@insmind/cli 2.0.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 (113) hide show
  1. package/README.md +5 -0
  2. package/contracts/operations/agent.send/input.schema.json +1 -77
  3. package/contracts/operations/credits.get/input.schema.json +8 -0
  4. package/contracts/operations/credits.get/output.schema.json +92 -0
  5. package/contracts/operations/credits.usage.get/input.schema.json +17 -0
  6. package/contracts/operations/credits.usage.get/output.schema.json +46 -0
  7. package/contracts/operations/credits.usage.list/input.schema.json +27 -0
  8. package/contracts/operations/credits.usage.list/output.schema.json +135 -0
  9. package/contracts/operations/dam.folder.list/input.schema.json +0 -1
  10. package/contracts/operations/dam.folder.list/output.schema.json +1 -2
  11. package/contracts/operations/dam.list/input.schema.json +3 -6
  12. package/contracts/operations/dam.list/output.schema.json +1 -2
  13. package/contracts/operations/dam.search/input.schema.json +3 -6
  14. package/contracts/operations/dam.search/output.schema.json +1 -2
  15. package/contracts/operations/tool.call/models/image-edit-smart.schema.json +1 -2
  16. package/contracts/operations/tool.call/models/image-expand-smart.schema.json +1 -2
  17. package/contracts/operations/tool.call/models/image-layers-smart.schema.json +1 -3
  18. package/contracts/operations/tool.call/models/video-edit-smart.schema.json +0 -3
  19. package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
  20. package/dist/bin/postinstall.js +22 -6
  21. package/dist/bin/task-worker.js +2 -2
  22. package/dist/src/bootstrap/create-cli.js +31 -15
  23. package/dist/src/bootstrap/create-runtime.js +103 -30
  24. package/dist/src/bootstrap/run-task-worker.js +6 -2
  25. package/dist/src/bootstrap/validators.js +4 -1
  26. package/dist/src/cli/action-binding.js +17 -50
  27. package/dist/src/cli/agent-commands.js +11 -11
  28. package/dist/src/cli/auth-commands.js +2 -1
  29. package/dist/src/cli/creation-help.js +9 -0
  30. package/dist/src/cli/credits-command.js +127 -16
  31. package/dist/src/cli/dam-commands.js +10 -14
  32. package/dist/src/cli/editor-commands.js +7 -5
  33. package/dist/src/cli/errors.js +81 -22
  34. package/dist/src/cli/host-input.js +64 -5
  35. package/dist/src/cli/model-commands.js +9 -3
  36. package/dist/src/cli/observed-errors.js +7 -3
  37. package/dist/src/cli/org-commands.js +3 -1
  38. package/dist/src/cli/presenter.js +4 -0
  39. package/dist/src/cli/task-commands.js +6 -2
  40. package/dist/src/cli/tool-commands.js +12 -11
  41. package/dist/src/cli/update-command.js +24 -1
  42. package/dist/src/features/agent/creative-agent-adapter.js +6 -2
  43. package/dist/src/features/agent/creative-protocol.js +8 -29
  44. package/dist/src/features/agent/resource-authorizer.js +25 -17
  45. package/dist/src/features/agent/result-reader.js +31 -14
  46. package/dist/src/features/agent/use-cases.js +6 -31
  47. package/dist/src/features/credits/amount.js +51 -0
  48. package/dist/src/features/credits/response.js +11 -0
  49. package/dist/src/features/credits/use-cases.js +200 -30
  50. package/dist/src/features/dam/asset-projection.js +3 -6
  51. package/dist/src/features/dam/dam-api-adapter.js +30 -15
  52. package/dist/src/features/dam/repository-catalog.js +30 -21
  53. package/dist/src/features/dam/use-cases.js +12 -7
  54. package/dist/src/features/editor/bridge-client.js +0 -2
  55. package/dist/src/features/editor/public-url.js +1 -36
  56. package/dist/src/features/editor/session.js +3 -2
  57. package/dist/src/features/editor/use-cases.js +27 -2
  58. package/dist/src/features/org/org-service.js +10 -1
  59. package/dist/src/features/org/use-cases.js +18 -4
  60. package/dist/src/features/task/process-owner.js +54 -0
  61. package/dist/src/features/task/store.js +37 -10
  62. package/dist/src/features/task/task-background.js +5 -2
  63. package/dist/src/features/task/use-cases.js +184 -84
  64. package/dist/src/features/tool/argument-paths.js +14 -0
  65. package/dist/src/features/tool/canvas-copy.js +28 -15
  66. package/dist/src/features/tool/canvas-matting.js +123 -0
  67. package/dist/src/features/tool/canvas-media.js +100 -52
  68. package/dist/src/features/tool/canvas-models.js +66 -33
  69. package/dist/src/features/tool/canvas-pricing.js +12 -0
  70. package/dist/src/features/tool/canvas-recovery.js +13 -30
  71. package/dist/src/features/tool/canvas-results.js +79 -87
  72. package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
  73. package/dist/src/features/tool/canvas-video.js +44 -37
  74. package/dist/src/features/tool/dynamic-schema.js +39 -40
  75. package/dist/src/features/tool/ffprobe-executable.js +21 -0
  76. package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
  77. package/dist/src/features/tool/resource-authorizer.js +11 -3
  78. package/dist/src/features/tool/tool-api-adapter.js +73 -82
  79. package/dist/src/features/tool/tool-errors.js +25 -0
  80. package/dist/src/features/tool/tool-output.js +15 -0
  81. package/dist/src/features/tool/use-cases.js +74 -98
  82. package/dist/src/features/update/check-schema.js +17 -0
  83. package/dist/src/features/update/host-receipt.js +30 -0
  84. package/dist/src/features/update/notice-output.js +30 -0
  85. package/dist/src/features/update/update-lock.js +80 -0
  86. package/dist/src/features/update/update-notification.js +129 -240
  87. package/dist/src/features/update/update-service.js +95 -21
  88. package/dist/src/platform/media-type.js +46 -0
  89. package/dist/src/platform/public-url.js +35 -0
  90. package/dist/src/platform/remote-error-evidence.js +33 -6
  91. package/dist/src/platform/resource-auth-key.js +35 -1
  92. package/dist/src/platform/safe-upload-file.js +36 -41
  93. package/dist/src/platform/signature.js +3 -1
  94. package/dist/src/platform/signed-http-transport.js +14 -6
  95. package/dist/src/platform/url-safety.js +6 -1
  96. package/dist/src/platform/webm-header.js +41 -0
  97. package/dist/src/telemetry/command-route.js +38 -0
  98. package/dist/src/telemetry/command-routes.json +1 -0
  99. package/dist/src/telemetry/failure-summary.js +1 -1
  100. package/dist/src/telemetry/invocation.js +1 -2
  101. package/dist/src/telemetry/process-errors.js +17 -33
  102. package/dist/src/telemetry/sanitize.js +19 -4
  103. package/dist/src/telemetry/sls-sink.js +8 -0
  104. package/package.json +4 -4
  105. package/skills/insmind-cli/SKILL.md +19 -5
  106. package/skills/insmind-cli/references/agent.md +9 -4
  107. package/skills/insmind-cli/references/creation.md +3 -1
  108. package/skills/insmind-cli/references/editor.md +7 -5
  109. package/skills/insmind-cli/references/errors.md +20 -9
  110. package/skills/insmind-cli/references/matting.md +3 -5
  111. package/skills/insmind-cli/references/media-tools.md +10 -4
  112. package/skills/insmind-cli/references/tool.md +9 -15
  113. package/skills/insmind-cli/references/update.md +2 -0
