@doubao-apps/create 0.0.25 → 0.0.27

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 (91) hide show
  1. package/dist/36.js +4 -4
  2. package/dist/template-empty/.ai/examples/common-patterns.md +53 -43
  3. package/dist/template-empty/.ai/examples/component-basics.md +0 -17
  4. package/dist/template-empty/.ai/guides/component-development.md +96 -214
  5. package/dist/template-empty/.ai/guides/system-prompt.md +14 -14
  6. package/dist/template-empty/.ai/reference/framework-api-quick-ref.md +46 -85
  7. package/dist/template-empty/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +699 -0
  8. package/dist/template-empty/.ai/reference/open-api/02-/345/255/230/345/202/250.md +409 -0
  9. package/dist/template-empty/.ai/reference/open-api/03-/350/267/257/347/224/261.md +165 -0
  10. package/dist/template-empty/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +432 -0
  11. package/dist/template-empty/.ai/reference/open-api/05-/347/225/214/351/235/242-/350/276/223/345/205/245.md +42 -0
  12. package/dist/template-empty/.ai/reference/open-api/06-/347/275/221/347/273/234.md +148 -0
  13. package/dist/template-empty/.ai/reference/open-api/07-/345/252/222/344/275/223.md +346 -0
  14. package/dist/template-empty/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +546 -0
  15. package/dist/template-empty/.ai/reference/open-api/09-/350/256/276/345/244/207-/350/223/235/347/211/231.md +961 -0
  16. package/dist/template-empty/.ai/reference/open-api/10-/350/256/276/345/244/207-wi-fi.md +277 -0
  17. package/dist/template-empty/.ai/reference/open-api/11-/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md +104 -0
  18. package/dist/template-empty/.ai/reference/open-api/12-/350/256/276/345/244/207-ibeacon.md +148 -0
  19. package/dist/template-empty/.ai/reference/open-api/13-/350/256/276/345/244/207-/347/275/227/347/233/230.md +82 -0
  20. package/dist/template-empty/.ai/reference/open-api/14-/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md +70 -0
  21. package/dist/template-empty/.ai/reference/open-api/15-/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md +104 -0
  22. package/dist/template-empty/.ai/reference/open-api/16-ui-/350/276/223/345/205/245.md +65 -0
  23. package/dist/template-empty/.ai/reference/open-api/17-/350/256/276/345/244/207-/347/275/221/347/273/234.md +164 -0
  24. package/dist/template-empty/.ai/reference/open-api/18-/350/256/276/345/244/207-/347/237/255/344/277/241.md +62 -0
  25. package/dist/template-empty/.ai/reference/open-api/19-/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md +43 -0
  26. package/dist/template-empty/.ai/reference/open-api/20-/350/256/276/345/244/207-/347/224/265/346/261/240.md +83 -0
  27. package/dist/template-empty/.ai/reference/open-api/21-/350/256/276/345/244/207-/346/227/245/345/216/206.md +215 -0
  28. package/dist/template-empty/.ai/reference/open-api/22-/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md +70 -0
  29. package/dist/template-empty/.ai/reference/open-api/23-/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md +270 -0
  30. package/dist/template-empty/.ai/reference/open-api/24-/350/256/276/345/244/207-/345/212/240/345/257/206.md +56 -0
  31. package/dist/template-empty/.ai/reference/open-api/25-/350/256/276/345/244/207-/347/224/265/350/257/235.md +41 -0
  32. package/dist/template-empty/.ai/reference/open-api/26-/350/256/276/345/244/207-/346/211/253/347/240/201.md +100 -0
  33. package/dist/template-empty/.ai/reference/open-api/27-/350/256/276/345/244/207-/345/261/217/345/271/225.md +173 -0
  34. package/dist/template-empty/.ai/reference/open-api/28-/350/256/276/345/244/207-/351/234/207/345/212/250.md +66 -0
  35. package/dist/template-empty/.ai/reference/open-api/README.md +36 -0
  36. package/dist/template-empty/.ai/reference/open-api.md +1758 -266
  37. package/dist/template-empty/.ai/rules/dos-and-donts.md +50 -37
  38. package/dist/template-empty/AGENTS.md +56 -33
  39. package/dist/template-empty/README.md +57 -10
  40. package/dist/template-empty/package.json +2 -2
  41. package/dist/template-empty/src/app.config.ts +6 -0
  42. package/dist/template-empty/src/app.ts +0 -6
  43. package/dist/template-empty/tsconfig.json +2 -0
  44. package/dist/template-starter/.ai/examples/common-patterns.md +53 -43
  45. package/dist/template-starter/.ai/examples/component-basics.md +0 -17
  46. package/dist/template-starter/.ai/guides/component-development.md +96 -214
  47. package/dist/template-starter/.ai/guides/system-prompt.md +14 -14
  48. package/dist/template-starter/.ai/reference/framework-api-quick-ref.md +46 -85
  49. package/dist/template-starter/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +699 -0
  50. package/dist/template-starter/.ai/reference/open-api/02-/345/255/230/345/202/250.md +409 -0
  51. package/dist/template-starter/.ai/reference/open-api/03-/350/267/257/347/224/261.md +165 -0
  52. package/dist/template-starter/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +432 -0
  53. package/dist/template-starter/.ai/reference/open-api/05-/347/225/214/351/235/242-/350/276/223/345/205/245.md +42 -0
  54. package/dist/template-starter/.ai/reference/open-api/06-/347/275/221/347/273/234.md +148 -0
  55. package/dist/template-starter/.ai/reference/open-api/07-/345/252/222/344/275/223.md +346 -0
  56. package/dist/template-starter/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +546 -0
  57. package/dist/template-starter/.ai/reference/open-api/09-/350/256/276/345/244/207-/350/223/235/347/211/231.md +961 -0
  58. package/dist/template-starter/.ai/reference/open-api/10-/350/256/276/345/244/207-wi-fi.md +277 -0
  59. package/dist/template-starter/.ai/reference/open-api/11-/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md +104 -0
  60. package/dist/template-starter/.ai/reference/open-api/12-/350/256/276/345/244/207-ibeacon.md +148 -0
  61. package/dist/template-starter/.ai/reference/open-api/13-/350/256/276/345/244/207-/347/275/227/347/233/230.md +82 -0
  62. package/dist/template-starter/.ai/reference/open-api/14-/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md +70 -0
  63. package/dist/template-starter/.ai/reference/open-api/15-/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md +104 -0
  64. package/dist/template-starter/.ai/reference/open-api/16-ui-/350/276/223/345/205/245.md +65 -0
  65. package/dist/template-starter/.ai/reference/open-api/17-/350/256/276/345/244/207-/347/275/221/347/273/234.md +164 -0
  66. package/dist/template-starter/.ai/reference/open-api/18-/350/256/276/345/244/207-/347/237/255/344/277/241.md +62 -0
  67. package/dist/template-starter/.ai/reference/open-api/19-/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md +43 -0
  68. package/dist/template-starter/.ai/reference/open-api/20-/350/256/276/345/244/207-/347/224/265/346/261/240.md +83 -0
  69. package/dist/template-starter/.ai/reference/open-api/21-/350/256/276/345/244/207-/346/227/245/345/216/206.md +215 -0
  70. package/dist/template-starter/.ai/reference/open-api/22-/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md +70 -0
  71. package/dist/template-starter/.ai/reference/open-api/23-/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md +270 -0
  72. package/dist/template-starter/.ai/reference/open-api/24-/350/256/276/345/244/207-/345/212/240/345/257/206.md +56 -0
  73. package/dist/template-starter/.ai/reference/open-api/25-/350/256/276/345/244/207-/347/224/265/350/257/235.md +41 -0
  74. package/dist/template-starter/.ai/reference/open-api/26-/350/256/276/345/244/207-/346/211/253/347/240/201.md +100 -0
  75. package/dist/template-starter/.ai/reference/open-api/27-/350/256/276/345/244/207-/345/261/217/345/271/225.md +173 -0
  76. package/dist/template-starter/.ai/reference/open-api/28-/350/256/276/345/244/207-/351/234/207/345/212/250.md +66 -0
  77. package/dist/template-starter/.ai/reference/open-api/README.md +36 -0
  78. package/dist/template-starter/.ai/reference/open-api.md +1758 -266
  79. package/dist/template-starter/.ai/rules/dos-and-donts.md +50 -37
  80. package/dist/template-starter/AGENTS.md +56 -33
  81. package/dist/template-starter/README.md +6 -1
  82. package/dist/template-starter/package.json +2 -2
  83. package/dist/template-starter/src/app.config.ts +35 -0
  84. package/dist/template-starter/src/app.ts +0 -6
  85. package/dist/template-starter/src/pages/applet/index.tsx +0 -5
  86. package/dist/template-starter/src/pages/home/index.tsx +0 -5
  87. package/dist/template-starter/src/pages/lynx/index.tsx +0 -4
  88. package/dist/template-starter/src/pages/react-lynx/index.tsx +0 -5
  89. package/dist/template-starter/src/widgets/weather-card/index.tsx +0 -4
  90. package/dist/template-starter/tsconfig.json +2 -0
  91. package/package.json +1 -1
