@insmind/cli 1.9.1 → 2.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/dist/bin/insmind-cli.js +2 -2
- package/dist/src/bootstrap/create-cli.js +9 -14
- package/dist/src/bootstrap/create-runtime.js +26 -16
- package/dist/src/bootstrap/run-task-worker.js +2 -1
- package/dist/src/bootstrap/validators.js +4 -2
- package/dist/src/cli/action-binding.js +39 -0
- package/dist/src/cli/agent-commands.js +8 -12
- package/dist/src/cli/dam-commands.js +3 -2
- package/dist/src/cli/editor-commands.js +10 -5
- package/dist/src/cli/host-input.js +34 -0
- package/dist/src/cli/model-commands.js +4 -3
- package/dist/src/cli/tool-commands.js +7 -9
- package/dist/src/contracts/creation-input.js +20 -0
- package/dist/src/features/agent/creative-protocol.js +12 -14
- package/dist/src/features/agent/use-cases.js +6 -31
- package/dist/src/features/auth/access-policy.js +1 -3
- package/dist/src/features/auth/sso-service.js +6 -4
- package/dist/src/features/auth/use-cases.js +2 -1
- package/dist/src/features/credits/use-cases.js +1 -1
- package/dist/src/features/dam/file-downloader.js +2 -1
- package/dist/src/features/dam/use-cases.js +7 -7
- package/dist/src/features/editor/bridge-client.js +1 -1
- package/dist/src/features/editor/use-cases.js +6 -8
- package/dist/src/features/org/use-cases.js +3 -3
- package/dist/src/features/skill/installer.js +24 -22
- package/dist/src/features/task/store.js +26 -12
- package/dist/src/features/task/use-cases.js +97 -82
- package/dist/src/features/tool/canvas-models.js +21 -4
- package/dist/src/features/tool/canvas-tool-adapter.js +29 -20
- package/dist/src/features/tool/canvas-video.js +2 -4
- package/dist/src/features/tool/dynamic-schema.js +29 -64
- package/dist/src/features/tool/mns-catalog-adapter.js +9 -2
- package/dist/src/features/tool/scene-catalog-adapter.js +0 -1
- package/dist/src/features/tool/tool-api-adapter.js +2 -2
- package/dist/src/features/tool/use-cases.js +24 -35
- package/dist/src/platform/json-input.js +1 -1
- package/dist/src/platform/safe-upload-file.js +6 -0
- package/dist/src/platform/signed-http-transport.js +24 -27
- package/dist/src/telemetry/host-diagnostics.js +2 -2
- package/dist/src/telemetry/invocation.js +87 -24
- package/dist/src/telemetry/process-errors.js +36 -3
- package/dist/src/telemetry/sls-sink.js +7 -10
- package/package.json +4 -4
- package/skills/insmind-cli/SKILL.md +1 -0
- package/skills/insmind-cli/references/editor.md +1 -1
- package/skills/insmind-cli/references/generation-constraints.md +3 -1
- package/skills/insmind-cli/references/tool.md +2 -3
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { cleanDiagnostic, errorEvidence } from "./sanitize.js";
|
|
2
2
|
import { isInterruption } from "../platform/interruption.js";
|
|
3
3
|
import { safeFailureSummary } from "./failure-summary.js";
|
|
4
|
-
|
|
4
|
+
export function hostName(value) {
|
|
5
|
+
return typeof value === "string" && value.trim() ? value.trim().slice(0, 128) : undefined;
|
|
6
|
+
}
|
|
5
7
|
export function hostTelemetryContext(env) {
|
|
6
8
|
return {
|
|
7
|
-
|
|
8
|
-
? { host_application: env.CLI_HOST_APPLICATION } : {}),
|
|
9
|
+
host_application: hostName(env.CLI_HOST_APPLICATION) ?? "unknown",
|
|
9
10
|
...(["auth_status", "version_check"].includes(env.CLI_INVOCATION_PURPOSE ?? "")
|
|
10
11
|
? { invocation_purpose: env.CLI_INVOCATION_PURPOSE } : {}),
|
|
11
12
|
...(/^[a-f0-9]{32}$/u.test(env.CLI_HOST_INVOCATION_ID ?? "") ? { host_invocation_id: env.CLI_HOST_INVOCATION_ID } : {}),
|
|
@@ -25,22 +26,30 @@ export function createTelemetryInvocation(options) {
|
|
|
25
26
|
const traceId = options.traceIdFactory();
|
|
26
27
|
const startedAt = options.startedAt ?? options.now();
|
|
27
28
|
let definition;
|
|
29
|
+
let issued = false;
|
|
30
|
+
let nextStep = "request_sent";
|
|
28
31
|
let finished = false;
|
|
29
32
|
let signal;
|
|
30
33
|
let sequence = 0;
|
|
31
34
|
const context = {};
|
|
32
35
|
const events = [];
|
|
36
|
+
const steps = new Map();
|
|
33
37
|
const published = new Set();
|
|
34
38
|
const failures = [];
|
|
35
|
-
function
|
|
39
|
+
function identity() {
|
|
36
40
|
const mode = definition?.mode?.();
|
|
37
|
-
|
|
41
|
+
const creation = mode === "execute" && (definition?.operation === "agent.send" || definition?.operation === "tool.call");
|
|
42
|
+
return { host_application: context.host_application ?? "unknown", schema_version: "6", started_at_ms: startedAt, command_kind: creation ? "creation" : "technical", cli_name: options.cliName ?? "gd-cli",
|
|
38
43
|
env: options.env ?? "production", process_role: options.processRole ?? "cli",
|
|
39
|
-
trace_id: traceId,
|
|
44
|
+
trace_id: traceId,
|
|
40
45
|
operation: definition?.operation ?? "unknown", ...(mode ? { mode } : {}),
|
|
41
46
|
cli_version: options.cliVersion, os: options.runtime.os, arch: options.runtime.arch,
|
|
42
47
|
node_major: options.runtime.nodeMajor };
|
|
43
48
|
}
|
|
49
|
+
function base() {
|
|
50
|
+
const { parameters: _input, ...diagnostics } = context;
|
|
51
|
+
return { ...diagnostics, ...identity(), record_seq: ++sequence, occurred_at_ms: options.now() };
|
|
52
|
+
}
|
|
44
53
|
function classify(error) {
|
|
45
54
|
return isInterruption(error, signal) ? { outcome: "interrupted" } : options.classifyError(error);
|
|
46
55
|
}
|
|
@@ -66,17 +75,35 @@ export function createTelemetryInvocation(options) {
|
|
|
66
75
|
}
|
|
67
76
|
function remember(event) {
|
|
68
77
|
const safe = cleanDiagnostic(event);
|
|
78
|
+
if (safe.event_name === "command_step") {
|
|
79
|
+
const key = `${safe.trace_id}/${safe.step}`;
|
|
80
|
+
const first = steps.get(key);
|
|
81
|
+
if (first)
|
|
82
|
+
return first;
|
|
83
|
+
steps.set(key, safe);
|
|
84
|
+
}
|
|
69
85
|
events.push(safe);
|
|
70
86
|
return safe;
|
|
71
87
|
}
|
|
88
|
+
function observeStep(step) {
|
|
89
|
+
if (step === "request_sent")
|
|
90
|
+
nextStep = "result_received";
|
|
91
|
+
if (step === "result_received")
|
|
92
|
+
nextStep = "delivered";
|
|
93
|
+
if (step === "delivered")
|
|
94
|
+
nextStep = undefined;
|
|
95
|
+
}
|
|
72
96
|
async function publish(event) {
|
|
73
97
|
if (!options.onEvent)
|
|
74
|
-
return;
|
|
98
|
+
return false;
|
|
75
99
|
try {
|
|
76
|
-
if (await options.onEvent(event) !== false)
|
|
100
|
+
if (await options.onEvent(event) !== false) {
|
|
77
101
|
published.add(event);
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
78
104
|
}
|
|
79
105
|
catch { /* Logging cannot fail the operation. */ }
|
|
106
|
+
return false;
|
|
80
107
|
}
|
|
81
108
|
return {
|
|
82
109
|
traceId,
|
|
@@ -86,7 +113,19 @@ export function createTelemetryInvocation(options) {
|
|
|
86
113
|
&& definition.mode?.() === "execute";
|
|
87
114
|
return `00-${traceId}-${options.spanIdFactory()}-${paid ? "01" : "00"}`;
|
|
88
115
|
},
|
|
89
|
-
select(next) {
|
|
116
|
+
select(next) { if (!issued)
|
|
117
|
+
definition = next; },
|
|
118
|
+
async issue(next) {
|
|
119
|
+
if (issued)
|
|
120
|
+
return;
|
|
121
|
+
issued = true;
|
|
122
|
+
definition = next;
|
|
123
|
+
await publish(remember({ ...base(), occurred_at_ms: startedAt, event_name: "command_step", step: "issued", outcome: "success" }));
|
|
124
|
+
},
|
|
125
|
+
observeHost(value) {
|
|
126
|
+
if (!context.host_application || context.host_application === "unknown")
|
|
127
|
+
context.host_application = hostName(value) ?? "unknown";
|
|
128
|
+
},
|
|
90
129
|
useSignal(next) { signal = next; },
|
|
91
130
|
annotate(annotation) {
|
|
92
131
|
for (const [key, value] of Object.entries(annotation)) {
|
|
@@ -105,10 +144,23 @@ export function createTelemetryInvocation(options) {
|
|
|
105
144
|
}
|
|
106
145
|
},
|
|
107
146
|
creationContext() {
|
|
108
|
-
|
|
109
|
-
|
|
147
|
+
// Background work and later queries retain the originating invocation's dimensions.
|
|
148
|
+
const snapshot = identity();
|
|
149
|
+
const keys = ["host_invocation_id", "host_connector_version", "installation_owner", "invocation_purpose",
|
|
150
|
+
"account_id", "organization_id", "tool_name", "model_id", "content_id", "task_id", "dify_task_id",
|
|
151
|
+
"cli_task_id", "execution_mode", "parameters"];
|
|
152
|
+
for (const key of keys) {
|
|
153
|
+
if (context[key] !== undefined)
|
|
154
|
+
Object.assign(snapshot, { [key]: context[key] });
|
|
155
|
+
}
|
|
156
|
+
return cleanDiagnostic(snapshot);
|
|
157
|
+
},
|
|
158
|
+
observeStep,
|
|
159
|
+
async emit(event) {
|
|
160
|
+
if (event.trace_id === traceId || event.trace_id === context.creation_trace_id)
|
|
161
|
+
observeStep(event.step);
|
|
162
|
+
return publish(remember(event));
|
|
110
163
|
},
|
|
111
|
-
async emit(event) { await publish(remember(event)); },
|
|
112
164
|
taskFailure(error) {
|
|
113
165
|
const c = classify(error);
|
|
114
166
|
const summary = { ...context.diagnostic_summary, ...c.diagnosticSummary };
|
|
@@ -145,18 +197,29 @@ export function createTelemetryInvocation(options) {
|
|
|
145
197
|
if (finished || !definition)
|
|
146
198
|
return [];
|
|
147
199
|
finished = true;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
...(completion.
|
|
158
|
-
...(
|
|
159
|
-
|
|
200
|
+
const last = base();
|
|
201
|
+
if (completion.outcome === "success" && issued && last.command_kind === "technical") {
|
|
202
|
+
remember({ ...last, event_name: "command_step", step: "delivered", outcome: "success",
|
|
203
|
+
...(context.parameters ? { parameters: context.parameters } : {}) });
|
|
204
|
+
}
|
|
205
|
+
else if (completion.outcome !== "success" || !issued) {
|
|
206
|
+
const failedStep = last.command_kind === "technical" ? "delivered" : nextStep;
|
|
207
|
+
const stage = completion.outcome === "success" ? "process" : classify(completion.error).failureStage ?? failureStage(completion.error) ?? "command";
|
|
208
|
+
remember({ ...last, event_name: "stage_finished", stage, outcome: completion.outcome,
|
|
209
|
+
...(completion.outcome !== "success" && failedStep ? { failed_step: failedStep } : {}),
|
|
210
|
+
...(context.parameters && (!issued || last.command_kind === "technical") ? { parameters: context.parameters } : {}),
|
|
211
|
+
duration_ms: Math.max(0, options.now() - startedAt),
|
|
212
|
+
...(completion.outcome === "success" ? {} : {
|
|
213
|
+
failure_stage: classify(completion.error).failureStage ?? failureStage(completion.error) ?? "unknown"
|
|
214
|
+
}),
|
|
215
|
+
...(completion.outcome === "failure" ? errorFields(completion.error) : completion.outcome === "interrupted" && completion.error !== undefined ? errorEvidence(completion.error) : {}),
|
|
216
|
+
...(completion.outcome === "failure" ? {
|
|
217
|
+
error_code: completion.errorCode, error_message: completion.errorMessage,
|
|
218
|
+
...(completion.httpStatus === undefined ? {} : { http_status: completion.httpStatus }),
|
|
219
|
+
...(completion.remoteErrorCode === undefined ? {} : { remote_error_code: completion.remoteErrorCode }),
|
|
220
|
+
...(completion.remoteErrorBody === undefined ? {} : { remote_error_body: completion.remoteErrorBody })
|
|
221
|
+
} : {}) });
|
|
222
|
+
}
|
|
160
223
|
return events.filter(event => !published.has(event));
|
|
161
224
|
}
|
|
162
225
|
};
|
|
@@ -1,13 +1,43 @@
|
|
|
1
1
|
import { classifyTelemetryError, mapCliError } from "../cli/errors.js";
|
|
2
2
|
import { isInterruption } from "../platform/interruption.js";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
|
-
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { readFile, readdir } from "node:fs/promises";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import { gaodingProduct, insmindProduct } from "../product/config.js";
|
|
9
9
|
import { createTelemetryInvocation, hostTelemetryContext } from "./invocation.js";
|
|
10
10
|
import { createSlsTelemetrySink } from "./sls-sink.js";
|
|
11
|
+
// The CLI module graph may not be loadable. Use packaged operation names only,
|
|
12
|
+
// so a user-supplied positional argument can never become an SLS operation name.
|
|
13
|
+
async function bootstrapDefinition(argv) {
|
|
14
|
+
const names = new Set(["agent.send", "tool.call", "editor.apply", "auth.login", "auth.logout", "org.switch", "credits", "update"]);
|
|
15
|
+
const contracts = new URL("../../../contracts/operations/", import.meta.url);
|
|
16
|
+
for (const name of await readdir(contracts).catch(() => []))
|
|
17
|
+
names.add(name);
|
|
18
|
+
const path = [];
|
|
19
|
+
let mode = "execute";
|
|
20
|
+
for (let i = 0; i < argv.length; i++) {
|
|
21
|
+
const token = argv[i];
|
|
22
|
+
if (token === "--")
|
|
23
|
+
break;
|
|
24
|
+
if (token === "--input" || token === "--locale") {
|
|
25
|
+
i++;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (token === "--help" || token === "-h")
|
|
29
|
+
mode = "help";
|
|
30
|
+
else if (token === "--version" || token === "-V")
|
|
31
|
+
mode = "version";
|
|
32
|
+
else if (token === "--schema" && mode === "execute")
|
|
33
|
+
mode = "schema";
|
|
34
|
+
else if (!token.startsWith("-") && !names.has(path.join(".")) && path.length < 3)
|
|
35
|
+
path.push(token);
|
|
36
|
+
}
|
|
37
|
+
const name = path.join(".");
|
|
38
|
+
const operation = mode === "version" ? "version" : names.has(name) ? name : !name && mode === "help" ? "help" : "bootstrap";
|
|
39
|
+
return { operation, mode: () => mode };
|
|
40
|
+
}
|
|
11
41
|
/** Independent fallback for entrypoints which cannot construct the full runtime. */
|
|
12
42
|
export async function reportProcessError(error, options) {
|
|
13
43
|
try {
|
|
@@ -34,8 +64,11 @@ export async function reportProcessError(error, options) {
|
|
|
34
64
|
traceIdFactory: () => options.traceId ?? randomBytes(16).toString("hex"), spanIdFactory: () => randomBytes(8).toString("hex"),
|
|
35
65
|
runtime: { os: process.platform, arch: process.arch, nodeMajor: Number(process.versions.node.split(".")[0]) },
|
|
36
66
|
classifyError: () => classification });
|
|
37
|
-
|
|
67
|
+
const definition = options.argv ? await bootstrapDefinition(options.argv) : { operation: options.operation };
|
|
68
|
+
telemetry.select(definition);
|
|
38
69
|
telemetry.annotate(hostTelemetryContext(process.env));
|
|
70
|
+
if ((options.processRole ?? "cli") === "cli")
|
|
71
|
+
await telemetry.issue(definition);
|
|
39
72
|
const events = telemetry.finish(mapped.kind === "interrupted" ? { outcome: "interrupted", error } : {
|
|
40
73
|
outcome: "failure", error, errorCode: mapped.failure.code, errorMessage: mapped.failure.message,
|
|
41
74
|
...(classification.httpStatus === undefined ? {} : { httpStatus: classification.httpStatus }),
|
|
@@ -43,7 +76,7 @@ export async function reportProcessError(error, options) {
|
|
|
43
76
|
...(classification.remoteErrorBody === undefined ? {} : { remoteErrorBody: classification.remoteErrorBody })
|
|
44
77
|
});
|
|
45
78
|
const sink = createSlsTelemetrySink({ fetch: globalThis.fetch, trackingUrl: options.trackingUrl ?? product.telemetryUrl,
|
|
46
|
-
directory: join(options.homeDirectory ?? homedir(), product.stateDirectory, "telemetry") });
|
|
79
|
+
directory: join(options.homeDirectory ?? homedir(), product.stateDirectory, "telemetry", "v6") });
|
|
47
80
|
// Automated process tests persist to their temporary home, without external traffic.
|
|
48
81
|
if (process.env.NODE_ENV === "test" || process.env.VITEST)
|
|
49
82
|
await sink.enqueue?.(events);
|
|
@@ -9,11 +9,9 @@ const TTL = 7 * 86_400_000;
|
|
|
9
9
|
const CAPACITY = 10 * 1024 * 1024;
|
|
10
10
|
const BUDGET = 2_000;
|
|
11
11
|
export function eventKey(event) {
|
|
12
|
-
const key = event.event_name === "
|
|
13
|
-
? [event.cli_name, event.env, event.
|
|
14
|
-
: event.
|
|
15
|
-
? [event.cli_name, event.env, event.cli_task_id, event.event_name]
|
|
16
|
-
: [event.cli_name, event.env, event.trace_id, event.process_role, Number(event.record_seq)];
|
|
12
|
+
const key = event.event_name === "command_step"
|
|
13
|
+
? [event.cli_name, event.env, event.trace_id, event.step]
|
|
14
|
+
: [event.cli_name, event.env, event.trace_id, event.process_role, Number(event.record_seq)];
|
|
17
15
|
return createHash("sha256").update(JSON.stringify(key)).digest("hex");
|
|
18
16
|
}
|
|
19
17
|
export function wireEvent(event) {
|
|
@@ -25,7 +23,7 @@ export function wireEvent(event) {
|
|
|
25
23
|
else
|
|
26
24
|
delete safe.diagnostic_summary;
|
|
27
25
|
}
|
|
28
|
-
const wire = {};
|
|
26
|
+
const wire = { event_id: eventKey(safe) };
|
|
29
27
|
for (const [key, value] of Object.entries(safe)) {
|
|
30
28
|
if (value !== undefined)
|
|
31
29
|
wire[key] = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
@@ -100,8 +98,7 @@ export function createSlsTelemetrySink(options) {
|
|
|
100
98
|
const value = rawStatus;
|
|
101
99
|
const count = (key) => typeof value[key] === "number" && Number.isSafeInteger(value[key]) && value[key] >= 0 ? value[key] : 0;
|
|
102
100
|
status = { count: count("count"), delivery_failures: count("delivery_failures"),
|
|
103
|
-
...(["interrupted_write", "corrupt", "expired", "capacity", "http_rejected"].includes(String(value.reason)) ? { reason: value.reason }
|
|
104
|
-
: /^http_4\d\d$/u.test(String(value.reason)) ? { reason: "http_rejected" } : {}),
|
|
101
|
+
...(["interrupted_write", "corrupt", "expired", "capacity", "http_rejected"].includes(String(value.reason)) ? { reason: value.reason } : {}),
|
|
105
102
|
...(["accepted", "http_rejected", "http_retryable", "network_error"].includes(String(value.result)) ? { result: value.result } : {}),
|
|
106
103
|
...(typeof value.http_status === "number" && value.http_status >= 100 && value.http_status <= 599 ? { http_status: value.http_status } : {}),
|
|
107
104
|
...(count("first_at_ms") ? { first_at_ms: count("first_at_ms") } : {}),
|
|
@@ -121,7 +118,7 @@ export function createSlsTelemetrySink(options) {
|
|
|
121
118
|
const raw = await readFile(join(options.directory, name), "utf8");
|
|
122
119
|
try {
|
|
123
120
|
const entry = JSON.parse(raw);
|
|
124
|
-
if (!Number.isFinite(entry.queuedAt) || !entry.event || eventKey(entry.event) !== name.slice(0, -5))
|
|
121
|
+
if (entry.event?.schema_version !== "6" || !Number.isFinite(entry.queuedAt) || !entry.event || eventKey(entry.event) !== name.slice(0, -5))
|
|
125
122
|
throw new Error();
|
|
126
123
|
entries.set(name.slice(0, -5), entry);
|
|
127
124
|
}
|
|
@@ -160,7 +157,7 @@ export function createSlsTelemetrySink(options) {
|
|
|
160
157
|
}
|
|
161
158
|
}
|
|
162
159
|
let size = [...entries.values()].reduce((sum, e) => sum + Buffer.byteLength(JSON.stringify(e)), 0);
|
|
163
|
-
const priority = (e) => e.event.event_name === "
|
|
160
|
+
const priority = (e) => e.event.event_name === "command_step" ? 2
|
|
164
161
|
: e.event.event_name === "host_diagnostic" || "outcome" in e.event && e.event.outcome !== "success" ? 1 : 0;
|
|
165
162
|
for (const [id, entry] of [...entries].sort((a, b) => priority(a[1]) - priority(b[1]) || a[1].queuedAt - b[1].queuedAt)) {
|
|
166
163
|
checkBudget(deadline);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@insmind/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "insMind command-line interface for agents and people.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@gaoding/cli": "workspace:*"
|
|
48
48
|
},
|
|
49
49
|
"gaodingRelease": {
|
|
50
|
-
"sourceCommit": "
|
|
51
|
-
"pipelineId": "
|
|
52
|
-
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/
|
|
50
|
+
"sourceCommit": "216c910373e0a89ff902e655f3cda89cae32887b",
|
|
51
|
+
"pipelineId": "241612",
|
|
52
|
+
"pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/241612"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -7,6 +7,7 @@ description: Use when creating images, videos or text with insMind CLI, operatin
|
|
|
7
7
|
|
|
8
8
|
## Discover current capabilities on demand
|
|
9
9
|
|
|
10
|
+
- For `agent send`, `tool call` and `editor apply`, set the top-level `host_application` in the input JSON to the calling app, for example `workbuddy`, `qwenwork` or `trae`. Use `terminal` for direct terminal use.
|
|
10
11
|
- Check `insmind-cli --version` on first use. If the entry point is unclear, read `insmind-cli --help`, follow the relevant command group, then read the chosen command's `--help` before execution. Examples here are not an exhaustive capability list.
|
|
11
12
|
- For structured input, query `--schema` only where the command exposes it. Discover models, parameter choices, prices and resource IDs through current lists/details rather than old examples. Report missing support or failed discovery without silently replacing explicit user constraints.
|
|
12
13
|
- Reuse help and static Schema within the same session and CLI path/version; refresh after changing the CLI. Query dynamic metadata when selecting capabilities or quoting prices for this task, and refresh relevant results after identity changes or an explicit mismatch. Avoid unrelated catalog scans.
|
|
@@ -20,7 +20,7 @@ Completion requires structural and visual verification followed by a successful
|
|
|
20
20
|
|
|
21
21
|
1. Read `insmind-cli editor connect --help` and choose `insmind-cli editor connect [target]` for the user's intended work. Do not omit the target and create a Board when recovering an existing work. Browser login, loading, edit/save permissions and content checks must pass; stop editing on connection failure.
|
|
22
22
|
2. Read `insmind-cli editor snapshot`. Base changes on complete elements from the latest Snapshot and change only intended fields. Submit full Updates, never patches.
|
|
23
|
-
3. Build
|
|
23
|
+
3. Build an object with `host_application` and an ordered `actions` array from the Schema and Snapshot. Run `insmind-cli editor apply --input actions.json`, or use `--input -` for stdin. Use short semantic IDs; Connector direction and targets must preserve business relationships.
|
|
24
24
|
4. Read a fresh Snapshot after every Apply. For layout, text or Connector changes, run `insmind-cli editor screenshot --json` and view the actual PNG at its absolute `path`. A file's existence or an accepted Action does not prove correct rendering.
|
|
25
25
|
5. After structural and visual checks pass, run `insmind-cli editor save --json` and wait for the original command. Do not interrupt during silent periods or issue concurrent Editor operations. Only success proves persistence; deliver the returned `workId` and public `url`, preserving environment parameters. Discover wait limits with `editor save --help`.
|
|
26
26
|
6. Run `insmind-cli editor disconnect` after saving; disconnecting does not replace saving.
|
|
@@ -6,6 +6,7 @@ Generation constraints example:
|
|
|
6
6
|
|
|
7
7
|
```json
|
|
8
8
|
{
|
|
9
|
+
"host_application": "<invoking application>",
|
|
9
10
|
"message": {
|
|
10
11
|
"parts": [
|
|
11
12
|
{ "text": "<user request>" },
|
|
@@ -22,10 +23,11 @@ Generation constraints example:
|
|
|
22
23
|
}
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
`arguments` can be supplied without `model`, allowing the service Agent to select one. With a model, the CLI
|
|
26
|
+
`arguments` can be supplied without `model`, allowing the service Agent to select one. With a model, the CLI forwards explicit controls and maps known editing aliases to their service fields. Put prompt text in a Text Part and media in separate URL Parts, not in `arguments`. Preserve input Part order. Use `metadata.role` for `reference`, `first_frame` or `last_frame`; do not inject frame-role text. For example:
|
|
26
27
|
|
|
27
28
|
```json
|
|
28
29
|
{
|
|
30
|
+
"host_application": "<invoking application>",
|
|
29
31
|
"message": {
|
|
30
32
|
"parts": [
|
|
31
33
|
{ "text": "Generate a transition video" },
|
|
@@ -12,14 +12,13 @@ insmind-cli tool call <tool> --input request.json --async
|
|
|
12
12
|
insmind-cli task get <taskId>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`tool
|
|
16
|
-
|
|
17
|
-
Provide all required fields. Put width, height, resolution and similar requirements in dedicated structured parameters when available, rather than only in prompt text. `tool call <tool> --schema` selects required fields, allowed parameters and ranges by model. Use `model get` for step, defaults and cross-field rules in `usageDescription`. Fixed JSON commands also accept `--json`.
|
|
15
|
+
Read `insmind-cli tool call <tool> --schema` for the input shape and `model get` for the selected model's price and estimated duration. `required` describes required inputs and `default` identifies service defaults. A defaulted field can be omitted when the user did not select a value. Use `options[].value` for a listed option. Put dimensions and resolution in `width`, `height` and `resolution` where available, and preserve explicit user values. Read `usageDescription` for cross-field rules such as video mode and frame roles.
|
|
18
16
|
|
|
19
17
|
Copy the returned `model` identifier into the top-level `model` field of request JSON (runtime `arguments.model`), alongside its parameters:
|
|
20
18
|
|
|
21
19
|
```json
|
|
22
20
|
{
|
|
21
|
+
"host_application": "<invoking application>",
|
|
23
22
|
"model": "<model>",
|
|
24
23
|
"prompt": "<required prompt>",
|
|
25
24
|
"<parameter>": "<value>"
|