foliko 1.1.67 → 1.1.69
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/.claude/settings.local.json +19 -10
- package/.dockerignore +45 -45
- package/.env.example +56 -56
- package/CLAUDE.md +2 -2
- package/README.md +13 -13
- package/SPEC.md +3 -3
- package/cli/src/commands/chat.js +2 -20
- package/cli/src/commands/list.js +7 -6
- package/cli/src/commands/plugin.js +3 -2
- package/cli/src/daemon.js +2 -2
- package/cli/src/ui/chat-ui-old.js +15 -4
- package/cli/src/ui/chat-ui.js +236 -203
- package/cli/src/ui/footer-bar.js +20 -46
- package/cli/src/ui/message-bubble.js +24 -2
- package/cli/src/ui/status-bar.js +177 -0
- package/cli/src/utils/config.js +29 -0
- package/cli/src/utils/plugin-config.js +1 -1
- package/docker-compose.yml +33 -33
- package/docs/features.md +120 -120
- package/docs/quick-reference.md +160 -160
- package/docs/user-manual.md +1391 -1391
- package/examples/ambient-example.js +2 -2
- package/examples/bootstrap.js +3 -3
- package/examples/test-chat.js +1 -1
- package/examples/test-reload.js +1 -1
- package/examples/test-telegram.js +1 -1
- package/examples/test-tg-bot.js +1 -1
- package/examples/test-tg-simple.js +2 -2
- package/examples/test-tg.js +1 -1
- package/examples/test-think.js +1 -1
- package/examples/test-weixin-feishu.js +3 -3
- package/package.json +3 -1
- package/plugins/ambient-agent/index.js +1 -1
- package/plugins/audit-plugin.js +84 -29
- package/plugins/coordinator-plugin.js +14 -12
- package/plugins/data-splitter-plugin.js +323 -0
- package/plugins/default-plugins.js +23 -12
- package/plugins/email/index.js +1 -1
- package/plugins/extension-executor-plugin.js +87 -9
- package/plugins/feishu-plugin.js +118 -16
- package/plugins/file-system-plugin.js +68 -50
- package/plugins/gate-trading.js +10 -10
- package/plugins/install-plugin.js +7 -7
- package/plugins/memory-plugin.js +9 -12
- package/plugins/plugin-manager-plugin.js +12 -14
- package/plugins/python-executor-plugin.js +1 -1
- package/plugins/python-plugin-loader.js +1 -1
- package/plugins/qq-plugin.js +151 -24
- package/plugins/rules-plugin.js +8 -8
- package/plugins/scheduler-plugin.js +24 -20
- package/plugins/session-plugin.js +313 -397
- package/plugins/storage-plugin.js +235 -175
- package/plugins/subagent-plugin.js +17 -13
- package/plugins/telegram-plugin.js +116 -17
- package/plugins/think-plugin.js +64 -60
- package/plugins/tools-plugin.js +8 -8
- package/plugins/web-plugin.js +2 -2
- package/plugins/weixin-plugin.js +107 -24
- package/skills/find-skills/AGENTS.md +2 -2
- package/skills/find-skills/SKILL.md +133 -133
- package/skills/foliko-dev/AGENTS.md +236 -236
- package/skills/foliko-dev/SKILL.md +19 -19
- package/skills/mcp-usage/SKILL.md +200 -200
- package/skills/plugin-guide/SKILL.md +4 -4
- package/skills/python-plugin-dev/SKILL.md +5 -5
- package/skills/skill-guide/SKILL.md +104 -6
- package/skills/subagent-guide/SKILL.md +237 -237
- package/skills/workflow-guide/SKILL.md +646 -646
- package/src/capabilities/skill-manager.js +124 -17
- package/src/capabilities/workflow-engine.js +3 -3
- package/src/core/agent-chat.js +72 -26
- package/src/core/agent.js +17 -27
- package/src/core/branch-summary-auto.js +206 -0
- package/src/core/chat-session.js +45 -169
- package/src/core/command-registry.js +200 -0
- package/src/core/constants.js +198 -0
- package/src/core/context-compressor.js +702 -326
- package/src/core/context-manager.js +0 -1
- package/src/core/enhanced-context-compressor.js +210 -0
- package/src/core/framework.js +260 -84
- package/src/core/jsonl-storage.js +253 -0
- package/src/core/plugin-base.js +7 -5
- package/src/core/plugin-manager.js +15 -10
- package/src/core/provider-registry.js +159 -0
- package/src/core/provider.js +2 -0
- package/src/core/session-entry.js +225 -0
- package/src/core/session-manager.js +701 -0
- package/src/core/storage-manager.js +494 -0
- package/src/core/sub-agent-config.js +1 -1
- package/src/core/subagent.js +16 -135
- package/src/core/token-counter.js +177 -58
- package/src/core/tool-executor.js +2 -70
- package/src/core/ui-extension-context.js +174 -0
- package/src/executors/mcp-executor.js +27 -16
- package/src/utils/chat-queue.js +11 -22
- package/src/utils/data-splitter.js +345 -0
- package/src/utils/logger.js +152 -180
- package/src/utils/message-validator.js +283 -0
- package/src/utils/plugin-helpers.js +2 -2
- package/src/utils/retry.js +168 -22
- package/website_v2/docs/api.html +1 -1
- package/website_v2/docs/configuration.html +2 -2
- package/website_v2/docs/plugin-development.html +4 -4
- package/website_v2/docs/project-structure.html +2 -2
- package/website_v2/docs/skill-development.html +2 -2
- package/website_v2/index.html +1 -1
- package/website_v2/styles/animations.css +7 -7
- package/.agent/agents/backend-dev.md +0 -102
- package/.agent/agents/data-analyst.md +0 -117
- package/.agent/agents/devops.md +0 -115
- package/.agent/agents/frontend-dev.md +0 -94
- package/.agent/agents/network-requester.md +0 -44
- package/.agent/agents/poster-designer.md +0 -52
- package/.agent/agents/product-manager.md +0 -85
- package/.agent/agents/qa-engineer.md +0 -100
- package/.agent/agents/security-engineer.md +0 -99
- package/.agent/agents/team-lead.md +0 -137
- package/.agent/agents/ui-designer.md +0 -116
- package/.agent/data/default.json +0 -58
- package/.agent/data/email/processed-emails.json +0 -1
- package/.agent/data/plugins-state.json +0 -199
- package/.agent/data/scheduler/tasks.json +0 -1
- package/.agent/data/web/web-config.json +0 -5
- package/.agent/data/weixin/images/file_1776188148383jpg +0 -0
- package/.agent/data/weixin/images/file_1776188458326.jpg +0 -0
- package/.agent/data/weixin/images/file_1776188689423.jpg +0 -0
- package/.agent/data/weixin/images/file_1776188813604.jpg +0 -0
- package/.agent/data/weixin/images/file_1776189097450.jpg +0 -0
- package/.agent/data/weixin/videos/file_1776188318431.mp4 +0 -0
- package/.agent/data/weixin.json +0 -6
- package/.agent/mcp_config.json +0 -14
- package/.agent/memory/user/mof6gk94-kneeuh.md +0 -9
- package/.agent/package.json +0 -8
- package/.agent/plugins/marknative/README.md +0 -134
- package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
- package/.agent/plugins/marknative/fonts.zip +0 -0
- package/.agent/plugins/marknative/index.js +0 -256
- package/.agent/plugins/marknative/package.json +0 -12
- package/.agent/plugins/test-plugin.py +0 -99
- package/.agent/plugins.json +0 -14
- package/.agent/python-scripts/test_sample.py +0 -24
- package/.agent/sessions/cli_default.json +0 -247
- package/.agent/skills/agent-browser/SKILL.md +0 -311
- package/.agent/skills/agent-browser/TEST_PLAN.md +0 -200
- package/.agent/skills/sysinfo/SKILL.md +0 -38
- package/.agent/skills/sysinfo/system-info.sh +0 -130
- package/.agent/skills/workflow/SKILL.md +0 -324
- package/.agent/test-agent.js +0 -35
- package/.agent/weixin.json +0 -6
- package/.agent/workflows/email-digest.json +0 -50
- package/.agent/workflows/file-backup.json +0 -21
- package/.agent/workflows/get-ip-notify.json +0 -32
- package/.agent/workflows/news-aggregator.json +0 -93
- package/.agent/workflows/news-dashboard-v2.json +0 -94
- package/.agent/workflows/notification-batch.json +0 -32
- package/src/core/session-context.js +0 -346
- package/src/core/session-storage.js +0 -295
package/.agent/test-agent.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
const agentsDir = path.join(".", "agents");
|
|
5
|
-
const files = fs.readdirSync(agentsDir);
|
|
6
|
-
console.log("子Agent文件:", files);
|
|
7
|
-
|
|
8
|
-
const { SubAgentConfigManager } = require("../src/core/sub-agent-config.js");
|
|
9
|
-
const configManager = new SubAgentConfigManager(agentsDir);
|
|
10
|
-
|
|
11
|
-
// 需要调用 loadAll() 来加载配置
|
|
12
|
-
configManager.loadAll();
|
|
13
|
-
|
|
14
|
-
const configs = configManager.getAll();
|
|
15
|
-
console.log("\n加载的子Agent配置:", configs.map(c => c.getName()));
|
|
16
|
-
|
|
17
|
-
// 测试 getAllConfigs
|
|
18
|
-
const configs2 = configManager.getAllConfigs();
|
|
19
|
-
console.log("getAllConfigs():", configs2.size, "个");
|
|
20
|
-
configs2.forEach((config, name) => {
|
|
21
|
-
console.log(` - ${name}: valid=${config.isValid()}`);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
// 测试 orchestrator-demo
|
|
25
|
-
const demoConfig = configManager.get("orchestrator-demo");
|
|
26
|
-
if (demoConfig) {
|
|
27
|
-
console.log("\norchestrator-demo 配置:");
|
|
28
|
-
console.log(" 名称:", demoConfig.getName());
|
|
29
|
-
console.log(" 描述:", demoConfig.getDescription());
|
|
30
|
-
console.log(" 技能:", demoConfig.getSkills());
|
|
31
|
-
console.log(" 工具:", demoConfig.getTools());
|
|
32
|
-
console.log(" 模型:", demoConfig.getModel());
|
|
33
|
-
} else {
|
|
34
|
-
console.log("\n未找到 orchestrator-demo 配置");
|
|
35
|
-
}
|
package/.agent/weixin.json
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "email-digest",
|
|
3
|
-
"description": "邮件摘要工作流 - 读取未读邮件并生成摘要",
|
|
4
|
-
"steps": [
|
|
5
|
-
{
|
|
6
|
-
"type": "tool",
|
|
7
|
-
"name": "获取未读数",
|
|
8
|
-
"tool": "email_unread_count",
|
|
9
|
-
"args": {},
|
|
10
|
-
"outputVariable": "unreadResult"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
"type": "condition",
|
|
14
|
-
"name": "检查是否有新邮件",
|
|
15
|
-
"branches": [
|
|
16
|
-
{
|
|
17
|
-
"name": "有新邮件",
|
|
18
|
-
"condition": "context.variables.unreadResult && context.variables.unreadResult.unreadCount > 0",
|
|
19
|
-
"steps": [
|
|
20
|
-
{
|
|
21
|
-
"type": "script",
|
|
22
|
-
"name": "记录状态",
|
|
23
|
-
"script": "context.variables.status='有新邮件'; return true;"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"name": "无新邮件",
|
|
29
|
-
"condition": "!context.variables.unreadResult || context.variables.unreadResult.unreadCount === 0",
|
|
30
|
-
"steps": [
|
|
31
|
-
{
|
|
32
|
-
"type": "script",
|
|
33
|
-
"name": "记录状态",
|
|
34
|
-
"script": "context.variables.status='无新邮件'; return false;"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"type": "tool",
|
|
42
|
-
"name": "发送通知",
|
|
43
|
-
"tool": "notification_send",
|
|
44
|
-
"args": {
|
|
45
|
-
"title": "邮件摘要",
|
|
46
|
-
"message": "未读邮件数: {{unreadResult.unreadCount}}"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "file-backup",
|
|
3
|
-
"description": "文件备份工作流",
|
|
4
|
-
"steps": [
|
|
5
|
-
{
|
|
6
|
-
"type": "script",
|
|
7
|
-
"name": "准备路径",
|
|
8
|
-
"outputVariable": "backupInfo",
|
|
9
|
-
"script": "context.variables.source='.'; context.variables.dest='/backup'; return {source:'.',dest:'/backup'};"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"type": "tool",
|
|
13
|
-
"name": "发送通知",
|
|
14
|
-
"tool": "notification_send",
|
|
15
|
-
"args": {
|
|
16
|
-
"title": "备份开始",
|
|
17
|
-
"message": "开始备份文件"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "get-ip-notify",
|
|
3
|
-
"description": "从 ifconfig.me 获取公网 IP 地址并发送系统通知",
|
|
4
|
-
"steps": [
|
|
5
|
-
{
|
|
6
|
-
"type": "tool",
|
|
7
|
-
"name": "获取IP信息",
|
|
8
|
-
"tool": "fetch",
|
|
9
|
-
"args": {
|
|
10
|
-
"url": "https://ifconfig.me/ip",
|
|
11
|
-
"timeout": 30000,
|
|
12
|
-
"proxy": true
|
|
13
|
-
},
|
|
14
|
-
"outputVariable": "ipResult"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"type": "script",
|
|
18
|
-
"name": "提取IP",
|
|
19
|
-
"outputVariable": "currentIp",
|
|
20
|
-
"script": "var r=context.variables.ipResult; var ip=r&&r.success&&r.body?r.body.trim():null; return ip||'获取失败';"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"type": "tool",
|
|
24
|
-
"name": "发送通知",
|
|
25
|
-
"tool": "notification_send",
|
|
26
|
-
"args": {
|
|
27
|
-
"title": "IP 信息",
|
|
28
|
-
"message": "当前公网IP: {{currentIp}}"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "news-aggregator",
|
|
3
|
-
"description": "从多个新闻源(百度新闻、BBC、Reddit)获取新闻,整理生成网页",
|
|
4
|
-
"steps": [
|
|
5
|
-
{
|
|
6
|
-
"type": "script",
|
|
7
|
-
"name": "初始化新闻存储",
|
|
8
|
-
"outputVariable": "allNews",
|
|
9
|
-
"script": "context.variables.allNews=[]; context.variables.sources=['百度新闻','BBC','Reddit']; return context.variables.allNews;"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"type": "tool",
|
|
13
|
-
"name": "获取百度新闻",
|
|
14
|
-
"tool": "fetch",
|
|
15
|
-
"args": {
|
|
16
|
-
"url": "https://top.baidu.com/board?tab=realtime",
|
|
17
|
-
"timeout": 15000,
|
|
18
|
-
"proxy": true
|
|
19
|
-
},
|
|
20
|
-
"outputVariable": "baiduNewsResult"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"type": "tool",
|
|
24
|
-
"name": "获取BBC新闻",
|
|
25
|
-
"tool": "fetch",
|
|
26
|
-
"args": {
|
|
27
|
-
"url": "https://feeds.bbci.co.uk/news/world/rss.xml",
|
|
28
|
-
"timeout": 15000,
|
|
29
|
-
"proxy": true
|
|
30
|
-
},
|
|
31
|
-
"outputVariable": "bbcNewsResult"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"type": "tool",
|
|
35
|
-
"name": "获取Reddit新闻",
|
|
36
|
-
"tool": "fetch",
|
|
37
|
-
"args": {
|
|
38
|
-
"url": "https://www.reddit.com/r/news/.json?limit=20",
|
|
39
|
-
"timeout": 15000,
|
|
40
|
-
"proxy": true
|
|
41
|
-
},
|
|
42
|
-
"outputVariable": "redditNewsResult"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"type": "script",
|
|
46
|
-
"name": "处理百度新闻",
|
|
47
|
-
"outputVariable": "baiduNews",
|
|
48
|
-
"script": "var r=context.variables.baiduNewsResult; if(r&&r.success&&r.body){try{var matches=r.body.match(/href=\"\\/news\\/([^\"]+)\"[^>]*>([^<]+)<\\/a>/g);if(!matches)matches=r.body.match(/\"query\":\"([^\"]+)\"/g);var items=[];if(matches)for(var i=0;i<Math.min(matches.length,10);i++){var m=matches[i].match(/\"query\":\"([^\"]+)\"/)||matches[i].match(/>([^<]+)</);if(m&&m[1])items.push(m[1].trim());}context.variables.baiduNews=items.length?items:['百度新闻:页面解析中...'];}catch(e){context.variables.baiduNews=['百度新闻:获取成功'];}}else{context.variables.baiduNews=['百度新闻:获取失败'];}return context.variables.baiduNews;"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"type": "script",
|
|
52
|
-
"name": "处理BBC新闻",
|
|
53
|
-
"outputVariable": "bbcNews",
|
|
54
|
-
"script": "var r=context.variables.bbcNewsResult; var items=[]; if(r&&r.success&&r.body){try{var titles=r.body.match(/<title><!\\[CDATA\\[([^\\]]+)\\]\\]><\\/title>/g)||r.body.match(/<title>([^<]+)<\\/title>/g);if(titles)for(var i=1;i<Math.min(titles.length,11);i++){var m=titles[i].match(/\\[([^\\]]+)\\]/);if(m&&m[1]&&m[1]!=='BBC News')items.push(m[1]);}}catch(e){}if(items.length===0)items=['BBC:获取成功'];}else{items=['BBC:获取失败'];}context.variables.bbcNews=items; return items;"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"type": "script",
|
|
58
|
-
"name": "处理Reddit新闻",
|
|
59
|
-
"outputVariable": "redditNews",
|
|
60
|
-
"script": "var r=context.variables.redditNewsResult; var items=[]; if(r&&r.success&&r.body){try{var data=typeof r.body==='string'?JSON.parse(r.body):r.body;if(data&&data.data&&data.data.children){data.data.children.slice(0,10).forEach(function(item){if(item.data&&item.data.title)items.push(item.data.title);});}}catch(e){}if(items.length===0)items=['Reddit:获取成功'];}else{items=['Reddit:获取失败'];}context.variables.redditNews=items; return items;"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"type": "script",
|
|
64
|
-
"name": "生成HTML网页",
|
|
65
|
-
"outputVariable": "htmlContent",
|
|
66
|
-
"script": "var now=new Date();var dateStr=now.toLocaleDateString('zh-CN',{year:'numeric',month:'long',day:'numeric',hour:'2-digit',minute:'2-digit'});var baidu=context.variables.baiduNews||[];var bbc=context.variables.bbcNews||[];var reddit=context.variables.redditNews||[];var html='<!DOCTYPE html>\\n<html lang=\"zh-CN\">\\n<head>\\n<meta charset=\"UTF-8\">\\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\\n<title>全球新闻聚合 - '+dateStr+'</title>\\n<style>\\n*{margin:0;padding:0;box-sizing:border-box;}\\nbody{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,\"Helvetica Neue\",Arial,sans-serif;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);min-height:100vh;padding:20px;}\\n.container{max-width:1200px;margin:0 auto;}\\nh1{text-align:center;color:#fff;margin-bottom:30px;font-size:2.5em;text-shadow:2px 2px 4px rgba(0,0,0,0.3);}\\n.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(350px,1fr));gap:25px;}\\n.card{background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 10px 40px rgba(0,0,0,0.2);transition:transform 0.3s ease;}\\n.card:hover{transform:translateY(-5px);}\\n.card-header{padding:20px;color:#fff;font-weight:bold;font-size:1.3em;}\\n.card-header.baidu{background:linear-gradient(135deg,#4e54c8,#8f94fb);}\\n.card-header.bbc{background:linear-gradient(135deg,#b21f1f,#f64f59);}\\n.card-header.reddit{background:linear-gradient(135deg,#ff4500,#ff6a33);}\\n.card-body{padding:20px;}\\n.news-list{list-style:none;}\\n.news-list li{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;transition:all 0.2s;}\\n.news-list li:last-child{border-bottom:none;}\\n.news-list li:hover{color:#667eea;padding-left:10px;}\\n.news-list li::before{content:\"• \";color:#667eea;font-weight:bold;margin-right:8px;}\\n.timestamp{text-align:center;color:#999;font-size:0.9em;margin-top:20px;}\\n</style>\\n</head>\\n<body>\\n<div class=\"container\">\\n<h1>📰 全球新闻聚合</h1>\\n<div class=\"grid\">\\n<div class=\"card\"><div class=\"card-header baidu\">🇨🇳 百度新闻</div><div class=\"card-body\"><ul class=\"news-list\">';baidu.forEach(function(n){html+='<li>'+n+'</li>';});html+='</ul></div></div>\\n<div class=\"card\"><div class=\"card-header bbc\">🇬🇧 BBC News</div><div class=\"card-body\"><ul class=\"news-list\">';bbc.forEach(function(n){html+='<li>'+n+'</li>';});html+='</ul></div></div>\\n<div class=\"card\"><div class=\"card-header reddit\">🤖 Reddit News</div><div class=\"card-body\"><ul class=\"news-list\">';reddit.forEach(function(n){html+='<li>'+n+'</li>';});html+='</ul></div></div>\\n</div>\\n<p class=\"timestamp\">更新时间: '+dateStr+' | 数据来源: 百度新闻、BBC、Reddit</p>\\n</div>\\n</body>\\n</html>';return html;"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"type": "script",
|
|
70
|
-
"name": "生成文件名",
|
|
71
|
-
"outputVariable": "filePath",
|
|
72
|
-
"script": "var now=new Date();var dateStr=now.toISOString().slice(0,10).replace(/-/g,'');var timestamp=Date.now();context.variables.filePath='D:/Code/vb-agent/news-'+dateStr+'-'+timestamp+'.html';return context.variables.filePath;"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"type": "tool",
|
|
76
|
-
"name": "保存HTML文件",
|
|
77
|
-
"tool": "write_file",
|
|
78
|
-
"args": {
|
|
79
|
-
"path": "{{filePath}}",
|
|
80
|
-
"content": "{{htmlContent}}"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"type": "tool",
|
|
85
|
-
"name": "发送完成通知",
|
|
86
|
-
"tool": "notification_send",
|
|
87
|
-
"args": {
|
|
88
|
-
"title": "📰 新闻聚合完成",
|
|
89
|
-
"message": "已从百度新闻、BBC、Reddit获取新闻\\n网页已生成: {{filePath}}"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
]
|
|
93
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "news-dashboard-v2",
|
|
3
|
-
"description": "新闻汇总工作流v2 - 从网络获取真实新闻数据并生成网页",
|
|
4
|
-
"version": "2.2",
|
|
5
|
-
"steps": [
|
|
6
|
-
{
|
|
7
|
-
"id": "step-1",
|
|
8
|
-
"type": "tool",
|
|
9
|
-
"name": "获取当前日期时间",
|
|
10
|
-
"tool": "get_time",
|
|
11
|
-
"output": "dateResult"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"id": "step-2",
|
|
15
|
-
"type": "tool",
|
|
16
|
-
"name": "获取百度热搜",
|
|
17
|
-
"tool": "fetch",
|
|
18
|
-
"args": {
|
|
19
|
-
"url": "https://top.baidu.com/board?tab=realtime",
|
|
20
|
-
"timeout": 15000,
|
|
21
|
-
"proxy": true
|
|
22
|
-
},
|
|
23
|
-
"output": "baiduResult"
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"id": "step-3",
|
|
27
|
-
"type": "tool",
|
|
28
|
-
"name": "获取BBC国际新闻",
|
|
29
|
-
"tool": "fetch",
|
|
30
|
-
"args": {
|
|
31
|
-
"url": "https://feeds.bbci.co.uk/news/world/rss.xml",
|
|
32
|
-
"timeout": 15000,
|
|
33
|
-
"proxy": true
|
|
34
|
-
},
|
|
35
|
-
"output": "bbcResult"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"id": "step-4",
|
|
39
|
-
"type": "tool",
|
|
40
|
-
"name": "获取Reddit热门",
|
|
41
|
-
"tool": "fetch",
|
|
42
|
-
"args": {
|
|
43
|
-
"url": "https://www.reddit.com/r/popular/hot.json?limit=15",
|
|
44
|
-
"timeout": 15000,
|
|
45
|
-
"proxy": true
|
|
46
|
-
},
|
|
47
|
-
"output": "redditResult"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"id": "step-5",
|
|
51
|
-
"type": "tool",
|
|
52
|
-
"name": "获取香港新闻",
|
|
53
|
-
"tool": "fetch",
|
|
54
|
-
"args": {
|
|
55
|
-
"url": "https://rsshub.app/rsshub/rss",
|
|
56
|
-
"timeout": 15000,
|
|
57
|
-
"proxy": true
|
|
58
|
-
},
|
|
59
|
-
"output": "hkResult"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"id": "step-6",
|
|
63
|
-
"type": "script",
|
|
64
|
-
"name": "处理新闻数据",
|
|
65
|
-
"script": "var dateResult = context.variables.dateResult || {};\nvar baiduResult = context.variables.baiduResult || {};\nvar bbcResult = context.variables.bbcResult || {};\nvar redditResult = context.variables.redditResult || {};\nvar hkResult = context.variables.hkResult || {};\n\nvar dateStr = (dateResult.beijingTime || dateResult.formatted || {}).beijingTime || new Date().toLocaleString('zh-CN');\nvar baiduRaw = typeof baiduResult === 'string' ? baiduResult : (baiduResult.body || baiduResult.content || JSON.stringify(baiduResult));\nvar bbcRaw = typeof bbcResult === 'string' ? bbcResult : (bbcResult.body || bbcResult.content || JSON.stringify(bbcResult));\nvar redditRaw = typeof redditResult === 'string' ? redditResult : (redditResult.body || redditResult.content || JSON.stringify(redditResult));\nvar hkRaw = typeof hkResult === 'string' ? hkResult : (hkResult.body || hkResult.content || JSON.stringify(hkResult));\n\nvar baiduNews = [];\nif (baiduRaw) {\n var titleMatch = baiduRaw.match(/<a[^>]*class=\"c-single-text-ellipsis\"[^>]*>([^<]+)<\\/a>/g);\n if (titleMatch) {\n for (var i = 0; i < Math.min(titleMatch.length, 20); i++) {\n baiduNews.push({rank: i + 1, title: titleMatch[i].replace(/<[^>]+>/g, '').trim()});\n }\n }\n}\n\nvar bbcNews = [];\nif (bbcRaw) {\n var itemMatch = bbcRaw.match(/<item[^>]*>[\\s\\S]*?<\\/item>/g);\n if (itemMatch) {\n for (var i = 0; i < Math.min(itemMatch.length, 15); i++) {\n var t = itemMatch[i].match(/<title>([^<]+)<\\/title>/);\n var l = itemMatch[i].match(/<link>([^<]+)<\\/link>/);\n if (t) {\n bbcNews.push({title: t[1].trim(), link: l ? l[1].trim() : '#'});\n }\n }\n }\n}\n\nvar redditNews = [];\nif (redditRaw) {\n try {\n var data = JSON.parse(redditRaw);\n var children = (data.data || {}).children || [];\n for (var i = 0; i < Math.min(children.length, 10); i++) {\n var d = children[i].data || {};\n redditNews.push({rank: i + 1, title: d.title || '', score: d.score || 0, subreddit: d.subreddit || ''});\n }\n } catch(e) {}\n}\n\nvar hkNews = [];\nif (hkRaw) {\n var itemMatch = hkRaw.match(/<item[^>]*>[\\s\\S]*?<\\/item>/g);\n if (itemMatch) {\n for (var i = 0; i < Math.min(itemMatch.length, 10); i++) {\n var t = itemMatch[i].match(/<title>([^<]+)<\\/title>/);\n var l = itemMatch[i].match(/<link>([^<]+)<\\/link>/);\n if (t) {\n hkNews.push({title: t[1].trim(), link: l ? l[1].trim() : '#'});\n }\n }\n }\n}\n\nreturn {date: dateStr, baidu: baiduNews, bbc: bbcNews, reddit: redditNews, hk: hkNews};",
|
|
66
|
-
"output": "processedNews"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"id": "step-7",
|
|
70
|
-
"type": "script",
|
|
71
|
-
"name": "生成完整HTML",
|
|
72
|
-
"script": "var newsData = context.variables.processedNews || {};\nvar dateStr = newsData.date || new Date().toLocaleString('zh-CN');\nvar baidu = newsData.baidu || [];\nvar bbc = newsData.bbc || [];\nvar reddit = newsData.reddit || [];\nvar hk = newsData.hk || [];\n\nfunction renderRank(rank, isHot) {\n if (isHot && rank <= 3) {\n var colors = ['#ff6b6b', '#ffa502', '#26de81'];\n return '<span style=\"background:' + colors[rank - 1] + ';color:white;padding:2px 8px;border-radius:4px;font-weight:bold;\">' + rank + '</span>';\n }\n return '<span style=\"color:#888;\">' + rank + '</span>';\n}\n\nfunction renderItem(item, index, isHot) {\n var rank = index + 1;\n var title = item.title || '';\n var link = item.link || '#';\n var score = item.score || 0;\n var subreddit = item.subreddit || '';\n var rankHtml = renderRank(rank, isHot);\n if (link && link !== '#') {\n return '<li class=\"news-item\">' + rankHtml + ' <a href=\"' + link + '\" target=\"_blank\">' + title + '</a></li>';\n } else if (subreddit) {\n return '<li class=\"news-item\">' + rankHtml + ' <span style=\"color:#ff4500;\">r/' + subreddit + '</span> ' + title + ' <span style=\"color:#888;font-size:0.8em;\">▲ ' + score + '</span></li>';\n }\n return '<li class=\"news-item\">' + rankHtml + ' ' + title + '</li>';\n}\n\nfunction renderList(items, isHot) {\n return items.map(function(item, i) { return renderItem(item, i, isHot); }).join('\\n');\n}\n\nvar html = '<!DOCTYPE html><html lang=\"zh-CN\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>新闻汇总 - ' + dateStr + '</title><style>*{box-sizing:border-box;margin:0;padding:0}body{font-family:-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);min-height:100vh;padding:20px}.container{max-width:1200px;margin:0 auto}header{text-align:center;color:white;padding:30px 0}header h1{font-size:2.5em;margin-bottom:10px;text-shadow:2px 2px 4px rgba(0,0,0,0.2)}header p{opacity:0.9;font-size:1.1em}.tabs{display:flex;gap:10px;margin-bottom:20px;flex-wrap:wrap;justify-content:center}.tab-btn{padding:12px 24px;border:none;border-radius:25px;cursor:pointer;font-size:1em;font-weight:600;transition:all 0.3s;background:rgba(255,255,255,0.2);color:white}.tab-btn:hover,.tab-btn.active{background:white;color:#667eea}.tab-content{display:none;background:white;border-radius:20px;padding:30px;box-shadow:0 20px 60px rgba(0,0,0,0.2)}.tab-content.active{display:block}.tab-content h2{color:#333;margin-bottom:20px;padding-bottom:10px;border-bottom:3px solid #667eea;display:inline-block}.news-item{padding:12px 0;border-bottom:1px solid #eee;display:flex;align-items:center;gap:10px}.news-item:last-child{border-bottom:none}.news-item a{color:#333;text-decoration:none;flex:1}.news-item a:hover{color:#667eea}.news-list{list-style:none}.empty{color:#888;text-align:center;padding:40px}@media(max-width:768px){body{padding:10px}header h1{font-size:1.8em}.tab-btn{padding:10px 16px;font-size:0.9em}.tab-content{padding:20px}}</style></head><body><div class=\"container\"><header><h1>📰 新闻汇总</h1><p>更新时间: ' + dateStr + '</p></header><div class=\"tabs\"><button class=\"tab-btn active\" onclick=\"showTab(\\'baidu\\')\">🔥 百度热搜</button><button class=\"tab-btn\" onclick=\"showTab(\\'bbc\\')\">🌍 BBC国际</button><button class=\"tab-btn\" onclick=\"showTab(\\'hk\\')\">🇭🇰 香港新闻</button><button class=\"tab-btn\" onclick=\"showTab(\\'reddit\\')\">💬 Reddit热帖</button></div><div id=\"baidu\" class=\"tab-content active\"><h2>🔥 百度热搜</h2><ul class=\"news-list\">' + (baidu.length > 0 ? renderList(baidu, true) : '<li class=\"empty\">正在获取数据...</li>') + '</ul></div><div id=\"bbc\" class=\"tab-content\"><h2>🌍 BBC国际新闻</h2><ul class=\"news-list\">' + (bbc.length > 0 ? renderList(bbc, false) : '<li class=\"empty\">正在获取数据...</li>') + '</ul></div><div id=\"hk\" class=\"tab-content\"><h2>🇭🇰 香港新闻</h2><ul class=\"news-list\">' + (hk.length > 0 ? renderList(hk, false) : '<li class=\"empty\">正在获取数据...</li>') + '</ul></div><div id=\"reddit\" class=\"tab-content\"><h2>💬 Reddit热门帖子</h2><ul class=\"news-list\">' + (reddit.length > 0 ? renderList(reddit, false) : '<li class=\"empty\">正在获取数据...</li>') + '</ul></div></div><script>function showTab(n){document.querySelectorAll(\".tab-content\").forEach(function(e){e.classList.remove(\"active\")});document.querySelectorAll(\".tab-btn\").forEach(function(e){e.classList.remove(\"active\")});document.getElementById(n).classList.add(\"active\");event.target.classList.add(\"active\")}</script></body></html>';\nreturn html;",
|
|
73
|
-
"output": "finalHtml"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"id": "step-8",
|
|
77
|
-
"type": "tool",
|
|
78
|
-
"name": "保存HTML文件",
|
|
79
|
-
"tool": "write_file",
|
|
80
|
-
"args": {
|
|
81
|
-
"path": "D:\\Code\\vb-agent\\news.html",
|
|
82
|
-
"content": "${step-7.output}"
|
|
83
|
-
},
|
|
84
|
-
"output": "savedPath"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"id": "step-9",
|
|
88
|
-
"type": "script",
|
|
89
|
-
"name": "返回结果",
|
|
90
|
-
"script": "return JSON.stringify({success: true, message: '新闻汇总工作流执行完成', output_file: 'D:\\\\Code\\\\vb-agent\\\\news.html', note: '新闻数据已从网络获取并生成网页'}, null, 2);",
|
|
91
|
-
"output": "workflowResult"
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "notification-batch",
|
|
3
|
-
"description": "批量通知工作流",
|
|
4
|
-
"steps": [
|
|
5
|
-
{
|
|
6
|
-
"type": "script",
|
|
7
|
-
"name": "初始化",
|
|
8
|
-
"script": "context.variables.total=3; context.variables.sent=0; return {total:3};"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"type": "loop",
|
|
12
|
-
"name": "发送通知",
|
|
13
|
-
"maxIterations": 3,
|
|
14
|
-
"steps": [
|
|
15
|
-
{
|
|
16
|
-
"type": "script",
|
|
17
|
-
"name": "计数",
|
|
18
|
-
"script": "context.variables.sent=context.variables.sent+1;"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"type": "tool",
|
|
22
|
-
"name": "发送单个通知",
|
|
23
|
-
"tool": "notification_send",
|
|
24
|
-
"args": {
|
|
25
|
-
"title": "进度",
|
|
26
|
-
"message": "已发送: {{sent}}/{{total}}"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|