@gaoding/cli 2.1.8 → 3.0.0

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 (61) hide show
  1. package/README.md +6 -3
  2. package/contracts/operations/tool.call/canvas-input.schema.json +0 -3
  3. package/contracts/presentations/agent.send.schema.json +303 -0
  4. package/contracts/presentations/model.get.schema.json +246 -0
  5. package/contracts/presentations/model.list.schema.json +144 -0
  6. package/contracts/presentations/task.get.schema.json +146 -0
  7. package/contracts/presentations/tool.call.schema.json +200 -0
  8. package/dist/bin/gd-cli.js +9 -3
  9. package/dist/bin/insmind-cli.js +6 -1
  10. package/dist/src/bootstrap/create-cli.js +7 -4
  11. package/dist/src/bootstrap/create-runtime.js +7 -32
  12. package/dist/src/cli/action-binding.js +2 -2
  13. package/dist/src/cli/agent-commands.js +5 -4
  14. package/dist/src/cli/auth-commands.js +1 -1
  15. package/dist/src/cli/dam-commands.js +18 -10
  16. package/dist/src/cli/errors.js +1 -35
  17. package/dist/src/cli/host-input.js +0 -11
  18. package/dist/src/cli/model-commands.js +6 -5
  19. package/dist/src/cli/skill-output.js +13 -0
  20. package/dist/src/cli/tool-commands.js +9 -5
  21. package/dist/src/features/skill/catalog.js +152 -0
  22. package/dist/src/features/skill/manual.js +71 -0
  23. package/dist/src/features/tool/archived-ocr-result.js +74 -0
  24. package/dist/src/features/tool/canvas-copy.js +2 -3
  25. package/dist/src/features/tool/canvas-models.js +2 -4
  26. package/dist/src/features/tool/canvas-recovery.js +3 -2
  27. package/dist/src/features/tool/canvas-results.js +1 -55
  28. package/dist/src/features/tool/canvas-tool-adapter.js +7 -10
  29. package/dist/src/features/tool/resource-authorizer.js +1 -1
  30. package/dist/src/features/tool/scene-catalog-adapter.js +20 -22
  31. package/dist/src/features/tool/tool-definitions.js +0 -1
  32. package/dist/src/product/config.js +0 -7
  33. package/dist/src/telemetry/command-routes.json +1 -1
  34. package/package.json +4 -4
  35. package/skills/gd-cli/SKILL.md +10 -29
  36. package/contracts/operations/editor.apply/input.schema.json +0 -134
  37. package/contracts/operations/editor.apply/output.schema.json +0 -15
  38. package/contracts/operations/editor.connect/input.schema.json +0 -15
  39. package/contracts/operations/editor.connect/output.schema.json +0 -17
  40. package/contracts/operations/editor.disconnect/input.schema.json +0 -8
  41. package/contracts/operations/editor.disconnect/output.schema.json +0 -14
  42. package/contracts/operations/editor.save/input.schema.json +0 -8
  43. package/contracts/operations/editor.save/output.schema.json +0 -23
  44. package/contracts/operations/editor.screenshot/input.schema.json +0 -8
  45. package/contracts/operations/editor.screenshot/output.schema.json +0 -16
  46. package/contracts/operations/editor.snapshot/input.schema.json +0 -8
  47. package/contracts/operations/editor.snapshot/output.schema.json +0 -113
  48. package/contracts/operations/tool.call/models/image-ocr.schema.json +0 -22
  49. package/contracts/operations/tool.call/ocr-payload.schema.json +0 -65
  50. package/dist/src/cli/editor-commands.js +0 -136
  51. package/skills/gd-cli/references/agent.md +0 -39
  52. package/skills/gd-cli/references/auth-org.md +0 -11
  53. package/skills/gd-cli/references/creation.md +0 -61
  54. package/skills/gd-cli/references/dam.md +0 -53
  55. package/skills/gd-cli/references/editor.md +0 -67
  56. package/skills/gd-cli/references/errors.md +0 -46
  57. package/skills/gd-cli/references/generation-constraints.md +0 -40
  58. package/skills/gd-cli/references/matting.md +0 -27
  59. package/skills/gd-cli/references/media-tools.md +0 -46
  60. package/skills/gd-cli/references/tool.md +0 -24
  61. package/skills/gd-cli/references/update.md +0 -22
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # GaoDing CLI
2
2
 
