@lark-apaas/coding-steering 0.1.68-alpha.20261016070747 → 0.1.68

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.
Files changed (143) hide show
  1. package/README.md +19 -21
  2. package/package.json +6 -6
  3. package/steering/design-html/skills/animated-video/SKILL.md +2 -2
  4. package/steering/design-html/skills/charts/SKILL.md +60 -8
  5. package/steering/design-html/skills/{data-report → data-viz}/SKILL.md +65 -9
  6. package/steering/design-html/skills/frontend-design/SKILL.md +2 -2
  7. package/steering/design-html/skills/hi-fi-design/SKILL.md +1 -1
  8. package/steering/design-html/skills/interactive-prototype/SKILL.md +19 -2
  9. package/steering/design-html/skills/mini-game/SKILL.md +71 -0
  10. package/steering/design-html/skills/mini-game/references/three-js.md +54 -0
  11. package/steering/design-html/skills/pptx-style-extract/SKILL.md +157 -0
  12. package/steering/design-html/skills/pptx-style-extract/font-fallback.yaml +129 -0
  13. package/steering/design-html/skills/pptx-style-extract/scripts/census.py +967 -0
  14. package/steering/design-html/skills/pptx-style-extract/scripts/check_v2.py +1052 -0
  15. package/steering/design-html/skills/pptx-style-extract/scripts/draft.py +3483 -0
  16. package/steering/design-html/skills/pptx-style-extract/scripts/export_consumer_md.py +75 -0
  17. package/steering/design-html/skills/pptx-style-extract/scripts/export_consumer_zip.py +175 -0
  18. package/steering/design-html/skills/pptx-style-extract/scripts/extract.py +1287 -0
  19. package/steering/design-html/skills/pptx-style-extract/scripts/ooxml.py +716 -0
  20. package/steering/design-html/skills/pptx-style-extract/scripts/package.py +1946 -0
  21. package/steering/design-html/skills/pptx-style-extract/scripts/parts.py +480 -0
  22. package/steering/design-html/skills/pptx-style-extract/scripts/query.py +557 -0
  23. package/steering/design-html/skills/pptx-style-extract/scripts/render_pages.py +687 -0
  24. package/steering/design-html/skills/pptx-style-extract/scripts/test_asset_judgment_package.py +556 -0
  25. package/steering/design-html/skills/pptx-style-extract/scripts/test_background_composite.py +364 -0
  26. package/steering/design-html/skills/pptx-style-extract/scripts/test_color_contract.py +60 -0
  27. package/steering/design-html/skills/pptx-style-extract/scripts/test_design_consumer_contract.py +76 -0
  28. package/steering/design-html/skills/pptx-style-extract/scripts/test_flow_layout_contract.py +528 -0
  29. package/steering/design-html/skills/pptx-style-extract/scripts/test_layout_css.py +1814 -0
  30. package/steering/design-html/skills/pptx-style-extract/scripts/test_logo_scope.py +600 -0
  31. package/steering/design-html/skills/pptx-style-extract/scripts/test_rounded_contract.py +112 -0
  32. package/steering/design-html/skills/pptx-style-extract/scripts/test_text_role_contract.py +315 -0
  33. package/steering/design-html/skills/pptx-style-extract/scripts/verify_font.py +68 -0
  34. package/steering/design-html/skills/pptx-style-extract/scripts/verify_layout_assets.py +421 -0
  35. package/steering/design-html/skills/pptx-style-extract/scripts/verify_logo_scope.py +12 -0
  36. package/steering/design-html/skills/pptx-style-extract/v2-format-spec.md +205 -0
  37. package/steering/design-html/skills/{make-a-deck → slide-deck}/SKILL.md +35 -11
  38. package/steering/design-html/skills/social-card/SKILL.md +263 -0
  39. package/steering/design-html/skills/{visual-exposure → visual-report}/SKILL.md +24 -2
  40. package/steering/nestjs-react-fullstack/skills/app-init-feasibility-guide/SKILL.md +5 -0
  41. package/steering/nestjs-react-fullstack/skills/authn-guide/SKILL.md +7 -0
  42. package/steering/nestjs-react-fullstack/skills/authz-guide/SKILL.md +43 -10
  43. package/steering/nestjs-react-fullstack/skills/authz-guide/references/dynamic-permission-guide.md +1 -1
  44. package/steering/nestjs-react-fullstack/skills/authz-guide/references/runtime-role-controller-spec.md +6 -8
  45. package/steering/nestjs-react-fullstack/skills/authz-guide/references/sdk-examples.md +6 -1
  46. package/steering/nestjs-react-fullstack/skills/authz-guide/references/sdk-types.md +8 -5
  47. package/steering/nestjs-react-fullstack/skills/client-builtins-file-storage-service/SKILL.md +45 -116
  48. package/steering/nestjs-react-fullstack/skills/client-builtins-user-service/SKILL.md +15 -2
  49. package/steering/nestjs-react-fullstack/skills/code-fix/SKILL.md +15 -9
  50. package/steering/nestjs-react-fullstack/skills/coding-guide/SKILL.md +360 -102
  51. package/steering/nestjs-react-fullstack/skills/connections-sdk/SKILL.md +202 -0
  52. package/steering/nestjs-react-fullstack/skills/contacts-service/SKILL.md +88 -11
  53. package/steering/nestjs-react-fullstack/skills/design-guide/SKILL.md +190 -0
  54. package/steering/nestjs-react-fullstack/skills/design-guide/references/broadsheet.md +313 -0
  55. package/steering/nestjs-react-fullstack/skills/design-guide/references/claude-editorial-research.md +375 -0
  56. package/steering/nestjs-react-fullstack/skills/design-guide/references/crimson-frosted-glass.md +221 -0
  57. package/steering/nestjs-react-fullstack/skills/design-guide/references/cybernetic-vault-terminal.md +74 -0
  58. package/steering/nestjs-react-fullstack/skills/design-guide/references/dashboard.md +234 -0
  59. package/steering/nestjs-react-fullstack/skills/design-guide/references/digital-e-guide.md +349 -0
  60. package/steering/nestjs-react-fullstack/skills/design-guide/references/finance-report.md +169 -0
  61. package/steering/nestjs-react-fullstack/skills/design-guide/references/flowbite.md +179 -0
  62. package/steering/{design-html/skills_local/creative-design → nestjs-react-fullstack/skills/design-guide}/references/frontend-design.md +21 -26
  63. package/steering/nestjs-react-fullstack/skills/design-guide/references/handwritten-sketch.md +215 -0
  64. package/steering/nestjs-react-fullstack/skills/design-guide/references/industry.md +348 -0
  65. package/steering/nestjs-react-fullstack/skills/design-guide/references/metabase.md +226 -0
  66. package/steering/nestjs-react-fullstack/skills/design-guide/references/minimal-jade.md +205 -0
  67. package/steering/nestjs-react-fullstack/skills/design-guide/references/nebula-crimson.md +306 -0
  68. package/steering/nestjs-react-fullstack/skills/design-guide/references/nexuscore-analytics.md +74 -0
  69. package/steering/nestjs-react-fullstack/skills/design-guide/references/organic-minimalism.md +253 -0
  70. package/steering/nestjs-react-fullstack/skills/design-guide/references/pm-spec.md +234 -0
  71. package/steering/nestjs-react-fullstack/skills/design-guide/references/pop-art.md +272 -0
  72. package/steering/nestjs-react-fullstack/skills/design-guide/references/sap-fiori-horizon.md +154 -0
  73. package/steering/nestjs-react-fullstack/skills/design-guide/references/token-mapping.md +68 -0
  74. package/steering/nestjs-react-fullstack/skills/design-guide/references/warm-elegance.md +217 -0
  75. package/steering/nestjs-react-fullstack/skills/design-guide/references/wild-orange.md +203 -0
  76. package/steering/nestjs-react-fullstack/skills/nestjs-cache/SKILL.md +254 -0
  77. package/steering/nestjs-react-fullstack/skills/openapi-guide/SKILL.md +44 -0
  78. package/steering/nestjs-react-fullstack/skills/plugin-guide/SKILL.md +179 -541
  79. package/steering/nestjs-react-fullstack/skills/plugin-guide/references/plugin-coding-guide.md +199 -17
  80. package/steering/nestjs-react-fullstack/skills/plugin-guide/references/table.md +30 -14
  81. package/steering/nestjs-react-fullstack/skills/raw-sql-boundary-audit/SKILL.md +63 -0
  82. package/steering/nestjs-react-fullstack/skills/server-builtins-file-storage-service/SKILL.md +210 -177
  83. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/SKILL.md +78 -0
  84. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/assets/eslint.mcp-ui.config.cjs +19 -0
  85. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/assets/ui-tsconfig.json +19 -0
  86. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/references/client-onboarding.md +82 -0
  87. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/references/debugging.md +81 -0
  88. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/references/mcp-apps.md +197 -0
  89. package/steering/nestjs-react-fullstack/skills_common/mcp-guide/references/tool-authoring.md +249 -0
  90. package/steering/nestjs-react-fullstack/skills_common/server-contacts-contract/SKILL.md +19 -0
  91. package/steering/nestjs-react-fullstack/{skills → skills_common}/trigger-guide/SKILL.md +38 -5
  92. package/steering/nestjs-react-fullstack/skills_common/user-identity/SKILL.md +33 -40
  93. package/steering/nestjs-react-fullstack/skills_local/authz-guide/SKILL.md +39 -6
  94. package/steering/nestjs-react-fullstack/skills_local/authz-guide/references/runtime-role-controller-spec.md +6 -8
  95. package/steering/nestjs-react-fullstack/skills_local/authz-guide/references/sdk-examples.md +6 -1
  96. package/steering/nestjs-react-fullstack/skills_local/authz-guide/references/sdk-types.md +8 -5
  97. package/steering/nestjs-react-fullstack/skills_local/client-builtins-user-service/SKILL.md +2 -0
  98. package/steering/nestjs-react-fullstack/skills_local/code-fix/SKILL.md +8 -2
  99. package/steering/nestjs-react-fullstack/skills_local/coding-guide/SKILL.md +145 -81
  100. package/steering/nestjs-react-fullstack/skills_local/plugin-guide/SKILL.md +14 -3
  101. package/steering/nestjs-react-fullstack/skills_local/plugin-guide/references/plugin-coding-guide.md +150 -16
  102. package/steering/vite-react/skills/plugin-guide/SKILL.md +8 -6
  103. package/steering/vite-react/skills/react-three-fiber/SKILL.md +5 -0
  104. package/steering/vite-react/tech.md +3 -0
  105. package/steering/design-html/skills_local/creative-design/agents/assets/vision-probe.png +0 -0
  106. package/steering/design-html/skills_local/creative-design/agents/fork-verifier-agent.md +0 -71
  107. package/steering/design-html/skills_local/creative-design/agents/vision-probe-agent.md +0 -41
  108. package/steering/design-html/skills_local/creative-design/assets/index.html +0 -27
  109. package/steering/design-html/skills_local/creative-design/references/aily.md +0 -39
  110. package/steering/design-html/skills_local/creative-design/references/animated-video.md +0 -35
  111. package/steering/design-html/skills_local/creative-design/references/charts.md +0 -165
  112. package/steering/design-html/skills_local/creative-design/references/claude.md +0 -36
  113. package/steering/design-html/skills_local/creative-design/references/codex.md +0 -32
  114. package/steering/design-html/skills_local/creative-design/references/data-report.md +0 -108
  115. package/steering/design-html/skills_local/creative-design/references/hi-fi-design.md +0 -32
  116. package/steering/design-html/skills_local/creative-design/references/interactive-prototype.md +0 -24
  117. package/steering/design-html/skills_local/creative-design/references/make-a-deck.md +0 -133
  118. package/steering/design-html/skills_local/creative-design/references/visual-exposure.md +0 -82
  119. package/steering/design-html/skills_local/creative-design/references/wireframe.md +0 -14
  120. package/steering/design-html/skills_local/creative-design/skill.md +0 -273
  121. package/steering/design-html/skills_local/creative-design/starter-components/android-frame.jsx +0 -188
  122. package/steering/design-html/skills_local/creative-design/starter-components/animations.jsx +0 -773
  123. package/steering/design-html/skills_local/creative-design/starter-components/browser-window.jsx +0 -122
  124. package/steering/design-html/skills_local/creative-design/starter-components/deck-stage.js +0 -2483
  125. package/steering/design-html/skills_local/creative-design/starter-components/design-canvas.jsx +0 -1432
  126. package/steering/design-html/skills_local/creative-design/starter-components/ios-frame.jsx +0 -270
  127. package/steering/design-html/skills_local/creative-design/starter-components/macos-window.jsx +0 -197
  128. package/steering/design-html/skills_local/creative-design/starter-components/tweaks-panel.jsx +0 -752
  129. package/steering/nestjs-react-fullstack/skills/client-add-aily-web-chat/SKILL.md +0 -139
  130. package/steering/nestjs-react-fullstack/skills/feishu/SKILL.md +0 -269
  131. package/steering/nestjs-react-fullstack/skills/feishu/references/approval.md +0 -214
  132. package/steering/nestjs-react-fullstack/skills/feishu/references/attendance.md +0 -163
  133. package/steering/nestjs-react-fullstack/skills/feishu/references/bitable.md +0 -311
  134. package/steering/nestjs-react-fullstack/skills/feishu/references/calendar.md +0 -190
  135. package/steering/nestjs-react-fullstack/skills/feishu/references/contacts.md +0 -160
  136. package/steering/nestjs-react-fullstack/skills/feishu/references/doc.md +0 -257
  137. package/steering/nestjs-react-fullstack/skills/feishu/references/drive.md +0 -104
  138. package/steering/nestjs-react-fullstack/skills/feishu/references/events.md +0 -199
  139. package/steering/nestjs-react-fullstack/skills/feishu/references/id-convert.md +0 -128
  140. package/steering/nestjs-react-fullstack/skills/feishu/references/messaging.md +0 -207
  141. package/steering/nestjs-react-fullstack/skills/feishu/references/oauth.md +0 -165
  142. package/steering/nestjs-react-fullstack/skills/feishu/references/perm.md +0 -91
  143. package/steering/nestjs-react-fullstack/skills/feishu/references/wiki.md +0 -165
