@makinbakin/sdk 0.0.1-rc.2 → 0.0.1-rc.21

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 (125) hide show
  1. package/README.md +1 -0
  2. package/_internal/app/components/agent-select.d.ts +16 -2
  3. package/_internal/app/components/asset-picker.d.ts +25 -0
  4. package/_internal/app/components/charts/bar-chart.d.ts +16 -0
  5. package/_internal/app/components/charts/chart-data-table.d.ts +31 -0
  6. package/_internal/app/components/charts/chart-explainer.d.ts +9 -0
  7. package/_internal/app/components/charts/chart-tooltip.d.ts +8 -0
  8. package/_internal/app/components/charts/line-chart.d.ts +13 -0
  9. package/_internal/app/components/charts/palette.d.ts +24 -0
  10. package/_internal/app/components/charts/sparkline.d.ts +12 -0
  11. package/_internal/app/components/charts/stacked-column-chart.d.ts +40 -0
  12. package/_internal/app/components/confirm-dialog.d.ts +54 -0
  13. package/_internal/app/components/conversation/activity-group.d.ts +15 -0
  14. package/_internal/app/components/conversation/agent-turn.d.ts +36 -0
  15. package/_internal/app/components/conversation/attention.d.ts +56 -0
  16. package/_internal/app/components/conversation/composer.d.ts +35 -0
  17. package/_internal/app/components/conversation/conversation-empty-state.d.ts +8 -0
  18. package/_internal/app/components/conversation/conversation-panel.d.ts +33 -0
  19. package/_internal/app/components/conversation/conversation.d.ts +14 -0
  20. package/_internal/app/components/conversation/fold.d.ts +129 -0
  21. package/_internal/app/components/conversation/notification-sound.d.ts +8 -0
  22. package/_internal/app/components/conversation/relative-time.d.ts +8 -0
  23. package/_internal/app/components/conversation/reply-toast.d.ts +15 -0
  24. package/_internal/app/components/conversation/thread-id.d.ts +8 -0
  25. package/_internal/app/components/conversation/tool-call-drawer.d.ts +7 -0
  26. package/_internal/app/components/conversation/turn-recorder.d.ts +37 -0
  27. package/_internal/app/components/conversation/use-conversation-attention.d.ts +64 -0
  28. package/_internal/app/components/conversation/use-conversation-thread.d.ts +55 -0
  29. package/_internal/app/components/conversation/user-message.d.ts +11 -0
  30. package/_internal/app/components/danger-zone.d.ts +28 -0
  31. package/_internal/app/components/empty-state.d.ts +18 -6
  32. package/_internal/app/components/plugin-header.d.ts +4 -3
  33. package/_internal/app/components/save-bar.d.ts +32 -0
  34. package/_internal/app/components/score-overlay.d.ts +33 -0
  35. package/_internal/app/components/search-degraded-chip.d.ts +4 -0
  36. package/_internal/app/components/search-partial-chip.d.ts +13 -0
  37. package/_internal/app/components/search-unavailable.d.ts +12 -0
  38. package/_internal/app/components/section-card.d.ts +22 -0
  39. package/_internal/app/components/segmented-control.d.ts +28 -0
  40. package/_internal/app/components/stat-tile.d.ts +26 -0
  41. package/_internal/app/components/status-badge.d.ts +19 -0
  42. package/_internal/app/components/turn-output-view.d.ts +57 -0
  43. package/_internal/app/components/ui/badge.d.ts +1 -1
  44. package/_internal/app/components/ui/button.d.ts +1 -1
  45. package/_internal/app/components/underline-tabs.d.ts +6 -2
  46. package/_internal/app/components/unsaved-changes-guard.d.ts +34 -0
  47. package/_internal/app/core/conversation-turns.d.ts +148 -0
  48. package/_internal/app/core/logger.d.ts +1 -0
  49. package/_internal/app/hooks/use-available-models.d.ts +5 -0
  50. package/_internal/app/hooks/use-content-store.d.ts +0 -9
  51. package/_internal/app/hooks/use-file-drop.d.ts +25 -0
  52. package/_internal/app/hooks/use-history-back.d.ts +1 -0
  53. package/_internal/app/hooks/use-horizontal-resize.d.ts +22 -0
  54. package/_internal/app/hooks/use-json-fetch.d.ts +26 -0
  55. package/_internal/app/hooks/use-nav-badge.d.ts +13 -0
  56. package/_internal/app/hooks/use-plugin-event.d.ts +19 -0
  57. package/_internal/app/hooks/use-query-state.d.ts +2 -0
  58. package/_internal/app/hooks/use-resizable-pane.d.ts +35 -0
  59. package/_internal/app/hooks/use-schedule.d.ts +47 -1
  60. package/_internal/app/hooks/use-search.d.ts +27 -8
  61. package/_internal/app/hooks/use-task-run-history.d.ts +26 -0
  62. package/_internal/app/hooks/use-toast.d.ts +3 -3
  63. package/_internal/app/hooks/use-vertical-resize.d.ts +6 -7
  64. package/_internal/app/lib/browser-notify.d.ts +12 -1
  65. package/_internal/app/types/index.d.ts +1 -105
  66. package/_internal/core/adapters/runtime/concepts.d.ts +671 -99
  67. package/_internal/core/adapters/runtime/errors.d.ts +98 -0
  68. package/_internal/core/adapters/runtime/helpers.d.ts +19 -0
  69. package/_internal/core/adapters/runtime/index.d.ts +7 -2
  70. package/_internal/core/adapters/runtime/testing.d.ts +79 -0
  71. package/_internal/core/adapters/runtime/turn-activity.d.ts +23 -0
  72. package/_internal/core/adapters/shared.d.ts +122 -12
  73. package/_internal/core/content-dir.d.ts +9 -0
  74. package/_internal/core/docs/route.d.ts +1 -1
  75. package/_internal/core/format/structured.d.ts +44 -0
  76. package/_internal/core/format.d.ts +13 -0
  77. package/_internal/core/media/downscale.d.ts +18 -0
  78. package/_internal/core/media/sharp-loader.d.ts +36 -0
  79. package/_internal/core/plugin-types.d.ts +216 -499
  80. package/_internal/core/routing/define.d.ts +26 -3
  81. package/_internal/core/routing/dispatcher.d.ts +15 -6
  82. package/_internal/core/routing/index.d.ts +1 -1
  83. package/_internal/core/routing/types.d.ts +13 -70
  84. package/_internal/core/storage/atomic-write.d.ts +11 -0
  85. package/_internal/core/tasks/store.d.ts +129 -0
  86. package/_internal/core/tasks/testing.d.ts +2 -0
  87. package/_internal/{plugins/workflows/lib → core/workflows}/notification-channel-registry.d.ts +1 -1
  88. package/_internal/plugins/team/types.d.ts +61 -4
  89. package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +1 -1
  90. package/components/index.d.ts +111 -5
  91. package/components/index.js +61815 -30060
  92. package/hooks/index.d.ts +90 -9
  93. package/hooks/index.js +15181 -685
  94. package/hooks/router.d.ts +20 -4
  95. package/index.d.ts +20 -3
  96. package/index.js +297 -259
  97. package/internal/index.d.ts +70 -0
  98. package/internal/index.js +409 -0
  99. package/metadata/index.d.ts +14 -1
  100. package/package.json +9 -2
  101. package/register.d.ts +63 -9
  102. package/routing/index.d.ts +6 -1
  103. package/routing/index.js +187 -147
  104. package/slots/index.d.ts +16 -24
  105. package/slots/index.js +215 -30
  106. package/testing/index.d.ts +122 -0
  107. package/testing/index.js +21874 -0
  108. package/types/index.d.ts +19 -919
  109. package/types/index.js +16 -0
  110. package/ui/index.js +2 -1
  111. package/utils/index.d.ts +46 -6
  112. package/utils/index.js +322 -249
  113. package/_internal/app/components/integrated-brainstorm/activity.d.ts +0 -23
  114. package/_internal/app/components/integrated-brainstorm/collapsed-header.d.ts +0 -14
  115. package/_internal/app/components/integrated-brainstorm/empty-state.d.ts +0 -5
  116. package/_internal/app/components/integrated-brainstorm/index.d.ts +0 -8
  117. package/_internal/app/components/integrated-brainstorm/input-row.d.ts +0 -16
  118. package/_internal/app/components/integrated-brainstorm/message-list.d.ts +0 -8
  119. package/_internal/app/components/integrated-brainstorm/session.d.ts +0 -16
  120. package/_internal/app/components/integrated-brainstorm/sse.d.ts +0 -8
  121. package/_internal/app/components/integrated-brainstorm/thinking-indicator.d.ts +0 -19
  122. package/_internal/app/components/integrated-brainstorm/types.d.ts +0 -63
  123. package/_internal/app/components/integrated-brainstorm/use-auto-grow.d.ts +0 -6
  124. package/_internal/app/components/integrated-brainstorm/use-brainstorm-state.d.ts +0 -21
  125. package/_internal/app/hooks/use-assets.d.ts +0 -25
