dal-code 1.0.8 → 1.0.10
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 +39 -53
- package/dist/core/keybindings.d.ts +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +85 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +19 -14
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +28 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +7 -3
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +20 -5
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +5 -6
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -21
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/node_modules/@dalcode/dal-bridge/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-gateway/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-guard/package.json +5 -5
- package/dist/node_modules/@dalcode/dal-halo/package.json +2 -2
- package/dist/node_modules/@dalcode/dal-lang/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-lsp/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-mcp/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-office/package.json +3 -3
- package/dist/node_modules/@dalcode/dal-pi-kit/package.json +1 -1
- package/dist/node_modules/@dalcode/dal-skills/package.json +4 -4
- package/dist/node_modules/@dalcode/dal-subagent/package.json +6 -6
- package/dist/node_modules/@dalcode/dal-telemetry/package.json +3 -3
- package/dist/node_modules/@dalcode/deepailab/package.json +4 -4
- package/dist/node_modules/@earendil-works/chord/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/chord/README.md +205 -0
- package/dist/node_modules/@earendil-works/chord/dist/api.d.ts +15 -0
- package/dist/node_modules/@earendil-works/chord/dist/api.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/api.js +72 -0
- package/dist/node_modules/@earendil-works/chord/dist/api.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/bundler.d.ts +6 -0
- package/dist/node_modules/@earendil-works/chord/dist/bundler.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/bundler.js +3 -0
- package/dist/node_modules/@earendil-works/chord/dist/bundler.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.d.ts +24 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.js +97 -0
- package/dist/node_modules/@earendil-works/chord/dist/context/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.d.ts +119 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.js +1906 -0
- package/dist/node_modules/@earendil-works/chord/dist/delta/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/host.d.ts +12 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/host.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/host.js +763 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/host.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/loader.d.ts +3 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/loader.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/loader.js +5 -0
- package/dist/node_modules/@earendil-works/chord/dist/facets/loader.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.d.ts +11 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.js +10 -0
- package/dist/node_modules/@earendil-works/chord/dist/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.d.ts +4 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.js +57 -0
- package/dist/node_modules/@earendil-works/chord/dist/json.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts +30 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.js +377 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle-loader.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle.d.ts +26 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle.js +183 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/bundle.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/manifest.d.ts +36 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/manifest.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/manifest.js +6 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/manifest.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/package.d.ts +15 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/package.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/package.js +199 -0
- package/dist/node_modules/@earendil-works/chord/dist/node/package.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node.d.ts +5 -0
- package/dist/node_modules/@earendil-works/chord/dist/node.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/node.js +3 -0
- package/dist/node_modules/@earendil-works/chord/dist/node.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/consumer.d.ts +11 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/consumer.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/consumer.js +537 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/consumer.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.d.ts +8 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.js +22 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/errors.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/handle.d.ts +15 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/handle.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/handle.js +99 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/handle.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/instances.d.ts +25 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/instances.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/instances.js +137 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/instances.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/loopback.d.ts +5 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/loopback.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/loopback.js +15 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/loopback.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.d.ts +37 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.js +472 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/provider.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts +15 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.js +115 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-codec.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts +11 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.js +10 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state-internals.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state.d.ts +23 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state.js +124 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/state.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.d.ts +60 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.js +173 -0
- package/dist/node_modules/@earendil-works/chord/dist/services/wire.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.d.ts +203 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.js +2 -0
- package/dist/node_modules/@earendil-works/chord/dist/types.js.map +1 -0
- package/dist/node_modules/@earendil-works/chord/package.json +62 -0
- package/dist/node_modules/@earendil-works/chord/src/delta/README.md +404 -0
- package/dist/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/dist/node_modules/@earendil-works/pi-ai/README.md +3 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +15 -6
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +9 -66
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts +12 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +50 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +13 -58
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +5 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +6 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +30 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +34 -4
- package/dist/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts +4 -2
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +8 -3
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +2 -0
- package/dist/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/dist/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-client/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-protocol/package.json +2 -2
- package/dist/node_modules/@earendil-works/pi-server/CHANGELOG.md +57 -0
- package/dist/node_modules/@earendil-works/pi-server/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-server/README.md +79 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.js +136 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/cli.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/config.d.ts +12 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/config.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/config.js +55 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/config.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/connection.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/connection.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/connection.js +4 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/connection.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/errors.d.ts +25 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/errors.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/errors.js +41 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/errors.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.d.ts +14 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.js +105 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/handler.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/index.js +5 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.js +56 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/client.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.d.ts +99 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.js +12 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/protocol.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.js +145 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/ipc/server.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/listener.d.ts +8 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/listener.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/listener.js +2 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/listener.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.d.ts +22 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.js +266 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/protocol.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.d.ts +36 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.js +360 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/radius.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.d.ts +31 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.js +168 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/rpc-process.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.d.ts +2 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.js +70 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/serve.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/server.d.ts +46 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/server.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/server.js +549 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/server.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/session-router.d.ts +40 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/session-router.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/session-router.js +264 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/session-router.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.d.ts +2195 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.js +332 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/sessions.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.js +39 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/snapshots.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.d.ts +10 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.js +58 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/storage.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.js +290 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/supervisor.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.js +138 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/client.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.d.ts +57 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.js +189 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/host.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.js +4 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.d.ts +13 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.js +17 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/server.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.d.ts +66 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.js +254 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/testing/service.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.js +9 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/address.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.js +4 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.js +421 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/listener.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.js +22 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/preset.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.js +2 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/transports/unix/types.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/types.d.ts +49 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/types.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/types.js +2 -0
- package/dist/node_modules/@earendil-works/pi-server/dist/types.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-server/package.json +45 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/CHANGELOG.md +46 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/LICENSE +21 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/README.md +33 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/index.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/index.js +103 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.js +70 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/branch-cache.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/index.d.ts +5 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/index.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/index.js +4 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/index.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/migrations/001_initial.sql +121 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/migrations.d.ts +3 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/migrations.js +7 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/migrations.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/repo.d.ts +41 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/repo.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/repo.js +408 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/repo.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.d.ts +14 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.js +153 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/search-backend.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/branch-entries.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/branch-entries.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/branch-entries.js +213 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/branch-entries.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/entries.d.ts +24 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/entries.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/entries.js +126 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/entries.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-row.d.ts +23 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-row.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-row.js +69 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-row.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-sequences.d.ts +4 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-sequences.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-sequences.js +13 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-sequences.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-stats.d.ts +6 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-stats.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-stats.js +39 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/session-stats.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/usage-ledger.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/usage-ledger.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/usage-ledger.js +50 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/usage-ledger.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/values.d.ts +23 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/values.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/values.js +91 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session/values.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session.d.ts +42 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session.js +163 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/session.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/sql.d.ts +19 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/sql.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/sql.js +58 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/sql.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.d.ts +41 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.js +112 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-entries.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.js +22 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/branch-tips.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.d.ts +34 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.js +37 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/entries.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.d.ts +20 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.js +38 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/facts.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.d.ts +35 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.js +95 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/lanes.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.js +49 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/records.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.d.ts +7 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.js +22 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-sequences.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.d.ts +17 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.js +40 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/session-stats.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.d.ts +26 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.js +99 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/sessions.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.d.ts +15 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.js +31 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage/writer-leases.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage.d.ts +38 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage.js +161 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/storage.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/types.d.ts +29 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/types.d.ts.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/types.js +2 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/dist/sqlite/types.js.map +1 -0
- package/dist/node_modules/@earendil-works/pi-session-backend-sqlite-node/package.json +33 -0
- package/dist/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/dist/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/official/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/plugins/pi-example-plugin/package.json +1 -1
- package/npm-shrinkwrap.json +3 -14
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.js","sourceRoot":"","sources":["../../src/services/consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAe3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAA+B,MA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import { awaitWithContext, BACKGROUND_CONTEXT } from \"../context/index.ts\";\nimport type { Op } from \"../delta/index.ts\";\nimport type {\n\tContext,\n\tJsonValue,\n\tRemoteServiceBinding,\n\tRemoteServiceBindingOptions,\n\tRemoteServiceTransport,\n\tService,\n\tServiceInstanceAddress,\n\tServiceInstanceSnapshot,\n\tServiceMemberSnapshot,\n\tServiceProviderUpdate,\n\tServiceSubscription,\n} from \"../types.ts\";\nimport { RemoteServiceError } from \"./errors.ts\";\nimport { ServiceSlot } from \"./handle.ts\";\nimport { InstanceDirectory, type InstanceDirectoryEntry } from \"./instances.ts\";\nimport { ReplicatedStateReplica, serviceDeliveryContext } from \"./state.ts\";\n\ntype ErrorReporter = (error: Error) => void;\ntype ServiceMemberKind = ServiceMemberSnapshot[\"kind\"];\n\nclass MemberSlot {\n\treadonly #serviceId: string;\n\treadonly #member: string;\n\treadonly #invoke: (args: readonly JsonValue[], context: Context) => Promise<JsonValue | undefined>;\n\treadonly #state: ReplicatedStateReplica;\n\treadonly #isActive: () => boolean;\n\treadonly #assertAccess: () => void;\n\treadonly value: unknown;\n\t#kind: ServiceMemberKind | undefined;\n\t#expectedKind: ServiceMemberKind | undefined;\n\n\tconstructor(\n\t\tserviceId: string,\n\t\tmember: string,\n\t\tinvoke: (args: readonly JsonValue[], context: Context) => Promise<JsonValue | undefined>,\n\t\tisActive: () => boolean,\n\t\tassertAccess: () => void,\n\t\treportError: ErrorReporter,\n\t) {\n\t\tthis.#serviceId = serviceId;\n\t\tthis.#member = member;\n\t\tthis.#invoke = invoke;\n\t\tthis.#isActive = isActive;\n\t\tthis.#assertAccess = assertAccess;\n\t\tthis.#state = new ReplicatedStateReplica(reportError);\n\t\tconst callable = (): void => {};\n\t\tthis.value = new Proxy(callable, {\n\t\t\tapply: (_target, _thisArg, args) => this.#call(args),\n\t\t\tget: (_target, property) => {\n\t\t\t\tif (property === \"value\") {\n\t\t\t\t\tthis.#assertAccess();\n\t\t\t\t\tthis.#expect(\"state\");\n\t\t\t\t\treturn this.#state.value;\n\t\t\t\t}\n\t\t\t\tif (property === \"subscribe\") return this.#subscribe.bind(this);\n\t\t\t\tif (property === Symbol.toStringTag) return \"RemoteServiceMember\";\n\t\t\t\tif (property === \"then\") return undefined;\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\t}\n\n\tsetDescription(kind: ServiceMemberKind): void {\n\t\tif (this.#kind !== undefined && this.#kind !== kind) {\n\t\t\tthrow new Error(`Remote service member ${this.#serviceId}.${this.#member} changed kind`);\n\t\t}\n\t\tthis.#kind = kind;\n\t\tif (this.#expectedKind !== undefined && this.#expectedKind !== kind) {\n\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\"service_member_mismatch\",\n\t\t\t\t`Remote service member ${this.#serviceId}.${this.#member} is ${kind}, not ${this.#expectedKind}`,\n\t\t\t);\n\t\t}\n\t}\n\n\thydrate(sequence: number, ops: readonly Op[], context: Context): void {\n\t\tthis.setDescription(\"state\");\n\t\tthis.#state.hydrate(sequence, ops, context);\n\t}\n\n\tupdate(sequence: number, ops: readonly Op[], context: Context): void {\n\t\tthis.setDescription(\"state\");\n\t\tthis.#state.update(sequence, ops, context);\n\t}\n\n\tclear(): void {\n\t\tthis.#state.clear();\n\t}\n\n\t#subscribe(listener: (value: JsonValue, context: Context) => void): () => void {\n\t\tthis.#assertAccess();\n\t\tif (typeof listener !== \"function\") {\n\t\t\tthrow new TypeError(\"Replicated state subscription listener must be a function\");\n\t\t}\n\t\tthis.#expect(\"state\");\n\t\treturn this.#state.subscribe(listener);\n\t}\n\n\t#expect(kind: ServiceMemberKind): void {\n\t\tif (this.#expectedKind !== undefined && this.#expectedKind !== kind) {\n\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\"service_member_mismatch\",\n\t\t\t\t`Remote service member ${this.#serviceId}.${this.#member} was used as two different kinds`,\n\t\t\t);\n\t\t}\n\t\tthis.#expectedKind = kind;\n\t\tif (this.#kind !== undefined && this.#kind !== kind) {\n\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\"service_member_mismatch\",\n\t\t\t\t`Remote service member ${this.#serviceId}.${this.#member} is ${this.#kind}, not ${kind}`,\n\t\t\t);\n\t\t}\n\t}\n\n\t#call(args: unknown[]): Promise<JsonValue | undefined> {\n\t\tthis.#assertAccess();\n\t\tthis.#expect(\"method\");\n\t\tif (!this.#isActive()) {\n\t\t\treturn Promise.reject(\n\t\t\t\tnew RemoteServiceError(\"service_stale_instance\", `Remote service ${this.#serviceId} binding is closed`),\n\t\t\t);\n\t\t}\n\t\tconst context = args.at(-1);\n\t\tif (!isContext(context)) {\n\t\t\treturn Promise.reject(\n\t\t\t\tnew RemoteServiceError(\n\t\t\t\t\t\"service_invalid_value\",\n\t\t\t\t\t`Remote service method ${this.#serviceId}.${this.#member} requires a trailing Context`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tconst businessArgs = args.slice(0, -1) as JsonValue[];\n\t\treturn this.#invoke(businessArgs, context);\n\t}\n}\n\nclass ServiceFacade {\n\treadonly #serviceId: string;\n\treadonly #address: ServiceInstanceAddress | undefined;\n\treadonly #transport: RemoteServiceTransport;\n\treadonly #reportError: ErrorReporter;\n\treadonly #slots = new Map<string, MemberSlot>();\n\treadonly #descriptions = new Map<string, ServiceMemberKind>();\n\treadonly #isActive: () => boolean;\n\treadonly #assertAccess: () => void;\n\treadonly proxy: object;\n\n\tconstructor(\n\t\tserviceId: string,\n\t\taddress: ServiceInstanceAddress | undefined,\n\t\ttransport: RemoteServiceTransport,\n\t\tisActive: () => boolean,\n\t\tassertAccess: () => void,\n\t\treportError: ErrorReporter,\n\t) {\n\t\tthis.#serviceId = serviceId;\n\t\tthis.#address = address;\n\t\tthis.#transport = transport;\n\t\tthis.#isActive = isActive;\n\t\tthis.#assertAccess = assertAccess;\n\t\tthis.#reportError = reportError;\n\t\tthis.proxy = new Proxy(Object.create(null) as object, {\n\t\t\tget: (_target, property) => {\n\t\t\t\tif (typeof property !== \"string\") return undefined;\n\t\t\t\treturn this.#slot(property).value;\n\t\t\t},\n\t\t});\n\t}\n\n\tinstall(snapshot: ServiceInstanceSnapshot, context: Context): void {\n\t\tif (!sameAddress(snapshot.instance, this.#address))\n\t\t\tthrow new Error(\"Remote service snapshot has the wrong address\");\n\t\tconst members = validateMembers(snapshot.members);\n\t\tfor (const name of this.#slots.keys()) {\n\t\t\tif (!members.has(name)) {\n\t\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\t\"service_member_not_found\",\n\t\t\t\t\t`Unknown remote service member ${this.#serviceId}.${name}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tthis.#descriptions.clear();\n\t\tfor (const [name, member] of members) this.#descriptions.set(name, member.kind);\n\t\tfor (const member of members.values()) {\n\t\t\tconst slot = this.#slots.get(member.name);\n\t\t\tif (member.kind === \"state\") {\n\t\t\t\t(slot ?? this.#slot(member.name)).hydrate(member.sequence, member.ops, context);\n\t\t\t} else {\n\t\t\t\tslot?.setDescription(member.kind);\n\t\t\t}\n\t\t}\n\t}\n\n\tupdate(member: string, sequence: number, ops: readonly Op[], context: Context): void {\n\t\tif (this.#descriptions.get(member) !== \"state\") {\n\t\t\tthrow new Error(`Remote service update targets non-state member ${this.#serviceId}.${member}`);\n\t\t}\n\t\tthis.#slot(member).update(sequence, ops, context);\n\t}\n\n\tclear(): void {\n\t\tfor (const slot of this.#slots.values()) slot.clear();\n\t}\n\n\t#slot(member: string): MemberSlot {\n\t\tlet slot = this.#slots.get(member);\n\t\tif (slot !== undefined) return slot;\n\t\tslot = new MemberSlot(\n\t\t\tthis.#serviceId,\n\t\t\tmember,\n\t\t\t(args, context) =>\n\t\t\t\tthis.#transport.invoke(\n\t\t\t\t\t{\n\t\t\t\t\t\tserviceId: this.#serviceId,\n\t\t\t\t\t\t...(this.#address === undefined ? {} : { instance: this.#address }),\n\t\t\t\t\t\tmember,\n\t\t\t\t\t\targs,\n\t\t\t\t\t},\n\t\t\t\t\tcontext,\n\t\t\t\t),\n\t\t\tthis.#isActive,\n\t\t\tthis.#assertAccess,\n\t\t\tthis.#reportError,\n\t\t);\n\t\tconst kind = this.#descriptions.get(member);\n\t\tif (kind !== undefined) slot.setDescription(kind);\n\t\tthis.#slots.set(member, slot);\n\t\treturn slot;\n\t}\n}\n\ninterface SingletonBinding {\n\tfacade: ServiceFacade;\n\tsubscription?: ServiceSubscription;\n\tstarting?: Promise<void>;\n\tactive: boolean;\n\trevision: number;\n}\n\ninterface KeyedInstance extends InstanceDirectoryEntry {\n\treadonly facade: ServiceFacade;\n}\n\nclass KeyedBinding<T> {\n\treadonly #service: Service<T>;\n\treadonly #transport: RemoteServiceTransport;\n\treadonly #reportError: ErrorReporter;\n\treadonly #assertAccess: () => void;\n\treadonly #onEmpty: () => void;\n\treadonly #instances: InstanceDirectory<KeyedInstance>;\n\t#subscription: ServiceSubscription | undefined;\n\t#starting: Promise<void> | undefined;\n\t#closed = false;\n\t#bound: boolean;\n\t#revision = 0;\n\n\tconstructor(\n\t\tservice: Service<T>,\n\t\ttransport: RemoteServiceTransport,\n\t\treportError: ErrorReporter,\n\t\tassertAccess: () => void,\n\t\tonEmpty: () => void,\n\t\tbound: boolean,\n\t) {\n\t\tthis.#service = service;\n\t\tthis.#transport = transport;\n\t\tthis.#reportError = reportError;\n\t\tthis.#assertAccess = assertAccess;\n\t\tthis.#onEmpty = onEmpty;\n\t\tthis.#bound = bound;\n\t\tthis.#instances = new InstanceDirectory({ ready: false, onError: reportError });\n\t}\n\n\tobserve(handler: (service: T, context: Context) => void | Promise<void>): () => void {\n\t\tif (this.#closed) throw new Error(\"Remote keyed service binding is closed\");\n\t\tlet stopped = false;\n\t\tconst stop = this.#instances.observe<T>((service, context) => {\n\t\t\tconst slot = new ServiceSlot(this.#service.id, true);\n\t\t\tvoid slot.bind(service as object);\n\t\t\treturn handler(\n\t\t\t\tslot.view<T>(() => {\n\t\t\t\t\tthis.#assertAccess();\n\t\t\t\t\tif (stopped || context.abortSignal?.aborted) {\n\t\t\t\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\t\t\t\"service_stale_instance\",\n\t\t\t\t\t\t\t`Remote service ${this.#service.id} observation is closed`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t\tcontext,\n\t\t\t);\n\t\t});\n\t\tif (this.#bound && this.#starting === undefined) {\n\t\t\tconst revision = this.#revision;\n\t\t\tconst starting = this.#start(revision);\n\t\t\tthis.#starting = starting;\n\t\t\tvoid starting.catch((error: unknown) => {\n\t\t\t\tif (!this.#closed && this.#revision === revision && this.#bound) this.#reportError(toError(error));\n\t\t\t});\n\t\t}\n\t\treturn () => {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\tstop();\n\t\t\tif (this.#instances.observerCount === 0) this.#onEmpty();\n\t\t};\n\t}\n\n\tasync rebind(bound: boolean, context: Context): Promise<void> {\n\t\tif (this.#closed) return;\n\t\tthis.#bound = bound;\n\t\tconst revision = ++this.#revision;\n\t\tawait this.#reset(context, false);\n\t\tif (this.#closed || this.#revision !== revision || this.#bound !== bound) return;\n\t\tif (bound && this.#instances.observerCount > 0) {\n\t\t\tconst starting = this.#start(revision);\n\t\t\tthis.#starting = starting;\n\t\t\tawait starting;\n\t\t}\n\t}\n\n\tready(): Promise<void> {\n\t\treturn this.#starting ?? Promise.resolve();\n\t}\n\n\tasync close(context: Context): Promise<void> {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tthis.#revision += 1;\n\t\tawait this.#reset(context, true);\n\t\tthis.#instances.dispose();\n\t}\n\n\tasync #reset(context: Context, waitForStarting: boolean): Promise<void> {\n\t\tthis.#instances.reset();\n\t\tconst starting = this.#starting;\n\t\tthis.#starting = undefined;\n\t\tconst subscription = this.#subscription;\n\t\tthis.#subscription = undefined;\n\t\tawait Promise.all([\n\t\t\twaitForStarting ? starting?.catch(() => {}) : undefined,\n\t\t\tsubscription === undefined ? undefined : subscription.close(context),\n\t\t]);\n\t}\n\n\tasync #start(revision: number): Promise<void> {\n\t\tconst subscription = await this.#transport.subscribe(\n\t\t\tthis.#service.id,\n\t\t\t\"keyed\",\n\t\t\t(update, context) => {\n\t\t\t\tif (this.#revision === revision) this.#update(update, context);\n\t\t\t},\n\t\t\tBACKGROUND_CONTEXT,\n\t\t);\n\t\tif (this.#closed || !this.#bound || this.#revision !== revision) {\n\t\t\tawait subscription.close(BACKGROUND_CONTEXT);\n\t\t\treturn;\n\t\t}\n\t\tthis.#subscription = subscription;\n\t\tif (subscription.snapshot.mode !== \"keyed\" || subscription.snapshot.serviceId !== this.#service.id) {\n\t\t\tthrow new Error(`Remote service ${this.#service.id} returned the wrong keyed snapshot`);\n\t\t}\n\t\tfor (const snapshot of subscription.snapshot.instances) this.#spawn(snapshot, serviceDeliveryContext());\n\t\tsubscription.activate();\n\t\tthis.#instances.ready();\n\t}\n\n\t#update(update: ServiceProviderUpdate, context: Context): void {\n\t\tif (this.#closed) return;\n\t\ttry {\n\t\t\tswitch (update.type) {\n\t\t\t\tcase \"unavailable\":\n\t\t\t\tcase \"replaced\":\n\t\t\t\t\tthrow new Error(\"Keyed service received a singleton lifecycle update\");\n\t\t\t\tcase \"spawned\":\n\t\t\t\t\tthis.#spawn(update.instance, context);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"closed\": {\n\t\t\t\t\tconst instance = this.#instances.get(update.instance.key);\n\t\t\t\t\tif (instance?.generation === update.instance.generation) this.#instances.remove(instance);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase \"state\": {\n\t\t\t\t\tif (update.instance === undefined) throw new Error(\"Keyed state update has no instance address\");\n\t\t\t\t\tconst instance = this.#instances.get(update.instance.key);\n\t\t\t\t\tif (instance?.generation !== update.instance.generation) return;\n\t\t\t\t\tinstance.facade.update(update.member, update.sequence, update.ops, context);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tthis.#reportError(toError(error));\n\t\t}\n\t}\n\n\t#spawn(snapshot: ServiceInstanceSnapshot, context: Context): void {\n\t\tconst address = snapshot.instance;\n\t\tif (address === undefined) throw new Error(\"Keyed service instance snapshot has no address\");\n\t\tlet active = true;\n\t\tconst facade = new ServiceFacade(\n\t\t\tthis.#service.id,\n\t\t\taddress,\n\t\t\tthis.#transport,\n\t\t\t() => active && !this.#closed,\n\t\t\tthis.#assertAccess,\n\t\t\tthis.#reportError,\n\t\t);\n\t\tfacade.install(snapshot, context);\n\t\tthis.#instances.replace({\n\t\t\tkey: address.key,\n\t\t\tgeneration: address.generation,\n\t\t\tservice: facade.proxy,\n\t\t\tfacade,\n\t\t\tdeactivate: () => {\n\t\t\t\tactive = false;\n\t\t\t\tfacade.clear();\n\t\t\t},\n\t\t});\n\t}\n}\n\nexport class RemoteServiceBindingImpl implements RemoteServiceBinding {\n\treadonly #transport: RemoteServiceTransport;\n\treadonly #allowlist = new Set<string>();\n\treadonly #reportError: ErrorReporter;\n\treadonly #modes = new Map<string, \"singleton\" | \"keyed\">();\n\treadonly #assertAccess: () => void;\n\treadonly #singletons = new Map<string, SingletonBinding>();\n\treadonly #keyed = new Map<string, KeyedBinding<unknown>>();\n\t#bound: boolean;\n\t#readinessRevision = 0;\n\t#bindingTransition = Promise.resolve();\n\t#disposed = false;\n\n\tconstructor(options: RemoteServiceBindingOptions) {\n\t\tthis.#transport = options.transport;\n\t\tconst ids = options.services.map(({ id }) => id);\n\t\tif (new Set(ids).size !== ids.length) throw new TypeError(\"Remote service binding has duplicate service IDs\");\n\t\tfor (const id of ids) this.#allowlist.add(id);\n\t\tthis.#reportError = options.onError ?? (() => {});\n\t\tthis.#assertAccess = options.assertAccess ?? (() => {});\n\t\tthis.#bound = options.bound ?? true;\n\t}\n\n\tuse<T>(service: Service<T>): T {\n\t\tthis.#assertRemotable(service);\n\t\tthis.#assertAvailable(service.id, \"singleton\");\n\t\tlet binding = this.#singletons.get(service.id);\n\t\tif (binding !== undefined) return binding.facade.proxy as T;\n\t\tbinding = { facade: undefined as unknown as ServiceFacade, active: true, revision: 0 };\n\t\tbinding.facade = new ServiceFacade(\n\t\t\tservice.id,\n\t\t\tundefined,\n\t\t\tthis.#transport,\n\t\t\t() => binding!.active && !this.#disposed && this.#bound,\n\t\t\t() => this.#assertHandleAccess(),\n\t\t\tthis.#reportError,\n\t\t);\n\t\tthis.#singletons.set(service.id, binding);\n\t\tthis.#readinessRevision += 1;\n\t\tif (this.#bound) {\n\t\t\tconst revision = binding.revision;\n\t\t\tconst starting = this.#startSingleton(service.id, binding, revision);\n\t\t\tbinding.starting = starting;\n\t\t\tvoid starting.catch((error: unknown) => {\n\t\t\t\tif (binding.active && binding.revision === revision && !this.#disposed && this.#bound) {\n\t\t\t\t\tthis.#reportError(toError(error));\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn binding.facade.proxy as T;\n\t}\n\n\tobserve<T>(service: Service<T>, handler: (service: T, context: Context) => void | Promise<void>): () => void {\n\t\tthis.#assertRemotable(service);\n\t\tthis.#assertAvailable(service.id, \"keyed\");\n\t\tlet binding = this.#keyed.get(service.id) as KeyedBinding<T> | undefined;\n\t\tif (binding === undefined) {\n\t\t\tbinding = new KeyedBinding(\n\t\t\t\tservice,\n\t\t\t\tthis.#transport,\n\t\t\t\tthis.#reportError,\n\t\t\t\t() => this.#assertHandleAccess(),\n\t\t\t\t() => {\n\t\t\t\t\tif (this.#keyed.get(service.id) !== binding) return;\n\t\t\t\t\tthis.#keyed.delete(service.id);\n\t\t\t\t\tthis.#readinessRevision += 1;\n\t\t\t\t\tvoid binding!.close(BACKGROUND_CONTEXT).catch(this.#reportError);\n\t\t\t\t},\n\t\t\t\tthis.#bound,\n\t\t\t);\n\t\t\tthis.#keyed.set(service.id, binding as KeyedBinding<unknown>);\n\t\t\tthis.#readinessRevision += 1;\n\t\t}\n\t\treturn binding.observe(handler);\n\t}\n\n\tasync ready(context: Context): Promise<void> {\n\t\tif (this.#disposed) throw new Error(\"Remote service binding is disposed\");\n\t\twhile (true) {\n\t\t\tconst revision = this.#readinessRevision;\n\t\t\tconst starts = [\n\t\t\t\tthis.#bindingTransition,\n\t\t\t\t...[...this.#singletons.values()].flatMap((binding) =>\n\t\t\t\t\tbinding.starting === undefined ? [] : [binding.starting],\n\t\t\t\t),\n\t\t\t\t...[...this.#keyed.values()].map((binding) => binding.ready()),\n\t\t\t];\n\t\t\tawait awaitWithContext(\n\t\t\t\tPromise.all(starts).then(() => undefined),\n\t\t\t\tcontext,\n\t\t\t);\n\t\t\tif (this.#disposed) throw new Error(\"Remote service binding is disposed\");\n\t\t\tif (revision === this.#readinessRevision) return;\n\t\t}\n\t}\n\n\tasync rebind(bound: boolean, context: Context): Promise<void> {\n\t\tif (this.#disposed) throw new Error(\"Remote service binding is disposed\");\n\t\tthis.#bound = bound;\n\t\tthis.#readinessRevision += 1;\n\t\tconst transitions: Promise<void>[] = [];\n\t\tfor (const [serviceId, binding] of this.#singletons) {\n\t\t\tbinding.revision += 1;\n\t\t\tbinding.facade.clear();\n\t\t\tconst subscription = binding.subscription;\n\t\t\tdelete binding.subscription;\n\t\t\tconst revision = binding.revision;\n\t\t\tconst starting = (async () => {\n\t\t\t\tawait subscription?.close(context);\n\t\t\t\tif (bound) await this.#startSingleton(serviceId, binding, revision);\n\t\t\t})();\n\t\t\tbinding.starting = starting;\n\t\t\ttransitions.push(starting);\n\t\t}\n\t\tfor (const binding of this.#keyed.values()) transitions.push(binding.rebind(bound, context));\n\t\tconst completion = (async () => {\n\t\t\tconst results = await Promise.allSettled(transitions);\n\t\t\tconst errors = results.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n\t\t\tif (errors.length > 0)\n\t\t\t\tthrow new AggregateError(\n\t\t\t\t\terrors.map(({ reason }) => reason),\n\t\t\t\t\t\"Failed to rebind services\",\n\t\t\t\t);\n\t\t})();\n\t\tthis.#bindingTransition = completion;\n\t\tawait completion;\n\t}\n\n\tasync dispose(context: Context): Promise<void> {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tconst closes: Promise<void>[] = [];\n\t\tfor (const binding of this.#singletons.values()) {\n\t\t\tbinding.active = false;\n\t\t\tbinding.facade.clear();\n\t\t\tif (binding.starting) closes.push(binding.starting.catch(() => {}));\n\t\t\tif (binding.subscription) closes.push(Promise.resolve(binding.subscription.close(context)));\n\t\t}\n\t\tfor (const binding of this.#keyed.values()) closes.push(binding.close(context));\n\t\tthis.#singletons.clear();\n\t\tthis.#keyed.clear();\n\t\tconst results = await Promise.allSettled(closes);\n\t\tconst errors = results.filter((result): result is PromiseRejectedResult => result.status === \"rejected\");\n\t\tif (errors.length > 0)\n\t\t\tthrow new AggregateError(\n\t\t\t\terrors.map(({ reason }) => reason),\n\t\t\t\t\"Failed to dispose services\",\n\t\t\t);\n\t}\n\n\tasync #startSingleton(serviceId: string, binding: SingletonBinding, revision: number): Promise<void> {\n\t\tconst subscription = await this.#transport.subscribe(\n\t\t\tserviceId,\n\t\t\t\"singleton\",\n\t\t\t(update, context) => {\n\t\t\t\tif (!binding.active || binding.revision !== revision) return;\n\t\t\t\ttry {\n\t\t\t\t\tif (update.type === \"unavailable\") {\n\t\t\t\t\t\tbinding.facade.clear();\n\t\t\t\t\t} else if (update.type === \"replaced\") {\n\t\t\t\t\t\tif (update.snapshot.instance !== undefined) {\n\t\t\t\t\t\t\tthrow new Error(\"Singleton replacement has an instance address\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbinding.facade.install(update.snapshot, context);\n\t\t\t\t\t} else if (update.type === \"state\" && update.instance === undefined) {\n\t\t\t\t\t\tbinding.facade.update(update.member, update.sequence, update.ops, context);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.#reportError(toError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tBACKGROUND_CONTEXT,\n\t\t);\n\t\tif (!binding.active || this.#disposed || !this.#bound || binding.revision !== revision) {\n\t\t\tawait subscription.close(BACKGROUND_CONTEXT);\n\t\t\treturn;\n\t\t}\n\t\tbinding.subscription = subscription;\n\t\tconst snapshot = subscription.snapshot;\n\t\tif (snapshot.mode !== \"singleton\" || snapshot.serviceId !== serviceId || snapshot.instances.length !== 1) {\n\t\t\tthrow new Error(`Remote service ${serviceId} returned an invalid singleton snapshot`);\n\t\t}\n\t\tbinding.facade.install(snapshot.instances[0]!, serviceDeliveryContext());\n\t\tsubscription.activate();\n\t}\n\n\t#assertHandleAccess(): void {\n\t\tif (this.#disposed) throw new Error(\"Remote service binding is disposed\");\n\t\tthis.#assertAccess();\n\t}\n\n\t#assertRemotable(service: { readonly id: string; readonly local: boolean }): void {\n\t\tif (service.local) throw new RemoteServiceError(\"service_not_allowed\", `Service ${service.id} is process-local`);\n\t}\n\n\t#assertAvailable(serviceId: string, mode: \"singleton\" | \"keyed\"): void {\n\t\tif (this.#disposed) throw new Error(\"Remote service binding is disposed\");\n\t\tif (!this.#allowlist.has(serviceId)) {\n\t\t\tthrow new RemoteServiceError(\"service_not_allowed\", `Remote service ${serviceId} is not allowlisted`);\n\t\t}\n\t\tconst existing = this.#modes.get(serviceId);\n\t\tif (existing !== undefined && existing !== mode) {\n\t\t\tthrow new RemoteServiceError(\n\t\t\t\t\"service_mode_mismatch\",\n\t\t\t\t`Remote service ${serviceId} is already used as ${existing}`,\n\t\t\t);\n\t\t}\n\t\tthis.#modes.set(serviceId, mode);\n\t}\n}\n\nfunction validateMembers(members: readonly ServiceMemberSnapshot[]): ReadonlyMap<string, ServiceMemberSnapshot> {\n\tconst result = new Map<string, ServiceMemberSnapshot>();\n\tfor (const member of members) {\n\t\tif (member.name.length === 0 || result.has(member.name)) {\n\t\t\tthrow new Error(\"Remote service has invalid member descriptions\");\n\t\t}\n\t\tresult.set(member.name, member);\n\t}\n\treturn result;\n}\n\nfunction sameAddress(left: ServiceInstanceAddress | undefined, right: ServiceInstanceAddress | undefined): boolean {\n\tif (left === undefined || right === undefined) return left === right;\n\treturn left.key === right.key && left.generation === right.generation;\n}\n\nfunction isContext(value: unknown): value is Context {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst candidate = value as Partial<Context>;\n\treturn typeof candidate.value === \"function\" && typeof candidate.toString === \"function\";\n}\n\nfunction toError(error: unknown): Error {\n\treturn error instanceof Error ? error : new Error(String(error));\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const REMOTE_SERVICE_ERROR_CODES: readonly ["service_not_allowed", "service_not_found", "service_mode_mismatch", "service_member_not_found", "service_member_mismatch", "service_instance_not_found", "service_stale_instance", "service_invalid_value"];
|
|
2
|
+
export type RemoteServiceErrorCode = (typeof REMOTE_SERVICE_ERROR_CODES)[number];
|
|
3
|
+
export declare function isRemoteServiceErrorCode(value: unknown): value is RemoteServiceErrorCode;
|
|
4
|
+
export declare class RemoteServiceError extends Error {
|
|
5
|
+
readonly code: RemoteServiceErrorCode;
|
|
6
|
+
constructor(code: RemoteServiceErrorCode, message: string);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/services/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,wNAS7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAExF;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAEtC,YAAY,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,EAIxD;CACD","sourcesContent":["export const REMOTE_SERVICE_ERROR_CODES = [\n\t\"service_not_allowed\",\n\t\"service_not_found\",\n\t\"service_mode_mismatch\",\n\t\"service_member_not_found\",\n\t\"service_member_mismatch\",\n\t\"service_instance_not_found\",\n\t\"service_stale_instance\",\n\t\"service_invalid_value\",\n] as const;\n\nexport type RemoteServiceErrorCode = (typeof REMOTE_SERVICE_ERROR_CODES)[number];\n\nexport function isRemoteServiceErrorCode(value: unknown): value is RemoteServiceErrorCode {\n\treturn typeof value === \"string\" && REMOTE_SERVICE_ERROR_CODES.includes(value as RemoteServiceErrorCode);\n}\n\nexport class RemoteServiceError extends Error {\n\treadonly code: RemoteServiceErrorCode;\n\n\tconstructor(code: RemoteServiceErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteServiceError\";\n\t\tthis.code = code;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const REMOTE_SERVICE_ERROR_CODES = [
|
|
2
|
+
"service_not_allowed",
|
|
3
|
+
"service_not_found",
|
|
4
|
+
"service_mode_mismatch",
|
|
5
|
+
"service_member_not_found",
|
|
6
|
+
"service_member_mismatch",
|
|
7
|
+
"service_instance_not_found",
|
|
8
|
+
"service_stale_instance",
|
|
9
|
+
"service_invalid_value",
|
|
10
|
+
];
|
|
11
|
+
export function isRemoteServiceErrorCode(value) {
|
|
12
|
+
return typeof value === "string" && REMOTE_SERVICE_ERROR_CODES.includes(value);
|
|
13
|
+
}
|
|
14
|
+
export class RemoteServiceError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
constructor(code, message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.name = "RemoteServiceError";
|
|
19
|
+
this.code = code;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/services/errors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACzC,qBAAqB;IACrB,mBAAmB;IACnB,uBAAuB;IACvB,0BAA0B;IAC1B,yBAAyB;IACzB,4BAA4B;IAC5B,wBAAwB;IACxB,uBAAuB;CACd,CAAC;AAIX,MAAM,UAAU,wBAAwB,CAAC,KAAc,EAAmC;IACzF,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,0BAA0B,CAAC,QAAQ,CAAC,KAA+B,CAAC,CAAC;AAAA,CACzG;AAED,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IACnC,IAAI,CAAyB;IAEtC,YAAY,IAA4B,EAAE,OAAe,EAAE;QAC1D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAAA,CACjB;CACD","sourcesContent":["export const REMOTE_SERVICE_ERROR_CODES = [\n\t\"service_not_allowed\",\n\t\"service_not_found\",\n\t\"service_mode_mismatch\",\n\t\"service_member_not_found\",\n\t\"service_member_mismatch\",\n\t\"service_instance_not_found\",\n\t\"service_stale_instance\",\n\t\"service_invalid_value\",\n] as const;\n\nexport type RemoteServiceErrorCode = (typeof REMOTE_SERVICE_ERROR_CODES)[number];\n\nexport function isRemoteServiceErrorCode(value: unknown): value is RemoteServiceErrorCode {\n\treturn typeof value === \"string\" && REMOTE_SERVICE_ERROR_CODES.includes(value as RemoteServiceErrorCode);\n}\n\nexport class RemoteServiceError extends Error {\n\treadonly code: RemoteServiceErrorCode;\n\n\tconstructor(code: RemoteServiceErrorCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RemoteServiceError\";\n\t\tthis.code = code;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface ResolvedValue {
|
|
2
|
+
readonly value: unknown;
|
|
3
|
+
readonly receiver: object;
|
|
4
|
+
}
|
|
5
|
+
/** Host-owned mutable target with consumer-owned guarded views. */
|
|
6
|
+
export declare class ServiceSlot {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(serviceId: string, wrapObjects: boolean);
|
|
9
|
+
view<T>(assertAccess: () => void): T;
|
|
10
|
+
bind(implementation: object): void;
|
|
11
|
+
unbind(): void;
|
|
12
|
+
resolve(property: PropertyKey, assertAccess: () => void): ResolvedValue;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../../src/services/handle.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC1B;AAID,mEAAmE;AACnE,qBAAa,WAAW;;IAKvB,YAAY,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAGlD;IAED,IAAI,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,CAAC,CAEnC;IAED,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAEjC;IAED,MAAM,IAAI,IAAI,CAEb;IAED,OAAO,CAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,IAAI,GAAG,aAAa,CAQtE;CACD","sourcesContent":["interface ResolvedValue {\n\treadonly value: unknown;\n\treadonly receiver: object;\n}\n\ntype ValueResolver = () => ResolvedValue;\n\n/** Host-owned mutable target with consumer-owned guarded views. */\nexport class ServiceSlot {\n\treadonly #serviceId: string;\n\treadonly #wrapObjects: boolean;\n\t#implementation: object | undefined;\n\n\tconstructor(serviceId: string, wrapObjects: boolean) {\n\t\tthis.#serviceId = serviceId;\n\t\tthis.#wrapObjects = wrapObjects;\n\t}\n\n\tview<T>(assertAccess: () => void): T {\n\t\treturn new ServiceView(this, assertAccess, this.#wrapObjects).proxy as T;\n\t}\n\n\tbind(implementation: object): void {\n\t\tthis.#implementation = implementation;\n\t}\n\n\tunbind(): void {\n\t\tthis.#implementation = undefined;\n\t}\n\n\tresolve(property: PropertyKey, assertAccess: () => void): ResolvedValue {\n\t\tassertAccess();\n\t\tconst implementation = this.#implementation;\n\t\tif (implementation === undefined) throw new Error(`Service ${this.#serviceId} is disconnected`);\n\t\treturn {\n\t\t\tvalue: Reflect.get(implementation, property, implementation),\n\t\t\treceiver: implementation,\n\t\t};\n\t}\n}\n\nclass ServiceView {\n\treadonly #slot: ServiceSlot;\n\treadonly #assertAccess: () => void;\n\treadonly #wrapObjects: boolean;\n\treadonly #members = new Map<PropertyKey, ValueView>();\n\treadonly proxy: object;\n\n\tconstructor(slot: ServiceSlot, assertAccess: () => void, wrapObjects: boolean) {\n\t\tthis.#slot = slot;\n\t\tthis.#assertAccess = assertAccess;\n\t\tthis.#wrapObjects = wrapObjects;\n\t\tthis.proxy = new Proxy(Object.create(null) as object, {\n\t\t\tget: (_target, property) => this.#getMember(property),\n\t\t});\n\t}\n\n\t#getMember(property: PropertyKey): unknown {\n\t\tconst resolve = (): ResolvedValue => this.#slot.resolve(property, this.#assertAccess);\n\t\tconst current = resolve().value;\n\t\tif (!isObject(current) || (typeof current !== \"function\" && !this.#wrapObjects)) return current;\n\t\tlet member = this.#members.get(property);\n\t\tif (member === undefined) {\n\t\t\tmember = new ValueView(resolve, typeof current === \"function\");\n\t\t\tthis.#members.set(property, member);\n\t\t}\n\t\treturn member.proxy;\n\t}\n}\n\nclass ValueView {\n\treadonly #resolve: ValueResolver;\n\treadonly #children = new Map<PropertyKey, ValueView>();\n\treadonly proxy: object;\n\n\tconstructor(resolve: ValueResolver, callable: boolean) {\n\t\tthis.#resolve = resolve;\n\t\tconst target: object = callable ? () => undefined : Object.create(null);\n\t\tthis.proxy = new Proxy(target, {\n\t\t\tapply: (_target, _thisArg, args) => this.#invoke(args),\n\t\t\tget: (_target, property) => this.#get(property),\n\t\t});\n\t}\n\n\t#invoke(args: unknown[]): unknown {\n\t\tconst { value, receiver } = this.#resolve();\n\t\tif (typeof value !== \"function\") throw new TypeError(\"Service member is not callable\");\n\t\treturn Reflect.apply(value, receiver, args);\n\t}\n\n\t#get(property: PropertyKey): unknown {\n\t\tconst resolve = (): ResolvedValue => {\n\t\t\tconst parent = this.#resolve();\n\t\t\tif (!isObject(parent.value)) throw new TypeError(\"Service member does not have properties\");\n\t\t\treturn {\n\t\t\t\tvalue: Reflect.get(parent.value, property, parent.value),\n\t\t\t\treceiver: parent.value,\n\t\t\t};\n\t\t};\n\t\tconst current = resolve().value;\n\t\tif (typeof current !== \"function\") return current;\n\t\tlet child = this.#children.get(property);\n\t\tif (child === undefined) {\n\t\t\tchild = new ValueView(resolve, true);\n\t\t\tthis.#children.set(property, child);\n\t\t}\n\t\treturn child.proxy;\n\t}\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Host-owned mutable target with consumer-owned guarded views. */
|
|
2
|
+
export class ServiceSlot {
|
|
3
|
+
#serviceId;
|
|
4
|
+
#wrapObjects;
|
|
5
|
+
#implementation;
|
|
6
|
+
constructor(serviceId, wrapObjects) {
|
|
7
|
+
this.#serviceId = serviceId;
|
|
8
|
+
this.#wrapObjects = wrapObjects;
|
|
9
|
+
}
|
|
10
|
+
view(assertAccess) {
|
|
11
|
+
return new ServiceView(this, assertAccess, this.#wrapObjects).proxy;
|
|
12
|
+
}
|
|
13
|
+
bind(implementation) {
|
|
14
|
+
this.#implementation = implementation;
|
|
15
|
+
}
|
|
16
|
+
unbind() {
|
|
17
|
+
this.#implementation = undefined;
|
|
18
|
+
}
|
|
19
|
+
resolve(property, assertAccess) {
|
|
20
|
+
assertAccess();
|
|
21
|
+
const implementation = this.#implementation;
|
|
22
|
+
if (implementation === undefined)
|
|
23
|
+
throw new Error(`Service ${this.#serviceId} is disconnected`);
|
|
24
|
+
return {
|
|
25
|
+
value: Reflect.get(implementation, property, implementation),
|
|
26
|
+
receiver: implementation,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
class ServiceView {
|
|
31
|
+
#slot;
|
|
32
|
+
#assertAccess;
|
|
33
|
+
#wrapObjects;
|
|
34
|
+
#members = new Map();
|
|
35
|
+
proxy;
|
|
36
|
+
constructor(slot, assertAccess, wrapObjects) {
|
|
37
|
+
this.#slot = slot;
|
|
38
|
+
this.#assertAccess = assertAccess;
|
|
39
|
+
this.#wrapObjects = wrapObjects;
|
|
40
|
+
this.proxy = new Proxy(Object.create(null), {
|
|
41
|
+
get: (_target, property) => this.#getMember(property),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
#getMember(property) {
|
|
45
|
+
const resolve = () => this.#slot.resolve(property, this.#assertAccess);
|
|
46
|
+
const current = resolve().value;
|
|
47
|
+
if (!isObject(current) || (typeof current !== "function" && !this.#wrapObjects))
|
|
48
|
+
return current;
|
|
49
|
+
let member = this.#members.get(property);
|
|
50
|
+
if (member === undefined) {
|
|
51
|
+
member = new ValueView(resolve, typeof current === "function");
|
|
52
|
+
this.#members.set(property, member);
|
|
53
|
+
}
|
|
54
|
+
return member.proxy;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
class ValueView {
|
|
58
|
+
#resolve;
|
|
59
|
+
#children = new Map();
|
|
60
|
+
proxy;
|
|
61
|
+
constructor(resolve, callable) {
|
|
62
|
+
this.#resolve = resolve;
|
|
63
|
+
const target = callable ? () => undefined : Object.create(null);
|
|
64
|
+
this.proxy = new Proxy(target, {
|
|
65
|
+
apply: (_target, _thisArg, args) => this.#invoke(args),
|
|
66
|
+
get: (_target, property) => this.#get(property),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
#invoke(args) {
|
|
70
|
+
const { value, receiver } = this.#resolve();
|
|
71
|
+
if (typeof value !== "function")
|
|
72
|
+
throw new TypeError("Service member is not callable");
|
|
73
|
+
return Reflect.apply(value, receiver, args);
|
|
74
|
+
}
|
|
75
|
+
#get(property) {
|
|
76
|
+
const resolve = () => {
|
|
77
|
+
const parent = this.#resolve();
|
|
78
|
+
if (!isObject(parent.value))
|
|
79
|
+
throw new TypeError("Service member does not have properties");
|
|
80
|
+
return {
|
|
81
|
+
value: Reflect.get(parent.value, property, parent.value),
|
|
82
|
+
receiver: parent.value,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const current = resolve().value;
|
|
86
|
+
if (typeof current !== "function")
|
|
87
|
+
return current;
|
|
88
|
+
let child = this.#children.get(property);
|
|
89
|
+
if (child === undefined) {
|
|
90
|
+
child = new ValueView(resolve, true);
|
|
91
|
+
this.#children.set(property, child);
|
|
92
|
+
}
|
|
93
|
+
return child.proxy;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function isObject(value) {
|
|
97
|
+
return (typeof value === "object" && value !== null) || typeof value === "function";
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../../src/services/handle.ts"],"names":[],"mappings":"AAOA,mEAAmE;AACnE,MAAM,OAAO,WAAW;IACd,UAAU,CAAS;IACnB,YAAY,CAAU;IAC/B,eAAe,CAAqB;IAEpC,YAAY,SAAiB,EAAE,WAAoB,EAAE;QACpD,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IAAA,CAChC;IAED,IAAI,CAAI,YAAwB,EAAK;QACpC,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,KAAU,CAAC;IAAA,CACzE;IAED,IAAI,CAAC,cAAsB,EAAQ;QAClC,IAAI,CAAC,eAAe,GAAG,cAAc,CAAC;IAAA,CACtC;IAED,MAAM,GAAS;QACd,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IAAA,CACjC;IAED,OAAO,CAAC,QAAqB,EAAE,YAAwB,EAAiB;QACvE,YAAY,EAAE,CAAC;QACf,MAAM,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,cAAc,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,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,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;YAC5F,OAAO;gBACN,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC;gBACxD,QAAQ,EAAE,MAAM,CAAC,KAAK;aACtB,CAAC;QAAA,CACF,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC,KAAK,CAAC;QAChC,IAAI,OAAO,OAAO,KAAK,UAAU;YAAE,OAAO,OAAO,CAAC;QAClD,IAAI,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACzC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,KAAK,GAAG,IAAI,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,KAAK,CAAC,KAAK,CAAC;IAAA,CACnB;CACD;AAED,SAAS,QAAQ,CAAC,KAAc,EAAmB;IAClD,OAAO,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;AAAA,CACpF","sourcesContent":["interface ResolvedValue {\n\treadonly value: unknown;\n\treadonly receiver: object;\n}\n\ntype ValueResolver = () => ResolvedValue;\n\n/** Host-owned mutable target with consumer-owned guarded views. */\nexport class ServiceSlot {\n\treadonly #serviceId: string;\n\treadonly #wrapObjects: boolean;\n\t#implementation: object | undefined;\n\n\tconstructor(serviceId: string, wrapObjects: boolean) {\n\t\tthis.#serviceId = serviceId;\n\t\tthis.#wrapObjects = wrapObjects;\n\t}\n\n\tview<T>(assertAccess: () => void): T {\n\t\treturn new ServiceView(this, assertAccess, this.#wrapObjects).proxy as T;\n\t}\n\n\tbind(implementation: object): void {\n\t\tthis.#implementation = implementation;\n\t}\n\n\tunbind(): void {\n\t\tthis.#implementation = undefined;\n\t}\n\n\tresolve(property: PropertyKey, assertAccess: () => void): ResolvedValue {\n\t\tassertAccess();\n\t\tconst implementation = this.#implementation;\n\t\tif (implementation === undefined) throw new Error(`Service ${this.#serviceId} is disconnected`);\n\t\treturn {\n\t\t\tvalue: Reflect.get(implementation, property, implementation),\n\t\t\treceiver: implementation,\n\t\t};\n\t}\n}\n\nclass ServiceView {\n\treadonly #slot: ServiceSlot;\n\treadonly #assertAccess: () => void;\n\treadonly #wrapObjects: boolean;\n\treadonly #members = new Map<PropertyKey, ValueView>();\n\treadonly proxy: object;\n\n\tconstructor(slot: ServiceSlot, assertAccess: () => void, wrapObjects: boolean) {\n\t\tthis.#slot = slot;\n\t\tthis.#assertAccess = assertAccess;\n\t\tthis.#wrapObjects = wrapObjects;\n\t\tthis.proxy = new Proxy(Object.create(null) as object, {\n\t\t\tget: (_target, property) => this.#getMember(property),\n\t\t});\n\t}\n\n\t#getMember(property: PropertyKey): unknown {\n\t\tconst resolve = (): ResolvedValue => this.#slot.resolve(property, this.#assertAccess);\n\t\tconst current = resolve().value;\n\t\tif (!isObject(current) || (typeof current !== \"function\" && !this.#wrapObjects)) return current;\n\t\tlet member = this.#members.get(property);\n\t\tif (member === undefined) {\n\t\t\tmember = new ValueView(resolve, typeof current === \"function\");\n\t\t\tthis.#members.set(property, member);\n\t\t}\n\t\treturn member.proxy;\n\t}\n}\n\nclass ValueView {\n\treadonly #resolve: ValueResolver;\n\treadonly #children = new Map<PropertyKey, ValueView>();\n\treadonly proxy: object;\n\n\tconstructor(resolve: ValueResolver, callable: boolean) {\n\t\tthis.#resolve = resolve;\n\t\tconst target: object = callable ? () => undefined : Object.create(null);\n\t\tthis.proxy = new Proxy(target, {\n\t\t\tapply: (_target, _thisArg, args) => this.#invoke(args),\n\t\t\tget: (_target, property) => this.#get(property),\n\t\t});\n\t}\n\n\t#invoke(args: unknown[]): unknown {\n\t\tconst { value, receiver } = this.#resolve();\n\t\tif (typeof value !== \"function\") throw new TypeError(\"Service member is not callable\");\n\t\treturn Reflect.apply(value, receiver, args);\n\t}\n\n\t#get(property: PropertyKey): unknown {\n\t\tconst resolve = (): ResolvedValue => {\n\t\t\tconst parent = this.#resolve();\n\t\t\tif (!isObject(parent.value)) throw new TypeError(\"Service member does not have properties\");\n\t\t\treturn {\n\t\t\t\tvalue: Reflect.get(parent.value, property, parent.value),\n\t\t\t\treceiver: parent.value,\n\t\t\t};\n\t\t};\n\t\tconst current = resolve().value;\n\t\tif (typeof current !== \"function\") return current;\n\t\tlet child = this.#children.get(property);\n\t\tif (child === undefined) {\n\t\t\tchild = new ValueView(resolve, true);\n\t\t\tthis.#children.set(property, child);\n\t\t}\n\t\treturn child.proxy;\n\t}\n}\n\nfunction isObject(value: unknown): value is object {\n\treturn (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Context } from "../types.ts";
|
|
2
|
+
export interface InstanceDirectoryEntry {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly generation: number;
|
|
5
|
+
readonly service: object;
|
|
6
|
+
deactivate(): void;
|
|
7
|
+
}
|
|
8
|
+
/** Owns keyed instance lifetime and the cancellable tasks observing those instances. */
|
|
9
|
+
export declare class InstanceDirectory<TEntry extends InstanceDirectoryEntry> {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(options: {
|
|
12
|
+
readonly ready: boolean;
|
|
13
|
+
readonly onError: (error: Error) => void;
|
|
14
|
+
});
|
|
15
|
+
get observerCount(): number;
|
|
16
|
+
get(key: string): TEntry | undefined;
|
|
17
|
+
insert(entry: TEntry): void;
|
|
18
|
+
replace(entry: TEntry): void;
|
|
19
|
+
remove(entry: TEntry): void;
|
|
20
|
+
ready(): void;
|
|
21
|
+
reset(): void;
|
|
22
|
+
observe<T>(handler: (service: T, context: Context) => void | Promise<void>): () => void;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=instances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/services/instances.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,UAAU,IAAI,IAAI,CAAC;CACnB;AAQD,wFAAwF;AACxF,qBAAa,iBAAiB,CAAC,MAAM,SAAS,sBAAsB;;IAOnE,YAAY,OAAO,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;KAAE,EAGzF;IAED,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAO1B;IAED,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAW3B;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAG1B;IAED,KAAK,IAAI,IAAI,CAKZ;IAED,KAAK,IAAI,IAAI,CAIZ;IAED,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAkBtF;IAED,OAAO,IAAI,IAAI,CAad;CAgCD","sourcesContent":["import { BACKGROUND_CONTEXT, withCancel } from \"../context/index.ts\";\nimport type { Context } from \"../types.ts\";\n\nexport interface InstanceDirectoryEntry {\n\treadonly key: string;\n\treadonly generation: number;\n\treadonly service: object;\n\tdeactivate(): void;\n}\n\ninterface Observer {\n\treadonly handler: (service: object, context: Context) => void | Promise<void>;\n\treadonly tasks: Map<InstanceDirectoryEntry, { readonly cancel: (reason?: unknown) => void }>;\n\tclosed: boolean;\n}\n\n/** Owns keyed instance lifetime and the cancellable tasks observing those instances. */\nexport class InstanceDirectory<TEntry extends InstanceDirectoryEntry> {\n\treadonly #entries = new Map<string, TEntry>();\n\treadonly #observers = new Set<Observer>();\n\treadonly #reportError: (error: Error) => void;\n\t#ready: boolean;\n\t#disposed = false;\n\n\tconstructor(options: { readonly ready: boolean; readonly onError: (error: Error) => void }) {\n\t\tthis.#ready = options.ready;\n\t\tthis.#reportError = options.onError;\n\t}\n\n\tget observerCount(): number {\n\t\treturn this.#observers.size;\n\t}\n\n\tget(key: string): TEntry | undefined {\n\t\treturn this.#entries.get(key);\n\t}\n\n\tinsert(entry: TEntry): void {\n\t\tthis.#assertActive();\n\t\tif (this.#entries.has(entry.key)) {\n\t\t\tthrow new Error(`Keyed service already has a live instance with key ${entry.key}`);\n\t\t}\n\t\tthis.#entries.set(entry.key, entry);\n\t\tif (this.#ready) this.#startAll(entry);\n\t}\n\n\treplace(entry: TEntry): void {\n\t\tthis.#assertActive();\n\t\tconst previous = this.#entries.get(entry.key);\n\t\tif (previous !== undefined) {\n\t\t\tif (previous.generation === entry.generation) {\n\t\t\t\tthrow new Error(\"Keyed service repeated a live generation\");\n\t\t\t}\n\t\t\tthis.#remove(previous);\n\t\t}\n\t\tthis.#entries.set(entry.key, entry);\n\t\tif (this.#ready) this.#startAll(entry);\n\t}\n\n\tremove(entry: TEntry): void {\n\t\tif (this.#entries.get(entry.key) !== entry) return;\n\t\tthis.#remove(entry);\n\t}\n\n\tready(): void {\n\t\tthis.#assertActive();\n\t\tif (this.#ready) return;\n\t\tthis.#ready = true;\n\t\tfor (const entry of this.#entries.values()) this.#startAll(entry);\n\t}\n\n\treset(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#ready = false;\n\t\tfor (const entry of [...this.#entries.values()]) this.#remove(entry);\n\t}\n\n\tobserve<T>(handler: (service: T, context: Context) => void | Promise<void>): () => void {\n\t\tthis.#assertActive();\n\t\tconst observer: Observer = {\n\t\t\thandler: handler as Observer[\"handler\"],\n\t\t\ttasks: new Map(),\n\t\t\tclosed: false,\n\t\t};\n\t\tthis.#observers.add(observer);\n\t\tif (this.#ready) {\n\t\t\tfor (const entry of this.#entries.values()) this.#start(observer, entry);\n\t\t}\n\t\treturn () => {\n\t\t\tif (observer.closed) return;\n\t\t\tobserver.closed = true;\n\t\t\tfor (const task of observer.tasks.values()) task.cancel();\n\t\t\tobserver.tasks.clear();\n\t\t\tthis.#observers.delete(observer);\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tfor (const observer of this.#observers) {\n\t\t\tobserver.closed = true;\n\t\t\tfor (const task of observer.tasks.values()) task.cancel();\n\t\t\tobserver.tasks.clear();\n\t\t}\n\t\tthis.#observers.clear();\n\t\tfor (const entry of [...this.#entries.values()]) {\n\t\t\tentry.deactivate();\n\t\t}\n\t\tthis.#entries.clear();\n\t}\n\n\t#remove(entry: TEntry): void {\n\t\tif (this.#entries.get(entry.key) !== entry) return;\n\t\tthis.#entries.delete(entry.key);\n\t\tentry.deactivate();\n\t\tfor (const observer of this.#observers) {\n\t\t\tobserver.tasks.get(entry)?.cancel();\n\t\t\tobserver.tasks.delete(entry);\n\t\t}\n\t}\n\n\t#startAll(entry: TEntry): void {\n\t\tfor (const observer of this.#observers) this.#start(observer, entry);\n\t}\n\n\t#start(observer: Observer, entry: TEntry): void {\n\t\tif (observer.closed || observer.tasks.has(entry)) return;\n\t\tconst { context, cancel } = withCancel(BACKGROUND_CONTEXT);\n\t\tobserver.tasks.set(entry, { cancel });\n\t\ttry {\n\t\t\tvoid Promise.resolve(observer.handler(entry.service, context)).catch((error: unknown) => {\n\t\t\t\tif (!context.abortSignal?.aborted) this.#reportError(toError(error));\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (!context.abortSignal?.aborted) this.#reportError(toError(error));\n\t\t}\n\t}\n\n\t#assertActive(): void {\n\t\tif (this.#disposed) throw new Error(\"Keyed service directory is disposed\");\n\t}\n}\n\nfunction toError(error: unknown): Error {\n\treturn error instanceof Error ? error : new Error(String(error));\n}\n"]}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BACKGROUND_CONTEXT, withCancel } from "../context/index.js";
|
|
2
|
+
/** Owns keyed instance lifetime and the cancellable tasks observing those instances. */
|
|
3
|
+
export class InstanceDirectory {
|
|
4
|
+
#entries = new Map();
|
|
5
|
+
#observers = new Set();
|
|
6
|
+
#reportError;
|
|
7
|
+
#ready;
|
|
8
|
+
#disposed = false;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.#ready = options.ready;
|
|
11
|
+
this.#reportError = options.onError;
|
|
12
|
+
}
|
|
13
|
+
get observerCount() {
|
|
14
|
+
return this.#observers.size;
|
|
15
|
+
}
|
|
16
|
+
get(key) {
|
|
17
|
+
return this.#entries.get(key);
|
|
18
|
+
}
|
|
19
|
+
insert(entry) {
|
|
20
|
+
this.#assertActive();
|
|
21
|
+
if (this.#entries.has(entry.key)) {
|
|
22
|
+
throw new Error(`Keyed service already has a live instance with key ${entry.key}`);
|
|
23
|
+
}
|
|
24
|
+
this.#entries.set(entry.key, entry);
|
|
25
|
+
if (this.#ready)
|
|
26
|
+
this.#startAll(entry);
|
|
27
|
+
}
|
|
28
|
+
replace(entry) {
|
|
29
|
+
this.#assertActive();
|
|
30
|
+
const previous = this.#entries.get(entry.key);
|
|
31
|
+
if (previous !== undefined) {
|
|
32
|
+
if (previous.generation === entry.generation) {
|
|
33
|
+
throw new Error("Keyed service repeated a live generation");
|
|
34
|
+
}
|
|
35
|
+
this.#remove(previous);
|
|
36
|
+
}
|
|
37
|
+
this.#entries.set(entry.key, entry);
|
|
38
|
+
if (this.#ready)
|
|
39
|
+
this.#startAll(entry);
|
|
40
|
+
}
|
|
41
|
+
remove(entry) {
|
|
42
|
+
if (this.#entries.get(entry.key) !== entry)
|
|
43
|
+
return;
|
|
44
|
+
this.#remove(entry);
|
|
45
|
+
}
|
|
46
|
+
ready() {
|
|
47
|
+
this.#assertActive();
|
|
48
|
+
if (this.#ready)
|
|
49
|
+
return;
|
|
50
|
+
this.#ready = true;
|
|
51
|
+
for (const entry of this.#entries.values())
|
|
52
|
+
this.#startAll(entry);
|
|
53
|
+
}
|
|
54
|
+
reset() {
|
|
55
|
+
if (this.#disposed)
|
|
56
|
+
return;
|
|
57
|
+
this.#ready = false;
|
|
58
|
+
for (const entry of [...this.#entries.values()])
|
|
59
|
+
this.#remove(entry);
|
|
60
|
+
}
|
|
61
|
+
observe(handler) {
|
|
62
|
+
this.#assertActive();
|
|
63
|
+
const observer = {
|
|
64
|
+
handler: handler,
|
|
65
|
+
tasks: new Map(),
|
|
66
|
+
closed: false,
|
|
67
|
+
};
|
|
68
|
+
this.#observers.add(observer);
|
|
69
|
+
if (this.#ready) {
|
|
70
|
+
for (const entry of this.#entries.values())
|
|
71
|
+
this.#start(observer, entry);
|
|
72
|
+
}
|
|
73
|
+
return () => {
|
|
74
|
+
if (observer.closed)
|
|
75
|
+
return;
|
|
76
|
+
observer.closed = true;
|
|
77
|
+
for (const task of observer.tasks.values())
|
|
78
|
+
task.cancel();
|
|
79
|
+
observer.tasks.clear();
|
|
80
|
+
this.#observers.delete(observer);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
dispose() {
|
|
84
|
+
if (this.#disposed)
|
|
85
|
+
return;
|
|
86
|
+
this.#disposed = true;
|
|
87
|
+
for (const observer of this.#observers) {
|
|
88
|
+
observer.closed = true;
|
|
89
|
+
for (const task of observer.tasks.values())
|
|
90
|
+
task.cancel();
|
|
91
|
+
observer.tasks.clear();
|
|
92
|
+
}
|
|
93
|
+
this.#observers.clear();
|
|
94
|
+
for (const entry of [...this.#entries.values()]) {
|
|
95
|
+
entry.deactivate();
|
|
96
|
+
}
|
|
97
|
+
this.#entries.clear();
|
|
98
|
+
}
|
|
99
|
+
#remove(entry) {
|
|
100
|
+
if (this.#entries.get(entry.key) !== entry)
|
|
101
|
+
return;
|
|
102
|
+
this.#entries.delete(entry.key);
|
|
103
|
+
entry.deactivate();
|
|
104
|
+
for (const observer of this.#observers) {
|
|
105
|
+
observer.tasks.get(entry)?.cancel();
|
|
106
|
+
observer.tasks.delete(entry);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
#startAll(entry) {
|
|
110
|
+
for (const observer of this.#observers)
|
|
111
|
+
this.#start(observer, entry);
|
|
112
|
+
}
|
|
113
|
+
#start(observer, entry) {
|
|
114
|
+
if (observer.closed || observer.tasks.has(entry))
|
|
115
|
+
return;
|
|
116
|
+
const { context, cancel } = withCancel(BACKGROUND_CONTEXT);
|
|
117
|
+
observer.tasks.set(entry, { cancel });
|
|
118
|
+
try {
|
|
119
|
+
void Promise.resolve(observer.handler(entry.service, context)).catch((error) => {
|
|
120
|
+
if (!context.abortSignal?.aborted)
|
|
121
|
+
this.#reportError(toError(error));
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
if (!context.abortSignal?.aborted)
|
|
126
|
+
this.#reportError(toError(error));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
#assertActive() {
|
|
130
|
+
if (this.#disposed)
|
|
131
|
+
throw new Error("Keyed service directory is disposed");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function toError(error) {
|
|
135
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=instances.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.js","sourceRoot":"","sources":["../../src/services/instances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EA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;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO;gBAAE,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,CAAC;IAAA,CACD;IAED,aAAa,GAAS;QACrB,IAAI,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IAAA,CAC3E;CACD;AAED,SAAS,OAAO,CAAC,KAAc,EAAS;IACvC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CACjE","sourcesContent":["import { BACKGROUND_CONTEXT, withCancel } from \"../context/index.ts\";\nimport type { Context } from \"../types.ts\";\n\nexport interface InstanceDirectoryEntry {\n\treadonly key: string;\n\treadonly generation: number;\n\treadonly service: object;\n\tdeactivate(): void;\n}\n\ninterface Observer {\n\treadonly handler: (service: object, context: Context) => void | Promise<void>;\n\treadonly tasks: Map<InstanceDirectoryEntry, { readonly cancel: (reason?: unknown) => void }>;\n\tclosed: boolean;\n}\n\n/** Owns keyed instance lifetime and the cancellable tasks observing those instances. */\nexport class InstanceDirectory<TEntry extends InstanceDirectoryEntry> {\n\treadonly #entries = new Map<string, TEntry>();\n\treadonly #observers = new Set<Observer>();\n\treadonly #reportError: (error: Error) => void;\n\t#ready: boolean;\n\t#disposed = false;\n\n\tconstructor(options: { readonly ready: boolean; readonly onError: (error: Error) => void }) {\n\t\tthis.#ready = options.ready;\n\t\tthis.#reportError = options.onError;\n\t}\n\n\tget observerCount(): number {\n\t\treturn this.#observers.size;\n\t}\n\n\tget(key: string): TEntry | undefined {\n\t\treturn this.#entries.get(key);\n\t}\n\n\tinsert(entry: TEntry): void {\n\t\tthis.#assertActive();\n\t\tif (this.#entries.has(entry.key)) {\n\t\t\tthrow new Error(`Keyed service already has a live instance with key ${entry.key}`);\n\t\t}\n\t\tthis.#entries.set(entry.key, entry);\n\t\tif (this.#ready) this.#startAll(entry);\n\t}\n\n\treplace(entry: TEntry): void {\n\t\tthis.#assertActive();\n\t\tconst previous = this.#entries.get(entry.key);\n\t\tif (previous !== undefined) {\n\t\t\tif (previous.generation === entry.generation) {\n\t\t\t\tthrow new Error(\"Keyed service repeated a live generation\");\n\t\t\t}\n\t\t\tthis.#remove(previous);\n\t\t}\n\t\tthis.#entries.set(entry.key, entry);\n\t\tif (this.#ready) this.#startAll(entry);\n\t}\n\n\tremove(entry: TEntry): void {\n\t\tif (this.#entries.get(entry.key) !== entry) return;\n\t\tthis.#remove(entry);\n\t}\n\n\tready(): void {\n\t\tthis.#assertActive();\n\t\tif (this.#ready) return;\n\t\tthis.#ready = true;\n\t\tfor (const entry of this.#entries.values()) this.#startAll(entry);\n\t}\n\n\treset(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#ready = false;\n\t\tfor (const entry of [...this.#entries.values()]) this.#remove(entry);\n\t}\n\n\tobserve<T>(handler: (service: T, context: Context) => void | Promise<void>): () => void {\n\t\tthis.#assertActive();\n\t\tconst observer: Observer = {\n\t\t\thandler: handler as Observer[\"handler\"],\n\t\t\ttasks: new Map(),\n\t\t\tclosed: false,\n\t\t};\n\t\tthis.#observers.add(observer);\n\t\tif (this.#ready) {\n\t\t\tfor (const entry of this.#entries.values()) this.#start(observer, entry);\n\t\t}\n\t\treturn () => {\n\t\t\tif (observer.closed) return;\n\t\t\tobserver.closed = true;\n\t\t\tfor (const task of observer.tasks.values()) task.cancel();\n\t\t\tobserver.tasks.clear();\n\t\t\tthis.#observers.delete(observer);\n\t\t};\n\t}\n\n\tdispose(): void {\n\t\tif (this.#disposed) return;\n\t\tthis.#disposed = true;\n\t\tfor (const observer of this.#observers) {\n\t\t\tobserver.closed = true;\n\t\t\tfor (const task of observer.tasks.values()) task.cancel();\n\t\t\tobserver.tasks.clear();\n\t\t}\n\t\tthis.#observers.clear();\n\t\tfor (const entry of [...this.#entries.values()]) {\n\t\t\tentry.deactivate();\n\t\t}\n\t\tthis.#entries.clear();\n\t}\n\n\t#remove(entry: TEntry): void {\n\t\tif (this.#entries.get(entry.key) !== entry) return;\n\t\tthis.#entries.delete(entry.key);\n\t\tentry.deactivate();\n\t\tfor (const observer of this.#observers) {\n\t\t\tobserver.tasks.get(entry)?.cancel();\n\t\t\tobserver.tasks.delete(entry);\n\t\t}\n\t}\n\n\t#startAll(entry: TEntry): void {\n\t\tfor (const observer of this.#observers) this.#start(observer, entry);\n\t}\n\n\t#start(observer: Observer, entry: TEntry): void {\n\t\tif (observer.closed || observer.tasks.has(entry)) return;\n\t\tconst { context, cancel } = withCancel(BACKGROUND_CONTEXT);\n\t\tobserver.tasks.set(entry, { cancel });\n\t\ttry {\n\t\t\tvoid Promise.resolve(observer.handler(entry.service, context)).catch((error: unknown) => {\n\t\t\t\tif (!context.abortSignal?.aborted) this.#reportError(toError(error));\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tif (!context.abortSignal?.aborted) this.#reportError(toError(error));\n\t\t}\n\t}\n\n\t#assertActive(): void {\n\t\tif (this.#disposed) throw new Error(\"Keyed service directory is disposed\");\n\t}\n}\n\nfunction toError(error: unknown): Error {\n\treturn error instanceof Error ? error : new Error(String(error));\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RemoteServiceTransport } from "../types.ts";
|
|
2
|
+
import type { RemoteServiceProvider } from "./provider.ts";
|
|
3
|
+
/** Connects a provider to a binding without changing remote service semantics. */
|
|
4
|
+
export declare function createLoopbackServiceTransport(provider: RemoteServiceProvider): RemoteServiceTransport;
|
|
5
|
+
//# sourceMappingURL=loopback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loopback.d.ts","sourceRoot":"","sources":["../../src/services/loopback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,kFAAkF;AAClF,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,qBAAqB,GAAG,sBAAsB,CAYtG","sourcesContent":["import type { RemoteServiceTransport } from \"../types.ts\";\nimport type { RemoteServiceProvider } from \"./provider.ts\";\n\n/** Connects a provider to a binding without changing remote service semantics. */\nexport function createLoopbackServiceTransport(provider: RemoteServiceProvider): RemoteServiceTransport {\n\treturn {\n\t\tinvoke: (call, context) => provider.invoke(call, context),\n\t\tsubscribe: async (serviceId, mode, listener) => {\n\t\t\tconst subscription = provider.subscribe(serviceId, mode, listener);\n\t\t\treturn {\n\t\t\t\tsnapshot: subscription.snapshot,\n\t\t\t\tactivate: () => subscription.activate(),\n\t\t\t\tclose: () => subscription.close(),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Connects a provider to a binding without changing remote service semantics. */
|
|
2
|
+
export function createLoopbackServiceTransport(provider) {
|
|
3
|
+
return {
|
|
4
|
+
invoke: (call, context) => provider.invoke(call, context),
|
|
5
|
+
subscribe: async (serviceId, mode, listener) => {
|
|
6
|
+
const subscription = provider.subscribe(serviceId, mode, listener);
|
|
7
|
+
return {
|
|
8
|
+
snapshot: subscription.snapshot,
|
|
9
|
+
activate: () => subscription.activate(),
|
|
10
|
+
close: () => subscription.close(),
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=loopback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loopback.js","sourceRoot":"","sources":["../../src/services/loopback.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,MAAM,UAAU,8BAA8B,CAAC,QAA+B,EAA0B;IACvG,OAAO;QACN,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC;QACzD,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC;YAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;YACnE,OAAO;gBACN,QAAQ,EAAE,YAAY,CAAC,QAAQ;gBAC/B,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE;gBACvC,KAAK,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE;aACjC,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["import type { RemoteServiceTransport } from \"../types.ts\";\nimport type { RemoteServiceProvider } from \"./provider.ts\";\n\n/** Connects a provider to a binding without changing remote service semantics. */\nexport function createLoopbackServiceTransport(provider: RemoteServiceProvider): RemoteServiceTransport {\n\treturn {\n\t\tinvoke: (call, context) => provider.invoke(call, context),\n\t\tsubscribe: async (serviceId, mode, listener) => {\n\t\t\tconst subscription = provider.subscribe(serviceId, mode, listener);\n\t\t\treturn {\n\t\t\t\tsnapshot: subscription.snapshot,\n\t\t\t\tactivate: () => subscription.activate(),\n\t\t\t\tclose: () => subscription.close(),\n\t\t\t};\n\t\t},\n\t};\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Context, JsonValue, RemoteServiceContract, Service, ServiceCall, ServiceCatalogueEntry, ServiceMode, ServiceProviderUpdate, ServiceSubscription } from "../types.ts";
|
|
2
|
+
interface ServiceProviderDefinition {
|
|
3
|
+
readonly service: {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly local?: boolean;
|
|
6
|
+
};
|
|
7
|
+
readonly mode: ServiceMode;
|
|
8
|
+
}
|
|
9
|
+
export type ServiceUpdatePublisher = (subscriptionId: string, update: ServiceProviderUpdate, context: Context) => void | Promise<void>;
|
|
10
|
+
/** Hosts one provider for one remote consumer and owns that consumer's subscriptions. */
|
|
11
|
+
export interface RemoteServiceEndpoint {
|
|
12
|
+
invoke(call: ServiceCall, publish: ServiceUpdatePublisher, context: Context): Promise<JsonValue | undefined>;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class RemoteServiceProvider {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(entries: readonly (ServiceProviderDefinition | {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
})[]);
|
|
20
|
+
get catalogue(): readonly ServiceCatalogueEntry[];
|
|
21
|
+
provide<T>(service: Service<T>, implementation: NoInfer<RemoteServiceContract<T>>): void;
|
|
22
|
+
/** Disconnect one singleton while preserving active subscriptions and remote facades. */
|
|
23
|
+
withdraw<T>(service: Service<T>): void;
|
|
24
|
+
/** Check a singleton replacement without changing the active provider. */
|
|
25
|
+
validateReplacement<T>(service: Service<T>, implementation: NoInfer<RemoteServiceContract<T>>): void;
|
|
26
|
+
/** Replace one singleton without making its stable remote facade unavailable. */
|
|
27
|
+
replace<T>(service: Service<T>, implementation: NoInfer<RemoteServiceContract<T>>): void;
|
|
28
|
+
use<T>(service: Service<T>): T;
|
|
29
|
+
spawn<T>(service: Service<T>, key: string, implementation: NoInfer<RemoteServiceContract<T>>): () => void;
|
|
30
|
+
invoke(call: ServiceCall, context: Context): Promise<JsonValue | undefined>;
|
|
31
|
+
subscribe(serviceId: string, mode: ServiceMode, listener: (update: ServiceProviderUpdate, context: Context) => void): ServiceSubscription;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function createRemoteServiceEndpoint(provider: RemoteServiceProvider): RemoteServiceEndpoint;
|
|
35
|
+
export declare function validateRemoteServiceImplementation(serviceId: string, implementation: unknown): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=provider.d.ts.map
|