3
- 稿定面向 Agent 与人的命令行产品,提供 Agent 创作、Tool/Model 调用、AI+ Editor 操作和 DAM 素材管理。
3
+ 稿定面向 Agent 与人的命令行产品,提供 Agent 创作、Tool/Model 调用和 DAM 素材管理。
4
+
5
+ 3.0 起移除 `editor` 命令组和 `image.ocr` 工具。已有 OCR 结果可用 `gd-cli task get <id>` 取回。图片改字使用 `image.text_edit`。
4
6
 
5
7
  ## 安装
6
8
 
@@ -50,6 +52,8 @@ node (Join-Path (Split-Path $target) "sync-skill.js")
50
52
 
51
53
  ## 开始使用
52
54
 
55
+ 运行 `gd-cli --skill` 查看基础用法和远程目录,`gd-cli --skill --help` 只列目录。用 `gd-cli --skill <章节>` 读取选中的一篇。目录和已读正文分别缓存一小时,过期时按 ETag 刷新,断网时可使用已有副本。按工具查模型、查模型详情或提交创作时,结果 JSON 默认用 `relatedSkills` 列出匹配的指引和读取命令。脚本若按原业务 Schema 校验,显式传 `--json`。同时传 `--json --with-skills` 会包含匹配的推荐。默认结果和原业务结果的 Schema 分别随包放在 `contracts/presentations/` 和 `contracts/operations/`。模型参数和价格从实时模型目录查询。
56
+
53
57
  ```bash
54
58
  gd-cli auth login
55
59
  gd-cli org list
@@ -59,13 +63,12 @@ gd-cli agent send --schema
59
63
  gd-cli tool list
60
64
  gd-cli model list --tool <tool>
61
65
  gd-cli model get <model>
62
- gd-cli editor apply --schema
63
66
  gd-cli credits --json
64
67
  gd-cli credits usage list --help
65
68
  gd-cli credits usage get --schema
66
69
  ```
67
70
 
68
- 选定 Model 后,以 `model get` 返回的 `parameters` 与 `usageDescription` 构造实际输入;其中 `cost` 是当前上架 SKU 的稿豆价格区间,不表示某次调用的实际扣费。`tool call <tool> --schema` 只给出整个 Tool 的参数并集。运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。`editor apply --schema` 无需登录或连接编辑器,输出当前版本的 Action 输入契约;与执行模式 `--input` 互斥。
71
+ 选定 Model 后,以 `model get` 返回的 `parameters` 与 `usageDescription` 构造实际输入;其中 `cost` 是当前上架 SKU 的稿豆价格区间,不表示某次调用的实际扣费。`tool call <tool> --schema` 只给出整个 Tool 的参数并集。运行 `gd-cli --help` 查看当前命令;运行任一命令的 `--help` 查看参数。
69
72
 
70
73
  CLI 最多每小时检查一次 npm `latest`,发现新版本后每天最多在 stderr 提醒一次;检查失败不影响原命令,`CI=true` 时跳过。普通启动不会检查或修复 Agent Skill。`gd-cli update` 始终实时检查 `latest`,支持更新 npm、pnpm 全局安装并同步 Agent Skill。
71
74
 
@@ -35,9 +35,6 @@
35
35
  {
36
36
  "$ref": "models/image-text-edit.schema.json"
37
37
  },
38
- {
39
- "$ref": "models/image-ocr.schema.json"
40
- },
41
38
  {
42
39
  "$ref": "models/image-layers-layout.schema.json"
43
40
  },
