@makinbakin/sdk 0.0.1-rc.3 → 0.0.1-rc.30

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 (329) hide show
  1. package/README.md +248 -3
  2. package/_internal/app/components/agent-avatar.d.ts +2 -1
  3. package/_internal/app/components/conversation/attention.d.ts +56 -0
  4. package/_internal/app/components/conversation/fold.d.ts +3 -0
  5. package/_internal/app/components/conversation/notification-sound.d.ts +8 -0
  6. package/_internal/app/components/conversation/reply-toast.d.ts +15 -0
  7. package/_internal/app/components/conversation/thread-id.d.ts +8 -0
  8. package/_internal/app/components/conversation/turn-recorder.d.ts +37 -0
  9. package/_internal/app/components/conversation/use-conversation-attention.d.ts +64 -0
  10. package/_internal/app/components/drawer.d.ts +29 -0
  11. package/_internal/app/components/ui/button.d.ts +2 -8
  12. package/_internal/app/components/ui/dialog.d.ts +2 -17
  13. package/_internal/app/components/ui/sheet.d.ts +2 -14
  14. package/_internal/app/core/conversation-turns.d.ts +229 -0
  15. package/_internal/app/core/logger.d.ts +1 -0
  16. package/_internal/app/core/tool-access.d.ts +42 -0
  17. package/_internal/app/hooks/use-available-models.d.ts +5 -0
  18. package/_internal/app/hooks/use-content-store.d.ts +0 -9
  19. package/_internal/app/hooks/use-history-back.d.ts +5 -0
  20. package/_internal/app/hooks/use-horizontal-resize.d.ts +21 -0
  21. package/_internal/app/hooks/use-json-fetch.d.ts +36 -0
  22. package/_internal/app/hooks/use-nav-badge.d.ts +13 -0
  23. package/_internal/app/hooks/use-plugin-event.d.ts +19 -0
  24. package/_internal/app/hooks/use-query-state.d.ts +3 -12
  25. package/_internal/app/hooks/use-resizable-pane.d.ts +35 -0
  26. package/_internal/app/hooks/use-schedule.d.ts +47 -1
  27. package/_internal/app/hooks/use-search.d.ts +27 -8
  28. package/_internal/app/hooks/use-task-run-history.d.ts +26 -0
  29. package/_internal/app/hooks/use-toast.d.ts +3 -3
  30. package/_internal/app/lib/browser-notify.d.ts +12 -1
  31. package/_internal/app/types/index.d.ts +1 -105
  32. package/_internal/core/adapters/runtime/channels.d.ts +231 -0
  33. package/_internal/core/adapters/runtime/concepts.d.ts +709 -237
  34. package/_internal/core/adapters/runtime/errors.d.ts +105 -0
  35. package/_internal/core/adapters/runtime/helpers.d.ts +19 -0
  36. package/_internal/core/adapters/runtime/index.d.ts +8 -2
  37. package/_internal/core/adapters/runtime/skill-files.d.ts +12 -0
  38. package/_internal/core/adapters/runtime/testing.d.ts +79 -0
  39. package/_internal/core/adapters/runtime/turn-activity.d.ts +23 -0
  40. package/_internal/core/adapters/shared.d.ts +133 -12
  41. package/_internal/core/content-dir.d.ts +9 -0
  42. package/_internal/core/delivery/bridge.d.ts +36 -0
  43. package/_internal/core/docs/route.d.ts +1 -1
  44. package/_internal/core/format/structured.d.ts +44 -0
  45. package/_internal/core/format.d.ts +25 -1
  46. package/_internal/core/health/observation-builders.d.ts +42 -0
  47. package/_internal/core/media/downscale.d.ts +18 -0
  48. package/_internal/core/media/sharp-loader.d.ts +36 -0
  49. package/_internal/core/plugin-types.d.ts +236 -500
  50. package/_internal/core/routing/define.d.ts +27 -3
  51. package/_internal/core/routing/dispatcher.d.ts +15 -6
  52. package/_internal/core/routing/index.d.ts +1 -1
  53. package/_internal/core/routing/types.d.ts +13 -70
  54. package/_internal/core/storage/atomic-write.d.ts +11 -0
  55. package/_internal/core/tasks/store.d.ts +129 -0
  56. package/_internal/core/tasks/testing.d.ts +2 -0
  57. package/_internal/{plugins/workflows/lib → core/workflows}/notification-channel-registry.d.ts +1 -1
  58. package/_internal/host/ui/action-status.d.ts +13 -0
  59. package/_internal/host/ui/modals.d.ts +5 -0
  60. package/_internal/plugins/team/types.d.ts +61 -4
  61. package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +1 -1
  62. package/_internal/ui/behaviors/clipboard.d.ts +10 -0
  63. package/_internal/ui/behaviors/selection-navigation.d.ts +5 -0
  64. package/_internal/ui/behaviors/use-persisted-leading-edge-resize.d.ts +29 -0
  65. package/_internal/ui/charts/area-chart.d.ts +27 -0
  66. package/_internal/ui/charts/axis.d.ts +13 -0
  67. package/_internal/ui/charts/bar-chart.d.ts +21 -0
  68. package/_internal/ui/charts/chart-data-table.d.ts +61 -0
  69. package/_internal/ui/charts/chart-explainer.d.ts +4 -0
  70. package/_internal/ui/charts/chart-tooltip.d.ts +8 -0
  71. package/_internal/ui/charts/composition-bar.d.ts +41 -0
  72. package/_internal/ui/charts/index.d.ts +24 -0
  73. package/_internal/ui/charts/line-chart.d.ts +26 -0
  74. package/_internal/ui/charts/monotone-curve.d.ts +23 -0
  75. package/_internal/ui/charts/palette.d.ts +32 -0
  76. package/_internal/ui/charts/pie-chart.d.ts +80 -0
  77. package/_internal/ui/charts/ranked-bar-chart.d.ts +41 -0
  78. package/_internal/ui/charts/sparkline.d.ts +16 -0
  79. package/_internal/ui/charts/stacked-column-chart.d.ts +33 -0
  80. package/_internal/ui/content/code-block.d.ts +43 -0
  81. package/_internal/ui/content/index.d.ts +2 -0
  82. package/_internal/ui/conversation/activity-group.d.ts +27 -0
  83. package/_internal/ui/conversation/agent-turn.d.ts +47 -0
  84. package/_internal/ui/conversation/composer.d.ts +62 -0
  85. package/_internal/ui/conversation/context-meter.d.ts +37 -0
  86. package/_internal/ui/conversation/conversation-empty-state.d.ts +13 -0
  87. package/_internal/ui/conversation/conversation-header.d.ts +26 -0
  88. package/_internal/ui/conversation/conversation-panel.d.ts +59 -0
  89. package/_internal/ui/conversation/conversation.d.ts +35 -0
  90. package/_internal/ui/conversation/fold.d.ts +150 -0
  91. package/_internal/ui/conversation/glyphs.d.ts +30 -0
  92. package/_internal/ui/conversation/index.d.ts +31 -0
  93. package/_internal/ui/conversation/queued-message-list.d.ts +22 -0
  94. package/_internal/ui/conversation/relative-time.d.ts +8 -0
  95. package/_internal/ui/conversation/resize-handle.d.ts +13 -0
  96. package/_internal/ui/conversation/tool-call-drawer.d.ts +14 -0
  97. package/_internal/ui/conversation/turn-controls.d.ts +9 -0
  98. package/_internal/ui/conversation/turn-output.d.ts +42 -0
  99. package/_internal/ui/conversation/turn-usage.d.ts +16 -0
  100. package/_internal/ui/conversation/user-message.d.ts +13 -0
  101. package/_internal/ui/forms/field.d.ts +25 -0
  102. package/_internal/ui/forms/fieldset.d.ts +10 -0
  103. package/_internal/ui/forms/form.d.ts +19 -0
  104. package/_internal/ui/forms/index.d.ts +6 -0
  105. package/_internal/ui/index.d.ts +86 -0
  106. package/_internal/ui/layout/bounded-overflow.d.ts +42 -0
  107. package/_internal/ui/layout/disclosure-panel.d.ts +24 -0
  108. package/_internal/ui/layout/flow.d.ts +27 -0
  109. package/_internal/ui/layout/grid.d.ts +16 -0
  110. package/_internal/ui/layout/index.d.ts +14 -0
  111. package/_internal/ui/layout/page-shell.d.ts +11 -0
  112. package/_internal/ui/layout/panel.d.ts +28 -0
  113. package/_internal/ui/layout/section.d.ts +15 -0
  114. package/_internal/ui/layout/sticky-overflow-scrollbar.d.ts +11 -0
  115. package/_internal/ui/layout/utils.d.ts +1 -0
  116. package/_internal/ui/patterns/agent-filter.d.ts +20 -0
  117. package/_internal/ui/patterns/calendar-grid.d.ts +80 -0
  118. package/_internal/ui/patterns/calendar-item.d.ts +42 -0
  119. package/_internal/ui/patterns/calendar-nav.d.ts +21 -0
  120. package/_internal/ui/patterns/confirm-dialog.d.ts +29 -0
  121. package/_internal/ui/patterns/copy-button.d.ts +15 -0
  122. package/_internal/ui/patterns/danger-zone.d.ts +17 -0
  123. package/_internal/ui/patterns/data-table.d.ts +151 -0
  124. package/_internal/ui/patterns/drawer-section.d.ts +11 -0
  125. package/_internal/ui/patterns/facet-filter.d.ts +22 -0
  126. package/_internal/ui/patterns/index.d.ts +73 -0
  127. package/_internal/ui/patterns/inspector-panel.d.ts +39 -0
  128. package/_internal/ui/patterns/kanban.d.ts +70 -0
  129. package/_internal/ui/patterns/key-value.d.ts +35 -0
  130. package/_internal/ui/patterns/list-rows.d.ts +111 -0
  131. package/_internal/ui/patterns/nav-list.d.ts +41 -0
  132. package/_internal/ui/patterns/node-card.d.ts +37 -0
  133. package/_internal/ui/patterns/page-aside.d.ts +49 -0
  134. package/_internal/ui/patterns/page-body.d.ts +49 -0
  135. package/_internal/ui/patterns/page-canvas.d.ts +12 -0
  136. package/_internal/ui/patterns/page-composer.d.ts +8 -0
  137. package/_internal/ui/patterns/page-controls.d.ts +31 -0
  138. package/_internal/ui/patterns/page-header.d.ts +40 -0
  139. package/_internal/ui/patterns/page-timeline.d.ts +18 -0
  140. package/_internal/ui/patterns/page.d.ts +32 -0
  141. package/_internal/ui/patterns/pagination.d.ts +23 -0
  142. package/_internal/ui/patterns/save-bar.d.ts +21 -0
  143. package/_internal/ui/patterns/search-input.d.ts +20 -0
  144. package/_internal/ui/patterns/segmented-control.d.ts +22 -0
  145. package/_internal/ui/patterns/sortable-head.d.ts +13 -0
  146. package/_internal/ui/patterns/stat-group.d.ts +8 -0
  147. package/_internal/ui/patterns/stat-tile.d.ts +25 -0
  148. package/_internal/ui/patterns/status-badge.d.ts +15 -0
  149. package/_internal/ui/patterns/status-marker.d.ts +10 -0
  150. package/_internal/ui/patterns/timeline.d.ts +59 -0
  151. package/_internal/ui/patterns/unsaved-changes-dialog.d.ts +22 -0
  152. package/_internal/ui/patterns/workspace-page.d.ts +76 -0
  153. package/_internal/ui/primitives/alert.d.ts +17 -0
  154. package/_internal/ui/primitives/avatar.d.ts +13 -0
  155. package/_internal/ui/primitives/badge.d.ts +27 -0
  156. package/_internal/ui/primitives/button.d.ts +32 -0
  157. package/_internal/ui/primitives/card.d.ts +47 -0
  158. package/_internal/ui/primitives/checkbox.d.ts +3 -0
  159. package/_internal/ui/primitives/collapsible.d.ts +7 -0
  160. package/_internal/ui/primitives/color-input.d.ts +21 -0
  161. package/_internal/ui/primitives/command.d.ts +36 -0
  162. package/_internal/ui/primitives/dialog.d.ts +31 -0
  163. package/_internal/ui/primitives/dropdown-menu.d.ts +54 -0
  164. package/_internal/ui/primitives/file-input.d.ts +33 -0
  165. package/_internal/ui/primitives/input-group.d.ts +24 -0
  166. package/_internal/ui/primitives/input.d.ts +5 -0
  167. package/_internal/ui/primitives/interactive-surface.d.ts +24 -0
  168. package/_internal/ui/primitives/label.d.ts +3 -0
  169. package/_internal/ui/primitives/modal-context.d.ts +9 -0
  170. package/_internal/ui/primitives/option-list.d.ts +10 -0
  171. package/_internal/ui/primitives/popover.d.ts +18 -0
  172. package/_internal/ui/primitives/portal-ownership.d.ts +11 -0
  173. package/_internal/ui/primitives/progress.d.ts +38 -0
  174. package/_internal/ui/primitives/radio-group.d.ts +12 -0
  175. package/_internal/ui/primitives/select.d.ts +25 -0
  176. package/_internal/ui/primitives/separator.d.ts +7 -0
  177. package/_internal/ui/primitives/sheet.d.ts +34 -0
  178. package/_internal/ui/primitives/shimmer-text.d.ts +13 -0
  179. package/_internal/ui/primitives/skeleton.d.ts +6 -0
  180. package/_internal/ui/primitives/spinner.d.ts +31 -0
  181. package/_internal/ui/primitives/switch.d.ts +6 -0
  182. package/_internal/{app/components/ui → ui/primitives}/tabs.d.ts +1 -1
  183. package/_internal/ui/primitives/text.d.ts +43 -0
  184. package/_internal/ui/primitives/textarea.d.ts +3 -0
  185. package/_internal/ui/primitives/tooltip.d.ts +14 -0
  186. package/_internal/ui/private-ui-boundary-probe.d.ts +9 -0
  187. package/_internal/ui/states/banner.d.ts +15 -0
  188. package/_internal/ui/states/index.d.ts +6 -0
  189. package/_internal/ui/states/system-state.d.ts +88 -0
  190. package/_internal/ui/states/toast.d.ts +26 -0
  191. package/_internal/ui/utils.d.ts +14 -0
  192. package/bin/bakin-plugin-test-ui.js +6822 -0
  193. package/charts/index.d.ts +3 -0
  194. package/charts/index.js +2 -0
  195. package/content/index.d.ts +14 -0
  196. package/content/index.js +39 -0
  197. package/content/markdown-content.d.ts +16 -0
  198. package/content/markdown-editor.d.ts +35 -0
  199. package/conversation/index.d.ts +50 -0
  200. package/conversation/index.js +4 -0
  201. package/conversation/use-conversation-thread.d.ts +73 -0
  202. package/hooks/index.d.ts +85 -11
  203. package/hooks/index.js +1 -1747
  204. package/hooks/router.d.ts +4 -36
  205. package/index.d.ts +30 -6
  206. package/index.js +10 -14210
  207. package/internal/index.d.ts +74 -0
  208. package/internal/index.js +2 -0
  209. package/internal/lazy.d.ts +58 -0
  210. package/internal/plugin-ownership.d.ts +18 -0
  211. package/internal/private-ui-boundary-probe.d.ts +2 -0
  212. package/layout/index.d.ts +9 -0
  213. package/layout/index.js +2 -0
  214. package/metadata/index.d.ts +14 -1
  215. package/metadata/index.js +1 -30
  216. package/navigation/history-back.d.ts +5 -0
  217. package/navigation/index.d.ts +23 -0
  218. package/navigation/index.js +2 -0
  219. package/navigation/plugin-link.d.ts +11 -0
  220. package/navigation/query-state.d.ts +7 -0
  221. package/navigation/router.d.ts +35 -0
  222. package/navigation/search-params.d.ts +7 -0
  223. package/navigation/unsaved-changes-guard.d.ts +35 -0
  224. package/package.json +62 -10
  225. package/patterns/agent-patterns.d.ts +79 -0
  226. package/patterns/asset-library-picker.d.ts +38 -0
  227. package/patterns/channel-patterns.d.ts +32 -0
  228. package/patterns/index.d.ts +40 -0
  229. package/patterns/index.js +47 -0
  230. package/patterns/picker-patterns.d.ts +96 -0
  231. package/patterns/plugin-settings-renderer.d.ts +41 -0
  232. package/patterns/presentation-color.d.ts +2 -0
  233. package/patterns/search-patterns.d.ts +51 -0
  234. package/register.d.ts +63 -9
  235. package/routing/index.d.ts +6 -1
  236. package/routing/index.js +10 -14014
  237. package/slots/index.d.ts +12 -24
  238. package/slots/index.js +1 -91
  239. package/slots/registry.d.ts +45 -0
  240. package/styles.css +2 -0
  241. package/testing/index.d.ts +122 -0
  242. package/testing/index.js +93 -0
  243. package/testing/ui/conformance/cli.d.ts +2 -0
  244. package/testing/ui/conformance/contracts.d.ts +73 -0
  245. package/testing/ui/conformance/index.d.ts +11 -0
  246. package/testing/ui/conformance/index.js +85 -0
  247. package/testing/ui/conformance/plugin-css.d.ts +37 -0
  248. package/testing/ui/conformance/plugin-id.d.ts +6 -0
  249. package/testing/ui/conformance/runner.d.ts +13 -0
  250. package/testing/ui/index.d.ts +24 -0
  251. package/testing/ui/index.js +2 -0
  252. package/testing/ui/plugin-ui-fixture-host.d.ts +36 -0
  253. package/testing/ui/runtime.d.ts +70 -0
  254. package/types/api-route.d.ts +89 -0
  255. package/types/context.d.ts +166 -0
  256. package/types/conversation-turns.d.ts +229 -0
  257. package/types/events.d.ts +10 -0
  258. package/types/health.d.ts +374 -0
  259. package/types/index.d.ts +19 -919
  260. package/types/index.js +1 -0
  261. package/types/manifest.d.ts +221 -0
  262. package/types/primitives.d.ts +33 -0
  263. package/types/registration.d.ts +281 -0
  264. package/types/runtime.d.ts +292 -0
  265. package/types/scheduled-events.d.ts +80 -0
  266. package/types/services.d.ts +578 -0
  267. package/ui/index.d.ts +70 -31
  268. package/ui/index.js +38 -28704
  269. package/utils/asset-id.d.ts +15 -0
  270. package/utils/index.d.ts +25 -7
  271. package/utils/index.js +4 -2098
  272. package/utils/plugin-fetch.d.ts +23 -0
  273. package/_internal/app/components/agent-filter.d.ts +0 -8
  274. package/_internal/app/components/agent-select.d.ts +0 -15
  275. package/_internal/app/components/agent-status.d.ts +0 -8
  276. package/_internal/app/components/bakin-drawer.d.ts +0 -23
  277. package/_internal/app/components/color-picker.d.ts +0 -7
  278. package/_internal/app/components/empty-state.d.ts +0 -10
  279. package/_internal/app/components/error-banner.d.ts +0 -6
  280. package/_internal/app/components/error-state.d.ts +0 -8
  281. package/_internal/app/components/facet-filter.d.ts +0 -17
  282. package/_internal/app/components/integrated-brainstorm/activity.d.ts +0 -23
  283. package/_internal/app/components/integrated-brainstorm/collapsed-header.d.ts +0 -14
  284. package/_internal/app/components/integrated-brainstorm/empty-state.d.ts +0 -5
  285. package/_internal/app/components/integrated-brainstorm/index.d.ts +0 -8
  286. package/_internal/app/components/integrated-brainstorm/input-row.d.ts +0 -16
  287. package/_internal/app/components/integrated-brainstorm/message-list.d.ts +0 -8
  288. package/_internal/app/components/integrated-brainstorm/session.d.ts +0 -16
  289. package/_internal/app/components/integrated-brainstorm/sse.d.ts +0 -8
  290. package/_internal/app/components/integrated-brainstorm/thinking-indicator.d.ts +0 -19
  291. package/_internal/app/components/integrated-brainstorm/types.d.ts +0 -63
  292. package/_internal/app/components/integrated-brainstorm/use-auto-grow.d.ts +0 -6
  293. package/_internal/app/components/integrated-brainstorm/use-brainstorm-state.d.ts +0 -21
  294. package/_internal/app/components/markdown-content.d.ts +0 -3
  295. package/_internal/app/components/markdown-editor.d.ts +0 -11
  296. package/_internal/app/components/model-select.d.ts +0 -9
  297. package/_internal/app/components/page-layout.d.ts +0 -9
  298. package/_internal/app/components/plugin-header.d.ts +0 -16
  299. package/_internal/app/components/plugin-settings-renderer.d.ts +0 -9
  300. package/_internal/app/components/sortable-head.d.ts +0 -13
  301. package/_internal/app/components/ui/alert.d.ts +0 -10
  302. package/_internal/app/components/ui/avatar.d.ts +0 -11
  303. package/_internal/app/components/ui/badge.d.ts +0 -7
  304. package/_internal/app/components/ui/card.d.ts +0 -11
  305. package/_internal/app/components/ui/checkbox.d.ts +0 -3
  306. package/_internal/app/components/ui/collapsible.d.ts +0 -5
  307. package/_internal/app/components/ui/command.d.ts +0 -19
  308. package/_internal/app/components/ui/dropdown-menu.d.ts +0 -29
  309. package/_internal/app/components/ui/form.d.ts +0 -23
  310. package/_internal/app/components/ui/input-group.d.ts +0 -18
  311. package/_internal/app/components/ui/input.d.ts +0 -3
  312. package/_internal/app/components/ui/label.d.ts +0 -3
  313. package/_internal/app/components/ui/popover.d.ts +0 -9
  314. package/_internal/app/components/ui/progress.d.ts +0 -7
  315. package/_internal/app/components/ui/select.d.ts +0 -15
  316. package/_internal/app/components/ui/separator.d.ts +0 -3
  317. package/_internal/app/components/ui/skeleton.d.ts +0 -2
  318. package/_internal/app/components/ui/switch.d.ts +0 -5
  319. package/_internal/app/components/ui/textarea.d.ts +0 -3
  320. package/_internal/app/components/ui/tooltip.d.ts +0 -6
  321. package/_internal/app/components/underline-tabs.d.ts +0 -15
  322. package/_internal/app/hooks/use-assets.d.ts +0 -25
  323. package/_internal/app/hooks/use-form-guard.d.ts +0 -5
  324. package/_internal/app/hooks/use-vertical-resize.d.ts +0 -22
  325. package/_internal/app/lib/utils.d.ts +0 -2
  326. package/_internal/plugins/workflows/hooks/channel-icon.d.ts +0 -6
  327. package/components/index.d.ts +0 -34
  328. package/components/index.js +0 -40175
  329. /package/_internal/{app/components/ui → ui/primitives}/table.d.ts +0 -0