@@ -1,27 +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
+ - Relay an available update to the user alongside their foreground result, at most once per hour. For stdout-only hosts, see “Update” below.
12
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 `#`.
13
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.
14
18
  - Discovery describes the installed CLI; it neither upgrades it nor authorizes generation, writes or installation. Recover unknown outcomes through the error-handling reference.
15
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
+
16
30
  ## Read task guidance
17
31
 
18
32
  Read only the reference for the user's goal:
19
33
 
20
34
  - Choose Agent or Tool creation, discover models, and generate images, videos or text: [Creation](references/creation.md)
21
- - 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)
22
36
  - Remove backgrounds, extract a subject, deliver transparent PNGs, or reconstruct an occluded object: [Matting](references/matting.md)
23
- - 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)
24
38
  - Discover repositories, folders and tags; find, upload, download or manage DAM assets: [Asset management](references/dam.md)
25
39
  - Sign in or inspect account credits: [Authentication](references/auth.md)
26
- - 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)
27
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
 
@@ -2,13 +2,14 @@
2
2
 
3
3
  - `stdout` contains results only. Parse structured command JSON directly.
4
4
  - `stderr` contains warnings, authorization notices and errors. Keep them separate from results.
5
- - Exit `0`: success.
6
- - Exit `1`: runtime, service or state failure. Follow explicit `error.details.next_steps`; if none are provided, stop and report.
7
- - Exit `2`: command or argument error. Read the command's `--help` and correct the invocation.
5
+ - Exit `0`: command success. Async submission means acceptance; a successful task query still requires reading state.
6
+ - Exit `1`: runtime, service or state failure. Recover from facts in `error.code/message/details` and `error.details.next_steps`. Query the original task after query failures and inspect state before repeating an unconfirmed write.
7
+ - Exit `2`: command/input error. Use `details.reason/field/issues` with help/Schema to correct the stated issue. A mask-format error calls for fixing the mask; a file-access error calls for checking its path. Do not conflate them.
8
8
  - Exit `130`: user interruption. Stop immediately; do not retry automatically.