@@ -2,15 +2,19 @@
2
2
 
3
3
  ### 核心原则:根据场景选择调用侧
4
4
 
5
- **默认优先在 Client 侧调用 capabilityClient;但当插件结果需要持久化到数据库时,应考虑在 Server 侧调用或确保前端调用后及时通过后端接口保存。**
5
+ **默认优先在 Client 侧调用 capabilityClient;流式或高耗时 AI 生成优先 `callStream` 渐进展示。结果需要持久化时,优先在流式结束后通过已有后端接口保存;只有 Client 侧无法满足时才切到 Server 侧。**
6
+
7
+ **高耗时 AI capability 先判调用形态**:只要输出规模大、输出字段多、需要多份结果、多语言/长文本、文件或多模态输入后继续生成、多个 capability 串联、或结果需后续查看/落库,就不得把完整 AI 结果塞进一个同步 HTTP 请求等待。能由前端承接时,优先用前端 `callStream` 渐进展示,并在流式结束后按需复用已有 CRUD 接口保存结果;只有 Client 侧无法满足(触发器/敏感凭证/强事务/必须由后端保证落库一致性等)时,才采用后端任务记录 + 状态/结果查询,避免把后台任务作为默认方案。
8
+
6
9
  **严禁** import { capabilityClient } from '@lark-apaas/client-capability'。
