@insmind/cli 1.8.0 → 1.9.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 (92) hide show
  1. package/contracts/operations/model.get/input.schema.json +5 -0
  2. package/contracts/operations/model.get/output.schema.json +9 -1
  3. package/contracts/operations/tool.call/canvas-input.schema.json +60 -0
  4. package/contracts/operations/tool.call/models/image-edit-smart.schema.json +39 -0
  5. package/contracts/operations/tool.call/models/image-edit-standard.schema.json +31 -0
  6. package/contracts/operations/tool.call/models/image-enhance-smart.schema.json +26 -0
  7. package/contracts/operations/tool.call/models/image-enhance-standard.schema.json +25 -0
  8. package/contracts/operations/tool.call/models/image-expand-smart.schema.json +72 -0
  9. package/contracts/operations/tool.call/models/image-expand-standard.schema.json +58 -0
  10. package/contracts/operations/tool.call/models/image-layers-layout.schema.json +20 -0
  11. package/contracts/operations/tool.call/models/image-layers-smart.schema.json +26 -0
  12. package/contracts/operations/tool.call/models/image-matting-smart.schema.json +34 -0
  13. package/contracts/operations/tool.call/models/image-matting-standard.schema.json +24 -0
  14. package/contracts/operations/tool.call/models/image-ocr.schema.json +20 -0
  15. package/contracts/operations/tool.call/models/image-remove-smart.schema.json +30 -0
  16. package/contracts/operations/tool.call/models/image-remove-standard.schema.json +25 -0
  17. package/contracts/operations/tool.call/models/image-text-edit.schema.json +43 -0
  18. package/contracts/operations/tool.call/models/image-vectorize.schema.json +20 -0
  19. package/contracts/operations/tool.call/models/video-edit-smart.schema.json +68 -0
  20. package/contracts/operations/tool.call/models/video-enhance-smart.schema.json +32 -0
  21. package/contracts/operations/tool.call/models/video-enhance-standard.schema.json +26 -0
  22. package/contracts/operations/tool.call/ocr-payload.schema.json +65 -0
  23. package/contracts/operations/tool.call/output.schema.json +38 -0
  24. package/contracts/operations/tool.call/template-payload.schema.json +95 -0
  25. package/dist/bin/insmind-cli.js +31 -24
  26. package/dist/bin/task-worker.js +4 -1
  27. package/dist/src/analytics/device.js +2 -2
  28. package/dist/src/bootstrap/create-cli.js +7 -0
  29. package/dist/src/bootstrap/create-runtime.js +53 -30
  30. package/dist/src/bootstrap/run-task-worker.js +5 -1
  31. package/dist/src/bootstrap/validators.js +11 -4
  32. package/dist/src/cli/agent-commands.js +1 -0
  33. package/dist/src/cli/dam-commands.js +3 -3
  34. package/dist/src/cli/errors.js +63 -15
  35. package/dist/src/cli/model-commands.js +6 -3
  36. package/dist/src/cli/observed-errors.js +3 -1
  37. package/dist/src/cli/tool-commands.js +2 -0
  38. package/dist/src/contracts/schema.js +4 -1
  39. package/dist/src/features/agent/creative-agent-adapter.js +37 -11
  40. package/dist/src/features/agent/creative-protocol.js +31 -10
  41. package/dist/src/features/agent/creative-stream.js +54 -6
  42. package/dist/src/features/agent/resource-authorizer.js +1 -0
  43. package/dist/src/features/agent/result-reader.js +3 -1
  44. package/dist/src/features/agent/use-cases.js +15 -5
  45. package/dist/src/features/auth/credential-store.js +6 -10
  46. package/dist/src/features/auth/sso-service.js +22 -6
  47. package/dist/src/features/auth/state.js +6 -0
  48. package/dist/src/features/auth/use-cases.js +90 -32
  49. package/dist/src/features/dam/asset-projection.js +10 -1
  50. package/dist/src/features/dam/dam-api-adapter.js +30 -15
  51. package/dist/src/features/dam/input.js +23 -0
  52. package/dist/src/features/dam/use-cases.js +32 -22
  53. package/dist/src/features/task/store.js +5 -5
  54. package/dist/src/features/task/task-background.js +67 -19
  55. package/dist/src/features/task/use-cases.js +38 -9
  56. package/dist/src/features/tool/canvas-copy.js +61 -0
  57. package/dist/src/features/tool/canvas-media.js +248 -0
  58. package/dist/src/features/tool/canvas-models.js +109 -0
  59. package/dist/src/features/tool/canvas-pricing.js +81 -0
  60. package/dist/src/features/tool/canvas-recovery.js +68 -0
  61. package/dist/src/features/tool/canvas-results.js +144 -0
  62. package/dist/src/features/tool/canvas-tool-adapter.js +366 -0
  63. package/dist/src/features/tool/canvas-video.js +84 -0
  64. package/dist/src/features/tool/catalog.js +35 -13
  65. package/dist/src/features/tool/dynamic-schema.js +55 -25
  66. package/dist/src/features/tool/matting-billing.js +115 -0
  67. package/dist/src/features/tool/mns-catalog-adapter.js +66 -19
  68. package/dist/src/features/tool/resource-authorizer.js +34 -0
  69. package/dist/src/features/tool/scene-catalog-adapter.js +35 -0
  70. package/dist/src/features/tool/tool-api-adapter.js +29 -17
  71. package/dist/src/features/tool/use-cases.js +28 -3
  72. package/dist/src/platform/file-lock.js +58 -15
  73. package/dist/src/platform/input-uri.js +105 -0
  74. package/dist/src/platform/local-json-file.js +7 -4
  75. package/dist/src/platform/remote-error-evidence.js +23 -1
  76. package/dist/src/platform/safe-upload-file.js +18 -4
  77. package/dist/src/platform/schema-issues.js +18 -0
  78. package/dist/src/platform/signed-http-transport.js +77 -16
  79. package/dist/src/platform/text-output.js +55 -13
  80. package/dist/src/product/config.js +12 -1
  81. package/dist/src/telemetry/failure-summary.js +53 -2
  82. package/dist/src/telemetry/host-diagnostics.js +95 -0
  83. package/dist/src/telemetry/invocation.js +24 -3
  84. package/dist/src/telemetry/process-errors.js +2 -1
  85. package/dist/src/telemetry/sls-sink.js +66 -18
  86. package/package.json +5 -4
  87. package/skills/insmind-cli/SKILL.md +2 -0
  88. package/skills/insmind-cli/references/creation.md +2 -0
  89. package/skills/insmind-cli/references/generation-constraints.md +3 -1
  90. package/skills/insmind-cli/references/matting.md +29 -0
  91. package/skills/insmind-cli/references/media-tools.md +40 -0
  92. package/skills/insmind-cli/references/tool.md +1 -1
