@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
|
@@ -12,9 +12,13 @@ import { useKabmoEvent } from '@/client/hooks/ui/window-event';
|
|
|
12
12
|
import { useHarnesses } from '@/client/hooks/models/use-harnesses';
|
|
13
13
|
import { HarnessTable, harnessCategoryFor } from '@/client/components/layout/session-sidebar/about-modal/HarnessTable';
|
|
14
14
|
import { useHarnessVersions } from '@/client/hooks/models/use-harness-versions';
|
|
15
|
+
import { useHarnessUpdate } from '@/client/hooks/models/use-harness-update';
|
|
16
|
+
import { UpdateLogDialog } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogDialog';
|
|
15
17
|
import { useDialogBehaviour } from '@/client/hooks/ui/dialog-behaviour';
|
|
16
18
|
import { UPDATE_POPUP_OPEN_EVENT } from '@/shared/lib/updates/popup-state';
|
|
17
19
|
import type { UpdateTarget } from '@/shared/types/updates';
|
|
20
|
+
import { MAX_WIDTH as CARD_MAX_WIDTH } from '@/client/components/workspace/model-dropdown/popover-metrics';
|
|
21
|
+
import { safeAreaPadding } from '@/shared/lib/ui/safe-area';
|
|
18
22
|
|
|
19
23
|
export interface AboutModalProps {
|
|
20
24
|
isOpen: boolean;
|
|
@@ -27,6 +31,9 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
27
31
|
// Which product's "what am I running" notes are open. The dialog draws above
|
|
28
32
|
// this panel instead of replacing it, so closing it returns here.
|
|
29
33
|
const [notesTarget, setNotesTarget] = useState<UpdateTarget | null>(null);
|
|
34
|
+
// The update log panel. It is a boolean and not a harness id: one update runs
|
|
35
|
+
// at a time, and the record the hook holds IS the one that was opened.
|
|
36
|
+
const [logOpen, setLogOpen] = useState(false);
|
|
30
37
|
// The About sheet is a dialog to assistive tech and to the keyboard. It had
|
|
31
38
|
// neither: measured in the running console it carried no `role`, no
|
|
32
39
|
// `aria-modal`, and Escape did nothing while focus sat inside it.
|
|
@@ -36,39 +43,20 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
36
43
|
// made in either appears here without a reload.
|
|
37
44
|
const { harnesses, isLoading: harnessesLoading } = useHarnesses();
|
|
38
45
|
const versions = useHarnessVersions();
|
|
39
|
-
// Which harness is mid-update
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!response.ok) {
|
|
54
|
-
return payload.error ?? `Update failed (HTTP ${response.status})`;
|
|
55
|
-
}
|
|
56
|
-
// The version the agent reports only changes after a restart, so the row is
|
|
57
|
-
// refreshed rather than optimistic: it will read the OLD number until the
|
|
58
|
-
// agent is probed again, and saying otherwise would be a claim Kabmo cannot
|
|
59
|
-
// stand behind.
|
|
60
|
-
// `refresh`, not `reload(false)`: the rows must be re-read, but forcing a
|
|
61
|
-
// registry request per npm harness after every update is a cost with no
|
|
62
|
-
// answer — the number this update just installed IS the latest one.
|
|
63
|
-
versions.refresh();
|
|
64
|
-
onToast?.(payload.message ?? 'Update finished', 'success');
|
|
65
|
-
return null;
|
|
66
|
-
} catch (cause) {
|
|
67
|
-
return cause instanceof Error ? cause.message : 'Update failed';
|
|
68
|
-
} finally {
|
|
69
|
-
setUpdating(null);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
46
|
+
// Which harness is mid-update, and the step it is on. The run is a BACKGROUND
|
|
47
|
+
// worker, so this hook also ADOPTS a run that is still going when the card
|
|
48
|
+
// opens — a reload no longer loses the update's state.
|
|
49
|
+
const update = useHarnessUpdate(
|
|
50
|
+
(message, ok) => {
|
|
51
|
+
// The hook re-reads the version rows itself once a run settles (the update
|
|
52
|
+
// forgot the cached probe), so what is left here is telling the user what
|
|
53
|
+
// happened. The row will still read the OLD number until the agent is
|
|
54
|
+
// probed again, and saying otherwise would be a claim Kabmo cannot stand
|
|
55
|
+
// behind.
|
|
56
|
+
onToast?.(message, ok ? 'success' : 'error');
|
|
57
|
+
},
|
|
58
|
+
{ enabled: isOpen },
|
|
59
|
+
);
|
|
72
60
|
|
|
73
61
|
// "What's new" opens the popup, which draws at a higher layer: leaving this
|
|
74
62
|
// dialog mounted would stack two modals over the same subject, and its
|
|
@@ -89,15 +77,20 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
89
77
|
// closed, and was invisible.
|
|
90
78
|
return createPortal(
|
|
91
79
|
<>
|
|
92
|
-
{/*
|
|
93
|
-
|
|
80
|
+
{/* ONE centered card at both sizes, sized like the composer's model
|
|
81
|
+
picker: the phone gets its own width cap (the popover's 512px) instead
|
|
82
|
+
of the whole screen, and the card is as TALL as its content up to the
|
|
83
|
+
space the safe area leaves — so nothing hides under the status bar or
|
|
84
|
+
the home indicator, and a short card never asks for a scroll.
|
|
94
85
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
Full-bleed on a phone was the bug: `h-full w-full` with no gutters put
|
|
87
|
+
the header at the viewport's top edge, which a `viewport-fit: cover`
|
|
88
|
+
surface draws UNDER the phone's status bar. The scrim's padding is
|
|
89
|
+
`safeAreaPadding` — one rule, shared with the `Modal` shell. The
|
|
90
|
+
desktop keeps its FIXED 880px two-column card. */}
|
|
99
91
|
<div
|
|
100
|
-
className="fixed inset-0 modal-scrim z-50 flex items-
|
|
92
|
+
className="fixed inset-0 modal-scrim z-50 flex items-center justify-center md:backdrop-blur-[2px] animate-in fade-in duration-200"
|
|
93
|
+
style={safeAreaPadding()}
|
|
101
94
|
onClick={onClose}
|
|
102
95
|
>
|
|
103
96
|
<div
|
|
@@ -110,7 +103,12 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
110
103
|
// when auto, so narrowing any one column shrank the whole dialog
|
|
111
104
|
// (measured when the action column went to an icon). 880px is what the
|
|
112
105
|
// two-column table needs with room for the widest agent name.
|
|
113
|
-
|
|
106
|
+
//
|
|
107
|
+
// The phone cap is the MODEL PICKER's own width (`MAX_WIDTH`), so the
|
|
108
|
+
// console's two floating cards are one size class; `min(…, 100%)` keeps
|
|
109
|
+
// a 320px phone from overflowing the backdrop padding.
|
|
110
|
+
className="glass-overlay relative flex max-h-full w-full max-w-[var(--about-card-max)] flex-col overflow-hidden rounded-2xl border border-ink/15 bg-paper text-ink shadow-2xl select-none md:w-[880px] md:max-w-[calc(100vw-3rem)] md:max-h-[92vh]"
|
|
111
|
+
style={{ '--about-card-max': `min(${CARD_MAX_WIDTH}px, 100%)` }}
|
|
114
112
|
onClick={(e) => e.stopPropagation()}
|
|
115
113
|
>
|
|
116
114
|
{/* Close Button */}
|
|
@@ -122,9 +120,13 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
122
120
|
<X size={18} className="stroke-[2.5]" />
|
|
123
121
|
</button>
|
|
124
122
|
|
|
125
|
-
{/* ONE scroller
|
|
126
|
-
to
|
|
127
|
-
|
|
123
|
+
{/* ONE scroller for the WHOLE card, at both sizes: the harness table
|
|
124
|
+
used to cap itself at `46vh` and scroll on a phone while the card
|
|
125
|
+
still had most of the screen empty below it. The body is the only
|
|
126
|
+
place a scroll can happen now, and only when the content genuinely
|
|
127
|
+
outgrows the card. On a desktop the card sizes itself to the content
|
|
128
|
+
instead of asking the reader to scroll a dialog. */}
|
|
129
|
+
<div className="min-h-0 flex-1 scrollbar-overlay-container overflow-y-auto p-5 md:flex-none md:overflow-visible md:p-6">
|
|
128
130
|
<header className="flex items-center gap-3 pr-10">
|
|
129
131
|
<img src="/icon.svg" alt="Kabmo" width={44} height={44} draggable={false} />
|
|
130
132
|
<div className="min-w-0">
|
|
@@ -159,8 +161,11 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
159
161
|
harnesses={harnesses}
|
|
160
162
|
versions={versions.rows}
|
|
161
163
|
loading={harnessesLoading}
|
|
162
|
-
onUpdate={
|
|
163
|
-
updating={updating}
|
|
164
|
+
onUpdate={update.start}
|
|
165
|
+
updating={update.updating}
|
|
166
|
+
progress={update.progress}
|
|
167
|
+
log={update.job ? { harness: update.job.harness, message: update.job.message } : null}
|
|
168
|
+
onOpenLog={() => setLogOpen(true)}
|
|
164
169
|
onOpenHarness={(id) => {
|
|
165
170
|
onClose();
|
|
166
171
|
// The settings modal is the frame that owns harness pages; the
|
|
@@ -196,6 +201,10 @@ export function AboutModal({ isOpen, onClose, updates, onToast }: AboutModalProp
|
|
|
196
201
|
{/* Sibling of the About backdrop, not a child: an event inside the portal
|
|
197
202
|
would otherwise bubble to that backdrop's `onClick` and close About. */}
|
|
198
203
|
{notesTarget && <NotesDialog target={notesTarget} onClose={() => setNotesTarget(null)} />}
|
|
204
|
+
{/* The log draws ABOVE About and does not replace it — the card it was
|
|
205
|
+
opened from keeps its glanceable state. It is not gated on a run being
|
|
206
|
+
in flight: a finished (or failed) record is what a reader came for. */}
|
|
207
|
+
{logOpen && update.job && <UpdateLogDialog job={update.job} onClose={() => setLogOpen(false)} />}
|
|
199
208
|
</>,
|
|
200
209
|
document.body,
|
|
201
210
|
);
|
|
@@ -32,9 +32,12 @@ import { useShowMore } from '@/client/hooks/ui/show-more';
|
|
|
32
32
|
import { useWorkspaceFolderActions } from '@/client/hooks/workspace/workspace-folder-actions';
|
|
33
33
|
import { useSessionDelete } from '@/client/hooks/workspace/session-delete';
|
|
34
34
|
import { useExpandedSessions } from '@/client/hooks/workspace/expanded-sessions';
|
|
35
|
+
import { useChildExpansion } from '@/client/hooks/workspace/child-expansion';
|
|
35
36
|
import { useSidebarData } from '@/client/hooks/chat/omp/session-list';
|
|
36
37
|
import { SessionRow, type SessionRowDensity } from '@/client/components/common/session-row';
|
|
37
38
|
import { SubagentList } from '@/client/components/common/subagent-list';
|
|
39
|
+
import { ChildSessionList } from '@/client/components/layout/session-sidebar/ChildSessionList';
|
|
40
|
+
import { buildSessionTree } from '@/client/lib/session-tree';
|
|
38
41
|
import { SessionDeleteModal } from '@/client/components/common/session-delete-modal';
|
|
39
42
|
import { WorkspaceOptionsMenu } from '@/client/components/common/workspace-options-menu';
|
|
40
43
|
import { NewWorktreeModal } from '@/client/components/workspace/worktree-modal/index';
|
|
@@ -86,6 +89,7 @@ export function WorkspaceSection({
|
|
|
86
89
|
const urlSubagentId = searchParams.get('subagent');
|
|
87
90
|
const urlSessionId = searchParams.get('sessionId');
|
|
88
91
|
const { expandedSessionIds, toggleSession } = useExpandedSessions();
|
|
92
|
+
const { expandedChildIds, toggleChild } = useChildExpansion();
|
|
89
93
|
const { refresh } = useSidebarData();
|
|
90
94
|
const toggleFetcher = useFetcher<{ success?: boolean }>();
|
|
91
95
|
const {
|
|
@@ -146,6 +150,7 @@ export function WorkspaceSection({
|
|
|
146
150
|
activeSessionId,
|
|
147
151
|
sessionStatus,
|
|
148
152
|
});
|
|
153
|
+
const tree = buildSessionTree(rendered);
|
|
149
154
|
|
|
150
155
|
// A session selection opens every workspace: a checkbox on a collapsed folder
|
|
151
156
|
// would let the user select rows they cannot see or unselect.
|
|
@@ -220,7 +225,7 @@ export function WorkspaceSection({
|
|
|
220
225
|
|
|
221
226
|
{listOpen && (
|
|
222
227
|
<div className="space-y-0.5">
|
|
223
|
-
{
|
|
228
|
+
{tree.roots.map((session) => {
|
|
224
229
|
const key = String(session.id);
|
|
225
230
|
const isActive = activeSessionId !== null
|
|
226
231
|
? String(activeSessionId) === key
|
|
@@ -228,8 +233,10 @@ export function WorkspaceSection({
|
|
|
228
233
|
// While one of its subagents is being viewed, the parent row dims so
|
|
229
234
|
// the highlighted roster entry reads as the active one.
|
|
230
235
|
const viewingSubagent = isActive && urlSessionId === key && Boolean(urlSubagentId);
|
|
236
|
+
const hasChildren = (tree.childrenOf.get(key)?.length ?? 0) > 0;
|
|
231
237
|
const hasSubagents = Boolean(session.hasSubagents);
|
|
232
|
-
const
|
|
238
|
+
const childrenExpanded = hasChildren && expandedChildIds.has(key);
|
|
239
|
+
const rosterExpanded = hasSubagents && expandedSessionIds.has(key);
|
|
233
240
|
const pending = key.startsWith('new-');
|
|
234
241
|
|
|
235
242
|
return (
|
|
@@ -246,9 +253,12 @@ export function WorkspaceSection({
|
|
|
246
253
|
timeAgo={relativeTimeAgo(session.updated_at ?? session.created_at)}
|
|
247
254
|
worktree={session.worktree}
|
|
248
255
|
waitingFor={session.waitingFor ? { title: session.waitingFor.title } : undefined}
|
|
256
|
+
expandable={hasChildren}
|
|
257
|
+
isExpanded={childrenExpanded}
|
|
258
|
+
onToggleExpand={() => toggleChild(key)}
|
|
249
259
|
hasSubagents={hasSubagents}
|
|
250
|
-
|
|
251
|
-
|
|
260
|
+
subagentsExpanded={rosterExpanded}
|
|
261
|
+
onToggleSubagents={() => toggleSession(key)}
|
|
252
262
|
onClick={() => onSelectSession(session.id)}
|
|
253
263
|
onArchive={() => handleArchive(session)}
|
|
254
264
|
// A pending `new-…` chat has no transcript anywhere yet, so
|
|
@@ -263,7 +273,10 @@ export function WorkspaceSection({
|
|
|
263
273
|
selected={Boolean(batch?.selected.includes(key))}
|
|
264
274
|
onToggleSelect={batch ? () => batch.toggle(key) : undefined}
|
|
265
275
|
/>
|
|
266
|
-
{
|
|
276
|
+
{childrenExpanded && (
|
|
277
|
+
<ChildSessionList parentId={key} childrenOf={tree.childrenOf} onSelect={onSelectSession} />
|
|
278
|
+
)}
|
|
279
|
+
{rosterExpanded && (
|
|
267
280
|
<SubagentList
|
|
268
281
|
sessionId={session.id}
|
|
269
282
|
isActiveSession={activeSessionId !== null && key === String(activeSessionId)}
|
|
@@ -3,9 +3,12 @@ import { FolderItemMenu } from '@/client/components/mobile/mobile-session-sideba
|
|
|
3
3
|
import { useSearchParams } from '@/client/lib/router/search-params';
|
|
4
4
|
import { MobileSessionRow } from '@/client/components/mobile/mobile-session-sidebar/SessionRow';
|
|
5
5
|
import { SubagentList } from '@/client/components/common/subagent-list';
|
|
6
|
+
import { ChildSessionList } from '@/client/components/layout/session-sidebar/ChildSessionList';
|
|
7
|
+
import { buildSessionTree } from '@/client/lib/session-tree';
|
|
6
8
|
import { useWorktreeDialog } from '@/client/components/mobile/mobile-session-sidebar/WorktreeDialog';
|
|
7
9
|
import { useShowMore } from '@/client/hooks/ui/show-more';
|
|
8
10
|
import { useExpandedSessions } from '@/client/hooks/workspace/expanded-sessions';
|
|
11
|
+
import { useChildExpansion } from '@/client/hooks/workspace/child-expansion';
|
|
9
12
|
import { useWorkspaceFolderActions } from '@/client/hooks/workspace/workspace-folder-actions';
|
|
10
13
|
import { useSessionDelete } from '@/client/hooks/workspace/session-delete';
|
|
11
14
|
import { SessionDeleteModal } from '@/client/components/common/session-delete-modal';
|
|
@@ -62,6 +65,7 @@ export function MobileSessionCategory({
|
|
|
62
65
|
);
|
|
63
66
|
const { refresh } = useSidebarData();
|
|
64
67
|
const { expandedSessionIds, toggleSession } = useExpandedSessions();
|
|
68
|
+
const { expandedChildIds, toggleChild } = useChildExpansion();
|
|
65
69
|
// The viewed transcript, so its session row dims while a roster entry is
|
|
66
70
|
// open (desktop parity — same params, same rule).
|
|
67
71
|
const [searchParams] = useSearchParams();
|
|
@@ -112,6 +116,7 @@ export function MobileSessionCategory({
|
|
|
112
116
|
activeSessionId,
|
|
113
117
|
sessionStatus,
|
|
114
118
|
});
|
|
119
|
+
const tree = buildSessionTree(visibleSessions);
|
|
115
120
|
const listOpen = isExpanded || sessionCheckboxes;
|
|
116
121
|
|
|
117
122
|
return (
|
|
@@ -224,7 +229,7 @@ export function MobileSessionCategory({
|
|
|
224
229
|
|
|
225
230
|
{listOpen && (
|
|
226
231
|
<div className="mt-0.5 space-y-0.5">
|
|
227
|
-
{
|
|
232
|
+
{tree.roots.map((session) => {
|
|
228
233
|
const sessionKey = String(session.id);
|
|
229
234
|
const isSessionActive = String(activeSessionId) === sessionKey;
|
|
230
235
|
// While one of its subagents is being viewed, the parent session
|
|
@@ -233,9 +238,11 @@ export function MobileSessionCategory({
|
|
|
233
238
|
const isViewingSubagent = isSessionActive && urlSessionId === sessionKey && Boolean(urlSubagentId);
|
|
234
239
|
// Same gate as desktop: the omp-side loader flag is authoritative,
|
|
235
240
|
// so a session whose roster exists on disk can be opened without a
|
|
236
|
-
// live process.
|
|
241
|
+
// live process. Children are a separate, tree-level disclosure.
|
|
237
242
|
const hasSubagents = Boolean(session.hasSubagents);
|
|
243
|
+
const hasChildren = (tree.childrenOf.get(sessionKey)?.length ?? 0) > 0;
|
|
238
244
|
const isRosterOpen = hasSubagents && expandedSessionIds.has(sessionKey);
|
|
245
|
+
const childrenOpen = hasChildren && expandedChildIds.has(sessionKey);
|
|
239
246
|
|
|
240
247
|
return (
|
|
241
248
|
<div key={session.id} className="space-y-0.5">
|
|
@@ -247,8 +254,11 @@ export function MobileSessionCategory({
|
|
|
247
254
|
awaitingInput={Boolean(session.awaitingInput)}
|
|
248
255
|
timeAgo={relativeTimeAgo(session.updated_at ?? session.created_at)}
|
|
249
256
|
hasSubagents={hasSubagents}
|
|
250
|
-
|
|
251
|
-
|
|
257
|
+
subagentsExpanded={isRosterOpen}
|
|
258
|
+
onToggleSubagents={() => toggleSession(sessionKey)}
|
|
259
|
+
expandable={hasChildren}
|
|
260
|
+
isExpanded={childrenOpen}
|
|
261
|
+
onToggleExpand={() => toggleChild(sessionKey)}
|
|
252
262
|
onSelect={() => onSelectSession(session.id)}
|
|
253
263
|
onArchive={() => handleArchive(session)}
|
|
254
264
|
onDelete={
|
|
@@ -272,6 +282,13 @@ export function MobileSessionCategory({
|
|
|
272
282
|
selected={Boolean(batch?.selected.includes(sessionKey))}
|
|
273
283
|
onToggleSelect={batch ? () => batch.toggle(sessionKey) : undefined}
|
|
274
284
|
/>
|
|
285
|
+
{childrenOpen && (
|
|
286
|
+
<ChildSessionList
|
|
287
|
+
parentId={sessionKey}
|
|
288
|
+
childrenOf={tree.childrenOf}
|
|
289
|
+
onSelect={onSelectSession}
|
|
290
|
+
/>
|
|
291
|
+
)}
|
|
275
292
|
{isRosterOpen && (
|
|
276
293
|
<SubagentList sessionId={session.id} isActiveSession={isSessionActive} />
|
|
277
294
|
)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Check, ChevronDown, ChevronRight, CircleQuestionMark, Hourglass, Loader2, MoreHorizontal } from 'lucide-preact';
|
|
1
|
+
import { Boxes, Check, ChevronDown, ChevronRight, CircleQuestionMark, Hourglass, Loader2, MoreHorizontal } from 'lucide-preact';
|
|
2
2
|
import type { SessionItemData } from '@/shared/types';
|
|
3
3
|
import { useInlineRename } from '@/client/hooks/ui/inline-rename';
|
|
4
4
|
import { useSessionRenaming } from '@/client/hooks/workspace/renaming-sessions';
|
|
@@ -18,8 +18,12 @@ export interface MobileSessionRowProps {
|
|
|
18
18
|
awaitingInput?: boolean;
|
|
19
19
|
/** Relative age of the session, or null when no usable timestamp exists. */
|
|
20
20
|
timeAgo: string | null;
|
|
21
|
-
/** The session has a subagent roster (on disk or live)
|
|
21
|
+
/** The session has a subagent roster (on disk or live). */
|
|
22
22
|
hasSubagents?: boolean;
|
|
23
|
+
subagentsExpanded?: boolean;
|
|
24
|
+
onToggleSubagents?: () => void;
|
|
25
|
+
/** The session has child sessions, so it can be expanded as a tree. */
|
|
26
|
+
expandable?: boolean;
|
|
23
27
|
isExpanded?: boolean;
|
|
24
28
|
onToggleExpand?: () => void;
|
|
25
29
|
onSelect: () => void;
|
|
@@ -51,6 +55,9 @@ export function MobileSessionRow({
|
|
|
51
55
|
awaitingInput = false,
|
|
52
56
|
timeAgo,
|
|
53
57
|
hasSubagents = false,
|
|
58
|
+
subagentsExpanded = false,
|
|
59
|
+
onToggleSubagents,
|
|
60
|
+
expandable = false,
|
|
54
61
|
isExpanded = false,
|
|
55
62
|
onToggleExpand,
|
|
56
63
|
onSelect,
|
|
@@ -90,7 +97,7 @@ export function MobileSessionRow({
|
|
|
90
97
|
// Touch has no hover to reveal a hidden toggle the way desktop does, so it is
|
|
91
98
|
// pinned whenever the row has a roster; a hidden one would leave the roster
|
|
92
99
|
// unreachable on a phone.
|
|
93
|
-
const showChevron =
|
|
100
|
+
const showChevron = expandable && Boolean(onToggleExpand);
|
|
94
101
|
const title = session.title.charAt(0).toUpperCase() + session.title.slice(1);
|
|
95
102
|
|
|
96
103
|
if (isEditing) {
|
|
@@ -223,15 +230,29 @@ export function MobileSessionRow({
|
|
|
223
230
|
</button>
|
|
224
231
|
)}
|
|
225
232
|
|
|
233
|
+
{/* The roster badge is a separate control from the tree chevron. */}
|
|
234
|
+
{hasSubagents && onToggleSubagents && !selectable && (
|
|
235
|
+
<button
|
|
236
|
+
type="button"
|
|
237
|
+
onClick={onToggleSubagents}
|
|
238
|
+
title="Subagents (tool calls)"
|
|
239
|
+
aria-label="Subagents"
|
|
240
|
+
aria-expanded={subagentsExpanded}
|
|
241
|
+
className="flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/40 hover:text-ink rounded-lg cursor-pointer"
|
|
242
|
+
>
|
|
243
|
+
<Boxes size={15} />
|
|
244
|
+
</button>
|
|
245
|
+
)}
|
|
246
|
+
|
|
226
247
|
{/* Last element, so its glyph shares the trigger's column — the same
|
|
227
248
|
inset pair and the same 4px ink margin. */}
|
|
228
249
|
{showChevron && !selectable && (
|
|
229
250
|
<button
|
|
230
251
|
type="button"
|
|
231
252
|
onClick={onToggleExpand}
|
|
232
|
-
title={isExpanded ? 'Collapse
|
|
253
|
+
title={isExpanded ? 'Collapse child sessions' : 'Expand child sessions'}
|
|
233
254
|
aria-expanded={isExpanded}
|
|
234
|
-
aria-label={isExpanded ? 'Collapse
|
|
255
|
+
aria-label={isExpanded ? 'Collapse child sessions' : 'Expand child sessions'}
|
|
235
256
|
className="flex-shrink-0 py-1.5 pl-1.5 pr-1 flex items-center justify-center text-ink/50 hover:text-ink rounded-lg cursor-pointer"
|
|
236
257
|
>
|
|
237
258
|
{isExpanded ? <ChevronDown size={14} /> : <ChevronRight size={14} />}
|
|
@@ -242,6 +263,7 @@ export function MobileSessionRow({
|
|
|
242
263
|
{menu.anchor && (
|
|
243
264
|
<SessionActionsMenu
|
|
244
265
|
anchor={menu.anchor}
|
|
266
|
+
sessionId={session.id}
|
|
245
267
|
isArchived={session.is_archived === 1}
|
|
246
268
|
onRename={onRename ? startRename : undefined}
|
|
247
269
|
onRenameWithAi={onRenameWithAi}
|
|
@@ -29,12 +29,16 @@ export function EnvProviderForm({ support, onSave }: { support: HarnessProviderS
|
|
|
29
29
|
const [baseUrl, setBaseUrl] = useState('');
|
|
30
30
|
const [apiKey, setApiKey] = useState('');
|
|
31
31
|
const [model, setModel] = useState('');
|
|
32
|
+
/** One value per `ANTHROPIC_DEFAULT_*_MODEL`-style variable, keyed by name. */
|
|
33
|
+
const [aliases, setAliases] = useState<Record<string, string>>({});
|
|
32
34
|
const [saving, setSaving] = useState(false);
|
|
33
35
|
const [problem, setProblem] = useState<string | null>(null);
|
|
34
36
|
const env = support.env;
|
|
35
37
|
|
|
36
38
|
if (!env) return null;
|
|
37
39
|
|
|
40
|
+
const modelAliases = env.modelAliases ?? [];
|
|
41
|
+
|
|
38
42
|
const save = async () => {
|
|
39
43
|
setSaving(true);
|
|
40
44
|
try {
|
|
@@ -42,6 +46,10 @@ export function EnvProviderForm({ support, onSave }: { support: HarnessProviderS
|
|
|
42
46
|
baseUrl.trim() ? `${env.baseUrl}=${baseUrl.trim()}` : '',
|
|
43
47
|
apiKey.trim() ? `${env.apiKey}=${apiKey.trim()}` : '',
|
|
44
48
|
env.model && model.trim() ? `${env.model}=${model.trim()}` : '',
|
|
49
|
+
...modelAliases.map((alias) => {
|
|
50
|
+
const value = aliases[alias.env]?.trim();
|
|
51
|
+
return value ? `${alias.env}=${value}` : '';
|
|
52
|
+
}),
|
|
45
53
|
].filter(Boolean).join('\n');
|
|
46
54
|
// The ANSWER is what decides success. Reading the `problem` state here held
|
|
47
55
|
// the PREVIOUS save's value, so a successful save reported failure.
|
|
@@ -51,6 +59,7 @@ export function EnvProviderForm({ support, onSave }: { support: HarnessProviderS
|
|
|
51
59
|
setBaseUrl('');
|
|
52
60
|
setApiKey('');
|
|
53
61
|
setModel('');
|
|
62
|
+
setAliases({});
|
|
54
63
|
}
|
|
55
64
|
} finally {
|
|
56
65
|
setSaving(false);
|
|
@@ -100,6 +109,28 @@ export function EnvProviderForm({ support, onSave }: { support: HarnessProviderS
|
|
|
100
109
|
/>
|
|
101
110
|
</label>
|
|
102
111
|
)}
|
|
112
|
+
{modelAliases.length > 0 && (
|
|
113
|
+
<div className="space-y-1.5 rounded-md border border-ink/15 bg-ink/[0.03] p-2">
|
|
114
|
+
<div className="text-[10px] leading-relaxed text-ink/60">
|
|
115
|
+
Each picker alias resolves to a model id the vendor ships unless it is pinned here.
|
|
116
|
+
Leave an alias blank when the endpoint serves that family's vendor id; fill it when
|
|
117
|
+
the endpoint has its own ids — otherwise that pick sends
|
|
118
|
+
{' '}<span className="font-mono">400 model not found</span>.
|
|
119
|
+
</div>
|
|
120
|
+
{modelAliases.map((alias) => (
|
|
121
|
+
<label key={alias.env} className="flex flex-col gap-1">
|
|
122
|
+
<span className="font-mono text-[10px] text-ink/50">{alias.env}</span>
|
|
123
|
+
<input
|
|
124
|
+
type="text"
|
|
125
|
+
value={aliases[alias.env] ?? ''}
|
|
126
|
+
placeholder={`the endpoint's ${alias.family} model id`}
|
|
127
|
+
onInput={(e) => setAliases((prev) => ({ ...prev, [alias.env]: e.currentTarget.value }))}
|
|
128
|
+
className={INPUT_CLASS}
|
|
129
|
+
/>
|
|
130
|
+
</label>
|
|
131
|
+
))}
|
|
132
|
+
</div>
|
|
133
|
+
)}
|
|
103
134
|
|
|
104
135
|
<button
|
|
105
136
|
type="button"
|
|
@@ -197,6 +197,55 @@ describe('the env form', () => {
|
|
|
197
197
|
// was a JSX-precompile hazard, not a style choice.
|
|
198
198
|
expect(container.querySelector('input')?.getAttribute('class')).toContain('font-mono');
|
|
199
199
|
});
|
|
200
|
+
|
|
201
|
+
test('each alias field writes its own variable; a blank one writes nothing', async () => {
|
|
202
|
+
let saved = '';
|
|
203
|
+
render(
|
|
204
|
+
h(HarnessProviderPanel, {
|
|
205
|
+
support: support({
|
|
206
|
+
level: 'environment',
|
|
207
|
+
env: {
|
|
208
|
+
baseUrl: 'ANTHROPIC_BASE_URL',
|
|
209
|
+
apiKey: 'ANTHROPIC_AUTH_TOKEN',
|
|
210
|
+
model: 'ANTHROPIC_MODEL',
|
|
211
|
+
modelAliases: [
|
|
212
|
+
{ family: 'sonnet', env: 'ANTHROPIC_DEFAULT_SONNET_MODEL' },
|
|
213
|
+
{ family: 'haiku', env: 'ANTHROPIC_DEFAULT_HAIKU_MODEL' },
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
protocols: ['anthropic-messages'],
|
|
217
|
+
importable: [],
|
|
218
|
+
}),
|
|
219
|
+
onSaveEnv: async (env) => {
|
|
220
|
+
saved = env;
|
|
221
|
+
return null;
|
|
222
|
+
},
|
|
223
|
+
}),
|
|
224
|
+
container,
|
|
225
|
+
);
|
|
226
|
+
const inputs = [...container.querySelectorAll('input')] as HTMLInputElement[];
|
|
227
|
+
expect(inputs).toHaveLength(5);
|
|
228
|
+
await act(async () => {
|
|
229
|
+
const values = ['https://kenari.id', 'kn-key', 'qwen3-8-27b:free', 'claude-sonnet-5-5', ''];
|
|
230
|
+
inputs.forEach((input, index) => {
|
|
231
|
+
input.value = values[index]!;
|
|
232
|
+
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
const save = buttons().find((button) => button.textContent?.includes('Save to environment'))!;
|
|
236
|
+
await act(async () => {
|
|
237
|
+
save.click();
|
|
238
|
+
await Promise.resolve();
|
|
239
|
+
await Promise.resolve();
|
|
240
|
+
});
|
|
241
|
+
expect(saved).toBe([
|
|
242
|
+
'ANTHROPIC_BASE_URL=https://kenari.id',
|
|
243
|
+
'ANTHROPIC_AUTH_TOKEN=kn-key',
|
|
244
|
+
'ANTHROPIC_MODEL=qwen3-8-27b:free',
|
|
245
|
+
'ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-5-5',
|
|
246
|
+
].join('\n'));
|
|
247
|
+
expect([...container.querySelectorAll('input')].every((input) => input.value === '')).toBe(true);
|
|
248
|
+
});
|
|
200
249
|
});
|
|
201
250
|
|
|
202
251
|
describe('the add-provider form', () => {
|
|
@@ -34,8 +34,10 @@ export interface ChatOverlaysProps {
|
|
|
34
34
|
|
|
35
35
|
newChatInitialContent: string | null;
|
|
36
36
|
newChatInitialAttachments: Attachment[];
|
|
37
|
+
/** The source chat's harness, carried onto the new chat's spawn. */
|
|
38
|
+
newChatHarness?: string;
|
|
37
39
|
onCloseNewChat: () => void;
|
|
38
|
-
onSendNewChat: (content: string, attachments: Attachment[]) => void;
|
|
40
|
+
onSendNewChat: (content: string, attachments: Attachment[], harness?: string) => void;
|
|
39
41
|
appSettings: Record<string, unknown>;
|
|
40
42
|
accessMode: ApprovalMode;
|
|
41
43
|
onAccessModeChange: (mode: ApprovalMode) => void;
|
|
@@ -56,6 +58,7 @@ export function ChatOverlays({
|
|
|
56
58
|
isOmpSession,
|
|
57
59
|
newChatInitialContent,
|
|
58
60
|
newChatInitialAttachments,
|
|
61
|
+
newChatHarness,
|
|
59
62
|
onCloseNewChat,
|
|
60
63
|
onSendNewChat,
|
|
61
64
|
appSettings,
|
|
@@ -84,7 +87,7 @@ export function ChatOverlays({
|
|
|
84
87
|
initialContent={newChatInitialContent}
|
|
85
88
|
initialAttachments={newChatInitialAttachments}
|
|
86
89
|
onClose={onCloseNewChat}
|
|
87
|
-
onSend={onSendNewChat}
|
|
90
|
+
onSend={(content, attachments) => onSendNewChat(content, attachments, newChatHarness)}
|
|
88
91
|
appSettings={appSettings}
|
|
89
92
|
accessMode={accessMode}
|
|
90
93
|
onAccessModeChange={onAccessModeChange}
|