foliko 1.1.0 → 1.1.1
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/.shared/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/.shared/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/.shared/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/.shared/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/.shared/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/.shared/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/.shared/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/.shared/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/.shared/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/.shared/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/.shared/ui-ux-pro-max/data/web-interface.csv +31 -0
- 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 +258 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/.shared/ui-ux-pro-max/scripts/search.py +106 -0
- package/.agent/ARCHITECTURE.md +288 -0
- package/.agent/agents/ambient-agent.md +57 -0
- package/.agent/agents/debugger.md +55 -0
- package/.agent/agents/email-assistant.md +49 -0
- package/.agent/agents/file-manager.md +42 -0
- package/.agent/agents/python-developer.md +60 -0
- package/.agent/agents/scheduler.md +59 -0
- package/.agent/agents/web-developer.md +45 -0
- package/.agent/data/default.json +412 -3
- package/.agent/data/plugins-state.json +173 -174
- package/.agent/data/puppeteer-sessions/undefined.json +6 -0
- package/.agent/mcp_config_updated.json +12 -0
- package/.agent/plugins/poster-plugin/fonts/NotoColorEmoji-Regular.ttf +0 -0
- package/.agent/plugins/poster-plugin/src/elements/polygon.js +37 -6
- package/.agent/plugins/poster-plugin/src/elements/text.js +71 -2
- package/.agent/plugins/poster-plugin/src/fonts.js +123 -8
- package/.agent/plugins/poster-plugin/src/index.js +15 -16
- package/.agent/plugins/puppeteer-plugin/README.md +147 -0
- package/.agent/plugins/puppeteer-plugin/index.js +1418 -0
- package/.agent/plugins/puppeteer-plugin/package.json +9 -0
- package/.agent/plugins.json +5 -11
- package/.agent/rules/GEMINI.md +273 -0
- package/.agent/rules/allow-rule.md +77 -0
- package/.agent/rules/log-rule.md +83 -0
- package/.agent/rules/security-rule.md +93 -0
- package/.agent/scripts/auto_preview.py +148 -0
- package/.agent/scripts/checklist.py +217 -0
- package/.agent/scripts/session_manager.py +120 -0
- package/.agent/scripts/verify_all.py +327 -0
- package/.agent/sessions/cli_default.json +135 -23981
- package/.agent/sessions/weixin_o9cq80zgZqKPA2-s59PN43GdDy1w@im.wechat.json +2195 -0
- package/.agent/skills/api-patterns/SKILL.md +81 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +40 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/architecture/SKILL.md +55 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/clean-code/SKILL.md +201 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/frontend-design/SKILL.md +418 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +311 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/orchestrate.md +237 -0
- package/.agent/workflows/plan.md +89 -0
- package/.agent/workflows/preview.md +81 -0
- package/.agent/workflows/simple-test.md +42 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/structured-orchestrate.md +180 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +296 -0
- package/.claude/settings.local.json +16 -1
- package/.env.example +56 -56
- package/README.md +441 -441
- package/calc_tokens_weixin.js +81 -0
- package/cli/src/commands/chat.js +2 -1
- package/foliko-creative-3.png +0 -0
- package/foliko-creative-4.png +0 -0
- package/foliko-creative-5.png +0 -0
- package/package.json +1 -1
- package/plugins/extension-executor-plugin.js +80 -2
- package/plugins/file-system-plugin.js +2 -2
- package/plugins/weixin-plugin.js +10 -2
- package/skills/find-skills/AGENTS.md +162 -162
- package/skills/find-skills/SKILL.md +133 -133
- package/skills/poster-guide/SKILL.md +948 -632
- package/src/core/agent-chat.js +82 -3
- 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/.agent/agents/code-assistant.json +0 -14
- package/.agent/agents/email-assistant.json +0 -14
- package/.agent/agents/file-assistant.json +0 -15
- package/.agent/agents/system-assistant.json +0 -15
- package/.agent/agents/web-assistant.json +0 -12
- package/.agent/data/ambient/goals.json +0 -50
- package/.agent/data/ambient/memories.json +0 -7
- package/.agent/data/scheduler/tasks.json +0 -1
- package/.agent/memory/core.md +0 -1
- package/.agent/memory/project/mnn93ogy-ypjn27.md +0 -9
- package/.agent/memory/project/mnn98fqy-5nhc1u.md +0 -25
- package/.agent/memory/user/mnm67t9m-x8rekk.md +0 -9
- package/.agent/memory/user/mnn5mmqh-w6aktx.md +0 -11
- package/.agent/memory/user/mnnbfhhn-dk1bd1.md +0 -22
- package/.agent/package.json +0 -8
- package/.agent/plugins/__pycache__/file_writer.cpython-312.pyc +0 -0
- package/.agent/plugins/daytona/README.md +0 -89
- package/.agent/plugins/daytona/index.js +0 -377
- package/.agent/plugins/daytona/package.json +0 -12
- package/.agent/plugins/marknative/README.md +0 -134
- package/.agent/plugins/marknative/index.js +0 -228
- package/.agent/plugins/marknative/package.json +0 -12
- package/.agent/plugins/marknative/update-readme.js +0 -134
- package/.agent/plugins/system-info/index.js +0 -387
- package/.agent/plugins/system-info/package.json +0 -4
- package/.agent/plugins/system-info/test.js +0 -40
- package/.agent/python-scripts/test_sample.py +0 -24
- 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/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/output/beef-love-poster.png +0 -0
|
@@ -9,8 +9,20 @@ const { registerFont: registerFontFn } = require('canvas')
|
|
|
9
9
|
// 已注册的字体
|
|
10
10
|
const registeredFonts = new Map()
|
|
11
11
|
|
|
12
|
+
// Emoji 字体名称映射(用于统一识别)
|
|
13
|
+
const emojiFontMappings = {
|
|
14
|
+
'NotoColorEmoji': 'Noto Color Emoji',
|
|
15
|
+
'NotoColorEmoji-Regular': 'Noto Color Emoji',
|
|
16
|
+
'Noto Emoji': 'Noto Emoji',
|
|
17
|
+
'NotoEmoji-Regular': 'Noto Emoji',
|
|
18
|
+
'Apple Color Emoji': 'Apple Color Emoji',
|
|
19
|
+
'Segoe UI Emoji': 'Segoe UI Emoji',
|
|
20
|
+
'Symbola': 'Symbola',
|
|
21
|
+
}
|
|
22
|
+
|
|
12
23
|
// 系统字体路径
|
|
13
24
|
const systemFonts = [
|
|
25
|
+
// Windows 字体
|
|
14
26
|
{ path: 'C:\\Windows\\Fonts\\msyh.ttc', family: 'Microsoft YaHei' },
|
|
15
27
|
{ path: 'C:\\Windows\\Fonts\\msyhbd.ttc', family: 'Microsoft YaHei Bold', weight: 'bold' },
|
|
16
28
|
{ path: 'C:\\Windows\\Fonts\\simhei.ttf', family: 'SimHei' },
|
|
@@ -19,10 +31,27 @@ const systemFonts = [
|
|
|
19
31
|
{ path: 'C:\\Windows\\Fonts\\Times New Roman.ttf', family: 'Times New Roman' },
|
|
20
32
|
{ path: 'C:\\Windows\\Fonts\\Consolas.ttf', family: 'Consolas' },
|
|
21
33
|
{ path: 'C:\\Windows\\Fonts\\Georgia.ttf', family: 'Georgia' },
|
|
34
|
+
// Linux emoji 字体(扩展搜索路径)
|
|
35
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
36
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoEmoji-Regular.ttf', family: 'Noto Emoji' },
|
|
37
|
+
{ path: '/usr/share/fonts/opentype/noto/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
38
|
+
{ path: '/usr/share/fonts/google-noto-cursive/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
39
|
+
{ path: '/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
40
|
+
{ path: '/usr/share/fonts/noto-fonts/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
41
|
+
{ path: '/usr/share/fonts/TTF/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
42
|
+
{ path: '/usr/share/fonts/truetype/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
43
|
+
{ path: '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', family: 'DejaVu Sans' },
|
|
44
|
+
{ path: '/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf', family: 'Liberation Sans' },
|
|
45
|
+
{ path: '/usr/share/fonts/truetype/freefont/FreeSans.ttf', family: 'FreeSans' },
|
|
46
|
+
{ path: '/usr/share/fonts/TTF/NotoSans-Regular.ttf', family: 'Noto Sans' },
|
|
47
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf', family: 'Noto Sans' },
|
|
48
|
+
// macOS 字体
|
|
49
|
+
{ path: '/System/Library/Fonts/Apple Color Emoji.ttc', family: 'Apple Color Emoji' },
|
|
50
|
+
{ path: '/System/Library/Fonts/Supplemental/Symbola.ttf', family: 'Symbola' },
|
|
22
51
|
]
|
|
23
52
|
|
|
24
53
|
// 默认字体
|
|
25
|
-
let defaultFontFamily = '
|
|
54
|
+
let defaultFontFamily = '微软雅黑'
|
|
26
55
|
|
|
27
56
|
/**
|
|
28
57
|
* 注册字体文件
|
|
@@ -55,17 +84,70 @@ function registerFontFile(fontPath, fontFamily, options = {}) {
|
|
|
55
84
|
}
|
|
56
85
|
}
|
|
57
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 判断是否为 Emoji 字体
|
|
89
|
+
*/
|
|
90
|
+
function isEmojiFont(fontName) {
|
|
91
|
+
if (!fontName) return false
|
|
92
|
+
const lower = fontName.toLowerCase()
|
|
93
|
+
return (
|
|
94
|
+
lower.includes('emoji') ||
|
|
95
|
+
lower.includes('color') ||
|
|
96
|
+
lower.includes('symbola')
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
58
100
|
/**
|
|
59
101
|
* 初始化字体
|
|
60
102
|
*/
|
|
61
103
|
function initFonts() {
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
104
|
+
// 插件字体目录
|
|
105
|
+
const pluginFontsDir = path.join(__dirname, '..', 'fonts')
|
|
106
|
+
|
|
107
|
+
// 优先加载插件自带的字体
|
|
108
|
+
if (fs.existsSync(pluginFontsDir)) {
|
|
109
|
+
const fontFiles = fs.readdirSync(pluginFontsDir)
|
|
110
|
+
for (const file of fontFiles) {
|
|
111
|
+
if (!file.endsWith('.ttf') && !file.endsWith('.otf') && !file.endsWith('.ttc')) {
|
|
112
|
+
continue
|
|
113
|
+
}
|
|
114
|
+
const fontPath = path.join(pluginFontsDir, file)
|
|
115
|
+
const fontName = path.basename(file, path.extname(file))
|
|
116
|
+
|
|
117
|
+
// 检查是否为 Emoji 字体,如果是则使用标准名称注册
|
|
118
|
+
let finalFontName = fontName
|
|
119
|
+
if (isEmojiFont(fontName)) {
|
|
120
|
+
// 尝试映射到标准名称
|
|
121
|
+
finalFontName = emojiFontMappings[fontName] || 'Noto Color Emoji'
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// 尝试注册
|
|
125
|
+
if (registerFontFile(fontPath, finalFontName)) {
|
|
126
|
+
if (isEmojiFont(finalFontName)) {
|
|
127
|
+
console.log(`[poster] 已注册插件 Emoji 字体: ${finalFontName}`)
|
|
128
|
+
} else {
|
|
129
|
+
// 微软雅黑设为默认字体
|
|
130
|
+
if (fontName.includes('微软雅黑') && !fontName.includes('粗体')) {
|
|
131
|
+
defaultFontFamily = finalFontName
|
|
132
|
+
console.log(`[poster] 已注册插件字体(设为默认): ${finalFontName}`)
|
|
133
|
+
} else if (!defaultFontFamily || defaultFontFamily === 'sans-serif') {
|
|
134
|
+
defaultFontFamily = finalFontName
|
|
135
|
+
console.log(`[poster] 已注册插件字体: ${finalFontName}`)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 如果没有注册到插件字体,再尝试系统字体
|
|
143
|
+
if (!defaultFontFamily || defaultFontFamily === 'sans-serif') {
|
|
144
|
+
for (const font of systemFonts) {
|
|
145
|
+
if (registerFontFile(font.path, font.family, { weight: font.weight })) {
|
|
146
|
+
if (font.weight !== 'bold') {
|
|
147
|
+
defaultFontFamily = font.family
|
|
148
|
+
console.log(`[poster] 已注册系统字体: ${font.family}`)
|
|
149
|
+
break
|
|
150
|
+
}
|
|
69
151
|
}
|
|
70
152
|
}
|
|
71
153
|
}
|
|
@@ -75,6 +157,39 @@ function initFonts() {
|
|
|
75
157
|
registeredFonts.set('sans-serif', { path: null })
|
|
76
158
|
console.log('[poster] 使用默认字体: sans-serif')
|
|
77
159
|
}
|
|
160
|
+
|
|
161
|
+
// 注册系统 emoji 字体(用于支持 emoji 渲染)
|
|
162
|
+
const emojiFonts = [
|
|
163
|
+
// Linux
|
|
164
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
165
|
+
{ path: '/usr/share/fonts/opentype/noto/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
166
|
+
{ path: '/usr/share/fonts/google-noto-emoji/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
167
|
+
{ path: '/usr/share/fonts/google-noto-cursive/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
168
|
+
{ path: '/usr/share/fonts/noto-fonts/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
169
|
+
{ path: '/usr/share/fonts/TTF/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
170
|
+
{ path: '/usr/share/fonts/truetype/NotoColorEmoji.ttf', family: 'Noto Color Emoji' },
|
|
171
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoEmoji-Regular.ttf', family: 'Noto Emoji' },
|
|
172
|
+
{ path: '/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf', family: 'Noto Sans' },
|
|
173
|
+
{ path: '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf', family: 'DejaVu Sans' },
|
|
174
|
+
{ path: '/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf', family: 'Liberation Sans' },
|
|
175
|
+
{ path: '/usr/share/fonts/truetype/freefont/FreeSans.ttf', family: 'FreeSans' },
|
|
176
|
+
// macOS
|
|
177
|
+
{ path: '/System/Library/Fonts/Apple Color Emoji.ttc', family: 'Apple Color Emoji' },
|
|
178
|
+
{ path: '/System/Library/Fonts/Supplemental/Symbola.ttf', family: 'Symbola' },
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
for (const font of emojiFonts) {
|
|
182
|
+
if (registerFontFile(font.path, font.family)) {
|
|
183
|
+
// 只在还没注册过 Noto Color Emoji 时打印
|
|
184
|
+
if (!registeredFonts.has('Noto Color Emoji') || font.family === 'Noto Color Emoji') {
|
|
185
|
+
console.log(`[poster] 已注册 emoji 字体: ${font.family}`)
|
|
186
|
+
}
|
|
187
|
+
// 一旦找到 Noto Color Emoji 就停止
|
|
188
|
+
if (font.family === 'Noto Color Emoji' && registeredFonts.has('Noto Color Emoji')) {
|
|
189
|
+
break
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
78
193
|
}
|
|
79
194
|
|
|
80
195
|
/**
|
|
@@ -66,20 +66,11 @@ module.exports = function (Plugin) {
|
|
|
66
66
|
this._canvasManager = new CanvasManager()
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
this._framework = framework
|
|
71
|
-
console.log('[poster] Poster plugin installed (v1.1.0)')
|
|
72
|
-
console.log('[poster] Components:', Object.keys(COMPONENT_TYPES).join(', '))
|
|
73
|
-
return this
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
start(framework) {
|
|
77
|
-
console.log('[poster] Poster plugin started')
|
|
78
|
-
}
|
|
69
|
+
|
|
79
70
|
|
|
80
71
|
// ==================== 工具定义 ====================
|
|
81
72
|
|
|
82
|
-
|
|
73
|
+
tools = {
|
|
83
74
|
// ==================== 画布管理 ====================
|
|
84
75
|
|
|
85
76
|
/**
|
|
@@ -1636,13 +1627,21 @@ module.exports = function (Plugin) {
|
|
|
1636
1627
|
},
|
|
1637
1628
|
}
|
|
1638
1629
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1630
|
+
|
|
1631
|
+
async install(framework) {
|
|
1632
|
+
this._framework = framework
|
|
1633
|
+
console.log('[poster] Poster plugin installed (v1.1.0)')
|
|
1634
|
+
console.log('[poster] Components:', Object.keys(COMPONENT_TYPES).join(', '))
|
|
1635
|
+
|
|
1636
|
+
return this
|
|
1644
1637
|
}
|
|
1645
1638
|
|
|
1639
|
+
start(framework) {
|
|
1640
|
+
// Object.keys(this.all_tools).map(key=>{
|
|
1641
|
+
// this._framework.registerTool({...this.all_tools[key],name:key})
|
|
1642
|
+
// })
|
|
1643
|
+
console.log('[poster] Poster plugin started')
|
|
1644
|
+
}
|
|
1646
1645
|
|
|
1647
1646
|
|
|
1648
1647
|
reload(framework) {
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# puppeteer-plugin
|
|
2
|
+
|
|
3
|
+
Puppeteer 网页自动化操作插件,支持浏览器控制、页面操作、元素交互、Session 管理。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 🌐 浏览器管理:启动/关闭浏览器实例
|
|
8
|
+
- 📄 页面操作:打开页面、导航、截图、获取页面结构
|
|
9
|
+
- 🖱️ 元素交互:查找、点击、输入文本、悬停、按键模拟
|
|
10
|
+
- 🍪 Cookie 管理:获取、设置、清除 Cookie
|
|
11
|
+
- 💾 Session 管理:保存/恢复/删除浏览器会话状态
|
|
12
|
+
- ⏱️ 等待控制:元素等待、网络空闲等待
|
|
13
|
+
|
|
14
|
+
## 工具列表
|
|
15
|
+
|
|
16
|
+
### 浏览器控制
|
|
17
|
+
| 工具 | 说明 |
|
|
18
|
+
|------|------|
|
|
19
|
+
| `browser_launch` | 启动 Puppeteer 浏览器实例 |
|
|
20
|
+
| `browser_close` | 关闭浏览器实例 |
|
|
21
|
+
| `browser_status` | 获取当前浏览器状态 |
|
|
22
|
+
|
|
23
|
+
### 页面操作
|
|
24
|
+
| 工具 | 说明 |
|
|
25
|
+
|------|------|
|
|
26
|
+
| `page_open` | 打开新页面或导航到 URL |
|
|
27
|
+
| `page_navigate` | 页面导航(前进、后退、刷新) |
|
|
28
|
+
| `page_screenshot` | 对页面进行截图 |
|
|
29
|
+
| `page_html` | 获取页面 HTML 内容 |
|
|
30
|
+
| `page_structure` | 获取页面关键结构信息(推荐) |
|
|
31
|
+
| `page_close` | 关闭指定页面 |
|
|
32
|
+
|
|
33
|
+
### 元素交互
|
|
34
|
+
| 工具 | 说明 |
|
|
35
|
+
|------|------|
|
|
36
|
+
| `element_find` | 查找页面元素 |
|
|
37
|
+
| `element_find_all` | 查找所有匹配的元素 |
|
|
38
|
+
| `element_click` | 点击页面元素 |
|
|
39
|
+
| `element_type` | 向输入框输入文本 |
|
|
40
|
+
| `element_hover` | 鼠标悬停到元素 |
|
|
41
|
+
| `element_press` | 模拟键盘按键 |
|
|
42
|
+
| `element_wait` | 等待元素出现或消失 |
|
|
43
|
+
|
|
44
|
+
### Cookie 管理
|
|
45
|
+
| 工具 | 说明 |
|
|
46
|
+
|------|------|
|
|
47
|
+
| `cookie_get` | 获取页面 Cookie |
|
|
48
|
+
| `cookie_set` | 设置 Cookie |
|
|
49
|
+
| `cookie_clear` | 清除 Cookie |
|
|
50
|
+
|
|
51
|
+
### Session 管理
|
|
52
|
+
| 工具 | 说明 |
|
|
53
|
+
|------|------|
|
|
54
|
+
| `session_save` | 保存当前浏览器会话状态 |
|
|
55
|
+
| `session_load` | 加载并恢复浏览器会话状态 |
|
|
56
|
+
| `session_list` | 列出所有保存的 Session |
|
|
57
|
+
| `session_delete` | 删除指定的 Session |
|
|
58
|
+
|
|
59
|
+
### 其他
|
|
60
|
+
| 工具 | 说明 |
|
|
61
|
+
|------|------|
|
|
62
|
+
| `js_execute` | 在页面中执行 JavaScript 代码 |
|
|
63
|
+
| `wait` | 等待指定时间 |
|
|
64
|
+
| `wait_network_idle` | 等待网络空闲 |
|
|
65
|
+
|
|
66
|
+
## 安装
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
foliko plugin install puppeteer-plugin
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 使用示例
|
|
73
|
+
|
|
74
|
+
### 启动浏览器并打开网页
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
// 启动浏览器
|
|
78
|
+
await ext_call({
|
|
79
|
+
plugin: "puppeteer",
|
|
80
|
+
tool: "browser_launch",
|
|
81
|
+
args: {}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// 打开网页
|
|
85
|
+
await ext_call({
|
|
86
|
+
plugin: "puppeteer",
|
|
87
|
+
tool: "page_open",
|
|
88
|
+
args: { url: "https://example.com" }
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// 截图
|
|
92
|
+
await ext_call({
|
|
93
|
+
plugin: "puppeteer",
|
|
94
|
+
tool: "page_screenshot",
|
|
95
|
+
args: { path: "screenshot.png" }
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 元素交互
|
|
100
|
+
|
|
101
|
+
```javascript
|
|
102
|
+
// 查找并点击按钮
|
|
103
|
+
await ext_call({
|
|
104
|
+
plugin: "puppeteer",
|
|
105
|
+
tool: "element_click",
|
|
106
|
+
args: { selector: "button.submit" }
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// 输入文本
|
|
110
|
+
await ext_call({
|
|
111
|
+
plugin: "puppeteer",
|
|
112
|
+
tool: "element_type",
|
|
113
|
+
args: { selector: "input[name='username']", text: "myuser" }
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Session 管理
|
|
118
|
+
|
|
119
|
+
```javascript
|
|
120
|
+
// 保存当前会话
|
|
121
|
+
await ext_call({
|
|
122
|
+
plugin: "puppeteer",
|
|
123
|
+
tool: "session_save",
|
|
124
|
+
args: { sessionId: "my-session" }
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// 恢复会话
|
|
128
|
+
await ext_call({
|
|
129
|
+
plugin: "puppeteer",
|
|
130
|
+
tool: "session_load",
|
|
131
|
+
args: { sessionId: "my-session" }
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 注意事项
|
|
136
|
+
|
|
137
|
+
1. **无图片识别能力**:该插件没有识别图片的能力,截图只能保存
|
|
138
|
+
2. **需要 Chromium**:Puppeteer 需要本地安装 Chromium 浏览器
|
|
139
|
+
3. **Session 恢复**:加载 Session 时会自动恢复 Cookie 和浏览器状态
|
|
140
|
+
|
|
141
|
+
## 依赖
|
|
142
|
+
|
|
143
|
+
- puppeteer-core: ^24.40.0
|
|
144
|
+
|
|
145
|
+
## 版本
|
|
146
|
+
|
|
147
|
+
- v1.0.0
|