@@ -0,0 +1,29 @@
1
+ # Matting and transparent output
2
+
3
+ Distinguish preserving visible source pixels from reconstructing a complete subject. A white background, a baked checkerboard and a file with real transparency are different deliverables.
4
+
5
+ ## Choose the workflow
6
+
7
+ | Goal | Workflow | Boundary |
8
+ | --- | --- | --- |
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 |
11
+
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
+
14
+ ## Discover and execute
15
+
16
+ 1. Follow [Creation](creation.md) to discover current Tools and Models, relevant help, public Schema and the selected Model detail. Determine whether the capability returns real transparency or only an intermediate redraw. A model title is not an output contract. Availability, parameters and prices depend on the current product and account.
17
+ 2. Standard matting and smart matting that already includes redraw/segmentation can both be atomic [Tool](tool.md) calls. Use [Agent](agent.md) when the user's task requires business planning, orchestration or multiple outputs. When supplying a mask, follow [mask review](media-tools.md#review-masks-before-submission) to inspect the source, mask and overlay. Never treat internal algorithms, editor entries or historical test-suite names as CLI models.
18
+ 3. Use the current source supplied by the user. For reconstruction, identify the subject, missing parts and structure/proportions to retain. If the discovered smart matting model already promises a transparent PNG, inspect that final file and do not pay for a second standard matting call. Only when the selected capability returns an intermediate redraw should you pass that actual redraw into a separate matting step. Do not matte the old occluded input or reuse another image's dimensions.
19
+ 4. If no transparent-matting capability is discoverable, report the gap. A transparency prompt, white background or checkerboard is not a substitute. Do not use internal endpoints to bypass product entitlements. An available redraw may be delivered as an intermediate result with the unfinished transparency step stated clearly.
20
+
21
+ A reconstruction prompt can specify: “Use the selected subject in this reference, complete these hidden parts, preserve these visible features and proportions, and render the complete subject against an easily separable solid background. Do not draw a checkerboard or add text or other objects.” Populate constraints from the request; the prompt itself does not create an alpha channel.
22
+
23
+ ## Verify and deliver
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.
28
+ - 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.
@@ -0,0 +1,40 @@
1
+ # Image and video processing
2
+
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
+
5
+ ## Select by purpose
6
+
7
+ | Goal | Discovery direction |
8
+ | --- | --- |
9
+ | Create a new image, recreate from references, change overall style or blend images | `image.generate`; a reference image or the word “edit” alone does not require `image.edit` |
10
+ | Create a new video from text, images, first/last frames or references | `video.generate`; supported input combinations depend on the model Schema |
11
+ | Edit a particular target or selected region in an existing image | `image.edit` |
12
+ | Remove a background/object, enhance clarity, expand a canvas, replace/read text, decompose layers or vectorize | Discover the purpose-specific Tool rather than routing every image task to `image.edit` |
13
+ | Modify an existing video's content, or enhance its clarity | Discover `video.edit` or `video.enhance` respectively; generating video from an image still uses `video.generate` |
14
+
15
+ Read `tool list`, the relevant `model list --tool <tool>`, then `model get <model> --tool <tool>`. Use the complete `inputSchema`, purpose and current quote. Availability, fields and options come from this task's discovery; one model's fields do not apply to every Tool.
16
+
17
+ ## Select a model and prepare inputs
18
+
19
+ Use the public model identifier and description rather than matching backend display names. Standard/smart are stable public categories, but the difference is specific to each Tool: standard matting separates visible source pixels, while smart matting redraws before segmentation; ordinary upscaling differs from generative restoration. Standard editing, erasure and expansion can also generate content, so “standard” does not universally mean lossless. Check fidelity requirements against the model's actual scope. Redrawing may alter product geometry, text, faces or textures; hidden details are generated guesses. For transparency read [matting](matting.md).
20
+
21
+ 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
+
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.
24
+
25
+ ## Review masks before submission
26
+
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.
28
+ 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
+ 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.
31
+
32
+ ## Execute and deliver
33
+
34
+ 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
+
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.
37
+
38
+ 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
+
40
+ For video editing with multiple references, use the media labels exposed by the model Schema to state each reference's purpose and the source content to preserve. The CLI adds original filename-to-label bindings; uploaded filenames change, so a download URL's filename alone cannot identify the source's role.
@@ -7,7 +7,7 @@ Discover live metadata in this order:
7
7
  ```bash
8
8
  insmind-cli tool list
9
9
  insmind-cli model list --tool <tool>
10
- insmind-cli model get <model>
10
+ insmind-cli model get <model> --tool <tool>
11
11
  insmind-cli tool call <tool> --input request.json --async
12
12
  insmind-cli task get <taskId>
13
13
  ```