@kabmo-labs/kabmo 0.21.0 → 0.22.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 (295) hide show
  1. package/README.md +7 -2
  2. package/dist/client/index.html +9 -8
  3. package/dist/client/index.js +334 -334
  4. package/dist/client/static/js/{index-zg32n2sk.js → index-297dck9a.js} +784 -791
  5. package/dist/client/static/js/index-7ppta1pb.css +1 -0
  6. package/extensions/kabmo-modes/commands.ts +17 -3
  7. package/extensions/kabmo-modes/goal-start.ts +101 -0
  8. package/extensions/kabmo-modes/goal.test.ts +80 -5
  9. package/extensions/kabmo-modes/goal.ts +13 -38
  10. package/extensions/kabmo-modes/prompts.test.ts +12 -0
  11. package/extensions/kabmo-modes/prompts.ts +9 -2
  12. package/index.html +8 -7
  13. package/package.json +2 -2
  14. package/src/cli/lib/args.js +9 -0
  15. package/src/cli/lib/args.test.js +26 -0
  16. package/src/cli/lib/commands/doctor.js +153 -0
  17. package/src/cli/lib/commands/doctor.test.js +139 -0
  18. package/src/cli/lib/commands/serve.js +23 -10
  19. package/src/cli/lib/commands/status.js +22 -3
  20. package/src/cli/lib/omp-setup.js +131 -0
  21. package/src/cli/lib/omp-setup.test.js +115 -0
  22. package/src/cli/main.js +1 -1
  23. package/src/client/components/common/DemoDataBadge.tsx +52 -0
  24. package/src/client/components/common/FolderPicker.tsx +2 -2
  25. package/src/client/components/common/Modal.tsx +15 -1
  26. package/src/client/components/common/code-surface/blame-panel.ts +1 -1
  27. package/src/client/components/common/context-usage-button/index.test.tsx +1 -1
  28. package/src/client/components/common/context-usage-button/index.tsx +4 -4
  29. package/src/client/components/common/demo-data-badge.test.tsx +58 -0
  30. package/src/client/components/common/diagram-viewer/index.tsx +2 -2
  31. package/src/client/components/common/editor-view-buttons/index.tsx +2 -2
  32. package/src/client/components/common/header-controls/MoreMenu.tsx +1 -1
  33. package/src/client/components/common/header-controls/index.tsx +4 -1
  34. package/src/client/components/common/markdown-review/ReviewPopover.tsx +2 -2
  35. package/src/client/components/common/markdown-review/ReviewSummary.tsx +1 -1
  36. package/src/client/components/common/panel-mark/index.tsx +2 -1
  37. package/src/client/components/common/server-control/Panel.tsx +3 -3
  38. package/src/client/components/common/server-control/index.tsx +1 -1
  39. package/src/client/components/common/shell-update-button/Modal.tsx +1 -1
  40. package/src/client/components/common/todo-row/index.tsx +1 -1
  41. package/src/client/components/layout/ActivityBar.tsx +4 -0
  42. package/src/client/components/layout/ShellNotice.tsx +33 -0
  43. package/src/client/components/layout/desktop-layout/index.tsx +14 -16
  44. package/src/client/components/layout/desktop-layout/resizer/index.tsx +14 -1
  45. package/src/client/components/layout/session-sidebar/CategoryHeader.tsx +2 -1
  46. package/src/client/components/layout/session-sidebar/ClassicView.tsx +5 -1
  47. package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
  48. package/src/client/components/layout/session-sidebar/SessionListNotice.tsx +56 -0
  49. package/src/client/components/layout/session-sidebar/SessionsView.tsx +2 -0
  50. package/src/client/components/layout/session-sidebar/about-modal/UpdateSection.tsx +1 -1
  51. package/src/client/components/layout/session-sidebar/about-modal/index.tsx +12 -1
  52. package/src/client/components/layout/session-sidebar/modern/WorkspaceHeader.tsx +2 -1
  53. package/src/client/components/layout/session-sidebar/modern/index.tsx +6 -2
  54. package/src/client/components/layout/session-sidebar/new-workspace-modal/CloneField.tsx +1 -1
  55. package/src/client/components/layout/session-sidebar/new-workspace-modal/index.tsx +2 -2
  56. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskForm.tsx +1 -1
  57. package/src/client/components/layout/session-sidebar/scheduler-modal/TaskList.tsx +3 -3
  58. package/src/client/components/layout/session-sidebar/scheduler-modal/index.tsx +1 -1
  59. package/src/client/components/layout/session-sidebar/session-list-states.test.tsx +150 -0
  60. package/src/client/components/layout/session-sidebar/variant-props.ts +6 -0
  61. package/src/client/components/mobile/LayoutWrapper.tsx +20 -30
  62. package/src/client/components/mobile/MainView.tsx +5 -2
  63. package/src/client/components/mobile/RightSidebar.tsx +1 -1
  64. package/src/client/components/mobile/SessionSidebar.tsx +3 -0
  65. package/src/client/components/mobile/mobile-main-view/Header.tsx +2 -2
  66. package/src/client/components/mobile/mobile-session-sidebar/ClassicDrawer.tsx +7 -1
  67. package/src/client/components/mobile/mobile-session-sidebar/Toolbar.tsx +1 -1
  68. package/src/client/components/settings/Modal.tsx +15 -1
  69. package/src/client/components/settings/ProjectSelectorDropdown.tsx +1 -1
  70. package/src/client/components/settings/Sidebar.tsx +2 -2
  71. package/src/client/components/settings/categories/OmpSettings.tsx +1 -1
  72. package/src/client/components/settings/categories/TokenUsageSettings.tsx +1 -1
  73. package/src/client/components/settings/categories/agent-settings/DetailPane.tsx +3 -3
  74. package/src/client/components/settings/categories/appearance-settings/EditorFontSection.tsx +1 -1
  75. package/src/client/components/settings/categories/appearance-settings/EditorThemeSection.tsx +2 -2
  76. package/src/client/components/settings/categories/appearance-settings/IconStyleSection.tsx +5 -5
  77. package/src/client/components/settings/categories/appearance-settings/SidebarStyleSection.tsx +1 -1
  78. package/src/client/components/settings/categories/appearance-settings/SurfaceStyleSection.tsx +1 -1
  79. package/src/client/components/settings/categories/appearance-settings/ThemeCard.tsx +1 -1
  80. package/src/client/components/settings/categories/chat-settings/ComposerStyleSection.tsx +1 -1
  81. package/src/client/components/settings/categories/chat-settings/GoalSection.tsx +1 -1
  82. package/src/client/components/settings/categories/command-settings/DetailPane.tsx +2 -2
  83. package/src/client/components/settings/categories/omp-settings/ConfigTabs.tsx +5 -5
  84. package/src/client/components/settings/categories/omp-settings/EngineHeader.tsx +3 -3
  85. package/src/client/components/settings/categories/omp-settings/RoleRow.tsx +2 -2
  86. package/src/client/components/settings/categories/panel-plugins/LeftDockSettings.tsx +1 -1
  87. package/src/client/components/settings/categories/panel-plugins/PluginCard.tsx +1 -1
  88. package/src/client/components/settings/categories/panel-plugins/PluginMark.tsx +4 -3
  89. package/src/client/components/settings/categories/plugin-settings/SidebarList.tsx +2 -2
  90. package/src/client/components/settings/categories/project-settings/AddProjectModal.tsx +1 -1
  91. package/src/client/components/settings/categories/project-settings/NameInput.tsx +1 -1
  92. package/src/client/components/settings/categories/project-settings/PathField.tsx +1 -1
  93. package/src/client/components/settings/categories/provider-settings/AddModelModal.tsx +3 -3
  94. package/src/client/components/settings/categories/provider-settings/AddProviderModal.tsx +1 -1
  95. package/src/client/components/settings/categories/provider-settings/AuthSection.tsx +2 -2
  96. package/src/client/components/settings/categories/provider-settings/DeleteProviderModal.tsx +1 -1
  97. package/src/client/components/settings/categories/provider-settings/EntryAdvanced.tsx +4 -4
  98. package/src/client/components/settings/categories/provider-settings/EntryModal.tsx +2 -2
  99. package/src/client/components/settings/categories/provider-settings/LoginModal.tsx +1 -1
  100. package/src/client/components/settings/categories/provider-settings/ModelCapabilitiesModal.tsx +1 -1
  101. package/src/client/components/settings/categories/provider-settings/ModelsList.tsx +2 -2
  102. package/src/client/components/settings/categories/provider-settings/PriceFields.tsx +1 -1
  103. package/src/client/components/settings/categories/token-usage-settings/Breakdown.tsx +4 -4
  104. package/src/client/components/settings/categories/token-usage-settings/Chart.tsx +2 -2
  105. package/src/client/components/settings/categories/token-usage-settings/Controls.tsx +1 -1
  106. package/src/client/components/settings/categories/token-usage-settings/MetricsGrid.tsx +1 -1
  107. package/src/client/components/settings/categories/usage-settings/KenariCard.tsx +5 -5
  108. package/src/client/components/workspace/browser-panel/AddressBar.tsx +1 -1
  109. package/src/client/components/workspace/browser-panel/Screencast.tsx +6 -6
  110. package/src/client/components/workspace/browser-panel/TabStrip.tsx +1 -1
  111. package/src/client/components/workspace/browser-panel/index.tsx +1 -1
  112. package/src/client/components/workspace/browser-toolbar/index.tsx +5 -5
  113. package/src/client/components/workspace/chat-timeline/AttachmentChips.tsx +1 -1
  114. package/src/client/components/workspace/chat-timeline/GeneratingIndicator.tsx +13 -26
  115. package/src/client/components/workspace/chat-timeline/GoalNotice.tsx +2 -2
  116. package/src/client/components/workspace/chat-timeline/MessageItem.tsx +1 -1
  117. package/src/client/components/workspace/chat-timeline/MinimapShortcuts.tsx +1 -1
  118. package/src/client/components/workspace/chat-timeline/QueueList.tsx +1 -1
  119. package/src/client/components/workspace/chat-timeline/SubagentView.tsx +1 -1
  120. package/src/client/components/workspace/chat-timeline/SystemNotice.tsx +5 -5
  121. package/src/client/components/workspace/chat-timeline/TaskResultContent.tsx +2 -2
  122. package/src/client/components/workspace/chat-timeline/ThinkingSection.tsx +4 -4
  123. package/src/client/components/workspace/chat-timeline/ToolCallingSection.tsx +1 -1
  124. package/src/client/components/workspace/chat-timeline/chat-input/AccessDropdown.tsx +1 -1
  125. package/src/client/components/workspace/chat-timeline/chat-input/ArmedGoalStrip.tsx +71 -0
  126. package/src/client/components/workspace/chat-timeline/chat-input/AttachmentToolbar.tsx +4 -3
  127. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.test.ts +1 -1
  128. package/src/client/components/workspace/chat-timeline/chat-input/GoalBanner.tsx +3 -3
  129. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.test.ts +176 -0
  130. package/src/client/components/workspace/chat-timeline/chat-input/GoalModal.tsx +70 -81
  131. package/src/client/components/workspace/chat-timeline/chat-input/GoalSurfaces.tsx +10 -1
  132. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.test.ts +20 -0
  133. package/src/client/components/workspace/chat-timeline/chat-input/ModeToggles.tsx +13 -7
  134. package/src/client/components/workspace/chat-timeline/chat-input/ThinkingLevelDropdown.tsx +1 -1
  135. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.test.ts +65 -3
  136. package/src/client/components/workspace/chat-timeline/chat-input/Toolbar.tsx +69 -19
  137. package/src/client/components/workspace/chat-timeline/chat-input/WaitingDependencyPicker.tsx +2 -2
  138. package/src/client/components/workspace/chat-timeline/chat-input/composer-portal.test.tsx +174 -0
  139. package/src/client/components/workspace/chat-timeline/chat-input/goal-modal-parts.tsx +80 -0
  140. package/src/client/components/workspace/chat-timeline/chat-input/modes-props.ts +15 -3
  141. package/src/client/components/workspace/chat-timeline/chat-input/styles.test.tsx +3 -1
  142. package/src/client/components/workspace/chat-timeline/plan-review/index.tsx +1 -1
  143. package/src/client/components/workspace/chat-timeline/target-picker/WorkspacePicker.tsx +1 -1
  144. package/src/client/components/workspace/chat-timeline/target-picker/WorktreePicker.tsx +1 -1
  145. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +1 -1
  146. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OptionRow.tsx +1 -1
  147. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/OrphanAsks.tsx +1 -1
  148. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +2 -2
  149. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionCard.tsx +4 -4
  150. package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +2 -2
  151. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/Header.tsx +1 -1
  152. package/src/client/components/workspace/chat-timeline/tool-renderers/extension-dialog/SelectBody.tsx +1 -1
  153. package/src/client/components/workspace/chat-timeline/tool-renderers/hashline-patch/index.tsx +4 -4
  154. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/AstEdit.tsx +6 -6
  155. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Bash.tsx +13 -13
  156. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Checkpoint.tsx +1 -1
  157. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ContextNotes.tsx +2 -2
  158. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Debug.tsx +3 -3
  159. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Edit.tsx +9 -9
  160. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Eval.tsx +10 -10
  161. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/FileMatches.tsx +1 -1
  162. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Goal.tsx +5 -5
  163. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/GoalRecord.tsx +5 -5
  164. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Lsp.tsx +6 -6
  165. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/ManageSkill.tsx +5 -5
  166. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Mcp.tsx +2 -2
  167. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Memory.tsx +3 -3
  168. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Proc.tsx +15 -15
  169. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Read.tsx +2 -2
  170. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Resolve.tsx +4 -4
  171. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchFs.tsx +2 -2
  172. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SearchTool.tsx +1 -1
  173. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/SecurityScan.tsx +4 -4
  174. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/TaskResult.tsx +7 -7
  175. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Think.tsx +2 -2
  176. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Todo.tsx +2 -2
  177. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.missing.test.ts +4 -2
  178. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Wait.tsx +17 -17
  179. package/src/client/components/workspace/chat-timeline/tool-renderers/panels/WebSearch.tsx +3 -3
  180. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ArtifactChip.tsx +1 -1
  181. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/EnvelopeHeader.tsx +2 -2
  182. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ExcerptCode.tsx +3 -3
  183. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/FallbackOutput.tsx +3 -3
  184. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/JsonCodeBlock.tsx +3 -3
  185. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/OutputWindow.tsx +2 -2
  186. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolBody.tsx +2 -2
  187. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolFactChips.tsx +2 -2
  188. package/src/client/components/workspace/chat-timeline/tool-renderers/shared/ToolPanelHeader.tsx +1 -1
  189. package/src/client/components/workspace/chat-timeline/tool-renderers/styles/Minimal.tsx +1 -1
  190. package/src/client/components/workspace/context-panel/RawJsonViewer.tsx +2 -2
  191. package/src/client/components/workspace/context-panel/StatsGrid.tsx +1 -1
  192. package/src/client/components/workspace/context-panel/index.tsx +1 -1
  193. package/src/client/components/workspace/diff-panel/ConflictBanner.tsx +1 -1
  194. package/src/client/components/workspace/editor/EmptyEditor.tsx +1 -1
  195. package/src/client/components/workspace/editor/FindWidget.tsx +1 -1
  196. package/src/client/components/workspace/editor/Tabs.tsx +1 -1
  197. package/src/client/components/workspace/editor/Toolbar.tsx +1 -1
  198. package/src/client/components/workspace/file-explorer/OutlineSection.tsx +2 -2
  199. package/src/client/components/workspace/file-explorer/RowLabel.tsx +1 -1
  200. package/src/client/components/workspace/file-explorer/index.tsx +1 -1
  201. package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
  202. package/src/client/components/workspace/git-panel/ChangesList.tsx +3 -3
  203. package/src/client/components/workspace/git-panel/ConflictItem.tsx +3 -3
  204. package/src/client/components/workspace/git-panel/FileItem.tsx +2 -2
  205. package/src/client/components/workspace/git-panel/StashSection.tsx +5 -5
  206. package/src/client/components/workspace/git-panel/TreeItem.tsx +2 -2
  207. package/src/client/components/workspace/git-panel/branch-modal/BranchRow.tsx +4 -4
  208. package/src/client/components/workspace/git-panel/branch-modal/DeleteDialog.tsx +2 -2
  209. package/src/client/components/workspace/git-panel/index.tsx +1 -1
  210. package/src/client/components/workspace/model-dropdown/Item.tsx +3 -3
  211. package/src/client/components/workspace/model-dropdown/Section.tsx +1 -1
  212. package/src/client/components/workspace/model-dropdown/index.tsx +3 -3
  213. package/src/client/components/workspace/plan-panel/index.tsx +2 -2
  214. package/src/client/components/workspace/repo-picker/Modal.tsx +1 -1
  215. package/src/client/components/workspace/repo-picker/Row.tsx +6 -6
  216. package/src/client/components/workspace/search-panel/Body.tsx +2 -2
  217. package/src/client/components/workspace/search-panel/Results.tsx +1 -1
  218. package/src/client/components/workspace/search-panel/index.tsx +1 -1
  219. package/src/client/components/workspace/terminal-panel/index.tsx +1 -1
  220. package/src/client/components/workspace/todo-panel/PhaseGroup.tsx +1 -1
  221. package/src/client/components/workspace/todo-panel/index.tsx +2 -2
  222. package/src/client/components/workspace/user-browser-panel/AddressBar.tsx +5 -5
  223. package/src/client/components/workspace/user-browser-panel/AnnotateBar.test.tsx +13 -13
  224. package/src/client/components/workspace/user-browser-panel/AnnotateBar.tsx +4 -4
  225. package/src/client/components/workspace/user-browser-panel/AnnotateLayer.tsx +1 -1
  226. package/src/client/components/workspace/user-browser-panel/AnnotateTarget.tsx +7 -7
  227. package/src/client/components/workspace/user-browser-panel/Frame.tsx +1 -1
  228. package/src/client/components/workspace/wiki-panel/Nav.tsx +1 -1
  229. package/src/client/components/workspace/wiki-panel/index.tsx +2 -2
  230. package/src/client/glass.css +50 -0
  231. package/src/client/glass.test.ts +68 -24
  232. package/src/client/hooks/chat/composer/browser-context.test.ts +6 -6
  233. package/src/client/hooks/chat/composer/use-draft.test.ts +2 -2
  234. package/src/client/hooks/chat/omp/prompt-send.test.ts +36 -0
  235. package/src/client/hooks/chat/omp/prompt-send.ts +24 -18
  236. package/src/client/hooks/chat/omp/session-list.tsx +24 -70
  237. package/src/client/hooks/chat/omp/session-merges.ts +89 -0
  238. package/src/client/hooks/chat/omp/session-sidebar-controller.ts +4 -1
  239. package/src/client/hooks/chat/timeline/armed-goal-send.test.ts +168 -0
  240. package/src/client/hooks/chat/timeline/armed-goal.test.ts +178 -0
  241. package/src/client/hooks/chat/timeline/goal-command.ts +57 -27
  242. package/src/client/hooks/chat/timeline/index.ts +7 -4
  243. package/src/client/hooks/chat/timeline/mode-post.ts +46 -0
  244. package/src/client/hooks/chat/timeline/modes-contract.ts +94 -0
  245. package/src/client/hooks/chat/timeline/modes.ts +60 -95
  246. package/src/client/hooks/chat/timeline/send-props.ts +97 -0
  247. package/src/client/hooks/chat/timeline/send-steer.test.ts +6 -0
  248. package/src/client/hooks/chat/timeline/send.test-util.ts +55 -8
  249. package/src/client/hooks/chat/timeline/send.test.ts +17 -1
  250. package/src/client/hooks/chat/timeline/send.ts +64 -72
  251. package/src/client/hooks/ui/dialog-behaviour.ts +143 -0
  252. package/src/client/hooks/ui/theme.ts +17 -0
  253. package/src/client/hooks/workspace/copy-tab-path.ts +23 -0
  254. package/src/client/hooks/workspace/mobile-back.ts +71 -0
  255. package/src/client/palette-class.test.ts +93 -0
  256. package/src/client/tailwind-contrast.test.ts +194 -0
  257. package/src/client/tailwind.css +327 -8
  258. package/src/server/lib/assets/theme-shell.server.ts +4 -10
  259. package/src/server/lib/omp/config/provider-seeds.test.ts +39 -1
  260. package/src/server/lib/omp/config/provider-seeds.ts +32 -3
  261. package/src/server/lib/omp/config/provider-vision-compat.test.ts +140 -0
  262. package/src/server/lib/omp/core/host-resolution.test.ts +1 -55
  263. package/src/server/lib/omp/core/install-hint.test.ts +48 -0
  264. package/src/server/lib/omp/core/install-hint.ts +64 -0
  265. package/src/server/lib/omp/core/startup.test.ts +125 -0
  266. package/src/server/lib/omp/core/startup.ts +5 -1
  267. package/src/server/lib/omp/mode/request.ts +14 -6
  268. package/src/server/plugins/ssr.ts +2 -1
  269. package/src/shared/lib/browser/annotate.test.ts +22 -22
  270. package/src/shared/lib/browser/annotate.ts +14 -14
  271. package/src/shared/lib/browser/page-context.ts +6 -6
  272. package/src/shared/lib/icons/icon-paint-authority.test.ts +86 -0
  273. package/src/shared/lib/icons/icon-paint-authority.ts +94 -0
  274. package/src/shared/lib/icons/icon-paint-css.test.ts +139 -25
  275. package/src/shared/lib/icons/icon-paint-css.ts +76 -50
  276. package/src/shared/lib/icons/icon-paint-panel.ts +15 -18
  277. package/src/shared/lib/icons/icon-paint-weight.ts +142 -0
  278. package/src/shared/lib/icons/icon-tone.ts +58 -13
  279. package/src/shared/lib/icons/tint-hues.generated.ts +51 -6
  280. package/src/shared/lib/icons/tint-tones.test.ts +257 -0
  281. package/src/shared/lib/icons/tint.test.ts +3 -211
  282. package/src/shared/lib/icons/tint.ts +23 -25
  283. package/src/shared/lib/omp/mode/actions.ts +40 -0
  284. package/src/shared/lib/omp/mode/types.ts +12 -0
  285. package/src/shared/lib/theme/css.ts +21 -0
  286. package/src/shared/lib/theme/first-frame.ts +38 -0
  287. package/src/shared/lib/theme/ink-scale.test.ts +151 -0
  288. package/src/shared/lib/theme/ink-scale.ts +103 -0
  289. package/src/shared/lib/theme/shell-palette.test.ts +22 -5
  290. package/src/shared/lib/theme/shell-palette.ts +9 -4
  291. package/src/shared/lib/theme/theme.test.ts +28 -3
  292. package/src/shared/lib/workspace/project-accent.test.ts +33 -1
  293. package/src/shared/lib/workspace/project-accent.ts +23 -0
  294. package/src/shared/types/omp/agent.ts +24 -9
  295. package/dist/client/static/js/index-0721wrkf.css +0 -1
