gaoding-cli 1.0.0-alpha.10
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/LICENSE +21 -0
- package/README.md +38 -0
- package/contracts/operations/agent.send/input.schema.json +354 -0
- package/contracts/operations/agent.send/output.schema.json +271 -0
- package/contracts/operations/auth.status/input.schema.json +7 -0
- package/contracts/operations/auth.status/output.schema.json +132 -0
- package/contracts/operations/dam.delete/input.schema.json +23 -0
- package/contracts/operations/dam.delete/output.schema.json +6 -0
- package/contracts/operations/dam.get/input.schema.json +16 -0
- package/contracts/operations/dam.get/output.schema.json +46 -0
- package/contracts/operations/dam.list/input.schema.json +44 -0
- package/contracts/operations/dam.list/output.schema.json +71 -0
- package/contracts/operations/dam.search/input.schema.json +46 -0
- package/contracts/operations/dam.search/output.schema.json +71 -0
- package/contracts/operations/dam.upload/input.schema.json +31 -0
- package/contracts/operations/dam.upload/output.schema.json +46 -0
- package/contracts/operations/editor.apply/input.schema.json +134 -0
- package/contracts/operations/editor.apply/output.schema.json +15 -0
- package/contracts/operations/editor.connect/input.schema.json +15 -0
- package/contracts/operations/editor.connect/output.schema.json +17 -0
- package/contracts/operations/editor.disconnect/input.schema.json +8 -0
- package/contracts/operations/editor.disconnect/output.schema.json +14 -0
- package/contracts/operations/editor.save/input.schema.json +8 -0
- package/contracts/operations/editor.save/output.schema.json +23 -0
- package/contracts/operations/editor.screenshot/input.schema.json +8 -0
- package/contracts/operations/editor.screenshot/output.schema.json +16 -0
- package/contracts/operations/editor.snapshot/input.schema.json +8 -0
- package/contracts/operations/editor.snapshot/output.schema.json +113 -0
- package/contracts/operations/model.get/input.schema.json +18 -0
- package/contracts/operations/model.get/output.schema.json +190 -0
- package/contracts/operations/model.list/input.schema.json +15 -0
- package/contracts/operations/model.list/output.schema.json +111 -0
- package/contracts/operations/org.current/input.schema.json +7 -0
- package/contracts/operations/org.current/output.schema.json +49 -0
- package/contracts/operations/org.list/input.schema.json +7 -0
- package/contracts/operations/org.list/output.schema.json +71 -0
- package/contracts/operations/tool.call/input.schema.json +35 -0
- package/contracts/operations/tool.call/output.schema.json +129 -0
- package/contracts/operations/tool.list/input.schema.json +7 -0
- package/contracts/operations/tool.list/output.schema.json +45 -0
- package/dist/bin/gd-cli.js +38 -0
- package/dist/bin/postinstall.js +42 -0
- package/dist/src/bootstrap/create-cli.js +55 -0
- package/dist/src/bootstrap/create-runtime.js +222 -0
- package/dist/src/bootstrap/validators.js +118 -0
- package/dist/src/cli/action-binding.js +63 -0
- package/dist/src/cli/agent-commands.js +39 -0
- package/dist/src/cli/auth-commands.js +47 -0
- package/dist/src/cli/dam-commands.js +207 -0
- package/dist/src/cli/editor-commands.js +73 -0
- package/dist/src/cli/errors.js +90 -0
- package/dist/src/cli/model-commands.js +47 -0
- package/dist/src/cli/org-commands.js +52 -0
- package/dist/src/cli/presenter.js +80 -0
- package/dist/src/cli/prompt.js +30 -0
- package/dist/src/cli/tool-commands.js +65 -0
- package/dist/src/cli/update-command.js +12 -0
- package/dist/src/contracts/schema.js +4 -0
- package/dist/src/features/agent/creative-agent-adapter.js +31 -0
- package/dist/src/features/agent/creative-protocol.js +324 -0
- package/dist/src/features/agent/creative-stream.js +127 -0
- package/dist/src/features/agent/use-cases.js +113 -0
- package/dist/src/features/auth/access-policy.js +101 -0
- package/dist/src/features/auth/credential-store.js +62 -0
- package/dist/src/features/auth/sso-service.js +179 -0
- package/dist/src/features/auth/state.js +129 -0
- package/dist/src/features/auth/use-cases.js +106 -0
- package/dist/src/features/dam/asset-projection.js +270 -0
- package/dist/src/features/dam/dam-api-adapter.js +206 -0
- package/dist/src/features/dam/object-storage.js +191 -0
- package/dist/src/features/dam/registered-uploader.js +224 -0
- package/dist/src/features/dam/storage-upload.js +141 -0
- package/dist/src/features/dam/transient-uploader.js +17 -0
- package/dist/src/features/dam/use-cases.js +151 -0
- package/dist/src/features/editor/bridge-client.js +96 -0
- package/dist/src/features/editor/bridge-process.js +222 -0
- package/dist/src/features/editor/bridge-server.js +311 -0
- package/dist/src/features/editor/protocol.js +1 -0
- package/dist/src/features/editor/session-state.js +78 -0
- package/dist/src/features/editor/session.js +193 -0
- package/dist/src/features/editor/use-cases.js +61 -0
- package/dist/src/features/org/org-service.js +76 -0
- package/dist/src/features/org/use-cases.js +140 -0
- package/dist/src/features/skill/bundled-skills.js +55 -0
- package/dist/src/features/skill/installer.js +265 -0
- package/dist/src/features/tool/catalog.js +79 -0
- package/dist/src/features/tool/dynamic-schema.js +96 -0
- package/dist/src/features/tool/mns-catalog-adapter.js +262 -0
- package/dist/src/features/tool/tool-api-adapter.js +200 -0
- package/dist/src/features/tool/use-cases.js +126 -0
- package/dist/src/features/update/update-service.js +194 -0
- package/dist/src/platform/json-input.js +64 -0
- package/dist/src/platform/local-json-file.js +59 -0
- package/dist/src/platform/open-browser.js +8 -0
- package/dist/src/platform/redact.js +80 -0
- package/dist/src/platform/safe-upload-file.js +146 -0
- package/dist/src/platform/signature.js +19 -0
- package/dist/src/platform/signed-http-transport.js +109 -0
- package/dist/src/platform/url-safety.js +100 -0
- package/package.json +56 -0
- package/skills/gd-cli/SKILL.md +15 -0
- package/skills/gd-cli/references/auth-org.md +9 -0
- package/skills/gd-cli/references/creation.md +38 -0
- package/skills/gd-cli/references/dam.md +20 -0
- package/skills/gd-cli/references/editor.md +12 -0
- package/skills/gd-cli/references/errors.md +10 -0
- package/skills/gd-cli/references/update.md +11 -0
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
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# GD CLI
|
|
2
|
+
|
|
3
|
+
稿定面向 Agent 与人的命令行产品,提供 Agent 创作、Tool/Model 调用、AI+ Editor 操作和 DAM 素材管理。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
需要 Node.js 24 或更高版本。使用 npm 或 pnpm 全局安装:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --global gaoding-cli
|
|
11
|
+
# 或
|
|
12
|
+
pnpm add --global --allow-build=gaoding-cli gaoding-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
全局安装和后续包升级会自动同步随包 `gd-cli` Agent Skill 到 canonical 目录,并连接已检测到的 Agent 宿主。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 tool call <tool> --schema
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。`gd-cli update` 固定检查 npm `latest`,支持更新 npm、pnpm 全局安装并同步 Agent Skill。
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT
|
|
@@ -0,0 +1,354 @@
|
|
|
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/CreativeParametersPart"
|
|
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
|
+
},
|
|
128
|
+
"required": [
|
|
129
|
+
"contextId"
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"UserPart": {
|
|
136
|
+
"oneOf": [
|
|
137
|
+
{
|
|
138
|
+
"$ref": "#/$defs/TextPart"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"$ref": "#/$defs/InputAssetPart"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"$ref": "#/$defs/CreativeParametersPart"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"$ref": "#/$defs/QuestionAnswerPart"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"TextPart": {
|
|
152
|
+
"type": "object",
|
|
153
|
+
"additionalProperties": false,
|
|
154
|
+
"required": [
|
|
155
|
+
"text"
|
|
156
|
+
],
|
|
157
|
+
"properties": {
|
|
158
|
+
"text": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 1,
|
|
161
|
+
"pattern": ".*\\S.*",
|
|
162
|
+
"description": "创作要求或补充说明。"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"InputAssetPart": {
|
|
167
|
+
"type": "object",
|
|
168
|
+
"additionalProperties": false,
|
|
169
|
+
"required": [
|
|
170
|
+
"url"
|
|
171
|
+
],
|
|
172
|
+
"properties": {
|
|
173
|
+
"url": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"format": "uri",
|
|
176
|
+
"minLength": 1,
|
|
177
|
+
"pattern": ".*\\S.*",
|
|
178
|
+
"description": "HTTP(S) 素材或由 CLI 处理的 file:// 本地文件。"
|
|
179
|
+
},
|
|
180
|
+
"mediaType": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"minLength": 1,
|
|
183
|
+
"pattern": ".*\\S.*",
|
|
184
|
+
"description": "素材 MIME type;无法从 URL 判断时使用。"
|
|
185
|
+
},
|
|
186
|
+
"filename": {
|
|
187
|
+
"type": "string",
|
|
188
|
+
"minLength": 1,
|
|
189
|
+
"pattern": ".*\\S.*",
|
|
190
|
+
"description": "素材文件名;无法从 URL 判断时使用。"
|
|
191
|
+
},
|
|
192
|
+
"metadata": {
|
|
193
|
+
"type": "object",
|
|
194
|
+
"additionalProperties": false,
|
|
195
|
+
"description": "素材在本次创作中的用途。",
|
|
196
|
+
"properties": {
|
|
197
|
+
"role": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"enum": [
|
|
200
|
+
"reference",
|
|
201
|
+
"first_frame",
|
|
202
|
+
"last_frame"
|
|
203
|
+
],
|
|
204
|
+
"description": "素材角色;省略时按 reference 处理。"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"CreativeParametersPart": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"additionalProperties": false,
|
|
213
|
+
"required": [
|
|
214
|
+
"data"
|
|
215
|
+
],
|
|
216
|
+
"properties": {
|
|
217
|
+
"data": {
|
|
218
|
+
"type": "object",
|
|
219
|
+
"additionalProperties": false,
|
|
220
|
+
"minProperties": 1,
|
|
221
|
+
"description": "本次创作的可选参数。",
|
|
222
|
+
"properties": {
|
|
223
|
+
"ratio": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"minLength": 1,
|
|
226
|
+
"pattern": ".*\\S.*",
|
|
227
|
+
"description": "输出画面比例,例如 16:9。"
|
|
228
|
+
},
|
|
229
|
+
"resolution": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"minLength": 1,
|
|
232
|
+
"pattern": ".*\\S.*",
|
|
233
|
+
"description": "输出分辨率。"
|
|
234
|
+
},
|
|
235
|
+
"durationSeconds": {
|
|
236
|
+
"type": "integer",
|
|
237
|
+
"minimum": 1,
|
|
238
|
+
"description": "视频或音频时长,单位为秒。"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"QuestionAnswerPart": {
|
|
245
|
+
"type": "object",
|
|
246
|
+
"additionalProperties": false,
|
|
247
|
+
"required": [
|
|
248
|
+
"data"
|
|
249
|
+
],
|
|
250
|
+
"properties": {
|
|
251
|
+
"data": {
|
|
252
|
+
"type": "object",
|
|
253
|
+
"additionalProperties": false,
|
|
254
|
+
"required": [
|
|
255
|
+
"questionMessageId",
|
|
256
|
+
"answers"
|
|
257
|
+
],
|
|
258
|
+
"description": "对上一轮 Agent 追问的回答。",
|
|
259
|
+
"properties": {
|
|
260
|
+
"questionMessageId": {
|
|
261
|
+
"type": "string",
|
|
262
|
+
"minLength": 1,
|
|
263
|
+
"pattern": ".*\\S.*",
|
|
264
|
+
"description": "上一轮追问消息的标识。"
|
|
265
|
+
},
|
|
266
|
+
"answers": {
|
|
267
|
+
"type": "array",
|
|
268
|
+
"minItems": 1,
|
|
269
|
+
"description": "按问题原文给出的回答。",
|
|
270
|
+
"items": {
|
|
271
|
+
"type": "object",
|
|
272
|
+
"additionalProperties": false,
|
|
273
|
+
"required": [
|
|
274
|
+
"question",
|
|
275
|
+
"values"
|
|
276
|
+
],
|
|
277
|
+
"properties": {
|
|
278
|
+
"question": {
|
|
279
|
+
"type": "string",
|
|
280
|
+
"minLength": 1,
|
|
281
|
+
"pattern": ".*\\S.*",
|
|
282
|
+
"description": "上一轮返回的问题原文。"
|
|
283
|
+
},
|
|
284
|
+
"values": {
|
|
285
|
+
"type": "array",
|
|
286
|
+
"minItems": 1,
|
|
287
|
+
"description": "该问题的一项或多项回答。",
|
|
288
|
+
"items": {
|
|
289
|
+
"type": "string",
|
|
290
|
+
"minLength": 1,
|
|
291
|
+
"pattern": ".*\\S.*"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"FirstFramePart": {
|
|
302
|
+
"allOf": [
|
|
303
|
+
{
|
|
304
|
+
"$ref": "#/$defs/InputAssetPart"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"type": "object",
|
|
308
|
+
"properties": {
|
|
309
|
+
"metadata": {
|
|
310
|
+
"type": "object",
|
|
311
|
+
"properties": {
|
|
312
|
+
"role": {
|
|
313
|
+
"const": "first_frame"
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
"required": [
|
|
317
|
+
"role"
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
"required": [
|
|
322
|
+
"metadata"
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
},
|
|
327
|
+
"LastFramePart": {
|
|
328
|
+
"allOf": [
|
|
329
|
+
{
|
|
330
|
+
"$ref": "#/$defs/InputAssetPart"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"type": "object",
|
|
334
|
+
"properties": {
|
|
335
|
+
"metadata": {
|
|
336
|
+
"type": "object",
|
|
337
|
+
"properties": {
|
|
338
|
+
"role": {
|
|
339
|
+
"const": "last_frame"
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
"required": [
|
|
343
|
+
"role"
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"required": [
|
|
348
|
+
"metadata"
|
|
349
|
+
]
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
@@ -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
|
+
}
|