@kabmo-labs/kabmo 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.html +1 -1
- package/dist/client/index.js +805 -736
- package/dist/client/static/js/index-bc9aa4mx.css +1 -0
- package/dist/client/static/js/{index-ph0q59rs.js → index-ga8cbpt4.js} +1071 -1171
- package/package.json +2 -4
- package/src/cli/lib/args.js +24 -1
- package/src/cli/lib/args.test.js +16 -0
- package/src/cli/lib/commands/session.js +233 -0
- package/src/cli/lib/commands/session.test.js +103 -0
- package/src/cli/main.js +1 -1
- package/src/client/components/common/ComposerPicker.tsx +3 -0
- package/src/client/components/common/Modal.tsx +2 -6
- package/src/client/components/common/code-surface/shiki.test.ts +82 -0
- package/src/client/components/common/code-surface/shiki.ts +28 -7
- package/src/client/components/common/session-actions-menu/NewChildSessionDialog.tsx +113 -0
- package/src/client/components/common/session-actions-menu/index.tsx +33 -2
- package/src/client/components/common/session-row/StatusSlot.tsx +4 -4
- package/src/client/components/common/session-row/index.tsx +27 -1
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +7 -1
- package/src/client/components/layout/desktop-layout/resizer/separator-drag.ts +3 -3
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +25 -12
- package/src/client/components/layout/session-sidebar/ChildSessionList.tsx +66 -0
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +28 -3
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.test.tsx +20 -0
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +59 -12
- package/src/client/components/layout/session-sidebar/about-modal/HarnessTableLog.test.tsx +94 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.test.tsx +130 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogDialog.tsx +120 -0
- package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +47 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.test.tsx +122 -0
- package/src/client/components/layout/session-sidebar/about-modal/index.tsx +55 -46
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +18 -5
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +21 -4
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +27 -5
- package/src/client/components/settings/categories/harness-settings/EnvProviderForm.tsx +31 -0
- package/src/client/components/settings/categories/harness-settings/provider-panel.test.tsx +49 -0
- package/src/client/components/workspace/chat-timeline/ChatOverlays.tsx +5 -2
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +64 -70
- package/src/client/components/workspace/chat-timeline/ComposerDockFrame.tsx +35 -0
- package/src/client/components/workspace/chat-timeline/EmptyWorkspacePrompt.tsx +135 -118
- package/src/client/components/workspace/chat-timeline/MessageItem.tsx +22 -1
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +14 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +4 -0
- package/src/client/components/workspace/chat-timeline/TimelineBody.tsx +3 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/composer-dock-frame.test.tsx +155 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +5 -2
- package/src/client/components/workspace/chat-timeline/pending-harness.test.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +11 -20
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/GroupedAsk.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +1 -1
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -1
- package/src/client/components/workspace/file-explorer/index.test.ts +25 -0
- package/src/client/components/workspace/file-explorer/index.tsx +9 -3
- package/src/client/components/workspace/model-dropdown/harness-models.test.ts +17 -0
- package/src/client/components/workspace/model-dropdown/harness-models.ts +33 -18
- package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
- package/src/client/components/workspace/model-dropdown/popover-metrics.ts +4 -1
- package/src/client/components/workspace/terminal-panel/KeyBar.tsx +10 -8
- package/src/client/components/workspace/terminal-panel/{RealtimeXtermView.tsx → RealtimeTerminalView.tsx} +51 -58
- package/src/client/components/workspace/terminal-panel/fit.test.ts +37 -0
- package/src/client/components/workspace/terminal-panel/fit.ts +64 -0
- package/src/client/components/workspace/terminal-panel/fonts.test.ts +161 -0
- package/src/client/components/workspace/terminal-panel/fonts.ts +164 -0
- package/src/client/components/workspace/terminal-panel/grid.test.ts +52 -0
- package/src/client/components/workspace/terminal-panel/grid.ts +118 -0
- package/src/client/components/workspace/terminal-panel/index.tsx +25 -21
- package/src/client/components/workspace/terminal-panel/mount.ts +247 -223
- package/src/client/components/workspace/terminal-panel/navigation.test.ts +54 -0
- package/src/client/components/workspace/terminal-panel/navigation.ts +47 -0
- package/src/client/data/settings/omp-schema.json +5 -5
- package/src/client/data/theme/terminal.test.ts +25 -0
- package/src/client/data/theme/terminal.ts +96 -79
- package/src/client/hooks/chat/composer/items.test.ts +12 -26
- package/src/client/hooks/chat/composer/pick-mapping.test.ts +42 -0
- package/src/client/hooks/chat/omp/prompt-send.test.ts +7 -7
- package/src/client/hooks/chat/omp/prompt-send.ts +26 -14
- package/src/client/hooks/chat/timeline/actions.ts +2 -2
- package/src/client/hooks/chat/timeline/ask-frames.ts +5 -4
- package/src/client/hooks/chat/timeline/new-chat-open.test.ts +86 -0
- package/src/client/hooks/chat/timeline/new-chat-open.ts +23 -5
- package/src/client/hooks/chat/timeline/new-chat.test.ts +32 -4
- package/src/client/hooks/chat/timeline/new-chat.ts +18 -6
- package/src/client/hooks/chat/timeline/prompt-text.test.ts +34 -1
- package/src/client/hooks/chat/timeline/prompt-text.ts +47 -20
- package/src/client/hooks/chat/timeline/rewind-actions.test.ts +24 -1
- package/src/client/hooks/chat/timeline/rewind-actions.ts +15 -11
- package/src/client/hooks/chat/timeline/run-identity.test.ts +52 -0
- package/src/client/hooks/chat/timeline/run-identity.ts +23 -11
- package/src/client/hooks/chat/timeline/send-execute.test.ts +56 -0
- package/src/client/hooks/chat/timeline/send-helpers.ts +30 -1
- package/src/client/hooks/chat/timeline/send-props.ts +5 -3
- package/src/client/hooks/chat/timeline/send-steer.test.ts +4 -4
- package/src/client/hooks/chat/timeline/send.test-util.ts +8 -2
- package/src/client/hooks/chat/timeline/send.test.ts +4 -4
- package/src/client/hooks/chat/timeline/send.ts +59 -53
- package/src/client/hooks/chat/timeline/session-load.test-util.ts +6 -2
- package/src/client/hooks/chat/timeline/session-load.test.ts +31 -0
- package/src/client/hooks/chat/timeline/session-load.ts +6 -14
- package/src/client/hooks/chat/timeline/session-shapes.ts +32 -0
- package/src/client/hooks/chat/timeline/use-fork-session.ts +49 -0
- package/src/client/hooks/models/harness-catalog.ts +114 -0
- package/src/client/hooks/models/provider-writes.test.ts +81 -0
- package/src/client/hooks/models/provider-writes.ts +10 -3
- package/src/client/hooks/models/use-harness-update.test.ts +193 -0
- package/src/client/hooks/models/use-harness-update.ts +202 -0
- package/src/client/hooks/models/use-harnesses-controller.ts +57 -0
- package/src/client/hooks/models/use-harnesses-signal.test.ts +128 -0
- package/src/client/hooks/models/use-harnesses.test.ts +2 -1
- package/src/client/hooks/models/use-harnesses.ts +48 -114
- package/src/client/hooks/workspace/child-expansion.ts +33 -0
- package/src/client/hooks/workspace/terminal/index.ts +17 -3
- package/src/client/hooks/workspace/terminal/socket.ts +9 -4
- package/src/client/lib/session-tree.test.ts +50 -0
- package/src/client/lib/session-tree.ts +59 -0
- package/src/client/tailwind.css +26 -12
- package/src/server/index.ts +2 -0
- package/src/server/lib/auth/guard.ts +10 -0
- package/src/server/lib/btw/session-copy.server.ts +6 -44
- package/src/server/lib/btw/session-copy.test.ts +2 -1
- package/src/server/lib/db/schema.ts +4 -0
- package/src/server/lib/db/seed-terminal.test.ts +1 -1
- package/src/server/lib/db/seed.test.ts +1 -1
- package/src/server/lib/harness/acp/activation.test.ts +81 -0
- package/src/server/lib/harness/acp/activation.ts +72 -0
- package/src/server/lib/harness/acp/background-work.test.ts +262 -0
- package/src/server/lib/harness/acp/background-work.ts +320 -0
- package/src/server/lib/harness/acp/client.ts +2 -2
- package/src/server/lib/harness/acp/frames.test.ts +50 -1
- package/src/server/lib/harness/acp/frames.ts +17 -5
- package/src/server/lib/harness/acp/gateway-env.test.ts +64 -0
- package/src/server/lib/harness/acp/gateway-env.ts +70 -0
- package/src/server/lib/harness/acp/mapper.ts +6 -4
- package/src/server/lib/harness/acp/prompt.test.ts +20 -0
- package/src/server/lib/harness/acp/prompt.ts +19 -3
- package/src/server/lib/harness/acp/session-background.test.ts +129 -0
- package/src/server/lib/harness/acp/session-config.test.ts +73 -0
- package/src/server/lib/harness/acp/session-config.ts +87 -6
- package/src/server/lib/harness/acp/session-exit.ts +31 -0
- package/src/server/lib/harness/acp/session-handshake.test.ts +108 -0
- package/src/server/lib/harness/acp/session-handshake.ts +36 -3
- package/src/server/lib/harness/acp/session-idle.ts +51 -0
- package/src/server/lib/harness/acp/session-listeners.ts +31 -0
- package/src/server/lib/harness/acp/session-notifications.ts +19 -3
- package/src/server/lib/harness/acp/session-observers.test.ts +9 -0
- package/src/server/lib/harness/acp/session-options.ts +33 -0
- package/src/server/lib/harness/acp/session-reaper.test.ts +96 -0
- package/src/server/lib/harness/acp/session-requests.ts +47 -0
- package/src/server/lib/harness/acp/session-turns.ts +20 -5
- package/src/server/lib/harness/acp/session.test-util.ts +54 -3
- package/src/server/lib/harness/acp/session.test.ts +65 -3
- package/src/server/lib/harness/acp/session.ts +79 -79
- package/src/server/lib/harness/acp/turn.test.ts +81 -0
- package/src/server/lib/harness/acp/turn.ts +54 -13
- package/src/server/lib/harness/acp/verbs.ts +12 -2
- package/src/server/lib/harness/auto-probe.server.test.ts +121 -0
- package/src/server/lib/harness/auto-probe.server.ts +178 -0
- package/src/server/lib/harness/config.server.test.ts +1 -1
- package/src/server/lib/harness/config.server.ts +1 -1
- package/src/server/lib/harness/launch-table.ts +195 -0
- package/src/server/lib/harness/launch.test.ts +37 -0
- package/src/server/lib/harness/launch.ts +16 -116
- package/src/server/lib/harness/provider-entry.ts +32 -0
- package/src/server/lib/harness/provider-file.server.ts +3 -0
- package/src/server/lib/harness/provider-sources.server.test.ts +45 -0
- package/src/server/lib/harness/provider-sources.server.ts +26 -2
- package/src/server/lib/harness/provider-write.server.ts +21 -32
- package/src/server/lib/harness/provider-zcode.server.test.ts +270 -0
- package/src/server/lib/harness/provider-zcode.server.ts +324 -0
- package/src/server/lib/harness/spawn.server.ts +15 -2
- package/src/server/lib/harness/update-job-store.test.ts +126 -0
- package/src/server/lib/harness/update-job-store.ts +109 -0
- package/src/server/lib/harness/update-job.server.ts +203 -0
- package/src/server/lib/harness/update-state.server.ts +15 -20
- package/src/server/lib/harness/update-worker.test.ts +153 -0
- package/src/server/lib/harness/update-worker.ts +197 -0
- package/src/server/lib/lifecycle/after-listen.ts +7 -0
- package/src/server/lib/lifecycle/paths.ts +23 -0
- package/src/server/lib/models/registry-refresh.server.test.ts +87 -0
- package/src/server/lib/models/registry-refresh.server.ts +98 -0
- package/src/server/lib/omp/rpc/child-config.ts +5 -4
- package/src/server/lib/omp/rpc/constants.test.ts +2 -1
- package/src/server/lib/omp/rpc/forked-resume.test.ts +14 -3
- package/src/server/lib/omp/rpc/manager.ts +5 -5
- package/src/server/lib/omp/rpc/prewarm-pool.ts +12 -3
- package/src/server/lib/omp/rpc/session-registry.ts +14 -2
- package/src/server/lib/omp/rpc/terminal-settle.ts +53 -5
- package/src/server/lib/omp/session/delete-flow.server.ts +62 -8
- package/src/server/lib/omp/session/delete.server.ts +17 -0
- package/src/server/lib/omp/session/rewind-file.ts +39 -21
- package/src/server/lib/omp/session/sidebar-data.server.ts +6 -6
- package/src/server/lib/omp/session/transcript-copy.ts +123 -0
- package/src/server/lib/sessions/agent-token.server.test.ts +64 -0
- package/src/server/lib/sessions/agent-token.server.ts +134 -0
- package/src/server/lib/sessions/answers.server.test.ts +33 -0
- package/src/server/lib/sessions/answers.server.ts +37 -0
- package/src/server/lib/sessions/dispatch.server.test.ts +143 -0
- package/src/server/lib/sessions/dispatch.server.ts +128 -0
- package/src/server/lib/sessions/fork.server.test.ts +209 -0
- package/src/server/lib/sessions/fork.server.ts +304 -0
- package/src/server/lib/sessions/lifecycle.server.test.ts +75 -0
- package/src/server/lib/sessions/lifecycle.server.ts +71 -0
- package/src/server/lib/sessions/notify.server.test.ts +112 -0
- package/src/server/lib/sessions/notify.server.ts +212 -0
- package/src/server/lib/sessions/relation-types.ts +76 -0
- package/src/server/lib/sessions/relations.server.test.ts +207 -0
- package/src/server/lib/sessions/relations.server.ts +337 -0
- package/src/server/lib/sessions/resolve.server.ts +106 -0
- package/src/server/lib/sessions/schema.server.ts +82 -0
- package/src/server/lib/sessions/sidebar-relations.server.test.ts +61 -0
- package/src/server/lib/sessions/sidebar-relations.server.ts +47 -0
- package/src/server/lib/sessions/spawn.server.test.ts +196 -0
- package/src/server/lib/sessions/spawn.server.ts +310 -0
- package/src/server/lib/terminal/attach-replay.test.ts +2 -2
- package/src/server/lib/terminal/output.test.ts +2 -2
- package/src/server/lib/terminal/output.ts +1 -1
- package/src/server/lib/terminal/resize.test.ts +99 -0
- package/src/server/lib/terminal/runtime.server.ts +26 -6
- package/src/server/lib/terminal/send-result.test.ts +18 -1
- package/src/server/lib/terminal/send-result.ts +26 -2
- package/src/server/lib/terminal/session.server.ts +6 -6
- package/src/server/lib/usage/new-api.test.ts +92 -0
- package/src/server/lib/usage/new-api.ts +131 -0
- package/src/server/lib/usage/provider-endpoint.test.ts +106 -0
- package/src/server/lib/usage/provider-key.ts +33 -0
- package/src/server/lib/usage/providers.server.ts +10 -3
- package/src/server/lib/usage/vendor-balance.server.ts +4 -53
- package/src/server/lib/usage/vendor-http.ts +41 -0
- package/src/server/lib/usage/window.ts +55 -0
- package/src/server/routes/agent/command.ts +14 -1
- package/src/server/routes/agent/harness-command.ts +6 -0
- package/src/server/routes/agent/new.ts +15 -0
- package/src/server/routes/chat/rewind.test.ts +147 -0
- package/src/server/routes/chat/rewind.ts +29 -7
- package/src/server/routes/chat/session.test.ts +165 -10
- package/src/server/routes/chat/session.ts +60 -7
- package/src/server/routes/harness/add-provider.test.ts +9 -1
- package/src/server/routes/harness/import-action.ts +22 -4
- package/src/server/routes/harness/import.test.ts +1 -1
- package/src/server/routes/harness/index.ts +5 -1
- package/src/server/routes/harness/root.ts +8 -49
- package/src/server/routes/harness/toggle.test.ts +20 -0
- package/src/server/routes/harness/update-status.ts +26 -0
- package/src/server/routes/harness/update.test.ts +119 -0
- package/src/server/routes/harness/update.ts +67 -113
- package/src/server/routes/harness/versions.ts +5 -1
- package/src/server/routes/sessions/answer.ts +24 -0
- package/src/server/routes/sessions/batch-delete.ts +11 -5
- package/src/server/routes/sessions/delete-acp.test.ts +227 -0
- package/src/server/routes/sessions/delete.ts +4 -2
- package/src/server/routes/sessions/fork.ts +74 -0
- package/src/server/routes/sessions/index.ts +14 -0
- package/src/server/routes/sessions/relations.ts +85 -0
- package/src/server/routes/sessions/session.ts +4 -0
- package/src/server/routes/sessions/spawn.ts +134 -0
- package/src/server/routes/settings/model-override.ts +5 -2
- package/src/server/routes/settings/provider-entry.ts +2 -2
- package/src/server/routes/settings/provider-model.ts +2 -2
- package/src/server/routes/settings/provider-models.ts +2 -2
- package/src/server/routes/settings/provider-refresh.ts +6 -4
- package/src/server/routes/settings/providers.ts +3 -1
- package/src/server/routes/settings/settings-config-routes.test.ts +10 -2
- package/src/server/routes/terminal/ws.ts +3 -3
- package/src/shared/lib/chat/ask-form/fields.ts +76 -0
- package/src/shared/lib/chat/ask-form/index.ts +323 -0
- package/src/shared/lib/chat/ask-form/tokens.ts +199 -0
- package/src/shared/lib/chat/ask-form/types.ts +43 -0
- package/src/shared/lib/chat/ask-form.test.ts +137 -0
- package/src/shared/lib/chat/ask-questions.test.ts +65 -1
- package/src/shared/lib/chat/ask-questions.ts +51 -145
- package/src/shared/lib/chat/ask-results.ts +198 -0
- package/src/shared/lib/chat/composer/client.ts +31 -2
- package/src/shared/lib/chat/composer/delegation.test.ts +93 -0
- package/src/shared/lib/chat/composer/delegation.ts +206 -0
- package/src/shared/lib/chat/notice-text.ts +1 -1
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +13 -1
- package/src/shared/lib/chat/timeline/prompt-error.test.ts +146 -0
- package/src/shared/lib/chat/timeline/prompt-error.ts +88 -0
- package/src/shared/lib/chat/tool/summary-wait.test.ts +11 -0
- package/src/shared/lib/code/ansi.ts +1 -1
- package/src/shared/lib/fonts/nerd-symbols.css +4 -3
- package/src/shared/lib/fonts/nerd-symbols.test.ts +9 -9
- package/src/shared/lib/harness/catalog.test.ts +1 -1
- package/src/shared/lib/harness/config-fields.test.ts +4 -0
- package/src/shared/lib/harness/config-fields.ts +19 -4
- package/src/shared/lib/harness/dialects.test.ts +8 -0
- package/src/shared/lib/harness/dialects.ts +12 -0
- package/src/shared/lib/harness/provider-facts.test.ts +59 -8
- package/src/shared/lib/harness/provider-facts.ts +46 -11
- package/src/shared/lib/harness/providers.ts +44 -1
- package/src/shared/lib/harness/rewind.ts +24 -0
- package/src/shared/lib/harness/update-job.ts +33 -0
- package/src/shared/lib/harness/update-plan.test.ts +69 -4
- package/src/shared/lib/harness/update-plan.ts +57 -9
- package/src/shared/lib/harness/updates.test.ts +22 -0
- package/src/shared/lib/harness/updates.ts +24 -1
- package/src/shared/lib/models/client.ts +10 -1
- package/src/shared/lib/omp/dialog-methods.ts +4 -3
- package/src/shared/lib/omp/session/wait-idle.test.ts +11 -0
- package/src/shared/lib/omp/session/wait-idle.ts +12 -2
- package/src/shared/lib/theme/catalog.test.ts +13 -9
- package/src/shared/lib/theme/color.test.ts +2 -2
- package/src/shared/lib/theme/color.ts +4 -4
- package/src/shared/lib/theme/css.ts +2 -0
- package/src/shared/lib/theme/ink-scale.ts +21 -1
- package/src/shared/lib/theme/theme.test.ts +26 -10
- package/src/shared/lib/ui/safe-area.test.ts +28 -0
- package/src/shared/lib/ui/safe-area.ts +42 -0
- package/src/shared/lib/workspace/terminal/input.test.ts +27 -0
- package/src/shared/lib/workspace/terminal/input.ts +33 -0
- package/src/shared/lib/workspace/terminal/keys.test.ts +1 -1
- package/src/shared/lib/workspace/terminal/keys.ts +7 -7
- package/src/shared/types/chat.ts +1 -1
- package/src/shared/types/harness-update.ts +65 -0
- package/src/shared/types/harness.ts +30 -4
- package/src/shared/types/omp/agent.ts +19 -2
- package/src/shared/types/workspace.ts +4 -0
- package/src/test-support/fake-omp-fork.ts +16 -2
- package/src/test-support/file-explorer-render.test-util.ts +37 -0
- package/src/test-support/file-explorer.test-util.ts +20 -18
- package/src/test-support/harness-table.test-util.ts +21 -4
- package/dist/client/static/js/index-jhmg4w91.css +0 -1
- package/src/client/components/workspace/terminal-panel/webgl.test.ts +0 -75
- package/src/client/components/workspace/terminal-panel/webgl.ts +0 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"source": "@oh-my-pi/pi-coding-agent 10 tabs /
|
|
2
|
+
"source": "@oh-my-pi/pi-coding-agent 10 tabs / 604 settings",
|
|
3
3
|
"tabs": [
|
|
4
4
|
{
|
|
5
5
|
"id": "appearance",
|
|
@@ -767,7 +767,7 @@
|
|
|
767
767
|
"tab": "appearance",
|
|
768
768
|
"group": "Display",
|
|
769
769
|
"label": "Mouse Click-to-Focus",
|
|
770
|
-
"description": "Capture mouse clicks in the main session so live subagent cards and HUD rows focus on click, with a hover highlight on the target, and clicks on extension-owned links reach their extension (the link-hint key picks them without the mouse). Native text selection becomes Shift+drag and wheel
|
|
770
|
+
"description": "Capture mouse clicks in the main session so live subagent cards and HUD rows focus on click, with a hover highlight on the target, and clicks on extension-owned links reach their extension (the link-hint key picks them without the mouse). Native text selection becomes Shift+drag while on, and mouse capture stops wheel scrolling — the terminal reports wheel ticks to omp instead — so scroll with the terminal's keyboard scrollback keys, or turn this off"
|
|
771
771
|
}
|
|
772
772
|
},
|
|
773
773
|
"tui.tight": {
|
|
@@ -5020,7 +5020,7 @@
|
|
|
5020
5020
|
"tab": "memory",
|
|
5021
5021
|
"group": "Mnemopi",
|
|
5022
5022
|
"label": "Mnemopi DB Path",
|
|
5023
|
-
"description": "Optional SQLite DB path. Defaults to the agent memories directory.",
|
|
5023
|
+
"description": "Optional SQLite DB path; a leading ~ is the home directory. Defaults to the agent memories directory.",
|
|
5024
5024
|
"condition": "mnemopiActive"
|
|
5025
5025
|
}
|
|
5026
5026
|
},
|
|
@@ -6923,7 +6923,7 @@
|
|
|
6923
6923
|
"tab": "files",
|
|
6924
6924
|
"group": "LSP",
|
|
6925
6925
|
"label": "LSP",
|
|
6926
|
-
"description": "
|
|
6926
|
+
"description": "Language-server integration: the lsp tool, diagnostics on write/edit, and format on write (--no-lsp disables for the run)"
|
|
6927
6927
|
}
|
|
6928
6928
|
},
|
|
6929
6929
|
"lsp.lazy": {
|
|
@@ -7469,7 +7469,7 @@
|
|
|
7469
7469
|
"tab": "tasks",
|
|
7470
7470
|
"group": "Subagents",
|
|
7471
7471
|
"label": "Prefer Task Delegation",
|
|
7472
|
-
"description": "How strongly to push
|
|
7472
|
+
"description": "How strongly to push the main agent to delegate work; subagents keep the model's own policy",
|
|
7473
7473
|
"options": [
|
|
7474
7474
|
{
|
|
7475
7475
|
"value": "default",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
import {
|
|
8
|
+
TERMINAL_SCROLLBACK_BYTES,
|
|
9
|
+
TERMINAL_SCROLLBACK_LINES,
|
|
10
|
+
scrollbackBytesForLines,
|
|
11
|
+
} from '@/client/data/theme/terminal';
|
|
12
|
+
|
|
13
|
+
describe('terminal scrollback budget', () => {
|
|
14
|
+
test('is a byte budget, not xterm’s line count', () => {
|
|
15
|
+
// Ghostty charges roughly one 16-byte cell per retained column.
|
|
16
|
+
expect(scrollbackBytesForLines(10_000, 100)).toBe(16_000_000);
|
|
17
|
+
expect(TERMINAL_SCROLLBACK_BYTES).toBe(scrollbackBytesForLines(TERMINAL_SCROLLBACK_LINES, 100));
|
|
18
|
+
// Passing xterm's `10000` through as the option would be ~1000× too small.
|
|
19
|
+
expect(TERMINAL_SCROLLBACK_BYTES).toBeGreaterThan(10_000);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('never returns a zero budget', () => {
|
|
23
|
+
expect(scrollbackBytesForLines(0, 0)).toBe(16);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -5,12 +5,11 @@ import { resolveTheme } from '@/shared/lib/theme/catalog';
|
|
|
5
5
|
* The terminal palette for a theme, derived from the same eight colors the rest
|
|
6
6
|
* of the app paints with.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* scrollback instead of leaving the previous palette on screen.
|
|
8
|
+
* The palette is applied when the WASM terminal is created: ANSI cells carry
|
|
9
|
+
* RGB resolved at parse time, so a running terminal cannot simply be recolored
|
|
10
|
+
* (see the theme rebuild in `terminal-panel/mount.ts`). Every blend is computed
|
|
11
|
+
* here in hex — the canvas renderer understands literal colors, not
|
|
12
|
+
* `color-mix()`.
|
|
14
13
|
*
|
|
15
14
|
* ANSI slots map onto the semantic colors the palette does carry (red=error,
|
|
16
15
|
* green=success, yellow=warning, blue=info, magenta=accent); `cyan` has no
|
|
@@ -19,18 +18,48 @@ import { resolveTheme } from '@/shared/lib/theme/catalog';
|
|
|
19
18
|
* the foreground, which is lighter on a dark theme and darker on a light one —
|
|
20
19
|
* the direction that increases contrast on both.
|
|
21
20
|
*/
|
|
22
|
-
export function
|
|
21
|
+
export function getTerminalTheme(themeId: string) {
|
|
23
22
|
const palette = resolveTheme(themeId);
|
|
24
|
-
const { canvas, ink } = palette;
|
|
23
|
+
const { canvas, ink, paper } = palette;
|
|
25
24
|
|
|
26
25
|
const towardInk = (color: string) => mixHex(color, ink, 0.2);
|
|
27
26
|
const grayscale = (ratio: number) => mixHex(canvas, ink, ratio);
|
|
28
27
|
|
|
28
|
+
// Two slots the canvas renderer paints OPAQUELY, so their values are
|
|
29
|
+
// deliberate departures from xterm's:
|
|
30
|
+
// - `selectionBackground` is a 28% ink-over-canvas gray rather than a
|
|
31
|
+
// translucent wash. The renderer's selection branch does
|
|
32
|
+
// `fillRect(...)` with the raw color — no alpha is applied and an
|
|
33
|
+
// `rgba()` value is NOT parsed (see the renderer's selection branch,
|
|
34
|
+
// which reads `this.theme.selectionBackground` directly) — so a
|
|
35
|
+
// translucent value would paint as the literal CSS color, and a light
|
|
36
|
+
// wash would vanish against the canvas. Opaque + mixed keeps the
|
|
37
|
+
// selection visible on every theme.
|
|
38
|
+
// - `cursor: palette.meta` is the theme's own accent rather than xterm's
|
|
39
|
+
// `cursor: ink`. The block cursor is a filled rect in the meta color
|
|
40
|
+
// with `cursorAccent` drawn through the glyph, so the blink reads on
|
|
41
|
+
// both light and dark palettes without a second constant.
|
|
42
|
+
//
|
|
43
|
+
// `background` is TRANSPARENT: the terminal has no surface of its own.
|
|
44
|
+
//
|
|
45
|
+
// It used to be `canvas`, a slightly darker rectangle that also stopped a cell
|
|
46
|
+
// short of the panel on the right (the fit addon reserves 15 px for its
|
|
47
|
+
// in-canvas scrollbar) — measured as a terminal that was not full width.
|
|
48
|
+
// Painting the panel's `paper` fixed the colour mismatch but still drew a
|
|
49
|
+
// surface over the panel's material, which under `[data-surface="glass"]` is
|
|
50
|
+
// the frosted chrome (`glass.css` makes the view ROOT transparent for exactly
|
|
51
|
+
// this reason). Transparent lets that chrome — and the aura behind it — show
|
|
52
|
+
// through the canvas; the classic look is unchanged because the chrome's own
|
|
53
|
+
// fill is `--theme-paper` there. `renderLine` clears each row before filling,
|
|
54
|
+
// so a transparent ground leaves the previous frame erased, not smeared.
|
|
55
|
+
//
|
|
56
|
+
// `cursorAccent` stays `paper`: it is the glyph drawn INSIDE the dark cursor
|
|
57
|
+
// block, so it needs a real colour, not the surface.
|
|
29
58
|
return {
|
|
30
|
-
background:
|
|
59
|
+
background: 'transparent',
|
|
31
60
|
foreground: ink,
|
|
32
61
|
cursor: palette.meta,
|
|
33
|
-
cursorAccent:
|
|
62
|
+
cursorAccent: paper,
|
|
34
63
|
selectionBackground: grayscale(0.28),
|
|
35
64
|
selectionForeground: ink,
|
|
36
65
|
black: grayscale(0.2),
|
|
@@ -52,6 +81,9 @@ export function getXtermTheme(themeId: string) {
|
|
|
52
81
|
};
|
|
53
82
|
}
|
|
54
83
|
|
|
84
|
+
/** The text face the renderer measures its cell width from. */
|
|
85
|
+
export const TERMINAL_TEXT_FAMILY = 'Fira Code';
|
|
86
|
+
|
|
55
87
|
/**
|
|
56
88
|
* Font stack for the terminal canvas.
|
|
57
89
|
*
|
|
@@ -71,22 +103,20 @@ export function getXtermTheme(themeId: string) {
|
|
|
71
103
|
* (`src/shared/lib/fonts/nerd-symbols.css`), and it is deliberately LAST: a
|
|
72
104
|
* machine that already has a Nerd Font renders from it and never fetches these
|
|
73
105
|
* bytes, while a phone — which has none — falls through to it instead of
|
|
74
|
-
* painting tofu.
|
|
75
|
-
* ahead of it, laying out a PUA glyph issued zero font requests; with no local
|
|
76
|
-
* family present, the face is fetched and all of the prompt's codepoints
|
|
77
|
-
* render.
|
|
106
|
+
* painting tofu.
|
|
78
107
|
*
|
|
79
108
|
* Only glyphs the text face lacks reach these entries, so Latin metrics are
|
|
80
|
-
* untouched
|
|
109
|
+
* untouched.
|
|
81
110
|
*/
|
|
82
|
-
export const
|
|
111
|
+
export const TERMINAL_GLYPH_FALLBACKS =
|
|
83
112
|
"'FiraCode Nerd Font Mono', 'FiraCode Nerd Font', 'JetBrainsMono Nerd Font', " +
|
|
84
113
|
"'JetBrainsMono NF', 'JetBrains Mono Nerd Font', 'Hack Nerd Font', 'MesloLGS NF', " +
|
|
85
114
|
"'MesloLGM Nerd Font', 'CaskaydiaCove Nerd Font', 'SauceCodePro Nerd Font', " +
|
|
86
115
|
"'Symbols Nerd Font Mono', 'Symbols Nerd Font', 'PowerlineSymbols'";
|
|
87
116
|
|
|
88
117
|
/**
|
|
89
|
-
* The bundled symbols face, kept separate so `mount.ts` can await it by
|
|
118
|
+
* The bundled symbols face, kept separate so `mount.ts` can await/watch it by
|
|
119
|
+
* name.
|
|
90
120
|
*
|
|
91
121
|
* It must stay last in the stack (see above) and its family name must match the
|
|
92
122
|
* `@font-face` in `nerd-symbols.css` — the two are one contract, which is why
|
|
@@ -94,70 +124,57 @@ export const XTERM_GLYPH_FALLBACKS =
|
|
|
94
124
|
*/
|
|
95
125
|
export const NERD_SYMBOLS_FAMILY = 'Kabmo Nerd Symbols';
|
|
96
126
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/** xterm's private render service, read only to size-check before fitting. */
|
|
101
|
-
export interface XtermCore {
|
|
102
|
-
_core?: { _renderService?: { dimensions?: { css?: { cell?: { width?: number; height?: number } } } } };
|
|
103
|
-
}
|
|
127
|
+
/** The faces whose late arrival changes what the canvas should rasterize. */
|
|
128
|
+
export const TERMINAL_FACES = [TERMINAL_TEXT_FAMILY, NERD_SYMBOLS_FAMILY] as const;
|
|
104
129
|
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
130
|
+
/**
|
|
131
|
+
* The canvas renderer composes its font string as `[italic ][bold ]SIZE FAMILY`
|
|
132
|
+
* when a cell is bold, and the shorthand grammar allows ONE weight before the
|
|
133
|
+
* size — not one per family — so the stack cannot ask for a real 700 per
|
|
134
|
+
* face (`'Fira Code';700` is not a valid family token and the whole
|
|
135
|
+
* declaration is dropped, leaving the renderer's `monospace` default). Bold
|
|
136
|
+
* therefore goes through the CSS font-matching rules: the first family that
|
|
137
|
+
* SHIPS a 700 wins, and `@fontsource/fira-code` does — `fira-code-fonts.css`
|
|
138
|
+
* bundles 400/500/600/700 — so bold cells rasterize from the real 700 and
|
|
139
|
+
* match xterm. Verified in Chromium: `bold 12px 'Fira Code', …` with the 700
|
|
140
|
+
* face unloaded reports `12px "Fira Code"` (the 400 face) and downloads
|
|
141
|
+
* `fira-code-latin-700-normal.woff2` the moment a bold cell is laid out.
|
|
142
|
+
*/
|
|
143
|
+
export const TERMINAL_FONT_FAMILY =
|
|
144
|
+
`'${TERMINAL_TEXT_FAMILY}', ${TERMINAL_GLYPH_FALLBACKS}, '${NERD_SYMBOLS_FAMILY}', Menlo, Monaco, 'Courier New', monospace`;
|
|
112
145
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!dims?.css?.cell?.width || !dims?.css?.cell?.height) return undefined;
|
|
125
|
-
return origPropose?.call(this);
|
|
126
|
-
} catch {
|
|
127
|
-
return undefined;
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
} catch {}
|
|
132
|
-
}
|
|
146
|
+
/**
|
|
147
|
+
* The cell font size in CSS px.
|
|
148
|
+
*
|
|
149
|
+
* 12px is a measured choice: the right panel is ~350 px wide at its default
|
|
150
|
+
* width, and 12px keeps a normal prompt unwrapped. The renderer has no
|
|
151
|
+
* `lineHeight` option, so the cell box is measured instead — `measureTerminalCell`
|
|
152
|
+
* in `terminal-panel/fonts.ts` pads the glyph ink (`Mg`) by 2.5 px above and 1 px
|
|
153
|
+
* below: 15 px per cell, which is what a painted background block needs to read
|
|
154
|
+
* as a rectangle rather than a band.
|
|
155
|
+
*/
|
|
156
|
+
export const TERMINAL_FONT_SIZE = 12;
|
|
133
157
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Ghostty's `max_scrollback` is a BYTE budget, not a line count.
|
|
160
|
+
*
|
|
161
|
+
* The wrapper types it as lines and passes xterm's `scrollback: 10000` through
|
|
162
|
+
* unchanged, which retains roughly 600 rows at a 98-column panel (measured).
|
|
163
|
+
* Kabmo wants xterm's old 10,000-line depth, so the budget is stated in the
|
|
164
|
+
* renderer's own unit.
|
|
165
|
+
*
|
|
166
|
+
* Ghostty charges roughly one 16-byte cell per retained column, so
|
|
167
|
+
* `lines × cols × 16` is the deliberate over-estimate: at 100 columns it is
|
|
168
|
+
* 16 MB for 10,000 lines, and the byte cap trims earlier only if the estimate
|
|
169
|
+
* is too small. The server's replay history is capped separately at 512 KiB
|
|
170
|
+
* (`lib/terminal/history.ts`), so a reconnect is bounded regardless.
|
|
171
|
+
*/
|
|
172
|
+
export const TERMINAL_SCROLLBACK_CELL_BYTES = 16;
|
|
173
|
+
export const TERMINAL_SCROLLBACK_LINES = 10_000;
|
|
138
174
|
|
|
139
|
-
export function
|
|
140
|
-
|
|
141
|
-
const core = term?._core;
|
|
142
|
-
if (core?._renderService) {
|
|
143
|
-
const proto = Object.getPrototypeOf(core._renderService);
|
|
144
|
-
const desc = Object.getOwnPropertyDescriptor(proto, 'dimensions');
|
|
145
|
-
if (desc?.get && !proto.__safePatched) {
|
|
146
|
-
proto.__safePatched = true;
|
|
147
|
-
const origGet = desc.get;
|
|
148
|
-
Object.defineProperty(proto, 'dimensions', {
|
|
149
|
-
get() {
|
|
150
|
-
try {
|
|
151
|
-
if (!this._renderer?.value) return DEFAULT_DIMENSIONS;
|
|
152
|
-
return origGet.call(this);
|
|
153
|
-
} catch {
|
|
154
|
-
return DEFAULT_DIMENSIONS;
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
configurable: true,
|
|
158
|
-
enumerable: true
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
} catch {}
|
|
175
|
+
export function scrollbackBytesForLines(lines: number, cols: number): number {
|
|
176
|
+
return Math.max(1, lines) * Math.max(1, cols) * TERMINAL_SCROLLBACK_CELL_BYTES;
|
|
163
177
|
}
|
|
178
|
+
|
|
179
|
+
/** The default budget: 10,000 lines at the panel's usual 100 columns. */
|
|
180
|
+
export const TERMINAL_SCROLLBACK_BYTES = scrollbackBytesForLines(TERMINAL_SCROLLBACK_LINES, 100);
|
|
@@ -32,8 +32,6 @@ import { registerListSlot, resetListSlots } from '@/client/lib/plugins/list-slot
|
|
|
32
32
|
import {
|
|
33
33
|
invalidateComposerCache,
|
|
34
34
|
loadComposerItems,
|
|
35
|
-
toAgentPickItems,
|
|
36
|
-
toFilePickItems,
|
|
37
35
|
} from '@/shared/lib/chat/composer/client';
|
|
38
36
|
|
|
39
37
|
const DOM_GLOBALS = ['window', 'document', 'navigator', 'HTMLElement', 'Element', 'Node', 'Event', 'CustomEvent'] as const;
|
|
@@ -144,7 +142,10 @@ describe('useComposerItems', () => {
|
|
|
144
142
|
|
|
145
143
|
await mount('mention', '/repo');
|
|
146
144
|
await settle(6);
|
|
147
|
-
|
|
145
|
+
const tokens = state.items.map((item) => item.token);
|
|
146
|
+
expect(tokens[0]).toBe('@sonic');
|
|
147
|
+
expect(tokens.at(-1)).toBe('@file:src/a.ts');
|
|
148
|
+
expect(tokens).toContain('@harness:claude');
|
|
148
149
|
expect(state.error).toBeNull();
|
|
149
150
|
});
|
|
150
151
|
|
|
@@ -240,7 +241,8 @@ describe('plugin commands in the popup', () => {
|
|
|
240
241
|
await mount('mention', '/repo');
|
|
241
242
|
await settle(6);
|
|
242
243
|
|
|
243
|
-
expect(state.items).
|
|
244
|
+
expect(state.items.every((item) => item.source === 'harness')).toBe(true);
|
|
245
|
+
expect(state.items.length).toBeGreaterThan(0);
|
|
244
246
|
});
|
|
245
247
|
|
|
246
248
|
test('a closed menu offers nothing, not even a plugin row', async () => {
|
|
@@ -252,26 +254,6 @@ describe('plugin commands in the popup', () => {
|
|
|
252
254
|
});
|
|
253
255
|
});
|
|
254
256
|
|
|
255
|
-
describe('pick item mapping', () => {
|
|
256
|
-
test('an agent becomes a bare @name token', () => {
|
|
257
|
-
const [item] = toAgentPickItems([
|
|
258
|
-
{ id: 'a1', name: 'sonic', description: 'fast', scope: 'user', systemPrompt: '' },
|
|
259
|
-
]);
|
|
260
|
-
expect(item).toMatchObject({ id: 'agent-sonic', name: 'sonic', kind: 'agent', source: 'agent', token: '@sonic' });
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
test('a file is namespaced under file:, so a root-level name cannot shadow an agent', () => {
|
|
264
|
-
const [item] = toFilePickItems([{ name: 'sonic', path: 'sonic' }]);
|
|
265
|
-
expect(item.token).toBe('@file:sonic');
|
|
266
|
-
expect(item.path).toBe('sonic');
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
test('a path with whitespace is quoted, so the token cannot end early', () => {
|
|
270
|
-
const [item] = toFilePickItems([{ name: 'my notes.md', path: 'docs/my notes.md' }]);
|
|
271
|
-
expect(item.token).toBe('@"file:docs/my notes.md"');
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
|
|
275
257
|
describe('loadComposerItems', () => {
|
|
276
258
|
test('mention merges agents first, then workspace files', async () => {
|
|
277
259
|
answer = (url) => url.includes('/api/settings/agents')
|
|
@@ -279,7 +261,9 @@ describe('loadComposerItems', () => {
|
|
|
279
261
|
: { body: { files: [{ name: 'a.ts', path: 'src/a.ts' }] } };
|
|
280
262
|
|
|
281
263
|
const items = await loadComposerItems('mention', '/repo');
|
|
282
|
-
expect(items.
|
|
264
|
+
expect(items[0].source).toBe('agent');
|
|
265
|
+
expect(items.at(-1)?.source).toBe('file');
|
|
266
|
+
expect(items.some((item) => item.source === 'harness')).toBe(true);
|
|
283
267
|
expect(requested).toContain('/api/fs/list?root=%2Frepo');
|
|
284
268
|
});
|
|
285
269
|
|
|
@@ -289,7 +273,9 @@ describe('loadComposerItems', () => {
|
|
|
289
273
|
: { body: { files: [{ name: 'a.ts', path: 'src/a.ts' }] } };
|
|
290
274
|
|
|
291
275
|
const items = await loadComposerItems('mention', '/repo', 's1', { includeAgents: false });
|
|
292
|
-
expect(items.
|
|
276
|
+
expect(items.at(-1)?.source).toBe('file');
|
|
277
|
+
expect(items.some((item) => item.source === 'harness')).toBe(true);
|
|
278
|
+
expect(items.some((item) => item.source === 'agent')).toBe(false);
|
|
293
279
|
// The agents request is skipped entirely, not fetched and filtered.
|
|
294
280
|
expect(requested.some((url) => url.includes('/api/settings/agents'))).toBe(false);
|
|
295
281
|
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import {
|
|
3
|
+
toAgentPickItems,
|
|
4
|
+
toFilePickItems,
|
|
5
|
+
toHarnessPickItems,
|
|
6
|
+
} from '@/shared/lib/chat/composer/client';
|
|
7
|
+
|
|
8
|
+
describe('pick item mapping', () => {
|
|
9
|
+
test('an agent becomes a bare @name token', () => {
|
|
10
|
+
const [item] = toAgentPickItems([
|
|
11
|
+
{ id: 'a1', name: 'sonic', description: 'fast', scope: 'user', systemPrompt: '' },
|
|
12
|
+
]);
|
|
13
|
+
expect(item).toMatchObject({
|
|
14
|
+
id: 'agent-sonic',
|
|
15
|
+
name: 'sonic',
|
|
16
|
+
kind: 'agent',
|
|
17
|
+
source: 'agent',
|
|
18
|
+
token: '@sonic',
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('a harness becomes a namespaced default-model token', () => {
|
|
23
|
+
const [item] = toHarnessPickItems().filter((entry) => entry.token === '@harness:claude');
|
|
24
|
+
expect(item).toMatchObject({
|
|
25
|
+
id: 'harness-claude',
|
|
26
|
+
kind: 'harness',
|
|
27
|
+
source: 'harness',
|
|
28
|
+
token: '@harness:claude',
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('a file is namespaced under file:, so a root-level name cannot shadow an agent', () => {
|
|
33
|
+
const [item] = toFilePickItems([{ name: 'sonic', path: 'sonic' }]);
|
|
34
|
+
expect(item.token).toBe('@file:sonic');
|
|
35
|
+
expect(item.path).toBe('sonic');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('a path with whitespace is quoted, so the token cannot end early', () => {
|
|
39
|
+
const [item] = toFilePickItems([{ name: 'my notes.md', path: 'docs/my notes.md' }]);
|
|
40
|
+
expect(item.token).toBe('@"file:docs/my notes.md"');
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -222,7 +222,7 @@ describe('useOmpPromptSender.sendNewPrompt — ordering', () => {
|
|
|
222
222
|
return false;
|
|
223
223
|
});
|
|
224
224
|
|
|
225
|
-
expect(result).toEqual({ sessionId: 'omp-5', model: null });
|
|
225
|
+
expect(result).toEqual({ ok: true, session: { sessionId: 'omp-5', model: null } });
|
|
226
226
|
expect(order).toEqual([NEW, 'goal:omp-5', '/api/agent/omp-5']);
|
|
227
227
|
expect(requests.length).toBe(2);
|
|
228
228
|
});
|
|
@@ -254,7 +254,7 @@ describe('useOmpPromptSender.sendNewPrompt', () => {
|
|
|
254
254
|
modes: { plan: true, goal: false },
|
|
255
255
|
});
|
|
256
256
|
|
|
257
|
-
expect(result).toEqual({ sessionId: 'omp-9', model: { provider: 'anthropic', modelId: 'claude' } });
|
|
257
|
+
expect(result).toEqual({ ok: true, session: { sessionId: 'omp-9', model: { provider: 'anthropic', modelId: 'claude' } } });
|
|
258
258
|
expect(requests[0].url).toBe(NEW);
|
|
259
259
|
expect(requests[0].body).toEqual({
|
|
260
260
|
type: 'ensure_session',
|
|
@@ -278,21 +278,21 @@ describe('useOmpPromptSender.sendNewPrompt', () => {
|
|
|
278
278
|
|
|
279
279
|
expect(requests[0].body).toEqual({ type: 'ensure_session', cwd: '/w' });
|
|
280
280
|
expect(requests[1].body).toEqual({ type: 'prompt', message: 'first' });
|
|
281
|
-
expect(result).toEqual({ sessionId: 'omp-1', model: null });
|
|
281
|
+
expect(result).toEqual({ ok: true, session: { sessionId: 'omp-1', model: null } });
|
|
282
282
|
});
|
|
283
283
|
|
|
284
|
-
test('a create failure returns
|
|
284
|
+
test('a create failure returns the server reason without connecting or prompting', async () => {
|
|
285
285
|
const requests = installFetch({ [NEW]: { status: 500, body: { error: 'no workspace' } } });
|
|
286
286
|
const probe = mountSender(null);
|
|
287
287
|
const result = await probe.sender().sendNewPrompt('first', '/w');
|
|
288
288
|
|
|
289
|
-
expect(result).
|
|
289
|
+
expect(result).toEqual({ ok: false, error: 'no workspace' });
|
|
290
290
|
expect(requests.length).toBe(1);
|
|
291
291
|
expect(probe.connected).toEqual([]);
|
|
292
292
|
expect(probe.state().error).toBe('no workspace');
|
|
293
293
|
});
|
|
294
294
|
|
|
295
|
-
test('a prompt failure returns
|
|
295
|
+
test('a prompt failure returns the reason even though the session was created', async () => {
|
|
296
296
|
const requests = installFetch({ [NEW]: { body: { success: true, sessionId: 'omp-3' } } });
|
|
297
297
|
let call = 0;
|
|
298
298
|
(globalThis as unknown as Record<string, unknown>).fetch = async (input: unknown, init?: { method?: string; body?: string }) => {
|
|
@@ -305,7 +305,7 @@ describe('useOmpPromptSender.sendNewPrompt', () => {
|
|
|
305
305
|
const probe = mountSender(null);
|
|
306
306
|
const result = await probe.sender().sendNewPrompt('first', '/w');
|
|
307
307
|
|
|
308
|
-
expect(result).
|
|
308
|
+
expect(result).toEqual({ ok: false, error: 'boom' });
|
|
309
309
|
expect(probe.connected).toEqual(['omp-3']);
|
|
310
310
|
expect(probe.state().isGenerating).toBe(false);
|
|
311
311
|
});
|
|
@@ -20,7 +20,7 @@ import { useCallback } from 'preact/hooks';
|
|
|
20
20
|
import type { Dispatch, SetStateAction } from 'preact/compat';
|
|
21
21
|
import { setSessionTitleHint } from '@/client/hooks/chat/omp/sidebar-overlay';
|
|
22
22
|
import { redirectToOwningInstance, type SessionOwnerConflict } from '@/client/hooks/chat/omp/owner-redirect';
|
|
23
|
-
import type { AgentImage, OmpAgentState, PromptDispatchResult, SpawnOptions,
|
|
23
|
+
import type { AgentImage, OmpAgentState, PromptDispatchResult, SpawnOptions, SpawnPromptResult } from '@/shared/types';
|
|
24
24
|
import type { ApprovalMode } from '@/shared/lib/omp/config/access-mode';
|
|
25
25
|
|
|
26
26
|
export interface OmpPromptSenderDeps {
|
|
@@ -49,7 +49,7 @@ export interface OmpPromptSender {
|
|
|
49
49
|
* the raw message after it would be a second turn asking the same thing.
|
|
50
50
|
*/
|
|
51
51
|
beforePrompt?: (sessionId: string) => Promise<boolean>,
|
|
52
|
-
) => Promise<
|
|
52
|
+
) => Promise<SpawnPromptResult>;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
@@ -114,16 +114,15 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
114
114
|
* the prompt through the existing session route so no agent events are
|
|
115
115
|
* missed. Model/thinking picks ride the ensure_session body so omp applies
|
|
116
116
|
* them BEFORE the first prompt (and their JSONL change entries are written
|
|
117
|
-
* up front, not after the run starts). Returns the
|
|
118
|
-
*
|
|
119
|
-
* session. */
|
|
117
|
+
* up front, not after the run starts). Returns the adopted session, or the
|
|
118
|
+
* server's refusal reason — the caller must report it, never simulate one. */
|
|
120
119
|
const sendNewPrompt = useCallback(async (
|
|
121
120
|
message: string,
|
|
122
121
|
cwd: string,
|
|
123
122
|
images?: AgentImage[],
|
|
124
123
|
composerOptions?: SpawnOptions,
|
|
125
124
|
beforePrompt?: (sessionId: string) => Promise<boolean>,
|
|
126
|
-
): Promise<
|
|
125
|
+
): Promise<SpawnPromptResult> => {
|
|
127
126
|
setState((prev) => ({ ...prev, isGenerating: true, error: null }));
|
|
128
127
|
// The real id does not exist until `ensure_session` answers, so the mark
|
|
129
128
|
// can only be armed past that point — the spawn itself is covered by the
|
|
@@ -151,10 +150,15 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
151
150
|
model?: { provider: string; modelId: string } | null;
|
|
152
151
|
harness?: string;
|
|
153
152
|
error?: string;
|
|
153
|
+
code?: string;
|
|
154
154
|
};
|
|
155
155
|
if (!created.ok || !createdBody.sessionId) {
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
const error = createdBody.error ?? `HTTP ${created.status}`;
|
|
157
|
+
setState((prev) => ({ ...prev, isGenerating: false, error }));
|
|
158
|
+
// The CODE travels: `mock_mode` is a "there is nothing to spawn here",
|
|
159
|
+
// which the caller answers with the simulated stream rather than an
|
|
160
|
+
// error the operator cannot act on.
|
|
161
|
+
return { ok: false, error, ...(createdBody.code ? { code: createdBody.code } : {}) };
|
|
158
162
|
}
|
|
159
163
|
sid = createdBody.sessionId;
|
|
160
164
|
connect(sid);
|
|
@@ -168,7 +172,10 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
168
172
|
// is what makes the order a fact rather than a race. An armed interview
|
|
169
173
|
// answers true: it already opened the turn, so this prompt is not sent.
|
|
170
174
|
if (beforePrompt && await beforePrompt(sid)) {
|
|
171
|
-
return {
|
|
175
|
+
return {
|
|
176
|
+
ok: true,
|
|
177
|
+
session: { sessionId: sid, model: createdBody.model ?? null, ...(createdBody.harness ? { harness: createdBody.harness } : {}) },
|
|
178
|
+
};
|
|
172
179
|
}
|
|
173
180
|
const res = await fetch(`/api/agent/${encodeURIComponent(sid)}`, {
|
|
174
181
|
method: 'POST',
|
|
@@ -181,13 +188,18 @@ export function useOmpPromptSender(deps: OmpPromptSenderDeps): OmpPromptSender {
|
|
|
181
188
|
});
|
|
182
189
|
const body = (await res.json().catch(() => ({}))) as { success?: boolean; error?: string };
|
|
183
190
|
if (!res.ok || body.error) {
|
|
184
|
-
|
|
185
|
-
|
|
191
|
+
const error = body.error ?? `HTTP ${res.status}`;
|
|
192
|
+
setState((prev) => ({ ...prev, isGenerating: false, error }));
|
|
193
|
+
return { ok: false, error };
|
|
186
194
|
}
|
|
187
|
-
return {
|
|
195
|
+
return {
|
|
196
|
+
ok: true,
|
|
197
|
+
session: { sessionId: sid, model: createdBody.model ?? null, ...(createdBody.harness ? { harness: createdBody.harness } : {}) },
|
|
198
|
+
};
|
|
188
199
|
} catch (e) {
|
|
189
|
-
|
|
190
|
-
|
|
200
|
+
const error = e instanceof Error ? e.message : String(e);
|
|
201
|
+
setState((prev) => ({ ...prev, isGenerating: false, error }));
|
|
202
|
+
return { ok: false, error };
|
|
191
203
|
}
|
|
192
204
|
}, [connect, setState]);
|
|
193
205
|
|
|
@@ -58,7 +58,7 @@ export interface ChatTimelineActionsDeps {
|
|
|
58
58
|
/** Server-backed per-item queue ops (append/remove/reorder). */
|
|
59
59
|
enqueueMessage: (item: Omit<QueuedMessage, 'id'>) => void;
|
|
60
60
|
removeMessage: (id: string) => void;
|
|
61
|
-
executeSend: (text: string, attachments: Attachment[], options?: { model?: QueuedMessageModel | null }) => Promise<PromptDispatchResult>;
|
|
61
|
+
executeSend: (text: string, attachments: Attachment[], options?: { model?: QueuedMessageModel | null; harness?: string | null }) => Promise<PromptDispatchResult>;
|
|
62
62
|
steerOmpAgent: (text: string, attachments: Attachment[]) => Promise<PromptDispatchResult>;
|
|
63
63
|
ompAgent: OmpAgentHandle;
|
|
64
64
|
abortControllerRef: { current: AbortController | null };
|
|
@@ -113,7 +113,7 @@ export interface ChatTimelineActionsResult {
|
|
|
113
113
|
handleSendNowQueueItem: (item: QueuedMessage) => Promise<void>;
|
|
114
114
|
handleUndo: (msgId: string, content?: string) => Promise<boolean>;
|
|
115
115
|
handleRetry: (msgId: string) => void;
|
|
116
|
-
submitNewChat: (text: string, attachments: Attachment[]) => void;
|
|
116
|
+
submitNewChat: (text: string, attachments: Attachment[], harness?: string) => void;
|
|
117
117
|
/** Stop the active run; returns the number of queue items held back. */
|
|
118
118
|
stopGenerating: () => number;
|
|
119
119
|
handleThinkingLevelChange: (level: string) => void;
|
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
import { createContext, useContext } from 'preact/compat';
|
|
43
43
|
import type { ChatMessageData } from '@/shared/types';
|
|
44
44
|
import type { ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
45
|
-
import { groupAskFrames, isAskSettled, isAskToolCall, normalizeAskText, parseAskQuestions
|
|
45
|
+
import { askQuestionForTitle, groupAskFrames, isAskSettled, isAskToolCall, normalizeAskText, parseAskQuestions } from '@/shared/lib/chat/ask-questions';
|
|
46
|
+
import { parseAskResult } from '@/shared/lib/chat/ask-results';
|
|
47
|
+
import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
|
|
46
48
|
import { isApprovalGateFrame } from '@/shared/lib/chat/omp/approval-gate';
|
|
47
49
|
import type { ExtensionDialogResponse } from '@/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Lazy';
|
|
48
50
|
|
|
@@ -165,15 +167,14 @@ export function splitAskFrames(
|
|
|
165
167
|
continue;
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
const title = typeof request.title === 'string' ? normalizeAskText(request.title) : '';
|
|
169
170
|
let owner: string | null = null;
|
|
170
|
-
if (title) {
|
|
171
|
+
if (typeof request.title === 'string' && request.title) {
|
|
171
172
|
// Newest first: omp asks one question at a time and blocks on it, so when
|
|
172
173
|
// two live calls name the same question the later one is the one in
|
|
173
174
|
// flight.
|
|
174
175
|
for (let index = openAsks.length - 1; index >= 0; index -= 1) {
|
|
175
176
|
const candidate = openAsks[index];
|
|
176
|
-
if (candidate.questions
|
|
177
|
+
if (askQuestionForTitle(candidate.questions, request.title) !== -1) {
|
|
177
178
|
owner = candidate.toolId;
|
|
178
179
|
break;
|
|
179
180
|
}
|