savant-code 0.0.19 → 0.0.20
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/README.md +381 -550
- package/{cli/release/index.js → index.js} +0 -0
- package/package.json +44 -71
- package/.agents/skills/coding-csharp/SKILL.md +0 -82
- package/.agents/skills/coding-go/SKILL.md +0 -76
- package/.agents/skills/coding-java/SKILL.md +0 -79
- package/.agents/skills/coding-python/SKILL.md +0 -87
- package/.agents/skills/coding-rust/SKILL.md +0 -83
- package/.agents/skills/coding-typescript/SKILL.md +0 -90
- package/.agents/skills/release-workflow/SKILL.md +0 -69
- package/.bun-version +0 -1
- package/.commandcode/settings.json +0 -11
- package/.commandcode/taste/workflow/taste.md +0 -6
- package/.env.example +0 -95
- package/.gitattributes +0 -43
- package/.githooks/pre-push +0 -35
- package/.github/workflows/build-release-binaries.yml +0 -163
- package/.markdownlint.json +0 -42
- package/.markdownlintignore +0 -21
- package/.prettierignore +0 -9
- package/.prettierrc +0 -23
- package/.savantignore +0 -3
- package/AGENTS.md +0 -97
- package/ARCHITECTURE.md +0 -241
- package/CHANGELOG.md +0 -2631
- package/CONTRIBUTING.md +0 -88
- package/ECHO-freebuff.md +0 -22
- package/ECHO.md +0 -722
- package/FREEREADME.md +0 -35
- package/LEARNINGS.md +0 -345
- package/NOTICE +0 -15
- package/README.zh-CN.md +0 -479
- package/SECURITY.md +0 -8
- package/VERSION +0 -1
- package/WINDOWS.md +0 -238
- package/agents/README.md +0 -41
- package/agents/base-chat.ts +0 -44
- package/agents/basher.ts +0 -107
- package/agents/browser-use/browser-use.test.ts +0 -211
- package/agents/browser-use/browser-use.ts +0 -259
- package/agents/constants.ts +0 -1
- package/agents/context-pruner.ts +0 -1076
- package/agents/detective/detective.ts +0 -168
- package/agents/editor/best-of-n/best-of-n-selector2.ts +0 -148
- package/agents/editor/best-of-n/editor-implementor-gpt-5.ts +0 -7
- package/agents/editor/best-of-n/editor-implementor-opus.ts +0 -7
- package/agents/editor/best-of-n/editor-implementor.ts +0 -196
- package/agents/editor/best-of-n/editor-multi-prompt.ts +0 -265
- package/agents/file-explorer/directory-lister.ts +0 -92
- package/agents/file-explorer/glob-matcher.ts +0 -96
- package/agents/forge/forge.ts +0 -146
- package/agents/librarian/librarian.test.ts +0 -289
- package/agents/librarian/librarian.ts +0 -158
- package/agents/package.json +0 -11
- package/agents/recorder/recorder.ts +0 -104
- package/agents/researcher/researcher-docs.ts +0 -32
- package/agents/researcher/researcher-web.ts +0 -40
- package/agents/savant/savant-analyze.ts +0 -11
- package/agents/savant/savant-free-deepseek-flash.ts +0 -13
- package/agents/savant/savant-free-deepseek.ts +0 -13
- package/agents/savant/savant-free-evals.ts +0 -9
- package/agents/savant/savant-free-glm.ts +0 -13
- package/agents/savant/savant-free-kimi.ts +0 -13
- package/agents/savant/savant-free-mimo-pro.ts +0 -13
- package/agents/savant/savant-free-mimo.ts +0 -13
- package/agents/savant/savant-free-minimax-m3.ts +0 -13
- package/agents/savant/savant-free.ts +0 -9
- package/agents/savant/savant-scaffold.ts +0 -15
- package/agents/savant/savant.ts +0 -706
- package/agents/scout/scout.ts +0 -305
- package/agents/scribe/scribe.ts +0 -54
- package/agents/thinker/thinker-gemini.ts +0 -26
- package/agents/thinker/thinker-gpt.ts +0 -21
- package/agents/thinker/thinker-with-files-gemini.ts +0 -66
- package/agents/thinker/thinker.ts +0 -99
- package/agents/tmux-cli.ts +0 -724
- package/agents/tsconfig.json +0 -12
- package/agents/types/agent-definition.ts +0 -1
- package/agents/types/secret-agent-definition.ts +0 -103
- package/agents/types/tools.ts +0 -465
- package/agents/types/util-types.ts +0 -167
- package/agents/verifier/verifier.ts +0 -80
- package/art/savant-redesign.md +0 -7
- package/art/savant-text-graf.md +0 -5
- package/art/savant_ascii.md +0 -88
- package/assets/banner.png +0 -0
- package/bun.lock +0 -1979
- package/bunfig.toml +0 -7
- package/cli/README.md +0 -111
- package/cli/bunfig.toml +0 -2
- package/cli/cli_exit +0 -1
- package/cli/package.json +0 -66
- package/cli/release/README.md +0 -348
- package/cli/release/package.json +0 -56
- package/cli/release-core/README.md +0 -20
- package/cli/release-core/package.json +0 -4
- package/cli/release-core/prepare-package.js +0 -31
- package/cli/release-staging/README.md +0 -70
- package/cli/release-staging/index.js +0 -42
- package/cli/release-staging/package.json +0 -43
- package/cli/scripts/build-binary.ts +0 -469
- package/cli/scripts/clean.ts +0 -16
- package/cli/scripts/prebuild-agents.ts +0 -250
- package/cli/scripts/release.ts +0 -103
- package/cli/scripts/smoke-binary.ts +0 -280
- package/cli/scripts/test-sdk-file-hooks.sh +0 -87
- package/cli/scripts/validate-cli-with-tmux.sh +0 -43
- package/cli/src/__tests__/README.md +0 -256
- package/cli/src/__tests__/bash-mode.test.ts +0 -442
- package/cli/src/__tests__/cli-args.test.ts +0 -241
- package/cli/src/__tests__/e2e/first-time-login.test.ts +0 -173
- package/cli/src/__tests__/e2e/logout-relogin-flow.test.ts +0 -110
- package/cli/src/__tests__/e2e/returning-user-auth.test.ts +0 -111
- package/cli/src/__tests__/e2e-cli.test.ts +0 -185
- package/cli/src/__tests__/helpers/mock-api-client.ts +0 -64
- package/cli/src/__tests__/helpers/terminal-watchdog-fixture.ts +0 -50
- package/cli/src/__tests__/home-directory-detection.test.ts +0 -213
- package/cli/src/__tests__/integration/agent-toolnames-validation.test.ts +0 -63
- package/cli/src/__tests__/integration/api-integration.test.ts +0 -289
- package/cli/src/__tests__/integration/credentials-storage.test.ts +0 -453
- package/cli/src/__tests__/integration/local-agents.test.ts +0 -1187
- package/cli/src/__tests__/integration/login-flow-instrumentation.test.ts +0 -146
- package/cli/src/__tests__/integration/login-polling-working.test.ts +0 -287
- package/cli/src/__tests__/integration/usage-refresh-on-completion.test.ts +0 -177
- package/cli/src/__tests__/integration-tmux.test.ts +0 -186
- package/cli/src/__tests__/mocks/hover-toggle-controller.ts +0 -71
- package/cli/src/__tests__/path-completion.test.ts +0 -243
- package/cli/src/__tests__/project-files-chat-id.test.ts +0 -34
- package/cli/src/__tests__/release/proxy-http-get.test.ts +0 -670
- package/cli/src/__tests__/release/wrapper-safety.test.ts +0 -177
- package/cli/src/__tests__/rerender-perf.integration.test.ts +0 -283
- package/cli/src/__tests__/terminal-reset-sequences.test.ts +0 -36
- package/cli/src/__tests__/terminal-watchdog.test.ts +0 -114
- package/cli/src/__tests__/test-utils.ts +0 -266
- package/cli/src/__tests__/tmux-poc.ts +0 -150
- package/cli/src/__tests__/unit/agent-mode-toggle.test.ts +0 -138
- package/cli/src/__tests__/unit/copy-button.test.tsx +0 -188
- package/cli/src/__tests__/unit/create-run-config.test.ts +0 -77
- package/cli/src/__tests__/unit/publish-confirmation.test.ts +0 -70
- package/cli/src/__tests__/unit/segmented-control.test.ts +0 -167
- package/cli/src/__tests__/utils/env.test.ts +0 -210
- package/cli/src/__tests__/utils/project-picker.test.ts +0 -39
- package/cli/src/agents/bundled-agents.generated.d.ts +0 -14
- package/cli/src/agents/bundled-agents.generated.ts +0 -1962
- package/cli/src/app.tsx +0 -383
- package/cli/src/chat.tsx +0 -2008
- package/cli/src/cli-args.ts +0 -183
- package/cli/src/commands/__tests__/bash-command.test.ts +0 -449
- package/cli/src/commands/__tests__/command-args.test.ts +0 -325
- package/cli/src/commands/__tests__/copy-conversation.test.ts +0 -240
- package/cli/src/commands/__tests__/dev-command.test.ts +0 -128
- package/cli/src/commands/__tests__/diagnostics-command.test.ts +0 -35
- package/cli/src/commands/__tests__/image.test.ts +0 -99
- package/cli/src/commands/__tests__/init.test.ts +0 -479
- package/cli/src/commands/__tests__/loop-command.test.ts +0 -89
- package/cli/src/commands/__tests__/new-command-rotates-chat.test.ts +0 -87
- package/cli/src/commands/__tests__/permissions-command.test.ts +0 -93
- package/cli/src/commands/__tests__/process-diagnostics.test.ts +0 -54
- package/cli/src/commands/__tests__/prompt-builders.test.ts +0 -69
- package/cli/src/commands/__tests__/registry-gating.test.ts +0 -125
- package/cli/src/commands/__tests__/rewind-command.test.ts +0 -227
- package/cli/src/commands/__tests__/router-connect-chatgpt.test.ts +0 -72
- package/cli/src/commands/__tests__/router-input.test.ts +0 -302
- package/cli/src/commands/__tests__/router-provider-setup.test.ts +0 -180
- package/cli/src/commands/__tests__/savant-free-command-aliases.test.ts +0 -56
- package/cli/src/commands/ads.ts +0 -45
- package/cli/src/commands/command-registry.ts +0 -1112
- package/cli/src/commands/copy-conversation.ts +0 -386
- package/cli/src/commands/goal.ts +0 -87
- package/cli/src/commands/health-command.ts +0 -61
- package/cli/src/commands/help.ts +0 -13
- package/cli/src/commands/image.ts +0 -20
- package/cli/src/commands/init.ts +0 -121
- package/cli/src/commands/loop.ts +0 -182
- package/cli/src/commands/process-diagnostics.ts +0 -120
- package/cli/src/commands/prompt-builders.ts +0 -140
- package/cli/src/commands/publish.ts +0 -261
- package/cli/src/commands/rewind.ts +0 -130
- package/cli/src/commands/router-utils.ts +0 -80
- package/cli/src/commands/router.ts +0 -589
- package/cli/src/commands/telemetry.ts +0 -68
- package/cli/src/commands/usage.ts +0 -26
- package/cli/src/components/__tests__/ad-banner.test.tsx +0 -84
- package/cli/src/components/__tests__/block-helpers.test.tsx +0 -139
- package/cli/src/components/__tests__/clickable.test.tsx +0 -39
- package/cli/src/components/__tests__/grid-layout.integration.test.tsx +0 -365
- package/cli/src/components/__tests__/grid-layout.test.tsx +0 -1033
- package/cli/src/components/__tests__/markdown-content.test.tsx +0 -163
- package/cli/src/components/__tests__/message-block.completion.test.tsx +0 -104
- package/cli/src/components/__tests__/message-block.streaming.test.tsx +0 -78
- package/cli/src/components/__tests__/message-with-agents.test.tsx +0 -571
- package/cli/src/components/__tests__/multiline-input.test.tsx +0 -1129
- package/cli/src/components/__tests__/selectable-list.test.ts +0 -232
- package/cli/src/components/__tests__/shimmer-text.test.tsx +0 -32
- package/cli/src/components/__tests__/status-indicator.test.tsx +0 -184
- package/cli/src/components/__tests__/user-error-banner.test.tsx +0 -100
- package/cli/src/components/ad-banner.tsx +0 -351
- package/cli/src/components/agent-checklist.tsx +0 -385
- package/cli/src/components/agent-mode-toggle.tsx +0 -294
- package/cli/src/components/ask-user/__tests__/multiple-choice-form.test.ts +0 -432
- package/cli/src/components/ask-user/__tests__/validation.test.ts +0 -213
- package/cli/src/components/ask-user/components/accordion-question.tsx +0 -153
- package/cli/src/components/ask-user/components/custom-answer-input.tsx +0 -66
- package/cli/src/components/ask-user/components/options-list.tsx +0 -139
- package/cli/src/components/ask-user/components/question-header.tsx +0 -80
- package/cli/src/components/ask-user/components/question-option.tsx +0 -94
- package/cli/src/components/ask-user/constants.ts +0 -35
- package/cli/src/components/ask-user/index.tsx +0 -660
- package/cli/src/components/ask-user/utils/validation.ts +0 -85
- package/cli/src/components/attachment-card.tsx +0 -67
- package/cli/src/components/blocks/agent-block-grid.tsx +0 -58
- package/cli/src/components/blocks/agent-branch-item.tsx +0 -230
- package/cli/src/components/blocks/agent-branch-wrapper.tsx +0 -524
- package/cli/src/components/blocks/agent-list-branch.tsx +0 -77
- package/cli/src/components/blocks/ask-user-branch.tsx +0 -98
- package/cli/src/components/blocks/block-helpers.tsx +0 -257
- package/cli/src/components/blocks/blocks-renderer.tsx +0 -296
- package/cli/src/components/blocks/content-with-markdown.tsx +0 -34
- package/cli/src/components/blocks/copy-button.tsx +0 -106
- package/cli/src/components/blocks/copyable-block.tsx +0 -47
- package/cli/src/components/blocks/image-block.tsx +0 -128
- package/cli/src/components/blocks/implementor-row.tsx +0 -453
- package/cli/src/components/blocks/markdown-content.tsx +0 -360
- package/cli/src/components/blocks/markdown-renderables.tsx +0 -347
- package/cli/src/components/blocks/single-block.tsx +0 -210
- package/cli/src/components/blocks/thinking-block.tsx +0 -77
- package/cli/src/components/blocks/tool-block-group.tsx +0 -72
- package/cli/src/components/blocks/tool-branch.tsx +0 -196
- package/cli/src/components/blocks/user-content-copy.tsx +0 -171
- package/cli/src/components/bottom-banner.tsx +0 -145
- package/cli/src/components/build-mode-buttons.tsx +0 -110
- package/cli/src/components/button.tsx +0 -75
- package/cli/src/components/chat-header.tsx +0 -11
- package/cli/src/components/chat-history-screen.tsx +0 -417
- package/cli/src/components/chat-input-bar.tsx +0 -535
- package/cli/src/components/chatgpt-connect-banner.tsx +0 -234
- package/cli/src/components/clickable.tsx +0 -149
- package/cli/src/components/collapse-button.tsx +0 -36
- package/cli/src/components/command-palette.tsx +0 -166
- package/cli/src/components/copy-button.tsx +0 -219
- package/cli/src/components/dialog.tsx +0 -111
- package/cli/src/components/elapsed-timer.tsx +0 -56
- package/cli/src/components/error-boundary.tsx +0 -63
- package/cli/src/components/feedback-container.tsx +0 -206
- package/cli/src/components/feedback-icon-button.tsx +0 -89
- package/cli/src/components/feedback-input-mode.tsx +0 -352
- package/cli/src/components/file-attachment-card.tsx +0 -89
- package/cli/src/components/grid-layout.tsx +0 -83
- package/cli/src/components/help-banner.tsx +0 -136
- package/cli/src/components/highlighted-text.tsx +0 -52
- package/cli/src/components/image-card.tsx +0 -167
- package/cli/src/components/image-thumbnail.tsx +0 -112
- package/cli/src/components/input-cursor.tsx +0 -77
- package/cli/src/components/input-mode-banner.tsx +0 -70
- package/cli/src/components/load-previous-button.tsx +0 -48
- package/cli/src/components/login-modal.tsx +0 -450
- package/cli/src/components/message-block.tsx +0 -337
- package/cli/src/components/message-footer.tsx +0 -269
- package/cli/src/components/message-with-agents.tsx +0 -594
- package/cli/src/components/mode-divider.tsx +0 -43
- package/cli/src/components/model-picker.tsx +0 -371
- package/cli/src/components/multiline-input.tsx +0 -1276
- package/cli/src/components/out-of-credits-banner.tsx +0 -155
- package/cli/src/components/pending-attachments-banner.tsx +0 -125
- package/cli/src/components/pending-bash-message.tsx +0 -57
- package/cli/src/components/progress-bar.tsx +0 -81
- package/cli/src/components/project-picker-screen.tsx +0 -469
- package/cli/src/components/provider-picker.tsx +0 -139
- package/cli/src/components/publish-confirmation.tsx +0 -514
- package/cli/src/components/publish-container.tsx +0 -737
- package/cli/src/components/raised-pill.tsx +0 -89
- package/cli/src/components/renderers/plan-box.tsx +0 -70
- package/cli/src/components/review-screen.tsx +0 -114
- package/cli/src/components/rewind-picker.tsx +0 -276
- package/cli/src/components/right-sidebar.tsx +0 -296
- package/cli/src/components/savant-free-active-session-summary.tsx +0 -63
- package/cli/src/components/savant-free-landing-screen.tsx +0 -756
- package/cli/src/components/savant-free-model-selector.tsx +0 -815
- package/cli/src/components/savant-free-referral-banner.tsx +0 -423
- package/cli/src/components/savant-free-superseded-screen.tsx +0 -62
- package/cli/src/components/savant-ui/animation/pulse.tsx +0 -26
- package/cli/src/components/savant-ui/animation/typewriter.tsx +0 -40
- package/cli/src/components/savant-ui/branding.tsx +0 -59
- package/cli/src/components/savant-ui/data-display/badge.tsx +0 -52
- package/cli/src/components/savant-ui/data-display/code-block.tsx +0 -55
- package/cli/src/components/savant-ui/data-display/key-value.tsx +0 -34
- package/cli/src/components/savant-ui/data-display/sparkline.tsx +0 -42
- package/cli/src/components/savant-ui/data-display/timeline.tsx +0 -44
- package/cli/src/components/savant-ui/data-display/tree-view.tsx +0 -55
- package/cli/src/components/savant-ui/echo/__tests__/sidebar-collapse.test.tsx +0 -90
- package/cli/src/components/savant-ui/echo/agent-stack.tsx +0 -72
- package/cli/src/components/savant-ui/echo/agent-status.tsx +0 -66
- package/cli/src/components/savant-ui/echo/fid-card.tsx +0 -89
- package/cli/src/components/savant-ui/echo/fid-list.tsx +0 -68
- package/cli/src/components/savant-ui/echo/loop-status-panel.tsx +0 -64
- package/cli/src/components/savant-ui/echo/perfection-loop.tsx +0 -118
- package/cli/src/components/savant-ui/echo/phase-indicator.tsx +0 -68
- package/cli/src/components/savant-ui/echo/phase-info.ts +0 -72
- package/cli/src/components/savant-ui/echo/token-meter.tsx +0 -39
- package/cli/src/components/savant-ui/feedback/alert.tsx +0 -45
- package/cli/src/components/savant-ui/feedback/cost-tracker.tsx +0 -54
- package/cli/src/components/savant-ui/feedback/progress-bar.tsx +0 -71
- package/cli/src/components/savant-ui/feedback/spinner.tsx +0 -40
- package/cli/src/components/savant-ui/icon-theme-keys.ts +0 -67
- package/cli/src/components/savant-ui/icon.tsx +0 -53
- package/cli/src/components/savant-ui/index.ts +0 -75
- package/cli/src/components/savant-ui/input/select.tsx +0 -26
- package/cli/src/components/savant-ui/input/toggle.tsx +0 -28
- package/cli/src/components/savant-ui/layout/grid.tsx +0 -52
- package/cli/src/components/savant-ui/layout/header.tsx +0 -28
- package/cli/src/components/savant-ui/navigation/stepper.tsx +0 -41
- package/cli/src/components/savant-ui/primitives/key-hint.tsx +0 -45
- package/cli/src/components/savant-ui/primitives/key-value-row.tsx +0 -41
- package/cli/src/components/savant-ui/primitives/panel.tsx +0 -42
- package/cli/src/components/savant-ui/primitives/separator.tsx +0 -34
- package/cli/src/components/savant-ui/primitives/sidebar-section.tsx +0 -64
- package/cli/src/components/savant-ui/primitives/spacer.tsx +0 -13
- package/cli/src/components/savant-ui/primitives/stack.tsx +0 -35
- package/cli/src/components/savant-ui/theme.ts +0 -45
- package/cli/src/components/scroll-to-bottom-button.tsx +0 -34
- package/cli/src/components/segmented-control.tsx +0 -199
- package/cli/src/components/selectable-list.tsx +0 -249
- package/cli/src/components/selected-chips.tsx +0 -86
- package/cli/src/components/separator.tsx +0 -40
- package/cli/src/components/session-ended-banner.tsx +0 -183
- package/cli/src/components/shimmer-text.tsx +0 -254
- package/cli/src/components/status-bar.tsx +0 -279
- package/cli/src/components/subscription-limit-banner.tsx +0 -269
- package/cli/src/components/suggested-prompts.tsx +0 -184
- package/cli/src/components/suggestion-menu.tsx +0 -219
- package/cli/src/components/terminal-command-display.tsx +0 -152
- package/cli/src/components/terminal-link.tsx +0 -97
- package/cli/src/components/text-attachment-card.tsx +0 -77
- package/cli/src/components/thinking.tsx +0 -108
- package/cli/src/components/toast.tsx +0 -109
- package/cli/src/components/tools/__tests__/apply-patch.test.tsx +0 -97
- package/cli/src/components/tools/__tests__/code-search.test.tsx +0 -45
- package/cli/src/components/tools/__tests__/gravity-index.test.ts +0 -76
- package/cli/src/components/tools/__tests__/render-ui.test.tsx +0 -556
- package/cli/src/components/tools/__tests__/run-terminal-command.test.ts +0 -274
- package/cli/src/components/tools/__tests__/tool-call-item.test.tsx +0 -73
- package/cli/src/components/tools/apply-patch.tsx +0 -101
- package/cli/src/components/tools/code-search.tsx +0 -50
- package/cli/src/components/tools/composio.tsx +0 -140
- package/cli/src/components/tools/diff-viewer.tsx +0 -21
- package/cli/src/components/tools/glob.tsx +0 -66
- package/cli/src/components/tools/gravity-index.tsx +0 -80
- package/cli/src/components/tools/list-directory.tsx +0 -66
- package/cli/src/components/tools/read-docs.tsx +0 -36
- package/cli/src/components/tools/read-files.tsx +0 -97
- package/cli/src/components/tools/read-subtree.tsx +0 -40
- package/cli/src/components/tools/read-url.tsx +0 -32
- package/cli/src/components/tools/registry.ts +0 -131
- package/cli/src/components/tools/render-ui.tsx +0 -466
- package/cli/src/components/tools/run-terminal-command.tsx +0 -86
- package/cli/src/components/tools/skill.tsx +0 -26
- package/cli/src/components/tools/str-replace.tsx +0 -77
- package/cli/src/components/tools/suggest-followups.tsx +0 -373
- package/cli/src/components/tools/task-completed.tsx +0 -16
- package/cli/src/components/tools/tool-call-item.tsx +0 -163
- package/cli/src/components/tools/types.ts +0 -100
- package/cli/src/components/tools/web-search.tsx +0 -32
- package/cli/src/components/tools/write-file.tsx +0 -20
- package/cli/src/components/tools/write-todos.tsx +0 -105
- package/cli/src/components/top-banner.tsx +0 -187
- package/cli/src/components/usage-banner.tsx +0 -296
- package/cli/src/components/user-error-banner.tsx +0 -54
- package/cli/src/components/validation-error-popover.tsx +0 -191
- package/cli/src/data/slash-commands.ts +0 -306
- package/cli/src/hooks/__tests__/holds-live-savant-free-slot.test.ts +0 -49
- package/cli/src/hooks/__tests__/run-outcome.test.ts +0 -178
- package/cli/src/hooks/__tests__/session-fetch-signal.test.ts +0 -45
- package/cli/src/hooks/__tests__/use-activity-query.test.ts +0 -810
- package/cli/src/hooks/__tests__/use-ask-user-bridge.test.ts +0 -175
- package/cli/src/hooks/__tests__/use-auth-query.test.ts +0 -21
- package/cli/src/hooks/__tests__/use-chat-messages-collapse.test.ts +0 -96
- package/cli/src/hooks/__tests__/use-connection-status.test.ts +0 -112
- package/cli/src/hooks/__tests__/use-directory-browser.test.ts +0 -215
- package/cli/src/hooks/__tests__/use-gravity-ad.test.ts +0 -73
- package/cli/src/hooks/__tests__/use-grid-layout.test.ts +0 -346
- package/cli/src/hooks/__tests__/use-input-history.test.ts +0 -704
- package/cli/src/hooks/__tests__/use-loop-scheduler.test.ts +0 -247
- package/cli/src/hooks/__tests__/use-path-tab-completion.test.ts +0 -324
- package/cli/src/hooks/__tests__/use-queue-controls.test.ts +0 -68
- package/cli/src/hooks/__tests__/use-searchable-list.test.ts +0 -364
- package/cli/src/hooks/__tests__/use-send-message-timer.test.ts +0 -146
- package/cli/src/hooks/__tests__/use-suggestion-engine-mention.test.ts +0 -364
- package/cli/src/hooks/__tests__/use-suggestion-engine.test.ts +0 -485
- package/cli/src/hooks/__tests__/use-terminal-focus.test.ts +0 -66
- package/cli/src/hooks/__tests__/use-terminal-layout.test.ts +0 -675
- package/cli/src/hooks/__tests__/use-timeout.test.ts +0 -330
- package/cli/src/hooks/__tests__/use-usage-query.test.ts +0 -526
- package/cli/src/hooks/__tests__/use-user-details-query.test.ts +0 -225
- package/cli/src/hooks/helpers/__tests__/send-message.test.ts +0 -1851
- package/cli/src/hooks/helpers/send-message.ts +0 -553
- package/cli/src/hooks/run-outcome.ts +0 -64
- package/cli/src/hooks/stream-state.ts +0 -106
- package/cli/src/hooks/use-activity-query.ts +0 -696
- package/cli/src/hooks/use-agent-validation.ts +0 -80
- package/cli/src/hooks/use-ask-user-bridge.ts +0 -102
- package/cli/src/hooks/use-auth-query.ts +0 -261
- package/cli/src/hooks/use-auth-state.ts +0 -155
- package/cli/src/hooks/use-chat-input.ts +0 -87
- package/cli/src/hooks/use-chat-keyboard.ts +0 -325
- package/cli/src/hooks/use-chat-messages.ts +0 -273
- package/cli/src/hooks/use-chat-state.ts +0 -219
- package/cli/src/hooks/use-chat-streaming.ts +0 -270
- package/cli/src/hooks/use-chat-ui.ts +0 -136
- package/cli/src/hooks/use-clipboard.ts +0 -154
- package/cli/src/hooks/use-connection-status.ts +0 -156
- package/cli/src/hooks/use-directory-browser.ts +0 -88
- package/cli/src/hooks/use-elapsed-time.ts +0 -116
- package/cli/src/hooks/use-event.ts +0 -36
- package/cli/src/hooks/use-exit-handler.ts +0 -108
- package/cli/src/hooks/use-fetch-login-url.ts +0 -65
- package/cli/src/hooks/use-fids.ts +0 -48
- package/cli/src/hooks/use-fingerprint.ts +0 -64
- package/cli/src/hooks/use-gravity-ad.ts +0 -688
- package/cli/src/hooks/use-grid-layout.ts +0 -78
- package/cli/src/hooks/use-input-history.ts +0 -173
- package/cli/src/hooks/use-login-keyboard-handlers.ts +0 -74
- package/cli/src/hooks/use-login-polling.ts +0 -120
- package/cli/src/hooks/use-logo.tsx +0 -178
- package/cli/src/hooks/use-loop-scheduler.ts +0 -481
- package/cli/src/hooks/use-message-queue.ts +0 -301
- package/cli/src/hooks/use-now.ts +0 -20
- package/cli/src/hooks/use-path-tab-completion.ts +0 -88
- package/cli/src/hooks/use-publish-mutation.ts +0 -60
- package/cli/src/hooks/use-queue-controls.ts +0 -70
- package/cli/src/hooks/use-queue-ui.ts +0 -55
- package/cli/src/hooks/use-savant-free-ctrl-c-exit.ts +0 -23
- package/cli/src/hooks/use-savant-free-session-progress.ts +0 -34
- package/cli/src/hooks/use-savant-free-session.ts +0 -679
- package/cli/src/hooks/use-savant-free-streak-query.ts +0 -72
- package/cli/src/hooks/use-scaffold-confirm.ts +0 -62
- package/cli/src/hooks/use-scaffold-revert-subscriber.ts +0 -66
- package/cli/src/hooks/use-scroll-management.ts +0 -182
- package/cli/src/hooks/use-searchable-list.ts +0 -99
- package/cli/src/hooks/use-send-message.ts +0 -1038
- package/cli/src/hooks/use-sheen-animation.tsx +0 -88
- package/cli/src/hooks/use-subscription-query.ts +0 -106
- package/cli/src/hooks/use-suggestion-engine.ts +0 -793
- package/cli/src/hooks/use-terminal-breakpoints.ts +0 -77
- package/cli/src/hooks/use-terminal-dimensions.ts +0 -50
- package/cli/src/hooks/use-terminal-focus.ts +0 -146
- package/cli/src/hooks/use-terminal-layout.ts +0 -189
- package/cli/src/hooks/use-theme.tsx +0 -140
- package/cli/src/hooks/use-timeout.ts +0 -88
- package/cli/src/hooks/use-toast.ts +0 -114
- package/cli/src/hooks/use-update-preference.ts +0 -77
- package/cli/src/hooks/use-usage-monitor.ts +0 -59
- package/cli/src/hooks/use-usage-query.ts +0 -138
- package/cli/src/hooks/use-user-details-query.ts +0 -104
- package/cli/src/hooks/use-why-did-you-update.ts +0 -178
- package/cli/src/index.tsx +0 -484
- package/cli/src/init/__tests__/init-direnv.test.ts +0 -597
- package/cli/src/init/init-app.ts +0 -54
- package/cli/src/init/init-direnv.ts +0 -133
- package/cli/src/login/constants.ts +0 -71
- package/cli/src/login/login-flow.ts +0 -224
- package/cli/src/login/plain-login.ts +0 -107
- package/cli/src/login/utils.ts +0 -183
- package/cli/src/native/ripgrep.ts +0 -82
- package/cli/src/polyfills/bun-strip-ansi.ts +0 -12
- package/cli/src/pre-init/load-dev-env.ts +0 -98
- package/cli/src/pre-init/tree-sitter-wasm.ts +0 -98
- package/cli/src/project-files.ts +0 -102
- package/cli/src/state/__tests__/chat-store-focus.test.ts +0 -22
- package/cli/src/state/__tests__/feedback-store.test.ts +0 -260
- package/cli/src/state/chat-history-store.ts +0 -27
- package/cli/src/state/chat-store.ts +0 -791
- package/cli/src/state/feedback-store.ts +0 -162
- package/cli/src/state/gateway-catalog-store.ts +0 -45
- package/cli/src/state/login-store.ts +0 -150
- package/cli/src/state/message-block-store.ts +0 -143
- package/cli/src/state/model-picker-store.ts +0 -67
- package/cli/src/state/provider-picker-store.ts +0 -53
- package/cli/src/state/publish-store.ts +0 -141
- package/cli/src/state/review-store.ts +0 -24
- package/cli/src/state/rewind-picker-store.ts +0 -74
- package/cli/src/state/savant-free-model-store.ts +0 -59
- package/cli/src/state/savant-free-session-store.ts +0 -32
- package/cli/src/test-setup.ts +0 -20
- package/cli/src/testing/env.ts +0 -46
- package/cli/src/types/chat-state.ts +0 -15
- package/cli/src/types/chat.ts +0 -242
- package/cli/src/types/contracts/send-message.ts +0 -16
- package/cli/src/types/env.ts +0 -107
- package/cli/src/types/function-params.ts +0 -35
- package/cli/src/types/opentui-augmentation.d.ts +0 -11
- package/cli/src/types/react19-compat.d.ts +0 -19
- package/cli/src/types/savant-free-session.ts +0 -17
- package/cli/src/types/store.ts +0 -112
- package/cli/src/types/theme-system.ts +0 -194
- package/cli/src/types/utils.ts +0 -3
- package/cli/src/utils/__tests__/activity-tracker.test.ts +0 -440
- package/cli/src/utils/__tests__/agent-display.test.ts +0 -139
- package/cli/src/utils/__tests__/analytics-client.test.ts +0 -311
- package/cli/src/utils/__tests__/anonymous-id.test.ts +0 -74
- package/cli/src/utils/__tests__/arrays.test.ts +0 -264
- package/cli/src/utils/__tests__/bash-context-processor.test.ts +0 -38
- package/cli/src/utils/__tests__/block-processor.test.ts +0 -690
- package/cli/src/utils/__tests__/chat-history.test.ts +0 -247
- package/cli/src/utils/__tests__/chat-input-key-intercept.test.ts +0 -40
- package/cli/src/utils/__tests__/chat-layout.test.ts +0 -32
- package/cli/src/utils/__tests__/chat-meta.test.ts +0 -160
- package/cli/src/utils/__tests__/chatgpt-oauth.test.ts +0 -50
- package/cli/src/utils/__tests__/clipboard.test.ts +0 -998
- package/cli/src/utils/__tests__/code-search-summary.test.ts +0 -84
- package/cli/src/utils/__tests__/collapse-helpers.test.ts +0 -1272
- package/cli/src/utils/__tests__/error-handling.test.ts +0 -611
- package/cli/src/utils/__tests__/feedback-helpers.test.ts +0 -452
- package/cli/src/utils/__tests__/feedback-submission.test.ts +0 -26
- package/cli/src/utils/__tests__/fetch-usage.test.ts +0 -355
- package/cli/src/utils/__tests__/fingerprint.test.ts +0 -147
- package/cli/src/utils/__tests__/format-elapsed-time.test.ts +0 -103
- package/cli/src/utils/__tests__/format-timeout.test.ts +0 -87
- package/cli/src/utils/__tests__/image-dimensions.test.ts +0 -243
- package/cli/src/utils/__tests__/image-processor.test.ts +0 -250
- package/cli/src/utils/__tests__/implementor-helpers.test.ts +0 -1457
- package/cli/src/utils/__tests__/keyboard-actions.test.ts +0 -686
- package/cli/src/utils/__tests__/layout-helpers.test.ts +0 -36
- package/cli/src/utils/__tests__/lazy-response-ads.test.ts +0 -167
- package/cli/src/utils/__tests__/logger-sanitize-secrets.test.ts +0 -80
- package/cli/src/utils/__tests__/markdown-renderer.test.tsx +0 -518
- package/cli/src/utils/__tests__/markdown-streaming.test.ts +0 -64
- package/cli/src/utils/__tests__/message-block-helpers.test.ts +0 -1197
- package/cli/src/utils/__tests__/message-updater.test.ts +0 -659
- package/cli/src/utils/__tests__/ollama-onboarding.test.ts +0 -239
- package/cli/src/utils/__tests__/openrouter-models.test.ts +0 -295
- package/cli/src/utils/__tests__/osc-timeout-scenarios.test.ts +0 -172
- package/cli/src/utils/__tests__/pending-attachments.test.ts +0 -278
- package/cli/src/utils/__tests__/provider-setup.test.ts +0 -183
- package/cli/src/utils/__tests__/run-state-storage.test.ts +0 -741
- package/cli/src/utils/__tests__/savant-code-api.test.ts +0 -634
- package/cli/src/utils/__tests__/savant-free-instance-owner.test.ts +0 -69
- package/cli/src/utils/__tests__/savant-free-model-navigation.test.ts +0 -104
- package/cli/src/utils/__tests__/savant-free-premium-reset.test.ts +0 -81
- package/cli/src/utils/__tests__/savant-free-referral-cache.test.ts +0 -67
- package/cli/src/utils/__tests__/savant-free-session-display.test.ts +0 -23
- package/cli/src/utils/__tests__/savant-free-streak-line.test.ts +0 -76
- package/cli/src/utils/__tests__/sdk-event-handlers.test.ts +0 -615
- package/cli/src/utils/__tests__/send-message-helpers.test.ts +0 -1875
- package/cli/src/utils/__tests__/send-message-timer.test.ts +0 -68
- package/cli/src/utils/__tests__/settings.test.ts +0 -138
- package/cli/src/utils/__tests__/strings.test.ts +0 -210
- package/cli/src/utils/__tests__/syntax-theme.test.ts +0 -91
- package/cli/src/utils/__tests__/terminal-color-detection.test.ts +0 -425
- package/cli/src/utils/__tests__/terminal-enter-detection.test.ts +0 -77
- package/cli/src/utils/__tests__/text-layout.test.ts +0 -82
- package/cli/src/utils/__tests__/think-tag-parser.test.ts +0 -159
- package/cli/src/utils/__tests__/trace-writer.test.ts +0 -193
- package/cli/src/utils/__tests__/trim-chat-logs.test.ts +0 -79
- package/cli/src/utils/__tests__/usage-banner-state.test.ts +0 -298
- package/cli/src/utils/__tests__/validation-error-formatting.test.ts +0 -126
- package/cli/src/utils/__tests__/write-file-atomic.test.ts +0 -130
- package/cli/src/utils/active-run.ts +0 -22
- package/cli/src/utils/activity-tracker.ts +0 -66
- package/cli/src/utils/agent-display.ts +0 -87
- package/cli/src/utils/agent-helpers.ts +0 -47
- package/cli/src/utils/ai-message-id.ts +0 -12
- package/cli/src/utils/analytics.ts +0 -407
- package/cli/src/utils/anonymous-id.ts +0 -87
- package/cli/src/utils/arrays.ts +0 -117
- package/cli/src/utils/auth.ts +0 -258
- package/cli/src/utils/bash-context-processor.ts +0 -47
- package/cli/src/utils/bash-messages.ts +0 -108
- package/cli/src/utils/block-margins.ts +0 -35
- package/cli/src/utils/block-operations.ts +0 -548
- package/cli/src/utils/block-processor.ts +0 -212
- package/cli/src/utils/chat-history.ts +0 -265
- package/cli/src/utils/chat-input-key-intercept.ts +0 -52
- package/cli/src/utils/chat-layout.ts +0 -44
- package/cli/src/utils/chat-meta.ts +0 -101
- package/cli/src/utils/chat-scroll-accel.ts +0 -151
- package/cli/src/utils/chatgpt-oauth.ts +0 -350
- package/cli/src/utils/clipboard-image.ts +0 -610
- package/cli/src/utils/clipboard.ts +0 -307
- package/cli/src/utils/code-search-summary.ts +0 -69
- package/cli/src/utils/collapse-helpers.ts +0 -265
- package/cli/src/utils/config-dir.ts +0 -30
- package/cli/src/utils/constants.ts +0 -159
- package/cli/src/utils/create-event-handler-state.ts +0 -79
- package/cli/src/utils/create-run-config.ts +0 -160
- package/cli/src/utils/db-storage.ts +0 -254
- package/cli/src/utils/detect-shell.ts +0 -112
- package/cli/src/utils/directory-browser.ts +0 -74
- package/cli/src/utils/engagement.ts +0 -55
- package/cli/src/utils/env.ts +0 -109
- package/cli/src/utils/error-handling.ts +0 -246
- package/cli/src/utils/error-messages.ts +0 -84
- package/cli/src/utils/feedback-helpers.ts +0 -115
- package/cli/src/utils/feedback-submission.ts +0 -24
- package/cli/src/utils/fetch-usage.ts +0 -75
- package/cli/src/utils/fid-loader.ts +0 -135
- package/cli/src/utils/fingerprint.ts +0 -263
- package/cli/src/utils/finish-logic.ts +0 -154
- package/cli/src/utils/format-elapsed-time.ts +0 -33
- package/cli/src/utils/format-session-units.ts +0 -6
- package/cli/src/utils/format-timeout.ts +0 -28
- package/cli/src/utils/format-validation-errors-for-message.ts +0 -85
- package/cli/src/utils/git.ts +0 -17
- package/cli/src/utils/glyphs.ts +0 -188
- package/cli/src/utils/helpers.ts +0 -47
- package/cli/src/utils/image-display.ts +0 -73
- package/cli/src/utils/image-handler.ts +0 -336
- package/cli/src/utils/image-processor.ts +0 -133
- package/cli/src/utils/image-thumbnail.ts +0 -83
- package/cli/src/utils/implementor-helpers.ts +0 -817
- package/cli/src/utils/input-modes.ts +0 -196
- package/cli/src/utils/keyboard-actions.ts +0 -394
- package/cli/src/utils/keypad-keys.ts +0 -47
- package/cli/src/utils/layout-helpers.ts +0 -36
- package/cli/src/utils/lazy-response-ads.ts +0 -1
- package/cli/src/utils/loading-phrases.ts +0 -68
- package/cli/src/utils/local-agent-registry.ts +0 -611
- package/cli/src/utils/log-shipper.ts +0 -116
- package/cli/src/utils/logger.ts +0 -435
- package/cli/src/utils/markdown-renderer.tsx +0 -1315
- package/cli/src/utils/math.ts +0 -3
- package/cli/src/utils/message-block-helpers.ts +0 -667
- package/cli/src/utils/message-history.ts +0 -153
- package/cli/src/utils/message-tree-utils.ts +0 -67
- package/cli/src/utils/message-updater.ts +0 -279
- package/cli/src/utils/ollama-onboarding.ts +0 -215
- package/cli/src/utils/open-file.ts +0 -144
- package/cli/src/utils/open-url.ts +0 -63
- package/cli/src/utils/openrouter-models.ts +0 -945
- package/cli/src/utils/path-completion.ts +0 -111
- package/cli/src/utils/path-helpers.ts +0 -38
- package/cli/src/utils/pending-attachments.ts +0 -363
- package/cli/src/utils/post-processing.ts +0 -99
- package/cli/src/utils/project-picker.ts +0 -12
- package/cli/src/utils/provider-setup.ts +0 -259
- package/cli/src/utils/recent-projects.ts +0 -156
- package/cli/src/utils/renderer-cleanup.ts +0 -142
- package/cli/src/utils/response-ad-positions.ts +0 -1
- package/cli/src/utils/rewind.ts +0 -175
- package/cli/src/utils/run-state-storage.ts +0 -480
- package/cli/src/utils/savant-code-api.ts +0 -686
- package/cli/src/utils/savant-code-client.ts +0 -217
- package/cli/src/utils/savant-free-agent-selection.ts +0 -12
- package/cli/src/utils/savant-free-exit.ts +0 -24
- package/cli/src/utils/savant-free-instance-owner.ts +0 -66
- package/cli/src/utils/savant-free-model-navigation.ts +0 -46
- package/cli/src/utils/savant-free-premium-reset.ts +0 -52
- package/cli/src/utils/savant-free-referral-cache.ts +0 -35
- package/cli/src/utils/savant-free-session-display.ts +0 -21
- package/cli/src/utils/savant-free-streak-line.ts +0 -67
- package/cli/src/utils/sdk-event-handlers.ts +0 -587
- package/cli/src/utils/send-message-helpers.ts +0 -199
- package/cli/src/utils/send-message-timer.ts +0 -110
- package/cli/src/utils/settings.ts +0 -388
- package/cli/src/utils/skill-registry.ts +0 -100
- package/cli/src/utils/spawn-agent-matcher.ts +0 -56
- package/cli/src/utils/status-indicator-state.ts +0 -100
- package/cli/src/utils/stream-chunk-processor.ts +0 -65
- package/cli/src/utils/strings.ts +0 -272
- package/cli/src/utils/subscription.ts +0 -31
- package/cli/src/utils/syntax-highlighter.tsx +0 -19
- package/cli/src/utils/syntax-theme.ts +0 -131
- package/cli/src/utils/terminal-color-detection.ts +0 -472
- package/cli/src/utils/terminal-enter-detection.ts +0 -63
- package/cli/src/utils/terminal-images.ts +0 -223
- package/cli/src/utils/terminal-reset-sequences.ts +0 -33
- package/cli/src/utils/terminal-title.ts +0 -113
- package/cli/src/utils/terminal-watchdog.ts +0 -246
- package/cli/src/utils/text-layout.ts +0 -153
- package/cli/src/utils/theme-config.ts +0 -143
- package/cli/src/utils/theme-system.ts +0 -1265
- package/cli/src/utils/think-tag-parser.ts +0 -105
- package/cli/src/utils/trace-writer.ts +0 -147
- package/cli/src/utils/ui-constants.ts +0 -69
- package/cli/src/utils/usage-banner-state.ts +0 -146
- package/cli/src/utils/validation-error-formatting.ts +0 -92
- package/cli/src/utils/validation-error-helpers.ts +0 -19
- package/cli/src/utils/version.ts +0 -23
- package/cli/src/utils/word-wrap-utils.ts +0 -53
- package/cli/src/utils/write-file-atomic.ts +0 -82
- package/cli/src/utils/yield-to-event-loop.ts +0 -9
- package/cli/tsconfig.json +0 -26
- package/coding-standards/csharp.md +0 -77
- package/coding-standards/go.md +0 -71
- package/coding-standards/java.md +0 -74
- package/coding-standards/python.md +0 -82
- package/coding-standards/rust.md +0 -78
- package/coding-standards/typescript.md +0 -85
- package/coding-standards/x402.md +0 -227
- package/common/README.md +0 -41
- package/common/common_exit +0 -1
- package/common/package.json +0 -45
- package/common/src/__tests__/agent-validation.test.ts +0 -861
- package/common/src/__tests__/agents.test.ts +0 -16
- package/common/src/__tests__/dynamic-agent-template-schema.test.ts +0 -420
- package/common/src/__tests__/env-ci.test.ts +0 -167
- package/common/src/__tests__/env-process.test.ts +0 -145
- package/common/src/__tests__/free-agents.test.ts +0 -269
- package/common/src/__tests__/handlesteps-parsing.test.ts +0 -247
- package/common/src/__tests__/model-config.test.ts +0 -41
- package/common/src/__tests__/project-file-tree.test.ts +0 -82
- package/common/src/__tests__/response-ad-positions.test.ts +0 -78
- package/common/src/__tests__/savant-free-models.test.ts +0 -460
- package/common/src/__tests__/savant-free-referral-tiers.test.ts +0 -122
- package/common/src/__tests__/user-state.test.ts +0 -30
- package/common/src/actions.ts +0 -215
- package/common/src/analytics-core.ts +0 -73
- package/common/src/analytics.ts +0 -96
- package/common/src/api-keys/constants.ts +0 -26
- package/common/src/browser-actions.ts +0 -414
- package/common/src/constants/agents.ts +0 -250
- package/common/src/constants/analytics-events.ts +0 -318
- package/common/src/constants/anthropic.ts +0 -72
- package/common/src/constants/byok.ts +0 -2
- package/common/src/constants/chatgpt-oauth.ts +0 -85
- package/common/src/constants/composio.ts +0 -34
- package/common/src/constants/feedback.ts +0 -18
- package/common/src/constants/free-agents.ts +0 -347
- package/common/src/constants/gemini.ts +0 -6
- package/common/src/constants/grant-priorities.ts +0 -13
- package/common/src/constants/hosts.ts +0 -6
- package/common/src/constants/images.ts +0 -53
- package/common/src/constants/index.ts +0 -8
- package/common/src/constants/knowledge.ts +0 -46
- package/common/src/constants/limits.ts +0 -23
- package/common/src/constants/model-config.ts +0 -469
- package/common/src/constants/paths.ts +0 -69
- package/common/src/constants/savant-code-config.ts +0 -12
- package/common/src/constants/savant-free-gemini-thinker.ts +0 -30
- package/common/src/constants/savant-free-models.ts +0 -855
- package/common/src/constants/savant-free-referral-tiers.ts +0 -169
- package/common/src/constants/skills.ts +0 -60
- package/common/src/constants/subscription-plans.ts +0 -54
- package/common/src/constants/ui.ts +0 -25
- package/common/src/env-ci.ts +0 -36
- package/common/src/env-process.ts +0 -95
- package/common/src/env-schema.ts +0 -42
- package/common/src/env.ts +0 -69
- package/common/src/mcp/client.ts +0 -308
- package/common/src/old-constants.ts +0 -10
- package/common/src/project-file-tree.ts +0 -361
- package/common/src/reddit-capi.ts +0 -175
- package/common/src/schemas/feedback.ts +0 -57
- package/common/src/schemas/logs.ts +0 -66
- package/common/src/templates/agent-validation.ts +0 -436
- package/common/src/templates/initial-agents-dir/LICENSE +0 -202
- package/common/src/templates/initial-agents-dir/README.md +0 -314
- package/common/src/templates/initial-agents-dir/examples/01-basic-diff-reviewer.ts +0 -17
- package/common/src/templates/initial-agents-dir/examples/02-intermediate-git-committer.ts +0 -78
- package/common/src/templates/initial-agents-dir/examples/03-advanced-file-explorer.ts +0 -76
- package/common/src/templates/initial-agents-dir/my-custom-agent.ts +0 -40
- package/common/src/templates/initial-agents-dir/package.json +0 -6
- package/common/src/templates/initial-agents-dir/skills/README.md +0 -66
- package/common/src/templates/initial-agents-dir/skills/example-skill/SKILL.md +0 -29
- package/common/src/templates/initial-agents-dir/types/agent-definition.ts +0 -484
- package/common/src/templates/initial-agents-dir/types/tools.ts +0 -452
- package/common/src/templates/initial-agents-dir/types/util-types.ts +0 -167
- package/common/src/testing/TESTING_PATTERNS.md +0 -353
- package/common/src/testing/errors.ts +0 -33
- package/common/src/testing/fixtures/agent-runtime.ts +0 -325
- package/common/src/testing/impl/agent-runtime.ts +0 -6
- package/common/src/testing/index.ts +0 -84
- package/common/src/testing/mock-modules.ts +0 -54
- package/common/src/testing/mock-types.ts +0 -123
- package/common/src/testing/mocks/analytics.ts +0 -262
- package/common/src/testing/mocks/child-process.ts +0 -93
- package/common/src/testing/mocks/crypto.ts +0 -218
- package/common/src/testing/mocks/database.ts +0 -337
- package/common/src/testing/mocks/filesystem.ts +0 -166
- package/common/src/testing/mocks/index.ts +0 -83
- package/common/src/testing/mocks/logger.ts +0 -136
- package/common/src/testing/mocks/stream.ts +0 -314
- package/common/src/testing/mocks/timers.ts +0 -132
- package/common/src/testing/mocks/tree-sitter.ts +0 -127
- package/common/src/testing/setup.ts +0 -282
- package/common/src/testing-env-ci.ts +0 -15
- package/common/src/testing-env-process.ts +0 -78
- package/common/src/tools/__tests__/compile-tool-definitions.test.ts +0 -34
- package/common/src/tools/__tests__/thought-session.test.ts +0 -256
- package/common/src/tools/compile-tool-definitions.ts +0 -194
- package/common/src/tools/constants.ts +0 -132
- package/common/src/tools/list.ts +0 -193
- package/common/src/tools/params/__tests__/coerce-to-array.test.ts +0 -237
- package/common/src/tools/params/__tests__/sequential-thinking-coercion.test.ts +0 -98
- package/common/src/tools/params/tool/add-message.ts +0 -36
- package/common/src/tools/params/tool/add-subgoal.ts +0 -57
- package/common/src/tools/params/tool/apply-patch.ts +0 -110
- package/common/src/tools/params/tool/ask-user.ts +0 -181
- package/common/src/tools/params/tool/browser-logs.ts +0 -85
- package/common/src/tools/params/tool/code-search.ts +0 -144
- package/common/src/tools/params/tool/composio.ts +0 -131
- package/common/src/tools/params/tool/create-plan.ts +0 -80
- package/common/src/tools/params/tool/end-turn.ts +0 -54
- package/common/src/tools/params/tool/find-files.ts +0 -60
- package/common/src/tools/params/tool/glob.ts +0 -74
- package/common/src/tools/params/tool/gravity-index.ts +0 -92
- package/common/src/tools/params/tool/list-directory.ts +0 -58
- package/common/src/tools/params/tool/lookup-agent-info.ts +0 -37
- package/common/src/tools/params/tool/propose-str-replace.ts +0 -103
- package/common/src/tools/params/tool/propose-write-file.ts +0 -71
- package/common/src/tools/params/tool/read-docs.ts +0 -85
- package/common/src/tools/params/tool/read-files.ts +0 -61
- package/common/src/tools/params/tool/read-subtree.ts +0 -83
- package/common/src/tools/params/tool/read-url.ts +0 -81
- package/common/src/tools/params/tool/render-ui.ts +0 -203
- package/common/src/tools/params/tool/run-file-change-hooks.ts +0 -57
- package/common/src/tools/params/tool/run-readonly-command.ts +0 -76
- package/common/src/tools/params/tool/run-terminal-command.ts +0 -185
- package/common/src/tools/params/tool/sequential-thinking.ts +0 -110
- package/common/src/tools/params/tool/set-messages.ts +0 -42
- package/common/src/tools/params/tool/set-output.ts +0 -62
- package/common/src/tools/params/tool/set-scaffold-complete.ts +0 -51
- package/common/src/tools/params/tool/skill.ts +0 -56
- package/common/src/tools/params/tool/spawn-agent-inline.ts +0 -57
- package/common/src/tools/params/tool/spawn-agents.ts +0 -154
- package/common/src/tools/params/tool/str-replace.ts +0 -107
- package/common/src/tools/params/tool/suggest-followups.ts +0 -94
- package/common/src/tools/params/tool/task-completed.ts +0 -58
- package/common/src/tools/params/tool/think-deeply.ts +0 -53
- package/common/src/tools/params/tool/transition-phase.ts +0 -57
- package/common/src/tools/params/tool/update-subgoal.ts +0 -89
- package/common/src/tools/params/tool/web-search.ts +0 -73
- package/common/src/tools/params/tool/write-file.ts +0 -71
- package/common/src/tools/params/tool/write-todos.ts +0 -67
- package/common/src/tools/params/utils.ts +0 -152
- package/common/src/tools/safety-registry.ts +0 -274
- package/common/src/tools/safety.ts +0 -42
- package/common/src/tools/sequential-thinking.ts +0 -340
- package/common/src/tools/utils.ts +0 -25
- package/common/src/types/__tests__/dynamic-agent-template.test.ts +0 -20
- package/common/src/types/agent-template.ts +0 -223
- package/common/src/types/api/agents/publish.ts +0 -63
- package/common/src/types/contracts/agent-runtime.ts +0 -84
- package/common/src/types/contracts/analytics.ts +0 -12
- package/common/src/types/contracts/bigquery.ts +0 -55
- package/common/src/types/contracts/billing.ts +0 -46
- package/common/src/types/contracts/client.ts +0 -52
- package/common/src/types/contracts/database.ts +0 -104
- package/common/src/types/contracts/env.ts +0 -203
- package/common/src/types/contracts/llm.ts +0 -183
- package/common/src/types/contracts/logger.ts +0 -29
- package/common/src/types/contracts/logs.ts +0 -34
- package/common/src/types/contracts/trace.ts +0 -21
- package/common/src/types/dynamic-agent-template.ts +0 -290
- package/common/src/types/filesystem.ts +0 -10
- package/common/src/types/function-params.ts +0 -35
- package/common/src/types/grant.ts +0 -20
- package/common/src/types/gravity-index.ts +0 -170
- package/common/src/types/json.ts +0 -26
- package/common/src/types/mcp.ts +0 -26
- package/common/src/types/messages/content-part.ts +0 -59
- package/common/src/types/messages/data-content.ts +0 -14
- package/common/src/types/messages/provider-metadata.ts +0 -10
- package/common/src/types/messages/savant-code-message.ts +0 -55
- package/common/src/types/organization.ts +0 -118
- package/common/src/types/print-mode.ts +0 -167
- package/common/src/types/publisher.ts +0 -67
- package/common/src/types/savant-free-session.ts +0 -295
- package/common/src/types/savant-free-streak.ts +0 -6
- package/common/src/types/session-state.ts +0 -237
- package/common/src/types/skill.ts +0 -56
- package/common/src/types/source.ts +0 -11
- package/common/src/types/spawn.ts +0 -13
- package/common/src/types/subscription.ts +0 -68
- package/common/src/types/usage.ts +0 -16
- package/common/src/types/util.ts +0 -3
- package/common/src/util/__tests__/analytics-dispatcher.test.ts +0 -145
- package/common/src/util/__tests__/analytics-log.test.ts +0 -110
- package/common/src/util/__tests__/analytics-sampling.test.ts +0 -131
- package/common/src/util/__tests__/axiom-only-log.test.ts +0 -64
- package/common/src/util/__tests__/engagement-tracker.test.ts +0 -115
- package/common/src/util/__tests__/error-abort.test.ts +0 -822
- package/common/src/util/__tests__/error-api-details.test.ts +0 -190
- package/common/src/util/__tests__/format-code-search.test.ts +0 -60
- package/common/src/util/__tests__/log-mirror.test.ts +0 -31
- package/common/src/util/__tests__/messages.test.ts +0 -1118
- package/common/src/util/__tests__/partial-json-delta.test.ts +0 -505
- package/common/src/util/__tests__/paths.test.ts +0 -289
- package/common/src/util/__tests__/promise.test.ts +0 -334
- package/common/src/util/__tests__/protocol-config.test.ts +0 -119
- package/common/src/util/__tests__/rate-limit.test.ts +0 -28
- package/common/src/util/__tests__/reddit-savant-free-retention.test.ts +0 -120
- package/common/src/util/__tests__/savant-free-streak.test.ts +0 -142
- package/common/src/util/__tests__/saxy.test.ts +0 -1008
- package/common/src/util/__tests__/string.test.ts +0 -238
- package/common/src/util/__tests__/zoned-time.test.ts +0 -88
- package/common/src/util/agent-file-utils.ts +0 -110
- package/common/src/util/agent-id-parsing.ts +0 -147
- package/common/src/util/agent-name-normalization.ts +0 -39
- package/common/src/util/analytics-dispatcher.ts +0 -81
- package/common/src/util/analytics-log.ts +0 -84
- package/common/src/util/analytics-sampling.ts +0 -225
- package/common/src/util/array.ts +0 -63
- package/common/src/util/axiom-only-log.ts +0 -79
- package/common/src/util/cache-debug.ts +0 -191
- package/common/src/util/credentials.ts +0 -12
- package/common/src/util/currency.ts +0 -25
- package/common/src/util/dates.ts +0 -81
- package/common/src/util/engagement-tracker.ts +0 -133
- package/common/src/util/error.ts +0 -580
- package/common/src/util/file.ts +0 -363
- package/common/src/util/format-code-search.ts +0 -115
- package/common/src/util/lazy-response-ads.ts +0 -93
- package/common/src/util/log-data.ts +0 -57
- package/common/src/util/log-mirror.ts +0 -34
- package/common/src/util/lru-cache.ts +0 -67
- package/common/src/util/messages.ts +0 -600
- package/common/src/util/model-utils.ts +0 -25
- package/common/src/util/object.ts +0 -137
- package/common/src/util/param-helpers.ts +0 -49
- package/common/src/util/partial-json-delta.ts +0 -100
- package/common/src/util/paths.ts +0 -194
- package/common/src/util/promise.ts +0 -87
- package/common/src/util/protocol-config.ts +0 -141
- package/common/src/util/random.ts +0 -15
- package/common/src/util/rate-limit.ts +0 -56
- package/common/src/util/reddit-capi-events.ts +0 -40
- package/common/src/util/reddit-savant-free-retention.ts +0 -69
- package/common/src/util/response-ad-positions.ts +0 -54
- package/common/src/util/savant-free-privacy.ts +0 -78
- package/common/src/util/savant-free-streak.ts +0 -153
- package/common/src/util/saxy.ts +0 -739
- package/common/src/util/skills.ts +0 -32
- package/common/src/util/stop-sequence.ts +0 -60
- package/common/src/util/string.ts +0 -419
- package/common/src/util/system-info.ts +0 -51
- package/common/src/util/type-narrowing.ts +0 -125
- package/common/src/util/xml.ts +0 -17
- package/common/src/util/zod-schema.ts +0 -80
- package/common/src/util/zoned-time.ts +0 -136
- package/common/src/utils/ask-user-bridge.ts +0 -47
- package/common/tsconfig.json +0 -8
- package/database.db +0 -0
- package/dev/LEARNINGS.md +0 -309
- package/dev/fids/.gitkeep +0 -0
- package/dev/fids/archive/.gitkeep +0 -0
- package/dev/fids/archive/FID-2026-0802-008-sdk-package-audit-client-run-run-state.md +0 -238
- package/dev/fids/archive/FID-2026-0803-001-echo-enforcement-layer-drift.md +0 -404
- package/dev/fids/archive/FID-2026-0803-002-llm-providers-database-audit.md +0 -348
- package/dev/fids/archive/FID-2026-0803-003-sdk-impl-common-util-audit.md +0 -277
- package/dev/fids/archive/FID-2026-0803-004-checkpoint-rewind.md +0 -181
- package/dev/fids/archive/FID-2026-0803-005-quality-scan-hygiene-fixes.md +0 -265
- package/dev/fids/archive/FID-2026-0803-006-code-map-audit-hygiene.md +0 -243
- package/dev/fids/archive/FID-2026-0803-007-evals-benchmark-audit-hygiene.md +0 -296
- package/dev/fids/archive/FID-2026-0803-009-echo-enforcement-doc-drift.md +0 -112
- package/dev/fids/archive/FID-2026-0803-010-database-llm-providers-low-fixes.md +0 -255
- package/dev/fids/archive/FID-2026-0803-011-build-artifact-hygiene.md +0 -169
- package/dev/fids/archive/FID-2026-0803-012-release-readiness-audit.md +0 -162
- package/dev/fids/archive/FID-2026-0803-013-agent-roster-over-reporting.md +0 -146
- package/dev/fids/archive/FID-2026-0803-014-freebuff-to-savant-rebrand-sweep.md +0 -185
- package/dev/nova/reports/2026-08-02-top-25-ai-inference-providers-competitive-intel.md +0 -213
- package/dev/nova/specs/echo-v0.1.2-freebuff.md +0 -391
- package/dev/nova/specs/goal-loop-feature-spec.md +0 -245
- package/dev/nova/specs/launch-strategy-research-prompt.md +0 -88
- package/dev/releases/README.md +0 -50
- package/dev/scratchpad/.gitkeep +0 -0
- package/dev/session-summaries/.gitkeep +0 -0
- package/dev/session-summaries/2026-07-16-1255.md +0 -128
- package/dev/session-summaries/2026-07-17-1000.md +0 -64
- package/dev/session-summaries/2026-07-19-eslint-zero-tolerance-cleanup.md +0 -145
- package/dev/session-summaries/2026-07-19-fid-026-debugging-and-rename.md +0 -79
- package/dev/session-summaries/2026-07-19-fid-026-phase-b-rebrand.md +0 -76
- package/dev/session-summaries/2026-07-19-fid-027-clean-break.md +0 -47
- package/dev/session-summaries/2026-07-19-pre-push-house-cleaning.md +0 -100
- package/dev/session-summaries/2026-07-19-v0.0.2-release-session.md +0 -229
- package/dev/session-summaries/2026-07-20-1805-fid-loop-closure.md +0 -95
- package/dev/session-summaries/2026-07-22-1800.md +0 -52
- package/dev/session-summaries/2026-07-23-fsm-optimization.md +0 -88
- package/dev/session-summaries/2026-07-25-0000.md +0 -80
- package/dev/session-summaries/2026-07-25-1200-context-compaction.md +0 -154
- package/dev/session-summaries/2026-07-25-1600-layer4-reactive-compact.md +0 -96
- package/dev/session-summaries/2026-07-25-1700-dev-folder-audit.md +0 -161
- package/dev/session-summaries/2026-07-25-2000-benchmark-v2-filters.md +0 -147
- package/dev/session-summaries/2026-07-25-2000.md +0 -77
- package/dev/session-summaries/2026-07-27-0000.md +0 -63
- package/dev/session-summaries/2026-07-28-history-capture-handoff.md +0 -206
- package/dev/session-summaries/2026-07-31-freebuff-echo-compliance-remediation.md +0 -156
- package/dev/session-summaries/2026-07-31-pre-launch-optimization-execution.md +0 -46
- package/dev/session-summaries/2026-0721-1800.md +0 -44
- package/dev/session-summaries/2026-08-01-sidebar-folded-startup.md +0 -159
- package/dev/session-summaries/2026-08-02-0.0.15-release-closeout.md +0 -32
- package/dev/session-summaries/2026-08-02-repository-hygiene.md +0 -51
- package/dev/session-summaries/2026-08-03-agent-roster-fix-and-ready-check-closeout.md +0 -73
- package/dev/session-summaries/2026-08-03-build-artifact-hygiene-closeout.md +0 -40
- package/dev/session-summaries/2026-08-03-code-map-audit-closeout.md +0 -44
- package/dev/session-summaries/2026-08-03-database-llm-providers-low-fixes-closeout.md +0 -47
- package/dev/session-summaries/2026-08-03-echo-enforcement-doc-drift-closeout.md +0 -43
- package/dev/session-summaries/2026-08-03-evals-benchmark-audit-closeout.md +0 -50
- package/dev/session-summaries/2026-08-03-quality-scan-hygiene-fixes-closeout.md +0 -57
- package/dev/session-summaries/2026-08-03-quality-session-checkpoint-rewind-closeout.md +0 -56
- package/dev/session-summaries/2026-08-03-release-readiness-audit-closeout.md +0 -60
- package/dev/test-prompts/archive/0.0.2-final-pass.md +0 -209
- package/dev/test-prompts/archive/agent-capabilities-full-test.md +0 -361
- package/dev/test-prompts/archive/agent-capabilities-test.md +0 -471
- package/dev/test-prompts/archive/comprehensive-az-system-test-v1.md +0 -441
- package/dev/test-prompts/archive/comprehensive-az-system-test-v2-report.md +0 -377
- package/dev/test-prompts/archive/comprehensive-az-system-test-v2.md +0 -544
- package/dev/test-prompts/archive/comprehensive-az-system-test.md +0 -396
- package/dev/test-prompts/archive/comprehensive-az-test-final.md +0 -900
- package/dev/test-prompts/archive/comprehensive-az-test-v11.md +0 -141
- package/dev/test-prompts/archive/comprehensive-az-test-v12.md +0 -29
- package/dev/test-prompts/archive/comprehensive-az-test-v6.md +0 -631
- package/dev/test-prompts/archive/comprehensive-az-test-v7.md +0 -625
- package/dev/test-prompts/archive/fid-007-ability-confirmation.md +0 -248
- package/dev/test-prompts/archive/fid-2026-0801-006-thinker-tool-call-boundary.md +0 -86
- package/dev/test-prompts/archive/fid-2026-0801-007-child-tool-set-fallback-cli.md +0 -101
- package/dev/test-prompts/archive/fid-2026-0801-008-provider-tool-call-accumulation-cli.md +0 -111
- package/dev/test-prompts/archive/fid-2026-0801-012-thinker-state-output-cli.md +0 -134
- package/dev/test-prompts/archive/gemini-deep-research-sidebar-highlight.md +0 -598
- package/dev/test-prompts/archive/goal-loop-cli-test.md +0 -142
- package/dev/test-prompts/archive/rebrand-qa.md +0 -258
- package/dev/test-prompts/archive/release-az-test-fid-085.md +0 -306
- package/dev/test-prompts/archive/release-az-test-fid-087.md +0 -219
- package/dev/test-prompts/archive/release-az-test-fid-2026-0726-001.md +0 -270
- package/dev/test-prompts/archive/release-az-test-fid-2026-0728-008.md +0 -213
- package/dev/test-prompts/archive/release-az-test-fid-2026-0728-launch-tracks.md +0 -253
- package/dev/test-prompts/archive/release-az-test-fid-2026-0731-pre-launch.md +0 -102
- package/docs/AI Coding Agents Market Research.md +0 -516
- package/docs/Agent Harness Feature Pairing Research.md +0 -166
- package/docs/CLI Agent Inference Backend Research.md +0 -446
- package/docs/Codebuff Rebranding And Migration Plan.md +0 -418
- package/docs/ECHO-EVOLUTION-ARCH.md +0 -77
- package/docs/Harness Engineering for Coding Agents Research.md +0 -196
- package/docs/Launch Plan Review and Optimization.md +0 -178
- package/docs/OpenTUI Sidebar Bug Fix.md +0 -245
- package/docs/SAVANT-VERSIONING.md +0 -31
- package/docs/Savant Code Launch Strategy.md +0 -270
- package/docs/Savant-Code Business And Backend Research.md +0 -222
- package/docs/agents-and-tools.md +0 -217
- package/docs/cloudflare-llms-full.md +0 -9623
- package/docs/design/OpenTUI Terminal Visualization Guide.md +0 -471
- package/docs/design/database-architecture.md +0 -217
- package/docs/design/deep-research-report.md +0 -295
- package/docs/design/thinker-sequentialthinking-regression-diagnostic.md +0 -366
- package/docs/discord-server-design.md +0 -167
- package/docs/gravity-integration-starter.md +0 -202
- package/docs/launch/hn-first-comment.md +0 -44
- package/docs/launch/hn-post.md +0 -35
- package/docs/launch/incident-response.md +0 -88
- package/docs/launch/landing/index.html +0 -233
- package/docs/launch/mastodon-thread.md +0 -52
- package/docs/launch/newsletter-pitch.md +0 -49
- package/docs/launch/twitter-thread.md +0 -62
- package/docs/privacy.md +0 -186
- package/docs/reports/Savant-Code Benchmark Specification.md +0 -206
- package/docs/reports/Thinker Agent Architecture Research.md +0 -284
- package/docs/reports/adoptable-features-2026-07-25.md +0 -604
- package/docs/reports/adoptable-features-master.md +0 -480
- package/docs/reports/codebuff-discord-feedback.md +0 -43
- package/docs/reports/feature-parity-report.md +0 -810
- package/docs/reports/repos/AionUi.md +0 -75
- package/docs/reports/repos/OpenHands.md +0 -76
- package/docs/reports/repos/SWE-agent.md +0 -82
- package/docs/reports/repos/agno.md +0 -89
- package/docs/reports/repos/aider.md +0 -74
- package/docs/reports/repos/cline.md +0 -83
- package/docs/reports/repos/codex.md +0 -83
- package/docs/reports/repos/gemini-cli.md +0 -92
- package/docs/reports/repos/goose.md +0 -65
- package/docs/reports/repos/gpt-pilot.md +0 -52
- package/docs/reports/repos/hermes-agent.md +0 -101
- package/docs/reports/repos/kilocode.md +0 -79
- package/docs/reports/repos/openclaude.md +0 -99
- package/docs/reports/repos/openclaw.md +0 -100
- package/docs/reports/repos/opencode-dev.md +0 -78
- package/docs/reports/repos/zero.md +0 -123
- package/docs/reports/savant-code-benchmark-v2-2026-08-03.md +0 -76
- package/docs/savant-code-modes.md +0 -338
- package/docs/testing.md +0 -51
- package/docs/visual-mockup-neon-slate.txt +0 -41
- package/eslint.config.js +0 -211
- package/evals/README.md +0 -45
- package/evals/benchmark/README.md +0 -449
- package/evals/benchmark/agent-runner.ts +0 -217
- package/evals/benchmark/analyze-task-scores.ts +0 -496
- package/evals/benchmark/eval-codebuff-hard.json +0 -3343
- package/evals/benchmark/eval-codebuff.json +0 -3193
- package/evals/benchmark/eval-codebuff2.json +0 -2494
- package/evals/benchmark/eval-manifold-hard.json +0 -2525
- package/evals/benchmark/eval-manifold.json +0 -1675
- package/evals/benchmark/eval-manifold2.json +0 -1945
- package/evals/benchmark/eval-plane-hard.json +0 -4372
- package/evals/benchmark/eval-plane.json +0 -2028
- package/evals/benchmark/eval-plane2.json +0 -3517
- package/evals/benchmark/eval-saleor-hard.json +0 -6081
- package/evals/benchmark/eval-saleor.json +0 -1829
- package/evals/benchmark/eval-saleor2.json +0 -3273
- package/evals/benchmark/eval-task-generator.ts +0 -158
- package/evals/benchmark/filter-supplemental-files.ts +0 -225
- package/evals/benchmark/format-output.ts +0 -215
- package/evals/benchmark/gen-evals.ts +0 -294
- package/evals/benchmark/gen-repo-eval.ts +0 -71
- package/evals/benchmark/judge.ts +0 -308
- package/evals/benchmark/lessons-extractor.ts +0 -247
- package/evals/benchmark/main-hard-tasks.ts +0 -49
- package/evals/benchmark/main-single-eval.ts +0 -23
- package/evals/benchmark/main.ts +0 -29
- package/evals/benchmark/meta-analyzer.ts +0 -329
- package/evals/benchmark/pick-commits.ts +0 -627
- package/evals/benchmark/run-benchmark.ts +0 -657
- package/evals/benchmark/runners/claude.ts +0 -176
- package/evals/benchmark/runners/codex.ts +0 -143
- package/evals/benchmark/runners/index.ts +0 -4
- package/evals/benchmark/runners/opencode.ts +0 -253
- package/evals/benchmark/runners/runner.ts +0 -13
- package/evals/benchmark/runners/savant.ts +0 -148
- package/evals/benchmark/setup-test-repo.ts +0 -314
- package/evals/benchmark/trace-analyzer.ts +0 -257
- package/evals/benchmark/trace-utils.ts +0 -80
- package/evals/benchmark/types.ts +0 -83
- package/evals/bunfig.toml +0 -4
- package/evals/logger.ts +0 -87
- package/evals/package.json +0 -31
- package/evals/subagents/test-repo-utils.ts +0 -131
- package/evals/tsconfig.json +0 -13
- package/evals/v2/README.md +0 -149
- package/evals/v2/reports/report.json +0 -261
- package/evals/v2/reports/report.md +0 -15
- package/evals/v2/schema/task.schema.json +0 -172
- package/evals/v2/src/cli.ts +0 -216
- package/evals/v2/src/golden.ts +0 -73
- package/evals/v2/src/harness.ts +0 -293
- package/evals/v2/src/metrics.ts +0 -326
- package/evals/v2/src/registry.ts +0 -179
- package/evals/v2/src/reports.ts +0 -126
- package/evals/v2/src/runner.ts +0 -143
- package/evals/v2/src/runners/savant.ts +0 -105
- package/evals/v2/src/sandbox.ts +0 -42
- package/evals/v2/src/sandboxes/docker.ts +0 -49
- package/evals/v2/src/sandboxes/tempdir.ts +0 -120
- package/evals/v2/src/schema.ts +0 -83
- package/evals/v2/src/trace.ts +0 -186
- package/evals/v2/src/verify.ts +0 -199
- package/evals/v2/tasks/error_recovery/env-fault/calculator.js +0 -11
- package/evals/v2/tasks/error_recovery/env-fault/calculator.test.js +0 -15
- package/evals/v2/tasks/error_recovery/env-fault/golden.patch +0 -15
- package/evals/v2/tasks/error_recovery/env-fault/task.yaml +0 -20
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/app.js +0 -5
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/app.test.js +0 -7
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/golden.patch +0 -19
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/greet.js +0 -3
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/orchestration.test.js +0 -30
- package/evals/v2/tasks/multi_agent_orchestration/options-contract/task.yaml +0 -29
- package/evals/v2/tasks/pure_coding/add-fix/add.js +0 -3
- package/evals/v2/tasks/pure_coding/add-fix/add.test.js +0 -11
- package/evals/v2/tasks/pure_coding/add-fix/golden.patch +0 -7
- package/evals/v2/tasks/pure_coding/add-fix/task.yaml +0 -20
- package/evals/v2/tasks/pure_coding/rename-greet/app.js +0 -5
- package/evals/v2/tasks/pure_coding/rename-greet/app.test.js +0 -32
- package/evals/v2/tasks/pure_coding/rename-greet/golden.patch +0 -19
- package/evals/v2/tasks/pure_coding/rename-greet/greet.js +0 -5
- package/evals/v2/tasks/pure_coding/rename-greet/task.yaml +0 -21
- package/evals/v2/tests/golden.test.ts +0 -104
- package/evals/v2/tests/harness.test.ts +0 -204
- package/evals/v2/tests/metrics.test.ts +0 -353
- package/evals/v2/tests/registry.test.ts +0 -210
- package/evals/v2/tests/reports.test.ts +0 -218
- package/evals/v2/tests/savant-runner.test.ts +0 -218
- package/evals/v2/tests/schema.test.ts +0 -127
- package/evals/v2/tests/tempdir-sandbox.test.ts +0 -49
- package/evals/v2/tests/trace.test.ts +0 -76
- package/evals/v2/tests/verify.test.ts +0 -224
- package/license +0 -202
- package/packages/agent-runtime/README.md +0 -46
- package/packages/agent-runtime/agent_exit +0 -1
- package/packages/agent-runtime/bunfig.toml +0 -2
- package/packages/agent-runtime/package.json +0 -34
- package/packages/agent-runtime/src/__tests__/apply-patch-tool.test.ts +0 -202
- package/packages/agent-runtime/src/__tests__/cost-aggregation.test.ts +0 -397
- package/packages/agent-runtime/src/__tests__/generate-diffs-prompt.test.ts +0 -107
- package/packages/agent-runtime/src/__tests__/get-file-reading-updates.test.ts +0 -59
- package/packages/agent-runtime/src/__tests__/gravity-index-tool.test.ts +0 -501
- package/packages/agent-runtime/src/__tests__/loop-agent-steps.test.ts +0 -1512
- package/packages/agent-runtime/src/__tests__/main-prompt.test.ts +0 -452
- package/packages/agent-runtime/src/__tests__/n-parameter.test.ts +0 -984
- package/packages/agent-runtime/src/__tests__/process-file-block.test.ts +0 -196
- package/packages/agent-runtime/src/__tests__/process-str-replace.test.ts +0 -512
- package/packages/agent-runtime/src/__tests__/programmatic-tool-authorization.test.ts +0 -219
- package/packages/agent-runtime/src/__tests__/prompt-caching-subagents.test.ts +0 -749
- package/packages/agent-runtime/src/__tests__/prompts-schema-handling.test.ts +0 -454
- package/packages/agent-runtime/src/__tests__/propose-tools.test.ts +0 -824
- package/packages/agent-runtime/src/__tests__/read-docs-tool.test.ts +0 -394
- package/packages/agent-runtime/src/__tests__/run-agent-step-prefill.test.ts +0 -161
- package/packages/agent-runtime/src/__tests__/run-agent-step-tools.test.ts +0 -612
- package/packages/agent-runtime/src/__tests__/run-programmatic-step.test.ts +0 -1743
- package/packages/agent-runtime/src/__tests__/sandbox-generator.test.ts +0 -154
- package/packages/agent-runtime/src/__tests__/spawn-agents-image-content.test.ts +0 -354
- package/packages/agent-runtime/src/__tests__/spawn-agents-message-history.test.ts +0 -280
- package/packages/agent-runtime/src/__tests__/spawn-agents-permissions.test.ts +0 -664
- package/packages/agent-runtime/src/__tests__/stream-parser-abort.test.ts +0 -250
- package/packages/agent-runtime/src/__tests__/stream-parser-reasoning.test.ts +0 -194
- package/packages/agent-runtime/src/__tests__/subagent-streaming.test.ts +0 -230
- package/packages/agent-runtime/src/__tests__/test-utils.ts +0 -96
- package/packages/agent-runtime/src/__tests__/thinker-convergence-gate.test.ts +0 -242
- package/packages/agent-runtime/src/__tests__/to-token-count-input-schema.test.ts +0 -81
- package/packages/agent-runtime/src/__tests__/tool-executor-sandbox.test.ts +0 -167
- package/packages/agent-runtime/src/__tests__/tool-stream-parser.test.ts +0 -682
- package/packages/agent-runtime/src/__tests__/tool-validation-error.test.ts +0 -1380
- package/packages/agent-runtime/src/__tests__/web-search-tool.test.ts +0 -402
- package/packages/agent-runtime/src/__tests__/xml-tool-result-ordering.test.ts +0 -264
- package/packages/agent-runtime/src/constants.ts +0 -12
- package/packages/agent-runtime/src/context-compactor.ts +0 -425
- package/packages/agent-runtime/src/find-files/__tests__/request-files-prompt.test.ts +0 -190
- package/packages/agent-runtime/src/find-files/custom-file-picker-config.ts +0 -61
- package/packages/agent-runtime/src/find-files/request-files-prompt.ts +0 -462
- package/packages/agent-runtime/src/generate-diffs-prompt.ts +0 -38
- package/packages/agent-runtime/src/get-file-reading-updates.ts +0 -27
- package/packages/agent-runtime/src/llm-api/__tests__/gemini-with-fallbacks.test.ts +0 -267
- package/packages/agent-runtime/src/llm-api/__tests__/serper-api.test.ts +0 -297
- package/packages/agent-runtime/src/llm-api/claude.ts +0 -7
- package/packages/agent-runtime/src/llm-api/context7-api.ts +0 -290
- package/packages/agent-runtime/src/llm-api/gemini-with-fallbacks.ts +0 -104
- package/packages/agent-runtime/src/llm-api/savant-code-web-api.ts +0 -370
- package/packages/agent-runtime/src/llm-api/serper-api.ts +0 -193
- package/packages/agent-runtime/src/main-prompt.ts +0 -251
- package/packages/agent-runtime/src/mcp-constants.ts +0 -12
- package/packages/agent-runtime/src/mcp.ts +0 -83
- package/packages/agent-runtime/src/process-file-block.ts +0 -118
- package/packages/agent-runtime/src/process-str-replace.ts +0 -213
- package/packages/agent-runtime/src/prompt-agent-stream.ts +0 -119
- package/packages/agent-runtime/src/run-agent-step.ts +0 -1632
- package/packages/agent-runtime/src/run-programmatic-step.ts +0 -633
- package/packages/agent-runtime/src/system-prompt/prompts.ts +0 -215
- package/packages/agent-runtime/src/system-prompt/search-system-prompt.ts +0 -89
- package/packages/agent-runtime/src/system-prompt/truncate-file-tree.ts +0 -414
- package/packages/agent-runtime/src/templates/README.md +0 -160
- package/packages/agent-runtime/src/templates/__tests__/agent-registry.test.ts +0 -489
- package/packages/agent-runtime/src/templates/__tests__/strings.test.ts +0 -465
- package/packages/agent-runtime/src/templates/agent-registry.ts +0 -122
- package/packages/agent-runtime/src/templates/prompts.ts +0 -189
- package/packages/agent-runtime/src/templates/strings.ts +0 -292
- package/packages/agent-runtime/src/templates/types.ts +0 -61
- package/packages/agent-runtime/src/tool-stream-parser.ts +0 -260
- package/packages/agent-runtime/src/tools/filter-tool-set.ts +0 -18
- package/packages/agent-runtime/src/tools/handlers/__tests__/glob.test.ts +0 -331
- package/packages/agent-runtime/src/tools/handlers/__tests__/read-subtree.test.ts +0 -346
- package/packages/agent-runtime/src/tools/handlers/__tests__/run-readonly-command.test.ts +0 -284
- package/packages/agent-runtime/src/tools/handlers/handler-function-type.ts +0 -77
- package/packages/agent-runtime/src/tools/handlers/list.ts +0 -105
- package/packages/agent-runtime/src/tools/handlers/tool/__tests__/checkpoint-store.test.ts +0 -394
- package/packages/agent-runtime/src/tools/handlers/tool/__tests__/skill.test.ts +0 -98
- package/packages/agent-runtime/src/tools/handlers/tool/__tests__/write-file.test.ts +0 -24
- package/packages/agent-runtime/src/tools/handlers/tool/add-message.ts +0 -37
- package/packages/agent-runtime/src/tools/handlers/tool/add-subgoal.ts +0 -30
- package/packages/agent-runtime/src/tools/handlers/tool/apply-patch.ts +0 -120
- package/packages/agent-runtime/src/tools/handlers/tool/ask-user.ts +0 -25
- package/packages/agent-runtime/src/tools/handlers/tool/browser-logs.ts +0 -21
- package/packages/agent-runtime/src/tools/handlers/tool/checkpoint-store.ts +0 -378
- package/packages/agent-runtime/src/tools/handlers/tool/code-search.ts +0 -21
- package/packages/agent-runtime/src/tools/handlers/tool/composio.ts +0 -52
- package/packages/agent-runtime/src/tools/handlers/tool/create-plan.ts +0 -63
- package/packages/agent-runtime/src/tools/handlers/tool/end-turn.ts +0 -15
- package/packages/agent-runtime/src/tools/handlers/tool/find-files.ts +0 -161
- package/packages/agent-runtime/src/tools/handlers/tool/glob.ts +0 -22
- package/packages/agent-runtime/src/tools/handlers/tool/gravity-index.ts +0 -230
- package/packages/agent-runtime/src/tools/handlers/tool/list-directory.ts +0 -22
- package/packages/agent-runtime/src/tools/handlers/tool/lookup-agent-info.ts +0 -105
- package/packages/agent-runtime/src/tools/handlers/tool/propose-str-replace.ts +0 -111
- package/packages/agent-runtime/src/tools/handlers/tool/propose-write-file.ts +0 -89
- package/packages/agent-runtime/src/tools/handlers/tool/proposed-content-store.ts +0 -64
- package/packages/agent-runtime/src/tools/handlers/tool/read-docs.ts +0 -160
- package/packages/agent-runtime/src/tools/handlers/tool/read-files.ts +0 -43
- package/packages/agent-runtime/src/tools/handlers/tool/read-subtree.ts +0 -198
- package/packages/agent-runtime/src/tools/handlers/tool/read-url.ts +0 -21
- package/packages/agent-runtime/src/tools/handlers/tool/render-ui.ts +0 -15
- package/packages/agent-runtime/src/tools/handlers/tool/run-file-change-hooks.ts +0 -20
- package/packages/agent-runtime/src/tools/handlers/tool/run-readonly-command.ts +0 -215
- package/packages/agent-runtime/src/tools/handlers/tool/run-terminal-command.ts +0 -33
- package/packages/agent-runtime/src/tools/handlers/tool/sequential-thinking.ts +0 -53
- package/packages/agent-runtime/src/tools/handlers/tool/set-messages.ts +0 -19
- package/packages/agent-runtime/src/tools/handlers/tool/set-output.ts +0 -104
- package/packages/agent-runtime/src/tools/handlers/tool/set-scaffold-complete.ts +0 -32
- package/packages/agent-runtime/src/tools/handlers/tool/skill.ts +0 -146
- package/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-inline.ts +0 -149
- package/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.ts +0 -436
- package/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.ts +0 -286
- package/packages/agent-runtime/src/tools/handlers/tool/str-replace.ts +0 -135
- package/packages/agent-runtime/src/tools/handlers/tool/suggest-followups.ts +0 -20
- package/packages/agent-runtime/src/tools/handlers/tool/task-completed.ts +0 -15
- package/packages/agent-runtime/src/tools/handlers/tool/think-deeply.ts +0 -25
- package/packages/agent-runtime/src/tools/handlers/tool/transition-phase.ts +0 -160
- package/packages/agent-runtime/src/tools/handlers/tool/update-subgoal.ts +0 -48
- package/packages/agent-runtime/src/tools/handlers/tool/web-search.ts +0 -151
- package/packages/agent-runtime/src/tools/handlers/tool/write-file.ts +0 -281
- package/packages/agent-runtime/src/tools/handlers/tool/write-todos.ts +0 -19
- package/packages/agent-runtime/src/tools/prompts.ts +0 -233
- package/packages/agent-runtime/src/tools/sandbox/__tests__/engine.test.ts +0 -169
- package/packages/agent-runtime/src/tools/sandbox/__tests__/shell-denylist.test.ts +0 -104
- package/packages/agent-runtime/src/tools/sandbox/engine.ts +0 -109
- package/packages/agent-runtime/src/tools/sandbox/index.ts +0 -14
- package/packages/agent-runtime/src/tools/sandbox/shell-denylist.ts +0 -119
- package/packages/agent-runtime/src/tools/stream-parser.ts +0 -407
- package/packages/agent-runtime/src/tools/thinker-convergence-gate.ts +0 -162
- package/packages/agent-runtime/src/tools/thought-session-store.ts +0 -43
- package/packages/agent-runtime/src/tools/tool-executor.ts +0 -1098
- package/packages/agent-runtime/src/util/__tests__/messages.test.ts +0 -995
- package/packages/agent-runtime/src/util/__tests__/parse-tool-calls-from-text.test.ts +0 -363
- package/packages/agent-runtime/src/util/__tests__/simplify-tool-results.test.ts +0 -382
- package/packages/agent-runtime/src/util/__tests__/stream-xml-parser.test.ts +0 -285
- package/packages/agent-runtime/src/util/__tests__/think-tags.test.ts +0 -49
- package/packages/agent-runtime/src/util/__tests__/token-counter.test.ts +0 -121
- package/packages/agent-runtime/src/util/activity-tracking.ts +0 -252
- package/packages/agent-runtime/src/util/agent-output.ts +0 -102
- package/packages/agent-runtime/src/util/cache-debug.ts +0 -330
- package/packages/agent-runtime/src/util/format-value.ts +0 -16
- package/packages/agent-runtime/src/util/messages.ts +0 -461
- package/packages/agent-runtime/src/util/parse-tool-calls-from-text.ts +0 -122
- package/packages/agent-runtime/src/util/render-read-files-result.ts +0 -18
- package/packages/agent-runtime/src/util/simplify-tool-results.ts +0 -61
- package/packages/agent-runtime/src/util/stream-xml-parser.ts +0 -259
- package/packages/agent-runtime/src/util/think-tags.ts +0 -33
- package/packages/agent-runtime/src/util/token-counter.ts +0 -136
- package/packages/agent-runtime/tsconfig.json +0 -8
- package/packages/code-map/README.md +0 -43
- package/packages/code-map/__tests__/integration.test.ts +0 -278
- package/packages/code-map/__tests__/languages.test.ts +0 -240
- package/packages/code-map/__tests__/parse.test.ts +0 -640
- package/packages/code-map/__tests__/test-langs/test.c +0 -42
- package/packages/code-map/__tests__/test-langs/test.cpp +0 -34
- package/packages/code-map/__tests__/test-langs/test.cs +0 -34
- package/packages/code-map/__tests__/test-langs/test.go +0 -27
- package/packages/code-map/__tests__/test-langs/test.java +0 -31
- package/packages/code-map/__tests__/test-langs/test.js +0 -50
- package/packages/code-map/__tests__/test-langs/test.php +0 -34
- package/packages/code-map/__tests__/test-langs/test.py +0 -25
- package/packages/code-map/__tests__/test-langs/test.rb +0 -28
- package/packages/code-map/__tests__/test-langs/test.rs +0 -28
- package/packages/code-map/__tests__/test-langs/test.ts +0 -31
- package/packages/code-map/package.json +0 -33
- package/packages/code-map/src/index.ts +0 -4
- package/packages/code-map/src/init-node.ts +0 -185
- package/packages/code-map/src/languages.ts +0 -344
- package/packages/code-map/src/parse.ts +0 -410
- package/packages/code-map/src/tree-sitter-queries/readme.md +0 -24
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-c-tags.scm +0 -16
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-c_sharp-tags.scm +0 -23
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-cpp-tags.scm +0 -29
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-go-tags.scm +0 -26
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-java-tags.scm +0 -19
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-javascript-tags.scm +0 -16
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-php-tags.scm +0 -23
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-python-tags.scm +0 -12
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-ruby-tags.scm +0 -58
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-rust-tags.scm +0 -26
- package/packages/code-map/src/tree-sitter-queries/tree-sitter-typescript-tags.scm +0 -22
- package/packages/code-map/src/types.ts +0 -11
- package/packages/code-map/src/utils.ts +0 -12
- package/packages/code-map/tsconfig.json +0 -10
- package/packages/database/README.md +0 -43
- package/packages/database/package.json +0 -28
- package/packages/database/src/__tests__/service.test.ts +0 -167
- package/packages/database/src/index.ts +0 -146
- package/packages/database/src/service.ts +0 -342
- package/packages/database/tsconfig.json +0 -9
- package/packages/llm-providers/README.md +0 -42
- package/packages/llm-providers/package.json +0 -42
- package/packages/llm-providers/src/ollama/__tests__/detect.test.ts +0 -59
- package/packages/llm-providers/src/ollama/detect.ts +0 -113
- package/packages/llm-providers/src/ollama/index.ts +0 -2
- package/packages/llm-providers/src/openai-compatible/chat/convert-to-openai-compatible-chat-messages.test.ts +0 -855
- package/packages/llm-providers/src/openai-compatible/chat/convert-to-openai-compatible-chat-messages.ts +0 -177
- package/packages/llm-providers/src/openai-compatible/chat/get-response-metadata.ts +0 -15
- package/packages/llm-providers/src/openai-compatible/chat/map-openai-compatible-finish-reason.ts +0 -19
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-api-types.ts +0 -60
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-language-model.test.ts +0 -549
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-language-model.ts +0 -474
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-chat-options.ts +0 -25
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-metadata-extractor.ts +0 -49
- package/packages/llm-providers/src/openai-compatible/chat/openai-compatible-prepare-tools.ts +0 -162
- package/packages/llm-providers/src/openai-compatible/chat/stream-transform.test.ts +0 -106
- package/packages/llm-providers/src/openai-compatible/chat/stream-transform.ts +0 -585
- package/packages/llm-providers/src/openai-compatible/completion/convert-to-openai-compatible-completion-prompt.ts +0 -98
- package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-language-model.test.ts +0 -173
- package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-language-model.ts +0 -414
- package/packages/llm-providers/src/openai-compatible/completion/openai-compatible-completion-options.ts +0 -33
- package/packages/llm-providers/src/openai-compatible/embedding/openai-compatible-embedding-model.ts +0 -143
- package/packages/llm-providers/src/openai-compatible/embedding/openai-compatible-embedding-options.ts +0 -21
- package/packages/llm-providers/src/openai-compatible/image/openai-compatible-image-model.ts +0 -129
- package/packages/llm-providers/src/openai-compatible/image/openai-compatible-image-settings.ts +0 -1
- package/packages/llm-providers/src/openai-compatible/index.ts +0 -27
- package/packages/llm-providers/src/openai-compatible/openai-compatible-error.ts +0 -34
- package/packages/llm-providers/src/openai-compatible/openai-compatible-provider.ts +0 -174
- package/packages/llm-providers/src/openai-compatible/version.ts +0 -5
- package/packages/llm-providers/tsconfig.json +0 -9
- package/protocol.config.yaml +0 -113
- package/savant-free/README.md +0 -73
- package/savant-free/SPEC.md +0 -385
- package/savant-free/cli/build.ts +0 -49
- package/savant-free/cli/release/README.md +0 -55
- package/savant-free/cli/release/index.js +0 -37
- package/savant-free/cli/release/package.json +0 -43
- package/savant-free/cli/release.ts +0 -128
- package/savant-free/cli/smoke-test.test.ts +0 -257
- package/savant-free/e2e/README.md +0 -173
- package/savant-free/e2e/agent/savant-free-tester.ts +0 -52
- package/savant-free/e2e/tests/ads-behavior.e2e.test.ts +0 -51
- package/savant-free/e2e/tests/agent-startup.e2e.test.ts +0 -61
- package/savant-free/e2e/tests/code-edit.e2e.test.ts +0 -78
- package/savant-free/e2e/tests/help-command.e2e.test.ts +0 -97
- package/savant-free/e2e/tests/knowledge-file.e2e.test.ts +0 -66
- package/savant-free/e2e/tests/slash-commands.e2e.test.ts +0 -119
- package/savant-free/e2e/tests/startup.e2e.test.ts +0 -56
- package/savant-free/e2e/tests/terminal-command.e2e.test.ts +0 -71
- package/savant-free/e2e/tests/version.e2e.test.ts +0 -50
- package/savant-free/e2e/utils/binary-helpers.ts +0 -24
- package/savant-free/e2e/utils/index.ts +0 -17
- package/savant-free/e2e/utils/savant-free-session.ts +0 -229
- package/savant-free/e2e/utils/tmux-custom-tools.ts +0 -156
- package/savant-free/e2e/utils/tmux-helpers.ts +0 -79
- package/savant-free/package.json +0 -20
- package/scripts/eslint-rules/__fixtures__/debug-ast.mjs +0 -20
- package/scripts/eslint-rules/__fixtures__/probe.mjs +0 -41
- package/scripts/eslint-rules/__fixtures__/probe2.mjs +0 -43
- package/scripts/eslint-rules/__fixtures__/rule-test.mjs +0 -44
- package/scripts/eslint-rules/__fixtures__/rule-test2.mjs +0 -27
- package/scripts/eslint-rules/__fixtures__/unknown-bad.ts +0 -21
- package/scripts/eslint-rules/__fixtures__/unknown-good.ts +0 -35
- package/scripts/eslint-rules/no-unknown-in-signatures.js +0 -141
- package/scripts/release.py +0 -360
- package/scripts/run-az-test.sh +0 -1150
- package/scripts/sync-agents.py +0 -337
- package/scripts/tmux/README.md +0 -359
- package/scripts/tmux/package.json +0 -9
- package/scripts/tmux/tmux-capture.sh +0 -231
- package/scripts/tmux/tmux-cli.sh +0 -160
- package/scripts/tmux/tmux-env.sh +0 -34
- package/scripts/tmux/tmux-send.sh +0 -339
- package/scripts/tmux/tmux-start.sh +0 -264
- package/scripts/tmux/tmux-stop.sh +0 -157
- package/scripts/tmux/tmux-viewer/README.md +0 -254
- package/scripts/tmux/tmux-viewer/components/session-viewer.tsx +0 -556
- package/scripts/tmux/tmux-viewer/components/theme.ts +0 -54
- package/scripts/tmux/tmux-viewer/gif-encoder-2.d.ts +0 -28
- package/scripts/tmux/tmux-viewer/gif-exporter.ts +0 -278
- package/scripts/tmux/tmux-viewer/index.tsx +0 -237
- package/scripts/tmux/tmux-viewer/package.json +0 -9
- package/scripts/tmux/tmux-viewer/session-loader.ts +0 -234
- package/scripts/tmux/tmux-viewer/tsconfig.json +0 -9
- package/scripts/tmux/tmux-viewer/types.ts +0 -76
- package/sdk/CHANGELOG.md +0 -126
- package/sdk/PUBLISHING.md +0 -55
- package/sdk/README.md +0 -334
- package/sdk/bunfig.toml +0 -6
- package/sdk/e2e/README.md +0 -158
- package/sdk/e2e/custom-agents/api-integration-agent.e2e.test.ts +0 -145
- package/sdk/e2e/custom-agents/apply-patch-tool.e2e.test.ts +0 -62
- package/sdk/e2e/custom-agents/database-query-agent.e2e.test.ts +0 -135
- package/sdk/e2e/custom-agents/weather-agent.e2e.test.ts +0 -120
- package/sdk/e2e/examples/code-explainer.example.ts +0 -62
- package/sdk/e2e/examples/code-reviewer.example.ts +0 -52
- package/sdk/e2e/examples/commit-message-generator.example.ts +0 -61
- package/sdk/e2e/examples/sdk-lint.example.ts +0 -65
- package/sdk/e2e/examples/sdk-refactor.example.ts +0 -63
- package/sdk/e2e/examples/sdk-test-gen.example.ts +0 -62
- package/sdk/e2e/features/knowledge-files.e2e.test.ts +0 -82
- package/sdk/e2e/features/max-agent-steps.e2e.test.ts +0 -65
- package/sdk/e2e/features/project-files.e2e.test.ts +0 -80
- package/sdk/e2e/integration/connection-check.integration.test.ts +0 -33
- package/sdk/e2e/integration/event-ordering.integration.test.ts +0 -186
- package/sdk/e2e/integration/event-types.integration.test.ts +0 -183
- package/sdk/e2e/integration/stream-chunks.integration.test.ts +0 -191
- package/sdk/e2e/streaming/concurrent-streams.e2e.test.ts +0 -164
- package/sdk/e2e/streaming/subagent-streaming.e2e.test.ts +0 -158
- package/sdk/e2e/utils/__tests__/event-collector.test.ts +0 -297
- package/sdk/e2e/utils/e2e-mocks.ts +0 -458
- package/sdk/e2e/utils/event-collector.ts +0 -145
- package/sdk/e2e/utils/get-api-key.ts +0 -76
- package/sdk/e2e/utils/index.ts +0 -3
- package/sdk/e2e/utils/test-fixtures.ts +0 -196
- package/sdk/e2e/workflows/error-recovery.e2e.test.ts +0 -112
- package/sdk/e2e/workflows/multi-turn-conversation.e2e.test.ts +0 -132
- package/sdk/examples/readme-example-1.ts +0 -34
- package/sdk/examples/readme-example-2.ts +0 -76
- package/sdk/package.json +0 -82
- package/sdk/scripts/build.ts +0 -349
- package/sdk/scripts/fetch-ripgrep.ts +0 -172
- package/sdk/scripts/publish.ts +0 -51
- package/sdk/scripts/release.js +0 -100
- package/sdk/scripts/verify.ts +0 -204
- package/sdk/sdk_exit +0 -1
- package/sdk/smoke-test-dist.ts +0 -248
- package/sdk/src/__tests__/apply-overrides-resume.test.ts +0 -83
- package/sdk/src/__tests__/apply-patch.test.ts +0 -438
- package/sdk/src/__tests__/build-file-tree.test.ts +0 -31
- package/sdk/src/__tests__/change-file.test.ts +0 -212
- package/sdk/src/__tests__/client.test.ts +0 -142
- package/sdk/src/__tests__/clone-session-state.test.ts +0 -158
- package/sdk/src/__tests__/code-search.test.ts +0 -896
- package/sdk/src/__tests__/composio.test.ts +0 -86
- package/sdk/src/__tests__/credentials.test.ts +0 -344
- package/sdk/src/__tests__/database.test.ts +0 -153
- package/sdk/src/__tests__/env.test.ts +0 -137
- package/sdk/src/__tests__/error-utils.test.ts +0 -253
- package/sdk/src/__tests__/fixtures/windows-stubborn-grandchild.ts +0 -26
- package/sdk/src/__tests__/initial-session-state.test.ts +0 -447
- package/sdk/src/__tests__/knowledge-file-selection.test.ts +0 -335
- package/sdk/src/__tests__/load-agents.test.ts +0 -935
- package/sdk/src/__tests__/load-mcp-config.test.ts +0 -285
- package/sdk/src/__tests__/load-skills.test.ts +0 -325
- package/sdk/src/__tests__/model-provider.test.ts +0 -44
- package/sdk/src/__tests__/path-utils.test.ts +0 -66
- package/sdk/src/__tests__/read-files.test.ts +0 -573
- package/sdk/src/__tests__/read-url.test.ts +0 -371
- package/sdk/src/__tests__/researcher-web.integration.test.ts +0 -130
- package/sdk/src/__tests__/run-cancellation.test.ts +0 -1321
- package/sdk/src/__tests__/run-error-preserves-history.test.ts +0 -335
- package/sdk/src/__tests__/run-event-dispatch.test.ts +0 -80
- package/sdk/src/__tests__/run-file-filter.test.ts +0 -530
- package/sdk/src/__tests__/run-handle-event.test.ts +0 -142
- package/sdk/src/__tests__/run-mcp-tool-filter.test.ts +0 -124
- package/sdk/src/__tests__/run-state-child-process.test.ts +0 -72
- package/sdk/src/__tests__/run-terminal-command.test.ts +0 -236
- package/sdk/src/__tests__/run.integration.test.ts +0 -170
- package/sdk/src/__tests__/user-knowledge-files.test.ts +0 -361
- package/sdk/src/__tests__/validate-agents.test.ts +0 -943
- package/sdk/src/agents/load-agents.ts +0 -339
- package/sdk/src/agents/load-mcp-config.ts +0 -275
- package/sdk/src/client.ts +0 -87
- package/sdk/src/composio.ts +0 -78
- package/sdk/src/constants.ts +0 -29
- package/sdk/src/credentials.ts +0 -303
- package/sdk/src/custom-tool.ts +0 -66
- package/sdk/src/env.ts +0 -116
- package/sdk/src/error-utils.ts +0 -127
- package/sdk/src/impl/__tests__/llm-chatgpt-oauth-policy.test.ts +0 -67
- package/sdk/src/impl/__tests__/llm-native-tool-call.test.ts +0 -38
- package/sdk/src/impl/__tests__/llm-stream-yielded-content.test.ts +0 -118
- package/sdk/src/impl/__tests__/model-provider-free-mode.test.ts +0 -166
- package/sdk/src/impl/__tests__/prompt-result.test.ts +0 -210
- package/sdk/src/impl/__tests__/provider-options-metadata.test.ts +0 -67
- package/sdk/src/impl/agent-runtime.ts +0 -159
- package/sdk/src/impl/chatgpt-backend-fetch.ts +0 -588
- package/sdk/src/impl/database.ts +0 -516
- package/sdk/src/impl/llm.ts +0 -852
- package/sdk/src/impl/model-provider.ts +0 -638
- package/sdk/src/impl/openrouter-key-resolver.ts +0 -78
- package/sdk/src/index.ts +0 -133
- package/sdk/src/native/ripgrep.ts +0 -141
- package/sdk/src/retry-config.ts +0 -51
- package/sdk/src/run-state.ts +0 -897
- package/sdk/src/run.ts +0 -1222
- package/sdk/src/skills/load-skills.ts +0 -253
- package/sdk/src/testing/env.ts +0 -19
- package/sdk/src/tools/apply-patch.ts +0 -690
- package/sdk/src/tools/change-file.ts +0 -155
- package/sdk/src/tools/code-search.ts +0 -547
- package/sdk/src/tools/glob.ts +0 -58
- package/sdk/src/tools/index.ts +0 -19
- package/sdk/src/tools/list-directory.ts +0 -52
- package/sdk/src/tools/path-utils.ts +0 -101
- package/sdk/src/tools/read-files.ts +0 -110
- package/sdk/src/tools/read-url.ts +0 -469
- package/sdk/src/tools/run-file-change-hooks.ts +0 -22
- package/sdk/src/tools/run-terminal-command.ts +0 -483
- package/sdk/src/tools/ssrf.ts +0 -120
- package/sdk/src/types/env.ts +0 -40
- package/sdk/src/utils/logger.ts +0 -15
- package/sdk/src/validate-agents.ts +0 -157
- package/sdk/test/cjs-compatibility/package-lock.json +0 -423
- package/sdk/test/cjs-compatibility/package.json +0 -21
- package/sdk/test/cjs-compatibility/test-imports.js +0 -77
- package/sdk/test/cjs-compatibility/test-types.ts +0 -54
- package/sdk/test/cjs-compatibility/tsconfig.json +0 -17
- package/sdk/test/esm-compatibility/package-lock.json +0 -423
- package/sdk/test/esm-compatibility/package.json +0 -21
- package/sdk/test/esm-compatibility/test-imports.js +0 -83
- package/sdk/test/esm-compatibility/test-types.ts +0 -59
- package/sdk/test/esm-compatibility/tsconfig.json +0 -17
- package/sdk/test/ripgrep-bundling/package-lock.json +0 -423
- package/sdk/test/ripgrep-bundling/package.json +0 -21
- package/sdk/test/ripgrep-bundling/test-ripgrep-types.ts +0 -132
- package/sdk/test/ripgrep-bundling/test-ripgrep.js +0 -257
- package/sdk/test/ripgrep-bundling/tsconfig.json +0 -15
- package/sdk/test/setup-env.ts +0 -54
- package/sdk/test/test-sdk.ts +0 -25
- package/sdk/test/tree-sitter-queries/package-lock.json +0 -47
- package/sdk/test/tree-sitter-queries/package.json +0 -12
- package/sdk/test/tree-sitter-queries/test-query-files.js +0 -256
- package/sdk/tsconfig.build.json +0 -32
- package/sdk/tsconfig.json +0 -27
- package/sdk/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/sdk/vendor/ripgrep/arm64-linux/rg +0 -0
- package/sdk/vendor/ripgrep/x64-darwin/rg +0 -0
- package/sdk/vendor/ripgrep/x64-linux/rg +0 -0
- package/sdk/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/templates/FID-TEMPLATE.md +0 -125
- package/templates/README-TEMPLATE.md +0 -87
- package/templates/SESSION-SUMMARY.md +0 -135
- package/tsconfig.base.json +0 -18
- package/tsconfig.json +0 -27
- /package/{cli/release-core/http.js → http.js} +0 -0
- /package/{cli/release-core/launcher.js → launcher.js} +0 -0
package/cli/src/chat.tsx
DELETED
|
@@ -1,2008 +0,0 @@
|
|
|
1
|
-
import { AnalyticsEvent } from '@savant-code/common/constants/analytics-events'
|
|
2
|
-
import {
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useLayoutEffect,
|
|
6
|
-
useMemo,
|
|
7
|
-
useRef,
|
|
8
|
-
useState,
|
|
9
|
-
} from 'react'
|
|
10
|
-
import { useShallow } from 'zustand/react/shallow'
|
|
11
|
-
|
|
12
|
-
import { getAdsEnabled } from './commands/ads'
|
|
13
|
-
import { getCheckpointDir } from './commands/rewind'
|
|
14
|
-
import { routeUserPrompt, addBashMessageToHistory } from './commands/router'
|
|
15
|
-
import { SingleAdBanner } from './components/ad-banner'
|
|
16
|
-
import { ChatHeader } from './components/chat-header'
|
|
17
|
-
import { ChatInputBar } from './components/chat-input-bar'
|
|
18
|
-
import { LoadPreviousButton } from './components/load-previous-button'
|
|
19
|
-
import { MessageWithAgents } from './components/message-with-agents'
|
|
20
|
-
import { ModelPicker } from './components/model-picker'
|
|
21
|
-
import { areCreditsRestored } from './components/out-of-credits-banner'
|
|
22
|
-
import { PendingBashMessage } from './components/pending-bash-message'
|
|
23
|
-
import { ProviderPicker } from './components/provider-picker'
|
|
24
|
-
import { ReviewScreen } from './components/review-screen'
|
|
25
|
-
import { RewindPicker } from './components/rewind-picker'
|
|
26
|
-
import { RightSidebar } from './components/right-sidebar'
|
|
27
|
-
import { SavantFreeActiveSessionSummary } from './components/savant-free-active-session-summary'
|
|
28
|
-
import { SessionEndedBanner } from './components/session-ended-banner'
|
|
29
|
-
import { StatusBar } from './components/status-bar'
|
|
30
|
-
import {
|
|
31
|
-
SuggestedPrompts,
|
|
32
|
-
DEFAULT_SUGGESTED_PROMPTS,
|
|
33
|
-
type SuggestedPromptSelection,
|
|
34
|
-
} from './components/suggested-prompts'
|
|
35
|
-
import { TopBanner } from './components/top-banner'
|
|
36
|
-
import { getSlashCommandsWithSkills } from './data/slash-commands'
|
|
37
|
-
import { createLoopRunHandler } from './hooks/run-outcome'
|
|
38
|
-
import { useAgentValidation } from './hooks/use-agent-validation'
|
|
39
|
-
import { useAskUserBridge } from './hooks/use-ask-user-bridge'
|
|
40
|
-
import { useChatInput } from './hooks/use-chat-input'
|
|
41
|
-
import {
|
|
42
|
-
useChatKeyboard,
|
|
43
|
-
type ChatKeyboardHandlers,
|
|
44
|
-
} from './hooks/use-chat-keyboard'
|
|
45
|
-
import { useChatMessages } from './hooks/use-chat-messages'
|
|
46
|
-
import { useChatState } from './hooks/use-chat-state'
|
|
47
|
-
import { useChatStreaming } from './hooks/use-chat-streaming'
|
|
48
|
-
import { useChatUI } from './hooks/use-chat-ui'
|
|
49
|
-
import { useClipboard } from './hooks/use-clipboard'
|
|
50
|
-
import { useEvent } from './hooks/use-event'
|
|
51
|
-
import { useGravityAd } from './hooks/use-gravity-ad'
|
|
52
|
-
import { useInputHistory } from './hooks/use-input-history'
|
|
53
|
-
import { useLoopScheduler } from './hooks/use-loop-scheduler'
|
|
54
|
-
import { usePublishMutation } from './hooks/use-publish-mutation'
|
|
55
|
-
import { returnToSavantFreeLanding } from './hooks/use-savant-free-session'
|
|
56
|
-
import { useScaffoldRevertSubscriber } from './hooks/use-scaffold-revert-subscriber'
|
|
57
|
-
import { useSendMessage } from './hooks/use-send-message'
|
|
58
|
-
import { useSubscriptionQuery } from './hooks/use-subscription-query'
|
|
59
|
-
import { useSuggestionEngine } from './hooks/use-suggestion-engine'
|
|
60
|
-
import { useUsageMonitor } from './hooks/use-usage-monitor'
|
|
61
|
-
import { WEBSITE_URL } from './login/constants'
|
|
62
|
-
import { getProjectRoot, tryGetProjectRoot } from './project-files'
|
|
63
|
-
import { useChatHistoryStore } from './state/chat-history-store'
|
|
64
|
-
import { useChatStore } from './state/chat-store'
|
|
65
|
-
import { useFeedbackStore } from './state/feedback-store'
|
|
66
|
-
import { useGatewayCatalogStore } from './state/gateway-catalog-store'
|
|
67
|
-
import { useMessageBlockStore } from './state/message-block-store'
|
|
68
|
-
import { useModelPickerStore } from './state/model-picker-store'
|
|
69
|
-
import { useProviderPickerStore } from './state/provider-picker-store'
|
|
70
|
-
import { usePublishStore } from './state/publish-store'
|
|
71
|
-
import { useReviewStore } from './state/review-store'
|
|
72
|
-
import { useRewindPickerStore } from './state/rewind-picker-store'
|
|
73
|
-
import { useSavantFreeModelStore } from './state/savant-free-model-store'
|
|
74
|
-
import { reportActivity } from './utils/activity-tracker'
|
|
75
|
-
import { trackEvent } from './utils/analytics'
|
|
76
|
-
import { showClipboardMessage } from './utils/clipboard'
|
|
77
|
-
import { readClipboardImage } from './utils/clipboard-image'
|
|
78
|
-
import { END_SESSION_MESSAGE, IS_SAVANT_FREE } from './utils/constants'
|
|
79
|
-
import { getInputModeConfig } from './utils/input-modes'
|
|
80
|
-
import {
|
|
81
|
-
type ChatKeyboardState,
|
|
82
|
-
createDefaultChatKeyboardState,
|
|
83
|
-
} from './utils/keyboard-actions'
|
|
84
|
-
import { loadLocalAgents } from './utils/local-agent-registry'
|
|
85
|
-
import { logger } from './utils/logger'
|
|
86
|
-
import { getSystemMessage } from './utils/message-history'
|
|
87
|
-
import { safeOpen } from './utils/open-url'
|
|
88
|
-
import { resolveContextWindowForModel } from './utils/openrouter-models'
|
|
89
|
-
import { formatCwd } from './utils/path-helpers'
|
|
90
|
-
import {
|
|
91
|
-
addClipboardPlaceholder,
|
|
92
|
-
addPendingFileFromPath,
|
|
93
|
-
addPendingImageFromFile,
|
|
94
|
-
validateAndAddImage,
|
|
95
|
-
} from './utils/pending-attachments'
|
|
96
|
-
import {
|
|
97
|
-
beginProviderSetup,
|
|
98
|
-
getMissingProviderSetup,
|
|
99
|
-
getProviderSetupGuidance,
|
|
100
|
-
getProviderSetupInfo,
|
|
101
|
-
} from './utils/provider-setup'
|
|
102
|
-
import { executeRewind } from './utils/rewind'
|
|
103
|
-
import {
|
|
104
|
-
hasSubmittedFirstPrompt,
|
|
105
|
-
loadSavantCodeModelPreference,
|
|
106
|
-
markFirstPromptSubmitted,
|
|
107
|
-
saveSavantCodeModelPreference,
|
|
108
|
-
saveSavantCodeModelProviderPreference,
|
|
109
|
-
} from './utils/settings'
|
|
110
|
-
import { getLoadedSkills } from './utils/skill-registry'
|
|
111
|
-
import {
|
|
112
|
-
getStatusIndicatorState,
|
|
113
|
-
type AuthStatus,
|
|
114
|
-
} from './utils/status-indicator-state'
|
|
115
|
-
import { createPasteHandler } from './utils/strings'
|
|
116
|
-
import { setTerminalTitle } from './utils/terminal-title'
|
|
117
|
-
import { computeInputLayoutMetrics } from './utils/text-layout'
|
|
118
|
-
|
|
119
|
-
import type { CommandResult } from './commands/command-registry'
|
|
120
|
-
import type { MultilineInputHandle } from './components/multiline-input'
|
|
121
|
-
import type { MatchedSlashCommand } from './hooks/use-suggestion-engine'
|
|
122
|
-
import type { RewindMode } from './state/rewind-picker-store'
|
|
123
|
-
import type { SavantFreeSession } from './types/savant-free-session'
|
|
124
|
-
import type { User } from './utils/auth'
|
|
125
|
-
import type { AgentMode } from './utils/constants'
|
|
126
|
-
import type { OpenRouterModel } from './utils/openrouter-models'
|
|
127
|
-
import type { ProviderSetupName } from './utils/provider-setup'
|
|
128
|
-
import type { PermissionMode } from './utils/settings'
|
|
129
|
-
import type { BoxRenderable, ScrollBoxRenderable } from '@opentui/core'
|
|
130
|
-
import type { FeedbackCategory } from '@savant-code/common/constants/feedback'
|
|
131
|
-
import type { FileTreeNode } from '@savant-code/common/util/file'
|
|
132
|
-
import type { TurnSummary } from '@savant-code/sdk'
|
|
133
|
-
import type { UseMutationResult } from '@tanstack/react-query'
|
|
134
|
-
import type { Dispatch, SetStateAction } from 'react'
|
|
135
|
-
|
|
136
|
-
// FID-007 S2: sidebar tool list — hoisted (stable identity so RightSidebar's
|
|
137
|
-
// React.memo can skip) and cross-checked against
|
|
138
|
-
// common/src/tools/constants.ts. The previous inline list named tools that do
|
|
139
|
-
// NOT exist in the executor allowlist (read_file, search_files, bash).
|
|
140
|
-
const SIDEBAR_TOOLS_AVAILABLE = [
|
|
141
|
-
'read_files',
|
|
142
|
-
'code_search',
|
|
143
|
-
'apply_patch',
|
|
144
|
-
'run_terminal_command',
|
|
145
|
-
]
|
|
146
|
-
|
|
147
|
-
// FID-007 D7: hoisted static style objects so the render loop stops
|
|
148
|
-
// allocating fresh style identities every render/tick.
|
|
149
|
-
const CHAT_ROOT_STYLE = {
|
|
150
|
-
flexDirection: 'row', // Horizontal split: chat + sidebar
|
|
151
|
-
gap: 0,
|
|
152
|
-
flexGrow: 1,
|
|
153
|
-
} as const
|
|
154
|
-
|
|
155
|
-
const HEADER_BOX_STYLE = { flexDirection: 'column' } as const
|
|
156
|
-
|
|
157
|
-
const SCROLLBOX_STYLE = {
|
|
158
|
-
flexGrow: 1,
|
|
159
|
-
rootOptions: {
|
|
160
|
-
flexGrow: 1,
|
|
161
|
-
padding: 0,
|
|
162
|
-
gap: 0,
|
|
163
|
-
flexDirection: 'row',
|
|
164
|
-
shouldFill: true,
|
|
165
|
-
backgroundColor: 'transparent',
|
|
166
|
-
},
|
|
167
|
-
wrapperOptions: {
|
|
168
|
-
flexGrow: 1,
|
|
169
|
-
border: false,
|
|
170
|
-
shouldFill: true,
|
|
171
|
-
backgroundColor: 'transparent',
|
|
172
|
-
flexDirection: 'column',
|
|
173
|
-
},
|
|
174
|
-
contentOptions: {
|
|
175
|
-
flexDirection: 'column',
|
|
176
|
-
gap: 0,
|
|
177
|
-
shouldFill: true,
|
|
178
|
-
justifyContent: 'flex-end',
|
|
179
|
-
backgroundColor: 'transparent',
|
|
180
|
-
paddingLeft: 1,
|
|
181
|
-
paddingRight: 2,
|
|
182
|
-
},
|
|
183
|
-
} as const
|
|
184
|
-
|
|
185
|
-
const BOTTOM_BOX_STYLE = {
|
|
186
|
-
flexShrink: 0,
|
|
187
|
-
backgroundColor: 'transparent',
|
|
188
|
-
} as const
|
|
189
|
-
|
|
190
|
-
export const Chat = ({
|
|
191
|
-
initialPrompt,
|
|
192
|
-
agentId,
|
|
193
|
-
fileTree,
|
|
194
|
-
inputRef,
|
|
195
|
-
setIsAuthenticated,
|
|
196
|
-
setUser,
|
|
197
|
-
logoutMutation,
|
|
198
|
-
continueChat,
|
|
199
|
-
continueChatId,
|
|
200
|
-
authStatus,
|
|
201
|
-
initialMode,
|
|
202
|
-
initialPermissionMode,
|
|
203
|
-
gitRoot,
|
|
204
|
-
onSwitchToGitRoot,
|
|
205
|
-
savantFreeSession,
|
|
206
|
-
}: {
|
|
207
|
-
initialPrompt: string | null
|
|
208
|
-
agentId?: string
|
|
209
|
-
fileTree: FileTreeNode[]
|
|
210
|
-
inputRef: React.MutableRefObject<MultilineInputHandle | null>
|
|
211
|
-
setIsAuthenticated: Dispatch<SetStateAction<boolean | null>>
|
|
212
|
-
setUser: Dispatch<SetStateAction<User | null>>
|
|
213
|
-
logoutMutation: UseMutationResult<boolean, Error, void, unknown>
|
|
214
|
-
continueChat: boolean
|
|
215
|
-
continueChatId?: string
|
|
216
|
-
authStatus: AuthStatus
|
|
217
|
-
initialMode?: AgentMode
|
|
218
|
-
initialPermissionMode?: PermissionMode
|
|
219
|
-
gitRoot?: string | null
|
|
220
|
-
onSwitchToGitRoot?: () => void
|
|
221
|
-
savantFreeSession: SavantFreeSession | null
|
|
222
|
-
}) => {
|
|
223
|
-
const [forceFileOnlyMentions, setForceFileOnlyMentions] = useState(false)
|
|
224
|
-
const headerRef = useRef<BoxRenderable | null>(null)
|
|
225
|
-
const [isHeaderVisible, setIsHeaderVisible] = useState(true)
|
|
226
|
-
|
|
227
|
-
// First-time onboarding: show clickable starter prompts until the user
|
|
228
|
-
// submits their first prompt ever (persisted in settings). SavantFree only.
|
|
229
|
-
const [showSuggestedPrompts, setShowSuggestedPrompts] = useState(
|
|
230
|
-
() => IS_SAVANT_FREE && !hasSubmittedFirstPrompt(),
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
const { validate: validateAgents } = useAgentValidation()
|
|
234
|
-
|
|
235
|
-
// Subscribe to ask_user bridge to trigger form display
|
|
236
|
-
useAskUserBridge()
|
|
237
|
-
|
|
238
|
-
// Auto-revert from SCAFFOLD to EDIT when the orchestrator declares the
|
|
239
|
-
// scaffold complete via the set_scaffold_complete tool.
|
|
240
|
-
useScaffoldRevertSubscriber()
|
|
241
|
-
|
|
242
|
-
// Monitor usage data and auto-show banner when thresholds are crossed
|
|
243
|
-
useUsageMonitor()
|
|
244
|
-
|
|
245
|
-
// Get chat state from extracted hook
|
|
246
|
-
const {
|
|
247
|
-
inputValue,
|
|
248
|
-
cursorPosition,
|
|
249
|
-
lastEditDueToNav,
|
|
250
|
-
setInputValue,
|
|
251
|
-
inputFocused,
|
|
252
|
-
setInputFocused,
|
|
253
|
-
slashSelectedIndex,
|
|
254
|
-
setSlashSelectedIndex,
|
|
255
|
-
agentSelectedIndex,
|
|
256
|
-
setAgentSelectedIndex,
|
|
257
|
-
focusedAgentId,
|
|
258
|
-
setFocusedAgentId,
|
|
259
|
-
messages,
|
|
260
|
-
setMessages,
|
|
261
|
-
agentMode,
|
|
262
|
-
setAgentMode,
|
|
263
|
-
toggleAgentMode,
|
|
264
|
-
isRetrying,
|
|
265
|
-
pendingBashMessages,
|
|
266
|
-
refs: {
|
|
267
|
-
activeAgentStreamsRef,
|
|
268
|
-
isChainInProgressRef,
|
|
269
|
-
activeSubagentsRef,
|
|
270
|
-
abortControllerRef,
|
|
271
|
-
sendMessageRef,
|
|
272
|
-
},
|
|
273
|
-
} = useChatState()
|
|
274
|
-
|
|
275
|
-
const providerGuidanceShownRef = useRef(false)
|
|
276
|
-
useEffect(() => {
|
|
277
|
-
// FID-007 U1: provider guidance is non-free builds only — SavantFree
|
|
278
|
-
// reaches inference via its own gateway, `/provider` is not registered
|
|
279
|
-
// there, and instructing free users to run it would produce
|
|
280
|
-
// "Command not found".
|
|
281
|
-
if (IS_SAVANT_FREE) return
|
|
282
|
-
if (providerGuidanceShownRef.current || messages.length !== 0) return
|
|
283
|
-
|
|
284
|
-
const missingProvider = getMissingProviderSetup()
|
|
285
|
-
if (!missingProvider) return
|
|
286
|
-
|
|
287
|
-
providerGuidanceShownRef.current = true
|
|
288
|
-
setMessages((prev) => [
|
|
289
|
-
...prev,
|
|
290
|
-
getSystemMessage(getProviderSetupGuidance(missingProvider)),
|
|
291
|
-
])
|
|
292
|
-
}, [messages.length, setMessages])
|
|
293
|
-
|
|
294
|
-
// Sidebar data from chat-store
|
|
295
|
-
const contextTokensUsed = useChatStore((s) => s.contextTokensUsed)
|
|
296
|
-
const contextTokensMax = useChatStore((s) => s.contextTokensMax)
|
|
297
|
-
// FID-007 S1: reactive selector — the previous getState() read during
|
|
298
|
-
// render was non-reactive (stale until some unrelated state forced a
|
|
299
|
-
// re-render).
|
|
300
|
-
const fsmPhase = useChatStore((s) => s.fsmPhase)
|
|
301
|
-
const toolsUsed = useChatStore((s) => s.toolsUsed)
|
|
302
|
-
const toolHistory = useChatStore((s) => s.toolHistory)
|
|
303
|
-
const filesChanged = useChatStore((s) => s.filesChanged)
|
|
304
|
-
const agentStack = useChatStore((s) => s.agentStack)
|
|
305
|
-
const sessionCost = useChatStore((s) => s.sessionCost)
|
|
306
|
-
const updateContextTokensMax = useChatStore((s) => s.updateContextTokensMax)
|
|
307
|
-
const sidebarModel = useSavantFreeModelStore((s) => s.selectedModel)
|
|
308
|
-
|
|
309
|
-
// Interactive /model picker overlay state.
|
|
310
|
-
const modelPickerOpen = useModelPickerStore((s) => s.isOpen)
|
|
311
|
-
const modelPickerQuery = useModelPickerStore((s) => s.query)
|
|
312
|
-
const modelPickerModels = useModelPickerStore((s) => s.models)
|
|
313
|
-
const modelPickerSelectedIndex = useModelPickerStore((s) => s.selectedIndex)
|
|
314
|
-
const setModelPickerQuery = useModelPickerStore((s) => s.setQuery)
|
|
315
|
-
const setModelPickerSelectedIndex = useModelPickerStore(
|
|
316
|
-
(s) => s.setSelectedIndex,
|
|
317
|
-
)
|
|
318
|
-
const closeModelPicker = useModelPickerStore((s) => s.close)
|
|
319
|
-
|
|
320
|
-
// Interactive /provider picker overlay state.
|
|
321
|
-
const providerPickerOpen = useProviderPickerStore((s) => s.isOpen)
|
|
322
|
-
const providerPickerProviders = useProviderPickerStore((s) => s.providers)
|
|
323
|
-
const providerPickerSelectedIndex = useProviderPickerStore(
|
|
324
|
-
(s) => s.selectedIndex,
|
|
325
|
-
)
|
|
326
|
-
const setProviderPickerSelectedIndex = useProviderPickerStore(
|
|
327
|
-
(s) => s.setSelectedIndex,
|
|
328
|
-
)
|
|
329
|
-
const closeProviderPicker = useProviderPickerStore((s) => s.close)
|
|
330
|
-
|
|
331
|
-
// Interactive /rewind picker overlay state (FID-2026-0803-004).
|
|
332
|
-
const rewindPickerOpen = useRewindPickerStore((s) => s.isOpen)
|
|
333
|
-
const rewindPickerTurns = useRewindPickerStore((s) => s.turns)
|
|
334
|
-
const rewindPickerSelectedIndex = useRewindPickerStore((s) => s.selectedIndex)
|
|
335
|
-
const rewindPickerStage = useRewindPickerStore((s) => s.stage)
|
|
336
|
-
const rewindPickerMode = useRewindPickerStore((s) => s.mode)
|
|
337
|
-
const setRewindPickerSelectedIndex = useRewindPickerStore(
|
|
338
|
-
(s) => s.setSelectedIndex,
|
|
339
|
-
)
|
|
340
|
-
const setRewindPickerStage = useRewindPickerStore((s) => s.setStage)
|
|
341
|
-
const setRewindPickerMode = useRewindPickerStore((s) => s.setMode)
|
|
342
|
-
const closeRewindPicker = useRewindPickerStore((s) => s.close)
|
|
343
|
-
|
|
344
|
-
const { statusMessage } = useClipboard()
|
|
345
|
-
|
|
346
|
-
// Fetch subscription data early - needed for session credits tracking and ad gating
|
|
347
|
-
const { data: subscriptionData } = useSubscriptionQuery({
|
|
348
|
-
refetchInterval: 60 * 1000,
|
|
349
|
-
})
|
|
350
|
-
const hasSubscription = subscriptionData?.hasSubscription ?? false
|
|
351
|
-
|
|
352
|
-
const {
|
|
353
|
-
ads,
|
|
354
|
-
responseAds,
|
|
355
|
-
requestResponseAds,
|
|
356
|
-
recordClick,
|
|
357
|
-
recordImpression,
|
|
358
|
-
} = useGravityAd({
|
|
359
|
-
enabled: IS_SAVANT_FREE || !hasSubscription,
|
|
360
|
-
provider: 'gravity',
|
|
361
|
-
inline: true,
|
|
362
|
-
surface: 'cli_chat',
|
|
363
|
-
// Lazily fill a four-ad pool, then repeat it for later transcript slots.
|
|
364
|
-
inlinePlacementId: 'CLI-Chat-Inline',
|
|
365
|
-
// Keep the rotating above-input slot separate for reporting continuity.
|
|
366
|
-
slotPlacementId: 'Single-Ad-Unit-1',
|
|
367
|
-
})
|
|
368
|
-
const showInlineAds = IS_SAVANT_FREE || getAdsEnabled()
|
|
369
|
-
|
|
370
|
-
// Stable identities so the message-block callbacks (set once) always call
|
|
371
|
-
// the latest recorder from the hook.
|
|
372
|
-
const handleAdClick = useEvent(recordClick)
|
|
373
|
-
const handleAdImpression = useEvent(recordImpression)
|
|
374
|
-
const handleResponseAdsNeeded = useEvent(requestResponseAds)
|
|
375
|
-
|
|
376
|
-
// While the model or provider picker overlay is open, blur the text input
|
|
377
|
-
// so keystrokes route to the picker, not the input.
|
|
378
|
-
useEffect(() => {
|
|
379
|
-
if (modelPickerOpen || providerPickerOpen) {
|
|
380
|
-
setInputFocused(false)
|
|
381
|
-
}
|
|
382
|
-
}, [modelPickerOpen, providerPickerOpen, setInputFocused])
|
|
383
|
-
|
|
384
|
-
// FID-2026-0723-062: keep the sidebar context-token cap in sync with the
|
|
385
|
-
// active model. This fires on initial render (restored preference), when the
|
|
386
|
-
// model changes, and when the gateway catalog finishes loading asynchronously.
|
|
387
|
-
const gatewayCatalogLoadedAt = useGatewayCatalogStore((s) => s.lastLoadedAt)
|
|
388
|
-
useEffect(() => {
|
|
389
|
-
if (sidebarModel) {
|
|
390
|
-
const maxTokens = resolveContextWindowForModel(sidebarModel)
|
|
391
|
-
updateContextTokensMax(maxTokens)
|
|
392
|
-
}
|
|
393
|
-
}, [sidebarModel, updateContextTokensMax, gatewayCatalogLoadedAt])
|
|
394
|
-
|
|
395
|
-
// Commit a /rewind picker selection (FID-2026-0803-004): execute the chosen
|
|
396
|
-
// restore mode against the selected turn's checkpoint and report in-chat.
|
|
397
|
-
const handleRewindPickerConfirm = useCallback(
|
|
398
|
-
(turn: TurnSummary, mode: RewindMode) => {
|
|
399
|
-
closeRewindPicker()
|
|
400
|
-
const projectRoot = tryGetProjectRoot() ?? getProjectRoot()
|
|
401
|
-
const checkpointDir = getCheckpointDir()
|
|
402
|
-
const message = executeRewind({
|
|
403
|
-
checkpointDir,
|
|
404
|
-
projectRoot,
|
|
405
|
-
turnId: turn.turnId,
|
|
406
|
-
mode,
|
|
407
|
-
setMessages,
|
|
408
|
-
})
|
|
409
|
-
setMessages((prev) => [...prev, getSystemMessage(message)])
|
|
410
|
-
setInputFocused(true)
|
|
411
|
-
inputRef.current?.focus()
|
|
412
|
-
},
|
|
413
|
-
[closeRewindPicker, setMessages, setInputFocused, inputRef],
|
|
414
|
-
)
|
|
415
|
-
|
|
416
|
-
// Commit a provider pick: enter providerSetup mode for the chosen provider.
|
|
417
|
-
const handleProviderPickerSelect = useCallback(
|
|
418
|
-
(provider: ProviderSetupName) => {
|
|
419
|
-
closeProviderPicker()
|
|
420
|
-
beginProviderSetup(provider)
|
|
421
|
-
const info = getProviderSetupInfo(provider)
|
|
422
|
-
if (info) {
|
|
423
|
-
useChatStore.getState().setInputMode('providerSetup')
|
|
424
|
-
setInputFocused(true)
|
|
425
|
-
inputRef.current?.focus()
|
|
426
|
-
setMessages((prev) => [
|
|
427
|
-
...prev,
|
|
428
|
-
getSystemMessage(
|
|
429
|
-
`${info.label} selected. Enter your API key below. It will be masked and stored locally in credentials.json. Environment variables take precedence.`,
|
|
430
|
-
),
|
|
431
|
-
])
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
[closeProviderPicker, setInputFocused, inputRef, setMessages],
|
|
435
|
-
)
|
|
436
|
-
|
|
437
|
-
// Commit a model pick: persist the override, confirm in-chat, and close.
|
|
438
|
-
const handleModelPickerSelect = useCallback(
|
|
439
|
-
(model: OpenRouterModel) => {
|
|
440
|
-
saveSavantCodeModelPreference(model.id)
|
|
441
|
-
saveSavantCodeModelProviderPreference(model.provider ?? 'openrouter')
|
|
442
|
-
useSavantFreeModelStore.getState().switchModel(model.id)
|
|
443
|
-
const current = loadSavantCodeModelPreference()
|
|
444
|
-
setMessages((prev) => [
|
|
445
|
-
...prev,
|
|
446
|
-
getSystemMessage(
|
|
447
|
-
current
|
|
448
|
-
? `Model switched to: ${current}`
|
|
449
|
-
: `Model switched to: ${model.id}`,
|
|
450
|
-
),
|
|
451
|
-
])
|
|
452
|
-
closeModelPicker()
|
|
453
|
-
setInputFocused(true)
|
|
454
|
-
inputRef.current?.focus()
|
|
455
|
-
},
|
|
456
|
-
[
|
|
457
|
-
saveSavantCodeModelPreference,
|
|
458
|
-
saveSavantCodeModelProviderPreference,
|
|
459
|
-
loadSavantCodeModelPreference,
|
|
460
|
-
setMessages,
|
|
461
|
-
closeModelPicker,
|
|
462
|
-
setInputFocused,
|
|
463
|
-
inputRef,
|
|
464
|
-
],
|
|
465
|
-
)
|
|
466
|
-
|
|
467
|
-
// Set initial mode from CLI flag on mount
|
|
468
|
-
useEffect(() => {
|
|
469
|
-
if (initialMode) {
|
|
470
|
-
setAgentMode(initialMode)
|
|
471
|
-
}
|
|
472
|
-
}, [initialMode, setAgentMode])
|
|
473
|
-
|
|
474
|
-
// Set initial permission mode from CLI flag on mount (CLI takes precedence
|
|
475
|
-
// over saved setting because it is an explicit per-launch override).
|
|
476
|
-
useEffect(() => {
|
|
477
|
-
if (initialPermissionMode) {
|
|
478
|
-
useChatStore.getState().setPermissionMode(initialPermissionMode)
|
|
479
|
-
}
|
|
480
|
-
}, [initialPermissionMode])
|
|
481
|
-
|
|
482
|
-
// Use extracted chat messages hook for message tree and pagination
|
|
483
|
-
const {
|
|
484
|
-
messageTree,
|
|
485
|
-
visibleTopLevelMessages,
|
|
486
|
-
hiddenMessageCount,
|
|
487
|
-
handleCollapseToggle,
|
|
488
|
-
isUserCollapsing,
|
|
489
|
-
handleLoadPreviousMessages,
|
|
490
|
-
handleToggleAll,
|
|
491
|
-
} = useChatMessages({ messages, setMessages })
|
|
492
|
-
|
|
493
|
-
// Use extracted UI hook for scroll, terminal dimensions, and theme
|
|
494
|
-
const {
|
|
495
|
-
scrollRef,
|
|
496
|
-
scrollToLatest,
|
|
497
|
-
scrollUp,
|
|
498
|
-
scrollDown,
|
|
499
|
-
appliedScrollboxProps,
|
|
500
|
-
isAtBottom,
|
|
501
|
-
hasOverflow,
|
|
502
|
-
terminalWidth,
|
|
503
|
-
terminalHeight,
|
|
504
|
-
separatorWidth,
|
|
505
|
-
messageAvailableWidth,
|
|
506
|
-
isCompactHeight,
|
|
507
|
-
isNarrowWidth,
|
|
508
|
-
theme,
|
|
509
|
-
markdownPalette,
|
|
510
|
-
} = useChatUI({ messages, isUserCollapsing })
|
|
511
|
-
|
|
512
|
-
const updateHeaderVisibility = useCallback(() => {
|
|
513
|
-
const header = headerRef.current
|
|
514
|
-
const viewport = scrollRef.current?.viewport
|
|
515
|
-
if (!header || !viewport) return
|
|
516
|
-
|
|
517
|
-
const headerTop = header.screenY
|
|
518
|
-
const headerBottom = headerTop + header.height
|
|
519
|
-
const viewportTop = viewport.screenY
|
|
520
|
-
const viewportBottom = viewportTop + viewport.height
|
|
521
|
-
const visible = headerTop < viewportBottom && headerBottom > viewportTop
|
|
522
|
-
setIsHeaderVisible((current) => (current === visible ? current : visible))
|
|
523
|
-
}, [scrollRef])
|
|
524
|
-
|
|
525
|
-
useEffect(() => {
|
|
526
|
-
const scrollbox = scrollRef.current
|
|
527
|
-
if (!scrollbox) return
|
|
528
|
-
|
|
529
|
-
const timeoutId = setTimeout(updateHeaderVisibility, 0)
|
|
530
|
-
scrollbox.verticalScrollBar.on('change', updateHeaderVisibility)
|
|
531
|
-
return () => {
|
|
532
|
-
clearTimeout(timeoutId)
|
|
533
|
-
scrollbox.verticalScrollBar.off('change', updateHeaderVisibility)
|
|
534
|
-
}
|
|
535
|
-
}, [scrollRef, updateHeaderVisibility])
|
|
536
|
-
|
|
537
|
-
useEffect(() => {
|
|
538
|
-
const timeoutId = setTimeout(updateHeaderVisibility, 0)
|
|
539
|
-
return () => clearTimeout(timeoutId)
|
|
540
|
-
}, [messages, terminalHeight, terminalWidth, updateHeaderVisibility])
|
|
541
|
-
|
|
542
|
-
const localAgents = useMemo(() => loadLocalAgents(agentMode), [agentMode])
|
|
543
|
-
const inputMode = useChatStore((state) => state.inputMode)
|
|
544
|
-
const setInputMode = useChatStore((state) => state.setInputMode)
|
|
545
|
-
const askUserState = useChatStore((state) => state.askUserState)
|
|
546
|
-
const adsEnabled = useChatStore((state) => state.adsEnabled)
|
|
547
|
-
|
|
548
|
-
// Get loaded skills for slash commands
|
|
549
|
-
const loadedSkills = useMemo(() => getLoadedSkills(), [])
|
|
550
|
-
|
|
551
|
-
// Filter slash commands based on current ads state - only show the option that changes state
|
|
552
|
-
// Hide both ads commands entirely for subscribers
|
|
553
|
-
// Also merge in skill commands
|
|
554
|
-
const filteredSlashCommands = useMemo(() => {
|
|
555
|
-
const allCommands = getSlashCommandsWithSkills(loadedSkills)
|
|
556
|
-
return allCommands.filter((cmd) => {
|
|
557
|
-
if (cmd.id === 'ads:enable') return !hasSubscription && !adsEnabled
|
|
558
|
-
if (cmd.id === 'ads:disable') return !hasSubscription && adsEnabled
|
|
559
|
-
return true
|
|
560
|
-
})
|
|
561
|
-
// FID-007 P1: deps are the reactive ads store slice (updated by the ads
|
|
562
|
-
// commands) — NOT inputValue, whose only effect was to rebuild the command
|
|
563
|
-
// list and clear the suggestion-engine cache on every keystroke.
|
|
564
|
-
}, [loadedSkills, hasSubscription, adsEnabled])
|
|
565
|
-
|
|
566
|
-
const {
|
|
567
|
-
slashContext,
|
|
568
|
-
mentionContext,
|
|
569
|
-
slashMatches,
|
|
570
|
-
agentMatches,
|
|
571
|
-
fileMatches,
|
|
572
|
-
slashSuggestionItems,
|
|
573
|
-
agentSuggestionItems,
|
|
574
|
-
fileSuggestionItems,
|
|
575
|
-
} = useSuggestionEngine({
|
|
576
|
-
disableAgentSuggestions: forceFileOnlyMentions || inputMode !== 'default',
|
|
577
|
-
inputValue: inputMode === 'bash' ? '' : inputValue,
|
|
578
|
-
cursorPosition,
|
|
579
|
-
slashCommands: filteredSlashCommands,
|
|
580
|
-
localAgents,
|
|
581
|
-
fileTree,
|
|
582
|
-
currentAgentMode: agentMode,
|
|
583
|
-
})
|
|
584
|
-
|
|
585
|
-
useEffect(() => {
|
|
586
|
-
if (!mentionContext.active) {
|
|
587
|
-
setForceFileOnlyMentions(false)
|
|
588
|
-
}
|
|
589
|
-
}, [mentionContext.active])
|
|
590
|
-
|
|
591
|
-
// Track when slash menu is activated
|
|
592
|
-
const prevSlashActiveRef = useRef(false)
|
|
593
|
-
useEffect(() => {
|
|
594
|
-
if (slashContext.active && !prevSlashActiveRef.current) {
|
|
595
|
-
trackEvent(AnalyticsEvent.SLASH_MENU_ACTIVATED, {
|
|
596
|
-
queryLength: slashContext.query.length,
|
|
597
|
-
matchCount: slashMatches.length,
|
|
598
|
-
inputLength: inputValue.length,
|
|
599
|
-
})
|
|
600
|
-
}
|
|
601
|
-
prevSlashActiveRef.current = slashContext.active
|
|
602
|
-
}, [
|
|
603
|
-
slashContext.active,
|
|
604
|
-
slashContext.query,
|
|
605
|
-
slashMatches.length,
|
|
606
|
-
inputValue.length,
|
|
607
|
-
])
|
|
608
|
-
|
|
609
|
-
// Reset suggestion menu indexes when context changes
|
|
610
|
-
useEffect(() => {
|
|
611
|
-
if (!slashContext.active) {
|
|
612
|
-
setSlashSelectedIndex(0)
|
|
613
|
-
return
|
|
614
|
-
}
|
|
615
|
-
setSlashSelectedIndex(0)
|
|
616
|
-
}, [slashContext.active, slashContext.query, setSlashSelectedIndex])
|
|
617
|
-
|
|
618
|
-
useEffect(() => {
|
|
619
|
-
if (slashMatches.length > 0 && slashSelectedIndex >= slashMatches.length) {
|
|
620
|
-
setSlashSelectedIndex(slashMatches.length - 1)
|
|
621
|
-
}
|
|
622
|
-
if (slashMatches.length === 0 && slashSelectedIndex !== 0) {
|
|
623
|
-
setSlashSelectedIndex(0)
|
|
624
|
-
}
|
|
625
|
-
}, [slashMatches.length, slashSelectedIndex, setSlashSelectedIndex])
|
|
626
|
-
|
|
627
|
-
useEffect(() => {
|
|
628
|
-
if (!mentionContext.active) {
|
|
629
|
-
setAgentSelectedIndex(0)
|
|
630
|
-
return
|
|
631
|
-
}
|
|
632
|
-
setAgentSelectedIndex(0)
|
|
633
|
-
}, [mentionContext.active, mentionContext.query, setAgentSelectedIndex])
|
|
634
|
-
|
|
635
|
-
useEffect(() => {
|
|
636
|
-
const totalMatches = agentMatches.length + fileMatches.length
|
|
637
|
-
if (totalMatches > 0 && agentSelectedIndex >= totalMatches) {
|
|
638
|
-
setAgentSelectedIndex(totalMatches - 1)
|
|
639
|
-
}
|
|
640
|
-
if (totalMatches === 0 && agentSelectedIndex !== 0) {
|
|
641
|
-
setAgentSelectedIndex(0)
|
|
642
|
-
}
|
|
643
|
-
}, [
|
|
644
|
-
agentMatches.length,
|
|
645
|
-
fileMatches.length,
|
|
646
|
-
agentSelectedIndex,
|
|
647
|
-
setAgentSelectedIndex,
|
|
648
|
-
])
|
|
649
|
-
|
|
650
|
-
const openFileMenuWithTab = useCallback((): boolean => {
|
|
651
|
-
const safeCursor = Math.max(0, Math.min(cursorPosition, inputValue.length))
|
|
652
|
-
|
|
653
|
-
let wordStart = safeCursor
|
|
654
|
-
while (wordStart > 0 && !/\s/.test(inputValue[wordStart - 1]!)) {
|
|
655
|
-
wordStart--
|
|
656
|
-
}
|
|
657
|
-
// FID-007 D4: report whether a word precedes the cursor so the keyboard
|
|
658
|
-
// handler can fall through when there is nothing to complete (previously
|
|
659
|
-
// this scan was duplicated inline in onOpenFileMenuWithTab).
|
|
660
|
-
if (wordStart >= safeCursor) return false
|
|
661
|
-
|
|
662
|
-
const before = inputValue.slice(0, wordStart)
|
|
663
|
-
const wordAtCursor = inputValue.slice(wordStart, safeCursor)
|
|
664
|
-
const after = inputValue.slice(safeCursor)
|
|
665
|
-
const mentionWord = wordAtCursor.startsWith('@')
|
|
666
|
-
? wordAtCursor
|
|
667
|
-
: `@${wordAtCursor}`
|
|
668
|
-
|
|
669
|
-
const text = `${before}${mentionWord}${after}`
|
|
670
|
-
const nextCursor = before.length + mentionWord.length
|
|
671
|
-
|
|
672
|
-
setInputValue({
|
|
673
|
-
text,
|
|
674
|
-
cursorPosition: nextCursor,
|
|
675
|
-
lastEditDueToNav: false,
|
|
676
|
-
})
|
|
677
|
-
setForceFileOnlyMentions(true)
|
|
678
|
-
return true
|
|
679
|
-
}, [cursorPosition, inputValue, setInputValue])
|
|
680
|
-
|
|
681
|
-
const { saveToHistory, navigateUp, navigateDown, resetHistoryNavigation } =
|
|
682
|
-
useInputHistory(inputValue, setInputValue, { inputMode, setInputMode })
|
|
683
|
-
|
|
684
|
-
// Use extracted streaming hook for connection, timer, queue, and exit handling
|
|
685
|
-
const {
|
|
686
|
-
isConnected,
|
|
687
|
-
showReconnectionMessage,
|
|
688
|
-
mainAgentTimer,
|
|
689
|
-
timerStartTime,
|
|
690
|
-
streamStatus,
|
|
691
|
-
isWaitingForResponse,
|
|
692
|
-
isStreaming,
|
|
693
|
-
setStreamStatus,
|
|
694
|
-
queuedMessages,
|
|
695
|
-
queuePaused,
|
|
696
|
-
streamMessageIdRef,
|
|
697
|
-
addToQueue,
|
|
698
|
-
addToQueueFront,
|
|
699
|
-
stopStreaming,
|
|
700
|
-
setCanProcessQueue,
|
|
701
|
-
pauseQueue,
|
|
702
|
-
resumeQueue,
|
|
703
|
-
clearQueue,
|
|
704
|
-
isQueuePausedRef,
|
|
705
|
-
isProcessingQueueRef,
|
|
706
|
-
queuedCount,
|
|
707
|
-
shouldShowQueuePreview,
|
|
708
|
-
queuePreviewTitle,
|
|
709
|
-
pausedQueueText,
|
|
710
|
-
inputPlaceholder,
|
|
711
|
-
handleCtrlC,
|
|
712
|
-
ensureQueueActiveBeforeSubmit,
|
|
713
|
-
nextCtrlCWillExit,
|
|
714
|
-
} = useChatStreaming({
|
|
715
|
-
agentMode,
|
|
716
|
-
inputValue,
|
|
717
|
-
setInputValue,
|
|
718
|
-
terminalWidth,
|
|
719
|
-
separatorWidth,
|
|
720
|
-
isChainInProgressRef,
|
|
721
|
-
activeAgentStreamsRef,
|
|
722
|
-
sendMessageRef,
|
|
723
|
-
})
|
|
724
|
-
|
|
725
|
-
// When streaming completes, flush any pending bash commands into history (ghost mode only)
|
|
726
|
-
// Non-ghost mode commands are already in history and will be cleared when user sends next message
|
|
727
|
-
useEffect(() => {
|
|
728
|
-
if (
|
|
729
|
-
!isStreaming &&
|
|
730
|
-
!streamMessageIdRef.current &&
|
|
731
|
-
!isChainInProgressRef.current &&
|
|
732
|
-
pendingBashMessages.length > 0
|
|
733
|
-
) {
|
|
734
|
-
// Only flush ghost mode commands (those not already added to history) to UI
|
|
735
|
-
const ghostModeMessages = pendingBashMessages.filter(
|
|
736
|
-
(msg) => !msg.isRunning && !msg.addedToHistory,
|
|
737
|
-
)
|
|
738
|
-
|
|
739
|
-
// Add ghost mode messages to UI history
|
|
740
|
-
for (const msg of ghostModeMessages) {
|
|
741
|
-
addBashMessageToHistory({
|
|
742
|
-
command: msg.command,
|
|
743
|
-
stdout: msg.stdout,
|
|
744
|
-
stderr: msg.stderr ?? null,
|
|
745
|
-
exitCode: msg.exitCode,
|
|
746
|
-
cwd: msg.cwd || process.cwd(),
|
|
747
|
-
setMessages,
|
|
748
|
-
})
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
// Mark ghost mode messages as added to history (so they don't show as ghost UI)
|
|
752
|
-
// but keep them in pendingBashMessages so they get sent to LLM with next user message
|
|
753
|
-
if (ghostModeMessages.length > 0) {
|
|
754
|
-
const ghostIds = new Set(ghostModeMessages.map((m) => m.id))
|
|
755
|
-
useChatStore.setState((state) => ({
|
|
756
|
-
pendingBashMessages: state.pendingBashMessages.map((m) =>
|
|
757
|
-
ghostIds.has(m.id) ? { ...m, addedToHistory: true } : m,
|
|
758
|
-
),
|
|
759
|
-
}))
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}, [isStreaming, pendingBashMessages, setMessages])
|
|
763
|
-
|
|
764
|
-
const { sendMessage, clearMessages } = useSendMessage({
|
|
765
|
-
inputRef,
|
|
766
|
-
activeSubagentsRef,
|
|
767
|
-
isChainInProgressRef,
|
|
768
|
-
setStreamStatus,
|
|
769
|
-
setCanProcessQueue,
|
|
770
|
-
abortControllerRef,
|
|
771
|
-
agentId,
|
|
772
|
-
onBeforeMessageSend: validateAgents,
|
|
773
|
-
mainAgentTimer,
|
|
774
|
-
scrollToLatest,
|
|
775
|
-
onTimerEvent: () => {},
|
|
776
|
-
isQueuePausedRef,
|
|
777
|
-
isProcessingQueueRef,
|
|
778
|
-
resumeQueue,
|
|
779
|
-
requeueMessageAtFront: addToQueueFront,
|
|
780
|
-
continueChat,
|
|
781
|
-
continueChatId,
|
|
782
|
-
subscriptionData,
|
|
783
|
-
})
|
|
784
|
-
|
|
785
|
-
sendMessageRef.current = sendMessage
|
|
786
|
-
|
|
787
|
-
// FID-2026-0726-001: mount the loop scheduler so /loop cadence actually
|
|
788
|
-
// recurs. The callback re-submits the loop prompt using the current agentMode.
|
|
789
|
-
useLoopScheduler(
|
|
790
|
-
useCallback(createLoopRunHandler(sendMessage, agentMode), [
|
|
791
|
-
sendMessage,
|
|
792
|
-
agentMode,
|
|
793
|
-
]),
|
|
794
|
-
)
|
|
795
|
-
|
|
796
|
-
const onSubmitPrompt = useEvent(
|
|
797
|
-
async (
|
|
798
|
-
content: string,
|
|
799
|
-
mode: AgentMode,
|
|
800
|
-
options?: { preserveInputValue?: boolean },
|
|
801
|
-
) => {
|
|
802
|
-
ensureQueueActiveBeforeSubmit()
|
|
803
|
-
|
|
804
|
-
const preserveInput = options?.preserveInputValue === true
|
|
805
|
-
const previousInputValue = preserveInput
|
|
806
|
-
? (() => {
|
|
807
|
-
const {
|
|
808
|
-
inputValue: text,
|
|
809
|
-
cursorPosition,
|
|
810
|
-
lastEditDueToNav,
|
|
811
|
-
} = useChatStore.getState()
|
|
812
|
-
return { text, cursorPosition, lastEditDueToNav }
|
|
813
|
-
})()
|
|
814
|
-
: null
|
|
815
|
-
|
|
816
|
-
// Preserve attachments if needed (inline logic to avoid abstraction overhead)
|
|
817
|
-
const preservedAttachments = preserveInput
|
|
818
|
-
? (() => {
|
|
819
|
-
const items = useChatStore.getState().pendingAttachments
|
|
820
|
-
if (items.length > 0) {
|
|
821
|
-
useChatStore.getState().clearPendingAttachments()
|
|
822
|
-
return [...items]
|
|
823
|
-
}
|
|
824
|
-
return null
|
|
825
|
-
})()
|
|
826
|
-
: null
|
|
827
|
-
|
|
828
|
-
try {
|
|
829
|
-
const result = await routeUserPrompt({
|
|
830
|
-
abortControllerRef,
|
|
831
|
-
agentMode: mode,
|
|
832
|
-
inputRef,
|
|
833
|
-
inputValue: content,
|
|
834
|
-
isChainInProgressRef,
|
|
835
|
-
isStreaming,
|
|
836
|
-
logoutMutation,
|
|
837
|
-
streamMessageIdRef,
|
|
838
|
-
addToQueue,
|
|
839
|
-
clearMessages,
|
|
840
|
-
saveToHistory,
|
|
841
|
-
scrollToLatest,
|
|
842
|
-
sendMessage,
|
|
843
|
-
setCanProcessQueue,
|
|
844
|
-
setInputFocused,
|
|
845
|
-
setInputValue,
|
|
846
|
-
setIsAuthenticated,
|
|
847
|
-
setMessages,
|
|
848
|
-
setUser,
|
|
849
|
-
stopStreaming,
|
|
850
|
-
})
|
|
851
|
-
|
|
852
|
-
return result
|
|
853
|
-
} finally {
|
|
854
|
-
if (previousInputValue) {
|
|
855
|
-
setInputValue({
|
|
856
|
-
text: previousInputValue.text,
|
|
857
|
-
cursorPosition: previousInputValue.cursorPosition,
|
|
858
|
-
lastEditDueToNav: previousInputValue.lastEditDueToNav,
|
|
859
|
-
})
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
// Restore attachments if they were preserved and none have been added since
|
|
863
|
-
if (
|
|
864
|
-
preservedAttachments &&
|
|
865
|
-
useChatStore.getState().pendingAttachments.length === 0
|
|
866
|
-
) {
|
|
867
|
-
useChatStore.setState((state) => {
|
|
868
|
-
state.pendingAttachments = preservedAttachments
|
|
869
|
-
})
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
},
|
|
873
|
-
)
|
|
874
|
-
|
|
875
|
-
// Retire onboarding suggested prompts only after the user submits a prompt.
|
|
876
|
-
// Provider guidance is a system message and must not count as submission.
|
|
877
|
-
// FID-007 D6: memoize the O(n) scan — it was re-run over the whole
|
|
878
|
-
// transcript on every render.
|
|
879
|
-
const hasSubmittedPrompt = useMemo(
|
|
880
|
-
() => messages.some((message) => message.variant === 'user'),
|
|
881
|
-
[messages],
|
|
882
|
-
)
|
|
883
|
-
useEffect(() => {
|
|
884
|
-
if (showSuggestedPrompts && hasSubmittedPrompt) {
|
|
885
|
-
markFirstPromptSubmitted()
|
|
886
|
-
setShowSuggestedPrompts(false)
|
|
887
|
-
}
|
|
888
|
-
}, [showSuggestedPrompts, hasSubmittedPrompt])
|
|
889
|
-
|
|
890
|
-
// Submit a suggested onboarding prompt as if the user had typed and sent it
|
|
891
|
-
const handleSelectSuggestedPrompt = useEvent(
|
|
892
|
-
(prompt: string, selection: SuggestedPromptSelection) => {
|
|
893
|
-
trackEvent(AnalyticsEvent.SUGGESTED_PROMPT_CLICKED, {
|
|
894
|
-
label: selection.label,
|
|
895
|
-
index: selection.index,
|
|
896
|
-
promptLength: prompt.length,
|
|
897
|
-
agentMode,
|
|
898
|
-
})
|
|
899
|
-
onSubmitPrompt(prompt, agentMode).catch((error) => {
|
|
900
|
-
logger.error({ error }, '[suggested-prompt] Failed to submit prompt')
|
|
901
|
-
showClipboardMessage('Failed to send prompt', { durationMs: 3000 })
|
|
902
|
-
})
|
|
903
|
-
},
|
|
904
|
-
)
|
|
905
|
-
|
|
906
|
-
// Handle followup suggestion clicks
|
|
907
|
-
useEffect(() => {
|
|
908
|
-
const handleFollowupClick = (event: Event) => {
|
|
909
|
-
const customEvent = event as CustomEvent<{
|
|
910
|
-
prompt: string
|
|
911
|
-
index: number
|
|
912
|
-
toolCallId: string
|
|
913
|
-
}>
|
|
914
|
-
const { prompt, index, toolCallId } = customEvent.detail
|
|
915
|
-
|
|
916
|
-
logger.info(
|
|
917
|
-
{ promptLength: prompt.length, index, toolCallId, agentMode },
|
|
918
|
-
'[followup-click] Followup clicked',
|
|
919
|
-
)
|
|
920
|
-
|
|
921
|
-
// Track analytics event
|
|
922
|
-
trackEvent(AnalyticsEvent.FOLLOWUP_CLICKED, {
|
|
923
|
-
promptLength: prompt.length,
|
|
924
|
-
index,
|
|
925
|
-
agentMode,
|
|
926
|
-
})
|
|
927
|
-
|
|
928
|
-
// Mark this followup as clicked (persisted per toolCallId)
|
|
929
|
-
useChatStore.getState().markFollowupClicked(toolCallId, index)
|
|
930
|
-
|
|
931
|
-
// Send the followup prompt directly, preserving the user's current input
|
|
932
|
-
onSubmitPrompt(prompt, agentMode, {
|
|
933
|
-
preserveInputValue: true,
|
|
934
|
-
})
|
|
935
|
-
.then((result) => {
|
|
936
|
-
logger.info(
|
|
937
|
-
{ hasResult: !!result },
|
|
938
|
-
'[followup-click] onSubmitPrompt completed',
|
|
939
|
-
)
|
|
940
|
-
})
|
|
941
|
-
.catch((error) => {
|
|
942
|
-
logger.error(
|
|
943
|
-
{ error },
|
|
944
|
-
'[followup-click] onSubmitPrompt failed with error',
|
|
945
|
-
)
|
|
946
|
-
showClipboardMessage('Failed to send followup', { durationMs: 3000 })
|
|
947
|
-
})
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
globalThis.addEventListener(
|
|
951
|
-
'savant-code:send-followup',
|
|
952
|
-
handleFollowupClick,
|
|
953
|
-
)
|
|
954
|
-
return () => {
|
|
955
|
-
globalThis.removeEventListener(
|
|
956
|
-
'savant-code:send-followup',
|
|
957
|
-
handleFollowupClick,
|
|
958
|
-
)
|
|
959
|
-
}
|
|
960
|
-
}, [onSubmitPrompt, agentMode])
|
|
961
|
-
|
|
962
|
-
// handleSlashItemClick is defined later after feedback/publish stores are available
|
|
963
|
-
|
|
964
|
-
// FID-007 D3: single mention select-and-replace helper shared by the click
|
|
965
|
-
// handler and the two keyboard menu handlers (previously 3 copies).
|
|
966
|
-
const selectMentionAt = useCallback(
|
|
967
|
-
(index: number): boolean => {
|
|
968
|
-
if (mentionContext.startIndex < 0) return false
|
|
969
|
-
|
|
970
|
-
let replacement: string
|
|
971
|
-
if (index < agentMatches.length) {
|
|
972
|
-
const selected = agentMatches[index]
|
|
973
|
-
if (!selected) return false
|
|
974
|
-
replacement = `@${selected.id} `
|
|
975
|
-
} else {
|
|
976
|
-
const fileIndex = index - agentMatches.length
|
|
977
|
-
const selectedFile = fileMatches[fileIndex]
|
|
978
|
-
if (!selectedFile) return false
|
|
979
|
-
replacement = `@${selectedFile.filePath} `
|
|
980
|
-
}
|
|
981
|
-
const before = inputValue.slice(0, mentionContext.startIndex)
|
|
982
|
-
const after = inputValue.slice(
|
|
983
|
-
mentionContext.startIndex + 1 + mentionContext.query.length,
|
|
984
|
-
)
|
|
985
|
-
setInputValue({
|
|
986
|
-
text: before + replacement + after,
|
|
987
|
-
cursorPosition: before.length + replacement.length,
|
|
988
|
-
lastEditDueToNav: false,
|
|
989
|
-
})
|
|
990
|
-
setAgentSelectedIndex(0)
|
|
991
|
-
return true
|
|
992
|
-
},
|
|
993
|
-
[
|
|
994
|
-
mentionContext,
|
|
995
|
-
agentMatches,
|
|
996
|
-
fileMatches,
|
|
997
|
-
inputValue,
|
|
998
|
-
setInputValue,
|
|
999
|
-
setAgentSelectedIndex,
|
|
1000
|
-
],
|
|
1001
|
-
)
|
|
1002
|
-
|
|
1003
|
-
const handleMentionItemClick = useCallback(
|
|
1004
|
-
(index: number) => {
|
|
1005
|
-
selectMentionAt(index)
|
|
1006
|
-
},
|
|
1007
|
-
[selectMentionAt],
|
|
1008
|
-
)
|
|
1009
|
-
|
|
1010
|
-
const { inputWidth, handleBuildFast, handleBuildMax, handleBuildLite } =
|
|
1011
|
-
useChatInput({
|
|
1012
|
-
setInputValue,
|
|
1013
|
-
agentMode,
|
|
1014
|
-
setAgentMode,
|
|
1015
|
-
separatorWidth,
|
|
1016
|
-
initialPrompt,
|
|
1017
|
-
onSubmitPrompt,
|
|
1018
|
-
isCompactHeight,
|
|
1019
|
-
isNarrowWidth,
|
|
1020
|
-
})
|
|
1021
|
-
|
|
1022
|
-
const {
|
|
1023
|
-
feedbackMode,
|
|
1024
|
-
feedbackText,
|
|
1025
|
-
openFeedbackForMessage,
|
|
1026
|
-
closeFeedback,
|
|
1027
|
-
saveCurrentInput,
|
|
1028
|
-
restoreSavedInput,
|
|
1029
|
-
setFeedbackText,
|
|
1030
|
-
} = useFeedbackStore(
|
|
1031
|
-
useShallow((state) => ({
|
|
1032
|
-
feedbackMode: state.feedbackMode,
|
|
1033
|
-
feedbackText: state.feedbackText,
|
|
1034
|
-
openFeedbackForMessage: state.openFeedbackForMessage,
|
|
1035
|
-
closeFeedback: state.closeFeedback,
|
|
1036
|
-
saveCurrentInput: state.saveCurrentInput,
|
|
1037
|
-
restoreSavedInput: state.restoreSavedInput,
|
|
1038
|
-
setFeedbackText: state.setFeedbackText,
|
|
1039
|
-
})),
|
|
1040
|
-
)
|
|
1041
|
-
|
|
1042
|
-
const { publishMode, openPublishMode, closePublish, preSelectAgents } =
|
|
1043
|
-
usePublishStore(
|
|
1044
|
-
useShallow((state) => ({
|
|
1045
|
-
publishMode: state.publishMode,
|
|
1046
|
-
openPublishMode: state.openPublishMode,
|
|
1047
|
-
closePublish: state.closePublish,
|
|
1048
|
-
preSelectAgents: state.preSelectAgents,
|
|
1049
|
-
})),
|
|
1050
|
-
)
|
|
1051
|
-
|
|
1052
|
-
const { reviewMode, closeReviewScreen } = useReviewStore(
|
|
1053
|
-
useShallow((state) => ({
|
|
1054
|
-
reviewMode: state.reviewMode,
|
|
1055
|
-
closeReviewScreen: state.closeReviewScreen,
|
|
1056
|
-
})),
|
|
1057
|
-
)
|
|
1058
|
-
|
|
1059
|
-
const publishMutation = usePublishMutation()
|
|
1060
|
-
|
|
1061
|
-
const handleCommandResult = useCallback(
|
|
1062
|
-
(result?: CommandResult) => {
|
|
1063
|
-
if (!result) return
|
|
1064
|
-
|
|
1065
|
-
if (result.openFeedbackMode) {
|
|
1066
|
-
// Save the feedback text that was set by the command handler before opening feedback mode
|
|
1067
|
-
const { feedbackText, feedbackCursor } = useFeedbackStore.getState()
|
|
1068
|
-
saveCurrentInput('', 0)
|
|
1069
|
-
openFeedbackForMessage(null)
|
|
1070
|
-
// Restore the prefilled text after openFeedbackForMessage resets it
|
|
1071
|
-
if (feedbackText) {
|
|
1072
|
-
useFeedbackStore.getState().setFeedbackText(feedbackText)
|
|
1073
|
-
useFeedbackStore.getState().setFeedbackCursor(feedbackCursor)
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
if (result.openPublishMode) {
|
|
1078
|
-
if (result.preSelectAgents && result.preSelectAgents.length > 0) {
|
|
1079
|
-
// preSelectAgents already sets publishMode: true, so don't call openPublishMode
|
|
1080
|
-
// which would reset the selectedAgentIds
|
|
1081
|
-
preSelectAgents(result.preSelectAgents)
|
|
1082
|
-
} else {
|
|
1083
|
-
openPublishMode()
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
if (result.openChatHistory) {
|
|
1088
|
-
useChatHistoryStore.getState().openChatHistory()
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
if (result.openReviewScreen) {
|
|
1092
|
-
useReviewStore.getState().openReviewScreen()
|
|
1093
|
-
}
|
|
1094
|
-
},
|
|
1095
|
-
[
|
|
1096
|
-
saveCurrentInput,
|
|
1097
|
-
openFeedbackForMessage,
|
|
1098
|
-
openPublishMode,
|
|
1099
|
-
preSelectAgents,
|
|
1100
|
-
],
|
|
1101
|
-
)
|
|
1102
|
-
|
|
1103
|
-
// Helper to apply insertText for slash commands - returns true if handled
|
|
1104
|
-
const applySlashInsertText = useCallback(
|
|
1105
|
-
(selected: MatchedSlashCommand): boolean => {
|
|
1106
|
-
if (selected.insertText != null && slashContext.startIndex >= 0) {
|
|
1107
|
-
const before = inputValue.slice(0, slashContext.startIndex)
|
|
1108
|
-
const after = inputValue.slice(
|
|
1109
|
-
slashContext.startIndex + 1 + slashContext.query.length,
|
|
1110
|
-
)
|
|
1111
|
-
setInputValue({
|
|
1112
|
-
text: before + selected.insertText + after,
|
|
1113
|
-
cursorPosition: before.length + selected.insertText.length,
|
|
1114
|
-
lastEditDueToNav: false,
|
|
1115
|
-
})
|
|
1116
|
-
setSlashSelectedIndex(0)
|
|
1117
|
-
return true
|
|
1118
|
-
}
|
|
1119
|
-
return false
|
|
1120
|
-
},
|
|
1121
|
-
[slashContext, inputValue, setInputValue, setSlashSelectedIndex],
|
|
1122
|
-
)
|
|
1123
|
-
|
|
1124
|
-
// Click handler for slash menu items - executes command or inserts text
|
|
1125
|
-
// FID-007 D3/E1: single slash execute helper (insertText handling, selection
|
|
1126
|
-
// reset, and error surfacing) shared by the click handler and keyboard menu.
|
|
1127
|
-
const executeSlashCommand = useCallback(
|
|
1128
|
-
async (selected: MatchedSlashCommand | undefined): Promise<void> => {
|
|
1129
|
-
if (!selected) return
|
|
1130
|
-
|
|
1131
|
-
// If the command has insertText, insert it instead of executing
|
|
1132
|
-
if (applySlashInsertText(selected)) return
|
|
1133
|
-
|
|
1134
|
-
setSlashSelectedIndex(0)
|
|
1135
|
-
try {
|
|
1136
|
-
const result = await onSubmitPrompt(`/${selected.id}`, agentMode)
|
|
1137
|
-
handleCommandResult(result)
|
|
1138
|
-
} catch (error) {
|
|
1139
|
-
logger.error({ error }, '[slash] Failed to execute command')
|
|
1140
|
-
showClipboardMessage('Failed to execute command', { durationMs: 3000 })
|
|
1141
|
-
}
|
|
1142
|
-
},
|
|
1143
|
-
[
|
|
1144
|
-
applySlashInsertText,
|
|
1145
|
-
setSlashSelectedIndex,
|
|
1146
|
-
onSubmitPrompt,
|
|
1147
|
-
agentMode,
|
|
1148
|
-
handleCommandResult,
|
|
1149
|
-
],
|
|
1150
|
-
)
|
|
1151
|
-
|
|
1152
|
-
const handleSlashItemClick = useCallback(
|
|
1153
|
-
async (index: number) => {
|
|
1154
|
-
await executeSlashCommand(slashMatches[index])
|
|
1155
|
-
},
|
|
1156
|
-
[slashMatches, executeSlashCommand],
|
|
1157
|
-
)
|
|
1158
|
-
|
|
1159
|
-
const inputValueRef = useRef(inputValue)
|
|
1160
|
-
const cursorPositionRef = useRef(cursorPosition)
|
|
1161
|
-
useEffect(() => {
|
|
1162
|
-
inputValueRef.current = inputValue
|
|
1163
|
-
}, [inputValue])
|
|
1164
|
-
|
|
1165
|
-
// Report activity on input changes for ad rotation (debounced via separate effect)
|
|
1166
|
-
const lastReportedActivityRef = useRef<number>(0)
|
|
1167
|
-
useEffect(() => {
|
|
1168
|
-
const now = Date.now()
|
|
1169
|
-
// Throttle to max once per second to avoid excessive calls
|
|
1170
|
-
if (now - lastReportedActivityRef.current > 1000) {
|
|
1171
|
-
lastReportedActivityRef.current = now
|
|
1172
|
-
reportActivity()
|
|
1173
|
-
}
|
|
1174
|
-
}, [inputValue])
|
|
1175
|
-
useEffect(() => {
|
|
1176
|
-
cursorPositionRef.current = cursorPosition
|
|
1177
|
-
}, [cursorPosition])
|
|
1178
|
-
|
|
1179
|
-
const handleOpenFeedbackForMessage = useCallback(
|
|
1180
|
-
(
|
|
1181
|
-
id: string | null,
|
|
1182
|
-
options?: {
|
|
1183
|
-
category?: FeedbackCategory
|
|
1184
|
-
footerMessage?: string
|
|
1185
|
-
errors?: Array<{ id: string; message: string }>
|
|
1186
|
-
},
|
|
1187
|
-
) => {
|
|
1188
|
-
saveCurrentInput(inputValueRef.current, cursorPositionRef.current)
|
|
1189
|
-
openFeedbackForMessage(id, options)
|
|
1190
|
-
},
|
|
1191
|
-
[saveCurrentInput, openFeedbackForMessage],
|
|
1192
|
-
)
|
|
1193
|
-
|
|
1194
|
-
const handleMessageFeedback = useCallback(
|
|
1195
|
-
(
|
|
1196
|
-
id: string,
|
|
1197
|
-
options?: {
|
|
1198
|
-
category?: FeedbackCategory
|
|
1199
|
-
footerMessage?: string
|
|
1200
|
-
errors?: Array<{ id: string; message: string }>
|
|
1201
|
-
},
|
|
1202
|
-
) => {
|
|
1203
|
-
handleOpenFeedbackForMessage(id, options)
|
|
1204
|
-
},
|
|
1205
|
-
[handleOpenFeedbackForMessage],
|
|
1206
|
-
)
|
|
1207
|
-
|
|
1208
|
-
const handleExitFeedback = useCallback(() => {
|
|
1209
|
-
const { value, cursor } = restoreSavedInput()
|
|
1210
|
-
setInputValue({
|
|
1211
|
-
text: value,
|
|
1212
|
-
cursorPosition: cursor,
|
|
1213
|
-
lastEditDueToNav: false,
|
|
1214
|
-
})
|
|
1215
|
-
setInputFocused(true)
|
|
1216
|
-
resetHistoryNavigation()
|
|
1217
|
-
}, [
|
|
1218
|
-
restoreSavedInput,
|
|
1219
|
-
setInputValue,
|
|
1220
|
-
setInputFocused,
|
|
1221
|
-
resetHistoryNavigation,
|
|
1222
|
-
])
|
|
1223
|
-
|
|
1224
|
-
const handleCloseFeedback = useCallback(() => {
|
|
1225
|
-
closeFeedback()
|
|
1226
|
-
handleExitFeedback()
|
|
1227
|
-
}, [closeFeedback, handleExitFeedback])
|
|
1228
|
-
|
|
1229
|
-
const handleExitPublish = useCallback(() => {
|
|
1230
|
-
closePublish()
|
|
1231
|
-
setInputFocused(true)
|
|
1232
|
-
}, [closePublish, setInputFocused])
|
|
1233
|
-
|
|
1234
|
-
const handleReviewOptionSelect = useCallback(
|
|
1235
|
-
(reviewText: string) => {
|
|
1236
|
-
closeReviewScreen()
|
|
1237
|
-
setInputFocused(true)
|
|
1238
|
-
// Submit the review request
|
|
1239
|
-
onSubmitPrompt(reviewText, agentMode)
|
|
1240
|
-
.then((result) => handleCommandResult(result))
|
|
1241
|
-
.catch((error) => {
|
|
1242
|
-
logger.error({ error }, '[review] Failed to submit review prompt')
|
|
1243
|
-
showClipboardMessage('Failed to send review request', {
|
|
1244
|
-
durationMs: 3000,
|
|
1245
|
-
})
|
|
1246
|
-
})
|
|
1247
|
-
},
|
|
1248
|
-
[
|
|
1249
|
-
closeReviewScreen,
|
|
1250
|
-
setInputFocused,
|
|
1251
|
-
onSubmitPrompt,
|
|
1252
|
-
agentMode,
|
|
1253
|
-
handleCommandResult,
|
|
1254
|
-
],
|
|
1255
|
-
)
|
|
1256
|
-
|
|
1257
|
-
const handleCloseReviewScreen = useCallback(() => {
|
|
1258
|
-
closeReviewScreen()
|
|
1259
|
-
setInputFocused(true)
|
|
1260
|
-
}, [closeReviewScreen, setInputFocused])
|
|
1261
|
-
|
|
1262
|
-
const handleReviewCustom = useCallback(() => {
|
|
1263
|
-
closeReviewScreen()
|
|
1264
|
-
setInputMode('review')
|
|
1265
|
-
setInputFocused(true)
|
|
1266
|
-
}, [closeReviewScreen, setInputMode, setInputFocused])
|
|
1267
|
-
|
|
1268
|
-
const handlePublish = useCallback(
|
|
1269
|
-
async (agentIds: string[]) => {
|
|
1270
|
-
await publishMutation.mutateAsync(agentIds)
|
|
1271
|
-
},
|
|
1272
|
-
[publishMutation],
|
|
1273
|
-
)
|
|
1274
|
-
|
|
1275
|
-
// Ensure bracketed paste events target the active chat input
|
|
1276
|
-
useEffect(() => {
|
|
1277
|
-
if (feedbackMode) {
|
|
1278
|
-
inputRef.current?.focus()
|
|
1279
|
-
return
|
|
1280
|
-
}
|
|
1281
|
-
if (!askUserState) {
|
|
1282
|
-
inputRef.current?.focus()
|
|
1283
|
-
}
|
|
1284
|
-
}, [feedbackMode, askUserState, inputRef])
|
|
1285
|
-
|
|
1286
|
-
const handleSubmit = useCallback(async () => {
|
|
1287
|
-
// Report activity for ad rotation
|
|
1288
|
-
reportActivity()
|
|
1289
|
-
// Update terminal title with truncated user input
|
|
1290
|
-
if (inputValue.trim()) {
|
|
1291
|
-
setTerminalTitle(inputValue)
|
|
1292
|
-
}
|
|
1293
|
-
// FID-007 E1: surface submit failures instead of an unhandled rejection.
|
|
1294
|
-
try {
|
|
1295
|
-
const result = await onSubmitPrompt(inputValue, agentMode)
|
|
1296
|
-
handleCommandResult(result)
|
|
1297
|
-
} catch (error) {
|
|
1298
|
-
logger.error({ error }, '[submit] Failed to submit prompt')
|
|
1299
|
-
showClipboardMessage('Failed to send message', { durationMs: 3000 })
|
|
1300
|
-
}
|
|
1301
|
-
}, [onSubmitPrompt, inputValue, agentMode, handleCommandResult])
|
|
1302
|
-
|
|
1303
|
-
const totalMentionMatches = agentMatches.length + fileMatches.length
|
|
1304
|
-
const historyNavUpEnabled =
|
|
1305
|
-
lastEditDueToNav ||
|
|
1306
|
-
(cursorPosition === 0 &&
|
|
1307
|
-
((slashContext.active && slashSelectedIndex === 0) ||
|
|
1308
|
-
(mentionContext.active && agentSelectedIndex === 0) ||
|
|
1309
|
-
(!slashContext.active && !mentionContext.active)))
|
|
1310
|
-
const historyNavDownEnabled =
|
|
1311
|
-
lastEditDueToNav ||
|
|
1312
|
-
(cursorPosition === inputValue.length &&
|
|
1313
|
-
((slashContext.active &&
|
|
1314
|
-
slashSelectedIndex === slashMatches.length - 1) ||
|
|
1315
|
-
(mentionContext.active &&
|
|
1316
|
-
agentSelectedIndex === totalMentionMatches - 1) ||
|
|
1317
|
-
(!slashContext.active && !mentionContext.active)))
|
|
1318
|
-
|
|
1319
|
-
// Build keyboard state from store values
|
|
1320
|
-
const chatKeyboardState: ChatKeyboardState = useMemo(
|
|
1321
|
-
() => ({
|
|
1322
|
-
...createDefaultChatKeyboardState(),
|
|
1323
|
-
inputMode,
|
|
1324
|
-
inputValue: feedbackMode ? feedbackText : inputValue,
|
|
1325
|
-
cursorPosition,
|
|
1326
|
-
isStreaming,
|
|
1327
|
-
isWaitingForResponse,
|
|
1328
|
-
feedbackMode,
|
|
1329
|
-
focusedAgentId,
|
|
1330
|
-
slashMenuActive: slashContext.active,
|
|
1331
|
-
mentionMenuActive: mentionContext.active,
|
|
1332
|
-
slashSelectedIndex,
|
|
1333
|
-
agentSelectedIndex,
|
|
1334
|
-
slashMatchesLength: slashMatches.length,
|
|
1335
|
-
totalMentionMatches: agentMatches.length + fileMatches.length,
|
|
1336
|
-
disableSlashSuggestions:
|
|
1337
|
-
getInputModeConfig(inputMode).disableSlashSuggestions,
|
|
1338
|
-
modelPickerOpen,
|
|
1339
|
-
historyNavUpEnabled,
|
|
1340
|
-
historyNavDownEnabled,
|
|
1341
|
-
nextCtrlCWillExit,
|
|
1342
|
-
queuePaused,
|
|
1343
|
-
queuedCount,
|
|
1344
|
-
}),
|
|
1345
|
-
[
|
|
1346
|
-
inputMode,
|
|
1347
|
-
inputValue,
|
|
1348
|
-
feedbackText,
|
|
1349
|
-
cursorPosition,
|
|
1350
|
-
isStreaming,
|
|
1351
|
-
isWaitingForResponse,
|
|
1352
|
-
feedbackMode,
|
|
1353
|
-
focusedAgentId,
|
|
1354
|
-
slashContext.active,
|
|
1355
|
-
mentionContext.active,
|
|
1356
|
-
slashSelectedIndex,
|
|
1357
|
-
agentSelectedIndex,
|
|
1358
|
-
slashMatches.length,
|
|
1359
|
-
agentMatches.length,
|
|
1360
|
-
fileMatches.length,
|
|
1361
|
-
historyNavUpEnabled,
|
|
1362
|
-
historyNavDownEnabled,
|
|
1363
|
-
nextCtrlCWillExit,
|
|
1364
|
-
queuePaused,
|
|
1365
|
-
queuedCount,
|
|
1366
|
-
],
|
|
1367
|
-
)
|
|
1368
|
-
|
|
1369
|
-
// Keyboard handlers
|
|
1370
|
-
const chatKeyboardHandlers: ChatKeyboardHandlers = useMemo(
|
|
1371
|
-
() => ({
|
|
1372
|
-
onExitInputMode: () => setInputMode('default'),
|
|
1373
|
-
onExitFeedbackMode: handleCloseFeedback,
|
|
1374
|
-
onClearFeedbackInput: () => {
|
|
1375
|
-
setFeedbackText('')
|
|
1376
|
-
useFeedbackStore.getState().setFeedbackCursor(0)
|
|
1377
|
-
},
|
|
1378
|
-
onClearInput: () =>
|
|
1379
|
-
setInputValue({ text: '', cursorPosition: 0, lastEditDueToNav: false }),
|
|
1380
|
-
onBackspaceExitMode: () => setInputMode('default'),
|
|
1381
|
-
onInterruptStream: () => {
|
|
1382
|
-
abortControllerRef.current?.abort()
|
|
1383
|
-
if (queuedMessages.length > 0) {
|
|
1384
|
-
pauseQueue()
|
|
1385
|
-
}
|
|
1386
|
-
},
|
|
1387
|
-
onSlashMenuDown: () => setSlashSelectedIndex((prev) => prev + 1),
|
|
1388
|
-
onSlashMenuUp: () => setSlashSelectedIndex((prev) => prev - 1),
|
|
1389
|
-
onSlashMenuSelect: async () => {
|
|
1390
|
-
await executeSlashCommand(
|
|
1391
|
-
slashMatches[slashSelectedIndex] || slashMatches[0],
|
|
1392
|
-
)
|
|
1393
|
-
},
|
|
1394
|
-
onSlashMenuComplete: () => {
|
|
1395
|
-
// Complete the word without executing - same as clicking on the item
|
|
1396
|
-
const selected = slashMatches[slashSelectedIndex] || slashMatches[0]
|
|
1397
|
-
if (!selected || slashContext.startIndex < 0) return
|
|
1398
|
-
|
|
1399
|
-
// If the command has insertText, insert it instead of the command
|
|
1400
|
-
if (applySlashInsertText(selected)) return
|
|
1401
|
-
|
|
1402
|
-
const before = inputValue.slice(0, slashContext.startIndex)
|
|
1403
|
-
const after = inputValue.slice(
|
|
1404
|
-
slashContext.startIndex + 1 + slashContext.query.length,
|
|
1405
|
-
)
|
|
1406
|
-
const replacement = `/${selected.id} `
|
|
1407
|
-
setInputValue({
|
|
1408
|
-
text: before + replacement + after,
|
|
1409
|
-
cursorPosition: before.length + replacement.length,
|
|
1410
|
-
lastEditDueToNav: false,
|
|
1411
|
-
})
|
|
1412
|
-
setSlashSelectedIndex(0)
|
|
1413
|
-
},
|
|
1414
|
-
onMentionMenuDown: () => setAgentSelectedIndex((prev) => prev + 1),
|
|
1415
|
-
onMentionMenuUp: () => setAgentSelectedIndex((prev) => prev - 1),
|
|
1416
|
-
onMentionMenuTab: () => {
|
|
1417
|
-
const totalMatches = agentMatches.length + fileMatches.length
|
|
1418
|
-
setAgentSelectedIndex((prev) => (prev + 1) % totalMatches)
|
|
1419
|
-
},
|
|
1420
|
-
onMentionMenuShiftTab: () => {
|
|
1421
|
-
const totalMatches = agentMatches.length + fileMatches.length
|
|
1422
|
-
setAgentSelectedIndex(
|
|
1423
|
-
(prev) => (totalMatches + prev - 1) % totalMatches,
|
|
1424
|
-
)
|
|
1425
|
-
},
|
|
1426
|
-
onMentionMenuSelect: () => {
|
|
1427
|
-
// Try current selection, fall back to first item
|
|
1428
|
-
selectMentionAt(agentSelectedIndex) || selectMentionAt(0)
|
|
1429
|
-
},
|
|
1430
|
-
onMentionMenuComplete: () => {
|
|
1431
|
-
// Complete the word without executing - same as select for mentions
|
|
1432
|
-
selectMentionAt(agentSelectedIndex) || selectMentionAt(0)
|
|
1433
|
-
},
|
|
1434
|
-
onOpenFileMenuWithTab: () => openFileMenuWithTab(),
|
|
1435
|
-
onHistoryUp: navigateUp,
|
|
1436
|
-
onHistoryDown: navigateDown,
|
|
1437
|
-
onToggleAgentMode: toggleAgentMode,
|
|
1438
|
-
onUnfocusAgent: () => {
|
|
1439
|
-
setFocusedAgentId(null)
|
|
1440
|
-
setInputFocused(true)
|
|
1441
|
-
inputRef.current?.focus()
|
|
1442
|
-
},
|
|
1443
|
-
onClearQueue: clearQueue,
|
|
1444
|
-
onExitAppWarning: () => handleCtrlC(),
|
|
1445
|
-
onExitApp: () => handleCtrlC(),
|
|
1446
|
-
onBashHistoryUp: navigateUp,
|
|
1447
|
-
onBashHistoryDown: navigateDown,
|
|
1448
|
-
onPasteImage: () => {
|
|
1449
|
-
const placeholderPath = addClipboardPlaceholder()
|
|
1450
|
-
|
|
1451
|
-
// Process the image in the background
|
|
1452
|
-
setTimeout(() => {
|
|
1453
|
-
const result = readClipboardImage()
|
|
1454
|
-
if (!result.success || !result.imagePath) {
|
|
1455
|
-
useChatStore.getState().removePendingImage(placeholderPath)
|
|
1456
|
-
showClipboardMessage(result.error || 'Failed to paste image', {
|
|
1457
|
-
durationMs: 3000,
|
|
1458
|
-
})
|
|
1459
|
-
return
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
const cwd = getProjectRoot() ?? process.cwd()
|
|
1463
|
-
addPendingImageFromFile(result.imagePath, cwd, placeholderPath).catch(
|
|
1464
|
-
(error) => {
|
|
1465
|
-
logger.error({ error }, 'Failed to add pending image from file')
|
|
1466
|
-
showClipboardMessage('Failed to add image', { durationMs: 3000 })
|
|
1467
|
-
},
|
|
1468
|
-
)
|
|
1469
|
-
}, 0)
|
|
1470
|
-
},
|
|
1471
|
-
onPasteImagePath: (imagePath: string) => {
|
|
1472
|
-
const cwd = getProjectRoot() ?? process.cwd()
|
|
1473
|
-
validateAndAddImage(imagePath, cwd).catch((error) => {
|
|
1474
|
-
logger.error({ error, imagePath }, 'Failed to validate and add image')
|
|
1475
|
-
showClipboardMessage('Failed to add image', { durationMs: 3000 })
|
|
1476
|
-
})
|
|
1477
|
-
},
|
|
1478
|
-
onPasteFilePath: (filePath: string, isDirectory: boolean) => {
|
|
1479
|
-
addPendingFileFromPath(filePath, isDirectory)
|
|
1480
|
-
},
|
|
1481
|
-
onPasteText: (text: string) => {
|
|
1482
|
-
setInputValue((prev) => {
|
|
1483
|
-
const before = prev.text.slice(0, prev.cursorPosition)
|
|
1484
|
-
const after = prev.text.slice(prev.cursorPosition)
|
|
1485
|
-
return {
|
|
1486
|
-
text: before + text + after,
|
|
1487
|
-
cursorPosition: before.length + text.length,
|
|
1488
|
-
lastEditDueToNav: false,
|
|
1489
|
-
}
|
|
1490
|
-
})
|
|
1491
|
-
},
|
|
1492
|
-
onScrollUp: scrollUp,
|
|
1493
|
-
onScrollDown: scrollDown,
|
|
1494
|
-
onToggleAll: handleToggleAll,
|
|
1495
|
-
onOpenBuyCredits: () => {
|
|
1496
|
-
// If credits have been restored, just return to default mode
|
|
1497
|
-
if (areCreditsRestored()) {
|
|
1498
|
-
setInputMode('default')
|
|
1499
|
-
return
|
|
1500
|
-
}
|
|
1501
|
-
// Otherwise open the buy credits page
|
|
1502
|
-
safeOpen(WEBSITE_URL + '/usage')
|
|
1503
|
-
},
|
|
1504
|
-
}),
|
|
1505
|
-
[
|
|
1506
|
-
setInputMode,
|
|
1507
|
-
handleCloseFeedback,
|
|
1508
|
-
setFeedbackText,
|
|
1509
|
-
setInputValue,
|
|
1510
|
-
abortControllerRef,
|
|
1511
|
-
queuedMessages.length,
|
|
1512
|
-
pauseQueue,
|
|
1513
|
-
setSlashSelectedIndex,
|
|
1514
|
-
slashMatches,
|
|
1515
|
-
slashSelectedIndex,
|
|
1516
|
-
slashContext,
|
|
1517
|
-
inputValue,
|
|
1518
|
-
applySlashInsertText,
|
|
1519
|
-
onSubmitPrompt,
|
|
1520
|
-
agentMode,
|
|
1521
|
-
handleCommandResult,
|
|
1522
|
-
setAgentSelectedIndex,
|
|
1523
|
-
agentSelectedIndex,
|
|
1524
|
-
selectMentionAt,
|
|
1525
|
-
openFileMenuWithTab,
|
|
1526
|
-
navigateUp,
|
|
1527
|
-
navigateDown,
|
|
1528
|
-
toggleAgentMode,
|
|
1529
|
-
setFocusedAgentId,
|
|
1530
|
-
setInputFocused,
|
|
1531
|
-
inputRef,
|
|
1532
|
-
handleCtrlC,
|
|
1533
|
-
clearQueue,
|
|
1534
|
-
scrollUp,
|
|
1535
|
-
scrollDown,
|
|
1536
|
-
handleToggleAll,
|
|
1537
|
-
],
|
|
1538
|
-
)
|
|
1539
|
-
|
|
1540
|
-
// Use the chat keyboard hook
|
|
1541
|
-
useChatKeyboard({
|
|
1542
|
-
state: chatKeyboardState,
|
|
1543
|
-
handlers: chatKeyboardHandlers,
|
|
1544
|
-
// Disable the global keyboard dispatcher while the model or provider picker
|
|
1545
|
-
// overlay is open so its own useKeyboard handler has exclusive control.
|
|
1546
|
-
disabled:
|
|
1547
|
-
askUserState !== null ||
|
|
1548
|
-
reviewMode ||
|
|
1549
|
-
modelPickerOpen ||
|
|
1550
|
-
providerPickerOpen,
|
|
1551
|
-
})
|
|
1552
|
-
|
|
1553
|
-
// Sync message block context to zustand store for child components
|
|
1554
|
-
const setMessageBlockContext = useMessageBlockStore(
|
|
1555
|
-
(state) => state.setContext,
|
|
1556
|
-
)
|
|
1557
|
-
const setMessageBlockCallbacks = useMessageBlockStore(
|
|
1558
|
-
(state) => state.setCallbacks,
|
|
1559
|
-
)
|
|
1560
|
-
|
|
1561
|
-
// Update context when values change - useLayoutEffect ensures synchronous updates
|
|
1562
|
-
// to prevent message loss during rapid streaming (race condition fix)
|
|
1563
|
-
useLayoutEffect(() => {
|
|
1564
|
-
setMessageBlockContext({
|
|
1565
|
-
theme,
|
|
1566
|
-
markdownPalette,
|
|
1567
|
-
messageTree,
|
|
1568
|
-
isWaitingForResponse,
|
|
1569
|
-
timerStartTime,
|
|
1570
|
-
availableWidth: messageAvailableWidth,
|
|
1571
|
-
responseAds: showInlineAds ? responseAds : {},
|
|
1572
|
-
})
|
|
1573
|
-
}, [
|
|
1574
|
-
theme,
|
|
1575
|
-
markdownPalette,
|
|
1576
|
-
messageTree,
|
|
1577
|
-
isWaitingForResponse,
|
|
1578
|
-
timerStartTime,
|
|
1579
|
-
messageAvailableWidth,
|
|
1580
|
-
responseAds,
|
|
1581
|
-
showInlineAds,
|
|
1582
|
-
setMessageBlockContext,
|
|
1583
|
-
])
|
|
1584
|
-
|
|
1585
|
-
// Update callbacks once (they're stable)
|
|
1586
|
-
useEffect(() => {
|
|
1587
|
-
setMessageBlockCallbacks({
|
|
1588
|
-
onToggleCollapsed: handleCollapseToggle,
|
|
1589
|
-
onBuildFast: handleBuildFast,
|
|
1590
|
-
onBuildMax: handleBuildMax,
|
|
1591
|
-
onBuildLite: handleBuildLite,
|
|
1592
|
-
onFeedback: handleMessageFeedback,
|
|
1593
|
-
onCloseFeedback: handleCloseFeedback,
|
|
1594
|
-
onAdClick: handleAdClick,
|
|
1595
|
-
onAdImpression: handleAdImpression,
|
|
1596
|
-
onResponseAdsNeeded: handleResponseAdsNeeded,
|
|
1597
|
-
})
|
|
1598
|
-
}, [
|
|
1599
|
-
handleCollapseToggle,
|
|
1600
|
-
handleBuildFast,
|
|
1601
|
-
handleBuildMax,
|
|
1602
|
-
handleBuildLite,
|
|
1603
|
-
handleMessageFeedback,
|
|
1604
|
-
handleCloseFeedback,
|
|
1605
|
-
handleAdClick,
|
|
1606
|
-
handleAdImpression,
|
|
1607
|
-
handleResponseAdsNeeded,
|
|
1608
|
-
setMessageBlockCallbacks,
|
|
1609
|
-
])
|
|
1610
|
-
|
|
1611
|
-
const modeConfig = getInputModeConfig(inputMode)
|
|
1612
|
-
const hasSlashSuggestions =
|
|
1613
|
-
slashContext.active &&
|
|
1614
|
-
slashSuggestionItems.length > 0 &&
|
|
1615
|
-
!modeConfig.disableSlashSuggestions
|
|
1616
|
-
const hasMentionSuggestions =
|
|
1617
|
-
!slashContext.active &&
|
|
1618
|
-
mentionContext.active &&
|
|
1619
|
-
(agentSuggestionItems.length > 0 || fileSuggestionItems.length > 0)
|
|
1620
|
-
const hasSuggestionMenu = hasSlashSuggestions || hasMentionSuggestions
|
|
1621
|
-
|
|
1622
|
-
// Show first-time onboarding starter prompts only on a pristine, idle,
|
|
1623
|
-
// empty-input default-mode chat — and never while a menu/overlay is up.
|
|
1624
|
-
const showOnboardingPrompts =
|
|
1625
|
-
showSuggestedPrompts &&
|
|
1626
|
-
messages.length === 0 &&
|
|
1627
|
-
inputValue.length === 0 &&
|
|
1628
|
-
inputMode === 'default' &&
|
|
1629
|
-
!hasSuggestionMenu &&
|
|
1630
|
-
!isStreaming &&
|
|
1631
|
-
!isWaitingForResponse &&
|
|
1632
|
-
!feedbackMode &&
|
|
1633
|
-
!publishMode &&
|
|
1634
|
-
!reviewMode &&
|
|
1635
|
-
askUserState === null
|
|
1636
|
-
|
|
1637
|
-
// Fire a one-time impression so we can measure onboarding-prompt usage
|
|
1638
|
-
// (click-through = SUGGESTED_PROMPT_CLICKED / SUGGESTED_PROMPT_SHOWN).
|
|
1639
|
-
const suggestedPromptsShownRef = useRef(false)
|
|
1640
|
-
useEffect(() => {
|
|
1641
|
-
if (showOnboardingPrompts && !suggestedPromptsShownRef.current) {
|
|
1642
|
-
suggestedPromptsShownRef.current = true
|
|
1643
|
-
trackEvent(AnalyticsEvent.SUGGESTED_PROMPT_SHOWN, {
|
|
1644
|
-
count: isCompactHeight
|
|
1645
|
-
? Math.min(2, DEFAULT_SUGGESTED_PROMPTS.length)
|
|
1646
|
-
: DEFAULT_SUGGESTED_PROMPTS.length,
|
|
1647
|
-
isCompactHeight,
|
|
1648
|
-
})
|
|
1649
|
-
}
|
|
1650
|
-
}, [showOnboardingPrompts, isCompactHeight])
|
|
1651
|
-
|
|
1652
|
-
const inputLayoutMetrics = useMemo(() => {
|
|
1653
|
-
// In bash mode, layout is based on the actual input (no ! prefix needed)
|
|
1654
|
-
const text = inputValue ?? ''
|
|
1655
|
-
const layoutContent = text.length > 0 ? text : ' '
|
|
1656
|
-
const safeCursor = Math.max(
|
|
1657
|
-
0,
|
|
1658
|
-
Math.min(cursorPosition, layoutContent.length),
|
|
1659
|
-
)
|
|
1660
|
-
const cursorProbe =
|
|
1661
|
-
safeCursor >= layoutContent.length
|
|
1662
|
-
? layoutContent
|
|
1663
|
-
: layoutContent.slice(0, safeCursor)
|
|
1664
|
-
const cols = Math.max(1, inputWidth)
|
|
1665
|
-
return computeInputLayoutMetrics({
|
|
1666
|
-
layoutContent,
|
|
1667
|
-
cursorProbe,
|
|
1668
|
-
cols,
|
|
1669
|
-
maxHeight: Math.floor(terminalHeight / 2),
|
|
1670
|
-
})
|
|
1671
|
-
}, [inputValue, cursorPosition, inputWidth, terminalHeight])
|
|
1672
|
-
const isMultilineInput = inputLayoutMetrics.heightLines > 1
|
|
1673
|
-
const shouldCenterInputVertically = !hasSuggestionMenu && !isMultilineInput
|
|
1674
|
-
const statusIndicatorState = getStatusIndicatorState({
|
|
1675
|
-
statusMessage,
|
|
1676
|
-
streamStatus,
|
|
1677
|
-
nextCtrlCWillExit,
|
|
1678
|
-
isConnected,
|
|
1679
|
-
authStatus,
|
|
1680
|
-
showReconnectionMessage,
|
|
1681
|
-
isRetrying,
|
|
1682
|
-
isAskUserActive: askUserState !== null,
|
|
1683
|
-
})
|
|
1684
|
-
const hasStatusIndicatorContent = statusIndicatorState.kind !== 'idle'
|
|
1685
|
-
|
|
1686
|
-
// Auto-show subscription limit banner when rate limit becomes active
|
|
1687
|
-
const subscriptionLimitShownRef = useRef(false)
|
|
1688
|
-
const subscriptionRateLimit = subscriptionData?.hasSubscription
|
|
1689
|
-
? subscriptionData.rateLimit
|
|
1690
|
-
: undefined
|
|
1691
|
-
const fallbackToALaCarte = subscriptionData?.fallbackToALaCarte ?? false
|
|
1692
|
-
useEffect(() => {
|
|
1693
|
-
const isLimited = subscriptionRateLimit?.limited === true
|
|
1694
|
-
if (isLimited && !subscriptionLimitShownRef.current) {
|
|
1695
|
-
subscriptionLimitShownRef.current = true
|
|
1696
|
-
// Skip showing the banner if user prefers to always fall back to a-la-carte
|
|
1697
|
-
if (!fallbackToALaCarte) {
|
|
1698
|
-
useChatStore.getState().setInputMode('subscriptionLimit')
|
|
1699
|
-
}
|
|
1700
|
-
} else if (!isLimited) {
|
|
1701
|
-
subscriptionLimitShownRef.current = false
|
|
1702
|
-
if (useChatStore.getState().inputMode === 'subscriptionLimit') {
|
|
1703
|
-
useChatStore.getState().setInputMode('default')
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
}, [subscriptionRateLimit?.limited, fallbackToALaCarte])
|
|
1707
|
-
|
|
1708
|
-
const inputBoxTitle = useMemo(() => {
|
|
1709
|
-
const segments: string[] = []
|
|
1710
|
-
|
|
1711
|
-
if (queuePreviewTitle) {
|
|
1712
|
-
segments.push(queuePreviewTitle)
|
|
1713
|
-
} else if (pausedQueueText) {
|
|
1714
|
-
segments.push(`⏸ ${pausedQueueText}`)
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
if (segments.length === 0) {
|
|
1718
|
-
return undefined
|
|
1719
|
-
}
|
|
1720
|
-
|
|
1721
|
-
return ` ${segments.join(' ')} `
|
|
1722
|
-
}, [queuePreviewTitle, pausedQueueText])
|
|
1723
|
-
|
|
1724
|
-
const hasActiveSavantFreeSession =
|
|
1725
|
-
IS_SAVANT_FREE && savantFreeSession?.status === 'active'
|
|
1726
|
-
const isSavantFreeSessionOver =
|
|
1727
|
-
IS_SAVANT_FREE && savantFreeSession?.status === 'ended'
|
|
1728
|
-
const shouldShowStatusLine =
|
|
1729
|
-
!feedbackMode &&
|
|
1730
|
-
(hasStatusIndicatorContent ||
|
|
1731
|
-
shouldShowQueuePreview ||
|
|
1732
|
-
!isAtBottom ||
|
|
1733
|
-
hasActiveSavantFreeSession)
|
|
1734
|
-
|
|
1735
|
-
// Track mouse movement for ad activity (throttled)
|
|
1736
|
-
const lastMouseActivityRef = useRef<number>(0)
|
|
1737
|
-
const handleMouseActivity = useCallback(() => {
|
|
1738
|
-
const now = Date.now()
|
|
1739
|
-
// Throttle to max once per second
|
|
1740
|
-
if (now - lastMouseActivityRef.current > 1000) {
|
|
1741
|
-
lastMouseActivityRef.current = now
|
|
1742
|
-
reportActivity()
|
|
1743
|
-
}
|
|
1744
|
-
}, [])
|
|
1745
|
-
|
|
1746
|
-
// FID-2026-0722-045: Hide the right sidebar on narrow terminals so the
|
|
1747
|
-
// chat area keeps enough width to remain usable. The sidebar is 40 cols
|
|
1748
|
-
// and supplemental; below this threshold the left column needs the space.
|
|
1749
|
-
const SIDEBAR_MIN_TERMINAL_WIDTH = 100
|
|
1750
|
-
|
|
1751
|
-
const projectRootDisplay = formatCwd(getProjectRoot())
|
|
1752
|
-
const showSidebar = terminalWidth >= SIDEBAR_MIN_TERMINAL_WIDTH
|
|
1753
|
-
const directoryMaxWidth = showSidebar ? terminalWidth - 42 : terminalWidth - 2
|
|
1754
|
-
const directoryDisplay =
|
|
1755
|
-
projectRootDisplay.length > directoryMaxWidth && directoryMaxWidth > 10
|
|
1756
|
-
? `…${projectRootDisplay.slice(-directoryMaxWidth + 1)}`
|
|
1757
|
-
: projectRootDisplay
|
|
1758
|
-
|
|
1759
|
-
return (
|
|
1760
|
-
<box
|
|
1761
|
-
onMouseMove={handleMouseActivity}
|
|
1762
|
-
focusable={false}
|
|
1763
|
-
style={CHAT_ROOT_STYLE}
|
|
1764
|
-
>
|
|
1765
|
-
{/* Left column: chat content + bottom section */}
|
|
1766
|
-
<box
|
|
1767
|
-
focusable={false}
|
|
1768
|
-
style={{
|
|
1769
|
-
flexDirection: 'column',
|
|
1770
|
-
flexGrow: 1,
|
|
1771
|
-
gap: 0,
|
|
1772
|
-
borderStyle: 'single',
|
|
1773
|
-
borderColor: theme.border,
|
|
1774
|
-
}}
|
|
1775
|
-
>
|
|
1776
|
-
{/* Pinned header — outside scrollbox so it stays at top */}
|
|
1777
|
-
<box
|
|
1778
|
-
ref={headerRef as React.Ref<BoxRenderable>}
|
|
1779
|
-
style={HEADER_BOX_STYLE}
|
|
1780
|
-
focusable={false}
|
|
1781
|
-
>
|
|
1782
|
-
<ChatHeader
|
|
1783
|
-
projectRoot={getProjectRoot()}
|
|
1784
|
-
animationEnabled={isHeaderVisible && inputFocused}
|
|
1785
|
-
/>
|
|
1786
|
-
</box>
|
|
1787
|
-
|
|
1788
|
-
<scrollbox
|
|
1789
|
-
ref={scrollRef as React.Ref<ScrollBoxRenderable>}
|
|
1790
|
-
stickyScroll
|
|
1791
|
-
stickyStart="bottom"
|
|
1792
|
-
scrollX={false}
|
|
1793
|
-
scrollbarOptions={{ visible: false }}
|
|
1794
|
-
verticalScrollbarOptions={{
|
|
1795
|
-
visible: !isStreaming && !isWaitingForResponse && hasOverflow,
|
|
1796
|
-
trackOptions: { width: 1 },
|
|
1797
|
-
}}
|
|
1798
|
-
{...appliedScrollboxProps}
|
|
1799
|
-
style={SCROLLBOX_STYLE}
|
|
1800
|
-
>
|
|
1801
|
-
<TopBanner gitRoot={gitRoot} onSwitchToGitRoot={onSwitchToGitRoot} />
|
|
1802
|
-
|
|
1803
|
-
{IS_SAVANT_FREE && (
|
|
1804
|
-
<SavantFreeActiveSessionSummary session={savantFreeSession} />
|
|
1805
|
-
)}
|
|
1806
|
-
{hiddenMessageCount > 0 && (
|
|
1807
|
-
<LoadPreviousButton
|
|
1808
|
-
hiddenCount={hiddenMessageCount}
|
|
1809
|
-
onLoadMore={handleLoadPreviousMessages}
|
|
1810
|
-
/>
|
|
1811
|
-
)}
|
|
1812
|
-
{visibleTopLevelMessages.map((message, idx) => (
|
|
1813
|
-
<MessageWithAgents
|
|
1814
|
-
key={message.id}
|
|
1815
|
-
message={message}
|
|
1816
|
-
depth={0}
|
|
1817
|
-
isLastMessage={idx === visibleTopLevelMessages.length - 1}
|
|
1818
|
-
availableWidth={messageAvailableWidth}
|
|
1819
|
-
/>
|
|
1820
|
-
))}
|
|
1821
|
-
{/* Pending bash messages as ghost messages (only show those not already in history) */}
|
|
1822
|
-
{pendingBashMessages
|
|
1823
|
-
.filter((msg) => !msg.addedToHistory)
|
|
1824
|
-
.map((msg) => (
|
|
1825
|
-
<PendingBashMessage
|
|
1826
|
-
key={`pending-bash-${msg.id}`}
|
|
1827
|
-
message={msg}
|
|
1828
|
-
/>
|
|
1829
|
-
))}
|
|
1830
|
-
</scrollbox>
|
|
1831
|
-
|
|
1832
|
-
<box focusable={false} style={BOTTOM_BOX_STYLE}>
|
|
1833
|
-
{showOnboardingPrompts && !reviewMode && !isSavantFreeSessionOver && (
|
|
1834
|
-
<SuggestedPrompts
|
|
1835
|
-
onSelect={handleSelectSuggestedPrompt}
|
|
1836
|
-
maxItems={isCompactHeight ? 2 : undefined}
|
|
1837
|
-
/>
|
|
1838
|
-
)}
|
|
1839
|
-
|
|
1840
|
-
{shouldShowStatusLine && (
|
|
1841
|
-
<StatusBar
|
|
1842
|
-
timerStartTime={timerStartTime}
|
|
1843
|
-
isAtBottom={isAtBottom}
|
|
1844
|
-
scrollToLatest={scrollToLatest}
|
|
1845
|
-
statusIndicatorState={statusIndicatorState}
|
|
1846
|
-
onStop={chatKeyboardHandlers.onInterruptStream}
|
|
1847
|
-
onEndSession={() => {
|
|
1848
|
-
setMessages((prev) => [
|
|
1849
|
-
...prev,
|
|
1850
|
-
getSystemMessage(END_SESSION_MESSAGE),
|
|
1851
|
-
])
|
|
1852
|
-
returnToSavantFreeLanding({ resetChat: true }).catch(() => {})
|
|
1853
|
-
}}
|
|
1854
|
-
savantFreeSession={savantFreeSession}
|
|
1855
|
-
/>
|
|
1856
|
-
)}
|
|
1857
|
-
|
|
1858
|
-
{ads?.[0] && showInlineAds && (
|
|
1859
|
-
<SingleAdBanner
|
|
1860
|
-
ad={ads[0]}
|
|
1861
|
-
onClick={recordClick}
|
|
1862
|
-
onImpression={recordImpression}
|
|
1863
|
-
/>
|
|
1864
|
-
)}
|
|
1865
|
-
|
|
1866
|
-
{reviewMode ? (
|
|
1867
|
-
// Review and ask_user take precedence over the session-ended banner:
|
|
1868
|
-
// during the grace window the agent may still be asking to run tools
|
|
1869
|
-
// or asking the user a question, and those approvals/answers must be
|
|
1870
|
-
// reachable for the run to finish — otherwise the agent hangs
|
|
1871
|
-
// waiting for input that can never be given.
|
|
1872
|
-
<ReviewScreen
|
|
1873
|
-
onSelectOption={handleReviewOptionSelect}
|
|
1874
|
-
onCustom={handleReviewCustom}
|
|
1875
|
-
onCancel={handleCloseReviewScreen}
|
|
1876
|
-
/>
|
|
1877
|
-
) : isSavantFreeSessionOver && !askUserState ? (
|
|
1878
|
-
<SessionEndedBanner
|
|
1879
|
-
isStreaming={isStreaming || isWaitingForResponse}
|
|
1880
|
-
/>
|
|
1881
|
-
) : (
|
|
1882
|
-
<>
|
|
1883
|
-
{modelPickerOpen && (
|
|
1884
|
-
<ModelPicker
|
|
1885
|
-
models={modelPickerModels}
|
|
1886
|
-
query={modelPickerQuery}
|
|
1887
|
-
selectedIndex={modelPickerSelectedIndex}
|
|
1888
|
-
onQueryChange={setModelPickerQuery}
|
|
1889
|
-
onSelectIndex={setModelPickerSelectedIndex}
|
|
1890
|
-
onSelect={handleModelPickerSelect}
|
|
1891
|
-
onClose={closeModelPicker}
|
|
1892
|
-
/>
|
|
1893
|
-
)}
|
|
1894
|
-
{providerPickerOpen && (
|
|
1895
|
-
<ProviderPicker
|
|
1896
|
-
providers={providerPickerProviders}
|
|
1897
|
-
selectedIndex={providerPickerSelectedIndex}
|
|
1898
|
-
onSelectIndex={setProviderPickerSelectedIndex}
|
|
1899
|
-
onSelect={handleProviderPickerSelect}
|
|
1900
|
-
onClose={closeProviderPicker}
|
|
1901
|
-
/>
|
|
1902
|
-
)}
|
|
1903
|
-
{rewindPickerOpen && (
|
|
1904
|
-
<RewindPicker
|
|
1905
|
-
turns={rewindPickerTurns}
|
|
1906
|
-
selectedIndex={rewindPickerSelectedIndex}
|
|
1907
|
-
stage={rewindPickerStage}
|
|
1908
|
-
mode={rewindPickerMode}
|
|
1909
|
-
onSelectIndex={setRewindPickerSelectedIndex}
|
|
1910
|
-
onSetStage={setRewindPickerStage}
|
|
1911
|
-
onSetMode={setRewindPickerMode}
|
|
1912
|
-
onConfirm={handleRewindPickerConfirm}
|
|
1913
|
-
onClose={closeRewindPicker}
|
|
1914
|
-
/>
|
|
1915
|
-
)}
|
|
1916
|
-
<box flexDirection="row" paddingLeft={1} focusable={false}>
|
|
1917
|
-
<text fg={theme.muted} wrapMode="none" selectable={false}>
|
|
1918
|
-
{`cwd: ${directoryDisplay}`}
|
|
1919
|
-
</text>
|
|
1920
|
-
</box>
|
|
1921
|
-
<ChatInputBar
|
|
1922
|
-
inputValue={inputValue}
|
|
1923
|
-
cursorPosition={cursorPosition}
|
|
1924
|
-
setInputValue={setInputValue}
|
|
1925
|
-
inputFocused={inputFocused}
|
|
1926
|
-
inputRef={inputRef}
|
|
1927
|
-
inputPlaceholder={inputPlaceholder}
|
|
1928
|
-
lastEditDueToNav={lastEditDueToNav}
|
|
1929
|
-
agentMode={agentMode}
|
|
1930
|
-
toggleAgentMode={toggleAgentMode}
|
|
1931
|
-
setAgentMode={setAgentMode}
|
|
1932
|
-
hasSlashSuggestions={hasSlashSuggestions}
|
|
1933
|
-
hasMentionSuggestions={hasMentionSuggestions}
|
|
1934
|
-
hasSuggestionMenu={hasSuggestionMenu}
|
|
1935
|
-
slashSuggestionItems={slashSuggestionItems}
|
|
1936
|
-
agentSuggestionItems={agentSuggestionItems}
|
|
1937
|
-
fileSuggestionItems={fileSuggestionItems}
|
|
1938
|
-
slashSelectedIndex={slashSelectedIndex}
|
|
1939
|
-
agentSelectedIndex={agentSelectedIndex}
|
|
1940
|
-
onSlashItemClick={handleSlashItemClick}
|
|
1941
|
-
onMentionItemClick={handleMentionItemClick}
|
|
1942
|
-
theme={theme}
|
|
1943
|
-
terminalHeight={terminalHeight}
|
|
1944
|
-
separatorWidth={separatorWidth}
|
|
1945
|
-
shouldCenterInputVertically={shouldCenterInputVertically}
|
|
1946
|
-
inputBoxTitle={inputBoxTitle}
|
|
1947
|
-
isCompactHeight={isCompactHeight}
|
|
1948
|
-
isNarrowWidth={isNarrowWidth}
|
|
1949
|
-
feedbackMode={feedbackMode}
|
|
1950
|
-
handleExitFeedback={handleExitFeedback}
|
|
1951
|
-
publishMode={publishMode}
|
|
1952
|
-
handleExitPublish={handleExitPublish}
|
|
1953
|
-
handlePublish={handlePublish}
|
|
1954
|
-
handleSubmit={handleSubmit}
|
|
1955
|
-
onPaste={createPasteHandler({
|
|
1956
|
-
text: inputValue,
|
|
1957
|
-
cursorPosition,
|
|
1958
|
-
onChange: setInputValue,
|
|
1959
|
-
onPasteImage: chatKeyboardHandlers.onPasteImage,
|
|
1960
|
-
onPasteImagePath: chatKeyboardHandlers.onPasteImagePath,
|
|
1961
|
-
onPasteFilePath: chatKeyboardHandlers.onPasteFilePath,
|
|
1962
|
-
onPasteLongText: (pastedText) => {
|
|
1963
|
-
const id = crypto.randomUUID()
|
|
1964
|
-
const preview = pastedText.slice(0, 100).replace(/\n/g, ' ')
|
|
1965
|
-
useChatStore.getState().addPendingTextAttachment({
|
|
1966
|
-
id,
|
|
1967
|
-
content: pastedText,
|
|
1968
|
-
preview,
|
|
1969
|
-
charCount: pastedText.length,
|
|
1970
|
-
})
|
|
1971
|
-
// Show temporary status message
|
|
1972
|
-
showClipboardMessage(
|
|
1973
|
-
`📋 Pasted text (${pastedText.length.toLocaleString()} chars)`,
|
|
1974
|
-
{ durationMs: 5000 },
|
|
1975
|
-
)
|
|
1976
|
-
},
|
|
1977
|
-
cwd: getProjectRoot() ?? process.cwd(),
|
|
1978
|
-
})}
|
|
1979
|
-
onInterruptStream={chatKeyboardHandlers.onInterruptStream}
|
|
1980
|
-
/>
|
|
1981
|
-
</>
|
|
1982
|
-
)}
|
|
1983
|
-
</box>
|
|
1984
|
-
</box>
|
|
1985
|
-
|
|
1986
|
-
{/* Right sidebar — session info, tools, history.
|
|
1987
|
-
Hidden on narrow terminals so the chat column remains usable. */}
|
|
1988
|
-
{showSidebar && (
|
|
1989
|
-
<RightSidebar
|
|
1990
|
-
tokensUsed={contextTokensUsed}
|
|
1991
|
-
tokensMax={contextTokensMax}
|
|
1992
|
-
cost={sessionCost}
|
|
1993
|
-
model={sidebarModel || 'unknown'}
|
|
1994
|
-
mode={agentMode}
|
|
1995
|
-
agent={agentId ?? 'Savant'}
|
|
1996
|
-
toolsUsed={toolsUsed}
|
|
1997
|
-
toolsAvailable={SIDEBAR_TOOLS_AVAILABLE}
|
|
1998
|
-
filesChanged={filesChanged}
|
|
1999
|
-
agentStack={agentStack}
|
|
2000
|
-
toolHistory={toolHistory}
|
|
2001
|
-
isStreaming={isStreaming}
|
|
2002
|
-
isWaitingForResponse={isWaitingForResponse}
|
|
2003
|
-
fsmPhase={fsmPhase}
|
|
2004
|
-
/>
|
|
2005
|
-
)}
|
|
2006
|
-
</box>
|
|
2007
|
-
)
|
|
2008
|
-
}
|