7
10
  **唯一指定**的导入方式是 import { capabilityClient } from '@lark-apaas/client-toolkit';
8
11
 
9
12
  | 优先级 | 场景 | 调用方式 |
10
13
  |-------|------|---------|
11
- | **首选** | 绝大多数场景 | `capabilityClient.load(id).call()` |
12
- | **首选** | 流式输出场景 | `capabilityClient.load(id).callStream()` |
13
- | **兜底** | Client 侧无法满足时 | `CapabilityService.load(id).call()` |
14
+ | **首选** | 绝大多数即时展示场景 | `capabilityClient.load(id).call()` |
15
+ | **首选** | 流式输出,或高耗时但可由前端承接的 AI 生成 | `capabilityClient.load(id).callStream()`(流式结束后按需持久化) |
16
+ | **必要时** | 高耗时且 Client 侧无法满足:触发器、敏感凭证、强事务、必须由后端保证落库一致性 | 后端任务记录 + 后台调用 `CapabilityService.load(id).call()` + 前端短轮询状态/结果 |
17
+ | **兜底** | Client 侧无法满足且单次调用可在交互边界内完成 | `CapabilityService.load(id).call()` |
14
18
 
15
19
  #### 什么情况下应使用 Server 侧?
16
20
 
@@ -19,7 +23,7 @@
19
23
  1. **涉及敏感凭证**:调用需要服务端私密 token/secret,不适合暴露给前端
20
24
  2. **必须后端编排**:多个插件调用之间有强事务依赖,需要后端统一编排
21
25
  3. **触发器/定时任务场景**:没有前端上下文,只能由后端发起
22
- 4. **插件结果需要持久化**:调用结果需要保存到数据库,在 Server 侧可以在同一方法中完成调用+落库,保证数据一致性
26
+ 4. **插件结果需要持久化**:调用结果需要保存到数据库;能由前端承接时,优先前端 `callStream` 渐进展示并在结束后复用已有 CRUD 接口保存;只有 Client 侧无法满足或必须由后端保证落库一致性时,才在 Server 侧调用并落库。若此时输出规模大、字段多、结果多份或需多步能力串联,必须改为任务记录 + 后台执行 + 状态/结果查询,避免一个 HTTP 请求等待完整生成
23
27
 
24
28
  > **提示**:如果插件结果不需要存储、仅用于即时展示(如流式生成文本、发送消息),优先在前端调用。但当结果需要保存到数据库时,不要回避使用 Server 侧。
25
29
 
@@ -31,9 +35,13 @@
31
35
 
32
36
  ```
33
37
  插件结果是否需要持久化到数据库?
34
- ├── 否 → Client 侧调用(默认)
35
- └── 是 → 推荐方案 A:Server 侧调用,在 Service 中调用插件并在同一方法中落库
36
- 备选方案 B:Client 侧调用插件 → 成功后通过已有 CRUD 接口保存结果
38
+ ├── 否
39
+ │ ├── `outputMode=stream` 或内容生成较慢 → Client 侧 `callStream()` 渐进展示
40
+ │ └── 单次短输出 → Client 侧 `call()`(默认)
41
+ └── 是
42
+ ├── `outputMode=stream` 且前端可承接 → 推荐方案 A:Client 侧 `callStream()` 渐进展示,成功后通过已有 CRUD 接口保存结果
43
+ ├── 输出较小且可在交互边界内完成、且必须由后端保证一致性 → Server 侧调用并在同一方法中落库
44
+ └── Client 侧无法满足且输出规模大/多字段/多份/多语言/多步骤 → 方案 B:Server 侧创建任务记录,快速返回任务状态;后台调用插件并落库;前端短轮询状态/结果
37
45
  ```
38
46
 
39
47
  | 应避免的做法 | 推荐做法 |
@@ -68,12 +76,18 @@
68
76
  #### call / callStream 函数签名
69
77
 
70
78
  ```typescript
71
- .call(actionKey: string, input: object) // 非流式,返回 Promise<output>
72
- .callStream(actionKey: string, input: object) // 流式,返回 AsyncIterable<chunk>
79
+ // 前端 capabilityClient(@lark-apaas/client-toolkit,实际类型来自 @lark-apaas/client-capability)
80
+ .call<T = unknown>(actionKey: string, params?: Record<string, unknown>): Promise<T> // 非流式
81
+ .callStream<T = unknown>(actionKey: string, params?: Record<string, unknown>): AsyncIterable<T> // 流式
73
82
  ```
74
83
 
75
84
  - **第一个参数 `actionKey`**:必须是字符串,值来自 `get_plugin_ai_json` 返回的 `actions[].key`(如 `'sendFeishuMessage'`、`'textGenerate'`)
76
- - **第二个参数 `input`**:必须是对象,结构符合 `actions[].inputSchema`
85
+ - **第二个参数 `params`**:类型是 `Record<string, unknown>`,结构符合 `actions[].inputSchema`
86
+ - 上面是**前端**签名,带泛型。**服务端 `CapabilityService` 的 `call` / `callStream` / `callStreamWithEvents` 都没有泛型**,两者不通用,详见「Server 侧调用方式」
87
+
88
+ > **`Record<string, unknown>` 不接 `interface` 声明的对象**(interface 没有隐式索引签名),直接传会撞
89
+ > `Argument of type 'XxxInput' is not assignable to parameter of type 'Record<string, unknown>'. Index signature for type 'string' is missing in type 'XxxInput'.`
90
+ > 三种正确写法:① 直接传内联对象字面量;② 入参类型用 `type XxxInput = { ... }` 而非 `interface`(type 别名有隐式索引签名);③ 已有 interface 时在调用点显式 `input as unknown as Record<string, unknown>`。**不要为此改用 `as any`。**
77
91
 
