@code-yeongyu/senpi 0.74.0
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 +4225 -0
- package/README.md +654 -0
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +9 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +53 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +342 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +83 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +20 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +92 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +399 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +117 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +300 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +93 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +118 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +643 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +2702 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +141 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +441 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +93 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +285 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +129 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +635 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +38 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +165 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/dynamic-prompt/build.d.ts +15 -0
- package/dist/core/dynamic-prompt/build.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/build.js +61 -0
- package/dist/core/dynamic-prompt/build.js.map +1 -0
- package/dist/core/dynamic-prompt/exploration.d.ts +2 -0
- package/dist/core/dynamic-prompt/exploration.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/exploration.js +8 -0
- package/dist/core/dynamic-prompt/exploration.js.map +1 -0
- package/dist/core/dynamic-prompt/identity.d.ts +2 -0
- package/dist/core/dynamic-prompt/identity.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/identity.js +4 -0
- package/dist/core/dynamic-prompt/identity.js.map +1 -0
- package/dist/core/dynamic-prompt/index.d.ts +13 -0
- package/dist/core/dynamic-prompt/index.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/index.js +11 -0
- package/dist/core/dynamic-prompt/index.js.map +1 -0
- package/dist/core/dynamic-prompt/intent-gate.d.ts +5 -0
- package/dist/core/dynamic-prompt/intent-gate.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/intent-gate.js +57 -0
- package/dist/core/dynamic-prompt/intent-gate.js.map +1 -0
- package/dist/core/dynamic-prompt/parallel-tools.d.ts +2 -0
- package/dist/core/dynamic-prompt/parallel-tools.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/parallel-tools.js +10 -0
- package/dist/core/dynamic-prompt/parallel-tools.js.map +1 -0
- package/dist/core/dynamic-prompt/policies.d.ts +2 -0
- package/dist/core/dynamic-prompt/policies.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/policies.js +14 -0
- package/dist/core/dynamic-prompt/policies.js.map +1 -0
- package/dist/core/dynamic-prompt/style.d.ts +2 -0
- package/dist/core/dynamic-prompt/style.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/style.js +10 -0
- package/dist/core/dynamic-prompt/style.js.map +1 -0
- package/dist/core/dynamic-prompt/tool-categorization.d.ts +4 -0
- package/dist/core/dynamic-prompt/tool-categorization.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/tool-categorization.js +26 -0
- package/dist/core/dynamic-prompt/tool-categorization.js.map +1 -0
- package/dist/core/dynamic-prompt/tool-section.d.ts +7 -0
- package/dist/core/dynamic-prompt/tool-section.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/tool-section.js +46 -0
- package/dist/core/dynamic-prompt/tool-section.js.map +1 -0
- package/dist/core/dynamic-prompt/types.d.ts +5 -0
- package/dist/core/dynamic-prompt/types.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/types.js +2 -0
- package/dist/core/dynamic-prompt/types.js.map +1 -0
- package/dist/core/dynamic-prompt/verification.d.ts +2 -0
- package/dist/core/dynamic-prompt/verification.d.ts.map +1 -0
- package/dist/core/dynamic-prompt/verification.js +12 -0
- package/dist/core/dynamic-prompt/verification.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +224 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/agent-types.d.ts +25 -0
- package/dist/core/extensions/builtin/agent-system/agent-types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/agent-types.js +38 -0
- package/dist/core/extensions/builtin/agent-system/agent-types.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/builtin-agents.d.ts +3 -0
- package/dist/core/extensions/builtin/agent-system/builtin-agents.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/builtin-agents.js +32 -0
- package/dist/core/extensions/builtin/agent-system/builtin-agents.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/index.d.ts +3 -0
- package/dist/core/extensions/builtin/agent-system/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/index.js +42 -0
- package/dist/core/extensions/builtin/agent-system/index.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/loader.d.ts +4 -0
- package/dist/core/extensions/builtin/agent-system/loader.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/loader.js +59 -0
- package/dist/core/extensions/builtin/agent-system/loader.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/permission.d.ts +11 -0
- package/dist/core/extensions/builtin/agent-system/permission.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/permission.js +24 -0
- package/dist/core/extensions/builtin/agent-system/permission.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/registry.d.ts +10 -0
- package/dist/core/extensions/builtin/agent-system/registry.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/registry.js +50 -0
- package/dist/core/extensions/builtin/agent-system/registry.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/types.d.ts +9 -0
- package/dist/core/extensions/builtin/agent-system/types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/types.js +2 -0
- package/dist/core/extensions/builtin/agent-system/types.js.map +1 -0
- package/dist/core/extensions/builtin/agent-system/wildcard.d.ts +4 -0
- package/dist/core/extensions/builtin/agent-system/wildcard.d.ts.map +1 -0
- package/dist/core/extensions/builtin/agent-system/wildcard.js +58 -0
- package/dist/core/extensions/builtin/agent-system/wildcard.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-bash/index.d.ts +7 -0
- package/dist/core/extensions/builtin/anthropic-bash/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-bash/index.js +79 -0
- package/dist/core/extensions/builtin/anthropic-bash/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-code-execution/index.d.ts +7 -0
- package/dist/core/extensions/builtin/anthropic-code-execution/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-code-execution/index.js +79 -0
- package/dist/core/extensions/builtin/anthropic-code-execution/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-computer-use/index.d.ts +53 -0
- package/dist/core/extensions/builtin/anthropic-computer-use/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-computer-use/index.js +676 -0
- package/dist/core/extensions/builtin/anthropic-computer-use/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-text-editor/index.d.ts +25 -0
- package/dist/core/extensions/builtin/anthropic-text-editor/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-text-editor/index.js +244 -0
- package/dist/core/extensions/builtin/anthropic-text-editor/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-tool-search/index.d.ts +6 -0
- package/dist/core/extensions/builtin/anthropic-tool-search/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-tool-search/index.js +112 -0
- package/dist/core/extensions/builtin/anthropic-tool-search/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-fetch/index.d.ts +7 -0
- package/dist/core/extensions/builtin/anthropic-web-fetch/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-fetch/index.js +112 -0
- package/dist/core/extensions/builtin/anthropic-web-fetch/index.js.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts +7 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.js +102 -0
- package/dist/core/extensions/builtin/anthropic-web-search/index.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/cancel-tool.d.ts +10 -0
- package/dist/core/extensions/builtin/background-task/cancel-tool.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/cancel-tool.js +109 -0
- package/dist/core/extensions/builtin/background-task/cancel-tool.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/index.d.ts +3 -0
- package/dist/core/extensions/builtin/background-task/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/index.js +207 -0
- package/dist/core/extensions/builtin/background-task/index.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/manager.d.ts +17 -0
- package/dist/core/extensions/builtin/background-task/manager.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/manager.js +114 -0
- package/dist/core/extensions/builtin/background-task/manager.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/notification.d.ts +22 -0
- package/dist/core/extensions/builtin/background-task/notification.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/notification.js +105 -0
- package/dist/core/extensions/builtin/background-task/notification.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/output-tool.d.ts +11 -0
- package/dist/core/extensions/builtin/background-task/output-tool.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/output-tool.js +127 -0
- package/dist/core/extensions/builtin/background-task/output-tool.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/spawner.d.ts +8 -0
- package/dist/core/extensions/builtin/background-task/spawner.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/spawner.js +207 -0
- package/dist/core/extensions/builtin/background-task/spawner.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/task-tool.d.ts +20 -0
- package/dist/core/extensions/builtin/background-task/task-tool.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/task-tool.js +302 -0
- package/dist/core/extensions/builtin/background-task/task-tool.js.map +1 -0
- package/dist/core/extensions/builtin/background-task/types.d.ts +72 -0
- package/dist/core/extensions/builtin/background-task/types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/background-task/types.js +32 -0
- package/dist/core/extensions/builtin/background-task/types.js.map +1 -0
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts +5 -0
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/bash-timeout/index.js +20 -0
- package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -0
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +17 -0
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -0
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +28 -0
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts +46 -0
- package/dist/core/extensions/builtin/compaction/checkpoint-state.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/checkpoint-state.js +131 -0
- package/dist/core/extensions/builtin/compaction/checkpoint-state.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/circuit-breaker.d.ts +23 -0
- package/dist/core/extensions/builtin/compaction/circuit-breaker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/circuit-breaker.js +36 -0
- package/dist/core/extensions/builtin/compaction/circuit-breaker.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/degradation-monitor.d.ts +67 -0
- package/dist/core/extensions/builtin/compaction/degradation-monitor.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/degradation-monitor.js +90 -0
- package/dist/core/extensions/builtin/compaction/degradation-monitor.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/index.d.ts +3 -0
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/index.js +199 -0
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/overflow-detection.d.ts +11 -0
- package/dist/core/extensions/builtin/compaction/overflow-detection.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/overflow-detection.js +40 -0
- package/dist/core/extensions/builtin/compaction/overflow-detection.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts +15 -0
- package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js +26 -0
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/policy.d.ts +19 -0
- package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/policy.js +96 -0
- package/dist/core/extensions/builtin/compaction/policy.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/prompts.d.ts +16 -0
- package/dist/core/extensions/builtin/compaction/prompts.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/prompts.js +252 -0
- package/dist/core/extensions/builtin/compaction/prompts.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/restoration-tracker.d.ts +57 -0
- package/dist/core/extensions/builtin/compaction/restoration-tracker.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/restoration-tracker.js +274 -0
- package/dist/core/extensions/builtin/compaction/restoration-tracker.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +58 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.js +230 -0
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/state.d.ts +17 -0
- package/dist/core/extensions/builtin/compaction/state.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/state.js +15 -0
- package/dist/core/extensions/builtin/compaction/state.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +25 -0
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/todo-bridge.js +77 -0
- package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-truncation.d.ts +4 -0
- package/dist/core/extensions/builtin/compaction/tool-truncation.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-truncation.js +85 -0
- package/dist/core/extensions/builtin/compaction/tool-truncation.js.map +1 -0
- package/dist/core/extensions/builtin/diff.d.ts +9 -0
- package/dist/core/extensions/builtin/diff.d.ts.map +1 -0
- package/dist/core/extensions/builtin/diff.js +188 -0
- package/dist/core/extensions/builtin/diff.js.map +1 -0
- package/dist/core/extensions/builtin/files.d.ts +9 -0
- package/dist/core/extensions/builtin/files.d.ts.map +1 -0
- package/dist/core/extensions/builtin/files.js +186 -0
- package/dist/core/extensions/builtin/files.js.map +1 -0
- package/dist/core/extensions/builtin/google-code-execution/index.d.ts +7 -0
- package/dist/core/extensions/builtin/google-code-execution/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/google-code-execution/index.js +73 -0
- package/dist/core/extensions/builtin/google-code-execution/index.js.map +1 -0
- package/dist/core/extensions/builtin/google-google-search/index.d.ts +7 -0
- package/dist/core/extensions/builtin/google-google-search/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/google-google-search/index.js +83 -0
- package/dist/core/extensions/builtin/google-google-search/index.js.map +1 -0
- package/dist/core/extensions/builtin/google-url-context/index.d.ts +7 -0
- package/dist/core/extensions/builtin/google-url-context/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/google-url-context/index.js +82 -0
- package/dist/core/extensions/builtin/google-url-context/index.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts +6 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.js +159 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/apply.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.d.ts +8 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.js +29 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/constants.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/errors.d.ts +8 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/errors.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/errors.js +14 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/errors.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts +6 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +54 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts +12 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js +11 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/index.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/params.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/params.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/params.js +13 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/params.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/parser.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/parser.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/parser.js +157 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/parser.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.d.ts +6 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.js +36 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-diff.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.d.ts +6 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.js +50 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/patch-replace.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.d.ts +13 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.js +306 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview-format.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview.d.ts +7 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview.js +73 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/preview.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.d.ts +6 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.js +49 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/seek-sequence.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.d.ts +23 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.js +197 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-parser.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.d.ts +4 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.js +76 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/streaming-render.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/text.d.ts +4 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/text.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/text.js +16 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/text.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js +116 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/tool.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts +109 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/types.js +2 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/types.js.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/workspace.d.ts +2 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/workspace.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/workspace.js +5 -0
- package/dist/core/extensions/builtin/gpt-apply-patch/workspace.js.map +1 -0
- package/dist/core/extensions/builtin/index.d.ts +18 -0
- package/dist/core/extensions/builtin/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/index.js +58 -0
- package/dist/core/extensions/builtin/index.js.map +1 -0
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.d.ts +6 -0
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.js +57 -0
- package/dist/core/extensions/builtin/openai-api-parallel-tool-calls/index.js.map +1 -0
- package/dist/core/extensions/builtin/openai-code-interpreter/index.d.ts +10 -0
- package/dist/core/extensions/builtin/openai-code-interpreter/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/openai-code-interpreter/index.js +95 -0
- package/dist/core/extensions/builtin/openai-code-interpreter/index.js.map +1 -0
- package/dist/core/extensions/builtin/openai-web-search/index.d.ts +7 -0
- package/dist/core/extensions/builtin/openai-web-search/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/openai-web-search/index.js +111 -0
- package/dist/core/extensions/builtin/openai-web-search/index.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/arity.d.ts +4 -0
- package/dist/core/extensions/builtin/permission-system/arity.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/arity.js +168 -0
- package/dist/core/extensions/builtin/permission-system/arity.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/cli.d.ts +6 -0
- package/dist/core/extensions/builtin/permission-system/cli.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/cli.js +33 -0
- package/dist/core/extensions/builtin/permission-system/cli.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/config.d.ts +7 -0
- package/dist/core/extensions/builtin/permission-system/config.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/config.js +49 -0
- package/dist/core/extensions/builtin/permission-system/config.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/evaluate.d.ts +9 -0
- package/dist/core/extensions/builtin/permission-system/evaluate.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/evaluate.js +14 -0
- package/dist/core/extensions/builtin/permission-system/evaluate.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/events.d.ts +67 -0
- package/dist/core/extensions/builtin/permission-system/events.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/events.js +63 -0
- package/dist/core/extensions/builtin/permission-system/events.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/external-dir.d.ts +4 -0
- package/dist/core/extensions/builtin/permission-system/external-dir.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/external-dir.js +138 -0
- package/dist/core/extensions/builtin/permission-system/external-dir.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/index.d.ts +3 -0
- package/dist/core/extensions/builtin/permission-system/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/index.js +134 -0
- package/dist/core/extensions/builtin/permission-system/index.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/non-interactive.d.ts +9 -0
- package/dist/core/extensions/builtin/permission-system/non-interactive.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/non-interactive.js +43 -0
- package/dist/core/extensions/builtin/permission-system/non-interactive.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/parsers.d.ts +16 -0
- package/dist/core/extensions/builtin/permission-system/parsers.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/parsers.js +150 -0
- package/dist/core/extensions/builtin/permission-system/parsers.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/prompt.d.ts +4 -0
- package/dist/core/extensions/builtin/permission-system/prompt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/prompt.js +74 -0
- package/dist/core/extensions/builtin/permission-system/prompt.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/service.d.ts +27 -0
- package/dist/core/extensions/builtin/permission-system/service.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/service.js +129 -0
- package/dist/core/extensions/builtin/permission-system/service.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/settings.d.ts +18 -0
- package/dist/core/extensions/builtin/permission-system/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/settings.js +23 -0
- package/dist/core/extensions/builtin/permission-system/settings.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/storage.d.ts +6 -0
- package/dist/core/extensions/builtin/permission-system/storage.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/storage.js +58 -0
- package/dist/core/extensions/builtin/permission-system/storage.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/types.d.ts +61 -0
- package/dist/core/extensions/builtin/permission-system/types.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/types.js +29 -0
- package/dist/core/extensions/builtin/permission-system/types.js.map +1 -0
- package/dist/core/extensions/builtin/permission-system/wildcard.d.ts +4 -0
- package/dist/core/extensions/builtin/permission-system/wildcard.d.ts.map +1 -0
- package/dist/core/extensions/builtin/permission-system/wildcard.js +58 -0
- package/dist/core/extensions/builtin/permission-system/wildcard.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +8 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +8 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +10 -0
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/file-operations.d.ts +2 -0
- package/dist/core/extensions/builtin/prompt-preset/file-operations.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js +31 -0
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js +17 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.2.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js +15 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.3-codex.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js +15 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.4.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js +21 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js +13 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/index.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/index.js +56 -0
- package/dist/core/extensions/builtin/prompt-preset/index.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js +10 -0
- package/dist/core/extensions/builtin/prompt-preset/kimi-k2-6.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts +12 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js +101 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +7 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js +26 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-url-widget.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-url-widget.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-url-widget.js +127 -0
- package/dist/core/extensions/builtin/prompt-url-widget.js.map +1 -0
- package/dist/core/extensions/builtin/redraws.d.ts +8 -0
- package/dist/core/extensions/builtin/redraws.d.ts.map +1 -0
- package/dist/core/extensions/builtin/redraws.js +23 -0
- package/dist/core/extensions/builtin/redraws.js.map +1 -0
- package/dist/core/extensions/builtin/service-tier.d.ts +6 -0
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -0
- package/dist/core/extensions/builtin/service-tier.js +29 -0
- package/dist/core/extensions/builtin/service-tier.js.map +1 -0
- package/dist/core/extensions/builtin/system-messages.d.ts +47 -0
- package/dist/core/extensions/builtin/system-messages.d.ts.map +1 -0
- package/dist/core/extensions/builtin/system-messages.js +117 -0
- package/dist/core/extensions/builtin/system-messages.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts +10 -0
- package/dist/core/extensions/builtin/todotools/continuation/config.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/config.js +33 -0
- package/dist/core/extensions/builtin/todotools/continuation/config.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts +2 -0
- package/dist/core/extensions/builtin/todotools/continuation/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/index.js +2 -0
- package/dist/core/extensions/builtin/todotools/continuation/index.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts +5 -0
- package/dist/core/extensions/builtin/todotools/continuation/prompt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js +34 -0
- package/dist/core/extensions/builtin/todotools/continuation/prompt.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts +11 -0
- package/dist/core/extensions/builtin/todotools/continuation/runtime.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js +204 -0
- package/dist/core/extensions/builtin/todotools/continuation/runtime.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/index.d.ts +5 -0
- package/dist/core/extensions/builtin/todotools/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/index.js +39 -0
- package/dist/core/extensions/builtin/todotools/index.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -0
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/prompt.js +164 -0
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/state.d.ts +29 -0
- package/dist/core/extensions/builtin/todotools/state.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/state.js +74 -0
- package/dist/core/extensions/builtin/todotools/state.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/tools/todoread.d.ts +4 -0
- package/dist/core/extensions/builtin/todotools/tools/todoread.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/tools/todoread.js +35 -0
- package/dist/core/extensions/builtin/todotools/tools/todoread.js.map +1 -0
- package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts +10 -0
- package/dist/core/extensions/builtin/todotools/tools/todowrite.d.ts.map +1 -0
- package/dist/core/extensions/builtin/todotools/tools/todowrite.js +92 -0
- package/dist/core/extensions/builtin/todotools/tools/todowrite.js.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts +4 -0
- package/dist/core/extensions/builtin/tool-pair-guard/index.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/index.js +11 -0
- package/dist/core/extensions/builtin/tool-pair-guard/index.js.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts +3 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js +75 -0
- package/dist/core/extensions/builtin/tool-pair-guard/sanitize-anthropic-payload.js.map +1 -0
- package/dist/core/extensions/builtin/tps.d.ts +3 -0
- package/dist/core/extensions/builtin/tps.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tps.js +65 -0
- package/dist/core/extensions/builtin/tps.js.map +1 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +27 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +505 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +164 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +900 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1240 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +45 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +310 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/index.d.ts +12 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +12 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +353 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +295 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/messages.d.ts +79 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +138 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +177 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +853 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +116 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +498 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/output-guard.d.ts +6 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +59 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +198 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +1995 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +52 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +250 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +23 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +126 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +184 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +771 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/sdk.d.ts +129 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +339 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +333 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1128 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +294 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +810 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +404 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +25 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +120 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/timings.d.ts +8 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +31 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +335 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +85 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +338 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +49 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +37 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +298 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +304 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +40 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +112 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +169 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +50 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +178 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +8 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +81 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +289 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +21 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +49 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +36 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +205 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/write.d.ts +26 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +213 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +603 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +311 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +9 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +8 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +333 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +32 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +209 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +34 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +175 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +503 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +79 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/earendil-announcement.js +40 -0
- package/dist/modes/interactive/components/earendil-announcement.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +111 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +24 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +78 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/favorite-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/favorite-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/favorite-models-selector.js +302 -0
- package/dist/modes/interactive/components/favorite-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +193 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +32 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +33 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +46 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +160 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +48 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +279 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +31 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +96 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +861 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +67 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +376 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +52 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +66 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +339 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +89 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1102 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +10 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +29 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +360 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +4615 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/startup-tools.d.ts +8 -0
- package/dist/modes/interactive/startup-tools.d.ts.map +1 -0
- package/dist/modes/interactive/startup-tools.js +6 -0
- package/dist/modes/interactive/startup-tools.js.map +1 -0
- package/dist/modes/interactive/theme/theme.d.ts +81 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +973 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +144 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +224 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +410 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +601 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +419 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +460 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/senpi +20 -0
- package/dist/utils/changelog.d.ts +21 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +87 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +12 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +86 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +8 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +14 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +117 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +163 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +39 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize.d.ts +36 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +137 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/mime.d.ts +2 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +26 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/paths.d.ts +16 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +50 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +21 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +121 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -0
- package/dist/utils/pi-user-agent.js +6 -0
- package/dist/utils/pi-user-agent.js.map +1 -0
- package/dist/utils/shell.d.ts +30 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +190 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +256 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +78 -0
- package/dist/utils/version-check.js.map +1 -0
- package/docs/agents.md +348 -0
- package/docs/compaction-guide.md +240 -0
- package/docs/compaction.md +394 -0
- package/docs/custom-provider.md +646 -0
- package/docs/development.md +80 -0
- package/docs/docs.json +148 -0
- package/docs/extensions.md +2596 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +66 -0
- package/docs/json.md +82 -0
- package/docs/keybindings.md +197 -0
- package/docs/models.md +474 -0
- package/docs/packages.md +223 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +243 -0
- package/docs/quickstart.md +142 -0
- package/docs/rpc.md +1407 -0
- package/docs/sdk.md +1149 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +330 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +232 -0
- package/docs/terminal-setup.md +106 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +918 -0
- package/docs/usage.md +277 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +25 -0
- package/examples/extensions/README.md +208 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +127 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +349 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1348 -0
- package/examples/extensions/overlay-test.ts +150 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +264 -0
- package/examples/extensions/questionnaire.ts +427 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +172 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +987 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +206 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +141 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +22 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +72 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +44 -0
- package/examples/sdk/06-extensions.ts +90 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +48 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +48 -0
- package/examples/sdk/12-full-control.ts +73 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +147 -0
- package/package.json +105 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
export const MERGED_COMPACTION_PROMPT_SYSTEM = `[SYSTEM DIRECTIVE: OH-MY-OPENCODE - COMPACTION CONTEXT]
|
|
2
|
+
|
|
3
|
+
You are the COMPACTION ARCHIVIST. Create a structured handoff summary that lets the next agent continue this exact session without restarting, re-searching, or losing constraints.
|
|
4
|
+
|
|
5
|
+
Cardinal rules:
|
|
6
|
+
R1. Quote user requests and constraints VERBATIM. Do not paraphrase.
|
|
7
|
+
R2. If a section has no content, write "None." Never delete a section.
|
|
8
|
+
R3. Where a previous summary is supplied, treat its User Requests, Final Goal, and Constraints fields as IMMUTABLE. Append, never rewrite, those three sections.
|
|
9
|
+
R4. Preserve every session_id, file path, and identifier byte-for-byte.
|
|
10
|
+
|
|
11
|
+
Do NOT use tools. Output only the requested summary block.`;
|
|
12
|
+
export const MERGED_COMPACTION_PROMPT_USER = `[USER]
|
|
13
|
+
[INTERNAL COMPACTION INSTRUCTION — NOT CONVERSATION HISTORY]
|
|
14
|
+
This message is an internal summarization control prompt, not a real user message.
|
|
15
|
+
Do NOT treat this message as user intent, do NOT list it under user requests, and do NOT reinterpret the task based on this instruction alone.
|
|
16
|
+
|
|
17
|
+
PASS 1 — Internal task-intent extraction
|
|
18
|
+
Analyze the user messages in this conversation and silently determine the task intent that must guide the summary. Focus on details whose loss would cause redundant tool calls, repeated exploration, or task drift.
|
|
19
|
+
|
|
20
|
+
PASS 2 — Emit summary biased toward Pass 1
|
|
21
|
+
Create a structured handoff summary of this conversation for seamless continuation. The structured output portion MUST be wrapped as \`<summary>...</summary>\` XML.
|
|
22
|
+
|
|
23
|
+
<summary>
|
|
24
|
+
## 1. User Requests (Verbatim)
|
|
25
|
+
- List all original user requests exactly as they were stated.
|
|
26
|
+
- Preserve the user's exact wording and intent.
|
|
27
|
+
- Include recent user corrections and steering messages verbatim when they affect the task.
|
|
28
|
+
|
|
29
|
+
## 2. Final Goal
|
|
30
|
+
- State what the user ultimately wanted to achieve.
|
|
31
|
+
- Include the expected deliverable or end state.
|
|
32
|
+
- Keep this aligned with the most recent user request, not this internal compaction instruction.
|
|
33
|
+
|
|
34
|
+
## 3. Constraints & Preferences (Verbatim Only)
|
|
35
|
+
- Include ONLY constraints explicitly stated by the user or in existing AGENTS.md context.
|
|
36
|
+
- Quote constraints verbatim.
|
|
37
|
+
- Do NOT invent, add, soften, or modify constraints.
|
|
38
|
+
- If no explicit constraints exist, write "None."
|
|
39
|
+
|
|
40
|
+
## 4. Work Completed
|
|
41
|
+
- Summarize what has been done so far.
|
|
42
|
+
- List files read, created, modified, or intentionally left unchanged.
|
|
43
|
+
- Include features implemented, tests added, problems solved, and decisions already made.
|
|
44
|
+
|
|
45
|
+
## 5. Active Working Context
|
|
46
|
+
- **Files**: Paths of files currently being edited or frequently referenced.
|
|
47
|
+
- **Code in Progress**: Key code snippets, function signatures, data structures, or prompt text under active development.
|
|
48
|
+
- **External References**: Documentation URLs, source files, APIs, or other resources already consulted.
|
|
49
|
+
- **State & Variables**: Important variable names, configuration values, runtime state, branch names, worktree paths, or command outputs needed to continue.
|
|
50
|
+
|
|
51
|
+
## 6. Remaining Tasks
|
|
52
|
+
- List pending items from the original request.
|
|
53
|
+
- Include follow-up tasks identified during the work only when they directly support the current user request.
|
|
54
|
+
- Mark blockers explicitly and explain what is needed to unblock them.
|
|
55
|
+
|
|
56
|
+
## 7. Exact Next Steps
|
|
57
|
+
- State the precise next action to take, directly in line with the user's most recent request.
|
|
58
|
+
- Include verbatim quotes from the conversation showing exactly where work was left off when helpful.
|
|
59
|
+
- Do not suggest tangential tasks.
|
|
60
|
+
|
|
61
|
+
## 8. Delegated Agent Sessions
|
|
62
|
+
- List ALL background agent tasks spawned during this session.
|
|
63
|
+
- For each: agent name, category, status, description, and session_id.
|
|
64
|
+
- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.
|
|
65
|
+
- Each listed session retains full context. After compaction, use session_id to continue existing agent sessions instead of spawning new ones.
|
|
66
|
+
|
|
67
|
+
## 9. Agent Verification State (CONDITIONAL — emit only for reviewer agents)
|
|
68
|
+
- **Current Agent**: What agent is running.
|
|
69
|
+
- **Verification Progress**: Files already verified or validated.
|
|
70
|
+
- **Pending Verifications**: Files still needing verification.
|
|
71
|
+
- **Previous Rejections**: If reviewer agent, what was rejected and why.
|
|
72
|
+
- **Acceptance Status**: Current state of review process.
|
|
73
|
+
</summary>
|
|
74
|
+
|
|
75
|
+
Verification: Before finalizing, confirm the summary clearly states the user's original request. If not, restate it verbatim.
|
|
76
|
+
IMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;
|
|
77
|
+
export const MERGED_COMPACTION_PROMPT_UPDATE = `[USER]
|
|
78
|
+
<previous-summary>
|
|
79
|
+
{{previousSummary}}
|
|
80
|
+
</previous-summary>
|
|
81
|
+
|
|
82
|
+
[INTERNAL COMPACTION UPDATE INSTRUCTION — NOT CONVERSATION HISTORY]
|
|
83
|
+
The messages above are NEW conversation messages to incorporate into the existing summary provided in <previous-summary> tags.
|
|
84
|
+
|
|
85
|
+
R3 enforcement: R3. Where a previous summary is supplied, treat its User Requests, Final Goal, and Constraints fields as IMMUTABLE. Append, never rewrite, those three sections.
|
|
86
|
+
|
|
87
|
+
PASS 1 — Internal task-intent extraction
|
|
88
|
+
Analyze the new user messages and silently determine which updates are needed without changing immutable prior User Requests, Final Goal, or Constraints.
|
|
89
|
+
|
|
90
|
+
PASS 2 — Emit summary biased toward Pass 1
|
|
91
|
+
Update the structured handoff summary. The structured output portion MUST be wrapped as \`<summary>...</summary>\` XML.
|
|
92
|
+
|
|
93
|
+
<summary>
|
|
94
|
+
## 1. User Requests (Verbatim)
|
|
95
|
+
- Preserve prior entries from <previous-summary> byte-for-byte.
|
|
96
|
+
- Append new user requests exactly as they were stated.
|
|
97
|
+
|
|
98
|
+
## 2. Final Goal
|
|
99
|
+
- Preserve the existing final goal unless the user explicitly changed it.
|
|
100
|
+
- Append the explicit change verbatim if the goal changed.
|
|
101
|
+
|
|
102
|
+
## 3. Constraints & Preferences (Verbatim Only)
|
|
103
|
+
- Preserve prior constraints byte-for-byte.
|
|
104
|
+
- Quote constraints verbatim.
|
|
105
|
+
- Do NOT invent, add, soften, or modify constraints.
|
|
106
|
+
- Append only new explicit constraints.
|
|
107
|
+
- If no explicit constraints exist, write "None."
|
|
108
|
+
|
|
109
|
+
## 4. Work Completed
|
|
110
|
+
- Preserve completed work from the previous summary.
|
|
111
|
+
- Add newly completed work, files changed, tests run, and decisions made.
|
|
112
|
+
|
|
113
|
+
## 5. Active Working Context
|
|
114
|
+
- Update files, code in progress, external references, state, variables, branch names, worktree paths, and command outputs needed to continue.
|
|
115
|
+
|
|
116
|
+
## 6. Remaining Tasks
|
|
117
|
+
- Remove tasks only when the new messages prove they are completed or cancelled.
|
|
118
|
+
- Add newly identified direct follow-up tasks.
|
|
119
|
+
|
|
120
|
+
## 7. Exact Next Steps
|
|
121
|
+
- Update based on current state and the user's most recent request.
|
|
122
|
+
- Keep this direct and immediately actionable.
|
|
123
|
+
|
|
124
|
+
## 8. Delegated Agent Sessions
|
|
125
|
+
- Preserve every existing agent name, status, description, and session_id byte-for-byte unless updated by new messages.
|
|
126
|
+
- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.
|
|
127
|
+
|
|
128
|
+
## 9. Agent Verification State (CONDITIONAL — emit only for reviewer agents)
|
|
129
|
+
- Preserve reviewer context and update verification progress, pending verifications, previous rejections, and acceptance status.
|
|
130
|
+
</summary>
|
|
131
|
+
|
|
132
|
+
IMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;
|
|
133
|
+
export const MERGED_COMPACTION_PROMPT_BRANCH = `[USER]
|
|
134
|
+
[INTERNAL BRANCH SUMMARY INSTRUCTION — NOT CONVERSATION HISTORY]
|
|
135
|
+
Create a structured summary of this conversation branch for context when returning later. This is a branch-level handoff, so reorient §2 toward the branched intent and why this branch exists.
|
|
136
|
+
|
|
137
|
+
PASS 1 — Internal task-intent extraction
|
|
138
|
+
Analyze this branch and silently determine the branch-specific intent, divergence point, and details whose loss would cause repeated work.
|
|
139
|
+
|
|
140
|
+
PASS 2 — Emit summary biased toward Pass 1
|
|
141
|
+
Create a structured branch handoff summary. The structured output portion MUST be wrapped as \`<summary>...</summary>\` XML.
|
|
142
|
+
|
|
143
|
+
<summary>
|
|
144
|
+
## 1. User Requests (Verbatim)
|
|
145
|
+
- List user requests that caused or shaped this branch exactly as they were stated.
|
|
146
|
+
- Preserve the user's exact wording and intent.
|
|
147
|
+
|
|
148
|
+
## 2. Final Goal
|
|
149
|
+
- State the branched intent: what this branch was trying to accomplish, test, compare, or preserve.
|
|
150
|
+
- Include how this branch differs from the mainline path when known.
|
|
151
|
+
|
|
152
|
+
## 3. Constraints & Preferences (Verbatim Only)
|
|
153
|
+
- Include ONLY constraints explicitly stated by the user or in existing AGENTS.md context.
|
|
154
|
+
- Quote constraints verbatim.
|
|
155
|
+
- Do NOT invent, add, soften, or modify constraints.
|
|
156
|
+
- If no explicit constraints exist, write "None."
|
|
157
|
+
|
|
158
|
+
## 4. Work Completed
|
|
159
|
+
- Summarize branch-specific progress.
|
|
160
|
+
- List files read, created, modified, or intentionally left unchanged on this branch.
|
|
161
|
+
|
|
162
|
+
## 5. Active Working Context
|
|
163
|
+
- **Files**: Paths of files currently edited or frequently referenced in this branch.
|
|
164
|
+
- **Code in Progress**: Key snippets, signatures, data structures, or prompt text under active development.
|
|
165
|
+
- **External References**: Sources already consulted for this branch.
|
|
166
|
+
- **State & Variables**: Branch names, worktree paths, runtime state, command outputs, and identifiers needed to resume.
|
|
167
|
+
|
|
168
|
+
## 6. Remaining Tasks
|
|
169
|
+
- List branch-specific work still needed.
|
|
170
|
+
- Include blockers and the concrete condition needed to unblock them.
|
|
171
|
+
|
|
172
|
+
## 7. Exact Next Steps
|
|
173
|
+
- State the precise next action for returning to this branch.
|
|
174
|
+
- Do not suggest tangential tasks.
|
|
175
|
+
|
|
176
|
+
## 8. Delegated Agent Sessions
|
|
177
|
+
- List branch-relevant background agent tasks.
|
|
178
|
+
- For each: agent name, category, status, description, and session_id.
|
|
179
|
+
- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.
|
|
180
|
+
</summary>
|
|
181
|
+
|
|
182
|
+
IMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;
|
|
183
|
+
export const MERGED_COMPACTION_PROMPT_TURN_PREFIX = `[USER]
|
|
184
|
+
[INTERNAL TURN-PREFIX SUMMARY INSTRUCTION — NOT CONVERSATION HISTORY]
|
|
185
|
+
Create a compact prefix summary for the next turn. Emit only the sections listed below.
|
|
186
|
+
|
|
187
|
+
PASS 1 — Internal task-intent extraction
|
|
188
|
+
Silently determine the current task intent and the minimum context needed for the next turn.
|
|
189
|
+
|
|
190
|
+
PASS 2 — Emit summary biased toward Pass 1
|
|
191
|
+
The structured output portion MUST be wrapped as \`<summary>...</summary>\` XML.
|
|
192
|
+
|
|
193
|
+
<summary>
|
|
194
|
+
## 1. User Requests (Verbatim)
|
|
195
|
+
- Quote the active user request and any steering constraints exactly as stated.
|
|
196
|
+
|
|
197
|
+
## 2. Final Goal
|
|
198
|
+
- State the immediate end state needed for the next turn.
|
|
199
|
+
|
|
200
|
+
## 3. Constraints & Preferences (Verbatim Only)
|
|
201
|
+
- Quote constraints verbatim.
|
|
202
|
+
- Do NOT invent, add, soften, or modify constraints.
|
|
203
|
+
- If no explicit constraints exist, write "None."
|
|
204
|
+
|
|
205
|
+
## 5. Active Working Context
|
|
206
|
+
- Include only files, identifiers, runtime state, and exact next-turn context needed to continue immediately.
|
|
207
|
+
</summary>
|
|
208
|
+
|
|
209
|
+
IMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;
|
|
210
|
+
export function buildPrompt(options) {
|
|
211
|
+
const user = buildUserPrompt(options);
|
|
212
|
+
return {
|
|
213
|
+
system: MERGED_COMPACTION_PROMPT_SYSTEM,
|
|
214
|
+
user: appendCustomInstructions(user, options.customInstructions),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function buildUserPrompt(options) {
|
|
218
|
+
switch (options.variant) {
|
|
219
|
+
case "default":
|
|
220
|
+
return MERGED_COMPACTION_PROMPT_USER;
|
|
221
|
+
case "update":
|
|
222
|
+
return MERGED_COMPACTION_PROMPT_UPDATE.replace("{{previousSummary}}", sanitizePreviousSummary(options.previousSummary));
|
|
223
|
+
case "branch":
|
|
224
|
+
return MERGED_COMPACTION_PROMPT_BRANCH;
|
|
225
|
+
case "turn_prefix":
|
|
226
|
+
return MERGED_COMPACTION_PROMPT_TURN_PREFIX;
|
|
227
|
+
}
|
|
228
|
+
const exhaustiveCheck = options.variant;
|
|
229
|
+
return exhaustiveCheck;
|
|
230
|
+
}
|
|
231
|
+
function appendCustomInstructions(userPrompt, customInstructions) {
|
|
232
|
+
const trimmedInstructions = customInstructions?.trim();
|
|
233
|
+
if (!trimmedInstructions) {
|
|
234
|
+
return userPrompt;
|
|
235
|
+
}
|
|
236
|
+
return `${userPrompt}
|
|
237
|
+
|
|
238
|
+
<custom-instructions>
|
|
239
|
+
${sanitizeCustomInstructions(trimmedInstructions)}
|
|
240
|
+
</custom-instructions>`;
|
|
241
|
+
}
|
|
242
|
+
function sanitizePreviousSummary(previousSummary) {
|
|
243
|
+
const trimmedSummary = previousSummary?.trim();
|
|
244
|
+
if (!trimmedSummary) {
|
|
245
|
+
return "None.";
|
|
246
|
+
}
|
|
247
|
+
return trimmedSummary.split("</previous-summary>").join("[/previous-summary]");
|
|
248
|
+
}
|
|
249
|
+
function sanitizeCustomInstructions(customInstructions) {
|
|
250
|
+
return customInstructions.split("</custom-instructions>").join("[/custom-instructions]");
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/compaction/prompts.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;2DAUY,CAAC;AAE5D,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFAgEsC,CAAC;AAEpF,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFAuDoC,CAAC;AAEpF,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFAiDoC,CAAC;AAEpF,MAAM,CAAC,MAAM,oCAAoC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;mFA0B+B,CAAC;AAEpF,MAAM,UAAU,WAAW,CAAC,OAA2C,EAAoC;IAC1G,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEtC,OAAO;QACN,MAAM,EAAE,+BAA+B;QACvC,IAAI,EAAE,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC;KAChE,CAAC;AAAA,CACF;AAED,SAAS,eAAe,CAAC,OAA2C,EAAU;IAC7E,QAAQ,OAAO,CAAC,OAAO,EAAE,CAAC;QACzB,KAAK,SAAS;YACb,OAAO,6BAA6B,CAAC;QACtC,KAAK,QAAQ;YACZ,OAAO,+BAA+B,CAAC,OAAO,CAC7C,qBAAqB,EACrB,uBAAuB,CAAC,OAAO,CAAC,eAAe,CAAC,CAChD,CAAC;QACH,KAAK,QAAQ;YACZ,OAAO,+BAA+B,CAAC;QACxC,KAAK,aAAa;YACjB,OAAO,oCAAoC,CAAC;IAC9C,CAAC;IAED,MAAM,eAAe,GAAU,OAAO,CAAC,OAAO,CAAC;IAC/C,OAAO,eAAe,CAAC;AAAA,CACvB;AAED,SAAS,wBAAwB,CAAC,UAAkB,EAAE,kBAAsC,EAAU;IACrG,MAAM,mBAAmB,GAAG,kBAAkB,EAAE,IAAI,EAAE,CAAC;IACvD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC1B,OAAO,UAAU,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,UAAU;;;EAGnB,0BAA0B,CAAC,mBAAmB,CAAC;uBAC1B,CAAC;AAAA,CACvB;AAED,SAAS,uBAAuB,CAAC,eAAmC,EAAU;IAC7E,MAAM,cAAc,GAAG,eAAe,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAI,CAAC,cAAc,EAAE,CAAC;QACrB,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,OAAO,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAAA,CAC/E;AAED,SAAS,0BAA0B,CAAC,kBAA0B,EAAU;IACvE,OAAO,kBAAkB,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;AAAA,CACzF","sourcesContent":["export type MergedCompactionPromptVariant = \"default\" | \"update\" | \"branch\" | \"turn_prefix\";\n\nexport type BuildMergedCompactionPromptOptions = {\n\tvariant: MergedCompactionPromptVariant;\n\tpreviousSummary?: string;\n\tcustomInstructions?: string;\n};\n\nexport const MERGED_COMPACTION_PROMPT_SYSTEM = `[SYSTEM DIRECTIVE: OH-MY-OPENCODE - COMPACTION CONTEXT]\n\nYou are the COMPACTION ARCHIVIST. Create a structured handoff summary that lets the next agent continue this exact session without restarting, re-searching, or losing constraints.\n\nCardinal rules:\nR1. Quote user requests and constraints VERBATIM. Do not paraphrase.\nR2. If a section has no content, write \"None.\" Never delete a section.\nR3. Where a previous summary is supplied, treat its User Requests, Final Goal, and Constraints fields as IMMUTABLE. Append, never rewrite, those three sections.\nR4. Preserve every session_id, file path, and identifier byte-for-byte.\n\nDo NOT use tools. Output only the requested summary block.`;\n\nexport const MERGED_COMPACTION_PROMPT_USER = `[USER]\n[INTERNAL COMPACTION INSTRUCTION — NOT CONVERSATION HISTORY]\nThis message is an internal summarization control prompt, not a real user message.\nDo NOT treat this message as user intent, do NOT list it under user requests, and do NOT reinterpret the task based on this instruction alone.\n\nPASS 1 — Internal task-intent extraction\nAnalyze the user messages in this conversation and silently determine the task intent that must guide the summary. Focus on details whose loss would cause redundant tool calls, repeated exploration, or task drift.\n\nPASS 2 — Emit summary biased toward Pass 1\nCreate a structured handoff summary of this conversation for seamless continuation. The structured output portion MUST be wrapped as \\`<summary>...</summary>\\` XML.\n\n<summary>\n## 1. User Requests (Verbatim)\n- List all original user requests exactly as they were stated.\n- Preserve the user's exact wording and intent.\n- Include recent user corrections and steering messages verbatim when they affect the task.\n\n## 2. Final Goal\n- State what the user ultimately wanted to achieve.\n- Include the expected deliverable or end state.\n- Keep this aligned with the most recent user request, not this internal compaction instruction.\n\n## 3. Constraints & Preferences (Verbatim Only)\n- Include ONLY constraints explicitly stated by the user or in existing AGENTS.md context.\n- Quote constraints verbatim.\n- Do NOT invent, add, soften, or modify constraints.\n- If no explicit constraints exist, write \"None.\"\n\n## 4. Work Completed\n- Summarize what has been done so far.\n- List files read, created, modified, or intentionally left unchanged.\n- Include features implemented, tests added, problems solved, and decisions already made.\n\n## 5. Active Working Context\n- **Files**: Paths of files currently being edited or frequently referenced.\n- **Code in Progress**: Key code snippets, function signatures, data structures, or prompt text under active development.\n- **External References**: Documentation URLs, source files, APIs, or other resources already consulted.\n- **State & Variables**: Important variable names, configuration values, runtime state, branch names, worktree paths, or command outputs needed to continue.\n\n## 6. Remaining Tasks\n- List pending items from the original request.\n- Include follow-up tasks identified during the work only when they directly support the current user request.\n- Mark blockers explicitly and explain what is needed to unblock them.\n\n## 7. Exact Next Steps\n- State the precise next action to take, directly in line with the user's most recent request.\n- Include verbatim quotes from the conversation showing exactly where work was left off when helpful.\n- Do not suggest tangential tasks.\n\n## 8. Delegated Agent Sessions\n- List ALL background agent tasks spawned during this session.\n- For each: agent name, category, status, description, and session_id.\n- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.\n- Each listed session retains full context. After compaction, use session_id to continue existing agent sessions instead of spawning new ones.\n\n## 9. Agent Verification State (CONDITIONAL — emit only for reviewer agents)\n- **Current Agent**: What agent is running.\n- **Verification Progress**: Files already verified or validated.\n- **Pending Verifications**: Files still needing verification.\n- **Previous Rejections**: If reviewer agent, what was rejected and why.\n- **Acceptance Status**: Current state of review process.\n</summary>\n\nVerification: Before finalizing, confirm the summary clearly states the user's original request. If not, restate it verbatim.\nIMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;\n\nexport const MERGED_COMPACTION_PROMPT_UPDATE = `[USER]\n<previous-summary>\n{{previousSummary}}\n</previous-summary>\n\n[INTERNAL COMPACTION UPDATE INSTRUCTION — NOT CONVERSATION HISTORY]\nThe messages above are NEW conversation messages to incorporate into the existing summary provided in <previous-summary> tags.\n\nR3 enforcement: R3. Where a previous summary is supplied, treat its User Requests, Final Goal, and Constraints fields as IMMUTABLE. Append, never rewrite, those three sections.\n\nPASS 1 — Internal task-intent extraction\nAnalyze the new user messages and silently determine which updates are needed without changing immutable prior User Requests, Final Goal, or Constraints.\n\nPASS 2 — Emit summary biased toward Pass 1\nUpdate the structured handoff summary. The structured output portion MUST be wrapped as \\`<summary>...</summary>\\` XML.\n\n<summary>\n## 1. User Requests (Verbatim)\n- Preserve prior entries from <previous-summary> byte-for-byte.\n- Append new user requests exactly as they were stated.\n\n## 2. Final Goal\n- Preserve the existing final goal unless the user explicitly changed it.\n- Append the explicit change verbatim if the goal changed.\n\n## 3. Constraints & Preferences (Verbatim Only)\n- Preserve prior constraints byte-for-byte.\n- Quote constraints verbatim.\n- Do NOT invent, add, soften, or modify constraints.\n- Append only new explicit constraints.\n- If no explicit constraints exist, write \"None.\"\n\n## 4. Work Completed\n- Preserve completed work from the previous summary.\n- Add newly completed work, files changed, tests run, and decisions made.\n\n## 5. Active Working Context\n- Update files, code in progress, external references, state, variables, branch names, worktree paths, and command outputs needed to continue.\n\n## 6. Remaining Tasks\n- Remove tasks only when the new messages prove they are completed or cancelled.\n- Add newly identified direct follow-up tasks.\n\n## 7. Exact Next Steps\n- Update based on current state and the user's most recent request.\n- Keep this direct and immediately actionable.\n\n## 8. Delegated Agent Sessions\n- Preserve every existing agent name, status, description, and session_id byte-for-byte unless updated by new messages.\n- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.\n\n## 9. Agent Verification State (CONDITIONAL — emit only for reviewer agents)\n- Preserve reviewer context and update verification progress, pending verifications, previous rejections, and acceptance status.\n</summary>\n\nIMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;\n\nexport const MERGED_COMPACTION_PROMPT_BRANCH = `[USER]\n[INTERNAL BRANCH SUMMARY INSTRUCTION — NOT CONVERSATION HISTORY]\nCreate a structured summary of this conversation branch for context when returning later. This is a branch-level handoff, so reorient §2 toward the branched intent and why this branch exists.\n\nPASS 1 — Internal task-intent extraction\nAnalyze this branch and silently determine the branch-specific intent, divergence point, and details whose loss would cause repeated work.\n\nPASS 2 — Emit summary biased toward Pass 1\nCreate a structured branch handoff summary. The structured output portion MUST be wrapped as \\`<summary>...</summary>\\` XML.\n\n<summary>\n## 1. User Requests (Verbatim)\n- List user requests that caused or shaped this branch exactly as they were stated.\n- Preserve the user's exact wording and intent.\n\n## 2. Final Goal\n- State the branched intent: what this branch was trying to accomplish, test, compare, or preserve.\n- Include how this branch differs from the mainline path when known.\n\n## 3. Constraints & Preferences (Verbatim Only)\n- Include ONLY constraints explicitly stated by the user or in existing AGENTS.md context.\n- Quote constraints verbatim.\n- Do NOT invent, add, soften, or modify constraints.\n- If no explicit constraints exist, write \"None.\"\n\n## 4. Work Completed\n- Summarize branch-specific progress.\n- List files read, created, modified, or intentionally left unchanged on this branch.\n\n## 5. Active Working Context\n- **Files**: Paths of files currently edited or frequently referenced in this branch.\n- **Code in Progress**: Key snippets, signatures, data structures, or prompt text under active development.\n- **External References**: Sources already consulted for this branch.\n- **State & Variables**: Branch names, worktree paths, runtime state, command outputs, and identifiers needed to resume.\n\n## 6. Remaining Tasks\n- List branch-specific work still needed.\n- Include blockers and the concrete condition needed to unblock them.\n\n## 7. Exact Next Steps\n- State the precise next action for returning to this branch.\n- Do not suggest tangential tasks.\n\n## 8. Delegated Agent Sessions\n- List branch-relevant background agent tasks.\n- For each: agent name, category, status, description, and session_id.\n- RESUME, DON'T RESTART — session_ids must be preserved byte-for-byte.\n</summary>\n\nIMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;\n\nexport const MERGED_COMPACTION_PROMPT_TURN_PREFIX = `[USER]\n[INTERNAL TURN-PREFIX SUMMARY INSTRUCTION — NOT CONVERSATION HISTORY]\nCreate a compact prefix summary for the next turn. Emit only the sections listed below.\n\nPASS 1 — Internal task-intent extraction\nSilently determine the current task intent and the minimum context needed for the next turn.\n\nPASS 2 — Emit summary biased toward Pass 1\nThe structured output portion MUST be wrapped as \\`<summary>...</summary>\\` XML.\n\n<summary>\n## 1. User Requests (Verbatim)\n- Quote the active user request and any steering constraints exactly as stated.\n\n## 2. Final Goal\n- State the immediate end state needed for the next turn.\n\n## 3. Constraints & Preferences (Verbatim Only)\n- Quote constraints verbatim.\n- Do NOT invent, add, soften, or modify constraints.\n- If no explicit constraints exist, write \"None.\"\n\n## 5. Active Working Context\n- Include only files, identifiers, runtime state, and exact next-turn context needed to continue immediately.\n</summary>\n\nIMPORTANT: Respond with ONLY the <summary>...</summary> block as your text output.`;\n\nexport function buildPrompt(options: BuildMergedCompactionPromptOptions): { system: string; user: string } {\n\tconst user = buildUserPrompt(options);\n\n\treturn {\n\t\tsystem: MERGED_COMPACTION_PROMPT_SYSTEM,\n\t\tuser: appendCustomInstructions(user, options.customInstructions),\n\t};\n}\n\nfunction buildUserPrompt(options: BuildMergedCompactionPromptOptions): string {\n\tswitch (options.variant) {\n\t\tcase \"default\":\n\t\t\treturn MERGED_COMPACTION_PROMPT_USER;\n\t\tcase \"update\":\n\t\t\treturn MERGED_COMPACTION_PROMPT_UPDATE.replace(\n\t\t\t\t\"{{previousSummary}}\",\n\t\t\t\tsanitizePreviousSummary(options.previousSummary),\n\t\t\t);\n\t\tcase \"branch\":\n\t\t\treturn MERGED_COMPACTION_PROMPT_BRANCH;\n\t\tcase \"turn_prefix\":\n\t\t\treturn MERGED_COMPACTION_PROMPT_TURN_PREFIX;\n\t}\n\n\tconst exhaustiveCheck: never = options.variant;\n\treturn exhaustiveCheck;\n}\n\nfunction appendCustomInstructions(userPrompt: string, customInstructions: string | undefined): string {\n\tconst trimmedInstructions = customInstructions?.trim();\n\tif (!trimmedInstructions) {\n\t\treturn userPrompt;\n\t}\n\n\treturn `${userPrompt}\n\n<custom-instructions>\n${sanitizeCustomInstructions(trimmedInstructions)}\n</custom-instructions>`;\n}\n\nfunction sanitizePreviousSummary(previousSummary: string | undefined): string {\n\tconst trimmedSummary = previousSummary?.trim();\n\tif (!trimmedSummary) {\n\t\treturn \"None.\";\n\t}\n\n\treturn trimmedSummary.split(\"</previous-summary>\").join(\"[/previous-summary]\");\n}\n\nfunction sanitizeCustomInstructions(customInstructions: string): string {\n\treturn customInstructions.split(\"</custom-instructions>\").join(\"[/custom-instructions]\");\n}\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import type { BeforeAgentStartEventResult, CompactionReason } from "../../types.js";
|
|
3
|
+
export declare const POST_COMPACT_RESTORATION_CUSTOM_TYPE = "compaction.post-compact-restoration";
|
|
4
|
+
declare const POST_COMPACT_RESTORATION_SCHEMA = "senpi.compaction.post-compact-restoration.v1";
|
|
5
|
+
type RestorationItemType = "file" | "skill";
|
|
6
|
+
export interface RestorationSettings {
|
|
7
|
+
restorationMaxItems?: number;
|
|
8
|
+
restorationMaxTokensPerItem?: number;
|
|
9
|
+
restorationMaxTotalTokens?: number;
|
|
10
|
+
restorationContextRatio?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface MinimalToolCallEvent {
|
|
13
|
+
toolName: string;
|
|
14
|
+
input: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface RestorationItem {
|
|
17
|
+
content: string;
|
|
18
|
+
label: string;
|
|
19
|
+
priority: number;
|
|
20
|
+
tokens: number;
|
|
21
|
+
type: RestorationItemType;
|
|
22
|
+
}
|
|
23
|
+
export interface PendingRestorationPayload {
|
|
24
|
+
customType: typeof POST_COMPACT_RESTORATION_CUSTOM_TYPE;
|
|
25
|
+
content: string;
|
|
26
|
+
display: false;
|
|
27
|
+
details: {
|
|
28
|
+
schema: typeof POST_COMPACT_RESTORATION_SCHEMA;
|
|
29
|
+
budgetTokens: number;
|
|
30
|
+
compactionEntryId: string;
|
|
31
|
+
reason: CompactionReason;
|
|
32
|
+
items: RestorationItem[];
|
|
33
|
+
};
|
|
34
|
+
budgetTokens: number;
|
|
35
|
+
}
|
|
36
|
+
export interface PreparePendingPayloadOptions {
|
|
37
|
+
accepted: boolean;
|
|
38
|
+
reason: CompactionReason;
|
|
39
|
+
compactionEntryId: string;
|
|
40
|
+
contextWindow: number;
|
|
41
|
+
usageTokens: number | null;
|
|
42
|
+
reserveTokens: number;
|
|
43
|
+
settings?: RestorationSettings;
|
|
44
|
+
keptMessages?: AgentMessage[];
|
|
45
|
+
}
|
|
46
|
+
export interface RestorationTrackerState {
|
|
47
|
+
items: Map<string, RestorationItem>;
|
|
48
|
+
restoredLabels: Set<string>;
|
|
49
|
+
pendingPayload: PendingRestorationPayload | null;
|
|
50
|
+
}
|
|
51
|
+
export declare function createRestorationTrackerState(): RestorationTrackerState;
|
|
52
|
+
export declare function trackToolCall(state: RestorationTrackerState, event: MinimalToolCallEvent): void;
|
|
53
|
+
export declare function preparePendingPayload(state: RestorationTrackerState, options: PreparePendingPayloadOptions): void;
|
|
54
|
+
export declare function consumePendingPayload(state: RestorationTrackerState): BeforeAgentStartEventResult["message"] | undefined;
|
|
55
|
+
export declare function computeRestorationBudget(options: PreparePendingPayloadOptions): number;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=restoration-tracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restoration-tracker.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/compaction/restoration-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGpF,eAAO,MAAM,oCAAoC,wCAAwC,CAAC;AAE1F,QAAA,MAAM,+BAA+B,iDAAiD,CAAC;AAMvF,KAAK,mBAAmB,GAAG,MAAM,GAAG,OAAO,CAAC;AAG5C,MAAM,WAAW,mBAAmB;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,mBAAmB,CAAC;CAC1B;AAED,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,OAAO,oCAAoC,CAAC;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE;QACR,MAAM,EAAE,OAAO,+BAA+B,CAAC;QAC/C,YAAY,EAAE,MAAM,CAAC;QACrB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,MAAM,EAAE,gBAAgB,CAAC;QACzB,KAAK,EAAE,eAAe,EAAE,CAAC;KACzB,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,cAAc,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACjD;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAMvE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAmB/F;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,4BAA4B,GAAG,IAAI,CA8BjH;AAED,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,uBAAuB,GAC5B,2BAA2B,CAAC,SAAS,CAAC,GAAG,SAAS,CAapD;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,CAQtF","sourcesContent":["import type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport { estimateTokens } from \"../../../compaction/index.js\";\nimport type { BeforeAgentStartEventResult, CompactionReason } from \"../../types.js\";\nimport { extractPatchedPaths } from \"../gpt-apply-patch/index.js\";\n\nexport const POST_COMPACT_RESTORATION_CUSTOM_TYPE = \"compaction.post-compact-restoration\";\n\nconst POST_COMPACT_RESTORATION_SCHEMA = \"senpi.compaction.post-compact-restoration.v1\";\nconst DEFAULT_RESTORATION_MAX_ITEMS = 10;\nconst DEFAULT_RESTORATION_MAX_TOKENS_PER_ITEM = 5000;\nconst DEFAULT_RESTORATION_MAX_TOTAL_TOKENS = 50_000;\nconst DEFAULT_RESTORATION_CONTEXT_RATIO = 0.15;\n\ntype RestorationItemType = \"file\" | \"skill\";\ntype FileOperation = \"read\" | \"write\" | \"edit\";\n\nexport interface RestorationSettings {\n\trestorationMaxItems?: number;\n\trestorationMaxTokensPerItem?: number;\n\trestorationMaxTotalTokens?: number;\n\trestorationContextRatio?: number;\n}\n\nexport interface MinimalToolCallEvent {\n\ttoolName: string;\n\tinput: Record<string, unknown>;\n}\n\nexport interface RestorationItem {\n\tcontent: string;\n\tlabel: string;\n\tpriority: number;\n\ttokens: number;\n\ttype: RestorationItemType;\n}\n\nexport interface PendingRestorationPayload {\n\tcustomType: typeof POST_COMPACT_RESTORATION_CUSTOM_TYPE;\n\tcontent: string;\n\tdisplay: false;\n\tdetails: {\n\t\tschema: typeof POST_COMPACT_RESTORATION_SCHEMA;\n\t\tbudgetTokens: number;\n\t\tcompactionEntryId: string;\n\t\treason: CompactionReason;\n\t\titems: RestorationItem[];\n\t};\n\tbudgetTokens: number;\n}\n\nexport interface PreparePendingPayloadOptions {\n\taccepted: boolean;\n\treason: CompactionReason;\n\tcompactionEntryId: string;\n\tcontextWindow: number;\n\tusageTokens: number | null;\n\treserveTokens: number;\n\tsettings?: RestorationSettings;\n\tkeptMessages?: AgentMessage[];\n}\n\nexport interface RestorationTrackerState {\n\titems: Map<string, RestorationItem>;\n\trestoredLabels: Set<string>;\n\tpendingPayload: PendingRestorationPayload | null;\n}\n\nexport function createRestorationTrackerState(): RestorationTrackerState {\n\treturn {\n\t\titems: new Map(),\n\t\trestoredLabels: new Set(),\n\t\tpendingPayload: null,\n\t};\n}\n\nexport function trackToolCall(state: RestorationTrackerState, event: MinimalToolCallEvent): void {\n\tswitch (event.toolName) {\n\t\tcase \"read\":\n\t\t\ttrackPathInput(state, event.input, \"read\");\n\t\t\treturn;\n\t\tcase \"write\":\n\t\t\ttrackPathInput(state, event.input, \"write\");\n\t\t\treturn;\n\t\tcase \"edit\":\n\t\t\ttrackPathInput(state, event.input, \"edit\");\n\t\t\treturn;\n\t\tcase \"apply_patch\":\n\t\t\ttrackApplyPatchInput(state, event.input);\n\t\t\treturn;\n\t\tcase \"skill\":\n\t\tcase \"load_skill\":\n\t\t\ttrackSkillInput(state, event.input);\n\t\t\treturn;\n\t}\n}\n\nexport function preparePendingPayload(state: RestorationTrackerState, options: PreparePendingPayloadOptions): void {\n\tif (!options.accepted) return;\n\n\tconst budgetTokens = computeRestorationBudget(options);\n\tif (budgetTokens <= 0) {\n\t\tstate.pendingPayload = null;\n\t\treturn;\n\t}\n\n\tfilterAgainstKeptMessages(state, options.keptMessages ?? []);\n\tconst selectedItems = selectRestorationItems(state, options.settings, budgetTokens);\n\tif (selectedItems.length === 0) {\n\t\tstate.pendingPayload = null;\n\t\treturn;\n\t}\n\n\tconst content = buildRestorationContent(options, selectedItems);\n\tstate.pendingPayload = {\n\t\tcustomType: POST_COMPACT_RESTORATION_CUSTOM_TYPE,\n\t\tcontent,\n\t\tdisplay: false,\n\t\tdetails: {\n\t\t\tschema: POST_COMPACT_RESTORATION_SCHEMA,\n\t\t\tbudgetTokens,\n\t\t\tcompactionEntryId: options.compactionEntryId,\n\t\t\treason: options.reason,\n\t\t\titems: selectedItems,\n\t\t},\n\t\tbudgetTokens,\n\t};\n}\n\nexport function consumePendingPayload(\n\tstate: RestorationTrackerState,\n): BeforeAgentStartEventResult[\"message\"] | undefined {\n\tconst payload = state.pendingPayload;\n\tstate.pendingPayload = null;\n\tif (!payload) return undefined;\n\tfor (const item of payload.details.items) {\n\t\tstate.restoredLabels.add(item.label);\n\t}\n\treturn {\n\t\tcustomType: payload.customType,\n\t\tcontent: payload.content,\n\t\tdisplay: payload.display,\n\t\tdetails: payload.details,\n\t};\n}\n\nexport function computeRestorationBudget(options: PreparePendingPayloadOptions): number {\n\tconst settings = resolveSettings(options.settings);\n\tconst contextWindow = Math.max(0, options.contextWindow);\n\tconst configuredBudget = settings.restorationMaxTotalTokens;\n\tconst contextRatioBudget = Math.floor(contextWindow * settings.restorationContextRatio);\n\tconst usageTokens = Math.max(0, options.usageTokens ?? 0);\n\tconst remainingBudget = Math.max(0, contextWindow - usageTokens - options.reserveTokens);\n\treturn Math.floor(Math.min(configuredBudget, contextRatioBudget, remainingBudget));\n}\n\nfunction trackPathInput(\n\tstate: RestorationTrackerState,\n\tinput: Record<string, unknown>,\n\toperation: FileOperation,\n): void {\n\tif (typeof input.path !== \"string\" || input.path.length === 0) return;\n\ttrackFile(state, input.path, operation);\n}\n\nfunction trackApplyPatchInput(state: RestorationTrackerState, input: Record<string, unknown>): void {\n\tif (typeof input.input !== \"string\") return;\n\tfor (const path of extractPatchedPaths(input.input)) {\n\t\tif (path.length > 0) trackFile(state, path, \"edit\");\n\t}\n}\n\nfunction trackSkillInput(state: RestorationTrackerState, input: Record<string, unknown>): void {\n\tconst skillName = typeof input.name === \"string\" ? input.name : input.skillName;\n\tif (typeof skillName === \"string\" && skillName.length > 0) {\n\t\tsetItem(state, {\n\t\t\tcontent: skillName,\n\t\t\tlabel: skillName,\n\t\t\tpriority: 80,\n\t\t\ttokens: estimateTextTokens(skillName),\n\t\t\ttype: \"skill\",\n\t\t});\n\t}\n}\n\nfunction trackFile(state: RestorationTrackerState, path: string, operation: FileOperation): void {\n\tconst label = path;\n\tconst existing = state.items.get(label);\n\tconst operations = new Set<FileOperation>(parseFileOperations(existing?.content));\n\toperations.add(operation);\n\tconst content = `${path} (${sortOperations(operations).join(\", \")})`;\n\tsetItem(state, {\n\t\tcontent,\n\t\tlabel,\n\t\tpriority: operation === \"read\" && operations.size === 1 ? 50 : 100,\n\t\ttokens: estimateTextTokens(content),\n\t\ttype: \"file\",\n\t});\n}\n\nfunction setItem(state: RestorationTrackerState, item: RestorationItem): void {\n\tstate.items.set(item.label, item);\n}\n\nfunction selectRestorationItems(\n\tstate: RestorationTrackerState,\n\tsettingsInput: RestorationSettings | undefined,\n\tbudgetTokens: number,\n): RestorationItem[] {\n\tconst settings = resolveSettings(settingsInput);\n\tconst candidates = Array.from(state.items.values())\n\t\t.filter((item) => !state.restoredLabels.has(item.label))\n\t\t.map((item) => truncateRestorationItem(item, settings.restorationMaxTokensPerItem))\n\t\t.sort((left, right) => {\n\t\t\tif (left.priority !== right.priority) return right.priority - left.priority;\n\t\t\tif (left.tokens !== right.tokens) return left.tokens - right.tokens;\n\t\t\treturn left.label.localeCompare(right.label);\n\t\t});\n\n\tconst selected: RestorationItem[] = [];\n\tlet totalTokens = 0;\n\tfor (const item of candidates) {\n\t\tif (selected.length >= settings.restorationMaxItems) break;\n\t\tif (totalTokens + item.tokens > budgetTokens) continue;\n\t\tselected.push(item);\n\t\ttotalTokens += item.tokens;\n\t}\n\treturn selected;\n}\n\nfunction buildRestorationContent(options: PreparePendingPayloadOptions, items: RestorationItem[]): string {\n\tconst files = items.filter((item) => item.type === \"file\");\n\tconst skills = items.filter((item) => item.type === \"skill\");\n\tconst lines = [\n\t\t\"[Restored context after compaction — files and skills from before compaction]\",\n\t\t`reason: ${options.reason}`,\n\t\t`compactionEntryId: ${options.compactionEntryId}`,\n\t\t\"\",\n\t];\n\n\tif (files.length > 0) {\n\t\tlines.push(\"<restored-files>\");\n\t\tfor (const file of files) {\n\t\t\tlines.push(`<file label=\"${escapeXmlAttribute(file.label)}\">${file.content}</file>`);\n\t\t}\n\t\tlines.push(\"</restored-files>\");\n\t\tlines.push(\"\");\n\t}\n\n\tif (skills.length > 0) {\n\t\tlines.push(\"<restored-skills>\");\n\t\tfor (const skill of skills) {\n\t\t\tlines.push(`<skill label=\"${escapeXmlAttribute(skill.label)}\">${skill.content}</skill>`);\n\t\t}\n\t\tlines.push(\"</restored-skills>\");\n\t\tlines.push(\"\");\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction truncateRestorationItem(item: RestorationItem, maxTokens: number): RestorationItem {\n\tif (item.tokens <= maxTokens) return item;\n\tconst truncationNotice = \"[... truncated]\";\n\tconst noticeTokens = estimateTextTokens(truncationNotice);\n\tconst targetTokens = Math.max(0, maxTokens - noticeTokens - 1);\n\tconst truncatedBody = truncateToTokenLimit(item.content, targetTokens);\n\tconst content = truncatedBody.length > 0 ? `${truncatedBody}\\n${truncationNotice}` : truncationNotice;\n\treturn { ...item, content, tokens: estimateTextTokens(content) };\n}\n\nfunction filterAgainstKeptMessages(state: RestorationTrackerState, keptMessages: AgentMessage[]): void {\n\tif (keptMessages.length === 0) return;\n\tconst keptText = keptMessages.map(extractMessageText).join(\"\\n\");\n\tfor (const label of state.items.keys()) {\n\t\tif (keptText.includes(label)) {\n\t\t\tstate.items.delete(label);\n\t\t}\n\t}\n}\n\nfunction extractMessageText(message: AgentMessage): string {\n\tif (\"content\" in message) {\n\t\tif (typeof message.content === \"string\") return message.content;\n\t\tif (Array.isArray(message.content)) {\n\t\t\treturn message.content\n\t\t\t\t.filter((content): content is { type: \"text\"; text: string } => content.type === \"text\")\n\t\t\t\t.map((content) => content.text)\n\t\t\t\t.join(\"\\n\");\n\t\t}\n\t}\n\tif (\"summary\" in message) return message.summary;\n\tif (\"command\" in message) return `${message.command}\\n${message.output}`;\n\treturn \"\";\n}\n\nfunction truncateToTokenLimit(text: string, tokenLimit: number): string {\n\tif (tokenLimit <= 0 || text.length === 0) return \"\";\n\tif (estimateTextTokens(text) <= tokenLimit) return text;\n\n\tlet low = 0;\n\tlet high = text.length;\n\twhile (low < high) {\n\t\tconst mid = Math.ceil((low + high) / 2);\n\t\tconst candidate = text.slice(0, mid);\n\t\tif (estimateTextTokens(candidate) <= tokenLimit) {\n\t\t\tlow = mid;\n\t\t\tcontinue;\n\t\t}\n\t\thigh = mid - 1;\n\t}\n\treturn text.slice(0, low).trimEnd();\n}\n\nfunction resolveSettings(settings: RestorationSettings | undefined): Required<RestorationSettings> {\n\treturn {\n\t\trestorationMaxItems: normalizeNonNegativeInteger(settings?.restorationMaxItems, DEFAULT_RESTORATION_MAX_ITEMS),\n\t\trestorationMaxTokensPerItem: normalizeNonNegativeInteger(\n\t\t\tsettings?.restorationMaxTokensPerItem,\n\t\t\tDEFAULT_RESTORATION_MAX_TOKENS_PER_ITEM,\n\t\t),\n\t\trestorationMaxTotalTokens: normalizeNonNegativeInteger(\n\t\t\tsettings?.restorationMaxTotalTokens,\n\t\t\tDEFAULT_RESTORATION_MAX_TOTAL_TOKENS,\n\t\t),\n\t\trestorationContextRatio: normalizeNonNegativeNumber(\n\t\t\tsettings?.restorationContextRatio,\n\t\t\tDEFAULT_RESTORATION_CONTEXT_RATIO,\n\t\t),\n\t};\n}\n\nfunction normalizeNonNegativeInteger(value: number | undefined, fallback: number): number {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;\n}\n\nfunction normalizeNonNegativeNumber(value: number | undefined, fallback: number): number {\n\treturn typeof value === \"number\" && Number.isFinite(value) && value >= 0 ? value : fallback;\n}\n\nfunction parseFileOperations(content: string | undefined): FileOperation[] {\n\tif (!content) return [];\n\tconst open = content.lastIndexOf(\"(\");\n\tconst close = content.lastIndexOf(\")\");\n\tif (open === -1 || close === -1 || close <= open) return [];\n\treturn content\n\t\t.slice(open + 1, close)\n\t\t.split(\",\")\n\t\t.map((operation) => operation.trim())\n\t\t.filter(\n\t\t\t(operation): operation is FileOperation =>\n\t\t\t\toperation === \"read\" || operation === \"write\" || operation === \"edit\",\n\t\t);\n}\n\nfunction sortOperations(operations: Set<FileOperation>): FileOperation[] {\n\tconst order: FileOperation[] = [\"read\", \"write\", \"edit\"];\n\treturn order.filter((operation) => operations.has(operation));\n}\n\nfunction estimateTextTokens(text: string): number {\n\treturn estimateTokens({ role: \"custom\", customType: \"restoration\", content: text, display: false, timestamp: 0 });\n}\n\nfunction escapeXmlAttribute(value: string): string {\n\treturn value.replace(/&/g, \"&\").replace(/\"/g, \""\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n"]}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { estimateTokens } from "../../../compaction/index.js";
|
|
2
|
+
import { extractPatchedPaths } from "../gpt-apply-patch/index.js";
|
|
3
|
+
export const POST_COMPACT_RESTORATION_CUSTOM_TYPE = "compaction.post-compact-restoration";
|
|
4
|
+
const POST_COMPACT_RESTORATION_SCHEMA = "senpi.compaction.post-compact-restoration.v1";
|
|
5
|
+
const DEFAULT_RESTORATION_MAX_ITEMS = 10;
|
|
6
|
+
const DEFAULT_RESTORATION_MAX_TOKENS_PER_ITEM = 5000;
|
|
7
|
+
const DEFAULT_RESTORATION_MAX_TOTAL_TOKENS = 50_000;
|
|
8
|
+
const DEFAULT_RESTORATION_CONTEXT_RATIO = 0.15;
|
|
9
|
+
export function createRestorationTrackerState() {
|
|
10
|
+
return {
|
|
11
|
+
items: new Map(),
|
|
12
|
+
restoredLabels: new Set(),
|
|
13
|
+
pendingPayload: null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function trackToolCall(state, event) {
|
|
17
|
+
switch (event.toolName) {
|
|
18
|
+
case "read":
|
|
19
|
+
trackPathInput(state, event.input, "read");
|
|
20
|
+
return;
|
|
21
|
+
case "write":
|
|
22
|
+
trackPathInput(state, event.input, "write");
|
|
23
|
+
return;
|
|
24
|
+
case "edit":
|
|
25
|
+
trackPathInput(state, event.input, "edit");
|
|
26
|
+
return;
|
|
27
|
+
case "apply_patch":
|
|
28
|
+
trackApplyPatchInput(state, event.input);
|
|
29
|
+
return;
|
|
30
|
+
case "skill":
|
|
31
|
+
case "load_skill":
|
|
32
|
+
trackSkillInput(state, event.input);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function preparePendingPayload(state, options) {
|
|
37
|
+
if (!options.accepted)
|
|
38
|
+
return;
|
|
39
|
+
const budgetTokens = computeRestorationBudget(options);
|
|
40
|
+
if (budgetTokens <= 0) {
|
|
41
|
+
state.pendingPayload = null;
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
filterAgainstKeptMessages(state, options.keptMessages ?? []);
|
|
45
|
+
const selectedItems = selectRestorationItems(state, options.settings, budgetTokens);
|
|
46
|
+
if (selectedItems.length === 0) {
|
|
47
|
+
state.pendingPayload = null;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const content = buildRestorationContent(options, selectedItems);
|
|
51
|
+
state.pendingPayload = {
|
|
52
|
+
customType: POST_COMPACT_RESTORATION_CUSTOM_TYPE,
|
|
53
|
+
content,
|
|
54
|
+
display: false,
|
|
55
|
+
details: {
|
|
56
|
+
schema: POST_COMPACT_RESTORATION_SCHEMA,
|
|
57
|
+
budgetTokens,
|
|
58
|
+
compactionEntryId: options.compactionEntryId,
|
|
59
|
+
reason: options.reason,
|
|
60
|
+
items: selectedItems,
|
|
61
|
+
},
|
|
62
|
+
budgetTokens,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function consumePendingPayload(state) {
|
|
66
|
+
const payload = state.pendingPayload;
|
|
67
|
+
state.pendingPayload = null;
|
|
68
|
+
if (!payload)
|
|
69
|
+
return undefined;
|
|
70
|
+
for (const item of payload.details.items) {
|
|
71
|
+
state.restoredLabels.add(item.label);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
customType: payload.customType,
|
|
75
|
+
content: payload.content,
|
|
76
|
+
display: payload.display,
|
|
77
|
+
details: payload.details,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export function computeRestorationBudget(options) {
|
|
81
|
+
const settings = resolveSettings(options.settings);
|
|
82
|
+
const contextWindow = Math.max(0, options.contextWindow);
|
|
83
|
+
const configuredBudget = settings.restorationMaxTotalTokens;
|
|
84
|
+
const contextRatioBudget = Math.floor(contextWindow * settings.restorationContextRatio);
|
|
85
|
+
const usageTokens = Math.max(0, options.usageTokens ?? 0);
|
|
86
|
+
const remainingBudget = Math.max(0, contextWindow - usageTokens - options.reserveTokens);
|
|
87
|
+
return Math.floor(Math.min(configuredBudget, contextRatioBudget, remainingBudget));
|
|
88
|
+
}
|
|
89
|
+
function trackPathInput(state, input, operation) {
|
|
90
|
+
if (typeof input.path !== "string" || input.path.length === 0)
|
|
91
|
+
return;
|
|
92
|
+
trackFile(state, input.path, operation);
|
|
93
|
+
}
|
|
94
|
+
function trackApplyPatchInput(state, input) {
|
|
95
|
+
if (typeof input.input !== "string")
|
|
96
|
+
return;
|
|
97
|
+
for (const path of extractPatchedPaths(input.input)) {
|
|
98
|
+
if (path.length > 0)
|
|
99
|
+
trackFile(state, path, "edit");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function trackSkillInput(state, input) {
|
|
103
|
+
const skillName = typeof input.name === "string" ? input.name : input.skillName;
|
|
104
|
+
if (typeof skillName === "string" && skillName.length > 0) {
|
|
105
|
+
setItem(state, {
|
|
106
|
+
content: skillName,
|
|
107
|
+
label: skillName,
|
|
108
|
+
priority: 80,
|
|
109
|
+
tokens: estimateTextTokens(skillName),
|
|
110
|
+
type: "skill",
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function trackFile(state, path, operation) {
|
|
115
|
+
const label = path;
|
|
116
|
+
const existing = state.items.get(label);
|
|
117
|
+
const operations = new Set(parseFileOperations(existing?.content));
|
|
118
|
+
operations.add(operation);
|
|
119
|
+
const content = `${path} (${sortOperations(operations).join(", ")})`;
|
|
120
|
+
setItem(state, {
|
|
121
|
+
content,
|
|
122
|
+
label,
|
|
123
|
+
priority: operation === "read" && operations.size === 1 ? 50 : 100,
|
|
124
|
+
tokens: estimateTextTokens(content),
|
|
125
|
+
type: "file",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function setItem(state, item) {
|
|
129
|
+
state.items.set(item.label, item);
|
|
130
|
+
}
|
|
131
|
+
function selectRestorationItems(state, settingsInput, budgetTokens) {
|
|
132
|
+
const settings = resolveSettings(settingsInput);
|
|
133
|
+
const candidates = Array.from(state.items.values())
|
|
134
|
+
.filter((item) => !state.restoredLabels.has(item.label))
|
|
135
|
+
.map((item) => truncateRestorationItem(item, settings.restorationMaxTokensPerItem))
|
|
136
|
+
.sort((left, right) => {
|
|
137
|
+
if (left.priority !== right.priority)
|
|
138
|
+
return right.priority - left.priority;
|
|
139
|
+
if (left.tokens !== right.tokens)
|
|
140
|
+
return left.tokens - right.tokens;
|
|
141
|
+
return left.label.localeCompare(right.label);
|
|
142
|
+
});
|
|
143
|
+
const selected = [];
|
|
144
|
+
let totalTokens = 0;
|
|
145
|
+
for (const item of candidates) {
|
|
146
|
+
if (selected.length >= settings.restorationMaxItems)
|
|
147
|
+
break;
|
|
148
|
+
if (totalTokens + item.tokens > budgetTokens)
|
|
149
|
+
continue;
|
|
150
|
+
selected.push(item);
|
|
151
|
+
totalTokens += item.tokens;
|
|
152
|
+
}
|
|
153
|
+
return selected;
|
|
154
|
+
}
|
|
155
|
+
function buildRestorationContent(options, items) {
|
|
156
|
+
const files = items.filter((item) => item.type === "file");
|
|
157
|
+
const skills = items.filter((item) => item.type === "skill");
|
|
158
|
+
const lines = [
|
|
159
|
+
"[Restored context after compaction — files and skills from before compaction]",
|
|
160
|
+
`reason: ${options.reason}`,
|
|
161
|
+
`compactionEntryId: ${options.compactionEntryId}`,
|
|
162
|
+
"",
|
|
163
|
+
];
|
|
164
|
+
if (files.length > 0) {
|
|
165
|
+
lines.push("<restored-files>");
|
|
166
|
+
for (const file of files) {
|
|
167
|
+
lines.push(`<file label="${escapeXmlAttribute(file.label)}">${file.content}</file>`);
|
|
168
|
+
}
|
|
169
|
+
lines.push("</restored-files>");
|
|
170
|
+
lines.push("");
|
|
171
|
+
}
|
|
172
|
+
if (skills.length > 0) {
|
|
173
|
+
lines.push("<restored-skills>");
|
|
174
|
+
for (const skill of skills) {
|
|
175
|
+
lines.push(`<skill label="${escapeXmlAttribute(skill.label)}">${skill.content}</skill>`);
|
|
176
|
+
}
|
|
177
|
+
lines.push("</restored-skills>");
|
|
178
|
+
lines.push("");
|
|
179
|
+
}
|
|
180
|
+
return lines.join("\n");
|
|
181
|
+
}
|
|
182
|
+
function truncateRestorationItem(item, maxTokens) {
|
|
183
|
+
if (item.tokens <= maxTokens)
|
|
184
|
+
return item;
|
|
185
|
+
const truncationNotice = "[... truncated]";
|
|
186
|
+
const noticeTokens = estimateTextTokens(truncationNotice);
|
|
187
|
+
const targetTokens = Math.max(0, maxTokens - noticeTokens - 1);
|
|
188
|
+
const truncatedBody = truncateToTokenLimit(item.content, targetTokens);
|
|
189
|
+
const content = truncatedBody.length > 0 ? `${truncatedBody}\n${truncationNotice}` : truncationNotice;
|
|
190
|
+
return { ...item, content, tokens: estimateTextTokens(content) };
|
|
191
|
+
}
|
|
192
|
+
function filterAgainstKeptMessages(state, keptMessages) {
|
|
193
|
+
if (keptMessages.length === 0)
|
|
194
|
+
return;
|
|
195
|
+
const keptText = keptMessages.map(extractMessageText).join("\n");
|
|
196
|
+
for (const label of state.items.keys()) {
|
|
197
|
+
if (keptText.includes(label)) {
|
|
198
|
+
state.items.delete(label);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function extractMessageText(message) {
|
|
203
|
+
if ("content" in message) {
|
|
204
|
+
if (typeof message.content === "string")
|
|
205
|
+
return message.content;
|
|
206
|
+
if (Array.isArray(message.content)) {
|
|
207
|
+
return message.content
|
|
208
|
+
.filter((content) => content.type === "text")
|
|
209
|
+
.map((content) => content.text)
|
|
210
|
+
.join("\n");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if ("summary" in message)
|
|
214
|
+
return message.summary;
|
|
215
|
+
if ("command" in message)
|
|
216
|
+
return `${message.command}\n${message.output}`;
|
|
217
|
+
return "";
|
|
218
|
+
}
|
|
219
|
+
function truncateToTokenLimit(text, tokenLimit) {
|
|
220
|
+
if (tokenLimit <= 0 || text.length === 0)
|
|
221
|
+
return "";
|
|
222
|
+
if (estimateTextTokens(text) <= tokenLimit)
|
|
223
|
+
return text;
|
|
224
|
+
let low = 0;
|
|
225
|
+
let high = text.length;
|
|
226
|
+
while (low < high) {
|
|
227
|
+
const mid = Math.ceil((low + high) / 2);
|
|
228
|
+
const candidate = text.slice(0, mid);
|
|
229
|
+
if (estimateTextTokens(candidate) <= tokenLimit) {
|
|
230
|
+
low = mid;
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
high = mid - 1;
|
|
234
|
+
}
|
|
235
|
+
return text.slice(0, low).trimEnd();
|
|
236
|
+
}
|
|
237
|
+
function resolveSettings(settings) {
|
|
238
|
+
return {
|
|
239
|
+
restorationMaxItems: normalizeNonNegativeInteger(settings?.restorationMaxItems, DEFAULT_RESTORATION_MAX_ITEMS),
|
|
240
|
+
restorationMaxTokensPerItem: normalizeNonNegativeInteger(settings?.restorationMaxTokensPerItem, DEFAULT_RESTORATION_MAX_TOKENS_PER_ITEM),
|
|
241
|
+
restorationMaxTotalTokens: normalizeNonNegativeInteger(settings?.restorationMaxTotalTokens, DEFAULT_RESTORATION_MAX_TOTAL_TOKENS),
|
|
242
|
+
restorationContextRatio: normalizeNonNegativeNumber(settings?.restorationContextRatio, DEFAULT_RESTORATION_CONTEXT_RATIO),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function normalizeNonNegativeInteger(value, fallback) {
|
|
246
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : fallback;
|
|
247
|
+
}
|
|
248
|
+
function normalizeNonNegativeNumber(value, fallback) {
|
|
249
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : fallback;
|
|
250
|
+
}
|
|
251
|
+
function parseFileOperations(content) {
|
|
252
|
+
if (!content)
|
|
253
|
+
return [];
|
|
254
|
+
const open = content.lastIndexOf("(");
|
|
255
|
+
const close = content.lastIndexOf(")");
|
|
256
|
+
if (open === -1 || close === -1 || close <= open)
|
|
257
|
+
return [];
|
|
258
|
+
return content
|
|
259
|
+
.slice(open + 1, close)
|
|
260
|
+
.split(",")
|
|
261
|
+
.map((operation) => operation.trim())
|
|
262
|
+
.filter((operation) => operation === "read" || operation === "write" || operation === "edit");
|
|
263
|
+
}
|
|
264
|
+
function sortOperations(operations) {
|
|
265
|
+
const order = ["read", "write", "edit"];
|
|
266
|
+
return order.filter((operation) => operations.has(operation));
|
|
267
|
+
}
|
|
268
|
+
function estimateTextTokens(text) {
|
|
269
|
+
return estimateTokens({ role: "custom", customType: "restoration", content: text, display: false, timestamp: 0 });
|
|
270
|
+
}
|
|
271
|
+
function escapeXmlAttribute(value) {
|
|
272
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=restoration-tracker.js.map
|