@insmind/cli 2.1.0 → 2.1.1
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/contracts/operations/agent.send/input.schema.json +1 -77
- package/contracts/operations/dam.folder.list/input.schema.json +0 -1
- package/contracts/operations/dam.folder.list/output.schema.json +1 -2
- package/contracts/operations/dam.list/input.schema.json +3 -6
- package/contracts/operations/dam.list/output.schema.json +1 -2
- package/contracts/operations/dam.search/input.schema.json +3 -6
- package/contracts/operations/dam.search/output.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-edit-smart.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-expand-smart.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-layers-smart.schema.json +1 -3
- package/contracts/operations/tool.call/models/video-edit-smart.schema.json +0 -3
- package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
- package/dist/bin/postinstall.js +22 -6
- package/dist/bin/task-worker.js +2 -2
- package/dist/src/bootstrap/create-cli.js +13 -6
- package/dist/src/bootstrap/create-runtime.js +98 -28
- package/dist/src/bootstrap/run-task-worker.js +6 -2
- package/dist/src/bootstrap/validators.js +1 -1
- package/dist/src/cli/action-binding.js +14 -37
- package/dist/src/cli/agent-commands.js +11 -11
- package/dist/src/cli/auth-commands.js +2 -1
- package/dist/src/cli/creation-help.js +9 -0
- package/dist/src/cli/dam-commands.js +10 -14
- package/dist/src/cli/editor-commands.js +7 -5
- package/dist/src/cli/errors.js +81 -22
- package/dist/src/cli/host-input.js +64 -5
- package/dist/src/cli/model-commands.js +9 -3
- package/dist/src/cli/observed-errors.js +7 -3
- package/dist/src/cli/org-commands.js +3 -1
- package/dist/src/cli/task-commands.js +6 -2
- package/dist/src/cli/tool-commands.js +12 -11
- package/dist/src/features/agent/creative-agent-adapter.js +6 -2
- package/dist/src/features/agent/creative-protocol.js +8 -29
- package/dist/src/features/agent/resource-authorizer.js +25 -17
- package/dist/src/features/agent/result-reader.js +31 -14
- package/dist/src/features/agent/use-cases.js +6 -31
- package/dist/src/features/credits/use-cases.js +55 -28
- package/dist/src/features/dam/asset-projection.js +3 -6
- package/dist/src/features/dam/dam-api-adapter.js +30 -15
- package/dist/src/features/dam/repository-catalog.js +30 -21
- package/dist/src/features/dam/use-cases.js +12 -7
- package/dist/src/features/editor/bridge-client.js +0 -2
- package/dist/src/features/editor/public-url.js +1 -36
- package/dist/src/features/editor/session.js +3 -2
- package/dist/src/features/editor/use-cases.js +27 -2
- package/dist/src/features/org/org-service.js +10 -1
- package/dist/src/features/org/use-cases.js +18 -4
- package/dist/src/features/task/process-owner.js +54 -0
- package/dist/src/features/task/store.js +37 -10
- package/dist/src/features/task/task-background.js +5 -2
- package/dist/src/features/task/use-cases.js +184 -84
- package/dist/src/features/tool/argument-paths.js +14 -0
- package/dist/src/features/tool/canvas-copy.js +28 -15
- package/dist/src/features/tool/canvas-matting.js +123 -0
- package/dist/src/features/tool/canvas-media.js +100 -52
- package/dist/src/features/tool/canvas-models.js +66 -33
- package/dist/src/features/tool/canvas-pricing.js +12 -0
- package/dist/src/features/tool/canvas-recovery.js +13 -30
- package/dist/src/features/tool/canvas-results.js +79 -87
- package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
- package/dist/src/features/tool/canvas-video.js +44 -37
- package/dist/src/features/tool/dynamic-schema.js +39 -40
- package/dist/src/features/tool/ffprobe-executable.js +21 -0
- package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
- package/dist/src/features/tool/resource-authorizer.js +11 -3
- package/dist/src/features/tool/tool-api-adapter.js +73 -82
- package/dist/src/features/tool/tool-errors.js +25 -0
- package/dist/src/features/tool/tool-output.js +15 -0
- package/dist/src/features/tool/use-cases.js +74 -98
- package/dist/src/features/update/update-service.js +95 -21
- package/dist/src/platform/media-type.js +46 -0
- package/dist/src/platform/public-url.js +35 -0
- package/dist/src/platform/remote-error-evidence.js +33 -6
- package/dist/src/platform/resource-auth-key.js +35 -1
- package/dist/src/platform/safe-upload-file.js +36 -41
- package/dist/src/platform/signature.js +2 -2
- package/dist/src/platform/signed-http-transport.js +4 -1
- package/dist/src/platform/url-safety.js +6 -1
- package/dist/src/platform/webm-header.js +41 -0
- package/dist/src/telemetry/command-route.js +38 -0
- package/dist/src/telemetry/command-routes.json +1 -0
- package/dist/src/telemetry/failure-summary.js +1 -1
- package/dist/src/telemetry/invocation.js +1 -2
- package/dist/src/telemetry/process-errors.js +17 -33
- package/dist/src/telemetry/sanitize.js +19 -4
- package/dist/src/telemetry/sls-sink.js +8 -0
- package/package.json +4 -4
- package/skills/insmind-cli/SKILL.md +18 -5
- package/skills/insmind-cli/references/agent.md +9 -4
- package/skills/insmind-cli/references/creation.md +3 -1
- package/skills/insmind-cli/references/editor.md +7 -5
- package/skills/insmind-cli/references/errors.md +20 -9
- package/skills/insmind-cli/references/matting.md +3 -5
- package/skills/insmind-cli/references/media-tools.md +10 -4
- package/skills/insmind-cli/references/tool.md +9 -15
|
@@ -75,30 +75,6 @@
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
|
-
{
|
|
79
|
-
"properties": {
|
|
80
|
-
"parts": {
|
|
81
|
-
"type": "array",
|
|
82
|
-
"contains": {
|
|
83
|
-
"$ref": "#/$defs/FirstFramePart"
|
|
84
|
-
},
|
|
85
|
-
"minContains": 0,
|
|
86
|
-
"maxContains": 1
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"properties": {
|
|
92
|
-
"parts": {
|
|
93
|
-
"type": "array",
|
|
94
|
-
"contains": {
|
|
95
|
-
"$ref": "#/$defs/LastFramePart"
|
|
96
|
-
},
|
|
97
|
-
"minContains": 0,
|
|
98
|
-
"maxContains": 1
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
78
|
{
|
|
103
79
|
"if": {
|
|
104
80
|
"properties": {
|
|
@@ -191,7 +167,7 @@
|
|
|
191
167
|
"properties": {
|
|
192
168
|
"role": {
|
|
193
169
|
"type": "string",
|
|
194
|
-
"
|
|
170
|
+
"examples": [
|
|
195
171
|
"reference",
|
|
196
172
|
"first_frame",
|
|
197
173
|
"last_frame"
|
|
@@ -278,58 +254,6 @@
|
|
|
278
254
|
}
|
|
279
255
|
}
|
|
280
256
|
}
|
|
281
|
-
},
|
|
282
|
-
"FirstFramePart": {
|
|
283
|
-
"allOf": [
|
|
284
|
-
{
|
|
285
|
-
"$ref": "#/$defs/InputAssetPart"
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
"type": "object",
|
|
289
|
-
"properties": {
|
|
290
|
-
"metadata": {
|
|
291
|
-
"type": "object",
|
|
292
|
-
"properties": {
|
|
293
|
-
"role": {
|
|
294
|
-
"const": "first_frame"
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
"required": [
|
|
298
|
-
"role"
|
|
299
|
-
]
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
"required": [
|
|
303
|
-
"metadata"
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
|
-
},
|
|
308
|
-
"LastFramePart": {
|
|
309
|
-
"allOf": [
|
|
310
|
-
{
|
|
311
|
-
"$ref": "#/$defs/InputAssetPart"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"type": "object",
|
|
315
|
-
"properties": {
|
|
316
|
-
"metadata": {
|
|
317
|
-
"type": "object",
|
|
318
|
-
"properties": {
|
|
319
|
-
"role": {
|
|
320
|
-
"const": "last_frame"
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
"required": [
|
|
324
|
-
"role"
|
|
325
|
-
]
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
"required": [
|
|
329
|
-
"metadata"
|
|
330
|
-
]
|
|
331
|
-
}
|
|
332
|
-
]
|
|
333
257
|
}
|
|
334
258
|
}
|
|
335
259
|
}
|
|
@@ -31,22 +31,19 @@
|
|
|
31
31
|
},
|
|
32
32
|
"assetFormats": {
|
|
33
33
|
"type": "array",
|
|
34
|
-
"minItems": 1,
|
|
35
34
|
"items": {
|
|
36
|
-
"
|
|
35
|
+
"type": "string"
|
|
37
36
|
}
|
|
38
37
|
},
|
|
39
38
|
"tagIds": {
|
|
40
39
|
"type": "array",
|
|
41
|
-
"minItems": 1,
|
|
42
40
|
"items": {
|
|
43
|
-
"
|
|
41
|
+
"type": "string"
|
|
44
42
|
}
|
|
45
43
|
},
|
|
46
44
|
"pageSize": {
|
|
47
45
|
"type": "integer",
|
|
48
|
-
"minimum": 1
|
|
49
|
-
"maximum": 100
|
|
46
|
+
"minimum": 1
|
|
50
47
|
},
|
|
51
48
|
"cursor": {
|
|
52
49
|
"$ref": "#/$defs/nonblank"
|
|
@@ -37,22 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"assetFormats": {
|
|
39
39
|
"type": "array",
|
|
40
|
-
"minItems": 1,
|
|
41
40
|
"items": {
|
|
42
|
-
"
|
|
41
|
+
"type": "string"
|
|
43
42
|
}
|
|
44
43
|
},
|
|
45
44
|
"tagIds": {
|
|
46
45
|
"type": "array",
|
|
47
|
-
"minItems": 1,
|
|
48
46
|
"items": {
|
|
49
|
-
"
|
|
47
|
+
"type": "string"
|
|
50
48
|
}
|
|
51
49
|
},
|
|
52
50
|
"pageSize": {
|
|
53
51
|
"type": "integer",
|
|
54
|
-
"minimum": 1
|
|
55
|
-
"maximum": 100
|
|
52
|
+
"minimum": 1
|
|
56
53
|
},
|
|
57
54
|
"cursor": {
|
|
58
55
|
"$ref": "#/$defs/nonblank"
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"format": "uri"
|
|
42
42
|
},
|
|
43
43
|
"minItems": 1,
|
|
44
|
-
"uniqueItems": true,
|
|
45
44
|
"maxItems": 10
|
|
46
45
|
},
|
|
47
46
|
"referenceVideos": {
|
|
@@ -51,7 +50,6 @@
|
|
|
51
50
|
"format": "uri"
|
|
52
51
|
},
|
|
53
52
|
"minItems": 1,
|
|
54
|
-
"uniqueItems": true,
|
|
55
53
|
"maxItems": 4
|
|
56
54
|
},
|
|
57
55
|
"referenceAudios": {
|
|
@@ -61,7 +59,6 @@
|
|
|
61
59
|
"format": "uri"
|
|
62
60
|
},
|
|
63
61
|
"minItems": 1,
|
|
64
|
-
"uniqueItems": true,
|
|
65
62
|
"maxItems": 5
|
|
66
63
|
}
|
|
67
64
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"title": "OcrPayload",
|
|
4
4
|
"type": "object",
|
|
5
|
-
"additionalProperties":
|
|
5
|
+
"additionalProperties": true,
|
|
6
6
|
"required": [
|
|
7
7
|
"image",
|
|
8
8
|
"blocks"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"properties": {
|
|
11
11
|
"image": {
|
|
12
12
|
"type": "object",
|
|
13
|
-
"additionalProperties":
|
|
13
|
+
"additionalProperties": true,
|
|
14
14
|
"required": [
|
|
15
15
|
"uri",
|
|
16
16
|
"width",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"type": "array",
|
|
36
36
|
"items": {
|
|
37
37
|
"type": "object",
|
|
38
|
-
"additionalProperties":
|
|
38
|
+
"additionalProperties": true,
|
|
39
39
|
"required": [
|
|
40
40
|
"bbox",
|
|
41
41
|
"category"
|
|
@@ -46,8 +46,7 @@
|
|
|
46
46
|
"minItems": 4,
|
|
47
47
|
"maxItems": 4,
|
|
48
48
|
"items": {
|
|
49
|
-
"type": "number"
|
|
50
|
-
"minimum": 0
|
|
49
|
+
"type": "number"
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
52
|
"category": {
|
package/dist/bin/postinstall.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { reportProcessError } from "../src/telemetry/process-errors.js";
|
|
2
2
|
import { cleanText } from "../src/telemetry/sanitize.js";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import {
|
|
4
|
+
import { existsSync, realpathSync, statSync } from "node:fs";
|
|
5
|
+
import { dirname, join, resolve } from "node:path";
|
|
5
6
|
import { loadBundledSkills } from "../src/features/skill/bundled-skills.js";
|
|
6
7
|
import { syncBundledSkills } from "../src/features/skill/installer.js";
|
|
7
8
|
import { markWorkBuddyInstallation, readInstallationOwner } from "../src/platform/installation-owner.js";
|
|
@@ -12,11 +13,26 @@ export function isSupportedGlobalLifecycle(env) {
|
|
|
12
13
|
return /^(?:npm|pnpm)\//u.test(userAgent);
|
|
13
14
|
}
|
|
14
15
|
const initialDirectory = (env.INIT_CWD ?? "").replace(/\\/gu, "/");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
&&
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const name = env.npm_package_name;
|
|
17
|
+
if (!userAgent.startsWith("pnpm/") || env.npm_command !== "add" || env.npm_lifecycle_event !== "postinstall"
|
|
18
|
+
|| (name !== "@gaoding/cli" && name !== "@insmind/cli"))
|
|
19
|
+
return false;
|
|
20
|
+
if (/\/v\d+\/[0-9a-f]+-[0-9a-f]+-[0-9a-f]{16}$/u.test(initialDirectory))
|
|
21
|
+
return true;
|
|
22
|
+
// pnpm 12 runs postinstall before publishing its global launcher. Its staging
|
|
23
|
+
// directory has no consumer manifest and links directly to the package being built.
|
|
24
|
+
if (!/\/v\d+\/[0-9a-f]+-[0-9a-f]{16}-\d+$/u.test(initialDirectory)
|
|
25
|
+
|| !env.npm_package_json || !env.PNPM_SCRIPT_SRC_DIR)
|
|
26
|
+
return false;
|
|
27
|
+
try {
|
|
28
|
+
return !existsSync(join(initialDirectory, "package.json"))
|
|
29
|
+
&& statSync(join(dirname(initialDirectory), "pnpm-workspace.yaml")).isFile()
|
|
30
|
+
&& realpathSync(join(initialDirectory, "node_modules", name, "package.json")) === realpathSync(env.npm_package_json)
|
|
31
|
+
&& realpathSync(join(env.PNPM_SCRIPT_SRC_DIR, "package.json")) === realpathSync(env.npm_package_json);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
20
36
|
}
|
|
21
37
|
export async function runPostinstall(options = {}) {
|
|
22
38
|
const startedAt = Date.now();
|
package/dist/bin/task-worker.js
CHANGED
|
@@ -28,7 +28,7 @@ else {
|
|
|
28
28
|
for (const key of Object.keys(endpoints))
|
|
29
29
|
endpoints[key] = new URL(job.endpoints[key]);
|
|
30
30
|
const runtime = createProductionRuntime({
|
|
31
|
-
processRole: job.operation === "
|
|
31
|
+
processRole: job.operation === "agent.send" ? "agent_worker" : "tool_worker",
|
|
32
32
|
...(job.telemetryVersion ? { telemetryVersion: job.telemetryVersion } : {}),
|
|
33
33
|
...(job.telemetryTrackingUrl ? { telemetryTrackingUrl: new URL(job.telemetryTrackingUrl) } : {}),
|
|
34
34
|
...(job.telemetryEnvironment ? { telemetryEnvironment: job.telemetryEnvironment } : {}),
|
|
@@ -38,7 +38,7 @@ else {
|
|
|
38
38
|
await runTaskWorker({ runtime, job, signal: controller.signal, send });
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
|
-
await reportProcessError(error, { operation: "bootstrap", processRole: currentJob?.operation === "
|
|
41
|
+
await reportProcessError(error, { operation: "bootstrap", processRole: currentJob?.operation === "agent.send" ? "agent_worker" : "tool_worker", startedAt, signal: controller.signal,
|
|
42
42
|
stateDirectory: currentJob?.product === "insmind" ? ".insmind" : ".gd",
|
|
43
43
|
...(currentJob?.telemetryTrackingUrl ? { trackingUrl: new URL(currentJob.telemetryTrackingUrl) } : {}),
|
|
44
44
|
...(currentJob?.telemetryEnvironment ? { environment: currentJob.telemetryEnvironment } : {}),
|
|
@@ -35,8 +35,8 @@ export function createCli(runtime, options) {
|
|
|
35
35
|
writeErr: () => undefined
|
|
36
36
|
});
|
|
37
37
|
program.addHelpText("after", runtime.product.id === "insmind"
|
|
38
|
-
? "\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 success, 1 execution failure, 2 invalid input, 130 local interruption; dispatched work may still be active.\n"
|
|
39
|
-
: "\nstdout 输出命令结果,人类可读视图可以附带升级提醒;stderr 输出进度、警告和错误。固定 JSON 命令、--json 和 --json-errors 的最终错误使用 {error:{code,message,details?,trace_id?}},stderr 可能包含多条信息。\n退出码:0
|
|
38
|
+
? "\nChoose by the object and goal: tool list discovers generation and processing of attached images/videos (including text replacement, layers and vectors); editor operates elements in a connected work; agent send handles planning and multi-turn creation. A capability absent from Editor may be available as a Tool.\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"
|
|
39
|
+
: "\n按对象和目标选入口:tool list 发现生成及附件图片/视频处理能力(含改字、分层、矢量化);editor 操作已连接作品的元素;agent send 负责策划和持续多轮创作。Editor 未提供的操作仍可能由 Tool 提供。\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
40
|
if (runtime.product.id === "insmind") {
|
|
41
41
|
program.option("--locale <locale>", "locale for service-owned business descriptions");
|
|
42
42
|
}
|
|
@@ -109,12 +109,19 @@ export async function executeCli(options) {
|
|
|
109
109
|
const { cli_task_id: taskId, operation } = options.telemetry.creationContext();
|
|
110
110
|
if (taskId && outcome.failure && ["agent.send", "tool.call"].includes(operation)) {
|
|
111
111
|
const details = outcome.failure.details;
|
|
112
|
-
|
|
112
|
+
const refused = ["TOOL_TASK_FAILED", "INSUFFICIENT_CREDITS"].includes(outcome.failure.code)
|
|
113
|
+
|| ["audit_rejected", "input_audit_rejected", "output_audit_rejected"].includes(details?.reason ?? "");
|
|
114
|
+
const recovery = { ...details, cli_task_id: taskId };
|
|
115
|
+
if (outcome.exitCode !== 2 && !refused && details?.phase !== "input_upload_before_dispatch") {
|
|
116
|
+
recovery.next_steps = [
|
|
113
117
|
...(details?.next_steps ?? []),
|
|
114
118
|
`${options.product?.commandName ?? "gd-cli"} task get ${taskId}`,
|
|
115
|
-
options.product?.id === "insmind"
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
options.product?.id === "insmind"
|
|
120
|
+
? "If the outcome is still unknown, tell the user and keep this ID for recovery. Do not start another creation."
|
|
121
|
+
: "原任务结果仍未知时,向用户说明并保留此 ID 供取回。不要另发创作。"
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
outcome.failure.details = recovery;
|
|
118
125
|
}
|
|
119
126
|
const telemetryError = classifyTelemetryError(error, { aborted: isInterruption(error, options.signal),
|
|
120
127
|
operation: options.telemetry.creationContext().operation, failureStage: options.telemetry.failureStage(error), ...(options.product ? { product: options.product } : {}) });
|