78
92
  ```typescript
79
93
  // ❌ 错误:把参数 JSON.stringify 后当作 actionKey
@@ -233,10 +247,11 @@ function MultiPluginStreamExample() {
233
247
  2. 一个 `stream` action 的真实调用结果(chunk 按 `outputSchema` 字段读取)
234
248
  3. 调用失败时的最小日志字段齐全
235
249
  4. 若无法执行真实调用,必须明确写明阻塞原因,禁止直接标记"开发完成"
250
+ 5. 若用户触发 AI 生成的请求超时、连接断开或工具返回超时,必须判定为验收失败;只有触发请求快速返回、随后能通过页面或接口读到明确完成或失败终态和结果,才允许标记通过
236
251
 
237
252
  ### Server 侧调用方式(仅兜底场景)
238
253
 
239
- > 以下场景适合使用 Server 侧调用,特别是涉及数据持久化时不要回避后端。
254
+ > 以下场景适合使用 Server 侧调用;若前端 `callStream` + 既有 CRUD 保存即可满足展示和持久化,不要优先引入后端后台任务。
240
255
 
241
256
  #### 1. 何时适合用 Server 侧?
242
257
 
@@ -247,6 +262,7 @@ function MultiPluginStreamExample() {
247
262
  | 敏感凭证调用 | 凭证不能暴露给前端 | 调用需要 admin token 的 API |
248
263
  | 强事务编排 | 多步骤需要原子性 | 创建记录 → 发通知 → 更新状态必须全成功或全回滚 |
249
264
  | 插件结果需持久化 | 调用结果需保存到数据库 | AI 分类/摘要结果需落库、文档解析的结构化数据需入库、图片识别结果需关联业务记录、语音转文字结果需存档等 |
265
+ | 高耗时 AI 生成需后续查看 | 请求不能长期占用用户交互链路 | 批量、多版本、多语言、长文本、多字段结构化生成,或文件/多模态分析后再生成内容 |
250
266
 
251
267
  #### 2. NestJS 注入方式
252
268
 
@@ -258,13 +274,127 @@ import { CapabilityService } from '@lark-apaas/fullstack-nestjs-core';
258
274
  export class XxxService {
259
275
  private readonly logger = new Logger(XxxService.name);
260
276
 
277
+ // 注入 token 必须显式写成 @Inject(CapabilityService)
261
278
  constructor(
262
- @Inject() private readonly capabilityService: CapabilityService,
279
+ @Inject(CapabilityService) private readonly capabilityService: CapabilityService,
263
280
  ) {}
264
281
  }
265
282
  ```
266
283
 
267
- #### 3. 调用示例
284
+ **禁止空参 `@Inject()`**。本 stack 的 `nest-cli.json` 用 `builder: swc`,空参 `@Inject()` 会把注入 token 置为 undefined,Nest 回退读 `design:type` 拿到 `Function`,服务端启动即崩溃、所有 `/api` 请求返回 502:
285
+
286
+ ```
287
+ UnknownDependenciesException: Nest can't resolve dependencies of the XxxService (?).
288
+ Please make sure that the argument Function at index [0] is available in the XxxModule context.
289
+ ```
290
+
291
+ 见到这段报错先查构造函数有没有空参 `@Inject()`,不要去改 Module 的 `imports` / `providers`。
292
+
293
+ **业务 Module 不需要注册 CapabilityModule**。`PlatformModule` 是 `@Global()` 且已把 `CapabilityModule` 放进 `exports`,`CapabilityService` 全局可注入。不要在业务 Module 里写 `imports: [CapabilityModule.forRoot(...)]` 或 `imports: [PlatformModule.forRoot()]`。
294
+
295
+ 同一规则适用于从 `@lark-apaas/fullstack-nestjs-core` 注入的其他平台服务(`AuthNPaasService`、`FileService` 等)。
296
+
297
+ #### 3. Server 侧已持久化文件进入 AI capability
298
+
299
+ Client 侧拿到用户刚选择的原始 `File` / `Blob` 时,直接传 `capabilityClient`,不要为了调用插件先上传到应用存储。文件/图片已作为业务数据持久化,且必须由 Server 侧 `CapabilityService` 调 `ai-doc-parser`、`ai-image-understanding` 或其它 `file` / `picture` / `plugin-file-url` / `plugin-image-url` 参数时,才在服务端把存储路径换成临时 http(s) URL 后传入插件。
300
+
301
+ 优先从业务记录读取存储 `file_path`;字段类型是 `file_attachment` 时,同时读取 `bucket_id` 与 `file_path`。旧记录只有标准 `/app` 或 `/spark/app/.../runtime/api/v1/storage/object/<bucket>/<key>` download URL 时,可以解析出 bucket 与 file path 后再签名;不能把它直接交给默认 `createSignedUrl()`,因为该入口只使用默认 bucket,不会使用 URL 里的 bucket。签名 URL 才能交给 AI plugin。禁止给标准路径拼接 `localhost`、`window.location.origin` 或 `/app/<app_id>`,否则会绕过内部路径解析并被当成不安全的外部 URL。非标准相对路径、前端展示 URL、非法 base64 data URL 不应作为 Server 侧插件稳定入参。
302
+
303
+ ```typescript
304
+ import { FileService } from '@lark-apaas/fullstack-nestjs-core';
305
+
306
+ type StoredFileRef = {
307
+ file_path?: string | null;
308
+ bucket_id?: string | null;
309
+ download_url?: string | null;
310
+ };
311
+
312
+ const STORAGE_DOWNLOAD_URL_RE =
313
+ /^\/(?:spark\/)?app\/app_[\w]+\/runtime\/api\/v1\/storage\/object\/([^/]+)\/(.+)$/;
314
+
315
+ function parseStorageDownloadUrl(
316
+ downloadUrl: string,
317
+ ): { bucketId: string; filePath: string } | null {
318
+ const match = STORAGE_DOWNLOAD_URL_RE.exec(downloadUrl);
319
+ if (!match) return null;
320
+
321
+ try {
322
+ const bucketId = decodeURIComponent(match[1]);
323
+ const filePath = decodeURIComponent(match[2]);
324
+ return bucketId && !bucketId.includes('/') && filePath
325
+ ? { bucketId, filePath }
326
+ : null;
327
+ } catch {
328
+ return null;
329
+ }
330
+ }
331
+
332
+ async function createTemporaryFileUrl(
333
+ fileService: FileService,
334
+ file: StoredFileRef,
335
+ ): Promise<string | null> {
336
+ try {
337
+ let signedUrl: string;
338
+ if (file.file_path) {
339
+ signedUrl = file.bucket_id
340
+ ? await fileService
341
+ .from(file.bucket_id)
342
+ .createSignedUrl(file.file_path, 3600)
343
+ : await fileService.createSignedUrl(file.file_path, 3600);
344
+ } else {
345
+ const parsed = file.download_url
346
+ ? parseStorageDownloadUrl(file.download_url)
347
+ : null;
348
+ if (!parsed) return null;
349
+ signedUrl = await fileService
350
+ .from(parsed.bucketId)
351
+ .createSignedUrl(parsed.filePath, 3600);
352
+ }
353
+ return signedUrl || null;
354
+ } catch (error) {
355
+ // 这里不要返回伪成功 URL;由调用方把业务状态置为 failed/pending/null 等可见状态
356
+ return null;
357
+ }
358
+ }
359
+ ```
360
+
361
+ 调用 AI 插件前先签名并校验 URL:
362
+
363
+ ```typescript
364
+ const docParserPluginInstanceId = '<doc-parser-plugin-instance-id>';
365
+ const signedUrl = await createTemporaryFileUrl(this.fileService, storedFile);
366
+ if (!signedUrl) {
367
+ this.logger.warn('missing file path or create signed url failed before AI capability call', {
368
+ filePath: storedFile.file_path,
369
+ bucketId: storedFile.bucket_id,
370
+ hasDownloadUrl: Boolean(storedFile.download_url),
371
+ pluginInstanceId: docParserPluginInstanceId,
372
+ actionKey: 'parseDocToMarkdown',
373
+ });
374
+ await this.updateRecord(recordId, { parseStatus: 'failed', parsedText: null });
375
+ return;
376
+ }
377
+
378
+ const output = await this.capabilityService
379
+ .load(docParserPluginInstanceId)
380
+ .call('parseDocToMarkdown', {
381
+ fileUrl: [signedUrl], // 是否数组必须以 inputSchema 为准
382
+ });
383
+ ```
384
+
385
+ 稳定契约:已持久化文件统一使用签名函数返回的 URL,不要先下载后转 base64,也不要把原始 URL 作为备用值传给插件。缺少可识别的文件路径、签名失败或返回空 URL 时记录警告,写入 `failed` / `pending` / `null`,并停止调用插件。
386
+
387
+ #### 4. 调用示例
388
+
389
+ 服务端 `CapabilityExecutor` 的**三个方法全都没有泛型参数**(`@lark-apaas/nestjs-capability`):
390
+
391
+ ```typescript
392
+ call(actionName: string, input: unknown, context?: Partial<PluginActionContext>): Promise<unknown>;
393
+ callStream(actionName: string, input: unknown, context?): AsyncIterable<unknown>;
394
+ callStreamWithEvents(actionName: string, input: unknown, context?): AsyncIterable<StreamEvent<unknown>>;
395
+ ```
396
+
397
+ 写 `.call<T>(...)` / `.callStream<T>(...)` / `.callStreamWithEvents<T>(...)` 都会报「应有 0 个类型参数,但获得 1 个」。泛型只存在于前端 `capabilityClient`。注意服务端 `input` 是**必传**(没有 `?`),且类型是 `unknown` 而非前端的 `Record<string, unknown>`。服务端接 `unknown` 后在运行时收窄,禁止 `as any`:
268
398
 
