@bastani/atomic 0.8.27 → 0.8.28-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/README.md +120 -118
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +22 -0
- package/dist/builtin/workflows/README.md +11 -9
- package/dist/builtin/workflows/builtin/open-claude-design.ts +150 -13
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +5 -2
- package/dist/builtin/workflows/src/extension/background-ui-adapter.ts +3 -1
- package/dist/builtin/workflows/src/extension/hil-answer-notifications.ts +17 -25
- package/dist/builtin/workflows/src/extension/index.ts +133 -18
- package/dist/builtin/workflows/src/extension/render-result.ts +22 -2
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +3 -3
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +210 -16
- package/dist/builtin/workflows/src/sdk-surface.ts +1 -1
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +42 -5
- package/dist/builtin/workflows/src/shared/store-types.ts +8 -2
- package/dist/builtin/workflows/src/shared/store.ts +51 -0
- package/dist/builtin/workflows/src/shared/types.ts +14 -4
- package/dist/builtin/workflows/src/tui/chat-surface.ts +32 -33
- package/dist/builtin/workflows/src/tui/graph-view.ts +4 -1
- package/dist/builtin/workflows/src/tui/prompt-card.ts +6 -0
- package/dist/builtin/workflows/src/tui/run-detail.ts +11 -4
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +11 -1
- package/dist/builtin/workflows/src/tui/status-list.ts +32 -2
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +35 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +36 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +7 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +57 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -3
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +9 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +205 -51
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts +10 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +26 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -3
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +5 -3
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +16 -10
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +4 -84
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +20 -502
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts.map +1 -1
- package/dist/core/compaction/context-compaction.js +39 -82
- package/dist/core/compaction/context-compaction.js.map +1 -1
- package/dist/core/compaction/index.d.ts +1 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -1
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +5 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/template.js +19 -6
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +6 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +11 -4
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +53 -3
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +44 -12
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +2 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +27 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/messages.d.ts +1 -11
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +10 -25
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +64 -7
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +52 -22
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +20 -8
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +5 -4
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +30 -29
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +73 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +3 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +9 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +134 -11
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +12 -2
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +108 -18
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +12 -42
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +11 -15
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +111 -111
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +15 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +69 -14
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +0 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +7 -10
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts +53 -0
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -0
- package/dist/core/tools/oversized-tool-result.js +206 -0
- package/dist/core/tools/oversized-tool-result.js.map +1 -0
- package/dist/core/tools/read.d.ts +12 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +99 -34
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +17 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +6 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-limits.d.ts +25 -0
- package/dist/core/tools/tool-limits.d.ts.map +1 -0
- package/dist/core/tools/tool-limits.js +25 -0
- package/dist/core/tools/tool-limits.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +31 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +196 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +142 -30
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +3 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +325 -7
- package/dist/migrations.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +2 -2
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +1 -5
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +5 -9
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +0 -3
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +6 -0
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +9 -16
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +22 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +85 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +134 -36
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +10 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +1 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +4 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +52 -8
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +24 -5
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +6 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +104 -10
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +72 -0
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +54 -22
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/docs/compaction.md +210 -181
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +9 -9
- package/docs/development.md +1 -1
- package/docs/docs.json +2 -0
- package/docs/extensions.md +71 -24
- package/docs/index.md +2 -0
- package/docs/json.md +3 -4
- package/docs/models.md +10 -10
- package/docs/packages.md +1 -1
- package/docs/prompt-templates.md +9 -2
- package/docs/providers.md +18 -5
- package/docs/quickstart.md +1 -0
- package/docs/rpc.md +3 -2
- package/docs/sdk.md +5 -0
- package/docs/security.md +56 -0
- package/docs/session-format.md +14 -23
- package/docs/sessions.md +11 -1
- package/docs/settings.md +23 -9
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +44 -2
- package/docs/themes.md +1 -1
- package/docs/tmux.md +4 -2
- package/docs/tui.md +14 -5
- package/docs/usage.md +17 -3
- package/docs/workflows.md +11 -9
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +9 -6
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/custom-compaction.ts +43 -106
- package/examples/extensions/custom-header.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +3 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +6 -6
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +55 -4
- package/examples/extensions/custom-provider-gitlab-duo/package.json +3 -3
- package/examples/extensions/doom-overlay/README.md +1 -1
- package/examples/extensions/doom-overlay/index.ts +2 -2
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/gondolin/index.ts +523 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +7 -45
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +2 -2
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +3 -3
- package/examples/extensions/interactive-shell.ts +2 -2
- package/examples/extensions/mac-system-theme.ts +2 -2
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +198 -179
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/preset.ts +14 -12
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/question.ts +1 -1
- package/examples/extensions/questionnaire.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/sandbox/index.ts +16 -14
- package/examples/extensions/sandbox/package-lock.json +90 -90
- package/examples/extensions/sandbox/package.json +17 -17
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/subagent/README.md +13 -13
- package/examples/extensions/subagent/agents.ts +4 -2
- package/examples/extensions/subagent/index.ts +6 -6
- package/examples/extensions/summarize.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +1 -1
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/todo.ts +1 -1
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +6 -1
- package/examples/extensions/trigger-compact.ts +5 -4
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +7 -7
- package/examples/extensions/working-indicator.ts +4 -4
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/06-extensions.ts +2 -2
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/package.json +8 -8
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +0 -16
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +0 -43
- package/dist/modes/interactive/components/compaction-summary-message.js.map +0 -1
|
@@ -20,9 +20,9 @@ import { stripFrontmatter } from "../utils/frontmatter.js";
|
|
|
20
20
|
import { resolvePath } from "../utils/paths.js";
|
|
21
21
|
import { sleep } from "../utils/sleep.js";
|
|
22
22
|
import { ATOMIC_GUIDE_COMMAND_NAME, ATOMIC_GUIDE_HELP_CHOICES, atomicGuideModeForChoice, getAtomicGuideMessage, isAtomicGuideHelpChoice, normalizeAtomicGuideMode, } from "./atomic-guide-command.js";
|
|
23
|
-
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage } from "./auth-guidance.js";
|
|
23
|
+
import { formatNoApiKeyFoundMessage, formatNoModelSelectedMessage, formatUnresolvedModelMessage, } from "./auth-guidance.js";
|
|
24
24
|
import { executeBashWithOperations } from "./bash-executor.js";
|
|
25
|
-
import { calculateContextTokens, collectEntriesForBranchSummary, contextCompact as runContextCompact, estimateContextTokens, generateBranchSummary, prepareContextCompaction, shouldCompact, } from "./compaction/index.js";
|
|
25
|
+
import { calculateContextTokens, collectEntriesForBranchSummary, contextCompact as runContextCompact, estimateContextTokens, generateBranchSummary, prepareContextCompaction, shouldCompact, validateContextDeletionRequest, } from "./compaction/index.js";
|
|
26
26
|
import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
|
|
27
27
|
import { exportSessionToHtml } from "./export-html/index.js";
|
|
28
28
|
import { createToolHtmlRenderer } from "./export-html/tool-renderer.js";
|
|
@@ -34,7 +34,17 @@ import { createSyntheticSourceInfo } from "./source-info.js";
|
|
|
34
34
|
import { buildSystemPrompt } from "./system-prompt.js";
|
|
35
35
|
import { createLocalBashOperations } from "./tools/bash.js";
|
|
36
36
|
import { createAllToolDefinitions, defaultToolNames } from "./tools/index.js";
|
|
37
|
+
import { redirectOversizedToolResult } from "./tools/oversized-tool-result.js";
|
|
37
38
|
import { createToolDefinitionFromAgentTool } from "./tools/tool-definition-wrapper.js";
|
|
39
|
+
function deepFreeze(value) {
|
|
40
|
+
if (value && typeof value === "object") {
|
|
41
|
+
Object.freeze(value);
|
|
42
|
+
for (const nested of Object.values(value)) {
|
|
43
|
+
deepFreeze(nested);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
38
48
|
/**
|
|
39
49
|
* Parse a skill block from message text.
|
|
40
50
|
* Returns null if the text doesn't contain a skill block.
|
|
@@ -149,6 +159,7 @@ export class AgentSession {
|
|
|
149
159
|
this._pendingBashMessages = [];
|
|
150
160
|
this._turnIndex = 0;
|
|
151
161
|
this._baseToolDefinitions = new Map();
|
|
162
|
+
this._extensionMode = "print";
|
|
152
163
|
// Tool registry for extension getTools/setTools
|
|
153
164
|
this._toolRegistry = new Map();
|
|
154
165
|
this._toolDefinitions = new Map();
|
|
@@ -253,26 +264,43 @@ export class AgentSession {
|
|
|
253
264
|
};
|
|
254
265
|
this.agent.afterToolCall = async ({ toolCall, args, result, isError }) => {
|
|
255
266
|
const runner = this._extensionRunner;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
267
|
+
const hookResult = runner.hasHandlers("tool_result")
|
|
268
|
+
? await runner.emitToolResult({
|
|
269
|
+
type: "tool_result",
|
|
270
|
+
toolName: toolCall.name,
|
|
271
|
+
toolCallId: toolCall.id,
|
|
272
|
+
input: args,
|
|
273
|
+
content: result.content,
|
|
274
|
+
details: result.details,
|
|
275
|
+
isError,
|
|
276
|
+
})
|
|
277
|
+
: undefined;
|
|
278
|
+
const extensionReplacement = hookResult
|
|
279
|
+
? {
|
|
280
|
+
content: hookResult.content,
|
|
281
|
+
details: hookResult.details,
|
|
282
|
+
isError: hookResult.isError ?? isError,
|
|
283
|
+
}
|
|
284
|
+
: undefined;
|
|
285
|
+
const finalResult = hookResult
|
|
286
|
+
? {
|
|
287
|
+
content: hookResult.content ?? result.content,
|
|
288
|
+
// Preserve original details when an extension hook rewrites only content;
|
|
289
|
+
// the redirect check only replaces model-visible content blocks.
|
|
290
|
+
details: hookResult.details ?? result.details,
|
|
291
|
+
}
|
|
292
|
+
: result;
|
|
293
|
+
const finalIsError = hookResult?.isError ?? isError;
|
|
294
|
+
const redirectReplacement = await redirectOversizedToolResult({
|
|
261
295
|
toolName: toolCall.name,
|
|
262
296
|
toolCallId: toolCall.id,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
297
|
+
result: finalResult,
|
|
298
|
+
isError: finalIsError,
|
|
299
|
+
sessionId: this.sessionManager.getSessionId(),
|
|
300
|
+
sessionDir: this.sessionManager.getSessionDir() || undefined,
|
|
301
|
+
maxResultSizeChars: this.getToolDefinition(toolCall.name)?.maxResultSizeChars,
|
|
267
302
|
});
|
|
268
|
-
|
|
269
|
-
return undefined;
|
|
270
|
-
}
|
|
271
|
-
return {
|
|
272
|
-
content: hookResult.content,
|
|
273
|
-
details: hookResult.details,
|
|
274
|
-
isError: hookResult.isError ?? isError,
|
|
275
|
-
};
|
|
303
|
+
return redirectReplacement ?? extensionReplacement;
|
|
276
304
|
};
|
|
277
305
|
}
|
|
278
306
|
// =========================================================================
|
|
@@ -357,7 +385,7 @@ export class AgentSession {
|
|
|
357
385
|
// Regular LLM message - persist as SessionMessageEntry
|
|
358
386
|
this.sessionManager.appendMessage(event.message);
|
|
359
387
|
}
|
|
360
|
-
// Other message types (bashExecution,
|
|
388
|
+
// Other message types (bashExecution, branchSummary) are persisted elsewhere
|
|
361
389
|
// Track assistant message for auto-compaction (checked on agent_end)
|
|
362
390
|
if (event.message.role === "assistant") {
|
|
363
391
|
this._lastAssistantMessage = event.message;
|
|
@@ -624,6 +652,7 @@ export class AgentSession {
|
|
|
624
652
|
name: definition.name,
|
|
625
653
|
description: definition.description,
|
|
626
654
|
parameters: definition.parameters,
|
|
655
|
+
promptGuidelines: definition.promptGuidelines,
|
|
627
656
|
sourceInfo,
|
|
628
657
|
}));
|
|
629
658
|
}
|
|
@@ -788,7 +817,7 @@ export class AgentSession {
|
|
|
788
817
|
let currentText = text;
|
|
789
818
|
let currentImages = options?.images;
|
|
790
819
|
if (this._extensionRunner.hasHandlers("input")) {
|
|
791
|
-
const inputResult = await this._extensionRunner.emitInput(currentText, currentImages, options?.source ?? "interactive");
|
|
820
|
+
const inputResult = await this._extensionRunner.emitInput(currentText, currentImages, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
|
|
792
821
|
if (inputResult.action === "handled") {
|
|
793
822
|
preflightResult?.(true);
|
|
794
823
|
return;
|
|
@@ -824,6 +853,15 @@ export class AgentSession {
|
|
|
824
853
|
if (!this.model) {
|
|
825
854
|
throw new Error(formatNoModelSelectedMessage());
|
|
826
855
|
}
|
|
856
|
+
// Defensive guard: a model that never resolved to a real provider
|
|
857
|
+
// (for example an unknown/unresolved model id that reached this path
|
|
858
|
+
// as a bare string) has no `provider`, which would otherwise fail deep
|
|
859
|
+
// in auth resolution as the confusing "No API key found for undefined".
|
|
860
|
+
// Surface a clear, accurate "unknown model" error instead.
|
|
861
|
+
const resolvedProvider = this.model.provider;
|
|
862
|
+
if (typeof resolvedProvider !== "string" || resolvedProvider.length === 0) {
|
|
863
|
+
throw new Error(formatUnresolvedModelMessage(this.model));
|
|
864
|
+
}
|
|
827
865
|
if (!this._modelRegistry.hasConfiguredAuth(this.model)) {
|
|
828
866
|
const isOAuth = this._modelRegistry.isUsingOAuth(this.model);
|
|
829
867
|
if (isOAuth) {
|
|
@@ -887,8 +925,20 @@ export class AgentSession {
|
|
|
887
925
|
return;
|
|
888
926
|
}
|
|
889
927
|
preflightResult?.(true);
|
|
928
|
+
await this._runAgentPrompt(messages);
|
|
929
|
+
}
|
|
930
|
+
async _runAgentPrompt(messages) {
|
|
890
931
|
await this.agent.prompt(messages);
|
|
891
932
|
await this.waitForRetry();
|
|
933
|
+
await this._continueQueuedAgentMessages();
|
|
934
|
+
}
|
|
935
|
+
async _continueQueuedAgentMessages() {
|
|
936
|
+
await this._agentEventQueue;
|
|
937
|
+
while (this.agent.hasQueuedMessages()) {
|
|
938
|
+
await this.agent.continue();
|
|
939
|
+
await this.waitForRetry();
|
|
940
|
+
await this._agentEventQueue;
|
|
941
|
+
}
|
|
892
942
|
}
|
|
893
943
|
/**
|
|
894
944
|
* Try to execute a built-in slash command. Returns true if command was found and executed.
|
|
@@ -1092,7 +1142,7 @@ export class AgentSession {
|
|
|
1092
1142
|
this._queueAgentMessage(appMessage, options?.deliverAs === "followUp" ? "followUp" : "steer");
|
|
1093
1143
|
}
|
|
1094
1144
|
else if (options?.triggerTurn) {
|
|
1095
|
-
await this.
|
|
1145
|
+
await this._runAgentPrompt(appMessage);
|
|
1096
1146
|
}
|
|
1097
1147
|
else {
|
|
1098
1148
|
this._appendCustomMessage(appMessage);
|
|
@@ -1483,6 +1533,9 @@ export class AgentSession {
|
|
|
1483
1533
|
if (!this.model) {
|
|
1484
1534
|
throw new Error(formatNoModelSelectedMessage());
|
|
1485
1535
|
}
|
|
1536
|
+
// Capture the narrowed model now (control-flow narrowing holds immediately after the
|
|
1537
|
+
// guard) so the lazy planner-fallback closure below can use a non-undefined model.
|
|
1538
|
+
const model = this.model;
|
|
1486
1539
|
const pathEntries = this.sessionManager.getBranch();
|
|
1487
1540
|
const settings = this.settingsManager.getCompactionSettings();
|
|
1488
1541
|
const mode = options.mode ?? "standard";
|
|
@@ -1490,28 +1543,118 @@ export class AgentSession {
|
|
|
1490
1543
|
if (!preparation) {
|
|
1491
1544
|
return undefined;
|
|
1492
1545
|
}
|
|
1493
|
-
|
|
1546
|
+
// Planner fallback used when no extension supplies a deletionRequest. Auth is resolved
|
|
1547
|
+
// lazily here so extension-provided deletion requests keep working offline. Returns
|
|
1548
|
+
// undefined when auth is unavailable (auto-mode resolvers), signaling a no-op compaction.
|
|
1549
|
+
const runPlanner = async () => {
|
|
1550
|
+
const auth = await options.resolvePlannerAuth();
|
|
1551
|
+
if (!auth)
|
|
1552
|
+
return undefined;
|
|
1553
|
+
return runContextCompact(preparation, model, auth.apiKey, auth.headers, options.abortController.signal, this.thinkingLevel, mode);
|
|
1554
|
+
};
|
|
1555
|
+
// Emit session_before_compact to allow extensions to cancel or provide a deletion request.
|
|
1556
|
+
// This happens BEFORE any auth resolution so local extension deletion requests work
|
|
1557
|
+
// without configured API credentials.
|
|
1558
|
+
let fromExtension = false;
|
|
1559
|
+
let validated;
|
|
1560
|
+
if (this._extensionRunner.hasHandlers("session_before_compact")) {
|
|
1561
|
+
// Deep-clone the preparation only when a before-compact handler actually exists. Extensions
|
|
1562
|
+
// receive an isolated, frozen snapshot so they cannot mutate protection metadata
|
|
1563
|
+
// (protectedEntryIds, entry .protected flags, etc.) on the internal preparation used for
|
|
1564
|
+
// validation. Building it lazily avoids deep-cloning the transcript — largest exactly when
|
|
1565
|
+
// compaction fires — on the common no-extension path.
|
|
1566
|
+
let extensionPreparation;
|
|
1567
|
+
try {
|
|
1568
|
+
extensionPreparation = deepFreeze(structuredClone(preparation));
|
|
1569
|
+
}
|
|
1570
|
+
catch (error) {
|
|
1571
|
+
// structuredClone only throws if an entry carries a non-cloneable value (a function or a
|
|
1572
|
+
// class instance). Transcript entries are plain data today, so this guards a latent
|
|
1573
|
+
// invariant: surface a clear error instead of letting a raw DataCloneError abort an
|
|
1574
|
+
// otherwise-viable compaction.
|
|
1575
|
+
throw new Error(`Failed to snapshot transcript for compaction extensions: ${error instanceof Error ? error.message : String(error)}`);
|
|
1576
|
+
}
|
|
1577
|
+
const hookResult = (await this._extensionRunner.emit({
|
|
1578
|
+
type: "session_before_compact",
|
|
1579
|
+
reason: options.reason,
|
|
1580
|
+
mode,
|
|
1581
|
+
preparation: extensionPreparation,
|
|
1582
|
+
branchEntries: pathEntries,
|
|
1583
|
+
signal: options.abortController.signal,
|
|
1584
|
+
}));
|
|
1585
|
+
if (hookResult?.cancel) {
|
|
1586
|
+
throw new Error("Compaction cancelled");
|
|
1587
|
+
}
|
|
1588
|
+
if (hookResult?.deletionRequest) {
|
|
1589
|
+
const extensionDeletionRequest = hookResult.deletionRequest;
|
|
1590
|
+
// Reject empty deletion requests before any side effects (backup, append, rebuild).
|
|
1591
|
+
if (!Array.isArray(extensionDeletionRequest.deletions) || extensionDeletionRequest.deletions.length === 0) {
|
|
1592
|
+
throw new Error("No safe context deletions proposed by extension");
|
|
1593
|
+
}
|
|
1594
|
+
// Validate against the internal transcript snapshot, not the extension-facing clone.
|
|
1595
|
+
// Auth is NOT resolved here — local extension deletion requests work offline.
|
|
1596
|
+
validated = validateContextDeletionRequest(extensionDeletionRequest, preparation.transcript, { mode });
|
|
1597
|
+
// Reject if reconciliation reduced deletions to zero.
|
|
1598
|
+
if (validated.deletedTargets.length === 0) {
|
|
1599
|
+
throw new Error("No safe context deletions proposed by extension");
|
|
1600
|
+
}
|
|
1601
|
+
fromExtension = true;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
// Planner fallback shared by both paths: no before-compact handler at all, or a handler that
|
|
1605
|
+
// observed without supplying a deletionRequest. Resolves auth lazily; undefined means auth is
|
|
1606
|
+
// unavailable (auto-mode resolvers), so compaction is a no-op.
|
|
1607
|
+
if (!validated) {
|
|
1608
|
+
const plannerResult = await runPlanner();
|
|
1609
|
+
if (!plannerResult) {
|
|
1610
|
+
return undefined;
|
|
1611
|
+
}
|
|
1612
|
+
validated = plannerResult;
|
|
1613
|
+
}
|
|
1494
1614
|
if (options.abortController.signal.aborted) {
|
|
1495
1615
|
throw new Error("Compaction cancelled");
|
|
1496
1616
|
}
|
|
1497
1617
|
const backupPath = this.sessionManager.writeBackupSnapshot(options.backupLabel);
|
|
1498
|
-
this.sessionManager.appendContextCompaction(validated.deletedTargets, validated.protectedEntryIds, validated.stats, backupPath);
|
|
1618
|
+
const compactionEntryId = this.sessionManager.appendContextCompaction(validated.deletedTargets, validated.protectedEntryIds, validated.stats, backupPath);
|
|
1499
1619
|
const sessionContext = this.sessionManager.buildSessionContext();
|
|
1500
1620
|
this.agent.state.messages = sessionContext.messages;
|
|
1501
|
-
|
|
1621
|
+
const result = {
|
|
1502
1622
|
...validated,
|
|
1503
1623
|
promptVersion: 1,
|
|
1504
1624
|
...(backupPath ? { backupPath } : {}),
|
|
1505
1625
|
};
|
|
1626
|
+
// Emit session_compact so extensions can observe the validated result. This is a pure
|
|
1627
|
+
// observation hook fired AFTER the compaction has been committed (backup written,
|
|
1628
|
+
// context_compaction entry persisted, active context rebuilt). A misbehaving observer must
|
|
1629
|
+
// never turn a successful, already-persisted compaction into a reported failure, so any
|
|
1630
|
+
// throw is routed to the non-fatal extension-error channel and compaction still reports
|
|
1631
|
+
// success.
|
|
1632
|
+
const contextCompactionEntry = this.sessionManager.getEntry(compactionEntryId);
|
|
1633
|
+
try {
|
|
1634
|
+
await this._extensionRunner.emit({
|
|
1635
|
+
type: "session_compact",
|
|
1636
|
+
reason: options.reason,
|
|
1637
|
+
mode,
|
|
1638
|
+
result,
|
|
1639
|
+
contextCompactionEntry,
|
|
1640
|
+
fromExtension,
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
catch (error) {
|
|
1644
|
+
this._extensionRunner.emitError({
|
|
1645
|
+
extensionPath: "<session_compact>",
|
|
1646
|
+
event: "session_compact",
|
|
1647
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1648
|
+
stack: error instanceof Error ? error.stack : undefined,
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
return result;
|
|
1506
1652
|
}
|
|
1507
1653
|
/**
|
|
1508
1654
|
* Manually compact the session context using deletion-only verbatim context compaction.
|
|
1509
|
-
* Aborts current agent operation first.
|
|
1655
|
+
* Aborts current agent operation first.
|
|
1510
1656
|
*/
|
|
1511
|
-
async compact(
|
|
1512
|
-
if (customInstructions?.trim()) {
|
|
1513
|
-
throw new Error("Custom compaction instructions are not supported; use /compact without arguments");
|
|
1514
|
-
}
|
|
1657
|
+
async compact() {
|
|
1515
1658
|
this._disconnectFromAgent();
|
|
1516
1659
|
await this.abort();
|
|
1517
1660
|
this._compactionAbortController = new AbortController();
|
|
@@ -1520,12 +1663,14 @@ export class AgentSession {
|
|
|
1520
1663
|
if (!this.model) {
|
|
1521
1664
|
throw new Error(formatNoModelSelectedMessage());
|
|
1522
1665
|
}
|
|
1523
|
-
|
|
1666
|
+
// Auth is resolved lazily: only called when the planner fallback is needed.
|
|
1667
|
+
// Extensions that provide a deletionRequest work without configured credentials.
|
|
1668
|
+
const model = this.model;
|
|
1524
1669
|
const result = await this._applyContextVerbatimCompaction({
|
|
1525
|
-
|
|
1526
|
-
headers,
|
|
1670
|
+
resolvePlannerAuth: () => this._getRequiredRequestAuth(model),
|
|
1527
1671
|
abortController: this._compactionAbortController,
|
|
1528
1672
|
backupLabel: "compact",
|
|
1673
|
+
reason: "manual",
|
|
1529
1674
|
});
|
|
1530
1675
|
if (!result) {
|
|
1531
1676
|
throw new Error("Nothing to compact (session too small)");
|
|
@@ -1570,12 +1715,14 @@ export class AgentSession {
|
|
|
1570
1715
|
if (!this.model) {
|
|
1571
1716
|
throw new Error(formatNoModelSelectedMessage());
|
|
1572
1717
|
}
|
|
1573
|
-
|
|
1718
|
+
// Auth is resolved lazily: only called when the planner fallback is needed.
|
|
1719
|
+
// Extensions that provide a deletionRequest work without configured credentials.
|
|
1720
|
+
const model = this.model;
|
|
1574
1721
|
const result = await this._applyContextVerbatimCompaction({
|
|
1575
|
-
|
|
1576
|
-
headers,
|
|
1722
|
+
resolvePlannerAuth: () => this._getRequiredRequestAuth(model),
|
|
1577
1723
|
abortController: this._compactionAbortController,
|
|
1578
1724
|
backupLabel: "context-compact",
|
|
1725
|
+
reason: "manual",
|
|
1579
1726
|
});
|
|
1580
1727
|
if (!result) {
|
|
1581
1728
|
throw new Error("Nothing to context-compact (session too small)");
|
|
@@ -1754,23 +1901,24 @@ export class AgentSession {
|
|
|
1754
1901
|
});
|
|
1755
1902
|
return;
|
|
1756
1903
|
}
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
aborted: false,
|
|
1764
|
-
willRetry: false,
|
|
1765
|
-
});
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1904
|
+
// Auth is resolved lazily: only called when the planner fallback is needed.
|
|
1905
|
+
// This allows extension-provided deletion requests to run before auth is checked,
|
|
1906
|
+
// enabling local extension compaction even when API credentials are unavailable.
|
|
1907
|
+
// Auto-mode resolver returns undefined (rather than throwing) when auth is missing,
|
|
1908
|
+
// so compaction silently no-ops if the planner would be needed but credentials are absent.
|
|
1909
|
+
const model = this.model;
|
|
1768
1910
|
const result = await this._applyContextVerbatimCompaction({
|
|
1769
|
-
|
|
1770
|
-
|
|
1911
|
+
resolvePlannerAuth: async () => {
|
|
1912
|
+
const authResult = await this._modelRegistry.getApiKeyAndHeaders(model);
|
|
1913
|
+
if (!authResult.ok || !authResult.apiKey) {
|
|
1914
|
+
return undefined;
|
|
1915
|
+
}
|
|
1916
|
+
return { apiKey: authResult.apiKey, headers: authResult.headers };
|
|
1917
|
+
},
|
|
1771
1918
|
abortController: this._autoCompactionAbortController,
|
|
1772
1919
|
backupLabel: reason === "overflow" ? "overflow-auto-compact" : "auto-compact",
|
|
1773
1920
|
mode: reason === "overflow" ? "critical_overflow" : "standard",
|
|
1921
|
+
reason,
|
|
1774
1922
|
});
|
|
1775
1923
|
if (!result) {
|
|
1776
1924
|
this._emit({
|
|
@@ -1822,6 +1970,9 @@ export class AgentSession {
|
|
|
1822
1970
|
if (bindings.uiContext !== undefined) {
|
|
1823
1971
|
this._extensionUIContext = bindings.uiContext;
|
|
1824
1972
|
}
|
|
1973
|
+
if (bindings.mode !== undefined) {
|
|
1974
|
+
this._extensionMode = bindings.mode;
|
|
1975
|
+
}
|
|
1825
1976
|
if (bindings.commandContextActions !== undefined) {
|
|
1826
1977
|
this._extensionCommandContextActions = bindings.commandContextActions;
|
|
1827
1978
|
}
|
|
@@ -1876,7 +2027,7 @@ export class AgentSession {
|
|
|
1876
2027
|
return `extension:${name}`;
|
|
1877
2028
|
}
|
|
1878
2029
|
_applyExtensionBindings(runner) {
|
|
1879
|
-
runner.setUIContext(this._extensionUIContext);
|
|
2030
|
+
runner.setUIContext(this._extensionUIContext, this._extensionMode);
|
|
1880
2031
|
runner.bindCommandContext(this._extensionCommandContextActions);
|
|
1881
2032
|
this._extensionErrorUnsubscriber?.();
|
|
1882
2033
|
this._extensionErrorUnsubscriber = this._extensionErrorListener
|
|
@@ -1964,6 +2115,7 @@ export class AgentSession {
|
|
|
1964
2115
|
}, {
|
|
1965
2116
|
getModel: () => this.model,
|
|
1966
2117
|
isIdle: () => !this.isStreaming,
|
|
2118
|
+
isProjectTrusted: () => this.settingsManager.isProjectTrusted(),
|
|
1967
2119
|
getSignal: () => this.agent.signal,
|
|
1968
2120
|
abort: () => this.abort(),
|
|
1969
2121
|
hasPendingMessages: () => this.pendingMessageCount > 0,
|
|
@@ -1974,7 +2126,7 @@ export class AgentSession {
|
|
|
1974
2126
|
compact: (options) => {
|
|
1975
2127
|
void (async () => {
|
|
1976
2128
|
try {
|
|
1977
|
-
const result = await this.compact(
|
|
2129
|
+
const result = await this.compact();
|
|
1978
2130
|
options?.onComplete?.(result);
|
|
1979
2131
|
}
|
|
1980
2132
|
catch (error) {
|
|
@@ -1984,6 +2136,7 @@ export class AgentSession {
|
|
|
1984
2136
|
})();
|
|
1985
2137
|
},
|
|
1986
2138
|
getSystemPrompt: () => this.systemPrompt,
|
|
2139
|
+
getSystemPromptOptions: () => this._baseSystemPromptOptions,
|
|
1987
2140
|
}, {
|
|
1988
2141
|
registerProvider: (name, config) => {
|
|
1989
2142
|
this._modelRegistry.registerProvider(name, config);
|
|
@@ -2442,6 +2595,7 @@ export class AgentSession {
|
|
|
2442
2595
|
customInstructions,
|
|
2443
2596
|
replaceInstructions,
|
|
2444
2597
|
reserveTokens: branchSummarySettings.reserveTokens,
|
|
2598
|
+
streamFn: this.agent.streamFn,
|
|
2445
2599
|
});
|
|
2446
2600
|
if (result.aborted) {
|
|
2447
2601
|
return { cancelled: true, aborted: true };
|