@@ -21,7 +21,7 @@
21
21
 
22
22
  ### **项目文档系统**
23
23
  本地项目文档(按优先级):
24
- 1. **AGENTS.md** - 项目主入口,包含快速开始和核心规则
24
+ 1. **SKILL.md** - 项目主入口,包含快速开始和核心规则
25
25
  2. **.ai/rules/** - 框架规则和约束
26
26
  3. **.ai/guides/** - 开发指南
27
27
  4. **.ai/examples/** - 代码示例库
@@ -50,7 +50,7 @@ LynxBase MCP 提供:
50
50
  ## 知识体系
51
51
 
52
52
  ### 知识优先级
53
- 1. **项目本地文档**(AGENTS.md 及 .ai/ 目录)
53
+ 1. **项目本地文档**(SKILL.md 及 .ai/ 目录)
54
54
  2. **LynxBase MCP**(Lynx 官方/内部文档)
55
55
  3. **通用编程知识**
56
56
 
@@ -64,7 +64,7 @@ LynxBase MCP 提供:
64
64
 
65
65
  [生成代码]
66
66
 
67
- 详细的开发规范请参考:[.ai/prompts/component-development.md](.ai/prompts/component-development.md)
67
+ 详细的开发规范请参考:[component-development.md](component-development.md)
68
68
  ```
69
69
 
70
70
  **错误做法**:
@@ -191,7 +191,7 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
191
191
 
192
192
  **4. 项目结构问题** → 引用本地文档
193
193
  - 示例:"如何组织组件?"
194
- - 响应:简短说明 + 引用 AGENTS.md 或 .ai/rules/
194
+ - 响应:简短说明 + 引用 SKILL.md 或 .ai/rules/
195
195
 
196
196
  **5. 问题诊断** → 分析 + 解决方案 + 预防措施
197
197
  - 示例:"报错了"
@@ -209,7 +209,7 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
209
209
 
210
210
  2. **规划方法**
211
211
  - **Lynx 相关** → 查询 **LynxBase MCP** 获取支持数据
212
- - **项目结构/规则** → 引用本地文档(AGENTS.md、.ai/)
212
+ - **项目结构/规则** → 引用本地文档(SKILL.md、.ai/)
213
213
 
214
214
  3. **调用适当工具**
215
215
  - Lynx 相关 → **LynxBase MCP**
@@ -261,7 +261,7 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
261
261
  - 提供错误处理代码
262
262
 
263
263
  4. ❌ **不要违反框架规则**
264
- - 严格遵守 AGENTS.md 和 Lynx 规范
264
+ - 严格遵守 SKILL.md 和 Lynx 规范
265
265
  - 不要为了方便走捷径
266
266
 
267
267
  5. ❌ **不要过度工程化**
@@ -280,13 +280,13 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
280
280
 
281
281
  | 用户请求 | 查阅文档 | 你的动作 |
282
282
  |---------|---------|---------|
283
- | "创建页面" | `.ai/prompts/component-development.md` (Page) + LynxBase MCP | 生成代码 + 引用文档 |
284
- | "创建卡片" | `.ai/prompts/component-development.md` (Widget) + LynxBase MCP | 生成代码 + 引用文档 |
283
+ | "创建页面" | `.ai/guides/component-development.md` (Page) + LynxBase MCP | 生成代码 + 引用文档 |
284
+ | "创建卡片" | `.ai/guides/component-development.md` (Widget) + LynxBase MCP | 生成代码 + 引用文档 |
285
285
  | "Lynx 组件如何用" | LynxBase MCP → `query-assets` → `get-assets` | 查询 + 提供示例 |
286
286
  | "如何调用 API" | `.ai/examples/common-patterns.md` + Doubao Bridge 文档 | 提供示例 + 引用文档 |
287
- | "性能优化" | `.ai/prompts/performance-optimization.md` + Lynx 性能指南 | 分析问题 + 引用文档 |
288
- | "报错了" | `.ai/prompts/troubleshooting.md` + 错误分析 | 诊断 + 修复 + 引用文档 |
289
- | "框架规则" | `.ai/rules/dos-and-donts.md` + AGENTS.md | 简要说明 + 引用文档 |
287
+ | "性能优化" | `.ai/guides/performance-optimization.md` + Lynx 性能指南 | 分析问题 + 引用文档 |
288
+ | "报错了" | `.ai/guides/troubleshooting.md` + 错误分析 | 诊断 + 修复 + 引用文档 |
289
+ | "框架规则" | `.ai/rules/dos-and-donts.md` + SKILL.md | 简要说明 + 引用文档 |
290
290
 
291
291
  ---
292
292
 
@@ -309,7 +309,7 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
309
309
  1. 调用 **LynxBase MCP** 查询主线程相关文档
310
310
  2. 简短解释:"主线程脚本是在 Lynx 主线程执行的 JS 代码,用于高频交互和实时更新..."
311
311
  3. 提供简单示例
312
- 4. 引用详细文档:"更多详情请查阅 LynxBase 文档或参考 [性能优化指南](.ai/prompts/performance-optimization.md)"
312
+ 4. 引用详细文档:"更多详情请查阅 LynxBase 文档或参考 [性能优化指南](performance-optimization.md)"
313
313
 
314
314
  ### 示例 3:项目规则
315
315
  **用户**:"组件应该放在哪里?"
@@ -324,8 +324,8 @@ ReactLynx 镜像 React API(`useState`、`useEffect` 等),但所有生命
324
324
  - `index.scss` - 样式文件
325
325
  - `types.ts` - 类型定义(可选)
326
326
 
327
- 详细规范请参考:[AGENTS.md](./AGENTS.md) 和 [组件开发指南](.ai/prompts/component-development.md)"
327
+ 详细规范请参考:[SKILL.md](../../SKILL.md) 和 [组件开发指南](component-development.md)"
328
328
 
329
329
  ---
330
330
 
331
- *系统提示词版本: 2.0.0 | 集成: Lynx + Doubao Apps SDK | 维护: Doubao Apps SDK 团队*
331
+ *系统提示词版本: 2.0.0 | 集成: Lynx + Doubao Apps SDK | 维护: Doubao Apps SDK 团队*
@@ -136,7 +136,7 @@ console.log(info.keys, info.currentSize, info.limitSize);
136
136
  ## 引入依赖
137
137
 
138
138
  ```ts
139
- import { getLocation, getPhoneNumber, openPage, request, showToast, setStorage, getStorage } from '@doubao-apps/framework/api';
139
+ import { getLocation, getPhoneNumber, navigateTo, navigateBack, request, showToast, setStorage, getStorage } from '@doubao-apps/framework/api';
140
140
  ```
141
141
 
142
142
  ## 使用示例
@@ -144,7 +144,8 @@ import { getLocation, getPhoneNumber, openPage, request, showToast, setStorage,
144
144
  ```ts
145
145
  await showToast({ message: '保存成功' });
146
146
 
147
- const { viewId } = await openPage({ pageId: 'detail', context: {} });
147
+ await navigateTo({ url: 'detail?id=123' });
148
+ await navigateBack();
148
149
 
149
150
  const res = await request({ url: '/api/data', method: 'GET' });
150
151
 
@@ -155,85 +156,57 @@ const phone = await getPhoneNumber();
155
156
 
156
157
  以下为常用端能力 API 的节选,完整以 `@doubao-apps/framework/api` 类型定义为准。
157
158
 
158
- ### openFloatingWindow
159
+ ### navigateTo
159
160
 
160
161
  **参数**:
161
162
  ```typescript
162
163
  {
163
- /** 期望要打开的 page id */
164
- pageId: string;
165
-
166
- /** 打开页面时传入的数据,运行时通过 getViewData 获取 */
167
- pageData?: string;
168
-
169
- /** view context 对象,在全页和卡片中通过 getViewContext() 获取 */
170
- context: object;
171
-
172
- /** 打开 Page 时配置页面参数 */
173
- pageSettings?: {
174
- /**
175
- * 悬浮窗口在横向上的吸附位置
176
- *
177
- * @deprecated 最新的 Lynx 悬浮窗中已失效
178
- */
179
- align?: 'left' | 'right';
180
-
181
- /**
182
- * 设置 Lynx 悬浮窗的宽度,单位是 `px`
183
- */
184
- width?: number;
185
-
186
- /**
187
- * 设置 Lynx 悬浮窗的高度,单位是 `px`
188
- */
189
- height?: number;
190
-
191
- /**
192
- * 优先级。越高代表优先级越高,取值-2~2
193
- */
194
- priority?: number;
195
-
196
- /**
197
- * 是否自动恢复展示。在被高优悬浮窗打断时会发挥作用,只有为 true 才会得到恢复的机会,否则直接释放
198
- */
199
- autoReshow?: boolean;
200
- };
164
+ /** 跳转目标,填写页面的 pageId,可拼接 query,如 'detail?id=123' */
165
+ url: string;
201
166
  }