@@ -0,0 +1,229 @@
1
+ import type { PluginContext } from '../../core/plugin-types';
2
+ import type { ChatChunk, MessageUsage } from '../../core/adapters/runtime';
3
+ /** The engine needs only messaging + the event bus from a plugin context. */
4
+ export type TurnContext = Pick<PluginContext, 'runtime' | 'events'>;
5
+ export interface TurnAttachment {
6
+ name: string;
7
+ mimeType: string;
8
+ path: string;
9
+ }
10
+ export declare function isRasterAttachment(a: TurnAttachment): boolean;
11
+ /**
12
+ * THE file-lane note generator (#742) — every chat-like surface (web
13
+ * composer, Discord inbound) converges here; never hand-roll this note.
14
+ * PDFs point at the blessed pdf tool rendered in the active runtime's
15
+ * calling style; other files get the generic file-tools wording.
16
+ */
17
+ export declare function fileLaneNote(a: TurnAttachment, agentId: string, renderCall?: (tool: string, args: string) => string): string;
18
+ /**
19
+ * The durable transcript row shape (identical to chat's schema-v2 rows —
20
+ * user attachments are path-addressed server-side; display URLs are a
21
+ * client concern).
22
+ */
23
+ export type ConversationTurnRow = {
24
+ kind: 'user';
25
+ ts: string;
26
+ content: string;
27
+ attachments?: TurnAttachment[];
28
+ } | {
29
+ kind: 'assistant';
30
+ ts: string;
31
+ turnId?: string;
32
+ content: string;
33
+ } | {
34
+ kind: 'tool';
35
+ ts: string;
36
+ turnId?: string;
37
+ callId?: string;
38
+ toolName: string;
39
+ status: 'completed' | 'failed';
40
+ summary?: string;
41
+ inputPreview?: string;
42
+ outputPreview?: string;
43
+ durationMs?: number;
44
+ metadata?: Record<string, unknown>;
45
+ } | {
46
+ kind: 'error';
47
+ ts: string;
48
+ turnId?: string;
49
+ message: string;
50
+ errorKind?: string;
51
+ } | {
52
+ kind: 'aborted';
53
+ ts: string;
54
+ turnId?: string;
55
+ } | {
56
+ kind: 'done';
57
+ ts: string;
58
+ turnId?: string;
59
+ };
60
+ export interface TurnOutcome {
61
+ aborted: boolean;
62
+ errored: boolean;
63
+ }
64
+ export type StartTurnResult = 'accepted' | 'not_found' | 'busy' | QueuedStart;
65
+ /**
66
+ * The queued acceptance (#729) — captured synchronously at push time so
67
+ * callers get THEIR item's id, never a tail re-read that a concurrent
68
+ * enqueue could poison (review finding: the awaited persist can park
69
+ * behind streaming transcript writes, making post-await reads stale).
70
+ */
71
+ export interface QueuedStart {
72
+ queued: true;
73
+ queueId: string;
74
+ queueLength: number;
75
+ }
76
+ /**
77
+ * A message accepted while the slot was busy (#729). Queued messages are a
78
+ * consumer-durable snapshot (the `queue.persist` hook) and drain as ONE
79
+ * combined turn when the active turn settles — done, error, and abort all
80
+ * drain. `agentId` is the agent resolved at enqueue time; the drain's
81
+ * synchronous slot reservation uses it, then refreshes from resolveThread
82
+ * before the runtime call.
83
+ */
84
+ export interface QueuedMessage {
85
+ id: string;
86
+ ts: string;
87
+ content: string;
88
+ agentId: string;
89
+ attachments?: TurnAttachment[];
90
+ }
91
+ export interface InflightTurnInfo {
92
+ key: string;
93
+ agentId: string;
94
+ turnId: string;
95
+ startedAt: number;
96
+ }
97
+ export interface ConversationTurnServiceConfig {
98
+ /** Consumer label for log lines (e.g. 'chat', 'projects.brainstorm'). */
99
+ name: string;
100
+ /** Bus event names — the consumer's wire contract (e.g. chat.chunk/done/error).
101
+ * `started` (optional) fires at turn-accept, BEFORE any runtime chunk —
102
+ * attention providers light the working dot instantly instead of waiting
103
+ * out model latency for the first chunk (#707). */
104
+ events: {
105
+ chunk: string;
106
+ done: string;
107
+ error: string;
108
+ started?: string;
109
+ };
110
+ /** Base payload identifying the thread on every event (e.g. key => ({ chatId: key })). */
111
+ payload: (key: string) => Record<string, unknown>;
112
+ /** Resolve the thread's agent; null → start() returns 'not_found'. */
113
+ resolveThread: (key: string) => {
114
+ agentId: string;
115
+ } | null | Promise<{
116
+ agentId: string;
117
+ } | null>;
118
+ /** Append one durable transcript row. Failures are logged, never thrown into the turn. */
119
+ appendRow: (key: string, row: ConversationTurnRow) => void | Promise<void>;
120
+ /**
121
+ * Runtime session thread id (e.g. key => `chat:${key}`). Called once per
122
+ * turn — per-turn thread schemes (brands' ephemeral randomUUID threads)
123
+ * are legitimate.
124
+ */
125
+ threadId: (key: string, agentId: string) => string;
126
+ /** Per-turn delivery framing appended to the runtime content; never persisted. */
127
+ framing?: string;
128
+ /** Run turns as ephemeral runtime sessions (no provider-side accumulation). */
129
+ ephemeral?: boolean;
130
+ /**
131
+ * Persist an invisible `{kind:'done'}` marker row at clean success settle
132
+ * (#735). Abort/error settles already end on their own terminal rows, so
133
+ * with this on EVERY settled turn ends on a terminal row — the evidence a
134
+ * boot sweep needs to stamp partial-output deaths without ever falsely
135
+ * marking a completed turn. Chat-style sweepable transcripts only:
136
+ * bounded stores (brands' 300-row brainstorm array) would evict real
137
+ * rows, and foreign zod schemas would reject the kind.
138
+ */
139
+ terminalMarkerRows?: boolean;
140
+ /**
141
+ * Opt-in pending queue (#729). Without this, a busy slot always answers
142
+ * `'busy'` — strict surfaces are unchanged.
143
+ */
144
+ queue?: {
145
+ /**
146
+ * Full-snapshot persistence after every queue mutation — the restart
147
+ * durability promise. Failures are logged, never thrown to callers.
148
+ */
149
+ persist?: (key: string, items: QueuedMessage[]) => void | Promise<void>;
150
+ /** Bus event emitted on enqueue (payload + queueId + queueLength). */
151
+ event?: string;
152
+ };
153
+ hooks?: {
154
+ /** Read-only tap on EVERY runtime chunk (e.g. messaging proposal parsing). */
155
+ onChunk?: (key: string, chunk: ChatChunk) => void;
156
+ /** Spend attribution, once per turn — success and abort, never error. */
157
+ meter?: (info: {
158
+ key: string;
159
+ agentId: string;
160
+ turnId: string;
161
+ usage?: MessageUsage;
162
+ }) => Promise<void> | void;
163
+ /**
164
+ * Success/abort path only, AFTER final row persistence but BEFORE the
165
+ * done event — finalize derived state (e.g. messaging's proposal
166
+ * linking) so it is durable when clients react to done. Errors are
167
+ * logged, never thrown into the turn.
168
+ */
169
+ onTurnComplete?: (info: {
170
+ key: string;
171
+ aborted: boolean;
172
+ }) => Promise<void> | void;
173
+ /** Runs after the slot releases; waitFor() resolves after it completes. */
174
+ onSettled?: (info: {
175
+ ctx: TurnContext;
176
+ key: string;
177
+ outcome: TurnOutcome;
178
+ }) => Promise<unknown> | unknown;
179
+ };
180
+ }
181
+ export interface StartTurnOptions {
182
+ attachments?: TurnAttachment[];
183
+ /** Per-turn agent override (surfaces with an agent picker); default = resolveThread's. */
184
+ agentId?: string;
185
+ /**
186
+ * Busy slot → enqueue instead of `'busy'` (requires `config.queue`).
187
+ * The busy-check and enqueue happen in one synchronous block (no TOCTOU).
188
+ * CAVEAT: a QUEUED send keeps only content + attachments — a per-turn
189
+ * `agentId` override and `runtimeContent` are DISCARDED at drain time
190
+ * (the combined turn resolves the thread's agent fresh and joins clean
191
+ * content). Surfaces that need either must not opt into queueing.
192
+ */
193
+ queueIfBusy?: boolean;
194
+ /**
195
+ * Pre-assembled runtime content for THIS turn (embedded surfaces inject
196
+ * doc/context prompts here). The persisted user row always keeps the
197
+ * clean `content`; when omitted, the runtime gets content + framing.
198
+ */
199
+ runtimeContent?: string;
200
+ }
201
+ export interface ConversationTurnService {
202
+ start(ctx: TurnContext, key: string, content: string, opts?: StartTurnOptions): Promise<StartTurnResult>;
203
+ /** Abort the in-flight turn; false when the thread is idle. Queued messages stay — they drain at settle. */
204
+ abort(key: string): boolean;
205
+ /** Snapshot of the pending queue (empty for strict surfaces). */
206
+ listQueued(key: string): QueuedMessage[];
207
+ /** Remove one queued message by id; persists. False when absent. */
208
+ removeQueued(key: string, id: string): boolean;
209
+ /** Drop the whole queue (delete-thread path); persists empty. */
210
+ clearQueue(key: string): void;
211
+ /**
212
+ * Seed the queue from persisted state (boot path) and drain immediately
213
+ * when the slot is idle. Does NOT re-persist — the items came from disk.
214
+ */
215
+ restore(ctx: TurnContext, key: string, items: QueuedMessage[]): void;
216
+ isInFlight(key: string): boolean;
217
+ /** Assistant text streamed so far for the in-flight turn (null when idle) —
218
+ * lets GET responses seed mid-turn rehydration without the missing-start gap. */
219
+ inflightPreview(key: string): string | null;
220
+ /**
221
+ * Await the current turn; when called while the turn is in flight this
222
+ * also covers its onSettled tail. Resolves immediately when idle
223
+ * (including during onSettled itself — the slot has already released).
224
+ */
225
+ waitFor(key: string): Promise<void>;
226
+ /** Every in-flight turn — consumers build active-turn resolution on top. */
227
+ listInFlight(): InflightTurnInfo[];
228
+ }
229
+ export declare function createConversationTurnService(config: ConversationTurnServiceConfig): ConversationTurnService;
@@ -0,0 +1 @@
1
+ export { createLogger } from '../../core/logger';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The ONE renderer for a runtime's tool-access instructions (P1.2).
3
+ *
4
+ * A runtime declares HOW its agents reach Bakin's `bakin_exec_*` tools via
5
+ * `describeToolAccess()` → {@link RuntimeToolAccess}. This module turns that
6
+ * declaration into the agent-facing instruction block. Both the projected
7
+ * AGENTS.md role layer and the per-dispatch prompt render through here (P1.4),
8
+ * so the two surfaces can never drift.
9
+ *
10
+ * Style intent:
11
+ * - `in-process` — exec tools are first-class session tools; bare calls,
12
+ * no cheat-sheet (the agent discovers the live set).
13
+ * - `mcp` — tools appear as native MCP tools under a per-agent
14
+ * server; prefixed calls, still discovered live.
15
+ * - `cli-shim` — tools are reached through a shell command; the exhaustive
16
+ * cheat-sheet IS warranted here because the invocation is
17
+ * non-obvious and easy to get wrong.
18
+ */
19
+ import type { RuntimeToolAccess } from '../../core/adapters/runtime';
20
+ export interface ToolAccessRenderOptions {
21
+ /** Agent whose per-agent server / shim names to substitute (mcp, cli-shim). */
22
+ agentId: string;
23
+ }
24
+ /**
25
+ * Render ONE tool invocation in the runtime's style — the primitive shared by
26
+ * both the standing tool-access block (below) and the per-dispatch prompt
27
+ * authors, so invocation bytes cannot drift between the two surfaces.
28
+ * - in-process → `bakin_exec_x arg=1`
29
+ * - mcp → `bakin-<agent>.bakin_exec_x arg=1`
30
+ * - cli-shim → the shim command with `<tool>`/`<args>` filled in
31
+ * `args` may be empty (trailing space is trimmed).
32
+ */
33
+ export declare function renderToolCall(access: RuntimeToolAccess, opts: {
34
+ agentId: string;
35
+ tool: string;
36
+ args?: string;
37
+ }): string;
38
+ /**
39
+ * Render the runtime-specific tool-access instruction block for `agentId`.
40
+ * Returns a single markdown string (no trailing newline).
41
+ */
42
+ export declare function renderToolAccessInstructions(access: RuntimeToolAccess, opts: ToolAccessRenderOptions): string;
@@ -0,0 +1,5 @@
1
+ import type { AvailableModel } from '@makinbakin/sdk/types';
2
+ /** The available-models catalog (empty array until loaded / on failure). */
3
+ export declare function useAvailableModels(): AvailableModel[];
4
+ /** Test-only: reset the module-level cache so tests run with a clean slate. */
5
+ export declare function __resetAvailableModelsCache(): void;
@@ -5,18 +5,12 @@ interface AuditEntry {
5
5
  agent: string;
6
6
  data: Record<string, unknown>;
7
7
  }
