imtoagent 0.3.3 → 0.3.5
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.
- package/README.md +97 -97
- package/bin/imtoagent-real +96 -96
- package/bin/imtoagent.cjs +1 -1
- package/index.ts +106 -106
- package/modules/agent/claude-adapter.ts +6 -6
- package/modules/agent/claude.ts +6 -6
- package/modules/agent/codex-adapter.ts +13 -13
- package/modules/agent/codex-exec-server.ts +11 -11
- package/modules/agent/codex.ts +29 -29
- package/modules/agent/opencode-adapter.ts +17 -17
- package/modules/agent/opencode.ts +10 -10
- package/modules/capabilities.ts +33 -33
- package/modules/cli/setup.ts +171 -163
- package/modules/core/config.ts +5 -5
- package/modules/core/error.ts +8 -8
- package/modules/core/runtime.ts +10 -10
- package/modules/core/session.ts +4 -4
- package/modules/core/stats.ts +14 -14
- package/modules/core/types.ts +7 -7
- package/modules/im/feishu.ts +56 -56
- package/modules/im/telegram.ts +23 -23
- package/modules/im/wechat.ts +54 -54
- package/modules/im/wecom.ts +50 -50
- package/modules/media/feishu-inbound-adapter.ts +4 -4
- package/modules/media/resolver.ts +11 -11
- package/modules/media/telegram-inbound-adapter.ts +8 -8
- package/modules/prompt-builder.ts +12 -12
- package/modules/proxy/anthropic-proxy.ts +39 -28
- package/modules/proxy/codex-proxy.ts +18 -18
- package/modules/utils/backend-check.ts +12 -12
- package/modules/utils/paths.ts +8 -8
- package/package.json +1 -1
- package/scripts/postinstall.cjs +10 -10
- package/scripts/postinstall.ts +13 -13
- package/templates/soul.template/identity.md +5 -5
- package/templates/soul.template/profile.md +7 -7
- package/templates/soul.template/rules.md +5 -5
- package/templates/soul.template/skills.md +2 -2
- package/templates/soul.template/workspace.md +3 -3
package/modules/capabilities.ts
CHANGED
|
@@ -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('
|
|
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(
|
|
33
|
+
// Text limit
|
|
34
|
+
lines.push(`**Text limit**: Maximum ${caps.maxTextLength} characters per message. Longer messages are automatically truncated.`);
|
|
35
35
|
|
|
36
|
-
// ==========
|
|
36
|
+
// ========== Only generate capabilities supported by parseToBlocks ==========
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// Code — ``` syntax
|
|
39
39
|
if (caps.codeBlock) {
|
|
40
|
-
lines.push('
|
|
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('
|
|
46
|
+
lines.push('**Images**: You can send images using markdown syntax ``. 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
|
-
//
|
|
49
|
+
// Tables + Cards — | syntax (requires cardMessage container to render)
|
|
50
50
|
if (caps.cardMessage) {
|
|
51
|
-
lines.push('
|
|
51
|
+
lines.push('**Tables**: You can use standard markdown table syntax to display structured data.');
|
|
52
52
|
lines.push('```');
|
|
53
|
-
lines.push('|
|
|
54
|
-
lines.push('|
|
|
55
|
-
lines.push('|
|
|
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
|
-
//
|
|
60
|
+
// File sending — fileSend + local path syntax
|
|
61
61
|
if (caps.fileSend) {
|
|
62
|
-
lines.push('
|
|
63
|
-
lines.push('`📎 [
|
|
64
|
-
lines.push('
|
|
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
|
-
//
|
|
68
|
+
// Audio sending — audioSend + local path syntax
|
|
69
69
|
if (caps.audioSend) {
|
|
70
|
-
lines.push('
|
|
71
|
-
lines.push('`🎙️ [
|
|
72
|
-
lines.push('
|
|
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('-
|
|
80
|
-
lines.push('-
|
|
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('-
|
|
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
|
}
|