202
167
  ```
203
168
 
204
- **返回值**:
169
+ **返回值**: Promise
170
+
171
+ ### redirectTo
172
+
173
+ **参数**:
205
174
  ```typescript
206
175
  {
207
- /** 创建出的 view id */
208
- viewId: string;
209
-
210
- /**
211
- * 返回展示悬浮窗的结果
212
- * 0: 展示失败
213
- * 1: 展示成功
214
- * 2: 排队中
215
- */
216
- floatingShowResult?: number;
176
+ /** 跳转目标,填写页面的 pageId,如 'settings' */
177
+ url: string;
217
178
  }
218
179
  ```
219
180
 
220
- ### close
181
+ **返回值**: Promise
182
+
183
+ ### reLaunch
221
184
 
222
185
  **参数**:
223
186
  ```typescript
224
187
  {
225
- /** 要关闭的页面 id,留空(undefined) 为当前页面 */
226
- viewID?: string;
227
- /** 要关闭的多个页面 id */
228
- viewIDs?: string[];
229
- /**
230
- * @default false
231
- */
232
- animated?: boolean;
188
+ /** 跳转目标,填写页面的 pageId,如 'home' */
189
+ url: string;
233
190
  }
234
191
  ```
235
192
 
236
- **返回值**: 无(空对象)
193
+ **返回值**: Promise
194
+
195
+ ### navigateBack
196
+
197
+ **参数**:
198
+ ```typescript
199
+ {
200
+ /** 返回的页面数,默认为 1 */
201
+ delta?: number;
202
+ }
203
+ ```
204
+
205
+ **返回值**: Promise
206
+
207
+ > `close()` 已废弃,公开路由场景请优先使用 `navigateBack()`。
208
+ >
209
+ > 常规页面跳转场景下,`url` 直接使用目标页面的 `pageId`,该值一般与页面的 `aiMeta.id` 一致;需要传参时可直接拼接 query string。
237
210
 
238
211
  ### showToast
239
212
 
@@ -413,7 +386,7 @@ const phone = await getPhoneNumber();
413
386
 
414
387
  | API | 功能 | 示例 |
415
388
  |-----|------|------|
416
- | `sendQueryMessage(params)` | 发送用户消息 | `sendQueryMessage({ content: '查询天气', type: 'text', context: {} })` |
389
+ | `sendQueryMessage(params)` | 发送用户消息 | `sendQueryMessage({ content: '查询天气', type: 'text' })` |
417
390
  | `setAdditionalContext(params)` | 设置上下文 | `setAdditionalContext({ additionalContext: '...' })` |
418
391
 
419
392
  ### sendQueryMessage
@@ -426,12 +399,6 @@ const phone = await getPhoneNumber();
426
399
 
427
400
  /** 消息类型,目前仅支持 text */
428
401
  type: 'text';
429
-
430
- /** Plugin tool 或 Page/Widget 携带的上下文信息 */
431
- context: object;
432
-
433
- /** 扩展信息 */
434
- ext?: Record<string, string>;
435
402
  }
436
403
  ```