9
9
  - `INSUFFICIENT_CREDITS` only means available credits were insufficient for this operation. It does not distinguish account balance, member limits or other charging restrictions. Do not automatically recommend a purchase or treat a balance check or price quote as a guarantee that charging will succeed.
10
10
 
11
- ## Missing creation output
11
+
12
+ ## Continuing tasks and missing output
12
13
 
13
14
  If an Agent or Tool request may already have been submitted, empty output, long execution or a host's completed-script message does not justify another creation. The original command prints a Task ID to stderr; a known ID is also retained in the final error recovery details. Continue waiting if its execution session remains available; otherwise query the original task:
14
15
 
@@ -19,13 +20,23 @@ insmind-cli task get <id>
19
20
 
20
21
  Use a known ID directly. Otherwise locate the task by time, operation and input summary. Ask the user when multiple candidates cannot be distinguished; do not automatically pick the newest.
21
22
 
22
- - `completed`: deliver `result`; use its `message.contextId` for continuation.
23
- - `running`: the original execution is updating or the Tool is processing. Query the same ID again after a few seconds.
23
+ - `completed`: Tool returns content; Agent returns message.parts, which may contain text or questions. Deliver the actual reply/assets or ask the user, then follow [Agent creation](agent.md).
24
+ - `running` means the original execution is still active. For delivery now, keep checking the same ID every few seconds. For later pickup, hand off the state and ID now and check when the user returns.
24
25
  - `unknown`: completion is unconfirmed. Recheck the same ID; explain if it remains unknown. `partialResult` is a message snapshot, not a complete deliverable.
25
- - `failed`: report `note` and the original error; do not resubmit automatically.
26
+ - On `failed`, explain the cause in `note` and the original error. Correct an input and call again when it was explicitly never dispatched. After a service refusal, tell the user there is no deliverable. Switching models or changing settings starts a new creation and requires a revised request or authorization for another attempt.
26
27
 
27
28
  A query error, including a task-not-found response, does not mean the original creation failed. Keep the original task ID; do not generate again.
28
29
 
29
- Exit `0` from `task get` means the query succeeded; `state` determines whether the creation completed. Repeated reads of one ID return the same usage, which must not be added again. Do not resume waiting or resubmit after a user interruption.
30
+ Exit `0` from `task get` means the query succeeded; `state` determines whether the creation completed. Stop tracking on delivery, definite failure or an explainable unknown blocker. Preserve the ID when the user requests later retrieval; stop after user interruption without resubmitting.
31
+
32
+ ## Cost sources
33
+
34
+ | Source | Meaning |
35
+ | --- | --- |
36
+ | Model catalog / Tool `usage.cost.minimum/maximum` | Catalog estimate/range, even when equal; missing cost does not mean free |
37
+ | Agent `usage.cost.amount` | Service-confirmed actual cost of this invocation; sum distinct taskIds only |
38
+ | `credits usage list/get` | Matching ledger consumption/restoration; read help for pagination/types rather than guessing a task’s cost from a page total or balance change |
39
+
40
+ Repeated reads of one ID return the same usage, not extra charges. Do not volunteer an unverified deduction when the user did not ask. Deliver Tool results directly; if quoting, call it an estimate. State that actual cost is unverified when a ledger record cannot be matched.
30
41
 