@@ -0,0 +1,303 @@
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": "本轮已完成的回复;读取 parts 后决定交付实际资源、转述文本或向用户提问。"
15
+ },
16
+ "usage": {
17
+ "$ref": "#/$defs/AgentUsage",
18
+ "description": "本轮服务已确认的实扣合计;若命令提示计费记录不完整,此数仅是已知部分,请以对应账单为准。"
19
+ },
20
+ "relatedSkills": {
21
+ "type": "array",
22
+ "minItems": 1,
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": false,
26
+ "required": [
27
+ "id",
28
+ "title",
29
+ "description",
30
+ "command"
31
+ ],
32
+ "properties": {
33
+ "id": {
34
+ "type": "string",
35
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
36
+ },
37
+ "title": {
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "description": {
42
+ "type": "string",
43
+ "minLength": 1
44
+ },
45
+ "command": {
46
+ "type": "string",
47
+ "pattern": "^gd-cli --skill [a-z][a-z0-9-]{0,63}$"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ },
53
+ "$defs": {
54
+ "ActualCost": {
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "required": [
58
+ "unit",
59
+ "amount"
60
+ ],
61
+ "properties": {
62
+ "unit": {
63
+ "const": "gaodou",
64
+ "description": "稿豆计价单位。"
65
+ },
66
+ "amount": {
67
+ "type": "number",
68
+ "minimum": 0,
69
+ "description": "实际消耗的稿豆数量。"
70
+ }
71
+ }
72
+ },
73
+ "AgentUsage": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "required": [
77
+ "cost",
78
+ "items"
79
+ ],
80
+ "properties": {
81
+ "cost": {
82
+ "$ref": "#/$defs/ActualCost",
83
+ "description": "本轮有有效实扣记录的金额合计;若命令提示计费不完整,以账单为准,不能据此推断免费。"
84
+ },
85
+ "items": {
86
+ "type": "array",
87
+ "description": "服务端同时确认费用和模型标识的调用明细;缺少模型标识的实际费用仍计入总额。",
88
+ "items": {
89
+ "type": "object",
90
+ "additionalProperties": false,
91
+ "required": [
92
+ "model",
93
+ "cost"
94
+ ],
95
+ "properties": {
96
+ "model": {
97
+ "type": "string",
98
+ "minLength": 1,
99
+ "pattern": ".*\\S.*",
100
+ "description": "实际调用的模型机器标识。"
101
+ },
102
+ "cost": {
103
+ "$ref": "#/$defs/ActualCost",
104
+ "description": "该次模型调用的实际稿豆消耗。"
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+ },
111
+ "AgentMessage": {
112
+ "type": "object",
113
+ "additionalProperties": false,
114
+ "required": [
115
+ "contextId",
116
+ "parts"
117
+ ],
118
+ "properties": {
119
+ "messageId": {
120
+ "type": "string",
121
+ "minLength": 1,
122
+ "pattern": ".*\\S.*",
123
+ "description": "存在追问时返回的真实追问消息标识。"
124
+ },
125
+ "contextId": {
126
+ "type": "string",
127
+ "minLength": 1,
128
+ "pattern": ".*\\S.*",
129
+ "description": "后续继续创作时使用的 Context 标识。"
130
+ },
131
+ "parts": {
132
+ "type": "array",
133
+ "minItems": 1,
134
+ "description": "本轮文本、资源或有效问题;按实际内容交付,不能把计划或确认文本说成图片/视频已生成。续聊沿用 contextId,结构化答复使用 messageId。",
135
+ "items": {
136
+ "$ref": "#/$defs/AgentPart"
137
+ }
138
+ }
139
+ },
140
+ "allOf": [
141
+ {
142
+ "if": {
143
+ "properties": {
144
+ "parts": {
145
+ "type": "array",
146
+ "contains": {
147
+ "$ref": "#/$defs/QuestionPart"
148
+ },
149
+ "minContains": 1
150
+ }
151
+ },
152
+ "required": [
153
+ "parts"
154
+ ]
155
+ },
156
+ "then": {
157
+ "type": "object",
158
+ "properties": {
159
+ "messageId": {
160
+ "type": "string"
161
+ }
162
+ },
163
+ "required": [
164
+ "messageId"
165
+ ]
166
+ },
167
+ "else": {
168
+ "properties": {
169
+ "messageId": false
170
+ }
171
+ }
172
+ }
173
+ ]
174
+ },
175
+ "AgentPart": {
176
+ "oneOf": [
177
+ {
178
+ "$ref": "#/$defs/TextPart"
179
+ },
180
+ {
181
+ "$ref": "#/$defs/OutputAssetPart"
182
+ },
183
+ {
184
+ "$ref": "#/$defs/QuestionPart"
185
+ }
186
+ ]
187
+ },
188
+ "TextPart": {
189
+ "type": "object",
190
+ "additionalProperties": false,
191
+ "required": [
192
+ "text"
193
+ ],
194
+ "properties": {
195
+ "text": {
196
+ "type": "string",
197
+ "minLength": 1,
198
+ "pattern": ".*\\S.*",
199
+ "description": "Agent 返回的最终文本。"
200
+ }
201
+ }
202
+ },
203
+ "OutputAssetPart": {
204
+ "type": "object",
205
+ "additionalProperties": false,
206
+ "required": [
207
+ "url",
208
+ "mediaType"
209
+ ],
210
+ "properties": {
211
+ "url": {
212
+ "type": "string",
213
+ "format": "uri",
214
+ "minLength": 1,
215
+ "pattern": ".*\\S.*",
216
+ "description": "生成素材的完整访问 URL。交付时原样保留查询参数,不截断、拼接或按诊断日志脱敏规则删除授权参数。"
217
+ },
218
+ "mediaType": {
219
+ "type": "string",
220
+ "minLength": 1,
221
+ "pattern": ".*\\S.*",
222
+ "description": "生成素材的 MIME type。"
223
+ },
224
+ "filename": {
225
+ "type": "string",
226
+ "minLength": 1,
227
+ "pattern": ".*\\S.*",
228
+ "description": "生成素材的文件名。"
229
+ }
230
+ }
231
+ },
232
+ "QuestionPart": {
233
+ "type": "object",
234
+ "additionalProperties": false,
235
+ "required": [
236
+ "data"
237
+ ],
238
+ "properties": {
239
+ "data": {
240
+ "type": "object",
241
+ "additionalProperties": false,
242
+ "required": [
243
+ "questions"
244
+ ],
245
+ "description": "Agent 要求调用者补充的信息。",
246
+ "properties": {
247
+ "title": {
248
+ "type": "string",
249
+ "minLength": 1,
250
+ "pattern": ".*\\S.*",
251
+ "description": "本轮问题组标题。"
252
+ },
253
+ "questions": {
254
+ "type": "array",
255
+ "minItems": 1,
256
+ "description": "Agent 返回的一项或多项问题。",
257
+ "items": {
258
+ "type": "object",
259
+ "additionalProperties": false,
260
+ "required": [
261
+ "question",
262
+ "options",
263
+ "allowMultiple"
264
+ ],
265
+ "properties": {
266
+ "question": {
267
+ "type": "string",
268
+ "minLength": 1,
269
+ "pattern": ".*\\S.*",
270
+ "description": "需要调用者回答的问题原文。"
271
+ },
272
+ "options": {
273
+ "type": "array",
274
+ "description": "可选答案;空数组表示允许自由回答。",
275
+ "items": {
276
+ "type": "object",
277
+ "additionalProperties": false,
278
+ "required": [
279
+ "label"
280
+ ],
281
+ "properties": {
282
+ "label": {
283
+ "type": "string",
284
+ "minLength": 1,
285
+ "pattern": ".*\\S.*",
286
+ "description": "一个可选答案的展示文本。"
287
+ }
288
+ }
289
+ }
290
+ },
291
+ "allowMultiple": {
292
+ "type": "boolean",
293
+ "description": "是否允许同时选择多个答案。"
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ }
300
+ }
301
+ }
302
+ }
303
+ }
@@ -0,0 +1,246 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "ModelDetail",
4
+ "description": "一个创作模型的完整产品信息。",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "tool",
9
+ "model",
10
+ "title",
11
+ "parameters"
12
+ ],
13
+ "properties": {
14
+ "tool": {
15
+ "$ref": "#/$defs/NonBlankString",
16
+ "description": "模型所属的产品创作工具。"
17
+ },
18
+ "model": {
19
+ "$ref": "#/$defs/NonBlankString",
20
+ "description": "调用模型时使用的机器标识。"
21
+ },
22
+ "title": {
23
+ "$ref": "#/$defs/NonBlankString",
24
+ "description": "模型的展示名称。"
25
+ },
26
+ "description": {
27
+ "$ref": "#/$defs/NonBlankString",
28
+ "description": "模型的用途说明。"
29
+ },
30
+ "usageDescription": {
31
+ "$ref": "#/$defs/NonBlankString",
32
+ "description": "模型的使用说明。"
33
+ },
34
+ "outputMediaTypes": {
35
+ "type": "array",
36
+ "description": "模型支持的输出 MIME type。",
37
+ "items": {
38
+ "$ref": "#/$defs/NonBlankString"
39
+ }
40
+ },
41
+ "parameters": {
42
+ "type": "array",
43
+ "description": "当前模型允许调用者提供的公开参数。",
44
+ "items": {
45
+ "$ref": "#/$defs/ModelParameter"
46
+ }
47
+ },
48
+ "cost": {
49
+ "$ref": "#/$defs/CostRange",
50
+ "description": "当前配置的目录预估价格区间,不表示实际扣费;计量模型的公式见 usageDescription。"
51
+ },
52
+ "estimatedTime": {
53
+ "$ref": "#/$defs/EstimatedTimeRange",
54
+ "description": "模型当前可用配置的预估耗时区间。"
55
+ },
56
+ "inputSchema": {
57
+ "type": "object",
58
+ "description": "当前 Tool/Model 的完整公开输入 Schema,指导字段、类型、媒体角色和取值;CLI 仅检查自身构造请求所必需的条件,业务接受性由执行服务判断。",
59
+ "additionalProperties": true
60
+ },
61
+ "relatedSkills": {
62
+ "type": "array",
63
+ "minItems": 1,
64
+ "items": {
65
+ "type": "object",
66
+ "additionalProperties": false,
67
+ "required": [
68
+ "id",
69
+ "title",
70
+ "description",
71
+ "command"
72
+ ],
73
+ "properties": {
74
+ "id": {
75
+ "type": "string",
76
+ "pattern": "^[a-z][a-z0-9-]{0,63}$"
77
+ },
78
+ "title": {
79
+ "type": "string",
80
+ "minLength": 1
81
+ },
82
+ "description": {
83
+ "type": "string",
84
+ "minLength": 1
85
+ },
86
+ "command": {
87
+ "type": "string",
88
+ "pattern": "^gd-cli --skill [a-z][a-z0-9-]{0,63}$"
89
+ }
90
+ }
91
+ }
92
+ }
93
+ },
94
+ "$defs": {
95
+ "NonBlankString": {
96
+ "type": "string",
97
+ "minLength": 1,
98
+ "pattern": ".*\\S.*"
99
+ },
100
+ "CostRange": {
101
+ "type": "object",
102
+ "additionalProperties": false,
103
+ "required": [
104
+ "unit",
105
+ "minimum",
106
+ "maximum"
107
+ ],
108
+ "properties": {
109
+ "unit": {
110
+ "const": "gaodou",
111
+ "description": "稿豆计价单位。"
112
+ },
113
+ "minimum": {
114
+ "type": "number",
115
+ "minimum": 0,
116
+ "description": "目录预估价格区间的下限。"
117
+ },
118
+ "maximum": {
119
+ "type": "number",
120
+ "minimum": 0,
121
+ "description": "目录预估价格区间的上限。"
122
+ }
123
+ },
124
+ "description": "Model Catalog 目录估价,不是实际扣费;minimum 与 maximum 相等也仍是估价。"
125
+ },
126
+ "EstimatedTimeRange": {
127
+ "type": "object",
128
+ "additionalProperties": false,
129
+ "required": [
130
+ "unit",
131
+ "minimum",
132
+ "maximum"
133
+ ],
134
+ "properties": {
135
+ "unit": {
136
+ "const": "second",
137
+ "description": "秒级耗时单位。"
138
+ },
139
+ "minimum": {
140
+ "type": "number",
141
+ "minimum": 0,
142
+ "description": "当前可用配置中的最短预估耗时。"
143
+ },
144
+ "maximum": {
145
+ "type": "number",
146
+ "minimum": 0,
147
+ "description": "当前可用配置中的最长预估耗时。"
148
+ }
149
+ }
150
+ },
151
+ "ModelParameter": {
152
+ "type": "object",
153
+ "additionalProperties": false,
154
+ "required": [
155
+ "name",
156
+ "type",
157
+ "required"
158
+ ],
159
+ "properties": {
160
+ "name": {
161
+ "$ref": "#/$defs/NonBlankString",
162
+ "description": "调用模型时使用的参数名。"
163
+ },
164
+ "type": {
165
+ "type": "string",
166
+ "enum": [
167
+ "string",
168
+ "number",
169
+ "uri",
170
+ "uri[]",
171
+ "integer",
172
+ "boolean",
173
+ "object",
174
+ "array"
175
+ ],
176
+ "description": "规范化后的参数类型。"
177
+ },
178
+ "required": {
179
+ "type": "boolean",
180
+ "description": "调用当前模型时是否必须提供该参数。"
181
+ },
182
+ "description": {
183
+ "$ref": "#/$defs/NonBlankString",
184
+ "description": "参数的用途说明。"
185
+ },
186
+ "minimum": {
187
+ "type": "number",
188
+ "description": "数值参数允许的最小值(包含);滑块参数的约束。"
189
+ },
190
+ "maximum": {
191
+ "type": "number",
192
+ "description": "数值参数允许的最大值(包含);滑块参数的约束。"
193
+ },
194
+ "step": {
195
+ "type": "number",
196
+ "exclusiveMinimum": 0,
197
+ "description": "滑块参数相邻允许值之间的正数步长,从 minimum 起算。"
198
+ },
199
+ "default": {
200
+ "anyOf": [
201
+ {
202
+ "type": "string"
203
+ },
204
+ {
205
+ "type": "number"
206
+ },
207
+ {
208
+ "type": "boolean"
209
+ },
210
+ {
211
+ "type": "object"
212
+ },
213
+ {
214
+ "type": "array"
215
+ },
216
+ {
217
+ "type": "null"
218
+ }
219
+ ],
220
+ "description": "服务端声明的默认值。"
221
+ },
222
+ "options": {
223
+ "type": "array",
224
+ "description": "选择型参数当前允许的值。",
225
+ "items": {
226
+ "type": "object",
227
+ "additionalProperties": false,
228
+ "required": [
229
+ "value"
230
+ ],
231
+ "properties": {
232
+ "value": {
233
+ "$ref": "#/$defs/NonBlankString",
234
+ "description": "调用时提供的选项值。"
235
+ },
236
+ "label": {
237
+ "$ref": "#/$defs/NonBlankString",
238
+ "description": "选项的展示名称。"
239
+ }
240
+ }
241
+ }
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }