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

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 (42) hide show
  1. package/README.md +1 -0
  2. package/_internal/app/components/agent-select.d.ts +7 -2
  3. package/_internal/app/components/confirm-dialog.d.ts +33 -0
  4. package/_internal/app/components/empty-state.d.ts +14 -5
  5. package/_internal/app/components/ui/badge.d.ts +1 -1
  6. package/_internal/app/components/ui/button.d.ts +1 -1
  7. package/_internal/app/hooks/use-content-store.d.ts +0 -9
  8. package/_internal/app/hooks/use-horizontal-resize.d.ts +22 -0
  9. package/_internal/app/hooks/use-json-fetch.d.ts +21 -0
  10. package/_internal/app/hooks/use-nav-badge.d.ts +13 -0
  11. package/_internal/app/hooks/use-plugin-event.d.ts +19 -0
  12. package/_internal/app/hooks/use-resizable-pane.d.ts +35 -0
  13. package/_internal/app/hooks/use-schedule.d.ts +2 -1
  14. package/_internal/app/hooks/use-task-run-history.d.ts +26 -0
  15. package/_internal/app/hooks/use-vertical-resize.d.ts +6 -7
  16. package/_internal/app/types/index.d.ts +1 -105
  17. package/_internal/core/adapters/runtime/concepts.d.ts +141 -67
  18. package/_internal/core/adapters/runtime/errors.d.ts +86 -0
  19. package/_internal/core/adapters/runtime/index.d.ts +3 -1
  20. package/_internal/core/content-dir.d.ts +1 -0
  21. package/_internal/core/format.d.ts +9 -0
  22. package/_internal/core/plugin-types.d.ts +124 -470
  23. package/_internal/plugins/models/hooks/use-available-models.d.ts +5 -0
  24. package/_internal/plugins/team/types.d.ts +14 -4
  25. package/components/index.d.ts +40 -2
  26. package/components/index.js +15897 -1678
  27. package/hooks/index.d.ts +69 -8
  28. package/hooks/index.js +14589 -369
  29. package/index.d.ts +64 -2
  30. package/index.js +228 -7
  31. package/metadata/index.d.ts +14 -1
  32. package/package.json +1 -1
  33. package/register.d.ts +45 -9
  34. package/routing/index.d.ts +6 -1
  35. package/routing/index.js +13 -1
  36. package/slots/index.d.ts +16 -24
  37. package/slots/index.js +196 -30
  38. package/types/index.d.ts +15 -919
  39. package/ui/index.js +2 -1
  40. package/utils/index.d.ts +40 -3
  41. package/utils/index.js +57 -0
  42. package/_internal/app/hooks/use-assets.d.ts +0 -25
package/README.md CHANGED
@@ -86,6 +86,7 @@ component for a slot via `registerPlugin({ slots: { 'slot-name': Component } })`
86
86
  | `task-assets` | Task drawer, asset attachments section |