269
399
  ```typescript
270
400
  const inputParams = {
@@ -272,9 +402,11 @@ const inputParams = {
272
402
  };
273
403
 
274
404
  try {
275
- const output = await this.capabilityService
405
+ const output: unknown = await this.capabilityService
276
406
  .load('')
277
407
  .call('', inputParams);
408
+ // 运行时收窄后再取字段,例如:
409
+ // if (typeof output === 'object' && output !== null && 'content' in output) { ... }
278
410
  return output;
279
411
  } catch (error) {
280
412
  this.logger.error('pluginInstance call failed', {
@@ -286,10 +418,12 @@ try {
286
418
  }
287
419
  ```
288
420
 
289
- #### 4. Server 侧编排与容错原则
421
+ #### 5. Server 侧编排与容错原则
290
422
 
291
423
  - PluginInstance 调用在 Server 侧通常属于 **外部依赖 / side-effect**
292
424
  - 除非业务明确要求强一致性,**默认不应阻塞主业务流程**
425
+ - 已选择 Server 侧承接的高耗时 AI capability 必须有可观测状态:创建任务时记录处理进度、完成终态、失败终态、输入摘要、错误信息和结果引用;触发接口只返回任务标识与当前状态,前端通过短轮询读取进度和最终结果
426
+ - 文件/图片签名 URL 生成失败或返回空 URL 时必须 `warn` 并把业务记录保持在 `failed` / `pending` / `null` 等用户可见状态,禁止构造假 URL 或写入“解析成功”
293
427
 
294
428
  推荐写法:异步触发 + catch 兜底:
295
429
 
@@ -3,6 +3,7 @@ name: plugin-guide
3
3
  description: "Use when 需要:(1) 创建或管理 PluginInstance 插件实例,(2) 调用 capabilityClient 生成插件调用代码,(3) 理解 Plugin、PluginInstance、PluginInstanceAIJson 三层关系,(4) 使用 get_plugin_ai_json 或 plugin_instance 工具。触发词:插件, plugin, 飞书消息, 飞书群组, 多维表格, AI生文, AI生图, 图片理解, capabilityClient, pluginInstance"
4
4
  steering: true
5
5
  steering-topic: plugin_guide
6
+ match-template-name: vite-react
6
7
  ---
7
8
 
8
9
  # Plugin 集成指南
