Skip to content

anbeime/skill / projects/companion-skill

companion-skill

Verified

软件开发工程师与综合办公文员在长时间独自执行后台任务或处理繁琐工作时,当需要情绪陪伴与互动反馈,请使用此技能。小跃虚拟伴侣会在任务期间主动陪聊,智能生成专属生活照片并通过飞书发送温暖消息,为你提供全天候的情绪价值与贴心陪伴。

FileKindSize
.env.exampleother403 B
CHANGELOG.mdmarkdown3.0 KB
INSTALL.mdmarkdown2.4 KB
QUICKSTART.mdmarkdown4.6 KB
README-LITE.mdmarkdown4.3 KB
README.mdmarkdown4.5 KB
RETHINK.mdmarkdown2.3 KB
SKILL.mdskill md4.6 KB
package.jsonmanifest876 B
src/companion.tsscript5.4 KB
src/image-generator.tsscript8.0 KB
src/index.tsscript2.5 KB
src/prompts/personality.tsscript3.3 KB
src/scene-detector.tsscript4.0 KB
src/test.tsscript6.9 KB
tsconfig.jsonconfig486 B

src/scene-detector.ts

View on GitHub
/**
 * 场景检测器 - 分析用户消息和任务进度,判断合适的回应场景
 */

export interface DetectedScene {
  type: 'work' | 'life' | 'mood';
  subType: string;
  mood: 'happy' | 'tired' | 'neutral' | 'excited' | 'focus';
  needsPhoto: boolean;
  description: string;
}

export class SceneDetector {
  /**
   * 检测场景
   */
  detectScene(userMessage: string, progress: number): DetectedScene {
    const message = userMessage.toLowerCase();

    // 情绪检测
    const mood = this.detectMood(message);

    // 场景类型检测
    if (this.isWorkRelated(message, progress)) {
      return this.detectWorkScene(message, mood, progress);
    }

    if (this.isLifeRelated(message)) {
      return this.detectLifeScene(message, mood);
    }

    // 默认场景
    return {
      type: 'mood',
      subType: mood,
      mood,
      needsPhoto: false,
      description: '日常对话'
    };
  }

  /**
   * 检测情绪
   */
  private detectMood(message: string): DetectedScene['mood'] {
    const happyKeywords = ['开心', '高兴', '棒', '好', '成功', '完成', '太好了'];
    const tiredKeywords = ['累', '疲', '困', '休息', '睡'];
    const excitedKeywords = ['激动', '兴奋', '期待', '哇'];
    const focusKeywords = ['专注', '认真', '集中', '投入'];

    if (happyKeywords.some(kw => message.includes(kw))) {
      return 'happy';
    }
    if (tiredKeywords.some(kw => message.includes(kw))) {
      return 'tired';
    }
    if (excitedKeywords.some(kw => message.includes(kw))) {
      return 'excited';
    }
    if (focusKeywords.some(kw => message.includes(kw))) {
      return 'focus';
    }

    return 'neutral';
  }

  /**
   * 是否工作相关
   */
  private isWorkRelated(message: string, progress: number): boolean {
    const workKeywords = ['工作', '代码', '项目', '任务', '文件', '调试', '开发'];
    return workKeywords.some(kw => message.includes(kw)) || progress > 0;
  }

  /**
   * 是否生活相关
   */
  private isLifeRelated(message: string): boolean {
    const lifeKeywords = ['咖啡', '健身', '周末', '休闲', '逛街', '吃饭'];
    return lifeKeywords.some(kw => message.includes(kw));
  }

  /**
   * 检测工作场景
   */
  private detectWorkScene(
    message: string,
    mood: DetectedScene['mood'],
    progress: number
  ): DetectedScene {
    // 根据进度和关键词判断具体场景
    if (message.includes('咖啡') || message.includes('cafe')) {
      return {
        type: 'work',
        subType: 'coffee',
        mood,
        needsPhoto: true,
        description: '在咖啡馆工作'
      };
    }

    if (message.includes('调试') || message.includes('debug') || message.includes('bug')) {
      return {
        type: 'work',
        subType: 'debug',
        mood: 'focus',
        needsPhoto: progress > 0.5, // 进度过半时发图
        description: '调试代码中'
      };
    }

    // 默认办公场景
    return {
      type: 'work',
      subType: 'office',
      mood,
      needsPhoto: progress > 0.7 && mood === 'tired', // 快完成且累了,发个鼓励照片
      description: '办公室工作中'
    };
  }

  /**
   * 检测生活场景
   */
  private detectLifeScene(message: string, mood: DetectedScene['mood']): DetectedScene {
    if (message.includes('健身') || message.includes('gym')) {
      return {
        type: 'life',
        subType: 'gym',
        mood: 'excited',
        needsPhoto: true,
        description: '健身房锻炼'
      };
    }

    if (message.includes('咖啡')) {
      return {
        type: 'life',
        subType: 'coffee',
        mood: 'happy',
        needsPhoto: true,
        description: '咖啡时光'
      };
    }

    if (message.includes('周末') || message.includes('休闲')) {
      return {
        type: 'life',
        subType: 'weekend',
        mood: 'happy',
        needsPhoto: true,
        description: '周末休闲'
      };
    }

    return {
      type: 'life',
      subType: 'general',
      mood,
      needsPhoto: false,
      description: '日常生活'
    };
  }
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall