@doubao-dev/cli 0.0.14 → 0.0.15
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/bin/run.js +1 -1
- package/dist/1664.js +60 -0
- package/dist/180.js +1 -0
- package/dist/{bin/win32-x64/security_tasm_codec.exe → 1966.js} +0 -0
- package/dist/1966.js.LICENSE.txt +119 -0
- package/dist/2585.js +2 -0
- package/dist/318.js +1 -0
- package/dist/3551.js +1 -0
- package/dist/3997.js +2 -0
- package/dist/4880.js +1 -0
- package/dist/5418.js +3 -0
- package/dist/5732.js +1 -0
- package/dist/7410.js +2 -0
- package/dist/7410.js.LICENSE.txt +1 -0
- package/dist/7526.js +1 -0
- package/dist/@byted-doubao-apps/create.js +4 -5
- package/dist/@byted-doubao-apps/login.js +2 -3
- package/dist/@byted-doubao-apps/login~1.js +2 -0
- package/dist/@byted-doubao-apps/template-empty/package.json +3 -3
- package/dist/@byted-doubao-apps/template-starter/package.json +3 -3
- package/dist/@byted-hdt/cli.js +11 -12
- package/dist/@inquirer/select.js +1 -0
- package/dist/app.js +1 -2
- package/dist/assets/web-sdk-debugger/index.html +1 -1
- package/dist/assets/web-sdk-debugger/static/css/{index.4b84c01189.css → index.123e72a5bc.css} +1 -1
- package/dist/assets/web-sdk-debugger/static/js/index.019ceb233a.js +26 -0
- package/dist/assets/web-sdk-debugger/wsd/doubao-apps-api.template.js +0 -0
- package/dist/assets/web-sdk-debugger/wsd/doubao-apps-framework.template.js +0 -0
- package/dist/auth.js +1 -2
- package/dist/browser.js +1 -2
- package/dist/components-loader.js +2 -3
- package/dist/dbx-demo.js +2 -3
- package/dist/demo-server.js +3 -4
- package/dist/dev-service-client.js +16 -10
- package/dist/dev-service-client.js.LICENSE.txt +89 -0
- package/dist/dev-shell.js +5 -2
- package/dist/dev-shell.js.LICENSE.txt +59 -0
- package/dist/dev.js +18 -19
- package/dist/devtools.js +2 -0
- package/dist/devtools.js.LICENSE.txt +1 -0
- package/dist/environment.js +1 -0
- package/dist/eval.js +1 -2
- package/dist/get.js +1 -2
- package/dist/init.js +6 -7
- package/dist/login.js +1 -2
- package/dist/main.js +1 -0
- package/dist/manifest-mcp-config.js +1 -2
- package/dist/project-layout.js +1 -2
- package/dist/prompt.js +5 -6
- package/dist/push-page.js +1 -2
- package/dist/push-widget.js +1 -2
- package/dist/rslib-runtime.js +1 -2
- package/dist/sandbox.js +1 -2
- package/dist/sdk.js +76 -169
- package/dist/sdk.js.LICENSE.txt +1 -13
- package/dist/sdk~1.js +218 -0
- package/dist/sdk~1.js.LICENSE.txt +15 -0
- package/dist/skills.js +2 -3
- package/dist/static/404/404.html +455 -0
- package/dist/static/assets/package.json +137 -0
- package/dist/static/home_choose/chooseRegion.html +345 -0
- package/dist/static/openChrome.applescript +88 -0
- package/dist/status.js +2 -3
- package/dist/status~1.js +1 -2
- package/dist/stop.js +1 -2
- package/dist/update.js +1 -2
- package/dist/upgrade.js +1 -2
- package/dist/upload.js +7 -8
- package/dist/validate.js +1 -2
- package/dist/yaml.js +25 -0
- package/package.json +34 -35
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/01-/345/237/272/347/241/200.md +114 -7
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/02-/347/263/273/347/273/237.md +126 -0
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/06-/344/272/244/344/272/222.md +71 -0
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/08-/347/275/221/347/273/234.md +222 -0
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/10-/344/270/232/345/212/241/350/203/275/345/212/233.md +122 -0
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/groups.md +5 -5
- package/skills/doubao-agentic-service-development/references/frontend/doubao-agentic-service-api/quick-reference.md +7 -2
- package/dist/183.js +0 -2
- package/dist/564.js +0 -13
- package/dist/714.js +0 -1
- package/dist/assets/web-sdk-debugger/static/js/index.62b5cae841.js +0 -26
- package/dist/bin/darwin-arm64/security_tasm_codec +0 -0
- package/dist/bin/darwin-arm64/security_tasm_codec.sha256 +0 -1
- package/dist/bin/darwin-x64/security_tasm_codec +0 -0
- package/dist/bin/darwin-x64/security_tasm_codec.sha256 +0 -1
- package/dist/bin/linux-x64/security_tasm_codec +0 -0
- package/dist/bin/linux-x64/security_tasm_codec.sha256 +0 -1
- package/dist/bin/win32-x64/security_tasm_codec.exe.sha256 +0 -1
- package/dist/index.js +0 -1
- package/dist/package.json +0 -56
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| [expiredWidget](#expiredwidget) | 更新过期的 Widget 为固定卡片。 |
|
|
13
13
|
| [openApp](#openapp) | 通过 deep link 等方式打开外部应用。 |
|
|
14
14
|
| [getPrivacySetting](#getprivacysetting) | 获取隐私设置状态。 |
|
|
15
|
+
| [sendFollowUpMessage](#sendfollowupmessage) | 以用户身份发送后续消息,触发新一轮对话或 API 调用。 |
|
|
15
16
|
| [createTask](#createtask) | 创建任务。 |
|
|
16
17
|
| [updateModelContext](#updatemodelcontext) | 向 Agent 捐赠上下文。 |
|
|
17
18
|
| [updateWidget](#updatewidget) | 更新指定 Widget 卡片实例的渲染数据。 用于卡片内操作后刷新卡片展示、把服务端最新结果写回卡片,或由 Page 根据传入的 widgetInstanceId 更新原卡片;需要替换卡片类型时可同时传入新的 widgetId。 |
|
|
@@ -352,6 +353,93 @@ console.log(needAuthorization);
|
|
|
352
353
|
}
|
|
353
354
|
```
|
|
354
355
|
|
|
356
|
+
<a id="sendfollowupmessage"></a>
|
|
357
|
+
### sendFollowUpMessage()
|
|
358
|
+
|
|
359
|
+
# sendFollowUpMessage
|
|
360
|
+
|
|
361
|
+
以用户身份发送后续消息,触发新一轮对话或 API 调用。
|
|
362
|
+
|
|
363
|
+
## 支持版本
|
|
364
|
+
|
|
365
|
+
前端库版本不低于 `0.0.37`。
|
|
366
|
+
|
|
367
|
+
## 支持平台
|
|
368
|
+
|
|
369
|
+
<table>
|
|
370
|
+
<thead>
|
|
371
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
372
|
+
</thead>
|
|
373
|
+
<tbody>
|
|
374
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
375
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
376
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
377
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
378
|
+
</tbody>
|
|
379
|
+
</table>
|
|
380
|
+
|
|
381
|
+
## 接入准备
|
|
382
|
+
|
|
383
|
+
### 前置条件
|
|
384
|
+
|
|
385
|
+
- **Android**:在卡片或智能服务页面中调用
|
|
386
|
+
- **iOS**:在卡片或智能服务页面中调用,且当前上下文已关联有效会话
|
|
387
|
+
|
|
388
|
+
## 使用说明
|
|
389
|
+
|
|
390
|
+
可在卡片或智能服务页面中调用,不支持在 app.ts 代码中调用。客户端会根据调用上下文关联会话:
|
|
391
|
+
卡片使用其所在会话,从卡片打开的页面沿用该会话,其他页面使用主会话。
|
|
392
|
+
|
|
393
|
+
- Promise 解析表示发送请求已提交,不表示消息已成功送达;实际发送失败不会通过该 Promise 返回。
|
|
394
|
+
|
|
395
|
+
## 调用方式
|
|
396
|
+
|
|
397
|
+
### 异步 API
|
|
398
|
+
|
|
399
|
+
```typescript
|
|
400
|
+
sendFollowUpMessage(params: SendFollowUpMessageParams): Promise<object>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
## 入参
|
|
404
|
+
|
|
405
|
+
<table>
|
|
406
|
+
<thead>
|
|
407
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
408
|
+
</thead>
|
|
409
|
+
<tbody>
|
|
410
|
+
<tr><td><code>content</code></td><td><code>Content[]</code></td><td>是</td><td>-</td><td>至少包含一条 text 类型且 text 不为空白的消息;第一条符合条件的消息作为本轮用户输入。</td><td>消息内容。</td></tr>
|
|
411
|
+
<tr><td><code>content[].text</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>后续消息的文本内容。</td></tr>
|
|
412
|
+
<tr><td><code>content[].type</code></td><td><code>"text"</code></td><td>是</td><td>-</td><td>-</td><td>文本消息。</td></tr>
|
|
413
|
+
<tr><td><code>content[].data</code></td><td><code>object</code></td><td>是</td><td>-</td><td>-</td><td>要调用的 API 及其参数。</td></tr>
|
|
414
|
+
<tr><td><code>content[].data.arguments</code></td><td><code>object</code></td><td>是</td><td>-</td><td>-</td><td>API 调用参数。</td></tr>
|
|
415
|
+
<tr><td><code>content[].data.name</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>API 名称。</td></tr>
|
|
416
|
+
<tr><td><code>content[].type</code></td><td><code>"api/call"</code></td><td>是</td><td>-</td><td>-</td><td>API 调用消息。</td></tr>
|
|
417
|
+
</tbody>
|
|
418
|
+
</table>
|
|
419
|
+
|
|
420
|
+
## 调用示例
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
import { sendFollowUpMessage } from '@doubao-dev/framework/api';
|
|
424
|
+
|
|
425
|
+
await sendFollowUpMessage({
|
|
426
|
+
content: [
|
|
427
|
+
{ type: 'text', text: '选择拿铁' },
|
|
428
|
+
{
|
|
429
|
+
type: 'api/call',
|
|
430
|
+
data: {
|
|
431
|
+
name: 'selectDrink',
|
|
432
|
+
arguments: { drinkId: 'latte_001' }
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
]
|
|
436
|
+
});
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## 成功返回
|
|
440
|
+
|
|
441
|
+
无返回字段。
|
|
442
|
+
|
|
355
443
|
<a id="createtask"></a>
|
|
356
444
|
### createTask()
|
|
357
445
|
|
|
@@ -691,6 +779,40 @@ await updateWidget({
|
|
|
691
779
|
|
|
692
780
|
• **needAuthorization**: `boolean` - 是否需要用户对隐私协议进行授权
|
|
693
781
|
|
|
782
|
+
<a id="content"></a>
|
|
783
|
+
### Content
|
|
784
|
+
|
|
785
|
+
后续消息内容。
|
|
786
|
+
|
|
787
|
+
#### Type
|
|
788
|
+
|
|
789
|
+
`| {
|
|
790
|
+
/** 文本消息。 */
|
|
791
|
+
type: 'text';
|
|
792
|
+
/** 后续消息的文本内容。 */
|
|
793
|
+
text: string;
|
|
794
|
+
}
|
|
795
|
+
| {
|
|
796
|
+
/** API 调用消息。 */
|
|
797
|
+
type: 'api/call';
|
|
798
|
+
/** 要调用的 API 及其参数。 */
|
|
799
|
+
data: {
|
|
800
|
+
/** API 名称。 */
|
|
801
|
+
name: string;
|
|
802
|
+
/** API 调用参数。 */
|
|
803
|
+
arguments: object;
|
|
804
|
+
};
|
|
805
|
+
}`
|
|
806
|
+
|
|
807
|
+
<a id="sendfollowupmessageparams"></a>
|
|
808
|
+
### SendFollowUpMessageParams
|
|
809
|
+
|
|
810
|
+
发送后续消息的请求参数。
|
|
811
|
+
|
|
812
|
+
#### Properties
|
|
813
|
+
|
|
814
|
+
• **content**: `Content[]` - 消息内容
|
|
815
|
+
|
|
694
816
|
<a id="tasktype"></a>
|
|
695
817
|
### TaskType
|
|
696
818
|
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
| 分组 | 说明 | API 数量 | 详细文档 |
|
|
8
8
|
| --- | --- | ---: | --- |
|
|
9
|
-
| 基础 | 账号、授权、宿主基础信息、窗口信息和能力可用性。 |
|
|
10
|
-
| 系统 | 宿主基础信息、窗口信息和系统设置。 |
|
|
9
|
+
| 基础 | 账号、授权、宿主基础信息、窗口信息和能力可用性。 | 6 | [查看](./01-基础.md) |
|
|
10
|
+
| 系统 | 宿主基础信息、窗口信息和系统设置。 | 9 | [查看](./02-系统.md) |
|
|
11
11
|
| 定位 | 获取设备当前的地理位置信息。 | 7 | [查看](./03-定位.md) |
|
|
12
12
|
| 存储 | 本地缓存;带 Sync 后缀的是同步 API。 | 10 | [查看](./04-存储.md) |
|
|
13
13
|
| 路由 | 应用内页面跳转、返回、退出和关闭。 | 5 | [查看](./05-路由.md) |
|
|
14
|
-
| 交互 | Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。 |
|
|
14
|
+
| 交互 | Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。 | 8 | [查看](./06-交互.md) |
|
|
15
15
|
| 输入 | 键盘和输入框选区能力。 | 2 | [查看](./07-输入.md) |
|
|
16
|
-
| 网络 | 网络请求与 WebSocket。 |
|
|
16
|
+
| 网络 | 网络请求与 WebSocket。 | 3 | [查看](./08-网络.md) |
|
|
17
17
|
| 媒体 | 图片选择、预览、保存、压缩和信息读取;录音管理;背景音频和内部音频播放。 | 8 | [查看](./09-媒体.md) |
|
|
18
|
-
| 业务能力 | 开放业务能力、卡片更新、模型上下文、任务、隐私设置和外部应用打开。 |
|
|
18
|
+
| 业务能力 | 开放业务能力、卡片更新、模型上下文、任务、隐私设置和外部应用打开。 | 8 | [查看](./10-业务能力.md) |
|
|
19
19
|
| 登录 | 豆包一次性登录凭证、Widget 登录交互和 MCP 授权结果回传能力。 | 3 | [查看](./11-登录.md) |
|
|
20
20
|
| 支付 | 订单创建、普通支付、平台免密支付、纯签约和支付并签约能力。 | 5 | [查看](./12-支付.md) |
|
|
21
21
|
| 数据分析 | 监控上报、事件和数据分析上报。 | 1 | [查看](./13-数据分析.md) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 这是豆包智能服务运行时 API,也称 Open API。默认从 `@doubao-dev/framework/api` 导入;本文件根据 `packages/open-api/src` 的导出结构自动生成,按模块列出 API 名称和说明。
|
|
4
4
|
|
|
5
|
-
覆盖
|
|
5
|
+
覆盖 142 个函数。详细参数、返回值、示例和相关类型请查看 [豆包智能服务的端能力 API 分组目录](groups.md),精确字段也可按参数/结果类型名查看 IDE 类型提示或 `@doubao-dev/framework/api` 类型定义。
|
|
6
6
|
|
|
7
7
|
## 使用方式
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ import { showToast, request, getStorage } from '@doubao-dev/framework/api';
|
|
|
19
19
|
| 网络请求、调用业务后端 | 发 HTTP 请求、读取接口数据、提交表单数据 | [request](08-网络.md#request) |
|
|
20
20
|
| 本地缓存 | 保存、读取、删除或清空本地数据;需要同步读取时选 Sync API | [setStorage](04-存储.md#setstorage)、[getStorage](04-存储.md#getstorage)、[removeStorage](04-存储.md#removestorage)、[clearStorage](04-存储.md#clearstorage)、[setStorageSync](04-存储.md#setstoragesync)、[getStorageSync](04-存储.md#getstoragesync) |
|
|
21
21
|
| 页面跳转、返回、退出 | 打开页面、替换页面、重启页面栈、返回上一页或退出智能服务 | [navigateTo](05-路由.md#navigateto)、[redirectTo](05-路由.md#redirectto)、[reLaunch](05-路由.md#relaunch)、[navigateBack](05-路由.md#navigateback)、[exitApp](05-路由.md#exitapp) |
|
|
22
|
-
| Toast、Loading、弹窗和菜单 | 给用户反馈操作结果、展示确认框、底部弹窗或操作菜单 | [showToast](06-交互.md#showtoast)、[showLoading](06-交互.md#showloading)、[hideLoading](06-交互.md#hideloading)、[showModal](06-交互.md#showmodal)、[showActionSheet](06-交互.md#showactionsheet)、[showBottomSheet](06-交互.md#showbottomsheet) |
|
|
22
|
+
| Toast、Loading、弹窗和菜单 | 给用户反馈操作结果、展示确认框、底部弹窗或操作菜单 | [showToast](06-交互.md#showtoast)、[showLoading](06-交互.md#showloading)、[hideLoading](06-交互.md#hideloading)、[hideToast](06-交互.md#hidetoast)、[showModal](06-交互.md#showmodal)、[showActionSheet](06-交互.md#showactionsheet)、[showBottomSheet](06-交互.md#showbottomsheet) |
|
|
23
23
|
| 更新或固定聊天卡片 | 刷新指定 Widget 卡片的数据、切换卡片类型,或把过期卡片替换成固定卡片 | [updateWidget](10-业务能力.md#updatewidget)、[expiredWidget](10-业务能力.md#expiredwidget) |
|
|
24
24
|
| 影响模型后续行为 | 把页面/卡片上下文补充给模型,或把按钮点击、选项选择、表单提交转成动作指令 | [updateModelContext](10-业务能力.md#updatemodelcontext)、[dispatchActionDirective](10-业务能力.md#dispatchactiondirective) |
|
|
25
25
|
| 任务管理 | 创建智能服务任务并关联后续业务 | [createTask](10-业务能力.md#createtask) |
|
|
@@ -43,6 +43,7 @@ import { showToast, request, getStorage } from '@doubao-dev/framework/api';
|
|
|
43
43
|
| [authorize](01-基础.md#authorize) | 提前向用户发起指定 scope 的应用授权。 |
|
|
44
44
|
| [getPackageInfoSync](01-基础.md#getpackageinfosync) | 同步获取当前 package 信息。<br><br>同步 API。 |
|
|
45
45
|
| [getSetting](01-基础.md#getsetting) | 获取用户当前的应用授权设置。 |
|
|
46
|
+
| [openSetting](01-基础.md#opensetting) | 打开智能服务授权设置页面。 |
|
|
46
47
|
|
|
47
48
|
## 系统
|
|
48
49
|
|
|
@@ -52,6 +53,7 @@ import { showToast, request, getStorage } from '@doubao-dev/framework/api';
|
|
|
52
53
|
| --- | --- |
|
|
53
54
|
| [getWindowInfoSync](02-系统.md#getwindowinfosync) | 获取窗口信息。<br><br>同步 API。 |
|
|
54
55
|
| [getSystemSetting](02-系统.md#getsystemsetting) | 获取设备设置。 |
|
|
56
|
+
| [getAppAuthorizeSetting](02-系统.md#getappauthorizesetting) | 获取宿主应用的系统授权设置。 调用只读取当前系统授权状态,不会申请权限或触发系统授权弹窗。状态字段固定返回 authorized、denied 或 not determined。 |
|
|
55
57
|
| [getAppBaseInfoSync](02-系统.md#getappbaseinfosync) | 获取应用基础信息。<br><br>同步 API。 |
|
|
56
58
|
| [getWindowInfo](02-系统.md#getwindowinfo) | 获取窗口信息。 |
|
|
57
59
|
| [getAppBaseInfo](02-系统.md#getappbaseinfo) | 获取应用基础信息。 |
|
|
@@ -110,6 +112,7 @@ Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。
|
|
|
110
112
|
| --- | --- |
|
|
111
113
|
| [showModal](06-交互.md#showmodal) | 显示模态对话框。 |
|
|
112
114
|
| [showLoading](06-交互.md#showloading) | 显示 loading 提示框。 |
|
|
115
|
+
| [hideToast](06-交互.md#hidetoast) | 隐藏当前 Toast。 |
|
|
113
116
|
| [hideLoading](06-交互.md#hideloading) | 隐藏当前 loading。 |
|
|
114
117
|
| [showActionSheet](06-交互.md#showactionsheet) | 显示操作菜单。 |
|
|
115
118
|
| [showBottomSheet](06-交互.md#showbottomsheet) | 显示 Native 底部弹窗。 |
|
|
@@ -133,6 +136,7 @@ Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。
|
|
|
133
136
|
| --- | --- |
|
|
134
137
|
| [request](08-网络.md#request) | 发起网络请求。 request 本身不接受泛型参数;如需业务数据类型,请读取 result.data 后再做类型收窄或断言。 |
|
|
135
138
|
| [connectSocket](08-网络.md#connectsocket) | 创建一个 WebSocket 连接,并返回可操作该连接的 SocketTask。 该 API 会同步返回 SocketTask,但连接创建本身是异步过程。调用方应先在返回的 SocketTask 上注册事件回调,再等待 onOpen 表示连接可用。后续发送消息使用 SocketTask.send,关闭连接使用 SocketTask.close。 |
|
|
139
|
+
| [uploadFile](08-网络.md#uploadfile) | 上传本地文件,并返回可用于监听进度和中断上传的 UploadTask。 |
|
|
136
140
|
|
|
137
141
|
## 媒体
|
|
138
142
|
|
|
@@ -159,6 +163,7 @@ Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。
|
|
|
159
163
|
| [expiredWidget](10-业务能力.md#expiredwidget) | 更新过期的 Widget 为固定卡片。 |
|
|
160
164
|
| [openApp](10-业务能力.md#openapp) | 通过 deep link 等方式打开外部应用。 |
|
|
161
165
|
| [getPrivacySetting](10-业务能力.md#getprivacysetting) | 获取隐私设置状态。 |
|
|
166
|
+
| [sendFollowUpMessage](10-业务能力.md#sendfollowupmessage) | 以用户身份发送后续消息,触发新一轮对话或 API 调用。 |
|
|
162
167
|
| [createTask](10-业务能力.md#createtask) | 创建任务。 |
|
|
163
168
|
| [updateModelContext](10-业务能力.md#updatemodelcontext) | 向 Agent 捐赠上下文。 |
|
|
164
169
|
| [updateWidget](10-业务能力.md#updatewidget) | 更新指定 Widget 卡片实例的渲染数据。 用于卡片内操作后刷新卡片展示、把服务端最新结果写回卡片,或由 Page 根据传入的 widgetInstanceId 更新原卡片;需要替换卡片类型时可同时传入新的 widgetId。 |
|
package/dist/183.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"node:module";import{createHash as e}from"node:crypto";import{existsSync as r,readFileSync as t,statSync as i}from"node:fs";import{basename as n}from"node:path";import o from"yaml";import{app_MiniAppVersionSourceType as s}from"./app.js";import{resolveProjectLayout as p}from"./project-layout.js";import{FRONTEND_ARCHIVE_FILENAME as a,http_getApiBaseUrl as f,isRecord as m}from"./564.js";function l(e,n,s){let a=s??p(e).manifestPath;if(!r(a)){if(n)return n;throw Error(`missing AppID: manifest file not found: ${a}`)}let f=function(e){let r;if(!i(e).isFile())throw Error(`missing AppID: manifest path is not a file: ${e}`);try{r=o.parse(t(e,"utf8"))}catch(t){let r=t instanceof Error?t.message:String(t);throw Error(`invalid manifest.yaml: ${e}: ${r}`)}let n=m(r)?r.app_key:void 0;if("string"==typeof n&&n.trim())return n.trim();throw Error(`missing AppID: write app_key in ${e}`)}(a);if(n&&n!==f)throw Error(`AppID mismatch: --app-id is ${n}, but manifest.app_key is ${f}. Update the resolved Manifest; it is the single source of truth.`);return f}function c(r){let o=t(r.file),s=i(r.file);return{type:r.type,file:r.file,file_name:n(r.file),file_size:s.size,sha256:e("sha256").update(o).digest("hex"),remote_file_name:function(e){switch(e){case"manifest":return"manifest.yaml";case"skill":return"skill.zip";case"frontend_code":return a}}(r.type),replaced:!0}}function u(e){switch(e){case"manifest":return s.MANIFEST;case"skill":return s.SKILL;case"frontend_code":return s.SOURCE_CODE}}function _(e){return`${h()}/agentic_service/${encodeURIComponent(e)}`}function d(e,r){return`${h()}/agentic_service/${encodeURIComponent(e)}/versions/${encodeURIComponent(r)}`}function h(){return f().replace(/\/+$/,"")}export{c as describeWorkspaceUpload,_ as miniAppDetailUrl,d as miniAppVersionDetailUrl,l as resolveAppKey,u as sourceTypeForWorkspaceFileType};
|
|
2
|
-
//# sourceMappingURL=183.js.map
|
package/dist/564.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var e,t,r,o;let n,a;import{createRequire as i}from"node:module";import{Command as s,CommanderError as c,InvalidArgumentError as l}from"commander";import{execa as d}from"execa";import u from"chalk";import p,*as f from"node:os";import h,*as w from"node:path";import{execFile as m,spawn as _}from"node:child_process";import g from"node:crypto";import{promises as y}from"node:fs";import{promisify as v}from"node:util";import{__webpack_require__ as b}from"./rslib-runtime.js";let E=i(import.meta.url);import*as S from"node:fs";b.add({assert(e){e.exports=E("assert")},"buffer?a044"(e){e.exports=E("buffer")},"child_process?e854"(e){e.exports=E("child_process")},"crypto?c6b6"(e){e.exports=E("crypto")},events(e){e.exports=E("events")},"fs?8b28"(e){e.exports=E("fs")},"http?f14b"(e){e.exports=E("http")},"https?1233"(e){e.exports=E("https")},net(e){e.exports=E("net")},"node:assert"(e){e.exports=E("node:assert")},"node:async_hooks?84a7"(e){e.exports=E("node:async_hooks")},"node:buffer"(e){e.exports=E("node:buffer")},"node:console"(e){e.exports=E("node:console")},"node:crypto?f06a"(e){e.exports=E("node:crypto")},"node:diagnostics_channel"(e){e.exports=E("node:diagnostics_channel")},"node:dns"(e){e.exports=E("node:dns")},"node:events"(e){e.exports=E("node:events")},"node:fs?9592"(e){e.exports=E("node:fs")},"node:http?45bc"(e){e.exports=E("node:http")},"node:http2"(e){e.exports=E("node:http2")},"node:net?742f"(e){e.exports=E("node:net")},"node:os?593a"(e){e.exports=E("node:os")},"node:path?435f"(e){e.exports=E("node:path")},"node:perf_hooks"(e){e.exports=E("node:perf_hooks")},"node:querystring"(e){e.exports=E("node:querystring")},"node:stream?3c93"(e){e.exports=E("node:stream")},"node:tls"(e){e.exports=E("node:tls")},"node:url?b4ec"(e){e.exports=E("node:url")},"node:util?fdfb"(e){e.exports=E("node:util")},"node:util/types"(e){e.exports=E("node:util/types")},"node:worker_threads"(e){e.exports=E("node:worker_threads")},"node:zlib"(e){e.exports=E("node:zlib")},"os?da1a"(e){e.exports=E("os")},"path?aeb1"(e){e.exports=E("path")},"stream?1b1a"(e){e.exports=E("stream")},string_decoder(e){e.exports=E("string_decoder")},tls(e){e.exports=E("tls")},tty(e){e.exports=E("tty")},"url?b918"(e){e.exports=E("url")},"util?f585"(e){e.exports=E("util")},"zlib?f21e"(e){e.exports=E("zlib")}});let x={authBaseUrl:"https://developer.doubao.com",apiBaseUrl:"https://developer.doubao.com",authAllowedOrigins:["https://developer.doubao.com"],excludeCommands:[],requestHeaders:{}},A=new Set(["x-tt-env","x-use-ppe"]),U=(r=x,{authBaseUrl:(o=(a=process.env.DBX_BUILD_BASE_DOMAIN?$(function(e){let t=e.trim();if(/^http:\/\//i.test(t))throw Error("DBX build config baseDomain must use https");return/^https:\/\//i.test(t)?t:`https://${t}`}(process.env.DBX_BUILD_BASE_DOMAIN),"baseDomain"):void 0,{authBaseUrl:process.env.DBX_BUILD_AUTH_BASE_URL?$(process.env.DBX_BUILD_AUTH_BASE_URL,"authBaseUrl"):a,apiBaseUrl:process.env.DBX_BUILD_API_BASE_URL?$(process.env.DBX_BUILD_API_BASE_URL,"apiBaseUrl"):a,authAllowedOrigins:process.env.DBX_BUILD_AUTH_ALLOWED_ORIGINS?C(process.env.DBX_BUILD_AUTH_ALLOWED_ORIGINS):void 0,excludeCommands:process.env.DBX_BUILD_EXCLUDE_COMMANDS?C(process.env.DBX_BUILD_EXCLUDE_COMMANDS):void 0,requestHeaders:process.env.DBX_BUILD_REQUEST_HEADERS_JSON?function(e){let t=JSON.parse(e);if("object"!=typeof t||null===t||Array.isArray(t))throw Error("DBX_BUILD_REQUEST_HEADERS_JSON must be a JSON object");let r={};for(let[e,o]of Object.entries(t)){let t=e.toLowerCase();if(A.has(t)){if("string"!=typeof o)throw Error(`DBX_BUILD_REQUEST_HEADERS_JSON header ${t} must have a string value`);r[t]=o}}return r}(process.env.DBX_BUILD_REQUEST_HEADERS_JSON):void 0})).authBaseUrl??r.authBaseUrl,apiBaseUrl:o.apiBaseUrl??r.apiBaseUrl,authAllowedOrigins:[...r.authAllowedOrigins,...o.authAllowedOrigins??[]],excludeCommands:o.excludeCommands??r.excludeCommands,requestHeaders:{...r.requestHeaders,...o.requestHeaders??{}}});function k(){var e;return{baseUrl:$(U.authBaseUrl,"authBaseUrl"),allowedOrigins:[...new Set([I((e=U).authBaseUrl,"authBaseUrl"),I(e.apiBaseUrl,"apiBaseUrl"),...e.authAllowedOrigins.map(e=>I(e,"authAllowedOrigins"))])],requestHeaders:U.requestHeaders}}function T(){return $(U.apiBaseUrl,"apiBaseUrl")}function D(e){return e.replace(/\/+$/,"")}function $(e,t){let r;try{r=new URL(D(e))}catch{throw Error(`DBX build config ${t} must be an absolute HTTPS URL`)}if("https:"!==r.protocol)throw Error(`DBX build config ${t} must use https`);return D(r.toString())}function I(e,t){return new URL($(e,t)).origin}function C(e){return"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):Array.isArray(e)?e.map(e=>String(e).trim()).filter(Boolean):[]}let N=JSON.parse('{"UU":"@doubao-dev/cli"}').UU;function O(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let B=/^v?(\d+)\.(\d+)\.(\d+)(?:[-+][0-9A-Za-z.-]+)?$/;function P(e){return e.trim().replace(/^v/i,"")}function H(e){return B.test(e.trim())}function R(e,t){let r=L(e),o=L(t);if(!r||!o)throw Error(`Invalid semver: ${!r?e:t}`);for(let e=0;e<3;e+=1){if(r[e]>o[e])return 1;if(r[e]<o[e])return -1}return 0}function L(e){let t=e.trim().match(B);return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}function j(e,t,r,o=!!(process.stdin.isTTY&&process.stderr.isTTY)){if(r||!o)return!1;let n=e.indexOf("--",2);return!e.slice(2,n<0?void 0:n).some(e=>["-h","--help","-V","--version"].includes(e))&&t?.[0]!=="upgrade"}async function K(e,t={}){if(!(t.interactive??!!(process.stdin.isTTY&&process.stderr.isTTY))||z(e))return;let r=G(),o=Date.now();if(function(e,t,r=Date.now()){let o=t?.attempted_at??t?.checked_at;return!o||r-o>=(F(e,t)?864e5:9e5)}(e,r,o)){V({...r??{},attempted_at:o});try{await M({currentVersion:e,runner:t.runner,timeoutMs:t.timeoutMs??5e3})}catch{}}}async function M(e){if(z(e.currentVersion))return;let t=e.runner??{npmView:async t=>(await d("npm",["view",t,"version"],{env:process.env,stdio:["ignore","pipe","pipe"],timeout:e.timeoutMs})).stdout.trim()};await q(e.currentVersion,t)}function F(e,t){let r=P(t?.latest_version??""),o=P(e);return!H(r)||!H(o)||0>=R(r,o)||P(t?.ignored_version??"")===r?null:{current:o,latest:r,message:`dbx ${r} available, current ${o}, run: dbx upgrade`,command:"dbx upgrade"}}async function X(e){let t=P(e);if(!H(t))return;let r=Date.now();V({...G()??{},latest_version:t,checked_at:r,attempted_at:r})}function J(e){let t=P(e);H(t)&&V({...G()??{},ignored_version:t})}function V(e){try{S.mkdirSync(Y(),{recursive:!0}),S.writeFileSync(W(),`${JSON.stringify(e,null,2)}
|
|
2
|
-
`,"utf8")}catch{}}function z(e){return!!process.env.DBX_CLI_NO_UPDATE_NOTIFIER||!!process.env.CI||!!process.env.BUILD_NUMBER||!!process.env.RUN_ID||!H(P(e))}async function q(e,t){let r=P(await t.npmView(N)),o=P(e);H(r)&&H(o)&&await X(r)}function G(){try{let e=S.readFileSync(W(),"utf8"),t=JSON.parse(e);return O(t)?t:null}catch{return null}}function Y(){return w.join(f.homedir(),".dbx")}function W(){return w.join(Y(),"update-state.json")}let Q="0.0.14",Z=h.join(p.homedir(),".dbx","token"),ee=h.join(p.homedir(),".doubao","token"),et={};function er(e={}){let t={...et,...e},r=function(e,t){let r;try{r=new URL(eo(e))}catch{throw Error(`${t} must be an absolute HTTPS URL`)}if("https:"!==r.protocol)throw Error(`${t} must use https`);return eo(r.toString())}(t.baseUrl??"https://developer.doubao.com","baseUrl"),o=t.tokenPath??Z;return{...t,baseUrl:r,allowedOrigins:function(e,t){let r=new Set([new URL(t).origin]);for(let t of e??[]){let e;try{e=new URL(t)}catch{throw Error(`allowedOrigins entries must be absolute HTTPS origins: ${t}`)}if("https:"!==e.protocol)throw Error(`allowedOrigins entries must use https: ${t}`);r.add(e.origin)}return[...r]}(t.allowedOrigins,r),tokenPath:o,legacyTokenPath:t.tokenPath?void 0:ee,requestHeaders:new Headers(t.requestHeaders)}}function eo(e){return e.replace(/\/+$/,"")}let en=v(m),ea="byted-doubao-open-dbx-cli",ei="dbx-cli",es="aes-256-gcm";class ec extends Error{constructor(e){super(e),this.name="CredentialStoreError"}}class el{constructor(e,t){this.primary=e,this.fallback=t}async get(e){let t;try{let t=await this.primary.get(e);if(t)return t}catch(e){t=e}try{let t=await this.fallback.get(e);if(t)return t}catch(e){if(t)throw new ec(`Failed to read token from system credential store (${ey(t)}); encrypted-file fallback also failed: ${ey(e)}`);throw e}if(t)throw t instanceof Error?t:new ec(`Failed to read token from system credential store: ${String(t)}`)}async set(e,t){let r;try{await this.primary.set(e,t)}catch(e){r=e}try{await this.fallback.set(e,t)}catch(e){if(r)throw new ec(`Failed to write token to system credential store (${ey(r)}) and encrypted-file fallback (${ey(e)})`);throw e}}async delete(e){let t;try{await this.primary.delete(e)}catch(e){t=e}try{await this.fallback.delete(e)}catch(e){if(t)throw new ec(`Failed to delete token from system credential store (${ey(t)}) and encrypted-file fallback (${ey(e)})`);throw e}}}class ed{constructor(e={}){this.baseDir=e.baseDir??("darwin"===process.platform?h.join(p.homedir(),"Library","Application Support",ei):"win32"===process.platform?h.join(process.env.APPDATA||h.join(p.homedir(),"AppData","Roaming"),ei):h.join(process.env.XDG_DATA_HOME||h.join(p.homedir(),".local","share"),ei))}async get(e){var t,r;let o,n,a=this.credentialFilePath(e);try{o=await y.readFile(a,"utf8")}catch(e){if(eg(e)&&"ENOENT"===e.code)return;throw new ec(`Failed to read encrypted token file: ${ey(e)}`)}try{n=JSON.parse(o)}catch(e){throw new ec(`Encrypted token file is not valid JSON: ${ey(e)}`)}if(!((t=n)&&"object"==typeof t&&1===t.version&&t.algorithm===es&&"string"==typeof t.iv&&"string"==typeof t.authTag&&"string"==typeof t.ciphertext))throw new ec("Encrypted token file has an unsupported format");let i=await this.readMasterKey();try{let t=g.createDecipheriv(es,i,Buffer.from(n.iv,"base64url"));return t.setAAD(Buffer.from((r=e,`${ea}:${r}`),"utf8")),t.setAuthTag(Buffer.from(n.authTag,"base64url")),Buffer.concat([t.update(Buffer.from(n.ciphertext,"base64url")),t.final()]).toString("utf8")}catch(e){throw new ec(`Failed to decrypt encrypted token file: ${ey(e)}`)}}async set(e,t){var r;let o=await this.readOrCreateMasterKey(),n=g.randomBytes(12),a=g.createCipheriv(es,o,n);a.setAAD(Buffer.from((r=e,`${ea}:${r}`),"utf8"));let i=Buffer.concat([a.update(t,"utf8"),a.final()]),s={version:1,algorithm:es,iv:n.toString("base64url"),authTag:a.getAuthTag().toString("base64url"),ciphertext:i.toString("base64url")};await ef(this.credentialFilePath(e),`${JSON.stringify(s,null,2)}
|
|
3
|
-
`)}async delete(e){try{await y.unlink(this.credentialFilePath(e))}catch(e){if(!eg(e)||"ENOENT"!==e.code)throw new ec(`Failed to delete encrypted token file: ${ey(e)}`)}}masterKeyPath(){return h.join(this.baseDir,"master.key")}credentialFilePath(e){let t=g.createHash("sha256").update(e).digest("hex");return h.join(this.baseDir,"credentials",`${t}.json`)}async readMasterKey(){try{var e=await y.readFile(this.masterKeyPath(),"utf8");let t=Buffer.from(e.trim(),"base64url");if(32!==t.length)throw new ec("Encrypted token master key has an unsupported format");return t}catch(e){if(eg(e)&&"ENOENT"===e.code)throw new ec("Encrypted token master key is missing");if(e instanceof ec)throw e;throw new ec(`Failed to read encrypted token master key: ${ey(e)}`)}}async readOrCreateMasterKey(){try{return await this.readMasterKey()}catch(e){if(!(e instanceof ec)||!e.message.includes("master key is missing"))throw e}let e=g.randomBytes(32);try{return await ef(this.masterKeyPath(),`${e.toString("base64url")}
|
|
4
|
-
`),e}catch(e){if(eg(e)&&"EEXIST"===e.code)return this.readMasterKey();throw new ec(`Failed to write encrypted token master key: ${ey(e)}`)}}}class eu{async get(e){try{let{stdout:t}=await en("security",["find-generic-password","-a",e,"-s",ea,"-w"]);return String(t).replace(/\n$/,"")}catch(e){if(eh(e))return;throw new ec(`Failed to read token from macOS Keychain: ${ey(e)}`)}}async set(e,t){try{await en("security",["add-generic-password","-a",e,"-s",ea,"-w",t,"-U"])}catch(e){throw new ec(`Failed to write token to macOS Keychain: ${ey(e)}`)}}async delete(e){try{await en("security",["delete-generic-password","-a",e,"-s",ea])}catch(e){if(eh(e))return;throw new ec(`Failed to delete token from macOS Keychain: ${ey(e)}`)}}}class ep{async get(e){try{let{stdout:t}=await en("secret-tool",["lookup","service",ea,"account",e]);return String(t).replace(/\n$/,"")}catch(e){if(ew(e))return;throw new ec(`Failed to read token from Secret Service: ${ey(e)}`)}}async set(e,t){try{var r,o,n;await (r="secret-tool",o=["store","--label","Doubao Open CLI token","service",ea,"account",e],n=t,new Promise((e,t)=>{let a=_(r,o,{stdio:["pipe","ignore","pipe"]}),i="";a.stderr.setEncoding("utf8"),a.stderr.on("data",e=>{i+=String(e)}),a.on("error",t),a.on("close",o=>{0===o?e():t(Error(i.trim()||`${r} exited with code ${o}`))}),a.stdin.end(n)}))}catch(e){throw new ec(`Failed to write token to Secret Service: ${ey(e)}`)}}async delete(e){try{await en("secret-tool",["clear","service",ea,"account",e])}catch(e){if(ew(e))return;throw new ec(`Failed to delete token from Secret Service: ${ey(e)}`)}}}async function ef(e,t){let r=h.dirname(e);await y.mkdir(r,{recursive:!0,mode:448}),"win32"!==process.platform&&await y.chmod(r,448);let o=h.join(r,`.${h.basename(e)}.${process.pid}.${Date.now()}.tmp`);try{await y.writeFile(o,t,{mode:384,flag:"wx"}),"win32"!==process.platform&&await y.chmod(o,384),await y.rename(o,e),"win32"!==process.platform&&await y.chmod(e,384)}finally{try{await y.unlink(o)}catch{}}}function eh(e){let t=em(e),r=e_(e);return(1===t||44===t)&&(r.includes("could not be found")||r.includes("The specified item could not be found"))}function ew(e){let t=em(e),r=e_(e);return 1===t&&(r.includes("could not be found")||r.includes("No matching items")||""===r.trim())}function em(e){return"object"==typeof e&&null!==e&&"code"in e?e.code:void 0}function e_(e){return"object"==typeof e&&null!==e&&"stderr"in e?String(e.stderr??""):""}function eg(e){return e instanceof Error&&"code"in e}function ey(e){if("object"==typeof e&&null!==e&&"stderr"in e){let t=String(e.stderr??"").trim();if(t)return t}return e instanceof Error&&e.message?e.message:String(e)}class ev extends Error{constructor(e,t){super(e),this.code=t,this.name="AuthError"}}class eb extends ev{constructor(e="Not logged in"){super(e,"NOT_LOGGED_IN"),this.name="NotLoggedInError"}}class eE extends ev{constructor(e="Login token has expired"){super(e,"TOKEN_EXPIRED"),this.name="TokenExpiredError"}}class eS extends ev{constructor(e,t="DEVICE_AUTH_FAILED",r={}){super(e,t),this.name="DeviceAuthError",this.logId=r.logId}}function ex(e){let t=function(e){let t=e.split(".")[1];if(t)try{let e=t.replace(/-/g,"+").replace(/_/g,"/"),r=e.padEnd(e.length+(4-e.length%4)%4,"="),o=Buffer.from(r,"base64").toString("utf8"),n=JSON.parse(o);return n&&"object"==typeof n?n:void 0}catch{return}}(e),r=t?.uid??t?.sub;return"string"==typeof r&&r.length>0?r:"number"==typeof r&&Number.isFinite(r)?String(r):void 0}async function eA(e,t={}){let r,o=process.env.DBX_ACCESS_TOKEN?.trim()||void 0;if(o)return{accessToken:o,tokenType:"Bearer",expiresAt:0xf4865700,baseUrl:t.envTokenBaseUrl??""};let n=await eI(e);if(void 0===n)return eC(e,t);try{r=JSON.parse(n)}catch(e){return}if(e$(r)){if(!t.allowExpired&&eT(r))return void await ek(e,t);let o=await eN(t).get(r.credentialAccount);if(!o)throw new ec("Stored login metadata exists, but the token credential is missing or inaccessible. Run dbx auth login again from a terminal that can access the credential store.");return{accessToken:o,tokenType:r.tokenType,expiresAt:r.expiresAt,baseUrl:r.baseUrl}}if(eD(r))return!t.allowExpired&&eT(r)?void await ek(e,t):(await eU(e,r,t),r)}async function eU(e,t,r={}){let o={version:2,storage:"keychain",credentialAccount:eO(e),tokenType:t.tokenType,expiresAt:t.expiresAt,baseUrl:t.baseUrl};await eN(r).set(o.credentialAccount,t.accessToken),await y.mkdir(h.dirname(e),{recursive:!0,mode:448}),"win32"!==process.platform&&await y.chmod(h.dirname(e),448);let n=`${e}.${process.pid}.${Date.now()}.tmp`;await y.writeFile(n,`${JSON.stringify(o,null,2)}
|
|
5
|
-
`,{mode:384}),"win32"!==process.platform&&await y.chmod(n,384),await y.rename(n,e),"win32"!==process.platform&&await y.chmod(e,384)}async function ek(e,t={}){let r=await eI(e);if(void 0!==r)try{let o=JSON.parse(r);e$(o)?await eN(t).delete(o.credentialAccount):await eN(t).delete(eO(e))}catch{}try{await y.unlink(e)}catch(e){if(!eB(e)||"ENOENT"!==e.code)throw e}}function eT(e,t=Math.floor(Date.now()/1e3)){return e.expiresAt<=t}function eD(e){return!!e&&"object"==typeof e&&"string"==typeof e.accessToken&&e.accessToken.length>0&&"string"==typeof e.tokenType&&e.tokenType.length>0&&"number"==typeof e.expiresAt&&Number.isFinite(e.expiresAt)&&"string"==typeof e.baseUrl&&e.baseUrl.length>0}function e$(e){return!!e&&"object"==typeof e&&2===e.version&&"keychain"===e.storage&&"string"==typeof e.credentialAccount&&e.credentialAccount.length>0&&"string"==typeof e.tokenType&&e.tokenType.length>0&&"number"==typeof e.expiresAt&&Number.isFinite(e.expiresAt)&&"string"==typeof e.baseUrl&&e.baseUrl.length>0}async function eI(e){try{return await y.readFile(e,"utf8")}catch(e){eB(e)&&e.code;return}}async function eC(e,t){let r;if(!t.legacyTokenPath||h.resolve(t.legacyTokenPath)===h.resolve(e))return;let o=await eI(t.legacyTokenPath);if(void 0!==o){try{r=JSON.parse(o)}catch{return}if(eD(r))return!t.allowExpired&&eT(r)?void await ek(t.legacyTokenPath,t):(await eU(e,r,t),await ek(t.legacyTokenPath,t),r)}}function eN(e){let t;return e.credentialStore??(t=new ed,"darwin"===process.platform?new el(new eu,t):"linux"===process.platform?new el(new ep,t):t)}function eO(e){let t=g.createHash("sha256").update(h.resolve(e)).digest("hex").slice(0,32);return`token:${t}`}function eB(e){return e instanceof Error&&"code"in e}async function eP(t={}){let r=er(t),o=r.fetch??fetch,n=r.sleep??eV,a=await eL(o,r.baseUrl,r.requestHeaders),i=ez(r.baseUrl,a.user_code);r.onVerification?.({userCode:a.user_code,verificationUrl:i,expiresIn:a.expires_in,interval:a.interval});let s=Math.max(1,a.interval),c=Date.now()+1e3*a.expires_in;for(;Date.now()<c;){await n(1e3*s);let t=await ej(o,r.baseUrl,a.device_code,r.requestHeaders);if(r.onPoll?.({status:t.status,interval:s}),t.status!==e.Pending){if(t.status===e.SlowDown){s+=Math.max(1,a.interval);continue}if(t.status===e.Expired)throw new eS("Device authorization expired","DEVICE_AUTH_EXPIRED");if(t.status===e.Invalid)throw new eS("Device authorization is invalid","DEVICE_AUTH_INVALID");if(t.status===e.Authorized){if(!t.access_token)throw new eS("Authorization response did not include an access token");let e=eJ(t,r.baseUrl);return await eU(r.tokenPath,e,{credentialStore:r.credentialStore}),{accessToken:e.accessToken,tokenType:e.tokenType,expiresAt:e.expiresAt,baseUrl:e.baseUrl,uid:ex(e.accessToken),tokenPath:r.tokenPath}}throw new eS(`Unexpected authorization status: ${String(t.status)}`)}}throw new eS("Device authorization timed out","DEVICE_AUTH_EXPIRED")}async function eH(e={}){let t=er(e),r=t.fetch??fetch,o=await eL(r,t.baseUrl,t.requestHeaders),n=ez(t.baseUrl,o.user_code);return t.onVerification?.({userCode:o.user_code,verificationUrl:n,expiresIn:o.expires_in,interval:o.interval}),{userCode:o.user_code,deviceCode:o.device_code,verificationUrl:n,expiresIn:o.expires_in,interval:o.interval}}async function eR(t,r={}){let o=er(r),n=o.fetch??fetch,a=o.sleep??eV,i=o.baseUrl,s=o.requestHeaders,c=5,l=Date.now()+6e5;for(;Date.now()<l;){await a(1e3*c);let r=await ej(n,i,t,s);if(o.onPoll?.({status:r.status,interval:c}),r.status!==e.Pending){if(r.status===e.SlowDown){c+=5;continue}if(r.status===e.Expired)throw new eS("Device authorization expired","DEVICE_AUTH_EXPIRED");if(r.status===e.Invalid)throw new eS("Device authorization is invalid","DEVICE_AUTH_INVALID");if(r.status===e.Authorized){if(!r.access_token)throw new eS("Authorization response did not include an access token");let e=eJ(r,i);return await eU(o.tokenPath,e,{credentialStore:o.credentialStore}),{accessToken:e.accessToken,tokenType:e.tokenType,expiresAt:e.expiresAt,baseUrl:e.baseUrl,uid:ex(e.accessToken),tokenPath:o.tokenPath}}throw new eS(`Unexpected authorization status: ${String(r.status)}`)}}throw new eS("Device authorization timed out","DEVICE_AUTH_EXPIRED")}async function eL(e,t,r){let o=await e(`${t}/app_developer/oauth/device/code`,{method:"POST",headers:eX(r),body:JSON.stringify({client_name:"dbx-cli"})}),n=await eK(o),a=eF(n);if(!a||!a.device_code||!a.user_code||"number"!=typeof a.expires_in||"number"!=typeof a.interval)throw new eS(`Device code response is malformed (HTTP ${o.status}): ${JSON.stringify(n)}`);return a}async function ej(t,r,o,n){let a=await t(`${r}/app_developer/oauth/token`,{method:"POST",headers:eX(n),body:JSON.stringify({device_code:o})}),i=await eK(a),s=eF(i);if(s?.access_token)return{status:e.Authorized,access_token:s.access_token,token_type:s.token_type,expires_in:s.expires_in,expires_at:s.expires_at};if(!s||"number"!=typeof s.status)throw new eS(`Token response is malformed (HTTP ${a.status}): ${JSON.stringify(i)}`);return s}async function eK(e){var t;let r,o=e.headers.get("x-tt-logid")??void 0;try{r=await e.json()}catch{throw new eS(`Auth server returned non-JSON response with status ${e.status}${eM(o)}`,"DEVICE_AUTH_FAILED",{logId:o})}let n=function(e){if(e&&"object"==typeof e)return"string"==typeof e.log_id&&e.log_id?e.log_id:void 0}(r)??o;if(!e.ok)throw new eS(`Auth server returned HTTP ${e.status}: ${JSON.stringify(r)}${eM(n)}`,"DEVICE_AUTH_FAILED",{logId:n});let a=(t=r)&&"object"==typeof t&&"number"==typeof t.code&&0!==t.code?{code:t.code,message:"string"==typeof t.message?t.message:"Unknown error",logId:"string"==typeof t.log_id?t.log_id:void 0}:null;if(a)throw new eS(`Auth server error (code ${a.code}): ${a.message}${eM(a.logId??n)}`,"DEVICE_AUTH_FAILED",{logId:a.logId??n});return r}function eM(e){return e?` [log_id: ${e}]`:""}function eF(e){return e&&"object"==typeof e&&"data"in e?e.data:e}function eX(e){let t=new Headers(e);return t.set("Content-Type","application/json"),t}function eJ(e,t){let r=Math.floor(Date.now()/1e3);return{accessToken:e.access_token??"",tokenType:e.token_type??"Bearer",expiresAt:"number"==typeof e.expires_at?e.expires_at:r+(e.expires_in??0),baseUrl:t}}function eV(e){return new Promise(t=>{setTimeout(t,e)})}function ez(e,t){let r=new URL(e).host,o=new URL(`https://${r}/oauth/device`);return o.searchParams.set("user_code",t),o.toString()}async function eq(e={}){let t,r=er(e);try{t=await eA(r.tokenPath,{envTokenBaseUrl:r.baseUrl,credentialStore:r.credentialStore,legacyTokenPath:r.legacyTokenPath})}catch(e){if(e instanceof ec)return{loggedIn:!1,tokenPath:r.tokenPath,baseUrl:r.baseUrl,credentialError:{code:"CREDENTIAL_STORE_UNAVAILABLE",message:e.message}};throw e}if(!t)return{loggedIn:!1,tokenPath:r.tokenPath};let o=await eG(e.fetch??fetch,r.baseUrl,t,r.requestHeaders);return o?{loggedIn:!0,uid:o.userId,name:o.name,avatar:o.avatar,expiresAt:t.expiresAt,tokenPath:r.tokenPath,baseUrl:r.baseUrl}:{loggedIn:!1,expiresAt:t.expiresAt,tokenPath:r.tokenPath,baseUrl:r.baseUrl}}async function eG(e,t,r,o){let n=new Headers(o);n.set("Authorization",`${r.tokenType||"Bearer"} ${r.accessToken}`);let a=await e(`${t.replace(/\/+$/,"")}/app_developer/api/user/basic`,{method:"GET",headers:n});if(!a.ok)return;let i=await a.json();if(0===i.code){var s;return{userId:"string"==typeof(s=i.data?.user_id)&&s.length>0?s:"number"==typeof s&&Number.isFinite(s)?String(s):void 0,name:i.data?.name,avatar:i.data?.avatar}}}function eY(){return n}function eW(e){let t=e.headers.get("x-tt-logid");t&&(n=t)}(t=e||(e={}))[t.Pending=1]="Pending",t[t.Authorized=2]="Authorized",t[t.Expired=3]="Expired",t[t.Invalid=4]="Invalid",t[t.SlowDown=5]="SlowDown";let eQ=function(e=fetch,t={}){return async(r,o={})=>{let n=er(t);var a=r,i=n.allowedOrigins;let s=function(e){try{if("string"==typeof e)return new URL(e);if(e instanceof URL)return e;return new URL(e.url)}catch{throw Error("Authenticated requests must use an absolute HTTPS URL")}}(a);if("https:"!==s.protocol)throw Error(`Authenticated requests must use https: ${s.toString()}`);if(!i.includes(s.origin))throw Error(`Refusing to attach Authorization header to untrusted origin: ${s.origin}`);let c=await eA(n.tokenPath,{allowExpired:!0,envTokenBaseUrl:n.baseUrl,credentialStore:n.credentialStore,legacyTokenPath:n.legacyTokenPath});if(!c)throw new eb;if(eT(c))throw new eE;let l=new Headers(o.headers);return n.requestHeaders.forEach((e,t)=>{l.set(t,e)}),l.set("Authorization",`${c.tokenType||"Bearer"} ${c.accessToken}`),e(r,{...o,headers:l})}}(fetch,k()),eZ=async(e,t)=>{let r=await eQ(e,t);return eW(r),r},e0=async(e,t)=>{var r;let o,n=(r=t,o=new Headers(k().requestHeaders),r?.headers&&new Headers(r.headers).forEach((e,t)=>o.set(t,e)),{...r,headers:o}),a=await fetch(e,n);return eW(a),a};function e4(){return T()}function e1(e){return`${e4()}${e}`}class e2 extends Error{constructor(e,t={}){super(e),this.details=t.details,this.exitCode=t.exitCode??1,this.json=t.json,this.logId=t.logId}}class e3 extends e2{constructor(e){super(e,{exitCode:2})}}async function e8(e,t){let r,o,n=(o=!!(r=e.optsWithGlobals()).json,{debug:!!r.debug,json:o,error(e){throw new e3(e)},log(e=""){o||process.stdout.write(`${e}
|
|
6
|
-
`)},warn(e,t={}){if(o)return;let r="label"===t.style?function(e,t="warn".padEnd(7)){let[r="",...o]=e.split("\n");return[`${t} ${r}`,...o.map(e=>`${"".padEnd(8)}${e}`)].join("\n")}(e,u.bold.yellow("warn".padEnd(7))):`Warning: ${e}`;process.stderr.write(`${r}
|
|
7
|
-
`)}}),a=await t(n);n.json&&void 0!==a&&process.stdout.write(`${JSON.stringify(a,null,2)}
|
|
8
|
-
`)}function e5(e){if(O(e)){if("string"==typeof e.logId&&e.logId)return e.logId;if("string"==typeof e.log_id&&e.log_id)return e.log_id}return eY()}function e6(e){return e instanceof Error&&e.message?e.message:void 0}function e9(e){let t=Number(e);if(!/^-?\d+$/.test(e)||!Number.isSafeInteger(t))throw new l("expected an integer");return t}function e7(e){return(t,r)=>{if(!e.includes(t))throw new l(`allowed values are ${e.join(", ")}`);return[...r,t]}}let te="Doubao Agentic Service",tt="doubao-agentic-service-development",tr="doubao-agentic-service",to="doubao-agentic-service.zip";function tn(e){return async()=>{let t=await e();return"function"==typeof t?t:t.default}}let ta=[{path:["init"],load:tn(()=>import("./init.js").then(e=>e.init_namespaceObject))},{path:["upgrade"],load:tn(()=>import("./upgrade.js"))},{path:["dev"],load:tn(()=>import("./dev.js").then(e=>e.dev_namespaceObject))},{path:["dev","push-page"],load:tn(()=>import("./push-page.js"))},{path:["dev","push-widget"],load:tn(()=>import("./push-widget.js"))},{path:["dev","stop"],load:tn(()=>import("./stop.js"))},{path:["auth","login"],load:tn(()=>import("./login.js"))},{path:["auth","status"],load:tn(()=>import("./status~1.js"))},{path:["app","artifacts","upload"],load:tn(()=>import("./upload.js").then(e=>e.upload_namespaceObject))},{path:["app","artifacts","status"],load:tn(()=>import("./status.js"))},{path:["app","artifacts","validate"],load:tn(()=>import("./validate.js"))},{path:["app","sandbox","get"],load:tn(()=>import("./get.js"))},{path:["mcp","demo-server"],load:tn(()=>import("./demo-server.js").then(e=>e.demo_server_namespaceObject))},{path:["simulator","eval"],load:tn(()=>import("./eval.js").then(e=>e.eval_namespaceObject))}],ti={app:"应用管理","app artifacts":"版本产物上传与构建","app sandbox":"Sandbox 应用管理",auth:"认证管理",dev:"开发与调试",mcp:"MCP 工具",simulator:`${te} Simulator 评测`};async function ts(e=process.argv){var t,r;let o,n,a,i=((a=(n=e.slice(2)).indexOf("--"))<0?n:n.slice(0,a)).includes("--json"),l=(t=i,(o=tl(new s,t).name("dbx").description("Doubao Open CLI").version(Q).option("--json","输出机器可读 JSON").option("-d, --debug","Enable debug logging",!1).showHelpAfterError().configureHelp({showGlobalOptions:!0})).action(()=>o.outputHelp()),o),d=function(e){let t=[...e],r=t.findIndex((e,t)=>t>=2&&"--"!==e&&!e.startsWith("-"));if(r<0)return t;let o=t[r];return o?.includes(":")&&t.splice(r,1,...o.split(":").filter(Boolean)),t}(e),u=function(e){let t=e.findIndex((e,t)=>t>=2&&"--"!==e&&!e.startsWith("-"));if(t<0)return;let r=e.slice(t);return[...ta].sort((e,t)=>t.path.length-e.path.length).find(e=>e.path.every((e,t)=>r[t]===e))?.path}(d),p=z(Q)?null:F(Q,G()),f=new Set(U.excludeCommands.map(tf)),h=await td(u,f),w=new Map;(function(e,t,r,o){for(let n of r){let r=tc(e,t,n.path.slice(0,-1),o),a=tl(n.factory(),o).configureHelp({showGlobalOptions:!0});r.addCommand(a),t.set(n.path.join(" "),a)}})(l,w,h,i),function(e,t,r,o,n,a){for(let i of r){if(tp(i.path,n)||o&&(tu(i.path,o)||function(e,t){return e.length<t.length&&e.every((e,r)=>e===t[r])}(i.path,o)))continue;let r=i.path.join(" ");if(t.has(r))continue;let c=tc(e,t,i.path.slice(0,-1),a),l=tl(new s(i.path.at(-1)),a).configureHelp({showGlobalOptions:!0});l.action(()=>l.outputHelp()),c.addCommand(l),t.set(r,l)}}(l,w,ta,u,f,i);try{if(p&&j(d,u,i)){let{promptForUpdate:e}=await import("./prompt.js");if(await e(p))return}await l.parseAsync(d)}catch(e){if(e instanceof c){if(0===e.exitCode)return;i&&(r=e.message.replace(/^error:\s*/i,""),process.stdout.write(`${JSON.stringify({error:{},message:r},null,2)}
|
|
9
|
-
`)),process.exitCode=e.exitCode;return}if(i)process.stdout.write(`${JSON.stringify(function(e){var t;if(e instanceof e2&&void 0!==e.json)return e.json;let r=function(e){if(!O(e))return e;let t={...e};if(O(t.error)){let{details:e,...r}=t.error;t.error=r}return t}({error:{},...e6(e)?{message:e6(e)}:{}});if(!O(r))return r;let o=e5(e),n=O(t=e)?t.details:void 0,a=e6(e);return{...r,...a&&!("message"in r)?{message:a}:{},...o?{log_id:o}:{},...void 0===n?{}:{details:n}}}(e),null,2)}
|
|
10
|
-
`);else{let t,r;process.stderr.write(`Error: ${(t=e6(e)??String(e),(r=e5(e))&&!t.includes(r)?`${t}
|
|
11
|
-
log_id: ${r}`:t)}
|
|
12
|
-
`)}process.exitCode=O(e)&&"number"==typeof e.exitCode?e.exitCode:1}finally{(function(e,t,r,o=!!(process.stdin.isTTY&&process.stderr.isTTY)){return t?.[0]!=="dev"&&j(e,t,r,o)})(d,u,i)&&await K(Q)}}function tc(e,t,r,o){let n=e,a=[];for(let e of r){a.push(e);let r=a.join(" "),i=t.get(r);i||((i=tl(new s(e),o).description(ti[r]??"").configureHelp({showGlobalOptions:!0})).action(()=>i?.outputHelp()),n.addCommand(i),t.set(r,i)),n=i}return n}function tl(e,t){return e.exitOverride(),t&&e.configureOutput({outputError:()=>void 0,writeErr:()=>void 0}),e}async function td(e,t){return Promise.all(ta.filter(({path:r})=>!!(e&&tu(r,e))&&!tp(r,t)).map(async e=>({...e,factory:await e.load()})))}function tu(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])}function tp(e,t){let r=tf(e.join(" "));for(let e of t)if(r===e||r.startsWith(`${e}:`))return!0;return!1}function tf(e){return e.trim().replace(/^dbx\s+/i,"").replace(/[/:]+/g,":").replace(/\s+/g,":").replace(/^:+|:+$/g,"")}export{te as AGENTIC_SERVICE_DISPLAY_NAME,tt as AGENTIC_SERVICE_SKILL_NAME,e2 as CliError,tr as DEFAULT_FRONTEND_DIRECTORY,to as FRONTEND_ARCHIVE_FILENAME,eZ as authorizedFetch,e7 as collectChoiceValues,R as compareSemver,eR as completeLogin,e0 as configuredFetch,T as getApiBaseUrl,e1 as getApiUrl,k as getAuthOptions,eY as getLastHttpResponseLogId,e4 as http_getApiBaseUrl,J as ignoreUpdateVersion,O as isRecord,H as isValidSemver,eP as login,ts as main,P as normalizeVersion,e9 as parseInteger,e8 as runCommand,N as runtime_packageName,eH as startLogin,e as types_TokenStatus,Q as version_version,eq as whoami,X as writeUpdateCheckState};
|
|
13
|
-
//# sourceMappingURL=564.js.map
|
package/dist/714.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"node:module";export{parseSync}from"@swc/core";export{simple}from"swc-walk";
|