@code-yeongyu/senpi 2026.7.31 → 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 +270 -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 +85 -14
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +445 -78
- 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/build.d.ts.map +1 -1
- package/dist/core/dynamic-prompt/build.js +4 -0
- package/dist/core/dynamic-prompt/build.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-agent-sdk → claude-sdk-oauth}/account-command.d.ts +2 -2
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.js +25 -25
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-command.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.d.ts +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.js +2 -2
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-management.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.d.ts +9 -9
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.js +2 -2
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/accounts.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.d.ts +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.js +3 -3
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/affinity.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.d.ts +21 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.js +30 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-attempt.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/auth-lane.d.ts +8 -4
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/auth-lane.js +34 -25
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -0
- 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-agent-sdk → claude-sdk-oauth}/custom-tools-schema.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.d.ts +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.js +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/errors.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.js +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts +14 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/guidance.js +37 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts +4 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/index.js +12 -10
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.d.ts +3 -3
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/oauth-login.js +2 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/options.d.ts +18 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/options.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/options.js +70 -10
- package/dist/core/extensions/builtin/claude-sdk-oauth/options.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.js +32 -19
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/sdk-boundary.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/sdk-boundary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → 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 +19 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +176 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.d.ts +18 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.js +33 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-state.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +76 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +87 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +259 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts +19 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js +192 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-stream.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts +20 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +132 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -0
- 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/settings.d.ts +28 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/settings.js +107 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/settings.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-guidance.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js +10 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +208 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.js +25 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/system-prompt.js.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.d.ts +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.d.ts.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.js +2 -2
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tool-watch.js.map +1 -1
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tools.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -0
- package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/tools.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -0
- 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 +18 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +73 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -0
- 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 +119 -15
- 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 +4 -1
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +39 -115
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/task-intent.d.ts +2 -6
- package/dist/core/extensions/builtin/compaction/task-intent.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/task-intent.js +10 -9
- package/dist/core/extensions/builtin/compaction/task-intent.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/goal/continuation-recovery.d.ts +6 -0
- package/dist/core/extensions/builtin/goal/continuation-recovery.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/continuation-recovery.js +20 -0
- package/dist/core/extensions/builtin/goal/continuation-recovery.js.map +1 -0
- package/dist/core/extensions/builtin/goal/continuation.d.ts +2 -4
- package/dist/core/extensions/builtin/goal/continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/continuation.js +2 -8
- package/dist/core/extensions/builtin/goal/continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/direct-input-lifecycle.d.ts +19 -0
- package/dist/core/extensions/builtin/goal/direct-input-lifecycle.d.ts.map +1 -0
- package/dist/core/extensions/builtin/goal/direct-input-lifecycle.js +48 -0
- package/dist/core/extensions/builtin/goal/direct-input-lifecycle.js.map +1 -0
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +17 -15
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js +12 -10
- package/dist/core/extensions/builtin/goal/lifecycle-helpers.js.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts +5 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +94 -52
- package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
- package/dist/core/extensions/builtin/goal/persistence.d.ts +16 -0
- package/dist/core/extensions/builtin/goal/persistence.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/persistence.js +185 -11
- package/dist/core/extensions/builtin/goal/persistence.js.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.d.ts +1 -0
- package/dist/core/extensions/builtin/goal/ui.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/ui.js +11 -2
- package/dist/core/extensions/builtin/goal/ui.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/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +15 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.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 +53 -8
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +5 -2
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop-guard/detectors.d.ts +31 -0
- package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/detectors.js +152 -0
- package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/index.d.ts +3 -0
- package/dist/core/extensions/builtin/loop-guard/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/index.js +31 -0
- package/dist/core/extensions/builtin/loop-guard/index.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/notice.d.ts +5 -0
- package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/notice.js +42 -0
- package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/policy.d.ts +30 -0
- package/dist/core/extensions/builtin/loop-guard/policy.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/policy.js +30 -0
- package/dist/core/extensions/builtin/loop-guard/policy.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.d.ts +4 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.js +50 -0
- package/dist/core/extensions/builtin/loop-guard/renderer.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/similarity.d.ts +13 -0
- package/dist/core/extensions/builtin/loop-guard/similarity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/similarity.js +51 -0
- package/dist/core/extensions/builtin/loop-guard/similarity.js.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/tracker.d.ts +13 -0
- package/dist/core/extensions/builtin/loop-guard/tracker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/loop-guard/tracker.js +39 -0
- package/dist/core/extensions/builtin/loop-guard/tracker.js.map +1 -0
- 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/monitor-state-event.d.ts +10 -0
- package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
- package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.js +10 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash-0731.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.js +10 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-flash.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.js +11 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4-pro.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.d.ts +13 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.js +60 -0
- package/dist/core/extensions/builtin/prompt-preset/deepseek-v4.js.map +1 -0
- 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/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/index.js +8 -4
- package/dist/core/extensions/builtin/prompt-preset/index.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/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +42 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +3 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js +2 -1
- package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
- package/dist/core/extensions/builtin/rules/index.js +4 -3
- package/dist/core/extensions/builtin/rules/index.js.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/constants.d.ts +11 -0
- package/dist/core/extensions/builtin/rules/rules/constants.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/constants.js +11 -0
- package/dist/core/extensions/builtin/rules/rules/constants.js.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/formatter.d.ts.map +1 -1
- package/dist/core/extensions/builtin/rules/rules/formatter.js +15 -1
- package/dist/core/extensions/builtin/rules/rules/formatter.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +23 -21
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +21 -7
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-notify.js +42 -5
- package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +2 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +2 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-status-ticker.d.ts +37 -0
- package/dist/core/extensions/builtin/terminal/monitor-status-ticker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-status-ticker.js +61 -0
- package/dist/core/extensions/builtin/terminal/monitor-status-ticker.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-status.d.ts +9 -1
- package/dist/core/extensions/builtin/terminal/monitor-status.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-status.js +35 -2
- package/dist/core/extensions/builtin/terminal/monitor-status.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 +2 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/commands.d.ts +2 -2
- package/dist/core/extensions/builtin/todotools/commands.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/commands.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/index.js +6 -3
- package/dist/core/extensions/builtin/todotools/index.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.d.ts +1 -1
- package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/state.js +1 -1
- package/dist/core/extensions/builtin/todotools/state.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/todo-widget-component.d.ts +19 -0
- package/dist/core/extensions/builtin/todotools/todo-widget-component.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/todo-widget-component.js +78 -0
- package/dist/core/extensions/builtin/todotools/todo-widget-component.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/todo-widget.d.ts +13 -1
- package/dist/core/extensions/builtin/todotools/todo-widget.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/todo-widget.js +32 -14
- package/dist/core/extensions/builtin/todotools/todo-widget.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts +2 -2
- package/dist/core/extensions/builtin/todotools/tools/todo.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.js +1 -1
- package/dist/core/extensions/builtin/todotools/tools/todo.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/builtin/tps.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tps.js +5 -2
- package/dist/core/extensions/builtin/tps.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/builtin-rules.d.ts +4 -0
- package/dist/core/extensions/builtin/ttsr/builtin-rules.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/builtin-rules.js +20 -0
- package/dist/core/extensions/builtin/ttsr/builtin-rules.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/commands.js +9 -1
- package/dist/core/extensions/builtin/ttsr/commands.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.js +4 -3
- package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/manager.js +1 -1
- package/dist/core/extensions/builtin/ttsr/manager.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/config.js +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/config.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/native.js +16 -5
- package/dist/core/extensions/builtin/websearch/websearch/native.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.js +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/provider-endpoints.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.d.ts +4 -1
- package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.js +44 -37
- package/dist/core/extensions/builtin/websearch/websearch/providers/anthropic.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.d.ts +3 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.d.ts.map +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.js +12 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers/deepseek.js.map +1 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/providers.js +2 -0
- package/dist/core/extensions/builtin/websearch/websearch/providers.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js +3 -3
- package/dist/core/extensions/builtin/websearch/websearch/renderers.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/search.js +1 -3
- package/dist/core/extensions/builtin/websearch/websearch/search.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/tool.js +2 -2
- package/dist/core/extensions/builtin/websearch/websearch/tool.js.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.d.ts.map +1 -1
- package/dist/core/extensions/builtin/websearch/websearch/types.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 +19 -18
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +21 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +38 -2
- 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-resolver.js +2 -2
- package/dist/core/model-resolver.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/core/thinking-levels.d.ts +5 -0
- package/dist/core/thinking-levels.d.ts.map +1 -1
- package/dist/core/thinking-levels.js +9 -39
- package/dist/core/thinking-levels.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/app-server/server/account.d.ts +1 -1
- package/dist/modes/app-server/server/account.js +1 -1
- package/dist/modes/app-server/server/account.js.map +1 -1
- package/dist/modes/app-server/server/server-core.js +1 -1
- package/dist/modes/app-server/server/server-core.js.map +1 -1
- package/dist/modes/interactive/compaction-queue-transfer.d.ts +2 -0
- package/dist/modes/interactive/compaction-queue-transfer.d.ts.map +1 -1
- package/dist/modes/interactive/compaction-queue-transfer.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/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +9 -5
- package/dist/modes/interactive/components/footer.js.map +1 -1
- 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 +189 -62
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/risky-main-model-warning.d.ts +1 -1
- package/dist/modes/interactive/risky-main-model-warning.d.ts.map +1 -1
- package/dist/modes/interactive/risky-main-model-warning.js +1 -1
- package/dist/modes/interactive/risky-main-model-warning.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 +16 -3
- 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 +34 -1
- package/docs/keybindings.md +13 -0
- package/docs/mcp.md +63 -4
- package/docs/models.md +1 -0
- package/docs/providers.md +41 -5
- package/docs/release-guide.md +7 -5
- package/docs/session-format.md +2 -0
- package/docs/settings.md +3 -1
- 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/overlay-test.ts +1 -1
- 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 +45 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +6 -3
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +3 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status-ticker.ts +79 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status.ts +36 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +26 -12
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +146 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-handler.ts +21 -119
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +157 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +62 -208
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-notification.ts +98 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-snapshot.ts +81 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-state.ts +24 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-eval-result.ts +140 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-notification-queue.ts +53 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-request.ts +45 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +45 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +20 -342
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- 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 +56 -25
- 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/node_modules/@earendil-works/pi-ai/dist/api/anthropic-tool-pairs.js +134 -0
- 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 +7 -3
- 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/fallback-state.d.ts +24 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.js +70 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses/fallback-state.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +2 -16
- 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 +94 -105
- 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 +19 -10
- 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-prompt-cache.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.js +7 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-prompt-cache.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 +9 -5
- 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/model.d.ts +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +14 -0
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +95 -19
- package/node_modules/@earendil-works/pi-ai/dist/models.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/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.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-go.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 +18 -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/dist/utils/unavailable-tool-text.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.js +36 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/unavailable-tool-text.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/mux.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/mux.js.map +1 -1
- 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 +37 -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 +89 -21
- 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/claude-agent-sdk/auth-lane.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/auth-lane.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/guidance.d.ts +0 -6
- package/dist/core/extensions/builtin/claude-agent-sdk/guidance.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/guidance.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/index.d.ts +0 -4
- package/dist/core/extensions/builtin/claude-agent-sdk/index.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/index.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/oauth-login.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/options.d.ts +0 -16
- package/dist/core/extensions/builtin/claude-agent-sdk/options.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/prompt-bridge.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/sdk-boundary.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/settings.d.ts +0 -15
- package/dist/core/extensions/builtin/claude-agent-sdk/settings.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/settings.js +0 -41
- package/dist/core/extensions/builtin/claude-agent-sdk/settings.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/stream.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/stream.js +0 -229
- package/dist/core/extensions/builtin/claude-agent-sdk/stream.js.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/tools.d.ts.map +0 -1
- package/dist/core/extensions/builtin/claude-agent-sdk/tools.js.map +0 -1
- 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 +0 -75
- 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/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/account-events.js +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools-schema.js +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/custom-tools.js +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/executable.js +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/failover.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/prompt-bridge.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/sdk-boundary.js +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.d.ts +0 -0
- /package/dist/core/extensions/builtin/{claude-agent-sdk → claude-sdk-oauth}/stream-protocol.js +0 -0
- /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,163 @@
|
|
|
1
|
+
import { CborError, resolveOptions, textDecoder, UINT32_BASE, } from "./options.js";
|
|
2
|
+
class CborReader {
|
|
3
|
+
constructor(bytes, options) {
|
|
4
|
+
this.offset = 0;
|
|
5
|
+
this.bytes = bytes;
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
decode() {
|
|
9
|
+
const value = this.readItem(0);
|
|
10
|
+
if (this.offset !== this.bytes.byteLength)
|
|
11
|
+
throw new CborError("CBOR payload contains trailing data");
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
readItem(depth) {
|
|
15
|
+
if (depth > this.options.maxDepth) {
|
|
16
|
+
throw new CborError(`CBOR nesting depth exceeds configured limit of ${this.options.maxDepth}`);
|
|
17
|
+
}
|
|
18
|
+
const initial = this.readByte();
|
|
19
|
+
const majorType = initial >>> 5;
|
|
20
|
+
const additionalInformation = initial & 0x1f;
|
|
21
|
+
switch (majorType) {
|
|
22
|
+
case 0:
|
|
23
|
+
return this.readArgument(additionalInformation);
|
|
24
|
+
case 1: {
|
|
25
|
+
const value = -1 - this.readArgument(additionalInformation);
|
|
26
|
+
if (!Number.isSafeInteger(value))
|
|
27
|
+
throw new CborError("Decoded CBOR integer is outside the safe range");
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
case 2: {
|
|
31
|
+
const length = this.readLength(additionalInformation, "byte string", this.options.maxByteLength);
|
|
32
|
+
return new Uint8Array(this.readBytes(length));
|
|
33
|
+
}
|
|
34
|
+
case 3: {
|
|
35
|
+
const length = this.readLength(additionalInformation, "text string", this.options.maxByteLength);
|
|
36
|
+
const bytes = this.readBytes(length);
|
|
37
|
+
try {
|
|
38
|
+
return textDecoder.decode(bytes);
|
|
39
|
+
}
|
|
40
|
+
catch (_error) {
|
|
41
|
+
throw new CborError("CBOR text string contains invalid UTF-8");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
case 4: {
|
|
45
|
+
const length = this.readLength(additionalInformation, "array", this.options.maxContainerLength);
|
|
46
|
+
const result = [];
|
|
47
|
+
for (let index = 0; index < length; index++)
|
|
48
|
+
result.push(this.readItem(depth + 1));
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
case 5: {
|
|
52
|
+
const length = this.readLength(additionalInformation, "map", this.options.maxContainerLength);
|
|
53
|
+
const result = {};
|
|
54
|
+
const keys = new Set();
|
|
55
|
+
for (let index = 0; index < length; index++) {
|
|
56
|
+
const key = this.readItem(depth + 1);
|
|
57
|
+
if (typeof key !== "string")
|
|
58
|
+
throw new CborError("CBOR map keys must be strings");
|
|
59
|
+
if (keys.has(key))
|
|
60
|
+
throw new CborError("CBOR map contains a duplicate key");
|
|
61
|
+
keys.add(key);
|
|
62
|
+
Object.defineProperty(result, key, {
|
|
63
|
+
configurable: true,
|
|
64
|
+
enumerable: true,
|
|
65
|
+
value: this.readItem(depth + 1),
|
|
66
|
+
writable: true,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
case 6:
|
|
72
|
+
throw new CborError("CBOR tags are not supported");
|
|
73
|
+
case 7:
|
|
74
|
+
return this.readSimple(additionalInformation);
|
|
75
|
+
default:
|
|
76
|
+
throw new CborError("Malformed CBOR major type");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
readSimple(additionalInformation) {
|
|
80
|
+
switch (additionalInformation) {
|
|
81
|
+
case 20:
|
|
82
|
+
return false;
|
|
83
|
+
case 21:
|
|
84
|
+
return true;
|
|
85
|
+
case 22:
|
|
86
|
+
return null;
|
|
87
|
+
case 27: {
|
|
88
|
+
const bytes = this.readBytes(8);
|
|
89
|
+
const value = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getFloat64(0, false);
|
|
90
|
+
if (!Number.isFinite(value))
|
|
91
|
+
throw new CborError("Decoded CBOR number must be finite");
|
|
92
|
+
if (Number.isInteger(value) && !Number.isSafeInteger(value)) {
|
|
93
|
+
throw new CborError("Decoded CBOR integer is outside the safe range");
|
|
94
|
+
}
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
case 31:
|
|
98
|
+
throw new CborError("CBOR break marker is not supported");
|
|
99
|
+
default:
|
|
100
|
+
throw new CborError("Unsupported CBOR simple value or floating-point width");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
readLength(additionalInformation, kind, limit) {
|
|
104
|
+
if (additionalInformation === 31)
|
|
105
|
+
throw new CborError(`Indefinite-length CBOR ${kind}s are not supported`);
|
|
106
|
+
const length = this.readArgument(additionalInformation);
|
|
107
|
+
if (length > limit)
|
|
108
|
+
throw new CborError(`CBOR ${kind} length exceeds configured limit of ${limit}`);
|
|
109
|
+
return length;
|
|
110
|
+
}
|
|
111
|
+
readArgument(additionalInformation) {
|
|
112
|
+
if (additionalInformation < 24)
|
|
113
|
+
return additionalInformation;
|
|
114
|
+
switch (additionalInformation) {
|
|
115
|
+
case 24:
|
|
116
|
+
return this.readByte();
|
|
117
|
+
case 25: {
|
|
118
|
+
const bytes = this.readBytes(2);
|
|
119
|
+
return bytes[0] * 0x100 + bytes[1];
|
|
120
|
+
}
|
|
121
|
+
case 26: {
|
|
122
|
+
const bytes = this.readBytes(4);
|
|
123
|
+
return bytes[0] * 0x1_000_000 + bytes[1] * 0x1_0000 + bytes[2] * 0x100 + bytes[3];
|
|
124
|
+
}
|
|
125
|
+
case 27: {
|
|
126
|
+
const high = this.readArgument(26);
|
|
127
|
+
const low = this.readArgument(26);
|
|
128
|
+
if (high > 0x1f_ffff)
|
|
129
|
+
throw new CborError("Decoded CBOR integer or length is outside the safe range");
|
|
130
|
+
return high * UINT32_BASE + low;
|
|
131
|
+
}
|
|
132
|
+
case 31:
|
|
133
|
+
throw new CborError("Indefinite-length CBOR items are not supported");
|
|
134
|
+
default:
|
|
135
|
+
throw new CborError("Malformed CBOR additional information");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
readByte() {
|
|
139
|
+
if (this.offset >= this.bytes.byteLength)
|
|
140
|
+
throw new CborError("Truncated CBOR payload");
|
|
141
|
+
const value = this.bytes[this.offset];
|
|
142
|
+
this.offset++;
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
readBytes(length) {
|
|
146
|
+
if (length > this.bytes.byteLength - this.offset)
|
|
147
|
+
throw new CborError("Truncated CBOR payload");
|
|
148
|
+
const value = this.bytes.subarray(this.offset, this.offset + length);
|
|
149
|
+
this.offset += length;
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/** Decodes exactly one item from the protocol's strict RFC 8949 subset. */
|
|
154
|
+
export function decodeCbor(bytes, options) {
|
|
155
|
+
if (!(bytes instanceof Uint8Array))
|
|
156
|
+
throw new TypeError("CBOR input must be a Uint8Array");
|
|
157
|
+
const resolved = resolveOptions(options);
|
|
158
|
+
if (bytes.byteLength > resolved.maxByteLength) {
|
|
159
|
+
throw new CborError(`CBOR byte length exceeds configured limit of ${resolved.maxByteLength}`);
|
|
160
|
+
}
|
|
161
|
+
return new CborReader(bytes, resolved).decode();
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=decoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../src/cbor/decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAGT,cAAc,EACd,WAAW,EACX,WAAW,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU;IAKf,YAAY,KAAiB,EAAE,OAA4B;QAHnD,WAAM,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED,MAAM;QACL,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC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,KAAK,YAAY,UAAU,CAAC;QAAE,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC,CAAC;IAC3F,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC/C,MAAM,IAAI,SAAS,CAAC,gDAAgD,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC","sourcesContent":["import {\n\tCborError,\n\ttype CborOptions,\n\ttype ResolvedCborOptions,\n\tresolveOptions,\n\ttextDecoder,\n\tUINT32_BASE,\n} from \"./options.ts\";\n\nclass CborReader {\n\tprivate readonly bytes: Uint8Array;\n\tprivate offset = 0;\n\tprivate readonly options: ResolvedCborOptions;\n\n\tconstructor(bytes: Uint8Array, options: ResolvedCborOptions) {\n\t\tthis.bytes = bytes;\n\t\tthis.options = options;\n\t}\n\n\tdecode(): unknown {\n\t\tconst value = this.readItem(0);\n\t\tif (this.offset !== this.bytes.byteLength) throw new CborError(\"CBOR payload contains trailing data\");\n\t\treturn value;\n\t}\n\n\tprivate readItem(depth: number): unknown {\n\t\tif (depth > this.options.maxDepth) {\n\t\t\tthrow new CborError(`CBOR nesting depth exceeds configured limit of ${this.options.maxDepth}`);\n\t\t}\n\t\tconst initial = this.readByte();\n\t\tconst majorType = initial >>> 5;\n\t\tconst additionalInformation = initial & 0x1f;\n\n\t\tswitch (majorType) {\n\t\t\tcase 0:\n\t\t\t\treturn this.readArgument(additionalInformation);\n\t\t\tcase 1: {\n\t\t\t\tconst value = -1 - this.readArgument(additionalInformation);\n\t\t\t\tif (!Number.isSafeInteger(value)) throw new CborError(\"Decoded CBOR integer is outside the safe range\");\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tcase 2: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"byte string\", this.options.maxByteLength);\n\t\t\t\treturn new Uint8Array(this.readBytes(length));\n\t\t\t}\n\t\t\tcase 3: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"text string\", this.options.maxByteLength);\n\t\t\t\tconst bytes = this.readBytes(length);\n\t\t\t\ttry {\n\t\t\t\t\treturn textDecoder.decode(bytes);\n\t\t\t\t} catch (_error) {\n\t\t\t\t\tthrow new CborError(\"CBOR text string contains invalid UTF-8\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase 4: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"array\", this.options.maxContainerLength);\n\t\t\t\tconst result: unknown[] = [];\n\t\t\t\tfor (let index = 0; index < length; index++) result.push(this.readItem(depth + 1));\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcase 5: {\n\t\t\t\tconst length = this.readLength(additionalInformation, \"map\", this.options.maxContainerLength);\n\t\t\t\tconst result: Record<string, unknown> = {};\n\t\t\t\tconst keys = new Set<string>();\n\t\t\t\tfor (let index = 0; index < length; index++) {\n\t\t\t\t\tconst key = this.readItem(depth + 1);\n\t\t\t\t\tif (typeof key !== \"string\") throw new CborError(\"CBOR map keys must be strings\");\n\t\t\t\t\tif (keys.has(key)) throw new CborError(\"CBOR map contains a duplicate key\");\n\t\t\t\t\tkeys.add(key);\n\t\t\t\t\tObject.defineProperty(result, key, {\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tvalue: this.readItem(depth + 1),\n\t\t\t\t\t\twritable: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tcase 6:\n\t\t\t\tthrow new CborError(\"CBOR tags are not supported\");\n\t\t\tcase 7:\n\t\t\t\treturn this.readSimple(additionalInformation);\n\t\t\tdefault:\n\t\t\t\tthrow new CborError(\"Malformed CBOR major type\");\n\t\t}\n\t}\n\n\tprivate readSimple(additionalInformation: number): unknown {\n\t\tswitch (additionalInformation) {\n\t\t\tcase 20:\n\t\t\t\treturn false;\n\t\t\tcase 21:\n\t\t\t\treturn true;\n\t\t\tcase 22:\n\t\t\t\treturn null;\n\t\t\tcase 27: {\n\t\t\t\tconst bytes = this.readBytes(8);\n\t\t\t\tconst value = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getFloat64(0, false);\n\t\t\t\tif (!Number.isFinite(value)) throw new CborError(\"Decoded CBOR number must be finite\");\n\t\t\t\tif (Number.isInteger(value) && !Number.isSafeInteger(value)) {\n\t\t\t\t\tthrow new CborError(\"Decoded CBOR integer is outside the safe range\");\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t}\n\t\t\tcase 31:\n\t\t\t\tthrow new CborError(\"CBOR break marker is not supported\");\n\t\t\tdefault:\n\t\t\t\tthrow new CborError(\"Unsupported CBOR simple value or floating-point width\");\n\t\t}\n\t}\n\n\tprivate readLength(additionalInformation: number, kind: string, limit: number): number {\n\t\tif (additionalInformation === 31) throw new CborError(`Indefinite-length CBOR ${kind}s are not supported`);\n\t\tconst length = this.readArgument(additionalInformation);\n\t\tif (length > limit) throw new CborError(`CBOR ${kind} length exceeds configured limit of ${limit}`);\n\t\treturn length;\n\t}\n\n\tprivate readArgument(additionalInformation: number): number {\n\t\tif (additionalInformation < 24) return additionalInformation;\n\t\tswitch (additionalInformation) {\n\t\t\tcase 24:\n\t\t\t\treturn this.readByte();\n\t\t\tcase 25: {\n\t\t\t\tconst bytes = this.readBytes(2);\n\t\t\t\treturn bytes[0]! * 0x100 + bytes[1]!;\n\t\t\t}\n\t\t\tcase 26: {\n\t\t\t\tconst bytes = this.readBytes(4);\n\t\t\t\treturn bytes[0]! * 0x1_000_000 + bytes[1]! * 0x1_0000 + bytes[2]! * 0x100 + bytes[3]!;\n\t\t\t}\n\t\t\tcase 27: {\n\t\t\t\tconst high = this.readArgument(26);\n\t\t\t\tconst low = this.readArgument(26);\n\t\t\t\tif (high > 0x1f_ffff) throw new CborError(\"Decoded CBOR integer or length is outside the safe range\");\n\t\t\t\treturn high * UINT32_BASE + low;\n\t\t\t}\n\t\t\tcase 31:\n\t\t\t\tthrow new CborError(\"Indefinite-length CBOR items are not supported\");\n\t\t\tdefault:\n\t\t\t\tthrow new CborError(\"Malformed CBOR additional information\");\n\t\t}\n\t}\n\n\tprivate readByte(): number {\n\t\tif (this.offset >= this.bytes.byteLength) throw new CborError(\"Truncated CBOR payload\");\n\t\tconst value = this.bytes[this.offset]!;\n\t\tthis.offset++;\n\t\treturn value;\n\t}\n\n\tprivate readBytes(length: number): Uint8Array {\n\t\tif (length > this.bytes.byteLength - this.offset) throw new CborError(\"Truncated CBOR payload\");\n\t\tconst value = this.bytes.subarray(this.offset, this.offset + length);\n\t\tthis.offset += length;\n\t\treturn value;\n\t}\n}\n\n/** Decodes exactly one item from the protocol's strict RFC 8949 subset. */\nexport function decodeCbor(bytes: Uint8Array, options?: CborOptions): unknown {\n\tif (!(bytes instanceof Uint8Array)) throw new TypeError(\"CBOR input must be a Uint8Array\");\n\tconst resolved = resolveOptions(options);\n\tif (bytes.byteLength > resolved.maxByteLength) {\n\t\tthrow new CborError(`CBOR byte length exceeds configured limit of ${resolved.maxByteLength}`);\n\t}\n\treturn new CborReader(bytes, resolved).decode();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.d.ts","sourceRoot":"","sources":["../../src/cbor/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,WAAW,EAOhB,MAAM,cAAc,CAAC;AAwMtB,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,UAAU,CAK5E"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { CborError, MAX_UINT32, resolveOptions, textDecoder, textEncoder, UINT32_BASE, } from "./options.js";
|
|
2
|
+
class CborWriter {
|
|
3
|
+
constructor(maxByteLength) {
|
|
4
|
+
this.offset = 0;
|
|
5
|
+
this.maxByteLength = maxByteLength;
|
|
6
|
+
this.buffer = new Uint8Array(Math.min(256, maxByteLength));
|
|
7
|
+
}
|
|
8
|
+
writeByte(value) {
|
|
9
|
+
this.ensureCapacity(1);
|
|
10
|
+
this.buffer[this.offset] = value;
|
|
11
|
+
this.offset++;
|
|
12
|
+
}
|
|
13
|
+
writeBytes(bytes) {
|
|
14
|
+
this.ensureCapacity(bytes.byteLength);
|
|
15
|
+
this.buffer.set(bytes, this.offset);
|
|
16
|
+
this.offset += bytes.byteLength;
|
|
17
|
+
}
|
|
18
|
+
writeUint16(value) {
|
|
19
|
+
this.ensureCapacity(2);
|
|
20
|
+
this.buffer[this.offset] = value >>> 8;
|
|
21
|
+
this.buffer[this.offset + 1] = value;
|
|
22
|
+
this.offset += 2;
|
|
23
|
+
}
|
|
24
|
+
writeUint32(value) {
|
|
25
|
+
this.ensureCapacity(4);
|
|
26
|
+
this.buffer[this.offset] = value >>> 24;
|
|
27
|
+
this.buffer[this.offset + 1] = value >>> 16;
|
|
28
|
+
this.buffer[this.offset + 2] = value >>> 8;
|
|
29
|
+
this.buffer[this.offset + 3] = value;
|
|
30
|
+
this.offset += 4;
|
|
31
|
+
}
|
|
32
|
+
writeUint64(value) {
|
|
33
|
+
const high = Math.floor(value / UINT32_BASE);
|
|
34
|
+
const low = value - high * UINT32_BASE;
|
|
35
|
+
this.writeUint32(high);
|
|
36
|
+
this.writeUint32(low);
|
|
37
|
+
}
|
|
38
|
+
writeFloat64(value) {
|
|
39
|
+
this.ensureCapacity(9);
|
|
40
|
+
this.buffer[this.offset] = 0xfb;
|
|
41
|
+
new DataView(this.buffer.buffer).setFloat64(this.offset + 1, value, false);
|
|
42
|
+
this.offset += 9;
|
|
43
|
+
}
|
|
44
|
+
finish() {
|
|
45
|
+
return this.buffer.slice(0, this.offset);
|
|
46
|
+
}
|
|
47
|
+
ensureCapacity(additionalBytes) {
|
|
48
|
+
const required = this.offset + additionalBytes;
|
|
49
|
+
if (required > this.maxByteLength) {
|
|
50
|
+
throw new CborError(`CBOR byte length exceeds configured limit of ${this.maxByteLength}`);
|
|
51
|
+
}
|
|
52
|
+
if (required <= this.buffer.byteLength)
|
|
53
|
+
return;
|
|
54
|
+
let capacity = Math.max(1, this.buffer.byteLength);
|
|
55
|
+
while (capacity < required)
|
|
56
|
+
capacity = Math.min(this.maxByteLength, Math.max(required, capacity * 2));
|
|
57
|
+
const expanded = new Uint8Array(capacity);
|
|
58
|
+
expanded.set(this.buffer);
|
|
59
|
+
this.buffer = expanded;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function writeArgument(writer, majorType, value) {
|
|
63
|
+
const prefix = majorType << 5;
|
|
64
|
+
if (value < 24) {
|
|
65
|
+
writer.writeByte(prefix | value);
|
|
66
|
+
}
|
|
67
|
+
else if (value <= 0xff) {
|
|
68
|
+
writer.writeByte(prefix | 24);
|
|
69
|
+
writer.writeByte(value);
|
|
70
|
+
}
|
|
71
|
+
else if (value <= 0xffff) {
|
|
72
|
+
writer.writeByte(prefix | 25);
|
|
73
|
+
writer.writeUint16(value);
|
|
74
|
+
}
|
|
75
|
+
else if (value <= MAX_UINT32) {
|
|
76
|
+
writer.writeByte(prefix | 26);
|
|
77
|
+
writer.writeUint32(value);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
writer.writeByte(prefix | 27);
|
|
81
|
+
writer.writeUint64(value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function isPlainObject(value) {
|
|
85
|
+
if (typeof value !== "object" || value === null)
|
|
86
|
+
return false;
|
|
87
|
+
const prototype = Object.getPrototypeOf(value);
|
|
88
|
+
return prototype === Object.prototype || prototype === null;
|
|
89
|
+
}
|
|
90
|
+
function encodeText(writer, value, options) {
|
|
91
|
+
const bytes = textEncoder.encode(value);
|
|
92
|
+
if (bytes.byteLength > options.maxByteLength) {
|
|
93
|
+
throw new CborError(`CBOR text string length exceeds configured limit of ${options.maxByteLength}`);
|
|
94
|
+
}
|
|
95
|
+
if (textDecoder.decode(bytes) !== value)
|
|
96
|
+
throw new CborError("CBOR text strings must contain valid Unicode scalar values");
|
|
97
|
+
writeArgument(writer, 3, bytes.byteLength);
|
|
98
|
+
writer.writeBytes(bytes);
|
|
99
|
+
}
|
|
100
|
+
function encodeValue(writer, value, options, depth, ancestors) {
|
|
101
|
+
if (depth > options.maxDepth)
|
|
102
|
+
throw new CborError(`CBOR nesting depth exceeds configured limit of ${options.maxDepth}`);
|
|
103
|
+
if (value === null) {
|
|
104
|
+
writer.writeByte(0xf6);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (typeof value === "boolean") {
|
|
108
|
+
writer.writeByte(value ? 0xf5 : 0xf4);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === "number") {
|
|
112
|
+
if (!Number.isFinite(value))
|
|
113
|
+
throw new CborError("CBOR numbers must be finite");
|
|
114
|
+
if (Number.isInteger(value) && !Object.is(value, -0)) {
|
|
115
|
+
if (!Number.isSafeInteger(value))
|
|
116
|
+
throw new CborError("CBOR integers must be safe JavaScript integers");
|
|
117
|
+
if (value >= 0)
|
|
118
|
+
writeArgument(writer, 0, value);
|
|
119
|
+
else
|
|
120
|
+
writeArgument(writer, 1, -1 - value);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
writer.writeFloat64(value);
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (typeof value === "string") {
|
|
128
|
+
encodeText(writer, value, options);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (value instanceof Uint8Array) {
|
|
132
|
+
if (value.byteLength > options.maxByteLength) {
|
|
133
|
+
throw new CborError(`CBOR byte string length exceeds configured limit of ${options.maxByteLength}`);
|
|
134
|
+
}
|
|
135
|
+
writeArgument(writer, 2, value.byteLength);
|
|
136
|
+
writer.writeBytes(value);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (Array.isArray(value)) {
|
|
140
|
+
if (ancestors.has(value))
|
|
141
|
+
throw new CborError("CBOR values must not contain cycles");
|
|
142
|
+
if (value.length > options.maxContainerLength) {
|
|
143
|
+
throw new CborError(`CBOR array length exceeds configured limit of ${options.maxContainerLength}`);
|
|
144
|
+
}
|
|
145
|
+
ancestors.add(value);
|
|
146
|
+
try {
|
|
147
|
+
writeArgument(writer, 4, value.length);
|
|
148
|
+
for (let index = 0; index < value.length; index++) {
|
|
149
|
+
if (!Object.hasOwn(value, index) || value[index] === undefined) {
|
|
150
|
+
throw new CborError("CBOR arrays must not contain holes or undefined values");
|
|
151
|
+
}
|
|
152
|
+
encodeValue(writer, value[index], options, depth + 1, ancestors);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
ancestors.delete(value);
|
|
157
|
+
}
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (isPlainObject(value)) {
|
|
161
|
+
if (ancestors.has(value))
|
|
162
|
+
throw new CborError("CBOR values must not contain cycles");
|
|
163
|
+
for (const symbol of Object.getOwnPropertySymbols(value)) {
|
|
164
|
+
if (Object.prototype.propertyIsEnumerable.call(value, symbol)) {
|
|
165
|
+
throw new CborError("CBOR map keys must be strings");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const entries = [];
|
|
169
|
+
for (const key of Object.keys(value)) {
|
|
170
|
+
const entryValue = value[key];
|
|
171
|
+
if (entryValue !== undefined)
|
|
172
|
+
entries.push([key, entryValue]);
|
|
173
|
+
}
|
|
174
|
+
if (entries.length > options.maxContainerLength) {
|
|
175
|
+
throw new CborError(`CBOR map length exceeds configured limit of ${options.maxContainerLength}`);
|
|
176
|
+
}
|
|
177
|
+
ancestors.add(value);
|
|
178
|
+
try {
|
|
179
|
+
writeArgument(writer, 5, entries.length);
|
|
180
|
+
for (const [key, entryValue] of entries) {
|
|
181
|
+
encodeText(writer, key, options);
|
|
182
|
+
encodeValue(writer, entryValue, options, depth + 1, ancestors);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
ancestors.delete(value);
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
throw new CborError(`Unsupported CBOR value type: ${typeof value}`);
|
|
191
|
+
}
|
|
192
|
+
/** Encodes the protocol's strict, definite-length RFC 8949 subset. */
|
|
193
|
+
export function encodeCbor(value, options) {
|
|
194
|
+
const resolved = resolveOptions(options);
|
|
195
|
+
const writer = new CborWriter(resolved.maxByteLength);
|
|
196
|
+
encodeValue(writer, value, resolved, 0, new Set());
|
|
197
|
+
return writer.finish();
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=encoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoder.js","sourceRoot":"","sources":["../../src/cbor/encoder.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,SAAS,EAET,UAAU,EAEV,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,UAAU;IAKf,YAAY,aAAqB;QAHzB,WAAM,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,SAAS,CAAC,KAAa;QACtB,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED,UAAU,CAAC,KAAiB;QAC3B,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,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AAC,kBAAkB,EAAE,CAAC,CAAC;QAClG,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC;YACJ,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,OAAO,EAAE,CAAC;gBACzC,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;gBACjC,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;YAChE,CAAC;QACF,CAAC;gBAAS,CAAC;YACV,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;QACD,OAAO;IACR,CAAC;IAED,MAAM,IAAI,SAAS,CAAC,gCAAgC,OAAO,KAAK,EAAE,CAAC,CAAC;AACrE,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,KAAc,EAAE,OAAqB;IAC/D,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACtD,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,GAAG,EAAU,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;AACxB,CAAC","sourcesContent":["import {\n\tCborError,\n\ttype CborOptions,\n\tMAX_UINT32,\n\ttype ResolvedCborOptions,\n\tresolveOptions,\n\ttextDecoder,\n\ttextEncoder,\n\tUINT32_BASE,\n} from \"./options.ts\";\n\nclass CborWriter {\n\tprivate buffer: Uint8Array;\n\tprivate offset = 0;\n\tprivate readonly maxByteLength: number;\n\n\tconstructor(maxByteLength: number) {\n\t\tthis.maxByteLength = maxByteLength;\n\t\tthis.buffer = new Uint8Array(Math.min(256, maxByteLength));\n\t}\n\n\twriteByte(value: number): void {\n\t\tthis.ensureCapacity(1);\n\t\tthis.buffer[this.offset] = value;\n\t\tthis.offset++;\n\t}\n\n\twriteBytes(bytes: Uint8Array): void {\n\t\tthis.ensureCapacity(bytes.byteLength);\n\t\tthis.buffer.set(bytes, this.offset);\n\t\tthis.offset += bytes.byteLength;\n\t}\n\n\twriteUint16(value: number): void {\n\t\tthis.ensureCapacity(2);\n\t\tthis.buffer[this.offset] = value >>> 8;\n\t\tthis.buffer[this.offset + 1] = value;\n\t\tthis.offset += 2;\n\t}\n\n\twriteUint32(value: number): void {\n\t\tthis.ensureCapacity(4);\n\t\tthis.buffer[this.offset] = value >>> 24;\n\t\tthis.buffer[this.offset + 1] = value >>> 16;\n\t\tthis.buffer[this.offset + 2] = value >>> 8;\n\t\tthis.buffer[this.offset + 3] = value;\n\t\tthis.offset += 4;\n\t}\n\n\twriteUint64(value: number): void {\n\t\tconst high = Math.floor(value / UINT32_BASE);\n\t\tconst low = value - high * UINT32_BASE;\n\t\tthis.writeUint32(high);\n\t\tthis.writeUint32(low);\n\t}\n\n\twriteFloat64(value: number): void {\n\t\tthis.ensureCapacity(9);\n\t\tthis.buffer[this.offset] = 0xfb;\n\t\tnew DataView(this.buffer.buffer).setFloat64(this.offset + 1, value, false);\n\t\tthis.offset += 9;\n\t}\n\n\tfinish(): Uint8Array {\n\t\treturn this.buffer.slice(0, this.offset);\n\t}\n\n\tprivate ensureCapacity(additionalBytes: number): void {\n\t\tconst required = this.offset + additionalBytes;\n\t\tif (required > this.maxByteLength) {\n\t\t\tthrow new CborError(`CBOR byte length exceeds configured limit of ${this.maxByteLength}`);\n\t\t}\n\t\tif (required <= this.buffer.byteLength) return;\n\n\t\tlet capacity = Math.max(1, this.buffer.byteLength);\n\t\twhile (capacity < required) capacity = Math.min(this.maxByteLength, Math.max(required, capacity * 2));\n\t\tconst expanded = new Uint8Array(capacity);\n\t\texpanded.set(this.buffer);\n\t\tthis.buffer = expanded;\n\t}\n}\n\nfunction writeArgument(writer: CborWriter, majorType: number, value: number): void {\n\tconst prefix = majorType << 5;\n\tif (value < 24) {\n\t\twriter.writeByte(prefix | value);\n\t} else if (value <= 0xff) {\n\t\twriter.writeByte(prefix | 24);\n\t\twriter.writeByte(value);\n\t} else if (value <= 0xffff) {\n\t\twriter.writeByte(prefix | 25);\n\t\twriter.writeUint16(value);\n\t} else if (value <= MAX_UINT32) {\n\t\twriter.writeByte(prefix | 26);\n\t\twriter.writeUint32(value);\n\t} else {\n\t\twriter.writeByte(prefix | 27);\n\t\twriter.writeUint64(value);\n\t}\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null) return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === Object.prototype || prototype === null;\n}\n\nfunction encodeText(writer: CborWriter, value: string, options: ResolvedCborOptions): void {\n\tconst bytes = textEncoder.encode(value);\n\tif (bytes.byteLength > options.maxByteLength) {\n\t\tthrow new CborError(`CBOR text string length exceeds configured limit of ${options.maxByteLength}`);\n\t}\n\tif (textDecoder.decode(bytes) !== value)\n\t\tthrow new CborError(\"CBOR text strings must contain valid Unicode scalar values\");\n\twriteArgument(writer, 3, bytes.byteLength);\n\twriter.writeBytes(bytes);\n}\n\nfunction encodeValue(\n\twriter: CborWriter,\n\tvalue: unknown,\n\toptions: ResolvedCborOptions,\n\tdepth: number,\n\tancestors: Set<object>,\n): void {\n\tif (depth > options.maxDepth)\n\t\tthrow new CborError(`CBOR nesting depth exceeds configured limit of ${options.maxDepth}`);\n\n\tif (value === null) {\n\t\twriter.writeByte(0xf6);\n\t\treturn;\n\t}\n\tif (typeof value === \"boolean\") {\n\t\twriter.writeByte(value ? 0xf5 : 0xf4);\n\t\treturn;\n\t}\n\tif (typeof value === \"number\") {\n\t\tif (!Number.isFinite(value)) throw new CborError(\"CBOR numbers must be finite\");\n\t\tif (Number.isInteger(value) && !Object.is(value, -0)) {\n\t\t\tif (!Number.isSafeInteger(value)) throw new CborError(\"CBOR integers must be safe JavaScript integers\");\n\t\t\tif (value >= 0) writeArgument(writer, 0, value);\n\t\t\telse writeArgument(writer, 1, -1 - value);\n\t\t} else {\n\t\t\twriter.writeFloat64(value);\n\t\t}\n\t\treturn;\n\t}\n\tif (typeof value === \"string\") {\n\t\tencodeText(writer, value, options);\n\t\treturn;\n\t}\n\tif (value instanceof Uint8Array) {\n\t\tif (value.byteLength > options.maxByteLength) {\n\t\t\tthrow new CborError(`CBOR byte string length exceeds configured limit of ${options.maxByteLength}`);\n\t\t}\n\t\twriteArgument(writer, 2, value.byteLength);\n\t\twriter.writeBytes(value);\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tif (ancestors.has(value)) throw new CborError(\"CBOR values must not contain cycles\");\n\t\tif (value.length > options.maxContainerLength) {\n\t\t\tthrow new CborError(`CBOR array length exceeds configured limit of ${options.maxContainerLength}`);\n\t\t}\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\twriteArgument(writer, 4, value.length);\n\t\t\tfor (let index = 0; index < value.length; index++) {\n\t\t\t\tif (!Object.hasOwn(value, index) || value[index] === undefined) {\n\t\t\t\t\tthrow new CborError(\"CBOR arrays must not contain holes or undefined values\");\n\t\t\t\t}\n\t\t\t\tencodeValue(writer, value[index], options, depth + 1, ancestors);\n\t\t\t}\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t\treturn;\n\t}\n\tif (isPlainObject(value)) {\n\t\tif (ancestors.has(value)) throw new CborError(\"CBOR values must not contain cycles\");\n\t\tfor (const symbol of Object.getOwnPropertySymbols(value)) {\n\t\t\tif (Object.prototype.propertyIsEnumerable.call(value, symbol)) {\n\t\t\t\tthrow new CborError(\"CBOR map keys must be strings\");\n\t\t\t}\n\t\t}\n\t\tconst entries: Array<readonly [string, unknown]> = [];\n\t\tfor (const key of Object.keys(value)) {\n\t\t\tconst entryValue = value[key];\n\t\t\tif (entryValue !== undefined) entries.push([key, entryValue]);\n\t\t}\n\t\tif (entries.length > options.maxContainerLength) {\n\t\t\tthrow new CborError(`CBOR map length exceeds configured limit of ${options.maxContainerLength}`);\n\t\t}\n\t\tancestors.add(value);\n\t\ttry {\n\t\t\twriteArgument(writer, 5, entries.length);\n\t\t\tfor (const [key, entryValue] of entries) {\n\t\t\t\tencodeText(writer, key, options);\n\t\t\t\tencodeValue(writer, entryValue, options, depth + 1, ancestors);\n\t\t\t}\n\t\t} finally {\n\t\t\tancestors.delete(value);\n\t\t}\n\t\treturn;\n\t}\n\n\tthrow new CborError(`Unsupported CBOR value type: ${typeof value}`);\n}\n\n/** Encodes the protocol's strict, definite-length RFC 8949 subset. */\nexport function encodeCbor(value: unknown, options?: CborOptions): Uint8Array {\n\tconst resolved = resolveOptions(options);\n\tconst writer = new CborWriter(resolved.maxByteLength);\n\tencodeValue(writer, value, resolved, 0, new Set<object>());\n\treturn writer.finish();\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { decodeCbor } from "./decoder.ts";
|
|
2
|
+
export { encodeCbor } from "./encoder.ts";
|
|
3
|
+
export { CborError, type CborOptions, DEFAULT_MAX_CBOR_BYTE_LENGTH, DEFAULT_MAX_CBOR_CONTAINER_LENGTH, DEFAULT_MAX_CBOR_DEPTH, } from "./options.ts";
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cbor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACN,SAAS,EACT,KAAK,WAAW,EAChB,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACtB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cbor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACN,SAAS,EAET,4BAA4B,EAC5B,iCAAiC,EACjC,sBAAsB,GACtB,MAAM,cAAc,CAAC","sourcesContent":["export { decodeCbor } from \"./decoder.ts\";\nexport { encodeCbor } from \"./encoder.ts\";\nexport {\n\tCborError,\n\ttype CborOptions,\n\tDEFAULT_MAX_CBOR_BYTE_LENGTH,\n\tDEFAULT_MAX_CBOR_CONTAINER_LENGTH,\n\tDEFAULT_MAX_CBOR_DEPTH,\n} from \"./options.ts\";\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const UINT32_BASE = 4294967296;
|
|
2
|
+
export declare const MAX_UINT32 = 4294967295;
|
|
3
|
+
/** Safe defaults for untrusted protocol payloads. */
|
|
4
|
+
export declare const DEFAULT_MAX_CBOR_BYTE_LENGTH: number;
|
|
5
|
+
export declare const DEFAULT_MAX_CBOR_CONTAINER_LENGTH = 1000000;
|
|
6
|
+
export declare const DEFAULT_MAX_CBOR_DEPTH = 64;
|
|
7
|
+
export interface CborOptions {
|
|
8
|
+
/** Maximum encoded input/output bytes and maximum byte/text string length. */
|
|
9
|
+
maxByteLength?: number;
|
|
10
|
+
/** Maximum number of elements in an array or entries in a map. */
|
|
11
|
+
maxContainerLength?: number;
|
|
12
|
+
/** Maximum recursive item depth. */
|
|
13
|
+
maxDepth?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ResolvedCborOptions {
|
|
16
|
+
maxByteLength: number;
|
|
17
|
+
maxContainerLength: number;
|
|
18
|
+
maxDepth: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class CborError extends Error {
|
|
21
|
+
constructor(message: string);
|
|
22
|
+
}
|
|
23
|
+
export declare const textEncoder: import("node:util").TextEncoder;
|
|
24
|
+
export declare const textDecoder: import("node:util").TextDecoder;
|
|
25
|
+
export declare function resolveOptions(options: CborOptions | undefined): ResolvedCborOptions;
|
|
26
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/cbor/options.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,aAAgB,CAAC;AACzC,eAAO,MAAM,UAAU,aAAc,CAAC;AAGtC,qDAAqD;AACrD,eAAO,MAAM,4BAA4B,QAAmB,CAAC;AAC7D,eAAO,MAAM,iCAAiC,UAAY,CAAC;AAC3D,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,WAAW,WAAW;IAC3B,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,SAAU,SAAQ,KAAK;IACnC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACD;AAED,eAAO,MAAM,WAAW,iCAAoB,CAAC;AAC7C,eAAO,MAAM,WAAW,iCAA6D,CAAC;AAStF,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,mBAAmB,CAUpF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const UINT32_BASE = 0x1_0000_0000;
|
|
2
|
+
export const MAX_UINT32 = 0xffff_ffff;
|
|
3
|
+
const MAX_CONFIGURED_DEPTH = 512;
|
|
4
|
+
/** Safe defaults for untrusted protocol payloads. */
|
|
5
|
+
export const DEFAULT_MAX_CBOR_BYTE_LENGTH = 16 * 1024 * 1024;
|
|
6
|
+
export const DEFAULT_MAX_CBOR_CONTAINER_LENGTH = 1_000_000;
|
|
7
|
+
export const DEFAULT_MAX_CBOR_DEPTH = 64;
|
|
8
|
+
export class CborError extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "CborError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export const textEncoder = new TextEncoder();
|
|
15
|
+
export const textDecoder = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
16
|
+
function resolveLimit(name, value, maximum) {
|
|
17
|
+
if (!Number.isSafeInteger(value) || value < 0 || value > maximum) {
|
|
18
|
+
throw new RangeError(`${name} must be an integer between 0 and ${maximum}`);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
export function resolveOptions(options) {
|
|
23
|
+
return {
|
|
24
|
+
maxByteLength: resolveLimit("maxByteLength", options?.maxByteLength ?? DEFAULT_MAX_CBOR_BYTE_LENGTH, MAX_UINT32),
|
|
25
|
+
maxContainerLength: resolveLimit("maxContainerLength", options?.maxContainerLength ?? DEFAULT_MAX_CBOR_CONTAINER_LENGTH, MAX_UINT32),
|
|
26
|
+
maxDepth: resolveLimit("maxDepth", options?.maxDepth ?? DEFAULT_MAX_CBOR_DEPTH, MAX_CONFIGURED_DEPTH),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/cbor/options.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AACtC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,qDAAqD;AACrD,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAC7D,MAAM,CAAC,MAAM,iCAAiC,GAAG,SAAS,CAAC;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAiBzC,MAAM,OAAO,SAAU,SAAQ,KAAK;IACnC,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IACzB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEtF,SAAS,YAAY,CAAC,IAAY,EAAE,KAAa,EAAE,OAAe;IACjE,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,OAAO,EAAE,CAAC;QAClE,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,qCAAqC,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,OAAgC;IAC9D,OAAO;QACN,aAAa,EAAE,YAAY,CAAC,eAAe,EAAE,OAAO,EAAE,aAAa,IAAI,4BAA4B,EAAE,UAAU,CAAC;QAChH,kBAAkB,EAAE,YAAY,CAC/B,oBAAoB,EACpB,OAAO,EAAE,kBAAkB,IAAI,iCAAiC,EAChE,UAAU,CACV;QACD,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,IAAI,sBAAsB,EAAE,oBAAoB,CAAC;KACrG,CAAC;AACH,CAAC","sourcesContent":["export const UINT32_BASE = 0x1_0000_0000;\nexport const MAX_UINT32 = 0xffff_ffff;\nconst MAX_CONFIGURED_DEPTH = 512;\n\n/** Safe defaults for untrusted protocol payloads. */\nexport const DEFAULT_MAX_CBOR_BYTE_LENGTH = 16 * 1024 * 1024;\nexport const DEFAULT_MAX_CBOR_CONTAINER_LENGTH = 1_000_000;\nexport const DEFAULT_MAX_CBOR_DEPTH = 64;\n\nexport interface CborOptions {\n\t/** Maximum encoded input/output bytes and maximum byte/text string length. */\n\tmaxByteLength?: number;\n\t/** Maximum number of elements in an array or entries in a map. */\n\tmaxContainerLength?: number;\n\t/** Maximum recursive item depth. */\n\tmaxDepth?: number;\n}\n\nexport interface ResolvedCborOptions {\n\tmaxByteLength: number;\n\tmaxContainerLength: number;\n\tmaxDepth: number;\n}\n\nexport class CborError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"CborError\";\n\t}\n}\n\nexport const textEncoder = new TextEncoder();\nexport const textDecoder = new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true });\n\nfunction resolveLimit(name: string, value: number, maximum: number): number {\n\tif (!Number.isSafeInteger(value) || value < 0 || value > maximum) {\n\t\tthrow new RangeError(`${name} must be an integer between 0 and ${maximum}`);\n\t}\n\treturn value;\n}\n\nexport function resolveOptions(options: CborOptions | undefined): ResolvedCborOptions {\n\treturn {\n\t\tmaxByteLength: resolveLimit(\"maxByteLength\", options?.maxByteLength ?? DEFAULT_MAX_CBOR_BYTE_LENGTH, MAX_UINT32),\n\t\tmaxContainerLength: resolveLimit(\n\t\t\t\"maxContainerLength\",\n\t\t\toptions?.maxContainerLength ?? DEFAULT_MAX_CBOR_CONTAINER_LENGTH,\n\t\t\tMAX_UINT32,\n\t\t),\n\t\tmaxDepth: resolveLimit(\"maxDepth\", options?.maxDepth ?? DEFAULT_MAX_CBOR_DEPTH, MAX_CONFIGURED_DEPTH),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FrameDecoderOptions } from "./framing.ts";
|
|
2
|
+
import { type ClientMessage, PROTOCOL_VERSION, type ServerMessage } from "./schemas.ts";
|
|
3
|
+
export declare class ProtocolValidationError extends Error {
|
|
4
|
+
constructor(message: string, _value?: unknown);
|
|
5
|
+
}
|
|
6
|
+
export declare function parseClientMessage(value: unknown): ClientMessage;
|
|
7
|
+
export declare function parseServerMessage(value: unknown): ServerMessage;
|
|
8
|
+
/** Validates and encodes one complete length-prefixed client message. */
|
|
9
|
+
export declare function encodeClientMessage(message: ClientMessage, options?: FrameDecoderOptions): Uint8Array;
|
|
10
|
+
/** Validates and encodes one complete length-prefixed server message. */
|
|
11
|
+
export declare function encodeServerMessage(message: ServerMessage, options?: FrameDecoderOptions): Uint8Array;
|
|
12
|
+
/** Incrementally decodes and validates framed client messages. */
|
|
13
|
+
export declare class ClientMessageDecoder {
|
|
14
|
+
private readonly decoder;
|
|
15
|
+
constructor(options?: FrameDecoderOptions);
|
|
16
|
+
push(chunk: Uint8Array): ClientMessage[];
|
|
17
|
+
end(): void;
|
|
18
|
+
}
|
|
19
|
+
/** Incrementally decodes and validates framed server messages. */
|
|
20
|
+
export declare class ServerMessageDecoder {
|
|
21
|
+
private readonly decoder;
|
|
22
|
+
constructor(options?: FrameDecoderOptions);
|
|
23
|
+
push(chunk: Uint8Array): ServerMessage[];
|
|
24
|
+
end(): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function createClientMessageDecoder(options?: FrameDecoderOptions): ClientMessageDecoder;
|
|
27
|
+
export declare function createServerMessageDecoder(options?: FrameDecoderOptions): ServerMessageDecoder;
|
|
28
|
+
export declare function isSupportedProtocolVersion(version: number): version is typeof PROTOCOL_VERSION;
|
|
29
|
+
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../src/codec.ts"],"names":[],"mappings":"AAEA,OAAO,EAKN,KAAK,mBAAmB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,KAAK,aAAa,EAElB,gBAAgB,EAChB,KAAK,aAAa,EAElB,MAAM,cAAc,CAAC;AAEtB,qBAAa,uBAAwB,SAAQ,KAAK;IACjD,YAAY,OAAO,EAAE,MAAM,EAA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