@gaoding/cli 0.0.0 → 1.0.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +40 -3
  3. package/contracts/operations/agent.send/input.schema.json +353 -0
  4. package/contracts/operations/agent.send/output.schema.json +271 -0
  5. package/contracts/operations/auth.status/input.schema.json +7 -0
  6. package/contracts/operations/auth.status/output.schema.json +132 -0
  7. package/contracts/operations/dam.copy/input.schema.json +19 -0
  8. package/contracts/operations/dam.copy/output.schema.json +19 -0
  9. package/contracts/operations/dam.delete/input.schema.json +23 -0
  10. package/contracts/operations/dam.delete/output.schema.json +6 -0
  11. package/contracts/operations/dam.download/input.schema.json +14 -0
  12. package/contracts/operations/dam.download/output.schema.json +25 -0
  13. package/contracts/operations/dam.folder.list/input.schema.json +15 -0
  14. package/contracts/operations/dam.folder.list/output.schema.json +37 -0
  15. package/contracts/operations/dam.get/input.schema.json +16 -0
  16. package/contracts/operations/dam.get/output.schema.json +46 -0
  17. package/contracts/operations/dam.list/input.schema.json +44 -0
  18. package/contracts/operations/dam.list/output.schema.json +71 -0
  19. package/contracts/operations/dam.move/input.schema.json +19 -0
  20. package/contracts/operations/dam.move/output.schema.json +18 -0
  21. package/contracts/operations/dam.recycle.list/input.schema.json +13 -0
  22. package/contracts/operations/dam.recycle.list/output.schema.json +34 -0
  23. package/contracts/operations/dam.recycle.restore/input.schema.json +14 -0
  24. package/contracts/operations/dam.recycle.restore/output.schema.json +6 -0
  25. package/contracts/operations/dam.rename/input.schema.json +18 -0
  26. package/contracts/operations/dam.rename/output.schema.json +18 -0
  27. package/contracts/operations/dam.repository.list/input.schema.json +8 -0
  28. package/contracts/operations/dam.repository.list/output.schema.json +52 -0
  29. package/contracts/operations/dam.search/input.schema.json +46 -0
  30. package/contracts/operations/dam.search/output.schema.json +71 -0
  31. package/contracts/operations/dam.tag.list/input.schema.json +12 -0
  32. package/contracts/operations/dam.tag.list/output.schema.json +26 -0
  33. package/contracts/operations/dam.upload/input.schema.json +31 -0
  34. package/contracts/operations/dam.upload/output.schema.json +46 -0
  35. package/contracts/operations/editor.apply/input.schema.json +134 -0
  36. package/contracts/operations/editor.apply/output.schema.json +15 -0
  37. package/contracts/operations/editor.connect/input.schema.json +15 -0
  38. package/contracts/operations/editor.connect/output.schema.json +17 -0
  39. package/contracts/operations/editor.disconnect/input.schema.json +8 -0
  40. package/contracts/operations/editor.disconnect/output.schema.json +14 -0
  41. package/contracts/operations/editor.save/input.schema.json +8 -0
  42. package/contracts/operations/editor.save/output.schema.json +23 -0
  43. package/contracts/operations/editor.screenshot/input.schema.json +8 -0
  44. package/contracts/operations/editor.screenshot/output.schema.json +16 -0
  45. package/contracts/operations/editor.snapshot/input.schema.json +8 -0
  46. package/contracts/operations/editor.snapshot/output.schema.json +113 -0
  47. package/contracts/operations/model.get/input.schema.json +18 -0
  48. package/contracts/operations/model.get/output.schema.json +191 -0
  49. package/contracts/operations/model.list/input.schema.json +15 -0
  50. package/contracts/operations/model.list/output.schema.json +111 -0
  51. package/contracts/operations/org.current/input.schema.json +7 -0
  52. package/contracts/operations/org.current/output.schema.json +49 -0
  53. package/contracts/operations/org.list/input.schema.json +7 -0
  54. package/contracts/operations/org.list/output.schema.json +71 -0
  55. package/contracts/operations/tool.call/input.schema.json +35 -0
  56. package/contracts/operations/tool.call/output.schema.json +129 -0
  57. package/contracts/operations/tool.list/input.schema.json +7 -0
  58. package/contracts/operations/tool.list/output.schema.json +45 -0
  59. package/dist/bin/gd-cli.js +60 -0
  60. package/dist/bin/postinstall.js +42 -0
  61. package/dist/src/bootstrap/create-cli.js +112 -0
  62. package/dist/src/bootstrap/create-runtime.js +290 -0
  63. package/dist/src/bootstrap/validators.js +157 -0
  64. package/dist/src/cli/action-binding.js +109 -0
  65. package/dist/src/cli/agent-commands.js +49 -0
  66. package/dist/src/cli/auth-commands.js +55 -0
  67. package/dist/src/cli/dam-commands.js +469 -0
  68. package/dist/src/cli/editor-commands.js +73 -0
  69. package/dist/src/cli/errors.js +157 -0
  70. package/dist/src/cli/model-commands.js +61 -0
  71. package/dist/src/cli/org-commands.js +58 -0
  72. package/dist/src/cli/presenter.js +105 -0
  73. package/dist/src/cli/prompt.js +30 -0
  74. package/dist/src/cli/tool-commands.js +77 -0
  75. package/dist/src/cli/update-command.js +14 -0
  76. package/dist/src/contracts/schema.js +4 -0
  77. package/dist/src/features/agent/creative-agent-adapter.js +36 -0
  78. package/dist/src/features/agent/creative-protocol.js +432 -0
  79. package/dist/src/features/agent/creative-stream.js +127 -0
  80. package/dist/src/features/agent/use-cases.js +150 -0
  81. package/dist/src/features/auth/access-policy.js +101 -0
  82. package/dist/src/features/auth/credential-store.js +62 -0
  83. package/dist/src/features/auth/sso-service.js +194 -0
  84. package/dist/src/features/auth/state.js +129 -0
  85. package/dist/src/features/auth/use-cases.js +136 -0
  86. package/dist/src/features/dam/asset-projection.js +278 -0
  87. package/dist/src/features/dam/dam-api-adapter.js +562 -0
  88. package/dist/src/features/dam/file-downloader.js +242 -0
  89. package/dist/src/features/dam/object-storage.js +193 -0
  90. package/dist/src/features/dam/operation-executor.js +72 -0
  91. package/dist/src/features/dam/registered-uploader.js +247 -0
  92. package/dist/src/features/dam/repository-catalog.js +127 -0
  93. package/dist/src/features/dam/storage-upload.js +141 -0
  94. package/dist/src/features/dam/transient-uploader.js +17 -0
  95. package/dist/src/features/dam/use-cases.js +470 -0
  96. package/dist/src/features/editor/bridge-client.js +109 -0
  97. package/dist/src/features/editor/bridge-process.js +222 -0
  98. package/dist/src/features/editor/bridge-server.js +337 -0
  99. package/dist/src/features/editor/protocol.js +1 -0
  100. package/dist/src/features/editor/public-url.js +36 -0
  101. package/dist/src/features/editor/session-state.js +78 -0
  102. package/dist/src/features/editor/session.js +207 -0
  103. package/dist/src/features/editor/use-cases.js +88 -0
  104. package/dist/src/features/org/org-service.js +76 -0
  105. package/dist/src/features/org/use-cases.js +156 -0
  106. package/dist/src/features/skill/bundled-skills.js +55 -0
  107. package/dist/src/features/skill/installer.js +271 -0
  108. package/dist/src/features/tool/catalog.js +83 -0
  109. package/dist/src/features/tool/dynamic-schema.js +128 -0
  110. package/dist/src/features/tool/mns-catalog-adapter.js +265 -0
  111. package/dist/src/features/tool/tool-api-adapter.js +352 -0
  112. package/dist/src/features/tool/use-cases.js +177 -0
  113. package/dist/src/features/update/latest-version.js +37 -0
  114. package/dist/src/features/update/update-notification.js +262 -0
  115. package/dist/src/features/update/update-service.js +183 -0
  116. package/dist/src/platform/json-input.js +67 -0
  117. package/dist/src/platform/local-json-file.js +59 -0
  118. package/dist/src/platform/open-browser.js +8 -0
  119. package/dist/src/platform/redact.js +80 -0
  120. package/dist/src/platform/remote-error-evidence.js +80 -0
  121. package/dist/src/platform/remote-protocol.js +10 -0
  122. package/dist/src/platform/safe-upload-file.js +146 -0
  123. package/dist/src/platform/signature.js +20 -0
  124. package/dist/src/platform/signed-http-transport.js +143 -0
  125. package/dist/src/platform/url-safety.js +100 -0
  126. package/dist/src/telemetry/invocation.js +156 -0
  127. package/dist/src/telemetry/sls-sink.js +31 -0
  128. package/package.json +54 -8
  129. package/skills/gd-cli/SKILL.md +15 -0
  130. package/skills/gd-cli/references/auth-org.md +9 -0
  131. package/skills/gd-cli/references/creation.md +115 -0
  132. package/skills/gd-cli/references/dam.md +52 -0
  133. package/skills/gd-cli/references/editor.md +254 -0
  134. package/skills/gd-cli/references/errors.md +13 -0
  135. package/skills/gd-cli/references/update.md +13 -0
  136. package/index.js +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present GDHub Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,42 @@