@@ -166,12 +167,11 @@ const structured = await (jsonExtractor as any).call('textToJson', { text: rawRe
166
167
 
167
168
  ### 创建结构化提取 PluginInstance 的关键要求
168
169
 
169
- 创建 `ai-text-to-json` 或 `ai-image-to-json` 类型的 PluginInstance 时:
170
+ 创建 `ai-text-to-json` 类型的 PluginInstance 时:一次性定义所有提取字段(参考 schema/表单/UI),最多 20 个。字段类型以当次 `formSchema.paramType.enum` 为准;静态指南/`readme` 只解释 enum 内类型,冲突时按 enum 建模并说明冲突,不得降级为 String;enum 缺失、不可读或缺业务所需类型时停止并报告合同冲突。基础字段用 String/Number/Boolean 等对应类型,同构列表用 Array,固定字段集合用 Object,嵌套成员写进 `paramDescription`。对象/列表结果不得序列化进 String;只有业务要求原样透传、不解析、不改写 JSON 文本时才用 String。创建后调用 `get_plugin_ai_json`,按 `outputSchema` 核验字段并生成调用代码,不把它作为创建前类型依据;按契约直接消费结果,禁止无依据 `JSON.parse`。
170
171
 
171
- 1. **必须一次性定义所有需要提取的字段**(参考数据库 schema / 表单定义 / UI 设计),宁多勿漏
172
- 2. 字段类型仅支持 String / Number / Boolean,最多 20 个字段
173
- 3. 先调用 `get_plugin_ai_json` 确认上游插件的 `outputSchema`,确保输入格式正确
174
- 4. 图片→结构化数据场景,优先使用 `ai-image-to-json`(单步),避免不必要的链式调用
172
+ `jsonStructure` 的顶级字段都会参与必填校验:模型漏任一 key 时整次调用抛 `INVALID_OUTPUT`。插件只用文本 prompt,不用 JSON Schema 强制生成;顶级字段越多,整体失败概率越高。N 套同构结果用一个 Array 字段承载,元素结构写进 `paramDescription`,不要摊成 N x M 个顶级字段。Array/Object 内部只做 `z.any()` 校验,`paramDescription` 仅影响 prompt;消费方仍须校验元素数量、成员字段和空值。
173
+
174
+ 创建 `ai-image-to-json` 实例时,必须一次性定义所有需要提取的字段,字段类型仅支持 String / Number / Boolean,最多 20 个;先调用 `get_plugin_ai_json` 确认上游插件的 `outputSchema`,确保输入格式正确。图片→结构化数据场景优先使用 `ai-image-to-json`(单步),避免不必要的链式调用。
175
175
 
176
176
  ## 核心概念
177
177
 
@@ -180,7 +180,7 @@ const structured = await (jsonExtractor as any).call('textToJson', { text: rawRe
180
180
  - **Plugin(插件)**:底层承载单元,包含插件元信息与表单定义(form.schema)。模型侧只感知插件及其表单字段,不感知插件内部实现细节。
181
181
  - **PluginInstance(插件实例配置)**:基于某个 Plugin 的表单做"业务封装",以 **单文件 JSON** 的形式存储(每个插件实例一个文件,语义化 id)。
182
182
  - 通过 `paramsSchema` 暴露业务入参
183
- - 通过 `formValue` 将业务入参映射到插件表单字段(可常量或引用 `{{input.xxx}}`)
183
+ - 通过 `formValue` 将业务入参映射到插件表单字段(可常量或引用 `{% raw %}{{input.xxx}}{% endraw %}`)
184
184
  - **PluginInstanceAIJson(pluginInstance.ai.json)**:工程转化层产物,是 pluginInstance 的**运行时投影 / 调用合同(Runtime Spec)**。
185
185
  - 包含插件定位信息、actions 入口列表、input/output schema、outputMode、readme 等
186
186
  - Code Agent 在生成**调用代码**前,必须读取它作为权威依据(使用 `capabilityClient` 调用)
@@ -224,6 +224,7 @@ Plugin 的具体内容以JSON格式给出,例如:
224
224
 
225
225
  PluginInstance 的配置以 JSON 形式输出,例如:
226
226
 
227
+ {% raw %}
227
228
  ```json
228
229
  {
229
230
  "id": "create_feishu_group", // 全局唯一语义化 ID
@@ -245,6 +246,7 @@ PluginInstance 的配置以 JSON 形式输出,例如:
245
246
  }
246
247
  }
247
248
  ```
249
+ {% endraw %}
248
250
 
249
251
  **注意**paramsSchema 支持以下 4 种参数类型,需要按下面规定的格式进行填充:
250
252
 
@@ -3,8 +3,11 @@ name: react-three-fiber
3
3
  description: "Use when 实现 3D 场景 / 3D 游戏 / 3D 数据可视化, 用到 react-three-fiber (R3F) / three.js / @react-three/drei / @react-three/rapier / @react-three/postprocessing 时. 触发词:3D, R3F, react-three-fiber, three.js, threejs, Canvas, useFrame, useThree, OrbitControls, drei, mesh, geometry, useGLTF, GLTF, GLB, 3D 模型, 3D 场景, 3D 游戏, 3D 地球, shader, GLSL, 物理引擎, rapier, postprocessing, Bloom, 后处理, 着色器, 立体, 透视, 视角, 飞行射击, 空战, 探索"
4
4
  steering: true
5
5
  steering-topic: react_three_fiber
6
+ match-template-name: vite-react
6
7
  ---
7
8
 
9
+ {% raw %}
10
+
8
11
  # React Three Fiber (R3F) 编码指南
9
12
 
10
13
  实现 3D 场景 / 3D 游戏 / 3D 数据可视化时, MUST 用 **react-three-fiber + drei** 声明式栈, 严禁用 React + CSS / SVG / `transform: rotateX` 伪 3D.
@@ -220,3 +223,5 @@ npm install react-error-boundary # 必装! Canvas 外包 ErrorBoundary
220
223
 
221
224
  - `client-coding-guide` - vite-react 通用编码规范
222
225
  - `component-conventions` - React 组件命名 / 文件结构
226
+
227
+ {% endraw %}
@@ -73,4 +73,7 @@ const url = flags[`/src/assets/flags/${code}.svg`]
73
73
  1. **shadcn-ui 组件不直接改源码**——需要变化时通过 `className` / `variant` props 控制。
74
74
  2. **样式优先用 Tailwind utility**,避免写 CSS module。
75
75
  3. **表单始终用 react-hook-form + zod**——不要直接操作 input value。
76
+ 字段类型由 zod schema 推导、`defaultValues` 覆盖全字段、运行时校验用 `zodResolver`;
77
+ 提交到必填 API/service Request 时,submit 的类型边界用业务 Request 而不是
78
+ `z.infer`(做法见 `forms-skill`)。
76
79
  4. **图表 ECharts 优先 echarts-for-react**——React 19 严格模式下注意 echarts instance 的初始化时机。
@@ -1,71 +0,0 @@
1
- # Fork verifier (read-only)
2
-
3
- You are a **read-only** verification subagent spawned to check a design
4
- deliverable the main agent just built or edited. Your **only** job: load that
5
- deliverable, verify it, and report a single verdict — `done` or `needs_work` —
6
- back to the main agent. **You must not modify, create, or delete any file**,
7
- edit the source, build, or take any other action. You read, probe, and report —
8
- nothing else. Resolve every tool named below to your harness's equivalent via
9
- its reference doc (`references/<harness>.md`): a generic action like "show the
10
- file" or "evaluate JS in-page" maps to your harness's preview / eval tool.
11
-
12
- ## Input
13
-
14
- You are given the **project directory**, the **path(s) of the HTML file(s)** the
15
- main agent built or edited, and the served
16
- `http://localhost:<port>/<file>.html` URL to load (always over HTTP —
17
- never `file://`). The caller may also include an explicit image-input status:
18
- `image input supported` or `image input unsupported`. You do **not** inherit the
19
- main agent's transcript; verify only what these inputs point at.
20
-
21
- ## What to do
22
-
23
- 1. Show the file the main agent built/edited (your harness's show-file / preview
24
- tool — upstream `show_html`).
25
- 2. Read the console / webview logs (upstream `get_webview_logs`) — console
26
- errors? failed loads?
27
- 3. Screenshot — layout / spacing / type / content look right? Skip screenshot
28
- reads only when the caller explicitly says image input is unsupported; in
29
- that case continue with console and JS/DOM checks and state that visual
30
- screenshot review was skipped.
31
- 4. Evaluate JS in-page (upstream `eval_js`) to probe if something seems off. For
32
- overflow/alignment issues, diagnose the constraint before reporting:
33
-
34
- ```js
35
- const el = document.querySelector('...'); const p = el.parentElement;
36
- const pick = (e, cs) => ({rect: e.getBoundingClientRect(), boxSizing: cs.boxSizing, display: cs.display, position: cs.position, width: cs.width, height: cs.height, minHeight: cs.minHeight, flexDirection: cs.flexDirection});
37
- JSON.stringify({el: pick(el, getComputedStyle(el)), parent: pick(p, getComputedStyle(p))});
38
- ```
39
-
40
- Include the result in your `needs_work` description so the main agent fixes
41
- the root cause (box-sizing, flex `min-height:auto`, percentage height with no
42
- resolved parent height), not the pixel symptom.
43
- 5. If the authored source uses `var(--*)`: evaluate JS to collect every custom
44
- property DEFINED in the loaded stylesheets (any selector / `@layer` /
45
- `@media`, not just `:root`):
46
-
47
- ```js
48
- const defined = new Set();
49
- const walk = rs => { for (const r of rs||[]) { if (r.style) for (const p of r.style) if (p.startsWith('--')) defined.add(p); try { walk(r.cssRules || r.styleSheet?.cssRules); } catch {} } };
50
- for (const ss of document.styleSheets) try { walk(ss.cssRules); } catch {}
51
- JSON.stringify([...defined]);
52
- ```
53
-
54
- Then grep the authored file for `var\(--[a-zA-Z0-9_-]+` and report any
55
- referenced name not in the defined set as unresolved.
56
- 6. Report your verdict — `done` or `needs_work` with a description — as your
57
- **final message** back to the main agent (upstream
58
- `verification_feedback({verdict, description})`). The verdict IS the
59
- deliverable; do not end on a prose summary with no verdict.
60
-
61
- ## Rules
62
-
63
- - **Read-only, always.** Never write or edit files, build, serve, or run write
64
- scripts. The upstream `write_file`, `str_replace_edit`, `show_to_user`,
65
- `update_todos`, and `run_script` are all off-limits — if something is wrong you
66
- *report* it; the main agent fixes it and re-runs you.
67
- - **`needs_work` = REAL problems only** — broken layout, console errors, missing
68
- content, unresolved `var(--*)` tokens. Not nitpicks.
69
- - **The verdict is the only exit.** A text-only reply with no `done` /
70
- `needs_work` verdict is a dead end — always end with the verdict + description.
71
- - Always load over the served `http://localhost:…` URL, never `file://`.
@@ -1,41 +0,0 @@
1
- # Vision probe (read-only)
2
-
3
- You are a **read-only** capability probe spawned before a design task tries to
4
- read or inspect screenshots. Your only job is to determine whether this Claude
5
- Code session's current model/provider can accept image input.
6
-
7
- ## Input
8
-
9
- You are given the absolute path to a tiny PNG probe image — the committed asset
10
- that ships with this skill, usually:
11
-
12
- ```text
13
- <skill>/agents/assets/vision-probe.png
14
- ```
15
-
16
- ## What to do
17
-
18
- 1. Try to read/view the PNG with the harness's normal image-reading capability.
19
- The probe image is a small colorful square with a dark X/border so successful
20
- image input should be recognizable without needing any project context.
21
- 2. If the image is visible to you, final-answer exactly:
22
-
23
- ```text
24
- VISION_OK
25
- ```
26
-
27
- 3. If the image cannot be read, the provider rejects image input, a tool fails,
28
- or you are not sure, final-answer exactly:
29
-
30
- ```text
31
- VISION_UNSUPPORTED
32
- ```
33
-
34
- ## Rules
35
-
36
- - **Read-only, always.** Do not write, edit, delete, serve, preview, or inspect
37
- any project files.
38
- - Do not read real design screenshots. This probe must touch only the tiny probe
39
- image path provided by the main agent.
40
- - Do not explain your reasoning in the final response. The main agent needs one
41
- exact token only: `VISION_OK` or `VISION_UNSUPPORTED`.
@@ -1,27 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title></title>
8
- <script
9
- src="https://sf3-scmcdn-cn.feishucdn.com/obj/feishu-static/miaoda/coding-unpkg-sdk/react@18.3.1/umd/react.development.js"
10
- crossorigin="anonymous"></script>
11
- <script
12
- src="https://sf3-scmcdn-cn.feishucdn.com/obj/feishu-static/miaoda/coding-unpkg-sdk/react-dom@18.3.1/umd/react-dom.development.js"
13
- crossorigin="anonymous"></script>
14
- <script
15
- src="https://sf3-scmcdn-cn.feishucdn.com/obj/feishu-static/miaoda/coding-unpkg-sdk/@babel/standalone@7.29.0/babel.min.js"
16
- crossorigin="anonymous"></script>
17
- <!-- 其他内容 -->
18
- </head>
19
-
20
- <body>
21
- <div id="root">
22
- <!-- React 组件将渲染到这里 -->
23
- </div>
24
- <!-- 其他内容 -->
25
- </body>
26
-
27
- </html>
@@ -1,39 +0,0 @@
1
- # Aily 工具参考
2
-
3
- 本文档列出 [`../skill.md`](../skill.md) 所依赖的 harness 专属工具,供你在 **Aily** 中运行时使用。主提示词只命名能力("向用户提问"、"展示文件"等);本文档给出 Aily 的调用方式。通用工具(`Bash`、文件读/写/编辑、grep/glob 搜索)在任何环境都相同,不在此覆盖。
4
-
5
- ## Web 工具 → Aily 对应项
6
-
7
- 上游提示词引用了一些在 Aily 中并不存在的 Claude.ai web 工具。无论出现在行文还是代码里,一律按下表替换:
8
-
9
- | Web 工具 | Aily 对应项 |
10
- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
- | `ask_user_question` | `ask_user`(向用户抛出结构化决策问题;先问,等用户答复后再继续)。 |
12
- | `done`、`fork_verifier_agent` | 用 `submit` 交付结果并给出文件路径。 |
13
- | `write_file`(及其 `asset:` 参数) | Aily 的「创建/编辑本地文件」工具。不存在 asset review pane;舍弃这一概念。 |
14
- | `copy_files` | `Bash cp`。 |
15
- | `read_file`、`list_files`、`view_image` | 「读取本地文件」;按文件名查找用 glob、搜内容用 grep;图片直接走「解析二进制文件(…图片…)」——Aily 原生支持图像输入。 |
16
- | `show_to_user` | 用 `submit` 交付并给出绝对本地文件路径。 |
17
- | `eval_js`、`eval_js_user_view`、`run_script` | 脚本用 `Bash`。 |
18
- | `web_fetch`、`web_search` | `fetch`、`web_search`。用于时效性事实、内容素材补充或用户要求的查询。 |
19
- | `generate_image` | `aily-image-generate_workbench`(Seedream V4.5 模型):支持文生图、图生图(给参考图)、信息图(infographic)、图片编辑、组图(一次生成多张风格统一、角色连贯的图像序列)。 |
20
- | `search_images` | `doubao_image_search`(按关键词搜索图片,适合找参考图、素材图)。 |
21
- | `copy_starter_component` | `Bash cp <本 skill 所在目录>/starter-components/<file> .`(cwd 通常是应用项目目录而非 skill 目录,需用 skill 目录实际路径;或读取后改编)。 |
22
- | 文档解析(docx / pdf) | Aily 原生「解析二进制文件」能力直接读取 Word / PDF / Excel / PPT 全文;PDF 也可用 `aily-pdf` 专用工具。 |
23
- | `invoke_skill("X")` / `invoke the "X" skill` | 用 `get_skills("X")` 加载对应媒介技能(如 `get_skills("frontend-design")`)。这些技能同时以本地文件形式随本 skill 附带在 `references/<X>.md`,`get_skills` 取不到时直接读该文件。 |
24
-
25
- ## 提出澄清性问题
26
-
27
- 用 `ask_user` 提出聚焦的结构化问题——它把用户的决策内联返回,先问、等答复后再继续。它最适合高影响力的承重决策:交付格式、保真度、设计上下文、参考应用、变体数量。一轮提问保持简明、可执行。不要虚构假的工具名。
28
-
29
- ## 交付与发布
30
-
31
- - 用 `submit` 提交交付结果,并给出绝对本地文件路径。
32
- - 产物完成并提交后,按 [`../skill.md`](../skill.md)「发布」一节发布到妙搭——交付给用户的可分享链接是 `+release-get` 返回的 `online_url`。
33
-
34
- ## Aily 专属注意事项
35
-
36
- - **优先用专用工具而非手搓。** 除了通用 `Bash`,Aily 还带一批专用工具(`aily-xlsx`、`aily-chart`、`aily-diagram`、`aily-pdf`、`aily-image-generate_workbench` 等)。涉及表格、图表、流程图、PDF、图像生成时,优先用对应专用工具,而不是用 `Bash` 从零脚本化。
37
- - **图像素材优先走生成 / 搜索。** [`../skill.md`](../skill.md)「图像素材与外部信息」一节的 `generate_image` / `search_images` 在 Aily 下都有真实对应(见上表),设计产物需要 hero 图、插画、信息图、连贯组图或参考图时应主动使用,而不是默认全部用 CSS/SVG 兜底。搜索到 / 生成的图片先落到本地,再用 `lark-cli apps +file-upload` 上传、在代码中引用返回的远端 URL,不提交 git。
38
- - `agent` 的 `slide` 子类型用于生成**飞书幻灯片**,与本 skill 产出的自包含 HTML deck(`starter-components/deck-stage.js`)是两条不同路径,不要混用——本 skill 的 deck 始终是 HTML。
39
- - 交付统一走 `submit`;需要跨轮次保留项目上下文时可用 `aily-work-memory`。
@@ -1,35 +0,0 @@
1
- ---
2
- name: animated-video
3
- metadata:
4
- display-names:
5
- zh-CN: 动画视频
6
- en-US: Animated Video
7
- description: Use when creating animated videos, motion graphics, product walkthroughs, or visual storytelling with timeline-based playback. 触发词:animation, video, motion, 动画, 视频, 动效, 产品演示, 演示动画, walkthrough
8
- available-agents:
9
- - CreativeDesign
10
- ---
11
-
12
- # Animated video
13
-
14
- Create an animated video or motion design piece rendered as an HTML page. Build a timeline-based animation with smooth transitions. Design frame-by-frame sequences with playback controls (play/pause, scrubber). Focus on visual storytelling; take the palette from the user's brand assets, or derive it from the subject per [`../skill.md`](../skill.md)「默认美学指令」— never default to any fixed brand palette. Export-ready at a fixed aspect ratio (16:9 or 9:16). If you need to know the position of an element (eg to move a cursor or character between elements) use refs to grab the position.
15
-
16
- START by calling `copy_starter_component` with `kind: "animations.jsx"` — it gives you a ready-made timeline engine: `<Stage width height duration>` (auto-scales to viewport, scrubber + play/pause + ←/→ seek + space + 0-to-reset, persists playhead), `<Sprite start end>` to gate children to a time window, `useTime()` / `useSprite()` hooks, an `Easing` library, `interpolate()` / `animate()` tweens, and `TextSprite` / `ImageSprite` / `RectSprite` primitives with built-in entry/exit. Read the file after copying and build YOUR scenes by composing Sprites inside a Stage; only fall back to Popmotion (https://sf3-scmcdn-cn.feishucdn.com/obj/feishu-static/miaoda/coding-unpkg-sdk/popmotion@11.0.5/dist/popmotion.min.js) if the starter genuinely can't do what you need.
17
-
18
- Animations are complex code! Make reusable JSX components for each visual element and each scene. Invest in tweaking the timeline iteratively.
19
-
20
- Animation tips:
21
-
22
- - Storytelling is KEY! Before you create ANYTHING, identify the story arc, key tensions, characters, etc. Align on the message you want to convey. Run it by the user.
23
- - Use good animation principles... anticipation, easing, follow-through, exaggeration, all the Disney animator principles.
24
- - Scenes should have establishing shots setting the scene (use titles or captions if NECESSARY, but prefer to show not tell), followed by heavy zooms on the action. (either hard cuts, or ken-burns-style zooms, or mouse-follows.) Most scenes should exist in a realistic context: they should have a background, or exist in the UI of a computer or phone; etc. Elements should generally not float in the aether.
25
- - In short animations, most 'scenes' are a single shot, or a sequence of shots in the same setting. Scenes may be slides (e.g. text or graphics onscreen, animating or being emphasized (highlighted etc) in an engaging way that calls attention to the key thing). Decide what the shot is going to be. Maybe it's starting zoomed out, then slowly zooming in on the area of focus or action. Maybe it's rapidly cutting back/forth between two people or graphics in tension. Maybe you're following something, like a cursor or a line on a graph, as it flits around. Be creative!
26
- - Except for deliberate dramatic effect (a held beat), SOMETHING should always be in motion. The camera, an element, or a transition — slowly panning, zooming, subtly scaling up, drifting, or building. A truly static frame reads as a bug. Images especially: always slowly zoom in/out, pan, have some 'action', have text or graphics appearing or building, or be rapidly cutting in sequence.
27
- - Whenever you show text or images, remember that you need pauses for it to sink in -- on the order of seconds -- before you can show something else.
28
-
29
- If cursor or pointer movement is depicted (eg in a product walkthrough or prototype), you should zoom in on it and follow it with a damped viewport animation, like Screen Studio would. You MUST use HTML refs to locate elements onscreen so the cursor points at the right things.
30
-
31
- For product-demo animations (simulated clicks, drags, dialogs, status changes), build a believable product UI and animate its real interface state — do NOT substitute an abstract flowchart or node diagram for the product screen. Reuse the device/window shells from `starter-components/` (`ios-frame.jsx`, `android-frame.jsx`, `macos-window.jsx`, `browser-window.jsx`) instead of hand-rolling frames.
32
-
33
- For data-driven animations (annual-review numbers, dashboards coming alive, chart morphing): animate counters by tweening the value with `animate()` / `interpolate()` and rendering the formatted number; morph charts by interpolating the underlying data array each frame and re-rendering the SVG bars/paths (or driving ECharts `setOption` from `useTime()`); chain chapters with scene transitions. Every number shown must come from the user's real data (see [`../skill.md`](../skill.md)「数据保真」).
34
-
35
- For clarity when commenting, update the video root's data-screen-label attr with the current timestamp each second, so you can easily comment on a particular timestamp and know that the agent will be told exactly the timestamp. `<Stage>` does NOT do this for you — wire it up yourself, e.g. inside a component rendered in the Stage: `const t = useTime(); const sec = Math.floor(t); useEffect(() => { document.querySelector('.video-root')?.setAttribute('data-screen-label', sec + 's'); }, [sec]);`