@@ -0,0 +1,148 @@
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
+ /**
11
+ * The durable transcript row shape (identical to chat's schema-v2 rows —
12
+ * user attachments are path-addressed server-side; display URLs are a
13
+ * client concern).
14
+ */
15
+ export type ConversationTurnRow = {
16
+ kind: 'user';
17
+ ts: string;
18
+ content: string;
19
+ attachments?: TurnAttachment[];
20
+ } | {
21
+ kind: 'assistant';
22
+ ts: string;
23
+ turnId?: string;
24
+ content: string;
25
+ } | {
26
+ kind: 'tool';
27
+ ts: string;
28
+ turnId?: string;
29
+ callId?: string;
30
+ toolName: string;
31
+ status: 'completed' | 'failed';
32
+ summary?: string;
33
+ inputPreview?: string;
34
+ outputPreview?: string;
35
+ durationMs?: number;
36
+ metadata?: Record<string, unknown>;
37
+ } | {
38
+ kind: 'error';
39
+ ts: string;
40
+ turnId?: string;
41
+ message: string;
42
+ errorKind?: string;
43
+ } | {
44
+ kind: 'aborted';
45
+ ts: string;
46
+ turnId?: string;
47
+ };
48
+ export interface TurnOutcome {
49
+ aborted: boolean;
50
+ errored: boolean;
51
+ }
52
+ export type StartTurnResult = 'accepted' | 'not_found' | 'busy';
53
+ export interface InflightTurnInfo {
54
+ key: string;
55
+ agentId: string;
56
+ turnId: string;
57
+ startedAt: number;
58
+ }
59
+ export interface ConversationTurnServiceConfig {
60
+ /** Consumer label for log lines (e.g. 'chat', 'projects.brainstorm'). */
61
+ name: string;
62
+ /** Bus event names — the consumer's wire contract (e.g. chat.chunk/done/error).
63
+ * `started` (optional) fires at turn-accept, BEFORE any runtime chunk —
64
+ * attention providers light the working dot instantly instead of waiting
65
+ * out model latency for the first chunk (#707). */
66
+ events: {
67
+ chunk: string;
68
+ done: string;
69
+ error: string;
70
+ started?: string;
71
+ };
72
+ /** Base payload identifying the thread on every event (e.g. key => ({ chatId: key })). */
73
+ payload: (key: string) => Record<string, unknown>;
74
+ /** Resolve the thread's agent; null → start() returns 'not_found'. */
75
+ resolveThread: (key: string) => {
76
+ agentId: string;
77
+ } | null | Promise<{
78
+ agentId: string;
79
+ } | null>;
80
+ /** Append one durable transcript row. Failures are logged, never thrown into the turn. */
81
+ appendRow: (key: string, row: ConversationTurnRow) => void | Promise<void>;
82
+ /**
83
+ * Runtime session thread id (e.g. key => `chat:${key}`). Called once per
84
+ * turn — per-turn thread schemes (brands' ephemeral randomUUID threads)
85
+ * are legitimate.
86
+ */
87
+ threadId: (key: string, agentId: string) => string;
88
+ /** Per-turn delivery framing appended to the runtime content; never persisted. */
89
+ framing?: string;
90
+ /** Run turns as ephemeral runtime sessions (no provider-side accumulation). */
91
+ ephemeral?: boolean;
92
+ hooks?: {
93
+ /** Read-only tap on EVERY runtime chunk (e.g. messaging proposal parsing). */
94
+ onChunk?: (key: string, chunk: ChatChunk) => void;
95
+ /** Spend attribution, once per turn — success and abort, never error. */
96
+ meter?: (info: {
97
+ key: string;
98
+ agentId: string;
99
+ turnId: string;
100
+ usage?: MessageUsage;
101
+ }) => Promise<void> | void;
102
+ /**
103
+ * Success/abort path only, AFTER final row persistence but BEFORE the
104
+ * done event — finalize derived state (e.g. messaging's proposal
105
+ * linking) so it is durable when clients react to done. Errors are
106
+ * logged, never thrown into the turn.
107
+ */
108
+ onTurnComplete?: (info: {
109
+ key: string;
110
+ aborted: boolean;
111
+ }) => Promise<void> | void;
112
+ /** Runs after the slot releases; waitFor() resolves after it completes. */
113
+ onSettled?: (info: {
114
+ ctx: TurnContext;
115
+ key: string;
116
+ outcome: TurnOutcome;
117
+ }) => Promise<unknown> | unknown;
118
+ };
119
+ }
120
+ export interface StartTurnOptions {
121
+ attachments?: TurnAttachment[];
122
+ /** Per-turn agent override (surfaces with an agent picker); default = resolveThread's. */
123
+ agentId?: string;
124
+ /**
125
+ * Pre-assembled runtime content for THIS turn (embedded surfaces inject
126
+ * doc/context prompts here). The persisted user row always keeps the
127
+ * clean `content`; when omitted, the runtime gets content + framing.
128
+ */
129
+ runtimeContent?: string;
130
+ }
131
+ export interface ConversationTurnService {
132
+ start(ctx: TurnContext, key: string, content: string, opts?: StartTurnOptions): Promise<StartTurnResult>;
133
+ /** Abort the in-flight turn; false when the thread is idle. */
134
+ abort(key: string): boolean;
135
+ isInFlight(key: string): boolean;
136
+ /** Assistant text streamed so far for the in-flight turn (null when idle) —
137
+ * lets GET responses seed mid-turn rehydration without the missing-start gap. */
138
+ inflightPreview(key: string): string | null;
139
+ /**
140
+ * Await the current turn; when called while the turn is in flight this
141
+ * also covers its onSettled tail. Resolves immediately when idle
142
+ * (including during onSettled itself — the slot has already released).
143
+ */
144
+ waitFor(key: string): Promise<void>;
145
+ /** Every in-flight turn — consumers build active-turn resolution on top. */
146
+ listInFlight(): InflightTurnInfo[];
147
+ }
148
+ export declare function createConversationTurnService(config: ConversationTurnServiceConfig): ConversationTurnService;
@@ -0,0 +1 @@
1
+ export { createLogger } from '../../core/logger';
@@ -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,25 @@
1
+ /**
2
+ * useFileDrop — the headless drag-drop file intake every upload surface
3
+ * repeats (drag-over state, dragOver/dragLeave/drop handlers, accept
4
+ * filtering). Four components hand-rolled this dance; compose the hook and
5
+ * style your own zone.
6
+ */
7
+ import { type DragEvent } from 'react';
8
+ export interface UseFileDropOptions {
9
+ /** MIME prefix/type filter, e.g. ['image/'] or ['image/', 'application/pdf']. Omit = accept all. */
10
+ accept?: string[];
11
+ multiple?: boolean;
12
+ onFiles: (files: File[]) => void;
13
+ /** Called when a drop contained ONLY rejected files — surface it, never swallow. */
14
+ onRejected?: (files: File[]) => void;
15
+ }
16
+ export interface UseFileDropResult {
17
+ dragOver: boolean;
18
+ /** Spread onto the drop target. */
19
+ dropProps: {
20
+ onDragOver: (e: DragEvent) => void;
21
+ onDragLeave: (e: DragEvent) => void;
22
+ onDrop: (e: DragEvent) => void;
23
+ };
24
+ }
25
+ export declare function useFileDrop({ accept, multiple, onFiles, onRejected }: UseFileDropOptions): UseFileDropResult;
@@ -0,0 +1 @@
1
+ export declare function useHistoryBack(fallbackTo: string): () => void;
@@ -0,0 +1,22 @@
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). The
18
+ * companion to {@link useVerticalResize} for side-by-side split panes; both are
19
+ * thin wrappers over {@link useResizablePane}.
20
+ */
21
+ export declare function useHorizontalResize({ defaultWidth, minWidth, maxWidth, storageKey }: Options): Return;
22
+ export {};
@@ -0,0 +1,26 @@
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
+ /**
12
+ * Cancellable JSON GET with the standard `{ data, loading, error, refresh }` lifecycle —
13
+ * the consolidation of the `let cancelled = false` fetch-in-useEffect boilerplate scattered
14
+ * across plugin components. Aborts the in-flight request on unmount or when `url` changes,
15
+ * so it never sets state after unmount.
16
+ *
17
+ * Pass `url = null` to skip fetching (e.g. until an id is known); `data` resets to null and
18
+ * `loading` is false while skipped. `opts` is read per-request but does NOT re-trigger on its
19
+ * own identity — change `url` or call `refresh()` to re-fetch.
20
+ */
21
+ export declare function useJsonFetch<T>(url: string | null, opts?: RequestInit): UseJsonFetchResult<T>;
22
+ /**
23
+ * `useJsonFetch` scoped to a plugin's own API: builds `/api/plugins/<id>/<path>`
24
+ * so components never hand-assemble the prefix. Pass `path = null` to skip.
25
+ */
26
+ export declare function usePluginJsonFetch<T>(pluginId: string, path: string | null, opts?: RequestInit): UseJsonFetchResult<T>;
@@ -0,0 +1,13 @@
1
+ import { type NavBadge } from '@makinbakin/sdk';
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 {};
@@ -4,11 +4,13 @@
4
4
  * - setValue uses router.replace (no history entry) — good for filters, search, view toggles
