@code-yeongyu/senpi 2026.8.1 → 2026.8.3
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 +33 -0
- package/README.md +1 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +27 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/credential-print.d.ts +23 -0
- package/dist/cli/credential-print.d.ts.map +1 -0
- package/dist/cli/credential-print.js +116 -0
- package/dist/cli/credential-print.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/remote-session.d.ts +53 -0
- package/dist/client/remote-session.d.ts.map +1 -0
- package/dist/client/remote-session.js +340 -0
- package/dist/client/remote-session.js.map +1 -0
- package/dist/client/transcript.d.ts +12 -0
- package/dist/client/transcript.d.ts.map +1 -0
- package/dist/client/transcript.js +98 -0
- package/dist/client/transcript.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +36 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +325 -41
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +5 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +72 -11
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/dynamic-prompt/verification.d.ts +2 -2
- package/dist/core/dynamic-prompt/verification.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/verification.js +2 -2
- package/dist/core/dynamic-prompt/verification.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts +17 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js +56 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/bounded-queue.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +32 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +43 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts +18 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js +46 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-commit-boundary.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +81 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +127 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts +10 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js +34 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-entry-annotations.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +56 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +174 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts +24 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js +34 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reaper.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +34 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +85 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts +2 -13
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +34 -55
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +35 -93
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +13 -11
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +44 -55
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts +3 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +101 -126
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts +2 -31
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +26 -98
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts +14 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js +42 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-claim.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts +32 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js +8 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-types.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts +16 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js +92 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-events.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +48 -88
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts +18 -1
- package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/checkpoint-state.js +32 -0
- package/dist/core/extensions/builtin/compaction/checkpoint-state.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +4 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/idle-retry.d.ts +21 -0
- package/dist/core/extensions/builtin/compaction/idle-retry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/idle-retry.js +24 -0
- package/dist/core/extensions/builtin/compaction/idle-retry.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +91 -13
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/lane-policy.d.ts +71 -0
- package/dist/core/extensions/builtin/compaction/lane-policy.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/lane-policy.js +94 -0
- package/dist/core/extensions/builtin/compaction/lane-policy.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.js +1 -0
- package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts +59 -0
- package/dist/core/extensions/builtin/compaction/overflow-retry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/overflow-retry.js +155 -0
- package/dist/core/extensions/builtin/compaction/overflow-retry.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +17 -98
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/transient-failure.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/transient-failure.js +3 -0
- package/dist/core/extensions/builtin/compaction/transient-failure.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.js +13 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js +23 -5
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.js +42 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/health.d.ts.map +1 -1
- package/dist/core/extensions/builtin/mcp/health.js +2 -1
- package/dist/core/extensions/builtin/mcp/health.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +5 -3
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +8 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.js +1 -0
- package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.js +1 -1
- package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +14 -18
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +4 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +18 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +16 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +10 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +24 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/model-registry.d.ts +2 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +3 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts +0 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +18 -34
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/pi-manifest.d.ts +9 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +25 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/resource-loader.d.ts +15 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +55 -6
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/retry-fallback/hint-policy.d.ts +29 -0
- package/dist/core/retry-fallback/hint-policy.d.ts.map +1 -0
- package/dist/core/retry-fallback/hint-policy.js +54 -0
- package/dist/core/retry-fallback/hint-policy.js.map +1 -0
- package/dist/core/retry-fallback/probe-scheduler.d.ts +60 -0
- package/dist/core/retry-fallback/probe-scheduler.d.ts.map +1 -0
- package/dist/core/retry-fallback/probe-scheduler.js +206 -0
- package/dist/core/retry-fallback/probe-scheduler.js.map +1 -0
- package/dist/core/retry-fallback/settings.d.ts +9 -0
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +14 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +21 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/extensions/llama/provider.js +1 -1
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +44 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +5 -2
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +16 -4
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/continuity-notice.d.ts +21 -0
- package/dist/modes/interactive/components/continuity-notice.d.ts.map +1 -0
- package/dist/modes/interactive/components/continuity-notice.js +58 -0
- package/dist/modes/interactive/components/continuity-notice.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +4 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +6 -2
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts +3 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +8 -2
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/help-content.d.ts.map +1 -1
- package/dist/modes/interactive/help-content.js +1 -0
- package/dist/modes/interactive/help-content.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +21 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +151 -50
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +1 -0
- package/dist/modes/interactive/theme/grok-day.json +1 -0
- package/dist/modes/interactive/theme/grok-night.json +1 -0
- package/dist/modes/interactive/theme/light.json +1 -0
- package/dist/modes/interactive/theme/theme-schema.json +5 -1
- package/dist/modes/interactive/theme/theme.d.ts +2 -2
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +13 -3
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +13 -0
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +22 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/docs/AGENTS.md +1 -6
- package/docs/custom-provider.md +10 -3
- package/docs/development.md +1 -2
- package/docs/extensions.md +24 -1
- package/docs/keybindings.md +13 -0
- package/docs/mcp.md +63 -4
- package/docs/models.md +1 -0
- package/docs/providers.md +20 -0
- package/docs/release-guide.md +5 -3
- package/docs/session-format.md +2 -0
- package/docs/settings.md +2 -0
- package/docs/skills.md +29 -0
- package/docs/themes.md +5 -3
- package/docs/usage.md +5 -0
- package/examples/extensions/custom-compaction.ts +1 -2
- package/examples/extensions/custom-provider-anthropic/index.ts +8 -2
- package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
- package/examples/extensions/handoff.ts +2 -3
- package/examples/extensions/qna.ts +2 -2
- package/examples/rpc-extension-ui.ts +11 -2
- package/examples/sdk/02-custom-model.ts +1 -2
- package/examples/sdk/12-full-control.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +14 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +156 -67
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts +3 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js +70 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/array-session-reader.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts +4 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js +22 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/fork.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts +13 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js +304 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-store.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts +17 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js +60 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/keyed-operation-queue.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts +6 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js +107 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-store.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts +28 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js +61 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repository.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts +8 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js +22 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/search-backend.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +6 -10
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +154 -77
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +49 -23
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +6 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +6 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +4 -4
- package/node_modules/@earendil-works/pi-ai/README.md +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +46 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.d.ts.map +1 -0
- package/{dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js → node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js} +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +64 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +12 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +13 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +12 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +19 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +84 -47
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +17 -8
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +11 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +7 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +81 -26
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +16 -8
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +4 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +13 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js +23 -4
- package/node_modules/@earendil-works/pi-ai/dist/utils/error-body.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +10 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +13 -12
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts +24 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js +233 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-hint.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +10 -6
- package/node_modules/@earendil-works/pi-client/CHANGELOG.md +7 -0
- package/node_modules/@earendil-works/pi-client/README.md +64 -0
- package/node_modules/@earendil-works/pi-client/dist/client.d.ts +25 -0
- package/node_modules/@earendil-works/pi-client/dist/client.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/client.js +386 -0
- package/node_modules/@earendil-works/pi-client/dist/client.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/connection.d.ts +25 -0
- package/node_modules/@earendil-works/pi-client/dist/connection.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/connection.js +204 -0
- package/node_modules/@earendil-works/pi-client/dist/connection.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/errors.d.ts +23 -0
- package/node_modules/@earendil-works/pi-client/dist/errors.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/errors.js +42 -0
- package/node_modules/@earendil-works/pi-client/dist/errors.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/index.d.ts +6 -0
- package/node_modules/@earendil-works/pi-client/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/index.js +3 -0
- package/node_modules/@earendil-works/pi-client/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/promise.d.ts +8 -0
- package/node_modules/@earendil-works/pi-client/dist/promise.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/promise.js +11 -0
- package/node_modules/@earendil-works/pi-client/dist/promise.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts +54 -0
- package/node_modules/@earendil-works/pi-client/dist/session-handle.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/session-handle.js +50 -0
- package/node_modules/@earendil-works/pi-client/dist/session-handle.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/state.d.ts +22 -0
- package/node_modules/@earendil-works/pi-client/dist/state.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/state.js +149 -0
- package/node_modules/@earendil-works/pi-client/dist/state.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/transport.d.ts +17 -0
- package/node_modules/@earendil-works/pi-client/dist/transport.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/transport.js +2 -0
- package/node_modules/@earendil-works/pi-client/dist/transport.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/types.d.ts +23 -0
- package/node_modules/@earendil-works/pi-client/dist/types.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/types.js +2 -0
- package/node_modules/@earendil-works/pi-client/dist/types.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/unix.d.ts +8 -0
- package/node_modules/@earendil-works/pi-client/dist/unix.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-client/dist/unix.js +151 -0
- package/node_modules/@earendil-works/pi-client/dist/unix.js.map +1 -0
- package/node_modules/@earendil-works/pi-client/package.json +56 -0
- package/node_modules/@earendil-works/pi-protocol/README.md +68 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts +4 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js +163 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/decoder.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts +4 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js +199 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/encoder.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts +4 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js +4 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts +26 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js +29 -0
- package/node_modules/@earendil-works/pi-protocol/dist/cbor/options.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts +29 -0
- package/node_modules/@earendil-works/pi-protocol/dist/codec.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/codec.js +140 -0
- package/node_modules/@earendil-works/pi-protocol/dist/codec.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts +29 -0
- package/node_modules/@earendil-works/pi-protocol/dist/framing.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/framing.js +152 -0
- package/node_modules/@earendil-works/pi-protocol/dist/framing.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/index.d.ts +5 -0
- package/node_modules/@earendil-works/pi-protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/index.js +5 -0
- package/node_modules/@earendil-works/pi-protocol/dist/index.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts +13818 -0
- package/node_modules/@earendil-works/pi-protocol/dist/schemas.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/dist/schemas.js +382 -0
- package/node_modules/@earendil-works/pi-protocol/dist/schemas.js.map +1 -0
- package/node_modules/@earendil-works/pi-protocol/package.json +48 -0
- package/node_modules/@earendil-works/pi-pty/package.json +2 -2
- package/node_modules/@earendil-works/pi-tui/README.md +77 -14
- package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts +83 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js +687 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiAltScreen.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/TuiMainScreen.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts +13 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js +36 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/alt-screen-flash.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts +7 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js +43 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/h-stack.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +4 -4
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +3 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts +51 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js +163 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/scroll-view.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +3 -6
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts +32 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/stack.js +109 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/stack.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts +8 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js +21 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/v-stack.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +10 -4
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +10 -4
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +30 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +18 -0
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts +40 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout-node.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout-node.js +6 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout-node.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts +40 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout.js +315 -0
- package/node_modules/@earendil-works/pi-tui/dist/layout.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +10 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +61 -3
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-text.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js +12 -2
- package/node_modules/@earendil-works/pi-tui/dist/terminal-text.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +36 -16
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +72 -18
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +10 -0
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +95 -4
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +2 -2
- package/node_modules/typebox/build/compile/validator.d.mts +3 -11
- package/node_modules/typebox/build/compile/validator.mjs +6 -36
- package/node_modules/typebox/build/error/errors.d.mts +1 -7
- package/node_modules/typebox/build/format/_idna.mjs +36 -6
- package/node_modules/typebox/build/format/_puny.mjs +4 -1
- package/node_modules/typebox/build/format/uuid.d.mts +2 -2
- package/node_modules/typebox/build/format/uuid.mjs +3 -3
- package/node_modules/typebox/build/guard/emit.d.mts +0 -4
- package/node_modules/typebox/build/guard/emit.mjs +0 -8
- package/node_modules/typebox/build/guard/guard.d.mts +5 -9
- package/node_modules/typebox/build/guard/guard.mjs +10 -15
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +3 -3
- package/node_modules/typebox/build/schema/engine/boolean.mjs +4 -4
- package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
- package/node_modules/typebox/build/schema/engine/schema.mjs +6 -11
- package/node_modules/typebox/build/schema/engine/type.mjs +14 -18
- package/node_modules/typebox/build/schema/types/dependencies.mjs +1 -1
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -1
- package/node_modules/typebox/build/schema/types/index.mjs +0 -1
- package/node_modules/typebox/build/schema/types/schema.d.mts +1 -1
- package/node_modules/typebox/build/schema/types/schema.mjs +2 -2
- package/node_modules/typebox/build/system/locale/ar_001.mjs +0 -1
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +0 -1
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/de_DE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/el_GR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/en_US.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_419.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_AR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_ES.mjs +0 -1
- package/node_modules/typebox/build/system/locale/es_MX.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/id_ID.mjs +0 -1
- package/node_modules/typebox/build/system/locale/it_IT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +0 -1
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +0 -1
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +0 -1
- package/node_modules/typebox/build/system/locale/th_TH.mjs +0 -1
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +0 -1
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +0 -1
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +0 -1
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +0 -1
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +0 -1
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +0 -1
- package/node_modules/typebox/build/system/memory/clone.d.mts +2 -3
- package/node_modules/typebox/build/system/memory/clone.mjs +73 -26
- package/node_modules/typebox/build/system/settings/settings.d.mts +15 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +3 -1
- package/node_modules/typebox/build/type/action/_add_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_add_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_immutable.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_optional.mjs +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.d.mts +11 -0
- package/node_modules/typebox/build/type/action/_remove_readonly.mjs +11 -0
- package/node_modules/typebox/build/type/action/conditional.d.mts +2 -3
- package/node_modules/typebox/build/type/action/conditional.mjs +2 -1
- package/node_modules/typebox/build/type/action/index.d.mts +7 -4
- package/node_modules/typebox/build/type/action/index.mjs +7 -4
- package/node_modules/typebox/build/type/action/mapped.d.mts +2 -3
- package/node_modules/typebox/build/type/action/mapped.mjs +2 -1
- package/node_modules/typebox/build/type/action/module.d.mts +8 -7
- package/node_modules/typebox/build/type/action/module.mjs +7 -6
- package/node_modules/typebox/build/type/action/readonly_object.mjs +3 -0
- package/node_modules/typebox/build/type/action/with.d.mts +11 -0
- package/node_modules/typebox/build/type/action/with.mjs +11 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +2 -2
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +2 -3
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +3 -6
- package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +6 -9
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +10 -16
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +9 -15
- package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +8 -14
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +2 -5
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +3 -2
- package/node_modules/typebox/build/type/engine/enum/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/enum/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +1 -2
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +2 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +10 -6
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +3 -3
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +17 -5
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +34 -8
- package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +5 -6
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +11 -12
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/index.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/index.mjs +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +4 -4
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +9 -6
- package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +5 -2
- package/node_modules/typebox/build/type/engine/instantiate.d.mts +44 -31
- package/node_modules/typebox/build/type/engine/instantiate.mjs +82 -83
- package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +3 -6
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +2 -1
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +5 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +3 -3
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +5 -4
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +10 -5
- package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +7 -9
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +17 -15
- package/node_modules/typebox/build/type/engine/object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +3 -4
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +2 -1
- package/node_modules/typebox/build/type/engine/partial/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/priority/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/priority/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +28 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +14 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +2 -2
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +8 -5
- package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +2 -2
- package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +3 -3
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +6 -6
- package/node_modules/typebox/build/type/engine/required/from_dependent.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +8 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +3 -2
- package/node_modules/typebox/build/type/engine/required/from_object.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +2 -2
- package/node_modules/typebox/build/type/engine/required/from_type.d.mts +3 -1
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +7 -4
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +3 -3
- package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +6 -6
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +1 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +1 -4
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +7 -13
- package/node_modules/typebox/build/type/engine/with/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/{options → with}/instantiate.mjs +5 -5
- package/node_modules/typebox/build/type/extends/dependent.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/dependent.mjs +6 -0
- package/node_modules/typebox/build/type/extends/enum.d.mts +4 -4
- package/node_modules/typebox/build/type/extends/enum.mjs +3 -2
- package/node_modules/typebox/build/type/extends/extends_left.d.mts +5 -7
- package/node_modules/typebox/build/type/extends/extends_left.mjs +24 -27
- package/node_modules/typebox/build/type/extends/extends_right.d.mts +7 -5
- package/node_modules/typebox/build/type/extends/extends_right.mjs +20 -15
- package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
- package/node_modules/typebox/build/type/extends/object.d.mts +8 -1
- package/node_modules/typebox/build/type/extends/object.mjs +25 -3
- package/node_modules/typebox/build/type/extends/parameters.mjs +2 -2
- package/node_modules/typebox/build/type/extends/record.d.mts +13 -0
- package/node_modules/typebox/build/type/extends/record.mjs +23 -0
- package/node_modules/typebox/build/type/extends/template_literal.d.mts +3 -3
- package/node_modules/typebox/build/type/extends/template_literal.mjs +3 -3
- package/node_modules/typebox/build/type/extends/tuple.d.mts +3 -6
- package/node_modules/typebox/build/type/extends/tuple.mjs +6 -5
- package/node_modules/typebox/build/type/extends/union.mjs +2 -2
- package/node_modules/typebox/build/type/script/mapping.d.mts +86 -98
- package/node_modules/typebox/build/type/script/mapping.mjs +95 -92
- package/node_modules/typebox/build/type/script/parser.d.mts +42 -40
- package/node_modules/typebox/build/type/script/parser.mjs +23 -22
- package/node_modules/typebox/build/type/script/script.d.mts +3 -4
- package/node_modules/typebox/build/type/script/script.mjs +3 -2
- package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -1
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/internal/take.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/until.mjs +2 -2
- package/node_modules/typebox/build/type/types/_codec.d.mts +12 -12
- package/node_modules/typebox/build/type/types/_codec.mjs +0 -1
- package/node_modules/typebox/build/type/types/_immutable.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_immutable.mjs +2 -10
- package/node_modules/typebox/build/type/types/_optional.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_optional.mjs +2 -11
- package/node_modules/typebox/build/type/types/_readonly.d.mts +2 -9
- package/node_modules/typebox/build/type/types/_readonly.mjs +2 -10
- package/node_modules/typebox/build/type/types/_refine.d.mts +8 -10
- package/node_modules/typebox/build/type/types/_refine.mjs +1 -2
- package/node_modules/typebox/build/type/types/call.d.mts +3 -3
- package/node_modules/typebox/build/type/types/call.mjs +3 -2
- package/node_modules/typebox/build/type/types/deferred.d.mts +1 -0
- package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
- package/node_modules/typebox/build/type/types/dependent.d.mts +17 -0
- package/node_modules/typebox/build/type/types/dependent.mjs +24 -0
- package/node_modules/typebox/build/type/types/enum.d.mts +3 -1
- package/node_modules/typebox/build/type/types/enum.mjs +5 -0
- package/node_modules/typebox/build/type/types/index.d.mts +1 -4
- package/node_modules/typebox/build/type/types/index.mjs +1 -4
- package/node_modules/typebox/build/type/types/number.d.mts +1 -1
- package/node_modules/typebox/build/type/types/number.mjs +1 -1
- package/node_modules/typebox/build/type/types/record.d.mts +13 -7
- package/node_modules/typebox/build/type/types/record.mjs +15 -9
- package/node_modules/typebox/build/type/types/static.d.mts +2 -5
- package/node_modules/typebox/build/typebox.d.mts +3 -7
- package/node_modules/typebox/build/typebox.mjs +3 -7
- package/node_modules/typebox/build/value/clean/clean.mjs +4 -2
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/value/clean/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/clean/from_union.d.mts +1 -1
- package/node_modules/typebox/build/value/clean/from_union.mjs +1 -2
- package/node_modules/typebox/build/value/clone/clone.mjs +2 -73
- package/node_modules/typebox/build/value/codec/decode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/encode.mjs +4 -2
- package/node_modules/typebox/build/value/codec/from_array.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_object.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_record.mjs +2 -7
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -4
- package/node_modules/typebox/build/value/codec/from_union.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_enum.mjs +3 -4
- package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +1 -1
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +2 -3
- package/node_modules/typebox/build/value/convert/from_type.mjs +19 -21
- package/node_modules/typebox/build/value/create/from_enum.mjs +2 -2
- package/node_modules/typebox/build/value/create/from_type.mjs +23 -31
- package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_type.mjs +8 -10
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/build/value/index.d.mts +0 -1
- package/node_modules/typebox/build/value/index.mjs +0 -1
- package/node_modules/typebox/build/value/repair/from_enum.mjs +2 -3
- package/node_modules/typebox/build/value/repair/from_type.mjs +24 -22
- package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +6 -2
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +62 -26
- package/node_modules/typebox/build/value/value.d.mts +0 -1
- package/node_modules/typebox/build/value/value.mjs +0 -1
- package/node_modules/typebox/package.json +33 -33
- package/node_modules/typebox/readme.md +117 -103
- package/package.json +20 -10
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts +0 -3
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts.map +0 -1
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts +0 -26
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +0 -100
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts +0 -42
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +0 -286
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts +0 -18
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +0 -44
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts +0 -33
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +0 -163
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts +0 -11
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +0 -39
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js.map +0 -1
- package/node_modules/typebox/build/schema/engine/_guard.d.mts +0 -6
- package/node_modules/typebox/build/schema/engine/_guard.mjs +0 -26
- package/node_modules/typebox/build/schema/types/_guard.d.mts +0 -10
- package/node_modules/typebox/build/schema/types/_guard.mjs +0 -16
- package/node_modules/typebox/build/type/action/_optional.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_optional.mjs +0 -40
- package/node_modules/typebox/build/type/action/_readonly.d.mts +0 -19
- package/node_modules/typebox/build/type/action/_readonly.mjs +0 -40
- package/node_modules/typebox/build/type/action/awaited.d.mts +0 -15
- package/node_modules/typebox/build/type/action/awaited.mjs +0 -15
- package/node_modules/typebox/build/type/action/options.d.mts +0 -11
- package/node_modules/typebox/build/type/action/options.mjs +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +0 -11
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +0 -20
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +0 -14
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +0 -24
- package/node_modules/typebox/build/type/engine/options/index.d.mts +0 -1
- package/node_modules/typebox/build/type/engine/options/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +0 -8
- package/node_modules/typebox/build/type/extends/async_iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/iterator.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/iterator.mjs +0 -9
- package/node_modules/typebox/build/type/extends/promise.d.mts +0 -7
- package/node_modules/typebox/build/type/extends/promise.mjs +0 -9
- package/node_modules/typebox/build/type/types/async_iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/async_iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/base.d.mts +0 -50
- package/node_modules/typebox/build/type/types/base.mjs +0 -84
- package/node_modules/typebox/build/type/types/iterator.d.mts +0 -20
- package/node_modules/typebox/build/type/types/iterator.mjs +0 -28
- package/node_modules/typebox/build/type/types/promise.d.mts +0 -21
- package/node_modules/typebox/build/type/types/promise.mjs +0 -29
- package/node_modules/typebox/build/value/clean/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/clean/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/convert/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/convert/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_base.mjs +0 -4
- package/node_modules/typebox/build/value/create/from_iterator.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_iterator.mjs +0 -5
- package/node_modules/typebox/build/value/create/from_promise.d.mts +0 -2
- package/node_modules/typebox/build/value/create/from_promise.mjs +0 -5
- package/node_modules/typebox/build/value/default/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/default/from_base.mjs +0 -5
- package/node_modules/typebox/build/value/mutate/error.d.mts +0 -3
- package/node_modules/typebox/build/value/mutate/error.mjs +0 -6
- package/node_modules/typebox/build/value/mutate/from_array.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_array.mjs +0 -16
- package/node_modules/typebox/build/value/mutate/from_object.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_object.mjs +0 -40
- package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +0 -7
- package/node_modules/typebox/build/value/mutate/from_value.d.mts +0 -2
- package/node_modules/typebox/build/value/mutate/from_value.mjs +0 -12
- package/node_modules/typebox/build/value/mutate/index.d.mts +0 -1
- package/node_modules/typebox/build/value/mutate/index.mjs +0 -1
- package/node_modules/typebox/build/value/mutate/mutate.d.mts +0 -11
- package/node_modules/typebox/build/value/mutate/mutate.mjs +0 -41
- package/node_modules/typebox/build/value/repair/from_base.d.mts +0 -2
- package/node_modules/typebox/build/value/repair/from_base.mjs +0 -8
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.d.mts +0 -0
- /package/node_modules/typebox/build/type/engine/{awaited → with}/index.mjs +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry-hint.js","sourceRoot":"","sources":["../../src/utils/retry-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,SAAS,GAAG,4BAA4B,CAAC;AAC/C,MAAM,kBAAkB,GACvB,gIAAgI,CAAC;AAClI,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IACtC,kBAAkB;IAClB,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;CACpB,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAC5C,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAUjC,uCAAuC;AAEvC,SAAS,aAAa,CAAC,MAA0B,EAAE,QAAgB;IAClE,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,mEAAmE;IACnE,MAAM,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACtC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,YAAY,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC9F,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,s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AQ,CAAC,CAAC;IACpD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC;IAE5C,gBAAgB;IAChB,OAAO,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,0CAA0C;AAE1C,MAAM,UAAU,wBAAwB,CAAC,OAAe,EAAE,MAAc;IACvE,OAAO,GAAG,OAAO,qBAAqB,MAAM,GAAG,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACtD,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACnC,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACzB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Strict 429 retry-hint extractor with canonical marker helpers.\n *\n * Precedence (first match wins, malformed source falls through):\n * 1. retry-after-ms header (strict `^\\d+(?:\\.\\d+)?$`, ceil)\n * 2. retry-after header (strict integer delta-seconds `^\\d+$`, else HTTP-date)\n * 3. x-ratelimit-reset{,-requests,-tokens} (epoch seconds, max-wins)\n * 4. JSON retryDelay strings (ms/s/m units, recursive, max-wins; numeric rejected)\n * 5. body prose (ms-marker, seconds-marker, relative, resets-at ISO8601)\n *\n * Eligibility gate: status 429 OR body marks rate-limit error.\n * Explicit zero = 0 (beats lower-precedence positives).\n * Past absolute times clamp to 0.\n * Absolute times resolve against response Date header (clock-skew safe), else nowMs.\n */\n\nconst MARKER_RE = /\\(retry-after-ms: (\\d+)\\)$/;\nconst RATE_LIMIT_BODY_RE =\n\t/\\b(rate_limit_error|rate_limit_exceeded|too_many_requests|resource_exhausted|rate limit (?:exceeded|hit)|too many requests)\\b/i;\nconst RATE_LIMIT_JSON_VALUES = new Set([\n\t\"rate_limit_error\",\n\t\"rate_limit_exceeded\",\n\t\"too_many_requests\",\n\t\"resource_exhausted\",\n]);\nconst RETRY_AFTER_MS_RE = /^\\d+(?:\\.\\d+)?$/;\nconst DELTA_SECONDS_RE = /^\\d+$/;\n\n/* ---------- public types ---------- */\n\nexport interface RetryHintInput {\n\tstatus?: number;\n\theaders?: Headers;\n\tbodyText: string;\n}\n\n/* ---------- eligibility ---------- */\n\nfunction isRateLimited(status: number | undefined, bodyText: string): boolean {\n\tif (status === 429) return true;\n\tif (RATE_LIMIT_BODY_RE.test(bodyText)) return true;\n\t// JSON type/code fields or retryDelay presence (rate-limit signal)\n\tconst json = tryParseJSON(bodyText);\n\tif (json !== undefined) {\n\t\tconst found = scanValue(json, (v, k) => {\n\t\t\tif (k !== undefined && k.toLowerCase() === \"retrydelay\" && typeof v === \"string\") return true;\n\t\t\tif (typeof v === \"string\" && RATE_LIMIT_JSON_VALUES.has(v)) return true;\n\t\t\tif (v === 429) return true;\n\t\t\treturn false;\n\t\t});\n\t\tif (found) return true;\n\t}\n\treturn false;\n}\n\n/* ---------- 1. retry-after-ms header ---------- */\n\nfunction fromRetryAfterMsHeader(h: Headers | undefined): number | undefined {\n\tconst raw = h?.get(\"retry-after-ms\");\n\tif (raw === null || raw === undefined) return undefined;\n\tif (!RETRY_AFTER_MS_RE.test(raw)) return undefined;\n\tconst val = Number.parseFloat(raw);\n\tif (!Number.isFinite(val) || val < 0) return undefined;\n\treturn Math.ceil(val);\n}\n\n/* ---------- 2. retry-after header ---------- */\n\nfunction fromRetryAfterHeader(h: Headers | undefined, nowMs: number): number | undefined {\n\tconst raw = h?.get(\"retry-after\");\n\tif (raw === null || raw === undefined) return undefined;\n\t// integer delta-seconds\n\tif (DELTA_SECONDS_RE.test(raw)) {\n\t\treturn Number.parseInt(raw, 10) * 1000;\n\t}\n\t// HTTP-date — must contain alphabetic chars to be a real date string\n\tif (/[a-zA-Z]/.test(raw)) {\n\t\tconst parsed = Date.parse(raw);\n\t\tif (!Number.isNaN(parsed)) {\n\t\t\tconst base = dateHeaderMs(h) ?? nowMs;\n\t\t\treturn clampAbsolute(parsed, base);\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/* ---------- 3. x-ratelimit-reset* headers ---------- */\n\nfunction fromXRateLimitReset(h: Headers | undefined, nowMs: number): number | undefined {\n\tlet best: number | undefined;\n\tfor (const key of [\"x-ratelimit-reset\", \"x-ratelimit-reset-requests\", \"x-ratelimit-reset-tokens\"]) {\n\t\tconst raw = h?.get(key);\n\t\tif (raw === null || raw === undefined) continue;\n\t\tconst epoch = Number.parseFloat(raw);\n\t\tif (!Number.isFinite(epoch) || epoch < 0) continue;\n\t\t// reject \"12abc\" — strict number check\n\t\tif (!/^\\d+(?:\\.\\d+)?$/.test(raw)) continue;\n\t\tconst delta = Math.ceil(epoch * 1000 - nowMs);\n\t\tconst clamped = Math.max(0, delta);\n\t\tif (best === undefined || clamped > best) best = clamped;\n\t}\n\treturn best;\n}\n\n/* ---------- 4. JSON retryDelay (recursive, max-wins) ---------- */\n\nconst RETRY_DELAY_RE = /^(\\d+(?:\\.\\d+)?)\\s*(ms|s|m)$/;\n\nfunction fromJsonRetryDelay(bodyText: string): number | undefined {\n\tconst json = tryParseJSON(bodyText);\n\tif (json === undefined) return undefined;\n\tlet best: number | undefined;\n\tscanValue(json, (v) => {\n\t\tif (typeof v !== \"string\") return false;\n\t\tconst m = v.match(RETRY_DELAY_RE);\n\t\tif (!m) return false;\n\t\tconst num = Number.parseFloat(m[1]);\n\t\tconst unit = m[2];\n\t\tconst ms = unit === \"ms\" ? num : unit === \"s\" ? num * 1000 : num * 60_000;\n\t\tconst intMs = Math.ceil(ms);\n\t\tif (best === undefined || intMs > best) best = intMs;\n\t\treturn false; // keep scanning\n\t});\n\treturn best;\n}\n\n/* ---------- 5. body prose ---------- */\n\nfunction fromBodyProse(bodyText: string, nowMs: number): number | undefined {\n\t// ms-marker: retry-after-ms: <N>\n\tlet m = bodyText.match(/retry-after-ms:\\s*(\\d+)/i);\n\tif (m) return Number.parseInt(m[1], 10);\n\n\t// seconds-marker: retry-after: <N>\n\tm = bodyText.match(/retry-after:\\s*(\\d+)/i);\n\tif (m) return Number.parseInt(m[1], 10) * 1000;\n\n\t// relative prose: try again | retry | wait after ... [in] N <unit>\n\tm = bodyText.match(\n\t\t/(?:try again|retry|wait after).*?(?:in\\s+)?(\\d+(?:\\.\\d+)?)\\s*(ms|s|sec|seconds?|m|min|minutes?)\\b/i,\n\t);\n\tif (m) return convertUnit(Number.parseFloat(m[1]), m[2]);\n\n\t// resets at <ISO8601-with-tz>\n\tm = bodyText.match(/resets?\\s+at\\s+(\\S+)/i);\n\tif (m) {\n\t\tconst parsed = Date.parse(m[1]);\n\t\tif (!Number.isNaN(parsed)) return clampAbsolute(parsed, nowMs);\n\t}\n\n\treturn undefined;\n}\n\n/* ---------- helpers ---------- */\n\nfunction dateHeaderMs(h: Headers | undefined): number | undefined {\n\tconst raw = h?.get(\"date\");\n\tif (raw === null || raw === undefined) return undefined;\n\tconst parsed = Date.parse(raw);\n\treturn Number.isNaN(parsed) ? undefined : parsed;\n}\n\nfunction clampAbsolute(targetMs: number, baseMs: number): number {\n\treturn Math.max(0, targetMs - baseMs);\n}\n\nfunction convertUnit(num: number, unit: string): number {\n\tconst u = unit.toLowerCase();\n\tif (u === \"ms\") return Math.ceil(num);\n\tif (u === \"s\" || u === \"sec\" || u === \"second\" || u === \"seconds\") return Math.ceil(num * 1000);\n\treturn Math.ceil(num * 60_000); // m / min / minute / minutes\n}\n\n/** Recursively walk JSON, calling fn on every leaf value with its key. */\nfunction scanValue(\n\tvalue: unknown,\n\tfn: (v: string | number | boolean | null, key?: string) => boolean,\n\tkey?: string,\n): boolean {\n\tif (value === null) return fn(null, key);\n\tif (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") return fn(value, key);\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tif (scanValue(item, fn, key)) return true;\n\t\t}\n\t\treturn false;\n\t}\n\tif (typeof value === \"object\") {\n\t\tfor (const [k, v] of Object.entries(value)) {\n\t\t\tif (scanValue(v, fn, k)) return true;\n\t\t}\n\t\treturn false;\n\t}\n\treturn false;\n}\n\nfunction tryParseJSON(text: string): unknown {\n\t// strip SSE data: prefix lines\n\tconst cleaned = text.replace(/^data:\\s*/gm, \"\").trim();\n\tif (!cleaned.startsWith(\"{\") && !cleaned.startsWith(\"[\")) return undefined;\n\ttry {\n\t\treturn JSON.parse(cleaned);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/* ---------- main extractor ---------- */\n\nexport function extract429RetryAfterMs(input: RetryHintInput, nowMs?: number): number | undefined {\n\tconst now = nowMs ?? Date.now();\n\n\tif (!isRateLimited(input.status, input.bodyText)) return undefined;\n\n\t// 1. retry-after-ms header\n\tconst fromMs = fromRetryAfterMsHeader(input.headers);\n\tif (fromMs !== undefined) return fromMs;\n\n\t// 2. retry-after header\n\tconst fromRa = fromRetryAfterHeader(input.headers, now);\n\tif (fromRa !== undefined) return fromRa;\n\n\t// 3. x-ratelimit-reset* headers\n\tconst fromXrl = fromXRateLimitReset(input.headers, now);\n\tif (fromXrl !== undefined) return fromXrl;\n\n\t// 4. JSON retryDelay\n\tconst fromJson = fromJsonRetryDelay(input.bodyText);\n\tif (fromJson !== undefined) return fromJson;\n\n\t// 5. body prose\n\treturn fromBodyProse(input.bodyText, now);\n}\n\n/* ---------- marker helpers ---------- */\n\nexport function appendRetryAfterMsMarker(message: string, hintMs: number): string {\n\treturn `${message} (retry-after-ms: ${hintMs})`;\n}\n\nexport function parseRetryAfterMsMarker(message: string): number | undefined {\n\tconst m = message.match(MARKER_RE);\n\tif (!m) return undefined;\n\treturn Number.parseInt(m[1], 10);\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-ai",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "2026.8.
|
|
4
|
+
"version": "2026.8.3",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/api/*.d.ts",
|
|
29
29
|
"import": "./dist/api/*.js"
|
|
30
30
|
},
|
|
31
|
+
"./utils/*": {
|
|
32
|
+
"types": "./dist/utils/*.d.ts",
|
|
33
|
+
"import": "./dist/utils/*.js"
|
|
34
|
+
},
|
|
31
35
|
"./oauth": {
|
|
32
36
|
"types": "./dist/oauth.d.ts",
|
|
33
37
|
"import": "./dist/oauth.js"
|
|
@@ -59,12 +63,12 @@
|
|
|
59
63
|
"generate-model-catalog": "tsx scripts/generate-models.ts --strict --json-only --json-output ../../.artifacts/model-catalog",
|
|
60
64
|
"generate-image-models": "tsx scripts/generate-image-models.ts --strict",
|
|
61
65
|
"check:model-data": "tsx scripts/check-model-data.ts",
|
|
62
|
-
"build": "
|
|
63
|
-
"build:offline": "npm run check:model-data &&
|
|
64
|
-
"dev": "
|
|
65
|
-
"dev:tsc": "
|
|
66
|
+
"build": "tsc -p tsconfig.build.json && shx chmod +x dist/cli.js && shx rm -rf dist/providers/data && shx cp -r src/providers/data dist/providers/data",
|
|
67
|
+
"build:offline": "npm run check:model-data && tsc -p tsconfig.build.json && shx chmod +x dist/cli.js && shx rm -rf dist/providers/data && shx cp -r src/providers/data dist/providers/data",
|
|
68
|
+
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
69
|
+
"dev:tsc": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
|
|
66
70
|
"test": "vitest --run",
|
|
67
|
-
"prepublishOnly": "shx rm -rf dist && tsx scripts/generate-models.ts && tsx scripts/generate-image-models.ts &&
|
|
71
|
+
"prepublishOnly": "shx rm -rf dist && tsx scripts/generate-models.ts && tsx scripts/generate-image-models.ts && tsc -p tsconfig.build.json && shx chmod +x dist/cli.js"
|
|
68
72
|
},
|
|
69
73
|
"dependencies": {
|
|
70
74
|
"@anthropic-ai/sdk": "0.91.1",
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @earendil-works/pi-client
|
|
2
|
+
|
|
3
|
+
Transport-neutral client for remote pi sessions. `PiClient` exchanges length-prefixed CBOR messages through a small `ByteTransport` interface. The package has no Node-specific imports.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { PiClient, type ByteTransportFactory } from "@earendil-works/pi-client";
|
|
7
|
+
|
|
8
|
+
const transportFactory: ByteTransportFactory = async (handlers) => {
|
|
9
|
+
// Connect using WebSocket, Unix socket, or another ordered byte transport.
|
|
10
|
+
return {
|
|
11
|
+
async send(chunk) {
|
|
12
|
+
// Deliver chunks in invocation order and honor backpressure.
|
|
13
|
+
},
|
|
14
|
+
close() {},
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const client = new PiClient({ token: bearerToken, transportFactory });
|
|
19
|
+
await client.connect();
|
|
20
|
+
const session = await client.createSession({ cwd: "/workspace" });
|
|
21
|
+
const unsubscribe = session.subscribe((snapshot) => render(snapshot));
|
|
22
|
+
await session.prompt("Inspect this project");
|
|
23
|
+
unsubscribe();
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Call `handlers.onData(chunk)` for inbound bytes, `handlers.onClose()` for an orderly terminal close, and `handlers.onError(error)` for transport failures. A factory must create a fresh transport for every connection attempt.
|
|
27
|
+
|
|
28
|
+
`PiClient` does not reconnect automatically. Call `reconnect()` after disconnection. One connection can attach several sessions. Requests are correlated by ID. Server snapshots and successful response snapshots are authoritative, while progress events do not mutate snapshot state optimistically. Read cached session summaries from `client.snapshot?.sessions`; call `listSessions()` to request a refreshed list from the server.
|
|
29
|
+
|
|
30
|
+
`acquireSession()` returns an independent `SessionLease`; leases cannot be constructed directly. Use `{ mode: "exclusive" }` for a lifecycle or mutation coordinator and `{ mode: "shared" }` when multiple low-level consumers intentionally share the session. Exclusive acquisition fails with `PiSessionOwnershipError` while any lease exists, and shared acquisition fails while an exclusive lease exists. `attachSession()` is a shared-acquisition convenience method. `createSession()` returns an exclusive lease for the newly created session.
|
|
31
|
+
|
|
32
|
+
Calling `dispose()` or `detach()` releases only that lease. A lease rejects commands as soon as release begins. The client sends the protocol detach request after the final lease is released. If explicit `detach()` fails, the lease becomes active again for retry. If cleanup-oriented `dispose()` fails, it reports the protocol error but relinquishes local ownership; `PiClient` reconciles the failed protocol cleanup before the next acquisition. A released lease becomes unavailable without affecting other shared leases. Server removal or disconnection invalidates every lease for the affected attachment, and disposing an invalidated lease is a no-op. Commands fail with `PiDisconnectedError` while the client is disconnected and `PiSessionDetachedError` when the client is connected but a lease is releasing, released, or invalidated. Leases implement `AsyncDisposable`.
|
|
33
|
+
|
|
34
|
+
`subscribe()` observes authoritative snapshots. `onEvent()` observes protocol events. Both return an unsubscribe function. Structured errors returned by the server are exposed as `PiServerError`.
|
|
35
|
+
|
|
36
|
+
## Limits and security
|
|
37
|
+
|
|
38
|
+
`PiClientOptions.maxFrameLength` bounds inbound and outbound CBOR payloads. Configure matching limits on the client and server. Transports should separately bound queued outbound bytes and preserve send order.
|
|
39
|
+
|
|
40
|
+
Treat peers as untrusted. Use a secure transport where required and protect the protocol bearer token.
|
|
41
|
+
|
|
42
|
+
Subscriber exceptions are isolated from protocol state. Set `onListenerError` in `PiClientOptions` to report them to application logging or diagnostics.
|
|
43
|
+
|
|
44
|
+
## Unix-domain sockets
|
|
45
|
+
|
|
46
|
+
Node.js and Bun consumers can use the separately exported Unix-domain socket transport:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { PiClient } from "@earendil-works/pi-client";
|
|
50
|
+
import { createUnixTransportFactory } from "@earendil-works/pi-client/unix";
|
|
51
|
+
|
|
52
|
+
const client = new PiClient({
|
|
53
|
+
token: bearerToken,
|
|
54
|
+
transportFactory: createUnixTransportFactory({
|
|
55
|
+
path: "/tmp/pi.sock",
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await client.connect();
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
`maxPendingBytes` bounds queued outbound data. It defaults to four times the protocol frame limit. The transport preserves send order and waits for socket backpressure before resolving each send.
|
|
63
|
+
|
|
64
|
+
The `@earendil-works/pi-client` root remains transport- and runtime-neutral. Importing the Node-compatible transport requires the explicit `@earendil-works/pi-client/unix` subpath.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ServerEvent, type ServerSnapshot, type SessionSummary } from "@earendil-works/pi-protocol";
|
|
2
|
+
import { type AcquireSessionOptions, type PiSessionHandle } from "./session-handle.ts";
|
|
3
|
+
import type { ConnectionState, ConnectionStateChange, CreateSessionOptions, PiClientOptions, Unsubscribe } from "./types.ts";
|
|
4
|
+
export declare class PiClient {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(options: PiClientOptions);
|
|
7
|
+
get disposed(): boolean;
|
|
8
|
+
get connectionState(): ConnectionState;
|
|
9
|
+
get connected(): boolean;
|
|
10
|
+
get snapshot(): ServerSnapshot | undefined;
|
|
11
|
+
static connect(options: PiClientOptions): Promise<PiClient>;
|
|
12
|
+
connect(): Promise<ServerSnapshot>;
|
|
13
|
+
reconnect(): Promise<ServerSnapshot>;
|
|
14
|
+
disconnect(reason?: string): void;
|
|
15
|
+
subscribe(listener: (snapshot: ServerSnapshot) => void): Unsubscribe;
|
|
16
|
+
onEvent(listener: (event: ServerEvent) => void): Unsubscribe;
|
|
17
|
+
onConnectionStateChange(listener: (change: ConnectionStateChange) => void): Unsubscribe;
|
|
18
|
+
listSessions(): Promise<readonly SessionSummary[]>;
|
|
19
|
+
createSession(options?: CreateSessionOptions): Promise<PiSessionHandle>;
|
|
20
|
+
attachSession(sessionId: string): Promise<PiSessionHandle>;
|
|
21
|
+
acquireSession(sessionId: string, options: AcquireSessionOptions): Promise<PiSessionHandle>;
|
|
22
|
+
dispose(): Promise<void>;
|
|
23
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 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GAAG,OAAO,CAAC,eAAe,CAAC,CAE/D;IAEK,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CA0BhG;IAqKD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAWvB;IAED,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAErC;CA2ED"}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
import { encodeClientMessage, ProtocolValidationError, } from "@earendil-works/pi-protocol";
|
|
2
|
+
import { Connection } from "./connection.js";
|
|
3
|
+
import { PiClientDisposedError, PiDisconnectedError, PiServerError, PiSessionDetachedError, PiSessionOwnershipError, toError, } from "./errors.js";
|
|
4
|
+
import { createPromiseResolvers } from "./promise.js";
|
|
5
|
+
import { SessionHandle, } from "./session-handle.js";
|
|
6
|
+
import { ClientState } from "./state.js";
|
|
7
|
+
export class PiClient {
|
|
8
|
+
#options;
|
|
9
|
+
#connection;
|
|
10
|
+
#state;
|
|
11
|
+
#pendingRequests = new Map();
|
|
12
|
+
#sessionLeaseCounts = new Map();
|
|
13
|
+
#exclusiveSessionLeases = new Map();
|
|
14
|
+
#sessionLeaseGenerations = new Map();
|
|
15
|
+
#sessionAttachments = new Map();
|
|
16
|
+
#sessionDetachments = new Map();
|
|
17
|
+
#sessionCleanupRequired = new Set();
|
|
18
|
+
#sessionReconciliations = new Map();
|
|
19
|
+
#connectionStateListeners = new Set();
|
|
20
|
+
#requestSequence = 0;
|
|
21
|
+
#disposed = false;
|
|
22
|
+
#disposePromise;
|
|
23
|
+
constructor(options) {
|
|
24
|
+
this.#options = options;
|
|
25
|
+
this.#state = new ClientState(options.onListenerError);
|
|
26
|
+
this.#connection = new Connection({
|
|
27
|
+
token: options.token,
|
|
28
|
+
transportFactory: options.transportFactory,
|
|
29
|
+
maxFrameLength: options.maxFrameLength,
|
|
30
|
+
onHandshake: (snapshot) => this.#state.applyServerSnapshot(snapshot),
|
|
31
|
+
onMessage: (message) => this.#handleMessage(message),
|
|
32
|
+
onStateChange: (change) => this.#handleConnectionStateChange(change),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
get disposed() {
|
|
36
|
+
return this.#disposed;
|
|
37
|
+
}
|
|
38
|
+
get connectionState() {
|
|
39
|
+
return this.#connection.state;
|
|
40
|
+
}
|
|
41
|
+
get connected() {
|
|
42
|
+
return this.#connection.state === "connected";
|
|
43
|
+
}
|
|
44
|
+
get snapshot() {
|
|
45
|
+
return this.#state.snapshot;
|
|
46
|
+
}
|
|
47
|
+
static async connect(options) {
|
|
48
|
+
const client = new PiClient(options);
|
|
49
|
+
try {
|
|
50
|
+
await client.connect();
|
|
51
|
+
return client;
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
await client.dispose();
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
connect() {
|
|
59
|
+
if (this.#disposed)
|
|
60
|
+
return Promise.reject(new PiClientDisposedError());
|
|
61
|
+
if (this.#connection.state === "disconnected")
|
|
62
|
+
this.#state.reset();
|
|
63
|
+
return this.#connection.connect();
|
|
64
|
+
}
|
|
65
|
+
reconnect() {
|
|
66
|
+
return this.connect();
|
|
67
|
+
}
|
|
68
|
+
disconnect(reason = "Client disconnected") {
|
|
69
|
+
this.#connection.disconnect(reason);
|
|
70
|
+
}
|
|
71
|
+
subscribe(listener) {
|
|
72
|
+
this.#assertNotDisposed();
|
|
73
|
+
return this.#state.subscribe(listener);
|
|
74
|
+
}
|
|
75
|
+
onEvent(listener) {
|
|
76
|
+
this.#assertNotDisposed();
|
|
77
|
+
return this.#state.onEvent(listener);
|
|
78
|
+
}
|
|
79
|
+
onConnectionStateChange(listener) {
|
|
80
|
+
this.#assertNotDisposed();
|
|
81
|
+
this.#connectionStateListeners.add(listener);
|
|
82
|
+
return () => this.#connectionStateListeners.delete(listener);
|
|
83
|
+
}
|
|
84
|
+
async listSessions() {
|
|
85
|
+
return (await this.#request({ command: "list" })).sessions;
|
|
86
|
+
}
|
|
87
|
+
async createSession(options = {}) {
|
|
88
|
+
const result = await this.#request({ command: "create", ...options });
|
|
89
|
+
const token = this.#reserveSessionLease(result.session.id, "exclusive");
|
|
90
|
+
return this.#createSessionLease(result.session.id, token);
|
|
91
|
+
}
|
|
92
|
+
async attachSession(sessionId) {
|
|
93
|
+
return this.acquireSession(sessionId, { mode: "shared" });
|
|
94
|
+
}
|
|
95
|
+
async acquireSession(sessionId, options) {
|
|
96
|
+
this.#assertNotDisposed();
|
|
97
|
+
const token = this.#reserveSessionLease(sessionId, options.mode);
|
|
98
|
+
try {
|
|
99
|
+
const detachment = this.#sessionDetachments.get(sessionId);
|
|
100
|
+
if (detachment)
|
|
101
|
+
await detachment.catch(() => { });
|
|
102
|
+
const reconciled = this.#sessionCleanupRequired.has(sessionId)
|
|
103
|
+
? await this.#reconcileSessionCleanup(sessionId)
|
|
104
|
+
: false;
|
|
105
|
+
if (reconciled || !this.#state.isSessionAttached(sessionId)) {
|
|
106
|
+
let attachment = this.#sessionAttachments.get(sessionId);
|
|
107
|
+
if (!attachment) {
|
|
108
|
+
attachment = this.#attachSession(sessionId);
|
|
109
|
+
this.#sessionAttachments.set(sessionId, attachment);
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await attachment;
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
if (this.#sessionAttachments.get(sessionId) === attachment)
|
|
116
|
+
this.#sessionAttachments.delete(sessionId);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return this.#createSessionLease(sessionId, token);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
this.#releaseSessionLease(sessionId, token);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async #attachSession(sessionId) {
|
|
127
|
+
const previous = this.#state.forgetSessionSnapshot(sessionId);
|
|
128
|
+
try {
|
|
129
|
+
await this.#request({ command: "attach", sessionId });
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (previous)
|
|
133
|
+
this.#state.restoreSessionSnapshot(previous);
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
#request(command) {
|
|
138
|
+
if (this.#disposed)
|
|
139
|
+
return Promise.reject(new PiClientDisposedError());
|
|
140
|
+
if (!this.connected)
|
|
141
|
+
return Promise.reject(new PiDisconnectedError());
|
|
142
|
+
const id = `request-${++this.#requestSequence}`;
|
|
143
|
+
const { promise, resolve, reject } = createPromiseResolvers();
|
|
144
|
+
this.#pendingRequests.set(id, { command, resolve, reject });
|
|
145
|
+
let frame;
|
|
146
|
+
try {
|
|
147
|
+
frame = encodeClientMessage({ type: "request", id, request: command }, { maxFrameLength: this.#connection.maxFrameLength });
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.#takePendingRequest(id)?.reject(toError(error));
|
|
151
|
+
return promise;
|
|
152
|
+
}
|
|
153
|
+
this.#connection.send(frame);
|
|
154
|
+
return promise;
|
|
155
|
+
}
|
|
156
|
+
#createSessionLease(sessionId, token) {
|
|
157
|
+
const generation = this.#sessionLeaseGenerations.get(sessionId) ?? 0;
|
|
158
|
+
this.#sessionLeaseGenerations.set(sessionId, generation);
|
|
159
|
+
let state = "active";
|
|
160
|
+
let releasePromise;
|
|
161
|
+
const refreshState = () => {
|
|
162
|
+
if ((state === "active" || state === "releasing") &&
|
|
163
|
+
this.#sessionLeaseGenerations.get(sessionId) !== generation) {
|
|
164
|
+
state = "invalidated";
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const isActive = () => {
|
|
168
|
+
refreshState();
|
|
169
|
+
return state === "active" && this.#state.isSessionAttached(sessionId);
|
|
170
|
+
};
|
|
171
|
+
const assertActive = () => {
|
|
172
|
+
this.#assertNotDisposed();
|
|
173
|
+
if (!this.connected)
|
|
174
|
+
throw new PiDisconnectedError();
|
|
175
|
+
if (!isActive())
|
|
176
|
+
throw new PiSessionDetachedError(sessionId);
|
|
177
|
+
};
|
|
178
|
+
const release = (relinquishOnFailure) => {
|
|
179
|
+
refreshState();
|
|
180
|
+
if (state === "released" || state === "invalidated")
|
|
181
|
+
return Promise.resolve();
|
|
182
|
+
if (releasePromise)
|
|
183
|
+
return releasePromise;
|
|
184
|
+
assertActive();
|
|
185
|
+
state = "releasing";
|
|
186
|
+
releasePromise = (async () => {
|
|
187
|
+
const count = this.#sessionLeaseCounts.get(sessionId) ?? 0;
|
|
188
|
+
if (count <= 1) {
|
|
189
|
+
const detachment = this.#request({ command: "detach", sessionId }).then(() => undefined);
|
|
190
|
+
this.#sessionDetachments.set(sessionId, detachment);
|
|
191
|
+
try {
|
|
192
|
+
await detachment;
|
|
193
|
+
this.#releaseSessionLease(sessionId, token);
|
|
194
|
+
}
|
|
195
|
+
finally {
|
|
196
|
+
if (this.#sessionDetachments.get(sessionId) === detachment) {
|
|
197
|
+
this.#sessionDetachments.delete(sessionId);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this.#releaseSessionLease(sessionId, token);
|
|
203
|
+
}
|
|
204
|
+
state = "released";
|
|
205
|
+
})().catch((error) => {
|
|
206
|
+
refreshState();
|
|
207
|
+
if (state === "invalidated")
|
|
208
|
+
return;
|
|
209
|
+
if (relinquishOnFailure) {
|
|
210
|
+
this.#releaseSessionLease(sessionId, token);
|
|
211
|
+
this.#sessionCleanupRequired.add(sessionId);
|
|
212
|
+
state = "released";
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
state = "active";
|
|
216
|
+
releasePromise = undefined;
|
|
217
|
+
}
|
|
218
|
+
throw error;
|
|
219
|
+
});
|
|
220
|
+
return releasePromise;
|
|
221
|
+
};
|
|
222
|
+
const callbacks = {
|
|
223
|
+
isAttached: isActive,
|
|
224
|
+
getSnapshot: () => (isActive() ? this.#state.getSessionSnapshot(sessionId) : undefined),
|
|
225
|
+
subscribe: (listener) => {
|
|
226
|
+
assertActive();
|
|
227
|
+
return this.#state.subscribeSession(sessionId, (snapshot) => {
|
|
228
|
+
if (isActive())
|
|
229
|
+
listener(snapshot);
|
|
230
|
+
});
|
|
231
|
+
},
|
|
232
|
+
onEvent: (listener) => {
|
|
233
|
+
assertActive();
|
|
234
|
+
return this.#state.onSessionEvent(sessionId, (event) => {
|
|
235
|
+
if (isActive() || event.type === "session_removed")
|
|
236
|
+
listener(event);
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
detach: () => release(false),
|
|
240
|
+
dispose: () => release(true),
|
|
241
|
+
request: (command) => {
|
|
242
|
+
assertActive();
|
|
243
|
+
return this.#request(command);
|
|
244
|
+
},
|
|
245
|
+
};
|
|
246
|
+
return new SessionHandle(sessionId, callbacks);
|
|
247
|
+
}
|
|
248
|
+
#handleMessage(message) {
|
|
249
|
+
if (message.type === "event") {
|
|
250
|
+
if (message.event.type === "session_removed")
|
|
251
|
+
this.#invalidateSessionLeases(message.event.sessionId);
|
|
252
|
+
this.#state.applyEvent(message.event);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const pending = this.#takePendingRequest(message.id);
|
|
256
|
+
if (!pending) {
|
|
257
|
+
this.#connection.fail(new ProtocolValidationError("Response has no matching request"));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (!message.ok) {
|
|
261
|
+
pending.reject(new PiServerError(message.error));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (message.result.command !== pending.command.command) {
|
|
265
|
+
const error = new ProtocolValidationError(`Response command ${message.result.command} does not match ${pending.command.command}`);
|
|
266
|
+
pending.reject(error);
|
|
267
|
+
this.#connection.fail(error);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
this.#state.applyResult(message.result);
|
|
271
|
+
pending.resolve(message.result);
|
|
272
|
+
}
|
|
273
|
+
#handleConnectionStateChange(change) {
|
|
274
|
+
if (change.state === "disconnected") {
|
|
275
|
+
this.#state.clearAttachments();
|
|
276
|
+
this.#invalidateAllSessionLeases();
|
|
277
|
+
this.#rejectPendingRequests(change.error ?? new PiDisconnectedError());
|
|
278
|
+
}
|
|
279
|
+
this.#notifyConnectionStateListeners(change);
|
|
280
|
+
}
|
|
281
|
+
#takePendingRequest(id) {
|
|
282
|
+
const request = this.#pendingRequests.get(id);
|
|
283
|
+
if (request)
|
|
284
|
+
this.#pendingRequests.delete(id);
|
|
285
|
+
return request;
|
|
286
|
+
}
|
|
287
|
+
#rejectPendingRequests(error) {
|
|
288
|
+
const requests = [...this.#pendingRequests.values()];
|
|
289
|
+
this.#pendingRequests.clear();
|
|
290
|
+
for (const request of requests)
|
|
291
|
+
request.reject(error);
|
|
292
|
+
}
|
|
293
|
+
dispose() {
|
|
294
|
+
if (this.#disposePromise)
|
|
295
|
+
return this.#disposePromise;
|
|
296
|
+
this.#disposed = true;
|
|
297
|
+
this.#disposePromise = Promise.resolve();
|
|
298
|
+
const error = new PiClientDisposedError();
|
|
299
|
+
this.#rejectPendingRequests(error);
|
|
300
|
+
this.#connection.disconnect(error);
|
|
301
|
+
this.#state.dispose();
|
|
302
|
+
this.#invalidateAllSessionLeases();
|
|
303
|
+
this.#connectionStateListeners.clear();
|
|
304
|
+
return this.#disposePromise;
|
|
305
|
+
}
|
|
306
|
+
[Symbol.asyncDispose]() {
|
|
307
|
+
return this.dispose();
|
|
308
|
+
}
|
|
309
|
+
#assertNotDisposed() {
|
|
310
|
+
if (this.#disposed)
|
|
311
|
+
throw new PiClientDisposedError();
|
|
312
|
+
}
|
|
313
|
+
async #reconcileSessionCleanup(sessionId) {
|
|
314
|
+
if (!this.#sessionCleanupRequired.has(sessionId))
|
|
315
|
+
return false;
|
|
316
|
+
let reconciliation = this.#sessionReconciliations.get(sessionId);
|
|
317
|
+
if (!reconciliation) {
|
|
318
|
+
reconciliation = this.#request({ command: "detach", sessionId })
|
|
319
|
+
.then(() => undefined)
|
|
320
|
+
.then(() => {
|
|
321
|
+
this.#sessionCleanupRequired.delete(sessionId);
|
|
322
|
+
})
|
|
323
|
+
.finally(() => {
|
|
324
|
+
this.#sessionReconciliations.delete(sessionId);
|
|
325
|
+
});
|
|
326
|
+
this.#sessionReconciliations.set(sessionId, reconciliation);
|
|
327
|
+
}
|
|
328
|
+
await reconciliation;
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
#reserveSessionLease(sessionId, mode) {
|
|
332
|
+
const count = this.#sessionLeaseCounts.get(sessionId) ?? 0;
|
|
333
|
+
if (mode === "exclusive" && count > 0) {
|
|
334
|
+
throw new PiSessionOwnershipError(sessionId, `Session ${sessionId} already has an active lease`);
|
|
335
|
+
}
|
|
336
|
+
if (mode === "shared" && this.#exclusiveSessionLeases.has(sessionId)) {
|
|
337
|
+
throw new PiSessionOwnershipError(sessionId, `Session ${sessionId} has an exclusive lease`);
|
|
338
|
+
}
|
|
339
|
+
const token = { mode };
|
|
340
|
+
this.#sessionLeaseCounts.set(sessionId, count + 1);
|
|
341
|
+
if (mode === "exclusive")
|
|
342
|
+
this.#exclusiveSessionLeases.set(sessionId, token);
|
|
343
|
+
return token;
|
|
344
|
+
}
|
|
345
|
+
#releaseSessionLease(sessionId, token) {
|
|
346
|
+
const count = this.#sessionLeaseCounts.get(sessionId) ?? 0;
|
|
347
|
+
if (count <= 1)
|
|
348
|
+
this.#sessionLeaseCounts.delete(sessionId);
|
|
349
|
+
else
|
|
350
|
+
this.#sessionLeaseCounts.set(sessionId, count - 1);
|
|
351
|
+
if (this.#exclusiveSessionLeases.get(sessionId) === token)
|
|
352
|
+
this.#exclusiveSessionLeases.delete(sessionId);
|
|
353
|
+
}
|
|
354
|
+
#invalidateSessionLeases(sessionId) {
|
|
355
|
+
this.#sessionLeaseCounts.delete(sessionId);
|
|
356
|
+
this.#exclusiveSessionLeases.delete(sessionId);
|
|
357
|
+
this.#sessionCleanupRequired.delete(sessionId);
|
|
358
|
+
this.#sessionLeaseGenerations.set(sessionId, (this.#sessionLeaseGenerations.get(sessionId) ?? 0) + 1);
|
|
359
|
+
}
|
|
360
|
+
#invalidateAllSessionLeases() {
|
|
361
|
+
for (const sessionId of this.#sessionLeaseCounts.keys())
|
|
362
|
+
this.#invalidateSessionLeases(sessionId);
|
|
363
|
+
this.#sessionCleanupRequired.clear();
|
|
364
|
+
}
|
|
365
|
+
#notifyConnectionStateListeners(change) {
|
|
366
|
+
for (const listener of this.#connectionStateListeners) {
|
|
367
|
+
try {
|
|
368
|
+
listener(change);
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
this.#reportListenerError(error);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
#reportListenerError(error) {
|
|
376
|
+
if (!this.#options.onListenerError)
|
|
377
|
+
return;
|
|
378
|
+
try {
|
|
379
|
+
this.#options.onListenerError(toError(error));
|
|
380
|
+
}
|
|
381
|
+
catch {
|
|
382
|
+
// Diagnostics cannot affect protocol or transport state.
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,mBAAmB,EACnB,uBAAuB,GAMvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACN,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAGN,aAAa,GAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAqBzC,MAAM,OAAO,QAAQ;IACX,QAAQ,CAAkB;IAC1B,WAAW,CAAa;I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AAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvG,CAAC;IAED,2BAA2B;QAC1B,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;QAClG,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IAED,+BAA+B,CAAC,MAA6B;QAC5D,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACvD,IAAI,CAAC;gBACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACF,CAAC;IACF,CAAC;IAED,oBAAoB,CAAC,KAAc;QAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe;YAAE,OAAO;QAC3C,IAAI,CAAC;YACJ,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/C,CAAC;QAAC,MAAM,CAAC;YACR,yDAAyD;QAC1D,CAAC;IACF,CAAC;CACD","sourcesContent":["import {\n\ttype Command,\n\ttype CommandResult,\n\ttype EventEnvelope,\n\tencodeClientMessage,\n\tProtocolValidationError,\n\ttype ResponseEnvelope,\n\ttype ResultForCommand,\n\ttype ServerEvent,\n\ttype ServerSnapshot,\n\ttype SessionSummary,\n} from \"@earendil-works/pi-protocol\";\nimport { Connection } from \"./connection.ts\";\nimport {\n\tPiClientDisposedError,\n\tPiDisconnectedError,\n\tPiServerError,\n\tPiSessionDetachedError,\n\tPiSessionOwnershipError,\n\ttoError,\n} from \"./errors.ts\";\nimport { createPromiseResolvers } from \"./promise.ts\";\nimport {\n\ttype AcquireSessionOptions,\n\ttype PiSessionHandle,\n\tSessionHandle,\n\ttype SessionHandleCallbacks,\n\ttype SessionLeaseMode,\n} from \"./session-handle.ts\";\nimport { ClientState } from \"./state.ts\";\nimport type {\n\tConnectionState,\n\tConnectionStateChange,\n\tCreateSessionOptions,\n\tPiClientOptions,\n\tUnsubscribe,\n} from \"./types.ts\";\n\ntype SessionLeaseState = \"active\" | \"releasing\" | \"released\" | \"invalidated\";\n\ninterface SessionLeaseToken {\n\treadonly mode: SessionLeaseMode;\n}\n\ninterface PendingRequest {\n\tcommand: Command;\n\tresolve(result: CommandResult): void;\n\treject(error: Error): void;\n}\n\nexport class PiClient {\n\treadonly #options: PiClientOptions;\n\treadonly #connection: Connection;\n\treadonly #state: ClientState;\n\treadonly #pendingRequests = new Map<string, PendingRequest>();\n\treadonly #sessionLeaseCounts = new Map<string, number>();\n\treadonly #exclusiveSessionLeases = new Map<string, SessionLeaseToken>();\n\treadonly #sessionLeaseGenerations = new Map<string, number>();\n\treadonly #sessionAttachments = new Map<string, Promise<void>>();\n\treadonly #sessionDetachments = new Map<string, Promise<void>>();\n\treadonly #sessionCleanupRequired = new Set<string>();\n\treadonly #sessionReconciliations = new Map<string, Promise<void>>();\n\treadonly #connectionStateListeners = new Set<(change: ConnectionStateChange) => void>();\n\t#requestSequence = 0;\n\t#disposed = false;\n\t#disposePromise: Promise<void> | undefined;\n\n\tconstructor(options: PiClientOptions) {\n\t\tthis.#options = options;\n\t\tthis.#state = new ClientState(options.onListenerError);\n\t\tthis.#connection = new Connection({\n\t\t\ttoken: options.token,\n\t\t\ttransportFactory: options.transportFactory,\n\t\t\tmaxFrameLength: options.maxFrameLength,\n\t\t\tonHandshake: (snapshot) => this.#state.applyServerSnapshot(snapshot),\n\t\t\tonMessage: (message) => this.#handleMessage(message),\n\t\t\tonStateChange: (change) => this.#handleConnectionStateChange(change),\n\t\t});\n\t}\n\n\tget disposed(): boolean {\n\t\treturn this.#disposed;\n\t}\n\n\tget connectionState(): ConnectionState {\n\t\treturn this.#connection.state;\n\t}\n\n\tget connected(): boolean {\n\t\treturn this.#connection.state === \"connected\";\n\t}\n\n\tget snapshot(): ServerSnapshot | undefined {\n\t\treturn this.#state.snapshot;\n\t}\n\n\tstatic async connect(options: PiClientOptions): Promise<PiClient> {\n\t\tconst client = new PiClient(options);\n\t\ttry {\n\t\t\tawait client.connect();\n\t\t\treturn client;\n\t\t} catch (error) {\n\t\t\tawait client.dispose();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tconnect(): Promise<ServerSnapshot> {\n\t\tif (this.#disposed) return Promise.reject(new PiClientDisposedError());\n\t\tif (this.#connection.state === \"disconnected\") this.#state.reset();\n\t\treturn this.#connection.connect();\n\t}\n\n\treconnect(): Promise<ServerSnapshot> {\n\t\treturn this.connect();\n\t}\n\n\tdisconnect(reason = \"Client disconnected\"): void {\n\t\tthis.#connection.disconnect(reason);\n\t}\n\n\tsubscribe(listener: (snapshot: ServerSnapshot) => void): Unsubscribe {\n\t\tthis.#assertNotDisposed();\n\t\treturn this.#state.subscribe(listener);\n\t}\n\n\tonEvent(listener: (event: ServerEvent) => void): Unsubscribe {\n\t\tthis.#assertNotDisposed();\n\t\treturn this.#state.onEvent(listener);\n\t}\n\n\tonConnectionStateChange(listener: (change: ConnectionStateChange) => void): Unsubscribe {\n\t\tthis.#assertNotDisposed();\n\t\tthis.#connectionStateListeners.add(listener);\n\t\treturn () => this.#connectionStateListeners.delete(listener);\n\t}\n\n\tasync listSessions(): Promise<readonly SessionSummary[]> {\n\t\treturn (await this.#request({ command: \"list\" })).sessions;\n\t}\n\n\tasync createSession(options: CreateSessionOptions = {}): Promise<PiSessionHandle> {\n\t\tconst result = await this.#request({ command: \"create\", ...options });\n\t\tconst token = this.#reserveSessionLease(result.session.id, \"exclusive\");\n\t\treturn this.#createSessionLease(result.session.id, token);\n\t}\n\n\tasync attachSession(sessionId: string): Promise<PiSessionHandle> {\n\t\treturn this.acquireSession(sessionId, { mode: \"shared\" });\n\t}\n\n\tasync acquireSession(sessionId: string, options: AcquireSessionOptions): Promise<PiSessionHandle> {\n\t\tthis.#assertNotDisposed();\n\t\tconst token = this.#reserveSessionLease(sessionId, options.mode);\n\t\ttry {\n\t\t\tconst detachment = this.#sessionDetachments.get(sessionId);\n\t\t\tif (detachment) await detachment.catch(() => {});\n\t\t\tconst reconciled = this.#sessionCleanupRequired.has(sessionId)\n\t\t\t\t? await this.#reconcileSessionCleanup(sessionId)\n\t\t\t\t: false;\n\t\t\tif (reconciled || !this.#state.isSessionAttached(sessionId)) {\n\t\t\t\tlet attachment = this.#sessionAttachments.get(sessionId);\n\t\t\t\tif (!attachment) {\n\t\t\t\t\tattachment = this.#attachSession(sessionId);\n\t\t\t\t\tthis.#sessionAttachments.set(sessionId, attachment);\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tawait attachment;\n\t\t\t\t} finally {\n\t\t\t\t\tif (this.#sessionAttachments.get(sessionId) === attachment) this.#sessionAttachments.delete(sessionId);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.#createSessionLease(sessionId, token);\n\t\t} catch (error) {\n\t\t\tthis.#releaseSessionLease(sessionId, token);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync #attachSession(sessionId: string): Promise<void> {\n\t\tconst previous = this.#state.forgetSessionSnapshot(sessionId);\n\t\ttry {\n\t\t\tawait this.#request({ command: \"attach\", sessionId });\n\t\t} catch (error) {\n\t\t\tif (previous) this.#state.restoreSessionSnapshot(previous);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t#request<const TCommand extends Command>(command: TCommand): Promise<ResultForCommand<TCommand>> {\n\t\tif (this.#disposed) return Promise.reject(new PiClientDisposedError());\n\t\tif (!this.connected) return Promise.reject(new PiDisconnectedError());\n\t\tconst id = `request-${++this.#requestSequence}`;\n\t\tconst { promise, resolve, reject } = createPromiseResolvers<CommandResult>();\n\t\tthis.#pendingRequests.set(id, { command, resolve, reject });\n\t\tlet frame: Uint8Array;\n\t\ttry {\n\t\t\tframe = encodeClientMessage(\n\t\t\t\t{ type: \"request\", id, request: command },\n\t\t\t\t{ maxFrameLength: this.#connection.maxFrameLength },\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.#takePendingRequest(id)?.reject(toError(error));\n\t\t\treturn promise as Promise<ResultForCommand<TCommand>>;\n\t\t}\n\t\tthis.#connection.send(frame);\n\t\treturn promise as Promise<ResultForCommand<TCommand>>;\n\t}\n\n\t#createSessionLease(sessionId: string, token: SessionLeaseToken): PiSessionHandle {\n\t\tconst generation = this.#sessionLeaseGenerations.get(sessionId) ?? 0;\n\t\tthis.#sessionLeaseGenerations.set(sessionId, generation);\n\t\tlet state: SessionLeaseState = \"active\";\n\t\tlet releasePromise: Promise<void> | undefined;\n\t\tconst refreshState = () => {\n\t\t\tif (\n\t\t\t\t(state === \"active\" || state === \"releasing\") &&\n\t\t\t\tthis.#sessionLeaseGenerations.get(sessionId) !== generation\n\t\t\t) {\n\t\t\t\tstate = \"invalidated\";\n\t\t\t}\n\t\t};\n\t\tconst isActive = () => {\n\t\t\trefreshState();\n\t\t\treturn state === \"active\" && this.#state.isSessionAttached(sessionId);\n\t\t};\n\t\tconst assertActive = () => {\n\t\t\tthis.#assertNotDisposed();\n\t\t\tif (!this.connected) throw new PiDisconnectedError();\n\t\t\tif (!isActive()) throw new PiSessionDetachedError(sessionId);\n\t\t};\n\t\tconst release = (relinquishOnFailure: boolean): Promise<void> => {\n\t\t\trefreshState();\n\t\t\tif (state === \"released\" || state === \"invalidated\") return Promise.resolve();\n\t\t\tif (releasePromise) return releasePromise;\n\t\t\tassertActive();\n\t\t\tstate = \"releasing\";\n\t\t\treleasePromise = (async () => {\n\t\t\t\tconst count = this.#sessionLeaseCounts.get(sessionId) ?? 0;\n\t\t\t\tif (count <= 1) {\n\t\t\t\t\tconst detachment = this.#request({ command: \"detach\", sessionId }).then(() => undefined);\n\t\t\t\t\tthis.#sessionDetachments.set(sessionId, detachment);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait detachment;\n\t\t\t\t\t\tthis.#releaseSessionLease(sessionId, token);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (this.#sessionDetachments.get(sessionId) === detachment) {\n\t\t\t\t\t\t\tthis.#sessionDetachments.delete(sessionId);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.#releaseSessionLease(sessionId, token);\n\t\t\t\t}\n\t\t\t\tstate = \"released\";\n\t\t\t})().catch((error: unknown) => {\n\t\t\t\trefreshState();\n\t\t\t\tif (state === \"invalidated\") return;\n\t\t\t\tif (relinquishOnFailure) {\n\t\t\t\t\tthis.#releaseSessionLease(sessionId, token);\n\t\t\t\t\tthis.#sessionCleanupRequired.add(sessionId);\n\t\t\t\t\tstate = \"released\";\n\t\t\t\t} else {\n\t\t\t\t\tstate = \"active\";\n\t\t\t\t\treleasePromise = undefined;\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t});\n\t\t\treturn releasePromise;\n\t\t};\n\t\tconst callbacks: SessionHandleCallbacks = {\n\t\t\tisAttached: isActive,\n\t\t\tgetSnapshot: () => (isActive() ? this.#state.getSessionSnapshot(sessionId) : undefined),\n\t\t\tsubscribe: (listener) => {\n\t\t\t\tassertActive();\n\t\t\t\treturn this.#state.subscribeSession(sessionId, (snapshot) => {\n\t\t\t\t\tif (isActive()) listener(snapshot);\n\t\t\t\t});\n\t\t\t},\n\t\t\tonEvent: (listener) => {\n\t\t\t\tassertActive();\n\t\t\t\treturn this.#state.onSessionEvent(sessionId, (event) => {\n\t\t\t\t\tif (isActive() || event.type === \"session_removed\") listener(event);\n\t\t\t\t});\n\t\t\t},\n\t\t\tdetach: () => release(false),\n\t\t\tdispose: () => release(true),\n\t\t\trequest: (command) => {\n\t\t\t\tassertActive();\n\t\t\t\treturn this.#request(command);\n\t\t\t},\n\t\t};\n\t\treturn new SessionHandle(sessionId, callbacks);\n\t}\n\n\t#handleMessage(message: ResponseEnvelope | EventEnvelope): void {\n\t\tif (message.type === \"event\") {\n\t\t\tif (message.event.type === \"session_removed\") this.#invalidateSessionLeases(message.event.sessionId);\n\t\t\tthis.#state.applyEvent(message.event);\n\t\t\treturn;\n\t\t}\n\t\tconst pending = this.#takePendingRequest(message.id);\n\t\tif (!pending) {\n\t\t\tthis.#connection.fail(new ProtocolValidationError(\"Response has no matching request\"));\n\t\t\treturn;\n\t\t}\n\t\tif (!message.ok) {\n\t\t\tpending.reject(new PiServerError(message.error));\n\t\t\treturn;\n\t\t}\n\t\tif (message.result.command !== pending.command.command) {\n\t\t\tconst error = new ProtocolValidationError(\n\t\t\t\t`Response command ${message.result.command} does not match ${pending.command.command}`,\n\t\t\t);\n\t\t\tpending.reject(error);\n\t\t\tthis.#connection.fail(error);\n\t\t\treturn;\n\t\t}\n\t\tthis.#state.applyResult(message.result);\n\t\tpending.resolve(message.result);\n\t}\n\n\t#handleConnectionStateChange(change: ConnectionStateChange): void {\n\t\tif (change.state === \"disconnected\") {\n\t\t\tthis.#state.clearAttachments();\n\t\t\tthis.#invalidateAllSessionLeases();\n\t\t\tthis.#rejectPendingRequests(change.error ?? new PiDisconnectedError());\n\t\t}\n\t\tthis.#notifyConnectionStateListeners(change);\n\t}\n\n\t#takePendingRequest(id: string): PendingRequest | undefined {\n\t\tconst request = this.#pendingRequests.get(id);\n\t\tif (request) this.#pendingRequests.delete(id);\n\t\treturn request;\n\t}\n\n\t#rejectPendingRequests(error: Error): void {\n\t\tconst requests = [...this.#pendingRequests.values()];\n\t\tthis.#pendingRequests.clear();\n\t\tfor (const request of requests) request.reject(error);\n\t}\n\n\tdispose(): Promise<void> {\n\t\tif (this.#disposePromise) return this.#disposePromise;\n\t\tthis.#disposed = true;\n\t\tthis.#disposePromise = Promise.resolve();\n\t\tconst error = new PiClientDisposedError();\n\t\tthis.#rejectPendingRequests(error);\n\t\tthis.#connection.disconnect(error);\n\t\tthis.#state.dispose();\n\t\tthis.#invalidateAllSessionLeases();\n\t\tthis.#connectionStateListeners.clear();\n\t\treturn this.#disposePromise;\n\t}\n\n\t[Symbol.asyncDispose](): Promise<void> {\n\t\treturn this.dispose();\n\t}\n\n\t#assertNotDisposed(): void {\n\t\tif (this.#disposed) throw new PiClientDisposedError();\n\t}\n\n\tasync #reconcileSessionCleanup(sessionId: string): Promise<boolean> {\n\t\tif (!this.#sessionCleanupRequired.has(sessionId)) return false;\n\t\tlet reconciliation = this.#sessionReconciliations.get(sessionId);\n\t\tif (!reconciliation) {\n\t\t\treconciliation = this.#request({ command: \"detach\", sessionId })\n\t\t\t\t.then(() => undefined)\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.#sessionCleanupRequired.delete(sessionId);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.#sessionReconciliations.delete(sessionId);\n\t\t\t\t});\n\t\t\tthis.#sessionReconciliations.set(sessionId, reconciliation);\n\t\t}\n\t\tawait reconciliation;\n\t\treturn true;\n\t}\n\n\t#reserveSessionLease(sessionId: string, mode: SessionLeaseMode): SessionLeaseToken {\n\t\tconst count = this.#sessionLeaseCounts.get(sessionId) ?? 0;\n\t\tif (mode === \"exclusive\" && count > 0) {\n\t\t\tthrow new PiSessionOwnershipError(sessionId, `Session ${sessionId} already has an active lease`);\n\t\t}\n\t\tif (mode === \"shared\" && this.#exclusiveSessionLeases.has(sessionId)) {\n\t\t\tthrow new PiSessionOwnershipError(sessionId, `Session ${sessionId} has an exclusive lease`);\n\t\t}\n\t\tconst token: SessionLeaseToken = { mode };\n\t\tthis.#sessionLeaseCounts.set(sessionId, count + 1);\n\t\tif (mode === \"exclusive\") this.#exclusiveSessionLeases.set(sessionId, token);\n\t\treturn token;\n\t}\n\n\t#releaseSessionLease(sessionId: string, token: SessionLeaseToken): void {\n\t\tconst count = this.#sessionLeaseCounts.get(sessionId) ?? 0;\n\t\tif (count <= 1) this.#sessionLeaseCounts.delete(sessionId);\n\t\telse this.#sessionLeaseCounts.set(sessionId, count - 1);\n\t\tif (this.#exclusiveSessionLeases.get(sessionId) === token) this.#exclusiveSessionLeases.delete(sessionId);\n\t}\n\n\t#invalidateSessionLeases(sessionId: string): void {\n\t\tthis.#sessionLeaseCounts.delete(sessionId);\n\t\tthis.#exclusiveSessionLeases.delete(sessionId);\n\t\tthis.#sessionCleanupRequired.delete(sessionId);\n\t\tthis.#sessionLeaseGenerations.set(sessionId, (this.#sessionLeaseGenerations.get(sessionId) ?? 0) + 1);\n\t}\n\n\t#invalidateAllSessionLeases(): void {\n\t\tfor (const sessionId of this.#sessionLeaseCounts.keys()) this.#invalidateSessionLeases(sessionId);\n\t\tthis.#sessionCleanupRequired.clear();\n\t}\n\n\t#notifyConnectionStateListeners(change: ConnectionStateChange): void {\n\t\tfor (const listener of this.#connectionStateListeners) {\n\t\t\ttry {\n\t\t\t\tlistener(change);\n\t\t\t} catch (error) {\n\t\t\t\tthis.#reportListenerError(error);\n\t\t\t}\n\t\t}\n\t}\n\n\t#reportListenerError(error: unknown): void {\n\t\tif (!this.#options.onListenerError) return;\n\t\ttry {\n\t\t\tthis.#options.onListenerError(toError(error));\n\t\t} catch {\n\t\t\t// Diagnostics cannot affect protocol or transport state.\n\t\t}\n\t}\n}\n"]}
|