@insmind/cli 2.1.7 → 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 +8 -5
- 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/mns-catalog-adapter.js +4 -4
- 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
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "EditorSaveResult",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": [
|
|
7
|
-
"workId",
|
|
8
|
-
"url"
|
|
9
|
-
],
|
|
10
|
-
"properties": {
|
|
11
|
-
"workId": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"minLength": 1,
|
|
14
|
-
"pattern": ".*\\S.*"
|
|
15
|
-
},
|
|
16
|
-
"url": {
|
|
17
|
-
"type": "string",
|
|
18
|
-
"format": "uri",
|
|
19
|
-
"minLength": 1,
|
|
20
|
-
"pattern": ".*\\S.*"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "EditorScreenshotResult",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": [
|
|
7
|
-
"path"
|
|
8
|
-
],
|
|
9
|
-
"properties": {
|
|
10
|
-
"path": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"minLength": 1,
|
|
13
|
-
"pattern": ".*\\S.*"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "EditorSnapshotResult",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": [
|
|
7
|
-
"elements",
|
|
8
|
-
"selectedIds"
|
|
9
|
-
],
|
|
10
|
-
"properties": {
|
|
11
|
-
"elements": {
|
|
12
|
-
"type": "array",
|
|
13
|
-
"items": {
|
|
14
|
-
"oneOf": [
|
|
15
|
-
{
|
|
16
|
-
"$ref": "#/$defs/EditorShape"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"$ref": "#/$defs/EditorConnector"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"selectedIds": {
|
|
25
|
-
"type": "array",
|
|
26
|
-
"items": {
|
|
27
|
-
"type": "string",
|
|
28
|
-
"minLength": 1,
|
|
29
|
-
"pattern": ".*\\S.*"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"$defs": {
|
|
34
|
-
"EditorShape": {
|
|
35
|
-
"title": "EditorShape",
|
|
36
|
-
"type": "object",
|
|
37
|
-
"additionalProperties": false,
|
|
38
|
-
"required": [
|
|
39
|
-
"_type",
|
|
40
|
-
"id",
|
|
41
|
-
"shapeType",
|
|
42
|
-
"x",
|
|
43
|
-
"y",
|
|
44
|
-
"w",
|
|
45
|
-
"h",
|
|
46
|
-
"fill",
|
|
47
|
-
"stroke"
|
|
48
|
-
],
|
|
49
|
-
"properties": {
|
|
50
|
-
"_type": {
|
|
51
|
-
"const": "shape"
|
|
52
|
-
},
|
|
53
|
-
"id": {
|
|
54
|
-
"type": "string",
|
|
55
|
-
"minLength": 1,
|
|
56
|
-
"pattern": ".*\\S.*"
|
|
57
|
-
},
|
|
58
|
-
"shapeType": {
|
|
59
|
-
"type": "string",
|
|
60
|
-
"enum": [
|
|
61
|
-
"rectangle",
|
|
62
|
-
"rounded-rectangle",
|
|
63
|
-
"triangle-up",
|
|
64
|
-
"ellipse",
|
|
65
|
-
"diamond"
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"x": {
|
|
69
|
-
"type": "number"
|
|
70
|
-
},
|
|
71
|
-
"y": {
|
|
72
|
-
"type": "number"
|
|
73
|
-
},
|
|
74
|
-
"w": {
|
|
75
|
-
"type": "number"
|
|
76
|
-
},
|
|
77
|
-
"h": {
|
|
78
|
-
"type": "number"
|
|
79
|
-
},
|
|
80
|
-
"text": {
|
|
81
|
-
"type": "string"
|
|
82
|
-
},
|
|
83
|
-
"fill": {
|
|
84
|
-
"type": "string",
|
|
85
|
-
"minLength": 1,
|
|
86
|
-
"pattern": ".*\\S.*"
|
|
87
|
-
},
|
|
88
|
-
"stroke": {
|
|
89
|
-
"anyOf": [
|
|
90
|
-
{
|
|
91
|
-
"type": "string",
|
|
92
|
-
"minLength": 1,
|
|
93
|
-
"pattern": ".*\\S.*"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"type": "null"
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"EditorConnector": {
|
|
103
|
-
"title": "EditorConnector",
|
|
104
|
-
"type": "object",
|
|
105
|
-
"additionalProperties": false,
|
|
106
|
-
"required": [
|
|
107
|
-
"_type",
|
|
108
|
-
"id",
|
|
109
|
-
"fromId",
|
|
110
|
-
"toId",
|
|
111
|
-
"lineType",
|
|
112
|
-
"color"
|
|
113
|
-
],
|
|
114
|
-
"properties": {
|
|
115
|
-
"_type": {
|
|
116
|
-
"const": "connector"
|
|
117
|
-
},
|
|
118
|
-
"id": {
|
|
119
|
-
"type": "string",
|
|
120
|
-
"minLength": 1,
|
|
121
|
-
"pattern": ".*\\S.*"
|
|
122
|
-
},
|
|
123
|
-
"fromId": {
|
|
124
|
-
"type": "string",
|
|
125
|
-
"minLength": 1,
|
|
126
|
-
"pattern": ".*\\S.*"
|
|
127
|
-
},
|
|
128
|
-
"toId": {
|
|
129
|
-
"type": "string",
|
|
130
|
-
"minLength": 1,
|
|
131
|
-
"pattern": ".*\\S.*"
|
|
132
|
-
},
|
|
133
|
-
"lineType": {
|
|
134
|
-
"type": "string",
|
|
135
|
-
"enum": [
|
|
136
|
-
"straight",
|
|
137
|
-
"elbowed"
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
"color": {
|
|
141
|
-
"type": "string",
|
|
142
|
-
"minLength": 1,
|
|
143
|
-
"pattern": ".*\\S.*"
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "ImageOcrInput",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": false,
|
|
6
|
-
"required": [
|
|
7
|
-
"model",
|
|
8
|
-
"image"
|
|
9
|
-
],
|
|
10
|
-
"properties": {
|
|
11
|
-
"model": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"const": "image-ocr"
|
|
14
|
-
},
|
|
15
|
-
"image": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"format": "uri"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"title": "OcrPayload",
|
|
4
|
-
"type": "object",
|
|
5
|
-
"additionalProperties": true,
|
|
6
|
-
"required": [
|
|
7
|
-
"image",
|
|
8
|
-
"blocks"
|
|
9
|
-
],
|
|
10
|
-
"properties": {
|
|
11
|
-
"image": {
|
|
12
|
-
"type": "object",
|
|
13
|
-
"additionalProperties": true,
|
|
14
|
-
"required": [
|
|
15
|
-
"uri",
|
|
16
|
-
"width",
|
|
17
|
-
"height"
|
|
18
|
-
],
|
|
19
|
-
"properties": {
|
|
20
|
-
"uri": {
|
|
21
|
-
"type": "string",
|
|
22
|
-
"format": "uri"
|
|
23
|
-
},
|
|
24
|
-
"width": {
|
|
25
|
-
"type": "integer",
|
|
26
|
-
"minimum": 1
|
|
27
|
-
},
|
|
28
|
-
"height": {
|
|
29
|
-
"type": "integer",
|
|
30
|
-
"minimum": 1
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"blocks": {
|
|
35
|
-
"type": "array",
|
|
36
|
-
"items": {
|
|
37
|
-
"type": "object",
|
|
38
|
-
"additionalProperties": true,
|
|
39
|
-
"required": [
|
|
40
|
-
"bbox",
|
|
41
|
-
"category"
|
|
42
|
-
],
|
|
43
|
-
"properties": {
|
|
44
|
-
"bbox": {
|
|
45
|
-
"type": "array",
|
|
46
|
-
"minItems": 4,
|
|
47
|
-
"maxItems": 4,
|
|
48
|
-
"items": {
|
|
49
|
-
"type": "number"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"category": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"minLength": 1,
|
|
55
|
-
"pattern": ".*\\S.*"
|
|
56
|
-
},
|
|
57
|
-
"text": {
|
|
58
|
-
"type": "string"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { hostSchema, readHostInput, editorActions } from "./host-input.js";
|
|
2
|
-
import { jsonOutput, bindAction, bindPreparedAction } from "./action-binding.js";
|
|
3
|
-
import { contractSchema } from "../contracts/schema.js";
|
|
4
|
-
import { CliUsageError } from "./errors.js";
|
|
5
|
-
import { productText as text } from "../product/text.js";
|
|
6
|
-
function editorApplyInputSchema() {
|
|
7
|
-
const { $defs, ...actionArray } = contractSchema("editor.apply", "input");
|
|
8
|
-
return {
|
|
9
|
-
type: "object", additionalProperties: false, required: ["actions"], properties: { actions: actionArray },
|
|
10
|
-
$defs: Object.fromEntries(Object.entries($defs)
|
|
11
|
-
.map(([name, definition]) => [name, { ...definition, additionalProperties: true }]))
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export function registerEditorCommands(program, runtime) {
|
|
15
|
-
const editor = program.command("editor")
|
|
16
|
-
.description(text(runtime.product, "连接并操作 AI+ Editor", "Connect to and operate insMind Editor"))
|
|
17
|
-
.helpCommand(false);
|
|
18
|
-
editor.addHelpText("after", [
|
|
19
|
-
"",
|
|
20
|
-
text(runtime.product, "对象是已连接作品中的元素。用户提供附件图片/媒体链接并要求改字、分层、矢量化或其他图片处理时,先从 tool list 发现能力;无需为了这些操作新建 Board。", "This group operates elements in a connected work. For attached images or media links needing text replacement, decomposition, vectorization or other processing, discover tool list first; these operations do not require a new Board."),
|
|
21
|
-
text(runtime.product, "操作一个当前 Session、当前 Page 的直属 Shape 和绑定 Connector;单操作者串行执行。", "Operate one current Session and its Page's direct Shapes and bound Connectors, serially with one operator."),
|
|
22
|
-
text(runtime.product, "元素类型与字段以 editor apply --schema 为准;Schema 查询无需登录或连接 Editor。", "Discover element types and fields with editor apply --schema; no login or Editor connection is required."),
|
|
23
|
-
text(runtime.product, "当前不支持嵌套元素、自由/半绑定 Connector、页面或选择修改;UNSUPPORTED_PAGE_CONTENT 时保留原作品并换用空白或专用 Page。", "Nested elements, free/half-bound Connectors, page and selection changes are unsupported. On UNSUPPORTED_PAGE_CONTENT, preserve the work and use a blank or dedicated Page."),
|
|
24
|
-
text(runtime.product, "流程:connect → snapshot → apply → snapshot/screenshot 复查 → 按用户授权 save → disconnect。apply 不代替 save。只预览/暂不保存时停在预览;用户要求断开就执行 disconnect,断开不隐含保存。", "Workflow: connect → snapshot → apply → review snapshot/screenshot → save as authorized → disconnect. Apply does not replace Save. For preview-only requests stop at preview; on a request to disconnect, execute disconnect without implicitly saving."),
|
|
25
|
-
text(runtime.product, "EDITOR_BUSY 时等待原命令结束;写入超时、取消或断连时,先重新连接同一作品并检查真实状态,不直接重试写入。", "On EDITOR_BUSY, wait for the original command. After a write times out, is cancelled or disconnects, reconnect to the same work and inspect its state before deciding what to do."),
|
|
26
|
-
""
|
|
27
|
-
].join("\n"));
|
|
28
|
-
const connect = leaf(editor.command("connect"))
|
|
29
|
-
.description(text(runtime.product, "打开并连接一个 AI+ Editor 作品", "Open and connect to an Editor work"))
|
|
30
|
-
.argument("[target]", text(runtime.product, "已有作品的 ID 或完整 URL;留空会新建线上 Board", "existing work ID or full URL; omitting it creates a new production Board"));
|
|
31
|
-
connect.addHelpText("after", [
|
|
32
|
-
"",
|
|
33
|
-
text(runtime.product, "继续已有作品时,传数字作品 ID 或完整 HTTP(S) URL。还没有目标就先向用户索取作品链接或 ID。用户要求新建时才省略 target。", "To continue an existing work, pass its numeric ID or supported insMind production Editor URL. If the target is missing, ask the user for the link or ID. Omit target only when the user requests a new Board."),
|
|
34
|
-
text(runtime.product, "会打开浏览器并替换旧 Session;浏览器登录、加载、Board 类型、编辑/保存权限与页面内容检查通过后才成功。CLI 登录不能替代浏览器登录。", "Opens the browser and replaces the old Session. Browser login, loading, Board type, edit/save permission and page-content checks must pass. CLI credentials do not replace browser login."),
|
|
35
|
-
text(runtime.product, "输出 JSON {target},不含连接凭证。连接失败时停止写入,让用户在页面处理登录或权限,再重新连接。", "Returns JSON {target} without connection credentials. On failure, stop writing and let the user resolve browser login or permissions before reconnecting."),
|
|
36
|
-
text(runtime.product, "页面切换作品会断开 Session;EDITOR_NOT_READY、EDITOR_SESSION_NOT_FOUND 或 EDITOR_NOT_CONNECTED 时确认目标后重连,不轮询旧 Session。", "Switching works disconnects the Session. On EDITOR_NOT_READY, EDITOR_SESSION_NOT_FOUND or EDITOR_NOT_CONNECTED, verify the target and reconnect instead of polling the old Session."),
|
|
37
|
-
""
|
|
38
|
-
].join("\n"));
|
|
39
|
-
jsonOutput(connect);
|
|
40
|
-
bindPreparedAction(connect, "none", async (signal) => {
|
|
41
|
-
signal.throwIfAborted();
|
|
42
|
-
const target = connect.processedArgs[0];
|
|
43
|
-
const input = typeof target === "string" ? { target } : {};
|
|
44
|
-
runtime.validators.editorConnectInput(input);
|
|
45
|
-
return { handled: false, input };
|
|
46
|
-
}, async (_context, input, signal) => {
|
|
47
|
-
const result = await runtime.telemetry.stage("editor.connect", () => runtime.editor.connect({ input, signal }));
|
|
48
|
-
writeJson(runtime, result);
|
|
49
|
-
});
|
|
50
|
-
const disconnect = leaf(editor.command("disconnect"))
|
|
51
|
-
.description(text(runtime.product, "断开当前 Editor 连接", "Disconnect the current Editor"));
|
|
52
|
-
disconnect.addHelpText("after", `\n${text(runtime.product, "输出 JSON {disconnected},解除当前 CLI 会话连接,不保存作品、不关闭浏览器页面。需要保留修改且已获保存授权时先 save;用户只要求断开或明确不保存时直接断开,并说明未保存状态。", "Returns JSON {disconnected}, ending the CLI session without saving the work or closing its browser page. Save first only when persistence is intended and authorized; if the user requests only disconnection or no save, disconnect and state what remains unsaved.")}\n`);
|
|
53
|
-
jsonOutput(disconnect);
|
|
54
|
-
bindAction(disconnect, "none", async (_context, signal) => {
|
|
55
|
-
writeJson(runtime, await runtime.telemetry.stage("editor.disconnect", () => runtime.editor.disconnect({ signal })));
|
|
56
|
-
});
|
|
57
|
-
const snapshot = leaf(editor.command("snapshot"))
|
|
58
|
-
.description(text(runtime.product, "读取当前作品快照", "Read the current work snapshot"));
|
|
59
|
-
snapshot.addHelpText("after", [
|
|
60
|
-
"",
|
|
61
|
-
text(runtime.product, "输出 JSON {elements, selectedIds};selectedIds 只读。元素字段和类型见 editor apply --schema。", "Returns JSON {elements, selectedIds}; selectedIds is read-only. Discover element fields and types with editor apply --schema."),
|
|
62
|
-
text(runtime.product, "修改时以最新 Snapshot 中的完整元素为基础;每次 apply 后重新读取。UNSUPPORTED_PAGE_CONTENT 时停止并保留原作品。", "Base changes on complete elements from the latest Snapshot and read again after every Apply. On UNSUPPORTED_PAGE_CONTENT, stop and preserve the work."),
|
|
63
|
-
""
|
|
64
|
-
].join("\n"));
|
|
65
|
-
jsonOutput(snapshot);
|
|
66
|
-
bindAction(snapshot, "none", async (_context, signal) => {
|
|
67
|
-
writeJson(runtime, await runtime.telemetry.stage("editor.snapshot", () => runtime.editor.snapshot({ signal })));
|
|
68
|
-
});
|
|
69
|
-
const apply = leaf(editor.command("apply"))
|
|
70
|
-
.description(text(runtime.product, "按顺序应用元素操作", "Apply element operations in order"))
|
|
71
|
-
.option("--schema", text(runtime.product, "输出输入 Schema,不执行操作", "output the input Schema without executing an operation"))
|
|
72
|
-
.option("--input <file|->", text(runtime.product, "从文件或标准输入读取 JSON", "read JSON from a file or stdin"));
|
|
73
|
-
apply.addHelpText("after", [
|
|
74
|
-
"",
|
|
75
|
-
text(runtime.product, "--schema 与 --input 必须且只能选择一个。Schema 为本地契约,不连接 Editor;执行成功输出 JSON {appliedCount}。", "Choose exactly one of --schema and --input. Schema reads the local contract without connecting to Editor; successful execution returns JSON {appliedCount}."),
|
|
76
|
-
text(runtime.product, "先保存完整 JSON,再用 --input request.json 执行;--input - 必须在同一条 shell 命令中经管道或重定向提供完整 JSON,不交互填参。", "Save complete JSON before using --input request.json. With --input -, pipe or redirect complete JSON in the same shell command; input is not an interactive form."),
|
|
77
|
-
text(runtime.product, "输入对象包含 host_application 和按序执行的 actions 数组;类型、必填字段与可选值见 --schema。使用简短语义 ID;create ID 必须唯一,Connector 可引用本批次更早创建的 Shape。", "Input is an object with host_application and an ordered actions array; discover types, required fields and choices with --schema. Use short semantic IDs. Create IDs must be unique; a Connector may reference a Shape created earlier in the batch."),
|
|
78
|
-
text(runtime.product, "update 提交完整元素而非 patch,不改变 id 或 _type。delete 要求 ID 存在;删除 Shape 同时删除绑定的 Connector。", "Update requires the full element, not a patch, without changing id or _type. Delete requires an existing ID; deleting a Shape also deletes its bound Connectors."),
|
|
79
|
-
text(runtime.product, "Shape 的 x/y 为 Page 左上角坐标,w/h 大于 0;数值必须有限。颜色用 #RRGGBB 或 #RRGGBBAA,仅 stroke 可为 null。Connector 用 fromId/toId 表达有方向的 Shape 关系。", "Shape x/y locate its top-left corner in Page coordinates; w/h must exceed zero and numbers must be finite. Colors use #RRGGBB or #RRGGBBAA; only stroke accepts null. Connector fromId/toId express a directed Shape relationship."),
|
|
80
|
-
text(runtime.product, "整批先预检,再在可回滚事务中应用;INVALID_ACTIONS 时修正输入,APPLY_FAILED 时读 Snapshot 确认回滚。EDITOR_ROLLBACK_FAILED 时停止 apply/save,只读检查并报告。", "The batch is checked before one rollback-capable transaction. Correct INVALID_ACTIONS; on APPLY_FAILED read a Snapshot to confirm rollback. On EDITOR_ROLLBACK_FAILED, stop apply/save, inspect read-only and report."),
|
|
81
|
-
text(runtime.product, "成功不表示已保存或视觉正确;读取新 Snapshot,涉及布局/文字/连线时查看截图。只预览时交付截图且不 save;需要持久化并已获授权时再显式 save。超时、取消或断连后先检查真实状态,不重复提交。", "Success proves neither persistence nor correct rendering. Read a new Snapshot and view a screenshot for layout/text/connectors. Deliver preview-only requests without save; explicitly save when persistence is intended and authorized. Inspect real state after timeout, cancellation or disconnection instead of resubmitting."),
|
|
82
|
-
""
|
|
83
|
-
].join("\n"));
|
|
84
|
-
jsonOutput(apply);
|
|
85
|
-
bindPreparedAction(apply, "none", async (signal) => {
|
|
86
|
-
signal.throwIfAborted();
|
|
87
|
-
const options = apply.opts();
|
|
88
|
-
if (Number(options.schema === true) + Number(options.input !== undefined) !== 1)
|
|
89
|
-
throw new CliUsageError();
|
|
90
|
-
if (options.schema === true) {
|
|
91
|
-
await runtime.telemetry.stage("output", () => { writeJson(runtime, hostSchema(runtime, editorApplyInputSchema())); });
|
|
92
|
-
return { handled: true };
|
|
93
|
-
}
|
|
94
|
-
const input = editorActions(readHostInput(runtime, await runtime.jsonInput.read(options.input, signal)));
|
|
95
|
-
return { handled: false, input };
|
|
96
|
-
}, async (_context, input, signal) => {
|
|
97
|
-
writeJson(runtime, await runtime.telemetry.stage("editor.apply", () => runtime.editor.apply({ input, signal })));
|
|
98
|
-
}, {
|
|
99
|
-
operation: "editor.apply",
|
|
100
|
-
mode: () => apply.opts().schema === true ? "schema" : "execute"
|
|
101
|
-
});
|
|
102
|
-
const screenshot = leaf(editor.command("screenshot"))
|
|
103
|
-
.description(text(runtime.product, "导出当前作品 PNG 截图", "Export a PNG screenshot of the current work"))
|
|
104
|
-
.option("--json", text(runtime.product, "输出 JSON", "output JSON"));
|
|
105
|
-
screenshot.addHelpText("after", `\n${text(runtime.product, "将当前作品截图写入本机 PNG;--json 输出 {path},path 为绝对路径。打开实际图片检查文字、布局与连线,不以文件存在代替视觉验收。", "Writes a PNG screenshot locally; --json returns {path} with an absolute path. View the actual image to check text, layout and connectors; file existence is not visual verification.")}\n`);
|
|
106
|
-
bindAction(screenshot, "none", async (_context, signal) => {
|
|
107
|
-
const result = await runtime.telemetry.stage("editor.screenshot", () => runtime.editor.screenshot({ signal }));
|
|
108
|
-
runtime.presenter.result(result, {
|
|
109
|
-
json: screenshot.opts().json === true,
|
|
110
|
-
view: value => text(runtime.product, `截图已保存至 ${value.path}`, `Screenshot saved to ${value.path}`)
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
const save = leaf(editor.command("save"))
|
|
114
|
-
.description(text(runtime.product, "保存当前 AI+ Editor 作品", "Save the current Editor work"))
|
|
115
|
-
.option("--json", text(runtime.product, "输出 JSON", "output JSON"));
|
|
116
|
-
save.addHelpText("after", [
|
|
117
|
-
"",
|
|
118
|
-
text(runtime.product, "等待真实持久化完成;--json 输出 {workId, url}。新 Board 首次保存创建作品 ID;原样交付公开 url,保留环境参数。", "Waits for real persistence; --json returns {workId, url}. A new Board gets its work ID on first save. Deliver the public url unchanged, retaining environment parameters."),
|
|
119
|
-
text(runtime.product, "Save 最长等待 5 分 30 秒,其他 Editor RPC 默认 1 分钟;继续等待原命令,保持串行。成功前不得报告已保存。", "Save waits up to 5 minutes 30 seconds; other Editor RPCs default to one minute. Keep waiting on the original command and run serially. Do not report persistence before success."),
|
|
120
|
-
text(runtime.product, "SAVE_FAILED 时保留 Session 并处理明确原因;超时、取消或断连不表示未保存,先重连同一作品检查真实状态。EDITOR_ROLLBACK_FAILED 时不得继续保存。", "On SAVE_FAILED retain the Session and resolve the stated cause. Timeout, cancellation or disconnection does not prove failure to save; reconnect to the same work and inspect first. Do not save after EDITOR_ROLLBACK_FAILED."),
|
|
121
|
-
""
|
|
122
|
-
].join("\n"));
|
|
123
|
-
bindAction(save, "none", async (_context, signal) => {
|
|
124
|
-
const result = await runtime.telemetry.stage("editor.save", () => runtime.editor.save({ signal }));
|
|
125
|
-
runtime.presenter.result(result, {
|
|
126
|
-
json: save.opts().json === true,
|
|
127
|
-
view: value => text(runtime.product, `作品已保存:${value.url}`, `Work saved: ${value.url}`)
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function leaf(command) {
|
|
132
|
-
return command.allowExcessArguments(false);
|
|
133
|
-
}
|
|
134
|
-
function writeJson(runtime, value) {
|
|
135
|
-
runtime.io.writeOut(`${JSON.stringify(value)}\n`);
|
|
136
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Agent creation
|
|
2
|
-
|
|
3
|
-
For delivery now, use the default synchronous command and keep waiting on the original host process handle. For later pickup, submit with `--async`, hand off the taskId and state on acceptance, and end the turn. For pickup or lost synchronous output, follow [task recovery](errors.md) using the original ID.
|
|
4
|
-
|
|
5
|
-
Read the input schema first. When specifying a model, also read its live detail:
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
insmind-cli agent send --schema
|
|
9
|
-
insmind-cli model list --tool <tool>
|
|
10
|
-
insmind-cli model get <model>
|
|
11
|
-
insmind-cli agent send --input request.json
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
For continued planning, generation or edits, copy `message.contextId` from the preceding result into the next request. Omit it for a new creation:
|
|
15
|
-
|
|
16
|
-
```json
|
|
17
|
-
{
|
|
18
|
-
"message": {
|
|
19
|
-
"contextId": "<message.contextId from the preceding result>",
|
|
20
|
-
"parts": [{ "text": "<the user's follow-up request>" }]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
completed means the turn has fully replied. Read `result.message.parts`: deliver actual assets, relay planning/confirmation text, or ask the user the returned `data.questions`. These are neither non-submission nor a guarantee that an image/video has been generated.
|
|
26
|
-
|
|
27
|
-
With the reply or assets, report this turn's actual credit charge from `usage.cost.amount`. Read the synchronous output or the completed task's `result`. Report 0 if present and unknown if absent. When totaling charges, count only actual usage from distinct taskIds. Repeated reads count once.
|
|
28
|
-
|
|
29
|
-
To answer structured questions, reuse `message.contextId`, put `message.messageId` in `data.questionMessageId`, and preserve each original question with the user’s values in answers. This data Part is the sole Part; see `agent send --schema` for the shape. Use a text Part for ordinary follow-up or confirmation. Ask for required user decisions instead of inventing them.
|
|
30
|
-
|
|
31
|
-
Put the user's request and confirmed information in Text Parts. Distinguish visible features from inferred materials or functions. Mark unverified details as pending confirmation and clarify when necessary. A previous model description is not automatically a user-confirmed fact. Keep the same factual boundaries in delivery copy; present style, audience and scene ideas as suggestions.
|
|
32
|
-
|
|
33
|
-
Before specifying a model, generation parameters or first/last frames, read [Generation constraints and media roles](generation-constraints.md).
|
|
34
|
-
|
|
35
|
-
Use complete JSON with `--input -` on stdin. Generate local media URIs as described in the Skill root.
|
|
36
|
-
|
|
37
|
-
Keep each URL Part's `url`, `filename`, local path and display name together as one record. Preserve that association through downloads, renames and reordering; do not pair results by request order. Before delivery, check that each final link's content matches its name. View the resource when its name is insufficient to identify it.
|
|
38
|
-
|
|
39
|
-
Each follow-up turn has a new taskId; reuse result.message.contextId for the conversation. Async Agent creation continues in a temporary local background process and is queried on the same machine. Ending the foreground wait does not cancel it. If the background process stops or the machine shuts down, the state may remain unknown; do not automatically submit again through another mode.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Authentication and credits
|
|
2
|
-
|
|
3
|
-
1. Check `insmind-cli auth status`; add `--json` for machine-readable status.
|
|
4
|
-
2. If signed out, run `insmind-cli auth login` and follow browser authorization. Use `--no-browser` when the browser cannot open automatically.
|
|
5
|
-
3. Read the current balance with `insmind-cli credits`.
|
|
6
|
-
4. If the user requests sign-out, run `insmind-cli auth logout`. For expired authentication, sign out and sign in again.
|
|
7
|
-
|
|
8
|
-
insMind uses the identity context supplied at login; it does not expose organization-selection commands. Do not invent organization IDs or use another product's credentials. Never ask the user for, or echo, Bearer tokens, cookies, access keys, secret keys or signatures.
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# Creation
|
|
2
|
-
|
|
3
|
-
## Requirements and inputs
|
|
4
|
-
|
|
5
|
-
Faithfully convey the user’s request, supplied materials and explicit constraints. When essential information or materials are missing, ask the user for clarification or pass the original request to the business Agent to assess and ask. Do not add instructions to generate replacement materials, disregard constraints or change the task’s objective without the user’s authorization. When the user explicitly permits free creation, illustrative materials or filling in missing details, work within that permission.
|
|
6
|
-
|
|
7
|
-
Judge whether the missing input affects the feasibility of the task, the identity of its subject or compliance with explicit requirements. Optional style preferences do not always require clarification.
|
|
8
|
-
|
|
9
|
-
For example, the user says “Make a promotional image for this product” without providing material that identifies the product:
|
|
10
|
-
|
|
11
|
-
- Correct: ask for the product image, or pass the original request to the business Agent so it can assess which materials are needed and ask.
|
|
12
|
-
- Incorrect: add “There is no original image, so generate an illustrative product first.” Labeling it a “concept” still changes the subject the user selected; obtain their choice first.
|
|
13
|
-
- Free creation differs: “Design a fictional product and make a promotional image” permits inventing the subject, so proceed. Unspecified colors or layouts can be designed as style details.
|
|
14
|
-
|
|
15
|
-
Deliver the existing result first. For a user-requested change, include their selected result as the new source. Use Agent for ongoing planning or a creative conversation.
|
|
16
|
-
|
|
17
|
-
## Choose a route
|
|
18
|
-
|
|
19
|
-
Choose the Creation Route before selecting or validating a Model. Both Agent and Tool accept models and parameters; `model list` and `model get` provide shared, live discovery.
|
|
20
|
-
|
|
21
|
-
- Agent: a business deliverable, clarification, planning, multiple steps or outputs, or continuation of existing work. The service selects its Business Skill.
|
|
22
|
-
- Tool: one atomic operation without business orchestration, discovered through `tool list`, or an explicit request to call an available Tool directly.
|
|
23
|
-
|
|
24
|
-
For Tool tasks, discover `image.generate` / `video.generate` for new images/videos or complete recreation from references. Use [image and video tool selection](media-tools.md) for purpose-specific processing of existing media. A reference image does not by itself require `image.edit`; multiple internal stages do not by themselves require a business Agent.
|
|
25
|
-
|
|
26
|
-
Match these business intents by meaning:
|
|
27
|
-
|
|
28
|
-
| Intent | Typical requests | Inputs and boundaries |
|
|
29
|
-
| --- | --- | --- |
|
|
30
|
-
| Ecommerce main images | Product images, a set of main images, product-image design | Usually includes a product photo; distinguish scene images, posters, detail pages, packaging and multiple angles |
|
|
31
|
-
| Ecommerce detail page | Product detail page, long image, selling points, parameters, features, comparisons, reasons to buy | Usually includes a product photo; a detail page is distinct from a main-image set |
|
|
32
|
-
| Product retouching | Retouch, restore, white background, remove signs of use | Requires an actual product photo; adding text, watermark removal, cutouts, local edits, posters and reference-layout imitation are different intents |
|
|
33
|
-
| Ecommerce models | Try-on, wearing, replace model, pose or background | Product photo optional; model-only generation is possible |
|
|
34
|
-
| Product scene image | Create a scene, change a background, combine products in a setting | Requires a product photo; portraits, landscapes, design drafts and text-led main images are different intents |
|
|
35
|
-
| Themed portrait | Themed photo, stylized portrait | Portrait input optional |
|
|
36
|
-
| Professional portrait | Headshot, professional profile | Portrait input optional |
|
|
37
|
-
| ID photo | ID/application photo, change background or dimensions | Portrait input optional |
|
|
38
|
-
| Ecommerce image prompts | Write prompts for product or main images | Subject to current service availability |
|
|
39
|
-
| Ecommerce video prompts | Product promotion or sales video prompts | Subject to current service availability |
|
|
40
|
-
|
|
41
|
-
These examples select the route, not a specific server Skill or a guarantee of service availability. Missing required media does not change a business task into a Tool task: use Agent and ask for the media. A specified model, resolution, aspect ratio or duration does not change the route either.
|
|
42
|
-
|
|
43
|
-
For example, a main-image set using a named model still uses Agent; planning three styles and generating each uses Agent; a single cat image using a named model uses Tool. Follow an explicit user request to use a Tool directly.
|
|
44
|
-
|
|
45
|
-
Never guess tool names, model names or parameters. For recommendations, capabilities, parameters or credit prices, first filter with `model list`, then inspect `model get`.
|
|
46
|
-
|
|
47
|
-
## Read the selected route
|
|
48
|
-
|
|
49
|
-
- Before an Agent request, read [Agent creation](agent.md) for new work, continuation, waiting and delivery.
|
|
50
|
-
- Before a Tool call, read [Tool creation](tool.md) and build arguments from the selected model detail.
|
|
51
|
-
|
|
52
|
-
## Local media
|
|
53
|
-
|
|
54
|
-
Use the attachment, named file or prior result explicitly selected in this turn. Otherwise choose the most recent relevant result in the current creation. When building or reusing request JSON, check every resource URL/path, name and role against the current target; updating only the text is insufficient. Preserve the matching `message.contextId` when continuing an Agent creation.
|
|
55
|
-
|
|
56
|
-
For Agent, put each media file in a separate URL Part. For Tool, use the media parameter defined in model detail. Generate standard file URIs as described in the Skill root, retaining source/reference/frame roles, order and repeated references. The CLI uploads local media through DAM internally and sends the resulting URL to the creation service. Do not invent URLs or read paths the user has not authorized.
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# DAM asset management
|
|
2
|
-
|
|
3
|
-
## Discover before acting
|
|
4
|
-
|
|
5
|
-
Read `insmind-cli dam --help` to choose an available operation, then its subcommand's `--help` before use. The paths below are common examples, not exhaustive command or parameter lists.
|
|
6
|
-
|
|
7
|
-
Before repository-scoped reads or writes, run:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
insmind-cli dam repository list --json
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Use only returned `repositories[].repository_id` values. Do not guess IDs from names, frontend URLs, entity IDs or old results. There is no repository-switch command.
|
|
14
|
-
|
|
15
|
-
Discover folders and tags when needed:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
insmind-cli dam folder list --repository-id <id> --json
|
|
19
|
-
insmind-cli dam tag list --repository-id <id> --json
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Discover folder/tag filters and pagination in their `--help`. The root folder ID is `0`; explicitly pass `--target-folder-id 0` for a root destination rather than relying on omission.
|
|
23
|
-
|
|
24
|
-
## Find and download
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
insmind-cli dam list --repository-id <id> --json
|
|
28
|
-
insmind-cli dam search <query> --repository-id <id> --json
|
|
29
|
-
insmind-cli dam get <asset-id> --json
|
|
30
|
-
insmind-cli dam download <asset-id> --repository-id <id> --output-dir ./downloads --json
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Use `--all-repositories` only when the user explicitly requests a cross-repository query. Discover filters, download scope and local-file handling from the selected command's `--help`; keep the user's resource scope intact.
|
|
34
|
-
|
|
35
|
-
## Writes and authorization
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
insmind-cli dam upload ./asset.png --repository-id <id> --folder-id <folder-id> --tag-ids <tag-id> --json
|
|
39
|
-
insmind-cli dam rename <entry-id> --kind asset --title <new-title> --repository-id <id> --json
|
|
40
|
-
insmind-cli dam copy <entry-id> --kind asset --repository-id <source-id> --target-repository-id <target-id> --target-folder-id <folder-id> --json
|
|
41
|
-
insmind-cli dam move <entry-id> --kind asset --repository-id <source-id> --target-repository-id <target-id> --target-folder-id <folder-id> --json
|
|
42
|
-
insmind-cli dam delete <asset-id> --repository-id <id>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
- Discover entry kinds and per-operation scope in `--help`; examples are not an exhaustive capability list and do not authorize broader writes.
|
|
46
|
-
- Use `--allow-sensitive-path` for protected uploads only with explicit user authorization. Use `--wait-analysis` when analysis must finish.
|
|
47
|
-
- A successful copy can omit `copied_entry_id`. Discover the copy in the destination; do not guess its ID or copy again.
|
|
48
|
-
- If move, copy or rename was submitted but remains unconfirmed, inspect the destination and report its diagnostic ID before considering further action.
|
|
49
|
-
- Delete moves an asset to the recycle bin by default. Use `--permanent` only when explicitly requested.
|
|
50
|
-
- For recycle-bin or other operations not illustrated here, check `insmind-cli dam --help`. Report missing capabilities instead of guessing commands.
|
|
51
|
-
|
|
52
|
-
Before writing, establish the repository, entry ID, kind and destination from current output and user intent. Do not substitute guessed IDs from local login state or old results.
|