437
404
 
@@ -500,21 +467,7 @@ interface PageInput {
500
467
  [key: string]: any; // URL 参数
501
468
  }
502
469
 
503
- // Widget Input Schema
504
- interface WidgetInputSchema {
505
- type: 'object';
506
- properties: {
507
- [key: string]: {
508
- type: 'string' | 'number' | 'boolean' | 'array' | 'object';
509
- title: string;
510
- description?: string;
511
- default?: any;
512
- };
513
- };
514
- required?: string[];
515
- }
516
-
517
- // aiMeta 配置
470
+ // src/app.config.ts 中的 metadata 配置
518
471
  interface PageAIMeta {
519
472
  id: string; // 页面唯一标识
520
473
  title?: string; // 页面标题
@@ -526,7 +479,15 @@ interface WidgetAIMeta {
526
479
  name?: string; // 卡片名称
527
480
  description?: string; // 卡片描述
528
481
  boxType?: 'inbox' | 'full_box'; // 卡片类型
529
- input: WidgetInputSchema; // 输入数据格式
482
+ border?: boolean; // 是否显示边框
483
+ keywords?: string[]; // 搜索关键词
484
+ titleType?: 'none' | 'normal' | 'float';
485
+ }
486
+
487
+ // Widget 渲染数据类型
488
+ interface WidgetViewData {
489
+ title: string;
490
+ content?: string;
530
491
  }
531
492
  ```
532
493