@makinbakin/sdk 0.0.0-bootstrap.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +107 -0
  2. package/_internal/app/components/agent-avatar.d.ts +11 -0
  3. package/_internal/app/components/agent-filter.d.ts +8 -0
  4. package/_internal/app/components/agent-select.d.ts +15 -0
  5. package/_internal/app/components/agent-status.d.ts +8 -0
  6. package/_internal/app/components/bakin-drawer.d.ts +23 -0
  7. package/_internal/app/components/color-picker.d.ts +7 -0
  8. package/_internal/app/components/empty-state.d.ts +10 -0
  9. package/_internal/app/components/error-banner.d.ts +6 -0
  10. package/_internal/app/components/error-state.d.ts +8 -0
  11. package/_internal/app/components/facet-filter.d.ts +17 -0
  12. package/_internal/app/components/integrated-brainstorm/collapsed-header.d.ts +14 -0
  13. package/_internal/app/components/integrated-brainstorm/empty-state.d.ts +5 -0
  14. package/_internal/app/components/integrated-brainstorm/index.d.ts +3 -0
  15. package/_internal/app/components/integrated-brainstorm/input-row.d.ts +16 -0
  16. package/_internal/app/components/integrated-brainstorm/message-list.d.ts +8 -0
  17. package/_internal/app/components/integrated-brainstorm/thinking-indicator.d.ts +19 -0
  18. package/_internal/app/components/integrated-brainstorm/types.d.ts +61 -0
  19. package/_internal/app/components/integrated-brainstorm/use-auto-grow.d.ts +6 -0
  20. package/_internal/app/components/integrated-brainstorm/use-brainstorm-state.d.ts +21 -0
  21. package/_internal/app/components/markdown-content.d.ts +3 -0
  22. package/_internal/app/components/markdown-editor.d.ts +11 -0
  23. package/_internal/app/components/model-select.d.ts +9 -0
  24. package/_internal/app/components/page-layout.d.ts +9 -0
  25. package/_internal/app/components/plugin-header.d.ts +16 -0
  26. package/_internal/app/components/plugin-settings-renderer.d.ts +9 -0
  27. package/_internal/app/components/sortable-head.d.ts +13 -0
  28. package/_internal/app/components/ui/alert.d.ts +10 -0
  29. package/_internal/app/components/ui/avatar.d.ts +11 -0
  30. package/_internal/app/components/ui/badge.d.ts +7 -0
  31. package/_internal/app/components/ui/button.d.ts +8 -0
  32. package/_internal/app/components/ui/card.d.ts +11 -0
  33. package/_internal/app/components/ui/checkbox.d.ts +3 -0
  34. package/_internal/app/components/ui/collapsible.d.ts +5 -0
  35. package/_internal/app/components/ui/command.d.ts +19 -0
  36. package/_internal/app/components/ui/dialog.d.ts +17 -0
  37. package/_internal/app/components/ui/dropdown-menu.d.ts +29 -0
  38. package/_internal/app/components/ui/form.d.ts +23 -0
  39. package/_internal/app/components/ui/input-group.d.ts +18 -0
  40. package/_internal/app/components/ui/input.d.ts +3 -0
  41. package/_internal/app/components/ui/label.d.ts +3 -0
  42. package/_internal/app/components/ui/popover.d.ts +9 -0
  43. package/_internal/app/components/ui/progress.d.ts +7 -0
  44. package/_internal/app/components/ui/select.d.ts +15 -0
  45. package/_internal/app/components/ui/separator.d.ts +3 -0
  46. package/_internal/app/components/ui/sheet.d.ts +14 -0
  47. package/_internal/app/components/ui/skeleton.d.ts +2 -0
  48. package/_internal/app/components/ui/switch.d.ts +5 -0
  49. package/_internal/app/components/ui/table.d.ts +10 -0
  50. package/_internal/app/components/ui/tabs.d.ts +10 -0
  51. package/_internal/app/components/ui/textarea.d.ts +3 -0
  52. package/_internal/app/components/ui/tooltip.d.ts +6 -0
  53. package/_internal/app/components/underline-tabs.d.ts +15 -0
  54. package/_internal/app/hooks/use-assets.d.ts +25 -0
  55. package/_internal/app/hooks/use-content-store.d.ts +36 -0
  56. package/_internal/app/hooks/use-debug.d.ts +1 -0
  57. package/_internal/app/hooks/use-form-guard.d.ts +5 -0
  58. package/_internal/app/hooks/use-query-state.d.ts +14 -0
  59. package/_internal/app/hooks/use-runtime-status.d.ts +12 -0
  60. package/_internal/app/hooks/use-schedule.d.ts +63 -0
  61. package/_internal/app/hooks/use-search.d.ts +65 -0
  62. package/_internal/app/hooks/use-sidebar.d.ts +4 -0
  63. package/_internal/app/hooks/use-sse.d.ts +1 -0
  64. package/_internal/app/hooks/use-toast.d.ts +16 -0
  65. package/_internal/app/hooks/use-vertical-resize.d.ts +22 -0
  66. package/_internal/app/lib/browser-notify.d.ts +5 -0
  67. package/_internal/app/lib/map-audit-message.d.ts +7 -0
  68. package/_internal/app/lib/utils.d.ts +2 -0
  69. package/_internal/app/types/index.d.ts +126 -0
  70. package/_internal/core/adapters/runtime/capabilities.d.ts +2 -0
  71. package/_internal/core/adapters/runtime/concepts.d.ts +458 -0
  72. package/_internal/core/adapters/runtime/helpers.d.ts +5 -0
  73. package/_internal/core/adapters/runtime/index.d.ts +5 -0
  74. package/_internal/core/adapters/shared.d.ts +37 -0
  75. package/_internal/core/docs/index.d.ts +2 -0
  76. package/_internal/core/docs/metadata.d.ts +92 -0
  77. package/_internal/core/docs/route.d.ts +9 -0
  78. package/_internal/core/format.d.ts +6 -0
  79. package/_internal/core/openapi/errors.d.ts +29 -0
  80. package/_internal/core/openapi/zod-to-openapi.d.ts +14 -0
  81. package/_internal/core/plugin-types.d.ts +849 -0
  82. package/_internal/core/routing/define.d.ts +34 -0
  83. package/_internal/core/routing/dispatcher.d.ts +44 -0
  84. package/_internal/core/routing/index.d.ts +15 -0
  85. package/_internal/core/routing/operation-id.d.ts +9 -0
  86. package/_internal/core/routing/registry.d.ts +52 -0
  87. package/_internal/core/routing/search-route.d.ts +26 -0
  88. package/_internal/core/routing/types.d.ts +123 -0
  89. package/_internal/plugins/team/hooks/use-agent-store.d.ts +49 -0
  90. package/_internal/plugins/team/types.d.ts +131 -0
  91. package/_internal/plugins/workflows/hooks/channel-icon.d.ts +6 -0
  92. package/_internal/plugins/workflows/hooks/use-notification-channels.d.ts +13 -0
  93. package/_internal/plugins/workflows/lib/notification-channel-registry.d.ts +26 -0
  94. package/components/index.d.ts +33 -0
  95. package/components/index.js +39522 -0
  96. package/hooks/index.d.ts +25 -0
  97. package/hooks/index.js +1738 -0
  98. package/hooks/router.d.ts +38 -0
  99. package/index.d.ts +27 -0
  100. package/index.js +13917 -0
  101. package/metadata/index.d.ts +16 -0
  102. package/metadata/index.js +31 -0
  103. package/package.json +88 -0
  104. package/register.d.ts +103 -0
  105. package/routing/index.d.ts +11 -0
  106. package/routing/index.js +13721 -0
  107. package/slots/index.d.ts +55 -0
  108. package/slots/index.js +92 -0
  109. package/types/index.d.ts +840 -0
  110. package/types/index.js +1 -0
  111. package/ui/index.d.ts +34 -0
  112. package/ui/index.js +28713 -0
  113. package/utils/index.d.ts +9 -0
  114. package/utils/index.js +1832 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `@bakin/sdk/metadata` — docs-aware contract helpers.
