@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.
Files changed (95) hide show
  1. package/contracts/operations/agent.send/input.schema.json +1 -77
  2. package/contracts/operations/dam.folder.list/input.schema.json +0 -1
  3. package/contracts/operations/dam.folder.list/output.schema.json +1 -2
  4. package/contracts/operations/dam.list/input.schema.json +3 -6
  5. package/contracts/operations/dam.list/output.schema.json +1 -2
  6. package/contracts/operations/dam.search/input.schema.json +3 -6
  7. package/contracts/operations/dam.search/output.schema.json +1 -2
  8. package/contracts/operations/tool.call/models/image-edit-smart.schema.json +1 -2
  9. package/contracts/operations/tool.call/models/image-expand-smart.schema.json +1 -2
  10. package/contracts/operations/tool.call/models/image-layers-smart.schema.json +1 -3
  11. package/contracts/operations/tool.call/models/video-edit-smart.schema.json +0 -3
  12. package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
  13. package/dist/bin/postinstall.js +22 -6
  14. package/dist/bin/task-worker.js +2 -2
  15. package/dist/src/bootstrap/create-cli.js +13 -6
  16. package/dist/src/bootstrap/create-runtime.js +98 -28
  17. package/dist/src/bootstrap/run-task-worker.js +6 -2
  18. package/dist/src/bootstrap/validators.js +1 -1
  19. package/dist/src/cli/action-binding.js +14 -37
  20. package/dist/src/cli/agent-commands.js +11 -11
  21. package/dist/src/cli/auth-commands.js +2 -1
  22. package/dist/src/cli/creation-help.js +9 -0
  23. package/dist/src/cli/dam-commands.js +10 -14
  24. package/dist/src/cli/editor-commands.js +7 -5
  25. package/dist/src/cli/errors.js +81 -22
  26. package/dist/src/cli/host-input.js +64 -5
  27. package/dist/src/cli/model-commands.js +9 -3
  28. package/dist/src/cli/observed-errors.js +7 -3
  29. package/dist/src/cli/org-commands.js +3 -1
  30. package/dist/src/cli/task-commands.js +6 -2
  31. package/dist/src/cli/tool-commands.js +12 -11
  32. package/dist/src/features/agent/creative-agent-adapter.js +6 -2
  33. package/dist/src/features/agent/creative-protocol.js +8 -29
  34. package/dist/src/features/agent/resource-authorizer.js +25 -17
  35. package/dist/src/features/agent/result-reader.js +31 -14
  36. package/dist/src/features/agent/use-cases.js +6 -31
  37. package/dist/src/features/credits/use-cases.js +55 -28
  38. package/dist/src/features/dam/asset-projection.js +3 -6
  39. package/dist/src/features/dam/dam-api-adapter.js +30 -15
  40. package/dist/src/features/dam/repository-catalog.js +30 -21
  41. package/dist/src/features/dam/use-cases.js +12 -7
  42. package/dist/src/features/editor/bridge-client.js +0 -2
  43. package/dist/src/features/editor/public-url.js +1 -36
  44. package/dist/src/features/editor/session.js +3 -2
  45. package/dist/src/features/editor/use-cases.js +27 -2
  46. package/dist/src/features/org/org-service.js +10 -1
  47. package/dist/src/features/org/use-cases.js +18 -4
  48. package/dist/src/features/task/process-owner.js +54 -0
  49. package/dist/src/features/task/store.js +37 -10
  50. package/dist/src/features/task/task-background.js +5 -2
  51. package/dist/src/features/task/use-cases.js +184 -84
  52. package/dist/src/features/tool/argument-paths.js +14 -0
  53. package/dist/src/features/tool/canvas-copy.js +28 -15
  54. package/dist/src/features/tool/canvas-matting.js +123 -0
  55. package/dist/src/features/tool/canvas-media.js +100 -52
  56. package/dist/src/features/tool/canvas-models.js +66 -33
  57. package/dist/src/features/tool/canvas-pricing.js +12 -0
  58. package/dist/src/features/tool/canvas-recovery.js +13 -30
  59. package/dist/src/features/tool/canvas-results.js +79 -87
  60. package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
  61. package/dist/src/features/tool/canvas-video.js +44 -37
  62. package/dist/src/features/tool/dynamic-schema.js +39 -40
  63. package/dist/src/features/tool/ffprobe-executable.js +21 -0
  64. package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
  65. package/dist/src/features/tool/resource-authorizer.js +11 -3
  66. package/dist/src/features/tool/tool-api-adapter.js +73 -82
  67. package/dist/src/features/tool/tool-errors.js +25 -0
  68. package/dist/src/features/tool/tool-output.js +15 -0
  69. package/dist/src/features/tool/use-cases.js +74 -98
  70. package/dist/src/features/update/update-service.js +95 -21
  71. package/dist/src/platform/media-type.js +46 -0
  72. package/dist/src/platform/public-url.js +35 -0
  73. package/dist/src/platform/remote-error-evidence.js +33 -6
  74. package/dist/src/platform/resource-auth-key.js +35 -1
  75. package/dist/src/platform/safe-upload-file.js +36 -41
  76. package/dist/src/platform/signature.js +2 -2
  77. package/dist/src/platform/signed-http-transport.js +4 -1
  78. package/dist/src/platform/url-safety.js +6 -1
  79. package/dist/src/platform/webm-header.js +41 -0
  80. package/dist/src/telemetry/command-route.js +38 -0
  81. package/dist/src/telemetry/command-routes.json +1 -0
  82. package/dist/src/telemetry/failure-summary.js +1 -1
  83. package/dist/src/telemetry/invocation.js +1 -2
  84. package/dist/src/telemetry/process-errors.js +17 -33
  85. package/dist/src/telemetry/sanitize.js +19 -4
  86. package/dist/src/telemetry/sls-sink.js +8 -0
  87. package/package.json +4 -4
  88. package/skills/insmind-cli/SKILL.md +18 -5
  89. package/skills/insmind-cli/references/agent.md +9 -4
  90. package/skills/insmind-cli/references/creation.md +3 -1
  91. package/skills/insmind-cli/references/editor.md +7 -5
  92. package/skills/insmind-cli/references/errors.md +20 -9
  93. package/skills/insmind-cli/references/matting.md +3 -5
  94. package/skills/insmind-cli/references/media-tools.md +10 -4
  95. package/skills/insmind-cli/references/tool.md +9 -15
