imtoagent 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +97 -97
  2. package/bin/imtoagent-real +197 -153
  3. package/bin/imtoagent.cjs +13 -5
  4. package/index.ts +106 -106
  5. package/modules/agent/claude-adapter.ts +6 -6
  6. package/modules/agent/claude.ts +6 -6
  7. package/modules/agent/codex-adapter.ts +13 -13
  8. package/modules/agent/codex-exec-server.ts +11 -11
  9. package/modules/agent/codex.ts +29 -29
  10. package/modules/agent/opencode-adapter.ts +17 -17
  11. package/modules/agent/opencode.ts +10 -10
  12. package/modules/capabilities.ts +33 -33
  13. package/modules/cli/setup.ts +164 -164
  14. package/modules/core/config.ts +5 -5
  15. package/modules/core/error.ts +8 -8
  16. package/modules/core/runtime.ts +10 -10
  17. package/modules/core/session.ts +4 -4
  18. package/modules/core/stats.ts +14 -14
  19. package/modules/core/types.ts +7 -7
  20. package/modules/im/feishu.ts +56 -56
  21. package/modules/im/telegram.ts +23 -23
  22. package/modules/im/wechat.ts +54 -54
  23. package/modules/im/wecom.ts +50 -50
  24. package/modules/media/feishu-inbound-adapter.ts +4 -4
  25. package/modules/media/resolver.ts +11 -11
  26. package/modules/media/telegram-inbound-adapter.ts +8 -8
  27. package/modules/prompt-builder.ts +12 -12
  28. package/modules/proxy/anthropic-proxy.ts +31 -31
  29. package/modules/proxy/codex-proxy.ts +18 -18
  30. package/modules/utils/backend-check.ts +12 -12
  31. package/modules/utils/paths.ts +8 -8
  32. package/package.json +1 -1
  33. package/scripts/postinstall.cjs +10 -10
  34. package/scripts/postinstall.ts +13 -13
  35. package/templates/soul.template/identity.md +5 -5
  36. package/templates/soul.template/profile.md +7 -7
  37. package/templates/soul.template/rules.md +5 -5
  38. package/templates/soul.template/skills.md +2 -2
  39. package/templates/soul.template/workspace.md +3 -3
