@code-yeongyu/senpi 2026.9.3 → 2026.9.4-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 +164 -0
- package/README.md +5 -4
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -30
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +31 -41
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +16 -7
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/credential-pool/state-store.d.ts +1 -0
- package/dist/core/credential-pool/state-store.d.ts.map +1 -1
- package/dist/core/credential-pool/state-store.js +22 -2
- package/dist/core/credential-pool/state-store.js.map +1 -1
- package/dist/core/dynamic-prompt/style.js +1 -1
- package/dist/core/dynamic-prompt/style.js.map +1 -1
- package/dist/core/dynamic-prompt/working-task.js +1 -1
- package/dist/core/dynamic-prompt/working-task.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js +3 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +9 -7
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +4 -9
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js +15 -18
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js +80 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts +18 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js +57 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js +13 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js +2 -23
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +2 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +30 -24
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +15 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +19 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +31 -13
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +8 -14
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js +23 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js +4 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +13 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts +11 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js +12 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -1
- package/dist/core/extensions/builtin/eval-only-routing.d.ts +10 -0
- package/dist/core/extensions/builtin/eval-only-routing.d.ts.map +1 -0
- package/dist/core/extensions/builtin/eval-only-routing.js +16 -0
- package/dist/core/extensions/builtin/eval-only-routing.js.map +1 -0
- package/dist/core/extensions/builtin/goal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/prompt.js +1 -3
- package/dist/core/extensions/builtin/goal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/store.js +8 -20
- package/dist/core/extensions/builtin/goal/store.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-account.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-account.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-account.js +115 -0
- package/dist/core/extensions/builtin/gpt-account.js.map +1 -0
- package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js +3 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
- package/dist/core/extensions/builtin/imagegen/auth.d.ts.map +1 -1
- package/dist/core/extensions/builtin/imagegen/auth.js +10 -2
- package/dist/core/extensions/builtin/imagegen/auth.js.map +1 -1
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +2 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/index.js +20 -1
- package/dist/core/extensions/builtin/loop/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop/store.d.ts +8 -6
- package/dist/core/extensions/builtin/loop/store.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/store.js +54 -88
- package/dist/core/extensions/builtin/loop/store.js.map +1 -1
- package/dist/core/extensions/builtin/loop/tools.d.ts +6 -1
- package/dist/core/extensions/builtin/loop/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/tools.js +8 -1
- package/dist/core/extensions/builtin/loop/tools.js.map +1 -1
- package/dist/core/extensions/builtin/monitor-state-event.d.ts +2 -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/claude-opus-4-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +1 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +1 -11
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +3 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +56 -43
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts +4 -15
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js +12 -21
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts +4 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js +16 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -5
- 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 +1 -6
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +123 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +202 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.js +1 -2
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.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 +60 -76
- 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 +17 -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 +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +186 -5
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.d.ts +10 -0
- package/dist/core/extensions/builtin/terminal/manager.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.js +21 -0
- package/dist/core/extensions/builtin/terminal/manager.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts +24 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.js +105 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +13 -2
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +24 -2
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts +13 -2
- package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.js +18 -7
- package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/restore.d.ts +43 -0
- package/dist/core/extensions/builtin/terminal/restore.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/restore.js +149 -0
- package/dist/core/extensions/builtin/terminal/restore.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts +110 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.js +158 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/tools/bash-input.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-input.js +3 -2
- package/dist/core/extensions/builtin/terminal/tools/bash-input.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js +5 -4
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.js +3 -2
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts +8 -0
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.js +10 -0
- package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.js +5 -4
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +4 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.js +58 -14
- package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -2
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +3 -6
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/index.js +1 -1
- package/dist/core/extensions/builtin/tool-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts +10 -5
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js +12 -7
- package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-support.d.ts +13 -0
- package/dist/core/extensions/builtin/tool-search/native-support.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-search/native-support.js +45 -0
- package/dist/core/extensions/builtin/tool-search/native-support.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts +34 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js +121 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts +2 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.js +6 -2
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.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/runner.d.ts +5 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +44 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +26 -3
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/lockfile-policy.d.ts +11 -0
- package/dist/core/lockfile-policy.d.ts.map +1 -1
- package/dist/core/lockfile-policy.js +19 -0
- package/dist/core/lockfile-policy.js.map +1 -1
- package/dist/core/manual-continue.d.ts +13 -0
- package/dist/core/manual-continue.d.ts.map +1 -0
- package/dist/core/manual-continue.js +19 -0
- package/dist/core/manual-continue.js.map +1 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +8 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +13 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +28 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-sidecar-store.d.ts +62 -0
- package/dist/core/session-sidecar-store.d.ts.map +1 -0
- package/dist/core/session-sidecar-store.js +149 -0
- package/dist/core/session-sidecar-store.js.map +1 -0
- package/dist/core/settings-manager.d.ts +5 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +45 -21
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +19 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/terminal-settings.d.ts +3 -0
- package/dist/core/terminal-settings.d.ts.map +1 -1
- package/dist/core/terminal-settings.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +2 -2
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +2 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -2
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -2
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +3 -3
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- 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 +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/daemon/process.d.ts +33 -3
- package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
- package/dist/modes/app-server/daemon/process.js +57 -6
- package/dist/modes/app-server/daemon/process.js.map +1 -1
- package/dist/modes/app-server/daemon.js +9 -1
- package/dist/modes/app-server/daemon.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +5 -11
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +21 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -2
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/grok/welcome-card.d.ts.map +1 -1
- package/dist/modes/interactive/grok/welcome-card.js +5 -2
- package/dist/modes/interactive/grok/welcome-card.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +74 -14
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/version-label.d.ts +7 -0
- package/dist/modes/interactive/version-label.d.ts.map +1 -0
- package/dist/modes/interactive/version-label.js +9 -0
- package/dist/modes/interactive/version-label.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +2 -0
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +71 -12
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +5 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +5 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/host-ensure.d.ts +2 -0
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +77 -18
- package/dist/modes/rpc/host-ensure.js.map +1 -1
- package/dist/modes/rpc/login-prompts.d.ts +24 -0
- package/dist/modes/rpc/login-prompts.d.ts.map +1 -0
- package/dist/modes/rpc/login-prompts.js +44 -0
- package/dist/modes/rpc/login-prompts.js.map +1 -0
- package/dist/modes/rpc/media-placeholders.d.ts +49 -0
- package/dist/modes/rpc/media-placeholders.d.ts.map +1 -0
- package/dist/modes/rpc/media-placeholders.js +151 -0
- package/dist/modes/rpc/media-placeholders.js.map +1 -0
- package/dist/modes/rpc/multi-session-host.js +3 -0
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +11 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +23 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +1 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +2 -1
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-fanout.d.ts +13 -2
- package/dist/modes/rpc/session-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-fanout.js +36 -12
- package/dist/modes/rpc/session-event-fanout.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +3 -1
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +23 -13
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts +8 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.js +32 -9
- package/dist/modes/rpc/socket-event-fanout.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +2 -0
- package/docs/environment-variables.md +5 -0
- package/docs/extensions.md +22 -2
- package/docs/keybindings.md +1 -1
- package/docs/models.md +3 -0
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +105 -1
- package/docs/settings.md +17 -32
- package/docs/terminal-setup.md +27 -0
- package/docs/usage.md +5 -3
- package/docs/windows.md +1 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.d.ts +18 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +155 -106
- package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +144 -83
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -32
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -36
- package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +2 -2
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +93 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +473 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +140 -93
- package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +96 -0
- package/node_modules/@anthropic-ai/sdk/README.md +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.js +5 -7
- package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +5 -7
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.js +4 -4
- package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +4 -4
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts +45 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts +45 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js +58 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs +54 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.js +3 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.mjs +3 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js +23 -25
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +5 -6
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts +9 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts +9 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.js +22 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs +19 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.mts +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.js +24 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.mjs +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/parse.js +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.js +10 -6
- package/node_modules/@anthropic-ai/sdk/internal/uploads.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs +10 -6
- package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.js +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +6 -4
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +4 -2
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +3 -4
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +1 -2
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +2 -3
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +2 -3
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js +30 -7
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +30 -7
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +3 -2
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +3 -46
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +3 -46
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts +131 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts +131 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js +45 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs +41 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +35 -6
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +35 -6
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/package.json +4 -11
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +13 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +13 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +28 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +28 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +8 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +8 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +25 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +25 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +7 -7
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +5 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +11 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +8 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +8 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +198 -29
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +198 -29
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts +177 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts +177 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js +56 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs +52 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts +74 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts +74 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js +52 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs +48 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts +272 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts +272 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js +119 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs +115 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts +14 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js +21 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs +16 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts +353 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts +353 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js +169 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs +165 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts +468 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts +468 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js +198 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs +193 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js +114 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs +110 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js +25 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs +12 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts +162 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts +162 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js +76 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs +72 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts +73 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts +73 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js +62 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs +57 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts +77 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts +77 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js +31 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs +27 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts +258 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts +258 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js +174 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs +169 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts +141 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts +141 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js +125 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs +121 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js +67 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs +63 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js +13 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts +135 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts +135 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js +102 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs +98 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts +83 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts +83 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js +34 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs +30 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts +210 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts +210 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js +189 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs +185 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts +303 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts +303 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js +112 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs +107 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +2 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +2 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +48 -120
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +48 -120
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +12 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +12 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +35 -138
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +35 -138
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +18 -18
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +18 -18
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +21 -25
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +21 -25
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +16 -17
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +16 -17
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +21 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +21 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1 -3
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1 -3
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +5 -7
- package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +4 -3
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/standard-schema.ts +99 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/errors.ts +3 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +11 -10
- package/node_modules/@anthropic-ai/sdk/src/internal/node.browser.ts +22 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/node.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/uploads.ts +10 -7
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/values.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +5 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +1 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +2 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +33 -9
- package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +7 -49
- package/node_modules/@anthropic-ai/sdk/src/lib/standard-schema.ts +209 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +38 -6
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +45 -15
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +6 -6
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +42 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +8 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +34 -11
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +13 -7
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +12 -9
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +8 -5
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +5 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +221 -38
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/api-keys.ts +231 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/compliance-settings.ts +96 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/external-keys.ts +365 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/federation.ts +71 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/index.ts +31 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/issuers.ts +486 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/index.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/rules.ts +624 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/workspaces.ts +196 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/index.ts +92 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/invites.ts +207 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/organization.ts +269 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/rate-limits.ts +104 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/index.ts +21 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/service-accounts.ts +389 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/workspaces.ts +217 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/users.ts +163 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/index.ts +43 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/members.ts +209 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/rate-limits.ts +113 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/service-accounts.ts +325 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/workspaces.ts +450 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +10 -10
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +2 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +7 -10
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +60 -150
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +43 -166
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +24 -27
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +25 -29
- package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2 -8
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +6 -5
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +5 -3
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +1 -5
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +122 -17
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +10 -43
- package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +13 -15
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +3 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +6 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +5 -3
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +1 -2
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +1 -2
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +0 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +0 -3
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +11 -9
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +11 -9
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +96 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +96 -7
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +0 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +0 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +20 -46
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +9 -33
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.js +1 -1
- package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +71 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +29 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +20 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.d.ts +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.js +126 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +34 -92
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +7 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +8 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +15 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +10 -5
- 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 +58 -64
- 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/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +16 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +6 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +40 -10
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -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 +130 -15
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js +40 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +1 -1
- 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-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +16 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +6 -0
- 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 +1 -3
- 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 +2 -16
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +16 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +40 -6
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.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/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.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/anthropic.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/baseten.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/nvidia.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/openrouter.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/openrouter.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +14 -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/drop-failed-assistant-turns.d.ts +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js +58 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +53 -12
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +4 -2
- 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 +3 -0
- 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/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +36 -3
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +2 -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 +106 -6
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +6 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +17 -4
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +11 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +57 -15
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +22 -7
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-event-fanout.js","sourceR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CAAC,MAAM,CAAC,CAAC;QACpD,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa;YAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3E,CAAC;IAED,aAAa,CAAC,SAAiB;QAC9B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAEO,cAAc,CAAC,EAAU,EAAE,SAAiB;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;QAC9C,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,MAAM,OAAO,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,qBAAqB,CAAC,IAAI,KAAK,CAAC;QACzF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;YAC9D,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,OAAO;gBAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAEO,cAAc,CAAC,EAAU,EAAE,SAAiB;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC;QAC9C,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;YAAE,IAAI,MAAM,CAAC,QAAQ;gBAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClH,CAAC;CACD","sourcesContent":["import { SocketEventSinkActor } from \"./socket-event-fanout.ts\";\n\nexport type RawWriter = (chunk: string) => void;\nexport type BackpressureWaiter = () => Promise<void>;\n\nexport interface SessionEventWriterConnection {\n\treadonly writeRaw: RawWriter;\n\treadonly waitForBackpressure: BackpressureWaiter;\n}\n\nexport const RENDERED_COMPONENT_RECORD = \"__senpiRenderedComponent\";\n\nconst BROADCAST_LIFECYCLE_RECORDS = new Set([\n\t\"agent_start\",\n\t\"agent_settled\",\n\t\"agent_idle\",\n\t\"session_opened\",\n\t\"session_closed\",\n]);\n\ntype RegisteredConnection = {\n\treadonly connection: SessionEventWriterConnection;\n\treadonly actor: SocketEventSinkActor;\n};\n\ntype SnapshotRecord = { readonly line: string; readonly rendered: boolean };\n\nexport class SessionEventFanout {\n\tprivate readonly connections = new Map<string, RegisteredConnection>();\n\tprivate readonly sessionSnapshots = new Map<string, SnapshotRecord[]>();\n\tprivate readonly connectionCapabilities = new Map<string, Set<string>>();\n\tprivate readonly connectionSessions = new Map<string, Set<string>>();\n\tprivate readonly registeredCapabilityConnections = new Set<string>();\n\n\tregisterConnection(id: string, connection: SessionEventWriterConnection): void {\n\t\tconst actor = new SocketEventSinkActor(connection, () => {\n\t\t\tif (this.connections.get(id)?.actor === actor) {\n\t\t\t\tthis.connections.delete(id);\n\t\t\t\tthis.connectionCapabilities.delete(id);\n\t\t\t\tthis.connectionSessions.delete(id);\n\t\t\t\tthis.registeredCapabilityConnections.delete(id);\n\t\t\t}\n\t\t});\n\t\tthis.connections.set(id, { connection, actor });\n\t\tthis.connectionCapabilities.set(id, new Set());\n\t\tthis.connectionSessions.set(id, new Set());\n\t}\n\n\tunregisterConnection(id: string): void {\n\t\tconst registered = this.connections.get(id);\n\t\tif (!registered) return;\n\t\tregistered.actor.close();\n\t\tthis.connections.delete(id);\n\t\tthis.connectionCapabilities.delete(id);\n\t\tthis.connectionSessions.delete(id);\n\t\tthis.registeredCapabilityConnections.delete(id);\n\t}\n\n\tattachConnectionToSession(id: string, sessionId: string): void {\n\t\tif (!this.connections.has(id)) return;\n\t\tconst sessions = this.connectionSessions.get(id) ?? new Set<string>();\n\t\tif (sessions.has(sessionId)) return;\n\t\tsessions.add(sessionId);\n\t\tthis.connectionSessions.set(id, sessions);\n\t\tthis.replaySnapshot(id, sessionId);\n\t}\n\n\tdetachConnectionFromSession(id: string, sessionId: string): void {\n\t\tthis.connectionSessions.get(id)?.delete(sessionId);\n\t}\n\n\tsetConnectionCapabilities(id: string, capabilities: readonly string[]): void {\n\t\tconst registered = this.connections.get(id);\n\t\tif (!registered) return;\n\t\tconst wasCapable = this.connectionCapabilities.get(id)?.has(\"rendered_components\") ?? false;\n\t\tthis.connectionCapabilities.set(id, new Set(capabilities));\n\t\tthis.registeredCapabilityConnections.add(id);\n\t\tif (!wasCapable && capabilities.includes(\"rendered_components\"))\n\t\t\tfor (const sessionId of this.connectionSessions.get(id) ?? []) this.replayRendered(id, sessionId);\n\t}\n\n\tclearConnectionCapabilities(id: string): void {\n\t\tif (this.connections.has(id)) {\n\t\t\tthis.connectionCapabilities.set(id, new Set());\n\t\t\tthis.registeredCapabilityConnections.delete(id);\n\t\t}\n\t}\n\n\thasRegisteredConnectionCapabilities(id: string): boolean {\n\t\treturn this.registeredCapabilityConnections.has(id);\n\t}\n\n\tgetConnectionCapabilities(id: string): readonly string[] | undefined {\n\t\tif (!this.registeredCapabilityConnections.has(id)) return undefined;\n\t\treturn [...(this.connectionCapabilities.get(id) ?? [])];\n\t}\n\n\thasCapableConnection(sessionId: string): boolean {\n\t\tfor (const [id, capabilities] of this.connectionCapabilities)\n\t\t\tif (capabilities.has(\"rendered_components\") && this.connectionSessions.get(id)?.has(sessionId)) return true;\n\t\treturn false;\n\t}\n\n\ttargets(\n\t\tsessionId: string,\n\t\ttargetId: string | undefined,\n\t\tisTargeted: boolean,\n\t\trendered: boolean,\n\t\trecordType: unknown,\n\t): readonly (string | undefined)[] {\n\t\tif (isTargeted) return [targetId];\n\t\tif (typeof recordType === \"string\" && BROADCAST_LIFECYCLE_RECORDS.has(recordType))\n\t\t\treturn this.connections.size > 0 ? [...this.connections.keys()] : [undefined];\n\t\tif (rendered)\n\t\t\treturn this.connections.size > 0\n\t\t\t\t? [...this.connections.keys()].filter(\n\t\t\t\t\t\t(id) =>\n\t\t\t\t\t\t\tthis.connectionCapabilities.get(id)?.has(\"rendered_components\") &&\n\t\t\t\t\t\t\tthis.connectionSessions.get(id)?.has(sessionId),\n\t\t\t\t\t)\n\t\t\t\t: [undefined];\n\t\treturn this.connections.size > 0\n\t\t\t? [...this.connections.keys()].filter((id) => this.connectionSessions.get(id)?.has(sessionId))\n\t\t\t: [undefined];\n\t}\n\n\tget(id: string): RegisteredConnection | undefined {\n\t\treturn this.connections.get(id);\n\t}\n\n\tvalues(): IterableIterator<RegisteredConnection> {\n\t\treturn this.connections.values();\n\t}\n\n\t/** True when no socket connection is registered, i.e. records must fall back to the stdio lane. */\n\tisEmpty(): boolean {\n\t\treturn this.connections.size === 0;\n\t}\n\n\tbroadcast(line: string): void {\n\t\tfor (const { actor } of this.connections.values()) actor.enqueue(line);\n\t}\n\n\trememberSnapshot(sessionId: string, value: Record<string, unknown>, line: string): void {\n\t\tconst event = value.assistantMessageEvent as Record<string, unknown> | undefined;\n\t\tconst record = { line, rendered: value[RENDERED_COMPONENT_RECORD] === true };\n\t\tif (value.type === \"message_start\" || (value.type === \"message_update\" && event?.type === \"text_start\")) {\n\t\t\tthis.sessionSnapshots.set(sessionId, [record]);\n\t\t} else if (this.sessionSnapshots.has(sessionId)) {\n\t\t\tthis.sessionSnapshots.get(sessionId)?.push(record);\n\t\t}\n\t\tif (value.type === \"message_end\") this.sessionSnapshots.delete(sessionId);\n\t}\n\n\tforgetSession(sessionId: string): void {\n\t\tthis.sessionSnapshots.delete(sessionId);\n\t}\n\n\tprivate replaySnapshot(id: string, sessionId: string): void {\n\t\tconst actor = this.connections.get(id)?.actor;\n\t\tif (!actor) return;\n\t\tconst capable = this.connectionCapabilities.get(id)?.has(\"rendered_components\") ?? false;\n\t\tfor (const record of this.sessionSnapshots.get(sessionId) ?? [])\n\t\t\tif (!record.rendered || capable) actor.enqueue(record.line);\n\t}\n\n\tprivate replayRendered(id: string, sessionId: string): void {\n\t\tconst actor = this.connections.get(id)?.actor;\n\t\tif (!actor) return;\n\t\tfor (const record of this.sessionSnapshots.get(sessionId) ?? []) if (record.rendered) actor.enqueue(record.line);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-event-fanout.js","sourceRoot":"","sources":["../../../src/modes/rpc/session-event-fanout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAiBhE,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAEpE,MAAM,2BAA2B,GAAG,IAAI,GAAG,CAAC;IAC3C,aAAa;IACb,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,gBAAgB;CAChB,CAAC,CAAC;AAuBH,yFAAyF;AACzF,SAAS,uBAAuB,CAAC,MAAsB;IACtD,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,eAAe,CAAC;IACxE,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1F,MAAM,CAAC,eAAe;QACrB,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC,eAAe,CAAC;AAC/B,CAAC;AAED,MAAM,OAAO,kBAAkB;IAA/B;QACkB,gBAAW,GAAG,IAAI,GAAG,EAAgC,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IAAI,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE;YAAE,IAAI,MAAM,CAAC,QAAQ;gBAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClH,CAAC;CACD","sourcesContent":["import { MEDIA_PLACEHOLDERS_CAPABILITY, RENDERED_COMPONENTS_CAPABILITY } from \"./custom-capability.ts\";\nimport { serializeJsonLine } from \"./jsonl.ts\";\nimport { omitInlineMedia } from \"./media-placeholders.ts\";\nimport { SocketEventSinkActor } from \"./socket-event-fanout.ts\";\n\nexport type RawWriter = (chunk: string) => void;\nexport type BackpressureWaiter = () => Promise<void>;\n\nexport interface SessionEventWriterConnection {\n\treadonly writeRaw: RawWriter;\n\treadonly waitForBackpressure: BackpressureWaiter;\n\t/**\n\t * Tears the transport down. Called when this connection's event queue fails\n\t * (overflow, write error): the actor has already stopped delivering records\n\t * AND command responses, so a socket left open would strand the client on a\n\t * connection that can never answer again. Closing it lets the client resync.\n\t */\n\treadonly close?: () => void;\n}\n\nexport const RENDERED_COMPONENT_RECORD = \"__senpiRenderedComponent\";\n\nconst BROADCAST_LIFECYCLE_RECORDS = new Set([\n\t\"agent_start\",\n\t\"agent_settled\",\n\t\"agent_idle\",\n\t\"session_opened\",\n\t\"session_closed\",\n]);\n\ntype RegisteredConnection = {\n\treadonly connection: SessionEventWriterConnection;\n\treadonly actor: SocketEventSinkActor;\n};\n\n/**\n * A replayable snapshot line.\n *\n * `placeholderLine` is the `media_placeholders` variant. The writer supplies it only when\n * a capable connection was already attached when the record was emitted; a connection that\n * attaches later still needs it, so `source` carries the wire record and the variant is\n * derived once, on the first capable replay, then memoized. Records with no media resolve\n * `placeholderLine` to `line`, so replay stays O(1) and never re-serializes twice.\n */\ntype SnapshotRecord = {\n\treadonly line: string;\n\tplaceholderLine?: string;\n\treadonly source?: Record<string, unknown>;\n\treadonly rendered: boolean;\n};\n\n/** The placeholder variant of a remembered record, derived and memoized on first use. */\nfunction snapshotPlaceholderLine(record: SnapshotRecord): string {\n\tif (record.placeholderLine !== undefined) return record.placeholderLine;\n\tconst redacted = record.source === undefined ? undefined : omitInlineMedia(record.source);\n\trecord.placeholderLine =\n\t\tredacted === undefined || redacted === record.source ? record.line : serializeJsonLine(redacted);\n\treturn record.placeholderLine;\n}\n\nexport class SessionEventFanout {\n\tprivate readonly connections = new Map<string, RegisteredConnection>();\n\tprivate readonly sessionSnapshots = new Map<string, SnapshotRecord[]>();\n\tprivate readonly connectionCapabilities = new Map<string, Set<string>>();\n\tprivate readonly connectionSessions = new Map<string, Set<string>>();\n\tprivate readonly registeredCapabilityConnections = new Set<string>();\n\n\tregisterConnection(\n\t\tid: string,\n\t\tconnection: SessionEventWriterConnection,\n\t\toptions: { readonly maxQueueBytes?: number } = {},\n\t): void {\n\t\tconst actor = new SocketEventSinkActor(\n\t\t\tconnection,\n\t\t\t(cause) => {\n\t\t\t\tif (this.connections.get(id)?.actor === actor) {\n\t\t\t\t\tthis.connections.delete(id);\n\t\t\t\t\tthis.connectionCapabilities.delete(id);\n\t\t\t\t\tthis.connectionSessions.delete(id);\n\t\t\t\t\tthis.registeredCapabilityConnections.delete(id);\n\t\t\t\t}\n\t\t\t\tprocess.stderr.write(\n\t\t\t\t\t`senpi rpc connection ${id} event queue failed; closing: ${cause instanceof Error ? cause.message : String(cause)}\\n`,\n\t\t\t\t);\n\t\t\t\tconnection.close?.();\n\t\t\t},\n\t\t\toptions.maxQueueBytes,\n\t\t);\n\t\tthis.connections.set(id, { connection, actor });\n\t\tthis.connectionCapabilities.set(id, new Set());\n\t\tthis.connectionSessions.set(id, new Set());\n\t}\n\n\tunregisterConnection(id: string): void {\n\t\tconst registered = this.connections.get(id);\n\t\tif (!registered) return;\n\t\tregistered.actor.close();\n\t\tthis.connections.delete(id);\n\t\tthis.connectionCapabilities.delete(id);\n\t\tthis.connectionSessions.delete(id);\n\t\tthis.registeredCapabilityConnections.delete(id);\n\t}\n\n\tattachConnectionToSession(id: string, sessionId: string): void {\n\t\tif (!this.connections.has(id)) return;\n\t\tconst sessions = this.connectionSessions.get(id) ?? new Set<string>();\n\t\tif (sessions.has(sessionId)) return;\n\t\tsessions.add(sessionId);\n\t\tthis.connectionSessions.set(id, sessions);\n\t\tthis.replaySnapshot(id, sessionId);\n\t}\n\n\tdetachConnectionFromSession(id: string, sessionId: string): void {\n\t\tthis.connectionSessions.get(id)?.delete(sessionId);\n\t}\n\n\tsetConnectionCapabilities(id: string, capabilities: readonly string[]): void {\n\t\tconst registered = this.connections.get(id);\n\t\tif (!registered) return;\n\t\tconst wasCapable = this.connectionCapabilities.get(id)?.has(RENDERED_COMPONENTS_CAPABILITY) ?? false;\n\t\tthis.connectionCapabilities.set(id, new Set(capabilities));\n\t\tthis.registeredCapabilityConnections.add(id);\n\t\tif (!wasCapable && capabilities.includes(RENDERED_COMPONENTS_CAPABILITY))\n\t\t\tfor (const sessionId of this.connectionSessions.get(id) ?? []) this.replayRendered(id, sessionId);\n\t}\n\n\tclearConnectionCapabilities(id: string): void {\n\t\tif (this.connections.has(id)) {\n\t\t\tthis.connectionCapabilities.set(id, new Set());\n\t\t\tthis.registeredCapabilityConnections.delete(id);\n\t\t}\n\t}\n\n\thasRegisteredConnectionCapabilities(id: string): boolean {\n\t\treturn this.registeredCapabilityConnections.has(id);\n\t}\n\n\tgetConnectionCapabilities(id: string): readonly string[] | undefined {\n\t\tif (!this.registeredCapabilityConnections.has(id)) return undefined;\n\t\treturn [...(this.connectionCapabilities.get(id) ?? [])];\n\t}\n\n\thasCapableConnection(sessionId: string): boolean {\n\t\tfor (const id of this.connectionCapabilities.keys())\n\t\t\tif (this.connectionHas(id, RENDERED_COMPONENTS_CAPABILITY) && this.connectionSessions.get(id)?.has(sessionId))\n\t\t\t\treturn true;\n\t\treturn false;\n\t}\n\n\t/** Whether a connection advertised a capability. The only capability lookup in this file. */\n\tconnectionHas(id: string | undefined, capability: string): boolean {\n\t\treturn id === undefined ? false : (this.connectionCapabilities.get(id)?.has(capability) ?? false);\n\t}\n\n\ttargets(\n\t\tsessionId: string,\n\t\ttargetId: string | undefined,\n\t\tisTargeted: boolean,\n\t\trendered: boolean,\n\t\trecordType: unknown,\n\t): readonly (string | undefined)[] {\n\t\tif (isTargeted) return [targetId];\n\t\tif (typeof recordType === \"string\" && BROADCAST_LIFECYCLE_RECORDS.has(recordType))\n\t\t\treturn this.connections.size > 0 ? [...this.connections.keys()] : [undefined];\n\t\tif (rendered)\n\t\t\treturn this.connections.size > 0\n\t\t\t\t? [...this.connections.keys()].filter(\n\t\t\t\t\t\t(id) =>\n\t\t\t\t\t\t\tthis.connectionHas(id, RENDERED_COMPONENTS_CAPABILITY) &&\n\t\t\t\t\t\t\tthis.connectionSessions.get(id)?.has(sessionId),\n\t\t\t\t\t)\n\t\t\t\t: [undefined];\n\t\treturn this.connections.size > 0\n\t\t\t? [...this.connections.keys()].filter((id) => this.connectionSessions.get(id)?.has(sessionId))\n\t\t\t: [undefined];\n\t}\n\n\tget(id: string): RegisteredConnection | undefined {\n\t\treturn this.connections.get(id);\n\t}\n\n\tvalues(): IterableIterator<RegisteredConnection> {\n\t\treturn this.connections.values();\n\t}\n\n\t/** True when no socket connection is registered, i.e. records must fall back to the stdio lane. */\n\tisEmpty(): boolean {\n\t\treturn this.connections.size === 0;\n\t}\n\n\tbroadcast(line: string): void {\n\t\tfor (const { actor } of this.connections.values()) actor.enqueue(line);\n\t}\n\n\trememberSnapshot(\n\t\tsessionId: string,\n\t\tvalue: Record<string, unknown>,\n\t\tline: string,\n\t\tplaceholderLine?: string,\n\t\tsource?: Record<string, unknown>,\n\t): void {\n\t\tconst event = value.assistantMessageEvent as Record<string, unknown> | undefined;\n\t\tconst record: SnapshotRecord = {\n\t\t\tline,\n\t\t\tplaceholderLine,\n\t\t\tsource,\n\t\t\trendered: value[RENDERED_COMPONENT_RECORD] === true,\n\t\t};\n\t\tif (value.type === \"message_start\" || (value.type === \"message_update\" && event?.type === \"text_start\")) {\n\t\t\tthis.sessionSnapshots.set(sessionId, [record]);\n\t\t} else if (this.sessionSnapshots.has(sessionId)) {\n\t\t\tthis.sessionSnapshots.get(sessionId)?.push(record);\n\t\t}\n\t\tif (value.type === \"message_end\") this.sessionSnapshots.delete(sessionId);\n\t}\n\n\tforgetSession(sessionId: string): void {\n\t\tthis.sessionSnapshots.delete(sessionId);\n\t}\n\n\tprivate replaySnapshot(id: string, sessionId: string): void {\n\t\tconst actor = this.connections.get(id)?.actor;\n\t\tif (!actor) return;\n\t\tconst capable = this.connectionHas(id, RENDERED_COMPONENTS_CAPABILITY);\n\t\tconst placeholders = this.connectionHas(id, MEDIA_PLACEHOLDERS_CAPABILITY);\n\t\tfor (const record of this.sessionSnapshots.get(sessionId) ?? [])\n\t\t\tif (!record.rendered || capable) actor.enqueue(placeholders ? snapshotPlaceholderLine(record) : record.line);\n\t}\n\n\tprivate replayRendered(id: string, sessionId: string): void {\n\t\tconst actor = this.connections.get(id)?.actor;\n\t\tif (!actor) return;\n\t\tfor (const record of this.sessionSnapshots.get(sessionId) ?? []) if (record.rendered) actor.enqueue(record.line);\n\t}\n}\n"]}
|
|
@@ -30,7 +30,9 @@ export declare class SessionEventWriter {
|
|
|
30
30
|
constructor(writeRaw: RawWriter, waitForBackpressure: BackpressureWaiter, scheduleFlush?: FlushScheduler);
|
|
31
31
|
get bufferedRecordCount(): number;
|
|
32
32
|
get bufferedByteLength(): number;
|
|
33
|
-
registerConnection(id: string, connection: SessionEventWriterConnection
|
|
33
|
+
registerConnection(id: string, connection: SessionEventWriterConnection, options?: {
|
|
34
|
+
readonly maxQueueBytes?: number;
|
|
35
|
+
}): void;
|
|
34
36
|
unregisterConnection(id: string): void;
|
|
35
37
|
attachConnectionToSession(id: string, sessionId: string): void;
|
|
36
38
|
detachConnectionFromSession(id: string, sessionId: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-event-writer.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/session-event-writer.ts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GAAG,IAAI;IAShE;;;;;OAKG;IACH,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKtC,kEAAkE;IAClE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YA2BR,eAAe;YAOf,gBAAgB;IAuC9B,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,mBAAmB;IAoC3B,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,MAAM;IAcd,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAE,SAAS;CAIlB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { MEDIA_PLACEHOLDERS_CAPABILITY } from "./custom-capability.js";
|
|
2
3
|
import { serializeJsonLine } from "./jsonl.js";
|
|
4
|
+
import { omitInlineMedia } from "./media-placeholders.js";
|
|
3
5
|
import { RENDERED_COMPONENT_RECORD, SessionEventFanout, } from "./session-event-fanout.js";
|
|
4
6
|
export { RENDERED_COMPONENT_RECORD } from "./session-event-fanout.js";
|
|
5
7
|
const MESSAGE_KEY = "message";
|
|
@@ -23,6 +25,11 @@ function compactDelta(value) {
|
|
|
23
25
|
delta: typedEvent.delta,
|
|
24
26
|
};
|
|
25
27
|
}
|
|
28
|
+
/** The delta-only form of a compact message_update: cumulative snapshot fields blanked, delta kept. */
|
|
29
|
+
function demoteToDeltaOnly(value) {
|
|
30
|
+
const event = value.assistantMessageEvent;
|
|
31
|
+
return { ...value, message: null, assistantMessageEvent: { ...event, partial: null } };
|
|
32
|
+
}
|
|
26
33
|
function toolUpdateKey(value) {
|
|
27
34
|
return value.type === "tool_execution_update" && typeof value.toolCallId === "string"
|
|
28
35
|
? `tool:${value.toolCallId}`
|
|
@@ -72,8 +79,8 @@ export class SessionEventWriter {
|
|
|
72
79
|
}
|
|
73
80
|
return bytes;
|
|
74
81
|
}
|
|
75
|
-
registerConnection(id, connection) {
|
|
76
|
-
this.fanout.registerConnection(id, connection);
|
|
82
|
+
registerConnection(id, connection, options = {}) {
|
|
83
|
+
this.fanout.registerConnection(id, connection, options);
|
|
77
84
|
}
|
|
78
85
|
unregisterConnection(id) {
|
|
79
86
|
this.fanout.unregisterConnection(id);
|
|
@@ -120,17 +127,25 @@ export class SessionEventWriter {
|
|
|
120
127
|
const tagged = { ...value, sessionId };
|
|
121
128
|
const { [RENDERED_COMPONENT_RECORD]: _rendered, ...wireTagged } = tagged;
|
|
122
129
|
const line = serializeJsonLine(wireTagged);
|
|
123
|
-
if (!isTargeted)
|
|
124
|
-
this.fanout.rememberSnapshot(sessionId, tagged, line);
|
|
125
130
|
const targets = this.fanout.targets(sessionId, targetId, isTargeted, record[RENDERED_COMPONENT_RECORD] === true, record.type);
|
|
131
|
+
// A record is only walked and re-serialized when a target asked for placeholders;
|
|
132
|
+
// otherwise this is byte-for-byte today's path, with serializeJsonLine called once.
|
|
133
|
+
const hasPlaceholderTarget = targets.some((target) => this.fanout.connectionHas(target, MEDIA_PLACEHOLDERS_CAPABILITY));
|
|
134
|
+
const redacted = hasPlaceholderTarget ? omitInlineMedia(wireTagged) : wireTagged;
|
|
135
|
+
const placeholderLine = redacted === wireTagged ? undefined : serializeJsonLine(redacted);
|
|
136
|
+
if (!isTargeted)
|
|
137
|
+
this.fanout.rememberSnapshot(sessionId, tagged, line, placeholderLine, wireTagged);
|
|
126
138
|
for (const target of targets) {
|
|
127
139
|
if (target !== undefined && !this.fanout.get(target))
|
|
128
140
|
continue;
|
|
129
141
|
const registered = target === undefined ? undefined : this.fanout.get(target);
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
const wants = placeholderLine !== undefined && this.fanout.connectionHas(target, MEDIA_PLACEHOLDERS_CAPABILITY);
|
|
143
|
+
if (registered) {
|
|
144
|
+
const keyed = compactDelta(tagged) !== undefined && tagged.message !== null;
|
|
145
|
+
registered.actor.enqueue(wants ? placeholderLine : line, keyed ? MESSAGE_KEY : undefined, undefined, keyed ? serializeJsonLine(demoteToDeltaOnly(wireTagged)) : undefined);
|
|
146
|
+
}
|
|
132
147
|
else
|
|
133
|
-
this.appendSessionRecord(sessionId, wireTagged, target);
|
|
148
|
+
this.appendSessionRecord(sessionId, wants ? redacted : wireTagged, target);
|
|
134
149
|
}
|
|
135
150
|
this.requestFlush();
|
|
136
151
|
return true;
|
|
@@ -319,12 +334,7 @@ export class SessionEventWriter {
|
|
|
319
334
|
this.markReady(queue);
|
|
320
335
|
}
|
|
321
336
|
demoteAndMerge(queue, node) {
|
|
322
|
-
|
|
323
|
-
node.value = {
|
|
324
|
-
...node.value,
|
|
325
|
-
message: null,
|
|
326
|
-
assistantMessageEvent: { ...event, partial: null },
|
|
327
|
-
};
|
|
337
|
+
node.value = demoteToDeltaOnly(node.value);
|
|
328
338
|
const current = compactDelta(node.value);
|
|
329
339
|
const preceding = node.previous;
|
|
330
340
|
const previous = preceding ? compactDelta(preceding.value) : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-event-writer.js","sourceRoot":"","sources":["../../../src/modes/rpc/session-event-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACN,yBAAyB,EACzB,kBAAkB,GAElB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,yBAAyB,EAAqC,MAAM,2BAA2B,CAAC;AA0BzG,MAAM,WAAW,GAAG,SAAS,CAAC;AAC9B,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAmB,CAAC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAE1G,SAAS,YAAY,CAAC,KAAgB;IACrC,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EA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nF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACxC,CAAC;IAEO,IAAI,CAAC,KAAc;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAAE,OAAO;QACvC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACtC,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1E,CAAC;IACF,CAAC;IAEO,CAAC,SAAS;QACjB,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,YAAY,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { serializeJsonLine } from \"./jsonl.ts\";\nimport {\n\tRENDERED_COMPONENT_RECORD,\n\tSessionEventFanout,\n\ttype SessionEventWriterConnection,\n} from \"./session-event-fanout.ts\";\n\nexport { RENDERED_COMPONENT_RECORD, type SessionEventWriterConnection } from \"./session-event-fanout.ts\";\n\ntype RawWriter = (chunk: string) => void;\ntype BackpressureWaiter = () => Promise<void>;\ntype FlushScheduler = (flush: () => Promise<void>) => void;\ntype RpcRecord = Record<string, unknown>;\ntype CompactDeltaType = \"text_delta\" | \"thinking_delta\" | \"toolcall_delta\";\n\ntype QueueNode = {\n\tvalue: RpcRecord;\n\tkey?: string;\n\tprevious?: QueueNode;\n\tnext?: QueueNode;\n\tresolve?: () => void;\n\treject?: (cause: unknown) => void;\n};\n\ntype RecordQueue = {\n\tsessionId?: string;\n\ttargetId?: string;\n\thead?: QueueNode;\n\ttail?: QueueNode;\n\tlatestByKey: Map<string, QueueNode>;\n\tready: boolean;\n};\n\nconst MESSAGE_KEY = \"message\";\nconst COMPACT_DELTA_TYPES = new Set<CompactDeltaType>([\"text_delta\", \"thinking_delta\", \"toolcall_delta\"]);\n\nfunction compactDelta(value: RpcRecord): { type: CompactDeltaType; contentIndex: number; delta: string } | undefined {\n\tif (value.type !== \"message_update\" || !Object.hasOwn(value, \"message\")) return undefined;\n\tconst event = value.assistantMessageEvent;\n\tif (typeof event !== \"object\" || event === null) return undefined;\n\tconst typedEvent = event as Record<string, unknown>;\n\tif (\n\t\ttypeof typedEvent.type !== \"string\" ||\n\t\t!COMPACT_DELTA_TYPES.has(typedEvent.type as CompactDeltaType) ||\n\t\ttypeof typedEvent.contentIndex !== \"number\" ||\n\t\ttypeof typedEvent.delta !== \"string\"\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\ttype: typedEvent.type as CompactDeltaType,\n\t\tcontentIndex: typedEvent.contentIndex,\n\t\tdelta: typedEvent.delta,\n\t};\n}\n\nfunction toolUpdateKey(value: RpcRecord): string | undefined {\n\treturn value.type === \"tool_execution_update\" && typeof value.toolCallId === \"string\"\n\t\t? `tool:${value.toolCallId}`\n\t\t: undefined;\n}\n\n/**\n * Process-wide stdout scheduler for multi-session RPC mode.\n *\n * Each queue contains complete structured JSONL records for one routing handle.\n * Draining takes one record per queue in round-robin order and waits for stdout\n * backpressure before selecting the next one. A record is deliberately written\n * by itself: coalescing records from different sessions would obscure the\n * scheduling boundary and violate D9.\n */\nexport class SessionEventWriter {\n\tprivate readonly queues = new Map<string, RecordQueue>();\n\tprivate readonly fanout = new SessionEventFanout();\n\tprivate readonly connectionContext = new AsyncLocalStorage<string>();\n\tprivate readonly controlQueue: RecordQueue = { latestByKey: new Map(), ready: false };\n\tprivate readonly readyQueues: RecordQueue[] = [];\n\tprivate readonly sealedSessions = new Set<string>();\n\tprivate readonly writeRaw: RawWriter;\n\tprivate readonly waitForBackpressure?: BackpressureWaiter;\n\tprivate readonly scheduleFlush: FlushScheduler;\n\tprivate flushScheduled = false;\n\tprivate drainPromise?: Promise<void>;\n\tprivate inFlight?: { queue: RecordQueue; node: QueueNode };\n\tprivate failure?: unknown;\n\n\tconstructor(writeRaw: RawWriter, scheduleFlush?: FlushScheduler);\n\tconstructor(writeRaw: RawWriter, waitForBackpressure: BackpressureWaiter, scheduleFlush?: FlushScheduler);\n\tconstructor(\n\t\twriteRaw: RawWriter,\n\t\twaitOrSchedule?: BackpressureWaiter | FlushScheduler,\n\t\tscheduleFlush?: FlushScheduler,\n\t) {\n\t\tthis.writeRaw = writeRaw;\n\t\tif (waitOrSchedule && scheduleFlush === undefined && waitOrSchedule.length > 0) {\n\t\t\tthis.scheduleFlush = waitOrSchedule as FlushScheduler;\n\t\t} else {\n\t\t\tthis.waitForBackpressure = waitOrSchedule as BackpressureWaiter | undefined;\n\t\t\tthis.scheduleFlush = scheduleFlush ?? ((flush) => queueMicrotask(() => void flush()));\n\t\t}\n\t}\n\n\tget bufferedRecordCount(): number {\n\t\tlet count = this.inFlight ? 1 : 0;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) count++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tget bufferedByteLength(): number {\n\t\tlet bytes = this.inFlight ? Buffer.byteLength(serializeJsonLine(this.inFlight.node.value)) : 0;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) {\n\t\t\t\tbytes += Buffer.byteLength(serializeJsonLine(node.value));\n\t\t\t}\n\t\t}\n\t\treturn bytes;\n\t}\n\n\tregisterConnection(id: string, connection: SessionEventWriterConnection): void {\n\t\tthis.fanout.registerConnection(id, connection);\n\t}\n\n\tunregisterConnection(id: string): void {\n\t\tthis.fanout.unregisterConnection(id);\n\t}\n\n\tattachConnectionToSession(id: string, sessionId: string): void {\n\t\tthis.fanout.attachConnectionToSession(id, sessionId);\n\t}\n\n\tdetachConnectionFromSession(id: string, sessionId: string): void {\n\t\tthis.fanout.detachConnectionFromSession(id, sessionId);\n\t}\n\n\tsetConnectionCapabilities(id: string, capabilities: readonly string[]): void {\n\t\tthis.fanout.setConnectionCapabilities(id, capabilities);\n\t}\n\n\tclearConnectionCapabilities(id: string): void {\n\t\tthis.fanout.clearConnectionCapabilities(id);\n\t}\n\n\thasRegisteredConnectionCapabilities(id: string): boolean {\n\t\treturn this.fanout.hasRegisteredConnectionCapabilities(id);\n\t}\n\n\tgetConnectionCapabilities(id: string): readonly string[] | undefined {\n\t\treturn this.fanout.getConnectionCapabilities(id);\n\t}\n\n\thasCapableConnection(sessionId: string): boolean {\n\t\treturn this.fanout.hasCapableConnection(sessionId);\n\t}\n\n\t/** Execute a connection's command with its response destination in context. */\n\twithConnection<T>(id: string, task: () => T): T {\n\t\treturn this.connectionContext.run(id, task);\n\t}\n\n\t/** Connection id of the command currently being dispatched, when one owns it. */\n\tcurrentConnection(): string | undefined {\n\t\treturn this.connectionContext.getStore();\n\t}\n\n\t/** Queue a session record. Content events target connections attached to the session. */\n\tenqueue(sessionId: string, value: object): boolean {\n\t\tif (this.sealedSessions.has(sessionId)) return false;\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst record = value as RpcRecord;\n\t\tconst isTargeted =\n\t\t\trecord.type === \"response\" ||\n\t\t\trecord.type === \"bash_execution_update\" ||\n\t\t\t(record.type === \"extension_ui_request\" &&\n\t\t\t\t[\"select\", \"confirm\", \"input\", \"editor\"].includes(String(record.method)));\n\t\tconst tagged = { ...value, sessionId } as RpcRecord;\n\t\tconst { [RENDERED_COMPONENT_RECORD]: _rendered, ...wireTagged } = tagged;\n\t\tconst line = serializeJsonLine(wireTagged);\n\t\tif (!isTargeted) this.fanout.rememberSnapshot(sessionId, tagged, line);\n\t\tconst targets = this.fanout.targets(\n\t\t\tsessionId,\n\t\t\ttargetId,\n\t\t\tisTargeted,\n\t\t\trecord[RENDERED_COMPONENT_RECORD] === true,\n\t\t\trecord.type,\n\t\t);\n\t\tfor (const target of targets) {\n\t\t\tif (target !== undefined && !this.fanout.get(target)) continue;\n\t\t\tconst registered = target === undefined ? undefined : this.fanout.get(target);\n\t\t\tif (registered)\n\t\t\t\tregistered.actor.enqueue(line, compactDelta(tagged) && tagged.message !== null ? MESSAGE_KEY : undefined);\n\t\t\telse this.appendSessionRecord(sessionId, wireTagged, target);\n\t\t}\n\t\tthis.requestFlush();\n\t\treturn true;\n\t}\n\n\t/** Queue one untagged host-control response for the current connection. */\n\tenqueueControl(value: object): Promise<void> {\n\t\tif (this.failure !== undefined) return Promise.reject(this.failure);\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) {\n\t\t\tregistered.actor.enqueue(serializeJsonLine(value));\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tconst queue = targetId === undefined ? this.controlQueue : this.connectionQueue(targetId);\n\t\tconst completion = new Promise<void>((resolve, reject) => {\n\t\t\tthis.append(queue, { ...value }, undefined, resolve, reject);\n\t\t});\n\t\tthis.markReady(queue);\n\t\tthis.requestFlush();\n\t\treturn completion;\n\t}\n\n\t/**\n\t * Prevent subsequent records for a session and append its terminal response.\n\t * Existing records retain FIFO order; this response is therefore that\n\t * session's final stdout record.\n\t */\n\tcloseSession(sessionId: string, response: object): void {\n\t\tif (this.sealedSessions.has(sessionId)) return;\n\t\tthis.sealedSessions.add(sessionId);\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst lifecycle = { type: \"session_closed\", sessionId };\n\t\tif (this.fanout.isEmpty()) this.appendSessionRecord(sessionId, lifecycle);\n\t\telse this.fanout.broadcast(serializeJsonLine(lifecycle));\n\t\tconst taggedResponse = { ...response, sessionId };\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) registered.actor.enqueue(serializeJsonLine(taggedResponse));\n\t\telse this.appendSessionRecord(sessionId, taggedResponse, targetId);\n\t\tthis.requestFlush();\n\t}\n\n\t/** Queue a successful response for a joined close after the terminal lifecycle record. */\n\tenqueueClosedResponse(sessionId: string, response: object): void {\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst taggedResponse = { ...response, sessionId };\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) registered.actor.enqueue(serializeJsonLine(taggedResponse));\n\t\telse this.appendSessionRecord(sessionId, taggedResponse, targetId);\n\t\tthis.requestFlush();\n\t}\n\n\t/**\n\t * Drops per-session bookkeeping for a handle whose runtime is fully disposed.\n\t * Routing handles are unique per process epoch, so nothing can legitimately\n\t * emit under this id again; without this every host-closed session would\n\t * leave a permanent sealed-handle (and snapshot) entry behind.\n\t */\n\tforgetSession(sessionId: string): void {\n\t\tthis.sealedSessions.delete(sessionId);\n\t\tthis.fanout.forgetSession(sessionId);\n\t}\n\n\t/** Drain every retained lane and the current in-flight record. */\n\tflush(): Promise<void> {\n\t\tif (this.failure !== undefined) return Promise.reject(this.failure);\n\t\tthis.flushScheduled = false;\n\t\tif (this.drainPromise) return this.drainPromise;\n\t\tif (this.readyQueues.length === 0)\n\t\t\treturn Promise.all([...this.fanout.values()].map(({ actor }) => actor.flush())).then(() => undefined);\n\t\tlet resolveDrain!: () => void;\n\t\tlet rejectDrain!: (cause: unknown) => void;\n\t\tconst drain = new Promise<void>((resolve, reject) => {\n\t\t\tresolveDrain = resolve;\n\t\t\trejectDrain = reject;\n\t\t});\n\t\tthis.drainPromise = drain;\n\t\tvoid this.drainUntilEmpty().then(resolveDrain, rejectDrain);\n\t\tvoid drain.then(\n\t\t\t() => {\n\t\t\t\tif (this.drainPromise === drain) this.drainPromise = undefined;\n\t\t\t\tif (this.readyQueues.length > 0) this.requestFlush();\n\t\t\t},\n\t\t\t(cause) => {\n\t\t\t\tif (this.drainPromise === drain) this.drainPromise = undefined;\n\t\t\t\tthis.fail(cause);\n\t\t\t},\n\t\t);\n\t\treturn drain;\n\t}\n\n\tprivate async drainUntilEmpty(): Promise<void> {\n\t\tdo {\n\t\t\tawait this.drainReadyQueues();\n\t\t} while (this.readyQueues.length > 0);\n\t\tawait Promise.all([...this.fanout.values()].map(({ actor }) => actor.flush()));\n\t}\n\n\tprivate async drainReadyQueues(): Promise<void> {\n\t\twhile (this.readyQueues.length > 0) {\n\t\t\tconst queue = this.readyQueues.shift()!;\n\t\t\tqueue.ready = false;\n\t\t\tconst node = queue.head;\n\t\t\tif (!node) continue;\n\n\t\t\tthis.unlink(queue, node);\n\t\t\tthis.inFlight = { queue, node };\n\t\t\ttry {\n\t\t\t\t// D9: exactly one complete record per raw write. The next lane is not\n\t\t\t\t// selected until this record has cleared stdout backpressure.\n\t\t\t\tconst connection = queue.targetId ? this.fanout.get(queue.targetId)?.connection : undefined;\n\t\t\t\tconst writeRaw = connection?.writeRaw ?? this.writeRaw;\n\t\t\t\tconst waitForBackpressure = connection?.waitForBackpressure ?? this.waitForBackpressure;\n\t\t\t\tif (!connection && queue.targetId) {\n\t\t\t\t\tnode.resolve?.();\n\t\t\t\t} else {\n\t\t\t\t\twriteRaw(serializeJsonLine(node.value));\n\t\t\t\t\tif (waitForBackpressure) await waitForBackpressure();\n\t\t\t\t\tnode.resolve?.();\n\t\t\t\t}\n\t\t\t} catch (cause) {\n\t\t\t\tnode.reject?.(cause);\n\t\t\t\tthrow cause;\n\t\t\t} finally {\n\t\t\t\tthis.inFlight = undefined;\n\t\t\t}\n\n\t\t\tif (queue.head) {\n\t\t\t\tthis.markReady(queue);\n\t\t\t} else if (queue.sessionId || queue.targetId) {\n\t\t\t\tfor (const [key, candidate] of this.queues) {\n\t\t\t\t\tif (candidate === queue) this.queues.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate connectionQueue(targetId: string): RecordQueue {\n\t\tconst key = `connection:${targetId}`;\n\t\tlet queue = this.queues.get(key);\n\t\tif (!queue) {\n\t\t\tqueue = { targetId, latestByKey: new Map(), ready: false };\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\t\treturn queue;\n\t}\n\n\tprivate appendSessionRecord(sessionId: string, value: RpcRecord, targetId?: string): void {\n\t\tconst key = `${targetId ?? \"default\"}:${sessionId}`;\n\t\tlet queue = this.queues.get(key);\n\t\tif (!queue) {\n\t\t\tqueue = { sessionId, targetId, latestByKey: new Map(), ready: false };\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\n\t\tconst delta = compactDelta(value);\n\t\tif (delta) {\n\t\t\tconst previousFull = queue.latestByKey.get(MESSAGE_KEY);\n\t\t\tif (previousFull) this.demoteAndMerge(queue, previousFull);\n\t\t\tconst node = this.append(queue, value, MESSAGE_KEY);\n\t\t\tqueue.latestByKey.set(MESSAGE_KEY, node);\n\t\t\tthis.markReady(queue);\n\t\t\treturn;\n\t\t}\n\n\t\tconst toolKey = toolUpdateKey(value);\n\t\tif (toolKey) {\n\t\t\tconst previous = queue.latestByKey.get(toolKey);\n\t\t\tif (previous) this.unlink(queue, previous);\n\t\t\tconst node = this.append(queue, value, toolKey);\n\t\t\tqueue.latestByKey.set(toolKey, node);\n\t\t\tthis.markReady(queue);\n\t\t\treturn;\n\t\t}\n\n\t\t// All non-compactable records are ordering barriers. In particular this\n\t\t// includes delta-only/full non-delta message updates, protocol responses,\n\t\t// extension UI requests, errors, retries, lifecycle, and unknown records.\n\t\tqueue.latestByKey.clear();\n\t\tthis.append(queue, value);\n\t\tthis.markReady(queue);\n\t}\n\n\tprivate demoteAndMerge(queue: RecordQueue, node: QueueNode): void {\n\t\tconst event = node.value.assistantMessageEvent as Record<string, unknown>;\n\t\tnode.value = {\n\t\t\t...node.value,\n\t\t\tmessage: null,\n\t\t\tassistantMessageEvent: { ...event, partial: null },\n\t\t};\n\t\tconst current = compactDelta(node.value);\n\t\tconst preceding = node.previous;\n\t\tconst previous = preceding ? compactDelta(preceding.value) : undefined;\n\t\tif (\n\t\t\tpreceding &&\n\t\t\tprevious &&\n\t\t\tcurrent &&\n\t\t\tpreceding.value.message === null &&\n\t\t\tprevious.type === current.type &&\n\t\t\tprevious.contentIndex === current.contentIndex\n\t\t) {\n\t\t\tconst precedingEvent = preceding.value.assistantMessageEvent as Record<string, unknown>;\n\t\t\tpreceding.value = {\n\t\t\t\t...preceding.value,\n\t\t\t\tassistantMessageEvent: { ...precedingEvent, delta: previous.delta + current.delta },\n\t\t\t};\n\t\t\tthis.unlink(queue, node);\n\t\t}\n\t}\n\n\tprivate append(\n\t\tqueue: RecordQueue,\n\t\tvalue: RpcRecord,\n\t\tkey?: string,\n\t\tresolve?: () => void,\n\t\treject?: (cause: unknown) => void,\n\t): QueueNode {\n\t\tconst node: QueueNode = { value, key, previous: queue.tail, resolve, reject };\n\t\tif (queue.tail) queue.tail.next = node;\n\t\telse queue.head = node;\n\t\tqueue.tail = node;\n\t\treturn node;\n\t}\n\n\tprivate unlink(queue: RecordQueue, node: QueueNode): void {\n\t\tif (node.previous) node.previous.next = node.next;\n\t\telse queue.head = node.next;\n\t\tif (node.next) node.next.previous = node.previous;\n\t\telse queue.tail = node.previous;\n\t\tif (node.key && queue.latestByKey.get(node.key) === node) queue.latestByKey.delete(node.key);\n\t\tnode.previous = undefined;\n\t\tnode.next = undefined;\n\t}\n\n\tprivate markReady(queue: RecordQueue): void {\n\t\tif (queue.ready || this.inFlight?.queue === queue || !queue.head) return;\n\t\tqueue.ready = true;\n\t\tthis.readyQueues.push(queue);\n\t}\n\n\tprivate requestFlush(): void {\n\t\tif (this.failure !== undefined || this.flushScheduled || this.drainPromise) return;\n\t\tthis.flushScheduled = true;\n\t\tthis.scheduleFlush(() => this.flush());\n\t}\n\n\tprivate fail(cause: unknown): void {\n\t\tif (this.failure !== undefined) return;\n\t\tthis.failure = cause;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) node.reject?.(cause);\n\t\t}\n\t}\n\n\tprivate *allQueues(): Iterable<RecordQueue> {\n\t\tyield* this.queues.values();\n\t\tyield this.controlQueue;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-event-writer.js","s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C;IAEO,SAAS,CAAC,KAAkB;QACnC,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,KAAK,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI;YAAE,OAAO;QACzE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEO,YAAY;QACnB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,YAAY;YAAE,OAAO;QACnF,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACxC,CAAC;IAEO,IAAI,CAAC,KAAc;QAC1B,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS;YAAE,OAAO;QACvC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACtC,KAAK,IAAI,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,IAAI;gBAAE,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1E,CAAC;IACF,CAAC;IAEO,CAAC,SAAS;QACjB,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,YAAY,CAAC;IACzB,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { MEDIA_PLACEHOLDERS_CAPABILITY } from \"./custom-capability.ts\";\nimport { serializeJsonLine } from \"./jsonl.ts\";\nimport { omitInlineMedia } from \"./media-placeholders.ts\";\nimport {\n\tRENDERED_COMPONENT_RECORD,\n\tSessionEventFanout,\n\ttype SessionEventWriterConnection,\n} from \"./session-event-fanout.ts\";\n\nexport { RENDERED_COMPONENT_RECORD, type SessionEventWriterConnection } from \"./session-event-fanout.ts\";\n\ntype RawWriter = (chunk: string) => void;\ntype BackpressureWaiter = () => Promise<void>;\ntype FlushScheduler = (flush: () => Promise<void>) => void;\ntype RpcRecord = Record<string, unknown>;\ntype CompactDeltaType = \"text_delta\" | \"thinking_delta\" | \"toolcall_delta\";\n\ntype QueueNode = {\n\tvalue: RpcRecord;\n\tkey?: string;\n\tprevious?: QueueNode;\n\tnext?: QueueNode;\n\tresolve?: () => void;\n\treject?: (cause: unknown) => void;\n};\n\ntype RecordQueue = {\n\tsessionId?: string;\n\ttargetId?: string;\n\thead?: QueueNode;\n\ttail?: QueueNode;\n\tlatestByKey: Map<string, QueueNode>;\n\tready: boolean;\n};\n\nconst MESSAGE_KEY = \"message\";\nconst COMPACT_DELTA_TYPES = new Set<CompactDeltaType>([\"text_delta\", \"thinking_delta\", \"toolcall_delta\"]);\n\nfunction compactDelta(value: RpcRecord): { type: CompactDeltaType; contentIndex: number; delta: string } | undefined {\n\tif (value.type !== \"message_update\" || !Object.hasOwn(value, \"message\")) return undefined;\n\tconst event = value.assistantMessageEvent;\n\tif (typeof event !== \"object\" || event === null) return undefined;\n\tconst typedEvent = event as Record<string, unknown>;\n\tif (\n\t\ttypeof typedEvent.type !== \"string\" ||\n\t\t!COMPACT_DELTA_TYPES.has(typedEvent.type as CompactDeltaType) ||\n\t\ttypeof typedEvent.contentIndex !== \"number\" ||\n\t\ttypeof typedEvent.delta !== \"string\"\n\t) {\n\t\treturn undefined;\n\t}\n\treturn {\n\t\ttype: typedEvent.type as CompactDeltaType,\n\t\tcontentIndex: typedEvent.contentIndex,\n\t\tdelta: typedEvent.delta,\n\t};\n}\n\n/** The delta-only form of a compact message_update: cumulative snapshot fields blanked, delta kept. */\nfunction demoteToDeltaOnly(value: RpcRecord): RpcRecord {\n\tconst event = value.assistantMessageEvent as Record<string, unknown>;\n\treturn { ...value, message: null, assistantMessageEvent: { ...event, partial: null } };\n}\n\nfunction toolUpdateKey(value: RpcRecord): string | undefined {\n\treturn value.type === \"tool_execution_update\" && typeof value.toolCallId === \"string\"\n\t\t? `tool:${value.toolCallId}`\n\t\t: undefined;\n}\n\n/**\n * Process-wide stdout scheduler for multi-session RPC mode.\n *\n * Each queue contains complete structured JSONL records for one routing handle.\n * Draining takes one record per queue in round-robin order and waits for stdout\n * backpressure before selecting the next one. A record is deliberately written\n * by itself: coalescing records from different sessions would obscure the\n * scheduling boundary and violate D9.\n */\nexport class SessionEventWriter {\n\tprivate readonly queues = new Map<string, RecordQueue>();\n\tprivate readonly fanout = new SessionEventFanout();\n\tprivate readonly connectionContext = new AsyncLocalStorage<string>();\n\tprivate readonly controlQueue: RecordQueue = { latestByKey: new Map(), ready: false };\n\tprivate readonly readyQueues: RecordQueue[] = [];\n\tprivate readonly sealedSessions = new Set<string>();\n\tprivate readonly writeRaw: RawWriter;\n\tprivate readonly waitForBackpressure?: BackpressureWaiter;\n\tprivate readonly scheduleFlush: FlushScheduler;\n\tprivate flushScheduled = false;\n\tprivate drainPromise?: Promise<void>;\n\tprivate inFlight?: { queue: RecordQueue; node: QueueNode };\n\tprivate failure?: unknown;\n\n\tconstructor(writeRaw: RawWriter, scheduleFlush?: FlushScheduler);\n\tconstructor(writeRaw: RawWriter, waitForBackpressure: BackpressureWaiter, scheduleFlush?: FlushScheduler);\n\tconstructor(\n\t\twriteRaw: RawWriter,\n\t\twaitOrSchedule?: BackpressureWaiter | FlushScheduler,\n\t\tscheduleFlush?: FlushScheduler,\n\t) {\n\t\tthis.writeRaw = writeRaw;\n\t\tif (waitOrSchedule && scheduleFlush === undefined && waitOrSchedule.length > 0) {\n\t\t\tthis.scheduleFlush = waitOrSchedule as FlushScheduler;\n\t\t} else {\n\t\t\tthis.waitForBackpressure = waitOrSchedule as BackpressureWaiter | undefined;\n\t\t\tthis.scheduleFlush = scheduleFlush ?? ((flush) => queueMicrotask(() => void flush()));\n\t\t}\n\t}\n\n\tget bufferedRecordCount(): number {\n\t\tlet count = this.inFlight ? 1 : 0;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) count++;\n\t\t}\n\t\treturn count;\n\t}\n\n\tget bufferedByteLength(): number {\n\t\tlet bytes = this.inFlight ? Buffer.byteLength(serializeJsonLine(this.inFlight.node.value)) : 0;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) {\n\t\t\t\tbytes += Buffer.byteLength(serializeJsonLine(node.value));\n\t\t\t}\n\t\t}\n\t\treturn bytes;\n\t}\n\n\tregisterConnection(\n\t\tid: string,\n\t\tconnection: SessionEventWriterConnection,\n\t\toptions: { readonly maxQueueBytes?: number } = {},\n\t): void {\n\t\tthis.fanout.registerConnection(id, connection, options);\n\t}\n\n\tunregisterConnection(id: string): void {\n\t\tthis.fanout.unregisterConnection(id);\n\t}\n\n\tattachConnectionToSession(id: string, sessionId: string): void {\n\t\tthis.fanout.attachConnectionToSession(id, sessionId);\n\t}\n\n\tdetachConnectionFromSession(id: string, sessionId: string): void {\n\t\tthis.fanout.detachConnectionFromSession(id, sessionId);\n\t}\n\n\tsetConnectionCapabilities(id: string, capabilities: readonly string[]): void {\n\t\tthis.fanout.setConnectionCapabilities(id, capabilities);\n\t}\n\n\tclearConnectionCapabilities(id: string): void {\n\t\tthis.fanout.clearConnectionCapabilities(id);\n\t}\n\n\thasRegisteredConnectionCapabilities(id: string): boolean {\n\t\treturn this.fanout.hasRegisteredConnectionCapabilities(id);\n\t}\n\n\tgetConnectionCapabilities(id: string): readonly string[] | undefined {\n\t\treturn this.fanout.getConnectionCapabilities(id);\n\t}\n\n\thasCapableConnection(sessionId: string): boolean {\n\t\treturn this.fanout.hasCapableConnection(sessionId);\n\t}\n\n\t/** Execute a connection's command with its response destination in context. */\n\twithConnection<T>(id: string, task: () => T): T {\n\t\treturn this.connectionContext.run(id, task);\n\t}\n\n\t/** Connection id of the command currently being dispatched, when one owns it. */\n\tcurrentConnection(): string | undefined {\n\t\treturn this.connectionContext.getStore();\n\t}\n\n\t/** Queue a session record. Content events target connections attached to the session. */\n\tenqueue(sessionId: string, value: object): boolean {\n\t\tif (this.sealedSessions.has(sessionId)) return false;\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst record = value as RpcRecord;\n\t\tconst isTargeted =\n\t\t\trecord.type === \"response\" ||\n\t\t\trecord.type === \"bash_execution_update\" ||\n\t\t\t(record.type === \"extension_ui_request\" &&\n\t\t\t\t[\"select\", \"confirm\", \"input\", \"editor\"].includes(String(record.method)));\n\t\tconst tagged = { ...value, sessionId } as RpcRecord;\n\t\tconst { [RENDERED_COMPONENT_RECORD]: _rendered, ...wireTagged } = tagged;\n\t\tconst line = serializeJsonLine(wireTagged);\n\t\tconst targets = this.fanout.targets(\n\t\t\tsessionId,\n\t\t\ttargetId,\n\t\t\tisTargeted,\n\t\t\trecord[RENDERED_COMPONENT_RECORD] === true,\n\t\t\trecord.type,\n\t\t);\n\t\t// A record is only walked and re-serialized when a target asked for placeholders;\n\t\t// otherwise this is byte-for-byte today's path, with serializeJsonLine called once.\n\t\tconst hasPlaceholderTarget = targets.some((target) =>\n\t\t\tthis.fanout.connectionHas(target, MEDIA_PLACEHOLDERS_CAPABILITY),\n\t\t);\n\t\tconst redacted = hasPlaceholderTarget ? omitInlineMedia(wireTagged) : wireTagged;\n\t\tconst placeholderLine = redacted === wireTagged ? undefined : serializeJsonLine(redacted);\n\t\tif (!isTargeted) this.fanout.rememberSnapshot(sessionId, tagged, line, placeholderLine, wireTagged);\n\t\tfor (const target of targets) {\n\t\t\tif (target !== undefined && !this.fanout.get(target)) continue;\n\t\t\tconst registered = target === undefined ? undefined : this.fanout.get(target);\n\t\t\tconst wants =\n\t\t\t\tplaceholderLine !== undefined && this.fanout.connectionHas(target, MEDIA_PLACEHOLDERS_CAPABILITY);\n\t\t\tif (registered) {\n\t\t\t\tconst keyed = compactDelta(tagged) !== undefined && tagged.message !== null;\n\t\t\t\tregistered.actor.enqueue(\n\t\t\t\t\twants ? placeholderLine : line,\n\t\t\t\t\tkeyed ? MESSAGE_KEY : undefined,\n\t\t\t\t\tundefined,\n\t\t\t\t\tkeyed ? serializeJsonLine(demoteToDeltaOnly(wireTagged)) : undefined,\n\t\t\t\t);\n\t\t\t} else this.appendSessionRecord(sessionId, wants ? (redacted as RpcRecord) : wireTagged, target);\n\t\t}\n\t\tthis.requestFlush();\n\t\treturn true;\n\t}\n\n\t/** Queue one untagged host-control response for the current connection. */\n\tenqueueControl(value: object): Promise<void> {\n\t\tif (this.failure !== undefined) return Promise.reject(this.failure);\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) {\n\t\t\tregistered.actor.enqueue(serializeJsonLine(value));\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tconst queue = targetId === undefined ? this.controlQueue : this.connectionQueue(targetId);\n\t\tconst completion = new Promise<void>((resolve, reject) => {\n\t\t\tthis.append(queue, { ...value }, undefined, resolve, reject);\n\t\t});\n\t\tthis.markReady(queue);\n\t\tthis.requestFlush();\n\t\treturn completion;\n\t}\n\n\t/**\n\t * Prevent subsequent records for a session and append its terminal response.\n\t * Existing records retain FIFO order; this response is therefore that\n\t * session's final stdout record.\n\t */\n\tcloseSession(sessionId: string, response: object): void {\n\t\tif (this.sealedSessions.has(sessionId)) return;\n\t\tthis.sealedSessions.add(sessionId);\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst lifecycle = { type: \"session_closed\", sessionId };\n\t\tif (this.fanout.isEmpty()) this.appendSessionRecord(sessionId, lifecycle);\n\t\telse this.fanout.broadcast(serializeJsonLine(lifecycle));\n\t\tconst taggedResponse = { ...response, sessionId };\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) registered.actor.enqueue(serializeJsonLine(taggedResponse));\n\t\telse this.appendSessionRecord(sessionId, taggedResponse, targetId);\n\t\tthis.requestFlush();\n\t}\n\n\t/** Queue a successful response for a joined close after the terminal lifecycle record. */\n\tenqueueClosedResponse(sessionId: string, response: object): void {\n\t\tconst targetId = this.connectionContext.getStore();\n\t\tconst taggedResponse = { ...response, sessionId };\n\t\tconst registered = targetId === undefined ? undefined : this.fanout.get(targetId);\n\t\tif (registered) registered.actor.enqueue(serializeJsonLine(taggedResponse));\n\t\telse this.appendSessionRecord(sessionId, taggedResponse, targetId);\n\t\tthis.requestFlush();\n\t}\n\n\t/**\n\t * Drops per-session bookkeeping for a handle whose runtime is fully disposed.\n\t * Routing handles are unique per process epoch, so nothing can legitimately\n\t * emit under this id again; without this every host-closed session would\n\t * leave a permanent sealed-handle (and snapshot) entry behind.\n\t */\n\tforgetSession(sessionId: string): void {\n\t\tthis.sealedSessions.delete(sessionId);\n\t\tthis.fanout.forgetSession(sessionId);\n\t}\n\n\t/** Drain every retained lane and the current in-flight record. */\n\tflush(): Promise<void> {\n\t\tif (this.failure !== undefined) return Promise.reject(this.failure);\n\t\tthis.flushScheduled = false;\n\t\tif (this.drainPromise) return this.drainPromise;\n\t\tif (this.readyQueues.length === 0)\n\t\t\treturn Promise.all([...this.fanout.values()].map(({ actor }) => actor.flush())).then(() => undefined);\n\t\tlet resolveDrain!: () => void;\n\t\tlet rejectDrain!: (cause: unknown) => void;\n\t\tconst drain = new Promise<void>((resolve, reject) => {\n\t\t\tresolveDrain = resolve;\n\t\t\trejectDrain = reject;\n\t\t});\n\t\tthis.drainPromise = drain;\n\t\tvoid this.drainUntilEmpty().then(resolveDrain, rejectDrain);\n\t\tvoid drain.then(\n\t\t\t() => {\n\t\t\t\tif (this.drainPromise === drain) this.drainPromise = undefined;\n\t\t\t\tif (this.readyQueues.length > 0) this.requestFlush();\n\t\t\t},\n\t\t\t(cause) => {\n\t\t\t\tif (this.drainPromise === drain) this.drainPromise = undefined;\n\t\t\t\tthis.fail(cause);\n\t\t\t},\n\t\t);\n\t\treturn drain;\n\t}\n\n\tprivate async drainUntilEmpty(): Promise<void> {\n\t\tdo {\n\t\t\tawait this.drainReadyQueues();\n\t\t} while (this.readyQueues.length > 0);\n\t\tawait Promise.all([...this.fanout.values()].map(({ actor }) => actor.flush()));\n\t}\n\n\tprivate async drainReadyQueues(): Promise<void> {\n\t\twhile (this.readyQueues.length > 0) {\n\t\t\tconst queue = this.readyQueues.shift()!;\n\t\t\tqueue.ready = false;\n\t\t\tconst node = queue.head;\n\t\t\tif (!node) continue;\n\n\t\t\tthis.unlink(queue, node);\n\t\t\tthis.inFlight = { queue, node };\n\t\t\ttry {\n\t\t\t\t// D9: exactly one complete record per raw write. The next lane is not\n\t\t\t\t// selected until this record has cleared stdout backpressure.\n\t\t\t\tconst connection = queue.targetId ? this.fanout.get(queue.targetId)?.connection : undefined;\n\t\t\t\tconst writeRaw = connection?.writeRaw ?? this.writeRaw;\n\t\t\t\tconst waitForBackpressure = connection?.waitForBackpressure ?? this.waitForBackpressure;\n\t\t\t\tif (!connection && queue.targetId) {\n\t\t\t\t\tnode.resolve?.();\n\t\t\t\t} else {\n\t\t\t\t\twriteRaw(serializeJsonLine(node.value));\n\t\t\t\t\tif (waitForBackpressure) await waitForBackpressure();\n\t\t\t\t\tnode.resolve?.();\n\t\t\t\t}\n\t\t\t} catch (cause) {\n\t\t\t\tnode.reject?.(cause);\n\t\t\t\tthrow cause;\n\t\t\t} finally {\n\t\t\t\tthis.inFlight = undefined;\n\t\t\t}\n\n\t\t\tif (queue.head) {\n\t\t\t\tthis.markReady(queue);\n\t\t\t} else if (queue.sessionId || queue.targetId) {\n\t\t\t\tfor (const [key, candidate] of this.queues) {\n\t\t\t\t\tif (candidate === queue) this.queues.delete(key);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate connectionQueue(targetId: string): RecordQueue {\n\t\tconst key = `connection:${targetId}`;\n\t\tlet queue = this.queues.get(key);\n\t\tif (!queue) {\n\t\t\tqueue = { targetId, latestByKey: new Map(), ready: false };\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\t\treturn queue;\n\t}\n\n\tprivate appendSessionRecord(sessionId: string, value: RpcRecord, targetId?: string): void {\n\t\tconst key = `${targetId ?? \"default\"}:${sessionId}`;\n\t\tlet queue = this.queues.get(key);\n\t\tif (!queue) {\n\t\t\tqueue = { sessionId, targetId, latestByKey: new Map(), ready: false };\n\t\t\tthis.queues.set(key, queue);\n\t\t}\n\n\t\tconst delta = compactDelta(value);\n\t\tif (delta) {\n\t\t\tconst previousFull = queue.latestByKey.get(MESSAGE_KEY);\n\t\t\tif (previousFull) this.demoteAndMerge(queue, previousFull);\n\t\t\tconst node = this.append(queue, value, MESSAGE_KEY);\n\t\t\tqueue.latestByKey.set(MESSAGE_KEY, node);\n\t\t\tthis.markReady(queue);\n\t\t\treturn;\n\t\t}\n\n\t\tconst toolKey = toolUpdateKey(value);\n\t\tif (toolKey) {\n\t\t\tconst previous = queue.latestByKey.get(toolKey);\n\t\t\tif (previous) this.unlink(queue, previous);\n\t\t\tconst node = this.append(queue, value, toolKey);\n\t\t\tqueue.latestByKey.set(toolKey, node);\n\t\t\tthis.markReady(queue);\n\t\t\treturn;\n\t\t}\n\n\t\t// All non-compactable records are ordering barriers. In particular this\n\t\t// includes delta-only/full non-delta message updates, protocol responses,\n\t\t// extension UI requests, errors, retries, lifecycle, and unknown records.\n\t\tqueue.latestByKey.clear();\n\t\tthis.append(queue, value);\n\t\tthis.markReady(queue);\n\t}\n\n\tprivate demoteAndMerge(queue: RecordQueue, node: QueueNode): void {\n\t\tnode.value = demoteToDeltaOnly(node.value);\n\t\tconst current = compactDelta(node.value);\n\t\tconst preceding = node.previous;\n\t\tconst previous = preceding ? compactDelta(preceding.value) : undefined;\n\t\tif (\n\t\t\tpreceding &&\n\t\t\tprevious &&\n\t\t\tcurrent &&\n\t\t\tpreceding.value.message === null &&\n\t\t\tprevious.type === current.type &&\n\t\t\tprevious.contentIndex === current.contentIndex\n\t\t) {\n\t\t\tconst precedingEvent = preceding.value.assistantMessageEvent as Record<string, unknown>;\n\t\t\tpreceding.value = {\n\t\t\t\t...preceding.value,\n\t\t\t\tassistantMessageEvent: { ...precedingEvent, delta: previous.delta + current.delta },\n\t\t\t};\n\t\t\tthis.unlink(queue, node);\n\t\t}\n\t}\n\n\tprivate append(\n\t\tqueue: RecordQueue,\n\t\tvalue: RpcRecord,\n\t\tkey?: string,\n\t\tresolve?: () => void,\n\t\treject?: (cause: unknown) => void,\n\t): QueueNode {\n\t\tconst node: QueueNode = { value, key, previous: queue.tail, resolve, reject };\n\t\tif (queue.tail) queue.tail.next = node;\n\t\telse queue.head = node;\n\t\tqueue.tail = node;\n\t\treturn node;\n\t}\n\n\tprivate unlink(queue: RecordQueue, node: QueueNode): void {\n\t\tif (node.previous) node.previous.next = node.next;\n\t\telse queue.head = node.next;\n\t\tif (node.next) node.next.previous = node.previous;\n\t\telse queue.tail = node.previous;\n\t\tif (node.key && queue.latestByKey.get(node.key) === node) queue.latestByKey.delete(node.key);\n\t\tnode.previous = undefined;\n\t\tnode.next = undefined;\n\t}\n\n\tprivate markReady(queue: RecordQueue): void {\n\t\tif (queue.ready || this.inFlight?.queue === queue || !queue.head) return;\n\t\tqueue.ready = true;\n\t\tthis.readyQueues.push(queue);\n\t}\n\n\tprivate requestFlush(): void {\n\t\tif (this.failure !== undefined || this.flushScheduled || this.drainPromise) return;\n\t\tthis.flushScheduled = true;\n\t\tthis.scheduleFlush(() => this.flush());\n\t}\n\n\tprivate fail(cause: unknown): void {\n\t\tif (this.failure !== undefined) return;\n\t\tthis.failure = cause;\n\t\tfor (const queue of this.allQueues()) {\n\t\t\tfor (let node = queue.head; node; node = node.next) node.reject?.(cause);\n\t\t}\n\t}\n\n\tprivate *allQueues(): Iterable<RecordQueue> {\n\t\tyield* this.queues.values();\n\t\tyield this.controlQueue;\n\t}\n}\n"]}
|
|
@@ -2,6 +2,13 @@ type SocketSink = {
|
|
|
2
2
|
writeRaw(chunk: string): void;
|
|
3
3
|
waitForBackpressure(): Promise<void>;
|
|
4
4
|
};
|
|
5
|
+
export declare class SocketEventQueueOverflowError extends Error {
|
|
6
|
+
readonly queuedBytes: number;
|
|
7
|
+
readonly incomingBytes: number;
|
|
8
|
+
readonly maxQueueBytes: number;
|
|
9
|
+
readonly incomingPreview: string;
|
|
10
|
+
constructor(queuedBytes: number, incomingBytes: number, maxQueueBytes: number, incomingPreview: string);
|
|
11
|
+
}
|
|
5
12
|
/** Independent FIFO actor for one socket. It never shares a drain promise with another sink. */
|
|
6
13
|
export declare class SocketEventSinkActor {
|
|
7
14
|
private readonly queue;
|
|
@@ -13,7 +20,7 @@ export declare class SocketEventSinkActor {
|
|
|
13
20
|
private readonly onFailure;
|
|
14
21
|
private readonly maxQueueBytes;
|
|
15
22
|
constructor(sink: SocketSink, onFailure: (cause: unknown) => void, maxQueueBytes?: number);
|
|
16
|
-
enqueue(line: string, key?: string, onWritten?: () => void): void;
|
|
23
|
+
enqueue(line: string, key?: string, onWritten?: () => void, demotedLine?: string): void;
|
|
17
24
|
flush(): Promise<void>;
|
|
18
25
|
close(): void;
|
|
19
26
|
private drain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-event-fanout.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/socket-event-fanout.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC;
|
|
1
|
+
{"version":3,"file":"socket-event-fanout.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/socket-event-fanout.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC;AAqBF,qBAAa,6BAA8B,SAAQ,KAAK;IACvD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;gBAErB,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;CAUtG;AAED,gGAAgG;AAChG,qBAAa,oBAAoB;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAgB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAC,CAAU;IAE1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2B;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,EAAE,aAAa,SAAsB;IAMtG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;IA4CjF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,KAAK;CA0Bb"}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
// A handful of image tool results is several MiB of base64 each; four of them
|
|
2
|
+
// blew the previous 4 MiB cap in one burst on a healthy reader. Overflow is a
|
|
3
|
+
// fail-closed disconnect (the client must resync), so the cap has to be well
|
|
4
|
+
// above any single burst a normal session produces.
|
|
5
|
+
const DEFAULT_QUEUE_BYTES = 64 * 1024 * 1024;
|
|
6
|
+
export class SocketEventQueueOverflowError extends Error {
|
|
7
|
+
constructor(queuedBytes, incomingBytes, maxQueueBytes, incomingPreview) {
|
|
8
|
+
super(`socket event queue overflow: ${queuedBytes} queued + ${incomingBytes} incoming > ${maxQueueBytes} (incoming: ${incomingPreview})`);
|
|
9
|
+
this.name = "SocketEventQueueOverflowError";
|
|
10
|
+
this.queuedBytes = queuedBytes;
|
|
11
|
+
this.incomingBytes = incomingBytes;
|
|
12
|
+
this.maxQueueBytes = maxQueueBytes;
|
|
13
|
+
this.incomingPreview = incomingPreview;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
2
16
|
/** Independent FIFO actor for one socket. It never shares a drain promise with another sink. */
|
|
3
17
|
export class SocketEventSinkActor {
|
|
4
18
|
constructor(sink, onFailure, maxQueueBytes = DEFAULT_QUEUE_BYTES) {
|
|
@@ -9,21 +23,30 @@ export class SocketEventSinkActor {
|
|
|
9
23
|
this.onFailure = onFailure;
|
|
10
24
|
this.maxQueueBytes = maxQueueBytes;
|
|
11
25
|
}
|
|
12
|
-
enqueue(line, key, onWritten) {
|
|
26
|
+
enqueue(line, key, onWritten, demotedLine) {
|
|
13
27
|
if (this.closed)
|
|
14
28
|
return;
|
|
15
29
|
const bytes = Buffer.byteLength(line);
|
|
16
30
|
if (key !== undefined) {
|
|
17
31
|
const existing = this.queue.find((entry) => entry.key === key);
|
|
18
32
|
if (existing) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
// Lossless supersession. The old behaviour replaced the queued line
|
|
34
|
+
// outright, which threw away every delta a stalled reader had not yet
|
|
35
|
+
// received (a desktop client assembles text from deltas). Keep the
|
|
36
|
+
// superseded record - demoted to its delta-only form when the producer
|
|
37
|
+
// supplied one - and let only the newest record carry the snapshot.
|
|
38
|
+
if (existing.demotedLine !== undefined) {
|
|
39
|
+
this.queuedBytes -= existing.bytes;
|
|
40
|
+
existing.line = existing.demotedLine;
|
|
41
|
+
existing.bytes = Buffer.byteLength(existing.line);
|
|
42
|
+
this.queuedBytes += existing.bytes;
|
|
43
|
+
existing.demotedLine = undefined;
|
|
44
|
+
}
|
|
45
|
+
existing.key = undefined;
|
|
24
46
|
}
|
|
25
47
|
}
|
|
26
48
|
if (this.queuedBytes + bytes > this.maxQueueBytes) {
|
|
49
|
+
const overflow = new SocketEventQueueOverflowError(this.queuedBytes, bytes, this.maxQueueBytes, line.slice(0, 120));
|
|
27
50
|
this.closed = true;
|
|
28
51
|
this.queue.length = 0;
|
|
29
52
|
this.queuedBytes = 0;
|
|
@@ -33,10 +56,10 @@ export class SocketEventSinkActor {
|
|
|
33
56
|
catch (cause) {
|
|
34
57
|
this.onFailure(cause);
|
|
35
58
|
}
|
|
36
|
-
this.onFailure(
|
|
59
|
+
this.onFailure(overflow);
|
|
37
60
|
return;
|
|
38
61
|
}
|
|
39
|
-
this.queue.push({ line, bytes, key, onWritten });
|
|
62
|
+
this.queue.push({ line, bytes, key, demotedLine, onWritten });
|
|
40
63
|
this.queuedBytes += bytes;
|
|
41
64
|
void this.drain();
|
|
42
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-event-fanout.js","sourceRoot":"","sources":["../../../src/modes/rpc/socket-event-fanout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"socket-event-fanout.js","sourceRoot":"","sources":["../../../src/modes/rpc/socket-event-fanout.ts"],"names":[],"mappings":"AAkBA,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,oDAAoD;AACpD,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAMvD,YAAY,WAAmB,EAAE,aAAqB,EAAE,aAAqB,EAAE,eAAuB;QACrG,KAAK,CACJ,gCAAgC,WAAW,aAAa,aAAa,eAAe,aAAa,eAAe,eAAe,GAAG,CAClI,CAAC;QACF,IAAI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B,2EAA2E;YAC3E,oEAAoE;YACpE,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;gBAAE,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;CACD","sourcesContent":["type SocketSink = {\n\twriteRaw(chunk: string): void;\n\twaitForBackpressure(): Promise<void>;\n};\n\ntype QueueEntry = {\n\tline: string;\n\tbytes: number;\n\tkey?: string;\n\t/**\n\t * The record with its cumulative snapshot fields blanked (delta kept). When a\n\t * later record with the same key supersedes this one, the entry is rewritten to\n\t * this line instead of being replaced, so a stalled reader never loses a delta.\n\t */\n\tdemotedLine?: string;\n\tonWritten?: () => void;\n};\n\n// A handful of image tool results is several MiB of base64 each; four of them\n// blew the previous 4 MiB cap in one burst on a healthy reader. Overflow is a\n// fail-closed disconnect (the client must resync), so the cap has to be well\n// above any single burst a normal session produces.\nconst DEFAULT_QUEUE_BYTES = 64 * 1024 * 1024;\n\nexport class SocketEventQueueOverflowError extends Error {\n\treadonly queuedBytes: number;\n\treadonly incomingBytes: number;\n\treadonly maxQueueBytes: number;\n\treadonly incomingPreview: string;\n\n\tconstructor(queuedBytes: number, incomingBytes: number, maxQueueBytes: number, incomingPreview: string) {\n\t\tsuper(\n\t\t\t`socket event queue overflow: ${queuedBytes} queued + ${incomingBytes} incoming > ${maxQueueBytes} (incoming: ${incomingPreview})`,\n\t\t);\n\t\tthis.name = \"SocketEventQueueOverflowError\";\n\t\tthis.queuedBytes = queuedBytes;\n\t\tthis.incomingBytes = incomingBytes;\n\t\tthis.maxQueueBytes = maxQueueBytes;\n\t\tthis.incomingPreview = incomingPreview;\n\t}\n}\n\n/** Independent FIFO actor for one socket. It never shares a drain promise with another sink. */\nexport class SocketEventSinkActor {\n\tprivate readonly queue: QueueEntry[] = [];\n\tprivate queuedBytes = 0;\n\tprivate draining?: Promise<void>;\n\tprivate closed = false;\n\tprivate failure?: unknown;\n\n\tprivate readonly sink: SocketSink;\n\tprivate readonly onFailure: (cause: unknown) => void;\n\tprivate readonly maxQueueBytes: number;\n\n\tconstructor(sink: SocketSink, onFailure: (cause: unknown) => void, maxQueueBytes = DEFAULT_QUEUE_BYTES) {\n\t\tthis.sink = sink;\n\t\tthis.onFailure = onFailure;\n\t\tthis.maxQueueBytes = maxQueueBytes;\n\t}\n\n\tenqueue(line: string, key?: string, onWritten?: () => void, demotedLine?: string): void {\n\t\tif (this.closed) return;\n\t\tconst bytes = Buffer.byteLength(line);\n\t\tif (key !== undefined) {\n\t\t\tconst existing = this.queue.find((entry) => entry.key === key);\n\t\t\tif (existing) {\n\t\t\t\t// Lossless supersession. The old behaviour replaced the queued line\n\t\t\t\t// outright, which threw away every delta a stalled reader had not yet\n\t\t\t\t// received (a desktop client assembles text from deltas). Keep the\n\t\t\t\t// superseded record - demoted to its delta-only form when the producer\n\t\t\t\t// supplied one - and let only the newest record carry the snapshot.\n\t\t\t\tif (existing.demotedLine !== undefined) {\n\t\t\t\t\tthis.queuedBytes -= existing.bytes;\n\t\t\t\t\texisting.line = existing.demotedLine;\n\t\t\t\t\texisting.bytes = Buffer.byteLength(existing.line);\n\t\t\t\t\tthis.queuedBytes += existing.bytes;\n\t\t\t\t\texisting.demotedLine = undefined;\n\t\t\t\t}\n\t\t\t\texisting.key = undefined;\n\t\t\t}\n\t\t}\n\t\tif (this.queuedBytes + bytes > this.maxQueueBytes) {\n\t\t\tconst overflow = new SocketEventQueueOverflowError(\n\t\t\t\tthis.queuedBytes,\n\t\t\t\tbytes,\n\t\t\t\tthis.maxQueueBytes,\n\t\t\t\tline.slice(0, 120),\n\t\t\t);\n\t\t\tthis.closed = true;\n\t\t\tthis.queue.length = 0;\n\t\t\tthis.queuedBytes = 0;\n\t\t\ttry {\n\t\t\t\tthis.sink.writeRaw(`${JSON.stringify({ type: \"overflow\", error: \"overflow, resync required\" })}\\n`);\n\t\t\t} catch (cause) {\n\t\t\t\tthis.onFailure(cause);\n\t\t\t}\n\t\t\tthis.onFailure(overflow);\n\t\t\treturn;\n\t\t}\n\t\tthis.queue.push({ line, bytes, key, demotedLine, onWritten });\n\t\tthis.queuedBytes += bytes;\n\t\tvoid this.drain();\n\t}\n\n\tasync flush(): Promise<void> {\n\t\twhile (this.draining) await this.draining;\n\t\tif (this.failure !== undefined) throw this.failure;\n\t}\n\n\tclose(): void {\n\t\tthis.closed = true;\n\t\tthis.queue.length = 0;\n\t\tthis.queuedBytes = 0;\n\t}\n\n\tprivate drain(): Promise<void> {\n\t\tif (this.draining) return this.draining;\n\t\tthis.draining = (async () => {\n\t\t\ttry {\n\t\t\t\twhile (!this.closed && this.queue.length > 0) {\n\t\t\t\t\tconst entry = this.queue.shift()!;\n\t\t\t\t\tthis.queuedBytes -= entry.bytes;\n\t\t\t\t\tthis.sink.writeRaw(entry.line);\n\t\t\t\t\tawait this.sink.waitForBackpressure();\n\t\t\t\t\tentry.onWritten?.();\n\t\t\t\t}\n\t\t\t} catch (cause) {\n\t\t\t\tthis.failure = cause;\n\t\t\t\tthis.closed = true;\n\t\t\t\tthis.queue.length = 0;\n\t\t\t\tthis.queuedBytes = 0;\n\t\t\t\tthis.onFailure(cause);\n\t\t\t}\n\t\t})().finally(() => {\n\t\t\tthis.draining = undefined;\n\t\t\t// An enqueue that lands between the loop's exit and this reaction sees the\n\t\t\t// stale settled promise and starts nothing; reschedule for it here.\n\t\t\tif (!this.closed && this.queue.length > 0) void this.drain();\n\t\t});\n\t\treturn this.draining;\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-check.d.ts","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,kBAAkB,EAA0B,MAAM,kBAAkB,CAAC;AAcnF,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,kB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AAE,MAAM,EACtB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAqCtC;AAED,wBAAsB,kBAAkB,CACvC,cAAc,EAAE,MAAM,EACtB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED,wBAAsB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,CAYvG"}
|
|
@@ -67,10 +67,9 @@ export function comparePackageVersions(leftVersion, rightVersion) {
|
|
|
67
67
|
}
|
|
68
68
|
export function isNewerPackageVersion(candidateVersion, currentVersion) {
|
|
69
69
|
const comparison = comparePackageVersions(candidateVersion, currentVersion);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return candidateVersion.trim() !== currentVersion.trim();
|
|
70
|
+
// Unparseable pairs (e.g. branded build labels) are never "newer": an update
|
|
71
|
+
// we cannot order is not one we can advertise.
|
|
72
|
+
return comparison !== undefined && comparison > 0;
|
|
74
73
|
}
|
|
75
74
|
export function getReleaseChangelogUrl(version) {
|
|
76
75
|
const trimmedVersion = version.trim();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-check.js","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAA2B,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,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AQ,CAAC,oBAAoB,CAAC;QAAE,OAAO,SAAS,CAAC;IAErD,IAAI,CAAC;QACJ,MAAM,aAAa,GAAG,MAAM,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAC/D,IAAI,aAAa,IAAI,qBAAqB,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,CAAC;YACnF,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC","sourcesContent":["import { compare, valid } from \"semver\";\nimport { PACKAGE_NAME } from \"../config.ts\";\nimport { type BrandUpdateChannel, brandProfile, envValue } from \"../core/brand.ts\";\nimport { fetchWithRetry } from \"./management-http.ts\";\nimport { getPiUserAgent } from \"./pi-user-agent.ts\";\n\nconst REGISTRY_BASE_URL = \"https://registry.npmjs.org\";\nconst LATEST_VERSION_URL = `${REGISTRY_BASE_URL}/${encodeURIComponent(PACKAGE_NAME)}/latest`;\n\n/** Registry endpoint answering \"what version does this product publish right now?\". */\nfunction latestVersionUrl(channel: BrandUpdateChannel | undefined): string {\n\treturn channel\n\t\t? `${REGISTRY_BASE_URL}/-/package/${encodeURIComponent(channel.packageName)}/dist-tags`\n\t\t: LATEST_VERSION_URL;\n}\n\n/** Reads the available version out of whichever registry document was fetched. */\nexport function readAvailableVersion(payload: unknown, channel: BrandUpdateChannel | undefined): string | undefined {\n\tif (typeof payload !== \"object\" || payload === null) return undefined;\n\tconst source = payload as Record<string, unknown>;\n\tconst raw = channel ? source[channel.distTag] : source.version;\n\treturn typeof raw === \"string\" && raw.trim() ? raw.trim() : undefined;\n}\nconst DEFAULT_VERSION_CHECK_TIMEOUT_MS = 10000;\nconst RELEASE_CHANGELOG_BASE_URL = \"https://github.com/code-yeongyu/senpi/blob\";\nconst RELEASE_CHANGELOG_PATH = \"packages/coding-agent/CHANGELOG.md\";\nconst SENPI_CALVER_PATTERN = /^(\\d{4})\\.(\\d{1,2})\\.(\\d{1,2})(?:-([2-9]\\d*))?$/;\n\nexport interface LatestPiRelease {\n\tversion: string;\n\tpackageName?: string;\n\tnote?: string;\n}\n\nfunction parseSenpiCalVer(version: string): readonly [number, number, number, number] | undefined {\n\tconst match = SENPI_CALVER_PATTERN.exec(version);\n\tif (!match) {\n\t\treturn undefined;\n\t}\n\treturn [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4] ?? 1)];\n}\n/** Include useful errno details hidden behind Node's generic \"fetch failed\" error. */\nexport function formatVersionCheckError(error: unknown): string {\n\tconst rootMessage = error instanceof Error && error.message ? error.message : String(error);\n\tconst cause = error instanceof Error ? error.cause : undefined;\n\tconst causes = cause instanceof AggregateError ? cause.errors : cause === undefined ? [] : [cause];\n\tconst codes = causes\n\t\t.map((value) =>\n\t\t\ttypeof value === \"object\" && value !== null && \"code\" in value && typeof value.code === \"string\"\n\t\t\t\t? value.code\n\t\t\t\t: undefined,\n\t\t)\n\t\t.filter((code): code is string => code !== undefined);\n\n\tif (codes.length > 0) return `${rootMessage} (${[...new Set(codes)].join(\", \")})`;\n\tconst causeMessage = causes.find(\n\t\t(value): value is Error => value instanceof Error && Boolean(value.message),\n\t)?.message;\n\treturn causeMessage ? `${rootMessage} (cause: ${causeMessage})` : rootMessage;\n}\nexport function comparePackageVersions(leftVersion: string, rightVersion: string): number | undefined {\n\tconst leftTrimmed = leftVersion.trim();\n\tconst rightTrimmed = rightVersion.trim();\n\tconst leftCalVer = parseSenpiCalVer(leftTrimmed);\n\tconst rightCalVer = parseSenpiCalVer(rightTrimmed);\n\tif (leftCalVer && rightCalVer) {\n\t\tfor (let index = 0; index < leftCalVer.length; index++) {\n\t\t\tif (leftCalVer[index] !== rightCalVer[index]) {\n\t\t\t\treturn leftCalVer[index] < rightCalVer[index] ? -1 : 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tconst left = valid(leftTrimmed);\n\tconst right = valid(rightTrimmed);\n\tif (!left || !right) {\n\t\treturn undefined;\n\t}\n\treturn compare(left, right);\n}\n\nexport function isNewerPackageVersion(candidateVersion: string, currentVersion: string): boolean {\n\tconst comparison = comparePackageVersions(candidateVersion, currentVersion);\n\tif (comparison !== undefined) {\n\t\treturn comparison > 0;\n\t}\n\treturn candidateVersion.trim() !== currentVersion.trim();\n}\n\nexport function getReleaseChangelogUrl(version: string): string {\n\tconst trimmedVersion = version.trim();\n\tconst channel = brandProfile()?.update;\n\tif (channel?.changelogUrl) {\n\t\treturn channel.changelogUrl.replace(\"{version}\", trimmedVersion);\n\t}\n\tconst tag = trimmedVersion.startsWith(\"v\") ? trimmedVersion : `v${trimmedVersion}`;\n\treturn `${RELEASE_CHANGELOG_BASE_URL}/${tag}/${RELEASE_CHANGELOG_PATH}`;\n}\n\nexport async function getLatestPiRelease(\n\tcurrentVersion: string,\n\toptions: { timeoutMs?: number; retry?: boolean } = {},\n): Promise<LatestPiRelease | undefined> {\n\tif (envValue(\"OFFLINE\")) return undefined;\n\n\tconst brand = brandProfile();\n\tconst channel = brand?.update;\n\tif (brand && !channel) {\n\t\t// The engine's own releases are not installable from inside a branded distribution, so\n\t\t// advertising them would send the user after an update they cannot apply.\n\t\treturn undefined;\n\t}\n\tconst response = await fetchWithRetry(\n\t\tlatestVersionUrl(channel),\n\t\t{\n\t\t\theaders: {\n\t\t\t\t\"User-Agent\": getPiUserAgent(currentVersion),\n\t\t\t\taccept: \"application/json\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tmaxRetries: options.retry ? 2 : 0,\n\t\t\ttimeoutMs: options.timeoutMs ?? DEFAULT_VERSION_CHECK_TIMEOUT_MS,\n\t\t},\n\t);\n\tif (!response.ok) return undefined;\n\n\tconst data = (await response.json()) as { packageName?: unknown; version?: unknown; note?: unknown };\n\tconst availableVersion = readAvailableVersion(data, channel);\n\tif (!availableVersion) {\n\t\treturn undefined;\n\t}\n\tif (channel) {\n\t\treturn { version: availableVersion, packageName: channel.packageName };\n\t}\n\tconst packageName =\n\t\ttypeof data.packageName === \"string\" && data.packageName.trim() ? data.packageName.trim() : undefined;\n\tconst note = typeof data.note === \"string\" && data.note.trim() ? data.note.trim() : undefined;\n\treturn { version: availableVersion, packageName, note };\n}\n\nexport async function getLatestPiVersion(\n\tcurrentVersion: string,\n\toptions: { timeoutMs?: number; retry?: boolean } = {},\n): Promise<string | undefined> {\n\treturn (await getLatestPiRelease(currentVersion, options))?.version;\n}\n\nexport async function checkForNewPiVersion(currentVersion: string): Promise<LatestPiRelease | undefined> {\n\tif (envValue(\"SKIP_VERSION_CHECK\")) return undefined;\n\n\ttry {\n\t\tconst latestRelease = await getLatestPiRelease(currentVersion);\n\t\tif (latestRelease && isNewerPackageVersion(latestRelease.version, currentVersion)) {\n\t\t\treturn latestRelease;\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"version-check.js","sourceRoot":"","sources":["../../src/utils/version-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAA2B,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AACvD,MAAM,kBAAkB,GAAG,GAAG,iBAAiB,IAAI,kBAAkB,CAAC,YAAY,CAAC,SAAS,CAAC;AAE7F,uFAAuF;AACvF,SAAS,gBAAgB,CAAC,OAAuC;IAChE,OAAO,OAAO;QACb,CAAC,CAAC,GAAG,iBAAiB,cAAc,kBAAkB,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY;QACvF,CAAC,CAAC,kBAAkB,CAAC;AACvB,CAAC;AAED,kFAA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ateChannel, brandProfile, envValue } from \"../core/brand.ts\";\nimport { fetchWithRetry } from \"./management-http.ts\";\nimport { getPiUserAgent } from \"./pi-user-agent.ts\";\n\nconst REGISTRY_BASE_URL = \"https://registry.npmjs.org\";\nconst LATEST_VERSION_URL = `${REGISTRY_BASE_URL}/${encodeURIComponent(PACKAGE_NAME)}/latest`;\n\n/** Registry endpoint answering \"what version does this product publish right now?\". */\nfunction latestVersionUrl(channel: BrandUpdateChannel | undefined): string {\n\treturn channel\n\t\t? `${REGISTRY_BASE_URL}/-/package/${encodeURIComponent(channel.packageName)}/dist-tags`\n\t\t: LATEST_VERSION_URL;\n}\n\n/** Reads the available version out of whichever registry document was fetched. */\nexport function readAvailableVersion(payload: unknown, channel: BrandUpdateChannel | undefined): string | undefined {\n\tif (typeof payload !== \"object\" || payload === null) return undefined;\n\tconst source = payload as Record<string, unknown>;\n\tconst raw = channel ? source[channel.distTag] : source.version;\n\treturn typeof raw === \"string\" && raw.trim() ? raw.trim() : undefined;\n}\nconst DEFAULT_VERSION_CHECK_TIMEOUT_MS = 10000;\nconst RELEASE_CHANGELOG_BASE_URL = \"https://github.com/code-yeongyu/senpi/blob\";\nconst RELEASE_CHANGELOG_PATH = \"packages/coding-agent/CHANGELOG.md\";\nconst SENPI_CALVER_PATTERN = /^(\\d{4})\\.(\\d{1,2})\\.(\\d{1,2})(?:-([2-9]\\d*))?$/;\n\nexport interface LatestPiRelease {\n\tversion: string;\n\tpackageName?: string;\n\tnote?: string;\n}\n\nfunction parseSenpiCalVer(version: string): readonly [number, number, number, number] | undefined {\n\tconst match = SENPI_CALVER_PATTERN.exec(version);\n\tif (!match) {\n\t\treturn undefined;\n\t}\n\treturn [Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4] ?? 1)];\n}\n/** Include useful errno details hidden behind Node's generic \"fetch failed\" error. */\nexport function formatVersionCheckError(error: unknown): string {\n\tconst rootMessage = error instanceof Error && error.message ? error.message : String(error);\n\tconst cause = error instanceof Error ? error.cause : undefined;\n\tconst causes = cause instanceof AggregateError ? cause.errors : cause === undefined ? [] : [cause];\n\tconst codes = causes\n\t\t.map((value) =>\n\t\t\ttypeof value === \"object\" && value !== null && \"code\" in value && typeof value.code === \"string\"\n\t\t\t\t? value.code\n\t\t\t\t: undefined,\n\t\t)\n\t\t.filter((code): code is string => code !== undefined);\n\n\tif (codes.length > 0) return `${rootMessage} (${[...new Set(codes)].join(\", \")})`;\n\tconst causeMessage = causes.find(\n\t\t(value): value is Error => value instanceof Error && Boolean(value.message),\n\t)?.message;\n\treturn causeMessage ? `${rootMessage} (cause: ${causeMessage})` : rootMessage;\n}\nexport function comparePackageVersions(leftVersion: string, rightVersion: string): number | undefined {\n\tconst leftTrimmed = leftVersion.trim();\n\tconst rightTrimmed = rightVersion.trim();\n\tconst leftCalVer = parseSenpiCalVer(leftTrimmed);\n\tconst rightCalVer = parseSenpiCalVer(rightTrimmed);\n\tif (leftCalVer && rightCalVer) {\n\t\tfor (let index = 0; index < leftCalVer.length; index++) {\n\t\t\tif (leftCalVer[index] !== rightCalVer[index]) {\n\t\t\t\treturn leftCalVer[index] < rightCalVer[index] ? -1 : 1;\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tconst left = valid(leftTrimmed);\n\tconst right = valid(rightTrimmed);\n\tif (!left || !right) {\n\t\treturn undefined;\n\t}\n\treturn compare(left, right);\n}\n\nexport function isNewerPackageVersion(candidateVersion: string, currentVersion: string): boolean {\n\tconst comparison = comparePackageVersions(candidateVersion, currentVersion);\n\t// Unparseable pairs (e.g. branded build labels) are never \"newer\": an update\n\t// we cannot order is not one we can advertise.\n\treturn comparison !== undefined && comparison > 0;\n}\n\nexport function getReleaseChangelogUrl(version: string): string {\n\tconst trimmedVersion = version.trim();\n\tconst channel = brandProfile()?.update;\n\tif (channel?.changelogUrl) {\n\t\treturn channel.changelogUrl.replace(\"{version}\", trimmedVersion);\n\t}\n\tconst tag = trimmedVersion.startsWith(\"v\") ? trimmedVersion : `v${trimmedVersion}`;\n\treturn `${RELEASE_CHANGELOG_BASE_URL}/${tag}/${RELEASE_CHANGELOG_PATH}`;\n}\n\nexport async function getLatestPiRelease(\n\tcurrentVersion: string,\n\toptions: { timeoutMs?: number; retry?: boolean } = {},\n): Promise<LatestPiRelease | undefined> {\n\tif (envValue(\"OFFLINE\")) return undefined;\n\n\tconst brand = brandProfile();\n\tconst channel = brand?.update;\n\tif (brand && !channel) {\n\t\t// The engine's own releases are not installable from inside a branded distribution, so\n\t\t// advertising them would send the user after an update they cannot apply.\n\t\treturn undefined;\n\t}\n\tconst response = await fetchWithRetry(\n\t\tlatestVersionUrl(channel),\n\t\t{\n\t\t\theaders: {\n\t\t\t\t\"User-Agent\": getPiUserAgent(currentVersion),\n\t\t\t\taccept: \"application/json\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tmaxRetries: options.retry ? 2 : 0,\n\t\t\ttimeoutMs: options.timeoutMs ?? DEFAULT_VERSION_CHECK_TIMEOUT_MS,\n\t\t},\n\t);\n\tif (!response.ok) return undefined;\n\n\tconst data = (await response.json()) as { packageName?: unknown; version?: unknown; note?: unknown };\n\tconst availableVersion = readAvailableVersion(data, channel);\n\tif (!availableVersion) {\n\t\treturn undefined;\n\t}\n\tif (channel) {\n\t\treturn { version: availableVersion, packageName: channel.packageName };\n\t}\n\tconst packageName =\n\t\ttypeof data.packageName === \"string\" && data.packageName.trim() ? data.packageName.trim() : undefined;\n\tconst note = typeof data.note === \"string\" && data.note.trim() ? data.note.trim() : undefined;\n\treturn { version: availableVersion, packageName, note };\n}\n\nexport async function getLatestPiVersion(\n\tcurrentVersion: string,\n\toptions: { timeoutMs?: number; retry?: boolean } = {},\n): Promise<string | undefined> {\n\treturn (await getLatestPiRelease(currentVersion, options))?.version;\n}\n\nexport async function checkForNewPiVersion(currentVersion: string): Promise<LatestPiRelease | undefined> {\n\tif (envValue(\"SKIP_VERSION_CHECK\")) return undefined;\n\n\ttry {\n\t\tconst latestRelease = await getLatestPiRelease(currentVersion);\n\t\tif (latestRelease && isNewerPackageVersion(latestRelease.version, currentVersion)) {\n\t\t\treturn latestRelease;\n\t\t}\n\t\treturn undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n"]}
|
package/docs/compaction.md
CHANGED
|
@@ -34,6 +34,8 @@ contextTokens > contextWindow - reserveTokens
|
|
|
34
34
|
|
|
35
35
|
By default, `reserveTokens` is 16384 tokens (configurable in `~/.senpi/agent/settings.json` or `<project-dir>/.senpi/settings.json`). This leaves room for the LLM's response.
|
|
36
36
|
|
|
37
|
+
During a multi-turn agent run, Pi checks this threshold after tools finish and their results are appended, before starting the next assistant response. If the threshold is crossed, Pi compacts inside the same agent run and resumes with the summary and retained messages. It skips this between-turn check when the completed tool batch terminates the run and no queued message requires another response. Pi also checks the threshold before a new user prompt and after a low-level agent run ends.
|
|
38
|
+
|
|
37
39
|
You can also trigger manually with `/compact [instructions]`, where optional instructions focus the summary.
|
|
38
40
|
|
|
39
41
|
### How It Works
|
|
@@ -87,6 +87,11 @@ These variables are read by Pi itself:
|
|
|
87
87
|
| `PI_CACHE_RETENTION` | Set to `long` to opt into extended provider prompt caching where supported; direct Anthropic defaults to 5 minutes |
|
|
88
88
|
| `PI_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
|
|
89
89
|
| `PI_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
|
|
90
|
+
| `PI_HYPERLINKS` | Override OSC 8 hyperlink detection with `1`, `0`, or `auto` |
|
|
91
|
+
| `PI_IMAGE_PROTOCOL` | Override inline image detection with `kitty`, `iterm2`, `none`, or `auto` |
|
|
92
|
+
| `PI_TRUE_COLOR` | Override truecolor detection with `1`, `0`, or `auto` |
|
|
93
|
+
|
|
94
|
+
`SENPI_HYPERLINKS`, `SENPI_IMAGE_PROTOCOL`, and `SENPI_TRUE_COLOR` are equivalent capability overrides for branded Senpi distributions. They take precedence over the legacy `PI_*` names when both are set; explicit settings in the terminal configuration take precedence over either environment variable. The image protocol accepts `kitty`, `iterm2`, `none`, or `auto`.
|
|
90
95
|
| `PI_TUI_ESC_TIMEOUT` | How long to wait after a lone ESC before treating it as Escape, in milliseconds; defaults to `100` over SSH and `10` otherwise. Increase if Alt-key input is misread as Escape |
|
|
91
96
|
| `SENPI_RECOVER_INSPECTOR_VM_IMPORT` | Set to `1` at process start to keep the TUI running when a Node Inspector (`node inspect` / `--inspect`) eval uses dynamic `import()`, which Node rejects with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`. Recovery applies only to that exact Inspector-originated rejection while an Inspector endpoint is active; all other uncaught errors remain fatal. Use `require()` or a target-side loader in Inspector evals instead |
|
|
92
97
|
| `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
|