@@ -102,7 +102,7 @@ export const ChatMessageItem = memo(function ChatMessageItem({
102
102
  <div className="flex items-center space-x-1.5 pb-1.5 mb-1 border-b border-ink/10 text-[11px] font-mono text-ink/70">
103
103
  <Bot size={12} className="text-ink shrink-0" />
104
104
  <span className="font-semibold text-ink">Subagent Assignment</span>
105
- <span className="text-[9px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-ink/5 text-ink/60">Delegated</span>
105
+ <span className="text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded bg-ink/5 text-ink/60">Delegated</span>
106
106
  </div>
107
107
  )}
108
108
  <MarkdownRenderer content={userContent} />
@@ -81,7 +81,7 @@ export function MinimapShortcuts({ turns, jumping, onJumpTurn }: MinimapShortcut
81
81
  <div
82
82
  className={`absolute right-full mr-3 top-1/2 -translate-y-1/2 w-64 p-3 bg-ink text-canvas text-xs rounded-md shadow-lg pointer-events-none transition-opacity duration-200 z-30 ${isHovered ? 'opacity-100' : 'opacity-0'}`}
83
83
  >
84
- <div className="flex items-center justify-between gap-2 pb-1.5 mb-1.5 border-b border-canvas/20 font-mono text-[10px] uppercase tracking-wider text-canvas/60">
84
+ <div className="flex items-center justify-between gap-2 pb-1.5 mb-1.5 border-b border-canvas/20 font-mono text-[10px] uppercase tracking-wider text-on-ink-muted">
85
85
  <span>#{idx + 1} of {turns.length}</span>
86
86
  {formatMessageStamp(turn) && <span>{formatMessageStamp(turn)}</span>}
87
87
  </div>
@@ -46,7 +46,7 @@ export function QueueList({ queue, onReorder, onRemove, onEdit, onSendNow }: Que
46
46
  <div className="cursor-grab text-ink/40 group-hover:text-ink/80">
47
47
  <GripVertical size={14} />
48
48
  </div>
49
- <span className="shrink-0 text-[9px] font-mono uppercase tracking-wider px-1 py-px rounded bg-ink/10 text-ink/70">
49
+ <span className="shrink-0 text-[10px] font-mono uppercase tracking-wider px-1 py-px rounded bg-ink/10 text-ink/70">
50
50
  follow-up
51
51
  </span>
52
52
  <div className="flex-1 truncate text-ink/80 pr-2">
@@ -92,7 +92,7 @@ export function SubagentView({ sessionId, subagent, onBack, provider, providerNa
92
92
  <span className="font-mono text-[12px] font-semibold text-ink truncate">
93
93
  {headerTitle}
94
94
  </span>
95
- <span className="shrink-0 rounded bg-ink/5 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-wider text-ink/50">
95
+ <span className="shrink-0 rounded bg-ink/5 px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wider text-ink/50">
96
96
  {STATUS_LABEL[effectiveStatus]}
97
97
  </span>
98
98
  </div>
@@ -233,20 +233,20 @@ export function SystemNotice({ notice, source, isMobile = false }: SystemNoticeP
233
233
  {reminderInfo?.reason && (
234
234
  <span
235
235
  title={reminderInfo.reason}
236
- className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[9px] text-ink/60"
236
+ className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/60"
237
237
  >
238
238
  {reminderInfo.reason}
239
239
  </span>
240
240
  )}
241
241
  {taskNotice?.agent && (
242
- <span className="flex items-center gap-1 rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[9px] text-ink/60">
242
+ <span className="flex items-center gap-1 rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/60">
243
243
  <Bot size={10} />
244
244
  {taskNotice.agent}
245
245
  </span>
246
246
  )}
247
247
  {taskNotice?.status && (
248
248
  <span
249
- className={`flex items-center gap-1 rounded px-1.5 py-0.2 font-mono text-[9px] font-semibold uppercase ${
249
+ className={`flex items-center gap-1 rounded px-1.5 py-0.2 font-mono text-[10px] font-semibold uppercase ${
250
250
  noticeStyle.isError ? 'bg-error/10 text-error' : 'bg-success/10 text-success'
251
251
  }`}
252
252
  >
@@ -255,13 +255,13 @@ export function SystemNotice({ notice, source, isMobile = false }: SystemNoticeP
255
255
  </span>
256
256
  )}
257
257
  {taskNotice?.duration && (
258
- <span className="flex items-center gap-1 font-mono text-[9px] text-ink/40">
258
+ <span className="flex items-center gap-1 font-mono text-[10px] text-ink/40">
259
259
  <Clock size={9} />
260
260
  {taskNotice.duration}
261
261
  </span>
262
262
  )}
263
263
  {taskNotice?.meta?.size && (
264
- <span className="flex items-center gap-1 font-mono text-[9px] text-ink/40">
264
+ <span className="flex items-center gap-1 font-mono text-[10px] text-ink/40">
265
265
  <Layers size={9} />
266
266
  {taskNotice.meta.size}
267
267
  </span>
@@ -106,7 +106,7 @@ export function TaskResultContent({ task }: TaskResultContentProps) {
106
106
  <FileCode size={11} className="text-ink/60" />
107
107
  <span>Files Inspected</span>
108
108
  </div>
109
- <span className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[9px] text-ink/50">
109
+ <span className="rounded bg-ink/5 px-1.5 py-0.2 font-mono text-[10px] text-ink/50">
110
110
  {structured.files.length} items
111
111
  </span>
112
112
  </div>
@@ -164,7 +164,7 @@ export function TaskResultContent({ task }: TaskResultContentProps) {
164
164
  {/* Outro & Follow-up URI Links */}
165
165
  {task.outro && (
166
166
  <div className="rounded-lg border border-ink/10 bg-canvas/60 p-2.5 text-[11px] text-ink/75">
167
- <div className="mb-1.5 flex items-center gap-1.5 font-mono text-[9.5px] font-semibold uppercase tracking-wider text-ink/50">
167
+ <div className="mb-1.5 flex items-center gap-1.5 font-mono text-[10px] font-semibold uppercase tracking-wider text-ink/50">
168
168
  <Terminal size={11} />
169
169
  <span>Follow-up & Transcript</span>
170
170
  </div>
@@ -86,7 +86,7 @@ export function ThinkingSection({
86
86
  <div className={`${transcriptGutter(isMobile)} ${showSeparator ? 'space-y-1.5' : ''}`}>
87
87
  {showSeparator && (
88
88
  <div className={`flex items-center gap-2 px-1 pt-0.5 ${traceInset(mode, isMobile)}`}>
89
- <span className="text-[9.5px] font-semibold uppercase tracking-[0.14em] text-ink/35">
89
+ <span className="text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/35">
90
90
  Thinking
91
91
  </span>
92
92
  <span className="h-px flex-1 bg-ink/8" />
@@ -113,7 +113,7 @@ export function ThinkingSection({
113
113
  {isGenerating && <span className="h-1.5 w-1.5 rounded-full bg-ink/60 animate-pulse" />}
114
114
  {!isOpen && (
115
115
  <>
116
- {!framed && <span className="text-ink/25">—</span>}
116
+ {!framed && <span className="text-ink/25">·</span>}
117
117
  <span className={`${chrome.subtitle} ${framed ? '' : 'flex-1'}`}>{summary}</span>
118
118
  </>
119
119
  )}
@@ -132,7 +132,7 @@ export function ThinkingSection({
132
132
  {isOpen && (
133
133
  <div className={chrome.body}>
134
134
  <div className="flex items-center justify-between pb-1.5">
135
- <span className="text-[9.5px] font-semibold uppercase tracking-[0.14em] text-ink/40">
135
+ <span className="text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/40">
136
136
  Model Reasoning & Strategy
137
137
  </span>
138
138
  <CopyButton
@@ -150,7 +150,7 @@ export function ThinkingSection({
150
150
  <BrainCircuit size={13} className="text-ink/70" />
151
151
  </span>
152
152
  <div className="min-w-0 flex-1">
153
- <div className="mb-0.5 text-[9.5px] font-semibold uppercase tracking-[0.12em] text-ink/50">
153
+ <div className="mb-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] text-ink/50">
154
154
  System Notice
155
155
  </div>
156
156
  <div className="text-[12px] leading-relaxed text-ink/85">
@@ -129,7 +129,7 @@ export function ToolCallingSection({ tools, defaultExpanded = false, isMobile =
129
129
  keeps it visible when a sentence-length intent has to shrink
130
130
  (a plain `flex-1` basis of 0 would collapse it to nothing). */}
131
131
  <span
132
- className="min-w-0 truncate text-[9.5px] font-semibold uppercase tracking-[0.14em] text-ink/35"
132
+ className="min-w-0 truncate text-[10px] font-semibold uppercase tracking-[0.14em] text-ink/35"
133
133
  title={intent}
134
134
  >
135
135
  {intent}
@@ -26,7 +26,7 @@ export function AccessDropdown({ value, onSelect }: AccessDropdownProps) {
26
26
  <button
27
27
  type="button"
28
28
  onClick={() => setShowAccess(!showAccess)}
29
- className="flex items-center space-x-1 hover:bg-ink/5 px-2 py-1 rounded transition-colors text-xs text-ink/80"
29
+ className="tap-chip flex items-center space-x-1 hover:bg-ink/5 px-2 py-1 rounded transition-colors text-xs text-muted"
30
30
  >
31
31
  <LockKeyhole size={12} className="text-ink/60" />
32
32
  <span className="hidden lg:inline">{ACCESS_LEVEL_LABELS[value]}</span>
@@ -0,0 +1,71 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The strip for a goal that is ARMED but not started.
8
+ *
9
+ * Setting a goal does not start it: the record is created by the fence of the
10
+ * next prompt, so the operator's own words are the goal's first turn. That
11
+ * leaves a state the other two surfaces cannot draw — there is no record yet
12
+ * (`GoalBanner` needs one) and the modal is closed — and the button alone would
13
+ * say "goal on" over nothing running, which is the lie this row prevents.
14
+ *
15
+ * It therefore names what is waiting, says in words what will start it, and
16
+ * offers the one action that applies: disarm. Its frame is deliberately the
17
+ * strip's own (a hairline, dim text), not the active goal's, because nothing is
18
+ * being pursued yet.
19
+ */
20
+
21
+ import { Target, X } from 'lucide-preact';
22
+ import { formatGoalTokens } from '@/shared/lib/omp/mode/format';
23
+ import type { ArmedGoal } from '@/shared/lib/omp/mode/actions';
24
+
25
+ export interface ArmedGoalStripProps {
26
+ goal: ArmedGoal;
27
+ onDisarm: () => void;
28
+ }
29
+
30
+ export function ArmedGoalStrip({ goal, onDisarm }: ArmedGoalStripProps) {
31
+ // The first non-empty line: the modal accepts newlines, and the strip must
32
+ // not grow with them.
33
+ const text = goal.kind === 'guided' ? goal.rough : goal.objective;
34
+ const headline = text.split('\n').map((line) => line.trim()).find((line) => line.length > 0) ?? 'Untitled goal';
35
+ // An armed interview has no limits yet — the objective (and so its budget)
36
+ // does not exist until the model writes it at the end of the conversation.
37
+ const limits = goal.kind === 'guided'
38
+ ? 'interview'
39
+ : [
40
+ goal.tokenBudget === undefined ? 'no budget' : `${formatGoalTokens(goal.tokenBudget)} tokens`,
41
+ goal.maxTurns === undefined ? null : `${goal.maxTurns} turns`,
42
+ ].filter(Boolean).join(' · ');
43
+
44
+ return (
45
+ <div
46
+ data-armed-goal
47
+ className="flex items-center gap-2 border-b border-ink/10 px-3 py-1.5 text-[11px] text-ink/70"
48
+ >
49
+ <Target size={11} className="shrink-0 text-ink/45" />
50
+ <span className="shrink-0 rounded bg-ink/8 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-ink/55">
51
+ {goal.kind === 'guided' ? 'Interview' : 'Armed'}
52
+ </span>
53
+ <span className="min-w-0 flex-1 truncate" title={text}>
54
+ {headline}
55
+ </span>
56
+ <span className="shrink-0 font-mono text-[10px] text-ink/40">{limits}</span>
57
+ <span className="hidden shrink-0 text-ink/45 @[420px]:inline">
58
+ {goal.kind === 'guided' ? 'your next message answers it' : 'starts with your next message'}
59
+ </span>
60
+ <button
61
+ type="button"
62
+ onClick={onDisarm}
63
+ aria-label="Cancel the armed goal"
64
+ title="Cancel the armed goal"
65
+ className="shrink-0 rounded p-0.5 text-ink/40 transition-colors hover:bg-ink/5 hover:text-ink"
66
+ >
67
+ <X size={11} />
68
+ </button>
69
+ </div>
70
+ );
71
+ }
@@ -52,7 +52,7 @@ export function AttachmentToolbar({ attachments, onFilesSelected, onRemove, mode
52
52
  <div className="composer-attach-row flex items-center flex-wrap gap-1.5 px-3 py-2 text-ink/60">
53
53
  <button
54
54
  onClick={() => fileInputRef.current?.click()}
55
- className="flex items-center justify-center hover:bg-ink/5 p-1 rounded transition-colors text-ink/60 hover:text-ink shrink-0"
55
+ className="tap-target flex items-center justify-center hover:bg-ink/5 p-1 rounded transition-colors text-ink/60 hover:text-ink shrink-0"
56
56
  title="Attach file or image"
57
57
  >
58
58
  <Paperclip size={14} />
@@ -83,7 +83,7 @@ export function AttachmentToolbar({ attachments, onFilesSelected, onRemove, mode
83
83
  <FileIcon size={12} />
84
84
  </div>
85
85
  )}
86
- <span className="truncate max-w-[120px] font-mono text-[10px] text-ink/80">{attachmentName(att)}</span>
86
+ <span className="truncate max-w-[120px] font-mono text-[10px] text-muted">{attachmentName(att)}</span>
87
87
  <button
88
88
  onClick={() => onRemove(att.id)}
89
89
  className="absolute right-0.5 top-1/2 -translate-y-1/2 p-0.5 text-ink/40 hover:text-error hover:bg-error/10 rounded transition-colors"
@@ -104,6 +104,7 @@ export function AttachmentToolbar({ attachments, onFilesSelected, onRemove, mode
104
104
  <ModeToggles
105
105
  plan={modes.plan}
106
106
  goal={modes.goalOpen}
107
+ goalArm={modes.goalArm}
107
108
  goalRecord={modes.goalRecord}
108
109
  pending={modes.pending}
109
110
  onTogglePlan={modes.onTogglePlan}
@@ -127,7 +128,7 @@ export function AttachmentToolbar({ attachments, onFilesSelected, onRemove, mode
127
128
  // as a tool card whose title is "composer".
128
129
  aria-label={expanded ? 'Restore composer' : 'Maximize composer'}
129
130
  title={expanded ? 'Restore composer' : 'Maximize composer'}
130
- className={`${modes && onOpenGoal ? '' : 'ml-auto '}flex items-center justify-center p-1 rounded transition-colors shrink-0 ${
131
+ className={`tap-target ${modes && onOpenGoal ? '' : 'ml-auto '}flex items-center justify-center p-1 rounded transition-colors shrink-0 ${
131
132
  expanded ? 'bg-ink/10 text-ink' : 'text-ink/60 hover:bg-ink/5 hover:text-ink'
132
133
  }`}
133
134
  >
@@ -21,7 +21,7 @@ import { afterAll, afterEach, beforeEach, describe, expect, test } from 'bun:tes
21
21
  import { Window } from 'happy-dom';
22
22
  import { h, render } from 'preact';
23
23
  import { GoalBanner, type GoalBannerProps } from '@/client/components/workspace/chat-timeline/chat-input/GoalBanner';
24
- import type { GoalAction } from '@/client/hooks/chat/timeline/modes';
24
+ import type { GoalAction } from '@/shared/lib/omp/mode/actions';
25
25
  import type { GoalRecord } from '@/shared/lib/omp/mode/types';
26
26
  import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
27
27
 
@@ -37,7 +37,7 @@ import { AlertTriangle, CheckCircle2, CircleDot, Loader2, Pause, Play, SlidersHo
37
37
  import type { GoalContinuation, GoalContinuationStop, GoalRecord } from '@/shared/lib/omp/mode/types';
38
38
  import { formatGoalDuration, formatGoalTokens } from '@/shared/lib/omp/mode/format';
39
39
  import { isGoalOpen } from '@/shared/lib/omp/mode/status';
40
- import type { GoalAction } from '@/client/hooks/chat/timeline/modes';
40
+ import type { GoalAction } from '@/shared/lib/omp/mode/actions';
41
41
 
42
42
  /** How each stand-down reason reads, and what the row offers for it. Data, not
43
43
  * a chain of `if`s: the reasons come from two places (the child's ceilings and
@@ -162,7 +162,7 @@ export function GoalBanner({ record, running, continuation, evaluating, pending,
162
162
  )}
163
163
  </span>
164
164
 
165
- <span className={`shrink-0 rounded-full px-1.5 py-px font-mono text-[9.5px] uppercase tracking-wider ${badge}`}>
165
+ <span className={`shrink-0 rounded-full px-1.5 py-px font-mono text-[10px] uppercase tracking-wider ${badge}`}>
166
166
  {paused ? record.status : stop ? STOP_UI[stop].badge : record.status}
167
167
  </span>
168
168
 
@@ -197,7 +197,7 @@ export function GoalBanner({ record, running, continuation, evaluating, pending,
197
197
  onClick={onOpenDetails}
198
198
  disabled={pending}
199
199
  aria-label="Raise the goal budget"
200
- title="Raise the budget — automatic continuation stopped when it ran out"
200
+ title="Raise the budget: automatic continuation stopped when it ran out"
201
201
  className="flex shrink-0 items-center gap-1 rounded border border-warning/30 px-1.5 py-0.5 text-[10px] text-warning transition-colors hover:bg-warning/10 disabled:opacity-50"
202
202
  >
203
203
  <SlidersHorizontal size={10} />
@@ -0,0 +1,176 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The Goal modal's submit contract: the form closes on success and STAYS on a
8
+ * refusal.
9
+ *
10
+ * The previous version called `onSubmit` then `onClose` unconditionally, so a
11
+ * refused command closed the dialog and threw away the objective the user had
12
+ * just written — the refusal read as a dead button and the text was gone.
13
+ */
14
+
15
+ import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';
16
+ import { Window } from 'happy-dom';
17
+ import { h, render } from 'preact';
18
+ import { act } from 'preact/test-utils';
19
+ import { GoalModal } from '@/client/components/workspace/chat-timeline/chat-input/GoalModal';
20
+ import type { GoalActionResult } from '@/client/hooks/chat/timeline/goal-command';
21
+ import { installDomGlobals, restoreDomGlobals } from '@/test-support/pristine-globals';
22
+
23
+ let container: HTMLElement;
24
+
25
+ beforeAll(() => {
26
+ installDomGlobals(new Window({ url: 'http://localhost' }));
27
+ });
28
+
29
+ afterEach(() => {
30
+ if (container) render(null, container);
31
+ container?.remove();
32
+ container = undefined as unknown as HTMLElement;
33
+ });
34
+
35
+ afterAll(() => {
36
+ restoreDomGlobals();
37
+ });
38
+
39
+ interface Probe {
40
+ closes: number;
41
+ submitted: unknown[];
42
+ el: HTMLElement;
43
+ }
44
+
45
+ /**
46
+ * The dialog's own subtree. It is PORTALLED to `<body>`, so it is not a child of
47
+ * the mount container — that separation is the fix for the composer's
48
+ * `contain: layout` sizing `position: fixed` (see the component).
49
+ */
50
+ function dialog(): HTMLElement {
51
+ const node = document.body.querySelector('.glass-overlay') as HTMLElement | null;
52
+ if (!node) throw new Error('the goal dialog did not portal into <body>');
53
+ return node;
54
+ }
55
+
56
+ /** The fixed scrim the portal mounts: the containing block question is about
57
+ * THIS element, since it is the one carrying `fixed inset-0`. */
58
+ function scrim(): HTMLElement {
59
+ const node = dialog().parentElement as HTMLElement | null;
60
+ if (!node) throw new Error('the dialog card has no scrim');
61
+ return node;
62
+ }
63
+
64
+ /** Mount the create form with `onSubmit` answering `answer`. */
65
+ async function mountCreate(answer: GoalActionResult): Promise<Probe> {
66
+ const probe: Probe = { closes: 0, submitted: [], el: null as unknown as HTMLElement };
67
+ container = document.body.appendChild(document.createElement('div'));
68
+ await act(async () => {
69
+ render(
70
+ h(GoalModal, {
71
+ open: true,
72
+ goal: false,
73
+ goalRecord: null,
74
+ pending: false,
75
+ onClose: () => { probe.closes += 1; },
76
+ onSubmit: async (action) => {
77
+ probe.submitted.push(action);
78
+ return answer;
79
+ },
80
+ }),
81
+ container,
82
+ );
83
+ });
84
+ probe.el = container;
85
+ return probe;
86
+ }
87
+
88
+ /** Type an objective into the create form's textarea. */
89
+ async function typeObjective(text: string): Promise<void> {
90
+ const textarea = dialog().querySelector('textarea') as HTMLTextAreaElement;
91
+ await act(async () => {
92
+ textarea.value = text;
93
+ textarea.dispatchEvent(new Event('input', { bubbles: true }));
94
+ textarea.dispatchEvent(new Event('change', { bubbles: true }));
95
+ });
96
+ }
97
+
98
+ function clickStart(): void {
99
+ const button = [...dialog().querySelectorAll('button')].find((node) => node.textContent?.includes('Start goal'));
100
+ if (!button) throw new Error('no Start goal button');
101
+ button.click();
102
+ }
103
+
104
+ describe('GoalModal submit', () => {
105
+ test('closes only after the command succeeded', async () => {
106
+ const probe = await mountCreate({ ok: true, sessionId: 'omp-1' });
107
+ await typeObjective('Ship the importer');
108
+ await act(async () => { clickStart(); });
109
+ for (let i = 0; i < 5; i += 1) await act(async () => {});
110
+
111
+ expect(probe.submitted).toEqual([{ kind: 'create', objective: 'Ship the importer' }]);
112
+ expect(probe.closes).toBe(1);
113
+ });
114
+
115
+ test('a refusal keeps the form, the objective and the reason on screen', async () => {
116
+ const probe = await mountCreate({ ok: false, error: 'Cannot start a goal while plan mode is active.' });
117
+ await typeObjective('Ship the importer');
118
+ await act(async () => { clickStart(); });
119
+ for (let i = 0; i < 5; i += 1) await act(async () => {});
120
+
121
+ expect(probe.closes).toBe(0);
122
+ // The text is still there, so a retry does not mean retyping the objective.
123
+ expect((dialog().querySelector('textarea') as HTMLTextAreaElement).value).toBe('Ship the importer');
124
+ expect(dialog().textContent).toContain('Cannot start a goal while plan mode is active.');
125
+ });
126
+ });
127
+
128
+ describe('GoalModal on an armed submit', () => {
129
+ test('closes on armed:true, which is a success without a running goal', async () => {
130
+ const probe = await mountCreate({ ok: true, armed: true });
131
+ await typeObjective('Ship the importer');
132
+ await act(async () => { clickStart(); });
133
+ for (let i = 0; i < 5; i += 1) await act(async () => {});
134
+
135
+ // Arming is a successful submit: the form must not linger over a goal the
136
+ // strip now owns.
137
+ expect(probe.closes).toBe(1);
138
+ });
139
+ });
140
+
141
+ describe('GoalModal placement', () => {
142
+ test('mounts OUTSIDE the composer card, in <body>', async () => {
143
+ // The composer is a `@container` (`container-type: inline-size` ⇒
144
+ // `contain: layout`), which becomes the containing block for
145
+ // `position: fixed` — so a dialog rendered inside it centred on the CARD,
146
+ // not the viewport ("muncul di depan composer"). A portal is the fix, and
147
+ // this pins it: the dialog must not be a descendant of the mount point.
148
+ await mountCreate({ ok: true });
149
+
150
+ const node = scrim();
151
+ const mountPoint = container as HTMLElement;
152
+ expect(mountPoint.contains(node)).toBe(false);
153
+ expect(node.parentElement).toBe(document.body);
154
+ // The scrim is what `inset-0` must resolve against the viewport.
155
+ expect(node.className).toContain('fixed');
156
+ expect(node.className).toContain('inset-0');
157
+ });
158
+
159
+ test('does not mount at all while closed', async () => {
160
+ container = document.body.appendChild(document.createElement('div'));
161
+ await act(async () => {
162
+ render(
163
+ h(GoalModal, {
164
+ open: false,
165
+ goal: false,
166
+ goalRecord: null,
167
+ pending: false,
168
+ onClose: () => {},
169
+ onSubmit: async () => ({ ok: true }),
170
+ }),
171
+ container,
172
+ );
173
+ });
174
+ expect(document.body.querySelector('.glass-overlay')).toBeNull();
175
+ });
176
+ });