@kabmo-labs/kabmo 0.23.0 → 0.24.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 +679 -679
- package/dist/client/static/js/{index-ph0q59rs.js → index-jcr5twtp.js} +769 -767
- package/dist/client/static/js/index-z3w7n85q.css +1 -0
- package/package.json +1 -1
- package/src/client/components/common/Modal.tsx +2 -6
- package/src/client/components/layout/desktop-layout/WorkspacePanels.tsx +7 -1
- 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 +23 -7
- 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 +27 -11
- 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/MessageList.test.ts +14 -0
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +4 -3
- package/src/client/components/workspace/chat-timeline/index.tsx +2 -1
- 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/data/settings/omp-schema.json +4 -4
- 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/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 +17 -0
- package/src/client/hooks/chat/timeline/send-props.ts +5 -3
- package/src/client/hooks/chat/timeline/send-steer.test.ts +1 -3
- package/src/client/hooks/chat/timeline/send.test-util.ts +1 -1
- package/src/client/hooks/chat/timeline/send.test.ts +1 -3
- package/src/client/hooks/chat/timeline/send.ts +8 -3
- 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/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-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/tailwind.css +9 -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/frames.test.ts +50 -1
- package/src/server/lib/harness/acp/frames.ts +17 -5
- package/src/server/lib/harness/acp/mapper.ts +6 -4
- 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-handshake.ts +9 -2
- package/src/server/lib/harness/acp/session-idle.ts +51 -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.test-util.ts +31 -2
- package/src/server/lib/harness/acp/session.test.ts +65 -3
- package/src/server/lib/harness/acp/session.ts +20 -20
- package/src/server/lib/harness/acp/turn.ts +31 -7
- 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 +13 -115
- 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/update-state.server.ts +15 -20
- package/src/server/lib/lifecycle/after-listen.ts +7 -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/session/delete-flow.server.ts +15 -8
- package/src/server/lib/omp/session/delete.server.ts +12 -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/import-action.ts +18 -4
- 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.ts +49 -7
- package/src/server/routes/harness/versions.ts +5 -1
- package/src/server/routes/sessions/delete-acp.test.ts +227 -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/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/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/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 +32 -8
- package/src/shared/lib/harness/provider-facts.ts +46 -11
- package/src/shared/lib/harness/providers.ts +9 -0
- package/src/shared/lib/harness/rewind.ts +24 -0
- package/src/shared/lib/harness/update-plan.test.ts +51 -1
- package/src/shared/lib/harness/update-plan.ts +47 -7
- 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/theme/css.ts +2 -0
- package/src/shared/lib/theme/ink-scale.ts +21 -1
- package/src/shared/lib/theme/theme.test.ts +25 -9
- package/src/shared/lib/ui/safe-area.test.ts +28 -0
- package/src/shared/lib/ui/safe-area.ts +42 -0
- package/src/shared/types/harness.ts +30 -4
- 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 +6 -3
- package/dist/client/static/js/index-jhmg4w91.css +0 -1
|
@@ -86,15 +86,55 @@ export function planHarnessUpdate(
|
|
|
86
86
|
// The CLI moves through ITS OWN updater (`claude update`), invoked by name: the
|
|
87
87
|
// adapter pins the CLI version it bridges, so this is the half that used to be
|
|
88
88
|
// left stale — and it is also the ONLY half that moves when the adapter is
|
|
89
|
-
// already current.
|
|
89
|
+
// already current. An npm CLI with no vendor updater (`dsh`) moves through the
|
|
90
|
+
// package the facts name instead; without that half its installed number could
|
|
91
|
+
// never be compared, let alone moved.
|
|
90
92
|
const { cli } = state;
|
|
91
|
-
if (cli &&
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
if (cli && cli.latest && cli.version && isNewer(cli.latest, cli.version)) {
|
|
94
|
+
if (facts.command) {
|
|
95
|
+
steps.push({
|
|
96
|
+
part: cli.name,
|
|
97
|
+
command: facts.command,
|
|
98
|
+
argv: facts.command.split(' '),
|
|
99
|
+
});
|
|
100
|
+
} else if (facts.cli?.pkg) {
|
|
101
|
+
steps.push({
|
|
102
|
+
part: cli.name,
|
|
103
|
+
command: `npm install -g ${facts.cli.pkg}@${cli.latest}`,
|
|
104
|
+
argv: ['npm', 'install', '-g', `${facts.cli.pkg}@${cli.latest}`],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
97
107
|
}
|
|
98
108
|
|
|
99
109
|
return steps;
|
|
100
110
|
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The launch command a successful adapter install should leave behind, or null.
|
|
114
|
+
*
|
|
115
|
+
* The launch table starts an npm adapter through a PINNED `npx -y pkg@x.y.z`,
|
|
116
|
+
* while the update installs the package GLOBALLY. Those are two different
|
|
117
|
+
* resolvers: `npm i -g` writes a binary onto PATH that `npx` never consults, so
|
|
118
|
+
* the press reported success while every new session still started the old
|
|
119
|
+
* pinned build — measured on `claude` (global 0.101.0, launch requested 0.100.0)
|
|
120
|
+
* and true by construction for codex/pi/zcode.
|
|
121
|
+
*
|
|
122
|
+
* The answer is the installed binary's name ONLY when this run installed the
|
|
123
|
+
* adapter, the binary is on PATH, and the harness has no user command of its
|
|
124
|
+
* own. A configured command is an explicit choice about how this machine starts
|
|
125
|
+
* the harness, so it is never replaced.
|
|
126
|
+
*/
|
|
127
|
+
export function repointAdapterLaunch(
|
|
128
|
+
facts: HarnessUpdateFacts | null,
|
|
129
|
+
steps: readonly HarnessUpdateStep[],
|
|
130
|
+
currentCommand: string,
|
|
131
|
+
agentBinOnPath: boolean,
|
|
132
|
+
): string | null {
|
|
133
|
+
const bin = facts?.agentBin;
|
|
134
|
+
const pkg = facts?.pkg;
|
|
135
|
+
if (!bin || !pkg || !agentBinOnPath || currentCommand.trim()) return null;
|
|
136
|
+
const installed = steps.some(
|
|
137
|
+
(step) => step.argv[0] === 'npm' && step.argv[3]?.startsWith(`${pkg}@`),
|
|
138
|
+
);
|
|
139
|
+
return installed ? bin : null;
|
|
140
|
+
}
|
|
@@ -76,6 +76,28 @@ describe('update facts per harness', () => {
|
|
|
76
76
|
expect(harnessUpdateFacts('omp-acp')?.command).toBe('omp update');
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
+
test('dsh compares its CLI package, not the ACP surface version', () => {
|
|
80
|
+
// Measured: the probe reports `deepseek-harness-acp` 0.0.1 while the
|
|
81
|
+
// installed CLI is 0.2.2-rc.1. The agent part has no registry package of its
|
|
82
|
+
// own; the CLI does, and that is the number an update can move.
|
|
83
|
+
expect(latestSourceFor('dsh')).toBeNull();
|
|
84
|
+
expect(harnessUpdateFacts('dsh')?.cli).toEqual({
|
|
85
|
+
bin: 'dsh',
|
|
86
|
+
name: 'deepseek-harness',
|
|
87
|
+
pkg: '@deepseek-ai/dsh',
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('an npx-launched adapter names the binary a global install writes', () => {
|
|
92
|
+
// The launch line pins `npx -y pkg@version`; `npm i -g` writes this binary,
|
|
93
|
+
// and the update route repoints the harness at it. Without the name the
|
|
94
|
+
// install cannot take effect on the next spawn.
|
|
95
|
+
expect(harnessUpdateFacts('claude')?.agentBin).toBe('claude-agent-acp');
|
|
96
|
+
expect(harnessUpdateFacts('codex')?.agentBin).toBe('codex-acp');
|
|
97
|
+
expect(harnessUpdateFacts('pi')?.agentBin).toBe('pi-acp');
|
|
98
|
+
expect(harnessUpdateFacts('zcode')?.agentBin).toBe('zcode-acp-server');
|
|
99
|
+
});
|
|
100
|
+
|
|
79
101
|
test('an unknown harness has no facts at all', () => {
|
|
80
102
|
expect(harnessUpdateFacts('some-future-agent')).toBeNull();
|
|
81
103
|
expect(latestSourceFor('some-future-agent')).toBeNull();
|
|
@@ -51,6 +51,13 @@ export interface HarnessUpdateFacts {
|
|
|
51
51
|
* refused, because a vendor installer is not Kabmo's to run.
|
|
52
52
|
*/
|
|
53
53
|
command?: string;
|
|
54
|
+
/**
|
|
55
|
+
* The binary the ADAPTER's own package installs, when the launch line prefers
|
|
56
|
+
* a pinned `npx` run of that package. A global install writes this name onto
|
|
57
|
+
* PATH; the update route points the harness at it so the install is the one
|
|
58
|
+
* that actually runs (see `routes/harness/update.ts`).
|
|
59
|
+
*/
|
|
60
|
+
agentBin?: string;
|
|
54
61
|
/** Where the command must run, when it is not the agent's own cwd. */
|
|
55
62
|
note?: string;
|
|
56
63
|
}
|
|
@@ -71,6 +78,9 @@ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpd
|
|
|
71
78
|
// fabricated comparison, measured on a real probe.
|
|
72
79
|
kind: 'npm',
|
|
73
80
|
pkg: '@agentclientprotocol/claude-agent-acp',
|
|
81
|
+
// The launch line runs `npx -y …@0.100.0`; the install writes this binary,
|
|
82
|
+
// and the route repoints the harness at it after a successful update.
|
|
83
|
+
agentBin: 'claude-agent-acp',
|
|
74
84
|
// The CLI underneath has its own updater (`claude update`), and the adapter
|
|
75
85
|
// pins the CLI version it bridges — so the adapter install alone can leave a
|
|
76
86
|
// stale CLI behind. Both lines are named.
|
|
@@ -83,6 +93,7 @@ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpd
|
|
|
83
93
|
// is compared against.
|
|
84
94
|
kind: 'npm',
|
|
85
95
|
pkg: '@agentclientprotocol/codex-acp',
|
|
96
|
+
agentBin: 'codex-acp',
|
|
86
97
|
cli: { bin: 'codex', name: 'codex' },
|
|
87
98
|
note: 'The row reports the ADAPTER; `codex --version` is the CLI underneath.',
|
|
88
99
|
},
|
|
@@ -104,6 +115,7 @@ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpd
|
|
|
104
115
|
pi: {
|
|
105
116
|
kind: 'npm',
|
|
106
117
|
pkg: 'pi-acp',
|
|
118
|
+
agentBin: 'pi-acp',
|
|
107
119
|
cli: { bin: 'pi', name: 'pi' },
|
|
108
120
|
// The ADAPTER is on npm; the agent it drives is not, so the note names both.
|
|
109
121
|
note: 'The row reports the ADAPTER; the `pi` binary it drives versions separately.',
|
|
@@ -111,7 +123,17 @@ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpd
|
|
|
111
123
|
qwen: { kind: 'npm', pkg: '@qwen-code/qwen-code' },
|
|
112
124
|
kimi: { kind: 'npm', pkg: '@moonshot-ai/kimi-code' },
|
|
113
125
|
minimax: { kind: 'npm', pkg: '@minimax-ai/code' },
|
|
114
|
-
dsh: {
|
|
126
|
+
dsh: {
|
|
127
|
+
kind: 'npm',
|
|
128
|
+
// The PROBE reports the ACP surface inside `dsh` (measured: agent
|
|
129
|
+
// `deepseek-harness-acp` 0.0.1), which is NOT the installed CLI's version
|
|
130
|
+
// (`dsh --version` is 0.2.2-rc.1). Comparing 0.0.1 against the package's
|
|
131
|
+
// 0.2.2 planned an install of the version already on disk on every press.
|
|
132
|
+
// The CLI is therefore the part that carries the package and the comparison;
|
|
133
|
+
// the agent line stays report-only.
|
|
134
|
+
cli: { bin: 'dsh', name: 'deepseek-harness', pkg: '@deepseek-ai/dsh' },
|
|
135
|
+
note: 'The row reports the `dsh` CLI; the ACP server it hosts reports its own version underneath.',
|
|
136
|
+
},
|
|
115
137
|
cursor: { kind: 'own', command: 'cursor-agent update', note: 'Cursor moves through its own installer.' },
|
|
116
138
|
// The ADAPTER is the npm package the probe reports; the `zcode` CLI it drives
|
|
117
139
|
// ships with the desktop app (or the vendor's own installer), so its version
|
|
@@ -119,6 +141,7 @@ export const HARNESS_UPDATE_FACTS: Readonly<Partial<Record<HarnessId, HarnessUpd
|
|
|
119
141
|
zcode: {
|
|
120
142
|
kind: 'npm',
|
|
121
143
|
pkg: 'zcode-acp-server',
|
|
144
|
+
agentBin: 'zcode-acp-server',
|
|
122
145
|
cli: { bin: 'zcode', name: 'ZCode' },
|
|
123
146
|
note: 'The row reports the ACP bridge; the ZCode CLI it drives installs with the desktop app.',
|
|
124
147
|
},
|
|
@@ -56,7 +56,16 @@ export function notifyModelsUpdated(): void {
|
|
|
56
56
|
/**
|
|
57
57
|
* Observe the `models` topic. The callback fires when the catalog changed, so
|
|
58
58
|
* the caller can re-project its own view from `fetchModelsData`.
|
|
59
|
+
*
|
|
60
|
+
* The local cache is dropped BEFORE the handler runs: the event exists because
|
|
61
|
+
* the server's answer changed, and a 60s answer cached before it would otherwise
|
|
62
|
+
* be handed straight back to a handler that is trying to re-read the catalog
|
|
63
|
+
* (measured: adding a provider left the composer's picker on the old list until
|
|
64
|
+
* the page was reloaded, even though the topic had fired).
|
|
59
65
|
*/
|
|
60
66
|
export function subscribeModelsUpdated(handler: () => void): () => void {
|
|
61
|
-
return realtimeClient.subscribe(TOPIC_MODELS,
|
|
67
|
+
return realtimeClient.subscribe(TOPIC_MODELS, () => {
|
|
68
|
+
invalidateModelsCache();
|
|
69
|
+
handler();
|
|
70
|
+
});
|
|
62
71
|
}
|
|
@@ -21,9 +21,10 @@
|
|
|
21
21
|
* fire-and-forget and must never be listed here: remembering one would offer a
|
|
22
22
|
* later client a modal nothing is waiting on.
|
|
23
23
|
*
|
|
24
|
-
* `'ask'` belongs here because
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* `'ask'` belongs here because a grouped ask dialog parks the agent until an
|
|
25
|
+
* answer arrives: omp's own `ask` tool took that path before 18.18.3, and
|
|
26
|
+
* extensions and the ratchet still open it. The tool's current form-driven walk
|
|
27
|
+
* parks on an ordinary `select`/`input`/`editor`, which is listed too.
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
import type { ExtensionUiDialogMethod, ExtensionUiDialogRequest } from '@/shared/types/omp/agent';
|
|
@@ -58,6 +58,8 @@ function paletteBlock(theme: ThemePalette): string {
|
|
|
58
58
|
` --theme-ink: ${theme.ink};`,
|
|
59
59
|
// Fifteen distinct values: the ink at N% over this palette's paper.
|
|
60
60
|
...scale.ladder.map((value, index) => ` --theme-ink-${MUTED_STEPS[index]}: ${value};`),
|
|
61
|
+
// The inline-code chip's OWN fill, opaque (see `CODE_FILL_PERCENT`).
|
|
62
|
+
` --theme-code-fill: ${scale.codeFill};`,
|
|
61
63
|
// Muted text on an inverted surface: an alpha reads 2.91:1 on `solarized-light`.
|
|
62
64
|
` --theme-on-ink-muted: ${onInkTextColor(theme)};`,
|
|
63
65
|
// The one level that clears AA on THIS palette. No single rung can be legal
|
|
@@ -11,6 +11,18 @@ export const MUTED_STEPS = [20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80,
|
|
|
11
11
|
* `/60` is 4.46:1, so the boundary sits where it is needed, not safely above it. */
|
|
12
12
|
export const TEXT_CONTRAST_FLOOR = 65;
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Strength of the inline-code chip's fill, as a percentage of ink over paper.
|
|
16
|
+
*
|
|
17
|
+
* The chip is SOLVED, not an alpha: `color-mix(… 8%, transparent)` composites
|
|
18
|
+
* with whatever is painted behind the chip, so a hovered block's tint showed
|
|
19
|
+
* through it and the code changed colour mid-hover (measured on a real session
|
|
20
|
+
* in the browser: the same `/Applications/Obsidian.app` chip read `#e4e9ed` at
|
|
21
|
+
* rest and `#dce2e5` with the hover tint behind it). An opaque value also pins
|
|
22
|
+
* the contrast between the code and its chip, which an alpha cannot.
|
|
23
|
+
*/
|
|
24
|
+
export const CODE_FILL_PERCENT = 8;
|
|
25
|
+
|
|
14
26
|
/** AA for small text. Named so the floor above can be read as a contrast. */
|
|
15
27
|
export const MUTED_CONTRAST_FLOOR = 4.5;
|
|
16
28
|
|
|
@@ -39,6 +51,8 @@ export interface InkScale {
|
|
|
39
51
|
ladder: readonly string[];
|
|
40
52
|
/** The lightest step that clears AA on both surfaces; the OS shells read it. */
|
|
41
53
|
muted: string;
|
|
54
|
+
/** The inline-code chip's fill: opaque ink over this palette's paper. */
|
|
55
|
+
codeFill: string;
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
/** Cached per palette object, so a render pass costs no arithmetic. */
|
|
@@ -58,7 +72,13 @@ export function inkScale(palette: ThemePalette): InkScale {
|
|
|
58
72
|
ladder.find((color) => worstTextContrast(color, palette) >= MUTED_CONTRAST_FLOOR) ??
|
|
59
73
|
palette.ink;
|
|
60
74
|
|
|
61
|
-
const scale: InkScale = {
|
|
75
|
+
const scale: InkScale = {
|
|
76
|
+
ink: palette.ink,
|
|
77
|
+
ladder,
|
|
78
|
+
muted,
|
|
79
|
+
// Opaque: the paper base is what makes the chip independent of its backdrop.
|
|
80
|
+
codeFill: mixHex(palette.paper, palette.ink, CODE_FILL_PERCENT / 100),
|
|
81
|
+
};
|
|
62
82
|
cache.set(palette, scale);
|
|
63
83
|
return scale;
|
|
64
84
|
}
|
|
@@ -28,7 +28,7 @@ import { describe, expect, test } from 'bun:test';
|
|
|
28
28
|
|
|
29
29
|
import { mixHex, parseHexColor, relativeLuminance, rgbaToHex } from '@/shared/lib/theme/color';
|
|
30
30
|
import { THEME_STYLE_ELEMENT_ID, themeStyleSheet } from '@/shared/lib/theme/css';
|
|
31
|
-
import { MUTED_STEPS, inkScale, onInkTextColor, signalTextColor } from '@/shared/lib/theme/ink-scale';
|
|
31
|
+
import { CODE_FILL_PERCENT, MUTED_STEPS, inkScale, onInkTextColor, signalTextColor } from '@/shared/lib/theme/ink-scale';
|
|
32
32
|
import { KABMO_PALETTES } from '@/shared/lib/theme/palettes/kabmo';
|
|
33
33
|
import { DARK_PALETTES } from '@/shared/lib/theme/palettes/dark';
|
|
34
34
|
import { DARK_EXTENDED_PALETTES } from '@/shared/lib/theme/palettes/dark-extended';
|
|
@@ -141,6 +141,9 @@ describe('generated stylesheet', () => {
|
|
|
141
141
|
// the ink cannot clear AA on every one (`ink-scale.ts`). One token per
|
|
142
142
|
// step: bucketing them onto four collapsed the ladder.
|
|
143
143
|
...MUTED_STEPS.map((step, index) => ` --theme-ink-${step}: ${inkScale(paper).ladder[index]};`),
|
|
144
|
+
// The inline-code chip's own opaque fill (never an alpha: see the
|
|
145
|
+
// `--theme-code-fill` rule in `tailwind.css`).
|
|
146
|
+
` --theme-code-fill: ${inkScale(paper).codeFill};`,
|
|
144
147
|
// Muted text for an inverted surface (`bg-ink`).
|
|
145
148
|
` --theme-on-ink-muted: ${onInkTextColor(paper)};`,
|
|
146
149
|
` --theme-muted: ${inkScale(paper).muted};`,
|
|
@@ -166,19 +169,32 @@ describe('generated stylesheet', () => {
|
|
|
166
169
|
|
|
167
170
|
test('names every slot --theme-* and nothing else', () => {
|
|
168
171
|
const names = [...css.matchAll(/--theme-[a-z0-9-]+:/g)].map((match) => match[0]);
|
|
169
|
-
// Eight palette slots, fifteen muted steps, the
|
|
170
|
-
// palette's own AA level (`--theme-muted`),
|
|
171
|
-
// and the two hover mixes.
|
|
172
|
-
expect(new Set(names).size).toBe(
|
|
172
|
+
// Eight palette slots, fifteen muted steps, the inline-code chip's fill,
|
|
173
|
+
// the inverted-surface level, the palette's own AA level (`--theme-muted`),
|
|
174
|
+
// the five solved signal levels, and the two hover mixes.
|
|
175
|
+
expect(new Set(names).size).toBe(33);
|
|
173
176
|
expect(names[0]).toBe('--theme-paper:');
|
|
174
177
|
// Slot order is the swatch order the appearance cards render.
|
|
175
178
|
expect(names[2]).toBe('--theme-ink:');
|
|
176
179
|
expect(names[3]).toBe('--theme-ink-20:');
|
|
177
180
|
expect(names[17]).toBe('--theme-ink-90:');
|
|
178
|
-
expect(names[18]).toBe('--theme-
|
|
179
|
-
expect(names[19]).toBe('--theme-muted:');
|
|
180
|
-
expect(names[
|
|
181
|
-
expect(names[25]).toBe('--theme-
|
|
181
|
+
expect(names[18]).toBe('--theme-code-fill:');
|
|
182
|
+
expect(names[19]).toBe('--theme-on-ink-muted:');
|
|
183
|
+
expect(names[20]).toBe('--theme-muted:');
|
|
184
|
+
expect(names[25]).toBe('--theme-meta:');
|
|
185
|
+
expect(names[26]).toBe('--theme-error-text:');
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
test('states the inline-code chip fill as an opaque colour, per palette', () => {
|
|
189
|
+
// The chip must NOT be an alpha: a translucent fill composites with whatever
|
|
190
|
+
// is painted behind it, so a hovered block changed the code's colour.
|
|
191
|
+
expect(css).not.toContain('--theme-code-fill: color-mix');
|
|
192
|
+
for (const palette of [KABMO_PALETTES[0], DARK_PALETTES[0]]) {
|
|
193
|
+
const fill = inkScale(palette).codeFill;
|
|
194
|
+
expect(fill).toBe(mixHex(palette.paper, palette.ink, CODE_FILL_PERCENT / 100));
|
|
195
|
+
expect(fill).toMatch(/^#[0-9a-f]{6}$/);
|
|
196
|
+
expect(css).toContain(`--theme-code-fill: ${fill};`);
|
|
197
|
+
}
|
|
182
198
|
});
|
|
183
199
|
|
|
184
200
|
test('is cached for the life of the process', () => {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, expect, test } from 'bun:test';
|
|
7
|
+
import { DIALOG_GUTTER_REM, safeAreaPadding } from '@/shared/lib/ui/safe-area';
|
|
8
|
+
|
|
9
|
+
describe('safeAreaPadding', () => {
|
|
10
|
+
test('every edge takes the LARGER of the gutter and the device inset', () => {
|
|
11
|
+
// `max()`, never a sum: a notched phone would otherwise get gutter + inset,
|
|
12
|
+
// which is twice the clearance the dialog needs.
|
|
13
|
+
const style = safeAreaPadding();
|
|
14
|
+
expect(style.paddingTop).toBe(`max(${DIALOG_GUTTER_REM}rem, env(safe-area-inset-top, 0px))`);
|
|
15
|
+
expect(style.paddingBottom).toBe(`max(${DIALOG_GUTTER_REM}rem, env(safe-area-inset-bottom, 0px))`);
|
|
16
|
+
expect(style.paddingLeft).toBe(`max(${DIALOG_GUTTER_REM}rem, env(safe-area-inset-left, 0px))`);
|
|
17
|
+
expect(style.paddingRight).toBe(`max(${DIALOG_GUTTER_REM}rem, env(safe-area-inset-right, 0px))`);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test('a caller with its own gutter keeps it on all four edges', () => {
|
|
21
|
+
const style = safeAreaPadding(1);
|
|
22
|
+
expect(style.paddingTop).toBe('max(1rem, env(safe-area-inset-top, 0px))');
|
|
23
|
+
expect(style.paddingBottom).toBe('max(1rem, env(safe-area-inset-bottom, 0px))');
|
|
24
|
+
// Both horizontal edges, because a landscape phone's notch is on a SIDE.
|
|
25
|
+
expect(style.paddingLeft).toBe('max(1rem, env(safe-area-inset-left, 0px))');
|
|
26
|
+
expect(style.paddingRight).toBe('max(1rem, env(safe-area-inset-right, 0px))');
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The padding a fixed overlay keeps clear of a phone's own chrome.
|
|
8
|
+
*
|
|
9
|
+
* A `fixed inset-0` frame reaches the viewport's physical edges, and on a
|
|
10
|
+
* `viewport-fit: cover` surface those edges run UNDER the status bar and the
|
|
11
|
+
* home indicator. Every dialog in this console states the same four declarations
|
|
12
|
+
* inline (the shared `Modal` shell, the About card, …); stated twice, one of them
|
|
13
|
+
* eventually forgets, and the symptom is a header nobody can tap.
|
|
14
|
+
*
|
|
15
|
+
* `env()` is 0 on a desktop, so a single rule serves both surfaces — no
|
|
16
|
+
* media query, and no second copy for the desktop.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** The gutter a dialog keeps from every edge when no safe area applies. */
|
|
20
|
+
export const DIALOG_GUTTER_REM = 0.75;
|
|
21
|
+
|
|
22
|
+
export type SafeAreaPadding = {
|
|
23
|
+
paddingTop: string;
|
|
24
|
+
paddingBottom: string;
|
|
25
|
+
paddingLeft: string;
|
|
26
|
+
paddingRight: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param gutterRem the edge gutter used when `env()` reports no inset.
|
|
31
|
+
* `max()`, not a sum: on a notched device the safe area is the LARGER of the
|
|
32
|
+
* two, and adding them would inset a dialog twice as far as the device needs.
|
|
33
|
+
*/
|
|
34
|
+
export function safeAreaPadding(gutterRem: number = DIALOG_GUTTER_REM): SafeAreaPadding {
|
|
35
|
+
const gutter = `${gutterRem}rem`;
|
|
36
|
+
return {
|
|
37
|
+
paddingTop: `max(${gutter}, env(safe-area-inset-top, 0px))`,
|
|
38
|
+
paddingBottom: `max(${gutter}, env(safe-area-inset-bottom, 0px))`,
|
|
39
|
+
paddingLeft: `max(${gutter}, env(safe-area-inset-left, 0px))`,
|
|
40
|
+
paddingRight: `max(${gutter}, env(safe-area-inset-right, 0px))`,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
@@ -15,11 +15,37 @@
|
|
|
15
15
|
import type { HarnessCapabilities } from '@/server/lib/harness/capabilities';
|
|
16
16
|
import type { HarnessConfig } from '@/shared/lib/harness/config';
|
|
17
17
|
import type { CanonicalProtocol } from '@/shared/lib/harness/dialects';
|
|
18
|
+
import type { EnvProviderContract } from '@/shared/lib/harness/provider-facts';
|
|
18
19
|
|
|
19
20
|
export type { HarnessConfig };
|
|
20
21
|
|
|
21
22
|
export type { HarnessCapabilities };
|
|
22
23
|
|
|
24
|
+
/**
|
|
25
|
+
* One selector value an ACP agent publishes (`configOptions[].options[]`), in
|
|
26
|
+
* the agent's own order and its own words.
|
|
27
|
+
*
|
|
28
|
+
* The SAME shape is what a probe records and what a live session reports, so a
|
|
29
|
+
* picker can list either without knowing which one it got.
|
|
30
|
+
*/
|
|
31
|
+
export interface HarnessSelectorValue {
|
|
32
|
+
value: string;
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The model and thinking selectors a harness's LIVE chat published.
|
|
38
|
+
*
|
|
39
|
+
* A probe is one throwaway spawn: it can be refused (codex demands
|
|
40
|
+
* authentication in the probe while the chat already running lists its models)
|
|
41
|
+
* and its answer ages. When a session of that harness is open, these are the
|
|
42
|
+
* selectors it published, and they are what the picker must show.
|
|
43
|
+
*/
|
|
44
|
+
export interface LiveHarnessModels {
|
|
45
|
+
models: HarnessSelectorValue[];
|
|
46
|
+
thinking?: HarnessSelectorValue[];
|
|
47
|
+
}
|
|
48
|
+
|
|
23
49
|
/** One row of `GET /api/harness`. */
|
|
24
50
|
export interface HarnessSummary {
|
|
25
51
|
id: string;
|
|
@@ -41,9 +67,9 @@ export interface HarnessSummary {
|
|
|
41
67
|
probe: {
|
|
42
68
|
harness: string;
|
|
43
69
|
capabilities: HarnessCapabilities;
|
|
44
|
-
models:
|
|
45
|
-
thinking:
|
|
46
|
-
modes:
|
|
70
|
+
models: HarnessSelectorValue[];
|
|
71
|
+
thinking: HarnessSelectorValue[];
|
|
72
|
+
modes: HarnessSelectorValue[];
|
|
47
73
|
probedAt: number;
|
|
48
74
|
/** True when the record is older than `PROBE_TTL_MS`. The answer is still
|
|
49
75
|
* shown — with its age — rather than being reported as "never probed". */
|
|
@@ -86,7 +112,7 @@ export interface HarnessProviderSupport {
|
|
|
86
112
|
* agent's own (Claude Code, Antigravity). */
|
|
87
113
|
createsChoice: boolean;
|
|
88
114
|
/** The env names this harness reads, for the `environment` form's labels. */
|
|
89
|
-
env?:
|
|
115
|
+
env?: EnvProviderContract;
|
|
90
116
|
/** The dot-path the providers live under in that file (`providers`,
|
|
91
117
|
* `model_providers`, `modelProviders`), so the card can name what it edits. */
|
|
92
118
|
pointer?: string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Draw the Files panel into a container, with an explicit `active` flag.
|
|
8
|
+
*
|
|
9
|
+
* Split from the harness so a spec can change the panel's visibility WITHOUT a
|
|
10
|
+
* remount: the desktop layout keeps a hidden view mounted and hides it with
|
|
11
|
+
* CSS, and only a re-render with another `active` reproduces that. Kept in its
|
|
12
|
+
* own module so the harness stays under the repository's line ceiling.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { h, render } from 'preact';
|
|
16
|
+
import { act } from 'preact/test-utils';
|
|
17
|
+
import { FileExplorer } from '@/client/components/workspace/file-explorer/index';
|
|
18
|
+
import { SessionStateProvider } from '@/client/components/common/session-state-provider/index';
|
|
19
|
+
|
|
20
|
+
export async function renderFileExplorer(
|
|
21
|
+
container: HTMLElement,
|
|
22
|
+
sessionId: string,
|
|
23
|
+
rootPath: string,
|
|
24
|
+
active: boolean,
|
|
25
|
+
onOpenFile: (file: { path: string; name: string }) => void,
|
|
26
|
+
): Promise<void> {
|
|
27
|
+
await act(async () => {
|
|
28
|
+
render(
|
|
29
|
+
h(SessionStateProvider, {
|
|
30
|
+
sessionId,
|
|
31
|
+
children: h(FileExplorer, { rootPath, enabled: true, active, onOpenFile }),
|
|
32
|
+
}),
|
|
33
|
+
container,
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
for (let i = 0; i < 10; i += 1) await act(async () => {});
|
|
37
|
+
}
|
|
@@ -15,10 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { Window } from 'happy-dom';
|
|
18
|
-
import {
|
|
18
|
+
import { render } from 'preact';
|
|
19
19
|
import { act } from 'preact/test-utils';
|
|
20
|
-
import { FileExplorer } from '@/client/components/workspace/file-explorer/index';
|
|
21
|
-
import { SessionStateProvider } from '@/client/components/common/session-state-provider/index';
|
|
22
20
|
import { resetRealtimeClient } from '@/shared/lib/realtime/client';
|
|
23
21
|
import { forgetSession } from '@/shared/lib/workspace/session-state/store';
|
|
24
22
|
import { fsTopic, reposTopic } from '@/shared/lib/realtime/protocol';
|
|
@@ -28,6 +26,7 @@ import type { TopicResolver } from '@/server/lib/realtime/hub.server';
|
|
|
28
26
|
import type { GitStatusPayload } from '@/server/lib/fs/git-status-read';
|
|
29
27
|
import { diskHas, entriesOf, moveOnDisk, writeToDisk, type Disk } from '@/test-support/file-explorer-disk.test-util';
|
|
30
28
|
import { fireDrag, rowElementFor, settleDrag, transferOf } from '@/test-support/file-explorer-drag.test-util';
|
|
29
|
+
import { renderFileExplorer } from '@/test-support/file-explorer-render.test-util';
|
|
31
30
|
|
|
32
31
|
export type { Disk } from '@/test-support/file-explorer-disk.test-util';
|
|
33
32
|
|
|
@@ -53,6 +52,14 @@ export interface FileExplorerHarness {
|
|
|
53
52
|
server: RealtimeTestServer | null;
|
|
54
53
|
/** Reset the disk state, mount the panel, and settle its first reads. */
|
|
55
54
|
mount: () => Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Re-render the mounted panel with a different `active` flag.
|
|
57
|
+
*
|
|
58
|
+
* The desktop layout keeps a view mounted and hides it with CSS when the
|
|
59
|
+
* right column is collapsed or another view is on screen, so this is how a
|
|
60
|
+
* spec reaches "the user opened the panel again" without a remount.
|
|
61
|
+
*/
|
|
62
|
+
setActive: (active: boolean) => Promise<void>;
|
|
56
63
|
/** Tear the panel down and stop the listener. */
|
|
57
64
|
unmount: () => void;
|
|
58
65
|
clickRow: (name: string) => Promise<void>;
|
|
@@ -203,21 +210,10 @@ export function createFileExplorerHarness(): FileExplorerHarness {
|
|
|
203
210
|
|
|
204
211
|
harness.container = document.createElement('div');
|
|
205
212
|
document.body.appendChild(harness.container);
|
|
206
|
-
await
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
children: h(FileExplorer, {
|
|
211
|
-
rootPath: ROOT,
|
|
212
|
-
enabled: true,
|
|
213
|
-
onOpenFile: (file: { path: string; name: string }) =>
|
|
214
|
-
harness.openedFiles.push({ path: file.path, name: file.name }),
|
|
215
|
-
}),
|
|
216
|
-
}),
|
|
217
|
-
harness.container,
|
|
218
|
-
);
|
|
219
|
-
});
|
|
220
|
-
for (let i = 0; i < 10; i += 1) await act(async () => {});
|
|
213
|
+
await renderPanel(true);
|
|
214
|
+
},
|
|
215
|
+
async setActive(active) {
|
|
216
|
+
await renderPanel(active);
|
|
221
217
|
},
|
|
222
218
|
async clickRow(name) {
|
|
223
219
|
// The deepest element whose own text is exactly `name`: `TreeItem` wraps
|
|
@@ -344,5 +340,11 @@ export function createFileExplorerHarness(): FileExplorerHarness {
|
|
|
344
340
|
return rowElementFor(harness.container, name);
|
|
345
341
|
},
|
|
346
342
|
};
|
|
343
|
+
/** Draw (or re-draw) the panel with the given visibility, then settle its reads. */
|
|
344
|
+
async function renderPanel(active: boolean) {
|
|
345
|
+
await renderFileExplorer(harness.container, SESSION, ROOT, active, (file) =>
|
|
346
|
+
harness.openedFiles.push({ path: file.path, name: file.name }),
|
|
347
|
+
);
|
|
348
|
+
}
|
|
347
349
|
return harness;
|
|
348
350
|
}
|
|
@@ -98,8 +98,11 @@ export function mountHarnessTable(
|
|
|
98
98
|
return container;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
/** The rows, which are the direct children of the
|
|
101
|
+
/** The rows, which are the direct children of the grid that draws them. */
|
|
102
102
|
export function harnessRows(el: HTMLElement): HTMLElement[] {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
// `data-harness-rows`, not the grid's scrollbar class: the list stopped being
|
|
104
|
+
// the scroller (the About card's body is), and a selector tied to a scrolling
|
|
105
|
+
// affordance silently returned no rows once it did.
|
|
106
|
+
const grid = el.querySelector('[data-harness-rows]');
|
|
107
|
+
return grid ? Array.from(grid.children) as HTMLElement[] : [];
|
|
105
108
|
}
|