@mcpview/compose 0.0.0-stage → 0.11.0
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/CHANGELOG.md +268 -0
- package/LICENSE +21 -0
- package/README.md +524 -2
- package/esm/_dnt.polyfills.d.ts +18 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -0
- package/esm/_dnt.polyfills.js +15 -0
- package/esm/_dnt.shims.d.ts +2 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +57 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_chars.js +48 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts +106 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.js +636 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts +67 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_loader_state.js +1393 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts +44 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_schema.js +117 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/binary.js +103 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/bool.js +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/float.js +96 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/int.js +159 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/map.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/merge.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/nil.js +22 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/omap.js +29 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.js +19 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.js +30 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/seq.js +10 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/set.js +14 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/str.js +9 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.js +81 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts +3 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.js +20 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts +32 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_type.js +6 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts +4 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/_utils.js +13 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts +51 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/mod.js +53 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts +79 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/parse.js +91 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts +108 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/stringify.js +33 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/types.d.ts +111 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/1.3.0/types.js +104 -0
- package/esm/mod.d.ts +49 -0
- package/esm/mod.d.ts.map +1 -0
- package/esm/mod.js +42 -0
- package/esm/package.json +3 -0
- package/esm/src/core/collector/collector.d.ts +58 -0
- package/esm/src/core/collector/collector.d.ts.map +1 -0
- package/esm/src/core/collector/collector.js +60 -0
- package/esm/src/core/collector/extractor.d.ts +33 -0
- package/esm/src/core/collector/extractor.d.ts.map +1 -0
- package/esm/src/core/collector/extractor.js +53 -0
- package/esm/src/core/collector/mod.d.ts +9 -0
- package/esm/src/core/collector/mod.d.ts.map +1 -0
- package/esm/src/core/collector/mod.js +7 -0
- package/esm/src/core/components/components.d.ts +4 -0
- package/esm/src/core/components/components.d.ts.map +1 -0
- package/esm/src/core/components/components.js +28 -0
- package/esm/src/core/components/mod.d.ts +2 -0
- package/esm/src/core/components/mod.d.ts.map +1 -0
- package/esm/src/core/components/mod.js +1 -0
- package/esm/src/core/composer/composer.d.ts +35 -0
- package/esm/src/core/composer/composer.d.ts.map +1 -0
- package/esm/src/core/composer/composer.js +72 -0
- package/esm/src/core/composer/mod.d.ts +7 -0
- package/esm/src/core/composer/mod.d.ts.map +1 -0
- package/esm/src/core/composer/mod.js +6 -0
- package/esm/src/core/mod.d.ts +15 -0
- package/esm/src/core/mod.d.ts.map +1 -0
- package/esm/src/core/mod.js +16 -0
- package/esm/src/core/sync/mod.d.ts +9 -0
- package/esm/src/core/sync/mod.d.ts.map +1 -0
- package/esm/src/core/sync/mod.js +7 -0
- package/esm/src/core/sync/resolver.d.ts +51 -0
- package/esm/src/core/sync/resolver.d.ts.map +1 -0
- package/esm/src/core/sync/resolver.js +88 -0
- package/esm/src/core/sync/validator.d.ts +39 -0
- package/esm/src/core/sync/validator.d.ts.map +1 -0
- package/esm/src/core/sync/validator.js +65 -0
- package/esm/src/core/types/components.d.ts +46 -0
- package/esm/src/core/types/components.d.ts.map +1 -0
- package/esm/src/core/types/components.js +2 -0
- package/esm/src/core/types/descriptor.d.ts +47 -0
- package/esm/src/core/types/descriptor.d.ts.map +1 -0
- package/esm/src/core/types/descriptor.js +6 -0
- package/esm/src/core/types/errors.d.ts +69 -0
- package/esm/src/core/types/errors.d.ts.map +1 -0
- package/esm/src/core/types/errors.js +32 -0
- package/esm/src/core/types/layout.d.ts +100 -0
- package/esm/src/core/types/layout.d.ts.map +1 -0
- package/esm/src/core/types/layout.js +49 -0
- package/esm/src/core/types/mcp-apps.d.ts +56 -0
- package/esm/src/core/types/mcp-apps.d.ts.map +1 -0
- package/esm/src/core/types/mcp-apps.js +16 -0
- package/esm/src/core/types/mod.d.ts +17 -0
- package/esm/src/core/types/mod.d.ts.map +1 -0
- package/esm/src/core/types/mod.js +7 -0
- package/esm/src/core/types/orchestration.d.ts +37 -0
- package/esm/src/core/types/orchestration.d.ts.map +1 -0
- package/esm/src/core/types/orchestration.js +6 -0
- package/esm/src/core/types/resources.d.ts +37 -0
- package/esm/src/core/types/resources.d.ts.map +1 -0
- package/esm/src/core/types/resources.js +1 -0
- package/esm/src/core/types/sync-rules.d.ts +80 -0
- package/esm/src/core/types/sync-rules.d.ts.map +1 -0
- package/esm/src/core/types/sync-rules.js +6 -0
- package/esm/src/deploy/mod.d.ts +12 -0
- package/esm/src/deploy/mod.d.ts.map +1 -0
- package/esm/src/deploy/mod.js +11 -0
- package/esm/src/deploy/types.d.ts +119 -0
- package/esm/src/deploy/types.d.ts.map +1 -0
- package/esm/src/deploy/types.js +19 -0
- package/esm/src/host/components-contract.d.ts +6 -0
- package/esm/src/host/components-contract.d.ts.map +1 -0
- package/esm/src/host/components-contract.js +5 -0
- package/esm/src/host/mod.d.ts +15 -0
- package/esm/src/host/mod.d.ts.map +1 -0
- package/esm/src/host/mod.js +14 -0
- package/esm/src/host/renderer/css/base.d.ts +23 -0
- package/esm/src/host/renderer/css/base.d.ts.map +1 -0
- package/esm/src/host/renderer/css/base.js +48 -0
- package/esm/src/host/renderer/css/layouts.d.ts +31 -0
- package/esm/src/host/renderer/css/layouts.d.ts.map +1 -0
- package/esm/src/host/renderer/css/layouts.js +129 -0
- package/esm/src/host/renderer/html-generator.d.ts +36 -0
- package/esm/src/host/renderer/html-generator.d.ts.map +1 -0
- package/esm/src/host/renderer/html-generator.js +227 -0
- package/esm/src/host/renderer/js/event-bus.d.ts +33 -0
- package/esm/src/host/renderer/js/event-bus.d.ts.map +1 -0
- package/esm/src/host/renderer/js/event-bus.js +592 -0
- package/esm/src/host/renderer/mod.d.ts +9 -0
- package/esm/src/host/renderer/mod.d.ts.map +1 -0
- package/esm/src/host/renderer/mod.js +7 -0
- package/esm/src/host/renderer/options.d.ts +126 -0
- package/esm/src/host/renderer/options.d.ts.map +1 -0
- package/esm/src/host/renderer/options.js +1 -0
- package/esm/src/host/serve.d.ts +55 -0
- package/esm/src/host/serve.d.ts.map +1 -0
- package/esm/src/host/serve.js +89 -0
- package/esm/src/host/types.d.ts +42 -0
- package/esm/src/host/types.d.ts.map +1 -0
- package/esm/src/host/types.js +9 -0
- package/esm/src/runtime/cluster.d.ts +92 -0
- package/esm/src/runtime/cluster.d.ts.map +1 -0
- package/esm/src/runtime/cluster.js +887 -0
- package/esm/src/runtime/compose.d.ts +67 -0
- package/esm/src/runtime/compose.d.ts.map +1 -0
- package/esm/src/runtime/compose.js +288 -0
- package/esm/src/runtime/host-dashboard-types.d.ts +79 -0
- package/esm/src/runtime/host-dashboard-types.d.ts.map +1 -0
- package/esm/src/runtime/host-dashboard-types.js +9 -0
- package/esm/src/runtime/host-dashboard.d.ts +29 -0
- package/esm/src/runtime/host-dashboard.d.ts.map +1 -0
- package/esm/src/runtime/host-dashboard.js +559 -0
- package/esm/src/runtime/manifest.d.ts +58 -0
- package/esm/src/runtime/manifest.d.ts.map +1 -0
- package/esm/src/runtime/manifest.js +144 -0
- package/esm/src/runtime/mod.d.ts +18 -0
- package/esm/src/runtime/mod.d.ts.map +1 -0
- package/esm/src/runtime/mod.js +21 -0
- package/esm/src/runtime/template.d.ts +79 -0
- package/esm/src/runtime/template.d.ts.map +1 -0
- package/esm/src/runtime/template.js +287 -0
- package/esm/src/runtime/types.d.ts +345 -0
- package/esm/src/runtime/types.d.ts.map +1 -0
- package/esm/src/runtime/types.js +28 -0
- package/esm/src/sdk/compose-events.d.ts +130 -0
- package/esm/src/sdk/compose-events.d.ts.map +1 -0
- package/esm/src/sdk/compose-events.js +127 -0
- package/esm/src/sdk/composition-validator.d.ts +97 -0
- package/esm/src/sdk/composition-validator.d.ts.map +1 -0
- package/esm/src/sdk/composition-validator.js +178 -0
- package/esm/src/sdk/mcp-sdk.d.ts +92 -0
- package/esm/src/sdk/mcp-sdk.d.ts.map +1 -0
- package/esm/src/sdk/mcp-sdk.js +54 -0
- package/esm/src/sdk/mod.d.ts +15 -0
- package/esm/src/sdk/mod.d.ts.map +1 -0
- package/esm/src/sdk/mod.js +10 -0
- package/esm/src/sdk/ui-meta-builder.d.ts +99 -0
- package/esm/src/sdk/ui-meta-builder.d.ts.map +1 -0
- package/esm/src/sdk/ui-meta-builder.js +53 -0
- package/esm/src/version.d.ts +30 -0
- package/esm/src/version.d.ts.map +1 -0
- package/esm/src/version.js +29 -0
- package/package.json +58 -4
- package/script/_dnt.polyfills.d.ts +18 -0
- package/script/_dnt.polyfills.d.ts.map +1 -0
- package/script/_dnt.polyfills.js +16 -0
- package/script/_dnt.shims.d.ts +2 -0
- package/script/_dnt.shims.d.ts.map +1 -0
- package/script/_dnt.shims.js +60 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts +33 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_chars.js +55 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts +106 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_dumper_state.js +640 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts +67 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_loader_state.js +1397 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts +44 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_schema.js +121 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/binary.js +106 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/bool.js +35 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/float.js +99 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/int.js +162 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/map.js +17 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/merge.js +13 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/nil.js +25 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/omap.js +32 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/pairs.js +22 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/regexp.js +33 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/seq.js +13 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/set.js +17 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/str.js +12 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/timestamp.js +84 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts +3 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type/undefined.js +23 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts +32 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_type.js +7 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts +4 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/_utils.js +18 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts +51 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/mod.js +69 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts +79 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/parse.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/parse.js +95 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts +108 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/stringify.js +36 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/types.d.ts +111 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/1.3.0/types.js +108 -0
- package/script/mod.d.ts +49 -0
- package/script/mod.d.ts.map +1 -0
- package/script/mod.js +60 -0
- package/script/package.json +3 -0
- package/script/src/core/collector/collector.d.ts +58 -0
- package/script/src/core/collector/collector.d.ts.map +1 -0
- package/script/src/core/collector/collector.js +63 -0
- package/script/src/core/collector/extractor.d.ts +33 -0
- package/script/src/core/collector/extractor.d.ts.map +1 -0
- package/script/src/core/collector/extractor.js +56 -0
- package/script/src/core/collector/mod.d.ts +9 -0
- package/script/src/core/collector/mod.d.ts.map +1 -0
- package/script/src/core/collector/mod.js +12 -0
- package/script/src/core/components/components.d.ts +4 -0
- package/script/src/core/components/components.d.ts.map +1 -0
- package/script/src/core/components/components.js +31 -0
- package/script/src/core/components/mod.d.ts +2 -0
- package/script/src/core/components/mod.d.ts.map +1 -0
- package/script/src/core/components/mod.js +5 -0
- package/script/src/core/composer/composer.d.ts +35 -0
- package/script/src/core/composer/composer.d.ts.map +1 -0
- package/script/src/core/composer/composer.js +75 -0
- package/script/src/core/composer/mod.d.ts +7 -0
- package/script/src/core/composer/mod.d.ts.map +1 -0
- package/script/src/core/composer/mod.js +10 -0
- package/script/src/core/mod.d.ts +15 -0
- package/script/src/core/mod.d.ts.map +1 -0
- package/script/src/core/mod.js +30 -0
- package/script/src/core/sync/mod.d.ts +9 -0
- package/script/src/core/sync/mod.d.ts.map +1 -0
- package/script/src/core/sync/mod.js +12 -0
- package/script/src/core/sync/resolver.d.ts +51 -0
- package/script/src/core/sync/resolver.d.ts.map +1 -0
- package/script/src/core/sync/resolver.js +91 -0
- package/script/src/core/sync/validator.d.ts +39 -0
- package/script/src/core/sync/validator.d.ts.map +1 -0
- package/script/src/core/sync/validator.js +68 -0
- package/script/src/core/types/components.d.ts +46 -0
- package/script/src/core/types/components.d.ts.map +1 -0
- package/script/src/core/types/components.js +3 -0
- package/script/src/core/types/descriptor.d.ts +47 -0
- package/script/src/core/types/descriptor.d.ts.map +1 -0
- package/script/src/core/types/descriptor.js +7 -0
- package/script/src/core/types/errors.d.ts +69 -0
- package/script/src/core/types/errors.d.ts.map +1 -0
- package/script/src/core/types/errors.js +35 -0
- package/script/src/core/types/layout.d.ts +100 -0
- package/script/src/core/types/layout.d.ts.map +1 -0
- package/script/src/core/types/layout.js +55 -0
- package/script/src/core/types/mcp-apps.d.ts +56 -0
- package/script/src/core/types/mcp-apps.d.ts.map +1 -0
- package/script/src/core/types/mcp-apps.js +17 -0
- package/script/src/core/types/mod.d.ts +17 -0
- package/script/src/core/types/mod.d.ts.map +1 -0
- package/script/src/core/types/mod.js +15 -0
- package/script/src/core/types/orchestration.d.ts +37 -0
- package/script/src/core/types/orchestration.d.ts.map +1 -0
- package/script/src/core/types/orchestration.js +7 -0
- package/script/src/core/types/resources.d.ts +37 -0
- package/script/src/core/types/resources.d.ts.map +1 -0
- package/script/src/core/types/resources.js +2 -0
- package/script/src/core/types/sync-rules.d.ts +80 -0
- package/script/src/core/types/sync-rules.d.ts.map +1 -0
- package/script/src/core/types/sync-rules.js +7 -0
- package/script/src/deploy/mod.d.ts +12 -0
- package/script/src/deploy/mod.d.ts.map +1 -0
- package/script/src/deploy/mod.js +15 -0
- package/script/src/deploy/types.d.ts +119 -0
- package/script/src/deploy/types.d.ts.map +1 -0
- package/script/src/deploy/types.js +22 -0
- package/script/src/host/components-contract.d.ts +6 -0
- package/script/src/host/components-contract.d.ts.map +1 -0
- package/script/src/host/components-contract.js +8 -0
- package/script/src/host/mod.d.ts +15 -0
- package/script/src/host/mod.d.ts.map +1 -0
- package/script/src/host/mod.js +21 -0
- package/script/src/host/renderer/css/base.d.ts +23 -0
- package/script/src/host/renderer/css/base.d.ts.map +1 -0
- package/script/src/host/renderer/css/base.js +51 -0
- package/script/src/host/renderer/css/layouts.d.ts +31 -0
- package/script/src/host/renderer/css/layouts.d.ts.map +1 -0
- package/script/src/host/renderer/css/layouts.js +132 -0
- package/script/src/host/renderer/html-generator.d.ts +36 -0
- package/script/src/host/renderer/html-generator.d.ts.map +1 -0
- package/script/src/host/renderer/html-generator.js +231 -0
- package/script/src/host/renderer/js/event-bus.d.ts +33 -0
- package/script/src/host/renderer/js/event-bus.d.ts.map +1 -0
- package/script/src/host/renderer/js/event-bus.js +595 -0
- package/script/src/host/renderer/mod.d.ts +9 -0
- package/script/src/host/renderer/mod.d.ts.map +1 -0
- package/script/src/host/renderer/mod.js +12 -0
- package/script/src/host/renderer/options.d.ts +126 -0
- package/script/src/host/renderer/options.d.ts.map +1 -0
- package/script/src/host/renderer/options.js +2 -0
- package/script/src/host/serve.d.ts +55 -0
- package/script/src/host/serve.d.ts.map +1 -0
- package/script/src/host/serve.js +92 -0
- package/script/src/host/types.d.ts +42 -0
- package/script/src/host/types.d.ts.map +1 -0
- package/script/src/host/types.js +10 -0
- package/script/src/runtime/cluster.d.ts +92 -0
- package/script/src/runtime/cluster.d.ts.map +1 -0
- package/script/src/runtime/cluster.js +892 -0
- package/script/src/runtime/compose.d.ts +67 -0
- package/script/src/runtime/compose.d.ts.map +1 -0
- package/script/src/runtime/compose.js +292 -0
- package/script/src/runtime/host-dashboard-types.d.ts +79 -0
- package/script/src/runtime/host-dashboard-types.d.ts.map +1 -0
- package/script/src/runtime/host-dashboard-types.js +10 -0
- package/script/src/runtime/host-dashboard.d.ts +29 -0
- package/script/src/runtime/host-dashboard.d.ts.map +1 -0
- package/script/src/runtime/host-dashboard.js +563 -0
- package/script/src/runtime/manifest.d.ts +58 -0
- package/script/src/runtime/manifest.d.ts.map +1 -0
- package/script/src/runtime/manifest.js +150 -0
- package/script/src/runtime/mod.d.ts +18 -0
- package/script/src/runtime/mod.d.ts.map +1 -0
- package/script/src/runtime/mod.js +41 -0
- package/script/src/runtime/template.d.ts +79 -0
- package/script/src/runtime/template.d.ts.map +1 -0
- package/script/src/runtime/template.js +295 -0
- package/script/src/runtime/types.d.ts +345 -0
- package/script/src/runtime/types.d.ts.map +1 -0
- package/script/src/runtime/types.js +31 -0
- package/script/src/sdk/compose-events.d.ts +130 -0
- package/script/src/sdk/compose-events.d.ts.map +1 -0
- package/script/src/sdk/compose-events.js +154 -0
- package/script/src/sdk/composition-validator.d.ts +97 -0
- package/script/src/sdk/composition-validator.d.ts.map +1 -0
- package/script/src/sdk/composition-validator.js +181 -0
- package/script/src/sdk/mcp-sdk.d.ts +92 -0
- package/script/src/sdk/mcp-sdk.d.ts.map +1 -0
- package/script/src/sdk/mcp-sdk.js +57 -0
- package/script/src/sdk/mod.d.ts +15 -0
- package/script/src/sdk/mod.d.ts.map +1 -0
- package/script/src/sdk/mod.js +18 -0
- package/script/src/sdk/ui-meta-builder.d.ts +99 -0
- package/script/src/sdk/ui-meta-builder.d.ts.map +1 -0
- package/script/src/sdk/ui-meta-builder.js +56 -0
- package/script/src/version.d.ts +30 -0
- package/script/src/version.d.ts.map +1 -0
- package/script/src/version.js +33 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime types for mcp-compose dashboard composition.
|
|
3
|
+
*
|
|
4
|
+
* These types define manifests (static MCP server metadata),
|
|
5
|
+
* dashboard templates (YAML), and the compose request/result contract.
|
|
6
|
+
*
|
|
7
|
+
* @module runtime/types
|
|
8
|
+
*/
|
|
9
|
+
import type { UiLayout } from "../core/types/layout.js";
|
|
10
|
+
import type { UiPortSyncRule, UiSyncRule } from "../core/types/sync-rules.js";
|
|
11
|
+
import type { CompositeUiDescriptor } from "../core/types/descriptor.js";
|
|
12
|
+
import type { ReadResourceResult } from "@modelcontextprotocol/client";
|
|
13
|
+
import type { ComposedDashboardPanel } from "./host-dashboard-types.js";
|
|
14
|
+
import type { ComponentSurface } from "../core/types/components.js";
|
|
15
|
+
/**
|
|
16
|
+
* Stdio transport — the cluster starts the MCP server as a child process.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const transport: StdioTransport = {
|
|
21
|
+
* type: "stdio",
|
|
22
|
+
* command: "deno",
|
|
23
|
+
* args: ["run", "--allow-net", "server.ts"],
|
|
24
|
+
* env: { DATABASE_URL: "postgres://localhost" },
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export interface StdioTransport {
|
|
29
|
+
type: "stdio";
|
|
30
|
+
/** Command to start the server. */
|
|
31
|
+
command: string;
|
|
32
|
+
/** Command arguments. */
|
|
33
|
+
args?: string[];
|
|
34
|
+
/** Environment variables for the process. */
|
|
35
|
+
env?: Record<string, string>;
|
|
36
|
+
/** MCP HTTP protocol used after the process reports its listening URL. */
|
|
37
|
+
protocol?: McpHttpProtocol;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* HTTP transport — connect to an already-running MCP server.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const transport: HttpTransport = {
|
|
45
|
+
* type: "http",
|
|
46
|
+
* url: "http://localhost:3001",
|
|
47
|
+
* };
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export interface HttpTransport {
|
|
51
|
+
type: "http";
|
|
52
|
+
/** Base URL of the running MCP server. */
|
|
53
|
+
url: string;
|
|
54
|
+
/**
|
|
55
|
+
* MCP HTTP protocol to use. `auto` probes the modern stateless protocol
|
|
56
|
+
* first, then falls back to the official Streamable HTTP SDK for legacy
|
|
57
|
+
* servers. Defaults to `auto`.
|
|
58
|
+
*/
|
|
59
|
+
protocol?: McpHttpProtocol;
|
|
60
|
+
}
|
|
61
|
+
/** MCP HTTP protocol selection for a manifest transport. */
|
|
62
|
+
export type McpHttpProtocol = "auto" | "stateless-2026-07-28" | "streamable-http";
|
|
63
|
+
/** Transport configuration for connecting to an MCP server. */
|
|
64
|
+
export type McpTransport = StdioTransport | HttpTransport;
|
|
65
|
+
/**
|
|
66
|
+
* A tool declared by an MCP server in its manifest.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const tool: McpToolDeclaration = {
|
|
71
|
+
* name: "invoice_search",
|
|
72
|
+
* description: "Search invoices",
|
|
73
|
+
* emits: ["invoice.selected"],
|
|
74
|
+
* accepts: ["filter.apply"],
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export interface McpToolDeclaration {
|
|
79
|
+
/** Tool name. */
|
|
80
|
+
name: string;
|
|
81
|
+
/** Human-readable description. */
|
|
82
|
+
description?: string;
|
|
83
|
+
/** JSON Schema for tool arguments. */
|
|
84
|
+
inputSchema?: Record<string, unknown>;
|
|
85
|
+
/** UI events this tool's UI emits. */
|
|
86
|
+
emits?: string[];
|
|
87
|
+
/** UI events this tool's UI accepts. */
|
|
88
|
+
accepts?: string[];
|
|
89
|
+
/** UI resource URI pattern. */
|
|
90
|
+
resourceUri?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Whether an embedded MCP App may invoke this tool through Compose's host
|
|
93
|
+
* bridge. Omitted means deny: interactive capabilities are opt-in per tool.
|
|
94
|
+
*/
|
|
95
|
+
appCallable?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Static manifest describing an MCP server.
|
|
99
|
+
*
|
|
100
|
+
* Generated at build time (no server startup needed).
|
|
101
|
+
* One JSON file per MCP server.
|
|
102
|
+
*
|
|
103
|
+
* @example Stdio (cluster starts the server)
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const manifest: McpManifest = {
|
|
106
|
+
* name: "mcp-einvoice",
|
|
107
|
+
* transport: { type: "stdio", command: "deno", args: ["run", "jsr:@casys/mcp-einvoice", "--http"] },
|
|
108
|
+
* requiredEnv: ["IOPOLE_CLIENT_ID", "IOPOLE_CLIENT_SECRET", "IOPOLE_CUSTOMER_ID"],
|
|
109
|
+
* tools: [{ name: "invoice_search", emits: ["invoice.selected"] }],
|
|
110
|
+
* };
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example HTTP (connect to existing server)
|
|
114
|
+
* ```typescript
|
|
115
|
+
* const manifest: McpManifest = {
|
|
116
|
+
* name: "mcp-einvoice",
|
|
117
|
+
* transport: { type: "http", url: "http://localhost:3001" },
|
|
118
|
+
* tools: [{ name: "invoice_search" }],
|
|
119
|
+
* };
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export interface McpManifest {
|
|
123
|
+
/** Unique server name (used as namespace in sync rules). */
|
|
124
|
+
name: string;
|
|
125
|
+
/** Human-readable description. */
|
|
126
|
+
description?: string;
|
|
127
|
+
/** Transport configuration (stdio or http). */
|
|
128
|
+
transport: McpTransport;
|
|
129
|
+
/** Environment variable names required to run this server (names only, no values). */
|
|
130
|
+
requiredEnv?: string[];
|
|
131
|
+
/** Tools this server exposes. */
|
|
132
|
+
tools: McpToolDeclaration[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Complete result of an MCP `resources/read` request.
|
|
136
|
+
*
|
|
137
|
+
* This aliases the official SDK type so callers retain each resource's MIME
|
|
138
|
+
* type and metadata (including MCP Apps CSP metadata) instead of reducing a
|
|
139
|
+
* resource to HTML text.
|
|
140
|
+
*/
|
|
141
|
+
export type McpReadResourceResult = ReadResourceResult;
|
|
142
|
+
/** A tool returned by MCP `tools/list`, preserving unrecognised fields. */
|
|
143
|
+
export interface McpListedTool {
|
|
144
|
+
name: string;
|
|
145
|
+
[key: string]: unknown;
|
|
146
|
+
}
|
|
147
|
+
/** Complete result of an MCP `tools/list` request. */
|
|
148
|
+
export interface McpListToolsResult {
|
|
149
|
+
tools: McpListedTool[];
|
|
150
|
+
nextCursor?: string;
|
|
151
|
+
_meta?: Record<string, unknown>;
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
/** A resource returned by MCP `resources/list`, preserving unrecognised fields. */
|
|
155
|
+
export interface McpListedResource {
|
|
156
|
+
uri: string;
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
}
|
|
159
|
+
/** Complete result of an MCP `resources/list` request. */
|
|
160
|
+
export interface McpListResourcesResult {
|
|
161
|
+
resources: McpListedResource[];
|
|
162
|
+
nextCursor?: string;
|
|
163
|
+
_meta?: Record<string, unknown>;
|
|
164
|
+
[key: string]: unknown;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* An active MCP server connection.
|
|
168
|
+
*
|
|
169
|
+
* For stdio: wraps the child process.
|
|
170
|
+
* For http: wraps the base URL.
|
|
171
|
+
* Both provide a uiBaseUrl once resolved (from handshake or URL).
|
|
172
|
+
*/
|
|
173
|
+
export interface McpConnection {
|
|
174
|
+
/** Server name from manifest. */
|
|
175
|
+
name: string;
|
|
176
|
+
/** Transport type used. */
|
|
177
|
+
transportType: "stdio" | "http";
|
|
178
|
+
/** Base URL for resolving ui:// resource URIs. */
|
|
179
|
+
uiBaseUrl: string;
|
|
180
|
+
/** Close the connection (kill process or cleanup). */
|
|
181
|
+
close(): Promise<void>;
|
|
182
|
+
/** Call a tool on this server. */
|
|
183
|
+
callTool(toolName: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
184
|
+
/** Read a resource through the server's active MCP transport. */
|
|
185
|
+
readResource(uri: string): Promise<McpReadResourceResult>;
|
|
186
|
+
/** List one page of tools; pass the returned nextCursor to continue. */
|
|
187
|
+
listTools(cursor?: string): Promise<McpListToolsResult>;
|
|
188
|
+
/** List one page of resources; pass the returned nextCursor to continue. */
|
|
189
|
+
listResources(cursor?: string): Promise<McpListResourcesResult>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Manage a cluster of MCP server connections.
|
|
193
|
+
*/
|
|
194
|
+
export interface McpCluster {
|
|
195
|
+
/** Start/connect all servers referenced by the template. */
|
|
196
|
+
startAll(): Promise<void>;
|
|
197
|
+
/** Call a tool on a specific server. */
|
|
198
|
+
callTool(serverName: string, toolName: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
199
|
+
/** Read a resource from a specific server's active MCP transport. */
|
|
200
|
+
readResource(serverName: string, uri: string): Promise<McpReadResourceResult>;
|
|
201
|
+
/** List tools exposed by a specific server. */
|
|
202
|
+
listTools(serverName: string, cursor?: string): Promise<McpListToolsResult>;
|
|
203
|
+
/** List resources exposed by a specific server. */
|
|
204
|
+
listResources(serverName: string, cursor?: string): Promise<McpListResourcesResult>;
|
|
205
|
+
/** Get the uiBaseUrl for a server (for uri resolution). */
|
|
206
|
+
getUiBaseUrl(serverName: string): string | undefined;
|
|
207
|
+
/** Stop all servers. */
|
|
208
|
+
stopAll(): Promise<void>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A tool call within a dashboard source.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const call: TemplateToolCall = {
|
|
216
|
+
* tool: "invoice_search",
|
|
217
|
+
* args: { customer_id: "{{customer_id}}" },
|
|
218
|
+
* };
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
export interface TemplateToolCall {
|
|
222
|
+
/** Stable component identity when one source contains multiple calls. */
|
|
223
|
+
id?: string;
|
|
224
|
+
/** Tool name (bare, scoped to the source's manifest). */
|
|
225
|
+
tool: string;
|
|
226
|
+
/** Static arguments. `{{key}}` placeholders are replaced at compose time. */
|
|
227
|
+
args?: Record<string, unknown>;
|
|
228
|
+
/** Optional call-specific composition of small App-owned components. */
|
|
229
|
+
surface?: ComponentSurface;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* A source MCP server referenced by a dashboard template.
|
|
233
|
+
*/
|
|
234
|
+
export interface TemplateSource {
|
|
235
|
+
/** Short ID for use in layout areas grid. */
|
|
236
|
+
id?: string;
|
|
237
|
+
/** Manifest name (must match an McpManifest.name). */
|
|
238
|
+
manifest: string;
|
|
239
|
+
/** Tools to call on this server. */
|
|
240
|
+
calls: TemplateToolCall[];
|
|
241
|
+
/** Small-component surface inherited by calls in this source. */
|
|
242
|
+
surface?: ComponentSurface;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Dashboard template (canonical JSON or legacy YAML, no runtime args).
|
|
246
|
+
*
|
|
247
|
+
* Defines which MCP servers to start, which tools to call,
|
|
248
|
+
* and how to arrange the resulting UIs.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```yaml
|
|
252
|
+
* name: Sales Dashboard
|
|
253
|
+
* sources:
|
|
254
|
+
* - manifest: mcp-einvoice
|
|
255
|
+
* calls:
|
|
256
|
+
* - tool: invoice_search
|
|
257
|
+
* args: { customer_id: "{{customer_id}}" }
|
|
258
|
+
* orchestration:
|
|
259
|
+
* layout: split
|
|
260
|
+
* sharedContext: [customer_id]
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
export interface DashboardTemplate {
|
|
264
|
+
/** Human-readable dashboard name. */
|
|
265
|
+
name: string;
|
|
266
|
+
/** Source MCP servers and their tool calls. */
|
|
267
|
+
sources: TemplateSource[];
|
|
268
|
+
/** Layout, sync rules, shared context. Maps to UiOrchestration. */
|
|
269
|
+
orchestration: {
|
|
270
|
+
layout: UiLayout;
|
|
271
|
+
sync?: UiSyncRule[];
|
|
272
|
+
portSync?: UiPortSyncRule[];
|
|
273
|
+
sharedContext?: string[];
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Request to compose a dashboard (template + runtime args).
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const request: ComposeRequest = {
|
|
282
|
+
* template,
|
|
283
|
+
* manifests,
|
|
284
|
+
* args: { customer_id: "CUST-001" },
|
|
285
|
+
* };
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export interface ComposeRequest {
|
|
289
|
+
/** Parsed dashboard template. */
|
|
290
|
+
template: DashboardTemplate;
|
|
291
|
+
/** Resolved manifests keyed by name. */
|
|
292
|
+
manifests: Map<string, McpManifest>;
|
|
293
|
+
/** Runtime arguments injected into `{{placeholder}}` values. */
|
|
294
|
+
args?: Record<string, unknown>;
|
|
295
|
+
/** Keep the cluster alive after composition (for serving). Default: false. */
|
|
296
|
+
keepAlive?: boolean;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Result of a compose operation.
|
|
300
|
+
*/
|
|
301
|
+
export interface ComposeResult {
|
|
302
|
+
/** The composite descriptor (from core pipeline). */
|
|
303
|
+
descriptor: CompositeUiDescriptor;
|
|
304
|
+
/** Rendered HTML string. */
|
|
305
|
+
html: string;
|
|
306
|
+
/** Warnings generated during composition. */
|
|
307
|
+
warnings: string[];
|
|
308
|
+
/**
|
|
309
|
+
* Immutable runtime provenance for each collected MCP App panel.
|
|
310
|
+
*
|
|
311
|
+
* Unlike `descriptor.children`, this retains the source server, original
|
|
312
|
+
* `ui://` resource URI, initial CallToolResult, and manifest allow-list
|
|
313
|
+
* needed by a local interactive host. It is captured while the tool call is
|
|
314
|
+
* still associated with its template source; it must never be reconstructed
|
|
315
|
+
* from a URI authority later.
|
|
316
|
+
*/
|
|
317
|
+
panels: readonly ComposedDashboardPanel[];
|
|
318
|
+
/** Cluster handle (only present if keepAlive was true). Call stopAll() when done. */
|
|
319
|
+
cluster?: McpCluster;
|
|
320
|
+
}
|
|
321
|
+
/** Runtime error codes. */
|
|
322
|
+
export declare enum RuntimeErrorCode {
|
|
323
|
+
MANIFEST_PARSE_ERROR = "MANIFEST_PARSE_ERROR",
|
|
324
|
+
TEMPLATE_PARSE_ERROR = "TEMPLATE_PARSE_ERROR",
|
|
325
|
+
MANIFEST_NOT_FOUND = "MANIFEST_NOT_FOUND",
|
|
326
|
+
PROCESS_START_FAILED = "PROCESS_START_FAILED",
|
|
327
|
+
TOOL_CALL_FAILED = "TOOL_CALL_FAILED",
|
|
328
|
+
TOOL_CALL_TIMEOUT = "TOOL_CALL_TIMEOUT",
|
|
329
|
+
TOOL_LIST_FAILED = "TOOL_LIST_FAILED",
|
|
330
|
+
TOOL_LIST_TIMEOUT = "TOOL_LIST_TIMEOUT",
|
|
331
|
+
RESOURCE_READ_FAILED = "RESOURCE_READ_FAILED",
|
|
332
|
+
RESOURCE_READ_TIMEOUT = "RESOURCE_READ_TIMEOUT",
|
|
333
|
+
RESOURCE_LIST_FAILED = "RESOURCE_LIST_FAILED",
|
|
334
|
+
RESOURCE_LIST_TIMEOUT = "RESOURCE_LIST_TIMEOUT",
|
|
335
|
+
PROCESS_DIED = "PROCESS_DIED"
|
|
336
|
+
}
|
|
337
|
+
/** Structured runtime error. */
|
|
338
|
+
export interface RuntimeError {
|
|
339
|
+
code: RuntimeErrorCode;
|
|
340
|
+
message: string;
|
|
341
|
+
server?: string;
|
|
342
|
+
tool?: string;
|
|
343
|
+
cause?: unknown;
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAMpE;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,yBAA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;IACnB;;;;;;;;OAQG;IACH,MAAM,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAC1C,qFAAqF;IACrF,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAMD,2BAA2B;AAC3B,oBAAY,gBAAgB;IAC1B,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,kBAAkB,uBAAuB;IACzC,oBAAoB,yBAAyB;IAC7C,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;IACvC,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,oBAAoB,yBAAyB;IAC7C,qBAAqB,0BAA0B;IAC/C,YAAY,iBAAiB;CAC9B;AAED,gCAAgC;AAChC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime types for mcp-compose dashboard composition.
|
|
3
|
+
*
|
|
4
|
+
* These types define manifests (static MCP server metadata),
|
|
5
|
+
* dashboard templates (YAML), and the compose request/result contract.
|
|
6
|
+
*
|
|
7
|
+
* @module runtime/types
|
|
8
|
+
*/
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// Error types
|
|
11
|
+
// =============================================================================
|
|
12
|
+
/** Runtime error codes. */
|
|
13
|
+
export var RuntimeErrorCode;
|
|
14
|
+
(function (RuntimeErrorCode) {
|
|
15
|
+
RuntimeErrorCode["MANIFEST_PARSE_ERROR"] = "MANIFEST_PARSE_ERROR";
|
|
16
|
+
RuntimeErrorCode["TEMPLATE_PARSE_ERROR"] = "TEMPLATE_PARSE_ERROR";
|
|
17
|
+
RuntimeErrorCode["MANIFEST_NOT_FOUND"] = "MANIFEST_NOT_FOUND";
|
|
18
|
+
RuntimeErrorCode["PROCESS_START_FAILED"] = "PROCESS_START_FAILED";
|
|
19
|
+
RuntimeErrorCode["TOOL_CALL_FAILED"] = "TOOL_CALL_FAILED";
|
|
20
|
+
RuntimeErrorCode["TOOL_CALL_TIMEOUT"] = "TOOL_CALL_TIMEOUT";
|
|
21
|
+
RuntimeErrorCode["TOOL_LIST_FAILED"] = "TOOL_LIST_FAILED";
|
|
22
|
+
RuntimeErrorCode["TOOL_LIST_TIMEOUT"] = "TOOL_LIST_TIMEOUT";
|
|
23
|
+
RuntimeErrorCode["RESOURCE_READ_FAILED"] = "RESOURCE_READ_FAILED";
|
|
24
|
+
RuntimeErrorCode["RESOURCE_READ_TIMEOUT"] = "RESOURCE_READ_TIMEOUT";
|
|
25
|
+
RuntimeErrorCode["RESOURCE_LIST_FAILED"] = "RESOURCE_LIST_FAILED";
|
|
26
|
+
RuntimeErrorCode["RESOURCE_LIST_TIMEOUT"] = "RESOURCE_LIST_TIMEOUT";
|
|
27
|
+
RuntimeErrorCode["PROCESS_DIED"] = "PROCESS_DIED";
|
|
28
|
+
})(RuntimeErrorCode || (RuntimeErrorCode = {}));
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI-side helpers for cross-UI event routing via mcp-compose.
|
|
3
|
+
*
|
|
4
|
+
* Uses a dedicated `ui/compose/event` JSON-RPC method, separate from
|
|
5
|
+
* the MCP Apps protocol. No dependency on `@modelcontextprotocol/ext-apps`.
|
|
6
|
+
*
|
|
7
|
+
* Works alongside the MCP Apps `App` class without interfering —
|
|
8
|
+
* each protocol has its own channel.
|
|
9
|
+
*
|
|
10
|
+
* @module sdk/compose-events
|
|
11
|
+
*/
|
|
12
|
+
export declare const COMPOSE_EVENT_METHOD = "ui/compose/event";
|
|
13
|
+
/**
|
|
14
|
+
* Payload received by an `on()` handler.
|
|
15
|
+
*/
|
|
16
|
+
export interface ComposeEventPayload {
|
|
17
|
+
/** The data sent by the emitting UI. */
|
|
18
|
+
data: unknown;
|
|
19
|
+
/** Slot index of the source UI. */
|
|
20
|
+
sourceSlot?: number;
|
|
21
|
+
/** Shared context from the composition. */
|
|
22
|
+
sharedContext?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Handler function for incoming compose events.
|
|
26
|
+
*/
|
|
27
|
+
export type ComposeEventHandler = (payload: ComposeEventPayload) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Compose events interface returned by `composeEvents()`.
|
|
30
|
+
*/
|
|
31
|
+
export interface ComposeEvents {
|
|
32
|
+
/**
|
|
33
|
+
* Emit an event to other UIs via the mcp-compose event bus.
|
|
34
|
+
*
|
|
35
|
+
* Sends a `ui/compose/event` JSON-RPC message to the parent frame.
|
|
36
|
+
* The event bus routes it to target UIs based on matching sync rules.
|
|
37
|
+
*
|
|
38
|
+
* @param event - Event name (must match a declared `emits` value)
|
|
39
|
+
* @param data - Arbitrary data payload
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* events.emit("invoice.selected", { invoiceId: "INV-001" });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
emit(event: string, data?: unknown): void;
|
|
47
|
+
/**
|
|
48
|
+
* Listen for an incoming action routed by the mcp-compose event bus.
|
|
49
|
+
*
|
|
50
|
+
* @param action - Action name (must match a declared `accepts` value)
|
|
51
|
+
* @param handler - Callback invoked when the action is received
|
|
52
|
+
* @returns Unsubscribe function
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* const off = events.on("filter.apply", (payload) => {
|
|
57
|
+
* applyFilter(payload.data);
|
|
58
|
+
* });
|
|
59
|
+
* // Later: off() to stop listening
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
on(action: string, handler: ComposeEventHandler): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* Stop listening to all compose events and clean up the message listener.
|
|
65
|
+
*/
|
|
66
|
+
destroy(): void;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Minimal interface for the parent window (for testability).
|
|
70
|
+
* In the browser, pass `window.parent`.
|
|
71
|
+
*/
|
|
72
|
+
export interface ComposeTarget {
|
|
73
|
+
postMessage(message: unknown, targetOrigin: string): void;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Minimal interface for the event source (for testability).
|
|
77
|
+
* In the browser, pass `window`.
|
|
78
|
+
*/
|
|
79
|
+
export interface ComposeSource {
|
|
80
|
+
addEventListener(type: "message", listener: (e: MessageEvent) => void): void;
|
|
81
|
+
removeEventListener(type: "message", listener: (e: MessageEvent) => void): void;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a compose events channel for cross-UI communication.
|
|
85
|
+
*
|
|
86
|
+
* Uses a dedicated `ui/compose/event` JSON-RPC method via postMessage,
|
|
87
|
+
* completely separate from the MCP Apps protocol. The MCP Apps `App`
|
|
88
|
+
* instance handles standard protocol methods; `composeEvents` handles
|
|
89
|
+
* composition events. No interference between the two.
|
|
90
|
+
*
|
|
91
|
+
* @param parent - The parent window to send messages to (default: `window.parent`)
|
|
92
|
+
* @param source - The window to listen on (default: `window`)
|
|
93
|
+
* @returns Compose events interface with `emit`, `on`, and `destroy` methods
|
|
94
|
+
*
|
|
95
|
+
* @example Browser usage
|
|
96
|
+
* ```typescript
|
|
97
|
+
* import { composeEvents } from "@mcpview/compose/sdk";
|
|
98
|
+
*
|
|
99
|
+
* const events = composeEvents();
|
|
100
|
+
*
|
|
101
|
+
* // Emit when user selects an invoice
|
|
102
|
+
* events.emit("invoice.selected", { invoiceId: "INV-001" });
|
|
103
|
+
*
|
|
104
|
+
* // Listen for filter actions from other UIs
|
|
105
|
+
* events.on("filter.apply", (payload) => {
|
|
106
|
+
* applyFilter(payload.data);
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* // Cleanup when done
|
|
110
|
+
* events.destroy();
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @example With MCP Apps App (no conflict)
|
|
114
|
+
* ```typescript
|
|
115
|
+
* import { App } from "@modelcontextprotocol/ext-apps";
|
|
116
|
+
* import { composeEvents } from "@mcpview/compose/sdk";
|
|
117
|
+
*
|
|
118
|
+
* // MCP Apps — standard protocol
|
|
119
|
+
* const app = new App({ name: "Invoice Viewer", version: "1.0.0" });
|
|
120
|
+
* await app.connect();
|
|
121
|
+
* app.ontoolresult = (result) => hydrateData(result);
|
|
122
|
+
*
|
|
123
|
+
* // Compose — separate channel, no interference
|
|
124
|
+
* const events = composeEvents();
|
|
125
|
+
* events.emit("invoice.selected", { id: "INV-001" });
|
|
126
|
+
* events.on("filter.apply", (p) => applyFilter(p.data));
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function composeEvents(parent?: ComposeTarget, source?: ComposeSource): ComposeEvents;
|
|
130
|
+
//# sourceMappingURL=compose-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-events.d.ts","sourceRoot":"","sources":["../../../src/src/sdk/compose-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,wCAAwC;IACxC,IAAI,EAAE,OAAO,CAAC;IACd,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1C;;;;;;;;;;;;;;OAcG;IACH,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI,CAAC;IAE7D;;OAEG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3D;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,GAAG,IAAI,CAAC;IAC7E,mBAAmB,CACjB,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,CAAC,CAAC,EAAE,YAAY,KAAK,IAAI,GAClC,IAAI,CAAC;CACT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,aAAa,CAC3B,MAAM,CAAC,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,aAAa,GACrB,aAAa,CA6Ef"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI-side helpers for cross-UI event routing via mcp-compose.
|
|
3
|
+
*
|
|
4
|
+
* Uses a dedicated `ui/compose/event` JSON-RPC method, separate from
|
|
5
|
+
* the MCP Apps protocol. No dependency on `@modelcontextprotocol/ext-apps`.
|
|
6
|
+
*
|
|
7
|
+
* Works alongside the MCP Apps `App` class without interfering —
|
|
8
|
+
* each protocol has its own channel.
|
|
9
|
+
*
|
|
10
|
+
* @module sdk/compose-events
|
|
11
|
+
*/
|
|
12
|
+
/** JSON-RPC method for compose events. */
|
|
13
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
14
|
+
export const COMPOSE_EVENT_METHOD = "ui/compose/event";
|
|
15
|
+
/**
|
|
16
|
+
* Create a compose events channel for cross-UI communication.
|
|
17
|
+
*
|
|
18
|
+
* Uses a dedicated `ui/compose/event` JSON-RPC method via postMessage,
|
|
19
|
+
* completely separate from the MCP Apps protocol. The MCP Apps `App`
|
|
20
|
+
* instance handles standard protocol methods; `composeEvents` handles
|
|
21
|
+
* composition events. No interference between the two.
|
|
22
|
+
*
|
|
23
|
+
* @param parent - The parent window to send messages to (default: `window.parent`)
|
|
24
|
+
* @param source - The window to listen on (default: `window`)
|
|
25
|
+
* @returns Compose events interface with `emit`, `on`, and `destroy` methods
|
|
26
|
+
*
|
|
27
|
+
* @example Browser usage
|
|
28
|
+
* ```typescript
|
|
29
|
+
* import { composeEvents } from "@mcpview/compose/sdk";
|
|
30
|
+
*
|
|
31
|
+
* const events = composeEvents();
|
|
32
|
+
*
|
|
33
|
+
* // Emit when user selects an invoice
|
|
34
|
+
* events.emit("invoice.selected", { invoiceId: "INV-001" });
|
|
35
|
+
*
|
|
36
|
+
* // Listen for filter actions from other UIs
|
|
37
|
+
* events.on("filter.apply", (payload) => {
|
|
38
|
+
* applyFilter(payload.data);
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Cleanup when done
|
|
42
|
+
* events.destroy();
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @example With MCP Apps App (no conflict)
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { App } from "@modelcontextprotocol/ext-apps";
|
|
48
|
+
* import { composeEvents } from "@mcpview/compose/sdk";
|
|
49
|
+
*
|
|
50
|
+
* // MCP Apps — standard protocol
|
|
51
|
+
* const app = new App({ name: "Invoice Viewer", version: "1.0.0" });
|
|
52
|
+
* await app.connect();
|
|
53
|
+
* app.ontoolresult = (result) => hydrateData(result);
|
|
54
|
+
*
|
|
55
|
+
* // Compose — separate channel, no interference
|
|
56
|
+
* const events = composeEvents();
|
|
57
|
+
* events.emit("invoice.selected", { id: "INV-001" });
|
|
58
|
+
* events.on("filter.apply", (p) => applyFilter(p.data));
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export function composeEvents(parent, source) {
|
|
62
|
+
const handlers = new Map();
|
|
63
|
+
let nextId = 1;
|
|
64
|
+
// Resolve parent/source — use globals only when available (browser)
|
|
65
|
+
const _parent = parent ??
|
|
66
|
+
("parent" in dntShim.dntGlobalThis
|
|
67
|
+
? dntShim.dntGlobalThis.parent
|
|
68
|
+
: undefined);
|
|
69
|
+
const _source = source ??
|
|
70
|
+
("addEventListener" in dntShim.dntGlobalThis ? dntShim.dntGlobalThis : undefined);
|
|
71
|
+
// Message listener for incoming compose events
|
|
72
|
+
const onMessage = (e) => {
|
|
73
|
+
const msg = e.data;
|
|
74
|
+
if (!msg || typeof msg !== "object")
|
|
75
|
+
return;
|
|
76
|
+
if (msg.jsonrpc !== "2.0")
|
|
77
|
+
return;
|
|
78
|
+
if (msg.method !== COMPOSE_EVENT_METHOD)
|
|
79
|
+
return;
|
|
80
|
+
const params = msg.params;
|
|
81
|
+
if (!params || typeof params.action !== "string")
|
|
82
|
+
return;
|
|
83
|
+
const actionHandlers = handlers.get(params.action);
|
|
84
|
+
if (!actionHandlers)
|
|
85
|
+
return;
|
|
86
|
+
const payload = {
|
|
87
|
+
data: params.data,
|
|
88
|
+
sourceSlot: params.sourceSlot,
|
|
89
|
+
sharedContext: params.sharedContext,
|
|
90
|
+
};
|
|
91
|
+
for (const handler of actionHandlers) {
|
|
92
|
+
handler(payload);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
_source?.addEventListener("message", onMessage);
|
|
96
|
+
return {
|
|
97
|
+
emit(event, data) {
|
|
98
|
+
if (!_parent) {
|
|
99
|
+
throw new Error("[mcp-compose] No parent window available. composeEvents() must run inside an iframe.");
|
|
100
|
+
}
|
|
101
|
+
_parent.postMessage({
|
|
102
|
+
jsonrpc: "2.0",
|
|
103
|
+
method: COMPOSE_EVENT_METHOD,
|
|
104
|
+
id: nextId++,
|
|
105
|
+
params: { event, data },
|
|
106
|
+
}, "*");
|
|
107
|
+
},
|
|
108
|
+
on(action, handler) {
|
|
109
|
+
if (!handlers.has(action)) {
|
|
110
|
+
handlers.set(action, new Set());
|
|
111
|
+
}
|
|
112
|
+
handlers.get(action).add(handler);
|
|
113
|
+
return () => {
|
|
114
|
+
const set = handlers.get(action);
|
|
115
|
+
if (set) {
|
|
116
|
+
set.delete(handler);
|
|
117
|
+
if (set.size === 0)
|
|
118
|
+
handlers.delete(action);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
destroy() {
|
|
123
|
+
_source?.removeEventListener("message", onMessage);
|
|
124
|
+
handlers.clear();
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
}
|