@insmind/cli 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/operations/agent.send/input.schema.json +1 -77
- package/contracts/operations/dam.folder.list/input.schema.json +0 -1
- package/contracts/operations/dam.folder.list/output.schema.json +1 -2
- package/contracts/operations/dam.list/input.schema.json +3 -6
- package/contracts/operations/dam.list/output.schema.json +1 -2
- package/contracts/operations/dam.search/input.schema.json +3 -6
- package/contracts/operations/dam.search/output.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-edit-smart.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-expand-smart.schema.json +1 -2
- package/contracts/operations/tool.call/models/image-layers-smart.schema.json +1 -3
- package/contracts/operations/tool.call/models/video-edit-smart.schema.json +0 -3
- package/contracts/operations/tool.call/ocr-payload.schema.json +4 -5
- package/dist/bin/postinstall.js +22 -6
- package/dist/bin/task-worker.js +2 -2
- package/dist/src/bootstrap/create-cli.js +13 -6
- package/dist/src/bootstrap/create-runtime.js +98 -28
- package/dist/src/bootstrap/run-task-worker.js +6 -2
- package/dist/src/bootstrap/validators.js +1 -1
- package/dist/src/cli/action-binding.js +14 -37
- package/dist/src/cli/agent-commands.js +11 -11
- package/dist/src/cli/auth-commands.js +2 -1
- package/dist/src/cli/creation-help.js +9 -0
- package/dist/src/cli/dam-commands.js +10 -14
- package/dist/src/cli/editor-commands.js +7 -5
- package/dist/src/cli/errors.js +81 -22
- package/dist/src/cli/host-input.js +64 -5
- package/dist/src/cli/model-commands.js +9 -3
- package/dist/src/cli/observed-errors.js +7 -3
- package/dist/src/cli/org-commands.js +3 -1
- package/dist/src/cli/task-commands.js +6 -2
- package/dist/src/cli/tool-commands.js +12 -11
- package/dist/src/features/agent/creative-agent-adapter.js +6 -2
- package/dist/src/features/agent/creative-protocol.js +8 -29
- package/dist/src/features/agent/resource-authorizer.js +25 -17
- package/dist/src/features/agent/result-reader.js +31 -14
- package/dist/src/features/agent/use-cases.js +6 -31
- package/dist/src/features/credits/use-cases.js +55 -28
- package/dist/src/features/dam/asset-projection.js +3 -6
- package/dist/src/features/dam/dam-api-adapter.js +30 -15
- package/dist/src/features/dam/repository-catalog.js +30 -21
- package/dist/src/features/dam/use-cases.js +12 -7
- package/dist/src/features/editor/bridge-client.js +0 -2
- package/dist/src/features/editor/public-url.js +1 -36
- package/dist/src/features/editor/session.js +3 -2
- package/dist/src/features/editor/use-cases.js +27 -2
- package/dist/src/features/org/org-service.js +10 -1
- package/dist/src/features/org/use-cases.js +18 -4
- package/dist/src/features/task/process-owner.js +54 -0
- package/dist/src/features/task/store.js +37 -10
- package/dist/src/features/task/task-background.js +5 -2
- package/dist/src/features/task/use-cases.js +184 -84
- package/dist/src/features/tool/argument-paths.js +14 -0
- package/dist/src/features/tool/canvas-copy.js +28 -15
- package/dist/src/features/tool/canvas-matting.js +123 -0
- package/dist/src/features/tool/canvas-media.js +100 -52
- package/dist/src/features/tool/canvas-models.js +66 -33
- package/dist/src/features/tool/canvas-pricing.js +12 -0
- package/dist/src/features/tool/canvas-recovery.js +13 -30
- package/dist/src/features/tool/canvas-results.js +79 -87
- package/dist/src/features/tool/canvas-tool-adapter.js +134 -157
- package/dist/src/features/tool/canvas-video.js +44 -37
- package/dist/src/features/tool/dynamic-schema.js +39 -40
- package/dist/src/features/tool/ffprobe-executable.js +21 -0
- package/dist/src/features/tool/mns-catalog-adapter.js +61 -24
- package/dist/src/features/tool/resource-authorizer.js +11 -3
- package/dist/src/features/tool/tool-api-adapter.js +73 -82
- package/dist/src/features/tool/tool-errors.js +25 -0
- package/dist/src/features/tool/tool-output.js +15 -0
- package/dist/src/features/tool/use-cases.js +74 -98
- package/dist/src/features/update/update-service.js +95 -21
- package/dist/src/platform/media-type.js +46 -0
- package/dist/src/platform/public-url.js +35 -0
- package/dist/src/platform/remote-error-evidence.js +33 -6
- package/dist/src/platform/resource-auth-key.js +35 -1
- package/dist/src/platform/safe-upload-file.js +36 -41
- package/dist/src/platform/signature.js +2 -2
- package/dist/src/platform/signed-http-transport.js +4 -1
- package/dist/src/platform/url-safety.js +6 -1
- package/dist/src/platform/webm-header.js +41 -0
- package/dist/src/telemetry/command-route.js +38 -0
- package/dist/src/telemetry/command-routes.json +1 -0
- package/dist/src/telemetry/failure-summary.js +1 -1
- package/dist/src/telemetry/invocation.js +1 -2
- package/dist/src/telemetry/process-errors.js +17 -33
- package/dist/src/telemetry/sanitize.js +19 -4
- package/dist/src/telemetry/sls-sink.js +8 -0
- package/package.json +4 -4
- package/skills/insmind-cli/SKILL.md +18 -5
- package/skills/insmind-cli/references/agent.md +9 -4
- package/skills/insmind-cli/references/creation.md +3 -1
- package/skills/insmind-cli/references/editor.md +7 -5
- package/skills/insmind-cli/references/errors.md +20 -9
- package/skills/insmind-cli/references/matting.md +3 -5
- package/skills/insmind-cli/references/media-tools.md +10 -4
- package/skills/insmind-cli/references/tool.md +9 -15
|
@@ -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.
|
|
7
|
-
- Exit `2`: command
|
|
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
|
-
|
|
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`:
|
|
23
|
-
- `running
|
|
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
|
|
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.
|
|
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
|
|
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
|
|
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
|
-
-
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|