@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 @@
|
|
|
1
|
+
{"version":3,"file":"preview-format.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/preview-format.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEX,iBAAiB,EAEjB,qBAAqB,EACrB,eAAe,EACf,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAkB5C,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQpD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAWjE;AAcD,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,iBAAiB,EAC1B,GAAG,GAAE,MAAsB,EAC3B,QAAQ,GAAE,OAAc,GACtB,MAAM,CA8BR;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMhE;AA4JD,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,qBAAqB,CA6BlH;AAED,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,OAAO,GACf,MAAM,CA6CR;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,CAO5E","sourcesContent":["import path from \"node:path\";\nimport * as Diff from \"diff\";\nimport { getLanguageFromPath, highlightCode } from \"../../../../modes/interactive/theme/theme.js\";\nimport { parsePatch } from \"./parser.js\";\nimport { extractPatchedPaths } from \"./text.js\";\nimport type {\n\tApplyPatchOperation,\n\tApplyPatchPreview,\n\tApplyPatchPreviewFile,\n\tApplyPatchRenderState,\n\tApplyPatchTheme,\n} from \"./types.js\";\n\nexport const PATCH_PREVIEW_MAX_LINES = 16;\nexport const PATCH_PREVIEW_MAX_CHARS = 4000;\nconst PATCH_PREVIEW_HEAD_LINES = 8;\nconst PATCH_PREVIEW_TAIL_LINES = 8;\nconst applyPatchRenderStates = new Map<string, ApplyPatchRenderState>();\n\nfunction formatLineCountSummary(added: number, removed: number): string {\n\treturn `(+${added} -${removed})`;\n}\n\nfunction countLines(text: string): number {\n\tif (text.length === 0) return 0;\n\tlet lines = 1;\n\tfor (let index = 0; index < text.length; index++) {\n\t\tif (text.charCodeAt(index) === 10) lines += 1;\n\t}\n\treturn lines;\n}\n\nexport function truncatePreview(text: string): string {\n\tif (text.length <= PATCH_PREVIEW_MAX_CHARS && countLines(text) <= PATCH_PREVIEW_MAX_LINES) return text;\n\tconst lines = text.split(\"\\n\");\n\tconst head = lines.slice(0, PATCH_PREVIEW_HEAD_LINES);\n\tconst tail = lines.slice(-PATCH_PREVIEW_TAIL_LINES);\n\tlet preview = [...head, \"…\", ...tail].join(\"\\n\");\n\tif (preview.length > PATCH_PREVIEW_MAX_CHARS) preview = `${preview.slice(0, PATCH_PREVIEW_MAX_CHARS).trimEnd()}\\n…`;\n\treturn preview;\n}\n\nexport function displayPath(filePath: string, cwd: string): string {\n\tif (!path.isAbsolute(filePath)) return filePath;\n\tconst absoluteCwd = path.resolve(cwd);\n\tconst relativePath = path.relative(absoluteCwd, filePath);\n\tif (\n\t\trelativePath === \"\" ||\n\t\t(!relativePath.startsWith(`..${path.sep}`) && relativePath !== \"..\" && !path.isAbsolute(relativePath))\n\t) {\n\t\treturn relativePath || \".\";\n\t}\n\treturn filePath;\n}\n\nfunction formatPatchFilePath(file: ApplyPatchPreviewFile, cwd: string = process.cwd()): string {\n\tconst filePath = displayPath(file.filePath, cwd);\n\tif (!file.movePath) return filePath;\n\treturn `${filePath} → ${displayPath(file.movePath, cwd)}`;\n}\n\nfunction formatPatchOperation(operation: ApplyPatchOperation): string {\n\tif (operation === \"add\") return \"Added\";\n\tif (operation === \"delete\") return \"Deleted\";\n\treturn \"Edited\";\n}\n\nexport function formatPatchPreview(\n\tpreview: ApplyPatchPreview,\n\tcwd: string = process.cwd(),\n\texpanded: boolean = true,\n): string {\n\tconst lines: string[] = [];\n\tif (preview.files.length === 1) {\n\t\tconst file = preview.files[0];\n\t\tif (file) {\n\t\t\tlines.push(\n\t\t\t\t`• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`,\n\t\t\t);\n\t\t\tif (expanded && file.diff)\n\t\t\t\tlines.push(\n\t\t\t\t\t...truncatePreview(file.diff)\n\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t.map((line) => ` ${line}`),\n\t\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tconst noun = preview.files.length === 1 ? \"file\" : \"files\";\n\tlines.push(`• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}`);\n\tfor (const file of preview.files) {\n\t\tlines.push(` └ ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`);\n\t\tif (expanded && file.diff)\n\t\t\tlines.push(\n\t\t\t\t...truncatePreview(file.diff)\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => ` ${line}`),\n\t\t\t);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function formatInFlightCallText(patchText: string): string {\n\tconst paths = extractPatchedPaths(patchText);\n\tif (paths.length === 0) return \"Patching\";\n\tconst noun = paths.length === 1 ? \"file\" : \"files\";\n\tconst count = paths.length > 1 ? ` (${paths.length} ${noun})` : \"\";\n\treturn `Patching${count}: ${paths.join(\", \")}`;\n}\n\ntype RenderableAddedDiffLine = { content: string; kind: \"added\"; lineNumber: string; sign: \"+\" };\ntype RenderableRemovedDiffLine = { content: string; kind: \"removed\"; lineNumber: string; sign: \"-\" };\ntype RenderableContextDiffLine = { content: string; kind: \"context\"; lineNumber: string; sign: \" \" };\ntype RenderableContentDiffLine = RenderableAddedDiffLine | RenderableContextDiffLine | RenderableRemovedDiffLine;\ntype RenderableDiffLine = RenderableContentDiffLine | { kind: \"meta\"; text: string };\n\nfunction parseRenderableDiffLine(line: string): RenderableDiffLine {\n\tconst match = line.match(/^([+\\- ])(\\s*\\d+)\\s(.*)$/);\n\tif (!match) return { kind: \"meta\", text: line };\n\n\tconst sign = match[1];\n\tconst lineNumber = match[2];\n\tif ((sign !== \"+\" && sign !== \"-\" && sign !== \" \") || lineNumber === undefined) return { kind: \"meta\", text: line };\n\n\tconst content = match[3] ?? \"\";\n\tif (sign === \"+\") return { content, kind: \"added\", lineNumber, sign };\n\tif (sign === \"-\") return { content, kind: \"removed\", lineNumber, sign };\n\treturn { content, kind: \"context\", lineNumber, sign };\n}\n\nfunction replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nfunction highlightDiffContent(content: string, filePath: string): string {\n\tconst plainContent = replaceTabs(content);\n\tconst language = getLanguageFromPath(filePath);\n\ttry {\n\t\treturn highlightCode(plainContent, language)[0] ?? plainContent;\n\t} catch {\n\t\treturn plainContent;\n\t}\n}\n\nfunction renderInlineDiff(\n\toldContent: string,\n\tnewContent: string,\n\ttheme: ApplyPatchTheme,\n): { added: string; removed: string } {\n\tconst parts = Diff.diffWords(replaceTabs(oldContent), replaceTabs(newContent));\n\tlet added = \"\";\n\tlet removed = \"\";\n\tlet firstAdded = true;\n\tlet firstRemoved = true;\n\n\tfor (const part of parts) {\n\t\tif (part.added) {\n\t\t\tlet value = part.value;\n\t\t\tif (firstAdded) {\n\t\t\t\tconst leadingWhitespace = value.match(/^(\\s*)/)?.[1] ?? \"\";\n\t\t\t\tadded += leadingWhitespace;\n\t\t\t\tvalue = value.slice(leadingWhitespace.length);\n\t\t\t\tfirstAdded = false;\n\t\t\t}\n\t\t\tif (value) added += theme.inverse(value);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (part.removed) {\n\t\t\tlet value = part.value;\n\t\t\tif (firstRemoved) {\n\t\t\t\tconst leadingWhitespace = value.match(/^(\\s*)/)?.[1] ?? \"\";\n\t\t\t\tremoved += leadingWhitespace;\n\t\t\t\tvalue = value.slice(leadingWhitespace.length);\n\t\t\t\tfirstRemoved = false;\n\t\t\t}\n\t\t\tif (value) removed += theme.inverse(value);\n\t\t\tcontinue;\n\t\t}\n\n\t\tadded += part.value;\n\t\tremoved += part.value;\n\t}\n\n\treturn { added, removed };\n}\n\nfunction renderOpenCodeLikeDiffLine(\n\tline: RenderableContentDiffLine,\n\tfilePath: string,\n\ttheme: ApplyPatchTheme,\n\tcontentOverride?: string,\n): string {\n\tconst lineNumber = theme.fg(\"muted\", line.lineNumber);\n\tif (line.kind === \"context\") {\n\t\treturn `${theme.fg(\"toolDiffContext\", line.sign)}${lineNumber} ${highlightDiffContent(line.content, filePath)}`;\n\t}\n\n\tconst diffColor = line.kind === \"added\" ? \"toolDiffAdded\" : \"toolDiffRemoved\";\n\tconst background = line.kind === \"added\" ? \"toolSuccessBg\" : \"toolErrorBg\";\n\tconst content =\n\t\tcontentOverride === undefined\n\t\t\t? highlightDiffContent(line.content, filePath)\n\t\t\t: theme.fg(diffColor, replaceTabs(contentOverride));\n\tconst rendered = `${theme.fg(diffColor, line.sign)}${lineNumber} ${content}`;\n\treturn theme.bg(background, rendered);\n}\n\nfunction renderOpenCodeLikeDiff(diffText: string, filePath: string, theme: ApplyPatchTheme): string {\n\tconst parsedLines = diffText.split(\"\\n\").map(parseRenderableDiffLine);\n\tconst rendered: string[] = [];\n\tlet index = 0;\n\n\twhile (index < parsedLines.length) {\n\t\tconst line = parsedLines[index];\n\t\tif (!line) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.kind !== \"removed\") {\n\t\t\trendered.push(\n\t\t\t\tline.kind === \"meta\"\n\t\t\t\t\t? theme.fg(\"toolDiffContext\", line.text)\n\t\t\t\t\t: renderOpenCodeLikeDiffLine(line, filePath, theme),\n\t\t\t);\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst removedLines: RenderableRemovedDiffLine[] = [];\n\t\twhile (parsedLines[index]?.kind === \"removed\") {\n\t\t\tconst removedLine = parsedLines[index];\n\t\t\tif (removedLine?.kind === \"removed\") removedLines.push(removedLine);\n\t\t\tindex++;\n\t\t}\n\n\t\tconst addedLines: RenderableAddedDiffLine[] = [];\n\t\twhile (parsedLines[index]?.kind === \"added\") {\n\t\t\tconst addedLine = parsedLines[index];\n\t\t\tif (addedLine?.kind === \"added\") addedLines.push(addedLine);\n\t\t\tindex++;\n\t\t}\n\n\t\tconst pairedCount = Math.min(removedLines.length, addedLines.length);\n\t\tfor (let pairIndex = 0; pairIndex < pairedCount; pairIndex++) {\n\t\t\tconst removedLine = removedLines[pairIndex];\n\t\t\tconst addedLine = addedLines[pairIndex];\n\t\t\tif (!removedLine || !addedLine) continue;\n\n\t\t\tconst inline = renderInlineDiff(removedLine.content, addedLine.content, theme);\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme, inline.removed));\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme, inline.added));\n\t\t}\n\n\t\tfor (const removedLine of removedLines.slice(pairedCount))\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme));\n\t\tfor (const addedLine of addedLines.slice(pairedCount))\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme));\n\t}\n\n\treturn rendered.join(\"\\n\");\n}\n\nexport function getApplyPatchRenderState(toolCallId: string, cwd: string, patchText: string): ApplyPatchRenderState {\n\tconst existing = applyPatchRenderStates.get(toolCallId);\n\tif (existing && existing.cwd === cwd && existing.patchText === patchText) return existing;\n\n\tconst callText = formatInFlightCallText(patchText);\n\tlet collapsed = \"\";\n\tlet expanded = \"\";\n\ttry {\n\t\tconst hunks = parsePatch(patchText);\n\t\tif (hunks.length > 0) {\n\t\t\tconst files = hunks.map((hunk) => ({\n\t\t\t\tfilePath: hunk.filePath,\n\t\t\t\tmovePath: hunk.type === \"update\" ? hunk.movePath : undefined,\n\t\t\t\toperation: hunk.type,\n\t\t\t\tdiff: \"\",\n\t\t\t\tadded: 0,\n\t\t\t\tremoved: 0,\n\t\t\t})) satisfies ApplyPatchPreviewFile[];\n\t\t\tconst preview: ApplyPatchPreview = { files, added: 0, removed: 0 };\n\t\t\tcollapsed = formatPatchPreview(preview, cwd, false);\n\t\t\texpanded = formatPatchPreview(preview, cwd, true);\n\t\t}\n\t} catch {\n\t\t// ignore incomplete patch text\n\t}\n\n\tconst nextState: ApplyPatchRenderState = { ...existing, cwd, patchText, callText, collapsed, expanded };\n\tapplyPatchRenderStates.set(toolCallId, nextState);\n\treturn nextState;\n}\n\nexport function clearApplyPatchRenderState(): void {\n\tapplyPatchRenderStates.clear();\n}\n\nexport function renderPatchPreview(\n\tpreview: ApplyPatchPreview,\n\tcwd: string,\n\ttheme: ApplyPatchTheme,\n\texpanded: boolean,\n): string {\n\tif (expanded) {\n\t\ttry {\n\t\t\tconst renderFile = (file: ApplyPatchPreviewFile, headerPrefix: string): string => {\n\t\t\t\tconst header = `• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;\n\t\t\t\tif (!file.diff) {\n\t\t\t\t\treturn headerPrefix.length > 0\n\t\t\t\t\t\t? `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`\n\t\t\t\t\t\t: header;\n\t\t\t\t}\n\n\t\t\t\tconst renderedDiff = renderOpenCodeLikeDiff(\n\t\t\t\t\ttruncatePreview(file.diff),\n\t\t\t\t\tfile.movePath ?? file.filePath,\n\t\t\t\t\ttheme,\n\t\t\t\t);\n\t\t\t\tif (headerPrefix.length > 0) {\n\t\t\t\t\tconst nestedHeader = `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;\n\t\t\t\t\treturn `${nestedHeader}\\n${renderedDiff\n\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t\t.join(\"\\n\")}`;\n\t\t\t\t}\n\t\t\t\treturn `${header}\\n${renderedDiff}`;\n\t\t\t};\n\n\t\t\tif (preview.files.length === 1) {\n\t\t\t\tconst file = preview.files[0];\n\t\t\t\treturn file ? renderFile(file, \"\") : \"\";\n\t\t\t}\n\n\t\t\tconst noun = preview.files.length === 1 ? \"file\" : \"files\";\n\t\t\tconst renderedFiles = preview.files.map((file) => renderFile(file, \" └ \")).join(\"\\n\");\n\t\t\tif (renderedFiles.length > 0) {\n\t\t\t\treturn `• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}\\n${renderedFiles}`;\n\t\t\t}\n\t\t} catch {\n\t\t\t// fall back to manual themed line rendering\n\t\t}\n\t}\n\n\treturn formatPatchPreview(preview, cwd, expanded)\n\t\t.split(\"\\n\")\n\t\t.map((line) => renderPatchLine(line, theme))\n\t\t.join(\"\\n\");\n}\n\nexport function formatPendingPatchPaths(patchText: string): string {\n\tconst paths = extractPatchedPaths(patchText);\n\tif (paths.length === 0) return \"Applying patch...\";\n\treturn `Applying patch...\\n${paths.map((filePath) => `• ${filePath}`).join(\"\\n\")}`;\n}\n\nexport function renderPatchLine(line: string, theme: ApplyPatchTheme): string {\n\tconst trimmed = line.trimStart();\n\tif (trimmed.startsWith(\"+\")) return theme.fg(\"toolDiffAdded\", line);\n\tif (trimmed.startsWith(\"-\")) return theme.fg(\"toolDiffRemoved\", line);\n\tif (trimmed.startsWith(\"•\")) return theme.fg(\"toolTitle\", theme.bold(line));\n\tif (trimmed.startsWith(\"└\")) return theme.fg(\"accent\", line);\n\treturn theme.fg(\"toolDiffContext\", line);\n}\n"]}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import * as Diff from "diff";
|
|
3
|
+
import { getLanguageFromPath, highlightCode } from "../../../../modes/interactive/theme/theme.js";
|
|
4
|
+
import { parsePatch } from "./parser.js";
|
|
5
|
+
import { extractPatchedPaths } from "./text.js";
|
|
6
|
+
export const PATCH_PREVIEW_MAX_LINES = 16;
|
|
7
|
+
export const PATCH_PREVIEW_MAX_CHARS = 4000;
|
|
8
|
+
const PATCH_PREVIEW_HEAD_LINES = 8;
|
|
9
|
+
const PATCH_PREVIEW_TAIL_LINES = 8;
|
|
10
|
+
const applyPatchRenderStates = new Map();
|
|
11
|
+
function formatLineCountSummary(added, removed) {
|
|
12
|
+
return `(+${added} -${removed})`;
|
|
13
|
+
}
|
|
14
|
+
function countLines(text) {
|
|
15
|
+
if (text.length === 0)
|
|
16
|
+
return 0;
|
|
17
|
+
let lines = 1;
|
|
18
|
+
for (let index = 0; index < text.length; index++) {
|
|
19
|
+
if (text.charCodeAt(index) === 10)
|
|
20
|
+
lines += 1;
|
|
21
|
+
}
|
|
22
|
+
return lines;
|
|
23
|
+
}
|
|
24
|
+
export function truncatePreview(text) {
|
|
25
|
+
if (text.length <= PATCH_PREVIEW_MAX_CHARS && countLines(text) <= PATCH_PREVIEW_MAX_LINES)
|
|
26
|
+
return text;
|
|
27
|
+
const lines = text.split("\n");
|
|
28
|
+
const head = lines.slice(0, PATCH_PREVIEW_HEAD_LINES);
|
|
29
|
+
const tail = lines.slice(-PATCH_PREVIEW_TAIL_LINES);
|
|
30
|
+
let preview = [...head, "…", ...tail].join("\n");
|
|
31
|
+
if (preview.length > PATCH_PREVIEW_MAX_CHARS)
|
|
32
|
+
preview = `${preview.slice(0, PATCH_PREVIEW_MAX_CHARS).trimEnd()}\n…`;
|
|
33
|
+
return preview;
|
|
34
|
+
}
|
|
35
|
+
export function displayPath(filePath, cwd) {
|
|
36
|
+
if (!path.isAbsolute(filePath))
|
|
37
|
+
return filePath;
|
|
38
|
+
const absoluteCwd = path.resolve(cwd);
|
|
39
|
+
const relativePath = path.relative(absoluteCwd, filePath);
|
|
40
|
+
if (relativePath === "" ||
|
|
41
|
+
(!relativePath.startsWith(`..${path.sep}`) && relativePath !== ".." && !path.isAbsolute(relativePath))) {
|
|
42
|
+
return relativePath || ".";
|
|
43
|
+
}
|
|
44
|
+
return filePath;
|
|
45
|
+
}
|
|
46
|
+
function formatPatchFilePath(file, cwd = process.cwd()) {
|
|
47
|
+
const filePath = displayPath(file.filePath, cwd);
|
|
48
|
+
if (!file.movePath)
|
|
49
|
+
return filePath;
|
|
50
|
+
return `${filePath} → ${displayPath(file.movePath, cwd)}`;
|
|
51
|
+
}
|
|
52
|
+
function formatPatchOperation(operation) {
|
|
53
|
+
if (operation === "add")
|
|
54
|
+
return "Added";
|
|
55
|
+
if (operation === "delete")
|
|
56
|
+
return "Deleted";
|
|
57
|
+
return "Edited";
|
|
58
|
+
}
|
|
59
|
+
export function formatPatchPreview(preview, cwd = process.cwd(), expanded = true) {
|
|
60
|
+
const lines = [];
|
|
61
|
+
if (preview.files.length === 1) {
|
|
62
|
+
const file = preview.files[0];
|
|
63
|
+
if (file) {
|
|
64
|
+
lines.push(`• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`);
|
|
65
|
+
if (expanded && file.diff)
|
|
66
|
+
lines.push(...truncatePreview(file.diff)
|
|
67
|
+
.split("\n")
|
|
68
|
+
.map((line) => ` ${line}`));
|
|
69
|
+
}
|
|
70
|
+
return lines.join("\n");
|
|
71
|
+
}
|
|
72
|
+
const noun = preview.files.length === 1 ? "file" : "files";
|
|
73
|
+
lines.push(`• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}`);
|
|
74
|
+
for (const file of preview.files) {
|
|
75
|
+
lines.push(` └ ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`);
|
|
76
|
+
if (expanded && file.diff)
|
|
77
|
+
lines.push(...truncatePreview(file.diff)
|
|
78
|
+
.split("\n")
|
|
79
|
+
.map((line) => ` ${line}`));
|
|
80
|
+
}
|
|
81
|
+
return lines.join("\n");
|
|
82
|
+
}
|
|
83
|
+
export function formatInFlightCallText(patchText) {
|
|
84
|
+
const paths = extractPatchedPaths(patchText);
|
|
85
|
+
if (paths.length === 0)
|
|
86
|
+
return "Patching";
|
|
87
|
+
const noun = paths.length === 1 ? "file" : "files";
|
|
88
|
+
const count = paths.length > 1 ? ` (${paths.length} ${noun})` : "";
|
|
89
|
+
return `Patching${count}: ${paths.join(", ")}`;
|
|
90
|
+
}
|
|
91
|
+
function parseRenderableDiffLine(line) {
|
|
92
|
+
const match = line.match(/^([+\- ])(\s*\d+)\s(.*)$/);
|
|
93
|
+
if (!match)
|
|
94
|
+
return { kind: "meta", text: line };
|
|
95
|
+
const sign = match[1];
|
|
96
|
+
const lineNumber = match[2];
|
|
97
|
+
if ((sign !== "+" && sign !== "-" && sign !== " ") || lineNumber === undefined)
|
|
98
|
+
return { kind: "meta", text: line };
|
|
99
|
+
const content = match[3] ?? "";
|
|
100
|
+
if (sign === "+")
|
|
101
|
+
return { content, kind: "added", lineNumber, sign };
|
|
102
|
+
if (sign === "-")
|
|
103
|
+
return { content, kind: "removed", lineNumber, sign };
|
|
104
|
+
return { content, kind: "context", lineNumber, sign };
|
|
105
|
+
}
|
|
106
|
+
function replaceTabs(text) {
|
|
107
|
+
return text.replace(/\t/g, " ");
|
|
108
|
+
}
|
|
109
|
+
function highlightDiffContent(content, filePath) {
|
|
110
|
+
const plainContent = replaceTabs(content);
|
|
111
|
+
const language = getLanguageFromPath(filePath);
|
|
112
|
+
try {
|
|
113
|
+
return highlightCode(plainContent, language)[0] ?? plainContent;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return plainContent;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function renderInlineDiff(oldContent, newContent, theme) {
|
|
120
|
+
const parts = Diff.diffWords(replaceTabs(oldContent), replaceTabs(newContent));
|
|
121
|
+
let added = "";
|
|
122
|
+
let removed = "";
|
|
123
|
+
let firstAdded = true;
|
|
124
|
+
let firstRemoved = true;
|
|
125
|
+
for (const part of parts) {
|
|
126
|
+
if (part.added) {
|
|
127
|
+
let value = part.value;
|
|
128
|
+
if (firstAdded) {
|
|
129
|
+
const leadingWhitespace = value.match(/^(\s*)/)?.[1] ?? "";
|
|
130
|
+
added += leadingWhitespace;
|
|
131
|
+
value = value.slice(leadingWhitespace.length);
|
|
132
|
+
firstAdded = false;
|
|
133
|
+
}
|
|
134
|
+
if (value)
|
|
135
|
+
added += theme.inverse(value);
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (part.removed) {
|
|
139
|
+
let value = part.value;
|
|
140
|
+
if (firstRemoved) {
|
|
141
|
+
const leadingWhitespace = value.match(/^(\s*)/)?.[1] ?? "";
|
|
142
|
+
removed += leadingWhitespace;
|
|
143
|
+
value = value.slice(leadingWhitespace.length);
|
|
144
|
+
firstRemoved = false;
|
|
145
|
+
}
|
|
146
|
+
if (value)
|
|
147
|
+
removed += theme.inverse(value);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
added += part.value;
|
|
151
|
+
removed += part.value;
|
|
152
|
+
}
|
|
153
|
+
return { added, removed };
|
|
154
|
+
}
|
|
155
|
+
function renderOpenCodeLikeDiffLine(line, filePath, theme, contentOverride) {
|
|
156
|
+
const lineNumber = theme.fg("muted", line.lineNumber);
|
|
157
|
+
if (line.kind === "context") {
|
|
158
|
+
return `${theme.fg("toolDiffContext", line.sign)}${lineNumber} ${highlightDiffContent(line.content, filePath)}`;
|
|
159
|
+
}
|
|
160
|
+
const diffColor = line.kind === "added" ? "toolDiffAdded" : "toolDiffRemoved";
|
|
161
|
+
const background = line.kind === "added" ? "toolSuccessBg" : "toolErrorBg";
|
|
162
|
+
const content = contentOverride === undefined
|
|
163
|
+
? highlightDiffContent(line.content, filePath)
|
|
164
|
+
: theme.fg(diffColor, replaceTabs(contentOverride));
|
|
165
|
+
const rendered = `${theme.fg(diffColor, line.sign)}${lineNumber} ${content}`;
|
|
166
|
+
return theme.bg(background, rendered);
|
|
167
|
+
}
|
|
168
|
+
function renderOpenCodeLikeDiff(diffText, filePath, theme) {
|
|
169
|
+
const parsedLines = diffText.split("\n").map(parseRenderableDiffLine);
|
|
170
|
+
const rendered = [];
|
|
171
|
+
let index = 0;
|
|
172
|
+
while (index < parsedLines.length) {
|
|
173
|
+
const line = parsedLines[index];
|
|
174
|
+
if (!line) {
|
|
175
|
+
index++;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (line.kind !== "removed") {
|
|
179
|
+
rendered.push(line.kind === "meta"
|
|
180
|
+
? theme.fg("toolDiffContext", line.text)
|
|
181
|
+
: renderOpenCodeLikeDiffLine(line, filePath, theme));
|
|
182
|
+
index++;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const removedLines = [];
|
|
186
|
+
while (parsedLines[index]?.kind === "removed") {
|
|
187
|
+
const removedLine = parsedLines[index];
|
|
188
|
+
if (removedLine?.kind === "removed")
|
|
189
|
+
removedLines.push(removedLine);
|
|
190
|
+
index++;
|
|
191
|
+
}
|
|
192
|
+
const addedLines = [];
|
|
193
|
+
while (parsedLines[index]?.kind === "added") {
|
|
194
|
+
const addedLine = parsedLines[index];
|
|
195
|
+
if (addedLine?.kind === "added")
|
|
196
|
+
addedLines.push(addedLine);
|
|
197
|
+
index++;
|
|
198
|
+
}
|
|
199
|
+
const pairedCount = Math.min(removedLines.length, addedLines.length);
|
|
200
|
+
for (let pairIndex = 0; pairIndex < pairedCount; pairIndex++) {
|
|
201
|
+
const removedLine = removedLines[pairIndex];
|
|
202
|
+
const addedLine = addedLines[pairIndex];
|
|
203
|
+
if (!removedLine || !addedLine)
|
|
204
|
+
continue;
|
|
205
|
+
const inline = renderInlineDiff(removedLine.content, addedLine.content, theme);
|
|
206
|
+
rendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme, inline.removed));
|
|
207
|
+
rendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme, inline.added));
|
|
208
|
+
}
|
|
209
|
+
for (const removedLine of removedLines.slice(pairedCount))
|
|
210
|
+
rendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme));
|
|
211
|
+
for (const addedLine of addedLines.slice(pairedCount))
|
|
212
|
+
rendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme));
|
|
213
|
+
}
|
|
214
|
+
return rendered.join("\n");
|
|
215
|
+
}
|
|
216
|
+
export function getApplyPatchRenderState(toolCallId, cwd, patchText) {
|
|
217
|
+
const existing = applyPatchRenderStates.get(toolCallId);
|
|
218
|
+
if (existing && existing.cwd === cwd && existing.patchText === patchText)
|
|
219
|
+
return existing;
|
|
220
|
+
const callText = formatInFlightCallText(patchText);
|
|
221
|
+
let collapsed = "";
|
|
222
|
+
let expanded = "";
|
|
223
|
+
try {
|
|
224
|
+
const hunks = parsePatch(patchText);
|
|
225
|
+
if (hunks.length > 0) {
|
|
226
|
+
const files = hunks.map((hunk) => ({
|
|
227
|
+
filePath: hunk.filePath,
|
|
228
|
+
movePath: hunk.type === "update" ? hunk.movePath : undefined,
|
|
229
|
+
operation: hunk.type,
|
|
230
|
+
diff: "",
|
|
231
|
+
added: 0,
|
|
232
|
+
removed: 0,
|
|
233
|
+
}));
|
|
234
|
+
const preview = { files, added: 0, removed: 0 };
|
|
235
|
+
collapsed = formatPatchPreview(preview, cwd, false);
|
|
236
|
+
expanded = formatPatchPreview(preview, cwd, true);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
// ignore incomplete patch text
|
|
241
|
+
}
|
|
242
|
+
const nextState = { ...existing, cwd, patchText, callText, collapsed, expanded };
|
|
243
|
+
applyPatchRenderStates.set(toolCallId, nextState);
|
|
244
|
+
return nextState;
|
|
245
|
+
}
|
|
246
|
+
export function clearApplyPatchRenderState() {
|
|
247
|
+
applyPatchRenderStates.clear();
|
|
248
|
+
}
|
|
249
|
+
export function renderPatchPreview(preview, cwd, theme, expanded) {
|
|
250
|
+
if (expanded) {
|
|
251
|
+
try {
|
|
252
|
+
const renderFile = (file, headerPrefix) => {
|
|
253
|
+
const header = `• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;
|
|
254
|
+
if (!file.diff) {
|
|
255
|
+
return headerPrefix.length > 0
|
|
256
|
+
? `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`
|
|
257
|
+
: header;
|
|
258
|
+
}
|
|
259
|
+
const renderedDiff = renderOpenCodeLikeDiff(truncatePreview(file.diff), file.movePath ?? file.filePath, theme);
|
|
260
|
+
if (headerPrefix.length > 0) {
|
|
261
|
+
const nestedHeader = `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;
|
|
262
|
+
return `${nestedHeader}\n${renderedDiff
|
|
263
|
+
.split("\n")
|
|
264
|
+
.map((line) => ` ${line}`)
|
|
265
|
+
.join("\n")}`;
|
|
266
|
+
}
|
|
267
|
+
return `${header}\n${renderedDiff}`;
|
|
268
|
+
};
|
|
269
|
+
if (preview.files.length === 1) {
|
|
270
|
+
const file = preview.files[0];
|
|
271
|
+
return file ? renderFile(file, "") : "";
|
|
272
|
+
}
|
|
273
|
+
const noun = preview.files.length === 1 ? "file" : "files";
|
|
274
|
+
const renderedFiles = preview.files.map((file) => renderFile(file, " └ ")).join("\n");
|
|
275
|
+
if (renderedFiles.length > 0) {
|
|
276
|
+
return `• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}\n${renderedFiles}`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
catch {
|
|
280
|
+
// fall back to manual themed line rendering
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return formatPatchPreview(preview, cwd, expanded)
|
|
284
|
+
.split("\n")
|
|
285
|
+
.map((line) => renderPatchLine(line, theme))
|
|
286
|
+
.join("\n");
|
|
287
|
+
}
|
|
288
|
+
export function formatPendingPatchPaths(patchText) {
|
|
289
|
+
const paths = extractPatchedPaths(patchText);
|
|
290
|
+
if (paths.length === 0)
|
|
291
|
+
return "Applying patch...";
|
|
292
|
+
return `Applying patch...\n${paths.map((filePath) => `• ${filePath}`).join("\n")}`;
|
|
293
|
+
}
|
|
294
|
+
export function renderPatchLine(line, theme) {
|
|
295
|
+
const trimmed = line.trimStart();
|
|
296
|
+
if (trimmed.startsWith("+"))
|
|
297
|
+
return theme.fg("toolDiffAdded", line);
|
|
298
|
+
if (trimmed.startsWith("-"))
|
|
299
|
+
return theme.fg("toolDiffRemoved", line);
|
|
300
|
+
if (trimmed.startsWith("•"))
|
|
301
|
+
return theme.fg("toolTitle", theme.bold(line));
|
|
302
|
+
if (trimmed.startsWith("└"))
|
|
303
|
+
return theme.fg("accent", line);
|
|
304
|
+
return theme.fg("toolDiffContext", line);
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=preview-format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-format.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/preview-format.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,M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LanguageFromPath, highlightCode } from \"../../../../modes/interactive/theme/theme.js\";\nimport { parsePatch } from \"./parser.js\";\nimport { extractPatchedPaths } from \"./text.js\";\nimport type {\n\tApplyPatchOperation,\n\tApplyPatchPreview,\n\tApplyPatchPreviewFile,\n\tApplyPatchRenderState,\n\tApplyPatchTheme,\n} from \"./types.js\";\n\nexport const PATCH_PREVIEW_MAX_LINES = 16;\nexport const PATCH_PREVIEW_MAX_CHARS = 4000;\nconst PATCH_PREVIEW_HEAD_LINES = 8;\nconst PATCH_PREVIEW_TAIL_LINES = 8;\nconst applyPatchRenderStates = new Map<string, ApplyPatchRenderState>();\n\nfunction formatLineCountSummary(added: number, removed: number): string {\n\treturn `(+${added} -${removed})`;\n}\n\nfunction countLines(text: string): number {\n\tif (text.length === 0) return 0;\n\tlet lines = 1;\n\tfor (let index = 0; index < text.length; index++) {\n\t\tif (text.charCodeAt(index) === 10) lines += 1;\n\t}\n\treturn lines;\n}\n\nexport function truncatePreview(text: string): string {\n\tif (text.length <= PATCH_PREVIEW_MAX_CHARS && countLines(text) <= PATCH_PREVIEW_MAX_LINES) return text;\n\tconst lines = text.split(\"\\n\");\n\tconst head = lines.slice(0, PATCH_PREVIEW_HEAD_LINES);\n\tconst tail = lines.slice(-PATCH_PREVIEW_TAIL_LINES);\n\tlet preview = [...head, \"…\", ...tail].join(\"\\n\");\n\tif (preview.length > PATCH_PREVIEW_MAX_CHARS) preview = `${preview.slice(0, PATCH_PREVIEW_MAX_CHARS).trimEnd()}\\n…`;\n\treturn preview;\n}\n\nexport function displayPath(filePath: string, cwd: string): string {\n\tif (!path.isAbsolute(filePath)) return filePath;\n\tconst absoluteCwd = path.resolve(cwd);\n\tconst relativePath = path.relative(absoluteCwd, filePath);\n\tif (\n\t\trelativePath === \"\" ||\n\t\t(!relativePath.startsWith(`..${path.sep}`) && relativePath !== \"..\" && !path.isAbsolute(relativePath))\n\t) {\n\t\treturn relativePath || \".\";\n\t}\n\treturn filePath;\n}\n\nfunction formatPatchFilePath(file: ApplyPatchPreviewFile, cwd: string = process.cwd()): string {\n\tconst filePath = displayPath(file.filePath, cwd);\n\tif (!file.movePath) return filePath;\n\treturn `${filePath} → ${displayPath(file.movePath, cwd)}`;\n}\n\nfunction formatPatchOperation(operation: ApplyPatchOperation): string {\n\tif (operation === \"add\") return \"Added\";\n\tif (operation === \"delete\") return \"Deleted\";\n\treturn \"Edited\";\n}\n\nexport function formatPatchPreview(\n\tpreview: ApplyPatchPreview,\n\tcwd: string = process.cwd(),\n\texpanded: boolean = true,\n): string {\n\tconst lines: string[] = [];\n\tif (preview.files.length === 1) {\n\t\tconst file = preview.files[0];\n\t\tif (file) {\n\t\t\tlines.push(\n\t\t\t\t`• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`,\n\t\t\t);\n\t\t\tif (expanded && file.diff)\n\t\t\t\tlines.push(\n\t\t\t\t\t...truncatePreview(file.diff)\n\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t.map((line) => ` ${line}`),\n\t\t\t\t);\n\t\t}\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tconst noun = preview.files.length === 1 ? \"file\" : \"files\";\n\tlines.push(`• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}`);\n\tfor (const file of preview.files) {\n\t\tlines.push(` └ ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`);\n\t\tif (expanded && file.diff)\n\t\t\tlines.push(\n\t\t\t\t...truncatePreview(file.diff)\n\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t.map((line) => ` ${line}`),\n\t\t\t);\n\t}\n\treturn lines.join(\"\\n\");\n}\n\nexport function formatInFlightCallText(patchText: string): string {\n\tconst paths = extractPatchedPaths(patchText);\n\tif (paths.length === 0) return \"Patching\";\n\tconst noun = paths.length === 1 ? \"file\" : \"files\";\n\tconst count = paths.length > 1 ? ` (${paths.length} ${noun})` : \"\";\n\treturn `Patching${count}: ${paths.join(\", \")}`;\n}\n\ntype RenderableAddedDiffLine = { content: string; kind: \"added\"; lineNumber: string; sign: \"+\" };\ntype RenderableRemovedDiffLine = { content: string; kind: \"removed\"; lineNumber: string; sign: \"-\" };\ntype RenderableContextDiffLine = { content: string; kind: \"context\"; lineNumber: string; sign: \" \" };\ntype RenderableContentDiffLine = RenderableAddedDiffLine | RenderableContextDiffLine | RenderableRemovedDiffLine;\ntype RenderableDiffLine = RenderableContentDiffLine | { kind: \"meta\"; text: string };\n\nfunction parseRenderableDiffLine(line: string): RenderableDiffLine {\n\tconst match = line.match(/^([+\\- ])(\\s*\\d+)\\s(.*)$/);\n\tif (!match) return { kind: \"meta\", text: line };\n\n\tconst sign = match[1];\n\tconst lineNumber = match[2];\n\tif ((sign !== \"+\" && sign !== \"-\" && sign !== \" \") || lineNumber === undefined) return { kind: \"meta\", text: line };\n\n\tconst content = match[3] ?? \"\";\n\tif (sign === \"+\") return { content, kind: \"added\", lineNumber, sign };\n\tif (sign === \"-\") return { content, kind: \"removed\", lineNumber, sign };\n\treturn { content, kind: \"context\", lineNumber, sign };\n}\n\nfunction replaceTabs(text: string): string {\n\treturn text.replace(/\\t/g, \" \");\n}\n\nfunction highlightDiffContent(content: string, filePath: string): string {\n\tconst plainContent = replaceTabs(content);\n\tconst language = getLanguageFromPath(filePath);\n\ttry {\n\t\treturn highlightCode(plainContent, language)[0] ?? plainContent;\n\t} catch {\n\t\treturn plainContent;\n\t}\n}\n\nfunction renderInlineDiff(\n\toldContent: string,\n\tnewContent: string,\n\ttheme: ApplyPatchTheme,\n): { added: string; removed: string } {\n\tconst parts = Diff.diffWords(replaceTabs(oldContent), replaceTabs(newContent));\n\tlet added = \"\";\n\tlet removed = \"\";\n\tlet firstAdded = true;\n\tlet firstRemoved = true;\n\n\tfor (const part of parts) {\n\t\tif (part.added) {\n\t\t\tlet value = part.value;\n\t\t\tif (firstAdded) {\n\t\t\t\tconst leadingWhitespace = value.match(/^(\\s*)/)?.[1] ?? \"\";\n\t\t\t\tadded += leadingWhitespace;\n\t\t\t\tvalue = value.slice(leadingWhitespace.length);\n\t\t\t\tfirstAdded = false;\n\t\t\t}\n\t\t\tif (value) added += theme.inverse(value);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (part.removed) {\n\t\t\tlet value = part.value;\n\t\t\tif (firstRemoved) {\n\t\t\t\tconst leadingWhitespace = value.match(/^(\\s*)/)?.[1] ?? \"\";\n\t\t\t\tremoved += leadingWhitespace;\n\t\t\t\tvalue = value.slice(leadingWhitespace.length);\n\t\t\t\tfirstRemoved = false;\n\t\t\t}\n\t\t\tif (value) removed += theme.inverse(value);\n\t\t\tcontinue;\n\t\t}\n\n\t\tadded += part.value;\n\t\tremoved += part.value;\n\t}\n\n\treturn { added, removed };\n}\n\nfunction renderOpenCodeLikeDiffLine(\n\tline: RenderableContentDiffLine,\n\tfilePath: string,\n\ttheme: ApplyPatchTheme,\n\tcontentOverride?: string,\n): string {\n\tconst lineNumber = theme.fg(\"muted\", line.lineNumber);\n\tif (line.kind === \"context\") {\n\t\treturn `${theme.fg(\"toolDiffContext\", line.sign)}${lineNumber} ${highlightDiffContent(line.content, filePath)}`;\n\t}\n\n\tconst diffColor = line.kind === \"added\" ? \"toolDiffAdded\" : \"toolDiffRemoved\";\n\tconst background = line.kind === \"added\" ? \"toolSuccessBg\" : \"toolErrorBg\";\n\tconst content =\n\t\tcontentOverride === undefined\n\t\t\t? highlightDiffContent(line.content, filePath)\n\t\t\t: theme.fg(diffColor, replaceTabs(contentOverride));\n\tconst rendered = `${theme.fg(diffColor, line.sign)}${lineNumber} ${content}`;\n\treturn theme.bg(background, rendered);\n}\n\nfunction renderOpenCodeLikeDiff(diffText: string, filePath: string, theme: ApplyPatchTheme): string {\n\tconst parsedLines = diffText.split(\"\\n\").map(parseRenderableDiffLine);\n\tconst rendered: string[] = [];\n\tlet index = 0;\n\n\twhile (index < parsedLines.length) {\n\t\tconst line = parsedLines[index];\n\t\tif (!line) {\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (line.kind !== \"removed\") {\n\t\t\trendered.push(\n\t\t\t\tline.kind === \"meta\"\n\t\t\t\t\t? theme.fg(\"toolDiffContext\", line.text)\n\t\t\t\t\t: renderOpenCodeLikeDiffLine(line, filePath, theme),\n\t\t\t);\n\t\t\tindex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst removedLines: RenderableRemovedDiffLine[] = [];\n\t\twhile (parsedLines[index]?.kind === \"removed\") {\n\t\t\tconst removedLine = parsedLines[index];\n\t\t\tif (removedLine?.kind === \"removed\") removedLines.push(removedLine);\n\t\t\tindex++;\n\t\t}\n\n\t\tconst addedLines: RenderableAddedDiffLine[] = [];\n\t\twhile (parsedLines[index]?.kind === \"added\") {\n\t\t\tconst addedLine = parsedLines[index];\n\t\t\tif (addedLine?.kind === \"added\") addedLines.push(addedLine);\n\t\t\tindex++;\n\t\t}\n\n\t\tconst pairedCount = Math.min(removedLines.length, addedLines.length);\n\t\tfor (let pairIndex = 0; pairIndex < pairedCount; pairIndex++) {\n\t\t\tconst removedLine = removedLines[pairIndex];\n\t\t\tconst addedLine = addedLines[pairIndex];\n\t\t\tif (!removedLine || !addedLine) continue;\n\n\t\t\tconst inline = renderInlineDiff(removedLine.content, addedLine.content, theme);\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme, inline.removed));\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme, inline.added));\n\t\t}\n\n\t\tfor (const removedLine of removedLines.slice(pairedCount))\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(removedLine, filePath, theme));\n\t\tfor (const addedLine of addedLines.slice(pairedCount))\n\t\t\trendered.push(renderOpenCodeLikeDiffLine(addedLine, filePath, theme));\n\t}\n\n\treturn rendered.join(\"\\n\");\n}\n\nexport function getApplyPatchRenderState(toolCallId: string, cwd: string, patchText: string): ApplyPatchRenderState {\n\tconst existing = applyPatchRenderStates.get(toolCallId);\n\tif (existing && existing.cwd === cwd && existing.patchText === patchText) return existing;\n\n\tconst callText = formatInFlightCallText(patchText);\n\tlet collapsed = \"\";\n\tlet expanded = \"\";\n\ttry {\n\t\tconst hunks = parsePatch(patchText);\n\t\tif (hunks.length > 0) {\n\t\t\tconst files = hunks.map((hunk) => ({\n\t\t\t\tfilePath: hunk.filePath,\n\t\t\t\tmovePath: hunk.type === \"update\" ? hunk.movePath : undefined,\n\t\t\t\toperation: hunk.type,\n\t\t\t\tdiff: \"\",\n\t\t\t\tadded: 0,\n\t\t\t\tremoved: 0,\n\t\t\t})) satisfies ApplyPatchPreviewFile[];\n\t\t\tconst preview: ApplyPatchPreview = { files, added: 0, removed: 0 };\n\t\t\tcollapsed = formatPatchPreview(preview, cwd, false);\n\t\t\texpanded = formatPatchPreview(preview, cwd, true);\n\t\t}\n\t} catch {\n\t\t// ignore incomplete patch text\n\t}\n\n\tconst nextState: ApplyPatchRenderState = { ...existing, cwd, patchText, callText, collapsed, expanded };\n\tapplyPatchRenderStates.set(toolCallId, nextState);\n\treturn nextState;\n}\n\nexport function clearApplyPatchRenderState(): void {\n\tapplyPatchRenderStates.clear();\n}\n\nexport function renderPatchPreview(\n\tpreview: ApplyPatchPreview,\n\tcwd: string,\n\ttheme: ApplyPatchTheme,\n\texpanded: boolean,\n): string {\n\tif (expanded) {\n\t\ttry {\n\t\t\tconst renderFile = (file: ApplyPatchPreviewFile, headerPrefix: string): string => {\n\t\t\t\tconst header = `• ${formatPatchOperation(file.operation)} ${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;\n\t\t\t\tif (!file.diff) {\n\t\t\t\t\treturn headerPrefix.length > 0\n\t\t\t\t\t\t? `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`\n\t\t\t\t\t\t: header;\n\t\t\t\t}\n\n\t\t\t\tconst renderedDiff = renderOpenCodeLikeDiff(\n\t\t\t\t\ttruncatePreview(file.diff),\n\t\t\t\t\tfile.movePath ?? file.filePath,\n\t\t\t\t\ttheme,\n\t\t\t\t);\n\t\t\t\tif (headerPrefix.length > 0) {\n\t\t\t\t\tconst nestedHeader = `${headerPrefix}${formatPatchFilePath(file, cwd)} ${formatLineCountSummary(file.added, file.removed)}`;\n\t\t\t\t\treturn `${nestedHeader}\\n${renderedDiff\n\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t.map((line) => ` ${line}`)\n\t\t\t\t\t\t.join(\"\\n\")}`;\n\t\t\t\t}\n\t\t\t\treturn `${header}\\n${renderedDiff}`;\n\t\t\t};\n\n\t\t\tif (preview.files.length === 1) {\n\t\t\t\tconst file = preview.files[0];\n\t\t\t\treturn file ? renderFile(file, \"\") : \"\";\n\t\t\t}\n\n\t\t\tconst noun = preview.files.length === 1 ? \"file\" : \"files\";\n\t\t\tconst renderedFiles = preview.files.map((file) => renderFile(file, \" └ \")).join(\"\\n\");\n\t\t\tif (renderedFiles.length > 0) {\n\t\t\t\treturn `• Edited ${preview.files.length} ${noun} ${formatLineCountSummary(preview.added, preview.removed)}\\n${renderedFiles}`;\n\t\t\t}\n\t\t} catch {\n\t\t\t// fall back to manual themed line rendering\n\t\t}\n\t}\n\n\treturn formatPatchPreview(preview, cwd, expanded)\n\t\t.split(\"\\n\")\n\t\t.map((line) => renderPatchLine(line, theme))\n\t\t.join(\"\\n\");\n}\n\nexport function formatPendingPatchPaths(patchText: string): string {\n\tconst paths = extractPatchedPaths(patchText);\n\tif (paths.length === 0) return \"Applying patch...\";\n\treturn `Applying patch...\\n${paths.map((filePath) => `• ${filePath}`).join(\"\\n\")}`;\n}\n\nexport function renderPatchLine(line: string, theme: ApplyPatchTheme): string {\n\tconst trimmed = line.trimStart();\n\tif (trimmed.startsWith(\"+\")) return theme.fg(\"toolDiffAdded\", line);\n\tif (trimmed.startsWith(\"-\")) return theme.fg(\"toolDiffRemoved\", line);\n\tif (trimmed.startsWith(\"•\")) return theme.fg(\"toolTitle\", theme.bold(line));\n\tif (trimmed.startsWith(\"└\")) return theme.fg(\"accent\", line);\n\treturn theme.fg(\"toolDiffContext\", line);\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApplyPatchPreview, ApplyPatchProgress, ApplyPatchToolDetails, ParsedPatch } from "./types.js";
|
|
2
|
+
export declare function createPatchPreview(cwd: string, hunks: ParsedPatch[]): Promise<ApplyPatchPreview>;
|
|
3
|
+
export declare function createPendingPatchUpdate(cwd: string, patchText: string, progress?: ApplyPatchProgress, previewOverride?: ApplyPatchPreview): Promise<{
|
|
4
|
+
text: string;
|
|
5
|
+
details: ApplyPatchToolDetails | undefined;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/preview.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACX,iBAAiB,EAEjB,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACX,MAAM,YAAY,CAAC;AAYpB,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+BtG;AAED,wBAAsB,wBAAwB,CAC7C,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,kBAAkB,EAC7B,eAAe,CAAC,EAAE,iBAAiB,GACjC,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAAA;CAAE,CAAC,CAyBvE","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { parsePatch } from \"./parser.js\";\nimport { createPatchDiff } from \"./patch-diff.js\";\nimport { replaceChunks } from \"./patch-replace.js\";\nimport { formatPatchPreview, formatPendingPatchPaths } from \"./preview-format.js\";\nimport type {\n\tApplyPatchPreview,\n\tApplyPatchPreviewFile,\n\tApplyPatchProgress,\n\tApplyPatchToolDetails,\n\tParsedPatch,\n} from \"./types.js\";\nimport { resolvePatchPath } from \"./workspace.js\";\n\nasync function readExistingFileForPreview(absolutePath: string): Promise<string> {\n\ttry {\n\t\treturn await readFile(absolutePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") return \"\";\n\t\tthrow error;\n\t}\n}\n\nexport async function createPatchPreview(cwd: string, hunks: ParsedPatch[]): Promise<ApplyPatchPreview> {\n\tconst files: ApplyPatchPreviewFile[] = [];\n\tfor (const hunk of hunks) {\n\t\tconst absolutePath = resolvePatchPath(cwd, hunk.filePath);\n\t\tif (hunk.type === \"add\") {\n\t\t\tconst oldContent = await readExistingFileForPreview(absolutePath);\n\t\t\tconst diff = createPatchDiff(oldContent, hunk.content);\n\t\t\tfiles.push({ filePath: hunk.filePath, operation: oldContent.length > 0 ? \"update\" : \"add\", ...diff });\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (hunk.type === \"delete\") {\n\t\t\tconst oldContent = await readFile(absolutePath, \"utf-8\");\n\t\t\tconst diff = createPatchDiff(oldContent, \"\");\n\t\t\tfiles.push({ filePath: hunk.filePath, operation: \"delete\", ...diff });\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst oldContent = await readFile(absolutePath, \"utf-8\");\n\t\tconst newContent =\n\t\t\thunk.chunks.length === 0 ? oldContent : replaceChunks(oldContent, hunk.filePath, hunk.chunks).content;\n\t\tif (hunk.movePath) resolvePatchPath(cwd, hunk.movePath);\n\t\tconst diff = createPatchDiff(oldContent, newContent);\n\t\tfiles.push({ filePath: hunk.filePath, movePath: hunk.movePath, operation: \"update\", ...diff });\n\t}\n\n\treturn {\n\t\tfiles,\n\t\tadded: files.reduce((sum, file) => sum + file.added, 0),\n\t\tremoved: files.reduce((sum, file) => sum + file.removed, 0),\n\t};\n}\n\nexport async function createPendingPatchUpdate(\n\tcwd: string,\n\tpatchText: string,\n\tprogress?: ApplyPatchProgress,\n\tpreviewOverride?: ApplyPatchPreview,\n): Promise<{ text: string; details: ApplyPatchToolDetails | undefined }> {\n\tconst title = progress\n\t\t? `Applying patch (${progress.applied + progress.failed}/${progress.total})...`\n\t\t: \"Applying patch...\";\n\tif (previewOverride) {\n\t\treturn {\n\t\t\ttext: `${title}\\n${formatPatchPreview(previewOverride)}`,\n\t\t\tdetails: { preview: previewOverride, progress },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst hunks = parsePatch(patchText);\n\t\tif (hunks.length === 0) return { text: title, details: progress ? { progress } : undefined };\n\t\tconst preview = await createPatchPreview(cwd, hunks);\n\t\tif (preview.files.some((file) => file.diff.trim().length > 0)) {\n\t\t\treturn { text: `${title}\\n${formatPatchPreview(preview)}`, details: { preview, progress } };\n\t\t}\n\t} catch {\n\t\treturn {\n\t\t\ttext: progress ? title : formatPendingPatchPaths(patchText),\n\t\t\tdetails: progress ? { progress } : undefined,\n\t\t};\n\t}\n\treturn { text: progress ? title : formatPendingPatchPaths(patchText), details: progress ? { progress } : undefined };\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { parsePatch } from "./parser.js";
|
|
3
|
+
import { createPatchDiff } from "./patch-diff.js";
|
|
4
|
+
import { replaceChunks } from "./patch-replace.js";
|
|
5
|
+
import { formatPatchPreview, formatPendingPatchPaths } from "./preview-format.js";
|
|
6
|
+
import { resolvePatchPath } from "./workspace.js";
|
|
7
|
+
async function readExistingFileForPreview(absolutePath) {
|
|
8
|
+
try {
|
|
9
|
+
return await readFile(absolutePath, "utf-8");
|
|
10
|
+
}
|
|
11
|
+
catch (error) {
|
|
12
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
13
|
+
return "";
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function createPatchPreview(cwd, hunks) {
|
|
18
|
+
const files = [];
|
|
19
|
+
for (const hunk of hunks) {
|
|
20
|
+
const absolutePath = resolvePatchPath(cwd, hunk.filePath);
|
|
21
|
+
if (hunk.type === "add") {
|
|
22
|
+
const oldContent = await readExistingFileForPreview(absolutePath);
|
|
23
|
+
const diff = createPatchDiff(oldContent, hunk.content);
|
|
24
|
+
files.push({ filePath: hunk.filePath, operation: oldContent.length > 0 ? "update" : "add", ...diff });
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (hunk.type === "delete") {
|
|
28
|
+
const oldContent = await readFile(absolutePath, "utf-8");
|
|
29
|
+
const diff = createPatchDiff(oldContent, "");
|
|
30
|
+
files.push({ filePath: hunk.filePath, operation: "delete", ...diff });
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const oldContent = await readFile(absolutePath, "utf-8");
|
|
34
|
+
const newContent = hunk.chunks.length === 0 ? oldContent : replaceChunks(oldContent, hunk.filePath, hunk.chunks).content;
|
|
35
|
+
if (hunk.movePath)
|
|
36
|
+
resolvePatchPath(cwd, hunk.movePath);
|
|
37
|
+
const diff = createPatchDiff(oldContent, newContent);
|
|
38
|
+
files.push({ filePath: hunk.filePath, movePath: hunk.movePath, operation: "update", ...diff });
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
files,
|
|
42
|
+
added: files.reduce((sum, file) => sum + file.added, 0),
|
|
43
|
+
removed: files.reduce((sum, file) => sum + file.removed, 0),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export async function createPendingPatchUpdate(cwd, patchText, progress, previewOverride) {
|
|
47
|
+
const title = progress
|
|
48
|
+
? `Applying patch (${progress.applied + progress.failed}/${progress.total})...`
|
|
49
|
+
: "Applying patch...";
|
|
50
|
+
if (previewOverride) {
|
|
51
|
+
return {
|
|
52
|
+
text: `${title}\n${formatPatchPreview(previewOverride)}`,
|
|
53
|
+
details: { preview: previewOverride, progress },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const hunks = parsePatch(patchText);
|
|
58
|
+
if (hunks.length === 0)
|
|
59
|
+
return { text: title, details: progress ? { progress } : undefined };
|
|
60
|
+
const preview = await createPatchPreview(cwd, hunks);
|
|
61
|
+
if (preview.files.some((file) => file.diff.trim().length > 0)) {
|
|
62
|
+
return { text: `${title}\n${formatPatchPreview(preview)}`, details: { preview, progress } };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return {
|
|
67
|
+
text: progress ? title : formatPendingPatchPaths(patchText),
|
|
68
|
+
details: progress ? { progress } : undefined,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { text: progress ? title : formatPendingPatchPaths(patchText), details: progress ? { progress } : undefined };
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAQlF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,KAAK,UAAU,0BAA0B,CAAC,YAAoB,EAAmB;IAChF,IAAI,CAAC;QACJ,OAAO,MAAM,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IA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;IACH,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QAC7F,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACrD,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC;YAC/D,OAAO,EAAE,IAAI,EAAE,GAAG,KAAK,KAAK,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC;QAC7F,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,OAAO;YACN,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC;YAC3D,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;SAC5C,CAAC;IACH,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AAAA,CACrH","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport { parsePatch } from \"./parser.js\";\nimport { createPatchDiff } from \"./patch-diff.js\";\nimport { replaceChunks } from \"./patch-replace.js\";\nimport { formatPatchPreview, formatPendingPatchPaths } from \"./preview-format.js\";\nimport type {\n\tApplyPatchPreview,\n\tApplyPatchPreviewFile,\n\tApplyPatchProgress,\n\tApplyPatchToolDetails,\n\tParsedPatch,\n} from \"./types.js\";\nimport { resolvePatchPath } from \"./workspace.js\";\n\nasync function readExistingFileForPreview(absolutePath: string): Promise<string> {\n\ttry {\n\t\treturn await readFile(absolutePath, \"utf-8\");\n\t} catch (error) {\n\t\tif (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") return \"\";\n\t\tthrow error;\n\t}\n}\n\nexport async function createPatchPreview(cwd: string, hunks: ParsedPatch[]): Promise<ApplyPatchPreview> {\n\tconst files: ApplyPatchPreviewFile[] = [];\n\tfor (const hunk of hunks) {\n\t\tconst absolutePath = resolvePatchPath(cwd, hunk.filePath);\n\t\tif (hunk.type === \"add\") {\n\t\t\tconst oldContent = await readExistingFileForPreview(absolutePath);\n\t\t\tconst diff = createPatchDiff(oldContent, hunk.content);\n\t\t\tfiles.push({ filePath: hunk.filePath, operation: oldContent.length > 0 ? \"update\" : \"add\", ...diff });\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (hunk.type === \"delete\") {\n\t\t\tconst oldContent = await readFile(absolutePath, \"utf-8\");\n\t\t\tconst diff = createPatchDiff(oldContent, \"\");\n\t\t\tfiles.push({ filePath: hunk.filePath, operation: \"delete\", ...diff });\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst oldContent = await readFile(absolutePath, \"utf-8\");\n\t\tconst newContent =\n\t\t\thunk.chunks.length === 0 ? oldContent : replaceChunks(oldContent, hunk.filePath, hunk.chunks).content;\n\t\tif (hunk.movePath) resolvePatchPath(cwd, hunk.movePath);\n\t\tconst diff = createPatchDiff(oldContent, newContent);\n\t\tfiles.push({ filePath: hunk.filePath, movePath: hunk.movePath, operation: \"update\", ...diff });\n\t}\n\n\treturn {\n\t\tfiles,\n\t\tadded: files.reduce((sum, file) => sum + file.added, 0),\n\t\tremoved: files.reduce((sum, file) => sum + file.removed, 0),\n\t};\n}\n\nexport async function createPendingPatchUpdate(\n\tcwd: string,\n\tpatchText: string,\n\tprogress?: ApplyPatchProgress,\n\tpreviewOverride?: ApplyPatchPreview,\n): Promise<{ text: string; details: ApplyPatchToolDetails | undefined }> {\n\tconst title = progress\n\t\t? `Applying patch (${progress.applied + progress.failed}/${progress.total})...`\n\t\t: \"Applying patch...\";\n\tif (previewOverride) {\n\t\treturn {\n\t\t\ttext: `${title}\\n${formatPatchPreview(previewOverride)}`,\n\t\t\tdetails: { preview: previewOverride, progress },\n\t\t};\n\t}\n\n\ttry {\n\t\tconst hunks = parsePatch(patchText);\n\t\tif (hunks.length === 0) return { text: title, details: progress ? { progress } : undefined };\n\t\tconst preview = await createPatchPreview(cwd, hunks);\n\t\tif (preview.files.some((file) => file.diff.trim().length > 0)) {\n\t\t\treturn { text: `${title}\\n${formatPatchPreview(preview)}`, details: { preview, progress } };\n\t\t}\n\t} catch {\n\t\treturn {\n\t\t\ttext: progress ? title : formatPendingPatchPaths(patchText),\n\t\t\tdetails: progress ? { progress } : undefined,\n\t\t};\n\t}\n\treturn { text: progress ? title : formatPendingPatchPaths(patchText), details: progress ? { progress } : undefined };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function seekSequenceWithFuzz(lines: string[], pattern: string[], start: number, eof: boolean): {
|
|
2
|
+
index: number;
|
|
3
|
+
fuzz: 0 | 1 | 100 | 10000;
|
|
4
|
+
} | undefined;
|
|
5
|
+
export declare function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | undefined;
|
|
6
|
+
//# sourceMappingURL=seek-sequence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seek-sequence.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/seek-sequence.ts"],"names":[],"mappings":"AASA,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,OAAO,GACV;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,KAAK,CAAA;CAAE,GAAG,SAAS,CAoC1D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEhH","sourcesContent":["function normalizeSeekLine(line: string): string {\n\treturn line\n\t\t.trim()\n\t\t.replace(/[‐‑‒–—―−]/g, \"-\")\n\t\t.replace(/[‘’‚‛]/g, \"'\")\n\t\t.replace(/[“”„‟]/g, '\"')\n\t\t.replace(/[\\u00A0\\u2002-\\u200A\\u202F\\u205F\\u3000]/g, \" \");\n}\n\nexport function seekSequenceWithFuzz(\n\tlines: string[],\n\tpattern: string[],\n\tstart: number,\n\teof: boolean,\n): { index: number; fuzz: 0 | 1 | 100 | 10000 } | undefined {\n\tif (pattern.length === 0) {\n\t\treturn { index: start, fuzz: 0 };\n\t}\n\tif (pattern.length > lines.length) {\n\t\treturn undefined;\n\t}\n\n\tconst searchStart = eof && lines.length >= pattern.length ? lines.length - pattern.length : start;\n\tconst lastStart = lines.length - pattern.length;\n\tconst matches = (index: number, compare: (left: string, right: string) => boolean): boolean => {\n\t\tfor (let patternIndex = 0; patternIndex < pattern.length; patternIndex++) {\n\t\t\tconst line = lines[index + patternIndex];\n\t\t\tconst expected = pattern[patternIndex];\n\t\t\tif (line === undefined || expected === undefined || !compare(line, expected)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t};\n\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line === expected)) return { index, fuzz: 0 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line.trimEnd() === expected.trimEnd())) return { index, fuzz: 1 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line.trim() === expected.trim())) return { index, fuzz: 100 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => normalizeSeekLine(line) === normalizeSeekLine(expected)))\n\t\t\treturn { index, fuzz: 10000 };\n\t}\n\n\treturn undefined;\n}\n\nexport function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | undefined {\n\treturn seekSequenceWithFuzz(lines, pattern, start, eof)?.index;\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function normalizeSeekLine(line) {
|
|
2
|
+
return line
|
|
3
|
+
.trim()
|
|
4
|
+
.replace(/[‐‑‒–—―−]/g, "-")
|
|
5
|
+
.replace(/[‘’‚‛]/g, "'")
|
|
6
|
+
.replace(/[“”„‟]/g, '"')
|
|
7
|
+
.replace(/[\u00A0\u2002-\u200A\u202F\u205F\u3000]/g, " ");
|
|
8
|
+
}
|
|
9
|
+
export function seekSequenceWithFuzz(lines, pattern, start, eof) {
|
|
10
|
+
if (pattern.length === 0) {
|
|
11
|
+
return { index: start, fuzz: 0 };
|
|
12
|
+
}
|
|
13
|
+
if (pattern.length > lines.length) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const searchStart = eof && lines.length >= pattern.length ? lines.length - pattern.length : start;
|
|
17
|
+
const lastStart = lines.length - pattern.length;
|
|
18
|
+
const matches = (index, compare) => {
|
|
19
|
+
for (let patternIndex = 0; patternIndex < pattern.length; patternIndex++) {
|
|
20
|
+
const line = lines[index + patternIndex];
|
|
21
|
+
const expected = pattern[patternIndex];
|
|
22
|
+
if (line === undefined || expected === undefined || !compare(line, expected)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
for (let index = searchStart; index <= lastStart; index++) {
|
|
29
|
+
if (matches(index, (line, expected) => line === expected))
|
|
30
|
+
return { index, fuzz: 0 };
|
|
31
|
+
}
|
|
32
|
+
for (let index = searchStart; index <= lastStart; index++) {
|
|
33
|
+
if (matches(index, (line, expected) => line.trimEnd() === expected.trimEnd()))
|
|
34
|
+
return { index, fuzz: 1 };
|
|
35
|
+
}
|
|
36
|
+
for (let index = searchStart; index <= lastStart; index++) {
|
|
37
|
+
if (matches(index, (line, expected) => line.trim() === expected.trim()))
|
|
38
|
+
return { index, fuzz: 100 };
|
|
39
|
+
}
|
|
40
|
+
for (let index = searchStart; index <= lastStart; index++) {
|
|
41
|
+
if (matches(index, (line, expected) => normalizeSeekLine(line) === normalizeSeekLine(expected)))
|
|
42
|
+
return { index, fuzz: 10000 };
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
export function seekSequence(lines, pattern, start, eof) {
|
|
47
|
+
return seekSequenceWithFuzz(lines, pattern, start, eof)?.index;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=seek-sequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seek-sequence.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/gpt-apply-patch/seek-sequence.ts"],"names":[],"mappings":"AAAA,SAAS,iBAAiB,CAAC,IAAY,EAAU;IAChD,OAAO,IAAI;SACT,IAAI,EAAE;SACN,OAAO,CAAC,0BAAY,EAAE,GAAG,CAAC;SAC1B,OAAO,CAAC,iBAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,iBAAS,EAAE,GAAG,CAAC;SACvB,OAAO,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAC;AAAA,CAC3D;AAED,MAAM,UAAU,oBAAoB,CACnC,KAAe,EACf,OAAiB,EACjB,KAAa,EACb,GAAY,EAC+C;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAA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AK,EAAE,EAAE,CAAC;QAC3D,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAC1G,CAAC;IACD,KAAK,IAAI,KAAK,GAAG,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3D,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACtG,CAAC;IACD,KAAK,IAAI,KAAK,GAAG,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC;QAC3D,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAC9F,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC;AAAA,CACjB;AAED,MAAM,UAAU,YAAY,CAAC,KAAe,EAAE,OAAiB,EAAE,KAAa,EAAE,GAAY,EAAsB;IACjH,OAAO,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC;AAAA,CAC/D","sourcesContent":["function normalizeSeekLine(line: string): string {\n\treturn line\n\t\t.trim()\n\t\t.replace(/[‐‑‒–—―−]/g, \"-\")\n\t\t.replace(/[‘’‚‛]/g, \"'\")\n\t\t.replace(/[“”„‟]/g, '\"')\n\t\t.replace(/[\\u00A0\\u2002-\\u200A\\u202F\\u205F\\u3000]/g, \" \");\n}\n\nexport function seekSequenceWithFuzz(\n\tlines: string[],\n\tpattern: string[],\n\tstart: number,\n\teof: boolean,\n): { index: number; fuzz: 0 | 1 | 100 | 10000 } | undefined {\n\tif (pattern.length === 0) {\n\t\treturn { index: start, fuzz: 0 };\n\t}\n\tif (pattern.length > lines.length) {\n\t\treturn undefined;\n\t}\n\n\tconst searchStart = eof && lines.length >= pattern.length ? lines.length - pattern.length : start;\n\tconst lastStart = lines.length - pattern.length;\n\tconst matches = (index: number, compare: (left: string, right: string) => boolean): boolean => {\n\t\tfor (let patternIndex = 0; patternIndex < pattern.length; patternIndex++) {\n\t\t\tconst line = lines[index + patternIndex];\n\t\t\tconst expected = pattern[patternIndex];\n\t\t\tif (line === undefined || expected === undefined || !compare(line, expected)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t};\n\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line === expected)) return { index, fuzz: 0 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line.trimEnd() === expected.trimEnd())) return { index, fuzz: 1 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => line.trim() === expected.trim())) return { index, fuzz: 100 };\n\t}\n\tfor (let index = searchStart; index <= lastStart; index++) {\n\t\tif (matches(index, (line, expected) => normalizeSeekLine(line) === normalizeSeekLine(expected)))\n\t\t\treturn { index, fuzz: 10000 };\n\t}\n\n\treturn undefined;\n}\n\nexport function seekSequence(lines: string[], pattern: string[], start: number, eof: boolean): number | undefined {\n\treturn seekSequenceWithFuzz(lines, pattern, start, eof)?.index;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ParsedPatch } from "./types.js";
|
|
2
|
+
export declare class StreamingPatchParser {
|
|
3
|
+
private lineBuffer;
|
|
4
|
+
private mode;
|
|
5
|
+
private hunks;
|
|
6
|
+
pushDelta(delta: string): ParsedPatch[];
|
|
7
|
+
finish(): ParsedPatch[];
|
|
8
|
+
private snapshot;
|
|
9
|
+
private ensureUpdateHunkIsNotEmpty;
|
|
10
|
+
private handleHeader;
|
|
11
|
+
private startAdd;
|
|
12
|
+
private startDelete;
|
|
13
|
+
private startUpdate;
|
|
14
|
+
private currentUpdate;
|
|
15
|
+
private currentChunk;
|
|
16
|
+
private processLine;
|
|
17
|
+
private processStarted;
|
|
18
|
+
private processAdd;
|
|
19
|
+
private processDelete;
|
|
20
|
+
private processUpdate;
|
|
21
|
+
private pushUpdateLine;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=streaming-parser.d.ts.map
|