@code-yeongyu/senpi 2026.8.30 → 2026.9.2
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 +174 -2
- package/README.md +3 -0
- package/dist/core/agent-session.d.ts +28 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +161 -14
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction-execution.d.ts +14 -0
- package/dist/core/compaction/compaction-execution.d.ts.map +1 -0
- package/dist/core/compaction/compaction-execution.js +121 -0
- package/dist/core/compaction/compaction-execution.js.map +1 -0
- package/dist/core/compaction/compaction-settings.d.ts +17 -0
- package/dist/core/compaction/compaction-settings.d.ts.map +1 -0
- package/dist/core/compaction/compaction-settings.js +17 -0
- package/dist/core/compaction/compaction-settings.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +13 -26
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +7 -136
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/ideal-compaction-settings.d.ts +9 -0
- package/dist/core/compaction/ideal-compaction-settings.d.ts.map +1 -0
- package/dist/core/compaction/ideal-compaction-settings.js +7 -0
- package/dist/core/compaction/ideal-compaction-settings.js.map +1 -0
- package/dist/core/compaction-settings-access.d.ts +19 -0
- package/dist/core/compaction-settings-access.d.ts.map +1 -0
- package/dist/core/compaction-settings-access.js +10 -0
- package/dist/core/compaction-settings-access.js.map +1 -0
- package/dist/core/compaction-settings-resolver.d.ts +22 -0
- package/dist/core/compaction-settings-resolver.d.ts.map +1 -0
- package/dist/core/compaction-settings-resolver.js +46 -0
- package/dist/core/compaction-settings-resolver.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +9 -1
- 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 +10 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts +24 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.js +43 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +8 -2
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts +17 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.js +64 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts +27 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.js +84 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/idle-retry.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/idle-retry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/idle-retry.js +1 -1
- package/dist/core/extensions/builtin/compaction/idle-retry.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/idle.d.ts +1 -0
- package/dist/core/extensions/builtin/compaction/idle.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/idle.js +13 -2
- package/dist/core/extensions/builtin/compaction/idle.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +152 -154
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.js +2 -0
- package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/model-selection.d.ts +14 -0
- package/dist/core/extensions/builtin/compaction/model-selection.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/model-selection.js +37 -0
- package/dist/core/extensions/builtin/compaction/model-selection.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts +30 -0
- package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/model-usability-budget.js +74 -0
- package/dist/core/extensions/builtin/compaction/model-usability-budget.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts +9 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js +2 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +3 -6
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/orchestration.d.ts +46 -0
- package/dist/core/extensions/builtin/compaction/orchestration.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/orchestration.js +103 -0
- package/dist/core/extensions/builtin/compaction/orchestration.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/policy.d.ts +12 -2
- package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/policy.js +52 -26
- package/dist/core/extensions/builtin/compaction/policy.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts +8 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.js +17 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.d.ts +22 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.js +16 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts +23 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.js +132 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +8 -13
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +21 -197
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts +24 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.js +25 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.d.ts +27 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.js +56 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.js.map +1 -0
- package/dist/core/extensions/builtin/hooks/trust-state-json.d.ts +5 -0
- package/dist/core/extensions/builtin/hooks/trust-state-json.d.ts.map +1 -0
- package/dist/core/extensions/builtin/hooks/trust-state-json.js +76 -0
- package/dist/core/extensions/builtin/hooks/trust-state-json.js.map +1 -0
- package/dist/core/extensions/builtin/hooks/trust-storage.d.ts +7 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js +60 -8
- package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust.d.ts +1 -2
- package/dist/core/extensions/builtin/hooks/trust.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust.js +1 -72
- package/dist/core/extensions/builtin/hooks/trust.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js +108 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-fable-5-1.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +11 -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/recommended-models/index.d.ts +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts +11 -0
- package/dist/core/extensions/builtin/terminal/runtime-session.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/runtime-session.js +18 -2
- package/dist/core/extensions/builtin/terminal/runtime-session.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/index.js +4 -0
- package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/manager.d.ts +2 -0
- package/dist/core/extensions/builtin/ttsr/manager.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/manager.js +28 -1
- package/dist/core/extensions/builtin/ttsr/manager.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 +7 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts +14 -0
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +33 -3
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/log.js +1 -1
- package/dist/core/retry-fallback/log.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +1 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -0
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-activity.d.ts +47 -0
- package/dist/core/session-activity.d.ts.map +1 -0
- package/dist/core/session-activity.js +58 -0
- package/dist/core/session-activity.js.map +1 -0
- package/dist/core/session-manager.d.ts +8 -12
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +118 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resident-store.d.ts +8 -1
- package/dist/core/session-resident-store.d.ts.map +1 -1
- package/dist/core/session-resident-store.js +12 -5
- package/dist/core/session-resident-store.js.map +1 -1
- package/dist/core/settings-manager.d.ts +8 -85
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +9 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-public-types.d.ts +11 -0
- package/dist/core/settings-public-types.d.ts.map +1 -0
- package/dist/core/settings-public-types.js +2 -0
- package/dist/core/settings-public-types.js.map +1 -0
- package/dist/core/settings-shapes.d.ts +36 -0
- package/dist/core/settings-shapes.d.ts.map +1 -0
- package/dist/core/settings-shapes.js +2 -0
- package/dist/core/settings-shapes.js.map +1 -0
- package/dist/core/shared-host-policy.d.ts +6 -0
- package/dist/core/shared-host-policy.d.ts.map +1 -0
- package/dist/core/shared-host-policy.js +7 -0
- package/dist/core/shared-host-policy.js.map +1 -0
- package/dist/core/terminal-settings.d.ts +22 -0
- package/dist/core/terminal-settings.d.ts.map +1 -0
- package/dist/core/terminal-settings.js +2 -0
- package/dist/core/terminal-settings.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +4 -4
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +27 -11
- package/dist/main.js.map +1 -1
- package/dist/modes/app-server/daemon/process.d.ts +13 -2
- package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
- package/dist/modes/app-server/daemon/process.js +58 -12
- package/dist/modes/app-server/daemon/process.js.map +1 -1
- package/dist/modes/app-server/daemon.js +65 -7
- package/dist/modes/app-server/daemon.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts +84 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.js +435 -112
- package/dist/modes/interactive/interactive-host-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +11 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +59 -6
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tips/catalog/ethos-tips.js +1 -1
- package/dist/modes/interactive/tips/catalog/ethos-tips.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +12 -5
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +180 -25
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +2 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +2 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/host-ensure.d.ts +17 -0
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +150 -23
- package/dist/modes/rpc/host-ensure.js.map +1 -1
- package/dist/modes/rpc/host-lifecycle.d.ts +54 -0
- package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
- package/dist/modes/rpc/host-lifecycle.js +259 -69
- package/dist/modes/rpc/host-lifecycle.js.map +1 -1
- package/dist/modes/rpc/host-watchdog.d.ts +2 -2
- package/dist/modes/rpc/host-watchdog.d.ts.map +1 -1
- package/dist/modes/rpc/host-watchdog.js +89 -21
- package/dist/modes/rpc/host-watchdog.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.d.ts +38 -0
- package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +149 -61
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/ownership-safe-lock.d.ts +14 -0
- package/dist/modes/rpc/ownership-safe-lock.d.ts.map +1 -0
- package/dist/modes/rpc/ownership-safe-lock.js +87 -0
- package/dist/modes/rpc/ownership-safe-lock.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +13 -2
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +46 -12
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +21 -3
- 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-binding.d.ts +2 -1
- package/dist/modes/rpc/session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/session-binding.js +1 -0
- package/dist/modes/rpc/session-binding.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts +54 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +180 -3
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +18 -0
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +88 -8
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +11 -1
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js +25 -0
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/socket-transport.d.ts +13 -0
- package/dist/modes/rpc/socket-transport.d.ts.map +1 -0
- package/dist/modes/rpc/socket-transport.js +92 -0
- package/dist/modes/rpc/socket-transport.js.map +1 -0
- package/dist/modes/rpc/widget-line-renderer.d.ts +17 -0
- package/dist/modes/rpc/widget-line-renderer.d.ts.map +1 -0
- package/dist/modes/rpc/widget-line-renderer.js +73 -0
- package/dist/modes/rpc/widget-line-renderer.js.map +1 -0
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js +11 -2
- package/dist/utils/fs-watch.js.map +1 -1
- package/docs/app-server.md +2 -2
- package/docs/containerization.md +2 -2
- package/docs/development.md +7 -7
- package/docs/extensions.md +5 -5
- package/docs/grok-neo.md +1 -1
- package/docs/index.md +1 -1
- package/docs/packages.md +2 -2
- package/docs/quickstart.md +4 -4
- package/docs/release-guide.md +21 -21
- package/docs/rpc.md +83 -6
- package/docs/sdk.md +1 -1
- package/docs/settings.md +4 -4
- package/docs/skills.md +2 -2
- package/docs/terminal-tools.md +1 -1
- package/docs/termux.md +1 -1
- package/docs/tui.md +1 -1
- package/examples/AGENTS.md +1 -1
- package/examples/sdk/README.md +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +52 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/skill-contribution.ts +71 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +3 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/SKILL.md +44 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/breaking-changes.md +75 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/build.md +114 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/dev-tooling.md +34 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/http-networking.md +113 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/install.md +93 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/node-compat-platforms.md +36 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/performance.md +33 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/runtime-apis.md +156 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/security.md +52 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/test.md +103 -0
- package/node_modules/@earendil-works/pi-agent-core/README.md +3 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/README.md +6 -3
- 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 +24 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +7 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +316 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.d.ts +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.js +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-conversation-rotation.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +24 -0
- 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 +20 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.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/google.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.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/opengateway.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/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/dist/screen-operations.d.ts +42 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-operations.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-operations.js +34 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-operations.js.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-text.d.ts +8 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-text.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-text.js +51 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen-text.js.map +1 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen.d.ts +45 -0
- package/node_modules/@earendil-works/pi-pty/dist/screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-pty/dist/screen.js +178 -55
- package/node_modules/@earendil-works/pi-pty/dist/screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/README.md +6 -3
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +5 -4
- package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +2 -2
- package/node_modules/@earendil-works/pi-tui/native/win32/README.md +2 -2
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-activity.js","sourceRoot":"","sources":["../../src/core/session-activity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,6EAA6E;AAC7E,MAAM,OAAO,iBAAiB;IAA9B;QACkB,WAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAwBrD,CAAC;IAtBA;;;OAGG;IACH,OAAO,CAAC,IAAa;QACpB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO;QACtD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAmD,CAAC;QACpF,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAC9D,IAAI,OAAO,WAAW,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO;QAC7E,IAAI,WAAW,GAAG,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;;YACrD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,gEAAgE;IAChE,IAAI,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,oDAAoD;IACpD,IAAI,aAAa;QAChB,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;CACD;AAgBD,qDAAqD;AACrD,MAAM,UAAU,qBAAqB,CAAC,QAAiC;IACtE,OAAO,CACN,QAAQ,CAAC,WAAW;QACpB,QAAQ,CAAC,aAAa;QACtB,QAAQ,CAAC,YAAY;QACrB,QAAQ,CAAC,cAAc;QACvB,QAAQ,CAAC,mBAAmB,CAC5B,CAAC;AACH,CAAC","sourcesContent":["/**\n * The session activity contract every occupancy decision shares.\n *\n * \"Busy\" means work the session OWNS that must outlive an idle-eviction\n * decision - not merely a streaming turn. There are exactly two registration\n * points for a new activity source:\n *\n * - in-session work reports a field on `SessionActivitySnapshot` (agent run,\n * bash, compaction, the session-work barrier);\n * - work owned by an extension publishes a `wake_source_state` event with a\n * non-zero `activeCount` (background terminal jobs, terminal monitors,\n * loop-guard holds), which `WakeSourceTracker` folds into the same predicate.\n *\n * Callers (the shared RPC host's occupancy sweep, and anything else deciding\n * whether a session may be torn down) MUST consult `isSessionBusySnapshot()` /\n * `AgentSession.isSessionBusy` instead of testing individual flags, so a source\n * added later cannot be silently missed by one call site.\n */\n\n/** Live counts of extension-published wake sources, keyed by source name. */\nexport class WakeSourceTracker {\n\tprivate readonly counts = new Map<string, number>();\n\n\t/**\n\t * Folds one `wake_source_state` payload in. Unknown shapes are ignored: a\n\t * malformed publisher must never flip a session to \"idle\" by accident.\n\t */\n\tobserve(data: unknown): void {\n\t\tif (typeof data !== \"object\" || data === null) return;\n\t\tconst { source, activeCount } = data as { source?: unknown; activeCount?: unknown };\n\t\tif (typeof source !== \"string\" || source.length === 0) return;\n\t\tif (typeof activeCount !== \"number\" || !Number.isFinite(activeCount)) return;\n\t\tif (activeCount > 0) this.counts.set(source, activeCount);\n\t\telse this.counts.delete(source);\n\t}\n\n\t/** Whether any published source currently reports live work. */\n\tget hasActive(): boolean {\n\t\treturn this.counts.size > 0;\n\t}\n\n\t/** Sources reporting live work, for diagnostics. */\n\tget activeSources(): readonly string[] {\n\t\treturn [...this.counts.keys()];\n\t}\n}\n\n/** In-session activity signals. Every field means \"work that must not be evicted\". */\nexport interface SessionActivitySnapshot {\n\t/** An agent run or post-run continuation is active. */\n\treadonly isStreaming: boolean;\n\t/** A bash command owned by this session is running. */\n\treadonly isBashRunning: boolean;\n\t/** Compaction or branch summarization is running. */\n\treadonly isCompacting: boolean;\n\t/** The session-work barrier holds deferred work (queued continuations, rebinds). */\n\treadonly hasSessionWork: boolean;\n\t/** An extension-published wake source reports live work. */\n\treadonly hasActiveWakeSource: boolean;\n}\n\n/** The complete session-owned activity predicate. */\nexport function isSessionBusySnapshot(snapshot: SessionActivitySnapshot): boolean {\n\treturn (\n\t\tsnapshot.isStreaming ||\n\t\tsnapshot.isBashRunning ||\n\t\tsnapshot.isCompacting ||\n\t\tsnapshot.hasSessionWork ||\n\t\tsnapshot.hasActiveWakeSource\n\t);\n}\n"]}
|
|
@@ -192,17 +192,8 @@ export declare function getDefaultSessionDir(cwd: string, agentDir?: string): st
|
|
|
192
192
|
export declare function loadEntriesFromFile(filePath: string): FileEntry[];
|
|
193
193
|
/** Exported for testing */
|
|
194
194
|
export declare function findMostRecentSession(sessionDir: string, cwd?: string): string | null;
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
*
|
|
198
|
-
* Each session entry has an id and parentId forming a tree structure. The "leaf"
|
|
199
|
-
* pointer tracks the current position. Appending creates a child of the current leaf.
|
|
200
|
-
* Branching moves the leaf to an earlier entry, allowing new branches without
|
|
201
|
-
* modifying history.
|
|
202
|
-
*
|
|
203
|
-
* Use buildSessionContext() to get the resolved message list for the LLM, which
|
|
204
|
-
* handles compaction summaries and follows the path from root to current leaf.
|
|
205
|
-
*/
|
|
195
|
+
/** Test seam for observing disk reloads without mocking ESM filesystem exports. */
|
|
196
|
+
export declare function setSessionEntryLoaderForTesting(loader: typeof loadEntriesFromFile): () => void;
|
|
206
197
|
export declare class SessionManager {
|
|
207
198
|
private sessionId;
|
|
208
199
|
private sessionFile;
|
|
@@ -218,6 +209,8 @@ export declare class SessionManager {
|
|
|
218
209
|
private labelTimestampsById;
|
|
219
210
|
private leafId;
|
|
220
211
|
private residentStore;
|
|
212
|
+
private mirrorTrimmed;
|
|
213
|
+
private compactEntriesCache;
|
|
221
214
|
private mutationCount;
|
|
222
215
|
private entriesCache;
|
|
223
216
|
private branchCache;
|
|
@@ -279,7 +272,8 @@ export declare class SessionManager {
|
|
|
279
272
|
appendModelChange(provider: string, modelId: string, reason?: "fallback" | "fallback-revert", originalProvider?: string, originalModelId?: string): string;
|
|
280
273
|
/** Append a compaction summary as child of current leaf, then advance leaf. Returns entry id. */
|
|
281
274
|
appendCompaction<T = unknown>(summary: string, firstKeptEntryId: string, tokensBefore: number, details?: T, fromHook?: boolean, usage?: Usage): string;
|
|
282
|
-
|
|
275
|
+
private _trimMirrorAfterCompaction;
|
|
276
|
+
/** Append a custom entry (for extensions) as child of current leaf, then advance leaf. */
|
|
283
277
|
appendCustomEntry(customType: string, data?: unknown): string;
|
|
284
278
|
/** Append a session info entry (e.g., display name). Returns entry id. */
|
|
285
279
|
appendSessionInfo(name: string): string;
|
|
@@ -349,6 +343,8 @@ export declare class SessionManager {
|
|
|
349
343
|
* you need to filter/reorder.
|
|
350
344
|
*/
|
|
351
345
|
getEntries(): SessionEntry[];
|
|
346
|
+
private _getCompactEntries;
|
|
347
|
+
private _loadFullHistoryEntries;
|
|
352
348
|
/**
|
|
353
349
|
* Get the session as a tree structure. Returns a shallow defensive copy of all entries.
|
|
354
350
|
* A well-formed session has exactly one root (first entry with parentId === null).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/core/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAkB1G,OAAO,EAAyC,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,6BAA6B,CAAC;AAE3F,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAuBlE,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAIlB,MAAM,eAAe,CAAC;AAIvB,8FAA8F;AAC9F,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAOpE,6EAA6E;AAC7E,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAElF;AAED,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC;AAED,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EA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EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,cAAc;IAK5F;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,cAAc;IAsBpF;;;;OAIG;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,cAAc;IAUvE,wDAAwD;IACxD,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAE,MAAsB,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,cAAc;IAIzF;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CACd,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,iBAAiB,GACzB,cAAc;IAgDjB;;;;;OAKG;WACU,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAW7G;;;OAGG;WACU,OAAO,CAAC,UAAU,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;WACjE,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAmDnG"}
|
|
@@ -497,6 +497,15 @@ export function findMostRecentSession(sessionDir, cwd) {
|
|
|
497
497
|
* Use buildSessionContext() to get the resolved message list for the LLM, which
|
|
498
498
|
* handles compaction summaries and follows the path from root to current leaf.
|
|
499
499
|
*/
|
|
500
|
+
let sessionEntryLoader = loadEntriesFromFile;
|
|
501
|
+
/** Test seam for observing disk reloads without mocking ESM filesystem exports. */
|
|
502
|
+
export function setSessionEntryLoaderForTesting(loader) {
|
|
503
|
+
const previous = sessionEntryLoader;
|
|
504
|
+
sessionEntryLoader = loader;
|
|
505
|
+
return () => {
|
|
506
|
+
sessionEntryLoader = previous;
|
|
507
|
+
};
|
|
508
|
+
}
|
|
500
509
|
export class SessionManager {
|
|
501
510
|
constructor(cwd, sessionDir, sessionFile, persist, newSessionOptions, preloadedFileEntries) {
|
|
502
511
|
this.sessionId = "";
|
|
@@ -513,6 +522,8 @@ export class SessionManager {
|
|
|
513
522
|
this.labelTimestampsById = new Map();
|
|
514
523
|
this.leafId = null;
|
|
515
524
|
this.residentStore = new ResidentStringStore();
|
|
525
|
+
this.mirrorTrimmed = false;
|
|
526
|
+
this.compactEntriesCache = null;
|
|
516
527
|
// Monotonic counter bumped by every mutator; memoized materialized views are
|
|
517
528
|
// keyed on it so read hot paths (footer, RPC) never re-materialize unchanged sessions.
|
|
518
529
|
this.mutationCount = 0;
|
|
@@ -567,6 +578,7 @@ export class SessionManager {
|
|
|
567
578
|
}
|
|
568
579
|
_setSessionFile(sessionFile, preloadedFileEntries) {
|
|
569
580
|
this.sessionFile = resolvePath(sessionFile);
|
|
581
|
+
this.mirrorTrimmed = false;
|
|
570
582
|
this.residentStore.clear();
|
|
571
583
|
if (existsSync(this.sessionFile)) {
|
|
572
584
|
this.fileEntries = preloadedFileEntries ?? loadEntriesFromFile(this.sessionFile);
|
|
@@ -614,6 +626,7 @@ export class SessionManager {
|
|
|
614
626
|
parentSession: options?.parentSession,
|
|
615
627
|
};
|
|
616
628
|
this.fileEntries = [header];
|
|
629
|
+
this.mirrorTrimmed = false;
|
|
617
630
|
this.residentStore.clear();
|
|
618
631
|
this.byId.clear();
|
|
619
632
|
this.entryOrdersById.clear();
|
|
@@ -776,7 +789,18 @@ export class SessionManager {
|
|
|
776
789
|
}
|
|
777
790
|
}
|
|
778
791
|
_materializeEntry(entry) {
|
|
779
|
-
|
|
792
|
+
let missingResidentString = false;
|
|
793
|
+
const materialized = this.residentStore.materialize(entry, () => {
|
|
794
|
+
missingResidentString = true;
|
|
795
|
+
return undefined;
|
|
796
|
+
});
|
|
797
|
+
// The resident store is a bounded cache. The JSONL remains authoritative
|
|
798
|
+
// when an evicted blob is needed by a branch or read operation.
|
|
799
|
+
if (missingResidentString && this.sessionFile) {
|
|
800
|
+
const persisted = loadEntriesFromFile(this.sessionFile).find((candidate) => candidate.id === entry.id);
|
|
801
|
+
if (persisted)
|
|
802
|
+
return persisted;
|
|
803
|
+
}
|
|
780
804
|
if (materialized.type === "message") {
|
|
781
805
|
const order = this.entryOrdersById.get(materialized.id);
|
|
782
806
|
if (order !== undefined) {
|
|
@@ -886,9 +910,36 @@ export class SessionManager {
|
|
|
886
910
|
fromHook,
|
|
887
911
|
};
|
|
888
912
|
this._appendEntry(entry);
|
|
913
|
+
this._trimMirrorAfterCompaction(entry);
|
|
889
914
|
return entry.id;
|
|
890
915
|
}
|
|
891
|
-
|
|
916
|
+
_trimMirrorAfterCompaction(compaction) {
|
|
917
|
+
if (!this.persist)
|
|
918
|
+
return;
|
|
919
|
+
const firstKeptIndex = this.fileEntries.findIndex((entry) => entry.id === compaction.firstKeptEntryId);
|
|
920
|
+
const compactionIndex = this.fileEntries.findIndex((entry) => entry.id === compaction.id);
|
|
921
|
+
if (firstKeptIndex < 0 || compactionIndex < firstKeptIndex)
|
|
922
|
+
return;
|
|
923
|
+
const header = this.fileEntries.find((entry) => entry.type === "session");
|
|
924
|
+
const retained = [
|
|
925
|
+
...this.fileEntries.slice(0, firstKeptIndex).filter((entry) => entry.type !== "message"),
|
|
926
|
+
...this.fileEntries.slice(firstKeptIndex, compactionIndex + 1),
|
|
927
|
+
];
|
|
928
|
+
let parentId = null;
|
|
929
|
+
for (const entry of retained) {
|
|
930
|
+
if (entry.type !== "session")
|
|
931
|
+
entry.parentId = parentId;
|
|
932
|
+
parentId = entry.type === "session" ? null : entry.id;
|
|
933
|
+
}
|
|
934
|
+
this.residentStore.clear();
|
|
935
|
+
this.mirrorTrimmed = true;
|
|
936
|
+
this.fileEntries = [header, ...retained]
|
|
937
|
+
.filter((entry) => entry !== undefined)
|
|
938
|
+
.map((entry) => this.residentStore.externalize(entry));
|
|
939
|
+
this._buildIndex();
|
|
940
|
+
this.mutationCount++;
|
|
941
|
+
}
|
|
942
|
+
/** Append a custom entry (for extensions) as child of current leaf, then advance leaf. */
|
|
892
943
|
appendCustomEntry(customType, data) {
|
|
893
944
|
const entry = {
|
|
894
945
|
type: "custom",
|
|
@@ -956,7 +1007,13 @@ export class SessionManager {
|
|
|
956
1007
|
}
|
|
957
1008
|
getEntry(id) {
|
|
958
1009
|
const entry = this.byId.get(id);
|
|
959
|
-
|
|
1010
|
+
if (entry)
|
|
1011
|
+
return this._materializeEntry(entry);
|
|
1012
|
+
if (this.mirrorTrimmed && this.sessionFile) {
|
|
1013
|
+
const persisted = this._loadFullHistoryEntries().find((candidate) => candidate.id === id);
|
|
1014
|
+
return persisted ? this.residentStore.materialize(persisted) : undefined;
|
|
1015
|
+
}
|
|
1016
|
+
return undefined;
|
|
960
1017
|
}
|
|
961
1018
|
/**
|
|
962
1019
|
* Get all direct children of an entry.
|
|
@@ -1020,10 +1077,16 @@ export class SessionManager {
|
|
|
1020
1077
|
}
|
|
1021
1078
|
const path = [];
|
|
1022
1079
|
const startId = fromId ?? this.leafId;
|
|
1023
|
-
let
|
|
1080
|
+
let entriesById = this.byId;
|
|
1081
|
+
if (fromId !== undefined && !entriesById.has(fromId) && this.mirrorTrimmed && this.sessionFile) {
|
|
1082
|
+
entriesById = new Map(this._loadFullHistoryEntries()
|
|
1083
|
+
.filter((entry) => entry.type !== "session")
|
|
1084
|
+
.map((entry) => [entry.id, this.residentStore.materialize(entry)]));
|
|
1085
|
+
}
|
|
1086
|
+
let current = startId ? entriesById.get(startId) : undefined;
|
|
1024
1087
|
while (current) {
|
|
1025
1088
|
path.unshift(this._materializeEntry(current));
|
|
1026
|
-
current = current.parentId ?
|
|
1089
|
+
current = current.parentId ? entriesById.get(current.parentId) : undefined;
|
|
1027
1090
|
}
|
|
1028
1091
|
if (fromId === undefined) {
|
|
1029
1092
|
this.branchCache = { leafId: this.leafId, mutation: this.mutationCount, entries: path };
|
|
@@ -1035,14 +1098,14 @@ export class SessionManager {
|
|
|
1035
1098
|
* Uses tree traversal from current leaf.
|
|
1036
1099
|
*/
|
|
1037
1100
|
buildContextEntries() {
|
|
1038
|
-
return buildContextEntries(this.
|
|
1101
|
+
return buildContextEntries(this._getCompactEntries(), this.leafId);
|
|
1039
1102
|
}
|
|
1040
1103
|
/**
|
|
1041
1104
|
* Build the session context (what gets sent to the LLM).
|
|
1042
1105
|
* Uses tree traversal from current leaf.
|
|
1043
1106
|
*/
|
|
1044
1107
|
buildSessionContext() {
|
|
1045
|
-
return buildSessionContext(this.
|
|
1108
|
+
return buildSessionContext(this._getCompactEntries(), this.leafId);
|
|
1046
1109
|
}
|
|
1047
1110
|
hasContextMessages() {
|
|
1048
1111
|
return this.hasBranchEntry((entry) => entry.type === "message" ||
|
|
@@ -1088,6 +1151,11 @@ export class SessionManager {
|
|
|
1088
1151
|
* you need to filter/reorder.
|
|
1089
1152
|
*/
|
|
1090
1153
|
getEntries() {
|
|
1154
|
+
if (this.mirrorTrimmed && this.sessionFile) {
|
|
1155
|
+
return this._loadFullHistoryEntries()
|
|
1156
|
+
.filter((e) => e.type !== "session")
|
|
1157
|
+
.map((entry) => this.residentStore.materialize(entry));
|
|
1158
|
+
}
|
|
1091
1159
|
if (this.entriesCache !== null && this.entriesCache.mutation === this.mutationCount) {
|
|
1092
1160
|
return this.entriesCache.entries;
|
|
1093
1161
|
}
|
|
@@ -1097,6 +1165,45 @@ export class SessionManager {
|
|
|
1097
1165
|
this.entriesCache = { mutation: this.mutationCount, entries };
|
|
1098
1166
|
return entries;
|
|
1099
1167
|
}
|
|
1168
|
+
_getCompactEntries() {
|
|
1169
|
+
if (this.compactEntriesCache?.mutation !== this.mutationCount) {
|
|
1170
|
+
this.compactEntriesCache = {
|
|
1171
|
+
mutation: this.mutationCount,
|
|
1172
|
+
entries: this.fileEntries.filter((e) => e.type !== "session"),
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
const entries = this.compactEntriesCache.entries;
|
|
1176
|
+
const missingEntryIds = new Set();
|
|
1177
|
+
for (const entry of entries) {
|
|
1178
|
+
this.residentStore.materialize(entry, () => {
|
|
1179
|
+
missingEntryIds.add(entry.id);
|
|
1180
|
+
return undefined;
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
if (missingEntryIds.size > 0 && this.sessionFile) {
|
|
1184
|
+
const persistedById = new Map(this._loadFullHistoryEntries().map((entry) => [entry.id, entry]));
|
|
1185
|
+
for (let index = 0; index < entries.length; index++) {
|
|
1186
|
+
const entry = entries[index];
|
|
1187
|
+
if (!missingEntryIds.has(entry.id))
|
|
1188
|
+
continue;
|
|
1189
|
+
const persisted = persistedById.get(entry.id);
|
|
1190
|
+
if (persisted)
|
|
1191
|
+
entries[index] = this.residentStore.externalize(persisted);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
const materialized = entries.map((entry) => this.residentStore.materialize(entry));
|
|
1195
|
+
for (const entry of materialized) {
|
|
1196
|
+
if (entry.type !== "message")
|
|
1197
|
+
continue;
|
|
1198
|
+
const order = this.entryOrdersById.get(entry.id);
|
|
1199
|
+
if (order !== undefined)
|
|
1200
|
+
this.messageEntryPositions.set(entry.message, { entryId: entry.id, order });
|
|
1201
|
+
}
|
|
1202
|
+
return materialized;
|
|
1203
|
+
}
|
|
1204
|
+
_loadFullHistoryEntries() {
|
|
1205
|
+
return this.sessionFile ? sessionEntryLoader(this.sessionFile) : this.fileEntries;
|
|
1206
|
+
}
|
|
1100
1207
|
/**
|
|
1101
1208
|
* Get the session as a tree structure. Returns a shallow defensive copy of all entries.
|
|
1102
1209
|
* A well-formed session has exactly one root (first entry with parentId === null).
|
|
@@ -1149,6 +1256,9 @@ export class SessionManager {
|
|
|
1149
1256
|
* are not modified or deleted.
|
|
1150
1257
|
*/
|
|
1151
1258
|
branch(branchFromId) {
|
|
1259
|
+
if (!this.byId.has(branchFromId) && this.sessionFile) {
|
|
1260
|
+
this.reloadFromDisk();
|
|
1261
|
+
}
|
|
1152
1262
|
if (!this.byId.has(branchFromId)) {
|
|
1153
1263
|
throw new Error(`Entry ${branchFromId} not found`);
|
|
1154
1264
|
}
|
|
@@ -1250,6 +1360,7 @@ export class SessionManager {
|
|
|
1250
1360
|
parentId = labelEntry.id;
|
|
1251
1361
|
}
|
|
1252
1362
|
this.residentStore.clear();
|
|
1363
|
+
this.mirrorTrimmed = false;
|
|
1253
1364
|
this.fileEntries = [header, ...pathWithoutLabels, ...labelEntries].map((entry) => this.residentStore.externalize(entry));
|
|
1254
1365
|
this.sessionId = newSessionId;
|
|
1255
1366
|
this.sessionFile = newSessionFile;
|