8
- interface ReindexProgressEntry {
9
- indexed: number;
10
- done: boolean;
11
- }
12
8
  interface ContentStore extends ContentState {
13
9
  loading: boolean;
14
10
  auditEntries: AuditEntry[];
15
11
  activityEvents: ActivityEvent[];
16
12
  sseConnected: boolean;
17
- taskboardVersion: number;
18
13
  debug: boolean;
19
- reindexProgress: Record<string, ReindexProgressEntry>;
20
14
  setFiles: (files: Record<string, string>) => void;
21
15
  updateFile: (key: string, content: string) => void;
22
16
  setHeartbeats: (heartbeats: Record<string, Heartbeat>) => void;
@@ -25,11 +19,8 @@ interface ContentStore extends ContentState {
25
19
  appendActivityEvent: (event: ActivityEvent) => void;
26
20
  setActivityEvents: (events: ActivityEvent[]) => void;
27
21
  setSseConnected: (connected: boolean) => void;
28
- bumpTaskboard: () => void;
29
22
  setDebug: (debug: boolean) => void;
30
23
  toggleDebug: () => void;
31
- setReindexProgress: (table: string, indexed: number, done: boolean) => void;
32
- clearReindexProgress: () => void;
33
24
  initialize: () => Promise<void>;
34
25
  }
35
26
  export declare const useContentStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ContentStore>>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @deprecated Import `useHistoryBack` from `@makinbakin/sdk/navigation`.
3
+ * This module remains as a compatibility adapter for existing consumers.
4
+ */
5
+ export { useHistoryBack } from '@makinbakin/sdk/navigation';
@@ -0,0 +1,21 @@
1
+ import { type ResizeHandleProps } from './use-resizable-pane';
2
+ interface Options {
3
+ defaultWidth: number;
4
+ minWidth: number;
5
+ maxWidth: number;
6
+ /** When set, width is persisted in localStorage under `bakin-hresize:${storageKey}`. */
7
+ storageKey?: string;
8
+ }
9
+ interface Return {
10
+ width: number;
11
+ setWidth: (w: number) => void;
12
+ handleProps: ResizeHandleProps;
13
+ }
14
+ /**
15
+ * Resize a right-anchored panel by dragging its left edge. The handle lives at
16
+ * the left of the element; dragging left grows the panel, dragging right
17
+ * shrinks it. Keyboard: ArrowLeft/ArrowRight (Shift for a larger step).
18
+ * Thin wrapper over {@link useResizablePane} for side-by-side split panes.
19
+ */
20
+ export declare function useHorizontalResize({ defaultWidth, minWidth, maxWidth, storageKey }: Options): Return;
21
+ export {};
@@ -0,0 +1,36 @@
1
+ export interface UseJsonFetchResult<T> {
2
+ /** Parsed JSON body, or null before the first successful load. */
3
+ data: T | null;
4
+ /** True while a request is in flight. */
5
+ loading: boolean;
6
+ /** Error message on a non-2xx response or a network/parse failure; null otherwise. */
7
+ error: string | null;
8
+ /** Re-run the fetch (e.g. after a mutation). */
9
+ refresh: () => void;
10
+ }
11
+ export interface UseJsonFetchOptions extends RequestInit {
12
+ /**
13
+ * Abort the request after this many milliseconds and report it as a timeout
14
+ * rather than a silent hang. Endpoints that scan the filesystem or call the
15
+ * runtime can stall indefinitely; without a deadline the caller shows a
16
+ * spinner forever.
17
+ */
18
+ timeoutMs?: number;
19
+ }
20
+ /**
21
+ * Cancellable JSON GET with the standard `{ data, loading, error, refresh }` lifecycle —
22
+ * the consolidation of the `let cancelled = false` fetch-in-useEffect boilerplate scattered
23
+ * across plugin components. Aborts the in-flight request on unmount or when `url` changes,
24
+ * so it never sets state after unmount.
25
+ *
26
+ * Pass `url = null` to skip fetching (e.g. until an id is known); `data` resets to null and
27
+ * `loading` is false while skipped. `opts` is read per-request but does NOT re-trigger on its
28
+ * own identity — change `url` or call `refresh()` to re-fetch. Set `opts.timeoutMs` to bound
29
+ * a request that can hang.
30
+ */
31
+ export declare function useJsonFetch<T>(url: string | null, opts?: UseJsonFetchOptions): UseJsonFetchResult<T>;
32
+ /**
33
+ * `useJsonFetch` scoped to a plugin's own API: builds `/api/plugins/<id>/<path>`
34
+ * so components never hand-assemble the prefix. Pass `path = null` to skip.
35
+ */
36
+ export declare function usePluginJsonFetch<T>(pluginId: string, path: string | null, opts?: UseJsonFetchOptions): UseJsonFetchResult<T>;
@@ -0,0 +1,13 @@
1
+ import type { NavBadge } from '@makinbakin/sdk/types';
2
+ /**
3
+ * Sync a nav item's badge to the value passed each render. Calls
4
+ * `setNavBadge(pluginId, navItemId, badge)` only when the badge's value
5
+ * actually changes — the effect is keyed on a serialization of `count` +
6
+ * `tone`, not the object identity (which a parent recreates every render).
7
+ *
8
+ * This is the recommended glue for a badge provider: keep your own summary
9
+ * hook (fetch + refresh) per plugin, derive a `NavBadge | null`, and pass it
10
+ * here. Teardown is handled by `unregisterPlugin`, so this does not clear on
11
+ * unmount (which would flicker on dev hot-reload).
12
+ */
13
+ export declare function useNavBadge(pluginId: string, navItemId: string, badge: NavBadge | null): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Subscribe to server-pushed plugin events over the shell's SINGLE EventSource.
3
+ *
4
+ * The shell owns one `/api/events` connection (`use-sse.ts`) with reconnect +
5
+ * backoff. Plugins used to each open their own `new EventSource('/api/events')`
6
+ * — N connections, no reconnect. Instead the shell fans every
7
+ * `{ type: 'plugin-event', event, … }` payload into this process-global emitter,
8
+ * and components subscribe by event name here. The handler receives the full
9
+ * payload so it can filter on `assetId`/`taskId`/etc.
10
+ */
11
+ export type PluginEventPayload = Record<string, unknown> & {
12
+ event?: string;
13
+ };
14
+ type Handler = (payload: PluginEventPayload) => void;
15
+ /** Called by the shell SSE handler for every `plugin-event` payload. */
16
+ export declare function emitPluginEvent(payload: PluginEventPayload): void;
17
+ /** Run `handler` whenever the server pushes a plugin event named `event`. */
18
+ export declare function usePluginEvent(event: string, handler: Handler): void;
19
+ export {};
@@ -1,14 +1,5 @@
1
1
  /**
2
- * Syncs a single string value to a URL query parameter.
3
- * Returns [value, setValue, pushValue] like useState.
4
- * - setValue uses router.replace (no history entry) — good for filters, search, view toggles
5
- * - pushValue uses router.push (creates history entry) — good for opening drawers/modals
6
- * When value equals defaultValue, the param is removed from the URL.
2
+ * @deprecated Import URL-backed state from `@makinbakin/sdk/navigation`.
3
+ * This module remains as a compatibility adapter for existing consumers.
7
4
  */
8
- export declare function useQueryState(key: string, defaultValue?: string): [string, (v: string) => void, (v: string) => void];
9
- /**
10
- * Syncs a string[] to a URL query parameter (comma-separated).
11
- * Returns [values, setValues] like useState.
12
- * When array is empty, the param is removed from the URL.
13
- */
14
- export declare function useQueryArrayState(key: string): [string[], (v: string[]) => void];
5
+ export { useQueryArrayState, useQueryState } from '@makinbakin/sdk/navigation';
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared split-pane resize behavior. A pane is anchored to the
3
+ * trailing edge (bottom for 'y', right for 'x') and resized by dragging the
4
+ * divider on its leading edge — dragging toward that edge (up / left) grows it.
5
+ * {@link useHorizontalResize} provides the right-anchored panel wrapper;
6
+ * keep all drag / persistence / a11y logic here so it lives in exactly one place.
7
+ */
8
+ export type ResizeAxis = 'x' | 'y';
9
+ interface CoreOptions {
10
+ axis: ResizeAxis;
11
+ defaultSize: number;
12
+ minSize: number;
13
+ maxSize: number;
14
+ /** localStorage key suffix; persisted under `${storagePrefix}${storageKey}`. */
15
+ storageKey?: string;
16
+ storagePrefix: string;
17
+ }
18
+ export interface ResizeHandleProps {
19
+ role: 'separator';
20
+ tabIndex: 0;
21
+ 'aria-orientation': 'horizontal' | 'vertical';
22
+ 'aria-valuenow': number;
23
+ 'aria-valuemin': number;
24
+ 'aria-valuemax': number;
25
+ onMouseDown: (e: React.MouseEvent) => void;
26
+ onTouchStart: (e: React.TouchEvent) => void;
27
+ onKeyDown: (e: React.KeyboardEvent) => void;
28
+ }
29
+ export interface ResizablePane {
30
+ size: number;
31
+ setSize: (n: number) => void;
32
+ handleProps: ResizeHandleProps;
33
+ }
34
+ export declare function useResizablePane({ axis, defaultSize, minSize, maxSize, storageKey, storagePrefix }: CoreOptions): ResizablePane;
35
+ export {};
@@ -3,6 +3,8 @@ export interface ScheduleJob {
3
3
  displayName: string;
4
4
  description?: string;
5
5
  agentId?: string;
6
+ /** Team assignment (#189) — mutually exclusive with agentId. */
7
+ teamId?: string;
6
8
  humanSchedule: string;
7
9
  cron?: string;
8
10
  paused: boolean;
@@ -31,20 +33,26 @@ export interface ScheduleJob {
31
33
  lastRun?: string;
32
34
  createdAt?: string;
33
35
  updatedAt?: string;
36
+ /** One-shot ('at') job that has fired: disabled with its consumed instant. */
37
+ completed?: boolean;
38
+ completedAt?: string;
34
39
  }
35
40
  export interface RunEntry {
36
41
  runId: string;
37
42
  timestamp: string;
38
- status: 'success' | 'failure' | 'skipped';
43
+ status: 'success' | 'failure' | 'skipped' | 'pending';
39
44
  taskId?: string;
40
45
  error?: string;
46
+ skippedReason?: string;
41
47
  }
42
48
  interface UseScheduleOptions {
43
49
  agent?: string;
44
50
  }
45
51
  export declare function useScheduleJobs(options?: UseScheduleOptions): {
46
52
  jobs: ScheduleJob[];
53
+ allJobs: ScheduleJob[];
47
54
  loading: boolean;
55
+ fetchFailed: boolean;
48
56
  refresh: () => Promise<void>;
49
57
  pauseJob: (jobId: string, pauseUntil?: string) => Promise<boolean>;
50
58
  resumeJob: (jobId: string) => Promise<boolean>;
@@ -56,6 +64,44 @@ export declare function useScheduleJobs(options?: UseScheduleOptions): {
56
64
  skipNext: (jobId: string, n?: number) => Promise<boolean>;
57
65
  duplicateJob: (jobId: string, overrides?: Record<string, unknown>) => Promise<boolean>;
58
66
  };
67
+ /** A plugin-contributed dated event rendered alongside job occurrences (#191). */
68
+ export interface ScheduledDomainEvent {
69
+ id: string;
70
+ pluginId: string;
71
+ title: string;
72
+ startsAt?: string;
73
+ endsAt?: string;
74
+ dueAt?: string;
75
+ kind: string;
76
+ status?: string;
77
+ url?: string;
78
+ reschedulable?: boolean;
79
+ metadata?: Record<string, unknown>;
80
+ }
81
+ /** One server-computed calendar placement — see plugins/schedule/lib/occurrences.ts. */
82
+ export interface ScheduleOccurrence {
83
+ jobId: string;
84
+ /** Absolute instant, ISO-8601 UTC — render in the browser's local tz. */
85
+ at: string;
86
+ past: boolean;
87
+ /** Ledger disposition for past Bakin occurrences (absent = never claimed). */
88
+ disposition?: 'pending' | 'created' | 'skipped' | 'seeded';
89
+ taskId?: string;
90
+ skipReason?: string;
91
+ }
92
+ /**
93
+ * Server-computed occurrences for a time range — the ONLY placement source
94
+ * for the calendar views (kind-aware, timezone/DST-correct; the old client-
95
+ * side cron parsing is gone). Refetches on schedule SSE events.
96
+ */
97
+ export declare function useOccurrences(fromIso: string, toIso: string): {
98
+ occurrences: ScheduleOccurrence[];
99
+ events: ScheduledDomainEvent[];
100
+ unevaluated: string[];
101
+ droppedProviders: string[];
102
+ loading: boolean;
103
+ refresh: () => Promise<void>;
104
+ };
59
105
  export declare function useRunHistory(jobId: string | null, limit?: number): {
60
106
  runs: RunEntry[];
61
107
  loading: boolean;
@@ -4,7 +4,7 @@ export interface SearchResult {
4
4
  score: number;
5
5
  fields: Record<string, unknown>;
6
6
  _table?: string;
7
- /** Per-index score breakdown (e.g. { search: 0.8, embeddings: 0.6 }) */
7
+ /** Per-leg score breakdown keyed by neutral leg names (e.g. { full_text: 0.8, assets_visual: -0.2 }) */
8
8
  indexScores?: Record<string, number>;
9
9
  }
10
10
  export interface SearchResponse {
@@ -17,25 +17,39 @@ export interface SearchResponse {
17
17
  query: string;
18
18
  total: number;
19
19
  took_ms: number;
20
- source: 'search' | 'fallback';
20
+ source: 'search' | 'unavailable';
21
+ /** True when any source degraded/was omitted under the query budget. */
22
+ partial?: boolean;
23
+ tables?: Array<{
24
+ table: string;
25
+ hits: number;
26
+ took_ms: number;
27
+ budget?: 'degraded' | 'omitted';
28
+ }>;
21
29
  };
22
30
  }
31
+ /**
32
+ * Honest search lifecycle (spec D11). `unavailable` is the explicit
33
+ * engine-down signal (HTTP 503 `search_unavailable`) — render
34
+ * `<SearchUnavailable/>`, never a silent lower-quality substitute.
35
+ */
36
+ export type SearchStatus = 'idle' | 'loading' | 'ok' | 'unavailable' | 'error';
23
37
  export interface UseSearchOptions {
24
38
  /**
25
39
  * Plugin id to route the query to. When set, the hook fetches
26
40
  * `/api/plugins/{plugin}/search?q=...` — the plugin owns its table
27
41
  * name and the client never sees the raw `bakin_` prefix. Omit for
28
- * cross-plugin search, which falls back to `/api/search?q=...`.
42
+ * cross-plugin search via `/api/search?q=...`.
29
43
  */
30
44
  plugin?: string;
31
45
  /** Max results */
32
46
  limit?: number;
33
47
  /** Facet fields to include aggregation counts for */
34
48
  facets?: string[];
49
+ /** Restrict cross-plugin search to these content types (tables). */
50
+ types?: string[];
35
51
  /** Debounce delay in ms (default: 250) */
36
52
  debounce?: number;
37
- /** Fallback filter function when search returns no results or errors */
38
- fallback?: (query: string) => SearchResult[];
39
53
  }
40
54
  export interface UseSearchReturn {
41
55
  results: SearchResult[];
@@ -43,11 +57,15 @@ export interface UseSearchReturn {
43
57
  value: string;
44
58
  count: number;
45
59
  }>>;
60
+ status: SearchStatus;
61
+ /** True while a request is in flight or debounce-pending (=== status 'loading'). */
46
62
  loading: boolean;
47
63
  error: string | null;
48
64
  meta: SearchResponse['meta'] | null;
49
65
  search: (query: string) => void;
50
66
  clear: () => void;
67
+ /** Re-run the last query immediately (Retry in the unavailable state). */
68
+ retry: () => void;
51
69
  }
52
70
  /**
53
71
  * Given a client-side filtered list and search results, reorder the list
@@ -58,8 +76,9 @@ export declare function reorderBySearchResults<T extends {
58
76
  id: string;
59
77
  }>(items: T[], searchResults: SearchResult[]): T[];
60
78
  /**
61
- * React hook for Bakin search with debouncing, AbortController, and an
62
- * optional client-side fallback. Scopes to a plugin via `plugin:` or
63
- * runs cross-plugin when omitted.
79
+ * React hook for Bakin search with debouncing and AbortController.
80
+ * Scopes to a plugin via `plugin:` or runs cross-plugin when omitted.
81
+ * There is deliberately NO client-side fallback: engine-down is an
82
+ * explicit `unavailable` status the UI must surface (spec D11).
64
83
  */
65
84
  export declare function useSearch(options?: UseSearchOptions): UseSearchReturn;
@@ -0,0 +1,26 @@
1
+ /** Task-level terminal outcome (mirrors plugins/tasks TaskOutcome). */
2
+ export interface TaskOutcome {
3
+ state: 'done' | 'blocked' | 'archived' | 'in_progress';
4
+ /** Set when state === 'done' and a completion row exists. */
5
+ completedAt?: string;
6
+ /** Agent that recorded the completion, when known. */
7
+ agent?: string;
8
+ }
9
+ /** One dispatch attempt for a task (mirrors plugins/tasks TaskRunEntry). */
10
+ export interface TaskRunEntry {
11
+ runId: string;
12
+ taskId: string;
13
+ seq: number;
14
+ agent: string;
15
+ status: 'running' | 'settled' | 'superseded' | 'lost';
16
+ startedAt: string;
17
+ settledAt?: string;
18
+ settleReason?: string;
19
+ durationMs?: number;
20
+ }
21
+ /** Fetch a task's dispatch run history (newest-first) + task outcome from the execution ledger. */
22
+ export declare function useTaskRunHistory(taskId: string | null, limit?: number): {
23
+ runs: TaskRunEntry[];
24
+ outcome: TaskOutcome | undefined;
25
+ loading: boolean;
26
+ };