3
+ *
4
+ * Re-exports the canonical `RouteContract`, `CliCommandContract`,
5
+ * `HookContract`, `SlotContract`, `ExecToolContract`, and the corresponding
6
+ * `define*Contract` helpers from `@bakin/core/docs`. The duplicated copy that
7
+ * previously lived in this file has been retired (T1) — keeping it
8
+ * structurally identical to the core copy was a maintenance burden the spec
9
+ * explicitly removes.
10
+ *
11
+ * `defineApiRoute` / `definePluginRoute` are kept as re-exports for backward
12
+ * compatibility with existing call sites; new code should use `defineRoute`
13
+ * from `@bakin/sdk/routing` (the typed declarative shape).
14
+ */
15
+ export type { ContractMetadata, ContractStability, ContractVisibility, CliCommandContract, DocsAwareAPIRoute, DocsExample, ExecToolContract, HookContract, HookKind, PublicContract, RouteContract, SchemaLike, SlotContract, SourceLocation, } from '../_internal/core/docs';
16
+ export { defineApiRoute, defineCliCommandContract, defineExecToolContract, defineHookContract, definePluginRoute, defineRouteContract, defineSlotContract, } from '../_internal/core/docs';
@@ -0,0 +1,31 @@
1
+ // @bun
2
+ // packages/core/src/docs/metadata.ts
3
+ function defineRouteContract(contract) {
4
+ return contract;
5
+ }
6
+ function defineCliCommandContract(contract) {
7
+ return contract;
8
+ }
9
+ function defineHookContract(contract) {
10
+ return contract;
11
+ }
12
+ function defineSlotContract(contract) {
13
+ return contract;
14
+ }
15
+ function defineExecToolContract(contract) {
16
+ return contract;
17
+ }
18
+ // packages/core/src/docs/route.ts
19
+ function defineApiRoute(route) {
20
+ return route;
21
+ }
22
+ var definePluginRoute = defineApiRoute;
23
+ export {
24
+ defineSlotContract,
25
+ defineRouteContract,
26
+ definePluginRoute,
27
+ defineHookContract,
28
+ defineExecToolContract,
29
+ defineCliCommandContract,
30
+ defineApiRoute
31
+ };
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@makinbakin/sdk",
3
+ "version": "0.0.0-bootstrap.0",
4
+ "description": "SDK for building Bakin plugins — UI components, slot types, hooks, and the runtime registerPlugin helper.",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./index.js",
8
+ "types": "./index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./index.js",
12
+ "types": "./index.d.ts"
13
+ },
14
+ "./ui": {
15
+ "import": "./ui/index.js",
16
+ "types": "./ui/index.d.ts"
17
+ },
18
+ "./hooks": {
19
+ "import": "./hooks/index.js",
20
+ "types": "./hooks/index.d.ts"
21
+ },
22
+ "./components": {
23
+ "import": "./components/index.js",
24
+ "types": "./components/index.d.ts"
25
+ },
26
+ "./slots": {
27
+ "import": "./slots/index.js",
28
+ "types": "./slots/index.d.ts"
29
+ },
30
+ "./types": {
31
+ "import": "./types/index.js",
32
+ "types": "./types/index.d.ts"
33
+ },
34
+ "./utils": {
35
+ "import": "./utils/index.js",
36
+ "types": "./utils/index.d.ts"
37
+ },
38
+ "./metadata": {
39
+ "import": "./metadata/index.js",
40
+ "types": "./metadata/index.d.ts"
41
+ },
42
+ "./routing": {
43
+ "import": "./routing/index.js",
44
+ "types": "./routing/index.d.ts"
45
+ }
46
+ },
47
+ "files": [
48
+ "**/*.js",
49
+ "**/*.d.ts",
50
+ "README.md"
51
+ ],
52
+ "peerDependencies": {
53
+ "react": "^19.0.0",
54
+ "react-dom": "^19.0.0"
55
+ },
56
+ "dependencies": {
57
+ "@base-ui/react": "^1.3.0",
58
+ "class-variance-authority": "^0.7.1",
59
+ "clsx": "^2.1.1",
60
+ "cmdk": "^1.1.1",
61
+ "lucide-react": "^0.577.0",
62
+ "react-hook-form": "^7.72.0",
63
+ "zod": "^4.3.0",
64
+ "zustand": "^5.0.12"
65
+ },
66
+ "repository": {
67
+ "type": "git",
68
+ "url": "git+https://github.com/markhayden/bakin.git",
69
+ "directory": "packages/sdk"
70
+ },
71
+ "homepage": "https://github.com/markhayden/bakin/tree/main/packages/sdk#readme",
72
+ "bugs": {
73
+ "url": "https://github.com/markhayden/bakin/issues"
74
+ },
75
+ "author": "markhayden",
76
+ "license": "MIT",
77
+ "keywords": [
78
+ "bakin",
79
+ "plugin",
80
+ "sdk",
81
+ "react",
82
+ "orchestration",
83
+ "agents"
84
+ ],
85
+ "publishConfig": {
86
+ "access": "public"
87
+ }
88
+ }
package/register.d.ts ADDED
@@ -0,0 +1,103 @@
1
+ /**
2
+ * `registerPlugin` — single-call plugin contribution API.
3
+ *
4
+ * Consolidates what each plugin's client.tsx does into one call:
5
+ * registerPlugin({
6
+ * id: 'my-plugin',
7
+ * navItems: [ ... ],
8
+ * slots: { 'asset-preview': AssetRenderer, 'page:/foo': MyPage },
9
+ * })
10
+ *
11
+ * Companion `unregisterPlugin` tears everything back down — used by the
12
+ * v2 dev-mode plugin hot-swap path and by any consumer that needs a clean
13
+ * reload. Plugin-local registries (e.g., workflows' node renderers and
14
+ * source definitions) hook into the teardown via `registerPluginCleanup`.
15
+ *
16
+ * Shell subscribes via `subscribeRegistry` / `getRegistryVersion` so the
17
+ * nav + slot trees re-render when plugins come or go at runtime.
18
+ */
19
+ import type { ComponentType } from 'react';
20
+ interface NavItem {
21
+ id: string;
22
+ label: string;
23
+ icon?: string;
24
+ href?: string;
25
+ order?: number;
26
+ alwaysExpanded?: boolean;
27
+ children?: NavItem[];
28
+ }
29
+ interface PluginRegistration {
30
+ id: string;
31
+ navItems?: NavItem[];
32
+ /**
33
+ * Route path pattern -> page component. Patterns support exact paths and
34
+ * dynamic segments in either `:id`, `[id]`, or `$id` form.
35
+ */
36
+ routes?: Record<string, ComponentType<any>>;
37
+ /**
38
+ * Map of slot name → component. Registered with the default order (100).
39
+ * Components are typed as `ComponentType<any>` because different slots
40
+ * accept different prop shapes (e.g. `page:/team/[id]` takes `agentId`,
41
+ * `asset-preview` takes `asset`) and `Slot` threads props through unchanged.
42
+ * For fine-grained ordering, call `registerSlot(name, Component, order, id)`
43
+ * directly from the plugin's client.tsx alongside registerPlugin.
44
+ */
45
+ slots?: Record<string, ComponentType<any>>;
46
+ }
47
+ interface ClientRouteEntry {
48
+ path: string;
49
+ component: ComponentType<Record<string, unknown>>;
50
+ owner: string;
51
+ }
52
+ /**
53
+ * Register everything a plugin contributes in one call. Invoked at the top
54
+ * of the plugin's client.tsx (or on dynamic import by the host's PluginHost).
55
+ */
56
+ export declare function registerPlugin(reg: PluginRegistration): void;
57
+ /**
58
+ * Remove every contribution a plugin made — nav items, owned slot entries,
59
+ * and any plugin-local registry cleanup functions it enrolled via
60
+ * `registerPluginCleanup`. Idempotent. Used by the v2 dev-mode hot-swap
61
+ * path before re-importing the plugin's client bundle.
62
+ */
63
+ export declare function unregisterPlugin(id: string): void;
64
+ /**
65
+ * Enroll a teardown function for the given plugin id. Runs when
66
+ * `unregisterPlugin(id)` is called. Plugins that maintain their own
67
+ * client-side registries (workflows' node renderers, source definitions)
68
+ * use this to hook into the unified teardown path.
69
+ */
70
+ export declare function registerPluginCleanup(id: string, fn: () => void): void;
71
+ /**
72
+ * Monotonic counter bumped on every register / unregister. Used with
73
+ * React's `useSyncExternalStore` (via `subscribeRegistry`) so the shell
74
+ * re-renders nav + slots when plugins come or go at runtime.
75
+ */
76
+ export declare function getRegistryVersion(): number;
77
+ /**
78
+ * Subscribe to registry mutations. Returns an unsubscribe function.
79
+ */
80
+ export declare function subscribeRegistry(listener: () => void): () => void;
81
+ /**
82
+ * All nav items from all registered plugins, sorted by `order` (default 100).
83
+ * The shell's sidebar reads this at render time.
84
+ */
85
+ export declare function getAllNavItems(): NavItem[];
86
+ /**
87
+ * Stable nav snapshot for React's useSyncExternalStore. The returned array
88
+ * identity only changes when plugin registration changes.
89
+ */
90
+ export declare function getNavItemsSnapshot(): readonly NavItem[];
91
+ /**
92
+ * Nav items for a specific plugin. Returned as a readonly copy.
93
+ */
94
+ export declare function getPluginNavItems(pluginId: string): ReadonlyArray<NavItem>;
95
+ export interface MatchedPluginRoute {
96
+ pluginId: string;
97
+ path: string;
98
+ component: ComponentType<Record<string, unknown>>;
99
+ params: Record<string, string>;
100
+ }
101
+ export declare function getPluginRoute(pathname: string): MatchedPluginRoute | null;
102
+ export declare function getPluginRoutes(pluginId?: string): ReadonlyArray<ClientRouteEntry>;
103
+ export type { NavItem, PluginRegistration, ClientRouteEntry };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `@bakin/sdk/routing` — typed route contracts for plugin authors.
3
+ *
4
+ * Re-exports from `@bakin/core/routing` for a single source of truth. The
5
+ * SDK's general type module (`@bakin/sdk/types`) keeps duplicated primitives
6
+ * for self-containment, but the routing surface re-exports because keeping
7
+ * two parallel `APIRoute<...>` definitions in sync is a debt we are
8
+ * deliberately avoiding.
9
+ */
10
+ export { defineRoute, defineCoreRoute, definePlugin, } from '../_internal/core/routing';
11
+ export type { HttpMethod, HttpStatus, RouteContext, PluginContextLite, CoreContext, JsonBodySpec, MultipartBodySpec, RawBodySpec, NoBodySpec, BodySpec, JsonResponseSpec, NoContentResponseSpec, NonJsonResponseSpec, ResponseSpec, ParsedInput, APIRoute, PluginWithRoutes, DefinePluginInput, } from '../_internal/core/routing';