31
- Do not infer internal causes from unknown errors or disclose local credentials, request signatures or sensitive URL query values. If safe recovery steps are absent, preserve the public error code from stderr and explain the failure.
42
+ Do not infer internal causes from unknown errors or disclose local credentials, request signatures or sensitive URLs from diagnostics. Resource links explicitly returned for delivery are task results: preserve their complete values instead of applying diagnostic redaction and breaking the download link. If safe recovery steps are absent, preserve the public error code from stderr and explain the failure.
@@ -7,7 +7,7 @@ Distinguish preserving visible source pixels from reconstructing a complete subj
7
7
  | Goal | Workflow | Boundary |
8
8
  | --- | --- | --- |
9
9
  | Remove a background while preserving an intact product, face, text or texture | Standard matting: separate the visible foreground from the original | Does not reconstruct hidden parts; inspect fine edges, hair, translucent materials and occlusion |
10
- | Extract an obstructed object and complete its hidden parts, or redraw a selected subject from a complex scene | When reconstruction is authorized, redraw from the reference, then apply standard matting to the redraw | Reconstructed details are generated guesses and may change geometry or texture; do not describe them as exact recovery |
10
+ | Extract an obstructed object and complete its hidden parts, or redraw a selected subject from a complex scene | When reconstruction is authorized, discover smart matting with redraw and transparent postprocessing included; one call returns the final PNG | Reconstructed details are generated guesses and may change geometry or texture; do not describe them as exact recovery |
11
11
 
12
12
  A complex background alone does not require redrawing. For strict fidelity or a no-redraw constraint, prefer standard matting; explain limitations or request a more complete source if necessary. An explicit request to complete hidden parts authorizes reconstruction within that scope.
13
13
 
@@ -22,8 +22,6 @@ A reconstruction prompt can specify: “Use the selected subject in this referen
22
22
 
23
23
  ## Verify and deliver
24
24
 
25
- - The calling Agent or user downloads the output and inspects the actual format, dimensions and transparency. An extension, MIME declaration or model claim does not establish matting quality. Review the background and visible subject together rather than merely checking that alpha exists. Maximum alpha need not equal 255: hair, glass and shadows can be translucent. Do not use an alpha-maximum pass threshold or force opacity.
26
- - Inspect against both light and dark backgrounds for edge damage, holes, hair, translucent regions, leftover background and baked checkerboards. Keep the original dimensions or crop to the subject as requested.
27
- - For reconstruction, compare product geometry, marks, identity and visible details. Identify generated completions without promising pixel fidelity.
25
+ - When the user requests a review or a revision, refer to the delivered file and the area they identified. Explain which details were generated during reconstruction.
28
26
  - Deliver the file or an authorized download link. A redraw or mask alone does not complete transparent matting; preserve intermediate results and state what remains.
