@kabmo-labs/kabmo 0.28.0 → 0.30.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.
Files changed (232) hide show
  1. package/bunfig.toml +6 -0
  2. package/dist/client/index.html +2 -2
  3. package/dist/client/index.js +481 -472
  4. package/dist/client/static/js/{index-xzvyrxya.js → index-5vjbp04s.js} +1193 -1049
  5. package/dist/client/static/js/index-naa91727.css +1 -0
  6. package/dist/client/static/{manifest-q6h8k9e0.webmanifest → manifest-vdvdqpre.webmanifest} +1 -0
  7. package/package.json +3 -2
  8. package/public/manifest.webmanifest +1 -0
  9. package/src/client/components/common/ComposerTextarea.test.tsx +109 -0
  10. package/src/client/components/common/ComposerTextarea.tsx +6 -0
  11. package/src/client/components/common/ReloadPageButton.test.tsx +14 -0
  12. package/src/client/components/common/ReloadPageButton.tsx +11 -2
  13. package/src/client/components/common/diagram-viewer/read-block.test.ts +71 -0
  14. package/src/client/components/common/diagram-viewer/read-block.ts +40 -16
  15. package/src/client/components/common/file-icon/index.tsx +7 -1
  16. package/src/client/components/common/harness-glyph/brands.ts +7 -1
  17. package/src/client/components/common/image-viewer/index.tsx +37 -165
  18. package/src/client/components/common/picker-search/index.tsx +70 -0
  19. package/src/client/components/common/search-select/index.tsx +2 -7
  20. package/src/client/components/common/zoom-pan-stage/index.tsx +258 -0
  21. package/src/client/components/common/zoom-pan-stage/zoom-pan-stage.test.tsx +87 -0
  22. package/src/client/components/layout/session-sidebar/ClassicView.tsx +1 -1
  23. package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +7 -3
  24. package/src/client/components/layout/session-sidebar/about-modal/HarnessRow.tsx +4 -1
  25. package/src/client/components/layout/session-sidebar/about-modal/HarnessTable.tsx +12 -1
  26. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.test.tsx +82 -0
  27. package/src/client/components/layout/session-sidebar/about-modal/UpdateLogLine.tsx +23 -3
  28. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +1 -0
  29. package/src/client/components/layout/session-sidebar/modern/index.tsx +1 -1
  30. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +6 -4
  31. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +8 -0
  32. package/src/client/components/mobile/mobile-right-sidebar/EditorSurface.tsx +25 -0
  33. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +1 -1
  34. package/src/client/components/settings/Sidebar.tsx +6 -8
  35. package/src/client/components/settings/categories/HarnessSettings.tsx +4 -2
  36. package/src/client/components/settings/categories/PanelPluginSettings.tsx +2 -2
  37. package/src/client/components/settings/categories/PluginSettings.tsx +1 -1
  38. package/src/client/components/settings/categories/harness-settings/ConfigForm.tsx +3 -6
  39. package/src/client/components/settings/categories/panel-plugins/GitFreshness.test.tsx +36 -0
  40. package/src/client/components/settings/categories/panel-plugins/Section.tsx +1 -3
  41. package/src/client/components/settings/categories/panel-plugins/Toolbar.tsx +18 -4
  42. package/src/client/components/settings/categories/plugin-settings/MarketplacePane.tsx +64 -61
  43. package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +15 -4
  44. package/src/client/components/settings/groups.test.tsx +2 -2
  45. package/src/client/components/workspace/chat-timeline/IrcNotice.test.tsx +55 -0
  46. package/src/client/components/workspace/chat-timeline/IrcNotice.tsx +71 -0
  47. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +4 -1
  48. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +19 -0
  49. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +8 -3
  50. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.search.test.tsx +72 -0
  51. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +42 -15
  52. package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.test.tsx +28 -0
  53. package/src/client/components/workspace/chat-timeline/target-picker/ParentSessionPicker.tsx +28 -10
  54. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.test.tsx +47 -1
  55. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +55 -5
  56. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +3 -2
  57. package/src/client/components/workspace/editor/FilePane.tsx +32 -0
  58. package/src/client/components/workspace/editor/Toolbar.tsx +4 -0
  59. package/src/client/components/workspace/editor/toolbar-clusters.test.ts +1 -0
  60. package/src/client/components/workspace/editor/toolbar-clusters.tsx +5 -2
  61. package/src/client/components/workspace/editor/viewers/CsvGrid.tsx +52 -5
  62. package/src/client/components/workspace/editor/viewers/DataGrid.tsx +227 -41
  63. package/src/client/components/workspace/editor/viewers/DrawioView.tsx +93 -0
  64. package/src/client/components/workspace/editor/viewers/GridRow.tsx +91 -0
  65. package/src/client/components/workspace/editor/viewers/GridToolbar.tsx +53 -0
  66. package/src/client/components/workspace/editor/viewers/SheetView.tsx +152 -57
  67. package/src/client/components/workspace/editor/viewers/dispatch.tsx +42 -9
  68. package/src/client/components/workspace/editor/viewers/drawio-pages.test.ts +80 -0
  69. package/src/client/components/workspace/editor/viewers/drawio-pages.ts +63 -0
  70. package/src/client/components/workspace/editor/viewers/grid.test.ts +296 -0
  71. package/src/client/components/workspace/editor/viewers/use-cell-edit.ts +64 -0
  72. package/src/client/components/workspace/editor/viewers/use-grid-interaction.ts +216 -0
  73. package/src/client/components/workspace/editor/viewers/viewers.test.ts +47 -2
  74. package/src/client/components/workspace/editor/viewers/workbook.ts +149 -0
  75. package/src/client/components/workspace/file-explorer/ArchiveModals.tsx +262 -0
  76. package/src/client/components/workspace/file-explorer/ContextMenu.tsx +30 -6
  77. package/src/client/components/workspace/file-explorer/Modals.tsx +8 -3
  78. package/src/client/components/workspace/file-explorer/RootOverlays.tsx +60 -0
  79. package/src/client/components/workspace/file-explorer/RowLabel.tsx +6 -2
  80. package/src/client/components/workspace/file-explorer/TreeItem.tsx +39 -49
  81. package/src/client/components/workspace/file-explorer/TreeItemModals.tsx +80 -0
  82. package/src/client/components/workspace/file-explorer/index.tsx +53 -29
  83. package/src/client/components/workspace/file-explorer/selection.test.tsx +109 -0
  84. package/src/client/data/settings/omp-schema.json +169 -22
  85. package/src/client/glass-palette.test.ts +72 -0
  86. package/src/client/glass.css +39 -14
  87. package/src/client/glass.test.ts +28 -67
  88. package/src/client/hooks/chat/composer/history.test.ts +267 -0
  89. package/src/client/hooks/chat/composer/history.ts +146 -0
  90. package/src/client/hooks/chat/timeline/ask-frames.test.ts +54 -0
  91. package/src/client/hooks/chat/timeline/ask-frames.ts +29 -1
  92. package/src/client/hooks/chat/timeline/timeline-rail.test.ts +34 -2
  93. package/src/client/hooks/chat/timeline/user-turns.ts +31 -2
  94. package/src/client/hooks/editor/file-editor-types.ts +15 -0
  95. package/src/client/hooks/editor/save-bytes.ts +79 -0
  96. package/src/client/hooks/editor/use-dirty-tracking.test.ts +73 -0
  97. package/src/client/hooks/editor/use-dirty-tracking.ts +96 -0
  98. package/src/client/hooks/editor/use-file-cache.ts +1 -0
  99. package/src/client/hooks/editor/use-file-editor.test.ts +30 -0
  100. package/src/client/hooks/editor/use-file-editor.ts +20 -17
  101. package/src/client/hooks/editor/use-file-read.ts +21 -2
  102. package/src/client/hooks/editor/use-grid-selection.ts +160 -0
  103. package/src/client/hooks/models/use-harness-update.test.ts +35 -2
  104. package/src/client/hooks/models/use-harness-update.ts +49 -10
  105. package/src/client/hooks/workspace/diff-file.test.ts +72 -0
  106. package/src/client/hooks/workspace/diff-file.ts +12 -6
  107. package/src/client/hooks/workspace/file-archive.ts +220 -0
  108. package/src/client/hooks/workspace/file-clipboard.test.ts +4 -4
  109. package/src/client/hooks/workspace/file-clipboard.ts +37 -26
  110. package/src/client/hooks/workspace/file-selection.test.ts +67 -0
  111. package/src/client/hooks/workspace/file-selection.ts +156 -0
  112. package/src/client/hooks/workspace/file-tree-actions-clipboard.test.ts +5 -5
  113. package/src/client/hooks/workspace/file-tree-actions.ts +36 -8
  114. package/src/client/lib/editor/workbook-drafts.ts +42 -0
  115. package/src/client/lib/launch/file-handlers.ts +2 -2
  116. package/src/client/lib/scrollbar-activity.test.ts +21 -88
  117. package/src/client/lib/scrollbar-activity.ts +71 -73
  118. package/src/client/lib/scrollbar-events.ts +143 -0
  119. package/src/client/lib/scrollbar-input.test.ts +126 -0
  120. package/src/client/lib/scrollbar-probe.test-util.ts +107 -0
  121. package/src/client/tailwind.css +32 -1
  122. package/src/server/db.server.test.ts +50 -1
  123. package/src/server/db.server.ts +36 -3
  124. package/src/server/lib/chat/prompt-history.server.test.ts +92 -0
  125. package/src/server/lib/chat/prompt-history.server.ts +65 -0
  126. package/src/server/lib/chat/schema.server.ts +35 -0
  127. package/src/server/lib/db/schema.ts +3 -0
  128. package/src/server/lib/fs/archive.test.ts +198 -0
  129. package/src/server/lib/fs/archive.ts +278 -0
  130. package/src/server/lib/fs/git-diff.test.ts +26 -1
  131. package/src/server/lib/fs/git-diff.ts +43 -15
  132. package/src/server/lib/harness/launch-table.ts +19 -0
  133. package/src/server/lib/harness/provider-entry.ts +1 -1
  134. package/src/server/lib/harness/provider-file.server.ts +1 -1
  135. package/src/server/lib/harness/provider-sources.server.ts +2 -1
  136. package/src/server/lib/harness/provider-write.server.ts +2 -1
  137. package/src/server/lib/harness/update-job-store.ts +12 -0
  138. package/src/server/lib/harness/update-queue.server.ts +15 -10
  139. package/src/server/lib/omp/rpc/frame-fold-signals.test.ts +5 -1
  140. package/src/server/lib/omp/rpc/frame-fold.test.ts +5 -1
  141. package/src/server/lib/omp/rpc/lifecycle.test.ts +4 -0
  142. package/src/server/lib/omp/session/auto-title.server.test.ts +4 -0
  143. package/src/server/lib/omp/session/delete.server.ts +1 -0
  144. package/src/server/lib/omp/session/goal-driver.test.ts +5 -1
  145. package/src/server/lib/omp/session/goal-settings.test.ts +5 -1
  146. package/src/server/lib/panels/auto-update.server.test.ts +5 -2
  147. package/src/server/lib/panels/git-update.server.test.ts +5 -2
  148. package/src/server/lib/panels/install.server.test.ts +5 -2
  149. package/src/server/lib/panels/remove.server.test.ts +5 -2
  150. package/src/server/routes/agent/command.ts +11 -0
  151. package/src/server/routes/agent/new.ts +5 -0
  152. package/src/server/routes/chat/index.ts +5 -0
  153. package/src/server/routes/chat/prompt-history.test.ts +67 -0
  154. package/src/server/routes/chat/prompt-history.ts +31 -0
  155. package/src/server/routes/chat/stream.test.ts +21 -0
  156. package/src/server/routes/chat/stream.ts +5 -0
  157. package/src/server/routes/fs/action-archive.test.ts +128 -0
  158. package/src/server/routes/fs/action-bulk.ts +106 -0
  159. package/src/server/routes/fs/action-save-bytes.test.ts +59 -0
  160. package/src/server/routes/fs/action-transfer.test.ts +26 -0
  161. package/src/server/routes/fs/action.ts +91 -11
  162. package/src/server/routes/fs/archive.ts +20 -0
  163. package/src/server/routes/fs/grant.test.ts +5 -2
  164. package/src/server/routes/fs/index.ts +2 -0
  165. package/src/server/routes/fs/scope.test.ts +6 -2
  166. package/src/server/routes/harness/import-action.ts +1 -1
  167. package/src/server/routes/harness/root.ts +6 -1
  168. package/src/server/routes/harness/summary.test.ts +50 -0
  169. package/src/server/routes/harness/update-status.ts +41 -2
  170. package/src/server/routes/harness/update.test.ts +56 -2
  171. package/src/server/routes/sessions/delete.test.ts +4 -0
  172. package/src/shared/lib/chat/ask-form/index.ts +39 -31
  173. package/src/shared/lib/chat/ask-form/labels.ts +46 -0
  174. package/src/shared/lib/chat/ask-form/tokens.ts +11 -2
  175. package/src/shared/lib/chat/ask-form.test.ts +57 -0
  176. package/src/shared/lib/chat/ask-questions.ts +31 -0
  177. package/src/shared/lib/chat/composer/history.test.ts +67 -0
  178. package/src/shared/lib/chat/composer/history.ts +61 -0
  179. package/src/shared/lib/chat/irc-notice.ts +42 -0
  180. package/src/shared/lib/chat/timeline/fork-anchor.test.ts +2 -0
  181. package/src/shared/lib/chat/todo/parser.ts +6 -4
  182. package/src/shared/lib/fs/archive.test.ts +101 -0
  183. package/src/shared/lib/fs/archive.ts +191 -0
  184. package/src/shared/lib/fs/clipboard.test.ts +32 -7
  185. package/src/shared/lib/fs/clipboard.ts +59 -14
  186. package/src/shared/lib/fs/csv.test.ts +50 -0
  187. package/src/shared/lib/fs/csv.ts +40 -0
  188. package/src/shared/lib/fs/document-kind.test.ts +13 -6
  189. package/src/shared/lib/fs/document-kind.ts +18 -6
  190. package/src/shared/lib/fs/file-kind-classify.test.ts +4 -0
  191. package/src/shared/lib/fs/file-kind.test.ts +2 -7
  192. package/src/shared/lib/fs/file-kind.ts +4 -2
  193. package/src/shared/lib/fs/grid-edit.test.ts +24 -0
  194. package/src/shared/lib/fs/grid-edit.ts +29 -0
  195. package/src/shared/lib/fs/grid-selection.test.ts +137 -0
  196. package/src/shared/lib/fs/grid-selection.ts +138 -0
  197. package/src/shared/lib/harness/brand-color.ts +5 -0
  198. package/src/shared/lib/harness/catalog.test.ts +22 -0
  199. package/src/shared/lib/harness/catalog.ts +12 -1
  200. package/src/shared/lib/harness/config-fields.test.ts +25 -0
  201. package/src/shared/lib/harness/config-fields.ts +33 -3
  202. package/src/shared/lib/harness/dialects.ts +1 -1
  203. package/src/shared/lib/harness/mcp-facts.ts +4 -0
  204. package/src/shared/lib/harness/provider-contracts.ts +109 -0
  205. package/src/shared/lib/harness/provider-facts.test.ts +2 -1
  206. package/src/shared/lib/harness/provider-facts.ts +24 -115
  207. package/src/shared/lib/harness/provider-lookup.ts +37 -0
  208. package/src/shared/lib/harness/providers.ts +2 -1
  209. package/src/shared/lib/harness/updates.ts +10 -0
  210. package/src/shared/lib/icons/tint-hues.generated.ts +14 -13
  211. package/src/shared/lib/omp/session/mapper.test.ts +31 -0
  212. package/src/shared/lib/omp/session/mapper.ts +17 -0
  213. package/src/shared/lib/omp/session/messages-map-notice.test.ts +68 -0
  214. package/src/shared/lib/omp/session/messages-map.test.ts +1 -35
  215. package/src/shared/lib/omp/session/messages-map.ts +17 -0
  216. package/src/shared/lib/omp/session/wait.ts +10 -1
  217. package/src/shared/lib/settings/sections.ts +8 -4
  218. package/src/shared/lib/ui/picker-filter.test.ts +23 -0
  219. package/src/shared/lib/ui/picker-filter.ts +20 -0
  220. package/src/shared/types/chat.ts +4 -0
  221. package/src/shared/types/harness.ts +5 -1
  222. package/src/shared/types/omp/session.ts +18 -0
  223. package/src/shared/types/settings/state.ts +6 -6
  224. package/src/shared/types/todo.ts +3 -1
  225. package/src/test-support/file-actions.test-util.ts +4 -0
  226. package/src/test-support/file-archive.test-util.ts +41 -0
  227. package/src/test-support/file-clipboard.test-util.ts +9 -6
  228. package/src/test-support/file-editor.test-util.ts +3 -2
  229. package/src/test-support/glass-css.ts +30 -0
  230. package/src/test-support/harness-table.test-util.ts +2 -0
  231. package/src/test-support/preload.ts +46 -0
  232. package/dist/client/static/js/index-81f7berm.css +0 -1
