@coze/cli 0.2.0-alpha.094e22 → 0.2.0-alpha.2ae411
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/README.md +61 -23
- package/lib/cli.js +3 -3
- package/lib/{index-CkTEdvpA.js → index-C6r1MTLx.js} +1 -1
- package/lib/send-message.worker.js +1 -1
- package/lib/session-task-refresh.worker.js +1 -1
- package/lib/task-worker-C08RI2za.js +1 -0
- package/package.json +3 -2
- package/skills/manifest.json +6 -6
- package/skills/using-coze-cli/SKILL.md +19 -26
- package/skills/using-coze-cli/coze-claw/MODULE.md +1 -1
- package/skills/using-coze-cli/coze-code/MODULE.md +77 -3
- package/skills/using-coze-cli/coze-code/references/coze-code-db.md +11 -4
- package/skills/using-coze-cli/coze-code/references/coze-code-deploy.md +2 -2
- package/skills/using-coze-cli/coze-code/references/coze-code-domain.md +1 -1
- package/skills/using-coze-cli/coze-code/references/coze-code-git.md +11 -3
- package/skills/using-coze-cli/coze-code/references/coze-code-message.md +1 -1
- package/skills/using-coze-cli/coze-code/references/coze-code-project.md +48 -2
- package/skills/using-coze-cli/coze-code/references/coze-code-repo.md +18 -7
- package/skills/using-coze-cli/coze-code/references/coze-code-skill.md +4 -0
- package/skills/using-coze-cli/coze-file/MODULE.md +4 -4
- package/skills/using-coze-cli/coze-file/references/coze-file-upload.md +7 -7
- package/skills/using-coze-cli/coze-generate/MODULE.md +2 -2
- package/skills/using-coze-cli/coze-generate/references/coze-generate-audio.md +2 -2
- package/skills/using-coze-cli/coze-generate/references/coze-generate-image.md +5 -5
- package/skills/using-coze-cli/coze-generate/references/coze-generate-video.md +9 -10
- package/lib/task-worker-C2ZfSQY6.js +0 -1
|
@@ -115,15 +115,20 @@ coze code git auth status --format json | jq .status
|
|
|
115
115
|
| 参数 | 必填 | 说明 |
|
|
116
116
|
|------|------|------|
|
|
117
117
|
| `--provider` | 否 | Git 平台(默认 `github`) |
|
|
118
|
-
| `--force` | 否 |
|
|
118
|
+
| `--force` | 否 | 跳过确认直接取消 |
|
|
119
|
+
|
|
120
|
+
### 确认逻辑
|
|
121
|
+
|
|
122
|
+
- 不加 `--force` 时:**交互式终端(TTY)**会弹出确认提示,确认后才执行;**JSON 模式或非交互终端(非 TTY)**会直接报 `E1000`,必须加 `--force` 才能执行。
|
|
123
|
+
- 脚本/Agent 场景(通常非 TTY 或 `--format json`)应始终加 `--force`。
|
|
119
124
|
|
|
120
125
|
### 推荐命令模板
|
|
121
126
|
|
|
122
127
|
```bash
|
|
123
|
-
# 取消 GitHub
|
|
128
|
+
# 取消 GitHub 授权(交互式终端会弹确认)
|
|
124
129
|
coze code git auth logout
|
|
125
130
|
|
|
126
|
-
#
|
|
131
|
+
# 强制取消(跳过确认,脚本/JSON 模式必须)
|
|
127
132
|
coze code git auth logout --force
|
|
128
133
|
```
|
|
129
134
|
|
|
@@ -136,6 +141,8 @@ coze code git auth logout --force
|
|
|
136
141
|
|
|
137
142
|
| 错误码 | 名称 | 说明 | 修复方式 |
|
|
138
143
|
|--------|------|------|---------|
|
|
144
|
+
| E1000 | INVALID_ARGUMENT | JSON 模式或非交互终端下未加 `--force` | 加 `--force` 跳过确认 |
|
|
145
|
+
| E1015 | INVALID_PROVIDER | 不支持的 Git 平台 | 使用 `github` / `gitlab` |
|
|
139
146
|
| E2007 | NOT_AUTHORIZED | 尚未授权 | 先执行 `coze code git auth login` |
|
|
140
147
|
|
|
141
148
|
---
|
|
@@ -151,6 +158,7 @@ coze code git auth logout --force
|
|
|
151
158
|
| `-k, --keyword <keyword>` | 否 | 搜索关键词 |
|
|
152
159
|
| `--page <page>` | 否 | 页码 |
|
|
153
160
|
| `--page-size <size>` | 否 | 每页数量(默认 20) |
|
|
161
|
+
| `--provider` | 否 | Git 平台(继承自 `git` 父命令):`github` / `gitlab`,默认 `github` |
|
|
154
162
|
|
|
155
163
|
### 推荐命令模板
|
|
156
164
|
|
|
@@ -50,7 +50,7 @@ coze code message send "对比 @src/old.ts 和 @src/new.ts 的差异" -p <projec
|
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
- 只支持引用**文件**(不支持目录)
|
|
53
|
-
-
|
|
53
|
+
- 文件路径可以是相对路径或绝对路径:**绝对路径不受工作目录限制**;相对路径解析后必须仍在当前工作目录内(`../` 越界会被忽略并输出 warning)。任何引用失败(文件不存在/是目录/越界)都会输出 warning 并把 `@路径` 原样作为普通文本发送
|
|
54
54
|
|
|
55
55
|
### stdin 管道输入(附加上下文)
|
|
56
56
|
|
|
@@ -50,9 +50,43 @@ coze code project create --message "移动端应用" --type app --format json
|
|
|
50
50
|
coze code project create --message "电商网站" --type web --wait --format json
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### 项目类型识别(App vs 网页)
|
|
54
|
+
|
|
55
|
+
创建前**必须**先根据用户意图选准 `--type`,**不要默认 `web`**。用户表达「创建 App / 应用」时一律用 `--type app` 进入 App 创建流程,避免误建成网页项目;意图含糊先反问确认。
|
|
56
|
+
|
|
57
|
+
| 用户表达(示例) | 推荐 `--type` |
|
|
58
|
+
|------------------|--------------|
|
|
59
|
+
| "App / 应用 / 移动端应用 / 手机 App / 原生应用" | `app` |
|
|
60
|
+
| "网页 / 网站 / Web 页面 / 落地页 / 官网 / H5" | `web` |
|
|
61
|
+
| "小程序 / 微信小程序" | `miniprogram` |
|
|
62
|
+
| "智能体 / Agent / 机器人 / 客服 bot" | `agent` |
|
|
63
|
+
| "工作流 / 自动化流程" | `workflow` |
|
|
64
|
+
| "技能 / skill 插件" | `skill` |
|
|
65
|
+
| "助手 / assistant" | `assistant` |
|
|
66
|
+
|
|
53
67
|
### 返回值
|
|
54
68
|
|
|
55
|
-
`--format json` 时返回 `{ project_id, type }
|
|
69
|
+
`--format json` 时返回 `{ project_id, type, project_url }`:
|
|
70
|
+
- `project_id`:**务必记录**,供后续 message/deploy/preview 使用。
|
|
71
|
+
- `project_url`:CLI 已按平台生成好的项目对话页面链接,**直接读取此字段透传给用户,不要自行拼接**。
|
|
72
|
+
|
|
73
|
+
### 创建成功后的回复要求
|
|
74
|
+
|
|
75
|
+
- **默认不触发部署**:`project create` 只完成项目创建与首次 AI 开发,**绝不**自动 `deploy`;部署须等用户明确要求且 `message status` 为 `done`。
|
|
76
|
+
- **必须附上「打开项目」入口**:回复中给出 CLI 返回的 `project_url`,方便用户直接跳转到项目对话页面,省去在项目列表 / 历史会话中二次查找。
|
|
77
|
+
- `project_url` 由 CLI 按**项目类型**自动生成(`web` / `app` / `miniprogram` 为 `https://www.coze.cn/p/<project_id>`;其它类型为 `https://code.coze.cn/p/<project_id>`),**优先直接使用该字段**。
|
|
78
|
+
- **必须主动跟进到开发完成**:创建后不能停在"正在开发中"。查询状态**优先主动轮询** `coze code message status -p <project_id>` 直到 `done`(`--wait` 仅备选),不要让用户自己查状态。
|
|
79
|
+
- **开发任务完成后**(轮询到 `done`)给出后续引导:继续开发(`message send`)、部署应用(`deploy`,需要时再执行)、打开项目(`project_url`)。
|
|
80
|
+
- **「预览效果」一行仅 `web` 类型显示**:当 `--type web` 时,先执行 `coze code preview <project_id> --format json` 取回 `preview_url`,把预览地址**直接展示**给用户(沙盒初始化需 1-3 分钟,未就绪可重试一次);非 `web` 类型(`app` / `miniprogram` / `agent` / `workflow` / `skill` / `assistant`)**省略整行**,不展示预览地址。
|
|
81
|
+
|
|
82
|
+
### 创建失败时的回复
|
|
83
|
+
|
|
84
|
+
当 `project create` 失败(如报错、未返回 `project_id`、上下文缺失等)时,**不要**只把原始错误堆栈丢给用户,按以下模板友好提示并引导用户补充信息后重试:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
项目创建失败
|
|
88
|
+
你可以重新发起创建,或补充更明确的项目类型、页面需求和目标空间后再试。
|
|
89
|
+
```
|
|
56
90
|
|
|
57
91
|
### 坑点
|
|
58
92
|
|
|
@@ -60,7 +94,7 @@ coze code project create --message "电商网站" --type web --wait --format jso
|
|
|
60
94
|
- `--message` 没有 `-m` 短别名,必须写全。
|
|
61
95
|
- 不带 `--wait` 时命令会立即返回 project_id,但首次 AI 消息仍在后台处理中。
|
|
62
96
|
- `web` / `app` / `miniprogram` 三种类型默认以 **Coze 3.0 方式**创建;其它类型使用原有创建方式。
|
|
63
|
-
-
|
|
97
|
+
- 项目访问域名由**项目类型**决定(`web` / `app` / `miniprogram` 为 `www.coze.cn`,其它类型为 `code.coze.cn`);`COZE_CLI_PLATFORM` 仅在无法获知类型时作回退,详见 [`../../SKILL.md`](../../SKILL.md) 的「环境变量覆盖」。
|
|
64
98
|
|
|
65
99
|
---
|
|
66
100
|
|
|
@@ -151,10 +185,22 @@ coze code project import -s github -r user/my-app --format json
|
|
|
151
185
|
coze code project import -s local -f ./project.zip --format json
|
|
152
186
|
```
|
|
153
187
|
|
|
188
|
+
### 返回值
|
|
189
|
+
|
|
190
|
+
`--format json` 时返回:
|
|
191
|
+
|
|
192
|
+
| 字段 | 说明 |
|
|
193
|
+
|------|------|
|
|
194
|
+
| `project_id` | 新建项目 ID |
|
|
195
|
+
| `source` | 导入来源(`github` / `local`) |
|
|
196
|
+
| `repo` | 源仓库全名(仅 `github` 导入时返回) |
|
|
197
|
+
| `project_url` | 项目 Web 地址,可直接给用户 |
|
|
198
|
+
|
|
154
199
|
### 坑点
|
|
155
200
|
|
|
156
201
|
- 远程导入需先完成 OAuth 授权(`coze code git auth login`),导入后会自动绑定到源仓库。
|
|
157
202
|
- 本地文件必须是 `.zip` 且不超过 500MB。
|
|
203
|
+
- 导入成功后,CLI 会自动在后台向项目默认会话发送初始化 query(「按标准流程初始化当前项目」,对齐 Web 端行为),可用 `coze code message status -p <project_id>` 跟进初始化进度;发送失败不影响导入结果,可手动补发 `coze code message send "按标准流程初始化当前项目" -p <project_id>`。
|
|
158
204
|
|
|
159
205
|
---
|
|
160
206
|
|
|
@@ -124,13 +124,21 @@ coze code repo bind -p <projectId> -r user/my-repo
|
|
|
124
124
|
| 参数 | 必填 | 说明 |
|
|
125
125
|
|------|------|------|
|
|
126
126
|
| `-p, --project-id <projectId>` | 是 | 项目 ID |
|
|
127
|
-
| `--force` | 否 |
|
|
127
|
+
| `--force` | 否 | 跳过确认直接解绑 |
|
|
128
|
+
|
|
129
|
+
### 确认逻辑
|
|
130
|
+
|
|
131
|
+
- 不加 `--force` 时:**交互式终端(TTY)**会弹出确认提示,确认后才执行;**JSON 模式或非交互终端(非 TTY)**会直接报 `E1000`,必须加 `--force` 才能执行。
|
|
132
|
+
- 脚本/Agent 场景(通常非 TTY 或 `--format json`)应始终加 `--force`。
|
|
128
133
|
|
|
129
134
|
### 推荐命令模板
|
|
130
135
|
|
|
131
136
|
```bash
|
|
132
|
-
#
|
|
137
|
+
# 解绑(交互式终端会弹确认;仅 bindStatus=3 即已绑定时可解绑,否则报 E3014)
|
|
133
138
|
coze code repo unbind -p <projectId>
|
|
139
|
+
|
|
140
|
+
# 强制解绑(跳过确认,脚本/JSON 模式必须)
|
|
141
|
+
coze code repo unbind -p <projectId> --force
|
|
134
142
|
```
|
|
135
143
|
|
|
136
144
|
### 返回值
|
|
@@ -144,6 +152,7 @@ coze code repo unbind -p <projectId>
|
|
|
144
152
|
|
|
145
153
|
| 错误码 | 名称 | 说明 | 修复方式 |
|
|
146
154
|
|--------|------|------|---------|
|
|
155
|
+
| E1000 | INVALID_ARGUMENT | JSON 模式或非交互终端下未加 `--force` | 加 `--force` 跳过确认 |
|
|
147
156
|
| E3014 | REPO_NOT_BOUND | 项目未绑定仓库 | 用 `coze code repo status -p <id>` 查看状态 |
|
|
148
157
|
|
|
149
158
|
---
|
|
@@ -180,8 +189,8 @@ coze code repo push -p <projectId> && coze code repo status -p <projectId>
|
|
|
180
189
|
| 错误码 | 名称 | 说明 | 修复方式 |
|
|
181
190
|
|--------|------|------|---------|
|
|
182
191
|
| E3014 | REPO_NOT_BOUND | 项目未绑定仓库 | 先执行 `repo bind` |
|
|
183
|
-
| E3017 | NOTHING_TO_PUSH |
|
|
184
|
-
| E3018 | REMOTE_HAS_UPDATES |
|
|
192
|
+
| E3017 | NOTHING_TO_PUSH | 无需推送(placeholder 阶段暂不触发) | 已与远程同步 |
|
|
193
|
+
| E3018 | REMOTE_HAS_UPDATES | 远程有更新(placeholder 阶段暂不触发) | 先执行 `repo pull` |
|
|
185
194
|
|
|
186
195
|
### 坑点
|
|
187
196
|
|
|
@@ -238,8 +247,8 @@ coze code repo pull -p <projectId> --conflict-strategy ours && coze code repo pu
|
|
|
238
247
|
| 错误码 | 名称 | 说明 | 修复方式 |
|
|
239
248
|
|--------|------|------|---------|
|
|
240
249
|
| E3014 | REPO_NOT_BOUND | 项目未绑定仓库 | 先执行 `repo bind` |
|
|
241
|
-
| E3019 | MERGE_CONFLICT |
|
|
242
|
-
| E3020 | WOULD_OVERWRITE |
|
|
250
|
+
| E3019 | MERGE_CONFLICT | 未指定策略遇到冲突(placeholder 阶段暂不触发) | 加 `--conflict-strategy ours` 或 `theirs` |
|
|
251
|
+
| E3020 | WOULD_OVERWRITE | 本地改动会被覆盖(placeholder 阶段暂不触发) | 先提交本地改动 |
|
|
243
252
|
|
|
244
253
|
---
|
|
245
254
|
|
|
@@ -274,7 +283,9 @@ coze code repo status -p <projectId> --format json | jq .bind_status
|
|
|
274
283
|
| `repo_full_name` | 仓库全名(仅 bound 时输出) |
|
|
275
284
|
| `html_url` | 仓库 URL(仅 bound 时输出) |
|
|
276
285
|
|
|
277
|
-
|
|
286
|
+
### 错误速查
|
|
287
|
+
|
|
288
|
+
`repo status` 自身没有专属业务错误码:未授权 / 未绑定不会报错,而是通过返回值 `bind_status`(`unauth` / `not-bound`)体现,请根据该字段分支处理。
|
|
278
289
|
|
|
279
290
|
### 状态枚举
|
|
280
291
|
|
|
@@ -99,6 +99,10 @@ coze code skill remove <skill-id> -p <project-id>
|
|
|
99
99
|
coze code skill upload "./my-skill.skill" -p <project-id>
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
### 返回值
|
|
103
|
+
|
|
104
|
+
`--format json` 时输出 `{ project_id, message }`(`message` 为结果提示文本),**不包含 `skill_id`**。需要拿到新技能 ID 时,请在上传后用 `coze code skill list -p <project-id> --my` 查询。
|
|
105
|
+
|
|
102
106
|
---
|
|
103
107
|
|
|
104
108
|
## skill delete
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coze-file
|
|
3
|
-
version: 0.2.0-alpha.
|
|
3
|
+
version: 0.2.0-alpha.2ae411
|
|
4
4
|
description: "Coze 文件操作:上传本地文件获取在线访问地址。当用户需要上传文件、或将本地生成的文件转换为在线可访问链接时触发。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
@@ -25,8 +25,8 @@ metadata:
|
|
|
25
25
|
|
|
26
26
|
## 关键规则
|
|
27
27
|
|
|
28
|
-
-
|
|
29
|
-
- 返回值中 `
|
|
28
|
+
- 上传文件的大小限制由服务端决定,CLI 本身不校验大小
|
|
29
|
+
- 返回值中 `file_url` 是在线访问地址(优先返回给用户),`file_uri` 仅作为内部标识
|
|
30
30
|
- 使用 `--format json` 获取结构化输出
|
|
31
31
|
|
|
32
32
|
## 典型使用场景
|
|
@@ -36,7 +36,7 @@ metadata:
|
|
|
36
36
|
```
|
|
37
37
|
coze generate audio "文本" --output-path /tmp/coze-audio
|
|
38
38
|
→ coze file upload /tmp/coze-audio/output.mp3
|
|
39
|
-
→ 返回
|
|
39
|
+
→ 返回 file_url 给用户
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
### 场景 2:上传用户自定义文件
|
|
@@ -26,14 +26,14 @@ coze file upload <file-path> [options]
|
|
|
26
26
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
|
29
|
-
"
|
|
30
|
-
"
|
|
29
|
+
"file_url": "https://xxx.coze.cn/...", // 在线访问地址 → 优先返回给用户!
|
|
30
|
+
"file_uri": "cos://xxx/..." // 内部标识,仅作内部引用
|
|
31
31
|
}
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**关键区分**:
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
35
|
+
- `file_url`:用户可直接在浏览器打开的 HTTPS 地址 → **交付给用户时用这个**
|
|
36
|
+
- `file_uri`:内部存储路径标识 → 不对外暴露
|
|
37
37
|
|
|
38
38
|
## 推荐命令模板
|
|
39
39
|
|
|
@@ -53,7 +53,7 @@ coze file upload ./document.pdf --format json
|
|
|
53
53
|
|
|
54
54
|
## 注意事项
|
|
55
55
|
|
|
56
|
-
-
|
|
57
|
-
- `<file-path>`
|
|
56
|
+
- **文件大小限制**:由服务端决定,CLI 本身不校验大小(超限时由服务端报错)
|
|
57
|
+
- `<file-path>` 必须是有效的本地文件路径;**传入目录会报 `E1000`(Uploading directories is not supported)**,文件不存在报 `E3000`
|
|
58
58
|
- 文件保存期限为 **7 天**
|
|
59
|
-
- 上传成功后务必将 `
|
|
59
|
+
- 上传成功后务必将 `file_url`(不是 `file_uri`)返回给用户
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coze-generate
|
|
3
|
-
version: 0.2.0-alpha.
|
|
3
|
+
version: 0.2.0-alpha.2ae411
|
|
4
4
|
description: "Coze 媒体生成:文本生成图片、文本转语音(TTS)、视频生成。当用户需要使用 coze generate image/audio/video 生成音频、图片或视频时触发。"
|
|
5
5
|
metadata:
|
|
6
6
|
requires:
|
|
@@ -23,7 +23,7 @@ metadata:
|
|
|
23
23
|
|
|
24
24
|
- 该规则适用于**音频、图片、视频**所有媒体类型
|
|
25
25
|
- 禁止返回本地路径给用户(`/tmp/...` 对用户不可访问)
|
|
26
|
-
-
|
|
26
|
+
- 优先使用上传返回的 `file_url` 而非 `file_uri` 作为交付链接
|
|
27
27
|
|
|
28
28
|
详细上传用法参见 [`../coze-file/references/coze-file-upload.md`](../coze-file/references/coze-file-upload.md)。
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@ coze generate audio [prompt] [options]
|
|
|
41
41
|
| `--ssml` | `false` | 将输入视为 SSML 标记语言 |
|
|
42
42
|
| `--stdin` | — | 从管道读取 prompt(与位置参数二选一,位置参数优先) |
|
|
43
43
|
| `--output-path` | — | **保存目录**(不是最终文件名!) |
|
|
44
|
-
| `--format` | `text` | 输出格式:`text` / `json
|
|
44
|
+
| `--format` | `text` | 输出格式:`text` / `json`(**全局选项**,所有 coze 命令通用,非 audio 专属) |
|
|
45
45
|
|
|
46
46
|
## 标准语音生成工作流
|
|
47
47
|
|
|
@@ -102,4 +102,4 @@ echo '<speak>欢迎来到我们的直播间</speak>' | coze generate audio --ssm
|
|
|
102
102
|
| 裸命令不保存文件 | 不带 `--output-path` 时可能只返回元数据 | 始终带 `--output-path` |
|
|
103
103
|
| `--output-path` 不是文件名 | 它是保存目录,CLI 自动命名文件 | 传入目录路径如 `/tmp/coze-audio` |
|
|
104
104
|
| 生成后忘记上传 | 只说"已生成"不够 | 必须继续 `coze file upload` 再返回 URL |
|
|
105
|
-
| 发了
|
|
105
|
+
| 发了 file_uri 而非 file_url | `file upload` 返回结构同时有 file_uri 和 file_url | **优先返回 file_url 给用户** |
|
|
@@ -26,10 +26,10 @@ coze generate image [prompt] [options]
|
|
|
26
26
|
| `--response-format` | `url` | 响应格式:`url` / `b64_json` |
|
|
27
27
|
| `--sequential` | `disabled` | 连续图像生成模式:`auto` / `disabled` |
|
|
28
28
|
| `--max-images` | `15` | 连续生成最大图片数(范围 1-15) |
|
|
29
|
-
| `--optimize-prompt-mode` |
|
|
29
|
+
| `--optimize-prompt-mode` | `standard` | 提示词优化模式 |
|
|
30
30
|
| `--stdin` | — | 从管道读取 prompt(与位置参数二选一,位置参数优先) |
|
|
31
31
|
| `--output-path` | — | **保存目录**(不是最终文件名!) |
|
|
32
|
-
| `--format` | `text` | 输出格式:`text` / `json
|
|
32
|
+
| `--format` | `text` | 输出格式:`text` / `json`(**全局选项**,所有 coze 命令通用,非 image 专属) |
|
|
33
33
|
|
|
34
34
|
## 标准图片生成工作流
|
|
35
35
|
|
|
@@ -68,7 +68,7 @@ coze generate image "不同角度的产品展示图" \
|
|
|
68
68
|
--output-path /tmp/coze-image --format json
|
|
69
69
|
|
|
70
70
|
# 自定义分辨率
|
|
71
|
-
coze generate image "头像图标" --size
|
|
71
|
+
coze generate image "头像图标" --size 2048x2048 --output-path /tmp/coze-image --format json
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
## 注意事项
|
|
@@ -76,5 +76,5 @@ coze generate image "头像图标" --size 1024x1024 --output-path /tmp/coze-imag
|
|
|
76
76
|
- **`--output-path` 是目录**:CLI 在该目录下自动命名保存生成的图片文件
|
|
77
77
|
- **同步返回**:命令执行完毕即表示图片已生成完毕,无需额外轮询
|
|
78
78
|
- **支持 `--stdin`**:`echo "描述" | coze generate image --stdin --output-path /tmp/img`(需显式传 `--stdin`)
|
|
79
|
-
- 尺寸约束:总像素范围约 2560x1440 ~ 4096x4096,宽高比范围约 1:16 ~ 16:1
|
|
80
|
-
- `--response-format b64_json`
|
|
79
|
+
- 尺寸约束:总像素范围约 2560x1440 ~ 4096x4096,宽高比范围约 1:16 ~ 16:1。**显式传入非法 `--size`(格式错误或超出范围)会直接报 `E1000`(退出码 4),不会静默回退默认值**;省略 `--size` 时默认 `2K`
|
|
80
|
+
- `--response-format b64_json` 配合 `--output-path` 时,CLI 仍会把 base64 解码后写入文件;仅在**不带** `--output-path` 时才只返回 base64 数据不落盘。一般场景用默认 `url` 即可
|
|
@@ -23,21 +23,21 @@ Step 2: coze generate video status <taskId> → 查询任务状态
|
|
|
23
23
|
| 参数 | 默认值 | 说明 |
|
|
24
24
|
|------|--------|------|
|
|
25
25
|
| `[prompt]` | — | 视频描述文本(或通过 `--stdin` 从管道读取,或首帧/尾帧图至少一项) |
|
|
26
|
-
| `--model` | `doubao-seedance-1-5-pro-251215` | 视频生成模型 |
|
|
27
26
|
| `--resolution` | `720p` | 分辨率:`480p` / `720p` / `1080p` |
|
|
28
27
|
| `--ratio` | `16:9` | 画面比例(如 `16:9`、`9:16`、`1:1`) |
|
|
29
28
|
| `--duration` | `5` | 时长(秒),范围 4~12 |
|
|
30
29
|
| `--no-watermark` | 有水印 | 添加此标志禁用水印 |
|
|
31
30
|
| `--first-frame <url>` | — | 首帧图片 URL |
|
|
32
31
|
| `--last-frame <url>` | — | 尾帧图片 URL |
|
|
33
|
-
| `--reference-image <url>` | — | 参考图 URL(可多次传入) |
|
|
34
32
|
| `--camerafixed` | `false` | 固定镜头(减少运动) |
|
|
35
33
|
| `--no-generate-audio` | 生成配音 | 添加此标志不生成配音 |
|
|
36
34
|
| `--seed` | — | 随机种子(用于复现相同结果) |
|
|
37
35
|
| `--stdin` | — | 从管道读取 prompt 文本(与位置参数二选一,位置参数优先) |
|
|
38
36
|
| `--wait` | — | 自动轮询等待完成(2秒间隔,5分钟超时) |
|
|
39
37
|
| `--output-path` | — | 保存目录(配合 --wait 使用) |
|
|
40
|
-
| `--format` | `text` | 输出格式:`text` / `json
|
|
38
|
+
| `--format` | `text` | 输出格式:`text` / `json`(全局选项) |
|
|
39
|
+
|
|
40
|
+
> 模型固定为 `DEFAULT_MODEL`(`doubao-seedance-1-5-pro-251215`,见源码 `video/constants.ts`),**不可通过 flag 修改**(没有 `--model` 选项)。
|
|
41
41
|
|
|
42
42
|
### 推荐工作流
|
|
43
43
|
|
|
@@ -98,28 +98,27 @@ coze generate video create "产品展示" \
|
|
|
98
98
|
| 参数 | 必填 | 说明 |
|
|
99
99
|
|------|------|------|
|
|
100
100
|
| `<taskId>` | 是 | 任务 ID(位置参数,来自 create 的返回值) |
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
|
|
102
|
+
> `status` 自身没有本地选项(无 `--wait`,单次查询)。结构化输出请使用全局 `--format json`。需要等待时请自行间隔轮询,或在 create 阶段用 `--wait`。
|
|
103
103
|
|
|
104
104
|
### 推荐命令模板
|
|
105
105
|
|
|
106
106
|
```bash
|
|
107
|
-
#
|
|
107
|
+
# 查询状态(单次查询,需等待时自行轮询)
|
|
108
108
|
coze generate video status <taskId> --format json
|
|
109
|
-
|
|
110
|
-
# 轮询等待完成
|
|
111
|
-
coze generate video status <taskId> --wait --format json
|
|
112
109
|
```
|
|
113
110
|
|
|
114
111
|
### 状态含义
|
|
115
112
|
|
|
116
113
|
| 状态 | 含义 | 下一步操作 |
|
|
117
114
|
|------|------|-------------|
|
|
118
|
-
| `
|
|
115
|
+
| `queued` / `running` | 排队/处理中 | 继续等待或稍后重试查询 |
|
|
119
116
|
| `succeeded` | 生成成功 | 从返回中获取视频信息,执行 file upload |
|
|
120
117
|
| `failed` | 生成失败 | 检查错误信息,调整参数后重试 |
|
|
118
|
+
| `cancelled` | 任务已取消 | 重新创建任务 |
|
|
121
119
|
|
|
122
120
|
### 注意事项
|
|
123
121
|
|
|
124
122
|
- **必须提供 Prompt 文本(位置参数或 `--stdin`)或者首帧/尾帧图片中至少一项作为输入**
|
|
125
123
|
- 首帧/尾帧图片必须是有效的可访问 URL
|
|
124
|
+
- `video status` 传入不存在/过期的 taskId 会报 `E3000 RESOURCE_NOT_FOUND`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("process"),t=require("path"),s=require("child_process"),i=require("undici"),a=require("./fetch-client-DC0c3ox3.js"),r=require("node:path"),n=require("node:os"),o=require("node:fs/promises");function c(e){const t=Object.create(null);if(e)for(const s in e)if("default"!==s){const i=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:function(){return e[s]}})}return t.default=e,Object.freeze(t)}require("node:fs");const l=c(r),d=c(n),_=c(o);const u=l.join(d.homedir(),".coze"),p=l.join(u,"config.json"),h=l.join(process.cwd(),".cozerc.json"),m={apiBaseUrl:"https://code.coze.cn/",sessionApiBaseUrl:"https://www.coze.cn/",openApiBaseUrl:"https://api.coze.cn",integrationApiBaseUrl:"https://integration.coze.cn",clientId:"95438868623436343239609434490626.app.coze",defaultOutputFormat:"json"};async function g(e){try{const t=await _.readFile(e,"utf8");return JSON.parse(t)}catch(e){return}}function E(){const e={};return process.env.COZE_API_TOKEN&&(e.accessToken=process.env.COZE_API_TOKEN),process.env.COZE_ORG_ID&&(e.organizationId=process.env.COZE_ORG_ID),process.env.COZE_ENTERPRISE_ID&&(e.enterpriseId=process.env.COZE_ENTERPRISE_ID),process.env.COZE_SPACE_ID&&(e.spaceId=process.env.COZE_SPACE_ID),process.env.COZE_SESSION_SPACE_WEB_ID&&(e.sessionSpaceWebId=process.env.COZE_SESSION_SPACE_WEB_ID),"global"!==process.env.COZE_CONFIG_SCOPE&&"local"!==process.env.COZE_CONFIG_SCOPE||(e.configScope=process.env.COZE_CONFIG_SCOPE),process.env.COZE_AUTO_CHECK_UPDATE&&(e.autoCheckUpdate="true"===process.env.COZE_AUTO_CHECK_UPDATE),process.env.COZE_DISABLE_TELEMETRY&&(e.disableTelemetry="true"===process.env.COZE_DISABLE_TELEMETRY),e}async function w(e){const t=process.env.COZE_CONFIG_FILE,[s,i,a,r]=await Promise.all([g(p),g(h),t?g(t):void 0,e?g(e):void 0]),n=E();return{...m,...s,...i,...a,...r,...n}}async function T(e,t=function(e,t){return null!=e?e:t()}(E().configScope,(()=>"global"))){const s=process.env.COZE_CONFIG_FILE,i=s||("global"===t?p:h),a=l.dirname(i);try{await _.mkdir(a,{recursive:!0});const t={...await g(i)||{},...e};await _.writeFile(i,JSON.stringify(t,null,2),"utf8")}catch(e){throw new Error(`Failed to save config to ${i}: ${e}`)}}function S(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const f=e=>e.endsWith("/")?e:`${e}/`,R=(e,t)=>{t&&Object.entries(t).forEach((([t,s])=>{null!=s&&e.searchParams.set(t,String(s))}))},P=async(e,t)=>{const s=await e.text();return s?a.safeJsonParse(s,t):t},A=(e,t,s={})=>{if(e.ok)return;const i=s.serviceName||"Service";throw new Error(S([t,"optionalAccess",e=>e.msg])||`${i} API request failed: ${e.status} ${e.statusText}`)},I=e=>e.headers.get("x-tt-logid")||void 0,U=e=>e?{"x-use-ppe":"1","x-tt-env":e}:{},C=e=>{const t=S([e,"optionalAccess",e=>e.trim,"call",e=>e()]);return t?{"x-coze-account":t}:{}},L=e=>{try{return"www.coze.cn"===new URL(e).hostname}catch(e){return!1}},O="coze-account",v=({getOrganizationId:e,organizationId:t})=>{if(!e&&!S([t,"optionalAccess",e=>e.trim,"call",e=>e()]))return void a.customFetch.removeScopedHeadersProvider(O);const s=e||(()=>t);a.customFetch.setScopedHeadersProvider(O,((e,t)=>{const i=(e=>"string"==typeof e?e:e instanceof URL?e.toString():"object"==typeof e&&e&&"url"in e?String(e.url):void 0)(e);return i&&L(i)?C(s()):{}}))};const y=async({url:e,api:t})=>{if(!e||!t.getWebUrl)return e;try{return function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([await t.getWebUrl({original_url:e,exchange_for_short_url:!0}),"access",e=>e.data,"optionalAccess",e=>e.short_url])||e}catch(t){return e}},B=({api:e})=>async({url:t})=>await y({url:t,api:e})||t;const b=({accountId:e,authConfigured:t})=>({authConfigured:t,authValid:!1,clawId:void 0,accountId:e,updatedAt:void 0});function z(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const D=({api:e,resolveClawId:t})=>async(s={})=>{const i=s.clawId||await t();return(z([await e.listProcess({claw_id:i,size:s.size||100}),"access",e=>e.data,"optionalAccess",e=>e.processes])||[]).map((e=>(e=>{const t=String(e.id||"");if(!t)return null;const s=e;return{progressId:t,name:"string"==typeof e.name?e.name:void 0,type:"string"==typeof s.type?s.type:void 0,progressStatus:"running",raw:e}})(e))).filter((e=>null!==e))},N=e=>async({progressId:t,clawId:s})=>(await e({clawId:s})).find((e=>e.progressId===t))||null,q=({listProgresses:e,runtimeStatusStore:t})=>async({sessionId:s,clawId:i})=>{const a=await e({clawId:i}),r=t.getLive(s),n=z([r,"optionalAccess",e=>e.status])||"idle",o=a.length;return{sessionId:s,displayStatus:"working"===n?"working":"idle",clawBusy:o>0,clawProgressCount:o,runtimeStatus:n,updatedAt:z([r,"optionalAccess",e=>e.updatedAt])}};class F extends Error{constructor(e,t){super(e),this.code=t,this.name="SessionServiceError"}}const k=()=>new F("Session token is missing or invalid","SESSION_AUTH_INVALID");function G(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const j=({api:e,resolveClawId:t})=>async()=>{const s=await t(),i=await e.createSession({claw_id:s}),a=G([i,"access",e=>e.data,"optionalAccess",e=>e.session,"optionalAccess",e=>e.id]);if(!a)throw new F(i.msg||"Failed to create session","SESSION_CREATE_FAILED");return{clawId:s,sessionId:String(a)}},x=({api:e,resolveClawId:t})=>async(s={})=>{const i=await t(),a=await e.listSession({claw_id:i,offset:s.offset,limit:s.limit});if(0!==a.code&&void 0!==a.code)throw new F(a.msg||"Failed to list sessions","SESSION_LIST_FAILED");const r=G([a,"access",e=>e.data,"optionalAccess",e=>e.session_list])||[],n=G([a,"access",e=>e.data,"optionalAccess",e=>e.next_offset]);return{items:r,nextOffset:n,hasMore:Boolean(n)}},M=({api:e,updateSessionRuntimeStatus:t})=>async({sessionId:s,content:i,files:a})=>{const r=await e.chat({session_id:s,content:i,files:a}),n=G([r,"access",e=>e.data,"optionalAccess",e=>e.message_id]);if(!n)throw new F(r.msg||"Failed to send session message","SESSION_MESSAGE_FAILED");return await t({sessionId:s,status:"working"}),{sessionId:s,messageId:n,status:"accepted"}};var H,W,V,Y,$,Z,K,J,X,Q,ee,te,se,ie,ae,re,ne,oe,ce,le,de,_e,ue,pe,he,me,ge,Ee,we,Te,Se,fe,Re,Pe,Ae,Ie,Ue,Ce,Le,Oe,ve,ye,Be,be,ze,De,Ne,qe,Fe,ke,Ge,je,xe,Me,He,We,Ve;function Ye(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}!function(e){e[e.Free=0]="Free";e[e.PremiumLite=10]="PremiumLite";e[e.Premium=15]="Premium";e[e.PremiumPlus=20]="PremiumPlus";e[e.V1ProInstance=100]="V1ProInstance";e[e.ProPersonal=110]="ProPersonal";e[e.CozePersonalPlus=112]="CozePersonalPlus";e[e.CozePersonalAdvanced=114]="CozePersonalAdvanced";e[e.CozePersonalPro=116]="CozePersonalPro";e[e.CozePersonalUltra=118]="CozePersonalUltra";e[e.Team=120]="Team";e[e.EnterpriseBasic=125]="EnterpriseBasic";e[e.Enterprise=130]="Enterprise";e[e.EnterprisePro=135]="EnterprisePro"}(H||(H={})),function(e){e[e.Resume=1]="Resume";e[e.Terminate=2]="Terminate"}(W||(W={})),function(e){e[e.CAL_TYPE_UNSPECIFIED=0]="CAL_TYPE_UNSPECIFIED";e[e.CAL_TYPE_CRON=1]="CAL_TYPE_CRON";e[e.CAL_TYPE_HEARTBEAT=2]="CAL_TYPE_HEARTBEAT";e[e.CAL_TYPE_ONCE=3]="CAL_TYPE_ONCE";e[e.CAL_TYPE_DEFAULT=4]="CAL_TYPE_DEFAULT"}(V||(V={})),function(e){e[e.EVENT_STATUS_UNSPECIFIED=0]="EVENT_STATUS_UNSPECIFIED";e[e.EVENT_STATUS_PENDING=1]="EVENT_STATUS_PENDING";e[e.EVENT_STATUS_RUNNING=2]="EVENT_STATUS_RUNNING";e[e.EVENT_STATUS_COMPLETED=3]="EVENT_STATUS_COMPLETED";e[e.EVENT_STATUS_PAUSED=4]="EVENT_STATUS_PAUSED";e[e.EVENT_STATUS_FAILED=5]="EVENT_STATUS_FAILED"}(Y||(Y={})),function(e){e[e.UnknownTask=0]="UnknownTask";e[e.SubagentTask=1]="SubagentTask";e[e.CronTask=2]="CronTask";e[e.MobileUseTask=3]="MobileUseTask";e[e.BrowserUseTask=4]="BrowserUseTask";e[e.ComputerUseTask=5]="ComputerUseTask"}($||($={})),function(e){e[e.Owner=1]="Owner";e[e.Member=10]="Member"}(Z||(Z={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent"}(K||(K={})),function(e){e[e.Unread=1]="Unread";e[e.Read=2]="Read";e[e.Overdue=3]="Overdue"}(J||(J={})),function(e){e[e.Chat=1]="Chat"}(X||(X={})),function(e){e[e.All=0]="All";e[e.Private=1]="Private";e[e.NormalProject=2]="NormalProject";e[e.VideoProject=3]="VideoProject"}(Q||(Q={})),function(e){e[e.Common=1]="Common";e[e.Video=2]="Video"}(ee||(ee={})),function(e){e[e.History=0]="History";e[e.Private=1]="Private";e[e.Project=2]="Project"}(te||(te={})),function(e){e[e.Asset=1]="Asset";e[e.Material=2]="Material"}(se||(se={})),function(e){e[e.Running=1]="Running";e[e.Waiting=2]="Waiting";e[e.Terminated=3]="Terminated";e[e.Finish=4]="Finish"}(ie||(ie={})),function(e){e[e.PENDING=0]="PENDING";e[e.RUNNING=1]="RUNNING";e[e.COMPLETED=2]="COMPLETED";e[e.FAILED=3]="FAILED";e[e.INTERRUPTED=4]="INTERRUPTED";e[e.CANCELLED=5]="CANCELLED";e[e.TIMEOUT=6]="TIMEOUT";e[e.RESUMED=7]="RESUMED"}(ae||(ae={})),function(e){e[e.PENDING=0]="PENDING";e[e.RUNNING=1]="RUNNING";e[e.COMPLETED=2]="COMPLETED";e[e.FAILED=3]="FAILED";e[e.INTERRUPTED=4]="INTERRUPTED";e[e.RESUMED=5]="RESUMED";e[e.CANCELLED=6]="CANCELLED"}(re||(re={})),function(e){e[e.Managed=1]="Managed";e[e.Cloud=2]="Cloud";e[e.Local=3]="Local"}(ne||(ne={})),function(e){e[e.AgentFrameworkCozeClaw=0]="AgentFrameworkCozeClaw";e[e.AgentFrameworkClaudeCode=1]="AgentFrameworkClaudeCode";e[e.AgentFrameworkCodex=2]="AgentFrameworkCodex";e[e.AgentFrameworkOpenClaw=3]="AgentFrameworkOpenClaw"}(oe||(oe={})),function(e){e[e.Offline=0]="Offline";e[e.Online=1]="Online";e[e.Busy=2]="Busy";e[e.Starting=3]="Starting";e[e.Error=4]="Error"}(ce||(ce={})),function(e){e[e.CreateModeTemplate=1]="CreateModeTemplate";e[e.CreateModeCloudThirdParty=2]="CreateModeCloudThirdParty";e[e.CreateModeLocalThirdParty=3]="CreateModeLocalThirdParty"}(le||(le={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.MOBILE_LIMIT_EXCEEDED=2]="MOBILE_LIMIT_EXCEEDED"}(de||(de={})),function(e){e[e.Terminate=1]="Terminate"}(_e||(_e={})),function(e){e[e.CANCEL=1]="CANCEL"}(ue||(ue={})),function(e){e[e.Success=1]="Success";e[e.Failed=2]="Failed";e[e.Timeout=3]="Timeout"}(pe||(pe={})),function(e){e[e.Init=1]="Init";e[e.Online=2]="Online";e[e.Busy=3]="Busy";e[e.Offline=4]="Offline";e[e.Error=5]="Error"}(he||(he={})),function(e){e[e.Unset=0]="Unset";e[e.Disabled=1]="Disabled";e[e.Enabled=2]="Enabled"}(me||(me={})),function(e){e[e.PENDING=0]="PENDING";e[e.APPROVED=1]="APPROVED";e[e.REJECTED=2]="REJECTED"}(ge||(ge={})),function(e){e[e.IDLE=1]="IDLE";e[e.INTERRUPTED=2]="INTERRUPTED";e[e.REBOOTING=3]="REBOOTING";e[e.INITIALIZING=4]="INITIALIZING";e[e.ARREARS=5]="ARREARS";e[e.RUNNING=6]="RUNNING";e[e.RESERVED=7]="RESERVED";e[e.SCALING=8]="SCALING";e[e.ASSIGN_FAILED=9]="ASSIGN_FAILED";e[e.BUSY=10]="BUSY"}(Ee||(Ee={})),function(e){e[e.PHONE_8C24G=1]="PHONE_8C24G";e[e.PHONE_4C12G=2]="PHONE_4C12G";e[e.PHONE_2C6G=3]="PHONE_2C6G";e[e.PC_2C4G=101]="PC_2C4G";e[e.PC_4C8G=102]="PC_4C8G";e[e.PC_8C16G=103]="PC_8C16G";e[e.PC_16C32G=104]="PC_16C32G";e[e.PC_32C64G=105]="PC_32C64G"}(we||(we={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(Te||(Te={})),function(e){e[e.SUBSCRIBING=0]="SUBSCRIBING";e[e.BOOTING=1]="BOOTING";e[e.REBOOTING=2]="REBOOTING";e[e.IDLE=3]="IDLE";e[e.BUSY=4]="BUSY";e[e.INTERRUPTED=5]="INTERRUPTED";e[e.RELEASING=6]="RELEASING";e[e.RELEASED=7]="RELEASED";e[e.OFFLINE=8]="OFFLINE";e[e.ARREARS=9]="ARREARS";e[e.RESERVED=10]="RESERVED";e[e.SCALING=11]="SCALING";e[e.ASSIGN_FAILED=12]="ASSIGN_FAILED"}(Se||(Se={})),function(e){e[e.HEALTHY=1]="HEALTHY";e[e.WARNING=2]="WARNING";e[e.CRITICAL=3]="CRITICAL"}(fe||(fe={})),function(e){e[e.AVAILABLE=1]="AVAILABLE";e[e.NEED_UPGRADE_PLAN=2]="NEED_UPGRADE_PLAN";e[e.NOT_ALLOWED_DOWNGRADE=3]="NOT_ALLOWED_DOWNGRADE";e[e.CURRENT_SPEC=4]="CURRENT_SPEC"}(Re||(Re={})),function(e){e[e.Send=1]="Send";e[e.Received=2]="Received";e[e.Spam=3]="Spam"}(Pe||(Pe={})),function(e){e[e.Normal=0]="Normal";e[e.Spoof=1]="Spoof";e[e.Phishing=2]="Phishing";e[e.Spam=3]="Spam";e[e.Malicious=4]="Malicious"}(Ae||(Ae={})),function(e){e[e.Normal=0]="Normal";e[e.Sending=1]="Sending";e[e.Failed=2]="Failed"}(Ie||(Ie={})),function(e){e[e.FILE_PARTITION_UNSPECIFIED=0]="FILE_PARTITION_UNSPECIFIED";e[e.FILE_PARTITION_USER_MEMORY=1]="FILE_PARTITION_USER_MEMORY";e[e.FILE_PARTITION_AGENT_ALL=2]="FILE_PARTITION_AGENT_ALL";e[e.FILE_PARTITION_USER_ALL=3]="FILE_PARTITION_USER_ALL";e[e.FILE_PARTITION_TRASH=9]="FILE_PARTITION_TRASH"}(Ue||(Ue={})),function(e){e[e.FILE_TAG_UNSPECIFIED=0]="FILE_TAG_UNSPECIFIED";e[e.FILE_TAG_FAVORITE=1]="FILE_TAG_FAVORITE";e[e.FILE_TAG_MEMORY=2]="FILE_TAG_MEMORY";e[e.FILE_TAG_TRASH=3]="FILE_TAG_TRASH"}(Ce||(Ce={})),function(e){e[e.FILE_TYPE_UNSPECIFIED=0]="FILE_TYPE_UNSPECIFIED";e[e.FILE_TYPE_FAVORITE=1]="FILE_TYPE_FAVORITE";e[e.FILE_TYPE_TEMPLATE=2]="FILE_TYPE_TEMPLATE";e[e.FILE_TYPE_TEMPLATE_COVER=3]="FILE_TYPE_TEMPLATE_COVER";e[e.FILE_TYPE_PLAN_TEMPLATE=4]="FILE_TYPE_PLAN_TEMPLATE";e[e.FILE_TYPE_ARTICLE=5]="FILE_TYPE_ARTICLE"}(Le||(Le={})),function(e){e[e.FOLDER_ARCHIVE_STATUS_UNSPECIFIED=0]="FOLDER_ARCHIVE_STATUS_UNSPECIFIED";e[e.FOLDER_ARCHIVE_STATUS_PENDING=1]="FOLDER_ARCHIVE_STATUS_PENDING";e[e.FOLDER_ARCHIVE_STATUS_RUNNING=2]="FOLDER_ARCHIVE_STATUS_RUNNING";e[e.FOLDER_ARCHIVE_STATUS_SUCCEEDED=3]="FOLDER_ARCHIVE_STATUS_SUCCEEDED";e[e.FOLDER_ARCHIVE_STATUS_FAILED=4]="FOLDER_ARCHIVE_STATUS_FAILED";e[e.FOLDER_ARCHIVE_STATUS_REJECTED=5]="FOLDER_ARCHIVE_STATUS_REJECTED";e[e.FOLDER_ARCHIVE_STATUS_EXPIRED=6]="FOLDER_ARCHIVE_STATUS_EXPIRED"}(Oe||(Oe={})),function(e){e[e.WORKSPACE_SEARCH_TAB_UNSPECIFIED=0]="WORKSPACE_SEARCH_TAB_UNSPECIFIED";e[e.WORKSPACE_SEARCH_TAB_ALL=1]="WORKSPACE_SEARCH_TAB_ALL";e[e.WORKSPACE_SEARCH_TAB_DOC=2]="WORKSPACE_SEARCH_TAB_DOC";e[e.WORKSPACE_SEARCH_TAB_SHEET=3]="WORKSPACE_SEARCH_TAB_SHEET";e[e.WORKSPACE_SEARCH_TAB_PPT=4]="WORKSPACE_SEARCH_TAB_PPT";e[e.WORKSPACE_SEARCH_TAB_IMAGE=5]="WORKSPACE_SEARCH_TAB_IMAGE";e[e.WORKSPACE_SEARCH_TAB_WEB=6]="WORKSPACE_SEARCH_TAB_WEB";e[e.WORKSPACE_SEARCH_TAB_VIDEO=7]="WORKSPACE_SEARCH_TAB_VIDEO";e[e.WORKSPACE_SEARCH_TAB_PODCAST=8]="WORKSPACE_SEARCH_TAB_PODCAST"}(ve||(ve={})),function(e){e[e.Chat=1]="Chat";e[e.ApiTemplate=2]="ApiTemplate"}(ye||(ye={})),function(e){e[e.User=1]="User";e[e.Agent=2]="Agent";e[e.Project=3]="Project"}(Be||(Be={})),function(e){e[e.Grant=1]="Grant";e[e.Revoke=2]="Revoke";e[e.UpdateScope=3]="UpdateScope"}(be||(be={})),function(e){e[e.Single=1]="Single";e[e.Desktop=2]="Desktop";e[e.All=3]="All"}(ze||(ze={})),function(e){e[e.Session=1]="Session";e[e.Agent=2]="Agent"}(De||(De={})),function(e){e[e.PDF=1]="PDF";e[e.PPT=2]="PPT";e[e.ImageEditablePpt=3]="ImageEditablePpt"}(Ne||(Ne={})),function(e){e[e.PDF=1]="PDF";e[e.DOCX=2]="DOCX"}(qe||(qe={})),function(e){e[e.POSITION=0]="POSITION";e[e.ELEMENT=1]="ELEMENT"}(Fe||(Fe={})),function(e){e[e.STORAGE_RESOURCE_TYPE_UNSPECIFIED=0]="STORAGE_RESOURCE_TYPE_UNSPECIFIED";e[e.STORAGE_RESOURCE_TYPE_AGENT=1]="STORAGE_RESOURCE_TYPE_AGENT";e[e.STORAGE_RESOURCE_TYPE_PROJECT=2]="STORAGE_RESOURCE_TYPE_PROJECT";e[e.STORAGE_RESOURCE_TYPE_VIDEO_PROJECT=3]="STORAGE_RESOURCE_TYPE_VIDEO_PROJECT";e[e.STORAGE_RESOURCE_TYPE_CODING_PROJECT=4]="STORAGE_RESOURCE_TYPE_CODING_PROJECT"}(ke||(ke={})),function(e){e[e.ACCOUNT_QUOTA_ZERO=1]="ACCOUNT_QUOTA_ZERO";e[e.RESOURCE_LIMIT_EXCEEDED=2]="RESOURCE_LIMIT_EXCEEDED"}(Ge||(Ge={})),function(e){e[e.MOBILE=1]="MOBILE";e[e.COMPUTER=2]="COMPUTER"}(je||(je={})),function(e){e[e.Delete=1]="Delete";e[e.Read=2]="Read";e[e.ClearAt=3]="ClearAt"}(xe||(xe={})),function(e){e[e.Delete=0]="Delete";e[e.Running=1]="Running";e[e.Idle=2]="Idle"}(Me||(Me={})),function(e){e[e.Pin=1]="Pin";e[e.Unpin=2]="Unpin";e[e.Delete=3]="Delete"}(He||(He={})),function(e){e[e.Running=1]="Running";e[e.Idle=2]="Idle"}(We||(We={})),function(e){e[e.Valid=1]="Valid";e[e.Delete=2]="Delete"}(Ve||(Ve={}));class $e{__init(){this.request=a.request}__init2(){this.baseURL=""}constructor(e){$e.prototype.__init.call(this),$e.prototype.__init2.call(this),this.request=Ye([e,"optionalAccess",e=>e.request])||this.request,this.baseURL=Ye([e,"optionalAccess",e=>e.baseURL])||this.baseURL}genBaseURL(e){return"string"==typeof this.baseURL?this.baseURL+e:this.baseURL(e)}ListMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/list"),a={session_id:s.session_id,cursor:s.cursor,size:s.size,asc_mode:s.asc_mode,need_reference:s.need_reference,conversation_id:s.conversation_id};return this.request({url:i,method:"POST",data:a},t)}ListSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/list"),a={claw_id:s.claw_id,limit:s.limit,offset:s.offset,is_pin:s.is_pin,order_by:s.order_by};return this.request({url:i,method:"POST",data:a},t)}ListProcess(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/process/list"),a={claw_id:s.claw_id,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}OperateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/operate"),a={session_id:s.session_id,operate_type:s.operate_type,conversation_id:s.conversation_id};return this.request({url:i,method:"POST",data:a},t)}UpdateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/update"),a={session_id:s.session_id,name:s.name,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}Chat(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/chat"),a={session_id:s.session_id,content:s.content,files:s.files,skill_ids:s.skill_ids,reference_message_id:s.reference_message_id,at_members:s.at_members,conversation_id:s.conversation_id,video_option:s.video_option};return this.request({url:i,method:"POST",data:a},t)}CreateMessageShare(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/create_share"),a={session_id:s.session_id,message_ids:s.message_ids,share_file:s.share_file};return this.request({url:i,method:"POST",data:a},t)}CreateSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/create"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetMainSession(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/get_main"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}EmailList(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/list"),a={claw_id:s.claw_id,email_type:s.email_type,contact_address:s.contact_address,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}CreateMailAddress(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/create_address"),a={claw_id:s.claw_id,address:s.address};return this.request({url:i,method:"POST",data:a},t)}BatchGetEmails(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/batch"),a={claw_id:s.claw_id,email_ids:s.email_ids};return this.request({url:i,method:"POST",data:a},t)}GetMailAddressInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/get_address"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateUserClawInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/claw/update_info"),a={claw_id:s.claw_id,file_name:s.file_name,file_content:s.file_content,model_name:s.model_name};return this.request({url:i,method:"POST",data:a},t)}ReceivedCallback(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/received_callback"),a={app_id:s.app_id,app_email:s.app_email,mail_id:s.mail_id,ouid:s.ouid,mail_message:s.mail_message,create_time:s.create_time};return this.request({url:i,method:"POST",data:a},t)}ListChannel(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/list"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetUrl(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_url"),a={uris:s.uris,share_id:s.share_id};return this.request({url:i,method:"POST",data:a},t)}GetUserClawInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/claw/info"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarQueryRange(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/query_range"),a={start_date:s.start_date,end_date:s.end_date,timezone:s.timezone,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}GetRecentFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/recent"),a={limit:s.limit,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}FileUpload(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/upload"),a={file_name:s.file_name,file_content:s.file_content,file_type:s.file_type,tags:s.tags,claw_id:s.claw_id,session_id:s.session_id,project_id:s.project_id,project_dir:s.project_dir};return this.request({url:i,method:"POST",data:a},t)}GetFileTree(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/tree"),a={partition:s.partition,depth:s.depth,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}ListFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/list"),a={tag:s.tag,limit:s.limit,offset:s.offset,sort_by:s.sort_by,sort_order:s.sort_order,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}GetFrontierKey(e,t){const s=this.genBaseURL("/api/coze_claw/resource/get_frontier_key");return this.request({url:s,method:"GET"},t)}GetContacts(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/email/get_contacts"),a={claw_id:s.claw_id,size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}CalendarBatchGetEvents(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/batch_get_events"),a={uids:s.uids,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/update"),a={file_path:s.file_path,file_content:s.file_content,claw_id:s.claw_id,file_uri:s.file_uri,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetFileVersions(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri};return this.request({url:i,method:"GET",params:a},t)}GetSessionInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session/get_info"),a={session_id:s.session_id};return this.request({url:i,method:"POST",data:a},t)}GetMobileSTSCredentials(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/sts_credentials"),a={pod_id:s.pod_id};return this.request({url:i,method:"GET",params:a},t)}ListMobileTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/mobile/list_task"),a={size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}FileSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/search"),a={keyword:s.keyword,file_type:s.file_type,tags:s.tags,trash_only:s.trash_only,partition:s.partition,sort_by:s.sort_by,sort_order:s.sort_order,page_size:s.page_size,page_token:s.page_token,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}OperateMobileTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/operate_task"),a={mobile_task_id:s.mobile_task_id,action:s.action,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}Reset(e,t){const s=this.genBaseURL("/api/coze_claw/resource/reset");return this.request({url:s,method:"POST"},t)}ListMobile(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/mobile/list"),a={mobile_ids:s.mobile_ids};return this.request({url:i,method:"GET",params:a},t)}EmailSendCallback(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/email/send_callback"),a={otid:s.otid,ouid:s.ouid,mail_id:s.mail_id,message_id:s.message_id,time_stamp:s.time_stamp,from_address:s.from_address,recipient_address:s.recipient_address,event:s.event,src_ip:s.src_ip,return_code:s.return_code,return_msg:s.return_msg,last_update_time_stamp:s.last_update_time_stamp,delivery_error_classify:s.delivery_error_classify};return this.request({url:i,method:"POST",data:a},t)}UnsubscribeMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/unsubscribe"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"POST",data:a},t)}SubscribeMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/subscribe"),a={name:s.name};return this.request({url:i,method:"POST",data:a},t)}OperateMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/operate"),a={mobile_id:s.mobile_id,action:s.action,reason:s.reason,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}CalendarListRecurringEvents(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/list_recurring_events"),a={claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}CalendarGetEventDebugURL(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/get_event_debug_url"),a={calendar_event_uid:s.calendar_event_uid,instance_start:s.instance_start};return this.request({url:i,method:"GET",params:a},t)}GetFeishuAuthInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/auth_info"),a={claw_id:s.claw_id,bot_name:s.bot_name,redirect_url:s.redirect_url};return this.request({url:i,method:"POST",data:a},t)}ExchangeFeishuAuthCode(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/exchange_code"),a={code:s.code,verify_state:s.verify_state};return this.request({url:i,method:"POST",data:a},t)}FeishuAuthCallback(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/auth_callback"),a={code:s.code,verify_state:s.verify_state};return this.request({url:i,method:"POST",data:a},t)}CancelFeishuAuth(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/cancel_auth"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}ApiTemplate(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/image/api_template"),a={session_id:s.session_id,prompt:s.prompt,files:s.files,type:s.type};return this.request({url:i,method:"POST",data:a},t)}CreateFeishuApp(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/feishu/create_app"),a={claw_id:s.claw_id,bot_name:s.bot_name,recreate:s.recreate};return this.request({url:i,method:"POST",data:a},t)}GetWebUrl(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_web_url"),a={original_url:s.original_url,exchange_for_short_url:s.exchange_for_short_url,exchange_for_qr_code:s.exchange_for_qr_code,exchange_for_long_url:s.exchange_for_long_url};return this.request({url:i,method:"GET",params:a},t)}CalendarDelete(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/delete"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarResume(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/resume"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}CalendarPause(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/calendar/pause"),a={uid:s.uid,instance_start:s.instance_start,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}DetailMobile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/detail"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"GET",params:a},t)}MGetMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/mget"),a={session_id:s.session_id,message_ids:s.message_ids};return this.request({url:i,method:"POST",data:a},t)}GenCover(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/resource/gen_cover"),a={original_file_uri:s.original_file_uri,resolution:s.resolution,mode:s.mode,selector_str:s.selector_str,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GenDoc(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/resource/gen_doc"),a={target_file_type:s.target_file_type,original_file_uri:s.original_file_uri,resource_map:s.resource_map,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}ShareDocs(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/share_docs"),a={uris:s.uris};return this.request({url:i,method:"POST",data:a},t)}TerminateProcess(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/process/terminate"),a={claw_id:s.claw_id,process_id:s.process_id};return this.request({url:i,method:"POST",data:a},t)}SearchMessage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/search_message"),a={session_id:s.session_id,query:s.query,limit:s.limit};return this.request({url:i,method:"POST",data:a},t)}WorkspaceSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/workspace_search"),a={keyword:s.keyword,tab:s.tab,page_size:s.page_size,page_token:s.page_token,session_id:s.session_id,claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}ExportPPT(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/export_ppt"),a={source_uri:s.source_uri,export_type:s.export_type};return this.request({url:i,method:"POST",data:a},t)}CreateFolderArchive(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/archive/create"),a={claw_id:s.claw_id,file_path:s.file_path,partition:s.partition,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetFolderArchiveStatus(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/archive/status"),a={claw_id:s.claw_id,job_id:s.job_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}GetSandboxToken(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/browser_use/get_sandbox_token"),a={session_id:s.session_id,claw_id:s.claw_id,session_key:s.session_key,computer_id:s.computer_id};return this.request({url:i,method:"POST",data:a},t)}OperateBrowserUse(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/browser_use/operate"),a={session_id:s.session_id,claw_id:s.claw_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ListBrowserUseMessage(e,t){const s=this.genBaseURL("/api/coze_claw/browser_use/list_message");return this.request({url:s,method:"GET"},t)}IntentRecognition(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/image/intent_recognition"),a={session_id:s.session_id,files:s.files,query:s.query};return this.request({url:i,method:"POST",data:a},t)}RestoreFileVersion(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions/restore"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri,version_id:s.version_id};return this.request({url:i,method:"POST",data:a},t)}GetFileVersionURL(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/versions/url"),a={file_path:s.file_path,claw_id:s.claw_id,file_uri:s.file_uri,version_id:s.version_id};return this.request({url:i,method:"GET",params:a},t)}ExportPPTSandbox(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/export_ppt_sandbox"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,html_content:s.html_content,title:s.title,export_type:s.export_type};return this.request({url:i,method:"POST",data:a},t)}CheckSubscribe(e,t){const s=this.genBaseURL("/api/coze_claw/mobile/check_subscribe");return this.request({url:s,method:"GET"},t)}GetMessageShare(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message/get_share"),a={share_id:s.share_id,need_reference:s.need_reference};return this.request({url:i,method:"POST",data:a},t)}GetModelConfig(e,t){const s=this.genBaseURL("/api/coze_claw/resource/get_model_config");return this.request({url:s,method:"POST"},t)}CheckResourceSubscribe(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/check_subscribe"),a={resource_types:s.resource_types};return this.request({url:i,method:"GET",params:a},t)}UnsubscribeComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/unsubscribe"),a={computer_id:s.computer_id};return this.request({url:i,method:"POST",data:a},t)}ListComputer(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/computer/list"),a={computer_ids:s.computer_ids};return this.request({url:i,method:"GET",params:a},t)}SubscribeComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/subscribe"),a={name:s.name};return this.request({url:i,method:"POST",data:a},t)}OperateComputer(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/operate"),a={computer_id:s.computer_id,action:s.action,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}WechatBindWait(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/bind_wait"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}WechatWebhook(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/wechat/webhook"),a={app_id:s.app_id,wechat_messages:s.wechat_messages};return this.request({url:i,method:"POST",data:a},t)}WechatBindStart(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/bind_start"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}WechatUnbind(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/unbind"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}OperateVideoTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/video/operate_task"),a={video_task_id:s.video_task_id,action:s.action,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}ListVideoTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/video/list_task"),a={size:s.size,cursor:s.cursor,claw_id:s.claw_id};return this.request({url:i,method:"GET",params:a},t)}WechatUnbindInternal(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/channel/wechat/unbind_internal"),a={app_id:s.app_id};return this.request({url:i,method:"POST",data:a},t)}GetEmailSettings(e,t){const s=this.genBaseURL("/api/coze_claw/email/get_settings");return this.request({url:s,method:"POST"},t)}GetFileTreeV2(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/tree_v2"),a={partition:s.partition,depth:s.depth,claw_id:s.claw_id,file_path:s.file_path,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}SandboxSkillHubAdd(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/skill/skill_hub_add"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,skill_id:s.skill_id,agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}SandboxSkillHubShopSearch(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/skill/skill_hub_shop_search"),a={sandbox_identity_ticket:s.sandbox_identity_ticket,keyword:s.keyword};return this.request({url:i,method:"POST",data:a},t)}GetStorageUsage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/storage_usage"),a={claw_id:s.claw_id,project_id:s.project_id};return this.request({url:i,method:"GET",params:a},t)}MobileScreenShot(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/mobile/screenshot"),a={mobile_id:s.mobile_id};return this.request({url:i,method:"GET",params:a},t)}OperateComputerTask(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/operate_task"),a={run_id:s.run_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ListComputerTask(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/computer/list_task"),a={size:s.size,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}ListClaw(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/list_claw"),a={project_id:s.project_id,limit:s.limit,cursor:s.cursor};return this.request({url:i,method:"POST",data:a},t)}ListProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/list"),a={type:s.type,limit:s.limit,offset:s.offset,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}RemoveProjectMember(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/remove"),a={project_id:s.project_id,project_member:s.project_member};return this.request({url:i,method:"POST",data:a},t)}UpdateInviteProjectUser(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/update"),a={project_id:s.project_id,is_accept:s.is_accept};return this.request({url:i,method:"POST",data:a},t)}CreateProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/create"),a={claw_ids:s.claw_ids,name:s.name,source_message_ids:s.source_message_ids,source_msg_id:s.source_msg_id,sub_type:s.sub_type};return this.request({url:i,method:"POST",data:a},t)}InviteProjectUser(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/invite"),a={project_id:s.project_id,invite_member:s.invite_member,invite_agent:s.invite_agent};return this.request({url:i,method:"POST",data:a},t)}DeleteProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/delete"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}AddProjectMember(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/add"),a={project_id:s.project_id,members:s.members};return this.request({url:i,method:"POST",data:a},t)}CreateClaw(e,t){const s=this.genBaseURL("/api/coze_claw/project/create_claw");return this.request({url:s,method:"POST"},t)}UpdateProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/update"),a={project_id:s.project_id,name:s.name,description:s.description,is_pin:s.is_pin};return this.request({url:i,method:"POST",data:a},t)}LeaveProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/leave"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetDeviceCreatePreflight(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/create/preflight"),a={cloud_device_type:s.cloud_device_type,cloud_device_id:s.cloud_device_id,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}ListInvitedProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/list_project"),a={limit:s.limit,offset:s.offset};return this.request({url:i,method:"POST",data:a},t)}ListProjectInvitee(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/list_invitee"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}GetGlobalFileTree(e,t){const s=this.genBaseURL("/api/coze_claw/file/global_tree");return this.request({url:s,method:"GET"},t)}EnterpriseGetDeviceStats(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/stats"),a={enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}ListBackgroundSession(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/session/list_background"),a={session_id:s.session_id,filter_running:s.filter_running,cursor:s.cursor,size:s.size};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListMyDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/my"),a={cursor:s.cursor,page_size:s.page_size,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseGetAutoApprove(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/auto_approve"),a={enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseAssignDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/assign"),a={cloud_device_id:s.cloud_device_id,target_user_uid:s.target_user_uid,organization_id:s.organization_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}GetPairResult(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/get_pair_result"),a={pair_code:s.pair_code};return this.request({url:i,method:"POST",data:a},t)}GetAgentStatus(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/get_status"),a={agent_ids:s.agent_ids};return this.request({url:i,method:"POST",data:a},t)}GetGlobalStorageUsage(e,t){const s=this.genBaseURL("/api/coze_claw/resource/global_storage_usage");return this.request({url:s,method:"GET"},t)}EnterpriseClaimDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim"),a={devices:s.devices,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseEditDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/edit"),a={cloud_device_id:s.cloud_device_id,device_name:s.device_name,spec:s.spec,confirm_price_change:s.confirm_price_change,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}SubscribeDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/subscribe"),a={cloud_device_type:s.cloud_device_type,spec:s.spec,name:s.name};return this.request({url:i,method:"POST",data:a},t)}ChangeDeviceSpec(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/device/change_spec"),a={cloud_device_type:s.cloud_device_type,cloud_device_id:s.cloud_device_id,target_spec:s.target_spec,name:s.name};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListDeviceClaimRecord(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/list"),a={cursor:s.cursor,page_size:s.page_size,status:s.status,keyword:s.keyword,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}GeneratePairCode(e,t){const s=this.genBaseURL("/api/coze_claw/agent/generate_pair_code");return this.request({url:s,method:"POST"},t)}EnterpriseRejectDeviceClaim(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/reject"),a={claim_record_id:s.claim_record_id,reason:s.reason,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseDeleteDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/delete"),a={cloud_device_id:s.cloud_device_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseApproveDeviceClaim(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/claim/approve"),a={claim_record_id:s.claim_record_id,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseListDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/list"),a={cursor:s.cursor,page_size:s.page_size,keyword:s.keyword,cloud_device_type:s.cloud_device_type,status:s.status,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}EnterpriseListAvailableDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/available"),a={cursor:s.cursor,page_size:s.page_size,enterprise_id:s.enterprise_id};return this.request({url:i,method:"GET",params:a},t)}CreateAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/create"),a={agent_name:s.agent_name,create_mode:s.create_mode,template_id:s.template_id,target_device_id:s.target_device_id,framework:s.framework,pair_code:s.pair_code,local_agents:s.local_agents,description:s.description,icon:s.icon};return this.request({url:i,method:"POST",data:a},t)}ListDeviceAgents(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/device/binding/list_by_device"),a={cloud_device_id:s.cloud_device_id,cloud_device_type:s.cloud_device_type,cursor:s.cursor,page_size:s.page_size};return this.request({url:i,method:"GET",params:a},t)}EnterpriseReassignDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/reassign"),a={cloud_device_id:s.cloud_device_id,new_user_uid:s.new_user_uid,new_organization_id:s.new_organization_id,cloud_device_type:s.cloud_device_type,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseSetAutoApprove(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/auto_approve"),a={enabled:s.enabled,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}GetHotWords(e,t){const s=this.genBaseURL("/api/coze_claw/asr/get_hot_words");return this.request({url:s,method:"GET"},t)}GetModelList(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/get_model_list"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}SelectModel(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/resource/select_model"),a={claw_id:s.claw_id,name:s.name};return this.request({url:i,method:"POST",data:a},t)}CreateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/create"),a={session_id:s.session_id,name:s.name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}OperateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/operate"),a={session_conversation_id:s.session_conversation_id,operate_type:s.operate_type};return this.request({url:i,method:"POST",data:a},t)}MessageCardAction(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/message_card/action"),a={name:s.name,surface_id:s.surface_id,source_component_id:s.source_component_id,timestamp:s.timestamp,context:s.context,message_id:s.message_id,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}UpdateSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/update"),a={session_conversation_id:s.session_conversation_id,name:s.name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}ListConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/conversation/list"),a={type:s.type,is_pin:s.is_pin,limit:s.limit,offset:s.offset,top_claw_id:s.top_claw_id};return this.request({url:i,method:"POST",data:a},t)}EnterpriseBatchCreateDevice(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/enterprise/device/batch_create"),a={cloud_device_type:s.cloud_device_type,device_name:s.device_name,spec:s.spec,quantity:s.quantity,enterprise_id:s.enterprise_id};return this.request({url:i,method:"POST",data:a},t)}ListSessionConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/session_conversation/list"),a={session_id:s.session_id,limit:s.limit,offset:s.offset};return this.request({url:i,method:"POST",data:a},t)}GetAgentFileContent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/file/content"),a={agent_id:s.agent_id,file_path:s.file_path,file_token:s.file_token};return this.request({url:i,method:"GET",params:a},t)}GetProjectInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/info"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}OperateDesktop(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/operate"),a={device_id:s.device_id,action:s.action,new_name:s.new_name};return this.request({url:i,method:"POST",data:a},t)}DesktopHeartbeat(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/heartbeat"),a={device_id:s.device_id,version:s.version,status:s.status,os:s.os,desktop_name:s.desktop_name};return this.request({url:i,method:"POST",data:a},t)}ReportDesktopCommandResult(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/report_command_result"),a={command_id:s.command_id,status:s.status,data:s.data,upload_file:s.upload_file};return this.request({url:i,method:"POST",data:a},t)}ListDesktop(e,t){const s=this.genBaseURL("/api/coze_claw/desktop/list");return this.request({url:s,method:"GET"},t)}SearchProject(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/search"),a={type:s.type,keyword:s.keyword,limit:s.limit,cursor:s.cursor};return this.request({url:i,method:"GET",params:a},t)}GetProjectMembers(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_member/list"),a={project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}UpdateAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/update"),a={agent_id:s.agent_id,agent_name:s.agent_name,description:s.description,file_name:s.file_name,file_content:s.file_content};return this.request({url:i,method:"POST",data:a},t)}ListAgents(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/list"),a={page_size:s.page_size,cursor:s.cursor,deploy_types:s.deploy_types,order_by:s.order_by};return this.request({url:i,method:"POST",data:a},t)}GetAgentDetail(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/detail"),a={agent_id:s.agent_id};return this.request({url:i,method:"POST",data:a},t)}ReconnectAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/reconnect"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}DisconnectAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/disconnect"),a={agent_id:s.agent_id,reason:s.reason,force:s.force};return this.request({url:i,method:"POST",data:a},t)}GetCozeClawUserInfo(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/info"),a={need_onboarding_status:s.need_onboarding_status};return this.request({url:i,method:"POST",data:a},t)}SetCozeClawUserOnboardingStatus(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/set_onboarding_status"),a={onboarding_status:s.onboarding_status};return this.request({url:i,method:"POST",data:a},t)}GetGlobalUnread(e,t){const s=this.genBaseURL("/api/coze_claw/unread/get_total");return this.request({url:s,method:"POST"},t)}GenerateAgentName(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/agent/generate_name"),a={create_mode:s.create_mode,template_id:s.template_id,framework:s.framework};return this.request({url:i,method:"POST",data:a},t)}ListProjectFiles(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/list"),a={project_id:s.project_id,file_path:s.file_path,depth:s.depth};return this.request({url:i,method:"POST",data:a},t)}WriteProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/write"),a={project_id:s.project_id,file_path:s.file_path,content:s.content};return this.request({url:i,method:"POST",data:a},t)}ReadProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/read"),a={project_id:s.project_id,file_path:s.file_path,offset:s.offset,limit:s.limit};return this.request({url:i,method:"POST",data:a},t)}EditProjectFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/project/file/edit"),a={project_id:s.project_id,file_path:s.file_path,mode:s.mode,old_string:s.old_string,new_string:s.new_string,append_content:s.append_content};return this.request({url:i,method:"POST",data:a},t)}ComputerScreenShot(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/computer/screenshot"),a={computer_id:s.computer_id};return this.request({url:i,method:"GET",params:a},t)}CancelProjectInvite(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project_invite/cancel"),a={project_id:s.project_id,invite_member:s.invite_member};return this.request({url:i,method:"POST",data:a},t)}GenerateAgentIcon(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/generate_icon"),a={agent_name:s.agent_name,description:s.description};return this.request({url:i,method:"POST",data:a},t)}ListPermission(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/permission/list"),a={session_id:s.session_id};return this.request({url:i,method:"GET",params:a},t)}OperatePermission(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/permission/operate"),a={session_id:s.session_id,action:s.action,target:s.target,permission_id:s.permission_id,desktop_id:s.desktop_id,scope:s.scope,claw_id:s.claw_id,file_path:s.file_path};return this.request({url:i,method:"POST",data:a},t)}RepairAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/repair"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}ResetAgent(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/reset"),a={agent_id:s.agent_id,reason:s.reason};return this.request({url:i,method:"POST",data:a},t)}MGetConversation(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/conversation/mget"),a={session_ids:s.session_ids,option:s.option,claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetProjectByClawID(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/project/get_by_claw_id"),a={claw_id:s.claw_id};return this.request({url:i,method:"POST",data:a},t)}GetDesktopCommand(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/get_command"),a={command_id:s.command_id};return this.request({url:i,method:"GET",params:a},t)}OperateVideoConversation(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/video/operate_conversation"),a={session_id:s.session_id,conversation_id:s.conversation_id,action:s.action};return this.request({url:i,method:"POST",data:a},t)}ValidateAgentName(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/validate_name"),a={agent_name:s.agent_name};return this.request({url:i,method:"POST",data:a},t)}GetLocalFileAccess(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/local_file_access"),a={device_id:s.device_id};return this.request({url:i,method:"GET",params:a},t)}UpdateLocalFileAccess(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/desktop/update_local_file_access"),a={device_id:s.device_id,status:s.status};return this.request({url:i,method:"POST",data:a},t)}AgentFileUpload(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/agent_upload"),a={file_name:s.file_name,file_content:s.file_content,file_type:s.file_type,tags:s.tags,agent_id:s.agent_id,session_id:s.session_id};return this.request({url:i,method:"POST",data:a},t)}SetNewFeaturePopupStatus(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/user/set_new_feature_popup_status"),a={new_feature_popup_status:s.new_feature_popup_status};return this.request({url:i,method:"POST",data:a},t)}DownloadFile(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/file/download"),a={file_url:s.file_url};return this.request({url:i,method:"GET",params:a},t)}DownloadImage(e,t){const s=e||{},i=this.genBaseURL("/api/coze_claw/file/download_image"),a={file_content:s.file_content,file_name:s.file_name,file_uri:s.file_uri};return this.request({url:i,method:"POST",data:a},t)}ResetV2(e,t){const s=this.genBaseURL("/api/coze_claw/resource/reset_v2");return this.request({url:s,method:"POST"},t)}AgentWebSearch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/web_search"),a={agent_id:s.agent_id,query_list:s.query_list,project_id:s.project_id};return this.request({url:i,method:"POST",data:a},t)}AgentWebFetch(e,t){const s=e,i=this.genBaseURL("/api/coze_claw/agent/web_fetch"),a={agent_id:s.agent_id,url:s.url,project_id:s.project_id,response_length:s.response_length};return this.request({url:i,method:"POST",data:a},t)}}const Ze=new $e({});function Ke(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const Je=Ne.PPT,Xe=Ne.ImageEditablePpt,Qe=e=>e.replace(/\s+/g," ").trim(),et=e=>Qe(e.replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")),tt=e=>{const t=e.match(/<title[^>]*>([\s\S]*?)<\/title>/i),s=Ke([t,"optionalAccess",e=>e[1]])?et(t[1]):"";if(s)return s;const i=et(e);return i?i.split(" ")[0]:void 0},st=e=>{const t=(e=>{if(e.includes("\x3c!--SPLIT_HTML--\x3e"))return e.split("\x3c!--SPLIT_HTML--\x3e").map((e=>e.trim())).filter(Boolean);const t=e.match(/<html[\s\S]*?<\/html>/gi);return Ke([t,"optionalAccess",e=>e.length])?t.map((e=>e.trim())).filter(Boolean):[e.trim()].filter(Boolean)})(e).map(((e,t)=>({page:t+1,title:tt(e),previewText:et(e)})));return{type:"html",pageCount:t.length,pages:t}},it=(e,t)=>{if(!(t.length>=80||void 0===e))if("string"!=typeof e)Array.isArray(e)?e.forEach((e=>it(e,t))):e&&"object"==typeof e&&Object.entries(e).forEach((([e,s])=>{(["title","text","content","description","name"].includes(e)||Array.isArray(s)||s&&"object"==typeof s)&&it(s,t)}));else{const s=Qe(e);s&&t.push(s)}},at=({api:e})=>async({fileUri:t,exportType:s="ppt"})=>{const i=await e.exportPPT({source_uri:t,export_type:"editable"===s?Xe:Je});if(void 0!==i.code&&0!==i.code&&"0"!==i.code)throw new F(i.msg||"Failed to export PPT","SESSION_PPT_EXPORT_FAILED");const a=Ke([i,"access",e=>e.data,"optionalAccess",e=>e.url]);if(!a)throw new F(i.msg||"PPT export response missing download URL","SESSION_PPT_EXPORT_FAILED");return{uri:Ke([i,"access",e=>e.data,"optionalAccess",e=>e.uri]),url:a,exportType:s}};function rt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const nt=e=>{const t=String(e.id||"");if(!t)return null;const s="string"==typeof e.content?e.content:"",i=(r=s,a.safeJsonParse(r,void 0));var r;const n=rt([i,"optionalAccess",e=>e.message_data,"optionalAccess",e=>e.reply]),o=void 0===rt([i,"optionalAccess",e=>e.create_time_ms])?void 0:String(i.create_time_ms);return{messageId:t,sessionId:"string"==typeof rt([i,"optionalAccess",e=>e.session_id])?i.session_id:void 0,source:(c=e.source,1===Number(c)?"user":2===Number(c)?"agent":"unknown"),content:"string"==typeof rt([n,"optionalAccess",e=>e.content])&&n.content?n.content:s,files:Array.isArray(e.files)?e.files:void 0,createTime:"string"==typeof e.create_time?e.create_time:o,messageType:"string"==typeof rt([i,"optionalAccess",e=>e.message_type])?i.message_type:void 0,replyToMessageId:"string"==typeof rt([n,"optionalAccess",e=>e.reply_to_message_id])?n.reply_to_message_id:void 0,raw:e};var c};const ot=({api:e})=>async({fileUri:t})=>{const s=await e.getUrl({uris:[t]}),i=function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([s,"access",e=>e.data,"optionalAccess",e=>e.urls,"optionalAccess",e=>e[0]]);if(!i)throw new F(s.msg||"Failed to resolve session file URL","SESSION_FILE_URL_FAILED");return i};const ct=async({formData:e,request:t})=>{e.append("file_name",t.fileName);const s=await(async e=>{if(e instanceof Blob)return e;if(Buffer.isBuffer(e))return new Blob([e]);if(e instanceof Uint8Array)return new Blob([e]);if(e instanceof ArrayBuffer)return new Blob([e]);if("string"==typeof e)return new Blob([e]);throw new TypeError("Unsupported session upload file content type")})(t.fileContent),i=(a=t.fileContent)instanceof Blob&&a.type?a.type:void 0;var a;const r=i&&s.type!==i?new Blob([s],{type:i}):s;e.append("file_content",r,t.fileName),e.append("claw_id",t.clawId),t.projectId&&e.append("project_id",t.projectId),t.projectDir&&e.append("project_dir",t.projectDir),t.sessionId&&e.append("session_id",t.sessionId)},lt=({options:e,requestOptions:t})=>{const s={...(i=t.headers,a=()=>({}),null!=i?i:a())};var i,a;const r=(({baseUrl:e,webOrigin:t})=>{if(t)return t;try{return new URL(f(e)).origin}catch(e){return}})({baseUrl:e.baseUrl,webOrigin:e.webOrigin});return r&&(s.Origin=r),s.Referer=(({baseUrl:e,webOrigin:t})=>t?t.endsWith("/")?t:`${t}/`:f(e))({baseUrl:e.baseUrl,webOrigin:e.webOrigin}),e.xSpaceWebId&&(s["x-space-webid"]=e.xSpaceWebId),Object.assign(s,U(e.xTTEnv)),s},dt=e=>async(t,s={})=>{const i=new URL("/api/coze_claw/file/upload",f(e.baseUrl)),r=new FormData;await ct({formData:r,request:t});const n=lt({options:e,requestOptions:s}),o=a.customFetch.getRequestHeaders(i.toString(),{headers:n}),c=await globalThis.fetch(i.toString(),{method:"POST",headers:o,body:r});!function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}}([s,"access",e=>e.onGetLogId,"optionalCall",e=>e(c.headers.get("x-tt-logid")||"")]);const l=await P(c,{});return A(c,l,{serviceName:"Session"}),l};const _t=async({baseUrl:e,params:t,requestOptions:s={},responseFallback:i,xTTEnv:r})=>{const n=new URL(t.url,f(e));R(n,t.params);const o={"Content-Type":"application/json",...(c=s.headers,l=()=>({}),null!=c?c:l()),...U(r)};var c,l;const d=t.method.toUpperCase(),_="GET"===d?void 0:JSON.stringify(void 0===t.data?{}:t.data),u=await a.customFetch.fetch(n.toString(),{method:d,headers:o,body:_});!function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}}([s,"access",e=>e.onGetLogId,"optionalCall",e=>e(I(u)||"")]);const p=await P(u,i);return A(u,p,{serviceName:"Session"}),p},ut=e=>{const t=async(t,s={})=>await _t({baseUrl:e.baseUrl,params:t,requestOptions:s,responseFallback:{},xTTEnv:e.xTTEnv}),s=new $e({baseURL:f(e.baseUrl),request:(e,s={})=>t(e,s)}),i=new $e({baseURL:f(e.baseUrl),request:(e,s={})=>t(e,s)});return{getUserClawInfo:(t,s)=>_t({baseUrl:e.baseUrl,params:{url:"/api/coze_claw/claw/info",method:"POST",data:t},requestOptions:s,responseFallback:{},xTTEnv:e.xTTEnv}),createSession:(e,t)=>s.CreateSession(e,t),listSession:(e,t)=>s.ListSession(e,t),listMessage:(e,t)=>s.ListMessage(e,t),uploadFile:dt(e),getWebUrl:(e,t)=>i.GetWebUrl(e,t),getUrl:(e,t)=>i.GetUrl(e,t),exportPPT:(e,t)=>i.ExportPPT(e,t),chat:(e,t)=>s.Chat(e,t),listProcess:(e,t)=>s.ListProcess(e,t)}},pt=e=>{const t=ut({baseUrl:e.sessionApiBaseUrl||e.apiBaseUrl,webOrigin:e.sessionApiBaseUrl||e.apiBaseUrl,xSpaceWebId:e.sessionSpaceWebId,xTTEnv:e.xTTEnv});return{getUserClawInfo:(e,s)=>t.getUserClawInfo(e,s),createSession:(e,s)=>t.createSession(e,s),listSession:(e,s)=>t.listSession(e,s),listMessage:(e,s)=>t.listMessage(e,s),uploadFile:(e,s)=>t.uploadFile(e,s),getWebUrl:(e,s)=>t.getWebUrl(e,s),getUrl:(e,s)=>t.getUrl(e,s),exportPPT:(e,s)=>t.exportPPT(e,s),chat:(e,s)=>t.chat(e,s),listProcess:(e,s)=>t.listProcess(e,s)}},ht=()=>({async get(){const e=await w();return{sessionId:e.sessionId,sessionClawId:e.sessionClawId}},async save(e){await T(e)}});function mt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const gt=[".report.html",".podcast.html",".webdoc.html",".socmed.html",".pptx.html",".poster.html",".resume.html",".chart.html"],Et=({file:e,fileIndex:t,clawId:s,webOrigin:i})=>{const a=e.file_uri;if(!a||!s)return;const r=new URL(i).origin;const n=e.file_name||a.split("/").pop()||"";return(e=>e.endsWith(".html")&&!gt.some((t=>e.endsWith(t))))(n||a)?`${r}/web?is_shared=1&uri=${encodeURIComponent(a)}&is_claw=1`:`${r}/share-product/${s}?index=${t}&uri=${encodeURIComponent(a)}&filename=${encodeURIComponent(n)}&only_content=1&is_claw=1`},wt=async({files:e,clawId:t,webOrigin:s,api:i})=>e&&0!==e.length?await Promise.all(e.map((async(e,a)=>{const r=Et({file:e,fileIndex:a,clawId:t,webOrigin:s});return{...e,preview_url:await y({url:r,api:i})}}))):[],Tt=async({files:e,clawId:t,apiBaseUrl:s,sessionApiBaseUrl:i,xTTEnv:a,service:r,deps:n})=>{if(!e||0===e.length)return e;const o=mt([n,"optionalAccess",e=>e.store])||ht(),{sessionClawId:c}=await o.get(),l=t||c||(await r.getStatus()).clawId,d=(mt([n,"optionalAccess",e=>e.createApi])||ut)({baseUrl:i||s,xTTEnv:a}),_=mt([n,"optionalAccess",e=>e.resolveFiles])||wt;return await _({files:e,clawId:l,webOrigin:i||s,api:{getWebUrl:e=>d.getWebUrl(e)}})},St=e=>"running"!==e,ft=e=>{if(e&&0!==e.length)return e.map((e=>({fileName:e.file_name,fileUrl:e.file_url,previewUrl:e.preview_url,fileUri:e.file_uri})))};const Rt=r.join(n.homedir(),".coze","tasks","session-progress-tasks.json");class Pt extends Error{constructor(e){super(e),this.name="SessionTaskStoreError"}}class At extends Error{constructor(e){super(`Session task expired: ${e}`),this.taskId=e,this.name="SessionTaskExpiredError"}}class It extends Error{constructor(e){super(`Session task not found: ${e}`),this.taskId=e,this.name="SessionTaskNotFoundError"}}const Ut=(e,t)=>Object.entries(t).reduce(((e,[t,s])=>void 0===s?e:{...e,[t]:s}),{...e}),Ct=e=>{const t=a.safeJsonParse(e,void 0);if(void 0===t)throw new Pt("Failed to parse session task store");if(s=t,!Boolean(s)||"object"!=typeof s||Array.isArray(s)||!Array.isArray(t.items))throw new Pt("Failed to parse session task store");var s;return{version:1,items:t.items}},Lt=({filePath:e=Rt,now:t=Date.now,retentionMs:s=6048e5,writeDocument:i=async(e,t)=>{await(async({content:e,filePath:t})=>{await o.mkdir(r.dirname(t),{recursive:!0});const s=`${t}.tmp.${Date.now()}.${process.pid}`,i=await o.open(s,"w");try{await i.writeFile(e,"utf8"),await i.sync()}finally{await i.close()}try{await o.rename(s,t)}catch(e){throw await o.rm(s,{force:!0}).catch((()=>{})),e}})({content:t,filePath:e})}}={})=>{const a=(e=>async()=>{try{const t=await o.readFile(e,"utf8");return Ct(t)}catch(e){if("ENOENT"===function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([e,"optionalAccess",e=>e.code]))return{version:1,items:[]};if(e instanceof Pt)throw e;throw new Pt(`Failed to read session task store: ${String(e)}`)}})(e),n=(({filePath:e,writeDocument:t})=>async s=>{await t(e,JSON.stringify(s,null,2))})({filePath:e,writeDocument:i}),c=e=>{if(!St(e.status))return!1;const i=(a=e.finishedAt,r=()=>e.updatedAt,null!=a?a:r());var a,r;return t()-i>s},l=(({isExpired:e,readDocument:t})=>async({includeExpired:s,taskId:i})=>{const a=(await t()).items.find((e=>e.taskId===i));if(!a)throw new It(i);if(!s&&e(a))throw new At(i);return a})({isExpired:c,readDocument:a});return{list:async(e={})=>(await a()).items.filter((t=>!(!e.includeExpired&&c(t))&&((!e.sessionId||t.sessionId===e.sessionId)&&(!e.status||t.status===e.status)))).sort(((e,t)=>t.updatedAt-e.updatedAt)),get:async(e,t={})=>await l({includeExpired:t.includeExpired,taskId:e}),async upsert(e){const t=await a(),s=t.items.findIndex((t=>t.taskId===e.taskId));if(s>=0){const[i]=t.items.slice(s,s+1),a=Ut(i,e);t.items.splice(s,1,a)}else t.items.push(e);return await n(t),await l({includeExpired:!0,taskId:e.taskId})},async patch(e,t){const s=await a(),i=s.items.findIndex((t=>t.taskId===e));if(i<0)throw new It(e);const[r]=s.items.slice(i,i+1),o=Ut(r,t);return s.items.splice(i,1,o),await n(s),await l({includeExpired:!0,taskId:e})},async remove(e){const t=await a();t.items=t.items.filter((t=>t.taskId!==e)),await n(t)},async gc(){const e=await a(),t=e.items.filter(c);return e.items=e.items.filter((e=>!c(e))),await n(e),t},isExpired:c}},Ot=({api:e,store:t,authConfigured:s=()=>!0,fallbackAccountId:i})=>{const a=(({now:e=Date.now,workingTtlMs:t=3e4}={})=>{const s=new Map;return{clear(){s.clear()},getLive(i){const a=s.get(i);if(a){if(!(e()-a.updatedAt>t))return a;s.delete(i)}},markIdle(e){s.delete(e)},markWorking(t){s.set(t,{status:"working",updatedAt:e()})}}})(),r=(e=>async({sessionId:t,status:s})=>{"idle"!==s?e.markWorking(t):e.markIdle(t)})(a),n=(({api:e,authConfigured:t,fallbackAccountId:s,store:i})=>async()=>{const a=s;if(!t())return b({accountId:a,authConfigured:!1});try{const t=a?{account_id:a}:{},s=function(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}([await e.getUserClawInfo(t),"access",e=>e.data,"optionalAccess",e=>e.user_claw_info,"optionalAccess",e=>e.claw_id]);return s?(await i.save({sessionClawId:s}),{authConfigured:!0,authValid:!0,clawId:s,accountId:a,updatedAt:void 0}):b({accountId:a,authConfigured:!0})}catch(e){return b({accountId:a,authConfigured:!0})}})({api:e,authConfigured:s,fallbackAccountId:i,store:t}),o=(({createAuthInvalidError:e,getStatus:t,getStoredConfig:s})=>async()=>{const i=await s();if(i.sessionClawId)return i.sessionClawId;const a=await t();if(!a.authValid||!a.clawId)throw e();return a.clawId})({createAuthInvalidError:k,getStatus:n,getStoredConfig:async()=>t.get()}),c=D({api:e,resolveClawId:o}),{listMessages:l,listRepliesByMessage:d}=(({api:e,createListError:t})=>{const s=async({sessionId:s,cursor:i,size:a=10,ascMode:r})=>{const n=await e.listMessage({session_id:s,cursor:i,size:a,asc_mode:r});if(0!==n.code&&void 0!==n.code)throw t(n.msg||"Failed to list session messages");const o=(rt([n,"access",e=>e.data,"optionalAccess",e=>e.messages])||[]).map((e=>nt(e))).filter((e=>null!==e)),c=rt([n,"access",e=>e.data,"optionalAccess",e=>e.next_cursor]);return{items:o,nextCursor:c,hasMore:Boolean(c)}};return{listMessages:s,listRepliesByMessage:async({sessionId:e,messageId:t,size:i=10,maxPages:a=100})=>{let r,n=!1;const o=[];for(let c=0;c<a;c+=1){const a=await s({sessionId:e,cursor:r,size:i});if(a.items.forEach((e=>{e.messageId===t&&(n=!0),e.replyToMessageId===t&&o.push(e)})),n||!a.hasMore||!a.nextCursor)break;r=a.nextCursor}return{sessionId:e,requestMessageId:t,requestMessageFound:n,items:o.reverse()}}}})({api:e,createListError:e=>new F(e,"SESSION_MESSAGE_LIST_FAILED")});return{getStatus:n,createSession:j({api:e,resolveClawId:o}),listSessions:x({api:e,resolveClawId:o}),listMessages:l,listRepliesByMessage:d,sendMessage:M({api:e,updateSessionRuntimeStatus:r}),listProgresses:c,getProgress:N(c),getSessionDisplayStatus:q({listProgresses:c,runtimeStatusStore:a}),resolveFileUrl:ot({api:e}),exportPpt:at({api:e}),shortenWebUrl:B({api:e}),updateSessionRuntimeStatus:r}},vt=e=>{const t=ht();return Ot({api:pt(e),store:t,authConfigured:()=>Boolean(e.accessToken),fallbackAccountId:e.organizationId})};function yt(e){let t,s=e[0],i=1;for(;i<e.length;){const a=e[i],r=e[i+1];if(i+=2,("optionalAccess"===a||"optionalCall"===a)&&null==s)return;"access"===a||"optionalAccess"===a?(t=s,s=r(s)):"call"!==a&&"optionalCall"!==a||(s=r(((...e)=>s.call(t,...e))),t=void 0)}return s}const Bt=e=>{if(!e)return;const t=(e=>e.replace(/\s+/g," ").trim())(e);return t?t.length>120?`${t.slice(0,117)}...`:t:void 0},bt=e=>{if(!e)return;const t=e.trim();return t?t.length>200?`${t.slice(0,197)}...`:t:void 0},zt=({apiBaseUrl:e,now:t=Date.now,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,store:r=Lt(),xTTEnv:n})=>({async createOrUpdateTaskFromMessageWait({answerMessageId:e,content:s,files:i,messageId:a,progress:n,sessionId:o}){const c=t(),l=s,d=Bt(l),_="running"!==n.progressStatus,u=_?bt(l):void 0;return await r.upsert({taskId:(p=n.progressId,`stp_${p}`),kind:"session_progress",sessionId:o,messageId:a,progressId:n.progressId,status:_?"finished":"running",contentPreview:d,answerMessageId:e,replyContent:l,resultSummary:u,artifacts:ft(i),lastProgressStatus:n.progressStatus,createdAt:c,updatedAt:c,finishedAt:_?c:void 0});var p},getTask:async(e,t)=>await r.get(e,t),patchTask:async(e,t)=>await r.patch(e,t),listTasks:async e=>await r.list(e),async refreshTask(o,c){const l=await r.get(o,c);if(St(l.status))return l;try{const c=await i.getProgress({progressId:l.progressId}),d=t();if(c)return await r.patch(o,{contentPreview:Bt(l.replyContent),lastProgressStatus:c.progressStatus,lastRefreshError:void 0,resultSummary:void 0,status:"running"===c.progressStatus?"running":"finished",updatedAt:d});const _=await(async({apiBaseUrl:e,resolveReplyFiles:t=Tt,service:s,sessionApiBaseUrl:i,task:a,xTTEnv:r})=>{const n=await s.listRepliesByMessage({sessionId:a.sessionId,messageId:a.messageId}),o=n.items[n.items.length-1];if(!o)return null;const c=o.files&&o.files.length>0?await t({files:o.files,apiBaseUrl:e,sessionApiBaseUrl:i,service:s,xTTEnv:r}):o.files;return{answerMessageId:o.messageId,files:c,replyContent:o.content,resultSummary:bt(o.content)}})({apiBaseUrl:e,resolveReplyFiles:s,service:i,sessionApiBaseUrl:a,task:l,xTTEnv:n});return await r.patch(o,{answerMessageId:yt([_,"optionalAccess",e=>e.answerMessageId]),artifacts:yt([_,"optionalAccess",e=>e.files])?ft(_.files):void 0,contentPreview:Bt(yt([_,"optionalAccess",e=>e.replyContent])),finishedAt:d,lastProgressStatus:"finished",lastRefreshError:void 0,replyContent:yt([_,"optionalAccess",e=>e.replyContent]),resultSummary:yt([_,"optionalAccess",e=>e.resultSummary]),status:"finished",updatedAt:d})}catch(e){return await r.patch(o,{lastRefreshError:e instanceof Error?e.message:String(e),updatedAt:t()})}},gcTasks:async()=>await r.gc()});function Dt(e,t){return null!=e?e:t()}const Nt=({elapsedMs:e})=>e>=3e5?3e4:1e4;exports.Claw=Ze,exports.DEFAULT_CONFIG=m,exports.SessionServiceError=F,exports.SessionTaskExpiredError=At,exports.SessionTaskNotFoundError=It,exports.SessionTaskStoreError=Pt,exports.appendSearchParams=R,exports.buildSessionPptSlideUrl=({origin:e,fileUri:t,taskId:s,baseHeight:i=720,baseWidth:a=1280})=>{const r=s||(e=>e.split("/").filter(Boolean)[0])(t);if(!r)throw new F("Missing PPT task id for share URL","SESSION_PPT_SHARE_FAILED");const n=new URL(`/slide/${encodeURIComponent(r)}`,(e=>e.endsWith("/")?e.slice(0,-1):e)(e));return n.searchParams.set("uri",t),n.searchParams.set("baseHeight",String(i)),n.searchParams.set("baseWidth",String(a)),n.searchParams.set("is_claw","1"),n.toString()},exports.createDefaultSessionService=vt,exports.createSessionApiClient=ut,exports.createSessionConfigStore=ht,exports.createSessionTaskService=zt,exports.createSessionUploadFile=dt,exports.deleteConfig=async function(e){const t=process.env.COZE_CONFIG_FILE;if(t){const s=await g(t);if(s&&e in s){try{delete s[e],await _.writeFile(t,JSON.stringify(s,null,2),"utf8")}catch(e){throw new Error(`Failed to delete config from ${t}: ${e}`)}return}}let s=h,i=await g(s);if(i&&e in i||(s=p,i=await g(s)),i&&e in i)try{delete i[e],await _.writeFile(s,JSON.stringify(i,null,2),"utf8")}catch(e){throw new Error(`Failed to delete config from ${s}: ${e}`)}},exports.fetchSessionPptContent=async({url:e,fetchImpl:t=e=>a.customFetch.fetch(e),maxBytes:s=10485760})=>{const i=await t(e);if(!i.ok)throw new F(`Failed to fetch PPT content: ${i.status} ${i.statusText}`,"SESSION_PPT_FETCH_FAILED");const r=i.headers.get("content-length");if(r){const e=Number.parseInt(r,10);if(Number.isFinite(e)&&e>s)throw new F(`PPT content is too large: ${e} bytes exceeds ${s} bytes`,"SESSION_PPT_FETCH_FAILED")}const n=await i.text(),o=Buffer.byteLength(n,"utf8");if(o>s)throw new F(`PPT content is too large: ${o} bytes exceeds ${s} bytes`,"SESSION_PPT_FETCH_FAILED");return n},exports.formatServiceErrorWithLogId=({fallback:e,logId:t,message:s})=>{const i=s||e;return t?`${i}\n LogID: ${t}`:i},exports.formatSessionPptEditQuery=({pages:e,query:t})=>{const s=[...new Set(e)].sort(((e,t)=>e-t));return 1===s.length?`对第${s[0]}页进行变更:<${t}>`:`对第${s.join("、")}页进行变更:<${t}>`},exports.getCozeAccountHeaders=C,exports.getPpeHeaders=U,exports.getServiceResponseLogId=I,exports.installScopedCozeAccountFetchHeader=v,exports.isSessionTaskTerminal=St,exports.listConfigs=async function(){const e=process.env.COZE_CONFIG_FILE,[t,s,i]=await Promise.all([g(p),g(h),e?g(e):void 0]),a=E(),r=new Set([...Object.keys(m),...Object.keys(t||{}),...Object.keys(s||{}),...Object.keys(i||{}),...Object.keys(a)]),n=[];for(const e of Array.from(r)){const r=e;let o,c="default";r in a&&void 0!==a[r]?(o=a[r],c="env"):i&&r in i&&void 0!==i[r]?(o=String(i[r]),c="env-file"):s&&r in s&&void 0!==s[r]?(o=String(s[r]),c="local"):t&&r in t&&void 0!==t[r]?(o=String(t[r]),c="global"):r in m&&(o=String(m[r]),c="default"),n.push({key:e,value:o,source:c})}return n},exports.loadConfig=w,exports.normalizeBaseUrl=f,exports.parseServiceResponseBody=P,exports.parseSessionPptContent=e=>{const t=e.trim(),s=(e=>{const t=a.safeJsonParse(e,null),s=Array.isArray(Ke([t,"optionalAccess",e=>e.pages]))?t.pages:Array.isArray(Ke([t,"optionalAccess",e=>e.data,"optionalAccess",e=>e.pages]))?t.data.pages:null;return s?{type:"json",pageCount:s.length,pages:s.map(((e,t)=>{const s=[];it(e,s);const i=((e,t)=>{if(!e||"object"!=typeof e)return;const s=e;for(const e of t){const t=s[e];if("string"==typeof t&&t.trim())return t}})(e,["image_url","export_image_url","preview_url","thumbnail_url"]);return{page:t+1,title:s[0]||`第${t+1}页`,previewUrl:i,previewText:Qe(s.join(" "))||(i?`preview_url: ${i}`:"")}}))}:null})(t);return s||(/<html[\s>]/i.test(t)||t.includes("\x3c!--SPLIT_HTML--\x3e")?st(t):{type:"unknown",pageCount:0,pages:[]})},exports.resolveStoredSessionReplyFiles=Tt,exports.runSessionTaskRefreshWorkerCli=async()=>{const t=e.argv[2];if(!t)throw new Error("No payload provided");const s=a.safeJsonParse(t,void 0);if(!s)throw new Error("Invalid payload");await(async({now:e=Date.now,payload:t,sleep:s=async e=>await new Promise((t=>setTimeout(t,e))),taskService:r=zt({apiBaseUrl:t.apiBaseUrl,service:vt({accessToken:t.accessToken,apiBaseUrl:t.apiBaseUrl,organizationId:t.organizationId,sessionApiBaseUrl:Dt(t.sessionApiBaseUrl,(()=>"")),xTTEnv:t.xTTEnv}),sessionApiBaseUrl:t.sessionApiBaseUrl,store:Lt(),xTTEnv:t.xTTEnv})})=>{const n=new i.EnvHttpProxyAgent;a.customFetch.setDispatcher(n),a.customFetch.setHeaders({Authorization:`Bearer ${t.accessToken}`}),v({organizationId:t.organizationId}),t.xTTEnv&&a.customFetch.setHeaders({"x-use-ppe":"1","x-tt-env":t.xTTEnv});const o=e();let c=3e3;try{for(;;){await s(c);const i=await r.refreshTask(t.taskId,{includeExpired:!0});if(St(i.status))return;c=Nt({elapsedMs:e()-o})}}finally{await r.patchTask(t.taskId,{workerPid:void 0})}})({payload:s})},exports.saveConfig=T,exports.shouldInjectCozeAccountHeader=L,exports.startDetachedSessionTaskRefreshWorker=async({payload:i,spawnImpl:a=s.spawn})=>{const r=a(e.execPath,[t.resolve(__dirname,"./session-task-refresh.worker.js"),JSON.stringify(i)],{detached:!0,stdio:"ignore"});return r.unref(),r.pid};
|