@imgly/codesign-mcp 0.7.2 → 0.7.3-next.20261125135902.gfdc6ee3
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 -17
- package/dist/cli/license.js +1 -1
- package/dist/runtime/cli/commands.d.ts +2 -0
- package/dist/runtime/cli/commands.d.ts.map +1 -1
- package/dist/runtime/cli/commands.js +56 -1
- package/dist/runtime/cli/commands.js.map +1 -1
- package/dist/runtime/cli/main.d.ts.map +1 -1
- package/dist/runtime/cli/main.js +5 -0
- package/dist/runtime/cli/main.js.map +1 -1
- package/dist/runtime/codesign-shim/codesign-router/protocol/types.mjs +1 -0
- package/dist/runtime/codesign-shim/codesign-router/release-build.generated.mjs +1 -1
- package/dist/server-client-types/protocol/types.d.ts +25 -3
- package/dist/server-client.mjs +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -2
- package/dist/server.js.map +1 -1
- package/node_modules/@imgly/codesign-billing/README.md +138 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.d.ts +30 -5
- package/node_modules/@imgly/codesign-billing/dist/charge.d.ts.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/charge.js +16 -1
- package/node_modules/@imgly/codesign-billing/dist/charge.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.d.ts +71 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.js +198 -0
- package/node_modules/@imgly/codesign-billing/dist/charges.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/index.d.ts +6 -0
- package/node_modules/@imgly/codesign-billing/dist/index.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/index.js +6 -0
- package/node_modules/@imgly/codesign-billing/dist/index.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts +55 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.js +80 -0
- package/node_modules/@imgly/codesign-billing/dist/ledger.js.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.d.ts +9 -1
- package/node_modules/@imgly/codesign-billing/dist/metering.d.ts.map +1 -0
- package/node_modules/@imgly/{codesign-sdk/dist/executor/billing → codesign-billing/dist}/metering.js +77 -21
- package/node_modules/@imgly/codesign-billing/dist/metering.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts +20 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.js +13 -0
- package/node_modules/@imgly/codesign-billing/dist/refusal.js.map +1 -0
- package/node_modules/@imgly/codesign-billing/package.json +30 -0
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts +13 -5
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.js +18 -12
- package/node_modules/@imgly/codesign-router/dist/config/unit-config.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/consent.d.ts +6 -2
- package/node_modules/@imgly/codesign-router/dist/consent.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/consent.js +65 -9
- package/node_modules/@imgly/codesign-router/dist/consent.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts +25 -3
- package/node_modules/@imgly/codesign-router/dist/protocol/types.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/protocol/types.js +1 -0
- package/node_modules/@imgly/codesign-router/dist/protocol/types.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.js +1 -1
- package/node_modules/@imgly/codesign-router/dist/release-build.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js +14 -4
- package/node_modules/@imgly/codesign-router/dist/router/channels-v2.js.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.js +9 -1
- package/node_modules/@imgly/codesign-router/dist/router/main.js.map +1 -1
- package/node_modules/@imgly/codesign-sdk/CHANGELOG.md +24 -0
- package/node_modules/@imgly/codesign-sdk/README.md +8 -7
- package/node_modules/@imgly/codesign-sdk/dist/abort.d.ts +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/abort.js +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/assets/inline.generated.js +12 -12
- package/node_modules/@imgly/codesign-sdk/dist/browser/index.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/browser/worker.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/browser/worker.js +15 -8
- package/node_modules/@imgly/codesign-sdk/dist/cesdk-utils/index.js +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/codesign-error.d.ts +38 -1
- package/node_modules/@imgly/codesign-sdk/dist/codesign-error.js +9 -0
- package/node_modules/@imgly/codesign-sdk/dist/codesign.d.ts +19 -12
- package/node_modules/@imgly/codesign-sdk/dist/codesign.js +268 -43
- package/node_modules/@imgly/codesign-sdk/dist/design/animatable.generated.js +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/capabilities.generated.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/facade.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/facade.js +128 -36
- package/node_modules/@imgly/codesign-sdk/dist/design/keyframes.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/lint.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/lint.js +82 -5
- package/node_modules/@imgly/codesign-sdk/dist/design/props.generated.js +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.d.ts +10 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/run-offsets.js +26 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.d.ts +23 -1
- package/node_modules/@imgly/codesign-sdk/dist/design/scene-lint.js +194 -3
- package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.d.ts +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/timeline-poses.js +53 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/variables.d.ts +14 -0
- package/node_modules/@imgly/codesign-sdk/dist/design/variables.js +250 -37
- package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.d.ts +50 -0
- package/node_modules/@imgly/codesign-sdk/dist/designs/s3-presigner.js +116 -0
- package/node_modules/@imgly/codesign-sdk/dist/designs/types.d.ts +79 -3
- package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.d.ts +12 -1
- package/node_modules/@imgly/codesign-sdk/dist/engine/audio-extract.js +20 -4
- package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.d.ts +20 -7
- package/node_modules/@imgly/codesign-sdk/dist/engine/engine-capacity.js +31 -14
- package/node_modules/@imgly/codesign-sdk/dist/engine/headless.d.ts +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/engine/headless.js +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.d.ts +1 -14
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/check.js +2 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.d.ts +1 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/billing/metered.js +120 -91
- package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.d.ts +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/encode-watchdog.js +10 -4
- package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/executor/engine-protocol.js +13 -3
- package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.d.ts +6 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/executor-options.js +14 -7
- package/node_modules/@imgly/codesign-sdk/dist/executor/handler.d.ts +47 -2
- package/node_modules/@imgly/codesign-sdk/dist/executor/handler.js +519 -8
- package/node_modules/@imgly/codesign-sdk/dist/executor/node.d.ts +42 -6
- package/node_modules/@imgly/codesign-sdk/dist/executor/node.js +231 -9
- package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.d.ts +13 -0
- package/node_modules/@imgly/codesign-sdk/dist/exporters/fig.js +28 -0
- package/node_modules/@imgly/codesign-sdk/dist/exporters/html.d.ts +18 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/html.js +129 -15
- package/node_modules/@imgly/codesign-sdk/dist/exporters/index.d.ts +5 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/index.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/exporters/node.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/exporters/node.js +4 -3
- package/node_modules/@imgly/codesign-sdk/dist/exporters/psd.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/av-limit.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/design-sniff.js +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-registry.js +4 -2
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/import-warnings.js +31 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.d.ts +15 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/media-facts.js +26 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/mime.d.ts +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/mime.js +37 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.d.ts +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/refuse-media.js +46 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.d.ts +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-export.js +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/svg-import.js +25 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/formats/zip-entries.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.d.ts +10 -4
- package/node_modules/@imgly/codesign-sdk/dist/gateway/asset-generate.js +205 -79
- package/node_modules/@imgly/codesign-sdk/dist/gateway/client.d.ts +23 -2
- package/node_modules/@imgly/codesign-sdk/dist/gateway/client.js +40 -41
- package/node_modules/@imgly/codesign-sdk/dist/gateway/index.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/index.js +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/types.d.ts +18 -3
- package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/gateway/upload-origin.js +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/host/edit-code.js +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.d.ts +4 -2
- package/node_modules/@imgly/codesign-sdk/dist/host/preview-size.js +7 -4
- package/node_modules/@imgly/codesign-sdk/dist/host.d.ts +34 -5
- package/node_modules/@imgly/codesign-sdk/dist/host.js +6 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/fig.d.ts +4 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/fig.js +57 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/index.d.ts +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/importers/index.js +38 -25
- package/node_modules/@imgly/codesign-sdk/dist/importers/node.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/node.js +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.d.ts +20 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/pdf-fonts.js +76 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/shared.d.ts +14 -0
- package/node_modules/@imgly/codesign-sdk/dist/importers/shared.js +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/index.d.ts +5 -4
- package/node_modules/@imgly/codesign-sdk/dist/index.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/internal/index.d.ts +24 -17
- package/node_modules/@imgly/codesign-sdk/dist/internal/index.js +19 -10
- package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/edit-renders.js +73 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/engine-child.js +18 -2
- package/node_modules/@imgly/codesign-sdk/dist/node/engine-http.js +8 -2
- package/node_modules/@imgly/codesign-sdk/dist/node/index.d.ts +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/index.js +1 -0
- package/node_modules/@imgly/codesign-sdk/dist/node/media-probe.js +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/sdk-version.generated.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.d.ts +59 -13
- package/node_modules/@imgly/codesign-sdk/dist/session/engine-session.js +19 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.d.ts +1 -14
- package/node_modules/@imgly/codesign-sdk/dist/session/export-facts.js +15 -4
- package/node_modules/@imgly/codesign-sdk/dist/session/file-formats.d.ts +5 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/guarded-engine-session.js +18 -7
- package/node_modules/@imgly/codesign-sdk/dist/session/local-engine-session.js +247 -68
- package/node_modules/@imgly/codesign-sdk/dist/session/local-engine.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/multipart.js +10 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/pending-video.js +2 -3
- package/node_modules/@imgly/codesign-sdk/dist/session/read-resolved.js +93 -6
- package/node_modules/@imgly/codesign-sdk/dist/session/remote.d.ts +34 -10
- package/node_modules/@imgly/codesign-sdk/dist/session/remote.js +377 -87
- package/node_modules/@imgly/codesign-sdk/dist/session/render-id.js +11 -2
- package/node_modules/@imgly/codesign-sdk/dist/session/session.d.ts +67 -6
- package/node_modules/@imgly/codesign-sdk/dist/session/session.js +213 -32
- package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.d.ts +18 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/silent-audio.js +47 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/transfers.d.ts +85 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/transfers.js +80 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.d.ts +30 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-guard.js +187 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-source.d.ts +21 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/url-source.js +163 -0
- package/node_modules/@imgly/codesign-sdk/dist/session/wire.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/session/wire.js +2 -1
- package/node_modules/@imgly/codesign-sdk/dist/session-instructions.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/sessions/state.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/sessions/state.js +5 -1
- package/node_modules/@imgly/codesign-sdk/dist/signed-urls.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/signed-urls.js +30 -0
- package/node_modules/@imgly/codesign-sdk/dist/skill-tool.js +12 -12
- package/node_modules/@imgly/codesign-sdk/dist/sources/handshake.d.ts +2 -0
- package/node_modules/@imgly/codesign-sdk/dist/sources/mime.js +0 -1
- package/node_modules/@imgly/codesign-sdk/dist/sources/route.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/sources/route.js +17 -2
- package/node_modules/@imgly/codesign-sdk/dist/sources/search.js +9 -2
- package/node_modules/@imgly/codesign-sdk/dist/sources/types.d.ts +8 -1
- package/node_modules/@imgly/codesign-sdk/dist/testing/conformance.js +11 -6
- package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.d.ts +1 -1
- package/node_modules/@imgly/codesign-sdk/dist/testing/fake-engine.js +11 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/edit.js +11 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/errors.js +2 -2
- package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.d.ts +4 -4
- package/node_modules/@imgly/codesign-sdk/dist/tools/export-formats/table.js +8 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/export.d.ts +3 -1
- package/node_modules/@imgly/codesign-sdk/dist/tools/export.js +75 -12
- package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.d.ts +3 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/omit-defaults.js +7 -0
- package/node_modules/@imgly/codesign-sdk/dist/tools/preview.js +42 -19
- package/node_modules/@imgly/codesign-sdk/dist/tools/source-tools.js +11 -4
- package/node_modules/@imgly/codesign-sdk/package.json +18 -10
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/apps.mjs +5 -5
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/image-gateway.mjs +5 -5
- package/node_modules/@imgly/codesign-server/assets/ai-plugins/version.json +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.js +2 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/link.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/local-server.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts +59 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js +127 -23
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-add.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts +7 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js +65 -15
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/asset-search.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js +15 -5
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/checklist.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js +7 -6
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-description.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts +2 -2
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js +14 -4
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/export-formats/modules.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js +106 -22
- package/node_modules/@imgly/codesign-server/dist/catalog/tools/import.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/connectors.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/connectors.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/doctor/checks/mcp-servers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/cli/pack.js +24 -18
- package/node_modules/@imgly/codesign-server/dist/cli/pack.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/instructions.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/main.js +4 -3
- package/node_modules/@imgly/codesign-server/dist/conversation/main.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.js +13 -0
- package/node_modules/@imgly/codesign-server/dist/conversation/stage.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts +0 -6
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js +0 -58
- package/node_modules/@imgly/codesign-server/dist/credentials/credential-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js +84 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/keychain.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts +1 -3
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js +3 -23
- package/node_modules/@imgly/codesign-server/dist/credentials/token-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts +59 -8
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js +317 -40
- package/node_modules/@imgly/codesign-server/dist/design/design-library-tools.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engine.js +4 -9
- package/node_modules/@imgly/codesign-server/dist/design/engine.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts +5 -0
- package/node_modules/@imgly/codesign-server/dist/design/engines.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/engines.js +49 -0
- package/node_modules/@imgly/codesign-server/dist/design/engines.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/host.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/design/host.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/host.js +10 -6
- package/node_modules/@imgly/codesign-server/dist/design/host.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js +34 -5
- package/node_modules/@imgly/codesign-server/dist/design/lazy-executors.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts +42 -5
- package/node_modules/@imgly/codesign-server/dist/design/local-design.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-design.js +175 -38
- package/node_modules/@imgly/codesign-server/dist/design/local-design.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts +27 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.js +65 -7
- package/node_modules/@imgly/codesign-server/dist/design/local-tools.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/main.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/main.js +23 -10
- package/node_modules/@imgly/codesign-server/dist/design/main.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js +13 -0
- package/node_modules/@imgly/codesign-server/dist/design/node-exporters.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.js +16 -0
- package/node_modules/@imgly/codesign-server/dist/design/probe-media.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts +22 -3
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js +123 -32
- package/node_modules/@imgly/codesign-server/dist/design/remote-resources.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/save.d.ts +5 -0
- package/node_modules/@imgly/codesign-server/dist/design/save.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/save.js +9 -0
- package/node_modules/@imgly/codesign-server/dist/design/save.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts +33 -4
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js +121 -43
- package/node_modules/@imgly/codesign-server/dist/design/sessions/store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts +8 -0
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js +50 -61
- package/node_modules/@imgly/codesign-server/dist/design/workspace-files.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts +24 -2
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js +132 -17
- package/node_modules/@imgly/codesign-server/dist/design/workspace-library.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.js +19 -6
- package/node_modules/@imgly/codesign-server/dist/services/archives/create.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js +10 -7
- package/node_modules/@imgly/codesign-server/dist/services/archives/handlers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts +3 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js +5 -4
- package/node_modules/@imgly/codesign-server/dist/services/archives/pack.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts +56 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js +218 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed-pack.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js +33 -124
- package/node_modules/@imgly/codesign-server/dist/services/archives/seed.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.js +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/archives/template.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js +2 -1
- package/node_modules/@imgly/codesign-server/dist/services/auth/login-manager.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts +9 -5
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js +14 -19
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/status.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/diagnostics/tool.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js +4 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-image-source.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts +5 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js +67 -6
- package/node_modules/@imgly/codesign-server/dist/services/engine/workspace-source-module.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js +2 -2
- package/node_modules/@imgly/codesign-server/dist/services/flags/manifest.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts +3 -3
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js +3 -3
- package/node_modules/@imgly/codesign-server/dist/services/flags/release-flags.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts +15 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js +14 -0
- package/node_modules/@imgly/codesign-server/dist/services/gateway-bearer.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js +36 -0
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/error-policy.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts +2 -2
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js +3 -5
- package/node_modules/@imgly/codesign-server/dist/services/telemetry/usage-sink.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js +5 -4
- package/node_modules/@imgly/codesign-server/dist/services/viewer/ai-plugin-assets.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js +0 -64
- package/node_modules/@imgly/codesign-server/dist/services/viewer/spa-assets.generated.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts +4 -0
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js +4 -0
- package/node_modules/@imgly/codesign-server/dist/services/viewer/url-builder.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js +2 -24
- package/node_modules/@imgly/codesign-server/dist/services/viewer/workspace-source-route.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts +4 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js +15 -14
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-sidecars.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts +12 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js +42 -12
- package/node_modules/@imgly/codesign-server/dist/services/workspace/asset-store.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js +1 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/assets-handlers.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js +24 -2
- package/node_modules/@imgly/codesign-server/dist/services/workspace/image-listing.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts +47 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js +167 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout-keys.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js +2 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/layout.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts +32 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js +79 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-fs.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts +35 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js +185 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store-workspace.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts +74 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.d.ts.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js +82 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/object-store.js.map +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts +10 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js +1 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/types.js.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.d.ts.map +1 -1
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js +5 -0
- package/node_modules/@imgly/codesign-server/dist/services/workspace/write-atomic.js.map +1 -1
- package/node_modules/@imgly/codesign-server/package.json +13 -11
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts +2 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.d.ts.map +1 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js +5 -1
- package/node_modules/@imgly/design-lint/dist/rules/text-legibility.js.map +1 -1
- package/node_modules/@imgly/design-lint/package.json +2 -2
- package/node_modules/@imgly/figma-exporter/CHANGELOG.md +79 -0
- package/node_modules/@imgly/figma-exporter/LICENSE.md +137 -0
- package/node_modules/@imgly/figma-exporter/README.md +201 -0
- package/node_modules/@imgly/figma-exporter/THIRD_PARTY_NOTICES.md +475 -0
- package/node_modules/@imgly/figma-exporter/dist/index.cjs +1 -0
- package/node_modules/@imgly/figma-exporter/dist/index.d.cts +8833 -0
- package/node_modules/@imgly/figma-exporter/dist/index.d.ts +8833 -0
- package/node_modules/@imgly/figma-exporter/dist/index.js +1 -0
- package/node_modules/@imgly/figma-exporter/package.json +92 -0
- package/node_modules/@imgly/figma-importer/CHANGELOG.md +84 -0
- package/node_modules/@imgly/figma-importer/LICENSE.md +137 -0
- package/node_modules/@imgly/figma-importer/README.md +256 -0
- package/node_modules/@imgly/figma-importer/THIRD_PARTY_NOTICES.md +446 -0
- package/node_modules/@imgly/figma-importer/dist/index.cjs +2 -0
- package/node_modules/@imgly/figma-importer/dist/index.d.cts +12831 -0
- package/node_modules/@imgly/figma-importer/dist/index.d.ts +12831 -0
- package/node_modules/@imgly/figma-importer/dist/index.js +2 -0
- package/node_modules/@imgly/figma-importer/package.json +85 -0
- package/node_modules/@imgly/html-exporter/CHANGELOG.md +35 -0
- package/node_modules/@imgly/html-exporter/README.md +45 -4
- package/node_modules/@imgly/html-exporter/dist/index.cjs +610 -493
- package/node_modules/@imgly/html-exporter/dist/index.d.cts +235 -216
- package/node_modules/@imgly/html-exporter/dist/index.d.ts +235 -216
- package/node_modules/@imgly/html-exporter/dist/index.js +610 -493
- package/node_modules/@imgly/html-exporter/package.json +15 -10
- package/node_modules/@imgly/idml-exporter/CHANGELOG.md +10 -0
- package/node_modules/@imgly/idml-exporter/README.md +17 -18
- package/node_modules/@imgly/idml-exporter/dist/harfbuzz.browser.js +1 -1
- package/node_modules/@imgly/idml-exporter/dist/index.cjs +8 -11
- package/node_modules/@imgly/idml-exporter/dist/index.d.cts +14480 -10275
- package/node_modules/@imgly/idml-exporter/dist/index.d.ts +14480 -10275
- package/node_modules/@imgly/idml-exporter/dist/index.js +8 -10
- package/node_modules/@imgly/idml-exporter/dist/woff2.browser.js +14 -14
- package/node_modules/@imgly/idml-exporter/package.json +17 -12
- package/node_modules/@imgly/idml-importer/CHANGELOG.md +37 -0
- package/node_modules/@imgly/idml-importer/README.md +148 -17
- package/node_modules/@imgly/idml-importer/dist/index.cjs +6 -5
- package/node_modules/@imgly/idml-importer/dist/index.d.cts +1003 -632
- package/node_modules/@imgly/idml-importer/dist/index.d.ts +1003 -632
- package/node_modules/@imgly/idml-importer/dist/index.js +6 -5
- package/node_modules/@imgly/idml-importer/package.json +9 -9
- package/node_modules/@imgly/pdf-importer/CHANGELOG.md +59 -0
- package/node_modules/@imgly/pdf-importer/README.md +71 -7
- package/node_modules/@imgly/pdf-importer/dist/browser.d.ts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/browser.js +17 -15
- package/node_modules/@imgly/pdf-importer/dist/node.cjs +17 -16
- package/node_modules/@imgly/pdf-importer/dist/node.d.cts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/node.d.ts +940 -788
- package/node_modules/@imgly/pdf-importer/dist/node.js +17 -15
- package/node_modules/@imgly/pdf-importer/dist/pdf.worker.mjs +80265 -61990
- package/node_modules/@imgly/pdf-importer/package.json +13 -13
- package/node_modules/@imgly/psd-exporter/CHANGELOG.md +12 -0
- package/node_modules/@imgly/psd-exporter/README.md +50 -7
- package/node_modules/@imgly/psd-exporter/dist/index.cjs +5 -7
- package/node_modules/@imgly/psd-exporter/dist/index.d.cts +14332 -10063
- package/node_modules/@imgly/psd-exporter/dist/index.d.ts +14332 -10063
- package/node_modules/@imgly/psd-exporter/dist/index.js +5 -6
- package/node_modules/@imgly/psd-exporter/dist/wawoff2-LICENSE.txt +19 -0
- package/node_modules/@imgly/psd-exporter/dist/woff2.browser.js +19 -0
- package/node_modules/@imgly/psd-exporter/package.json +26 -9
- package/node_modules/@imgly/psd-importer/CHANGELOG.md +29 -1
- package/node_modules/@imgly/psd-importer/README.md +22 -30
- package/node_modules/@imgly/psd-importer/dist/index.cjs +11 -11
- package/node_modules/@imgly/psd-importer/dist/index.d.cts +10479 -12978
- package/node_modules/@imgly/psd-importer/dist/index.d.ts +10479 -12978
- package/node_modules/@imgly/psd-importer/dist/index.js +11 -11
- package/node_modules/@imgly/psd-importer/package.json +8 -11
- package/package.json +28 -17
- package/node_modules/@imgly/pdf-importer/dist/browser.d.cts +0 -941
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/design/main.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,sHAAsH;AACtH,6GAA6G;AAE7G,OAAO,EAAE,SAAS,EAAE,MAAM,8CAA8C,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,MAAM,EACN,aAAa,EACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EACL,cAAc,EAEf,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EACL,YAAY,EAEb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,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AAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// A design unit: `cdsn unit --kind design --id <id>`. It holds one design session (its engine in a child) and serves\n// the catalog to every channel the router opens on it, over the server protocol (role `unit`). Every channel works on\n// the same design, engine and undo history. It parks itself when no channel has been open for the idle time.\n\nimport { isUiEvent } from '@imgly/codesign-router/protocol/ui-events.js';\nimport { reportInstallOutcomes } from '../services/telemetry/runtime-events.js';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { randomUUID } from 'node:crypto';\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync\n} from 'node:fs';\nimport { join } from 'node:path';\n\nimport { SDK_VERSION } from '@imgly/codesign-sdk';\nimport type { HostTool } from '@imgly/codesign-sdk/internal';\nimport {\n readUnitConfig,\n type UnitConfig\n} from '@imgly/codesign-router/config/unit-config.js';\nimport type { CoreManifest } from '@imgly/codesign-router/install/install.js';\nimport { readUpdateState } from '@imgly/codesign-router/install/install.js';\nimport {\n runtimePaths,\n type RuntimePaths\n} from '@imgly/codesign-router/paths.js';\nimport { ProtocolError } from '@imgly/codesign-router/peer/ndjson.js';\nimport { Peer } from '@imgly/codesign-router/peer/peer.js';\nimport { listenUnix } from '@imgly/codesign-router/peer/transports/unix.js';\nimport type {\n AuthState,\n ChannelMethods,\n ClientIdentity,\n DesignChangedParams,\n RouterMethods,\n RouterToUnitEvents,\n ToolResult,\n ToolsCallParams,\n UnitEvents,\n UnitMethods,\n UnitRecord\n} from '@imgly/codesign-router/protocol/types.js';\nimport { writeLease } from '@imgly/codesign-router/units/leases.js';\n\nimport { createCatalog } from '../catalog/catalog.js';\nimport {\n catalogHandlers,\n type CatalogHandlers,\n type ChatGate\n} from '../catalog/link.js';\nimport { readRecord } from '../conversation/record.js';\nimport { resolveLicense } from '../services/engine/resolve-license.js';\nimport {\n packsBaseUrl,\n seeder,\n type Seeder\n} from '../services/archives/seed.js';\nimport {\n listExperiments,\n setExperiment\n} from '../services/flags/experiments.js';\nimport { installedCesdkVersion } from '../services/viewer/cesdk-cdn.js';\nimport { routerWarning } from '../services/diagnostics/status.js';\nimport { endUnit, removeFilesOnExit, removeUnitFiles } from './end.js';\nimport { designEngines } from './engines.js';\nimport { buildLocalHost, type LocalHostOptions } from './host.js';\nimport {\n packHandlers,\n type PackMethod\n} from '../services/archives/handlers.js';\nimport {\n styleHandlers,\n type StyleMethod\n} from '../services/styles/handlers.js';\nimport {\n libraryHandlers,\n type LibraryMethod\n} from '../services/workspace/library-handlers.js';\nimport {\n assetsHandlers,\n type AssetsMethod\n} from '../services/workspace/assets-handlers.js';\nimport {\n HarnessContext,\n harnessFields,\n harnessFromEnv\n} from '../services/telemetry/harness-context.js';\nimport { readFreshStart } from '../services/workspace/fresh-start.js';\nimport { workspaceImportHandlers } from '../services/workspace/import-workspace-handler.js';\nimport { sessionNotice } from './session-notice.js';\nimport {\n callerClient,\n channelCaller,\n type Caller\n} from '../services/telemetry/usage-sink.js';\nimport {\n HANDOVER_POLL_MS,\n idleFile,\n oldestIdleUnit,\n slotWanted\n} from './slot-handover.js';\n\ntype UnitPeer = Peer<\n UnitMethods,\n RouterMethods,\n RouterToUnitEvents,\n UnitEvents\n>;\n\nexport interface DesignUnitOptions {\n id: string;\n home: string;\n /** The runtime version this unit runs from. */\n runtime: string;\n /** The licence the build carries; the unit's config overrides it. */\n bundledLicense: string;\n usageFetch?: LocalHostOptions['usageFetch'];\n redirectConsole?: LocalHostOptions['redirectConsole'];\n /** Pins the open-source codecs when the bundled licence is in use, before the engine children's env is taken. */\n pinCodecs?: (env: NodeJS.ProcessEnv) => void;\n}\n\n/** The unit's config as the environment the host and the engine children read: its licence and gateway key win over the env's. */\nexport function unitEnv(\n config: UnitConfig,\n env: NodeJS.ProcessEnv\n): NodeJS.ProcessEnv {\n const out: NodeJS.ProcessEnv = {\n ...env,\n IMGLY_CODESIGN_HOME: config.home,\n CODESIGN_WORKSPACE: config.workspace.root,\n IMGLY_DISABLE_VIEWER: config.viewer.enabled ? 'off' : 'on',\n IMGLY_TELEMETRY: config.telemetry.usage ? 'on' : 'off',\n IMGLY_ERROR_REPORTING: config.telemetry.errors ? 'on' : 'off',\n IMGLY_MAX_ENGINES: String(config.engine.maxEngines),\n IMGLY_ENGINE_IDLE_TIMEOUT: String(Math.round(config.engine.idleMs / 1000))\n };\n // Set here, after freezeReleaseEnv ran at start, because a release build would drop an inherited one.\n delete out.IMGLY_TELEMETRY_DECIDED_BY;\n if (config.telemetry.usageDecidedBy === 'consent')\n out.IMGLY_TELEMETRY_DECIDED_BY = 'consent';\n if (config.licence !== undefined) out.CESDK_LICENSE = config.licence;\n if (config.engine.prefer !== 'auto')\n out.IMGLY_CESDK_ENGINE = config.engine.prefer;\n if (config.gateway?.baseURL !== undefined)\n out.IMGLY_GATEWAY_BASE_URL = config.gateway.baseURL;\n if (config.gateway?.apiKey !== undefined) {\n delete out.IMGLY_GATEWAY_API_KEY_FILE;\n out.IMGLY_GATEWAY_API_KEY = config.gateway.apiKey;\n }\n return out;\n}\n\n/** The engine pack and the assets pack a version runs on, by their directories under `engines/`; none for a build that was not installed. */\nexport function unitPacks(paths: RuntimePaths, version: string): string[] {\n let core: CoreManifest;\n try {\n core = JSON.parse(\n readFileSync(join(paths.version(version), 'manifest.json'), 'utf8')\n ) as CoreManifest;\n } catch {\n return [];\n }\n const wasm = readUpdateState(paths).engine?.kind === 'wasm';\n return [\n `${core.enginePack}-${wasm ? 'wasm' : core.platform}`,\n `assets-${core.enginePack}`\n ];\n}\n\nconst FOLDER_POLL_MS = 5_000;\n\n/** What a holder answers an `open` of the design it is on: the channel moved here, its client sees the live state; another session is named only while another channel is open. */\nconst joinedAnswer = (uri: string, others: boolean) => ({\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n uri,\n joined: true,\n note: others\n ? 'This design is open in another live session; this connection now works in that session, on its current state. preview it before you continue.'\n : 'Continuing the live session of this design, on its current state. preview it before you continue.'\n })\n }\n ]\n});\n\nexport async function runDesignUnit(opts: DesignUnitOptions): Promise<void> {\n // A stderr whose reader died (EPIPE) must not turn every log line into an uncaught exception.\n process.stderr.on('error', () => undefined);\n const home = runtimePaths(opts.home);\n const paths = home.session(opts.id);\n mkdirSync(paths.dir, { recursive: true, mode: 0o700 });\n const config = await readUnitConfig(home, opts.id);\n const env = unitEnv(config, process.env);\n Object.assign(process.env, env);\n opts.pinCodecs?.(process.env);\n const workspace = config.workspace.id;\n\n const releaseLease = writeLease(home, {\n role: 'unit',\n version: opts.runtime,\n packs: unitPacks(home, opts.runtime)\n });\n\n const record: UnitRecord = {\n id: opts.id,\n kind: 'design',\n runtime: opts.runtime,\n sdk: SDK_VERSION,\n cesdk: installedCesdkVersion(),\n pid: process.pid,\n startedAt: Date.now(),\n workspace,\n workspaceHold: true\n };\n const writeRecord = () => {\n const tmp = `${paths.json}.${process.pid}.tmp`;\n writeFileSync(tmp, JSON.stringify(record, null, 2));\n renameSync(tmp, paths.json);\n };\n\n const log = (line: string) => process.stderr.write(`design unit: ${line}\\n`);\n const license = resolveLicense(process.env, opts.bundledLicense);\n const engines =\n license === undefined\n ? undefined\n : designEngines({\n env: process.env,\n license,\n idleMs: config.engine.idleMs,\n log\n });\n const older = routerWarning(home.daemonJson, env);\n if (older !== null) log(older);\n\n const peers = new Set<UnitPeer>();\n const channels = new Map<\n string,\n {\n peer: UnitPeer;\n client: ClientIdentity;\n chatClientKind?: ClientIdentity['kind'];\n internal?: boolean;\n harness: HarnessContext;\n handlers: CatalogHandlers;\n }\n >();\n // R21: an MCP session's first result tells of 0.6's fresh start while it is pending.\n const firstResult = sessionNotice(\n async () => (await readFreshStart(config.workspace.root))?.notice\n );\n /** The channel whose call is running, its caller and harness as the call began: a design the call moves to is claimed for it. */\n const calling = new AsyncLocalStorage<{\n channel: string;\n caller: Caller;\n harness?: HarnessContext;\n }>();\n const callOn = <T>(\n channel: string,\n fn: () => T,\n c = channels.get(channel)\n ): T => {\n return calling.run(\n { channel, caller: channelCaller(c), harness: c?.harness },\n fn\n );\n };\n /** Answers by `once`, kept a minute after they settle for a call resent once its router died. */\n const answers = new Map<string, Promise<ToolResult>>();\n const ANSWER_KEPT_MS = 60_000;\n\n const claim = async (uri: string, channel: string) => {\n const peer = channels.get(channel)?.peer;\n if (peer === undefined) return { granted: true as const };\n return peer.request('design.claim', { workspace, uri, channel });\n };\n /** The last change it announced: a channel opened after it learns its revision from the answer. */\n let announced: { uri: string; revision: string } | undefined;\n const notifyChanged = (notice: DesignChangedParams) => {\n announced = { uri: notice.uri, revision: notice.revision };\n for (const peer of peers) peer.notify('design.changed', notice);\n };\n const release = (uri: string) => {\n for (const peer of peers)\n void peer\n .request('design.release', { workspace, uri })\n .catch(() => undefined);\n };\n\n /** The change notices of a gated edit's channel, held until the edit stays or is put back. */\n let held: { channel: string; notices: DesignChangedParams[] } | undefined;\n /** A change before the router said hello, sent once it has. */\n let unsentAuth: AuthState | undefined;\n // Triggered only once the host below is built: its callbacks read `local`.\n const seed: Seeder = seeder({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n baseUrl: packsBaseUrl(process.env),\n session: async (fresh) => local.auth?.session(fresh),\n previews: (ids) => local.previewDesigns(ids),\n onState: (state) => {\n for (const peer of peers) peer.notify('seed.changed', state);\n },\n log\n });\n const local = await buildLocalHost({\n onSignedIn: () => void seed.trigger(),\n packSeed: () => {\n const error = seed.lastError();\n return {\n state: seed.status().state,\n ...(error !== undefined ? { error } : {})\n };\n },\n bundledLicense: opts.bundledLicense,\n serverStartFields: (): Record<string, string> => {\n const missing = readUpdateState(home).engine?.missing;\n return missing !== undefined ? { missing } : {};\n },\n ...(opts.usageFetch !== undefined ? { usageFetch: opts.usageFetch } : {}),\n workspaceRoot: config.workspace.root,\n workspace: { id: workspace },\n unit: opts.id,\n ...(opts.redirectConsole !== undefined\n ? { redirectConsole: opts.redirectConsole }\n : {}),\n ...(engines !== undefined\n ? { executors: engines.executors, engineBreach: engines.lastBreach }\n : {}),\n claimDesign: async (uri) => {\n const [router] = peers;\n if (router === undefined) return false;\n const claimed = await router.request('design.claim', { workspace, uri });\n return 'granted' in claimed;\n },\n onAuthChanged: (state) => {\n unsentAuth = peers.size === 0 ? state : undefined;\n for (const peer of peers) peer.notify('auth.changed', state);\n },\n onDesignChanged: (uri) => {\n const left = record.design;\n if (uri === undefined) delete record.design;\n else record.design = uri;\n writeRecord();\n if (uri !== left) announced = undefined;\n if (left !== undefined && left !== uri) release(left);\n const channel = calling.getStore()?.channel;\n if (uri !== undefined && uri !== left && channel !== undefined)\n void claim(uri, channel).catch(() => undefined);\n },\n onDesignSaved: ({ uri, revision, tool }) => {\n const channel = calling.getStore()?.channel;\n const client =\n channel !== undefined ? channels.get(channel)?.client : undefined;\n const notice: DesignChangedParams = {\n workspace,\n uri,\n unit: record.id,\n revision,\n by: {\n ...(tool !== undefined ? { tool } : {}),\n ...(client !== undefined ? { client } : {})\n }\n };\n if (held !== undefined && held.channel === channel)\n held.notices.push(notice);\n else notifyChanged(notice);\n }\n });\n writeRecord();\n\n // `open` claims its design first: when another unit holds it the router moves the channel there and asks that unit.\n const tools: HostTool[] = local.tools.map((tool) => {\n return {\n ...tool,\n call: async (args, ctx) => {\n const channel = calling.getStore()?.channel;\n if (tool.name === 'open') {\n const uri = (args as { uri?: unknown } | undefined)?.uri;\n if (typeof uri === 'string' && uri === record.design)\n return joinedAnswer(\n uri,\n [...channels.keys()].some((id) => id !== channel)\n );\n if (typeof uri === 'string' && channel !== undefined) {\n const claimed = await claim(uri, channel);\n if ('heldBy' in claimed) return joinedAnswer(uri, true);\n }\n }\n return tool.call(args, ctx);\n }\n };\n });\n /**\n * A chat's channel on this unit while it holds no design: no unit held `uri`, the design the chat's active tab names\n * as the router asked the live chat (a turn on a tab not shown, a tab switched to mid-turn), so it is opened here,\n * before any call of the channel runs.\n */\n let opening: Promise<unknown> = Promise.resolve();\n const openChatDesign = (channel: string, uri: string) => {\n const open = tools.find((tool) => tool.name === 'open');\n if (open === undefined) return;\n opening = opening\n .then(() =>\n record.design === undefined\n ? callOn(channel, () => open.call({ uri }))\n : undefined\n )\n .then(\n (result) => {\n if (result?.isError === true)\n log(\n `open ${uri}: ${result.content.map((p) => (p.type === 'text' ? p.text : '')).join(' ')}`\n );\n },\n (err: unknown) =>\n log(\n `open ${uri}: ${err instanceof Error ? err.message : String(err)}`\n )\n );\n };\n const catalog = createCatalog({\n assets: local.assets,\n tools,\n telemetry: local.telemetry,\n onToolCallMeta: local.onToolCallMeta,\n ...(local.onServedDocs ? { onServedDocs: local.onServedDocs } : {})\n });\n local.setCaller(() => calling.getStore()?.caller);\n if (local.usageEvents) void reportInstallOutcomes(home, local.usageEvents);\n local.setCallingClient(() => callerClient(calling.getStore()?.caller));\n /** The channel that opened last: error reports only, never usage telemetry. */\n let lastClient: ClientIdentity | undefined;\n local.setClientInfo(() =>\n lastClient?.name !== undefined\n ? { name: lastClient.name, version: lastClient.version ?? '' }\n : undefined\n );\n /** The newest channel's harness, for a report outside any call. */\n let lastHarness: HarnessContext | undefined;\n local.setHarness(() => {\n const call = calling.getStore();\n return call !== undefined ? call.harness : lastHarness;\n });\n\n let idleTimer: NodeJS.Timeout | undefined;\n let handover: NodeJS.Timeout | undefined;\n const idle = idleFile(home, opts.id);\n /** Calls running now: an engine with none is idle, and is given up to a unit that needs a slot. */\n let calls = 0;\n const folderRemoved = () => {\n log('the session folder was removed while the unit ran: ending');\n void end('session folder removed');\n };\n /** Writes the idle file; a session folder someone else removed ends the unit, as its record and socket went with it. */\n const markIdle = (): boolean => {\n try {\n if (!existsSync(idle)) writeFileSync(idle, '');\n return true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err;\n folderRemoved();\n return false;\n }\n };\n // A unit no client is on, never idle, sees no other event that would find its folder gone.\n const folderWatch = setInterval(() => {\n if (channels.size === 0 && calls === 0 && !existsSync(paths.dir))\n folderRemoved();\n }, FOLDER_POLL_MS).unref();\n const watchIdle = () => {\n if (ending) return;\n clearTimeout(idleTimer);\n clearInterval(handover);\n if (calls > 0 || !engines?.used()) rmSync(idle, { force: true });\n else {\n if (!markIdle()) return;\n // An engine child elsewhere waits for a slot: the unit whose engine was idle longest gives its own up, and\n // ends when no client is on it.\n handover = setInterval(() => {\n if (\n slotWanted(home.engineSlots, config.engine.maxEngines) &&\n oldestIdleUnit(home) === opts.id\n )\n void handOver();\n }, HANDOVER_POLL_MS);\n }\n if (channels.size > 0 || calls > 0 || config.engine.idleMs === 0) return;\n idleTimer = setTimeout(() => void end('idle'), config.engine.idleMs);\n };\n const handOver = async () => {\n clearInterval(handover);\n if (channels.size === 0) return end('handover');\n log('handing the idle engine to a design that needs one');\n // The idle file goes only once the engine has: a child waiting for its slot stops waiting when no unit is idle.\n await engines?.stop();\n watchIdle();\n };\n\n const removeFiles = (code: number) => {\n releaseLease();\n removeUnitFiles(home, opts.id, code);\n };\n let ending = false;\n const end = async (reason: string): Promise<void> => {\n if (ending) return;\n ending = true;\n clearTimeout(idleTimer);\n clearInterval(handover);\n clearInterval(folderWatch);\n await endUnit({\n shutdown: () =>\n local.shutdown(reason, async () => {\n server.close();\n channels.clear();\n for (const peer of peers) peer.close();\n }),\n stopEngines: () => engines?.stop(),\n removeFiles,\n exit: (code) => process.exit(code)\n });\n };\n\n const channelOf = (channel: string) => {\n const c = channels.get(channel);\n if (c === undefined)\n throw new ProtocolError('invalid_params', `no channel ${channel}`);\n return c;\n };\n const authOf = () => {\n if (local.auth === undefined)\n throw new ProtocolError(\n 'not_installed',\n 'sign-in is not configured in this build'\n );\n return local.auth;\n };\n\n /** The gate of a chat's channel: its client's can_edit, through the router; none when no client declared it. */\n const chatGate = (peer: UnitPeer, channel: string): ChatGate => ({\n canEdit: (params) =>\n peer\n .request('client.call', {\n channel,\n call: randomUUID(),\n name: 'can_edit',\n arguments: { ...params }\n })\n .catch((err: unknown) => {\n if (err instanceof ProtocolError && err.kind === 'invalid_params')\n return undefined;\n throw err;\n }),\n pages: () => local.pages(),\n keep: async () => {\n const restore = await local.keep();\n const hold = (held = { channel, notices: [] });\n const stop = () => {\n if (held === hold) held = undefined;\n return hold.notices;\n };\n return {\n release: () => stop().forEach(notifyChanged),\n restore: async () => {\n stop();\n await restore();\n }\n };\n }\n });\n\n type Forwarded = Exclude<keyof CatalogHandlers, 'tools.call'>;\n const forwarded: Forwarded[] = [\n 'tools.list',\n 'tools.cancel',\n 'instructions',\n 'skills.list',\n 'skills.read',\n 'prompts.list',\n 'prompts.get',\n 'prompts.complete'\n ];\n\n void seed.trigger();\n const server = await listenUnix(paths.sock, (transport) => {\n const peer: UnitPeer = new Peer(transport, {\n role: 'unit',\n remote: 'router'\n });\n peers.add(peer);\n peer.onClose(() => {\n peers.delete(peer);\n for (const [id, c] of channels)\n if (c.peer === peer) {\n channels.delete(id);\n firstResult.forget(id);\n }\n watchIdle();\n });\n peer.handle('hello', () => {\n const state = unsentAuth;\n unsentAuth = undefined;\n if (state !== undefined)\n setImmediate(() => peer.notify('auth.changed', state));\n return { protocol: peer.version ?? 2, unit: record, pid: process.pid };\n });\n peer.on('auth.changed', () => local.auth?.forget());\n peer.on('sources.changed', ({ workspace: changed }) => {\n if (changed === workspace) void local.reloadSources();\n });\n peer.on('seed.changed', (state) => seed.mirror(state));\n peer.handle('seed.status', ({ channel }) => {\n channelOf(channel);\n return seed.status();\n });\n peer.handle(\n 'channel.open',\n ({\n channel,\n client,\n conversation,\n design,\n chatClientKind,\n internal,\n harness,\n chatHarness\n }) => {\n if (channels.has(channel))\n throw new ProtocolError(\n 'invalid_params',\n `channel ${channel} is open`\n );\n lastClient = client;\n lastHarness = new HarnessContext(\n harness !== undefined\n ? harnessFields(harness)\n : harnessFromEnv(process.env),\n chatHarness !== undefined ? harnessFields(chatHarness) : {}\n );\n channels.set(channel, {\n peer,\n client,\n ...(chatClientKind !== undefined ? { chatClientKind } : {}),\n ...(internal === true ? { internal } : {}),\n harness: lastHarness,\n handlers: catalogHandlers(\n catalog,\n () => client,\n (p) => {\n peer.notify('progress', { channel, ...p });\n },\n conversation === undefined\n ? {}\n : {\n conversation,\n chatKind: readRecord(home, conversation)?.kind ?? 'design',\n gate: chatGate(peer, channel),\n workspaceRoot: config.workspace.root\n }\n )\n });\n watchIdle();\n if (design !== undefined && record.design === undefined)\n openChatDesign(channel, design);\n if (record.design === undefined) return {};\n return announced?.uri === record.design\n ? { design: record.design, revision: announced.revision }\n : { design: record.design };\n }\n );\n peer.handle('channel.close', ({ channel }) => {\n channels.delete(channel);\n firstResult.forget(channel);\n watchIdle();\n return {};\n });\n const runCall = async (\n channel: string,\n call: Omit<ToolsCallParams, 'channel' | 'once'>\n ) => {\n const c = channelOf(channel);\n calls += 1;\n watchIdle();\n try {\n await opening;\n const result = await callOn(\n channel,\n () => c.handlers['tools.call'](call),\n c\n );\n // R21: an MCP session's first result tells of 0.6's fresh start; a chat's holder says it to its person itself.\n if (!channels.has(channel)) return result;\n return await firstResult.withNotice(\n channel,\n c.chatClientKind === undefined ? c.client : undefined,\n call.name,\n result\n );\n } finally {\n calls -= 1;\n // The idle file's time is when the engine was last used: the least recently used gives its engine up first.\n if (calls === 0) rmSync(idle, { force: true });\n watchIdle();\n }\n };\n peer.handle('tools.call', ({ channel, once, ...call }) => {\n const answered = once !== undefined ? answers.get(once) : undefined;\n if (answered !== undefined) return answered;\n const answer = runCall(channel, call);\n if (once === undefined) return answer;\n answers.set(once, answer);\n const forget = () =>\n setTimeout(() => answers.delete(once), ANSWER_KEPT_MS).unref();\n answer.then(forget, forget);\n return answer;\n });\n for (const method of forwarded) {\n peer.handle(method, (params: { channel: string }) => {\n const handler = channelOf(params.channel).handlers[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>;\n return callOn(params.channel, () => handler(params));\n });\n }\n peer.handle('designs.list', async ({ channel }) => {\n const handlers = channelOf(channel).handlers;\n const result = await callOn(channel, () =>\n handlers['tools.call']({\n call: 'designs.list',\n name: 'designs',\n arguments: {}\n })\n );\n const rows = result.content.at(-1);\n const json = rows?.type === 'text' ? rows.text.split('\\n')[1] : undefined;\n return { designs: json !== undefined ? JSON.parse(json) : [] };\n });\n peer.handle('experiments.list', ({ channel }) => {\n channelOf(channel);\n return { experiments: listExperiments(opts.home).experiments };\n });\n peer.handle('experiments.set', ({ channel, id, state, value }) => {\n channelOf(channel);\n return {\n experiments: setExperiment(opts.home, id, state, undefined, value)\n };\n });\n const packs = packHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n sourcesChanged: (changed) => {\n for (const p of peers)\n p.notify('sources.changed', { workspace: changed });\n if (changed === workspace) void local.reloadSources();\n },\n ...(local.usageEvents !== undefined\n ? { usageEvents: local.usageEvents }\n : {})\n });\n for (const method of Object.keys(packs) as PackMethod[])\n peer.handle(method, async (params: { channel: string }) => {\n channelOf(params.channel);\n const result = await callOn(params.channel, () =>\n (\n packs[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params)\n );\n // A design from a template without a preview gets one rendered.\n if (\n method === 'designs.fromTemplate' &&\n [undefined, workspace].includes(\n (params as { workspace?: string }).workspace\n )\n )\n void local.sweepPreviews();\n return result;\n });\n const assets = assetsHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root }\n });\n for (const method of Object.keys(assets) as AssetsMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return assets[method](\n params as ChannelMethods[typeof method]['params']\n );\n });\n const library = libraryHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n store: local.store\n });\n for (const method of Object.keys(library) as LibraryMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return (\n library[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params);\n });\n const styles = styleHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root }\n });\n for (const method of Object.keys(styles) as StyleMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return (\n styles[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params);\n });\n const imports = workspaceImportHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n // This server serves the workspace: an old one is never set aside under its sessions.\n setAsideOld: false\n });\n peer.handle('workspace.import', async (params) => {\n channelOf(params.channel);\n const result = await imports['workspace.import'](params);\n const changed = params.workspace ?? workspace;\n // Imported designs without a preview get one rendered, as a design from a template does.\n if (result.designs > 0 && changed === workspace)\n void local.sweepPreviews();\n // Imported sources are new catalogues for every client.\n if (result.sources > 0) {\n for (const p of peers)\n p.notify('sources.changed', { workspace: changed });\n if (changed === workspace) void local.reloadSources();\n }\n return result;\n });\n peer.handle('auth.status', () => authOf().status());\n peer.handle('auth.login', async ({ switchAccount }) => ({\n url: await authOf().login({ switchAccount })\n }));\n peer.handle('auth.cancel', () => {\n authOf().cancel();\n return {};\n });\n peer.handle('auth.token', ({ fresh }) => authOf().token(fresh === true));\n peer.handle('auth.logout', async () => {\n await authOf().logout();\n return { signedIn: false };\n });\n peer.handle('ui.event', ({ channel, ...event }) => {\n channelOf(channel);\n // Never forwarded as it came: a name or a field outside the catalog, an envelope field included.\n if (!isUiEvent(event)) log('dropped a ui.event outside the catalog');\n else\n callOn(channel, () =>\n local.usageEvents?.recordEvent(event.name, event.fields)\n );\n return {};\n });\n peer.handle('design.save', async ({ channel, scene }) => {\n channelOf(channel);\n const saved = await callOn(channel, () =>\n local.takeSave(new TextEncoder().encode(scene))\n );\n return { uri: saved.uri, revision: saved.revision };\n });\n peer.handle('draft.save', async () => ({ saved: await local.keepDraft() }));\n peer.handle('park', () => {\n setImmediate(() => void end('park'));\n return {};\n });\n peer.handle('ping', () => ({}));\n });\n watchIdle();\n removeFilesOnExit(removeFiles);\n\n process.on('SIGINT', () => void end('SIGINT'));\n process.on('SIGTERM', () => void end('SIGTERM'));\n process.on('SIGHUP', () => void end('SIGHUP'));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["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,QAAQ,CAAC,CAAC,CAAC;AACjD,CAAC","sourcesContent":["// A design unit: `cdsn unit --kind design --id <id>`. It holds one design session (its engine in a child) and serves\n// the catalog to every channel the router opens on it, over the server protocol (role `unit`). Every channel works on\n// the same design, engine and undo history. It parks itself when no channel has been open for the idle time.\n\nimport { isUiEvent } from '@imgly/codesign-router/protocol/ui-events.js';\nimport { reportInstallOutcomes } from '../services/telemetry/runtime-events.js';\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { randomUUID } from 'node:crypto';\nimport {\n existsSync,\n mkdirSync,\n readFileSync,\n renameSync,\n rmSync,\n writeFileSync\n} from 'node:fs';\nimport { join } from 'node:path';\n\nimport { SDK_VERSION } from '@imgly/codesign-sdk';\nimport type { HostTool } from '@imgly/codesign-sdk/internal';\nimport {\n readUnitConfig,\n type UnitConfig\n} from '@imgly/codesign-router/config/unit-config.js';\nimport type { CoreManifest } from '@imgly/codesign-router/install/install.js';\nimport { readUpdateState } from '@imgly/codesign-router/install/install.js';\nimport {\n runtimePaths,\n type RuntimePaths\n} from '@imgly/codesign-router/paths.js';\nimport { ProtocolError } from '@imgly/codesign-router/peer/ndjson.js';\nimport { Peer } from '@imgly/codesign-router/peer/peer.js';\nimport { listenUnix } from '@imgly/codesign-router/peer/transports/unix.js';\nimport type {\n AuthState,\n ChannelMethods,\n ClientIdentity,\n DesignChangedParams,\n RouterMethods,\n RouterToUnitEvents,\n ToolResult,\n ToolsCallParams,\n UnitEvents,\n UnitMethods,\n UnitRecord\n} from '@imgly/codesign-router/protocol/types.js';\nimport { writeLease } from '@imgly/codesign-router/units/leases.js';\n\nimport { createCatalog } from '../catalog/catalog.js';\nimport {\n catalogHandlers,\n type CatalogHandlers,\n type ChatGate\n} from '../catalog/link.js';\nimport { readRecord } from '../conversation/record.js';\nimport { resolveLicense } from '../services/engine/resolve-license.js';\nimport {\n packsBaseUrl,\n seeder,\n type Seeder\n} from '../services/archives/seed.js';\nimport {\n listExperiments,\n setExperiment\n} from '../services/flags/experiments.js';\nimport { installedCesdkVersion } from '../services/viewer/cesdk-cdn.js';\nimport { routerWarning } from '../services/diagnostics/status.js';\nimport { endUnit, removeFilesOnExit, removeUnitFiles } from './end.js';\nimport { everyDesign } from './design-library-tools.js';\nimport { designEngines } from './engines.js';\nimport { buildLocalHost, type LocalHostOptions } from './host.js';\nimport {\n packHandlers,\n type PackMethod\n} from '../services/archives/handlers.js';\nimport {\n styleHandlers,\n type StyleMethod\n} from '../services/styles/handlers.js';\nimport {\n libraryHandlers,\n type LibraryMethod\n} from '../services/workspace/library-handlers.js';\nimport {\n assetsHandlers,\n type AssetsMethod\n} from '../services/workspace/assets-handlers.js';\nimport {\n HarnessContext,\n harnessFields,\n harnessFromEnv\n} from '../services/telemetry/harness-context.js';\nimport { readFreshStart } from '../services/workspace/fresh-start.js';\nimport { workspaceImportHandlers } from '../services/workspace/import-workspace-handler.js';\nimport { sessionNotice } from './session-notice.js';\nimport {\n callerClient,\n channelCaller,\n type Caller\n} from '../services/telemetry/usage-sink.js';\nimport {\n HANDOVER_POLL_MS,\n idleFile,\n oldestIdleUnit,\n slotWanted\n} from './slot-handover.js';\n\ntype UnitPeer = Peer<\n UnitMethods,\n RouterMethods,\n RouterToUnitEvents,\n UnitEvents\n>;\n\nexport interface DesignUnitOptions {\n id: string;\n home: string;\n /** The runtime version this unit runs from. */\n runtime: string;\n /** The licence the build carries; the unit's config overrides it. */\n bundledLicense: string;\n usageFetch?: LocalHostOptions['usageFetch'];\n redirectConsole?: LocalHostOptions['redirectConsole'];\n /** Pins the open-source codecs when the bundled licence is in use, before the engine children's env is taken. */\n pinCodecs?: (env: NodeJS.ProcessEnv) => void;\n}\n\n/** The unit's config as the environment the host and the engine children read: its licence and gateway key win over the env's. */\nexport function unitEnv(\n config: UnitConfig,\n env: NodeJS.ProcessEnv\n): NodeJS.ProcessEnv {\n const out: NodeJS.ProcessEnv = {\n ...env,\n IMGLY_CODESIGN_HOME: config.home,\n CODESIGN_WORKSPACE: config.workspace.root,\n IMGLY_DISABLE_VIEWER: config.viewer.enabled ? 'off' : 'on',\n IMGLY_TELEMETRY: config.telemetry.usage ? 'on' : 'off',\n IMGLY_ERROR_REPORTING: config.telemetry.errors ? 'on' : 'off',\n IMGLY_MAX_ENGINES: String(config.engine.maxEngines),\n IMGLY_ENGINE_IDLE_TIMEOUT: String(Math.round(config.engine.idleMs / 1000))\n };\n // Set here, after freezeReleaseEnv ran at start, because a release build would drop an inherited one.\n delete out.IMGLY_TELEMETRY_DECIDED_BY;\n delete out.IMGLY_ERROR_REPORTING_DECIDED_BY;\n delete out.IMGLY_TELEMETRY_MACHINE_OPT_OUT;\n const { usageDecidedBy, errorsDecidedBy, machineOptOut } = config.telemetry;\n if (usageDecidedBy === 'consent' || usageDecidedBy === 'machine')\n out.IMGLY_TELEMETRY_DECIDED_BY = usageDecidedBy;\n if (errorsDecidedBy === 'machine')\n out.IMGLY_ERROR_REPORTING_DECIDED_BY = 'machine';\n if (machineOptOut) out.IMGLY_TELEMETRY_MACHINE_OPT_OUT = 'on';\n if (config.licence !== undefined) out.CESDK_LICENSE = config.licence;\n if (config.engine.prefer !== 'auto')\n out.IMGLY_CESDK_ENGINE = config.engine.prefer;\n if (config.gateway?.baseURL !== undefined)\n out.IMGLY_GATEWAY_BASE_URL = config.gateway.baseURL;\n if (config.gateway?.apiKey !== undefined) {\n delete out.IMGLY_GATEWAY_API_KEY_FILE;\n out.IMGLY_GATEWAY_API_KEY = config.gateway.apiKey;\n }\n return out;\n}\n\n/** The engine pack and the assets pack a version runs on, by their directories under `engines/`; none for a build that was not installed. */\nexport function unitPacks(paths: RuntimePaths, version: string): string[] {\n let core: CoreManifest;\n try {\n core = JSON.parse(\n readFileSync(join(paths.version(version), 'manifest.json'), 'utf8')\n ) as CoreManifest;\n } catch {\n return [];\n }\n const wasm = readUpdateState(paths).engine?.kind === 'wasm';\n return [\n `${core.enginePack}-${wasm ? 'wasm' : core.platform}`,\n `assets-${core.enginePack}`\n ];\n}\n\nconst FOLDER_POLL_MS = 5_000;\n\n/** What a holder answers an `open` of the design it is on: the channel moved here, its client sees the live state; another session is named only while another channel is open. */\nconst joinedAnswer = (uri: string, others: boolean) => ({\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify({\n uri,\n joined: true,\n note: others\n ? 'This design is open in another live session; this connection now works in that session, on its current state. preview it before you continue.'\n : 'Continuing the live session of this design, on its current state. preview it before you continue.'\n })\n }\n ]\n});\n\nexport async function runDesignUnit(opts: DesignUnitOptions): Promise<void> {\n // A stderr whose reader died (EPIPE) must not turn every log line into an uncaught exception.\n process.stderr.on('error', () => undefined);\n const home = runtimePaths(opts.home);\n const paths = home.session(opts.id);\n mkdirSync(paths.dir, { recursive: true, mode: 0o700 });\n const config = await readUnitConfig(home, opts.id);\n const env = unitEnv(config, process.env);\n Object.assign(process.env, env);\n opts.pinCodecs?.(process.env);\n const workspace = config.workspace.id;\n\n const releaseLease = writeLease(home, {\n role: 'unit',\n version: opts.runtime,\n packs: unitPacks(home, opts.runtime)\n });\n\n const record: UnitRecord = {\n id: opts.id,\n kind: 'design',\n runtime: opts.runtime,\n sdk: SDK_VERSION,\n cesdk: installedCesdkVersion(),\n pid: process.pid,\n startedAt: Date.now(),\n workspace,\n workspaceHold: true\n };\n const writeRecord = () => {\n const tmp = `${paths.json}.${process.pid}.tmp`;\n writeFileSync(tmp, JSON.stringify(record, null, 2));\n renameSync(tmp, paths.json);\n };\n\n const log = (line: string) => process.stderr.write(`design unit: ${line}\\n`);\n const license = resolveLicense(process.env, opts.bundledLicense);\n const engines =\n license === undefined\n ? undefined\n : designEngines({\n env: process.env,\n license,\n idleMs: config.engine.idleMs,\n log\n });\n // Linux only, as in the engine child: there GStreamer's encoders may be missing; WebM is offered where it found them.\n const probing =\n process.platform === 'linux' && process.env.IMGLY_CESDK_ENGINE !== 'wasm'\n ? engines?.probeMedia()\n : undefined;\n const older = routerWarning(home.daemonJson, env);\n if (older !== null) log(older);\n\n const peers = new Set<UnitPeer>();\n const channels = new Map<\n string,\n {\n peer: UnitPeer;\n client: ClientIdentity;\n chatClientKind?: ClientIdentity['kind'];\n internal?: boolean;\n harness: HarnessContext;\n handlers: CatalogHandlers;\n }\n >();\n // R21: an MCP session's first result tells of 0.6's fresh start while it is pending.\n const firstResult = sessionNotice(\n async () => (await readFreshStart(config.workspace.root))?.notice\n );\n /** The channel whose call is running, its caller and harness as the call began: a design the call moves to is claimed for it. */\n const calling = new AsyncLocalStorage<{\n channel: string;\n caller: Caller;\n harness?: HarnessContext;\n }>();\n const callOn = <T>(\n channel: string,\n fn: () => T,\n c = channels.get(channel)\n ): T => {\n return calling.run(\n { channel, caller: channelCaller(c), harness: c?.harness },\n fn\n );\n };\n /** Answers by `once`, kept a minute after they settle for a call resent once its router died. */\n const answers = new Map<string, Promise<ToolResult>>();\n const ANSWER_KEPT_MS = 60_000;\n\n const claim = async (uri: string, channel: string) => {\n const peer = channels.get(channel)?.peer;\n if (peer === undefined) return { granted: true as const };\n return peer.request('design.claim', { workspace, uri, channel });\n };\n /** The last change it announced: a channel opened after it learns its revision from the answer. */\n let announced: { uri: string; revision: string } | undefined;\n const notifyChanged = (notice: DesignChangedParams) => {\n announced = { uri: notice.uri, revision: notice.revision };\n for (const peer of peers) peer.notify('design.changed', notice);\n };\n const release = (uri: string) => {\n for (const peer of peers)\n void peer\n .request('design.release', { workspace, uri })\n .catch(() => undefined);\n };\n\n /** The change notices of a gated edit's channel, held until the edit stays or is put back. */\n let held: { channel: string; notices: DesignChangedParams[] } | undefined;\n /** A change before the router said hello, sent once it has. */\n let unsentAuth: AuthState | undefined;\n // Triggered only once the host below is built: its callbacks read `local`.\n const seed: Seeder = seeder({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n baseUrl: packsBaseUrl(process.env),\n session: async (fresh) => local.auth?.session(fresh),\n previews: (ids) => local.previewDesigns(ids),\n onState: (state) => {\n for (const peer of peers) peer.notify('seed.changed', state);\n },\n log\n });\n const local = await buildLocalHost({\n onSignedIn: () => void seed.trigger(),\n packSeed: () => {\n const error = seed.lastError();\n return {\n state: seed.status().state,\n ...(error !== undefined ? { error } : {})\n };\n },\n bundledLicense: opts.bundledLicense,\n serverStartFields: (): Record<string, string> => {\n const missing = readUpdateState(home).engine?.missing;\n return missing !== undefined ? { missing } : {};\n },\n ...(opts.usageFetch !== undefined ? { usageFetch: opts.usageFetch } : {}),\n workspaceRoot: config.workspace.root,\n workspace: { id: workspace },\n unit: opts.id,\n ...(opts.redirectConsole !== undefined\n ? { redirectConsole: opts.redirectConsole }\n : {}),\n ...(engines !== undefined\n ? { executors: engines.executors, engineBreach: engines.lastBreach }\n : {}),\n ...((await probing)?.webm === true ? { webm: true } : {}),\n claimDesign: async (uri) => {\n const [router] = peers;\n if (router === undefined) return false;\n const claimed = await router.request('design.claim', { workspace, uri });\n return 'granted' in claimed;\n },\n onAuthChanged: (state) => {\n unsentAuth = peers.size === 0 ? state : undefined;\n for (const peer of peers) peer.notify('auth.changed', state);\n },\n onDesignChanged: (uri) => {\n const left = record.design;\n if (uri === undefined) delete record.design;\n else record.design = uri;\n writeRecord();\n if (uri !== left) announced = undefined;\n if (left !== undefined && left !== uri) release(left);\n const channel = calling.getStore()?.channel;\n if (uri !== undefined && uri !== left && channel !== undefined)\n void claim(uri, channel).catch(() => undefined);\n },\n onDesignSaved: ({ uri, revision, tool }) => {\n const channel = calling.getStore()?.channel;\n const client =\n channel !== undefined ? channels.get(channel)?.client : undefined;\n const notice: DesignChangedParams = {\n workspace,\n uri,\n unit: record.id,\n revision,\n by: {\n ...(tool !== undefined ? { tool } : {}),\n ...(client !== undefined ? { client } : {})\n }\n };\n if (held !== undefined && held.channel === channel)\n held.notices.push(notice);\n else notifyChanged(notice);\n }\n });\n writeRecord();\n\n // `open` claims its design first: when another unit holds it the router moves the channel there and asks that unit.\n const tools: HostTool[] = local.tools.map((tool) => {\n return {\n ...tool,\n call: async (args, ctx) => {\n const channel = calling.getStore()?.channel;\n if (tool.name === 'open') {\n const uri = (args as { uri?: unknown } | undefined)?.uri;\n if (typeof uri === 'string' && uri === record.design)\n return joinedAnswer(\n uri,\n [...channels.keys()].some((id) => id !== channel)\n );\n if (typeof uri === 'string' && channel !== undefined) {\n const claimed = await claim(uri, channel);\n if ('heldBy' in claimed) return joinedAnswer(uri, true);\n }\n }\n return tool.call(args, ctx);\n }\n };\n });\n /**\n * A chat's channel on this unit while it holds no design: no unit held `uri`, the design the chat's active tab names\n * as the router asked the live chat (a turn on a tab not shown, a tab switched to mid-turn), so it is opened here,\n * before any call of the channel runs.\n */\n let opening: Promise<unknown> = Promise.resolve();\n const openChatDesign = (channel: string, uri: string) => {\n const open = tools.find((tool) => tool.name === 'open');\n if (open === undefined) return;\n opening = opening\n .then(() =>\n record.design === undefined\n ? callOn(channel, () => open.call({ uri }))\n : undefined\n )\n .then(\n (result) => {\n if (result?.isError === true)\n log(\n `open ${uri}: ${result.content.map((p) => (p.type === 'text' ? p.text : '')).join(' ')}`\n );\n },\n (err: unknown) =>\n log(\n `open ${uri}: ${err instanceof Error ? err.message : String(err)}`\n )\n );\n };\n const catalog = createCatalog({\n assets: local.assets,\n tools,\n telemetry: local.telemetry,\n onToolCallMeta: local.onToolCallMeta,\n ...(local.onServedDocs ? { onServedDocs: local.onServedDocs } : {})\n });\n local.setCaller(() => calling.getStore()?.caller);\n if (local.usageEvents) void reportInstallOutcomes(home, local.usageEvents);\n local.setCallingClient(() => callerClient(calling.getStore()?.caller));\n /** The channel that opened last: error reports only, never usage telemetry. */\n let lastClient: ClientIdentity | undefined;\n local.setClientInfo(() =>\n lastClient?.name !== undefined\n ? { name: lastClient.name, version: lastClient.version ?? '' }\n : undefined\n );\n /** The newest channel's harness, for a report outside any call. */\n let lastHarness: HarnessContext | undefined;\n local.setHarness(() => {\n const call = calling.getStore();\n return call !== undefined ? call.harness : lastHarness;\n });\n\n let idleTimer: NodeJS.Timeout | undefined;\n let handover: NodeJS.Timeout | undefined;\n const idle = idleFile(home, opts.id);\n /** Calls running now: an engine with none is idle, and is given up to a unit that needs a slot. */\n let calls = 0;\n const folderRemoved = () => {\n log('the session folder was removed while the unit ran: ending');\n void end('session folder removed');\n };\n /** Writes the idle file; a session folder someone else removed ends the unit, as its record and socket went with it. */\n const markIdle = (): boolean => {\n try {\n if (!existsSync(idle)) writeFileSync(idle, '');\n return true;\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') throw err;\n folderRemoved();\n return false;\n }\n };\n // A unit no client is on, never idle, sees no other event that would find its folder gone.\n const folderWatch = setInterval(() => {\n if (channels.size === 0 && calls === 0 && !existsSync(paths.dir))\n folderRemoved();\n }, FOLDER_POLL_MS).unref();\n const watchIdle = () => {\n if (ending) return;\n clearTimeout(idleTimer);\n clearInterval(handover);\n if (calls > 0 || !engines?.used()) rmSync(idle, { force: true });\n else {\n if (!markIdle()) return;\n // An engine child elsewhere waits for a slot: the unit whose engine was idle longest gives its own up, and\n // ends when no client is on it.\n handover = setInterval(() => {\n if (\n slotWanted(home.engineSlots, config.engine.maxEngines) &&\n oldestIdleUnit(home) === opts.id\n )\n void handOver();\n }, HANDOVER_POLL_MS);\n }\n if (channels.size > 0 || calls > 0 || config.engine.idleMs === 0) return;\n idleTimer = setTimeout(() => void end('idle'), config.engine.idleMs);\n };\n const handOver = async () => {\n clearInterval(handover);\n if (channels.size === 0) return end('handover');\n log('handing the idle engine to a design that needs one');\n // The idle file goes only once the engine has: a child waiting for its slot stops waiting when no unit is idle.\n await engines?.stop();\n watchIdle();\n };\n\n const removeFiles = (code: number) => {\n releaseLease();\n removeUnitFiles(home, opts.id, code);\n };\n let ending = false;\n const end = async (reason: string): Promise<void> => {\n if (ending) return;\n ending = true;\n clearTimeout(idleTimer);\n clearInterval(handover);\n clearInterval(folderWatch);\n await endUnit({\n shutdown: () =>\n local.shutdown(reason, async () => {\n server.close();\n channels.clear();\n for (const peer of peers) peer.close();\n }),\n stopEngines: () => engines?.stop(),\n removeFiles,\n exit: (code) => process.exit(code)\n });\n };\n\n const channelOf = (channel: string) => {\n const c = channels.get(channel);\n if (c === undefined)\n throw new ProtocolError('invalid_params', `no channel ${channel}`);\n return c;\n };\n const authOf = () => {\n if (local.auth === undefined)\n throw new ProtocolError(\n 'not_installed',\n 'sign-in is not configured in this build'\n );\n return local.auth;\n };\n\n /** The gate of a chat's channel: its client's can_edit, through the router; none when no client declared it. */\n const chatGate = (peer: UnitPeer, channel: string): ChatGate => ({\n canEdit: (params) =>\n peer\n .request('client.call', {\n channel,\n call: randomUUID(),\n name: 'can_edit',\n arguments: { ...params }\n })\n .catch((err: unknown) => {\n if (err instanceof ProtocolError && err.kind === 'invalid_params')\n return undefined;\n throw err;\n }),\n pages: () => local.pages(),\n keep: async () => {\n const restore = await local.keep();\n const hold = (held = { channel, notices: [] });\n const stop = () => {\n if (held === hold) held = undefined;\n return hold.notices;\n };\n return {\n release: () => stop().forEach(notifyChanged),\n restore: async () => {\n stop();\n await restore();\n }\n };\n }\n });\n\n type Forwarded = Exclude<keyof CatalogHandlers, 'tools.call'>;\n const forwarded: Forwarded[] = [\n 'tools.list',\n 'tools.cancel',\n 'instructions',\n 'skills.list',\n 'skills.read',\n 'prompts.list',\n 'prompts.get',\n 'prompts.complete'\n ];\n\n void seed.trigger();\n const server = await listenUnix(paths.sock, (transport) => {\n const peer: UnitPeer = new Peer(transport, {\n role: 'unit',\n remote: 'router'\n });\n peers.add(peer);\n peer.onClose(() => {\n peers.delete(peer);\n for (const [id, c] of channels)\n if (c.peer === peer) {\n channels.delete(id);\n firstResult.forget(id);\n }\n watchIdle();\n });\n peer.handle('hello', () => {\n const state = unsentAuth;\n unsentAuth = undefined;\n if (state !== undefined)\n setImmediate(() => peer.notify('auth.changed', state));\n return { protocol: peer.version ?? 2, unit: record, pid: process.pid };\n });\n peer.on('auth.changed', () => local.auth?.forget());\n peer.on('sources.changed', ({ workspace: changed }) => {\n if (changed === workspace) void local.reloadSources();\n });\n peer.on('seed.changed', (state) => seed.mirror(state));\n peer.handle('seed.status', ({ channel }) => {\n channelOf(channel);\n return seed.status();\n });\n peer.handle(\n 'channel.open',\n ({\n channel,\n client,\n conversation,\n design,\n chatClientKind,\n internal,\n harness,\n chatHarness\n }) => {\n if (channels.has(channel))\n throw new ProtocolError(\n 'invalid_params',\n `channel ${channel} is open`\n );\n lastClient = client;\n lastHarness = new HarnessContext(\n harness !== undefined\n ? harnessFields(harness)\n : harnessFromEnv(process.env),\n chatHarness !== undefined ? harnessFields(chatHarness) : {}\n );\n channels.set(channel, {\n peer,\n client,\n ...(chatClientKind !== undefined ? { chatClientKind } : {}),\n ...(internal === true ? { internal } : {}),\n harness: lastHarness,\n handlers: catalogHandlers(\n catalog,\n () => client,\n (p) => {\n peer.notify('progress', { channel, ...p });\n },\n conversation === undefined\n ? {}\n : {\n conversation,\n chatKind: readRecord(home, conversation)?.kind ?? 'design',\n gate: chatGate(peer, channel),\n workspaceRoot: config.workspace.root\n }\n )\n });\n watchIdle();\n if (design !== undefined && record.design === undefined)\n openChatDesign(channel, design);\n if (record.design === undefined) return {};\n return announced?.uri === record.design\n ? { design: record.design, revision: announced.revision }\n : { design: record.design };\n }\n );\n peer.handle('channel.close', ({ channel }) => {\n channels.delete(channel);\n firstResult.forget(channel);\n watchIdle();\n return {};\n });\n const runCall = async (\n channel: string,\n call: Omit<ToolsCallParams, 'channel' | 'once'>\n ) => {\n const c = channelOf(channel);\n calls += 1;\n watchIdle();\n try {\n await opening;\n const result = await callOn(\n channel,\n () => c.handlers['tools.call'](call),\n c\n );\n // R21: an MCP session's first result tells of 0.6's fresh start; a chat's holder says it to its person itself.\n if (!channels.has(channel)) return result;\n return await firstResult.withNotice(\n channel,\n c.chatClientKind === undefined ? c.client : undefined,\n call.name,\n result\n );\n } finally {\n calls -= 1;\n // The idle file's time is when the engine was last used: the least recently used gives its engine up first.\n if (calls === 0) rmSync(idle, { force: true });\n watchIdle();\n }\n };\n peer.handle('tools.call', ({ channel, once, ...call }) => {\n const answered = once !== undefined ? answers.get(once) : undefined;\n if (answered !== undefined) return answered;\n const answer = runCall(channel, call);\n if (once === undefined) return answer;\n answers.set(once, answer);\n const forget = () =>\n setTimeout(() => answers.delete(once), ANSWER_KEPT_MS).unref();\n answer.then(forget, forget);\n return answer;\n });\n for (const method of forwarded) {\n peer.handle(method, (params: { channel: string }) => {\n const handler = channelOf(params.channel).handlers[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>;\n return callOn(params.channel, () => handler(params));\n });\n }\n peer.handle('designs.list', async ({ channel }) => {\n const handlers = channelOf(channel).handlers;\n const designs = await everyDesign((args) =>\n callOn(channel, () =>\n handlers['tools.call']({\n call: 'designs.list',\n name: 'designs',\n arguments: args\n })\n )\n );\n return { designs };\n });\n peer.handle('experiments.list', ({ channel }) => {\n channelOf(channel);\n return { experiments: listExperiments(opts.home).experiments };\n });\n peer.handle('experiments.set', ({ channel, id, state, value }) => {\n channelOf(channel);\n return {\n experiments: setExperiment(opts.home, id, state, undefined, value)\n };\n });\n const packs = packHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n sourcesChanged: (changed) => {\n for (const p of peers)\n p.notify('sources.changed', { workspace: changed });\n if (changed === workspace) void local.reloadSources();\n },\n ...(local.usageEvents !== undefined\n ? { usageEvents: local.usageEvents }\n : {})\n });\n for (const method of Object.keys(packs) as PackMethod[])\n peer.handle(method, async (params: { channel: string }) => {\n channelOf(params.channel);\n const result = await callOn(params.channel, () =>\n (\n packs[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params)\n );\n // A design from a template without a preview gets one rendered, opened by hand from a pack too.\n if (\n (method === 'designs.fromTemplate' ||\n (method === 'pack.install' &&\n (params as { dryRun?: boolean }).dryRun !== true)) &&\n [undefined, workspace].includes(\n (params as { workspace?: string }).workspace\n )\n )\n void local.sweepPreviews();\n return result;\n });\n const assets = assetsHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root }\n });\n for (const method of Object.keys(assets) as AssetsMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return assets[method](\n params as ChannelMethods[typeof method]['params']\n );\n });\n const library = libraryHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n store: local.store\n });\n for (const method of Object.keys(library) as LibraryMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return (\n library[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params);\n });\n const styles = styleHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root }\n });\n for (const method of Object.keys(styles) as StyleMethod[])\n peer.handle(method, (params: { channel: string }) => {\n channelOf(params.channel);\n return (\n styles[method] as (\n p: unknown\n ) => Promise<ChannelMethods[typeof method]['result']>\n )(params);\n });\n const imports = workspaceImportHandlers({\n home,\n workspace: { id: workspace, root: config.workspace.root },\n // This server serves the workspace: an old one is never set aside under its sessions.\n setAsideOld: false\n });\n peer.handle('workspace.import', async (params) => {\n channelOf(params.channel);\n const result = await imports['workspace.import'](params);\n const changed = params.workspace ?? workspace;\n // Imported designs without a preview get one rendered, as a design from a template does.\n if (result.designs > 0 && changed === workspace)\n void local.sweepPreviews();\n // Imported sources are new catalogues for every client.\n if (result.sources > 0) {\n for (const p of peers)\n p.notify('sources.changed', { workspace: changed });\n if (changed === workspace) void local.reloadSources();\n }\n return result;\n });\n peer.handle('auth.status', () => authOf().status());\n peer.handle('auth.login', async ({ switchAccount }) => ({\n url: await authOf().login({ switchAccount })\n }));\n peer.handle('auth.cancel', () => {\n authOf().cancel();\n return {};\n });\n peer.handle('auth.token', ({ fresh }) => authOf().token(fresh === true));\n peer.handle('auth.logout', async () => {\n await authOf().logout();\n return { signedIn: false };\n });\n peer.handle('ui.event', ({ channel, ...event }) => {\n channelOf(channel);\n // Never forwarded as it came: a name or a field outside the catalog, an envelope field included.\n if (!isUiEvent(event)) log('dropped a ui.event outside the catalog');\n else\n callOn(channel, () =>\n local.usageEvents?.recordEvent(event.name, event.fields)\n );\n return {};\n });\n peer.handle('design.save', async ({ channel, scene }) => {\n channelOf(channel);\n const saved = await callOn(channel, () =>\n local.takeSave(new TextEncoder().encode(scene))\n );\n return { uri: saved.uri, revision: saved.revision };\n });\n peer.handle('draft.save', async () => ({ saved: await local.keepDraft() }));\n peer.handle('park', () => {\n setImmediate(() => void end('park'));\n return {};\n });\n peer.handle('ping', () => ({}));\n });\n watchIdle();\n removeFilesOnExit(removeFiles);\n\n process.on('SIGINT', () => void end('SIGINT'));\n process.on('SIGTERM', () => void end('SIGTERM'));\n process.on('SIGHUP', () => void end('SIGHUP'));\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Exporters } from '@imgly/codesign-sdk/internal';
|
|
2
|
+
/** Every exporter, PSD and Figma included, reading a custom ICC profile off this machine's disk: for Node hosts only. */
|
|
3
|
+
export declare function nodeExporters(): Required<Exporters>;
|
|
4
|
+
//# sourceMappingURL=node-exporters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-exporters.d.ts","sourceRoot":"","sources":["../../src/design/node-exporters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAI9D,yHAAyH;AACzH,wBAAgB,aAAa,IAAI,QAAQ,CAAC,SAAS,CAAC,CAOnD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { createNodeExporters } from '@imgly/codesign-sdk/internal/exporters/node';
|
|
3
|
+
import { nodeUrlGuard } from '@imgly/codesign-sdk/internal/node';
|
|
4
|
+
/** Every exporter, PSD and Figma included, reading a custom ICC profile off this machine's disk: for Node hosts only. */
|
|
5
|
+
export function nodeExporters() {
|
|
6
|
+
return createNodeExporters({
|
|
7
|
+
urlGuard: nodeUrlGuard(),
|
|
8
|
+
pdfx: {
|
|
9
|
+
readProfile: async (path) => new Uint8Array(await readFile(path))
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=node-exporters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-exporters.js","sourceRoot":"","sources":["../../src/design/node-exporters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,yHAAyH;AACzH,MAAM,UAAU,aAAa;IAC3B,OAAO,mBAAmB,CAAC;QACzB,QAAQ,EAAE,YAAY,EAAE;QACxB,IAAI,EAAE;YACJ,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;SAClE;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { readFile } from 'node:fs/promises';\n\nimport type { Exporters } from '@imgly/codesign-sdk/internal';\nimport { createNodeExporters } from '@imgly/codesign-sdk/internal/exporters/node';\nimport { nodeUrlGuard } from '@imgly/codesign-sdk/internal/node';\n\n/** Every exporter, PSD and Figma included, reading a custom ICC profile off this machine's disk: for Node hosts only. */\nexport function nodeExporters(): Required<Exporters> {\n return createNodeExporters({\n urlGuard: nodeUrlGuard(),\n pdfx: {\n readProfile: async (path) => new Uint8Array(await readFile(path))\n }\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe-media.d.ts","sourceRoot":"","sources":["../../src/design/probe-media.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The design unit's media probe: `node probe-media.js`, run once before the unit lists its tools, in the engine
|
|
2
|
+
// child's environment. It prints what the native engine encodes as one JSON line, then exits.
|
|
3
|
+
import { exit, stdout } from 'node:process';
|
|
4
|
+
import { startNativeEngine } from '../catalog/tools/engine.js';
|
|
5
|
+
import { MEDIA_SUPPORT_ENV, mediaSupport } from './media-support.js';
|
|
6
|
+
const license = process.env.CESDK_LICENSE ?? '';
|
|
7
|
+
delete process.env.CESDK_LICENSE;
|
|
8
|
+
delete process.env.IMGLY_CESDK_LICENSE;
|
|
9
|
+
const media = await mediaSupport({
|
|
10
|
+
known: process.env[MEDIA_SUPPORT_ENV],
|
|
11
|
+
env: process.env,
|
|
12
|
+
// The engine's types name only video/mp4; the probe also asks for WebM, which the engine encodes.
|
|
13
|
+
startNative: () => startNativeEngine(license)
|
|
14
|
+
});
|
|
15
|
+
stdout.write(`${JSON.stringify(media)}\n`, () => exit(0));
|
|
16
|
+
//# sourceMappingURL=probe-media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probe-media.js","sourceRoot":"","sources":["../../src/design/probe-media.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,8FAA8F;AAE9F,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAErE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC;AAChD,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AACjC,OAAO,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;AAEvC,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC;IAC/B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IACrC,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,kGAAkG;IAClG,WAAW,EAAE,GAAG,EAAE,CAChB,iBAAiB,CAAC,OAAO,CAAoC;CAChE,CAAC,CAAC;AACH,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC","sourcesContent":["// The design unit's media probe: `node probe-media.js`, run once before the unit lists its tools, in the engine\n// child's environment. It prints what the native engine encodes as one JSON line, then exits.\n\nimport { exit, stdout } from 'node:process';\n\nimport type { ProbeEngine } from '@imgly/codesign-sdk/internal/node';\n\nimport { startNativeEngine } from '../catalog/tools/engine.js';\nimport { MEDIA_SUPPORT_ENV, mediaSupport } from './media-support.js';\n\nconst license = process.env.CESDK_LICENSE ?? '';\ndelete process.env.CESDK_LICENSE;\ndelete process.env.IMGLY_CESDK_LICENSE;\n\nconst media = await mediaSupport({\n known: process.env[MEDIA_SUPPORT_ENV],\n env: process.env,\n // The engine's types name only video/mp4; the probe also asks for WebM, which the engine encodes.\n startNative: () =>\n startNativeEngine(license) as unknown as Promise<ProbeEngine>\n});\nstdout.write(`${JSON.stringify(media)}\\n`, () => exit(0));\n"]}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import type { WorkspaceFS } from '../services/workspace/types.js';
|
|
2
|
+
/** A remote address the design file still names, and why it could not be copied. */
|
|
3
|
+
export interface KeptRemote {
|
|
4
|
+
uri: string;
|
|
5
|
+
reason: string;
|
|
6
|
+
}
|
|
7
|
+
/** A design file's scene, the remote addresses it still names because their copy failed, and those not tried yet. */
|
|
8
|
+
export interface LocalizedScene {
|
|
9
|
+
scene: string;
|
|
10
|
+
kept: KeptRemote[];
|
|
11
|
+
untried?: string[];
|
|
12
|
+
}
|
|
13
|
+
/** `localize` a scene (`download: false`: with the copies made so far); `download` copies addresses, answering the failures. */
|
|
14
|
+
export type RemoteResources = ((scene: string, opts?: {
|
|
15
|
+
download?: boolean;
|
|
16
|
+
}) => Promise<LocalizedScene>) & {
|
|
17
|
+
download(uris: string[]): Promise<KeptRemote[]>;
|
|
18
|
+
};
|
|
2
19
|
/**
|
|
3
20
|
* The scene of a design file with its remote resources as workspace files in `fs`. Each address is fetched once per
|
|
4
|
-
* process
|
|
21
|
+
* process; a failure stands for `retryMs` (one in FINAL for good), so saves in a row never wait twice on a host that is not there.
|
|
5
22
|
*/
|
|
6
|
-
export declare function remoteResources(fs: WorkspaceFS, { fetch }?: {
|
|
23
|
+
export declare function remoteResources(fs: WorkspaceFS, { fetch, idleMs, retryMs }?: {
|
|
7
24
|
fetch?: typeof globalThis.fetch;
|
|
8
|
-
|
|
25
|
+
idleMs?: number;
|
|
26
|
+
retryMs?: number;
|
|
27
|
+
}): RemoteResources;
|
|
9
28
|
//# sourceMappingURL=remote-resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-resources.d.ts","sourceRoot":"","sources":["../../src/design/remote-resources.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"remote-resources.d.ts","sourceRoot":"","sources":["../../src/design/remote-resources.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA0ClE,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,qHAAqH;AACrH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,gIAAgI;AAChI,MAAM,MAAM,eAAe,GAAG,CAAC,CAC7B,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,KAC1B,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;CACjD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,WAAW,EACf,EACE,KAAwB,EACxB,MAAgB,EAChB,OAAkB,EACnB,GAAE;IACD,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GACL,eAAe,CAgJjB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// A design file's resources are workspace files (decision 47), as the app's design held its own copies: what a scene
|
|
2
2
|
// loads over http(s), a catalog's font or a searched image, is copied to `assets/<sha256>.<ext>` with its sidecar and
|
|
3
|
-
// named so, for a design that opens offline. A resource that cannot be fetched keeps its address.
|
|
3
|
+
// named so, for a design that opens offline. A resource that cannot be fetched keeps its address, and the save says so.
|
|
4
4
|
import { workspaceAssetStore } from '../services/workspace/asset-store.js';
|
|
5
5
|
import { decodeScene, encodeScene, strings } from './migrate.js';
|
|
6
6
|
/** The keys whose string the engine loads: *URI / *URL, and a font's `data`. */
|
|
@@ -9,7 +9,13 @@ const REMOTE = /^https?:\/\/[^\s#]+(#\S*)?$/i;
|
|
|
9
9
|
/** The editor's emoji font is a setting of every engine, not a resource of the design. */
|
|
10
10
|
const RUNTIME_SETTING = 'defaultEmojiFontFileUri';
|
|
11
11
|
const MAX_BYTES = 256 * 1024 * 1024;
|
|
12
|
-
|
|
12
|
+
/** A download fails when no bytes arrive for this long; a large video that keeps arriving is never cut off. */
|
|
13
|
+
const IDLE_MS = 30_000;
|
|
14
|
+
/** A failed address, unless its failure is FINAL, is tried again by the first agent save after this long. */
|
|
15
|
+
const RETRY_MS = 5 * 60_000;
|
|
16
|
+
const TOO_LARGE = 'larger than 256 MB';
|
|
17
|
+
/** What the host answers the same every time is never tried again. */
|
|
18
|
+
const FINAL = new Set([TOO_LARGE, 'empty']);
|
|
13
19
|
const TYPES = {
|
|
14
20
|
'font/ttf': 'ttf',
|
|
15
21
|
'font/otf': 'otf',
|
|
@@ -25,81 +31,166 @@ const TYPES = {
|
|
|
25
31
|
'audio/mpeg': 'mp3',
|
|
26
32
|
'audio/wav': 'wav'
|
|
27
33
|
};
|
|
34
|
+
class NotStored extends Error {
|
|
35
|
+
constructor(cause) {
|
|
36
|
+
super('not stored', { cause });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const messageOf = (err) => err instanceof Error ? err.message : String(err);
|
|
28
40
|
/**
|
|
29
41
|
* The scene of a design file with its remote resources as workspace files in `fs`. Each address is fetched once per
|
|
30
|
-
* process
|
|
42
|
+
* process; a failure stands for `retryMs` (one in FINAL for good), so saves in a row never wait twice on a host that is not there.
|
|
31
43
|
*/
|
|
32
|
-
export function remoteResources(fs, { fetch = globalThis.fetch } = {}) {
|
|
44
|
+
export function remoteResources(fs, { fetch = globalThis.fetch, idleMs = IDLE_MS, retryMs = RETRY_MS } = {}) {
|
|
33
45
|
const assets = workspaceAssetStore(fs);
|
|
46
|
+
const settled = new Map();
|
|
34
47
|
const copies = new Map();
|
|
48
|
+
const failedAt = new Map();
|
|
49
|
+
const expire = (url) => {
|
|
50
|
+
const at = failedAt.get(url);
|
|
51
|
+
if (at === undefined || Date.now() - at < retryMs)
|
|
52
|
+
return;
|
|
53
|
+
failedAt.delete(url);
|
|
54
|
+
settled.delete(url);
|
|
55
|
+
copies.delete(url);
|
|
56
|
+
};
|
|
35
57
|
const copy = async (url) => {
|
|
58
|
+
const abort = new AbortController();
|
|
59
|
+
let timer;
|
|
60
|
+
const waiting = () => {
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
timer = setTimeout(() => abort.abort(), idleMs);
|
|
63
|
+
};
|
|
64
|
+
waiting();
|
|
36
65
|
try {
|
|
37
|
-
const response = await fetch(url, {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
|
|
66
|
+
const response = await fetch(url, { signal: abort.signal });
|
|
67
|
+
waiting();
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
await response.body?.cancel();
|
|
70
|
+
return { reason: `HTTP ${response.status}` };
|
|
71
|
+
}
|
|
72
|
+
const declared = Number(response.headers.get('content-length'));
|
|
73
|
+
if (declared > MAX_BYTES) {
|
|
43
74
|
await response.body?.cancel();
|
|
44
|
-
return
|
|
75
|
+
return { reason: TOO_LARGE };
|
|
45
76
|
}
|
|
46
|
-
const bytes = await readCapped(response);
|
|
47
|
-
|
|
48
|
-
|
|
77
|
+
const bytes = await readCapped(response, declared, waiting);
|
|
78
|
+
clearTimeout(timer);
|
|
79
|
+
if (bytes === undefined)
|
|
80
|
+
return { reason: TOO_LARGE };
|
|
81
|
+
if (bytes.length === 0)
|
|
82
|
+
return { reason: 'empty' };
|
|
49
83
|
const ext = TYPES[(response.headers.get('content-type') ?? '').split(';')[0].trim()] ??
|
|
50
84
|
/\.([a-z0-9]{1,8})$/i.exec(new URL(url).pathname)?.[1].toLowerCase() ??
|
|
51
85
|
'bin';
|
|
52
|
-
|
|
86
|
+
const uri = await assets.write(bytes, { ext, group: 'imported' }).then((asset) => asset.meta?.uri, (err) => {
|
|
87
|
+
throw new NotStored(err);
|
|
88
|
+
});
|
|
89
|
+
return uri === undefined ? { reason: 'not stored' } : { uri };
|
|
53
90
|
}
|
|
54
|
-
catch {
|
|
55
|
-
|
|
91
|
+
catch (err) {
|
|
92
|
+
if (err instanceof NotStored)
|
|
93
|
+
return { reason: `not stored (${messageOf(err.cause)})` };
|
|
94
|
+
if (abort.signal.aborted)
|
|
95
|
+
return { reason: `no data for ${Math.round(idleMs / 1000)} s` };
|
|
96
|
+
return {
|
|
97
|
+
reason: `could not be fetched (${messageOf(err)})`
|
|
98
|
+
};
|
|
56
99
|
}
|
|
100
|
+
finally {
|
|
101
|
+
clearTimeout(timer);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const started = (url) => {
|
|
105
|
+
expire(url);
|
|
106
|
+
let copied = copies.get(url);
|
|
107
|
+
if (copied === undefined) {
|
|
108
|
+
copied = copy(url).then((result) => {
|
|
109
|
+
settled.set(url, result);
|
|
110
|
+
if ('reason' in result && !FINAL.has(result.reason))
|
|
111
|
+
failedAt.set(url, Date.now());
|
|
112
|
+
return result;
|
|
113
|
+
});
|
|
114
|
+
copies.set(url, copied);
|
|
115
|
+
}
|
|
116
|
+
return copied;
|
|
57
117
|
};
|
|
58
|
-
|
|
118
|
+
const localize = async (scene, { download = true } = {}) => {
|
|
59
119
|
let payload;
|
|
60
120
|
try {
|
|
61
121
|
payload = decodeScene(scene);
|
|
62
122
|
}
|
|
63
123
|
catch {
|
|
64
|
-
return scene;
|
|
124
|
+
return { scene, kept: [] };
|
|
65
125
|
}
|
|
66
126
|
const remote = [...strings(payload)].filter(({ key, value }) => RESOURCE_KEY.test(key) && key !== RUNTIME_SETTING && REMOTE.test(value));
|
|
67
127
|
const located = remote.map(({ holder, key, value }) => {
|
|
68
128
|
const hash = value.indexOf('#');
|
|
69
129
|
const url = hash < 0 ? value : value.slice(0, hash);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
130
|
+
if (!download)
|
|
131
|
+
expire(url);
|
|
132
|
+
const copied = download
|
|
133
|
+
? started(url)
|
|
134
|
+
: Promise.resolve(settled.get(url));
|
|
73
135
|
return {
|
|
74
136
|
holder,
|
|
75
137
|
key,
|
|
138
|
+
url,
|
|
76
139
|
fragment: hash < 0 ? '' : value.slice(hash),
|
|
77
140
|
copied
|
|
78
141
|
};
|
|
79
142
|
});
|
|
80
143
|
let changed = false;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
144
|
+
const kept = new Map();
|
|
145
|
+
const untried = new Set();
|
|
146
|
+
for (const { holder, key, url, fragment, copied } of located) {
|
|
147
|
+
const result = await copied;
|
|
148
|
+
if (result === undefined) {
|
|
149
|
+
untried.add(url);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if ('reason' in result) {
|
|
153
|
+
kept.set(url, result.reason);
|
|
84
154
|
continue;
|
|
85
|
-
|
|
155
|
+
}
|
|
156
|
+
holder[key] = result.uri + fragment;
|
|
86
157
|
changed = true;
|
|
87
158
|
}
|
|
88
|
-
return
|
|
159
|
+
return {
|
|
160
|
+
scene: changed ? encodeScene(payload, scene.slice(0, 4)) : scene,
|
|
161
|
+
kept: [...kept].map(([uri, reason]) => ({ uri, reason })),
|
|
162
|
+
...(untried.size > 0 ? { untried: [...untried] } : {})
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
const download = async (uris) => {
|
|
166
|
+
const results = await Promise.all(uris.map(async (uri) => ({ uri, result: await started(uri) })));
|
|
167
|
+
return results.flatMap(({ uri, result }) => 'reason' in result ? [{ uri, reason: result.reason }] : []);
|
|
89
168
|
};
|
|
169
|
+
return Object.assign(localize, { download });
|
|
90
170
|
}
|
|
91
|
-
/** The body, or undefined
|
|
92
|
-
async function readCapped(response) {
|
|
171
|
+
/** The body, or undefined past MAX_BYTES; a declared length is read into one buffer. */
|
|
172
|
+
async function readCapped(response, declared, arrived) {
|
|
93
173
|
if (response.body === null)
|
|
94
174
|
return new Uint8Array();
|
|
95
175
|
const chunks = [];
|
|
176
|
+
let into = declared > 0 ? new Uint8Array(declared) : undefined;
|
|
96
177
|
let length = 0;
|
|
97
178
|
for await (const chunk of response.body) {
|
|
98
|
-
|
|
99
|
-
if (length > MAX_BYTES)
|
|
179
|
+
arrived();
|
|
180
|
+
if (length + chunk.length > MAX_BYTES)
|
|
100
181
|
return undefined;
|
|
101
|
-
|
|
182
|
+
if (into !== undefined && length + chunk.length <= into.length)
|
|
183
|
+
into.set(chunk, length);
|
|
184
|
+
else {
|
|
185
|
+
if (into !== undefined)
|
|
186
|
+
chunks.push(into.subarray(0, length));
|
|
187
|
+
into = undefined;
|
|
188
|
+
chunks.push(chunk);
|
|
189
|
+
}
|
|
190
|
+
length += chunk.length;
|
|
102
191
|
}
|
|
192
|
+
if (into !== undefined)
|
|
193
|
+
return into.subarray(0, length);
|
|
103
194
|
const bytes = new Uint8Array(length);
|
|
104
195
|
let at = 0;
|
|
105
196
|
for (const chunk of chunks) {
|