@@ -25,65 +25,65 @@ export type UnifiedBlock =
25
25
  export function buildCapabilityPrompt(caps: IMCapabilities): string {
26
26
  const lines: string[] = [];
27
27
 
28
- // 总览
29
- lines.push('## IM 客户端环境');
30
- lines.push('你通过飞书(Lark)即时通讯与用户对话。你的回复会被网关解析为飞书原生消息格式。');
28
+ // Overview
29
+ lines.push('## IM Client Environment');
30
+ lines.push('You communicate with users through Feishu (Lark) instant messaging. Your responses are parsed by the gateway into native Feishu message formats.');
31
31
  lines.push('');
32
32
 
33
- // 文本限制
34
- lines.push(`**文本限制**:单条消息最多 ${caps.maxTextLength} 字符,超长会自动截断。`);
33
+ // Text limit
34
+ lines.push(`**Text limit**: Maximum ${caps.maxTextLength} characters per message. Longer messages are automatically truncated.`);
35
35
 
36
- // ========== 只能生成 parseToBlocks 支持的能力 ==========
36
+ // ========== Only generate capabilities supported by parseToBlocks ==========
37
37
 
38
- // 代码 — ``` 语法
38
+ // Code — ``` syntax
39
39
  if (caps.codeBlock) {
40
- lines.push('**代码输出**:当输出代码时,使用标准 markdown 代码块(\\```语言\\n代码\\n\\```)。');
41
- lines.push('⚠️ 注意:飞书对代码块的渲染有限,长代码建议使用折叠面板或分段输出,避免单条消息过长。');
40
+ lines.push('**Code output**: When outputting code, use standard markdown code blocks (\\```language\\ncode\\n\\```).');
41
+ lines.push('⚠️ Note: Feishu has limited code block rendering. For long code, consider collapsible panels or splitting output to avoid overly long messages.');
42
42
  }
43
43
 
44
- // 图片 — ![]() 语法
44
+ // Image — ![]() syntax
45
45
  if (caps.imageSend) {
46
- lines.push('**图片**:可以使用 markdown 图片语法 `![描述](URL)` 发送图片。支持本地 file:// 路径(如图表截图)和远程 URL。网关会自动渲染,无需额外上传步骤。');
46
+ lines.push('**Images**: You can send images using markdown syntax `![alt](URL)`. Supports local file:// paths (e.g., chart screenshots) and remote URLs. The gateway handles rendering automatically, no extra upload steps needed.');
47
47
  }
48
48
 
49
- // 表格 + 卡片 — | 语法(需要 cardMessage 容器来渲染)
49
+ // Tables + Cards — | syntax (requires cardMessage container to render)
50
50
  if (caps.cardMessage) {
51
- lines.push('**表格**:可以使用标准 markdown 表格语法来展示结构化数据。');
51
+ lines.push('**Tables**: You can use standard markdown table syntax to display structured data.');
52
52
  lines.push('```');
53
- lines.push('| 列A | 列B |');
54
- lines.push('| --- | --- |');
55
- lines.push('| 数据1 | 数据2 |');
53
+ lines.push('| ColA | ColB |');
54
+ lines.push('| ---- | ---- |');
55
+ lines.push('| Data1 | Data2 |');
56
56
  lines.push('```');
57
- lines.push('**卡片消息**:可以使用富文本卡片(多块内容会自动组合为一张卡片消息)。');
57
+ lines.push('**Card messages**: Rich-text cards are supported (multiple blocks are automatically combined into a single card message).');
58
58
  }
59
59
 
60
- // 文件发送 — fileSend + 本地路径语法
60
+ // File sending — fileSend + local path syntax
61
61
  if (caps.fileSend) {
62
- lines.push('**文件发送**:如果你生成了文件(如图表、CSV、代码文件等),在回复中直接使用以下语法即可发送,网关会自动完成上传和投递,你不需要调用任何额外工具:');
63
- lines.push('`📎 [文件名](file:///本地绝对路径)`');
64
- lines.push('例如:`📎 [分析结果.csv](file:///tmp/result.csv)`');
62
+ lines.push('**Sending files**: If you generate files (charts, CSVs, code files, etc.), use the following syntax in your reply and the gateway will handle upload and delivery automatically — no extra tools needed:');
63
+ lines.push('`📎 [filename](file:///absolute/local/path)`');
64
+ lines.push('Example: `📎 [analysis.csv](file:///tmp/result.csv)`');
65
65
  }
66
66
 
67
67
 
68
- // 语音发送 — audioSend + 本地路径语法
68
+ // Audio sending — audioSend + local path syntax
69
69
  if (caps.audioSend) {
70
- lines.push('**语音/音频**:如果你生成了音频文件(如语音合成、录音等),在回复中直接使用以下语法即可发送,网关会自动处理:');
71
- lines.push('`🎙️ [文件名](file:///本地绝对路径)`');
72
- lines.push('例如:`🎙️ [语音播报.mp3](file:///tmp/tts-output.mp3)`');
70
+ lines.push('**Audio**: If you generate audio files (TTS, recordings, etc.), use the following syntax and the gateway will handle it:');
71
+ lines.push('`🎙️ [filename](file:///absolute/local/path)`');
72
+ lines.push('Example: `🎙️ [announcement.mp3](file:///tmp/tts-output.mp3)`');
73
73
  }
74
74
 
75
75
  // 注:buttonAction 有 IM 能力但无 markdown 语法,不生成提示词
76
76
 
77
77
  lines.push('');
78
- lines.push('### 行为规则');
79
- lines.push('- 不要在回复中提及或尝试调用 lark-clifeishu 等第三方上传工具——网关会自动解析 📎 ![图片]() 语法并完成发送');
80
- lines.push('- **每次修改/创建/删除文件后,必须简要汇报结果**(如"已修改 xxx.ts,修复了 YYY 问题"),不要默默完成就结束');
81
- lines.push('- 任务完成后用一两句话总结做了什么');
78
+ lines.push('### Behavior Rules');
79
+ lines.push('- Do not mention or attempt to invoke third-party upload tools like lark-cli, feishu, etc. — the gateway automatically parses 📎 and ![image]() syntax and handles sending');
80
+ lines.push('- **After each file modification/creation/deletion, briefly report the result** (e.g., "Modified xxx.ts, fixed the YYY issue"), don\'t silently finish');
81
+ lines.push('- Summarize what you did in one or two sentences after completing a task');
82
82
  lines.push('');
83
- lines.push('### 格式转换规则');
84
- lines.push('- 你的回复会被按 markdown 格式解析为多个块(文本、代码、图片、卡片等)');
85
- lines.push('- 每个块会被渲染为对应的飞书原生元素');
86
- lines.push('- 不要提及这些技术细节,直接使用对应格式即可');
83
+ lines.push('### Format Conversion Rules');
84
+ lines.push('- Your reply is parsed as markdown into multiple blocks (text, code, images, cards, etc.)');
85
+ lines.push('- Each block is rendered as the corresponding native Feishu element');
86
+ lines.push('- Do not mention these technical details, just use the appropriate format directly');
87
87
 
88
88
  return lines.join('\n');
89
89
  }