foliko 1.1.1 → 1.1.2
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/.agent/data/weixin-media/2026-04-08/img_1775618677512.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619073340.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619097536.jpg +0 -0
- package/.agent/data/weixin-media/2026-04-08/img_1775619209388.jpg +0 -0
- package/.agent/plugins/poster-plugin/package.json +2 -1
- package/.agent/plugins/poster-plugin/src/canvas.js +70 -7
- package/.agent/plugins/poster-plugin/src/components/barcode.js +120 -0
- package/.agent/plugins/poster-plugin/src/components/bubble.js +153 -0
- package/.agent/plugins/poster-plugin/src/components/button.js +124 -0
- package/.agent/plugins/poster-plugin/src/components/cta.js +26 -24
- package/.agent/plugins/poster-plugin/src/components/featureGrid.js +22 -17
- package/.agent/plugins/poster-plugin/src/components/frame.js +230 -0
- package/.agent/plugins/poster-plugin/src/components/highlightText.js +144 -0
- package/.agent/plugins/poster-plugin/src/components/icon.js +94 -0
- package/.agent/plugins/poster-plugin/src/components/index.js +19 -0
- package/.agent/plugins/poster-plugin/src/components/listItem.js +6 -5
- package/.agent/plugins/poster-plugin/src/components/qrcode.js +74 -0
- package/.agent/plugins/poster-plugin/src/components/ribbon.js +193 -0
- package/.agent/plugins/poster-plugin/src/components/seal.js +146 -0
- package/.agent/plugins/poster-plugin/src/components/table.js +17 -9
- package/.agent/plugins/poster-plugin/src/components/tagCloud.js +24 -17
- package/.agent/plugins/poster-plugin/src/components/timeline.js +24 -12
- package/.agent/plugins/poster-plugin/src/composer.js +392 -150
- package/.agent/plugins/poster-plugin/src/elements/background.js +36 -4
- package/.agent/plugins/poster-plugin/src/elements/image.js +4 -47
- package/.agent/plugins/poster-plugin/src/elements/index.js +2 -0
- package/.agent/plugins/poster-plugin/src/elements/richText.js +230 -0
- package/.agent/plugins/poster-plugin/src/elements/svg.js +35 -19
- package/.agent/plugins/poster-plugin/src/index.js +430 -7
- package/.agent/plugins/poster-plugin/src/utils/imageLoader.js +84 -0
- package/.agent/plugins/poster-plugin/test-background.svg +1 -0
- package/.agent/plugins/poster-plugin/test-full-poster.svg +2 -0
- package/.agent/plugins/poster-plugin/test-image.png +0 -0
- package/.agent/sessions/cli_default.json +1089 -145
- package/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json +8902 -0
- package/.claude/settings.local.json +6 -1
- package/output/beef-love-poster.png +0 -0
- package/output/international-news-daily.png +0 -0
- package/package.json +2 -1
- package/plugins/extension-executor-plugin.js +33 -32
- package/plugins/file-system-plugin.js +4 -19
- package/plugins/subagent-plugin.js +37 -14
- package/plugins/weixin-plugin.js +167 -47
- package/poster-test-2.png +0 -0
- package/skills/poster-guide/SKILL.md +497 -5
- package/src/core/agent-chat.js +141 -8
- package/src/core/agent.js +6 -3
- package/calc_tokens_weixin.js +0 -81
- package/foliko-creative-3.png +0 -0
- package/foliko-creative-4.png +0 -0
- package/foliko-creative-5.png +0 -0
- package/story-cover-book-v2.png +0 -0
- package/story-cover-japanese-1.png +0 -0
- package/story-cover-japanese-2.png +0 -0
- package/story-cover-japanese-3.png +0 -0
- package/story-cover-moran.png +0 -0
- package/undefined.png +0 -0
package/src/core/agent.js
CHANGED
|
@@ -334,6 +334,8 @@ class Agent extends EventEmitter {
|
|
|
334
334
|
desc += ' - 根据上述【子 Agent 匹配表】,将任务委托给最匹配的子Agent处理\n';
|
|
335
335
|
desc += ' - 使用 subagent_call 工具并指定 agentName 来委托任务\n';
|
|
336
336
|
desc += ' - 只有当没有匹配的子Agent时,才直接调用工具\n';
|
|
337
|
+
desc +=
|
|
338
|
+
' - 子Agent返回结果后,必须将结果中的 result 字段内容整理后呈现给用户,不要直接输出 JSON 对象\n';
|
|
337
339
|
|
|
338
340
|
return desc.trim();
|
|
339
341
|
}
|
|
@@ -523,20 +525,21 @@ class Agent extends EventEmitter {
|
|
|
523
525
|
5. **结果导向**:调用工具后,基于返回结果回答,不要重复工具的内部实现细节。
|
|
524
526
|
6. **多步骤任务**:复杂任务拆解为多个工具调用,逐步完成,每步基于结果决定下一步。
|
|
525
527
|
7. **步骤未完成必须提示继续**:如果任务需要多步骤操作,在返回前必须明确告知用户当前进度和下一步操作。如果回复内容为空或不完整,必须说明"步骤进行中,请继续"。
|
|
526
|
-
|
|
528
|
+
8. **子Agent结果必须完整呈现**:调用 subagent_call 后,工具返回的内容就是子Agent的查询结果,**必须将返回内容完整地呈现给用户**,不要省略、截断或只说"以上是..."就结束。
|
|
527
529
|
|
|
528
530
|
【响应规范】
|
|
529
531
|
- 直接给出结论或结果,不说"我需要..."、"我建议..."等铺垫话术
|
|
530
532
|
- 如果工具返回错误,说明错误原因并给出解决建议
|
|
531
533
|
- 如果信息不足,先调用工具获取必要信息,不要假设或猜测
|
|
532
534
|
- **重要:如果任务需要多步骤操作,在回复末尾必须提示用户"请继续"或"是否继续下一步"**
|
|
533
|
-
|
|
535
|
+
- **调用子Agent后,必须完整展示返回内容,不允许省略**
|
|
534
536
|
|
|
535
537
|
【禁止事项】
|
|
536
538
|
- 不调用工具就直接回答
|
|
537
539
|
- 编造不存在的数据、文件、订单、用户等信息
|
|
538
540
|
- 回复含糊不清,让用户无法确定答案是否正确
|
|
539
|
-
-
|
|
541
|
+
- **多步骤任务未完成就结束,不提示用户继续**
|
|
542
|
+
- **省略子Agent返回的内容,或只说"以上是..."没有实际内容**`;
|
|
540
543
|
}
|
|
541
544
|
|
|
542
545
|
/**
|
package/calc_tokens_weixin.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
|
|
3
|
-
function encode(text) {
|
|
4
|
-
if (!text || typeof text !== 'string') return 0;
|
|
5
|
-
const cleanText = text.replace(/\0+/g, '').replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '').slice(0, 100000);
|
|
6
|
-
if (!cleanText) return 0;
|
|
7
|
-
const chineseChars = (cleanText.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g) || []).length;
|
|
8
|
-
const englishChars = cleanText.length - chineseChars;
|
|
9
|
-
const chineseTokens = chineseChars / 2;
|
|
10
|
-
const englishTokens = englishChars / 4;
|
|
11
|
-
return Math.ceil(chineseTokens + englishTokens);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const filePath = 'D:/code/vb-agent/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json';
|
|
15
|
-
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
16
|
-
|
|
17
|
-
let totalTokens = 0;
|
|
18
|
-
let totalChars = 0;
|
|
19
|
-
let largeMessages = [];
|
|
20
|
-
const messages = data.messages || [];
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < messages.length; i++) {
|
|
23
|
-
const msg = messages[i];
|
|
24
|
-
let msgTokens = 4;
|
|
25
|
-
let msgChars = 0;
|
|
26
|
-
|
|
27
|
-
if (typeof msg.content === 'string') {
|
|
28
|
-
msgTokens += encode(msg.content);
|
|
29
|
-
msgChars += msg.content.length;
|
|
30
|
-
} else if (Array.isArray(msg.content)) {
|
|
31
|
-
for (const part of msg.content) {
|
|
32
|
-
if (!part || typeof part !== 'object') continue;
|
|
33
|
-
if (part.text) {
|
|
34
|
-
const text = String(part.text);
|
|
35
|
-
msgTokens += encode(text);
|
|
36
|
-
msgChars += text.length;
|
|
37
|
-
}
|
|
38
|
-
if (part.type === 'tool-result' && part.output) {
|
|
39
|
-
let outputText = '';
|
|
40
|
-
if (typeof part.output === 'string') {
|
|
41
|
-
outputText = part.output;
|
|
42
|
-
} else if (part.output && part.output.value) {
|
|
43
|
-
outputText = String(part.output.value);
|
|
44
|
-
} else if (part.output && part.output.html) {
|
|
45
|
-
outputText = part.output.html;
|
|
46
|
-
} else if (part.output) {
|
|
47
|
-
outputText = JSON.stringify(part.output);
|
|
48
|
-
}
|
|
49
|
-
msgTokens += encode(outputText);
|
|
50
|
-
msgChars += outputText.length;
|
|
51
|
-
}
|
|
52
|
-
if (part.type === 'tool_use' && part.input) {
|
|
53
|
-
const inputStr = JSON.stringify(part.input);
|
|
54
|
-
msgTokens += encode(inputStr);
|
|
55
|
-
msgChars += inputStr.length;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
} else if (msg.content && typeof msg.content === 'object') {
|
|
59
|
-
try {
|
|
60
|
-
const str = JSON.stringify(msg.content);
|
|
61
|
-
msgTokens += encode(str);
|
|
62
|
-
msgChars += str.length;
|
|
63
|
-
} catch (e) {}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
totalTokens += msgTokens;
|
|
67
|
-
totalChars += msgChars;
|
|
68
|
-
|
|
69
|
-
if (msgTokens > 3000) {
|
|
70
|
-
largeMessages.push({ index: i, role: msg.role, tokens: msgTokens, chars: msgChars });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
console.log('Messages:', messages.length);
|
|
75
|
-
console.log('Total chars:', totalChars);
|
|
76
|
-
console.log('Total tokens (approx):', totalTokens);
|
|
77
|
-
console.log('File size:', fs.statSync(filePath).size, 'bytes');
|
|
78
|
-
console.log('\nLarge messages (>3000 tokens):');
|
|
79
|
-
largeMessages.forEach(m => {
|
|
80
|
-
console.log(` [${m.index}] ${m.role}: ${m.tokens} tokens, ${m.chars} chars`);
|
|
81
|
-
});
|
package/foliko-creative-3.png
DELETED
|
Binary file
|
package/foliko-creative-4.png
DELETED
|
Binary file
|
package/foliko-creative-5.png
DELETED
|
Binary file
|
package/story-cover-book-v2.png
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/story-cover-moran.png
DELETED
|
Binary file
|
package/undefined.png
DELETED
|
Binary file
|