5
5
  * - pushValue uses router.push (creates history entry) — good for opening drawers/modals
6
6
  * When value equals defaultValue, the param is removed from the URL.
7
+ * Multiple setter calls in the same tick compose into one navigation.
7
8
  */
8
9
  export declare function useQueryState(key: string, defaultValue?: string): [string, (v: string) => void, (v: string) => void];
9
10
  /**
10
11
  * Syncs a string[] to a URL query parameter (comma-separated).
11
12
  * Returns [values, setValues] like useState.
12
13
  * When array is empty, the param is removed from the URL.
14
+ * Composes with other setter calls in the same tick (one navigation).
13
15
  */
14
16
  export declare function useQueryArrayState(key: string): [string[], (v: string[]) => void];
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared core for the two split-pane resize hooks. 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 useVerticalResize} and {@link useHorizontalResize} are thin wrappers;
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
+ };
@@ -7,10 +7,10 @@ export interface Toast {
7
7
  }
8
8
  interface ToastStore {
9
9
  toasts: Toast[];
10
- add: (toast: Omit<Toast, 'id'>) => void;
10
+ add: (toast: Omit<Toast, 'id'>) => string;
11
11
  dismiss: (id: string) => void;
12
12
  }
13
13
  export declare const useToastStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ToastStore>>;