29
- - Explain costs from actual stage usage; do not present estimates as deductions. After acceptance, an interruption, timeout or postprocessing failure calls for querying the original task through [Errors](errors.md), not blindly repeating successful paid generation.
27
+ - Internal smart-matting stages belong to one Tool call and are not separately added as charges. Tool returns catalog estimates; use the [cost sources](errors.md#cost-sources) for actual charges. After acceptance, an interruption, timeout or postprocessing failure calls for querying the original task through [Errors](errors.md), not blindly repeating successful paid generation.
@@ -2,6 +2,8 @@
2
2
 
3
3
  First choose Agent or Tool through [creation](creation.md). These guidelines select a Tool for a single operation; business orchestration still uses Agent. Honor explicitly requested routes and models.
4
4
 
5
+ Attached images and media links are processing targets, including text inside images, layer decomposition and vectorization. Discover `tool list` before concluding that these operations are unavailable. Editor operates connected work elements; it does not require converting attachments to a Board first.
6
+
5
7
  ## Select by purpose
6
8
 
7
9
  | Goal | Discovery direction |
@@ -20,20 +22,24 @@ Use the public model identifier and description rather than matching backend dis
20
22
 
21
23
  Identify the current source, target changes and content to preserve. Include only necessary references and assign each a subject, style, color or layout role. Organize the prompt as target → change → preserved content → reference roles → output requirements, using the user's request and confirmed media. For style-only references, name the borrowed qualities; prefer relevant references to reduce conflicting instructions about ignoring a prominent subject. Put structured model controls in their actual fields.
22
24
 
23
- Expansion uses natural-pixel canvas dimensions and source top-left placement without implicit scaling. Keep source, selection and references in their Schema-defined fields; a reference image is not a mask.
25
+ For expansion, distinguish an exact output pixel size from a requested aspect ratio. Use the selected model’s canvas and placement descriptions to set the source position, layout and resolution. Keep source, selection and references in their Schema-defined fields; a reference image is not a mask.
26
+
27
+ Requirements such as preserving text/details or avoiding redrawing guide model selection and input construction. Do not turn them into an unrequested pixel-for-pixel identity threshold. Read the relevant model details, invoke the requested processing, deliver readable service results and describe observed differences. The possibility of detail changes alone does not establish that every Tool is unsuitable.
28
+
29
+ A model prerequisite is not a Tool-wide restriction. Before submission, if missing local dependencies or unavailable inputs block one model, inspect other models of the same Tool. Choose another only when the user has not fixed the model and it meets the explicit requirements. Do not silently relax fidelity constraints or replace a requested model; explain the specific gap if no suitable route exists. Prepare intermediate files in the current writable work directory; an unwritable temporary path does not mean the CLI lacks the capability.
24
30
 
25
31
  ## Review masks before submission
26
32
 
27
- 1. Read the selected model's mask requirements, including whether it is required, its file rules and selection semantics. Use a mask for this exact source. A valid file can still select the wrong location.
33
+ 1. Read the selected model’s mask requirements and whether it is required. For binary PNGs, use only pure black/white RGB and alpha 255 if present, matching the auto-oriented source dimensions. Gray antialiasing, transparency and a user’s colored selection preview are not a mask. Prepare a separate mask from the selection and use the unmarked source image. File validity does not prove correct selection.
28
34
  2. View the auto-oriented source and mask, then overlay the selection on the source for review. Verify that white covers the intended subject/part without omissions and black covers protected content. Check contours, holes, edges and alignment for shifts, stretching or background selection. The overlay is only a review preview; submit the original mask required by the Schema.
29
35
  3. White must be nonempty. Use an all-white mask only for an explicitly requested whole-image operation. Follow the target's contour rather than inventing an arbitrary rectangle, unless the user selected a rectangular region. Correct misplaced selections before submitting; ask for a selection or target clarification when reliable localization is unavailable.
30
- 4. A smart model may use an optional mask only as a visual boundary cue. Consult its description; this does not guarantee unchanged pixels outside the selection. Compare protected content before delivery.
36
+ 4. A smart model may use an optional mask only as a visual boundary cue. Consult its description; this does not guarantee unchanged pixels outside the selection. Prepare a mask only when actually supplying one; an optional mask is not mandatory when text can identify the target. Follow the delivery boundaries below for result review.
31
37
 
32
38
  ## Execute and deliver
33
39
 
34
40
  Submit once following [Tool](tool.md) and wait for that task. Read current metered prices and formulas; quotes are not deductions. Query the original task after interruption rather than repeating processing, uploads or settlement.
35
41
 
36
- The calling Agent or user reviews visual/audio effects; CLI quality thresholds do not decide success. Compare protected regions after editing/removal, placement and canvas after expansion, all relevant text after replacement, OCR coordinates against the returned recognition image, native template layers/resources, actual SVG contents, and video duration, frames and sound. Audio presence does not establish soundtrack preservation. Deliver the actual service result and describe observed deviations; iterate within user authorization rather than automatically changing models or regenerating poor results.
42
+ Deliver a readable service result first. When the user requests an effect review, examine relevant text, placement, layers or sound and describe deviations. Audio presence does not establish soundtrack preservation; a layer limit does not guarantee separate objects. Effects do not change the fact of CLI delivery. Further creation follows user authorization, rather than automatically changing models, increasing layers or regenerating.
37
43
 
38
44
  Distinguish layer goals: layout decomposition targets editable text, images and layout; smart decomposition separates objects into individual layers. A layer limit does not guarantee the actual layer count, and object decomposition is not per-character OCR. Select from the current catalog and deliver the native JSON and resources, not PSD. If editor import is requested, discover the supported operations via [Editor](editor.md) and verify editable text, layers and substituted fonts.
39
45
 
@@ -1,6 +1,6 @@
1
1
  # Tool 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
  Discover live metadata in this order:
6
6
 
@@ -8,23 +8,17 @@ Discover live metadata in this order:
8
8
  insmind-cli tool list
9
9
  insmind-cli model list --tool <tool>
10
10
  insmind-cli model get <model> --tool <tool>
11
- insmind-cli tool call <tool> --input request.json --async
12
- insmind-cli task get <taskId>
11
+ insmind-cli tool call <tool> --input request.json
13
12
  ```
14
13
 
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.
14
+ 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 default is a suggested value. Supply every field in the selected schema’s required list, including one with a default. 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.
16
15
 
17
- Copy the returned `model` identifier into the top-level `model` field of request JSON (runtime `arguments.model`), alongside its parameters:
16
+ Set `"model": "<model>"` at the top level of the request (runtime `arguments.model`) alongside `host_application` and the fields for that model. Keep ordered references in their declared field. For example, a model declaring `image_urls` takes `["file:///inputs/product.png", "https://example.com/style.png"]`. Preserve order and repeats.
18
17
 
19
- ```json
20
- {
21
- "host_application": "<invoking application>",
22
- "model": "<model>",
23
- "prompt": "<required prompt>",
24
- "<parameter>": "<value>"
25
- }
26
- ```
18
+ Generate attachment URIs using the Skill root instructions and write those exact values into the request object, rather than typing file URIs with raw Unicode, spaces or `#`. Write complete JSON to a file or stdin; the JSON file path and the media URIs are different inputs.
19
+
20
+ Success returns `content` and `usage`. Content can include text, resource links and embedded JSON. Tool `usage.cost.minimum/maximum` is a catalog estimate even when both values are equal. Missing cost means no estimate, not free. For actual charges, use the [cost sources](errors.md#cost-sources).
27
21
 
28
- Success returns `content` and `usage`. Content contains text or resource links; usage identifies the model and the published credit price range, not an actual charge.
22
+ Deliver the existing service result first and describe observed deviations. Further creation follows the user’s request, rather than another paid call to meet a private quality score. Label locally written SVGs, interpolated upscaling or other local edits as such; they are not evidence of calling the corresponding Tool.
29
23
 
30
- Keep each resource link, returned name, local path and display name together. Preserve the association through downloads, renames and reordering; do not pair results by request order. Check each final link's content against its name before delivery, viewing the resource when necessary.
24
+ Keep each resource link, returned name, local path and display name together. Preserve the association through downloads, renames and reordering; do not pair results by request order. Deliver each part as returned. If only a cover was returned, share it and say that no identifiable video was received. Do not guess an unknown attachment type or submit another creation.
@@ -1,5 +1,7 @@
1
1
  # Update
2
2
 
3
+ Relay an update alongside the foreground business result. In a stdout-only host, discover `check` through `insmind-cli update --help`. On first foreground use or after an hour, set `CLI_HOST_APPLICATION` to the actual host, run `insmind-cli update check --json --for-display`, and relay the returned `notice` if present. Ordinary `update check --json` queries do not spend a display slot. For an older CLI, compare its actual version to `npm view @insmind/cli dist-tags.latest` only for a confirmed user installation. Continue the task if the check is unavailable.
4
+
3
5
  When the user requests an upgrade or approves resolving a compatibility issue, discover the current installation channel's update behavior before updating:
4
6
 
5
7
  ```bash