@@ -113,6 +113,32 @@ describe('fs paste', () => {
113
113
  expect(fs.readFileSync(path.join(DIR, 'a.ts'), 'utf8')).toBe('A');
114
114
  });
115
115
 
116
+ test('a multi-entry cut moves every source in one request', async () => {
117
+ reset({
118
+ 'tmp-fs-transfer-probe/a.ts': 'A',
119
+ 'tmp-fs-transfer-probe/b.ts': 'B',
120
+ 'tmp-fs-transfer-probe/dest/.keep': '',
121
+ });
122
+
123
+ const form = new FormData();
124
+ for (const [key, value] of Object.entries({
125
+ root: process.cwd(),
126
+ actionType: 'paste',
127
+ mode: 'cut',
128
+ targetPath: 'tmp-fs-transfer-probe/dest',
129
+ targetKind: 'folder',
130
+ })) form.append(key, value);
131
+ form.append('sourcePath', 'tmp-fs-transfer-probe/a.ts');
132
+ form.append('sourcePath', 'tmp-fs-transfer-probe/b.ts');
133
+ const res = await action({ request: new Request('http://localhost/api/fs/action', { method: 'POST', body: form }) } as never);
134
+ const body = (await res.json()) as { success?: boolean; paths?: string[]; failures?: unknown[] };
135
+
136
+ expect(res.status).toBe(200);
137
+ expect(body.paths?.sort()).toEqual(['tmp-fs-transfer-probe/dest/a.ts', 'tmp-fs-transfer-probe/dest/b.ts']);
138
+ expect(fs.existsSync(path.join(DIR, 'a.ts'))).toBe(false);
139
+ expect(fs.readFileSync(path.join(DIR, 'dest/b.ts'), 'utf8')).toBe('B');
140
+ });
141
+
116
142
  test('refuses a folder pasted into its own subtree', async () => {
117
143
  reset({ 'tmp-fs-transfer-probe/src/a.ts': 'A', 'tmp-fs-transfer-probe/src/deep/.keep': '' });
118
144
 
@@ -7,12 +7,14 @@ import { getDefaultFsRoot, isWithinRoot, resolveRoot, resolveWithinRoot } from '
7
7
  import { runShell } from '@/server/lib/fs/shell';
8
8
  import { revealInFileManager } from '@/server/lib/fs/reveal';
9
9
  import { duplicateEntry, nextDuplicateName, pasteEntry, toRelPath } from '@/server/lib/fs/transfer';
10
+ import { runArchiveAction, runBatchDeleteAction } from '@/server/routes/fs/action-bulk';
10
11
  import { normalizeRelativePath } from '@/server/lib/fs/relative-path';
11
12
  import { isSinglePathSegment } from '@/server/lib/fs/path-segment';
12
13
  import { checkWriteConflict, parseBaseMtime, stableMtime } from '@/server/lib/fs/write-conflict';
13
14
  import { transferRefusal } from '@/shared/lib/fs/clipboard';
14
15
  import { toDiskText } from '@/shared/lib/code/line-endings';
15
16
  import { contentHash } from '@/shared/lib/fs/content-hash';
17
+ import { DOCUMENT_MAX_FILE_BYTES } from '@/shared/lib/fs/file-kind';
16
18
 
17
19
  /** The two shapes a transfer action answers with, ready for `json`. */
18
20
  function transferResponse(outcome: { path?: string; error?: string; status?: number }) {
@@ -51,22 +53,54 @@ async function runDuplicateAction(options: { filePath: string; scopedRoot: strin
51
53
  async function runPasteAction(options: { formData: FormData; scopedRoot: string }) {
52
54
  const { formData, scopedRoot } = options;
53
55
  const mode = formData.get('mode') === 'cut' ? 'cut' : 'copy';
54
- const sourceRel = ((formData.get('sourcePath') as string) ?? '').trim();
55
- const sourcePath = resolveWithinRoot(scopedRoot, sourceRel);
56
- if (!sourcePath) return json({ error: 'Invalid path' }, { status: 403 });
57
- const sourceStat = await Bun.file(sourcePath).stat().catch(() => null);
58
- if (!sourceStat) return json({ error: 'The entry on the clipboard no longer exists' }, { status: 404 });
56
+ // Repeated fields carry a whole selection; a single `sourcePath` from an older
57
+ // client is the same list of one.
58
+ const sourceRels = formData.getAll('sourcePath').map((value) => String(value).trim()).filter(Boolean);
59
+ if (sourceRels.length === 0) return json({ error: 'Nothing to paste' }, { status: 400 });
59
60
  const rawTarget = ((formData.get('targetPath') as string) ?? '').trim() || '.';
60
61
  const rawTargetKind = formData.get('targetKind') === 'folder' ? 'folder' : 'file';
61
62
  const targetDir = rawTargetKind === 'folder' ? rawTarget : path.dirname(rawTarget);
62
- const refusal = transferRefusal(
63
- { path: sourceRel, kind: sourceStat.isDirectory() ? 'folder' : 'file' },
64
- targetDir,
65
- );
66
- if (refusal) return json({ error: refusal }, { status: 409 });
67
63
  const fullDir = resolveWithinRoot(scopedRoot, targetDir);
68
64
  if (!fullDir) return json({ error: 'Invalid path' }, { status: 403 });
69
- return transferResponse(await pasteEntry({ scopedRoot, sourcePath, destinationDir: fullDir, mode }));
65
+
66
+ // VALIDATE the whole batch before moving anything: a refusal on the third
67
+ // entry must leave the first two where they were, or the answer says "no"
68
+ // while the tree has already changed.
69
+ const sources: { rel: string; full: string }[] = [];
70
+ const failures: { path: string; error: string }[] = [];
71
+ for (const sourceRel of sourceRels) {
72
+ const sourcePath = resolveWithinRoot(scopedRoot, sourceRel);
73
+ if (!sourcePath) return json({ error: 'Invalid path' }, { status: 403 });
74
+ const sourceStat = await Bun.file(sourcePath).stat().catch(() => null);
75
+ if (!sourceStat) {
76
+ failures.push({ path: sourceRel, error: 'The entry on the clipboard no longer exists' });
77
+ continue;
78
+ }
79
+ const refusal = transferRefusal(
80
+ { path: sourceRel, kind: sourceStat.isDirectory() ? 'folder' : 'file' },
81
+ targetDir,
82
+ );
83
+ if (refusal) return json({ error: refusal }, { status: 409 });
84
+ sources.push({ rel: sourceRel, full: sourcePath });
85
+ }
86
+
87
+ const paths: string[] = [];
88
+ for (const source of sources) {
89
+ const outcome = await pasteEntry({ scopedRoot, sourcePath: source.full, destinationDir: fullDir, mode });
90
+ if (outcome.error) failures.push({ path: source.rel, error: outcome.error });
91
+ else if (outcome.path) paths.push(outcome.path);
92
+ }
93
+
94
+ if (paths.length === 0 && failures.length > 0) {
95
+ // The single-entry answer keeps the status it always had, so a stale tab
96
+ // still reads "that entry is gone" rather than a generic 400.
97
+ const missing = failures.every((failure) => failure.error.includes('no longer exists'));
98
+ return json({ error: failures[0]!.error }, { status: missing ? 404 : 400 });
99
+ }
100
+ // One source answers the shape the panel has always read; a batch names the
101
+ // whole list so the reload after it can reveal what moved.
102
+ if (sourceRels.length === 1) return json({ success: true, path: paths[0] });
103
+ return json(failures.length > 0 ? { success: true, paths, failures } : { success: true, paths });
70
104
  }
71
105
 
72
106
  export async function action({ request }: ActionFunctionArgs) {
@@ -89,6 +123,16 @@ export async function action({ request }: ActionFunctionArgs) {
89
123
  return await runPasteAction({ formData, scopedRoot });
90
124
  }
91
125
 
126
+ // The archive verbs name their own paths (`path`/`paths`), so they are
127
+ // dispatched BEFORE the single-`path` resolution: a compress request has no
128
+ // `path` field at all, and resolving `undefined` is a crash, not a refusal.
129
+ if (actionType === 'extract' || actionType === 'compress') {
130
+ return await runArchiveAction({ actionType, formData, scopedRoot });
131
+ }
132
+ if (actionType === 'delete' && typeof formData.get('paths') === 'string') {
133
+ return await runBatchDeleteAction({ formData, scopedRoot });
134
+ }
135
+
92
136
  const fullPath = resolveWithinRoot(scopedRoot, filePath);
93
137
 
94
138
  if (!fullPath) {
@@ -137,6 +181,42 @@ export async function action({ request }: ActionFunctionArgs) {
137
181
  mtimeMs: written ? stableMtime(written.mtimeMs) : null,
138
182
  hash: await contentHash(content),
139
183
  });
184
+ } else if (actionType === 'saveBytes') {
185
+ // A workbook the grid edited: the bytes are the file, so they travel as a
186
+ // Blob rather than as a text field. `content` cannot carry them — a
187
+ // multipart text field is UTF-8 and normalizes line endings, which would
188
+ // corrupt a ZIP container.
189
+ const blob = formData.get('bytes');
190
+ if (!(blob instanceof Blob)) {
191
+ return json({ error: 'No file bytes' }, { status: 400 });
192
+ }
193
+ if (blob.size > DOCUMENT_MAX_FILE_BYTES) {
194
+ return json({ error: 'The edited file is larger than the editor writes.' }, { status: 413 });
195
+ }
196
+ const verdict = await checkWriteConflict(
197
+ fullPath,
198
+ parseBaseMtime(formData.get('baseMtime')),
199
+ async (target) => {
200
+ const stat = await Bun.file(target).stat().catch(() => null);
201
+ return stat && !stat.isDirectory() ? { mtimeMs: stat.mtimeMs } : null;
202
+ },
203
+ );
204
+ if (!verdict.write) {
205
+ return json(
206
+ {
207
+ error: 'This file changed on disk since it was opened.',
208
+ conflict: true,
209
+ mtimeMs: verdict.diskMtimeMs,
210
+ },
211
+ { status: 409 },
212
+ );
213
+ }
214
+ await fs.promises.mkdir(path.dirname(fullPath), { recursive: true });
215
+ await Bun.write(fullPath, blob);
216
+ const written = await Bun.file(fullPath).stat().catch(() => null);
217
+ // No content hash: the digest route hashes TEXT, and a workbook is not
218
+ // text. The mtime is what the next save's conflict base needs.
219
+ return json({ success: true, mtimeMs: written ? stableMtime(written.mtimeMs) : null, hash: null });
140
220
  } else if (actionType === 'saveAs') {
141
221
  // Write the buffer to a NEW path. The destination is `path` (a directory) plus
142
222
  // `name` (ONE segment), both resolved against this route's own scope — a
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * `GET /api/fs/archive` — which compress formats this machine can write.
8
+ *
9
+ * The dialog cannot guess: `rar` is almost never installed and `7z` is not on
10
+ * a stock macOS. Offering a format the server then refuses with ENOENT is a
11
+ * dead row; asking here means the dialog lists exactly the tools the machine
12
+ * has, and the user learns the reason before typing a name.
13
+ */
14
+
15
+ import { json } from '@/server/lib/remix-compat';
16
+ import { compressFormats } from '@/server/lib/fs/archive';
17
+
18
+ export async function loader() {
19
+ return json({ formats: compressFormats() });
20
+ }
@@ -20,21 +20,24 @@ import path from 'path';
20
20
  import { action } from '@/server/routes/fs/grant';
21
21
  import { resolveFileScope } from '@/server/routes/fs/scope';
22
22
  import { clearExternalRoots, externalRoots, isExternalRoot } from '@/server/lib/fs/external-roots';
23
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
23
24
 
24
25
  /** A file OUTSIDE the app root and outside every workspace. */
25
26
  let outside: string;
26
27
  let outsideFile: string;
27
28
 
28
- beforeEach(() => {
29
+ beforeEach(async () => {
30
+ await isolateDb();
29
31
  clearExternalRoots();
30
32
  outside = fs.mkdtempSync(path.join(os.tmpdir(), 'kabmo-grant-'));
31
33
  outsideFile = path.join(outside, 'report.md');
32
34
  fs.writeFileSync(outsideFile, '# report\n');
33
35
  });
34
36
 
35
- afterEach(() => {
37
+ afterEach(async () => {
36
38
  clearExternalRoots();
37
39
  fs.rmSync(outside, { recursive: true, force: true });
40
+ await releaseDb();
38
41
  });
39
42
 
40
43
  function grantRequest(body: unknown, headers: Record<string, string> = {}): Request {
@@ -5,6 +5,7 @@ import { fileExists } from '@/server/routes/fs/exists';
5
5
  import { fileDigest } from '@/server/routes/fs/digest';
6
6
  import { serveRawFile } from '@/server/routes/fs/raw';
7
7
  import * as fsAction from '@/server/routes/fs/action';
8
+ import * as fsArchive from '@/server/routes/fs/archive';
8
9
  import * as fsGit from '@/server/routes/fs/git';
9
10
  import * as fsGrant from '@/server/routes/fs/grant';
10
11
  import * as fsReplace from '@/server/routes/fs/replace';
@@ -13,6 +14,7 @@ import * as fsValidate from '@/server/routes/fs/validate';
13
14
 
14
15
  export const fsBindings: HandlerBinding[] = [
15
16
  ...bindingsFor(fsAction, '/api/fs/action'),
17
+ ...bindingsFor(fsArchive, '/api/fs/archive'),
16
18
  ...bindingsFor(fsGit, '/api/fs/git'),
17
19
  ...bindingsFor(fsGrant, '/api/fs/grant', { mutating: ['POST'] }),
18
20
  ...bindingsFor(fsReplace, '/api/fs/replace'),
@@ -15,19 +15,23 @@
15
15
  * scoped to).
16
16
  */
17
17
 
18
- import { afterEach, describe, expect, test } from 'bun:test';
18
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
19
19
  import fs from 'fs';
20
20
  import path from 'path';
21
21
  import { testPosix } from '@/test-support/platform';
22
22
  import { resolveFileScope } from '@/server/routes/fs/scope';
23
23
  import { DOCUMENT_MAX_FILE_BYTES, EDITOR_MAX_FILE_BYTES, PDF_MAX_FILE_BYTES } from '@/shared/lib/fs/file-kind';
24
24
  import { formatBytes } from '@/shared/lib/format/number';
25
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
25
26
 
26
27
  const APP = process.cwd();
27
28
  const DIR = path.join(APP, 'tmp-scope-probe');
28
29
 
29
- afterEach(() => {
30
+ beforeEach(isolateDb);
31
+
32
+ afterEach(async () => {
30
33
  fs.rmSync(DIR, { recursive: true, force: true });
34
+ await releaseDb();
31
35
  });
32
36
 
33
37
  async function scope(rawPath: string) {
@@ -26,7 +26,7 @@
26
26
  import { json } from '@/server/lib/remix-compat';
27
27
  import { isBuiltinHarness, type HarnessId } from '@/shared/lib/harness/catalog';
28
28
  import { adaptBaseUrl, planProtocol, supportedProtocols, type CanonicalProtocol } from '@/shared/lib/harness/dialects';
29
- import { providerFacts } from '@/shared/lib/harness/provider-facts';
29
+ import { providerFacts } from '@/shared/lib/harness/provider-lookup';
30
30
  import { providerEnv, providerLevel, registryLabel } from '@/shared/lib/harness/providers';
31
31
  import { providerIdProblem, providerSlugFrom } from '@/shared/lib/harness/provider-slug';
32
32
  import { withEnvValues } from '@/shared/lib/harness/config';
@@ -35,7 +35,7 @@ import {
35
35
  providerLevel,
36
36
  registryLabel,
37
37
  } from '@/shared/lib/harness/providers';
38
- import { providerFacts } from '@/shared/lib/harness/provider-facts';
38
+ import { providerFacts } from '@/shared/lib/harness/provider-lookup';
39
39
  import type { HarnessProviderSupport } from '@/shared/types/harness';
40
40
  import { parseHarnessConfig, type HarnessConfig } from '@/shared/lib/harness/config';
41
41
 
@@ -60,6 +60,8 @@ export interface HarnessSummary {
60
60
  /** The letter the UI draws when there is no vendor mark. */
61
61
  initial: string;
62
62
  install?: string;
63
+ /** The built-in launch line, as the config form should show it. */
64
+ command?: string;
63
65
  note?: string;
64
66
  probe: HarnessProbe | null;
65
67
  /** Why it cannot run, without probing: the launch command is missing. */
@@ -102,6 +104,9 @@ export async function listHarnesses(): Promise<HarnessSummary[]> {
102
104
  ...(descriptor?.builtIn ? { builtIn: true as const } : {}),
103
105
  ...(isBuiltinHarness(id) ? {} : { custom: true as const }),
104
106
  ...(launch?.install ? { install: launch.install } : {}),
107
+ // The line a spawn actually runs when the config's command is empty —
108
+ // what the settings card's placeholder must name.
109
+ ...(launch?.command.length ? { command: launch.command.join(' ') } : {}),
105
110
  ...(launch?.note ? { note: launch.note } : {}),
106
111
  probe: fresh,
107
112
  ...(available ? {} : {
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * What the settings card's launch box is told about the agent.
8
+ *
9
+ * The box advertised `agy acp` on every card — Antigravity's line, printed on
10
+ * omp's and Claude's too — and its hint quoted the INSTALL command as "the
11
+ * built-in line". A user typing that hint's example launches nothing, and the
12
+ * form's placeholder claimed a command this harness does not run.
13
+ *
14
+ * So the catalog now carries the line the spawn would actually run, and this
15
+ * pins it to the launch table itself rather than to a second copy.
16
+ */
17
+
18
+ import { afterEach, beforeEach, describe, expect, test } from 'bun:test';
19
+
20
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
21
+ import { HARNESS_LAUNCH } from '@/server/lib/harness/launch-table';
22
+ import { listHarnesses } from '@/server/routes/harness/root';
23
+
24
+ beforeEach(async () => {
25
+ await isolateDb();
26
+ });
27
+
28
+ afterEach(async () => {
29
+ await releaseDb();
30
+ });
31
+
32
+ describe('the catalog carries each harness’s own launch line', () => {
33
+ test('every harness with a launch entry reports that entry’s command', async () => {
34
+ const rows = new Map((await listHarnesses()).map((row) => [row.id, row]));
35
+ for (const [id, launch] of Object.entries(HARNESS_LAUNCH)) {
36
+ if (!launch) continue;
37
+ expect(rows.get(id)?.command, id).toBe(launch.command.join(' '));
38
+ }
39
+ });
40
+
41
+ test('omp and Claude name their own binaries, not Antigravity’s', async () => {
42
+ const rows = new Map((await listHarnesses()).map((row) => [row.id, row]));
43
+ expect(rows.get('omp-acp')?.command).toBe('omp acp');
44
+ expect(rows.get('claude')?.command).toBe(
45
+ 'npx -y @agentclientprotocol/claude-agent-acp@0.100.0',
46
+ );
47
+ // The install line is a different fact and must not stand in for the command.
48
+ expect(rows.get('omp-acp')?.command).not.toBe(rows.get('omp-acp')?.install);
49
+ });
50
+ });
@@ -4,7 +4,8 @@
4
4
  */
5
5
 
6
6
  /**
7
- * `GET /api/harness/update/status` — every harness's background update record.
7
+ * `GET /api/harness/update/status` — every harness's background update record —
8
+ * and `DELETE` on the same path, which dismisses one settled result.
8
9
  *
9
10
  * The POST answers in milliseconds and the install keeps running in a detached
10
11
  * worker, so this is how the dialog learns where each run is and whether it
@@ -21,12 +22,50 @@
21
22
  * An empty array is a real answer — no update has ever run — and it must not be
22
23
  * a 404: the About card asks this on every open, and a "not found" would read as
23
24
  * a broken route rather than "nothing is running".
25
+ *
26
+ * **A settled record is history, and history can be dismissed.** The row used to
27
+ * keep "claude updated (adapter) — it now reports 0.106.0" forever, because the
28
+ * record had no way out: a dismissal has to delete it (or the next open reads it
29
+ * back) and must refuse while the run is still moving — deleting a live record
30
+ * would hide the spinner and let a second install start.
24
31
  */
25
32
 
26
33
  import { json, NO_STORE_HEADERS } from '@/server/lib/remix-compat';
27
- import { pumpUpdateQueue } from '@/server/lib/harness/update-queue.server';
34
+ import type { ActionFunctionArgs } from '@/server/lib/remix-compat';
35
+ import { methodNotAllowed, parseJsonBody } from '@/server/lib/route-adapter';
36
+ import { getHarnessUpdateStatusPath } from '@/server/lib/lifecycle/paths';
37
+ import { pumpUpdateQueue, serializeUpdateWork } from '@/server/lib/harness/update-queue.server';
38
+ import { readUpdateJob, removeUpdateJob } from '@/server/lib/harness/update-job-store';
39
+ import { isBuiltinHarness } from '@/shared/lib/harness/catalog';
40
+ import { jobUnfinished } from '@/shared/lib/harness/update-job';
28
41
 
29
42
  export async function loader() {
30
43
  const jobs = await pumpUpdateQueue();
31
44
  return json({ jobs }, { headers: NO_STORE_HEADERS });
32
45
  }
46
+
47
+ export async function action({ request, params }: ActionFunctionArgs) {
48
+ if (request.method !== 'DELETE') return methodNotAllowed({ request, params });
49
+
50
+ const parsed = await parseJsonBody<{ harness?: unknown }>(request);
51
+ if (!parsed.ok) return json({ error: 'Request body is not valid JSON' }, { status: 400 });
52
+ const id = parsed.body?.harness;
53
+ if (typeof id !== 'string' || !isBuiltinHarness(id)) {
54
+ return json({ error: 'Unknown harness' }, { status: 400 });
55
+ }
56
+
57
+ // Serialized with the queue's own reads/writes: the post-install probe writes
58
+ // the record after answering, so a delete between its read and its write would
59
+ // otherwise be undone and the dismissed message would come back.
60
+ return serializeUpdateWork(async () => {
61
+ const path = getHarnessUpdateStatusPath(id);
62
+ const job = await readUpdateJob(path);
63
+ if (job && jobUnfinished(job)) {
64
+ return json({
65
+ error: `${job.label} update is still ${job.queuedAt !== null ? 'queued' : 'running'} — nothing to dismiss yet`,
66
+ }, { status: 409, headers: NO_STORE_HEADERS });
67
+ }
68
+ await removeUpdateJob(path);
69
+ return json({ dismissed: true }, { headers: NO_STORE_HEADERS });
70
+ });
71
+ }
@@ -22,8 +22,8 @@ import { mkdtempSync, rmSync } from 'node:fs';
22
22
  import { tmpdir } from 'node:os';
23
23
  import { join } from 'node:path';
24
24
  import { action } from '@/server/routes/harness/update';
25
- import { loader as statusLoader } from '@/server/routes/harness/update-status';
26
- import { writeUpdateJob } from '@/server/lib/harness/update-job-store';
25
+ import { action as statusAction, loader as statusLoader } from '@/server/routes/harness/update-status';
26
+ import { readUpdateJob, writeUpdateJob } from '@/server/lib/harness/update-job-store';
27
27
  import { getHarnessUpdateStatusPath } from '@/server/lib/lifecycle/paths';
28
28
  import type { HarnessUpdateJob } from '@/shared/types/harness-update';
29
29
 
@@ -53,6 +53,17 @@ function post(harness: string): Parameters<typeof action>[0] {
53
53
  } as Parameters<typeof action>[0];
54
54
  }
55
55
 
56
+ function dismiss(harness: string): Parameters<typeof statusAction>[0] {
57
+ return {
58
+ request: new Request('http://localhost/api/harness/update/status', {
59
+ method: 'DELETE',
60
+ headers: { 'content-type': 'application/json' },
61
+ body: JSON.stringify({ harness }),
62
+ }),
63
+ params: {},
64
+ } as Parameters<typeof statusAction>[0];
65
+ }
66
+
56
67
  function job(overrides: Partial<HarnessUpdateJob> = {}): HarnessUpdateJob {
57
68
  return {
58
69
  harness: 'claude',
@@ -154,3 +165,46 @@ describe('GET /api/harness/update/status', () => {
154
165
  expect(codex?.pid).toBeNull();
155
166
  });
156
167
  });
168
+
169
+ describe('DELETE /api/harness/update/status', () => {
170
+ test('an unknown harness is refused', async () => {
171
+ const response = (await statusAction(dismiss('nope'))) as Response;
172
+ expect(response.status).toBe(400);
173
+ expect(((await response.json()) as { error: string }).error).toBe('Unknown harness');
174
+ });
175
+
176
+ test('a settled record is deleted, so the row stops quoting it', async () => {
177
+ // The reported defect: "claude updated (adapter) — it now reports 0.106.0"
178
+ // stayed in About after the update finished, with no way out. The dismissal
179
+ // removes the record itself, because a closed card reads it back from disk.
180
+ await writeUpdateJob(job({
181
+ pid: null,
182
+ finishedAt: Date.now(),
183
+ ok: true,
184
+ applied: true,
185
+ probe: 'done',
186
+ message: 'claude updated (adapter) — it now reports 0.106.0',
187
+ }), getHarnessUpdateStatusPath('claude'));
188
+
189
+ const response = (await statusAction(dismiss('claude'))) as Response;
190
+ expect(response.status).toBe(200);
191
+ expect(((await response.json()) as { dismissed: boolean }).dismissed).toBe(true);
192
+ expect(await readUpdateJob(getHarnessUpdateStatusPath('claude'))).toBeNull();
193
+
194
+ const list = (await statusLoader()) as Response;
195
+ expect(((await list.json()) as { jobs: unknown[] }).jobs).toEqual([]);
196
+ });
197
+
198
+ test('a run that is still installing or QUEUED is refused, and its record survives', async () => {
199
+ // Deleting a live record would hide the spinner and let a second install
200
+ // start over the same global prefix.
201
+ await writeUpdateJob(
202
+ job({ harness: 'codex', label: 'codex', pid: null, queuedAt: Date.now() }),
203
+ getHarnessUpdateStatusPath('codex'),
204
+ );
205
+ const response = (await statusAction(dismiss('codex'))) as Response;
206
+ expect(response.status).toBe(409);
207
+ expect(((await response.json()) as { error: string }).error).toContain('still queued');
208
+ expect(await readUpdateJob(getHarnessUpdateStatusPath('codex'))).not.toBeNull();
209
+ });
210
+ });
@@ -21,6 +21,10 @@ import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
21
21
  import fs from 'fs';
22
22
  import path from 'path';
23
23
  import { deleteSession } from '@/server/routes/sessions/delete';
24
+ import { isolateDb, releaseDb } from '@/test-support/isolated-db';
25
+
26
+ beforeAll(isolateDb);
27
+ afterAll(releaseDb);
24
28
 
25
29
  /**
26
30
  * The 404 branch resolves the id by scanning the sessions directory, so the
@@ -22,6 +22,7 @@
22
22
 
23
23
  import type { AskQuestion } from '@/shared/lib/chat/ask-form/types';
24
24
  import { toQuestions, type DraftField, type DraftOption } from '@/shared/lib/chat/ask-form/fields';
25
+ import { IGNORED_INPUTS, readLabelTargets } from '@/shared/lib/chat/ask-form/labels';
25
26
  import {
26
27
  BLOCK,
27
28
  findChild,
@@ -36,34 +37,6 @@ import {
36
37
  type Token,
37
38
  } from '@/shared/lib/chat/ask-form/tokens';
38
39
 
39
- const IGNORED_INPUTS: Record<string, true> = {
40
- button: true,
41
- file: true,
42
- image: true,
43
- reset: true,
44
- submit: true,
45
- hidden: true,
46
- };
47
-
48
- /** Pre-pass: ids of controls, and the `<label for>` text that names them. */
49
- function readLabelTargets(tokens: Token[]): Map<string, string> {
50
- const ids = new Set<string>();
51
- for (const token of tokens) {
52
- if (token.kind !== 'open') continue;
53
- if (token.tag !== 'input' && token.tag !== 'select' && token.tag !== 'textarea') continue;
54
- if (token.attrs.id) ids.add(token.attrs.id);
55
- }
56
- const labels = new Map<string, string>();
57
- for (let index = 0; index < tokens.length; index += 1) {
58
- const token = tokens[index];
59
- if (token.kind !== 'open' || token.tag !== 'label' || token.selfClosing) continue;
60
- const target = token.attrs.for;
61
- if (!target || !ids.has(target) || labels.has(target)) continue;
62
- labels.set(target, textOf(tokens, index + 1, matchingClose(tokens, index, 'label')));
63
- }
64
- return labels;
65
- }
66
-
67
40
  /** Fields of one form, in document order, with the question text omp derives. */
68
41
  export function parseAskForm(html: string): AskQuestion[] {
69
42
  if (!html.trim()) return [];
@@ -84,7 +57,12 @@ export function parseAskForm(html: string): AskQuestion[] {
84
57
  };
85
58
 
86
59
  const addField = (field: DraftField) => {
60
+ // The text block immediately before a control is its caption (omp's
61
+ // `fieldQuestions`), so the pending inline run must be flushed BEFORE the
62
+ // field is built — flushing after left `<span>Which?</span><select>` with
63
+ // the control's own name as its question.
87
64
  flush();
65
+ field.caption = caption;
88
66
  fields.push(field);
89
67
  caption = '';
90
68
  };
@@ -104,7 +82,10 @@ export function parseAskForm(html: string): AskQuestion[] {
104
82
  const value = attrs.value ?? 'on';
105
83
  const option: DraftOption = {
106
84
  value,
107
- label: controlLabel(attrs, wrapping) || value || name,
85
+ // omp's fallback is the RAW `value` attribute, else the name — not the
86
+ // `on` default a valueless checkbox submits. Using `on` made a lone
87
+ // checkbox's question "on" while omp's dialog title was its name.
88
+ label: controlLabel(attrs, wrapping) || attrs.value || name,
108
89
  checked: 'checked' in attrs,
109
90
  disabled: 'disabled' in attrs,
110
91
  };
@@ -212,7 +193,12 @@ export function parseAskForm(html: string): AskQuestion[] {
212
193
  else if (tag === 'input') addInput(token.attrs, wrapping);
213
194
  continue;
214
195
  }
215
- const close = matchingClose(tokens, index, tag);
196
+ // An unclosed tag (`<span class="truncate">` written literally inside a
197
+ // code span) has no `</span>`; `matchingClose` then answers the end of the
198
+ // document, and walking to it re-walked every field after the enclosing
199
+ // block — the same question appeared twice and the frame could not be
200
+ // placed. Clamp to the range this walk owns.
201
+ const close = Math.min(matchingClose(tokens, index, tag), end);
216
202
  if (SKIPPED[tag]) {
217
203
  index = close;
218
204
  continue;
@@ -267,7 +253,20 @@ export function parseAskForm(html: string): AskQuestion[] {
267
253
  index = close;
268
254
  continue;
269
255
  }
270
- if (tag === 'ul' || tag === 'ol' || tag === 'pre' || tag === 'table') {
256
+ // A `<table>` of controls (a decision matrix) is LAYOUT: omp walks it, so
257
+ // the row's text captions the control and the field survives. Treating
258
+ // every table as prose dropped the fields entirely, and a tool call whose
259
+ // questions never parsed cannot claim its dialogs — the whole ask fell to
260
+ // the modal.
261
+ if (tag === 'table') {
262
+ settle();
263
+ if (hasControl(tokens, index + 1, close)) walk(index + 1, close, wrapping, depth, quiet);
264
+ else if (!quiet) caption = '';
265
+ settle();
266
+ index = close;
267
+ continue;
268
+ }
269
+ if (tag === 'ul' || tag === 'ol' || tag === 'pre') {
271
270
  settle();
272
271
  // A list of controls is layout; any other list is a block, which clears
273
272
  // the caption the next field would otherwise borrow.
@@ -280,6 +279,15 @@ export function parseAskForm(html: string): AskQuestion[] {
280
279
  index = close;
281
280
  continue;
282
281
  }
282
+ // Cell boundaries separate one cell's text from the next; without them
283
+ // every cell in a row ran together into one caption.
284
+ if (tag === 'td' || tag === 'th' || tag === 'tr') {
285
+ settle();
286
+ walk(index + 1, close, wrapping, depth, quiet);
287
+ settle();
288
+ index = close;
289
+ continue;
290
+ }
283
291
  if (tag === 'input') {
284
292
  addInput(token.attrs, wrapping);
285
293
  continue;