@insmind/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.
- package/README.md +6 -2
- package/contracts/operations/tool.call/canvas-input.schema.json +0 -3
- package/contracts/presentations/agent.send.schema.json +280 -0
- package/contracts/presentations/model.get.schema.json +217 -0
- package/contracts/presentations/model.list.schema.json +129 -0
- package/contracts/presentations/task.get.schema.json +135 -0
- package/contracts/presentations/tool.call.schema.json +185 -0
- package/dist/bin/insmind-cli.js +6 -1
- package/dist/src/bootstrap/create-cli.js +7 -4
- package/dist/src/bootstrap/create-runtime.js +7 -32
- package/dist/src/cli/action-binding.js +2 -2
- package/dist/src/cli/agent-commands.js +5 -4
- package/dist/src/cli/auth-commands.js +1 -1
- package/dist/src/cli/dam-commands.js +18 -10
- package/dist/src/cli/errors.js +1 -35
- package/dist/src/cli/host-input.js +0 -11
- package/dist/src/cli/model-commands.js +6 -5
- package/dist/src/cli/skill-output.js +13 -0
- package/dist/src/cli/tool-commands.js +9 -5
- package/dist/src/features/skill/catalog.js +152 -0
- package/dist/src/features/skill/manual.js +71 -0
- package/dist/src/features/tool/archived-ocr-result.js +74 -0
- package/dist/src/features/tool/canvas-copy.js +2 -3
- package/dist/src/features/tool/canvas-models.js +2 -4
- package/dist/src/features/tool/canvas-recovery.js +3 -2
- package/dist/src/features/tool/canvas-results.js +1 -55
- package/dist/src/features/tool/canvas-tool-adapter.js +7 -10
- package/dist/src/features/tool/resource-authorizer.js +1 -1
- package/dist/src/features/tool/scene-catalog-adapter.js +20 -22
- package/dist/src/features/tool/tool-definitions.js +0 -1
- package/dist/src/product/config.js +0 -7
- package/dist/src/telemetry/command-routes.json +1 -1
- package/package.json +4 -4
- package/skills/insmind-cli/SKILL.md +9 -28
- package/contracts/operations/editor.apply/input.schema.json +0 -177
- package/contracts/operations/editor.apply/output.schema.json +0 -15
- package/contracts/operations/editor.connect/input.schema.json +0 -13
- package/contracts/operations/editor.connect/output.schema.json +0 -17
- package/contracts/operations/editor.disconnect/input.schema.json +0 -7
- package/contracts/operations/editor.disconnect/output.schema.json +0 -14
- package/contracts/operations/editor.save/input.schema.json +0 -7
- package/contracts/operations/editor.save/output.schema.json +0 -23
- package/contracts/operations/editor.screenshot/input.schema.json +0 -7
- package/contracts/operations/editor.screenshot/output.schema.json +0 -16
- package/contracts/operations/editor.snapshot/input.schema.json +0 -7
- package/contracts/operations/editor.snapshot/output.schema.json +0 -148
- package/contracts/operations/tool.call/models/image-ocr.schema.json +0 -20
- package/contracts/operations/tool.call/ocr-payload.schema.json +0 -64
- package/dist/src/cli/editor-commands.js +0 -136
- package/skills/insmind-cli/references/agent.md +0 -39
- package/skills/insmind-cli/references/auth.md +0 -8
- package/skills/insmind-cli/references/creation.md +0 -56
- package/skills/insmind-cli/references/dam.md +0 -52
- package/skills/insmind-cli/references/editor.md +0 -62
- package/skills/insmind-cli/references/errors.md +0 -42
- package/skills/insmind-cli/references/generation-constraints.md +0 -40
- package/skills/insmind-cli/references/matting.md +0 -27
- package/skills/insmind-cli/references/media-tools.md +0 -46
- package/skills/insmind-cli/references/tool.md +0 -24
- package/skills/insmind-cli/references/update.md +0 -18
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://gdcli.insmind.com/contracts/presentations/task.get.schema.json",
|
|
4
|
+
"title": "TaskResult",
|
|
5
|
+
"allOf": [
|
|
6
|
+
{
|
|
7
|
+
"if": {
|
|
8
|
+
"properties": {
|
|
9
|
+
"state": {
|
|
10
|
+
"const": "completed"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"then": {
|
|
15
|
+
"properties": {
|
|
16
|
+
"result": {}
|
|
17
|
+
},
|
|
18
|
+
"required": [
|
|
19
|
+
"result"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"else": {
|
|
23
|
+
"not": {
|
|
24
|
+
"properties": {
|
|
25
|
+
"result": {}
|
|
26
|
+
},
|
|
27
|
+
"required": [
|
|
28
|
+
"result"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": [
|
|
37
|
+
"taskId",
|
|
38
|
+
"operation",
|
|
39
|
+
"label",
|
|
40
|
+
"createdAt",
|
|
41
|
+
"updatedAt",
|
|
42
|
+
"state"
|
|
43
|
+
],
|
|
44
|
+
"properties": {
|
|
45
|
+
"taskId": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"format": "uuid"
|
|
48
|
+
},
|
|
49
|
+
"operation": {
|
|
50
|
+
"enum": [
|
|
51
|
+
"agent.send",
|
|
52
|
+
"tool.call"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
"label": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"maxLength": 200
|
|
58
|
+
},
|
|
59
|
+
"createdAt": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"format": "date-time"
|
|
62
|
+
},
|
|
63
|
+
"updatedAt": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"format": "date-time"
|
|
66
|
+
},
|
|
67
|
+
"state": {
|
|
68
|
+
"enum": [
|
|
69
|
+
"running",
|
|
70
|
+
"completed",
|
|
71
|
+
"failed",
|
|
72
|
+
"unknown"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"contextId": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"minLength": 1
|
|
78
|
+
},
|
|
79
|
+
"note": {
|
|
80
|
+
"type": "string"
|
|
81
|
+
},
|
|
82
|
+
"result": {
|
|
83
|
+
"oneOf": [
|
|
84
|
+
{
|
|
85
|
+
"$ref": "../operations/agent.send/output.schema.json"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"$ref": "../operations/tool.call/output.schema.json"
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"partialResult": {
|
|
93
|
+
"oneOf": [
|
|
94
|
+
{
|
|
95
|
+
"$ref": "../operations/agent.send/output.schema.json"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"$ref": "../operations/tool.call/output.schema.json"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"relatedSkills": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"minItems": 1,
|
|
105
|
+
"items": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"additionalProperties": false,
|
|
108
|
+
"required": [
|
|
109
|
+
"id",
|
|
110
|
+
"title",
|
|
111
|
+
"description",
|
|
112
|
+
"command"
|
|
113
|
+
],
|
|
114
|
+
"properties": {
|
|
115
|
+
"id": {
|
|
116
|
+
"type": "string",
|
|
117
|
+
"pattern": "^[a-z][a-z0-9-]{0,63}$"
|
|
118
|
+
},
|
|
119
|
+
"title": {
|
|
120
|
+
"type": "string",
|
|
121
|
+
"minLength": 1
|
|
122
|
+
},
|
|
123
|
+
"description": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"minLength": 1
|
|
126
|
+
},
|
|
127
|
+
"command": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"pattern": "^insmind-cli --skill [a-z][a-z0-9-]{0,63}$"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "ToolCallOutput",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"required": [
|
|
7
|
+
"content",
|
|
8
|
+
"usage"
|
|
9
|
+
],
|
|
10
|
+
"properties": {
|
|
11
|
+
"content": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": {
|
|
14
|
+
"oneOf": [
|
|
15
|
+
{
|
|
16
|
+
"$ref": "#/$defs/TextContent"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/ResourceLink"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"$ref": "#/$defs/EmbeddedJsonResource"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"usage": {
|
|
28
|
+
"$ref": "#/$defs/ToolUsage"
|
|
29
|
+
},
|
|
30
|
+
"relatedSkills": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"minItems": 1,
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": [
|
|
37
|
+
"id",
|
|
38
|
+
"title",
|
|
39
|
+
"description",
|
|
40
|
+
"command"
|
|
41
|
+
],
|
|
42
|
+
"properties": {
|
|
43
|
+
"id": {
|
|
44
|
+
"type": "string",
|
|
45
|
+
"pattern": "^[a-z][a-z0-9-]{0,63}$"
|
|
46
|
+
},
|
|
47
|
+
"title": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"minLength": 1
|
|
50
|
+
},
|
|
51
|
+
"description": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
},
|
|
55
|
+
"command": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"pattern": "^insmind-cli --skill [a-z][a-z0-9-]{0,63}$"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"$defs": {
|
|
64
|
+
"CostRange": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"additionalProperties": false,
|
|
67
|
+
"required": [
|
|
68
|
+
"unit",
|
|
69
|
+
"minimum",
|
|
70
|
+
"maximum"
|
|
71
|
+
],
|
|
72
|
+
"properties": {
|
|
73
|
+
"unit": {
|
|
74
|
+
"const": "credit"
|
|
75
|
+
},
|
|
76
|
+
"minimum": {
|
|
77
|
+
"type": "number",
|
|
78
|
+
"minimum": 0
|
|
79
|
+
},
|
|
80
|
+
"maximum": {
|
|
81
|
+
"type": "number",
|
|
82
|
+
"minimum": 0
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"ToolUsage": {
|
|
87
|
+
"type": "object",
|
|
88
|
+
"additionalProperties": false,
|
|
89
|
+
"required": [
|
|
90
|
+
"model"
|
|
91
|
+
],
|
|
92
|
+
"properties": {
|
|
93
|
+
"model": {
|
|
94
|
+
"type": "string",
|
|
95
|
+
"minLength": 1,
|
|
96
|
+
"pattern": ".*\\S.*"
|
|
97
|
+
},
|
|
98
|
+
"cost": {
|
|
99
|
+
"$ref": "#/$defs/CostRange"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"TextContent": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"required": [
|
|
107
|
+
"type",
|
|
108
|
+
"text"
|
|
109
|
+
],
|
|
110
|
+
"properties": {
|
|
111
|
+
"type": {
|
|
112
|
+
"const": "text"
|
|
113
|
+
},
|
|
114
|
+
"text": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"minLength": 1,
|
|
117
|
+
"pattern": ".*\\S.*"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"ResourceLink": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"required": [
|
|
125
|
+
"type",
|
|
126
|
+
"uri",
|
|
127
|
+
"name"
|
|
128
|
+
],
|
|
129
|
+
"properties": {
|
|
130
|
+
"type": {
|
|
131
|
+
"const": "resource_link"
|
|
132
|
+
},
|
|
133
|
+
"uri": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"format": "uri"
|
|
136
|
+
},
|
|
137
|
+
"name": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"minLength": 1,
|
|
140
|
+
"pattern": ".*\\S.*"
|
|
141
|
+
},
|
|
142
|
+
"mimeType": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"minLength": 1,
|
|
145
|
+
"pattern": ".*\\S.*"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"EmbeddedJsonResource": {
|
|
150
|
+
"type": "object",
|
|
151
|
+
"additionalProperties": false,
|
|
152
|
+
"required": [
|
|
153
|
+
"type",
|
|
154
|
+
"resource"
|
|
155
|
+
],
|
|
156
|
+
"properties": {
|
|
157
|
+
"type": {
|
|
158
|
+
"const": "resource"
|
|
159
|
+
},
|
|
160
|
+
"resource": {
|
|
161
|
+
"type": "object",
|
|
162
|
+
"additionalProperties": false,
|
|
163
|
+
"required": [
|
|
164
|
+
"uri",
|
|
165
|
+
"mimeType",
|
|
166
|
+
"text"
|
|
167
|
+
],
|
|
168
|
+
"properties": {
|
|
169
|
+
"uri": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"format": "uri"
|
|
172
|
+
},
|
|
173
|
+
"mimeType": {
|
|
174
|
+
"const": "application/json"
|
|
175
|
+
},
|
|
176
|
+
"text": {
|
|
177
|
+
"type": "string",
|
|
178
|
+
"minLength": 1
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
package/dist/bin/insmind-cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { runSkillManual } from "../src/features/skill/manual.js";
|
|
3
4
|
import { jsonErrorsRequested } from "../src/platform/error-output-mode.js";
|
|
4
5
|
import { isInterruption } from "../src/platform/interruption.js";
|
|
5
6
|
import { insmindProduct } from "../src/product/config.js";
|
|
@@ -15,7 +16,11 @@ let runtime;
|
|
|
15
16
|
let mapCliError;
|
|
16
17
|
let redact;
|
|
17
18
|
try {
|
|
18
|
-
|
|
19
|
+
const manualExitCode = await runSkillManual(process.argv.slice(2), "insmind-cli", jsonErrors);
|
|
20
|
+
if (manualExitCode !== undefined) {
|
|
21
|
+
process.exitCode = manualExitCode;
|
|
22
|
+
}
|
|
23
|
+
else if (process.env.CLI_INTERNAL_HOST_DIAGNOSTIC === "1" && process.argv.length === 3 && process.argv[2] === "--version") {
|
|
19
24
|
await import("../src/telemetry/host-diagnostics.js")
|
|
20
25
|
.then(({ runHostDiagnosticReporter }) => runHostDiagnosticReporter({ product: insmindProduct }))
|
|
21
26
|
.catch(() => undefined);
|
|
@@ -8,7 +8,6 @@ import { classifyTelemetryError, isHelpOutcome, mapCliError } from "../cli/error
|
|
|
8
8
|
import { registerOrgCommands } from "../cli/org-commands.js";
|
|
9
9
|
import { registerToolCommands } from "../cli/tool-commands.js";
|
|
10
10
|
import { registerModelCommands } from "../cli/model-commands.js";
|
|
11
|
-
import { registerEditorCommands } from "../cli/editor-commands.js";
|
|
12
11
|
import { registerDamCommands } from "../cli/dam-commands.js";
|
|
13
12
|
import { registerUpdateCommand } from "../cli/update-command.js";
|
|
14
13
|
import { registerCreditsCommand } from "../cli/credits-command.js";
|
|
@@ -35,10 +34,15 @@ export function createCli(runtime, options) {
|
|
|
35
34
|
writeErr: () => undefined
|
|
36
35
|
});
|
|
37
36
|
program.addHelpText("after", runtime.product.id === "insmind"
|
|
38
|
-
? "\nChoose by the object and goal: tool list discovers generation and processing of attached images/videos (including text replacement, layers and vectors);
|
|
39
|
-
: "\n按对象和目标选入口:tool list 发现生成及附件图片/视频处理能力(含改字、分层、矢量化);
|
|
37
|
+
? "\nChoose by the object and goal: tool list discovers generation and processing of attached images/videos (including text replacement, layers and vectors); agent send handles planning and multi-turn creation.\nRead the selected command's --help. Use its advertised --schema for JSON structure and model get for live model inputs. --input takes a JSON file path or - with complete JSON on stdin; media URI fields inside JSON take URLs.\nstdout contains command results; human-readable views can include an update notice. stderr contains progress, warnings and errors. Fixed JSON commands, --json and --json-errors use {error:{code,message,details?,trace_id?}} for final errors. stderr may contain multiple messages.\nExit codes: 0 command success (async acceptance and successful queries still require checking task state), 1 execution failure, 2 invalid input, 130 local interruption; dispatched work may still be active.\n"
|
|
38
|
+
: "\n按对象和目标选入口:tool list 发现生成及附件图片/视频处理能力(含改字、分层、矢量化);agent send 负责策划和持续多轮创作。\n先读所选命令 --help;结构化输入从其公开的 --schema 发现,模型参数从 model get 查询。--input 接收 JSON 文件路径,或用 - 从 stdin 传完整 JSON;JSON 内的媒体 URI 字段接收 URL。\nstdout 输出命令结果,人类可读视图可以附带升级提醒;stderr 输出进度、警告和错误。固定 JSON 命令、--json 和 --json-errors 的最终错误使用 {error:{code,message,details?,trace_id?}},stderr 可能包含多条信息。\n退出码:0 命令成功(异步受理、查询成功仍须查看任务状态),1 执行失败,2 输入无效,130 本地中断;已派发的工作可能仍在继续。\n");
|
|
40
39
|
if (runtime.product.id === "insmind") {
|
|
41
40
|
program.option("--locale <locale>", "locale for service-owned business descriptions");
|
|
41
|
+
program.addHelpText("after", "Agents can run insmind-cli --skill for the guide catalog, then insmind-cli --skill <chapter> to read a guide.\n");
|
|
42
|
+
}
|
|
43
|
+
else if (process.env.CLI_HOST_APPLICATION !== "qwenwork" || process.env.CLI_INVOCATION_PURPOSE === undefined) {
|
|
44
|
+
// The retired Qwen 1.x CLI bridge owns its Skill and only accepts JSON business output.
|
|
45
|
+
program.addHelpText("after", "Agent 可用 gd-cli --skill 查看使用指南和场景目录,用 gd-cli --skill <章节> 读取所选正文。\n");
|
|
42
46
|
}
|
|
43
47
|
configureActionEnvironment(program, {
|
|
44
48
|
policies: runtime.accessPolicies,
|
|
@@ -51,7 +55,6 @@ export function createCli(runtime, options) {
|
|
|
51
55
|
registerAgentCommands(program, runtime);
|
|
52
56
|
registerToolCommands(program, runtime);
|
|
53
57
|
registerModelCommands(program, runtime);
|
|
54
|
-
registerEditorCommands(program, runtime);
|
|
55
58
|
registerDamCommands(program, runtime);
|
|
56
59
|
registerUpdateCommand(program, runtime);
|
|
57
60
|
registerTaskCommands(program, runtime);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createSkillCatalog } from "../features/skill/catalog.js";
|
|
1
2
|
import { httpUserAgent } from "../platform/http-user-agent.js";
|
|
2
3
|
import { canvasModelBindings } from "../features/tool/canvas-models.js";
|
|
3
4
|
import { createWindAnalytics } from "../analytics/wind.js";
|
|
@@ -32,9 +33,6 @@ import { createDamRegisteredUploader } from "../features/dam/registered-uploader
|
|
|
32
33
|
import { createDamTransientUploader } from "../features/dam/transient-uploader.js";
|
|
33
34
|
import { createDamStorageUploader } from "../features/dam/storage-upload.js";
|
|
34
35
|
import { createDamUseCases } from "../features/dam/use-cases.js";
|
|
35
|
-
import { createEditorSession } from "../features/editor/session.js";
|
|
36
|
-
import { createEditorSessionStateStore } from "../features/editor/session-state.js";
|
|
37
|
-
import { createEditorUseCases } from "../features/editor/use-cases.js";
|
|
38
36
|
import { createObjectStorageUploader } from "../features/dam/object-storage.js";
|
|
39
37
|
import { createAgentUseCases } from "../features/agent/use-cases.js";
|
|
40
38
|
import { createSceneCatalogAdapter } from "../features/tool/scene-catalog-adapter.js";
|
|
@@ -543,34 +541,6 @@ export function createProductionRuntime(options = {}) {
|
|
|
543
541
|
warn: (message) => { presenter.warning(message); },
|
|
544
542
|
telemetry
|
|
545
543
|
}), product.billingUnit);
|
|
546
|
-
const editor = createEditorUseCases({
|
|
547
|
-
onPartial: count => partialWarning("EDITOR_SNAPSHOT_PARTIAL", `有 ${count} 个元素无法表示,已返回其余元素。`, `${count} unsupported element(s); the other elements are included.`),
|
|
548
|
-
session: createEditorSession({
|
|
549
|
-
store: createEditorSessionStateStore({
|
|
550
|
-
...(options.homeDirectory === undefined
|
|
551
|
-
? {}
|
|
552
|
-
: { homeDirectory: options.homeDirectory }),
|
|
553
|
-
stateDirectory: product.stateDirectory
|
|
554
|
-
}),
|
|
555
|
-
browser,
|
|
556
|
-
defaultCreateUrl: product.defaultEditorCreateUrl,
|
|
557
|
-
workUrl: product.editorWorkUrl,
|
|
558
|
-
commandName: product.commandName,
|
|
559
|
-
restrictTargets: product.restrictEditorTargets,
|
|
560
|
-
stateDirectory: product.stateDirectory,
|
|
561
|
-
...(options.homeDirectory === undefined
|
|
562
|
-
? {}
|
|
563
|
-
: { homeDirectory: options.homeDirectory })
|
|
564
|
-
}),
|
|
565
|
-
validate: {
|
|
566
|
-
connect: validators.editorConnectOutput,
|
|
567
|
-
disconnect: validators.editorDisconnectOutput,
|
|
568
|
-
snapshot: validators.editorSnapshotOutput,
|
|
569
|
-
apply: validators.editorApplyOutput,
|
|
570
|
-
screenshot: validators.editorScreenshotOutput,
|
|
571
|
-
save: validators.editorSaveOutput
|
|
572
|
-
}
|
|
573
|
-
});
|
|
574
544
|
const update = {
|
|
575
545
|
run(signal) {
|
|
576
546
|
return createUpdateService({
|
|
@@ -606,7 +576,13 @@ export function createProductionRuntime(options = {}) {
|
|
|
606
576
|
commandName: product.commandName
|
|
607
577
|
} : {})
|
|
608
578
|
});
|
|
579
|
+
// The retired Qwen CLI bridge validates the original closed JSON schemas.
|
|
580
|
+
const legacyQwen = env.CLI_HOST_APPLICATION === "qwenwork" && env.CLI_INVOCATION_PURPOSE !== undefined;
|
|
609
581
|
return {
|
|
582
|
+
...(legacyQwen ? {} : {
|
|
583
|
+
skillCatalog: createSkillCatalog(product.commandName, { home: options.homeDirectory,
|
|
584
|
+
endpoint: env[product.id === "insmind" ? "INSMIND_CLI_SKILL_URL" : "GD_CLI_SKILL_URL"] }),
|
|
585
|
+
}),
|
|
610
586
|
product,
|
|
611
587
|
version: primarySkill.version,
|
|
612
588
|
telemetry,
|
|
@@ -639,7 +615,6 @@ export function createProductionRuntime(options = {}) {
|
|
|
639
615
|
throw error;
|
|
640
616
|
}
|
|
641
617
|
},
|
|
642
|
-
editor,
|
|
643
618
|
dam,
|
|
644
619
|
tool,
|
|
645
620
|
credits,
|
|
@@ -6,10 +6,10 @@ const jsonCommands = new WeakSet();
|
|
|
6
6
|
const selectedCommands = new WeakMap();
|
|
7
7
|
const commandDefinitions = new WeakMap();
|
|
8
8
|
/** Declare the existing fixed JSON contract alongside the command registration. */
|
|
9
|
-
export function jsonOutput(command) {
|
|
9
|
+
export function jsonOutput(command, description = "JSON output (default)") {
|
|
10
10
|
jsonCommands.add(command);
|
|
11
11
|
if (!command.options.some(option => option.long === "--json")) {
|
|
12
|
-
command.option("--json",
|
|
12
|
+
command.option("--json", description);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export function errorUsesJson(program, argv) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { skillOutput, writeSkillResult } from "./skill-output.js";
|
|
1
2
|
import { creationTaskHelp } from "./creation-help.js";
|
|
2
3
|
import { hostSchema, readHostInput } from "./host-input.js";
|
|
3
4
|
import { readAgentInputSchema } from "../contracts/creation-input.js";
|
|
4
|
-
import {
|
|
5
|
+
import { bindPreparedAction } from "./action-binding.js";
|
|
5
6
|
import { CliUsageError } from "./errors.js";
|
|
6
7
|
import { productText as text } from "../product/text.js";
|
|
7
8
|
export function registerAgentCommands(program, runtime) {
|
|
@@ -30,7 +31,7 @@ export function registerAgentCommands(program, runtime) {
|
|
|
30
31
|
text(runtime.product, "素材用独立 URL Part;本地文件用 Path(path).resolve().as_uri() 或 pathToFileURL(path).href 生成标准 URI,保留顺序和 metadata.role。--input 的 JSON 文件参数仍使用路径。", "Supply assets as separate URL Parts, preserving order and metadata.role. Generate local URIs with Path(path).resolve().as_uri() or pathToFileURL(path).href. The --input JSON file argument remains a path."),
|
|
31
32
|
""
|
|
32
33
|
].join("\n"));
|
|
33
|
-
|
|
34
|
+
skillOutput(send, runtime);
|
|
34
35
|
bindPreparedAction(send, "organization", async (signal) => {
|
|
35
36
|
signal.throwIfAborted();
|
|
36
37
|
const options = send.opts();
|
|
@@ -57,7 +58,7 @@ export function registerAgentCommands(program, runtime) {
|
|
|
57
58
|
const result = await runtime.startBackgroundTask({ operation: "agent.send", state: context.state, label: task.label, input }, signal);
|
|
58
59
|
await runtime.telemetry.stage("output", async () => {
|
|
59
60
|
runtime.validators.taskResult(result);
|
|
60
|
-
runtime.
|
|
61
|
+
await writeSkillResult(runtime, send, result, "agent.send");
|
|
61
62
|
});
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
@@ -66,7 +67,7 @@ export function registerAgentCommands(program, runtime) {
|
|
|
66
67
|
access: { credential: context.state.credential, organizationId: context.state.organization.id }, signal });
|
|
67
68
|
const result = await runtime.tasks.track({ ...task, run });
|
|
68
69
|
await runtime.telemetry.stage("output", async () => {
|
|
69
|
-
runtime.
|
|
70
|
+
await writeSkillResult(runtime, send, result, "agent.send");
|
|
70
71
|
});
|
|
71
72
|
}, {
|
|
72
73
|
operation: "agent.send",
|
|
@@ -6,7 +6,7 @@ export function registerAuthCommands(program, runtime) {
|
|
|
6
6
|
const auth = program.command("auth")
|
|
7
7
|
.description(text(runtime.product, "登录与本机凭证", "Authentication and local credentials"))
|
|
8
8
|
.helpCommand(false);
|
|
9
|
-
auth.addHelpText("after", text(runtime.product, "\n管理本机 CLI
|
|
9
|
+
auth.addHelpText("after", text(runtime.product, "\n管理本机 CLI 登录。status 只读状态,login 等待浏览器授权完成,logout 清除本机共享登录。授权链接不等于登录成功;无需提供或读取 AK/SK、Cookie 等凭证。\n", "\nManages the local CLI identity. status reads state, login waits for browser authorization, and logout clears the shared local sign-in. An authorization URL is not successful login; do not provide or read credential values.\n"));
|
|
10
10
|
const login = leaf(auth.command("login"))
|
|
11
11
|
.description(text(runtime.product, "登录稿定", "Sign in to insMind"))
|
|
12
12
|
.option("--no-browser", text(runtime.product, "不自动打开浏览器", "do not open a browser automatically"))
|
|
@@ -27,7 +27,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
27
27
|
signal
|
|
28
28
|
})));
|
|
29
29
|
await runtime.telemetry.stage("output", async () => {
|
|
30
|
-
runtime.
|
|
30
|
+
await presentDamResult(runtime, result, "dam.repository.list", {
|
|
31
31
|
json: repositoryList.opts().json === true,
|
|
32
32
|
view: value => repositoryListView(value, runtime.product)
|
|
33
33
|
});
|
|
@@ -64,7 +64,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
64
64
|
signal
|
|
65
65
|
});
|
|
66
66
|
await runtime.telemetry.stage("output", async () => {
|
|
67
|
-
runtime.
|
|
67
|
+
await presentDamResult(runtime, result, "dam.folder.list", {
|
|
68
68
|
json: folderList.opts().json === true,
|
|
69
69
|
view: value => folderListView(value, runtime.product)
|
|
70
70
|
});
|
|
@@ -95,7 +95,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
95
95
|
signal
|
|
96
96
|
});
|
|
97
97
|
await runtime.telemetry.stage("output", async () => {
|
|
98
|
-
runtime.
|
|
98
|
+
await presentDamResult(runtime, result, "dam.tag.list", {
|
|
99
99
|
json: tagList.opts().json === true,
|
|
100
100
|
view: value => tagListView(value, runtime.product)
|
|
101
101
|
});
|
|
@@ -126,7 +126,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
126
126
|
signal
|
|
127
127
|
});
|
|
128
128
|
await runtime.telemetry.stage("output", async () => {
|
|
129
|
-
runtime
|
|
129
|
+
await presentDamResult(runtime, result, "dam.download", {
|
|
130
130
|
json: download.opts().json === true,
|
|
131
131
|
view: value => downloadView(value, runtime.product)
|
|
132
132
|
});
|
|
@@ -159,7 +159,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
159
159
|
signal
|
|
160
160
|
});
|
|
161
161
|
await runtime.telemetry.stage("output", async () => {
|
|
162
|
-
runtime
|
|
162
|
+
await presentDamResult(runtime, result, "dam.rename", {
|
|
163
163
|
json: rename.opts().json === true,
|
|
164
164
|
view: value => renameView(value, runtime.product)
|
|
165
165
|
});
|
|
@@ -209,7 +209,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
209
209
|
signal
|
|
210
210
|
});
|
|
211
211
|
await runtime.telemetry.stage("output", async () => {
|
|
212
|
-
runtime
|
|
212
|
+
await presentDamResult(runtime, result, `dam.${operation}`, {
|
|
213
213
|
json: command.opts().json === true,
|
|
214
214
|
view: value => operation === "move" ? moveView(value, runtime.product) : copyView(value, runtime.product)
|
|
215
215
|
});
|
|
@@ -231,7 +231,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
231
231
|
signal
|
|
232
232
|
});
|
|
233
233
|
await runtime.telemetry.stage("output", async () => {
|
|
234
|
-
runtime
|
|
234
|
+
await presentDamResult(runtime, result, "dam.list", {
|
|
235
235
|
json: list.opts().json === true,
|
|
236
236
|
view: value => assetListView(value, runtime.product)
|
|
237
237
|
});
|
|
@@ -256,7 +256,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
256
256
|
signal
|
|
257
257
|
});
|
|
258
258
|
await runtime.telemetry.stage("output", async () => {
|
|
259
|
-
runtime
|
|
259
|
+
await presentDamResult(runtime, result, "dam.search", {
|
|
260
260
|
json: search.opts().json === true,
|
|
261
261
|
view: value => assetListView(value, runtime.product)
|
|
262
262
|
});
|
|
@@ -279,7 +279,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
279
279
|
signal
|
|
280
280
|
});
|
|
281
281
|
await runtime.telemetry.stage("output", async () => {
|
|
282
|
-
runtime
|
|
282
|
+
await presentDamResult(runtime, result, "dam.get", {
|
|
283
283
|
json: get.opts().json === true,
|
|
284
284
|
view: value => assetDetailView(value, runtime.product)
|
|
285
285
|
});
|
|
@@ -318,7 +318,7 @@ export function registerDamCommands(program, runtime) {
|
|
|
318
318
|
signal
|
|
319
319
|
});
|
|
320
320
|
await runtime.telemetry.stage("output", async () => {
|
|
321
|
-
runtime
|
|
321
|
+
await presentDamResult(runtime, result, "dam.upload", {
|
|
322
322
|
json: upload.opts().json === true,
|
|
323
323
|
view: value => assetDetailView(value, runtime.product)
|
|
324
324
|
});
|
|
@@ -354,6 +354,14 @@ export function registerDamCommands(program, runtime) {
|
|
|
354
354
|
});
|
|
355
355
|
}, { operation: "dam.delete" });
|
|
356
356
|
}
|
|
357
|
+
async function presentDamResult(runtime, result, operation, presentation) {
|
|
358
|
+
runtime.presenter.result(result, presentation);
|
|
359
|
+
if (presentation.json || !runtime.skillCatalog)
|
|
360
|
+
return;
|
|
361
|
+
const hints = await runtime.skillCatalog.recommendations(operation);
|
|
362
|
+
for (const hint of hints)
|
|
363
|
+
runtime.presenter.notice(hint.title + " — " + hint.description + " (" + hint.command + ")");
|
|
364
|
+
}
|
|
357
365
|
function leaf(command) {
|
|
358
366
|
return command.allowExcessArguments(false);
|
|
359
367
|
}
|