87
87
  | `task-sidebar` | Task drawer sidebar (custom panels for a plugin's tasks) |
88
88
  | `home-widget` | Dashboard home widget grid |
89
+ | `nav-badge-providers` | Background hook runners (render `null`) that drive `setNavBadge` |
89
90
  | `page:/<route>` | Full-page mount at `<route>` |
90
91
 
91
92
  ## Sub-path imports
@@ -1,6 +1,11 @@
1
- interface AgentSelectProps {
1
+ import type { AriaAttributes } from 'react';
2
+ interface AgentSelectProps extends Pick<AriaAttributes, 'aria-describedby' | 'aria-invalid'> {
3
+ id?: string;
2
4
  value: string;
3
5
  onValueChange: (value: string) => void;
6
+ /** Include the workflow/task runtime assignee token (`$assigned`) */
7
+ includeAssigned?: boolean;
8
+ assignedLabel?: string;
4
9
  /** Show a "None" / "Unassigned" option at the top (default: false) */
5
10
  allowNone?: boolean;
6
11
  /** Label for the none option (default: "Unassigned") */
@@ -11,5 +16,5 @@ interface AgentSelectProps {
11
16
  agentIds?: string[];
12
17
  className?: string;
13
18
  }
14
- export declare function AgentSelect({ value, onValueChange, allowNone, noneLabel, placeholder, agentIds, className, }: AgentSelectProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare function AgentSelect({ value, onValueChange, includeAssigned, assignedLabel, allowNone, noneLabel, placeholder, agentIds, className, id, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, }: AgentSelectProps): import("react/jsx-runtime").JSX.Element;
15
20
  export {};
@@ -0,0 +1,33 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ConfirmDialogProps {
3
+ /** Whether the dialog is shown. Controlled by the caller (e.g. `open={!!target}`). */
4
+ open: boolean;
5
+ title: ReactNode;
6
+ /** Body copy. Rendered inside DialogDescription (a `<p>`) — pass inline content; use `<span className="block">` for secondary lines. */
7
+ description?: ReactNode;
8
+ /** Confirm button label (default "Delete"). */
9
+ confirmLabel?: string;
10
+ /** Confirm label while busy (default = confirmLabel); a spinner is prepended. */
11
+ busyLabel?: string;
12
+ /** Cancel button label (default "Cancel"). */
13
+ cancelLabel?: string;
14
+ /** Cancel button variant (default "outline"). */
15
+ cancelVariant?: 'outline' | 'ghost';
16
+ /** Disables both buttons and shows a spinner on confirm while the action is in flight. */
17
+ busy?: boolean;
18
+ /** Inline error shown above the footer. */
19
+ error?: string | null;
20
+ /** Test id forwarded to the confirm button. */
21
+ confirmTestId?: string;
22
+ /** DialogContent className override (default width is `sm:max-w-sm`). */
23
+ className?: string;
24
+ onConfirm: () => void;
25
+ onCancel: () => void;
26
+ }
27
+ /**
28
+ * A controlled confirmation dialog for destructive actions — the consolidation of
29
+ * six near-identical hand-rolled delete dialogs. The caller owns visibility (`open`)
30
+ * and the busy/error state of the in-flight action; the dialog never closes itself
31
+ * while `busy` so an action can't be cancelled mid-flight.
32
+ */
33
+ export declare function ConfirmDialog({ open, title, description, confirmLabel, busyLabel, cancelLabel, cancelVariant, busy, error, confirmTestId, className, onConfirm, onCancel, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,19 @@
1
- import type { LucideIcon } from 'lucide-react';
1
+ import type { ComponentType, ReactNode } from 'react';
2
2
  interface EmptyStateProps {
3
- icon?: LucideIcon;
3
+ icon?: ComponentType<{
4
+ className?: string;
5
+ }>;
4
6
  title: string;
5
- description?: string;
6
- action?: React.ReactNode;
7
+ description?: ReactNode;
8
+ action?: ReactNode;
7
9
  className?: string;
10
+ /**
11
+ * Visual size.
12
+ * - `default` — compact rounded chip + small title (the original SDK look).
13
+ * - `panel` — larger rounded-2xl chip + semibold title for full-tab empty
14
+ * surfaces (folded in from the team plugin's former local variant).
15
+ */
16
+ variant?: 'default' | 'panel';
8
17
  }
9
- export declare function EmptyState({ icon: Icon, title, description, action, className }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare function EmptyState({ icon: Icon, title, description, action, className, variant }: EmptyStateProps): import("react/jsx-runtime").JSX.Element;
10
19
  export {};
@@ -1,7 +1,7 @@
1
1
  import { useRender } from "@base-ui/react/use-render";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "destructive" | "link" | "default" | "outline" | "secondary" | "ghost" | null | undefined;
4
+ variant?: "destructive" | "default" | "link" | "outline" | "secondary" | "ghost" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
7
7
  export { Badge, badgeVariants };
@@ -1,7 +1,7 @@
1
1
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "destructive" | "link" | "default" | "outline" | "secondary" | "ghost" | "warning" | "accent" | null | undefined;
4
+ variant?: "info" | "destructive" | "default" | "link" | "outline" | "secondary" | "ghost" | "warning" | "accent" | null | undefined;
5
5
  size?: "default" | "sm" | "lg" | "icon" | "xs" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react/jsx-runtime").JSX.Element;
@@ -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,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,21 @@
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>;
@@ -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 {};
@@ -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 {};
@@ -35,9 +35,10 @@ export interface ScheduleJob {
35
35
  export interface RunEntry {
36
36
  runId: string;
37
37
  timestamp: string;
38
- status: 'success' | 'failure' | 'skipped';
38
+ status: 'success' | 'failure' | 'skipped' | 'pending';
39
39
  taskId?: string;
40
40
  error?: string;
41
+ skippedReason?: string;
41
42
  }
42
43
  interface UseScheduleOptions {
43
44
  agent?: string;
@@ -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
+ };
@@ -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,113 +1,8 @@
1
- export interface TaskLogEntry {
2
- timestamp: string;
3
- author: string;
4
- message: string;
5
- }
6
- export interface Task {
7
- id: string;
8
- title: string;
9
- agent?: string;
10
- checked: boolean;
11
- date?: string;
12
- blockedReason?: string;
13
- description?: string;
14
- log?: TaskLogEntry[];
15
- }
16
- export interface TaskColumns {
17
- inProgress: Task[];
18
- todo: Task[];
19
- done: Task[];
20
- blocked: Task[];
21
- }
22
- export interface TaskBoard {
23
- columns: TaskColumns;
24
- timestamp?: string;
25
- }
26
- export type ColumnId = keyof TaskColumns;
27
- export interface CalendarEvent {
28
- time?: string;
29
- text: string;
30
- }
31
- export interface CalendarDay {
32
- date: string;
33
- label?: string;
34
- events: CalendarEvent[];
35
- }
36
- export interface RecurringEvent {
37
- schedule: string;
38
- text: string;
39
- }
40
- export interface MemoryEntry {
41
- type: 'decision' | 'learned' | 'note';
42
- text: string;
43
- }
44
- export interface MemoryDay {
45
- date: string;
46
- entries: MemoryEntry[];
47
- }
48
1
  export interface Heartbeat {
49
2
  status: 'working' | 'idle' | 'down';
50
3
  currentTask?: string;
51
4
  timestamp: string;
52
5
  }
53
- export interface ProjectMeta {
54
- filename: string;
55
- title: string;
56
- status?: string;
57
- content: string;
58
- }
59
- export interface AssetVariantMeta {
60
- role: 'thumbnail' | 'optimized' | 'webp';
61
- path: string;
62
- filename: string;
63
- size: number;
64
- mimeType: string;
65
- }
66
- export interface AssetMeta {
67
- path: string;
68
- filename: string;
69
- type: 'text' | 'images' | 'video' | 'audio' | 'plans' | 'research' | 'pdf' | 'data' | 'other';
70
- mimeType: string;
71
- size: number;
72
- mtimeMs?: number;
73
- metadata: {
74
- agent: string;
75
- taskId: string | null;
76
- created: string;
77
- tool?: string;
78
- description?: string;
79
- tags?: string[];
80
- originalFilename?: string;
81
- };
82
- variants?: AssetVariantMeta[];
83
- }
84
- export interface TrashedAssetMeta {
85
- filename: string;
86
- originalFilename: string;
87
- type: string;
88
- mimeType: string;
89
- size: number;
90
- deletedAt: string;
91
- expiresAt: string;
92
- metadata: {
93
- agent: string;
94
- taskId: string | null;
95
- created: string;
96
- tool?: string;
97
- description?: string;
98
- tags?: string[];
99
- } | null;
100
- }
101
- export interface OfficeData {
102
- asciiMap: string;
103
- statusTable: {
104
- agent: string;
105
- status: string;
106
- task: string;
107
- heartbeat: string;
108
- }[];
109
- history: string[];
110
- }
111
6
  export interface ActivityEvent {
112
7
  id: string;
113
8
  ts: string;
@@ -118,6 +13,7 @@ export interface ActivityEvent {
118
13
  taskTitle?: string;
119
14
  eventName?: string;
120
15
  duplicate?: boolean;
16
+ data?: Record<string, unknown>;
121
17
  }
122
18
  export interface ContentState {
123
19
  files: Record<string, string>;