@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
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
import { useState } from 'preact/hooks';
|
|
32
32
|
import { Download, Loader2 } from 'lucide-preact';
|
|
33
33
|
import { HarnessGlyph, HARNESS_GLYPH_SIZE } from '@/client/components/common/harness-glyph';
|
|
34
|
+
import { UpdateLogLine } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogLine';
|
|
34
35
|
import { harnessStatus, type HarnessState } from '@/shared/lib/harness/status';
|
|
35
36
|
import { harnessCategoryId } from '@/shared/lib/harness/menu';
|
|
36
37
|
import type { HarnessSummary } from '@/shared/types/harness';
|
|
@@ -41,10 +42,23 @@ interface HarnessTableProps {
|
|
|
41
42
|
versions: HarnessVersionRow[];
|
|
42
43
|
loading?: boolean;
|
|
43
44
|
onOpenHarness: (id: string) => void;
|
|
44
|
-
/**
|
|
45
|
+
/** Starts one harness's update as a background job and follows it; resolves
|
|
46
|
+
* to a refusal (a busy server, an unknown harness), or null when it began. */
|
|
45
47
|
onUpdate: (id: string) => Promise<string | null>;
|
|
46
|
-
/** Which harness is mid-update
|
|
48
|
+
/** Which harness is mid-update, and the step it is on (an adapter install,
|
|
49
|
+
* `claude update`, …). The step comes from the background job's record. */
|
|
47
50
|
updating: string | null;
|
|
51
|
+
progress?: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* The last update record this card read, running OR finished.
|
|
54
|
+
*
|
|
55
|
+
* The run is a background worker, and its output lives in that record — so the
|
|
56
|
+
* row that owns it offers `View log` next to the spinner, and keeps offering it
|
|
57
|
+
* once the run has settled, because a failure is exactly when the output is
|
|
58
|
+
* worth reading.
|
|
59
|
+
*/
|
|
60
|
+
log?: { harness: string; message: string | null } | null;
|
|
61
|
+
onOpenLog?: () => void;
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
/** The state mark. Shape carries the state, so tone is reinforcement only. */
|
|
@@ -66,6 +80,11 @@ function StateMark({ state }: { state: HarnessState }) {
|
|
|
66
80
|
* - the VERSION column held `7.5rem` (120px), which clipped the widest thing
|
|
67
81
|
* it ever holds — an adapter's `adapter 0.100.0 → 0.101.0` line, measured at
|
|
68
82
|
* 151px in this face. It is `9.5rem` (152px), the content's own width.
|
|
83
|
+
* - on a PHONE it is `7rem`: the About card is 512px at most, and the 152px
|
|
84
|
+
* track left the agent's own name ~130px, so `command-code` and
|
|
85
|
+
* `deepseek-harness` were the cells that truncated while the name is the one
|
|
86
|
+
* thing a reader is scanning for. The version line ellipsizes instead, and
|
|
87
|
+
* carries its full text in `title`.
|
|
69
88
|
*
|
|
70
89
|
* It stays a FIXED track rather than `auto`: every row is its own grid, so an
|
|
71
90
|
* `auto` track is measured per row and the version numbers stop lining up in a
|
|
@@ -80,10 +99,11 @@ function StateMark({ state }: { state: HarnessState }) {
|
|
|
80
99
|
* `adapter …` line under it), and centering measured the number 7.5px BELOW the
|
|
81
100
|
* name it belongs to. Top-aligned, line one of every cell shares one baseline.
|
|
82
101
|
*/
|
|
83
|
-
const COLUMNS = 'grid grid-cols-[minmax(0,1fr)
|
|
102
|
+
const COLUMNS = 'grid grid-cols-[minmax(0,1fr)_7rem_1.75rem] items-start gap-x-2 md:grid-cols-[minmax(0,1fr)_9.5rem_1.75rem]';
|
|
84
103
|
|
|
85
104
|
export function HarnessTable({
|
|
86
|
-
harnesses, versions, loading = false, onOpenHarness, onUpdate, updating,
|
|
105
|
+
harnesses, versions, loading = false, onOpenHarness, onUpdate, updating, progress = null,
|
|
106
|
+
log = null, onOpenLog,
|
|
87
107
|
}: HarnessTableProps) {
|
|
88
108
|
const [problem, setProblem] = useState<{ id: string; message: string } | null>(null);
|
|
89
109
|
|
|
@@ -136,21 +156,35 @@ export function HarnessTable({
|
|
|
136
156
|
))}
|
|
137
157
|
</div>
|
|
138
158
|
) : (
|
|
139
|
-
//
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
|
|
159
|
+
// ONE list, no scroll cap of its own. It used to be `max-h-[46vh]
|
|
160
|
+
// overflow-y-auto` on a phone, which scroll-trapped fourteen rows inside
|
|
161
|
+
// a card that had most of the screen empty below them — two nested
|
|
162
|
+
// scrollers, and the inner one had no reason to exist. The About panel's
|
|
163
|
+
// own body is the single scroller now, so the list simply grows.
|
|
164
|
+
<div data-harness-rows="" className="grid grid-cols-1 gap-x-6 md:grid-cols-2">
|
|
143
165
|
{entries.map((entry) => {
|
|
144
166
|
const status = harnessStatus(entry);
|
|
145
167
|
const version = byId.get(entry.id);
|
|
146
168
|
const isUpdating = updating === entry.id;
|
|
169
|
+
// The row that owns the record gets the log line: while its worker
|
|
170
|
+
// runs, and after it settles so the output is not lost with it.
|
|
171
|
+
const showLogLine = isUpdating || log?.harness === entry.id;
|
|
147
172
|
// The number a reader calls "the version": the CLI when the harness is
|
|
148
173
|
// an adapter, otherwise the agent itself. Each part carries its own
|
|
149
174
|
// `latest` and its own ability to move, so the two are never compared
|
|
150
175
|
// across each other.
|
|
151
|
-
|
|
176
|
+
//
|
|
177
|
+
// A CLI part EXISTS for every adapter even when its `--version` could
|
|
178
|
+
// not be read (the binary is absent, or its launcher is broken). Taking
|
|
179
|
+
// that empty part as the lead painted `—` over a known adapter number:
|
|
180
|
+
// measured on `zcode` (adapter 0.82.3 probed, no `zcode` runtime) and
|
|
181
|
+
// `claude` (`claude --version` fails while the adapter answers). The
|
|
182
|
+
// part that HAS a number leads.
|
|
183
|
+
const cli = version?.cli ?? null;
|
|
184
|
+
const agent = version?.agent ?? null;
|
|
185
|
+
const lead = cli?.version ? cli : agent;
|
|
152
186
|
const showAdapterLine = Boolean(
|
|
153
|
-
|
|
187
|
+
cli?.version && agent?.version && agent.version !== cli.version,
|
|
154
188
|
);
|
|
155
189
|
// What the press would install, named: an adapter and a CLI are two
|
|
156
190
|
// different products, so the accessible name says which is moving.
|
|
@@ -165,6 +199,10 @@ export function HarnessTable({
|
|
|
165
199
|
].filter((target): target is string => Boolean(target))
|
|
166
200
|
: [];
|
|
167
201
|
const updateLabel = `Update ${entry.label}${targets.length > 0 ? ` to ${targets.join(' + ')}` : ''}`;
|
|
202
|
+
// While the background worker runs, the button names the STEP it is
|
|
203
|
+
// on: one press can be an adapter install and then `claude update`,
|
|
204
|
+
// and "Updating…" alone would hide which half is moving.
|
|
205
|
+
const actionLabel = isUpdating && progress ? `Updating ${entry.label}: ${progress}` : updateLabel;
|
|
168
206
|
return (
|
|
169
207
|
<div key={entry.id} className={`${COLUMNS} border-b border-ink/5 py-1.5`}>
|
|
170
208
|
{/* The name is the link: one target per row, and the row's other
|
|
@@ -262,8 +300,8 @@ export function HarnessTable({
|
|
|
262
300
|
type="button"
|
|
263
301
|
onClick={() => void runUpdate(entry.id)}
|
|
264
302
|
disabled={isUpdating}
|
|
265
|
-
aria-label={
|
|
266
|
-
title={
|
|
303
|
+
aria-label={actionLabel}
|
|
304
|
+
title={actionLabel}
|
|
267
305
|
className="inline-flex cursor-pointer items-center justify-center rounded border border-ink/25 p-1 text-ink transition-colors hover:border-ink/50 hover:bg-ink/5 disabled:cursor-not-allowed disabled:opacity-50"
|
|
268
306
|
>
|
|
269
307
|
{isUpdating
|
|
@@ -278,6 +316,15 @@ export function HarnessTable({
|
|
|
278
316
|
{problem?.id === entry.id && (
|
|
279
317
|
<span className="col-span-3 pb-1 text-[10px] text-ink/70">{problem.message}</span>
|
|
280
318
|
)}
|
|
319
|
+
|
|
320
|
+
{showLogLine && (
|
|
321
|
+
<UpdateLogLine
|
|
322
|
+
running={isUpdating}
|
|
323
|
+
progress={progress}
|
|
324
|
+
message={log?.message ?? null}
|
|
325
|
+
onOpenLog={onOpenLog}
|
|
326
|
+
/>
|
|
327
|
+
)}
|
|
281
328
|
</div>
|
|
282
329
|
);
|
|
283
330
|
})}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The row's link to its update log.
|
|
8
|
+
*
|
|
9
|
+
* A harness update runs in a background worker, so the row can only show *that*
|
|
10
|
+
* something is installing — never what it printed. That output lives in the
|
|
11
|
+
* job record, and these cases pin the row's half of the deal: while the worker
|
|
12
|
+
* runs the row names the step and offers `View log`; once it settles the row
|
|
13
|
+
* keeps offering the log with the run's own sentence, because a failure is
|
|
14
|
+
* exactly when the output is worth reading; and a record never leaks onto a row
|
|
15
|
+
* that does not own it.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
import { render } from 'preact';
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
harnessRows,
|
|
24
|
+
installHarnessTableDom,
|
|
25
|
+
mountHarnessTable,
|
|
26
|
+
restoreHarnessTableDom,
|
|
27
|
+
summary,
|
|
28
|
+
version,
|
|
29
|
+
} from '@/test-support/harness-table.test-util';
|
|
30
|
+
|
|
31
|
+
let container: HTMLElement;
|
|
32
|
+
|
|
33
|
+
beforeAll(() => {
|
|
34
|
+
installHarnessTableDom();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
container = document.createElement('div');
|
|
39
|
+
document.body.appendChild(container);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
render(null, container);
|
|
44
|
+
container.remove();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
afterAll(() => {
|
|
48
|
+
restoreHarnessTableDom();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/** The claude row, with an update record attached. */
|
|
52
|
+
function mountClaude(state: Parameters<typeof mountHarnessTable>[5]): HTMLElement {
|
|
53
|
+
return mountHarnessTable(
|
|
54
|
+
container,
|
|
55
|
+
[summary()],
|
|
56
|
+
[version({ updateAvailable: true, agent: { version: '0.100.0', latest: '0.102.0', updateAvailable: true } })],
|
|
57
|
+
undefined,
|
|
58
|
+
undefined,
|
|
59
|
+
state,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe('harness row update log', () => {
|
|
64
|
+
test('while the worker runs, the row names the step and offers the log', () => {
|
|
65
|
+
let opened = 0;
|
|
66
|
+
const el = mountClaude({
|
|
67
|
+
updating: 'claude',
|
|
68
|
+
progress: 'adapter',
|
|
69
|
+
log: { harness: 'claude', message: null },
|
|
70
|
+
onOpenLog: () => { opened += 1; },
|
|
71
|
+
});
|
|
72
|
+
const row = harnessRows(el)[0];
|
|
73
|
+
expect(row.textContent).toContain('Installing adapter…');
|
|
74
|
+
const log = row.querySelector<HTMLButtonElement>('[data-update-log]');
|
|
75
|
+
expect(log?.textContent).toBe('View log');
|
|
76
|
+
act(() => log!.click());
|
|
77
|
+
expect(opened).toBe(1);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
test('after the run settles the log stays, with the run’s sentence', () => {
|
|
81
|
+
const el = mountClaude({
|
|
82
|
+
log: { harness: 'claude', message: 'claude update failed (exit 3)' },
|
|
83
|
+
onOpenLog: () => {},
|
|
84
|
+
});
|
|
85
|
+
const row = harnessRows(el)[0];
|
|
86
|
+
expect(row.textContent).toContain('claude update failed (exit 3)');
|
|
87
|
+
expect(row.querySelector('[data-update-log]')).not.toBeNull();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('a record for another harness does not appear on this row', () => {
|
|
91
|
+
const el = mountClaude({ log: { harness: 'codex', message: 'codex updated' } });
|
|
92
|
+
expect(harnessRows(el)[0].querySelector('[data-update-log]')).toBeNull();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The panel a reader opens when a harness update is running (or just failed).
|
|
8
|
+
*
|
|
9
|
+
* The complaint it answers was concrete: press Update on `claude`, and the card
|
|
10
|
+
* showed a spinner with no way to see what the install was printing — so a
|
|
11
|
+
* failure said "update failed" with the reason already gone. These cases pin the
|
|
12
|
+
* three things the panel must state: every step and its command, the streamed
|
|
13
|
+
* output, and the finished run's own sentence.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
17
|
+
import { Window } from 'happy-dom';
|
|
18
|
+
import { render } from 'preact';
|
|
19
|
+
import { act } from 'preact/test-utils';
|
|
20
|
+
import { UpdateLogDialog } from '@/client/components/layout/session-sidebar/about-modal/UpdateLogDialog';
|
|
21
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
22
|
+
import type { HarnessUpdateJob } from '@/shared/types/harness-update';
|
|
23
|
+
|
|
24
|
+
beforeAll(() => {
|
|
25
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
afterAll(() => {
|
|
29
|
+
restoreDomGlobals();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
let container: HTMLElement | null = null;
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
if (container) act(() => render(null, container!));
|
|
36
|
+
container?.remove();
|
|
37
|
+
container = null;
|
|
38
|
+
for (const node of Array.from(document.body.children)) node.remove();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function job(overrides: Partial<HarnessUpdateJob> = {}): HarnessUpdateJob {
|
|
42
|
+
return {
|
|
43
|
+
harness: 'claude',
|
|
44
|
+
label: 'claude',
|
|
45
|
+
startedAt: Date.now(),
|
|
46
|
+
finishedAt: null,
|
|
47
|
+
pid: 4242,
|
|
48
|
+
steps: [
|
|
49
|
+
{
|
|
50
|
+
part: 'adapter',
|
|
51
|
+
command: 'npm install -g @agentclientprotocol/claude-agent-acp@0.102.0',
|
|
52
|
+
argv: ['npm', 'install', '-g', '@agentclientprotocol/claude-agent-acp@0.102.0'],
|
|
53
|
+
state: 'running',
|
|
54
|
+
code: null,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
output: '',
|
|
58
|
+
ok: null,
|
|
59
|
+
message: null,
|
|
60
|
+
applied: false,
|
|
61
|
+
repointed: null,
|
|
62
|
+
...overrides,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Mount the panel and hand back its dialog element. */
|
|
67
|
+
function mountPanel(record: HarnessUpdateJob, onClose: () => void = () => {}): HTMLElement {
|
|
68
|
+
container = document.createElement('div');
|
|
69
|
+
document.body.appendChild(container);
|
|
70
|
+
act(() => render(<UpdateLogDialog job={record} onClose={onClose} />, container!));
|
|
71
|
+
const panel = document.querySelector('[role="dialog"]');
|
|
72
|
+
if (!panel) throw new Error('the log panel did not mount');
|
|
73
|
+
return panel as HTMLElement;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
describe('UpdateLogDialog', () => {
|
|
77
|
+
test('a running step shows its command and says it is waiting for output', () => {
|
|
78
|
+
const panel = mountPanel(job());
|
|
79
|
+
expect(panel.textContent).toContain('Updating claude');
|
|
80
|
+
expect(panel.textContent).toContain('Installing…');
|
|
81
|
+
expect(panel.textContent).toContain('adapter');
|
|
82
|
+
// The command is the reader's way to repeat a step by hand after a failure.
|
|
83
|
+
expect(panel.textContent).toContain('npm install -g @agentclientprotocol/claude-agent-acp@0.102.0');
|
|
84
|
+
expect(panel.textContent).toContain('Waiting for output…');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test('the streamed output is rendered verbatim', () => {
|
|
88
|
+
const panel = mountPanel(job({ output: 'added 1 package in 3s\nnpm warn deprecated x' }));
|
|
89
|
+
expect(panel.querySelector('pre')?.textContent).toContain('added 1 package in 3s');
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
test('a failed step names its exit code, and the run its sentence', () => {
|
|
93
|
+
const panel = mountPanel(job({
|
|
94
|
+
finishedAt: Date.now(),
|
|
95
|
+
pid: null,
|
|
96
|
+
ok: false,
|
|
97
|
+
applied: true,
|
|
98
|
+
message: 'claude update failed (exit 3)',
|
|
99
|
+
output: 'boom',
|
|
100
|
+
steps: [{
|
|
101
|
+
part: 'Claude Code',
|
|
102
|
+
command: 'claude update',
|
|
103
|
+
argv: ['claude', 'update'],
|
|
104
|
+
state: 'failed',
|
|
105
|
+
code: 3,
|
|
106
|
+
}],
|
|
107
|
+
}));
|
|
108
|
+
expect(panel.textContent).toContain('Failed');
|
|
109
|
+
expect(panel.textContent).toContain('claude update');
|
|
110
|
+
expect(panel.textContent).toContain('exit 3');
|
|
111
|
+
expect(panel.textContent).toContain('claude update failed (exit 3)');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test('a finished run with no output says so instead of showing an empty box', () => {
|
|
115
|
+
const panel = mountPanel(job({ finishedAt: Date.now(), pid: null, ok: true, message: 'claude updated (adapter)' }));
|
|
116
|
+
expect(panel.textContent).toContain('The commands printed nothing.');
|
|
117
|
+
expect(panel.textContent).toContain('claude updated (adapter)');
|
|
118
|
+
expect(panel.textContent).toContain('Finished');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
test('the close control asks to close', () => {
|
|
122
|
+
let closed = 0;
|
|
123
|
+
const panel = mountPanel(job(), () => { closed += 1; });
|
|
124
|
+
const close = panel.querySelector<HTMLButtonElement>('button[aria-label="Close"]')
|
|
125
|
+
?? panel.querySelector<HTMLButtonElement>('button');
|
|
126
|
+
expect(close).not.toBeNull();
|
|
127
|
+
act(() => close!.click());
|
|
128
|
+
expect(closed).toBe(1);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The install's own console, opened from the row that is updating.
|
|
8
|
+
*
|
|
9
|
+
* A harness update is a background job now, so the dialog's spinner says that
|
|
10
|
+
* *something* is running and nothing about what it is doing — and when a press
|
|
11
|
+
* fails, "claude update failed" without the command's output is not actionable.
|
|
12
|
+
* The worker already streams every step's stdout/stderr into the job record
|
|
13
|
+
* (throttled to 400 ms), so this panel is only a view of that: the steps, and
|
|
14
|
+
* the output, pinned to the newest line.
|
|
15
|
+
*
|
|
16
|
+
* It stays open after the run settles — the failure case is exactly when the log
|
|
17
|
+
* matters — and the record it renders is the last one the card polled, so a
|
|
18
|
+
* finished run keeps its output until another update replaces it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { useEffect, useRef } from 'preact/hooks';
|
|
22
|
+
import { createPortal } from 'preact/compat';
|
|
23
|
+
import { Ban, CheckCircle2, CircleDashed, Loader2 } from 'lucide-preact';
|
|
24
|
+
import { Modal } from '@/client/components/common/Modal';
|
|
25
|
+
import type { HarnessUpdateJob, HarnessUpdateJobStep } from '@/shared/types/harness-update';
|
|
26
|
+
|
|
27
|
+
export interface UpdateLogDialogProps {
|
|
28
|
+
job: HarnessUpdateJob;
|
|
29
|
+
onClose: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The mark for one step's state. */
|
|
33
|
+
function StepMark({ state }: { state: HarnessUpdateJobStep['state'] }) {
|
|
34
|
+
if (state === 'ok') return <CheckCircle2 size={12} className="shrink-0 text-ink/55" />;
|
|
35
|
+
if (state === 'failed') return <Ban size={12} className="shrink-0 text-error" />;
|
|
36
|
+
if (state === 'running') return <Loader2 size={12} className="shrink-0 animate-spin text-ink motion-reduce:animate-none" />;
|
|
37
|
+
return <CircleDashed size={12} className="shrink-0 text-ink/25" />;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** How the panel describes the run, in the same words the toast uses. */
|
|
41
|
+
function phaseLabel(job: HarnessUpdateJob): string {
|
|
42
|
+
if (job.finishedAt === null) return 'Installing…';
|
|
43
|
+
return job.ok ? 'Finished' : 'Failed';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function UpdateLogDialog({ job, onClose }: UpdateLogDialogProps) {
|
|
47
|
+
const output = useRef<HTMLPreElement | null>(null);
|
|
48
|
+
const running = job.finishedAt === null;
|
|
49
|
+
|
|
50
|
+
// Pin to the newest line while the worker streams. Without it the panel shows
|
|
51
|
+
// the top of npm's output and the reason for a failure is always below the
|
|
52
|
+
// fold.
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const node = output.current;
|
|
55
|
+
if (node) node.scrollTop = node.scrollHeight;
|
|
56
|
+
}, [job.output]);
|
|
57
|
+
|
|
58
|
+
return createPortal(
|
|
59
|
+
<Modal
|
|
60
|
+
onClose={onClose}
|
|
61
|
+
// Above About (`z-50`) — the log is opened FROM that card, not instead of it.
|
|
62
|
+
zClass="z-[65]"
|
|
63
|
+
maxWidthClass="max-w-3xl"
|
|
64
|
+
ariaLabel={`Update log for ${job.label}`}
|
|
65
|
+
header={
|
|
66
|
+
<div className="flex min-w-0 items-center gap-3">
|
|
67
|
+
{running
|
|
68
|
+
? <Loader2 size={15} className="shrink-0 animate-spin text-ink/70 motion-reduce:animate-none" />
|
|
69
|
+
: <StepMark state={job.ok ? 'ok' : 'failed'} />}
|
|
70
|
+
<div className="min-w-0">
|
|
71
|
+
<h2 className="truncate text-sm font-semibold text-ink">Updating {job.label}</h2>
|
|
72
|
+
<p className="truncate font-mono text-[11px] text-ink/50">
|
|
73
|
+
{phaseLabel(job)}
|
|
74
|
+
{job.steps.length > 0 ? ` · ${job.steps.filter((step) => step.state === 'ok').length}/${job.steps.length} steps` : ''}
|
|
75
|
+
</p>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
}
|
|
79
|
+
footer={
|
|
80
|
+
job.message ? (
|
|
81
|
+
<div className="border-t border-ink/10 px-5 py-2.5">
|
|
82
|
+
<p className="text-[11px] leading-4 text-ink/65">{job.message}</p>
|
|
83
|
+
</div>
|
|
84
|
+
) : undefined
|
|
85
|
+
}
|
|
86
|
+
>
|
|
87
|
+
<div className="flex min-h-0 flex-col gap-3 px-5 py-4">
|
|
88
|
+
{/* What the run will do, and what it is doing: the commands are the
|
|
89
|
+
reader's way to repeat a step by hand after a failure. */}
|
|
90
|
+
<ul className="space-y-1">
|
|
91
|
+
{job.steps.map((step, index) => (
|
|
92
|
+
<li key={`${step.part}-${index}`} className="flex items-start gap-2">
|
|
93
|
+
<span className="mt-0.5 flex h-3.5 items-center"><StepMark state={step.state} /></span>
|
|
94
|
+
<span className="min-w-0 flex-1">
|
|
95
|
+
<span className="block text-[11px] leading-4 text-ink">{step.part}</span>
|
|
96
|
+
<span className="block break-all font-mono text-[10px] leading-[15px] text-ink/45">
|
|
97
|
+
{step.command}
|
|
98
|
+
{step.state === 'failed' && step.code !== null ? ` — exit ${step.code}` : ''}
|
|
99
|
+
</span>
|
|
100
|
+
</span>
|
|
101
|
+
{/* One line per STATE, because a press can run two installs: the
|
|
102
|
+
reader has to see which half is done. */}
|
|
103
|
+
<span className="shrink-0 text-[10px] leading-4 text-ink/40">{step.state}</span>
|
|
104
|
+
</li>
|
|
105
|
+
))}
|
|
106
|
+
</ul>
|
|
107
|
+
|
|
108
|
+
{/* The output box scrolls on its own — the modal body must not, or the
|
|
109
|
+
step list would scroll away from the log it explains. */}
|
|
110
|
+
<pre
|
|
111
|
+
ref={output}
|
|
112
|
+
className="max-h-[38vh] min-h-[8rem] overflow-auto rounded-lg border border-ink/10 bg-ink/[0.03] px-3 py-2 font-mono text-[10px] leading-[15px] whitespace-pre-wrap break-all text-ink/75"
|
|
113
|
+
>
|
|
114
|
+
{job.output || (running ? 'Waiting for output…' : 'The commands printed nothing.')}
|
|
115
|
+
</pre>
|
|
116
|
+
</div>
|
|
117
|
+
</Modal>,
|
|
118
|
+
document.body,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The in-flow line an updating harness row carries: what the background worker
|
|
8
|
+
* is doing, and the way into its log.
|
|
9
|
+
*
|
|
10
|
+
* It is a LINE under the row rather than a second icon in the action cell,
|
|
11
|
+
* because that cell is a fixed `1.75rem` track measured for one 24px button —
|
|
12
|
+
* two of them overflow it, which is the same defect the earlier `7rem` track
|
|
13
|
+
* caused in the other direction. In flow it can also carry the step's name,
|
|
14
|
+
* which a bare icon cannot.
|
|
15
|
+
*
|
|
16
|
+
* After the run settles the line stays, showing what happened and keeping
|
|
17
|
+
* `View log` available: the failure case is exactly when the output matters, and
|
|
18
|
+
* the record it lives in survives until the next update replaces it.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export interface UpdateLogLineProps {
|
|
22
|
+
/** Is the worker still installing? */
|
|
23
|
+
running: boolean;
|
|
24
|
+
/** The step it is on (`adapter`, `Claude Code`, …), when the record says. */
|
|
25
|
+
progress: string | null;
|
|
26
|
+
/** The finished run's sentence, once it has one. */
|
|
27
|
+
message: string | null;
|
|
28
|
+
onOpenLog?: () => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function UpdateLogLine({ running, progress, message, onOpenLog }: UpdateLogLineProps) {
|
|
32
|
+
return (
|
|
33
|
+
<span className="col-span-3 flex items-center gap-2 pb-1 text-[10px] text-ink/60">
|
|
34
|
+
{running
|
|
35
|
+
? <span>{progress ? `Installing ${progress}…` : 'Updating…'}</span>
|
|
36
|
+
: <span className="min-w-0 truncate">{message ?? 'Update finished'}</span>}
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
data-update-log
|
|
40
|
+
onClick={() => onOpenLog?.()}
|
|
41
|
+
className="shrink-0 cursor-pointer font-medium text-ink underline decoration-ink/30 underline-offset-2 transition-colors hover:decoration-ink"
|
|
42
|
+
>
|
|
43
|
+
View log
|
|
44
|
+
</button>
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The About card's FRAME, at both sizes.
|
|
8
|
+
*
|
|
9
|
+
* The phone used to get a full-bleed sheet (`h-full w-full`, no gutters), which
|
|
10
|
+
* put the card's own header against the viewport's top edge — under the status
|
|
11
|
+
* bar on a `viewport-fit: cover` surface — and capped the harness list at `46vh`
|
|
12
|
+
* inside it, so the list scrolled while most of the screen sat empty below it.
|
|
13
|
+
*
|
|
14
|
+
* Two things are guarded here, and both are properties of the TREE rather than
|
|
15
|
+
* of a stylesheet: the card is a bounded floating card sized by the same width
|
|
16
|
+
* cap the composer's model picker uses, and the card carries exactly ONE scroll
|
|
17
|
+
* container (its body) — the harness list must not be a second one.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
|
|
21
|
+
import { Window } from 'happy-dom';
|
|
22
|
+
import { render } from 'preact';
|
|
23
|
+
import { act } from 'preact/test-utils';
|
|
24
|
+
import { AboutModal } from '@/client/components/layout/session-sidebar/about-modal';
|
|
25
|
+
import { MAX_WIDTH } from '@/client/components/workspace/model-dropdown/popover-metrics';
|
|
26
|
+
import { resetHarnessVersions } from '@/client/hooks/models/use-harness-versions';
|
|
27
|
+
import { resetHarnessesStore } from '@/client/hooks/models/harness-catalog';
|
|
28
|
+
import { delay } from '@/client/hooks/chat/composer/file-reads';
|
|
29
|
+
import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
|
|
30
|
+
import type { UseUpdatesResult } from '@/client/hooks/ui/updates';
|
|
31
|
+
|
|
32
|
+
/** A console with nothing to install: this suite reads the frame, not the data. */
|
|
33
|
+
const UPDATES: UseUpdatesResult = {
|
|
34
|
+
info: null,
|
|
35
|
+
checking: false,
|
|
36
|
+
applying: null,
|
|
37
|
+
progress: null,
|
|
38
|
+
error: null,
|
|
39
|
+
hasUpdate: false,
|
|
40
|
+
check: async () => {},
|
|
41
|
+
apply: async () => null,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const nativeFetch = globalThis.fetch;
|
|
45
|
+
|
|
46
|
+
beforeAll(() => {
|
|
47
|
+
installDomGlobals(new Window({ url: 'http://localhost' }));
|
|
48
|
+
// Both catalogs are module-level stores: a suite that ran earlier and left a
|
|
49
|
+
// read in flight (or the "already loaded" flag set) makes this card mount
|
|
50
|
+
// against that state instead of its own 501, and the harness list then renders
|
|
51
|
+
// its skeleton forever — the frame assertions still pass, the ROWS assertion
|
|
52
|
+
// does not. Cold stores make the suite order-independent.
|
|
53
|
+
resetHarnessesStore();
|
|
54
|
+
resetHarnessVersions();
|
|
55
|
+
// The card reads two catalogs on mount; a 501 makes both hooks report their
|
|
56
|
+
// error state instead of dialing a server that is not there.
|
|
57
|
+
globalThis.fetch = (async () => ({
|
|
58
|
+
ok: false,
|
|
59
|
+
status: 501,
|
|
60
|
+
json: async () => ({}),
|
|
61
|
+
})) as unknown as typeof fetch;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
afterAll(() => {
|
|
65
|
+
globalThis.fetch = nativeFetch;
|
|
66
|
+
restoreDomGlobals();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
let container: HTMLElement | null = null;
|
|
70
|
+
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
if (container) act(() => render(null, container!));
|
|
73
|
+
container?.remove();
|
|
74
|
+
container = null;
|
|
75
|
+
for (const node of Array.from(document.body.children)) node.remove();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
/** Mount the card and return its `role="dialog"` panel. */
|
|
79
|
+
async function mountCard(): Promise<HTMLElement> {
|
|
80
|
+
container = document.createElement('div');
|
|
81
|
+
document.body.appendChild(container);
|
|
82
|
+
act(() => render(<AboutModal isOpen onClose={() => {}} updates={UPDATES} />, container!));
|
|
83
|
+
// The two catalog reads land after the first paint; the harness list only
|
|
84
|
+
// exists once the store reports it is done loading.
|
|
85
|
+
await act(() => delay(0));
|
|
86
|
+
const panel = document.querySelector('[role="dialog"][aria-label="About Kabmo"]');
|
|
87
|
+
if (!panel) throw new Error('About card did not mount');
|
|
88
|
+
return panel as HTMLElement;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
describe('the About card frame', () => {
|
|
92
|
+
test('a floating card sized by the model picker’s cap, not the whole screen', async () => {
|
|
93
|
+
const panel = await mountCard();
|
|
94
|
+
// `h-full` was the full-bleed sheet: a card stretched to the screen's top
|
|
95
|
+
// edge is exactly what drew its header under the status bar.
|
|
96
|
+
expect(panel.classList.contains('h-full')).toBe(false);
|
|
97
|
+
expect(panel.style.getPropertyValue('--about-card-max')).toBe(`min(${MAX_WIDTH}px, 100%)`);
|
|
98
|
+
expect(panel.classList.contains('max-h-full')).toBe(true);
|
|
99
|
+
expect(panel.classList.contains('rounded-2xl')).toBe(true);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('the card is centered with a capped height, never stretched', async () => {
|
|
103
|
+
const panel = await mountCard();
|
|
104
|
+
const backdrop = panel.parentElement!;
|
|
105
|
+
// `items-stretch` + `h-full` was the sheet; a stretched card has no gutter to
|
|
106
|
+
// keep the safe area clear, and no height cap to scroll inside.
|
|
107
|
+
expect(backdrop.className).toContain('items-center');
|
|
108
|
+
expect(backdrop.className).not.toContain('items-stretch');
|
|
109
|
+
expect(panel.classList.contains('max-h-full')).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('exactly ONE scroll container inside the card', async () => {
|
|
113
|
+
const panel = await mountCard();
|
|
114
|
+
const scrollers = panel.querySelectorAll('.scrollbar-overlay-container');
|
|
115
|
+
expect(scrollers).toHaveLength(1);
|
|
116
|
+
// …and the harness list is not it.
|
|
117
|
+
const list = panel.querySelector('[data-harness-rows]');
|
|
118
|
+
expect(list).not.toBeNull();
|
|
119
|
+
expect(list!.classList.contains('scrollbar-overlay-container')).toBe(false);
|
|
120
|
+
expect(list!.classList.contains('overflow-y-auto')).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
});
|