foliko 1.1.3 → 1.1.4
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/agents/code-assistant.json +14 -0
- package/.agent/agents/email-assistant.json +14 -0
- package/.agent/agents/file-assistant.json +15 -0
- package/.agent/agents/system-assistant.json +15 -0
- package/.agent/agents/web-assistant.json +12 -0
- package/.agent/data/ambient/goals.json +50 -0
- package/.agent/data/ambient/memories.json +7 -0
- package/.agent/data/default.json +3 -412
- package/.agent/data/plugins-state.json +174 -173
- package/.agent/data/scheduler/tasks.json +1 -0
- package/.agent/memory/core.md +1 -0
- package/.agent/memory/project/mnn93ogy-ypjn27.md +9 -0
- package/.agent/memory/project/mnn98fqy-5nhc1u.md +25 -0
- package/.agent/memory/reference/mnq3oenw-46haj6.md +63 -0
- package/.agent/memory/reference/mnq5qxm2-mjoooh.md +116 -0
- package/.agent/memory/user/mnm67t9m-x8rekk.md +9 -0
- package/.agent/memory/user/mnn5mmqh-w6aktx.md +11 -0
- package/.agent/memory/user/mnnbfhhn-dk1bd1.md +22 -0
- package/.agent/package.json +8 -0
- package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
- package/.agent/plugins/daytona/README.md +89 -0
- package/.agent/plugins/daytona/index.js +377 -0
- package/.agent/plugins/daytona/package.json +12 -0
- package/.agent/plugins/marknative/README.md +134 -0
- package/.agent/plugins/marknative/fonts/SegoeUI Emoji.ttf +0 -0
- package/.agent/plugins/marknative/index.js +256 -0
- package/.agent/plugins/marknative/package.json +12 -0
- package/.agent/plugins/marknative/update-readme.js +134 -0
- package/.agent/plugins/poster-plugin/emojis/rocket.png +1 -0
- package/.agent/plugins/poster-plugin/fonts/SegoeUI Emoji.ttf +0 -0
- package/.agent/plugins/poster-plugin/src/elements/text.js +3 -1
- package/.agent/plugins/poster-plugin/src/fonts.js +10 -0
- package/.agent/plugins/poster-plugin/yarn.lock +1007 -0
- package/.agent/plugins/system-info/index.js +387 -0
- package/.agent/plugins/system-info/package.json +4 -0
- package/.agent/plugins/system-info/test.js +40 -0
- package/.agent/plugins.json +11 -5
- package/.agent/python-scripts/test_sample.py +24 -0
- package/.agent/sessions/cli_default.json +1869 -691
- package/.agent/skills/agent-browser/SKILL.md +311 -0
- package/.agent/skills/agent-browser/TEST_PLAN.md +200 -0
- package/.agent/skills/sysinfo/SKILL.md +38 -0
- package/.agent/skills/sysinfo/system-info.sh +130 -0
- package/.agent/skills/workflow/SKILL.md +324 -0
- package/.agent/weixin.json +6 -0
- package/.agent/workflows/email-digest.json +50 -0
- package/.agent/workflows/file-backup.json +21 -0
- package/.agent/workflows/get-ip-notify.json +32 -0
- package/.agent/workflows/news-aggregator.json +93 -0
- package/.agent/workflows/news-dashboard-v2.json +94 -0
- package/.agent/workflows/notification-batch.json +32 -0
- package/.claude/settings.local.json +1 -20
- package/.env.example +56 -56
- package/README.md +441 -441
- package/cli/src/commands/chat.js +22 -13
- package/cli/src/ui/chat-ui.js +50 -37
- package/output/emoji-segoe-test-v2.png +0 -0
- package/output/emoji-segoe-test.png +0 -0
- package/output/emoji-test.png +0 -0
- package/output/emoji-windows-test.png +0 -0
- package/output/foliko-emoji-poster.png +0 -0
- package/output/foliko-muji-poster-final.png +0 -0
- package/output/foliko-muji-poster-v2.png +0 -0
- package/output/foliko-muji-poster.png +0 -0
- package/output/foliko-share.png +0 -0
- package/output/progress-circle-test.png +0 -0
- package/output/vb-agent-poster.png +0 -0
- package/package.json +1 -2
- package/plugins/default-plugins.js +4 -3
- package/plugins/extension-executor-plugin.js +12 -91
- package/plugins/file-system-plugin.js +19 -4
- package/plugins/memory-plugin.js +33 -4
- package/plugins/subagent-plugin.js +14 -37
- package/plugins/weixin-plugin.js +40 -168
- package/skills/find-skills/AGENTS.md +162 -162
- package/skills/find-skills/SKILL.md +133 -133
- package/skills/poster-guide/SKILL.md +669 -1426
- package/src/core/agent-chat.js +439 -269
- package/src/core/agent.js +3 -6
- package/.agent/.shared/ui-ux-pro-max/data/charts.csv +0 -26
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +0 -97
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +0 -101
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +0 -31
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +0 -97
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +0 -24
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +0 -45
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +0 -53
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +0 -56
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +0 -53
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +0 -53
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +0 -51
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +0 -59
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +0 -52
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +0 -54
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +0 -61
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +0 -54
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +0 -51
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +0 -50
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +0 -59
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +0 -58
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +0 -101
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +0 -100
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +0 -31
- package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/core.cpython-313.pyc +0 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/core.py +0 -258
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +0 -1067
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +0 -106
- package/.agent/ARCHITECTURE.md +0 -288
- package/.agent/agents/ambient-agent.md +0 -57
- package/.agent/agents/debugger.md +0 -55
- package/.agent/agents/email-assistant.md +0 -49
- package/.agent/agents/file-manager.md +0 -42
- package/.agent/agents/python-developer.md +0 -60
- package/.agent/agents/scheduler.md +0 -59
- package/.agent/agents/web-developer.md +0 -45
- package/.agent/data/puppeteer-sessions/undefined.json +0 -6
- 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/mcp_config_updated.json +0 -12
- package/.agent/plugins/poster-plugin/fonts/NotoColorEmoji-Regular.ttf +0 -0
- package/.agent/plugins/puppeteer-plugin/README.md +0 -147
- package/.agent/plugins/puppeteer-plugin/index.js +0 -1418
- package/.agent/plugins/puppeteer-plugin/package.json +0 -9
- package/.agent/rules/GEMINI.md +0 -273
- package/.agent/rules/allow-rule.md +0 -77
- package/.agent/rules/log-rule.md +0 -83
- package/.agent/rules/security-rule.md +0 -93
- package/.agent/scripts/auto_preview.py +0 -148
- package/.agent/scripts/checklist.py +0 -217
- package/.agent/scripts/session_manager.py +0 -120
- package/.agent/scripts/verify_all.py +0 -327
- package/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json +0 -11097
- package/.agent/skills/api-patterns/SKILL.md +0 -81
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/scripts/api_validator.py +0 -211
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/SKILL.md +0 -75
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/app-builder/templates/SKILL.md +0 -39
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +0 -76
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +0 -92
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +0 -88
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +0 -88
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +0 -83
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +0 -90
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +0 -90
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +0 -122
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +0 -122
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +0 -169
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +0 -134
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +0 -83
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +0 -119
- package/.agent/skills/architecture/SKILL.md +0 -55
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/clean-code/SKILL.md +0 -201
- package/.agent/skills/doc.md +0 -177
- package/.agent/skills/frontend-design/SKILL.md +0 -418
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -311
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +0 -183
- package/.agent/skills/frontend-design/scripts/ux_audit.py +0 -722
- package/.agent/skills/frontend-design/typography-system.md +0 -345
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/i18n-localization/SKILL.md +0 -154
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +0 -241
- package/.agent/skills/mcp-builder/SKILL.md +0 -176
- package/.agent/skills/web-design-guidelines/SKILL.md +0 -57
- package/.agent/workflows/brainstorm.md +0 -113
- package/.agent/workflows/create.md +0 -59
- package/.agent/workflows/debug.md +0 -103
- package/.agent/workflows/deploy.md +0 -176
- package/.agent/workflows/enhance.md +0 -63
- package/.agent/workflows/orchestrate.md +0 -237
- package/.agent/workflows/plan.md +0 -89
- package/.agent/workflows/preview.md +0 -81
- package/.agent/workflows/simple-test.md +0 -42
- package/.agent/workflows/status.md +0 -86
- package/.agent/workflows/structured-orchestrate.md +0 -180
- package/.agent/workflows/test.md +0 -144
- package/.agent/workflows/ui-ux-pro-max.md +0 -296
- package/output/beef-love-poster.png +0 -0
- package/output/international-news-daily.png +0 -0
- package/poster-test-2.png +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: "mnnbfhhn-dk1bd1"
|
|
3
|
+
name: "何建成"
|
|
4
|
+
type: "user"
|
|
5
|
+
project: "null"
|
|
6
|
+
tags: []
|
|
7
|
+
created: "2026-04-06"
|
|
8
|
+
---
|
|
9
|
+
用户姓名:何建成
|
|
10
|
+
|
|
11
|
+
项目:Foliko - 简约的插件化 Agent 框架
|
|
12
|
+
工作目录:D:\Code\vb-agent
|
|
13
|
+
|
|
14
|
+
已发布插件:poster-plugin
|
|
15
|
+
|
|
16
|
+
创建的海报:
|
|
17
|
+
- foliko-poster.png (1080x1080)
|
|
18
|
+
- foliko-twitter-cover.png (1500x500)
|
|
19
|
+
- foliko-instagram-story.png (1080x1920)
|
|
20
|
+
- foliko-japanese-minimal.png (1080x1350)
|
|
21
|
+
- zen-card-japanese.png (800x1100)
|
|
22
|
+
- foliko-final-poster.png
|
|
Binary file
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Daytona Plugin
|
|
2
|
+
|
|
3
|
+
Daytona 云开发环境管理插件,用于在 Foliko 中创建和管理云开发环境(Sandbox)。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **沙箱管理**: 创建、启动、停止、删除沙箱环境
|
|
8
|
+
- **代码执行**: 在沙箱中执行 JavaScript/TypeScript 代码
|
|
9
|
+
- **文件操作**: 在沙箱中读写文件
|
|
10
|
+
- **临时沙箱**: 支持创建临时沙箱(自动清理)
|
|
11
|
+
- **多语言支持**: JavaScript、TypeScript、Python 等
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd .agent/plugins/daytona
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 配置
|
|
21
|
+
|
|
22
|
+
首次使用需要配置 API 密钥:
|
|
23
|
+
|
|
24
|
+
```javascript
|
|
25
|
+
daytona_configure({
|
|
26
|
+
apiKey: "your-daytona-api-key",
|
|
27
|
+
apiUrl: "https://app.daytona.io/api",
|
|
28
|
+
target: "default"
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 工具列表
|
|
33
|
+
|
|
34
|
+
### daytona_configure
|
|
35
|
+
配置 Daytona API 密钥和连接信息。
|
|
36
|
+
|
|
37
|
+
### daytona_create_sandbox
|
|
38
|
+
创建新的沙箱环境。
|
|
39
|
+
|
|
40
|
+
### daytona_get_sandbox
|
|
41
|
+
获取指定沙箱信息。
|
|
42
|
+
|
|
43
|
+
### daytona_list_sandboxes
|
|
44
|
+
列出所有沙箱。
|
|
45
|
+
|
|
46
|
+
### daytona_start_sandbox
|
|
47
|
+
启动沙箱。
|
|
48
|
+
|
|
49
|
+
### daytona_stop_sandbox
|
|
50
|
+
停止沙箱。
|
|
51
|
+
|
|
52
|
+
### daytona_delete_sandbox
|
|
53
|
+
删除沙箱。
|
|
54
|
+
|
|
55
|
+
### daytona_execute_code
|
|
56
|
+
在沙箱中执行代码。
|
|
57
|
+
|
|
58
|
+
### daytona_write_file
|
|
59
|
+
在沙箱中写入文件。
|
|
60
|
+
|
|
61
|
+
### daytona_read_file
|
|
62
|
+
在沙箱中读取文件。
|
|
63
|
+
|
|
64
|
+
### daytona_create_ephemeral_sandbox
|
|
65
|
+
创建临时沙箱(5分钟后自动删除)。
|
|
66
|
+
|
|
67
|
+
## 使用示例
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
// 1. 配置 API
|
|
71
|
+
daytona_configure({ apiKey: "your-key" })
|
|
72
|
+
|
|
73
|
+
// 2. 创建沙箱
|
|
74
|
+
daytona_create_sandbox({ language: "javascript" })
|
|
75
|
+
|
|
76
|
+
// 3. 执行代码
|
|
77
|
+
daytona_execute_code({ code: "console.log('Hello!')" })
|
|
78
|
+
|
|
79
|
+
// 4. 读写文件
|
|
80
|
+
daytona_write_file({ path: "/tmp/test.js", content: "..." })
|
|
81
|
+
daytona_read_file({ path: "/tmp/test.js" })
|
|
82
|
+
|
|
83
|
+
// 5. 清理
|
|
84
|
+
daytona_delete_sandbox({ sandboxId: "sandbox-id" })
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 许可证
|
|
88
|
+
|
|
89
|
+
Apache-2.0
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
const { z } = require('zod');
|
|
2
|
+
|
|
3
|
+
module.exports = function (Plugin) {
|
|
4
|
+
return class DaytonaPlugin extends Plugin {
|
|
5
|
+
constructor(config = {}) {
|
|
6
|
+
super();
|
|
7
|
+
this.name = 'daytona';
|
|
8
|
+
this.version = '1.0.0';
|
|
9
|
+
this.description = 'Daytona 云开发环境管理插件';
|
|
10
|
+
this.priority = 10;
|
|
11
|
+
this.daytona = null;
|
|
12
|
+
this.currentSandbox = null;
|
|
13
|
+
this.config = {};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
start(framework) {
|
|
17
|
+
this._framework = framework;
|
|
18
|
+
this._loadConfig();
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_loadConfig() {
|
|
23
|
+
try {
|
|
24
|
+
const storage = this._framework.pluginManager.get('storage');
|
|
25
|
+
if (storage) {
|
|
26
|
+
const store = storage.getStore();
|
|
27
|
+
const entry = store.get('daytona:config');
|
|
28
|
+
if (entry && entry.value) {
|
|
29
|
+
this.config = entry.value;
|
|
30
|
+
if (this.config.apiKey) {
|
|
31
|
+
const { Daytona } = require('@daytonaio/sdk');
|
|
32
|
+
this.daytona = new Daytona(this.config);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
// 配置加载失败,忽略
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
tools = {
|
|
42
|
+
daytona_configure: {
|
|
43
|
+
description: '配置 Daytona API 密钥和连接信息(配置会持久化保存)',
|
|
44
|
+
inputSchema: z.object({
|
|
45
|
+
apiKey: z.string().describe('Daytona API Key'),
|
|
46
|
+
apiUrl: z.string().optional().describe('Daytona API URL,默认为 https://app.daytona.io/api'),
|
|
47
|
+
target: z.string().optional().describe('目标区域,如 us, eu 等'),
|
|
48
|
+
organizationId: z.string().optional().describe('组织 ID(JWT 认证时需要)'),
|
|
49
|
+
}),
|
|
50
|
+
execute: async (args, framework) => {
|
|
51
|
+
try {
|
|
52
|
+
const { Daytona } = require('@daytonaio/sdk');
|
|
53
|
+
this.config = {
|
|
54
|
+
apiKey: args.apiKey,
|
|
55
|
+
};
|
|
56
|
+
if (args.apiUrl) this.config.apiUrl = args.apiUrl;
|
|
57
|
+
if (args.target) this.config.target = args.target;
|
|
58
|
+
if (args.organizationId) this.config.organizationId = args.organizationId;
|
|
59
|
+
|
|
60
|
+
this.daytona = new Daytona(this.config);
|
|
61
|
+
|
|
62
|
+
const storage = framework.pluginManager.get('storage');
|
|
63
|
+
if (storage) {
|
|
64
|
+
storage.setDirect('daytona:config', {
|
|
65
|
+
value: this.config,
|
|
66
|
+
updatedAt: new Date()
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
success: true,
|
|
72
|
+
message: 'Daytona 配置已保存',
|
|
73
|
+
config: {
|
|
74
|
+
apiUrl: this.config.apiUrl || 'https://app.daytona.io/api',
|
|
75
|
+
target: this.config.target || 'default',
|
|
76
|
+
hasApiKey: true
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
} catch (error) {
|
|
80
|
+
return { success: false, error: error.message };
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
daytona_create_sandbox: {
|
|
86
|
+
description: '创建 Daytona 沙箱环境',
|
|
87
|
+
inputSchema: z.object({
|
|
88
|
+
language: z.string().optional().describe('编程语言:javascript, typescript, python(默认 javascript)'),
|
|
89
|
+
name: z.string().optional().describe('沙箱名称'),
|
|
90
|
+
resources: z.object({
|
|
91
|
+
cpu: z.number().optional().describe('CPU 核心数'),
|
|
92
|
+
memory: z.number().optional().describe('内存大小(GiB)'),
|
|
93
|
+
disk: z.number().optional().describe('磁盘大小(GiB)'),
|
|
94
|
+
}).optional().describe('资源配置'),
|
|
95
|
+
envVars: z.record(z.string()).optional().describe('环境变量'),
|
|
96
|
+
ephemeral: z.boolean().optional().describe('是否临时沙箱(停止后自动删除)'),
|
|
97
|
+
autoStopInterval: z.number().optional().describe('自动停止间隔(分钟,0 禁用)'),
|
|
98
|
+
}),
|
|
99
|
+
execute: async (args) => {
|
|
100
|
+
try {
|
|
101
|
+
if (!this.daytona) {
|
|
102
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
103
|
+
}
|
|
104
|
+
const params = {
|
|
105
|
+
language: args.language || 'javascript',
|
|
106
|
+
};
|
|
107
|
+
if (args.name) params.name = args.name;
|
|
108
|
+
if (args.resources) params.resources = args.resources;
|
|
109
|
+
if (args.envVars) params.envVars = args.envVars;
|
|
110
|
+
if (args.ephemeral !== undefined) params.ephemeral = args.ephemeral;
|
|
111
|
+
if (args.autoStopInterval !== undefined) params.autoStopInterval = args.autoStopInterval;
|
|
112
|
+
const sandbox = await this.daytona.create(params);
|
|
113
|
+
this.currentSandbox = sandbox;
|
|
114
|
+
return {
|
|
115
|
+
success: true,
|
|
116
|
+
sandbox: {
|
|
117
|
+
id: sandbox.id,
|
|
118
|
+
name: sandbox.name,
|
|
119
|
+
state: sandbox.state,
|
|
120
|
+
language: sandbox.language,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return { success: false, error: error.message };
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
daytona_get_sandbox: {
|
|
130
|
+
description: '获取指定沙箱信息',
|
|
131
|
+
inputSchema: z.object({
|
|
132
|
+
sandboxId: z.string().describe('沙箱 ID 或名称'),
|
|
133
|
+
}),
|
|
134
|
+
execute: async (args) => {
|
|
135
|
+
try {
|
|
136
|
+
if (!this.daytona) {
|
|
137
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
138
|
+
}
|
|
139
|
+
const sandbox = await this.daytona.get(args.sandboxId);
|
|
140
|
+
return {
|
|
141
|
+
success: true,
|
|
142
|
+
sandbox: {
|
|
143
|
+
id: sandbox.id,
|
|
144
|
+
name: sandbox.name,
|
|
145
|
+
state: sandbox.state,
|
|
146
|
+
language: sandbox.language,
|
|
147
|
+
createdAt: sandbox.createdAt,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return { success: false, error: error.message };
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
daytona_list_sandboxes: {
|
|
157
|
+
description: '列出所有沙箱',
|
|
158
|
+
inputSchema: z.object({
|
|
159
|
+
labels: z.record(z.string()).optional().describe('标签过滤'),
|
|
160
|
+
page: z.number().optional().describe('页码'),
|
|
161
|
+
limit: z.number().optional().describe('每页数量'),
|
|
162
|
+
}),
|
|
163
|
+
execute: async (args) => {
|
|
164
|
+
try {
|
|
165
|
+
if (!this.daytona) {
|
|
166
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
167
|
+
}
|
|
168
|
+
const result = await this.daytona.list(args.labels, args.page, args.limit);
|
|
169
|
+
return {
|
|
170
|
+
success: true,
|
|
171
|
+
total: result.total,
|
|
172
|
+
page: result.page,
|
|
173
|
+
sandboxes: result.items.map((s) => ({
|
|
174
|
+
id: s.id,
|
|
175
|
+
name: s.name,
|
|
176
|
+
state: s.state,
|
|
177
|
+
language: s.language,
|
|
178
|
+
})),
|
|
179
|
+
};
|
|
180
|
+
} catch (error) {
|
|
181
|
+
return { success: false, error: error.message };
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
daytona_start_sandbox: {
|
|
187
|
+
description: '启动沙箱',
|
|
188
|
+
inputSchema: z.object({
|
|
189
|
+
sandboxId: z.string().describe('沙箱 ID 或名称'),
|
|
190
|
+
timeout: z.number().optional().describe('超时时间(秒)'),
|
|
191
|
+
}),
|
|
192
|
+
execute: async (args) => {
|
|
193
|
+
try {
|
|
194
|
+
if (!this.daytona) {
|
|
195
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
196
|
+
}
|
|
197
|
+
const sandbox = await this.daytona.get(args.sandboxId);
|
|
198
|
+
await this.daytona.start(sandbox, args.timeout || 60);
|
|
199
|
+
return { success: true, message: `沙箱 ${args.sandboxId} 启动成功` };
|
|
200
|
+
} catch (error) {
|
|
201
|
+
return { success: false, error: error.message };
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
daytona_stop_sandbox: {
|
|
207
|
+
description: '停止沙箱',
|
|
208
|
+
inputSchema: z.object({
|
|
209
|
+
sandboxId: z.string().describe('沙箱 ID 或名称'),
|
|
210
|
+
}),
|
|
211
|
+
execute: async (args) => {
|
|
212
|
+
try {
|
|
213
|
+
if (!this.daytona) {
|
|
214
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
215
|
+
}
|
|
216
|
+
const sandbox = await this.daytona.get(args.sandboxId);
|
|
217
|
+
await this.daytona.stop(sandbox);
|
|
218
|
+
return { success: true, message: `沙箱 ${args.sandboxId} 已停止` };
|
|
219
|
+
} catch (error) {
|
|
220
|
+
return { success: false, error: error.message };
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
daytona_delete_sandbox: {
|
|
226
|
+
description: '删除沙箱',
|
|
227
|
+
inputSchema: z.object({
|
|
228
|
+
sandboxId: z.string().describe('沙箱 ID 或名称'),
|
|
229
|
+
timeout: z.number().optional().describe('超时时间(秒)'),
|
|
230
|
+
}),
|
|
231
|
+
execute: async (args) => {
|
|
232
|
+
try {
|
|
233
|
+
if (!this.daytona) {
|
|
234
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
235
|
+
}
|
|
236
|
+
const sandbox = await this.daytona.get(args.sandboxId);
|
|
237
|
+
await this.daytona.delete(sandbox, args.timeout || 60);
|
|
238
|
+
if (this.currentSandbox?.id === sandbox.id) {
|
|
239
|
+
this.currentSandbox = null;
|
|
240
|
+
}
|
|
241
|
+
return { success: true, message: `沙箱 ${args.sandboxId} 已删除` };
|
|
242
|
+
} catch (error) {
|
|
243
|
+
return { success: false, error: error.message };
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
|
|
248
|
+
daytona_execute_code: {
|
|
249
|
+
description: '在沙箱中执行代码',
|
|
250
|
+
inputSchema: z.object({
|
|
251
|
+
code: z.string().describe('要执行的代码'),
|
|
252
|
+
sandboxId: z.string().optional().describe('沙箱 ID(不填使用当前沙箱)'),
|
|
253
|
+
}),
|
|
254
|
+
execute: async (args) => {
|
|
255
|
+
try {
|
|
256
|
+
if (!this.daytona) {
|
|
257
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
258
|
+
}
|
|
259
|
+
let sandbox = this.currentSandbox;
|
|
260
|
+
if (args.sandboxId) {
|
|
261
|
+
sandbox = await this.daytona.get(args.sandboxId);
|
|
262
|
+
}
|
|
263
|
+
if (!sandbox) {
|
|
264
|
+
return { success: false, error: '没有活动的沙箱,请先创建或指定沙箱' };
|
|
265
|
+
}
|
|
266
|
+
const result = await sandbox.process.executeCommand(args.code);
|
|
267
|
+
return {
|
|
268
|
+
success: true,
|
|
269
|
+
stdout: result.result,
|
|
270
|
+
stderr: result.stderr,
|
|
271
|
+
exitCode: result.exitCode,
|
|
272
|
+
};
|
|
273
|
+
} catch (error) {
|
|
274
|
+
return { success: false, error: error.message };
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
daytona_write_file: {
|
|
280
|
+
description: '在沙箱中写入文件',
|
|
281
|
+
inputSchema: z.object({
|
|
282
|
+
path: z.string().describe('文件路径'),
|
|
283
|
+
content: z.string().describe('文件内容'),
|
|
284
|
+
sandboxId: z.string().optional().describe('沙箱 ID(不填使用当前沙箱)'),
|
|
285
|
+
}),
|
|
286
|
+
execute: async (args) => {
|
|
287
|
+
try {
|
|
288
|
+
if (!this.daytona) {
|
|
289
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
290
|
+
}
|
|
291
|
+
let sandbox = this.currentSandbox;
|
|
292
|
+
if (args.sandboxId) {
|
|
293
|
+
sandbox = await this.daytona.get(args.sandboxId);
|
|
294
|
+
}
|
|
295
|
+
if (!sandbox) {
|
|
296
|
+
return { success: false, error: '没有活动的沙箱,请先创建或指定沙箱' };
|
|
297
|
+
}
|
|
298
|
+
await sandbox.fs.uploadFiles([{ source: Buffer.from(args.content), destination: args.path }]);
|
|
299
|
+
return { success: true, message: `文件 ${args.path} 写入成功` };
|
|
300
|
+
} catch (error) {
|
|
301
|
+
return { success: false, error: error.message };
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
|
|
306
|
+
daytona_read_file: {
|
|
307
|
+
description: '在沙箱中读取文件',
|
|
308
|
+
inputSchema: z.object({
|
|
309
|
+
path: z.string().describe('文件路径'),
|
|
310
|
+
sandboxId: z.string().optional().describe('沙箱 ID(不填使用当前沙箱)'),
|
|
311
|
+
}),
|
|
312
|
+
execute: async (args) => {
|
|
313
|
+
try {
|
|
314
|
+
if (!this.daytona) {
|
|
315
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
316
|
+
}
|
|
317
|
+
let sandbox = this.currentSandbox;
|
|
318
|
+
if (args.sandboxId) {
|
|
319
|
+
sandbox = await this.daytona.get(args.sandboxId);
|
|
320
|
+
}
|
|
321
|
+
if (!sandbox) {
|
|
322
|
+
return { success: false, error: '没有活动的沙箱,请先创建或指定沙箱' };
|
|
323
|
+
}
|
|
324
|
+
const result = await sandbox.process.executeCommand(`cat "${args.path}"`);
|
|
325
|
+
return { success: true, path: args.path, content: result.result || '' };
|
|
326
|
+
} catch (error) {
|
|
327
|
+
return { success: false, error: error.message };
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
daytona_create_ephemeral_sandbox: {
|
|
333
|
+
description: '创建临时沙箱(停止后自动删除)',
|
|
334
|
+
inputSchema: z.object({
|
|
335
|
+
language: z.string().optional().describe('编程语言(默认 javascript)'),
|
|
336
|
+
timeout: z.number().optional().describe('创建超时时间(秒,默认 60)'),
|
|
337
|
+
}),
|
|
338
|
+
execute: async (args) => {
|
|
339
|
+
try {
|
|
340
|
+
if (!this.daytona) {
|
|
341
|
+
return { success: false, error: '请先调用 daytona_configure 配置 API' };
|
|
342
|
+
}
|
|
343
|
+
const params = {
|
|
344
|
+
language: args.language || 'javascript',
|
|
345
|
+
ephemeral: true,
|
|
346
|
+
autoStopInterval: 5,
|
|
347
|
+
};
|
|
348
|
+
const sandbox = await this.daytona.create(params, { timeout: args.timeout || 60 });
|
|
349
|
+
this.currentSandbox = sandbox;
|
|
350
|
+
return {
|
|
351
|
+
success: true,
|
|
352
|
+
message: '临时沙箱创建成功(5分钟后自动停止并删除)',
|
|
353
|
+
sandbox: {
|
|
354
|
+
id: sandbox.id,
|
|
355
|
+
name: sandbox.name,
|
|
356
|
+
state: sandbox.state,
|
|
357
|
+
language: sandbox.language,
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
} catch (error) {
|
|
361
|
+
return { success: false, error: error.message };
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
install(framework) {
|
|
368
|
+
return this;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
uninstall(framework) {
|
|
372
|
+
if (this.currentSandbox && this.daytona) {
|
|
373
|
+
this.daytona.delete(this.currentSandbox).catch(() => {});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "daytona-plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Daytona 云开发环境管理插件",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"keywords": ["daytona", "sandbox", "cloud", "foliko", "plugin"],
|
|
7
|
+
"author": "",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@daytonaio/sdk": "^0.161.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# MarkNative Plugin
|
|
2
|
+
|
|
3
|
+
将 Markdown 转换为 PNG/SVG 图片的 Foliko 插件。基于 [marknative](https://github.com/liyown/marknative) 项目。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- **原生渲染**: 不需要浏览器,使用原生 2D canvas API
|
|
8
|
+
- **多种格式**: 支持 PNG 和 SVG 输出
|
|
9
|
+
- **丰富主题**: 10 种内置主题(浅色/深色)
|
|
10
|
+
- **代码高亮**: 支持代码块语法高亮
|
|
11
|
+
- **分页支持**: 自动分页处理长文档
|
|
12
|
+
- **双重模式**: 支持本地运行和 Daytona 沙箱运行
|
|
13
|
+
|
|
14
|
+
## 安装依赖
|
|
15
|
+
|
|
16
|
+
### 方式一:本地安装
|
|
17
|
+
```bash
|
|
18
|
+
cd .agent/plugins/marknative
|
|
19
|
+
npm install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 方式二:使用 Daytona 沙箱
|
|
23
|
+
确保已配置 Daytona 插件,插件将自动在沙箱中运行。
|
|
24
|
+
|
|
25
|
+
## 工具列表
|
|
26
|
+
|
|
27
|
+
### marknative_render
|
|
28
|
+
将 Markdown 渲染为图片(Base64 编码返回)
|
|
29
|
+
|
|
30
|
+
参数:
|
|
31
|
+
- `markdown`: Markdown 内容(必填)
|
|
32
|
+
- `format`: 输出格式 (png/svg)
|
|
33
|
+
- `theme`: 主题名称
|
|
34
|
+
- `singlePage`: 是否单页输出
|
|
35
|
+
- `codeTheme`: 代码高亮主题
|
|
36
|
+
- `useSandbox`: 是否强制使用沙箱执行
|
|
37
|
+
|
|
38
|
+
### marknative_render_to_file
|
|
39
|
+
将 Markdown 渲染为图片并保存到文件
|
|
40
|
+
|
|
41
|
+
参数:
|
|
42
|
+
- `markdown`: Markdown 内容(必填)
|
|
43
|
+
- `outputPath`: 输出文件路径(必填)
|
|
44
|
+
- `format`: 输出格式
|
|
45
|
+
- `theme`: 主题名称
|
|
46
|
+
- `codeTheme`: 代码高亮主题
|
|
47
|
+
|
|
48
|
+
### marknative_preview
|
|
49
|
+
预览渲染效果(返回第一页 Base64)
|
|
50
|
+
|
|
51
|
+
参数:
|
|
52
|
+
- `markdown`: Markdown 内容(必填)
|
|
53
|
+
- `theme`: 主题名称
|
|
54
|
+
- `codeTheme`: 代码高亮主题
|
|
55
|
+
|
|
56
|
+
### marknative_get_themes
|
|
57
|
+
获取所有可用主题和代码高亮主题列表
|
|
58
|
+
|
|
59
|
+
### marknative_status
|
|
60
|
+
检查插件状态
|
|
61
|
+
|
|
62
|
+
## 可用主题
|
|
63
|
+
|
|
64
|
+
| 主题 | 描述 |
|
|
65
|
+
|------|------|
|
|
66
|
+
| default | 默认主题(浅色) |
|
|
67
|
+
| github | GitHub 风格 |
|
|
68
|
+
| solarized | Solarized 风格 |
|
|
69
|
+
| sepia | 复古纸张风格 |
|
|
70
|
+
| rose | 玫瑰粉风格 |
|
|
71
|
+
| dark | 深色主题 |
|
|
72
|
+
| nord | Nord 风格 |
|
|
73
|
+
| dracula | Dracula 风格 |
|
|
74
|
+
| ocean | 海洋风格 |
|
|
75
|
+
| forest | 森林风格 |
|
|
76
|
+
|
|
77
|
+
## 代码高亮主题
|
|
78
|
+
|
|
79
|
+
支持 Shiki 主题:`github-light`, `github-dark`, `nord`, `dracula`, `solarized-light`, `solarized-dark`, `monokai` 等。
|
|
80
|
+
|
|
81
|
+
## 使用示例
|
|
82
|
+
|
|
83
|
+
```javascript
|
|
84
|
+
// 1. 检查状态
|
|
85
|
+
marknative_status({})
|
|
86
|
+
|
|
87
|
+
// 2. 渲染为 Base64 图片
|
|
88
|
+
marknative_render({
|
|
89
|
+
markdown: '# Hello\n\nThis is **markdown** to image!',
|
|
90
|
+
format: 'png',
|
|
91
|
+
theme: 'github'
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// 3. 保存为文件
|
|
95
|
+
marknative_render_to_file({
|
|
96
|
+
markdown: '# Document\n\nContent here...',
|
|
97
|
+
outputPath: './output.png',
|
|
98
|
+
theme: 'dark'
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// 4. 预览
|
|
102
|
+
marknative_preview({
|
|
103
|
+
markdown: '# Preview\n\nTest content',
|
|
104
|
+
theme: 'nord'
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
// 5. 获取主题列表
|
|
108
|
+
marknative_get_themes({})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## 完整示例
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// 渲染带有代码高亮的文档
|
|
115
|
+
marknative_render({
|
|
116
|
+
markdown: `# 示例代码
|
|
117
|
+
|
|
118
|
+
\`\`\`javascript
|
|
119
|
+
function hello() {
|
|
120
|
+
console.log('Hello, World!');
|
|
121
|
+
}
|
|
122
|
+
\`\`\`
|
|
123
|
+
|
|
124
|
+
**支持语法高亮!**
|
|
125
|
+
`,
|
|
126
|
+
format: 'png',
|
|
127
|
+
theme: 'dark',
|
|
128
|
+
codeTheme: 'github-dark'
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 许可证
|
|
133
|
+
|
|
134
|
+
MIT
|
|
Binary file
|