@@ -1,3 +1,6 @@
1
+ import { validateHeaderValue } from "node:http";
2
+ import { concreteMediaType, mediaTypeForFormat } from "./media-type.js";
3
+ import { hasWebmDocType } from "./webm-header.js";
1
4
  import { isInterruption } from "./interruption.js";
2
5
  import { open, realpath, stat } from "node:fs/promises";
3
6
  import { basename, extname, sep } from "node:path";
@@ -20,6 +23,7 @@ const protectedSegments = new Set([
20
23
  ".docker",
21
24
  ".gd",
22
25
  ".gd-cli-dev",
26
+ ".insmind",
23
27
  ".git",
24
28
  ".gnupg",
25
29
  ".kube",
@@ -39,29 +43,16 @@ const protectedFilenames = new Set([
39
43
  "id_rsa",
40
44
  "known_hosts"
41
45
  ]);
42
- const mediaTypes = {
43
- avif: "image/avif",
44
- bmp: "image/bmp",
45
- gif: "image/gif",
46
- heic: "image/heic",
47
- heif: "image/heif",
48
- jpeg: "image/jpeg",
49
- m4v: "video/x-m4v",
50
- mkv: "video/x-matroska",
51
- mov: "video/quicktime",
52
- mp4: "video/mp4",
53
- png: "image/png",
54
- svg: "image/svg+xml",
55
- webm: "video/webm",
56
- webp: "image/webp"
57
- };
58
46
  function reject(reason) {
59
47
  throw new LocalFileInputError(undefined, reason);
60
48
  }
61
49
  function assertSafePath(filePath) {
62
50
  const segments = filePath.split(sep).filter(Boolean).map((segment) => segment.toLowerCase());
63
51
  const filename = segments.at(-1) ?? "";
64
- if (protectedFilenames.has(filename) || filename.startsWith(".")
52
+ const parent = segments.at(-2);
53
+ const hostCredential = (parent === ".codex" && filename === "auth.json")
54
+ || (parent === ".gemini" && filename === "oauth_creds.json");
55
+ if (hostCredential || protectedFilenames.has(filename) || filename.startsWith(".")
65
56
  || segments.some(segment => protectedSegments.has(segment))) {
66
57
  reject("path_restricted");
67
58
  }
@@ -80,10 +71,15 @@ function detectedFormat(header) {
80
71
  if (signature === "GIF87a" || signature === "GIF89a")
81
72
  return "gif";
82
73
  }
83
- if (header.length >= 12
84
- && header.subarray(0, 4).toString("ascii") === "RIFF"
85
- && header.subarray(8, 12).toString("ascii") === "WEBP")
86
- return "webp";
74
+ if (header.length >= 12 && header.toString("latin1", 0, 4) === "RIFF") {
75
+ const kind = header.toString("latin1", 8, 12);
76
+ if (kind === "WEBP")
77
+ return "webp";
78
+ if (kind === "WAVE")
79
+ return "wav";
80
+ }
81
+ if (hasWebmDocType(header))
82
+ return "webm";
87
83
  if (header.length >= 12 && header.subarray(4, 8).toString("ascii") === "ftyp") {
88
84
  const brand = header.subarray(8, 12).toString("ascii");
89
85
  if (["isom", "iso2", "iso5", "iso6", "mp41", "mp42", "avc1", "dash"].includes(brand))
@@ -103,7 +99,8 @@ async function readHeader(filePath, signal) {
103
99
  signal.throwIfAborted();
104
100
  const handle = await open(filePath, "r");
105
101
  try {
106
- const buffer = Buffer.alloc(32);
102
+ // Read a bounded prefix; the WebM DocType can extend past a 32-byte prefix.
103
+ const buffer = Buffer.alloc(4096);
107
104
  const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
108
105
  signal.throwIfAborted();
109
106
  return buffer.subarray(0, bytesRead);
@@ -135,31 +132,29 @@ export async function inspectUploadFile(input) {
135
132
  return reject("not_regular_file");
136
133
  const header = await readHeader(filePath, input.signal);
137
134
  const detected = detectedFormat(header);
138
- // Hidden host/workspace ancestors are not themselves secrets. Only known
139
- // media headers may pass there; named credential paths remain blocked on
140
- // both requested and canonical paths before any file is opened.
141
- if (input.allowSensitivePath !== true && detected === undefined
142
- && [requestedPath, filePath].some(path => path.split(sep).some(segment => segment.startsWith(".")))) {
143
- return reject("path_restricted");
144
- }
145
135
  const extension = extname(requestedPath).slice(1).toLowerCase();
146
- const format = detected ?? (extension === "jpg" ? "jpeg" : extension);
147
- if (format === "")
148
- return reject("format_missing");
149
- const detectedMediaType = detected === undefined ? undefined : mediaTypes[detected];
150
- if (detectedMediaType !== undefined
151
- && input.claimedMediaType !== undefined
152
- && input.claimedMediaType.trim().toLowerCase() !== detectedMediaType) {
153
- return reject("media_type_mismatch");
136
+ const declaration = input.claimedMediaType;
137
+ if (declaration !== undefined) {
138
+ try {
139
+ validateHeaderValue("Content-Type", declaration);
140
+ }
141
+ catch {
142
+ return reject("invalid_media_type_header");
143
+ }
154
144
  }
145
+ const claimed = concreteMediaType(declaration);
146
+ const subtype = claimed?.split("/")[1];
147
+ const declaredFormat = claimed === "image/svg+xml" ? "svg" : claimed === "video/quicktime" ? "mov"
148
+ : subtype && /^[a-z0-9]+$/u.test(subtype) ? subtype : undefined;
149
+ const format = detected ?? (extension === "jpg" ? "jpeg" : extension || declaredFormat || "bin");
155
150
  return {
156
151
  filePath,
157
152
  filename: basename(requestedPath),
158
153
  format,
159
- mediaType: detectedMediaType
160
- ?? input.claimedMediaType
161
- ?? mediaTypes[format]
162
- ?? `application/${format}`,
154
+ mediaType: declaration
155
+ ?? (detected ? mediaTypeForFormat(detected) : undefined)
156
+ ?? mediaTypeForFormat(format)
157
+ ?? (format === "bin" ? "application/octet-stream" : `application/${format}`),
163
158
  size: details.size
164
159
  };
165
160
  }
@@ -7,8 +7,8 @@ export function canonicalizeQuery(entries) {
7
7
  .replaceAll("%3A", ":");
8
8
  }
9
9
  export function createSigningString(input) {
10
- // The gateway signs literal base64 padding; keep its wire query URL-encoded.
11
- const signingQuery = input.canonicalQuery.replaceAll("%3D", "=");
10
+ // The gateway signs decoded form values. On the wire, a space is + and a literal plus is %2B.
11
+ const signingQuery = decodeURIComponent(input.canonicalQuery.replaceAll("+", " "));
12
12
  return `${input.method.toUpperCase()}@${input.pathname}@${signingQuery}@${input.timestamp}`;
13
13
  }
14
14
  export function signRequest(input) {
@@ -235,7 +235,10 @@ export function createSignedHttpTransport(options) {
235
235
  const { response } = received;
236
236
  if (!response.ok) {
237
237
  const body = await readText(received);
238
- throw new RemoteRequestError(response.status, false, remoteErrorEvidence(body), undefined, undefined, received.diagnostics());
238
+ const original = remoteErrorEvidence(body);
239
+ const evidence = request.sensitiveResponse
240
+ ? (original.remoteCode === undefined ? {} : { remoteCode: original.remoteCode }) : original;
241
+ throw new RemoteRequestError(response.status, false, evidence, undefined, undefined, received.diagnostics());
239
242
  }
240
243
  if (!response.body)
241
244
  throw new RemoteRequestError(response.status, false, {}, undefined, "RESPONSE_BODY_MISSING", received.diagnostics());
@@ -65,7 +65,7 @@ function isPrivateIpv6(parts) {
65
65
  }
66
66
  return unspecified || loopback || uniqueLocal || linkLocal;
67
67
  }
68
- export function parseSafeRemoteAssetUrl(value) {
68
+ export function parseHttpAssetUrl(value) {
69
69
  let url;
70
70
  try {
71
71
  url = new URL(value);
@@ -78,6 +78,11 @@ export function parseSafeRemoteAssetUrl(value) {
78
78
  || url.password !== "") {
79
79
  return fail();
80
80
  }
81
+ return url;
82
+ }
83
+ /** Only a process that opens the URL needs to enforce the local network boundary. */
84
+ export function parseSafeRemoteAssetUrl(value) {
85
+ const url = parseHttpAssetUrl(value);
81
86
  const hostname = url.hostname
82
87
  .replace(/^\[|\]$/g, "")
83
88
  .replace(/[.]+$/, "")
@@ -0,0 +1,41 @@
1
+ function vintWidth(first) {
2
+ if (!first)
3
+ return 0;
4
+ // The leading marker bit determines the width of an EBML variable-size integer.
5
+ return Math.clz32(first) - 23;
6
+ }
7
+ function ebmlPayload(bytes, sizeOffset, limit) {
8
+ const width = vintWidth(bytes[sizeOffset]);
9
+ const start = sizeOffset + width;
10
+ if (!width || start > limit)
11
+ return;
12
+ let length = bytes[sizeOffset] & (0xff >>> width);
13
+ for (let i = sizeOffset + 1; i < start; i++)
14
+ length = length * 256 + bytes[i];
15
+ if (length > limit - start || length === 2 ** (7 * width) - 1)
16
+ return;
17
+ return { start, end: start + length };
18
+ }
19
+ export function hasWebmDocType(bytes) {
20
+ if (bytes.length < 5 || bytes.readUInt32BE(0) !== 0x1a45dfa3)
21
+ return false;
22
+ const header = ebmlPayload(bytes, 4, bytes.length);
23
+ if (!header)
24
+ return false;
25
+ let found = false;
26
+ for (let offset = header.start; offset < header.end;) {
27
+ const idWidth = vintWidth(bytes[offset]);
28
+ if (!idWidth || idWidth > 4)
29
+ return false;
30
+ const field = ebmlPayload(bytes, offset + idWidth, header.end);
31
+ if (!field)
32
+ return false;
33
+ if (idWidth === 2 && bytes.readUInt16BE(offset) === 0x4282) {
34
+ if (found || field.end - field.start !== 4 || bytes.toString("latin1", field.start, field.end) !== "webm")
35
+ return false;
36
+ found = true;
37
+ }
38
+ offset = field.end;
39
+ }
40
+ return found;
41
+ }
@@ -0,0 +1,38 @@
1
+ import { Command } from "commander";
2
+ /** Read only argv. Commander owns option arity, the -- separator and the choice of subcommand. */
3
+ export function identifyInvocation(root, argv) {
4
+ let route = root;
5
+ let operands = [];
6
+ let unknown = argv;
7
+ let schema = false;
8
+ const selected = (operation, mode) => ({ operation, mode: () => mode });
9
+ while (true) {
10
+ // Parse the option declarations on a disposable command; the real flags, actions and I/O are untouched.
11
+ const parser = new Command().exitOverride().configureOutput({ writeErr() { } });
12
+ for (const flags of route.options)
13
+ parser.option(flags);
14
+ let parsed;
15
+ try {
16
+ parsed = parser.parseOptions(unknown);
17
+ }
18
+ catch {
19
+ if (parser.opts().version)
20
+ return selected("version", "version");
21
+ return selected(route.operation, schema || parser.opts().schema ? "schema" : "execute");
22
+ }
23
+ if (parser.opts().version)
24
+ return selected("version", "version");
25
+ schema ||= parser.opts().schema === true;
26
+ operands = operands.concat(parsed.operands);
27
+ unknown = parsed.unknown;
28
+ const name = operands[0];
29
+ if (name && Object.hasOwn(route.children, name)) {
30
+ route = route.children[name];
31
+ operands = operands.slice(1);
32
+ continue;
33
+ }
34
+ if (unknown.includes("--help") || unknown.includes("-h"))
35
+ return selected(route === root ? "help" : route.operation, "help");
36
+ return selected(name && !route.action ? "unknown" : route.operation, schema ? "schema" : "execute");
37
+ }
38
+ }
@@ -0,0 +1 @@
1
+ {"operation":"unknown","action":false,"options":["-V, --version","--json-errors","--locale <locale>"],"children":{"auth":{"operation":"auth","action":false,"options":[],"children":{"login":{"operation":"auth.login","action":true,"options":["--no-browser","--require-browser"],"children":{}},"status":{"operation":"auth.status","action":true,"options":["--json"],"children":{}},"logout":{"operation":"auth.logout","action":true,"options":[],"children":{}}}},"agent":{"operation":"agent","action":false,"options":[],"children":{"send":{"operation":"agent.send","action":true,"options":["--schema","--input <file|->","--async","--json"],"children":{}}}},"tool":{"operation":"tool","action":false,"options":[],"children":{"list":{"operation":"tool.list","action":true,"options":["--json"],"children":{}},"call":{"operation":"tool.call","action":true,"options":["--schema","--input <file|->","--async","--json"],"children":{}}}},"model":{"operation":"model","action":false,"options":[],"children":{"list":{"operation":"model.list","action":true,"options":["--tool <tool>","--json"],"children":{}},"get":{"operation":"model.get","action":true,"options":["--tool <tool>","--json"],"children":{}}}},"editor":{"operation":"editor","action":false,"options":[],"children":{"connect":{"operation":"editor.connect","action":true,"options":["--json"],"children":{}},"disconnect":{"operation":"editor.disconnect","action":true,"options":["--json"],"children":{}},"snapshot":{"operation":"editor.snapshot","action":true,"options":["--json"],"children":{}},"apply":{"operation":"editor.apply","action":true,"options":["--schema","--input <file|->","--json"],"children":{}},"screenshot":{"operation":"editor.screenshot","action":true,"options":["--json"],"children":{}},"save":{"operation":"editor.save","action":true,"options":["--json"],"children":{}}}},"dam":{"operation":"dam","action":false,"options":[],"children":{"repository":{"operation":"dam.repository","action":false,"options":[],"children":{"list":{"operation":"dam.repository.list","action":true,"options":["--json"],"children":{}}}},"folder":{"operation":"dam.folder","action":false,"options":[],"children":{"list":{"operation":"dam.folder.list","action":true,"options":["--repository-id <id>","--parent-id <id>","--query <text>","--page <n>","--page-size <number>","--json"],"children":{}}}},"tag":{"operation":"dam.tag","action":false,"options":[],"children":{"list":{"operation":"dam.tag.list","action":true,"options":["--repository-id <id>","--query <text>","--json"],"children":{}}}},"download":{"operation":"dam.download","action":true,"options":["--repository-id <id>","--output-dir <directory>","--json"],"children":{}},"rename":{"operation":"dam.rename","action":true,"options":["--kind <asset|folder>","--title <title>","--repository-id <id>","--json"],"children":{}},"move":{"operation":"dam.move","action":true,"options":["--kind <asset|folder>","--target-folder-id <id>","--repository-id <source-id>","--target-repository-id <target-id>","--json"],"children":{}},"copy":{"operation":"dam.copy","action":true,"options":["--kind <asset|folder>","--target-folder-id <id>","--repository-id <source-id>","--target-repository-id <target-id>","--json"],"children":{}},"list":{"operation":"dam.list","action":true,"options":["--repository-id <id>","--all-repositories","--folder-id <id>","--no-include-child-folder","--type <type>","--asset-format <csv>","--tag-ids <csv>","--page-size <number>","--cursor <id>","--json"],"children":{}},"search":{"operation":"dam.search","action":true,"options":["--repository-id <id>","--all-repositories","--folder-id <id>","--no-include-child-folder","--type <type>","--asset-format <csv>","--tag-ids <csv>","--page-size <number>","--cursor <id>","--json"],"children":{}},"get":{"operation":"dam.get","action":true,"options":["--json"],"children":{}},"upload":{"operation":"dam.upload","action":true,"options":["--repository-id <id>","--title <title>","--folder-id <id>","--tag-ids <csv>","--allow-sensitive-path","--wait-analysis","--json"],"children":{}},"delete":{"operation":"dam.delete","action":true,"options":["--repository-id <id>","--permanent"],"children":{}}}},"update":{"operation":"update","action":true,"options":[],"children":{"check":{"operation":"update.check","action":true,"options":["--for-display","--schema","--json"],"children":{}}}},"task":{"operation":"task","action":false,"options":[],"children":{"list":{"operation":"task.list","action":true,"options":["--limit <number>","--operation <operation>","--json"],"children":{}},"get":{"operation":"task.get","action":true,"options":["--json"],"children":{}}}},"credits":{"operation":"credits.get","action":true,"options":["--json","--schema"],"children":{"usage":{"operation":"credits.usage","action":false,"options":[],"children":{"list":{"operation":"credits.usage.list","action":true,"options":["--from <timestamp>","--to <timestamp>","--limit <number>","--cursor <cursor>","--json","--schema"],"children":{}},"get":{"operation":"credits.usage.get","action":true,"options":["--json","--schema"],"children":{}}}}}}}}
@@ -6,7 +6,7 @@ const flags = new Set(["bodyUsedAtReceipt", "bodyLockedAtReceipt", "bodyUsedBefo
6
6
  const counts = new Set(["messageCount", "invalidMessageCount", "systemErrorCount", "publicPartCount",
7
7
  "streamPayloadCount", "streamJsonValueCount"]);
8
8
  const localFileSteps = new Set(["directory_create", "directory_permissions", "directory_read", "stat", "parse", "validate", "open", "file_permissions", "read", "write", "sync", "close", "rename", "unlink"]);
9
- const inputReasons = new Set(["path_restricted", "not_regular_file", "format_missing", "media_type_mismatch", "file_read_failed",
9
+ const inputReasons = new Set(["path_restricted", "not_regular_file", "format_missing", "invalid_media_type_header", "file_read_failed",
10
10
  "json_read", "json_parse", "schema_validation", "invalid_task_id", "command_arguments", "model_required", "model_not_found",
11
11
  "model_tool_mismatch", "model_parameters", "tool_not_found", "invalid_asset_url", "commander.unknownOption",
12
12
  "commander.unknownCommand", "commander.missingArgument", "commander.excessArguments", "commander.help",
@@ -148,7 +148,7 @@ export function createTelemetryInvocation(options) {
148
148
  const snapshot = identity();
149
149
  const keys = ["host_invocation_id", "host_connector_version", "installation_owner", "invocation_purpose",
150
150
  "account_id", "organization_id", "tool_name", "model_id", "content_id", "task_id", "dify_task_id",
151
- "cli_task_id", "execution_mode", "parameters"];
151
+ "cli_task_id", "execution_mode", "execution_protocol", "parameters"];
152
152
  for (const key of keys) {
153
153
  if (context[key] !== undefined)
154
154
  Object.assign(snapshot, { [key]: context[key] });
@@ -207,7 +207,6 @@ export function createTelemetryInvocation(options) {
207
207
  const stage = completion.outcome === "success" ? "process" : classify(completion.error).failureStage ?? failureStage(completion.error) ?? "command";
208
208
  remember({ ...last, event_name: "stage_finished", stage, outcome: completion.outcome,
209
209
  ...(completion.outcome !== "success" && failedStep ? { failed_step: failedStep } : {}),
210
- ...(context.parameters && (!issued || last.command_kind === "technical") ? { parameters: context.parameters } : {}),
211
210
  duration_ms: Math.max(0, options.now() - startedAt),
212
211
  ...(completion.outcome === "success" ? {} : {
213
212
  failure_stage: classify(completion.error).failureStage ?? failureStage(completion.error) ?? "unknown"
@@ -1,42 +1,23 @@
1
- import { classifyTelemetryError, mapCliError } from "../cli/errors.js";
2
1
  import { isInterruption } from "../platform/interruption.js";
3
2
  import { randomBytes } from "node:crypto";
4
- import { readFile, readdir } from "node:fs/promises";
3
+ import { readFile } from "node:fs/promises";
5
4
  import { dirname, join } from "node:path";
6
5
  import { homedir } from "node:os";
7
6
  import { fileURLToPath } from "node:url";
8
7
  import { gaodingProduct, insmindProduct } from "../product/config.js";
9
8
  import { createTelemetryInvocation, hostTelemetryContext } from "./invocation.js";
10
9
  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.
10
+ // The normal runtime or even Commander may be unavailable. Only package-owned names may enter SLS.
13
11
  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);
12
+ try {
13
+ const [{ identifyInvocation }, catalog] = await Promise.all([
14
+ import("./command-route.js"), readFile(new URL("./command-routes.json", import.meta.url), "utf8")
15
+ ]);
16
+ return identifyInvocation(JSON.parse(catalog), argv);
17
+ }
18
+ catch {
19
+ return { operation: "bootstrap", mode: () => "execute" };
36
20
  }
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
21
  }
41
22
  /** Independent fallback for entrypoints which cannot construct the full runtime. */
42
23
  export async function reportProcessError(error, options) {
@@ -55,8 +36,11 @@ export async function reportProcessError(error, options) {
55
36
  catch { /* The package file may be unavailable during startup failure. */ }
56
37
  }
57
38
  const aborted = isInterruption(error, options.signal);
58
- const classification = classifyTelemetryError(error, { aborted, product });
59
- const mapped = mapCliError(error, { aborted, product });
39
+ // The application error mapper imports Commander and feature dependencies which can themselves fail to load.
40
+ const mapper = await import("../cli/errors.js").catch(() => undefined);
41
+ const classification = mapper?.classifyTelemetryError(error, { aborted, product })
42
+ ?? { outcome: aborted ? "interrupted" : "failure", errorCode: "INTERNAL_ERROR" };
43
+ const failure = mapper?.mapCliError(error, { aborted, product }).failure;
60
44
  const telemetry = createTelemetryInvocation({ cliName: product.commandName, cliVersion: version,
61
45
  env: options.environment ?? (process.env.CLI_TELEMETRY_ENV === "test" ? "test" : "production"),
62
46
  processRole: options.processRole ?? "cli", now: Date.now,
@@ -69,8 +53,8 @@ export async function reportProcessError(error, options) {
69
53
  telemetry.annotate(hostTelemetryContext(process.env));
70
54
  if ((options.processRole ?? "cli") === "cli")
71
55
  await telemetry.issue(definition);
72
- const events = telemetry.finish(mapped.kind === "interrupted" ? { outcome: "interrupted", error } : {
73
- outcome: "failure", error, errorCode: mapped.failure.code, errorMessage: mapped.failure.message,
56
+ const events = telemetry.finish(classification.outcome === "interrupted" ? { outcome: "interrupted", error } : {
57
+ outcome: "failure", error, errorCode: failure?.code ?? "INTERNAL_ERROR", errorMessage: failure?.message ?? "CLI startup failed.",
74
58
  ...(classification.httpStatus === undefined ? {} : { httpStatus: classification.httpStatus }),
75
59
  ...(classification.remoteErrorCode === undefined ? {} : { remoteErrorCode: classification.remoteErrorCode }),
76
60
  ...(classification.remoteErrorBody === undefined ? {} : { remoteErrorBody: classification.remoteErrorBody })
@@ -1,3 +1,4 @@
1
+ import { posix, win32 } from "node:path";
1
2
  import { isSensitiveKey, redactSensitiveText } from "../platform/redact.js";
2
3
  const ids = new Set(["account_id", "organization_id", "cli_task_id", "task_id", "dify_task_id", "content_id"]);
3
4
  function sensitive(key) {
@@ -28,7 +29,15 @@ export function cleanText(value) {
28
29
  }
29
30
  export function cleanDiagnostic(value) {
30
31
  const seen = new WeakSet();
31
- function clean(item, depth) {
32
+ const envelope = value && typeof value === "object" ? value : {};
33
+ const tool = envelope.operation === "tool.call";
34
+ const toolDiagnostic = (tool || (envelope.operation === "task.get" && ["dify", "toolkit", "sync"].includes(String(envelope.execution_protocol)))) && envelope.event_name === "stage_finished";
35
+ function clean(item, depth, inParameters = false) {
36
+ if (typeof item === "string" && inParameters) {
37
+ if (posix.isAbsolute(item) || win32.isAbsolute(item) || /^file:\/\//iu.test(item))
38
+ return "[Local file]";
39
+ item = item.replace(/file:\/\/[^\s<>"`]+/giu, "[Local file]");
40
+ }
32
41
  if (typeof item === "string")
33
42
  return /^data:[^,]*;base64,/iu.test(item) ? "[Binary omitted]" : cleanText(item);
34
43
  if (typeof item === "bigint")
@@ -45,9 +54,15 @@ export function cleanDiagnostic(value) {
45
54
  if (item instanceof Error)
46
55
  return errorEvidence(item);
47
56
  if (Array.isArray(item))
48
- return item.map(v => clean(v, depth + 1));
49
- return Object.fromEntries(Object.entries(item).map(([key, v]) => [key,
50
- depth === 0 && ids.has(key) ? v : sensitive(key) ? "[REDACTED]" : clean(v, depth + 1)]));
57
+ return item.map(v => clean(v, depth + 1, inParameters));
58
+ const entries = Object.entries(item);
59
+ const fields = depth === 0 && envelope.event_name === "stage_finished"
60
+ ? entries.filter(([key]) => key !== "parameters") : entries;
61
+ return Object.fromEntries(fields.map(([key, v]) => [key,
62
+ depth === 0 && toolDiagnostic && ["error_message", "error_stack", "remote_error_body"].includes(key)
63
+ ? (key === "error_message" ? envelope.error_code ?? "TOOL_ERROR" : "[User content omitted]") :
64
+ inParameters && tool && key === "prompt" ? "[User content omitted]" :
65
+ depth === 0 && ids.has(key) ? v : sensitive(key) || (inParameters && key === "answers") ? "[REDACTED]" : clean(v, depth + 1, inParameters || key === "parameters")]));
51
66
  }
52
67
  return clean(value, 0);
53
68
  }
@@ -120,6 +120,14 @@ export function createSlsTelemetrySink(options) {
120
120
  const entry = JSON.parse(raw);
121
121
  if (entry.event?.schema_version !== "6" || !Number.isFinite(entry.queuedAt) || !entry.event || eventKey(entry.event) !== name.slice(0, -5))
122
122
  throw new Error();
123
+ // Earlier v6 clients could queue input parameters and echoed Agent HTTP errors.
124
+ const event = entry.event;
125
+ if (event.event_name === "stage_finished") {
126
+ delete event.parameters;
127
+ const agent = event.operation === "agent.send" || (event.operation === "task.get" && !event.execution_protocol);
128
+ if (agent && Number(event.http_status) >= 400)
129
+ delete event.remote_error_body;
130
+ }
123
131
  entries.set(name.slice(0, -5), entry);
124
132
  }
125
133
  catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insmind/cli",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
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": "5a8acfd84d3ce5ed311d5442c66ebc6b62c9f680",
51
- "pipelineId": "241803",
52
- "pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/241803"
50
+ "sourceCommit": "6bb95e37a8accaddd86c5219d536bd9db493ed32",
51
+ "pipelineId": "245407",
52
+ "pipelineUrl": "https://git.intra.gaoding.com/gtt/gaoding-cli/-/pipelines/245407"
53
53
  }
54
54
  }
@@ -1,28 +1,41 @@
1
1
  ---
2
2
  name: insmind-cli
3
- description: Use when creating images, videos or text with insMind CLI, operating the focused insMind editor, or managing insMind DAM assets.
3
+ description: Use insMind for business planning and multi-turn creation, compare tools and credit prices, create or edit images, videos or text, operate the insMind editor, or manage DAM assets.
4
4
  ---
5
5
 
6
6
  # insMind CLI
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
+ - For `agent send`, `tool call` and `editor apply`, set the top-level `host_application` to the calling app. A Codex agent running a shell command uses `codex`. Other hosts use their own names, such as `workbuddy`, `qwenwork` or `trae`. Use `terminal` only when a person runs the command directly.
11
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.
12
12
  - Relay an available update to the user alongside their foreground result, at most once per hour. For stdout-only hosts, see “Update” below.
13
13
  - 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.
14
+ - Choose by the object first: discover attachment/media-link processing (including text replacement, layers and vectorization) with `tool list`; Editor operates elements in a connected work identified by a work ID or editor URL. Reading Editor help alone does not establish whether image processing is supported.
15
+ - When the user explicitly requests insMind planning, creation or processing, completion requires an actual CLI call and service reply. Discover and call Agent for planning too; locally written advice is not an insMind reply. Read the selected model's `model get` detail before deciding whether it meets the request; a list summary alone does not establish a limitation. Local interpolation or tracing does not replace the requested insMind call. Local scripts may prepare inputs; report any substitute separately without claiming the insMind task is complete.
16
+ - Construct and save complete JSON from the Schema before running `--input request.json`. Input is not an interactive form. With `--input -`, pipe or redirect the complete JSON in the same shell command; running it alone will not prompt for fields. For local media inside JSON, generate URIs with `Path(path).resolve().as_uri()` or `pathToFileURL(path).href`, preserving filenames and escaping Unicode, spaces and `#`.
14
17
  - 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.
15
18
  - Discovery describes the installed CLI; it neither upgrades it nor authorizes generation, writes or installation. Recover unknown outcomes through the error-handling reference.
16
19
 
20
+ ## Creation execution boundaries
21
+
22
+ After choosing the route, read [Tool](references/tool.md) or [Agent](references/agent.md) before submitting. The scenario references below help select capabilities and prepare inputs; they do not replace the execution workflow.
23
+
24
+ - For delivery now, use the default synchronous command. Keep the host's exit status and process handle, then wait on that process for the complete result. If the handle is lost, track the CLI taskId from stderr and keep waiting while running.
25
+ - When the user asks for later pickup, use `--async`. On acceptance, give the user the taskId and current state and end this turn. Retrieve that task when the user returns.
26
+ - Deliver the first usable service result. Do not switch models, adjust a selection or create again just to fix a perceived visual deviation. Explain the difference and let the user decide on revisions. Preparing inputs before submission, querying the original task and downloading its result are not additional creation.
27
+ - Treat resource URLs explicitly returned for delivery as complete values. Copy them exactly or save and reference them; do not retype, splice, truncate or remove query parameters. Retrieve the actual returned link again instead of reconstructing it from memory.
28
+ - Tool price ranges are estimates even when both bounds are equal. For Agent actual usage and ledger verification, see [cost sources](references/errors.md#cost-sources).
29
+
17
30
  ## Read task guidance
18
31
 
19
32
  Read only the reference for the user's goal:
20
33
 
21
34
  - Choose Agent or Tool creation, discover models, and generate images, videos or text: [Creation](references/creation.md)
22
- - Select image/video generation or processing tools, prepare references and review masks: [Media tool selection](references/media-tools.md)
35
+ - Process attached/linked images or videos, including text replacement, layers and vectorization; prepare references and masks: [Media tool selection](references/media-tools.md)
23
36
  - Remove backgrounds, extract a subject, deliver transparent PNGs, or reconstruct an occluded object: [Matting](references/matting.md)
24
- - Operate the current AI+ Editor work: [Editor](references/editor.md)
37
+ - Operate Shape/Connector elements in a connected work; preview, save or disconnect: [Editor](references/editor.md)
25
38
  - Discover repositories, folders and tags; find, upload, download or manage DAM assets: [Asset management](references/dam.md)
26
39
  - Sign in or inspect account credits: [Authentication](references/auth.md)
27
- - Handle output, warnings, failures, interruptions or missing results: [Errors](references/errors.md)
40
+ - Track accepted/running creation, retrieve async results and interpret costs, warnings, failures or interruptions: [Errors](references/errors.md)
28
41
  - Update the CLI and bundled Agent Skill: [Update](references/update.md)
@@ -1,6 +1,6 @@
1
1
  # Agent creation
2
2
 
3
- For long creation work, submit once with `--async`, then query the returned `taskId` with `insmind-cli task get <taskId>`. Repeat queries while running; read `result` only when completed. An empty response, query timeout, unknown state, or host session ending is not a reason to generate again. If the ID is missing, use `task list` to locate the original task. The default command still waits for its result; keep waiting on that same process. See [status handling](errors.md).
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
4
 
5
5
  Read the input schema first. When specifying a model, also read its live detail:
6
6
 
@@ -8,8 +8,7 @@ Read the input schema first. When specifying a model, also read its live detail:
8
8
  insmind-cli agent send --schema
9
9
  insmind-cli model list --tool <tool>
10
10
  insmind-cli model get <model>
11
- insmind-cli agent send --input request.json --async
12
- insmind-cli task get <taskId>
11
+ insmind-cli agent send --input request.json
13
12
  ```
14
13
 
15
14
  For continued planning, generation or edits, copy `message.contextId` from the preceding result into the next request. Omit it for a new creation:
@@ -23,11 +22,17 @@ For continued planning, generation or edits, copy `message.contextId` from the p
23
22
  }
24
23
  ```
25
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
+
26
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.
27
32
 
28
33
  Before specifying a model, generation parameters or first/last frames, read [Generation constraints and media roles](generation-constraints.md).
29
34
 
30
- Use `--input -` to read JSON from stdin. The synchronous output (or result of a completed async task) contains `message` and actual credit usage for this `agent send`, excluding other tasks. Deliver text, resources, the continuation identifier and usage. When reporting totals, sum only distinct tasks whose usage you actually received. Repeated queries of one task report the same usage; do not add them again. Identify the task when quoting one charge and do not guess missing usage.
35
+ Use complete JSON with `--input -` on stdin. Generate local media URIs as described in the Skill root.
31
36
 
32
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.
33
38
 
@@ -12,6 +12,8 @@ For example, the user says “Make a promotional image for this product” witho
12
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
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
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
+
15
17
  ## Choose a route
16
18
 
17
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.
@@ -51,4 +53,4 @@ Never guess tool names, model names or parameters. For recommendations, capabili
51
53
 
52
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.
53
55
 
54
- For Agent, put each local media file in a separate `file://` URL Part. For Tool, use the media parameter defined in model detail. 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.
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.
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Discover capabilities and scope
4
4
 
5
+ This branch operates editable elements in a work identified by its ID or editor URL. For text, layers or vectors in an attachment, read [media tool selection](media-tools.md); an absent Editor Action does not prove CLI processing is unavailable.
6
+
5
7
  On first entering this task branch, read help from the installed CLI. Before constructing Actions, query the input Schema:
6
8
 
7
9
  ```bash
@@ -16,14 +18,14 @@ Keep operations serial with one operator. If the Page contains unsupported conte
16
18
 
17
19
  ## Workflow
18
20
 
19
- Completion requires structural and visual verification followed by a successful explicit save returning the public work URL.
21
+ Completion follows the user’s request: preview-only work ends with its screenshot and an explicit unsaved status; persistence requires successful save and the public URL. Verification does not override a no-save instruction.
20
22
 
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.
23
+ 1. Read `insmind-cli editor connect --help`. To continue an existing work, use its ID or link. Ask the user for it if the target is missing. Omit the target when the user wants a new Board. Browser login, loading, edit/save permissions and content checks must pass; stop editing on connection failure.
22
24
  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
25
  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
26
  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
- 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
- 6. Run `insmind-cli editor disconnect` after saving; disconnecting does not replace saving.
27
+ 5. When persistence is intended and authorized, 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. Skip saving for preview-only requests. Discover wait limits with `editor save --help`.
28
+ 6. After saving when no more work is needed, or whenever the user says the connection is no longer needed, run `insmind-cli editor disconnect` and check its disconnected receipt. Disconnecting neither replaces nor authorizes saving.
27
29
 
28
30
  Connecting replaces the old Session and opens the work. A failed precheck clears the attempted Session but leaves the browser page open. The user handles browser login or access issues, then reconnects. CLI credentials do not replace browser AI+ login; the user enters account credentials in the browser.
29
31
 
@@ -40,7 +42,7 @@ Use the latest post-Apply Snapshot for fields and relationships, and the actual
40
42
  - Shapes, text and Connectors have the intended spacing and do not overlap unexpectedly.
41
43
  - The reading direction and composition make relationships easy to follow.
42
44
 
43
- When a fix is actionable, read the latest Snapshot first and submit full element Updates, never patches. If correct Connector IDs still produce a path crossing an endpoint, resubmit that Connector's full Update to trigger native path recalculation; preserve correct business relationships. Read a new Snapshot and screenshot after visual changes. Save when no actionable issue remains.
45
+ When a fix is actionable, read the latest Snapshot first and submit full element Updates, never patches. If correct Connector IDs still produce a path crossing an endpoint, resubmit that Connector's full Update to trigger native path recalculation; preserve correct business relationships. Read a new Snapshot and screenshot after visual changes. Deliver the authorized preview or save after the requested corrections.
44
46
 
45
47
  ## Failures
46
48