1
- # @gaoding/cli
1
+ # GaoDing CLI
2
2
 
3
- Placeholder package for the Gaoding CLI.
3
+ 稿定面向 Agent 与人的命令行产品,提供 Agent 创作、Tool/Model 调用、AI+ Editor 操作和 DAM 素材管理。
4
4
 
5
- This package does not provide any functionality yet.
5
+ ## 安装
6
+
7
+ 需要 Node.js 20 或更高版本。使用 npm 或 pnpm 全局安装:
8
+
9
+ ```bash
10
+ npm install --global --allow-scripts=@gaoding/cli @gaoding/cli
11
+ # 或
12
+ pnpm add --global --allow-build=@gaoding/cli @gaoding/cli
13
+ ```
14
+
15
+ 全局安装和后续包升级会自动同步随包 `gd-cli` Agent Skill 到 canonical 目录,并连接已检测到的 Agent 宿主。npm 的 `--allow-scripts=@gaoding/cli` 与 pnpm 的 `--allow-build=@gaoding/cli` 分别只允许本包执行安装脚本。若安装时使用了 `--ignore-scripts`,执行以下命令补齐:
16
+
17
+ ```bash
18
+ gd-cli update
19
+ ```
20
+
21
+ ## 开始使用
22
+
23
+ ```bash
24
+ gd-cli auth login
25
+ gd-cli org list
26
+ gd-cli org switch --org <org-id>
27
+
28
+ gd-cli agent send --schema
29
+ gd-cli tool list
30
+ gd-cli model list --tool <tool>
31
+ gd-cli model get <model>
32
+ ```
33
+
34
+ 选定 Model 后,以 `model get` 返回的 `parameters` 与 `usageDescription` 构造实际输入;其中 `cost` 是当前上架 SKU 的稿豆价格区间,不表示某次调用的实际扣费。`tool call --schema` 只给出整个 Tool 的参数并集。运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。
35
+
36
+ CLI 最多每小时检查一次 npm `latest`,发现新版本后每天最多在 stderr 提醒一次;检查失败不影响原命令,`CI=true` 时跳过。普通启动不会检查或修复 Agent Skill。`gd-cli update` 始终实时检查 `latest`,支持更新 npm、pnpm 全局安装并同步 Agent Skill。
37
+
38
+ 发布切换必须先完成精确版本的安装验收,再执行仓库中的 `scripts/promote-latest.mjs`;不要直接用未校验的 `npm dist-tag add` 移动 `latest`。
39
+
40
+ ## License
41
+
42
+ MIT
@@ -0,0 +1,353 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AgentSendInput",
4
+ "description": "发送给稿定 Agent 的结构化创作消息。",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "message"
9
+ ],
10
+ "properties": {
11
+ "message": {
12
+ "$ref": "#/$defs/UserMessage",
13
+ "description": "本次发送的消息。"
14
+ }
15
+ },
16
+ "$defs": {
17
+ "UserMessage": {
18
+ "type": "object",
19
+ "additionalProperties": false,
20
+ "required": [
21
+ "parts"
22
+ ],
23
+ "properties": {
24
+ "contextId": {
25
+ "type": "string",
26
+ "minLength": 1,
27
+ "pattern": ".*\\S.*",
28
+ "description": "继续已有创作 Context 时使用服务端返回的标识。"
29
+ },
30
+ "parts": {
31
+ "type": "array",
32
+ "minItems": 1,
33
+ "description": "按顺序发送的消息内容。",
34
+ "items": {
35
+ "$ref": "#/$defs/UserPart"
36
+ }
37
+ }
38
+ },
39
+ "allOf": [
40
+ {
41
+ "properties": {
42
+ "parts": {
43
+ "type": "array",
44
+ "contains": {
45
+ "anyOf": [
46
+ {
47
+ "$ref": "#/$defs/TextPart"
48
+ },
49
+ {
50
+ "$ref": "#/$defs/QuestionAnswerPart"
51
+ }
52
+ ]
53
+ },
54
+ "minContains": 1
55
+ }
56
+ }
57
+ },
58
+ {
59
+ "properties": {
60
+ "parts": {
61
+ "type": "array",
62
+ "contains": {
63
+ "$ref": "#/$defs/GenerationConstraintsPart"
64
+ },
65
+ "minContains": 0,
66
+ "maxContains": 1
67
+ }
68
+ }
69
+ },
70
+ {
71
+ "properties": {
72
+ "parts": {
73
+ "type": "array",
74
+ "contains": {
75
+ "$ref": "#/$defs/QuestionAnswerPart"
76
+ },
77
+ "minContains": 0,
78
+ "maxContains": 1
79
+ }
80
+ }
81
+ },
82
+ {
83
+ "properties": {
84
+ "parts": {
85
+ "type": "array",
86
+ "contains": {
87
+ "$ref": "#/$defs/FirstFramePart"
88
+ },
89
+ "minContains": 0,
90
+ "maxContains": 1
91
+ }
92
+ }
93
+ },
94
+ {
95
+ "properties": {
96
+ "parts": {
97
+ "type": "array",
98
+ "contains": {
99
+ "$ref": "#/$defs/LastFramePart"
100
+ },
101
+ "minContains": 0,
102
+ "maxContains": 1
103
+ }
104
+ }
105
+ },
106
+ {
107
+ "if": {
108
+ "properties": {
109
+ "parts": {
110
+ "type": "array",
111
+ "contains": {
112
+ "$ref": "#/$defs/QuestionAnswerPart"
113
+ },
114
+ "minContains": 1
115
+ }
116
+ },
117
+ "required": [
118
+ "parts"
119
+ ]
120
+ },
121
+ "then": {
122
+ "type": "object",
123
+ "properties": {
124
+ "contextId": {
125
+ "type": "string"
126
+ },
127
+ "parts": {
128
+ "type": "array",
129
+ "maxItems": 1
130
+ }
131
+ },
132
+ "required": [
133
+ "contextId"
134
+ ]
135
+ }
136
+ }
137
+ ]
138
+ },
139
+ "UserPart": {
140
+ "oneOf": [
141
+ {
142
+ "$ref": "#/$defs/TextPart"
143
+ },
144
+ {
145
+ "$ref": "#/$defs/InputAssetPart"
146
+ },
147
+ {
148
+ "$ref": "#/$defs/GenerationConstraintsPart"
149
+ },
150
+ {
151
+ "$ref": "#/$defs/QuestionAnswerPart"
152
+ }
153
+ ]
154
+ },
155
+ "TextPart": {
156
+ "type": "object",
157
+ "additionalProperties": false,
158
+ "required": [
159
+ "text"
160
+ ],
161
+ "properties": {
162
+ "text": {
163
+ "type": "string",
164
+ "minLength": 1,
165
+ "pattern": ".*\\S.*",
166
+ "description": "创作要求或补充说明。"
167
+ }
168
+ }
169
+ },
170
+ "InputAssetPart": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "required": [
174
+ "url"
175
+ ],
176
+ "properties": {
177
+ "url": {
178
+ "type": "string",
179
+ "format": "uri",
180
+ "minLength": 1,
181
+ "pattern": ".*\\S.*",
182
+ "description": "HTTP(S) 素材或由 CLI 处理的 file:// 本地文件。"
183
+ },
184
+ "mediaType": {
185
+ "type": "string",
186
+ "minLength": 1,
187
+ "pattern": ".*\\S.*",
188
+ "description": "素材 MIME type;无法从 URL 判断时使用。"
189
+ },
190
+ "filename": {
191
+ "type": "string",
192
+ "minLength": 1,
193
+ "pattern": ".*\\S.*",
194
+ "description": "素材文件名;无法从 URL 判断时使用。"
195
+ },
196
+ "metadata": {
197
+ "type": "object",
198
+ "additionalProperties": false,
199
+ "description": "素材在本次创作中的用途。",
200
+ "properties": {
201
+ "role": {
202
+ "type": "string",
203
+ "enum": [
204
+ "reference",
205
+ "first_frame",
206
+ "last_frame"
207
+ ],
208
+ "description": "素材角色;省略时按 reference 处理。"
209
+ }
210
+ }
211
+ }
212
+ }
213
+ },
214
+ "GenerationConstraintsPart": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "required": [
218
+ "data"
219
+ ],
220
+ "properties": {
221
+ "data": {
222
+ "type": "object",
223
+ "additionalProperties": false,
224
+ "minProperties": 1,
225
+ "description": "本次创作指定的模型与动态参数;它们不决定 Agent 或 Tool 路由。",
226
+ "properties": {
227
+ "model": {
228
+ "type": "string",
229
+ "minLength": 1,
230
+ "pattern": ".*\\S.*",
231
+ "description": "可选创作模型机器标识;指定时由 CLI 根据实时 Model Catalog 校验。"
232
+ },
233
+ "arguments": {
234
+ "type": "object",
235
+ "minProperties": 1,
236
+ "description": "按模型公开字段传递的动态控制参数;素材使用独立 InputAssetPart。",
237
+ "additionalProperties": true
238
+ }
239
+ }
240
+ }
241
+ }
242
+ },
243
+ "QuestionAnswerPart": {
244
+ "type": "object",
245
+ "additionalProperties": false,
246
+ "required": [
247
+ "data"
248
+ ],
249
+ "properties": {
250
+ "data": {
251
+ "type": "object",
252
+ "additionalProperties": false,
253
+ "required": [
254
+ "questionMessageId",
255
+ "answers"
256
+ ],
257
+ "description": "对上一轮 Agent 追问的回答。",
258
+ "properties": {
259
+ "questionMessageId": {
260
+ "type": "string",
261
+ "minLength": 1,
262
+ "pattern": ".*\\S.*",
263
+ "description": "上一轮追问消息的标识。"
264
+ },
265
+ "answers": {
266
+ "type": "array",
267
+ "minItems": 1,
268
+ "description": "按问题原文给出的回答。",
269
+ "items": {
270
+ "type": "object",
271
+ "additionalProperties": false,
272
+ "required": [
273
+ "question",
274
+ "values"
275
+ ],
276
+ "properties": {
277
+ "question": {
278
+ "type": "string",
279
+ "minLength": 1,
280
+ "pattern": ".*\\S.*",
281
+ "description": "上一轮返回的问题原文。"
282
+ },
283
+ "values": {
284
+ "type": "array",
285
+ "minItems": 1,
286
+ "description": "该问题的一项或多项回答。",
287
+ "items": {
288
+ "type": "string",
289
+ "minLength": 1,
290
+ "pattern": ".*\\S.*"
291
+ }
292
+ }
293
+ }
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ },
300
+ "FirstFramePart": {
301
+ "allOf": [
302
+ {
303
+ "$ref": "#/$defs/InputAssetPart"
304
+ },
305
+ {
306
+ "type": "object",
307
+ "properties": {
308
+ "metadata": {
309
+ "type": "object",
310
+ "properties": {
311
+ "role": {
312
+ "const": "first_frame"
313
+ }
314
+ },
315
+ "required": [
316
+ "role"
317
+ ]
318
+ }
319
+ },
320
+ "required": [
321
+ "metadata"
322
+ ]
323
+ }
324
+ ]
325
+ },
326
+ "LastFramePart": {
327
+ "allOf": [
328
+ {
329
+ "$ref": "#/$defs/InputAssetPart"
330
+ },
331
+ {
332
+ "type": "object",
333
+ "properties": {
334
+ "metadata": {
335
+ "type": "object",
336
+ "properties": {
337
+ "role": {
338
+ "const": "last_frame"
339
+ }
340
+ },
341
+ "required": [
342
+ "role"
343
+ ]
344
+ }
345
+ },
346
+ "required": [
347
+ "metadata"
348
+ ]
349
+ }
350
+ ]
351
+ }
352
+ }
353
+ }
@@ -0,0 +1,271 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "AgentSendOutput",
4
+ "description": "稿定 Agent 同步返回的最终消息与实际稿豆消耗。",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "message",
9
+ "usage"
10
+ ],
11
+ "properties": {
12
+ "message": {
13
+ "$ref": "#/$defs/AgentMessage",
14
+ "description": "本次调用返回的最终 Agent 消息。"
15
+ },
16
+ "usage": {
17
+ "$ref": "#/$defs/AgentUsage",
18
+ "description": "本次调用由最终消息结算的实际稿豆消耗。"
19
+ }
20
+ },
21
+ "$defs": {
22
+ "ActualCost": {
23
+ "type": "object",
24
+ "additionalProperties": false,
25
+ "required": [
26
+ "unit",
27
+ "amount"
28
+ ],
29
+ "properties": {
30
+ "unit": {
31
+ "const": "gaodou",
32
+ "description": "稿豆计价单位。"
33
+ },
34
+ "amount": {
35
+ "type": "number",
36
+ "minimum": 0,
37
+ "description": "实际消耗的稿豆数量。"
38
+ }
39
+ }
40
+ },
41
+ "AgentUsage": {
42
+ "type": "object",
43
+ "additionalProperties": false,
44
+ "required": [
45
+ "cost",
46
+ "items"
47
+ ],
48
+ "properties": {
49
+ "cost": {
50
+ "$ref": "#/$defs/ActualCost",
51
+ "description": "本次 Agent 调用的实际总消耗。"
52
+ },
53
+ "items": {
54
+ "type": "array",
55
+ "description": "产生实际消耗的模型调用明细。",
56
+ "items": {
57
+ "type": "object",
58
+ "additionalProperties": false,
59
+ "required": [
60
+ "model",
61
+ "cost"
62
+ ],
63
+ "properties": {
64
+ "model": {
65
+ "type": "string",
66
+ "minLength": 1,
67
+ "pattern": ".*\\S.*",
68
+ "description": "实际调用的模型机器标识。"
69
+ },
70
+ "cost": {
71
+ "$ref": "#/$defs/ActualCost",
72
+ "description": "该次模型调用的实际稿豆消耗。"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ },
79
+ "AgentMessage": {
80
+ "type": "object",
81
+ "additionalProperties": false,
82
+ "required": [
83
+ "contextId",
84
+ "parts"
85
+ ],
86
+ "properties": {
87
+ "messageId": {
88
+ "type": "string",
89
+ "minLength": 1,
90
+ "pattern": ".*\\S.*",
91
+ "description": "存在追问时返回的真实追问消息标识。"
92
+ },
93
+ "contextId": {
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "pattern": ".*\\S.*",
97
+ "description": "后续继续创作时使用的 Context 标识。"
98
+ },
99
+ "parts": {
100
+ "type": "array",
101
+ "minItems": 1,
102
+ "description": "最终文本、素材或有效追问。",
103
+ "items": {
104
+ "$ref": "#/$defs/AgentPart"
105
+ }
106
+ }
107
+ },
108
+ "allOf": [
109
+ {
110
+ "if": {
111
+ "properties": {
112
+ "parts": {
113
+ "type": "array",
114
+ "contains": {
115
+ "$ref": "#/$defs/QuestionPart"
116
+ },
117
+ "minContains": 1
118
+ }
119
+ },
120
+ "required": [
121
+ "parts"
122
+ ]
123
+ },
124
+ "then": {
125
+ "type": "object",
126
+ "properties": {
127
+ "messageId": {
128
+ "type": "string"
129
+ }
130
+ },
131
+ "required": [
132
+ "messageId"
133
+ ]
134
+ },
135
+ "else": {
136
+ "properties": {
137
+ "messageId": false
138
+ }
139
+ }
140
+ }
141
+ ]
142
+ },
143
+ "AgentPart": {
144
+ "oneOf": [
145
+ {
146
+ "$ref": "#/$defs/TextPart"
147
+ },
148
+ {
149
+ "$ref": "#/$defs/OutputAssetPart"
150
+ },
151
+ {
152
+ "$ref": "#/$defs/QuestionPart"
153
+ }
154
+ ]
155
+ },
156
+ "TextPart": {
157
+ "type": "object",
158
+ "additionalProperties": false,
159
+ "required": [
160
+ "text"
161
+ ],
162
+ "properties": {
163
+ "text": {
164
+ "type": "string",
165
+ "minLength": 1,
166
+ "pattern": ".*\\S.*",
167
+ "description": "Agent 返回的最终文本。"
168
+ }
169
+ }
170
+ },
171
+ "OutputAssetPart": {
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "required": [
175
+ "url",
176
+ "mediaType"
177
+ ],
178
+ "properties": {
179
+ "url": {
180
+ "type": "string",
181
+ "format": "uri",
182
+ "minLength": 1,
183
+ "pattern": ".*\\S.*",
184
+ "description": "生成素材的访问 URL。"
185
+ },
186
+ "mediaType": {
187
+ "type": "string",
188
+ "minLength": 1,
189
+ "pattern": ".*\\S.*",
190
+ "description": "生成素材的 MIME type。"
191
+ },
192
+ "filename": {
193
+ "type": "string",
194
+ "minLength": 1,
195
+ "pattern": ".*\\S.*",
196
+ "description": "生成素材的文件名。"
197
+ }
198
+ }
199
+ },
200
+ "QuestionPart": {
201
+ "type": "object",
202
+ "additionalProperties": false,
203
+ "required": [
204
+ "data"
205
+ ],
206
+ "properties": {
207
+ "data": {
208
+ "type": "object",
209
+ "additionalProperties": false,
210
+ "required": [
211
+ "questions"
212
+ ],
213
+ "description": "Agent 要求调用者补充的信息。",
214
+ "properties": {
215
+ "title": {
216
+ "type": "string",
217
+ "minLength": 1,
218
+ "pattern": ".*\\S.*",
219
+ "description": "本轮问题组标题。"
220
+ },
221
+ "questions": {
222
+ "type": "array",
223
+ "minItems": 1,
224
+ "description": "Agent 返回的一项或多项问题。",
225
+ "items": {
226
+ "type": "object",
227
+ "additionalProperties": false,
228
+ "required": [
229
+ "question",
230
+ "options",
231
+ "allowMultiple"
232
+ ],
233
+ "properties": {
234
+ "question": {
235
+ "type": "string",
236
+ "minLength": 1,
237
+ "pattern": ".*\\S.*",
238
+ "description": "需要调用者回答的问题原文。"
239
+ },
240
+ "options": {
241
+ "type": "array",
242
+ "description": "可选答案;空数组表示允许自由回答。",
243
+ "items": {
244
+ "type": "object",
245
+ "additionalProperties": false,
246
+ "required": [
247
+ "label"
248
+ ],
249
+ "properties": {
250
+ "label": {
251
+ "type": "string",
252
+ "minLength": 1,
253
+ "pattern": ".*\\S.*",
254
+ "description": "一个可选答案的展示文本。"
255
+ }
256
+ }
257
+ }
258
+ },
259
+ "allowMultiple": {
260
+ "type": "boolean",
261
+ "description": "是否允许同时选择多个答案。"
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.gaoding.com/operations/auth.status/input.schema.json",
4
+ "title": "AuthStatusInput",
5
+ "type": "object",
6
+ "additionalProperties": false
7
+ }