14
- /** Convenience: call from anywhere without hooks */
15
- export declare function toast(message: ReactNode, type?: Toast['type'], duration?: number): void;
14
+ /** Convenience: call from anywhere without hooks. Returns the toast id for programmatic dismiss. */
15
+ export declare function toast(message: ReactNode, type?: Toast['type'], duration?: number): string;
16
16
  export {};
@@ -1,3 +1,4 @@
1
+ import { type ResizeHandleProps } from './use-resizable-pane';
1
2
  interface Options {
2
3
  defaultHeight: number;
3
4
  minHeight: number;
@@ -5,18 +6,16 @@ interface Options {
5
6
  /** When set, height is persisted in localStorage under `bakin-vresize:${storageKey}`. */
6
7
  storageKey?: string;
7
8
  }
8
- interface HandleProps {
9
- onMouseDown: (e: React.MouseEvent) => void;
10
- onTouchStart: (e: React.TouchEvent) => void;
11
- }
12
9
  interface Return {
13
10
  height: number;
14
11
  setHeight: (h: number) => void;
15
- handleProps: HandleProps;
12
+ handleProps: ResizeHandleProps;
16
13
  }
17
14
  /**
18
- * Resize a panel by dragging its top edge. The handle lives at the top of the
19
- * element; dragging upward grows the panel, dragging downward shrinks it.
15
+ * Resize a bottom-anchored panel by dragging its top edge. The handle lives at
16
+ * the top of the element; dragging upward grows the panel, dragging downward
17
+ * shrinks it. Keyboard: ArrowUp/ArrowDown (Shift for a larger step). Thin
18
+ * wrapper over {@link useResizablePane}.
20
19
  */
21
20
  export declare function useVerticalResize({ defaultHeight, minHeight, maxHeight, storageKey }: Options): Return;
22
21
  export {};
@@ -1,5 +1,16 @@
1
+ /**
2
+ * Navigate bridge — the host registers its router here at boot so
3
+ * notification clicks route client-side instead of full-reloading the shell.
4
+ * globalThis-based (like __bakinBroadcast) because every plugin bundle
5
+ * inlines its own copy of this module; a module-level variable would never
6
+ * reach those copies.
7
+ */
8
+ type NavigateFn = (url: string) => void;
9
+ export declare function setNotificationNavigator(navigate: NavigateFn): void;
10
+ export declare function navigateToUrl(url: string): void;
1
11
  export declare function isNotificationsSupported(): boolean;
2
12
  export declare function isNotificationsEnabled(): boolean;
3
13
  export declare function requestNotificationPermission(): Promise<boolean>;
4
14
  export declare function toggleNotifications(enabled: boolean): void;
5
- export declare function sendBrowserNotification(title: string, body: string): void;
15
+ export declare function sendBrowserNotification(title: string, body: string, url?: string): void;
16
+ export {};