@nodetool-ai/agents 0.7.0-rc.22 → 0.8.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/README.md +35 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/analysis/audio-dsp.d.ts +223 -0
- package/dist/analysis/audio-dsp.d.ts.map +1 -0
- package/dist/analysis/audio-dsp.js +642 -0
- package/dist/analysis/audio-dsp.js.map +1 -0
- package/dist/analysis/media-decode.d.ts +85 -0
- package/dist/analysis/media-decode.d.ts.map +1 -0
- package/dist/analysis/media-decode.js +199 -0
- package/dist/analysis/media-decode.js.map +1 -0
- package/dist/analysis/mediabunny-runtime.d.ts +15 -0
- package/dist/analysis/mediabunny-runtime.d.ts.map +1 -0
- package/dist/analysis/mediabunny-runtime.js +30 -0
- package/dist/analysis/mediabunny-runtime.js.map +1 -0
- package/dist/analysis/video-frames.d.ts +120 -0
- package/dist/analysis/video-frames.d.ts.map +1 -0
- package/dist/analysis/video-frames.js +288 -0
- package/dist/analysis/video-frames.js.map +1 -0
- package/dist/apify/assets.d.ts +80 -0
- package/dist/apify/assets.d.ts.map +1 -0
- package/dist/apify/assets.js +192 -0
- package/dist/apify/assets.js.map +1 -0
- package/dist/apify/catalog.d.ts +44 -0
- package/dist/apify/catalog.d.ts.map +1 -0
- package/dist/apify/catalog.js +108 -0
- package/dist/apify/catalog.js.map +1 -0
- package/dist/apify/client.d.ts +137 -0
- package/dist/apify/client.d.ts.map +1 -0
- package/dist/apify/client.js +346 -0
- package/dist/apify/client.js.map +1 -0
- package/dist/apify/errors.d.ts +85 -0
- package/dist/apify/errors.d.ts.map +1 -0
- package/dist/apify/errors.js +90 -0
- package/dist/apify/errors.js.map +1 -0
- package/dist/apify/normalize.d.ts +131 -0
- package/dist/apify/normalize.d.ts.map +1 -0
- package/dist/apify/normalize.js +202 -0
- package/dist/apify/normalize.js.map +1 -0
- package/dist/apify/policy.d.ts +136 -0
- package/dist/apify/policy.d.ts.map +1 -0
- package/dist/apify/policy.js +223 -0
- package/dist/apify/policy.js.map +1 -0
- package/dist/apify/run.d.ts +86 -0
- package/dist/apify/run.d.ts.map +1 -0
- package/dist/apify/run.js +158 -0
- package/dist/apify/run.js.map +1 -0
- package/dist/app-build/author.d.ts +67 -0
- package/dist/app-build/author.d.ts.map +1 -0
- package/dist/app-build/author.js +231 -0
- package/dist/app-build/author.js.map +1 -0
- package/dist/app-build/bridge.d.ts +130 -0
- package/dist/app-build/bridge.d.ts.map +1 -0
- package/dist/app-build/bridge.js +647 -0
- package/dist/app-build/bridge.js.map +1 -0
- package/dist/app-build/build-service.d.ts +66 -0
- package/dist/app-build/build-service.d.ts.map +1 -0
- package/dist/app-build/build-service.js +249 -0
- package/dist/app-build/build-service.js.map +1 -0
- package/dist/app-build/build.d.ts +115 -0
- package/dist/app-build/build.d.ts.map +1 -0
- package/dist/app-build/build.js +901 -0
- package/dist/app-build/build.js.map +1 -0
- package/dist/app-build/interactions.d.ts +20 -0
- package/dist/app-build/interactions.d.ts.map +1 -0
- package/dist/app-build/interactions.js +121 -0
- package/dist/app-build/interactions.js.map +1 -0
- package/dist/app-build/judge.d.ts +113 -0
- package/dist/app-build/judge.d.ts.map +1 -0
- package/dist/app-build/judge.js +318 -0
- package/dist/app-build/judge.js.map +1 -0
- package/dist/app-build/markdown.d.ts +10 -0
- package/dist/app-build/markdown.d.ts.map +1 -0
- package/dist/app-build/markdown.js +65 -0
- package/dist/app-build/markdown.js.map +1 -0
- package/dist/app-build/spec.d.ts +228 -0
- package/dist/app-build/spec.d.ts.map +1 -0
- package/dist/app-build/spec.js +651 -0
- package/dist/app-build/spec.js.map +1 -0
- package/dist/app-build/tool-loop.d.ts +84 -0
- package/dist/app-build/tool-loop.d.ts.map +1 -0
- package/dist/app-build/tool-loop.js +113 -0
- package/dist/app-build/tool-loop.js.map +1 -0
- package/dist/app-build/types.d.ts +215 -0
- package/dist/app-build/types.d.ts.map +1 -0
- package/dist/app-build/types.js +28 -0
- package/dist/app-build/types.js.map +1 -0
- package/dist/author-graph.d.ts +91 -0
- package/dist/author-graph.d.ts.map +1 -0
- package/dist/author-graph.js +319 -0
- package/dist/author-graph.js.map +1 -0
- package/dist/background-subtasks.d.ts +79 -0
- package/dist/background-subtasks.d.ts.map +1 -0
- package/dist/background-subtasks.js +139 -0
- package/dist/background-subtasks.js.map +1 -0
- package/dist/blender-gate.d.ts +21 -0
- package/dist/blender-gate.d.ts.map +1 -0
- package/dist/blender-gate.js +27 -0
- package/dist/blender-gate.js.map +1 -0
- package/dist/browser-gate.d.ts +28 -0
- package/dist/browser-gate.d.ts.map +1 -0
- package/dist/browser-gate.js +34 -0
- package/dist/browser-gate.js.map +1 -0
- package/dist/capabilities/adapters.d.ts +36 -0
- package/dist/capabilities/adapters.d.ts.map +1 -0
- package/dist/capabilities/adapters.js +44 -0
- package/dist/capabilities/adapters.js.map +1 -0
- package/dist/capabilities/agents.d.ts +78 -0
- package/dist/capabilities/agents.d.ts.map +1 -0
- package/dist/capabilities/agents.js +366 -0
- package/dist/capabilities/agents.js.map +1 -0
- package/dist/capabilities/agents.specs.d.ts +27 -0
- package/dist/capabilities/agents.specs.d.ts.map +1 -0
- package/dist/capabilities/agents.specs.js +243 -0
- package/dist/capabilities/agents.specs.js.map +1 -0
- package/dist/capabilities/analysis.d.ts +93 -0
- package/dist/capabilities/analysis.d.ts.map +1 -0
- package/dist/capabilities/analysis.js +812 -0
- package/dist/capabilities/analysis.js.map +1 -0
- package/dist/capabilities/analysis.specs.d.ts +39 -0
- package/dist/capabilities/analysis.specs.d.ts.map +1 -0
- package/dist/capabilities/analysis.specs.js +217 -0
- package/dist/capabilities/analysis.specs.js.map +1 -0
- package/dist/capabilities/apify.d.ts +34 -0
- package/dist/capabilities/apify.d.ts.map +1 -0
- package/dist/capabilities/apify.js +449 -0
- package/dist/capabilities/apify.js.map +1 -0
- package/dist/capabilities/apify.specs.d.ts +28 -0
- package/dist/capabilities/apify.specs.d.ts.map +1 -0
- package/dist/capabilities/apify.specs.js +232 -0
- package/dist/capabilities/apify.specs.js.map +1 -0
- package/dist/capabilities/apps.d.ts +40 -0
- package/dist/capabilities/apps.d.ts.map +1 -0
- package/dist/capabilities/apps.js +413 -0
- package/dist/capabilities/apps.js.map +1 -0
- package/dist/capabilities/apps.specs.d.ts +23 -0
- package/dist/capabilities/apps.specs.d.ts.map +1 -0
- package/dist/capabilities/apps.specs.js +236 -0
- package/dist/capabilities/apps.specs.js.map +1 -0
- package/dist/capabilities/args.d.ts +65 -0
- package/dist/capabilities/args.d.ts.map +1 -0
- package/dist/capabilities/args.js +218 -0
- package/dist/capabilities/args.js.map +1 -0
- package/dist/capabilities/assets.d.ts +45 -0
- package/dist/capabilities/assets.d.ts.map +1 -0
- package/dist/capabilities/assets.js +952 -0
- package/dist/capabilities/assets.js.map +1 -0
- package/dist/capabilities/assets.specs.d.ts +54 -0
- package/dist/capabilities/assets.specs.d.ts.map +1 -0
- package/dist/capabilities/assets.specs.js +291 -0
- package/dist/capabilities/assets.specs.js.map +1 -0
- package/dist/capabilities/background-generation.d.ts +14 -0
- package/dist/capabilities/background-generation.d.ts.map +1 -0
- package/dist/capabilities/background-generation.js +29 -0
- package/dist/capabilities/background-generation.js.map +1 -0
- package/dist/capabilities/browser.d.ts +30 -0
- package/dist/capabilities/browser.d.ts.map +1 -0
- package/dist/capabilities/browser.js +250 -0
- package/dist/capabilities/browser.js.map +1 -0
- package/dist/capabilities/browser.specs.d.ts +37 -0
- package/dist/capabilities/browser.specs.d.ts.map +1 -0
- package/dist/capabilities/browser.specs.js +173 -0
- package/dist/capabilities/browser.specs.js.map +1 -0
- package/dist/capabilities/code-grading.d.ts +68 -0
- package/dist/capabilities/code-grading.d.ts.map +1 -0
- package/dist/capabilities/code-grading.js +75 -0
- package/dist/capabilities/code-grading.js.map +1 -0
- package/dist/capabilities/code.d.ts +56 -0
- package/dist/capabilities/code.d.ts.map +1 -0
- package/dist/capabilities/code.js +327 -0
- package/dist/capabilities/code.js.map +1 -0
- package/dist/capabilities/code.specs.d.ts +22 -0
- package/dist/capabilities/code.specs.d.ts.map +1 -0
- package/dist/capabilities/code.specs.js +175 -0
- package/dist/capabilities/code.specs.js.map +1 -0
- package/dist/capabilities/collections.d.ts +44 -0
- package/dist/capabilities/collections.d.ts.map +1 -0
- package/dist/capabilities/collections.js +432 -0
- package/dist/capabilities/collections.js.map +1 -0
- package/dist/capabilities/collections.specs.d.ts +25 -0
- package/dist/capabilities/collections.specs.d.ts.map +1 -0
- package/dist/capabilities/collections.specs.js +299 -0
- package/dist/capabilities/collections.specs.js.map +1 -0
- package/dist/capabilities/compositions.d.ts +57 -0
- package/dist/capabilities/compositions.d.ts.map +1 -0
- package/dist/capabilities/compositions.js +384 -0
- package/dist/capabilities/compositions.js.map +1 -0
- package/dist/capabilities/compositions.specs.d.ts +22 -0
- package/dist/capabilities/compositions.specs.d.ts.map +1 -0
- package/dist/capabilities/compositions.specs.js +126 -0
- package/dist/capabilities/compositions.specs.js.map +1 -0
- package/dist/capabilities/concurrency.d.ts +12 -0
- package/dist/capabilities/concurrency.d.ts.map +1 -0
- package/dist/capabilities/concurrency.js +30 -0
- package/dist/capabilities/concurrency.js.map +1 -0
- package/dist/capabilities/costs.d.ts +20 -0
- package/dist/capabilities/costs.d.ts.map +1 -0
- package/dist/capabilities/costs.js +40 -0
- package/dist/capabilities/costs.js.map +1 -0
- package/dist/capabilities/costs.specs.d.ts +12 -0
- package/dist/capabilities/costs.specs.d.ts.map +1 -0
- package/dist/capabilities/costs.specs.js +35 -0
- package/dist/capabilities/costs.specs.js.map +1 -0
- package/dist/capabilities/dispatcher.d.ts +57 -0
- package/dist/capabilities/dispatcher.d.ts.map +1 -0
- package/dist/capabilities/dispatcher.js +117 -0
- package/dist/capabilities/dispatcher.js.map +1 -0
- package/dist/capabilities/documents.d.ts +25 -0
- package/dist/capabilities/documents.d.ts.map +1 -0
- package/dist/capabilities/documents.js +278 -0
- package/dist/capabilities/documents.js.map +1 -0
- package/dist/capabilities/documents.specs.d.ts +18 -0
- package/dist/capabilities/documents.specs.d.ts.map +1 -0
- package/dist/capabilities/documents.specs.js +201 -0
- package/dist/capabilities/documents.specs.js.map +1 -0
- package/dist/capabilities/email.d.ts +23 -0
- package/dist/capabilities/email.d.ts.map +1 -0
- package/dist/capabilities/email.js +226 -0
- package/dist/capabilities/email.js.map +1 -0
- package/dist/capabilities/email.specs.d.ts +16 -0
- package/dist/capabilities/email.specs.d.ts.map +1 -0
- package/dist/capabilities/email.specs.js +102 -0
- package/dist/capabilities/email.specs.js.map +1 -0
- package/dist/capabilities/entities.d.ts +52 -0
- package/dist/capabilities/entities.d.ts.map +1 -0
- package/dist/capabilities/entities.js +478 -0
- package/dist/capabilities/entities.js.map +1 -0
- package/dist/capabilities/entities.specs.d.ts +25 -0
- package/dist/capabilities/entities.specs.d.ts.map +1 -0
- package/dist/capabilities/entities.specs.js +247 -0
- package/dist/capabilities/entities.specs.js.map +1 -0
- package/dist/capabilities/example-timelines.d.ts +3 -0
- package/dist/capabilities/example-timelines.d.ts.map +1 -0
- package/dist/capabilities/example-timelines.js +191 -0
- package/dist/capabilities/example-timelines.js.map +1 -0
- package/dist/capabilities/example-timelines.specs.d.ts +5 -0
- package/dist/capabilities/example-timelines.specs.d.ts.map +1 -0
- package/dist/capabilities/example-timelines.specs.js +53 -0
- package/dist/capabilities/example-timelines.specs.js.map +1 -0
- package/dist/capabilities/files.d.ts +53 -0
- package/dist/capabilities/files.d.ts.map +1 -0
- package/dist/capabilities/files.js +1172 -0
- package/dist/capabilities/files.js.map +1 -0
- package/dist/capabilities/files.specs.d.ts +28 -0
- package/dist/capabilities/files.specs.d.ts.map +1 -0
- package/dist/capabilities/files.specs.js +259 -0
- package/dist/capabilities/files.specs.js.map +1 -0
- package/dist/capabilities/flow.d.ts +93 -0
- package/dist/capabilities/flow.d.ts.map +1 -0
- package/dist/capabilities/flow.js +285 -0
- package/dist/capabilities/flow.js.map +1 -0
- package/dist/capabilities/flow.specs.d.ts +25 -0
- package/dist/capabilities/flow.specs.d.ts.map +1 -0
- package/dist/capabilities/flow.specs.js +114 -0
- package/dist/capabilities/flow.specs.js.map +1 -0
- package/dist/capabilities/game-asset-source.d.ts +31 -0
- package/dist/capabilities/game-asset-source.d.ts.map +1 -0
- package/dist/capabilities/game-asset-source.js +81 -0
- package/dist/capabilities/game-asset-source.js.map +1 -0
- package/dist/capabilities/game.d.ts +12 -0
- package/dist/capabilities/game.d.ts.map +1 -0
- package/dist/capabilities/game.js +1262 -0
- package/dist/capabilities/game.js.map +1 -0
- package/dist/capabilities/game.specs.d.ts +3 -0
- package/dist/capabilities/game.specs.d.ts.map +1 -0
- package/dist/capabilities/game.specs.js +96 -0
- package/dist/capabilities/game.specs.js.map +1 -0
- package/dist/capabilities/gate-from-context.d.ts +39 -0
- package/dist/capabilities/gate-from-context.d.ts.map +1 -0
- package/dist/capabilities/gate-from-context.js +97 -0
- package/dist/capabilities/gate-from-context.js.map +1 -0
- package/dist/capabilities/gate-tools.d.ts +18 -0
- package/dist/capabilities/gate-tools.d.ts.map +1 -0
- package/dist/capabilities/gate-tools.js +66 -0
- package/dist/capabilities/gate-tools.js.map +1 -0
- package/dist/capabilities/generations.d.ts +79 -0
- package/dist/capabilities/generations.d.ts.map +1 -0
- package/dist/capabilities/generations.js +382 -0
- package/dist/capabilities/generations.js.map +1 -0
- package/dist/capabilities/generations.specs.d.ts +62 -0
- package/dist/capabilities/generations.specs.d.ts.map +1 -0
- package/dist/capabilities/generations.specs.js +230 -0
- package/dist/capabilities/generations.specs.js.map +1 -0
- package/dist/capabilities/google.d.ts +50 -0
- package/dist/capabilities/google.d.ts.map +1 -0
- package/dist/capabilities/google.js +246 -0
- package/dist/capabilities/google.js.map +1 -0
- package/dist/capabilities/google.specs.d.ts +52 -0
- package/dist/capabilities/google.specs.d.ts.map +1 -0
- package/dist/capabilities/google.specs.js +391 -0
- package/dist/capabilities/google.specs.js.map +1 -0
- package/dist/capabilities/html-text.d.ts +28 -0
- package/dist/capabilities/html-text.d.ts.map +1 -0
- package/dist/capabilities/html-text.js +76 -0
- package/dist/capabilities/html-text.js.map +1 -0
- package/dist/capabilities/index.d.ts +19 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +14 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/invoke.d.ts +89 -0
- package/dist/capabilities/invoke.d.ts.map +1 -0
- package/dist/capabilities/invoke.js +214 -0
- package/dist/capabilities/invoke.js.map +1 -0
- package/dist/capabilities/jobs.d.ts +32 -0
- package/dist/capabilities/jobs.d.ts.map +1 -0
- package/dist/capabilities/jobs.js +123 -0
- package/dist/capabilities/jobs.js.map +1 -0
- package/dist/capabilities/jobs.specs.d.ts +20 -0
- package/dist/capabilities/jobs.specs.d.ts.map +1 -0
- package/dist/capabilities/jobs.specs.js +103 -0
- package/dist/capabilities/jobs.specs.js.map +1 -0
- package/dist/capabilities/js-scripts.d.ts +90 -0
- package/dist/capabilities/js-scripts.d.ts.map +1 -0
- package/dist/capabilities/js-scripts.js +700 -0
- package/dist/capabilities/js-scripts.js.map +1 -0
- package/dist/capabilities/js-scripts.specs.d.ts +50 -0
- package/dist/capabilities/js-scripts.specs.d.ts.map +1 -0
- package/dist/capabilities/js-scripts.specs.js +344 -0
- package/dist/capabilities/js-scripts.specs.js.map +1 -0
- package/dist/capabilities/lazy-tool.d.ts +42 -0
- package/dist/capabilities/lazy-tool.d.ts.map +1 -0
- package/dist/capabilities/lazy-tool.js +88 -0
- package/dist/capabilities/lazy-tool.js.map +1 -0
- package/dist/capabilities/local-browser.d.ts +24 -0
- package/dist/capabilities/local-browser.d.ts.map +1 -0
- package/dist/capabilities/local-browser.js +105 -0
- package/dist/capabilities/local-browser.js.map +1 -0
- package/dist/capabilities/media.d.ts +121 -0
- package/dist/capabilities/media.d.ts.map +1 -0
- package/dist/capabilities/media.js +2217 -0
- package/dist/capabilities/media.js.map +1 -0
- package/dist/capabilities/media.specs.d.ts +65 -0
- package/dist/capabilities/media.specs.d.ts.map +1 -0
- package/dist/capabilities/media.specs.js +779 -0
- package/dist/capabilities/media.specs.js.map +1 -0
- package/dist/capabilities/memory.d.ts +31 -0
- package/dist/capabilities/memory.d.ts.map +1 -0
- package/dist/capabilities/memory.js +403 -0
- package/dist/capabilities/memory.js.map +1 -0
- package/dist/capabilities/memory.specs.d.ts +55 -0
- package/dist/capabilities/memory.specs.d.ts.map +1 -0
- package/dist/capabilities/memory.specs.js +208 -0
- package/dist/capabilities/memory.specs.js.map +1 -0
- package/dist/capabilities/model3d.d.ts +29 -0
- package/dist/capabilities/model3d.d.ts.map +1 -0
- package/dist/capabilities/model3d.js +482 -0
- package/dist/capabilities/model3d.js.map +1 -0
- package/dist/capabilities/model3d.specs.d.ts +28 -0
- package/dist/capabilities/model3d.specs.d.ts.map +1 -0
- package/dist/capabilities/model3d.specs.js +305 -0
- package/dist/capabilities/model3d.specs.js.map +1 -0
- package/dist/capabilities/models.d.ts +138 -0
- package/dist/capabilities/models.d.ts.map +1 -0
- package/dist/capabilities/models.js +803 -0
- package/dist/capabilities/models.js.map +1 -0
- package/dist/capabilities/models.specs.d.ts +21 -0
- package/dist/capabilities/models.specs.d.ts.map +1 -0
- package/dist/capabilities/models.specs.js +141 -0
- package/dist/capabilities/models.specs.js.map +1 -0
- package/dist/capabilities/nodes.d.ts +26 -0
- package/dist/capabilities/nodes.d.ts.map +1 -0
- package/dist/capabilities/nodes.js +266 -0
- package/dist/capabilities/nodes.js.map +1 -0
- package/dist/capabilities/nodes.specs.d.ts +20 -0
- package/dist/capabilities/nodes.specs.d.ts.map +1 -0
- package/dist/capabilities/nodes.specs.js +106 -0
- package/dist/capabilities/nodes.specs.js.map +1 -0
- package/dist/capabilities/packs.d.ts +69 -0
- package/dist/capabilities/packs.d.ts.map +1 -0
- package/dist/capabilities/packs.js +246 -0
- package/dist/capabilities/packs.js.map +1 -0
- package/dist/capabilities/packs.specs.d.ts +27 -0
- package/dist/capabilities/packs.specs.d.ts.map +1 -0
- package/dist/capabilities/packs.specs.js +64 -0
- package/dist/capabilities/packs.specs.js.map +1 -0
- package/dist/capabilities/project-scope.d.ts +12 -0
- package/dist/capabilities/project-scope.d.ts.map +1 -0
- package/dist/capabilities/project-scope.js +19 -0
- package/dist/capabilities/project-scope.js.map +1 -0
- package/dist/capabilities/projects.d.ts +23 -0
- package/dist/capabilities/projects.d.ts.map +1 -0
- package/dist/capabilities/projects.js +206 -0
- package/dist/capabilities/projects.js.map +1 -0
- package/dist/capabilities/projects.specs.d.ts +23 -0
- package/dist/capabilities/projects.specs.d.ts.map +1 -0
- package/dist/capabilities/projects.specs.js +118 -0
- package/dist/capabilities/projects.specs.js.map +1 -0
- package/dist/capabilities/registry.d.ts +109 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +445 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/script-link.d.ts +22 -0
- package/dist/capabilities/script-link.d.ts.map +1 -0
- package/dist/capabilities/script-link.js +35 -0
- package/dist/capabilities/script-link.js.map +1 -0
- package/dist/capabilities/scripts.d.ts +43 -0
- package/dist/capabilities/scripts.d.ts.map +1 -0
- package/dist/capabilities/scripts.js +1789 -0
- package/dist/capabilities/scripts.js.map +1 -0
- package/dist/capabilities/scripts.specs.d.ts +40 -0
- package/dist/capabilities/scripts.specs.d.ts.map +1 -0
- package/dist/capabilities/scripts.specs.js +319 -0
- package/dist/capabilities/scripts.specs.js.map +1 -0
- package/dist/capabilities/serpapi.d.ts +42 -0
- package/dist/capabilities/serpapi.d.ts.map +1 -0
- package/dist/capabilities/serpapi.js +262 -0
- package/dist/capabilities/serpapi.js.map +1 -0
- package/dist/capabilities/serpapi.specs.d.ts +24 -0
- package/dist/capabilities/serpapi.specs.d.ts.map +1 -0
- package/dist/capabilities/serpapi.specs.js +174 -0
- package/dist/capabilities/serpapi.specs.js.map +1 -0
- package/dist/capabilities/settings.d.ts +48 -0
- package/dist/capabilities/settings.d.ts.map +1 -0
- package/dist/capabilities/settings.js +226 -0
- package/dist/capabilities/settings.js.map +1 -0
- package/dist/capabilities/settings.specs.d.ts +42 -0
- package/dist/capabilities/settings.specs.d.ts.map +1 -0
- package/dist/capabilities/settings.specs.js +126 -0
- package/dist/capabilities/settings.specs.js.map +1 -0
- package/dist/capabilities/shared.d.ts +35 -0
- package/dist/capabilities/shared.d.ts.map +1 -0
- package/dist/capabilities/shared.js +165 -0
- package/dist/capabilities/shared.js.map +1 -0
- package/dist/capabilities/shared.specs.d.ts +19 -0
- package/dist/capabilities/shared.specs.d.ts.map +1 -0
- package/dist/capabilities/shared.specs.js +134 -0
- package/dist/capabilities/shared.specs.js.map +1 -0
- package/dist/capabilities/sketches.d.ts +52 -0
- package/dist/capabilities/sketches.d.ts.map +1 -0
- package/dist/capabilities/sketches.js +1163 -0
- package/dist/capabilities/sketches.js.map +1 -0
- package/dist/capabilities/sketches.specs.d.ts +44 -0
- package/dist/capabilities/sketches.specs.d.ts.map +1 -0
- package/dist/capabilities/sketches.specs.js +392 -0
- package/dist/capabilities/sketches.specs.js.map +1 -0
- package/dist/capabilities/skills.d.ts +28 -0
- package/dist/capabilities/skills.d.ts.map +1 -0
- package/dist/capabilities/skills.js +269 -0
- package/dist/capabilities/skills.js.map +1 -0
- package/dist/capabilities/skills.specs.d.ts +17 -0
- package/dist/capabilities/skills.specs.d.ts.map +1 -0
- package/dist/capabilities/skills.specs.js +108 -0
- package/dist/capabilities/skills.specs.js.map +1 -0
- package/dist/capabilities/storyboards.d.ts +68 -0
- package/dist/capabilities/storyboards.d.ts.map +1 -0
- package/dist/capabilities/storyboards.js +2246 -0
- package/dist/capabilities/storyboards.js.map +1 -0
- package/dist/capabilities/storyboards.specs.d.ts +42 -0
- package/dist/capabilities/storyboards.specs.d.ts.map +1 -0
- package/dist/capabilities/storyboards.specs.js +418 -0
- package/dist/capabilities/storyboards.specs.js.map +1 -0
- package/dist/capabilities/threads.d.ts +25 -0
- package/dist/capabilities/threads.d.ts.map +1 -0
- package/dist/capabilities/threads.js +240 -0
- package/dist/capabilities/threads.js.map +1 -0
- package/dist/capabilities/threads.specs.d.ts +26 -0
- package/dist/capabilities/threads.specs.d.ts.map +1 -0
- package/dist/capabilities/threads.specs.js +108 -0
- package/dist/capabilities/threads.specs.js.map +1 -0
- package/dist/capabilities/timeline-audio-bake.d.ts +114 -0
- package/dist/capabilities/timeline-audio-bake.d.ts.map +1 -0
- package/dist/capabilities/timeline-audio-bake.js +188 -0
- package/dist/capabilities/timeline-audio-bake.js.map +1 -0
- package/dist/capabilities/timeline-bake.d.ts +21 -0
- package/dist/capabilities/timeline-bake.d.ts.map +1 -0
- package/dist/capabilities/timeline-bake.js +118 -0
- package/dist/capabilities/timeline-bake.js.map +1 -0
- package/dist/capabilities/timeline-isolate-subject.d.ts +157 -0
- package/dist/capabilities/timeline-isolate-subject.d.ts.map +1 -0
- package/dist/capabilities/timeline-isolate-subject.js +293 -0
- package/dist/capabilities/timeline-isolate-subject.js.map +1 -0
- package/dist/capabilities/timeline-native-media.d.ts +4 -0
- package/dist/capabilities/timeline-native-media.d.ts.map +1 -0
- package/dist/capabilities/timeline-native-media.js +920 -0
- package/dist/capabilities/timeline-native-media.js.map +1 -0
- package/dist/capabilities/timeline-track-object.d.ts +83 -0
- package/dist/capabilities/timeline-track-object.d.ts.map +1 -0
- package/dist/capabilities/timeline-track-object.js +195 -0
- package/dist/capabilities/timeline-track-object.js.map +1 -0
- package/dist/capabilities/timelines.d.ts +190 -0
- package/dist/capabilities/timelines.d.ts.map +1 -0
- package/dist/capabilities/timelines.js +2326 -0
- package/dist/capabilities/timelines.js.map +1 -0
- package/dist/capabilities/timelines.specs.d.ts +134 -0
- package/dist/capabilities/timelines.specs.d.ts.map +1 -0
- package/dist/capabilities/timelines.specs.js +1362 -0
- package/dist/capabilities/timelines.specs.js.map +1 -0
- package/dist/capabilities/types.d.ts +197 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +19 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/capabilities/ui.d.ts +38 -0
- package/dist/capabilities/ui.d.ts.map +1 -0
- package/dist/capabilities/ui.js +128 -0
- package/dist/capabilities/ui.js.map +1 -0
- package/dist/capabilities/ui.specs.d.ts +22 -0
- package/dist/capabilities/ui.specs.d.ts.map +1 -0
- package/dist/capabilities/ui.specs.js +59 -0
- package/dist/capabilities/ui.specs.js.map +1 -0
- package/dist/capabilities/video-production-acceptance.d.ts +27 -0
- package/dist/capabilities/video-production-acceptance.d.ts.map +1 -0
- package/dist/capabilities/video-production-acceptance.js +41 -0
- package/dist/capabilities/video-production-acceptance.js.map +1 -0
- package/dist/capabilities/video-production.d.ts +179 -0
- package/dist/capabilities/video-production.d.ts.map +1 -0
- package/dist/capabilities/video-production.js +1492 -0
- package/dist/capabilities/video-production.js.map +1 -0
- package/dist/capabilities/video-production.specs.d.ts +13 -0
- package/dist/capabilities/video-production.specs.d.ts.map +1 -0
- package/dist/capabilities/video-production.specs.js +256 -0
- package/dist/capabilities/video-production.specs.js.map +1 -0
- package/dist/capabilities/web.d.ts +86 -0
- package/dist/capabilities/web.d.ts.map +1 -0
- package/dist/capabilities/web.js +850 -0
- package/dist/capabilities/web.js.map +1 -0
- package/dist/capabilities/web.specs.d.ts +33 -0
- package/dist/capabilities/web.specs.d.ts.map +1 -0
- package/dist/capabilities/web.specs.js +286 -0
- package/dist/capabilities/web.specs.js.map +1 -0
- package/dist/capabilities/workflows.d.ts +58 -0
- package/dist/capabilities/workflows.d.ts.map +1 -0
- package/dist/capabilities/workflows.js +1530 -0
- package/dist/capabilities/workflows.js.map +1 -0
- package/dist/capabilities/workflows.specs.d.ts +63 -0
- package/dist/capabilities/workflows.specs.d.ts.map +1 -0
- package/dist/capabilities/workflows.specs.js +852 -0
- package/dist/capabilities/workflows.specs.js.map +1 -0
- package/dist/code-gen/analyze.d.ts +26 -0
- package/dist/code-gen/analyze.d.ts.map +1 -0
- package/dist/code-gen/analyze.js +79 -0
- package/dist/code-gen/analyze.js.map +1 -0
- package/dist/code-gen/port-types.d.ts +58 -0
- package/dist/code-gen/port-types.d.ts.map +1 -0
- package/dist/code-gen/port-types.js +115 -0
- package/dist/code-gen/port-types.js.map +1 -0
- package/dist/code-gen/prompt.d.ts +37 -0
- package/dist/code-gen/prompt.d.ts.map +1 -0
- package/dist/code-gen/prompt.js +129 -0
- package/dist/code-gen/prompt.js.map +1 -0
- package/dist/code-gen/sandbox-manifest.d.ts +120 -0
- package/dist/code-gen/sandbox-manifest.d.ts.map +1 -0
- package/dist/code-gen/sandbox-manifest.js +1023 -0
- package/dist/code-gen/sandbox-manifest.js.map +1 -0
- package/dist/code-gen/sandbox-prompt.d.ts +26 -0
- package/dist/code-gen/sandbox-prompt.d.ts.map +1 -0
- package/dist/code-gen/sandbox-prompt.js +126 -0
- package/dist/code-gen/sandbox-prompt.js.map +1 -0
- package/dist/code-planner.d.ts +72 -0
- package/dist/code-planner.d.ts.map +1 -0
- package/dist/code-planner.js +271 -0
- package/dist/code-planner.js.map +1 -0
- package/dist/codeact/action-diagnostics.d.ts +35 -0
- package/dist/codeact/action-diagnostics.d.ts.map +1 -0
- package/dist/codeact/action-diagnostics.js +147 -0
- package/dist/codeact/action-diagnostics.js.map +1 -0
- package/dist/codeact/capability-modules.d.ts +66 -0
- package/dist/codeact/capability-modules.d.ts.map +1 -0
- package/dist/codeact/capability-modules.js +278 -0
- package/dist/codeact/capability-modules.js.map +1 -0
- package/dist/codeact/chat-codeact.d.ts +104 -0
- package/dist/codeact/chat-codeact.d.ts.map +1 -0
- package/dist/codeact/chat-codeact.js +424 -0
- package/dist/codeact/chat-codeact.js.map +1 -0
- package/dist/codeact/codeact-executor.d.ts +247 -0
- package/dist/codeact/codeact-executor.d.ts.map +1 -0
- package/dist/codeact/codeact-executor.js +1176 -0
- package/dist/codeact/codeact-executor.js.map +1 -0
- package/dist/codeact/compact-ids.d.ts +28 -0
- package/dist/codeact/compact-ids.d.ts.map +1 -0
- package/dist/codeact/compact-ids.js +77 -0
- package/dist/codeact/compact-ids.js.map +1 -0
- package/dist/codeact/execute-code-contract.d.ts +97 -0
- package/dist/codeact/execute-code-contract.d.ts.map +1 -0
- package/dist/codeact/execute-code-contract.js +225 -0
- package/dist/codeact/execute-code-contract.js.map +1 -0
- package/dist/codeact/fabric-package.d.ts +29 -0
- package/dist/codeact/fabric-package.d.ts.map +1 -0
- package/dist/codeact/fabric-package.js +62 -0
- package/dist/codeact/fabric-package.js.map +1 -0
- package/dist/codeact/flow-package.d.ts +31 -0
- package/dist/codeact/flow-package.d.ts.map +1 -0
- package/dist/codeact/flow-package.js +80 -0
- package/dist/codeact/flow-package.js.map +1 -0
- package/dist/codeact/graph-dsl-package.d.ts +42 -0
- package/dist/codeact/graph-dsl-package.d.ts.map +1 -0
- package/dist/codeact/graph-dsl-package.js +100 -0
- package/dist/codeact/graph-dsl-package.js.map +1 -0
- package/dist/codeact/graph-model.d.ts +30 -0
- package/dist/codeact/graph-model.d.ts.map +1 -0
- package/dist/codeact/graph-model.js +408 -0
- package/dist/codeact/graph-model.js.map +1 -0
- package/dist/codeact/mcp-guest-contract.d.ts +66 -0
- package/dist/codeact/mcp-guest-contract.d.ts.map +1 -0
- package/dist/codeact/mcp-guest-contract.js +108 -0
- package/dist/codeact/mcp-guest-contract.js.map +1 -0
- package/dist/codeact/nodetool-api.d.ts +60 -0
- package/dist/codeact/nodetool-api.d.ts.map +1 -0
- package/dist/codeact/nodetool-api.js +2056 -0
- package/dist/codeact/nodetool-api.js.map +1 -0
- package/dist/codeact/prompt.d.ts +88 -0
- package/dist/codeact/prompt.d.ts.map +1 -0
- package/dist/codeact/prompt.js +326 -0
- package/dist/codeact/prompt.js.map +1 -0
- package/dist/codeact/sandbox-package-docs.d.ts +48 -0
- package/dist/codeact/sandbox-package-docs.d.ts.map +1 -0
- package/dist/codeact/sandbox-package-docs.js +55 -0
- package/dist/codeact/sandbox-package-docs.js.map +1 -0
- package/dist/codeact/sandbox-package-listing.d.ts +81 -0
- package/dist/codeact/sandbox-package-listing.d.ts.map +1 -0
- package/dist/codeact/sandbox-package-listing.js +101 -0
- package/dist/codeact/sandbox-package-listing.js.map +1 -0
- package/dist/codeact/sandbox-packages.d.ts +72 -0
- package/dist/codeact/sandbox-packages.d.ts.map +1 -0
- package/dist/codeact/sandbox-packages.js +230 -0
- package/dist/codeact/sandbox-packages.js.map +1 -0
- package/dist/codeact/timeline-package.d.ts +5 -0
- package/dist/codeact/timeline-package.d.ts.map +1 -0
- package/dist/codeact/timeline-package.js +10 -0
- package/dist/codeact/timeline-package.js.map +1 -0
- package/dist/codeact/tool-api.d.ts +197 -0
- package/dist/codeact/tool-api.d.ts.map +1 -0
- package/dist/codeact/tool-api.js +445 -0
- package/dist/codeact/tool-api.js.map +1 -0
- package/dist/codeact/tools-prelude.d.ts +32 -0
- package/dist/codeact/tools-prelude.d.ts.map +1 -0
- package/dist/codeact/tools-prelude.js +65 -0
- package/dist/codeact/tools-prelude.js.map +1 -0
- package/dist/constants.d.ts +47 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +64 -2
- package/dist/constants.js.map +1 -1
- package/dist/custom-animation-bake.d.ts +57 -0
- package/dist/custom-animation-bake.d.ts.map +1 -0
- package/dist/custom-animation-bake.js +88 -0
- package/dist/custom-animation-bake.js.map +1 -0
- package/dist/dynamic-slots.d.ts +72 -0
- package/dist/dynamic-slots.d.ts.map +1 -0
- package/dist/dynamic-slots.js +0 -0
- package/dist/dynamic-slots.js.map +1 -0
- package/dist/evals/app-build-cases.d.ts +35 -0
- package/dist/evals/app-build-cases.d.ts.map +1 -0
- package/dist/evals/app-build-cases.js +722 -0
- package/dist/evals/app-build-cases.js.map +1 -0
- package/dist/evals/app-build-eval.d.ts +208 -0
- package/dist/evals/app-build-eval.d.ts.map +1 -0
- package/dist/evals/app-build-eval.js +518 -0
- package/dist/evals/app-build-eval.js.map +1 -0
- package/dist/evals/app-build-plan.d.ts +76 -0
- package/dist/evals/app-build-plan.d.ts.map +1 -0
- package/dist/evals/app-build-plan.js +140 -0
- package/dist/evals/app-build-plan.js.map +1 -0
- package/dist/evals/code-gen-cases.d.ts +13 -0
- package/dist/evals/code-gen-cases.d.ts.map +1 -0
- package/dist/evals/code-gen-cases.js +124 -0
- package/dist/evals/code-gen-cases.js.map +1 -0
- package/dist/evals/code-gen-eval.d.ts +109 -0
- package/dist/evals/code-gen-eval.d.ts.map +1 -0
- package/dist/evals/code-gen-eval.js +299 -0
- package/dist/evals/code-gen-eval.js.map +1 -0
- package/dist/evals/codeact-api-cases.d.ts +14 -0
- package/dist/evals/codeact-api-cases.d.ts.map +1 -0
- package/dist/evals/codeact-api-cases.js +29 -0
- package/dist/evals/codeact-api-cases.js.map +1 -0
- package/dist/evals/codeact-api-core.d.ts +23 -0
- package/dist/evals/codeact-api-core.d.ts.map +1 -0
- package/dist/evals/codeact-api-core.js +1411 -0
- package/dist/evals/codeact-api-core.js.map +1 -0
- package/dist/evals/codeact-api-surfaces.d.ts +25 -0
- package/dist/evals/codeact-api-surfaces.d.ts.map +1 -0
- package/dist/evals/codeact-api-surfaces.js +2191 -0
- package/dist/evals/codeact-api-surfaces.js.map +1 -0
- package/dist/evals/codeact-cases.d.ts +76 -0
- package/dist/evals/codeact-cases.d.ts.map +1 -0
- package/dist/evals/codeact-cases.js +151 -0
- package/dist/evals/codeact-cases.js.map +1 -0
- package/dist/evals/codeact-eval.d.ts +66 -0
- package/dist/evals/codeact-eval.d.ts.map +1 -0
- package/dist/evals/codeact-eval.js +250 -0
- package/dist/evals/codeact-eval.js.map +1 -0
- package/dist/evals/codeact-sandbox-pack-cases.d.ts +31 -0
- package/dist/evals/codeact-sandbox-pack-cases.d.ts.map +1 -0
- package/dist/evals/codeact-sandbox-pack-cases.js +219 -0
- package/dist/evals/codeact-sandbox-pack-cases.js.map +1 -0
- package/dist/evals/escalation-cases.d.ts +22 -0
- package/dist/evals/escalation-cases.d.ts.map +1 -0
- package/dist/evals/escalation-cases.js +343 -0
- package/dist/evals/escalation-cases.js.map +1 -0
- package/dist/evals/escalation.d.ts +92 -0
- package/dist/evals/escalation.d.ts.map +1 -0
- package/dist/evals/escalation.js +152 -0
- package/dist/evals/escalation.js.map +1 -0
- package/dist/evals/goal-judge.d.ts +51 -0
- package/dist/evals/goal-judge.d.ts.map +1 -0
- package/dist/evals/goal-judge.js +152 -0
- package/dist/evals/goal-judge.js.map +1 -0
- package/dist/evals/graph-e2e-cases.d.ts +21 -0
- package/dist/evals/graph-e2e-cases.d.ts.map +1 -0
- package/dist/evals/graph-e2e-cases.js +262 -0
- package/dist/evals/graph-e2e-cases.js.map +1 -0
- package/dist/evals/graph-e2e-eval.d.ts +202 -0
- package/dist/evals/graph-e2e-eval.d.ts.map +1 -0
- package/dist/evals/graph-e2e-eval.js +438 -0
- package/dist/evals/graph-e2e-eval.js.map +1 -0
- package/dist/evals/graph-planner-cases.d.ts +12 -0
- package/dist/evals/graph-planner-cases.d.ts.map +1 -0
- package/dist/evals/graph-planner-cases.js +256 -0
- package/dist/evals/graph-planner-cases.js.map +1 -0
- package/dist/evals/graph-planner-eval.d.ts +178 -0
- package/dist/evals/graph-planner-eval.d.ts.map +1 -0
- package/dist/evals/graph-planner-eval.js +495 -0
- package/dist/evals/graph-planner-eval.js.map +1 -0
- package/dist/evals/planner-tools.d.ts +21 -0
- package/dist/evals/planner-tools.d.ts.map +1 -0
- package/dist/evals/planner-tools.js +66 -0
- package/dist/evals/planner-tools.js.map +1 -0
- package/dist/evals/subtask-cases.d.ts +88 -0
- package/dist/evals/subtask-cases.d.ts.map +1 -0
- package/dist/evals/subtask-cases.js +322 -0
- package/dist/evals/subtask-cases.js.map +1 -0
- package/dist/evals/subtask-eval.d.ts +129 -0
- package/dist/evals/subtask-eval.d.ts.map +1 -0
- package/dist/evals/subtask-eval.js +397 -0
- package/dist/evals/subtask-eval.js.map +1 -0
- package/dist/evals/surfaces/app.d.ts +19 -0
- package/dist/evals/surfaces/app.d.ts.map +1 -0
- package/dist/evals/surfaces/app.js +341 -0
- package/dist/evals/surfaces/app.js.map +1 -0
- package/dist/evals/surfaces/creative-pipeline.d.ts +203 -0
- package/dist/evals/surfaces/creative-pipeline.d.ts.map +1 -0
- package/dist/evals/surfaces/creative-pipeline.js +909 -0
- package/dist/evals/surfaces/creative-pipeline.js.map +1 -0
- package/dist/evals/surfaces/game.d.ts +5 -0
- package/dist/evals/surfaces/game.d.ts.map +1 -0
- package/dist/evals/surfaces/game.js +42 -0
- package/dist/evals/surfaces/game.js.map +1 -0
- package/dist/evals/surfaces/js-script.d.ts +66 -0
- package/dist/evals/surfaces/js-script.d.ts.map +1 -0
- package/dist/evals/surfaces/js-script.js +407 -0
- package/dist/evals/surfaces/js-script.js.map +1 -0
- package/dist/evals/surfaces/memory.d.ts +34 -0
- package/dist/evals/surfaces/memory.d.ts.map +1 -0
- package/dist/evals/surfaces/memory.js +264 -0
- package/dist/evals/surfaces/memory.js.map +1 -0
- package/dist/evals/surfaces/model3d.d.ts +45 -0
- package/dist/evals/surfaces/model3d.d.ts.map +1 -0
- package/dist/evals/surfaces/model3d.js +346 -0
- package/dist/evals/surfaces/model3d.js.map +1 -0
- package/dist/evals/surfaces/script.d.ts +96 -0
- package/dist/evals/surfaces/script.d.ts.map +1 -0
- package/dist/evals/surfaces/script.js +709 -0
- package/dist/evals/surfaces/script.js.map +1 -0
- package/dist/evals/surfaces/sketch.d.ts +124 -0
- package/dist/evals/surfaces/sketch.d.ts.map +1 -0
- package/dist/evals/surfaces/sketch.js +1298 -0
- package/dist/evals/surfaces/sketch.js.map +1 -0
- package/dist/evals/surfaces/storyboard.d.ts +97 -0
- package/dist/evals/surfaces/storyboard.d.ts.map +1 -0
- package/dist/evals/surfaces/storyboard.js +693 -0
- package/dist/evals/surfaces/storyboard.js.map +1 -0
- package/dist/evals/surfaces/timeline.d.ts +416 -0
- package/dist/evals/surfaces/timeline.d.ts.map +1 -0
- package/dist/evals/surfaces/timeline.js +3267 -0
- package/dist/evals/surfaces/timeline.js.map +1 -0
- package/dist/evals/task-planner-cases.d.ts +57 -0
- package/dist/evals/task-planner-cases.d.ts.map +1 -0
- package/dist/evals/task-planner-cases.js +117 -0
- package/dist/evals/task-planner-cases.js.map +1 -0
- package/dist/evals/task-planner-eval.d.ts +101 -0
- package/dist/evals/task-planner-eval.d.ts.map +1 -0
- package/dist/evals/task-planner-eval.js +380 -0
- package/dist/evals/task-planner-eval.js.map +1 -0
- package/dist/evals/tool-loop-bridge.d.ts +57 -0
- package/dist/evals/tool-loop-bridge.d.ts.map +1 -0
- package/dist/evals/tool-loop-bridge.js +129 -0
- package/dist/evals/tool-loop-bridge.js.map +1 -0
- package/dist/evals/tool-loop-cases.d.ts +21 -0
- package/dist/evals/tool-loop-cases.d.ts.map +1 -0
- package/dist/evals/tool-loop-cases.js +401 -0
- package/dist/evals/tool-loop-cases.js.map +1 -0
- package/dist/evals/tool-loop-eval.d.ts +234 -0
- package/dist/evals/tool-loop-eval.d.ts.map +1 -0
- package/dist/evals/tool-loop-eval.js +373 -0
- package/dist/evals/tool-loop-eval.js.map +1 -0
- package/dist/evals/tool-loop-permission.d.ts +43 -0
- package/dist/evals/tool-loop-permission.d.ts.map +1 -0
- package/dist/evals/tool-loop-permission.js +76 -0
- package/dist/evals/tool-loop-permission.js.map +1 -0
- package/dist/game-examples.d.ts +447 -0
- package/dist/game-examples.d.ts.map +1 -0
- package/dist/game-examples.js +187 -0
- package/dist/game-examples.js.map +1 -0
- package/dist/graph-builder.d.ts +55 -3
- package/dist/graph-builder.d.ts.map +1 -1
- package/dist/graph-builder.js +159 -4
- package/dist/graph-builder.js.map +1 -1
- package/dist/graph-dsl-core.d.ts +25 -0
- package/dist/graph-dsl-core.d.ts.map +1 -0
- package/dist/graph-dsl-core.js +312 -0
- package/dist/graph-dsl-core.js.map +1 -0
- package/dist/graph-dsl.d.ts +30 -0
- package/dist/graph-dsl.d.ts.map +1 -0
- package/dist/graph-dsl.js +116 -0
- package/dist/graph-dsl.js.map +1 -0
- package/dist/host-binaries.d.ts +6 -0
- package/dist/host-binaries.d.ts.map +1 -0
- package/dist/host-binaries.js +6 -0
- package/dist/host-binaries.js.map +1 -0
- package/dist/host-binary-guard.d.ts +100 -0
- package/dist/host-binary-guard.d.ts.map +1 -0
- package/dist/host-binary-guard.js +205 -0
- package/dist/host-binary-guard.js.map +1 -0
- package/dist/host-modules/aws.d.ts +57 -0
- package/dist/host-modules/aws.d.ts.map +1 -0
- package/dist/host-modules/aws.js +309 -0
- package/dist/host-modules/aws.js.map +1 -0
- package/dist/host-modules/chrono.d.ts +15 -0
- package/dist/host-modules/chrono.d.ts.map +1 -0
- package/dist/host-modules/chrono.js +35 -0
- package/dist/host-modules/chrono.js.map +1 -0
- package/dist/host-modules/csv.d.ts +17 -0
- package/dist/host-modules/csv.d.ts.map +1 -0
- package/dist/host-modules/csv.js +64 -0
- package/dist/host-modules/csv.js.map +1 -0
- package/dist/host-modules/diff.d.ts +9 -0
- package/dist/host-modules/diff.d.ts.map +1 -0
- package/dist/host-modules/diff.js +26 -0
- package/dist/host-modules/diff.js.map +1 -0
- package/dist/host-modules/dispatcher.d.ts +41 -0
- package/dist/host-modules/dispatcher.d.ts.map +1 -0
- package/dist/host-modules/dispatcher.js +99 -0
- package/dist/host-modules/dispatcher.js.map +1 -0
- package/dist/host-modules/docx.d.ts +19 -0
- package/dist/host-modules/docx.d.ts.map +1 -0
- package/dist/host-modules/docx.js +120 -0
- package/dist/host-modules/docx.js.map +1 -0
- package/dist/host-modules/epub.d.ts +48 -0
- package/dist/host-modules/epub.d.ts.map +1 -0
- package/dist/host-modules/epub.js +100 -0
- package/dist/host-modules/epub.js.map +1 -0
- package/dist/host-modules/exif.d.ts +8 -0
- package/dist/host-modules/exif.d.ts.map +1 -0
- package/dist/host-modules/exif.js +19 -0
- package/dist/host-modules/exif.js.map +1 -0
- package/dist/host-modules/expr.d.ts +16 -0
- package/dist/host-modules/expr.d.ts.map +1 -0
- package/dist/host-modules/expr.js +18 -0
- package/dist/host-modules/expr.js.map +1 -0
- package/dist/host-modules/fabric.d.ts +46 -0
- package/dist/host-modules/fabric.d.ts.map +1 -0
- package/dist/host-modules/fabric.js +178 -0
- package/dist/host-modules/fabric.js.map +1 -0
- package/dist/host-modules/html.d.ts +51 -0
- package/dist/host-modules/html.d.ts.map +1 -0
- package/dist/host-modules/html.js +198 -0
- package/dist/host-modules/html.js.map +1 -0
- package/dist/host-modules/ics.d.ts +9 -0
- package/dist/host-modules/ics.d.ts.map +1 -0
- package/dist/host-modules/ics.js +35 -0
- package/dist/host-modules/ics.js.map +1 -0
- package/dist/host-modules/limits.d.ts +41 -0
- package/dist/host-modules/limits.d.ts.map +1 -0
- package/dist/host-modules/limits.js +76 -0
- package/dist/host-modules/limits.js.map +1 -0
- package/dist/host-modules/mammoth.d.ts +11 -0
- package/dist/host-modules/mammoth.d.ts.map +1 -0
- package/dist/host-modules/mammoth.js +29 -0
- package/dist/host-modules/mammoth.js.map +1 -0
- package/dist/host-modules/notion.d.ts +45 -0
- package/dist/host-modules/notion.d.ts.map +1 -0
- package/dist/host-modules/notion.js +128 -0
- package/dist/host-modules/notion.js.map +1 -0
- package/dist/host-modules/ocr.d.ts +25 -0
- package/dist/host-modules/ocr.d.ts.map +1 -0
- package/dist/host-modules/ocr.js +74 -0
- package/dist/host-modules/ocr.js.map +1 -0
- package/dist/host-modules/pdf.d.ts +21 -0
- package/dist/host-modules/pdf.d.ts.map +1 -0
- package/dist/host-modules/pdf.js +53 -0
- package/dist/host-modules/pdf.js.map +1 -0
- package/dist/host-modules/pdflib.d.ts +17 -0
- package/dist/host-modules/pdflib.d.ts.map +1 -0
- package/dist/host-modules/pdflib.js +138 -0
- package/dist/host-modules/pdflib.js.map +1 -0
- package/dist/host-modules/pptx.d.ts +19 -0
- package/dist/host-modules/pptx.d.ts.map +1 -0
- package/dist/host-modules/pptx.js +67 -0
- package/dist/host-modules/pptx.js.map +1 -0
- package/dist/host-modules/pptxgen.d.ts +13 -0
- package/dist/host-modules/pptxgen.d.ts.map +1 -0
- package/dist/host-modules/pptxgen.js +98 -0
- package/dist/host-modules/pptxgen.js.map +1 -0
- package/dist/host-modules/prepared-request.d.ts +41 -0
- package/dist/host-modules/prepared-request.d.ts.map +1 -0
- package/dist/host-modules/prepared-request.js +104 -0
- package/dist/host-modules/prepared-request.js.map +1 -0
- package/dist/host-modules/registry.d.ts +31 -0
- package/dist/host-modules/registry.d.ts.map +1 -0
- package/dist/host-modules/registry.js +193 -0
- package/dist/host-modules/registry.js.map +1 -0
- package/dist/host-modules/subtitle.d.ts +15 -0
- package/dist/host-modules/subtitle.d.ts.map +1 -0
- package/dist/host-modules/subtitle.js +45 -0
- package/dist/host-modules/subtitle.js.map +1 -0
- package/dist/host-modules/supabase.d.ts +42 -0
- package/dist/host-modules/supabase.d.ts.map +1 -0
- package/dist/host-modules/supabase.js +141 -0
- package/dist/host-modules/supabase.js.map +1 -0
- package/dist/host-modules/tfjs.d.ts +42 -0
- package/dist/host-modules/tfjs.d.ts.map +1 -0
- package/dist/host-modules/tfjs.js +186 -0
- package/dist/host-modules/tfjs.js.map +1 -0
- package/dist/host-modules/tokens.d.ts +17 -0
- package/dist/host-modules/tokens.d.ts.map +1 -0
- package/dist/host-modules/tokens.js +74 -0
- package/dist/host-modules/tokens.js.map +1 -0
- package/dist/host-modules/twilio.d.ts +34 -0
- package/dist/host-modules/twilio.d.ts.map +1 -0
- package/dist/host-modules/twilio.js +67 -0
- package/dist/host-modules/twilio.js.map +1 -0
- package/dist/host-modules/xlsx.d.ts +26 -0
- package/dist/host-modules/xlsx.d.ts.map +1 -0
- package/dist/host-modules/xlsx.js +323 -0
- package/dist/host-modules/xlsx.js.map +1 -0
- package/dist/host-modules/xml.d.ts +23 -0
- package/dist/host-modules/xml.d.ts.map +1 -0
- package/dist/host-modules/xml.js +38 -0
- package/dist/host-modules/xml.js.map +1 -0
- package/dist/host-modules/zip.d.ts +24 -0
- package/dist/host-modules/zip.d.ts.map +1 -0
- package/dist/host-modules/zip.js +70 -0
- package/dist/host-modules/zip.js.map +1 -0
- package/dist/index.d.ts +197 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +153 -60
- package/dist/index.js.map +1 -1
- package/dist/js-sandbox-worker/host.d.ts +136 -0
- package/dist/js-sandbox-worker/host.d.ts.map +1 -0
- package/dist/js-sandbox-worker/host.js +482 -0
- package/dist/js-sandbox-worker/host.js.map +1 -0
- package/dist/js-sandbox-worker/interpreter.d.ts +276 -0
- package/dist/js-sandbox-worker/interpreter.d.ts.map +1 -0
- package/dist/js-sandbox-worker/interpreter.js +1201 -0
- package/dist/js-sandbox-worker/interpreter.js.map +1 -0
- package/dist/js-sandbox-worker/protocol.d.ts +168 -0
- package/dist/js-sandbox-worker/protocol.d.ts.map +1 -0
- package/dist/js-sandbox-worker/protocol.js +217 -0
- package/dist/js-sandbox-worker/protocol.js.map +1 -0
- package/dist/js-sandbox-worker/worker-entry.d.ts +26 -0
- package/dist/js-sandbox-worker/worker-entry.d.ts.map +1 -0
- package/dist/js-sandbox-worker/worker-entry.js +307 -0
- package/dist/js-sandbox-worker/worker-entry.js.map +1 -0
- package/dist/js-sandbox.d.ts +455 -15
- package/dist/js-sandbox.d.ts.map +1 -1
- package/dist/js-sandbox.js +1961 -309
- package/dist/js-sandbox.js.map +1 -1
- package/dist/js-script-app-runner.d.ts +9 -0
- package/dist/js-script-app-runner.d.ts.map +1 -0
- package/dist/js-script-app-runner.js +49 -0
- package/dist/js-script-app-runner.js.map +1 -0
- package/dist/js-script-sandbox.d.ts +33 -0
- package/dist/js-script-sandbox.d.ts.map +1 -0
- package/dist/js-script-sandbox.js +82 -0
- package/dist/js-script-sandbox.js.map +1 -0
- package/dist/jtbd/friction.d.ts +26 -0
- package/dist/jtbd/friction.d.ts.map +1 -0
- package/dist/jtbd/friction.js +169 -0
- package/dist/jtbd/friction.js.map +1 -0
- package/dist/jtbd/index.d.ts +6 -0
- package/dist/jtbd/index.d.ts.map +1 -0
- package/dist/jtbd/index.js +6 -0
- package/dist/jtbd/index.js.map +1 -0
- package/dist/jtbd/optimize.d.ts +71 -0
- package/dist/jtbd/optimize.d.ts.map +1 -0
- package/dist/jtbd/optimize.js +176 -0
- package/dist/jtbd/optimize.js.map +1 -0
- package/dist/jtbd/registry.d.ts +29 -0
- package/dist/jtbd/registry.d.ts.map +1 -0
- package/dist/jtbd/registry.js +451 -0
- package/dist/jtbd/registry.js.map +1 -0
- package/dist/jtbd/run.d.ts +70 -0
- package/dist/jtbd/run.d.ts.map +1 -0
- package/dist/jtbd/run.js +177 -0
- package/dist/jtbd/run.js.map +1 -0
- package/dist/jtbd/types.d.ts +141 -0
- package/dist/jtbd/types.d.ts.map +1 -0
- package/dist/jtbd/types.js +25 -0
- package/dist/jtbd/types.js.map +1 -0
- package/dist/model-prompting-skills.d.ts +45 -0
- package/dist/model-prompting-skills.d.ts.map +1 -0
- package/dist/model-prompting-skills.js +116 -0
- package/dist/model-prompting-skills.js.map +1 -0
- package/dist/network-guard.d.ts +50 -0
- package/dist/network-guard.d.ts.map +1 -0
- package/dist/network-guard.js +106 -0
- package/dist/network-guard.js.map +1 -0
- package/dist/normalize-model-properties.d.ts +26 -0
- package/dist/normalize-model-properties.d.ts.map +1 -0
- package/dist/normalize-model-properties.js +58 -0
- package/dist/normalize-model-properties.js.map +1 -0
- package/dist/output-format.d.ts +5 -1
- package/dist/output-format.d.ts.map +1 -1
- package/dist/output-format.js.map +1 -1
- package/dist/parallel-task-executor.d.ts +68 -37
- package/dist/parallel-task-executor.d.ts.map +1 -1
- package/dist/parallel-task-executor.js +234 -203
- package/dist/parallel-task-executor.js.map +1 -1
- package/dist/prompts/background-subtask-prompt.d.ts +14 -0
- package/dist/prompts/background-subtask-prompt.d.ts.map +1 -0
- package/dist/prompts/background-subtask-prompt.js +64 -0
- package/dist/prompts/background-subtask-prompt.js.map +1 -0
- package/dist/prompts/product-knowledge.d.ts +3 -0
- package/dist/prompts/product-knowledge.d.ts.map +1 -0
- package/dist/prompts/product-knowledge.js +79 -0
- package/dist/prompts/product-knowledge.js.map +1 -0
- package/dist/prompts/read-only-search-prompt.d.ts +33 -0
- package/dist/prompts/read-only-search-prompt.d.ts.map +1 -0
- package/dist/prompts/read-only-search-prompt.js +109 -0
- package/dist/prompts/read-only-search-prompt.js.map +1 -0
- package/dist/prompts/sandbox-pack-catalog.d.ts +23 -0
- package/dist/prompts/sandbox-pack-catalog.d.ts.map +1 -0
- package/dist/prompts/sandbox-pack-catalog.js +40 -0
- package/dist/prompts/sandbox-pack-catalog.js.map +1 -0
- package/dist/prompts/security-monitor-prompt.d.ts +32 -0
- package/dist/prompts/security-monitor-prompt.d.ts.map +1 -0
- package/dist/prompts/security-monitor-prompt.js +99 -0
- package/dist/prompts/security-monitor-prompt.js.map +1 -0
- package/dist/prompts/workflow-authoring-knowledge.d.ts +77 -0
- package/dist/prompts/workflow-authoring-knowledge.d.ts.map +1 -0
- package/dist/prompts/workflow-authoring-knowledge.js +319 -0
- package/dist/prompts/workflow-authoring-knowledge.js.map +1 -0
- package/dist/run-policy.d.ts +25 -0
- package/dist/run-policy.d.ts.map +1 -0
- package/dist/run-policy.js +54 -0
- package/dist/run-policy.js.map +1 -0
- package/dist/sandbox-av-media.d.ts +33 -0
- package/dist/sandbox-av-media.d.ts.map +1 -0
- package/dist/sandbox-av-media.js +666 -0
- package/dist/sandbox-av-media.js.map +1 -0
- package/dist/sandbox-bootstrap-modules.d.ts +54 -0
- package/dist/sandbox-bootstrap-modules.d.ts.map +1 -0
- package/dist/sandbox-bootstrap-modules.js +104 -0
- package/dist/sandbox-bootstrap-modules.js.map +1 -0
- package/dist/sandbox-bytes.d.ts +43 -0
- package/dist/sandbox-bytes.d.ts.map +1 -0
- package/dist/sandbox-bytes.js +61 -0
- package/dist/sandbox-bytes.js.map +1 -0
- package/dist/sandbox-canvas-api.d.ts +30 -0
- package/dist/sandbox-canvas-api.d.ts.map +1 -0
- package/dist/sandbox-canvas-api.js +81 -0
- package/dist/sandbox-canvas-api.js.map +1 -0
- package/dist/sandbox-constants.d.ts +5 -0
- package/dist/sandbox-constants.d.ts.map +1 -0
- package/dist/sandbox-constants.js +13 -0
- package/dist/sandbox-constants.js.map +1 -0
- package/dist/sandbox-json-transport.d.ts +107 -0
- package/dist/sandbox-json-transport.d.ts.map +1 -0
- package/dist/sandbox-json-transport.js +324 -0
- package/dist/sandbox-json-transport.js.map +1 -0
- package/dist/sandbox-media-handle.d.ts +78 -0
- package/dist/sandbox-media-handle.d.ts.map +1 -0
- package/dist/sandbox-media-handle.js +114 -0
- package/dist/sandbox-media-handle.js.map +1 -0
- package/dist/sandbox-media-ref.d.ts +134 -0
- package/dist/sandbox-media-ref.d.ts.map +1 -0
- package/dist/sandbox-media-ref.js +442 -0
- package/dist/sandbox-media-ref.js.map +1 -0
- package/dist/sandbox-media.d.ts +177 -0
- package/dist/sandbox-media.d.ts.map +1 -0
- package/dist/sandbox-media.js +963 -0
- package/dist/sandbox-media.js.map +1 -0
- package/dist/sandbox-module-fixtures.d.ts +445 -0
- package/dist/sandbox-module-fixtures.d.ts.map +1 -0
- package/dist/sandbox-module-fixtures.js +214 -0
- package/dist/sandbox-module-fixtures.js.map +1 -0
- package/dist/sandbox-toolbelt.d.ts +13 -0
- package/dist/sandbox-toolbelt.d.ts.map +1 -0
- package/dist/sandbox-toolbelt.js +64 -0
- package/dist/sandbox-toolbelt.js.map +1 -0
- package/dist/security-monitor.d.ts +89 -0
- package/dist/security-monitor.d.ts.map +1 -0
- package/dist/security-monitor.js +307 -0
- package/dist/security-monitor.js.map +1 -0
- package/dist/serpapi/catalog.d.ts +101 -0
- package/dist/serpapi/catalog.d.ts.map +1 -0
- package/dist/serpapi/catalog.js +246 -0
- package/dist/serpapi/catalog.js.map +1 -0
- package/dist/serpapi/client.d.ts +81 -0
- package/dist/serpapi/client.d.ts.map +1 -0
- package/dist/serpapi/client.js +228 -0
- package/dist/serpapi/client.js.map +1 -0
- package/dist/serpapi/errors.d.ts +49 -0
- package/dist/serpapi/errors.d.ts.map +1 -0
- package/dist/serpapi/errors.js +64 -0
- package/dist/serpapi/errors.js.map +1 -0
- package/dist/serpapi/normalize.d.ts +58 -0
- package/dist/serpapi/normalize.d.ts.map +1 -0
- package/dist/serpapi/normalize.js +140 -0
- package/dist/serpapi/normalize.js.map +1 -0
- package/dist/skill-prompt.d.ts +27 -0
- package/dist/skill-prompt.d.ts.map +1 -0
- package/dist/skill-prompt.js +61 -0
- package/dist/skill-prompt.js.map +1 -0
- package/dist/step-executor.d.ts +90 -77
- package/dist/step-executor.d.ts.map +1 -1
- package/dist/step-executor.js +384 -690
- package/dist/step-executor.js.map +1 -1
- package/dist/subagent.d.ts +275 -0
- package/dist/subagent.d.ts.map +1 -0
- package/dist/subagent.js +444 -0
- package/dist/subagent.js.map +1 -0
- package/dist/supervisor/prompt.d.ts +12 -0
- package/dist/supervisor/prompt.d.ts.map +1 -0
- package/dist/supervisor/prompt.js +51 -0
- package/dist/supervisor/prompt.js.map +1 -0
- package/dist/supervisor/supervisor-agent.d.ts +72 -0
- package/dist/supervisor/supervisor-agent.d.ts.map +1 -0
- package/dist/supervisor/supervisor-agent.js +185 -0
- package/dist/supervisor/supervisor-agent.js.map +1 -0
- package/dist/supervisor/tools.d.ts +56 -0
- package/dist/supervisor/tools.d.ts.map +1 -0
- package/dist/supervisor/tools.js +83 -0
- package/dist/supervisor/tools.js.map +1 -0
- package/dist/supervisor/verdict-schema.d.ts +18 -0
- package/dist/supervisor/verdict-schema.d.ts.map +1 -0
- package/dist/supervisor/verdict-schema.js +58 -0
- package/dist/supervisor/verdict-schema.js.map +1 -0
- package/dist/system-skills.d.ts +68 -0
- package/dist/system-skills.d.ts.map +1 -0
- package/dist/system-skills.js +168 -0
- package/dist/system-skills.js.map +1 -0
- package/dist/task-executor.d.ts +90 -40
- package/dist/task-executor.d.ts.map +1 -1
- package/dist/task-executor.js +259 -282
- package/dist/task-executor.js.map +1 -1
- package/dist/task-planner.d.ts +18 -12
- package/dist/task-planner.d.ts.map +1 -1
- package/dist/task-planner.js +342 -328
- package/dist/task-planner.js.map +1 -1
- package/dist/timeline-preview/compare.d.ts +27 -0
- package/dist/timeline-preview/compare.d.ts.map +1 -0
- package/dist/timeline-preview/compare.js +71 -0
- package/dist/timeline-preview/compare.js.map +1 -0
- package/dist/timeline-preview/frames.d.ts +167 -0
- package/dist/timeline-preview/frames.d.ts.map +1 -0
- package/dist/timeline-preview/frames.js +646 -0
- package/dist/timeline-preview/frames.js.map +1 -0
- package/dist/timeline-preview/model3d.d.ts +67 -0
- package/dist/timeline-preview/model3d.d.ts.map +1 -0
- package/dist/timeline-preview/model3d.js +165 -0
- package/dist/timeline-preview/model3d.js.map +1 -0
- package/dist/timeline-preview/rasterize.d.ts +33 -0
- package/dist/timeline-preview/rasterize.d.ts.map +1 -0
- package/dist/timeline-preview/rasterize.js +83 -0
- package/dist/timeline-preview/rasterize.js.map +1 -0
- package/dist/timeline-preview/sheet.d.ts +38 -0
- package/dist/timeline-preview/sheet.d.ts.map +1 -0
- package/dist/timeline-preview/sheet.js +72 -0
- package/dist/timeline-preview/sheet.js.map +1 -0
- package/dist/tools/asset-persist.d.ts +29 -0
- package/dist/tools/asset-persist.d.ts.map +1 -0
- package/dist/tools/asset-persist.js +78 -0
- package/dist/tools/asset-persist.js.map +1 -0
- package/dist/tools/base-tool.d.ts +52 -5
- package/dist/tools/base-tool.d.ts.map +1 -1
- package/dist/tools/base-tool.js +180 -3
- package/dist/tools/base-tool.js.map +1 -1
- package/dist/tools/binary-output.d.ts +54 -0
- package/dist/tools/binary-output.d.ts.map +1 -0
- package/dist/tools/binary-output.js +127 -0
- package/dist/tools/binary-output.js.map +1 -0
- package/dist/tools/browser-tools.d.ts +5 -29
- package/dist/tools/browser-tools.d.ts.map +1 -1
- package/dist/tools/browser-tools.js +5 -205
- package/dist/tools/browser-tools.js.map +1 -1
- package/dist/tools/builtin-tools.d.ts +52 -0
- package/dist/tools/builtin-tools.d.ts.map +1 -0
- package/dist/tools/builtin-tools.js +276 -0
- package/dist/tools/builtin-tools.js.map +1 -0
- package/dist/tools/control-tool.d.ts +2 -5
- package/dist/tools/control-tool.d.ts.map +1 -1
- package/dist/tools/control-tool.js +18 -15
- package/dist/tools/control-tool.js.map +1 -1
- package/dist/tools/dataseo-tools.d.ts +34 -32
- package/dist/tools/dataseo-tools.d.ts.map +1 -1
- package/dist/tools/dataseo-tools.js +148 -233
- package/dist/tools/dataseo-tools.js.map +1 -1
- package/dist/tools/external-capability-tools.d.ts +36 -0
- package/dist/tools/external-capability-tools.d.ts.map +1 -0
- package/dist/tools/external-capability-tools.js +41 -0
- package/dist/tools/external-capability-tools.js.map +1 -0
- package/dist/tools/external-mcp-tools.d.ts +139 -0
- package/dist/tools/external-mcp-tools.d.ts.map +1 -0
- package/dist/tools/external-mcp-tools.js +552 -0
- package/dist/tools/external-mcp-tools.js.map +1 -0
- package/dist/tools/finish-step-tool.d.ts +1 -1
- package/dist/tools/finish-step-tool.d.ts.map +1 -1
- package/dist/tools/finish-step-tool.js +3 -3
- package/dist/tools/finish-step-tool.js.map +1 -1
- package/dist/tools/google-tools.d.ts +28 -39
- package/dist/tools/google-tools.d.ts.map +1 -1
- package/dist/tools/google-tools.js +51 -164
- package/dist/tools/google-tools.js.map +1 -1
- package/dist/tools/google-workspace-tools.d.ts +23 -0
- package/dist/tools/google-workspace-tools.d.ts.map +1 -0
- package/dist/tools/google-workspace-tools.js +26 -0
- package/dist/tools/google-workspace-tools.js.map +1 -0
- package/dist/tools/graph-validation-registry.d.ts +33 -0
- package/dist/tools/graph-validation-registry.d.ts.map +1 -0
- package/dist/tools/graph-validation-registry.js +54 -0
- package/dist/tools/graph-validation-registry.js.map +1 -0
- package/dist/tools/http-tools.d.ts +5 -53
- package/dist/tools/http-tools.d.ts.map +1 -1
- package/dist/tools/http-tools.js +5 -177
- package/dist/tools/http-tools.js.map +1 -1
- package/dist/tools/image-injection.d.ts +51 -0
- package/dist/tools/image-injection.d.ts.map +1 -0
- package/dist/tools/image-injection.js +85 -0
- package/dist/tools/image-injection.js.map +1 -0
- package/dist/tools/mcp-tool-support.d.ts +203 -0
- package/dist/tools/mcp-tool-support.d.ts.map +1 -0
- package/dist/tools/mcp-tool-support.js +536 -0
- package/dist/tools/mcp-tool-support.js.map +1 -0
- package/dist/tools/mcp-tools.d.ts +104 -390
- package/dist/tools/mcp-tools.d.ts.map +1 -1
- package/dist/tools/mcp-tools.js +128 -600
- package/dist/tools/mcp-tools.js.map +1 -1
- package/dist/tools/media-tools.d.ts +9 -272
- package/dist/tools/media-tools.d.ts.map +1 -1
- package/dist/tools/media-tools.js +11 -676
- package/dist/tools/media-tools.js.map +1 -1
- package/dist/tools/memory-tools.d.ts +36 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +52 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/openai-tools.d.ts +28 -68
- package/dist/tools/openai-tools.d.ts.map +1 -1
- package/dist/tools/openai-tools.js +51 -181
- package/dist/tools/openai-tools.js.map +1 -1
- package/dist/tools/plan-builder-tools.d.ts +141 -7
- package/dist/tools/plan-builder-tools.d.ts.map +1 -1
- package/dist/tools/plan-builder-tools.js +159 -86
- package/dist/tools/plan-builder-tools.js.map +1 -1
- package/dist/tools/run-search-tool.d.ts +82 -0
- package/dist/tools/run-search-tool.d.ts.map +1 -0
- package/dist/tools/run-search-tool.js +121 -0
- package/dist/tools/run-search-tool.js.map +1 -0
- package/dist/tools/run-subtask-tool.d.ts +49 -0
- package/dist/tools/run-subtask-tool.d.ts.map +1 -0
- package/dist/tools/run-subtask-tool.js +88 -0
- package/dist/tools/run-subtask-tool.js.map +1 -0
- package/dist/tools/search-tools.d.ts +5 -36
- package/dist/tools/search-tools.d.ts.map +1 -1
- package/dist/tools/search-tools.js +5 -215
- package/dist/tools/search-tools.js.map +1 -1
- package/dist/tools/serp-providers/apify-provider.d.ts +18 -0
- package/dist/tools/serp-providers/apify-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/apify-provider.js +93 -0
- package/dist/tools/serp-providers/apify-provider.js.map +1 -0
- package/dist/tools/serp-providers/brave-provider.d.ts +34 -0
- package/dist/tools/serp-providers/brave-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/brave-provider.js +86 -0
- package/dist/tools/serp-providers/brave-provider.js.map +1 -0
- package/dist/tools/serp-providers/dataforseo-provider.d.ts +14 -1
- package/dist/tools/serp-providers/dataforseo-provider.d.ts.map +1 -1
- package/dist/tools/serp-providers/dataforseo-provider.js +0 -9
- package/dist/tools/serp-providers/dataforseo-provider.js.map +1 -1
- package/dist/tools/serp-providers/gemini-provider.d.ts +45 -0
- package/dist/tools/serp-providers/gemini-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/gemini-provider.js +148 -0
- package/dist/tools/serp-providers/gemini-provider.js.map +1 -0
- package/dist/tools/serp-providers/index.d.ts +61 -0
- package/dist/tools/serp-providers/index.d.ts.map +1 -1
- package/dist/tools/serp-providers/index.js +119 -3
- package/dist/tools/serp-providers/index.js.map +1 -1
- package/dist/tools/serp-providers/openai-provider.d.ts +58 -0
- package/dist/tools/serp-providers/openai-provider.d.ts.map +1 -0
- package/dist/tools/serp-providers/openai-provider.js +113 -0
- package/dist/tools/serp-providers/openai-provider.js.map +1 -0
- package/dist/tools/serp-providers/serpapi-provider.d.ts +9 -5
- package/dist/tools/serp-providers/serpapi-provider.d.ts.map +1 -1
- package/dist/tools/serp-providers/serpapi-provider.js +26 -44
- package/dist/tools/serp-providers/serpapi-provider.js.map +1 -1
- package/dist/tools/serp-tool-factory.d.ts +27 -0
- package/dist/tools/serp-tool-factory.d.ts.map +1 -0
- package/dist/tools/serp-tool-factory.js +56 -0
- package/dist/tools/serp-tool-factory.js.map +1 -0
- package/dist/tools/shared-tools.d.ts +33 -0
- package/dist/tools/shared-tools.d.ts.map +1 -0
- package/dist/tools/shared-tools.js +39 -0
- package/dist/tools/shared-tools.js.map +1 -0
- package/dist/tools/start-subtask-tool.d.ts +51 -0
- package/dist/tools/start-subtask-tool.d.ts.map +1 -0
- package/dist/tools/start-subtask-tool.js +189 -0
- package/dist/tools/start-subtask-tool.js.map +1 -0
- package/dist/tools/submit-code-tool.d.ts +159 -0
- package/dist/tools/submit-code-tool.d.ts.map +1 -0
- package/dist/tools/submit-code-tool.js +209 -0
- package/dist/tools/submit-code-tool.js.map +1 -0
- package/dist/tools/subtask-fields.d.ts +11 -0
- package/dist/tools/subtask-fields.d.ts.map +1 -0
- package/dist/tools/subtask-fields.js +11 -0
- package/dist/tools/subtask-fields.js.map +1 -0
- package/dist/tools/todo-tools.d.ts +15 -0
- package/dist/tools/todo-tools.d.ts.map +1 -0
- package/dist/tools/todo-tools.js +15 -0
- package/dist/tools/todo-tools.js.map +1 -0
- package/dist/tools/tool-permissions.d.ts +40 -0
- package/dist/tools/tool-permissions.d.ts.map +1 -0
- package/dist/tools/tool-permissions.js +52 -0
- package/dist/tools/tool-permissions.js.map +1 -0
- package/dist/tools/tool-search.d.ts +39 -0
- package/dist/tools/tool-search.d.ts.map +1 -0
- package/dist/tools/tool-search.js +108 -0
- package/dist/tools/tool-search.js.map +1 -0
- package/dist/tools/vector-tool-support.d.ts +15 -0
- package/dist/tools/vector-tool-support.d.ts.map +1 -0
- package/dist/tools/vector-tool-support.js +133 -0
- package/dist/tools/vector-tool-support.js.map +1 -0
- package/dist/tools/vector-tools.d.ts +13 -220
- package/dist/tools/vector-tools.d.ts.map +1 -1
- package/dist/tools/vector-tools.js +7 -578
- package/dist/tools/vector-tools.js.map +1 -1
- package/dist/tools/wait-subtasks-tool.d.ts +27 -0
- package/dist/tools/wait-subtasks-tool.d.ts.map +1 -0
- package/dist/tools/wait-subtasks-tool.js +66 -0
- package/dist/tools/wait-subtasks-tool.js.map +1 -0
- package/dist/tsconfig.tests.tmp.tsbuildinfo +1 -0
- package/dist/types.d.ts +16 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/dag-scheduler.d.ts +85 -0
- package/dist/utils/dag-scheduler.d.ts.map +1 -0
- package/dist/utils/dag-scheduler.js +180 -0
- package/dist/utils/dag-scheduler.js.map +1 -0
- package/dist/utils/json-parser.d.ts +32 -1
- package/dist/utils/json-parser.d.ts.map +1 -1
- package/dist/utils/json-parser.js +145 -10
- package/dist/utils/json-parser.js.map +1 -1
- package/dist/utils/json-schema-validate.d.ts +29 -0
- package/dist/utils/json-schema-validate.d.ts.map +1 -0
- package/dist/utils/json-schema-validate.js +228 -0
- package/dist/utils/json-schema-validate.js.map +1 -0
- package/dist/utils/link-abort.d.ts +13 -0
- package/dist/utils/link-abort.d.ts.map +1 -0
- package/dist/utils/link-abort.js +23 -0
- package/dist/utils/link-abort.js.map +1 -0
- package/dist/utils/merge-generators.d.ts +58 -0
- package/dist/utils/merge-generators.d.ts.map +1 -0
- package/dist/utils/merge-generators.js +148 -0
- package/dist/utils/merge-generators.js.map +1 -0
- package/dist/utils/remove-base64-images.d.ts +0 -5
- package/dist/utils/remove-base64-images.d.ts.map +1 -1
- package/dist/utils/remove-base64-images.js.map +1 -1
- package/dist/utils/step-failure.d.ts +20 -0
- package/dist/utils/step-failure.d.ts.map +1 -0
- package/dist/utils/step-failure.js +43 -0
- package/dist/utils/step-failure.js.map +1 -0
- package/dist/utils/think-tags.d.ts +16 -0
- package/dist/utils/think-tags.d.ts.map +1 -0
- package/dist/utils/think-tags.js +23 -0
- package/dist/utils/think-tags.js.map +1 -0
- package/dist/utils/type-guards.d.ts +26 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +44 -0
- package/dist/utils/type-guards.js.map +1 -0
- package/dist/utils/ui-event-buffer.d.ts +18 -0
- package/dist/utils/ui-event-buffer.d.ts.map +1 -0
- package/dist/utils/ui-event-buffer.js +18 -0
- package/dist/utils/ui-event-buffer.js.map +1 -0
- package/dist/utils/wrap-generators-parallel.d.ts +0 -5
- package/dist/utils/wrap-generators-parallel.d.ts.map +1 -1
- package/dist/utils/wrap-generators-parallel.js +3 -6
- package/dist/utils/wrap-generators-parallel.js.map +1 -1
- package/dist/wasm-sandbox/host.d.ts +106 -0
- package/dist/wasm-sandbox/host.d.ts.map +1 -0
- package/dist/wasm-sandbox/host.js +409 -0
- package/dist/wasm-sandbox/host.js.map +1 -0
- package/dist/wasm-sandbox/workers.d.ts +43 -0
- package/dist/wasm-sandbox/workers.d.ts.map +1 -0
- package/dist/wasm-sandbox/workers.js +150 -0
- package/dist/wasm-sandbox/workers.js.map +1 -0
- package/dist/workspace-paths.d.ts +40 -0
- package/dist/workspace-paths.d.ts.map +1 -0
- package/dist/workspace-paths.js +102 -0
- package/dist/workspace-paths.js.map +1 -0
- package/dist/yt-dlp-gate.d.ts +19 -0
- package/dist/yt-dlp-gate.d.ts.map +1 -0
- package/dist/yt-dlp-gate.js +22 -0
- package/dist/yt-dlp-gate.js.map +1 -0
- package/package.json +112 -14
- package/dist/agent-executor.d.ts +0 -62
- package/dist/agent-executor.d.ts.map +0 -1
- package/dist/agent-executor.js +0 -324
- package/dist/agent-executor.js.map +0 -1
- package/dist/agent-step-executor.d.ts +0 -28
- package/dist/agent-step-executor.d.ts.map +0 -1
- package/dist/agent-step-executor.js +0 -99
- package/dist/agent-step-executor.js.map +0 -1
- package/dist/agent-workflow-runner.d.ts +0 -31
- package/dist/agent-workflow-runner.d.ts.map +0 -1
- package/dist/agent-workflow-runner.js +0 -124
- package/dist/agent-workflow-runner.js.map +0 -1
- package/dist/agent.d.ts +0 -115
- package/dist/agent.d.ts.map +0 -1
- package/dist/agent.js +0 -587
- package/dist/agent.js.map +0 -1
- package/dist/base-agent.d.ts +0 -42
- package/dist/base-agent.d.ts.map +0 -1
- package/dist/base-agent.js +0 -29
- package/dist/base-agent.js.map +0 -1
- package/dist/graph-planner.d.ts +0 -56
- package/dist/graph-planner.d.ts.map +0 -1
- package/dist/graph-planner.js +0 -311
- package/dist/graph-planner.js.map +0 -1
- package/dist/multi-mode-agent.d.ts +0 -86
- package/dist/multi-mode-agent.d.ts.map +0 -1
- package/dist/multi-mode-agent.js +0 -476
- package/dist/multi-mode-agent.js.map +0 -1
- package/dist/prompts/graph-planner-prompt.d.ts +0 -48
- package/dist/prompts/graph-planner-prompt.d.ts.map +0 -1
- package/dist/prompts/graph-planner-prompt.js +0 -180
- package/dist/prompts/graph-planner-prompt.js.map +0 -1
- package/dist/reject-agentic-provider.d.ts +0 -21
- package/dist/reject-agentic-provider.d.ts.map +0 -1
- package/dist/reject-agentic-provider.js +0 -32
- package/dist/reject-agentic-provider.js.map +0 -1
- package/dist/simple-agent.d.ts +0 -29
- package/dist/simple-agent.d.ts.map +0 -1
- package/dist/simple-agent.js +0 -54
- package/dist/simple-agent.js.map +0 -1
- package/dist/sub-agent-planner.d.ts +0 -33
- package/dist/sub-agent-planner.d.ts.map +0 -1
- package/dist/sub-agent-planner.js +0 -203
- package/dist/sub-agent-planner.js.map +0 -1
- package/dist/team/db-task-board.d.ts +0 -54
- package/dist/team/db-task-board.d.ts.map +0 -1
- package/dist/team/db-task-board.js +0 -361
- package/dist/team/db-task-board.js.map +0 -1
- package/dist/team/edge-message-bus.d.ts +0 -51
- package/dist/team/edge-message-bus.d.ts.map +0 -1
- package/dist/team/edge-message-bus.js +0 -169
- package/dist/team/edge-message-bus.js.map +0 -1
- package/dist/team/edge-task-board.d.ts +0 -77
- package/dist/team/edge-task-board.d.ts.map +0 -1
- package/dist/team/edge-task-board.js +0 -140
- package/dist/team/edge-task-board.js.map +0 -1
- package/dist/team/index.d.ts +0 -16
- package/dist/team/index.d.ts.map +0 -1
- package/dist/team/index.js +0 -17
- package/dist/team/index.js.map +0 -1
- package/dist/team/message-bus.d.ts +0 -58
- package/dist/team/message-bus.d.ts.map +0 -1
- package/dist/team/message-bus.js +0 -151
- package/dist/team/message-bus.js.map +0 -1
- package/dist/team/task-board.d.ts +0 -106
- package/dist/team/task-board.d.ts.map +0 -1
- package/dist/team/task-board.js +0 -370
- package/dist/team/task-board.js.map +0 -1
- package/dist/team/team-executor.d.ts +0 -72
- package/dist/team/team-executor.d.ts.map +0 -1
- package/dist/team/team-executor.js +0 -466
- package/dist/team/team-executor.js.map +0 -1
- package/dist/team/team-tools.d.ts +0 -252
- package/dist/team/team-tools.d.ts.map +0 -1
- package/dist/team/team-tools.js +0 -412
- package/dist/team/team-tools.js.map +0 -1
- package/dist/team/types.d.ts +0 -198
- package/dist/team/types.d.ts.map +0 -1
- package/dist/team/types.js +0 -8
- package/dist/team/types.js.map +0 -1
- package/dist/tools/add-edge-tool.d.ts +0 -18
- package/dist/tools/add-edge-tool.d.ts.map +0 -1
- package/dist/tools/add-edge-tool.js +0 -92
- package/dist/tools/add-edge-tool.js.map +0 -1
- package/dist/tools/add-node-tool.d.ts +0 -22
- package/dist/tools/add-node-tool.d.ts.map +0 -1
- package/dist/tools/add-node-tool.js +0 -128
- package/dist/tools/add-node-tool.js.map +0 -1
- package/dist/tools/asset-tools.d.ts +0 -58
- package/dist/tools/asset-tools.d.ts.map +0 -1
- package/dist/tools/asset-tools.js +0 -191
- package/dist/tools/asset-tools.js.map +0 -1
- package/dist/tools/calculator-tool.d.ts +0 -24
- package/dist/tools/calculator-tool.d.ts.map +0 -1
- package/dist/tools/calculator-tool.js +0 -64
- package/dist/tools/calculator-tool.js.map +0 -1
- package/dist/tools/claude-code-tools.d.ts +0 -96
- package/dist/tools/claude-code-tools.d.ts.map +0 -1
- package/dist/tools/claude-code-tools.js +0 -463
- package/dist/tools/claude-code-tools.js.map +0 -1
- package/dist/tools/code-tools.d.ts +0 -26
- package/dist/tools/code-tools.d.ts.map +0 -1
- package/dist/tools/code-tools.js +0 -82
- package/dist/tools/code-tools.js.map +0 -1
- package/dist/tools/create-plan-tool.d.ts +0 -29
- package/dist/tools/create-plan-tool.d.ts.map +0 -1
- package/dist/tools/create-plan-tool.js +0 -355
- package/dist/tools/create-plan-tool.js.map +0 -1
- package/dist/tools/create-task-tool.d.ts +0 -28
- package/dist/tools/create-task-tool.d.ts.map +0 -1
- package/dist/tools/create-task-tool.js +0 -254
- package/dist/tools/create-task-tool.js.map +0 -1
- package/dist/tools/email-tools.d.ts +0 -76
- package/dist/tools/email-tools.d.ts.map +0 -1
- package/dist/tools/email-tools.js +0 -259
- package/dist/tools/email-tools.js.map +0 -1
- package/dist/tools/filesystem-tools.d.ts +0 -77
- package/dist/tools/filesystem-tools.d.ts.map +0 -1
- package/dist/tools/filesystem-tools.js +0 -334
- package/dist/tools/filesystem-tools.js.map +0 -1
- package/dist/tools/find-model-tool.d.ts +0 -25
- package/dist/tools/find-model-tool.d.ts.map +0 -1
- package/dist/tools/find-model-tool.js +0 -236
- package/dist/tools/find-model-tool.js.map +0 -1
- package/dist/tools/finish-graph-tool.d.ts +0 -23
- package/dist/tools/finish-graph-tool.d.ts.map +0 -1
- package/dist/tools/finish-graph-tool.js +0 -46
- package/dist/tools/finish-graph-tool.js.map +0 -1
- package/dist/tools/js-code-tool.d.ts +0 -30
- package/dist/tools/js-code-tool.d.ts.map +0 -1
- package/dist/tools/js-code-tool.js +0 -98
- package/dist/tools/js-code-tool.js.map +0 -1
- package/dist/tools/local-get-node-info-tool.d.ts +0 -19
- package/dist/tools/local-get-node-info-tool.d.ts.map +0 -1
- package/dist/tools/local-get-node-info-tool.js +0 -75
- package/dist/tools/local-get-node-info-tool.js.map +0 -1
- package/dist/tools/local-list-nodes-tool.d.ts +0 -19
- package/dist/tools/local-list-nodes-tool.d.ts.map +0 -1
- package/dist/tools/local-list-nodes-tool.js +0 -69
- package/dist/tools/local-list-nodes-tool.js.map +0 -1
- package/dist/tools/local-search-nodes-tool.d.ts +0 -21
- package/dist/tools/local-search-nodes-tool.d.ts.map +0 -1
- package/dist/tools/local-search-nodes-tool.js +0 -111
- package/dist/tools/local-search-nodes-tool.js.map +0 -1
- package/dist/tools/math-tools.d.ts +0 -156
- package/dist/tools/math-tools.d.ts.map +0 -1
- package/dist/tools/math-tools.js +0 -422
- package/dist/tools/math-tools.js.map +0 -1
- package/dist/tools/model-tools.d.ts +0 -25
- package/dist/tools/model-tools.d.ts.map +0 -1
- package/dist/tools/model-tools.js +0 -48
- package/dist/tools/model-tools.js.map +0 -1
- package/dist/tools/pdf-tools.d.ts +0 -152
- package/dist/tools/pdf-tools.d.ts.map +0 -1
- package/dist/tools/pdf-tools.js +0 -339
- package/dist/tools/pdf-tools.js.map +0 -1
- package/dist/tools/tool-registry.d.ts +0 -9
- package/dist/tools/tool-registry.d.ts.map +0 -1
- package/dist/tools/tool-registry.js +0 -17
- package/dist/tools/tool-registry.js.map +0 -1
- package/dist/tools/workspace-tools.d.ts +0 -58
- package/dist/tools/workspace-tools.d.ts.map +0 -1
- package/dist/tools/workspace-tools.js +0 -152
- package/dist/tools/workspace-tools.js.map +0 -1
|
@@ -0,0 +1,963 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-side media engine behind the sandbox's `image` and `canvas` bridges.
|
|
3
|
+
*
|
|
4
|
+
* The guest never sees a canvas, a context, or an image object — those are host
|
|
5
|
+
* resources with methods, and the bridge contract is plain data in, plain data
|
|
6
|
+
* out. So the boundary carries encoded image bytes (`Uint8Array`) and, for
|
|
7
|
+
* drawing, a *draw list*: the guest records ordinary Canvas 2D calls
|
|
8
|
+
* synchronously and ships them in one {@link CanvasRenderSpec}, which this
|
|
9
|
+
* module replays against a real 2D context and encodes.
|
|
10
|
+
*
|
|
11
|
+
* Two backends implement the same surface, picked at first use:
|
|
12
|
+
*
|
|
13
|
+
* - **Node** — `@napi-rs/canvas` (Skia). Imported through `importHidden`, so no
|
|
14
|
+
* bundler tries to resolve the native addon into a browser graph. It is
|
|
15
|
+
* already staged as an external in `scripts/bundle-backend.mjs`, so the
|
|
16
|
+
* packaged Electron backend resolves it at runtime.
|
|
17
|
+
* - **Browser / worker** — `OffscreenCanvas` + `createImageBitmap` +
|
|
18
|
+
* `convertToBlob`, so the in-browser runner draws with the platform's own
|
|
19
|
+
* canvas instead of shipping a second copy of Skia.
|
|
20
|
+
*
|
|
21
|
+
* Neither backend is ever handed to the guest.
|
|
22
|
+
*/
|
|
23
|
+
import { importHidden } from "@nodetool-ai/config";
|
|
24
|
+
import { CANVAS_GRADIENT_MARKER, CANVAS_METHODS, CANVAS_PROPERTIES } from "./sandbox-canvas-api.js";
|
|
25
|
+
import { isFiniteNumber, isFunction, isObjectLike, isString } from "./utils/type-guards.js";
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Limits
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
/** Largest encoded image the `image.*` bridges accept. */
|
|
30
|
+
export const MAX_IMAGE_INPUT_BYTES = 25 * 1024 * 1024;
|
|
31
|
+
/** Pixel ceiling for a decoded image or a rendered canvas. */
|
|
32
|
+
export const MAX_IMAGE_PIXELS = 32 * 1024 * 1024;
|
|
33
|
+
/** Longest edge any single surface may have. */
|
|
34
|
+
export const MAX_IMAGE_DIMENSION = 16_384;
|
|
35
|
+
/**
|
|
36
|
+
* Pixel ceiling for `image.decode`. Lower than {@link MAX_IMAGE_PIXELS}: raw
|
|
37
|
+
* RGBA is four bytes a pixel and crosses the boundary base64-encoded, so the
|
|
38
|
+
* guest pays roughly 5.4x the pixel count in transferred characters.
|
|
39
|
+
*/
|
|
40
|
+
export const MAX_DECODE_PIXELS = 8 * 1024 * 1024;
|
|
41
|
+
/**
|
|
42
|
+
* Draw operations replayed per `canvas` render. The ceiling is generous
|
|
43
|
+
* against what the boundary can carry, not against Skia: each recorded op is
|
|
44
|
+
* a small object marshaled out of the guest, which costs around a millisecond,
|
|
45
|
+
* so a draw list this long already spends most of a default run's budget
|
|
46
|
+
* getting to the host. Composing several images with `image.composite` beats
|
|
47
|
+
* drawing tens of thousands of primitives.
|
|
48
|
+
*/
|
|
49
|
+
export const MAX_CANVAS_OPS = 10_000;
|
|
50
|
+
/** Composite layers accepted by one `image.composite` call. */
|
|
51
|
+
export const MAX_COMPOSITE_LAYERS = 64;
|
|
52
|
+
/** Default JPEG/WebP/AVIF quality when the caller names none. */
|
|
53
|
+
export const DEFAULT_IMAGE_QUALITY = 0.92;
|
|
54
|
+
export const IMAGE_FORMATS = ["png", "jpeg", "webp", "avif"];
|
|
55
|
+
function napiQuality(format, quality) {
|
|
56
|
+
// Skia takes 0-100 for the lossy encoders and ignores it for PNG.
|
|
57
|
+
if (format === "png")
|
|
58
|
+
return undefined;
|
|
59
|
+
return Math.round(Math.min(Math.max(quality, 0), 1) * 100);
|
|
60
|
+
}
|
|
61
|
+
function createNodeBackend(mod) {
|
|
62
|
+
return {
|
|
63
|
+
createSurface(width, height) {
|
|
64
|
+
const canvas = mod.createCanvas(width, height);
|
|
65
|
+
const ctx = canvas.getContext("2d");
|
|
66
|
+
// `__canvas` is this backend's own extension of the surface, kept off
|
|
67
|
+
// the public MediaSurface so callers cannot reach the backing canvas.
|
|
68
|
+
const surface = { width, height, ctx, __canvas: canvas };
|
|
69
|
+
return surface;
|
|
70
|
+
},
|
|
71
|
+
async decode(bytes) {
|
|
72
|
+
const img = await mod.loadImage(bytes);
|
|
73
|
+
return { width: img.width, height: img.height, handle: img };
|
|
74
|
+
},
|
|
75
|
+
async fromPixels(pixels, width, height) {
|
|
76
|
+
const canvas = mod.createCanvas(width, height);
|
|
77
|
+
const ctx = canvas.getContext("2d");
|
|
78
|
+
const clamped = new Uint8ClampedArray(pixels.buffer.slice(pixels.byteOffset, pixels.byteOffset + pixels.byteLength));
|
|
79
|
+
ctx.putImageData(new mod.ImageData(clamped, width, height), 0, 0);
|
|
80
|
+
return { width, height, handle: canvas };
|
|
81
|
+
},
|
|
82
|
+
async encode(surface, format, quality) {
|
|
83
|
+
// SAFETY: `createSurface` above is the only maker of this backend's
|
|
84
|
+
// surfaces and always sets `__canvas`; no other surface reaches here.
|
|
85
|
+
const canvas = surface.__canvas;
|
|
86
|
+
const q = napiQuality(format, quality);
|
|
87
|
+
const out = q === undefined
|
|
88
|
+
? await canvas.encode(format)
|
|
89
|
+
: await canvas.encode(format, q);
|
|
90
|
+
return out instanceof Uint8Array ? out : new Uint8Array(out);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function createBrowserBackend() {
|
|
95
|
+
// SAFETY: this backend is chosen only on a host that has the browser
|
|
96
|
+
// canvas globals; `createBrowserBackend` is never reached otherwise.
|
|
97
|
+
const globals = globalThis;
|
|
98
|
+
const make = (w, h) => new globals.OffscreenCanvas(w, h);
|
|
99
|
+
const createBitmap = globals.createImageBitmap;
|
|
100
|
+
return {
|
|
101
|
+
createSurface(width, height) {
|
|
102
|
+
const canvas = make(width, height);
|
|
103
|
+
const ctx = canvas.getContext("2d");
|
|
104
|
+
if (!ctx)
|
|
105
|
+
throw new Error("2d canvas context unavailable");
|
|
106
|
+
const surface = { width, height, ctx, __canvas: canvas };
|
|
107
|
+
return surface;
|
|
108
|
+
},
|
|
109
|
+
async decode(bytes) {
|
|
110
|
+
const blob = new Blob([bytes]);
|
|
111
|
+
const bitmap = await createBitmap(blob);
|
|
112
|
+
return { width: bitmap.width, height: bitmap.height, handle: bitmap };
|
|
113
|
+
},
|
|
114
|
+
async fromPixels(pixels, width, height) {
|
|
115
|
+
const clamped = new Uint8ClampedArray(pixels.buffer.slice(pixels.byteOffset, pixels.byteOffset + pixels.byteLength));
|
|
116
|
+
const data = new ImageData(clamped, width, height);
|
|
117
|
+
const bitmap = await createBitmap(data);
|
|
118
|
+
return { width, height, handle: bitmap };
|
|
119
|
+
},
|
|
120
|
+
async encode(surface, format, quality) {
|
|
121
|
+
// SAFETY: `createSurface` above is the only maker of this backend's
|
|
122
|
+
// surfaces and always sets `__canvas`; no other surface reaches here.
|
|
123
|
+
const canvas = surface.__canvas;
|
|
124
|
+
const blob = await canvas.convertToBlob({
|
|
125
|
+
type: `image/${format}`,
|
|
126
|
+
quality
|
|
127
|
+
});
|
|
128
|
+
return new Uint8Array(await blob.arrayBuffer());
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
let backendPromise = null;
|
|
133
|
+
/** Resolve the platform's canvas backend. Cached — the choice cannot change. */
|
|
134
|
+
export async function getMediaBackend() {
|
|
135
|
+
if (!backendPromise) {
|
|
136
|
+
backendPromise = (async () => {
|
|
137
|
+
const mod = await importHidden("@napi-rs/canvas").catch(() => null);
|
|
138
|
+
if (mod && isFunction(mod.createCanvas)) {
|
|
139
|
+
return createNodeBackend(mod);
|
|
140
|
+
}
|
|
141
|
+
if (isFunction(globalThis.OffscreenCanvas)) {
|
|
142
|
+
return createBrowserBackend();
|
|
143
|
+
}
|
|
144
|
+
throw new Error("image and canvas need a 2D canvas: install @napi-rs/canvas on Node, " +
|
|
145
|
+
"or run somewhere with OffscreenCanvas");
|
|
146
|
+
})();
|
|
147
|
+
// A failed probe must not be cached as a rejected promise forever.
|
|
148
|
+
backendPromise.catch(() => {
|
|
149
|
+
backendPromise = null;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return backendPromise;
|
|
153
|
+
}
|
|
154
|
+
/** Test seam: force a backend (or clear it with `null`). */
|
|
155
|
+
export function setMediaBackend(backend) {
|
|
156
|
+
backendPromise = backend ? Promise.resolve(backend) : null;
|
|
157
|
+
}
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
// Shared validation
|
|
160
|
+
// ---------------------------------------------------------------------------
|
|
161
|
+
/**
|
|
162
|
+
* Accept the two shapes bytes arrive in. Guest `Uint8Array`s are marshaled
|
|
163
|
+
* natively by the typed-array serializers, but a value that travelled through
|
|
164
|
+
* a plain-object round trip arrives numeric-keyed — coerce rather than refuse,
|
|
165
|
+
* so `image.resize(JSON.parse(...).bytes)` behaves.
|
|
166
|
+
*/
|
|
167
|
+
export function asImageBytes(value, label) {
|
|
168
|
+
if (value instanceof Uint8Array)
|
|
169
|
+
return value;
|
|
170
|
+
if (ArrayBuffer.isView(value)) {
|
|
171
|
+
const view = value;
|
|
172
|
+
return new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
173
|
+
}
|
|
174
|
+
if (value instanceof ArrayBuffer)
|
|
175
|
+
return new Uint8Array(value);
|
|
176
|
+
if (isObjectLike(value)) {
|
|
177
|
+
const record = value;
|
|
178
|
+
const length = Number(record.length ?? -1);
|
|
179
|
+
if (Number.isInteger(length) && length >= 0) {
|
|
180
|
+
const out = new Uint8Array(length);
|
|
181
|
+
for (let i = 0; i < length; i++)
|
|
182
|
+
out[i] = Number(record[i]) & 255;
|
|
183
|
+
return out;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
throw new Error(`${label} must be a Uint8Array of encoded image bytes`);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Call a context method by name, keeping the receiver. The backends' contexts
|
|
190
|
+
* are native objects — pulling a method off one and calling it bare throws
|
|
191
|
+
* "Illegal invocation" — and the index signature that makes the allowlist
|
|
192
|
+
* replay possible hides that from the type checker.
|
|
193
|
+
*/
|
|
194
|
+
function invoke(ctx, name, ...args) {
|
|
195
|
+
const fn = ctx[name];
|
|
196
|
+
if (!isFunction(fn)) {
|
|
197
|
+
throw new Error(`canvas: "${name}" is not available in this runtime`);
|
|
198
|
+
}
|
|
199
|
+
fn.apply(ctx, args);
|
|
200
|
+
}
|
|
201
|
+
function assertInputSize(bytes, label) {
|
|
202
|
+
if (bytes.length === 0)
|
|
203
|
+
throw new Error(`${label}: image bytes are empty`);
|
|
204
|
+
if (bytes.length > MAX_IMAGE_INPUT_BYTES) {
|
|
205
|
+
throw new Error(`${label}: image exceeds the ${MAX_IMAGE_INPUT_BYTES} byte limit`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export function assertSurfaceSize(width, height, label) {
|
|
209
|
+
if (!Number.isFinite(width) ||
|
|
210
|
+
!Number.isFinite(height) ||
|
|
211
|
+
width < 1 ||
|
|
212
|
+
height < 1) {
|
|
213
|
+
throw new Error(`${label}: width and height must be positive numbers`);
|
|
214
|
+
}
|
|
215
|
+
if (width > MAX_IMAGE_DIMENSION || height > MAX_IMAGE_DIMENSION) {
|
|
216
|
+
throw new Error(`${label}: no edge may exceed ${MAX_IMAGE_DIMENSION} pixels`);
|
|
217
|
+
}
|
|
218
|
+
if (width * height > MAX_IMAGE_PIXELS) {
|
|
219
|
+
throw new Error(`${label}: exceeds the ${MAX_IMAGE_PIXELS} pixel limit`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function resolveFormat(value, label) {
|
|
223
|
+
if (value === undefined || value === null)
|
|
224
|
+
return "png";
|
|
225
|
+
const name = String(value).toLowerCase();
|
|
226
|
+
const normalized = name === "jpg" ? "jpeg" : name;
|
|
227
|
+
if (!IMAGE_FORMATS.includes(normalized)) {
|
|
228
|
+
throw new Error(`${label}: format must be one of ${IMAGE_FORMATS.join(", ")}`);
|
|
229
|
+
}
|
|
230
|
+
return normalized;
|
|
231
|
+
}
|
|
232
|
+
function resolveQuality(value) {
|
|
233
|
+
const q = Number(value ?? DEFAULT_IMAGE_QUALITY);
|
|
234
|
+
if (!Number.isFinite(q))
|
|
235
|
+
return DEFAULT_IMAGE_QUALITY;
|
|
236
|
+
return Math.min(Math.max(q, 0), 1);
|
|
237
|
+
}
|
|
238
|
+
function encodeOptions(options, label, fallbackFormat = "png") {
|
|
239
|
+
const opts = options ?? {};
|
|
240
|
+
return {
|
|
241
|
+
format: opts.format === undefined
|
|
242
|
+
? fallbackFormat
|
|
243
|
+
: resolveFormat(opts.format, label),
|
|
244
|
+
quality: resolveQuality(opts.quality)
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/** Magic-number sniff — the encoder that produced the bytes, before decoding. */
|
|
248
|
+
export function sniffImageFormat(bytes) {
|
|
249
|
+
const at = (i) => bytes[i] ?? -1;
|
|
250
|
+
if (at(0) === 0x89 && at(1) === 0x50 && at(2) === 0x4e && at(3) === 0x47) {
|
|
251
|
+
return "png";
|
|
252
|
+
}
|
|
253
|
+
if (at(0) === 0xff && at(1) === 0xd8 && at(2) === 0xff)
|
|
254
|
+
return "jpeg";
|
|
255
|
+
if (at(0) === 0x47 && at(1) === 0x49 && at(2) === 0x46)
|
|
256
|
+
return "gif";
|
|
257
|
+
if (at(0) === 0x42 && at(1) === 0x4d)
|
|
258
|
+
return "bmp";
|
|
259
|
+
const tag = (offset, text) => [...text].every((ch, i) => at(offset + i) === ch.charCodeAt(0));
|
|
260
|
+
if (tag(0, "RIFF") && tag(8, "WEBP"))
|
|
261
|
+
return "webp";
|
|
262
|
+
if (tag(4, "ftyp")) {
|
|
263
|
+
if (tag(8, "avif") || tag(8, "avis"))
|
|
264
|
+
return "avif";
|
|
265
|
+
if (tag(8, "heic") || tag(8, "heix") || tag(8, "mif1"))
|
|
266
|
+
return "heic";
|
|
267
|
+
}
|
|
268
|
+
if (tag(0, "<svg") || tag(0, "<?xml"))
|
|
269
|
+
return "svg";
|
|
270
|
+
return "unknown";
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* An image's pixel size from its header alone.
|
|
274
|
+
*
|
|
275
|
+
* Decoding to ask how big something is costs a full rasterization and, for the
|
|
276
|
+
* formats the backend does not build with, fails outright — so this reads the
|
|
277
|
+
* four formats whose dimensions sit in a fixed place near the front. An
|
|
278
|
+
* unrecognized format is null: a caller wanting a shape has to cope with not
|
|
279
|
+
* knowing it, and a wrong guess is worse than none.
|
|
280
|
+
*/
|
|
281
|
+
export function imagePixelSize(bytes) {
|
|
282
|
+
const at = (i) => bytes[i] ?? 0;
|
|
283
|
+
const be16 = (i) => (at(i) << 8) | at(i + 1);
|
|
284
|
+
const be32 = (i) => at(i) * 0x1000000 + (at(i + 1) << 16) + (at(i + 2) << 8) + at(i + 3);
|
|
285
|
+
const le16 = (i) => at(i) | (at(i + 1) << 8);
|
|
286
|
+
const format = sniffImageFormat(bytes);
|
|
287
|
+
if (format === "png" && bytes.length >= 24) {
|
|
288
|
+
return { width: be32(16), height: be32(20) };
|
|
289
|
+
}
|
|
290
|
+
if (format === "gif" && bytes.length >= 10) {
|
|
291
|
+
return { width: le16(6), height: le16(8) };
|
|
292
|
+
}
|
|
293
|
+
if (format === "jpeg") {
|
|
294
|
+
// Walk the segment chain to the frame header; SOF0..SOF15 carry the size,
|
|
295
|
+
// minus the four that are not frames (DHT, JPG, DAC, and the restarts).
|
|
296
|
+
let offset = 2;
|
|
297
|
+
while (offset + 9 < bytes.length) {
|
|
298
|
+
if (at(offset) !== 0xff) {
|
|
299
|
+
offset += 1;
|
|
300
|
+
continue;
|
|
301
|
+
}
|
|
302
|
+
const marker = at(offset + 1);
|
|
303
|
+
const size = be16(offset + 2);
|
|
304
|
+
if (size < 2)
|
|
305
|
+
return null;
|
|
306
|
+
const isFrame = marker >= 0xc0 &&
|
|
307
|
+
marker <= 0xcf &&
|
|
308
|
+
marker !== 0xc4 &&
|
|
309
|
+
marker !== 0xc8 &&
|
|
310
|
+
marker !== 0xcc;
|
|
311
|
+
if (isFrame) {
|
|
312
|
+
return { height: be16(offset + 5), width: be16(offset + 7) };
|
|
313
|
+
}
|
|
314
|
+
offset += 2 + size;
|
|
315
|
+
}
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
if (format === "webp" && bytes.length >= 30) {
|
|
319
|
+
// VP8X carries a 24-bit canvas size; lossy (VP8 ) and lossless (VP8L)
|
|
320
|
+
// each spell it differently.
|
|
321
|
+
const chunk = String.fromCharCode(at(12), at(13), at(14), at(15));
|
|
322
|
+
if (chunk === "VP8X") {
|
|
323
|
+
const dim = (i) => (at(i) | (at(i + 1) << 8) | (at(i + 2) << 16)) + 1;
|
|
324
|
+
return { width: dim(24), height: dim(27) };
|
|
325
|
+
}
|
|
326
|
+
if (chunk === "VP8 ") {
|
|
327
|
+
return { width: le16(26) & 0x3fff, height: le16(28) & 0x3fff };
|
|
328
|
+
}
|
|
329
|
+
if (chunk === "VP8L") {
|
|
330
|
+
const bits = at(21) | (at(22) << 8) | (at(23) << 16) | (at(24) << 24);
|
|
331
|
+
return {
|
|
332
|
+
width: (bits & 0x3fff) + 1,
|
|
333
|
+
height: ((bits >> 14) & 0x3fff) + 1
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Structural check before the native decoder sees the bytes./**
|
|
341
|
+
* Structural check before the native decoder sees the bytes.
|
|
342
|
+
*
|
|
343
|
+
* `@napi-rs/canvas` does not merely fail on a truncated image — on linux-x64 it
|
|
344
|
+
* **segfaults the process**, and on other builds it reports "Invalid SVG image"
|
|
345
|
+
* for bytes whose own magic number says PNG, which sends the reader hunting for
|
|
346
|
+
* an SVG that was never involved. Both are reachable from guest code with
|
|
347
|
+
* nothing but a short read, so the check belongs here rather than in whichever
|
|
348
|
+
* caller happened to produce a partial buffer.
|
|
349
|
+
*
|
|
350
|
+
* This is a terminator check, not a validation: it proves the byte stream ends
|
|
351
|
+
* where its container says it should. A corrupt middle still reaches the
|
|
352
|
+
* decoder, which is the decoder's job.
|
|
353
|
+
*/
|
|
354
|
+
function assertDecodable(bytes, label) {
|
|
355
|
+
const format = sniffImageFormat(bytes);
|
|
356
|
+
const fail = (why) => {
|
|
357
|
+
throw new Error(`${label}: the ${format} data is incomplete (${why}). ` +
|
|
358
|
+
`Got ${bytes.length} bytes — the source was likely truncated.`);
|
|
359
|
+
};
|
|
360
|
+
if (format === "png") {
|
|
361
|
+
// 8-byte signature + at least one chunk, ending in IEND.
|
|
362
|
+
if (bytes.length < 57)
|
|
363
|
+
fail("shorter than the smallest possible PNG");
|
|
364
|
+
const end = bytes.subarray(bytes.length - 8);
|
|
365
|
+
const iend = [0x49, 0x45, 0x4e, 0x44];
|
|
366
|
+
if (!iend.every((b, i) => end[i] === b))
|
|
367
|
+
fail("no IEND chunk at the end");
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (format === "jpeg") {
|
|
371
|
+
if (bytes.length < 4)
|
|
372
|
+
fail("shorter than the smallest possible JPEG");
|
|
373
|
+
const last = bytes.length - 1;
|
|
374
|
+
// EOI marker FFD9. Some encoders pad after it, so scan the tail.
|
|
375
|
+
let found = false;
|
|
376
|
+
for (let i = last; i >= Math.max(0, last - 32) && !found; i--) {
|
|
377
|
+
if (bytes[i - 1] === 0xff && bytes[i] === 0xd9)
|
|
378
|
+
found = true;
|
|
379
|
+
}
|
|
380
|
+
if (!found)
|
|
381
|
+
fail("no EOI marker at the end");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (format === "gif") {
|
|
385
|
+
if (bytes.length < 14)
|
|
386
|
+
fail("shorter than the smallest possible GIF");
|
|
387
|
+
if (bytes[bytes.length - 1] !== 0x3b)
|
|
388
|
+
fail("no trailer byte at the end");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
async function decodeImage(bytes, label) {
|
|
392
|
+
assertInputSize(bytes, label);
|
|
393
|
+
assertDecodable(bytes, label);
|
|
394
|
+
const backend = await getMediaBackend();
|
|
395
|
+
let image;
|
|
396
|
+
try {
|
|
397
|
+
image = await backend.decode(bytes);
|
|
398
|
+
}
|
|
399
|
+
catch (e) {
|
|
400
|
+
throw new Error(`${label}: could not decode the image (${sniffImageFormat(bytes)}) — ${e instanceof Error ? e.message : String(e)}`);
|
|
401
|
+
}
|
|
402
|
+
assertSurfaceSize(image.width, image.height, label);
|
|
403
|
+
return { backend, image };
|
|
404
|
+
}
|
|
405
|
+
/** Render `draw` onto a fresh surface and encode it. */
|
|
406
|
+
async function renderTo(backend, width, height, encode, background, draw) {
|
|
407
|
+
const surface = backend.createSurface(Math.round(width), Math.round(height));
|
|
408
|
+
const ctx = surface.ctx;
|
|
409
|
+
// JPEG has no alpha: without a ground, transparent pixels encode as black.
|
|
410
|
+
const ground = background ?? (encode.format === "jpeg" ? "#ffffff" : undefined);
|
|
411
|
+
if (ground) {
|
|
412
|
+
ctx.fillStyle = ground;
|
|
413
|
+
invoke(ctx, "fillRect", 0, 0, surface.width, surface.height);
|
|
414
|
+
}
|
|
415
|
+
draw(ctx);
|
|
416
|
+
return backend.encode(surface, encode.format, encode.quality);
|
|
417
|
+
}
|
|
418
|
+
function resolveFit(value, label) {
|
|
419
|
+
if (value === undefined || value === null)
|
|
420
|
+
return "contain";
|
|
421
|
+
const fit = String(value);
|
|
422
|
+
if (fit !== "cover" && fit !== "contain" && fit !== "fill") {
|
|
423
|
+
throw new Error(`${label}: fit must be cover, contain or fill`);
|
|
424
|
+
}
|
|
425
|
+
return fit;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Source rectangle and destination rectangle for a fit-constrained draw.
|
|
429
|
+
* `cover` crops the source, `contain` letterboxes into the destination,
|
|
430
|
+
* `fill` stretches.
|
|
431
|
+
*/
|
|
432
|
+
function fitRects(sw, sh, dw, dh, fit) {
|
|
433
|
+
if (fit === "fill")
|
|
434
|
+
return [0, 0, sw, sh, 0, 0, dw, dh];
|
|
435
|
+
if (fit === "cover") {
|
|
436
|
+
const scale = Math.max(dw / sw, dh / sh);
|
|
437
|
+
const cw = Math.min(sw, dw / scale);
|
|
438
|
+
const ch = Math.min(sh, dh / scale);
|
|
439
|
+
return [(sw - cw) / 2, (sh - ch) / 2, cw, ch, 0, 0, dw, dh];
|
|
440
|
+
}
|
|
441
|
+
const scale = Math.min(dw / sw, dh / sh);
|
|
442
|
+
const w = sw * scale;
|
|
443
|
+
const h = sh * scale;
|
|
444
|
+
return [0, 0, sw, sh, (dw - w) / 2, (dh - h) / 2, w, h];
|
|
445
|
+
}
|
|
446
|
+
const FILTER_BUILDERS = {
|
|
447
|
+
brightness: (v) => `brightness(${v})`,
|
|
448
|
+
contrast: (v) => `contrast(${v})`,
|
|
449
|
+
saturate: (v) => `saturate(${v})`,
|
|
450
|
+
grayscale: (v) => `grayscale(${v})`,
|
|
451
|
+
sepia: (v) => `sepia(${v})`,
|
|
452
|
+
invert: (v) => `invert(${v})`,
|
|
453
|
+
blur: (v) => `blur(${v}px)`,
|
|
454
|
+
hueRotate: (v) => `hue-rotate(${v}deg)`,
|
|
455
|
+
opacity: (v) => `opacity(${v})`
|
|
456
|
+
};
|
|
457
|
+
function buildFilter(options) {
|
|
458
|
+
const parts = [];
|
|
459
|
+
for (const [key, build] of Object.entries(FILTER_BUILDERS)) {
|
|
460
|
+
const raw = options[key];
|
|
461
|
+
if (raw === undefined || raw === null)
|
|
462
|
+
continue;
|
|
463
|
+
const value = Number(raw);
|
|
464
|
+
if (!Number.isFinite(value)) {
|
|
465
|
+
throw new Error(`image.adjust: ${key} must be a number`);
|
|
466
|
+
}
|
|
467
|
+
parts.push(build(value));
|
|
468
|
+
}
|
|
469
|
+
return parts.join(" ");
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* The `image` namespace. Every member takes and returns encoded image bytes,
|
|
473
|
+
* so results chain (`resize` → `adjust` → `convert`) without the guest ever
|
|
474
|
+
* holding a decoded surface.
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* Encode raw RGBA pixels — host-side only, deliberately not on the guest
|
|
478
|
+
* bridge.
|
|
479
|
+
*
|
|
480
|
+
* This is what `image.encode` used to expose. The capability is fine; offering
|
|
481
|
+
* it to the *guest* was not, because the pixels had to be built in the guest
|
|
482
|
+
* heap and shipped across the boundary, and every observed use was a backdrop:
|
|
483
|
+
* `width*height*4` zeroed bytes moved to produce a few kilobytes of PNG. The
|
|
484
|
+
* guest now asks for `image.blank` instead. Host code (fixtures, backends,
|
|
485
|
+
* anything already holding pixels) keeps the direct path.
|
|
486
|
+
*/
|
|
487
|
+
export async function encodePixels(pixels, width, height, options) {
|
|
488
|
+
assertSurfaceSize(width, height, "encodePixels");
|
|
489
|
+
if (pixels.length !== width * height * 4) {
|
|
490
|
+
throw new Error(`encodePixels: expected ${width * height * 4} RGBA bytes, got ${pixels.length}`);
|
|
491
|
+
}
|
|
492
|
+
const encode = encodeOptions(options, "encodePixels");
|
|
493
|
+
const backend = await getMediaBackend();
|
|
494
|
+
const image = await backend.fromPixels(pixels, width, height);
|
|
495
|
+
return renderTo(backend, width, height, encode, options?.background, (ctx) => ctx.drawImage(image.handle, 0, 0));
|
|
496
|
+
}
|
|
497
|
+
export function createImageBridge() {
|
|
498
|
+
return {
|
|
499
|
+
async info(bytes) {
|
|
500
|
+
const input = asImageBytes(bytes, "image.info: bytes");
|
|
501
|
+
const { image } = await decodeImage(input, "image.info");
|
|
502
|
+
return {
|
|
503
|
+
width: image.width,
|
|
504
|
+
height: image.height,
|
|
505
|
+
format: sniffImageFormat(input),
|
|
506
|
+
byteLength: input.length
|
|
507
|
+
};
|
|
508
|
+
},
|
|
509
|
+
async decode(bytes) {
|
|
510
|
+
const input = asImageBytes(bytes, "image.decode: bytes");
|
|
511
|
+
const { backend, image } = await decodeImage(input, "image.decode");
|
|
512
|
+
if (image.width * image.height > MAX_DECODE_PIXELS) {
|
|
513
|
+
throw new Error(`image.decode: ${image.width}x${image.height} exceeds the ` +
|
|
514
|
+
`${MAX_DECODE_PIXELS} pixel limit — resize first, or work on ` +
|
|
515
|
+
"encoded bytes");
|
|
516
|
+
}
|
|
517
|
+
const surface = backend.createSurface(image.width, image.height);
|
|
518
|
+
surface.ctx.drawImage(image.handle, 0, 0);
|
|
519
|
+
const data = surface.ctx.getImageData(0, 0, image.width, image.height);
|
|
520
|
+
return {
|
|
521
|
+
width: image.width,
|
|
522
|
+
height: image.height,
|
|
523
|
+
pixels: Uint8Array.from(data.data)
|
|
524
|
+
};
|
|
525
|
+
},
|
|
526
|
+
/**
|
|
527
|
+
* Per-channel summary, computed host-side.
|
|
528
|
+
*
|
|
529
|
+
* Handles mean the guest no longer holds an image, which would leave it
|
|
530
|
+
* unable to answer anything about one without `decode` pulling every pixel
|
|
531
|
+
* across — reintroducing the cost handles removed. This answers the
|
|
532
|
+
* questions a body actually asks (is it dark? is it flat? is it
|
|
533
|
+
* transparent?) in a few dozen bytes.
|
|
534
|
+
*/
|
|
535
|
+
async stats(bytes) {
|
|
536
|
+
const input = asImageBytes(bytes, "image.stats: bytes");
|
|
537
|
+
// No MAX_DECODE_PIXELS check: that bound exists because `decode` ships
|
|
538
|
+
// every pixel to the guest. This reads them host-side and answers in a
|
|
539
|
+
// hundred bytes, so the surface-size guard `decodeImage` already applies
|
|
540
|
+
// is the only limit it needs.
|
|
541
|
+
const { backend, image } = await decodeImage(input, "image.stats");
|
|
542
|
+
const surface = backend.createSurface(image.width, image.height);
|
|
543
|
+
surface.ctx.drawImage(image.handle, 0, 0);
|
|
544
|
+
const data = surface.ctx.getImageData(0, 0, image.width, image.height);
|
|
545
|
+
const px = data.data;
|
|
546
|
+
const count = image.width * image.height;
|
|
547
|
+
const sum = [0, 0, 0, 0];
|
|
548
|
+
const min = [255, 255, 255, 255];
|
|
549
|
+
const max = [0, 0, 0, 0];
|
|
550
|
+
let luminance = 0;
|
|
551
|
+
for (let i = 0; i < count; i++) {
|
|
552
|
+
for (let c = 0; c < 4; c++) {
|
|
553
|
+
const v = px[i * 4 + c];
|
|
554
|
+
sum[c] += v;
|
|
555
|
+
if (v < min[c])
|
|
556
|
+
min[c] = v;
|
|
557
|
+
if (v > max[c])
|
|
558
|
+
max[c] = v;
|
|
559
|
+
}
|
|
560
|
+
// Rec. 601 luma, the same weighting `adjust`'s grayscale uses.
|
|
561
|
+
luminance += 0.299 * px[i * 4] + 0.587 * px[i * 4 + 1] + 0.114 * px[i * 4 + 2];
|
|
562
|
+
}
|
|
563
|
+
const channel = (c) => ({
|
|
564
|
+
mean: sum[c] / count,
|
|
565
|
+
min: min[c],
|
|
566
|
+
max: max[c]
|
|
567
|
+
});
|
|
568
|
+
return {
|
|
569
|
+
width: image.width,
|
|
570
|
+
height: image.height,
|
|
571
|
+
pixels: count,
|
|
572
|
+
luminance: luminance / count,
|
|
573
|
+
opaque: min[3] === 255,
|
|
574
|
+
channels: {
|
|
575
|
+
r: channel(0),
|
|
576
|
+
g: channel(1),
|
|
577
|
+
b: channel(2),
|
|
578
|
+
a: channel(3)
|
|
579
|
+
}
|
|
580
|
+
};
|
|
581
|
+
},
|
|
582
|
+
/**
|
|
583
|
+
* A new surface, made host-side.
|
|
584
|
+
*
|
|
585
|
+
* This replaces `encode`, whose only observed use was allocating
|
|
586
|
+
* `width*height*4` zeroed bytes in the guest to get a backdrop — 6 MB
|
|
587
|
+
* shipped across the boundary to produce a 6 KB PNG, and the single
|
|
588
|
+
* largest guest→host payload left in a normal image run.
|
|
589
|
+
*/
|
|
590
|
+
async blank(width, height, options) {
|
|
591
|
+
const w = Math.round(Number(width));
|
|
592
|
+
const h = Math.round(Number(height));
|
|
593
|
+
if (!Number.isFinite(w) || !Number.isFinite(h)) {
|
|
594
|
+
throw new Error("image.blank: width and height must be numbers");
|
|
595
|
+
}
|
|
596
|
+
assertSurfaceSize(w, h, "image.blank");
|
|
597
|
+
const encode = encodeOptions(options, "image.blank");
|
|
598
|
+
const backend = await getMediaBackend();
|
|
599
|
+
const color = options?.color;
|
|
600
|
+
return renderTo(backend, w, h, encode,
|
|
601
|
+
// `background` fills before the draw, which is exactly a solid fill.
|
|
602
|
+
color ?? options?.background, () => { });
|
|
603
|
+
},
|
|
604
|
+
/**
|
|
605
|
+
* Grow the canvas around an image without scaling it — the headroom a
|
|
606
|
+
* composite needs, and what `nodetool.image.CanvasResize` does in a graph.
|
|
607
|
+
* Building it by hand meant computing a bigger blank and compositing onto
|
|
608
|
+
* it, which is three calls and an easy place to get the offsets wrong.
|
|
609
|
+
*/
|
|
610
|
+
async pad(bytes, options) {
|
|
611
|
+
const opts = options ?? {};
|
|
612
|
+
const input = asImageBytes(bytes, "image.pad: bytes");
|
|
613
|
+
const { backend, image } = await decodeImage(input, "image.pad");
|
|
614
|
+
const all = Number(opts.all ?? 0);
|
|
615
|
+
const side = (name) => {
|
|
616
|
+
const v = Number(opts[name] ?? all);
|
|
617
|
+
if (!Number.isFinite(v) || v < 0) {
|
|
618
|
+
throw new Error(`image.pad: ${name} must be a non-negative number`);
|
|
619
|
+
}
|
|
620
|
+
return Math.round(v);
|
|
621
|
+
};
|
|
622
|
+
const top = side("top");
|
|
623
|
+
const right = side("right");
|
|
624
|
+
const bottom = side("bottom");
|
|
625
|
+
const left = side("left");
|
|
626
|
+
const width = image.width + left + right;
|
|
627
|
+
const height = image.height + top + bottom;
|
|
628
|
+
assertSurfaceSize(width, height, "image.pad");
|
|
629
|
+
const encode = encodeOptions(options, "image.pad");
|
|
630
|
+
return renderTo(backend, width, height, encode, opts.color ??
|
|
631
|
+
opts.background, (ctx) => ctx.drawImage(image.handle, left, top));
|
|
632
|
+
},
|
|
633
|
+
/**
|
|
634
|
+
* Lay images out in a grid — the shape a caller usually means by "combine
|
|
635
|
+
* these", and the replacement for the retired `lib.grid.CombineImageGrid`
|
|
636
|
+
* node. Expressing it with `composite` meant sizing a backdrop, computing
|
|
637
|
+
* every offset, and getting the row wrap right; the failure that started
|
|
638
|
+
* all of this was a two-image version of exactly that.
|
|
639
|
+
*/
|
|
640
|
+
async grid(images, options) {
|
|
641
|
+
const opts = options ?? {};
|
|
642
|
+
if (!Array.isArray(images) || images.length === 0) {
|
|
643
|
+
throw new Error("image.grid: pass a non-empty array of images");
|
|
644
|
+
}
|
|
645
|
+
if (images.length > MAX_COMPOSITE_LAYERS) {
|
|
646
|
+
throw new Error(`image.grid: at most ${MAX_COMPOSITE_LAYERS} images, got ${images.length}`);
|
|
647
|
+
}
|
|
648
|
+
const backend = await getMediaBackend();
|
|
649
|
+
const decoded = [];
|
|
650
|
+
for (let i = 0; i < images.length; i++) {
|
|
651
|
+
decoded.push((await decodeImage(asImageBytes(images[i], `image.grid: images[${i}]`), `image.grid: images[${i}]`)).image);
|
|
652
|
+
}
|
|
653
|
+
const gap = Math.max(0, Math.round(Number(opts.gap ?? 0)));
|
|
654
|
+
const columns = Math.max(1, Math.round(Number(opts.columns ?? decoded.length)));
|
|
655
|
+
const rows = Math.ceil(decoded.length / columns);
|
|
656
|
+
// Every cell is the largest input, so a grid stays aligned when the
|
|
657
|
+
// sources differ in size; each image is centred in its cell.
|
|
658
|
+
const cellWidth = Math.max(...decoded.map((d) => d.width));
|
|
659
|
+
const cellHeight = Math.max(...decoded.map((d) => d.height));
|
|
660
|
+
const width = columns * cellWidth + (columns - 1) * gap;
|
|
661
|
+
const height = rows * cellHeight + (rows - 1) * gap;
|
|
662
|
+
assertSurfaceSize(width, height, "image.grid");
|
|
663
|
+
const encode = encodeOptions(options, "image.grid");
|
|
664
|
+
return renderTo(backend, width, height, encode, opts.background ??
|
|
665
|
+
opts.color, (ctx) => {
|
|
666
|
+
decoded.forEach((d, i) => {
|
|
667
|
+
const col = i % columns;
|
|
668
|
+
const row = Math.floor(i / columns);
|
|
669
|
+
const x = col * (cellWidth + gap) + Math.round((cellWidth - d.width) / 2);
|
|
670
|
+
const y = row * (cellHeight + gap) + Math.round((cellHeight - d.height) / 2);
|
|
671
|
+
ctx.drawImage(d.handle, x, y);
|
|
672
|
+
});
|
|
673
|
+
});
|
|
674
|
+
},
|
|
675
|
+
async resize(bytes, options) {
|
|
676
|
+
const opts = options ?? {};
|
|
677
|
+
const input = asImageBytes(bytes, "image.resize: bytes");
|
|
678
|
+
const { backend, image } = await decodeImage(input, "image.resize");
|
|
679
|
+
const fit = resolveFit(opts.fit, "image.resize");
|
|
680
|
+
let width = opts.width === undefined ? NaN : Number(opts.width);
|
|
681
|
+
let height = opts.height === undefined ? NaN : Number(opts.height);
|
|
682
|
+
if (!Number.isFinite(width) && !Number.isFinite(height)) {
|
|
683
|
+
throw new Error("image.resize: pass width, height, or both");
|
|
684
|
+
}
|
|
685
|
+
// One dimension given keeps the aspect ratio; the fit modes only matter
|
|
686
|
+
// once the caller has pinned a box.
|
|
687
|
+
if (!Number.isFinite(width)) {
|
|
688
|
+
width = (image.width * height) / image.height;
|
|
689
|
+
}
|
|
690
|
+
if (!Number.isFinite(height)) {
|
|
691
|
+
height = (image.height * width) / image.width;
|
|
692
|
+
}
|
|
693
|
+
width = Math.max(1, Math.round(width));
|
|
694
|
+
height = Math.max(1, Math.round(height));
|
|
695
|
+
assertSurfaceSize(width, height, "image.resize");
|
|
696
|
+
const rect = fitRects(image.width, image.height, width, height, fit);
|
|
697
|
+
const encode = encodeOptions(options, "image.resize");
|
|
698
|
+
return renderTo(backend, width, height, encode, opts.background, (ctx) => ctx.drawImage(image.handle, ...rect));
|
|
699
|
+
},
|
|
700
|
+
async crop(bytes, options) {
|
|
701
|
+
const opts = options ?? {};
|
|
702
|
+
const input = asImageBytes(bytes, "image.crop: bytes");
|
|
703
|
+
const { backend, image } = await decodeImage(input, "image.crop");
|
|
704
|
+
const x = Math.round(Number(opts.x ?? 0));
|
|
705
|
+
const y = Math.round(Number(opts.y ?? 0));
|
|
706
|
+
const width = Math.round(Number(opts.width ?? image.width - x));
|
|
707
|
+
const height = Math.round(Number(opts.height ?? image.height - y));
|
|
708
|
+
if (![x, y, width, height].every(Number.isFinite)) {
|
|
709
|
+
throw new Error("image.crop: x, y, width and height must be numbers");
|
|
710
|
+
}
|
|
711
|
+
if (x < 0 ||
|
|
712
|
+
y < 0 ||
|
|
713
|
+
width < 1 ||
|
|
714
|
+
height < 1 ||
|
|
715
|
+
x + width > image.width ||
|
|
716
|
+
y + height > image.height) {
|
|
717
|
+
throw new Error(`image.crop: rectangle ${width}x${height}+${x}+${y} falls outside ` +
|
|
718
|
+
`the ${image.width}x${image.height} image`);
|
|
719
|
+
}
|
|
720
|
+
const encode = encodeOptions(options, "image.crop");
|
|
721
|
+
return renderTo(backend, width, height, encode, opts.background, (ctx) => ctx.drawImage(image.handle, x, y, width, height, 0, 0, width, height));
|
|
722
|
+
},
|
|
723
|
+
async rotate(bytes, degrees, options) {
|
|
724
|
+
const opts = options ?? {};
|
|
725
|
+
const input = asImageBytes(bytes, "image.rotate: bytes");
|
|
726
|
+
const angle = Number(degrees);
|
|
727
|
+
if (!Number.isFinite(angle)) {
|
|
728
|
+
throw new Error("image.rotate: degrees must be a number");
|
|
729
|
+
}
|
|
730
|
+
const { backend, image } = await decodeImage(input, "image.rotate");
|
|
731
|
+
const radians = (angle * Math.PI) / 180;
|
|
732
|
+
const cos = Math.abs(Math.cos(radians));
|
|
733
|
+
const sin = Math.abs(Math.sin(radians));
|
|
734
|
+
// The bounding box of the rotated rectangle, so nothing is clipped.
|
|
735
|
+
const width = Math.max(1, Math.round(image.width * cos + image.height * sin));
|
|
736
|
+
const height = Math.max(1, Math.round(image.width * sin + image.height * cos));
|
|
737
|
+
assertSurfaceSize(width, height, "image.rotate");
|
|
738
|
+
const encode = encodeOptions(options, "image.rotate");
|
|
739
|
+
return renderTo(backend, width, height, encode, opts.background, (ctx) => {
|
|
740
|
+
invoke(ctx, "translate", width / 2, height / 2);
|
|
741
|
+
invoke(ctx, "rotate", radians);
|
|
742
|
+
ctx.drawImage(image.handle, -image.width / 2, -image.height / 2);
|
|
743
|
+
});
|
|
744
|
+
},
|
|
745
|
+
async flip(bytes, options) {
|
|
746
|
+
const opts = options ?? {};
|
|
747
|
+
const input = asImageBytes(bytes, "image.flip: bytes");
|
|
748
|
+
const horizontal = opts.horizontal === undefined ? true : Boolean(opts.horizontal);
|
|
749
|
+
const vertical = Boolean(opts.vertical);
|
|
750
|
+
const { backend, image } = await decodeImage(input, "image.flip");
|
|
751
|
+
const encode = encodeOptions(options, "image.flip");
|
|
752
|
+
return renderTo(backend, image.width, image.height, encode, opts.background, (ctx) => {
|
|
753
|
+
invoke(ctx, "translate", horizontal ? image.width : 0, vertical ? image.height : 0);
|
|
754
|
+
invoke(ctx, "scale", horizontal ? -1 : 1, vertical ? -1 : 1);
|
|
755
|
+
ctx.drawImage(image.handle, 0, 0);
|
|
756
|
+
});
|
|
757
|
+
},
|
|
758
|
+
async adjust(bytes, options) {
|
|
759
|
+
const opts = options ?? {};
|
|
760
|
+
const input = asImageBytes(bytes, "image.adjust: bytes");
|
|
761
|
+
const filter = buildFilter(opts);
|
|
762
|
+
if (!filter) {
|
|
763
|
+
throw new Error(`image.adjust: name at least one of ${Object.keys(FILTER_BUILDERS).join(", ")}`);
|
|
764
|
+
}
|
|
765
|
+
const { backend, image } = await decodeImage(input, "image.adjust");
|
|
766
|
+
const encode = encodeOptions(options, "image.adjust");
|
|
767
|
+
return renderTo(backend, image.width, image.height, encode, opts.background, (ctx) => {
|
|
768
|
+
ctx.filter = filter;
|
|
769
|
+
ctx.drawImage(image.handle, 0, 0);
|
|
770
|
+
});
|
|
771
|
+
},
|
|
772
|
+
async composite(bytes, layers, options) {
|
|
773
|
+
const opts = options ?? {};
|
|
774
|
+
const input = asImageBytes(bytes, "image.composite: bytes");
|
|
775
|
+
if (!Array.isArray(layers)) {
|
|
776
|
+
throw new Error("image.composite: layers must be an array");
|
|
777
|
+
}
|
|
778
|
+
if (layers.length > MAX_COMPOSITE_LAYERS) {
|
|
779
|
+
throw new Error(`image.composite: at most ${MAX_COMPOSITE_LAYERS} layers per call`);
|
|
780
|
+
}
|
|
781
|
+
const { backend, image } = await decodeImage(input, "image.composite");
|
|
782
|
+
const drawn = [];
|
|
783
|
+
for (const [index, entry] of layers.entries()) {
|
|
784
|
+
const layer = (entry ?? {});
|
|
785
|
+
const label = `image.composite: layer ${index}`;
|
|
786
|
+
const layerBytes = asImageBytes(layer.image, `${label} image`);
|
|
787
|
+
const decoded = await decodeImage(layerBytes, label);
|
|
788
|
+
drawn.push({
|
|
789
|
+
image: decoded.image,
|
|
790
|
+
x: Number(layer.x ?? 0),
|
|
791
|
+
y: Number(layer.y ?? 0),
|
|
792
|
+
width: Number(layer.width ?? decoded.image.width),
|
|
793
|
+
height: Number(layer.height ?? decoded.image.height),
|
|
794
|
+
opacity: layer.opacity === undefined
|
|
795
|
+
? 1
|
|
796
|
+
: Math.min(Math.max(Number(layer.opacity), 0), 1),
|
|
797
|
+
blendMode: String(layer.blendMode ?? "source-over")
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
const encode = encodeOptions(options, "image.composite");
|
|
801
|
+
return renderTo(backend, image.width, image.height, encode, opts.background, (ctx) => {
|
|
802
|
+
ctx.drawImage(image.handle, 0, 0);
|
|
803
|
+
for (const layer of drawn) {
|
|
804
|
+
ctx.globalAlpha = layer.opacity;
|
|
805
|
+
ctx.globalCompositeOperation = layer.blendMode;
|
|
806
|
+
ctx.drawImage(layer.image.handle, layer.x, layer.y, layer.width, layer.height);
|
|
807
|
+
}
|
|
808
|
+
ctx.globalAlpha = 1;
|
|
809
|
+
ctx.globalCompositeOperation = "source-over";
|
|
810
|
+
});
|
|
811
|
+
},
|
|
812
|
+
async convert(bytes, options) {
|
|
813
|
+
const opts = options ?? {};
|
|
814
|
+
const input = asImageBytes(bytes, "image.convert: bytes");
|
|
815
|
+
const { backend, image } = await decodeImage(input, "image.convert");
|
|
816
|
+
const encode = encodeOptions(options, "image.convert");
|
|
817
|
+
return renderTo(backend, image.width, image.height, encode, opts.background, (ctx) => ctx.drawImage(image.handle, 0, 0));
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
/** The `image` namespace, built once — the members are pure closures. */
|
|
822
|
+
export const imageOps = createImageBridge();
|
|
823
|
+
// ---------------------------------------------------------------------------
|
|
824
|
+
// canvas.* bridge
|
|
825
|
+
// ---------------------------------------------------------------------------
|
|
826
|
+
const PROPERTY_SET = new Set(CANVAS_PROPERTIES);
|
|
827
|
+
const METHOD_SET = new Set(CANVAS_METHODS);
|
|
828
|
+
function buildGradients(ctx, specs) {
|
|
829
|
+
const out = new Map();
|
|
830
|
+
for (const [id, spec] of Object.entries(specs ?? {})) {
|
|
831
|
+
const coords = (spec.coords ?? []).map(Number);
|
|
832
|
+
let gradient;
|
|
833
|
+
if (spec.type === "linear") {
|
|
834
|
+
gradient = ctx.createLinearGradient(...coords);
|
|
835
|
+
}
|
|
836
|
+
else if (spec.type === "radial") {
|
|
837
|
+
gradient = ctx.createRadialGradient(...coords);
|
|
838
|
+
}
|
|
839
|
+
else if (spec.type === "conic" && ctx.createConicGradient) {
|
|
840
|
+
gradient = ctx.createConicGradient(...coords);
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
throw new Error(`canvas: gradient type "${spec.type}" is not available`);
|
|
844
|
+
}
|
|
845
|
+
for (const [offset, color] of spec.stops ?? []) {
|
|
846
|
+
gradient.addColorStop(Number(offset), String(color));
|
|
847
|
+
}
|
|
848
|
+
out.set(id, gradient);
|
|
849
|
+
}
|
|
850
|
+
return out;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Replay a recorded draw list and return the encoded image.
|
|
854
|
+
*
|
|
855
|
+
* Ops are validated against the allowlists above, and `drawImage`'s first
|
|
856
|
+
* argument is decoded here rather than in the guest — so the guest passes plain
|
|
857
|
+
* image bytes and never holds a drawable.
|
|
858
|
+
*/
|
|
859
|
+
export async function renderCanvas(spec) {
|
|
860
|
+
if (!isObjectLike(spec)) {
|
|
861
|
+
throw new Error("canvas.render: spec must be an object");
|
|
862
|
+
}
|
|
863
|
+
const width = Math.round(Number(spec.width));
|
|
864
|
+
const height = Math.round(Number(spec.height));
|
|
865
|
+
assertSurfaceSize(width, height, "canvas.render");
|
|
866
|
+
const ops = spec.ops ?? [];
|
|
867
|
+
if (!Array.isArray(ops)) {
|
|
868
|
+
throw new Error("canvas.render: ops must be an array");
|
|
869
|
+
}
|
|
870
|
+
if (ops.length > MAX_CANVAS_OPS) {
|
|
871
|
+
throw new Error(`canvas.render: ${ops.length} operations exceeds the ${MAX_CANVAS_OPS} limit`);
|
|
872
|
+
}
|
|
873
|
+
const backend = await getMediaBackend();
|
|
874
|
+
const encode = encodeOptions({ format: spec.format, quality: spec.quality }, "canvas.render");
|
|
875
|
+
// Decode every drawImage source up front: the replay itself is synchronous,
|
|
876
|
+
// so an await inside it would interleave with nothing and only complicate
|
|
877
|
+
// the transform stack's lifetime.
|
|
878
|
+
const decoded = new Map();
|
|
879
|
+
for (const [index, entry] of ops.entries()) {
|
|
880
|
+
if (entry?.op !== "drawImage")
|
|
881
|
+
continue;
|
|
882
|
+
const args = entry.args ?? [];
|
|
883
|
+
const bytes = asImageBytes(args[0], `canvas.render: op ${index} image`);
|
|
884
|
+
const { image } = await decodeImage(bytes, `canvas.render: op ${index}`);
|
|
885
|
+
decoded.set(index, image);
|
|
886
|
+
}
|
|
887
|
+
const surface = backend.createSurface(width, height);
|
|
888
|
+
const ctx = surface.ctx;
|
|
889
|
+
const gradients = buildGradients(ctx, spec.gradients);
|
|
890
|
+
const resolveStyle = (value) => {
|
|
891
|
+
if (isObjectLike(value)) {
|
|
892
|
+
const id = value[CANVAS_GRADIENT_MARKER];
|
|
893
|
+
if (isString(id)) {
|
|
894
|
+
const gradient = gradients.get(id);
|
|
895
|
+
if (!gradient) {
|
|
896
|
+
throw new Error("canvas.render: unknown gradient reference");
|
|
897
|
+
}
|
|
898
|
+
return gradient;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return value;
|
|
902
|
+
};
|
|
903
|
+
if (spec.background) {
|
|
904
|
+
ctx.fillStyle = String(spec.background);
|
|
905
|
+
invoke(ctx, "fillRect", 0, 0, width, height);
|
|
906
|
+
}
|
|
907
|
+
else if (encode.format === "jpeg") {
|
|
908
|
+
ctx.fillStyle = "#ffffff";
|
|
909
|
+
invoke(ctx, "fillRect", 0, 0, width, height);
|
|
910
|
+
}
|
|
911
|
+
for (const [index, entry] of ops.entries()) {
|
|
912
|
+
const name = entry?.op;
|
|
913
|
+
const args = (entry?.args ?? []);
|
|
914
|
+
if (name === "set") {
|
|
915
|
+
const [property, value] = args;
|
|
916
|
+
const key = String(property);
|
|
917
|
+
if (!PROPERTY_SET.has(key)) {
|
|
918
|
+
throw new Error(`canvas.render: op ${index} sets unknown property "${key}"`);
|
|
919
|
+
}
|
|
920
|
+
ctx[key] = resolveStyle(value);
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
if (name === "drawImage") {
|
|
924
|
+
const image = decoded.get(index);
|
|
925
|
+
if (!image) {
|
|
926
|
+
throw new Error(`canvas.render: op ${index} has no image`);
|
|
927
|
+
}
|
|
928
|
+
ctx.drawImage(image.handle, ...args.slice(1));
|
|
929
|
+
continue;
|
|
930
|
+
}
|
|
931
|
+
if (!METHOD_SET.has(String(name))) {
|
|
932
|
+
throw new Error(`canvas.render: op ${index} calls unknown method "${name}"`);
|
|
933
|
+
}
|
|
934
|
+
invoke(ctx, String(name), ...args);
|
|
935
|
+
}
|
|
936
|
+
return backend.encode(surface, encode.format, encode.quality);
|
|
937
|
+
}
|
|
938
|
+
/** Text metrics for a font, so the guest can lay text out before drawing it. */
|
|
939
|
+
export async function measureCanvasText(text, font) {
|
|
940
|
+
if (!isString(text)) {
|
|
941
|
+
throw new Error("canvas.measureText: text must be a string");
|
|
942
|
+
}
|
|
943
|
+
const backend = await getMediaBackend();
|
|
944
|
+
const surface = backend.createSurface(1, 1);
|
|
945
|
+
if (font !== undefined && font !== null) {
|
|
946
|
+
surface.ctx.font = String(font);
|
|
947
|
+
}
|
|
948
|
+
const metrics = surface.ctx.measureText(text);
|
|
949
|
+
const pick = (key) => {
|
|
950
|
+
const value = metrics[key];
|
|
951
|
+
return isFiniteNumber(value) ? value : 0;
|
|
952
|
+
};
|
|
953
|
+
return {
|
|
954
|
+
width: pick("width"),
|
|
955
|
+
actualBoundingBoxLeft: pick("actualBoundingBoxLeft"),
|
|
956
|
+
actualBoundingBoxRight: pick("actualBoundingBoxRight"),
|
|
957
|
+
actualBoundingBoxAscent: pick("actualBoundingBoxAscent"),
|
|
958
|
+
actualBoundingBoxDescent: pick("actualBoundingBoxDescent"),
|
|
959
|
+
fontBoundingBoxAscent: pick("fontBoundingBoxAscent"),
|
|
960
|
+
fontBoundingBoxDescent: pick("fontBoundingBoxDescent")
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
//# sourceMappingURL=sandbox-media.js.map
|