@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,55 @@
1
+ /**
2
+ * `@bakin/sdk/slots` — client-side slot registry + `<Slot>` primitive.
3
+ *
4
+ * The slot system lets a plugin render components contributed by other
5
+ * plugins at a named extension point. Today it's used for:
6
+ * - `asset-preview` — renderer for an asset (images/video/audio/pdf/...)
7
+ * - `task-sidebar` — side panels on the task detail dialog
8
+ * - `home-widget` — dashboard tiles
9
+ *
10
+ * Design:
11
+ * - `registerSlot(name, Component, order?, owner?)` mutates a browser-
12
+ * global Map. Namespaced under `__bakinSlotRegistry` so HMR / module
13
+ * dedup doesn't wipe the registrations. `owner` is the pluginId that
14
+ * registered the entry — used by `unregisterPlugin` to clean up only
15
+ * that plugin's entries during hot-swap.
16
+ * - `<Slot name="..." {...props} />` reads the registry at render time and
17
+ * renders every matched component in `order` sequence.
18
+ *
19
+ * Registration happens at plugin client-module load time (import side effect).
20
+ * Test-only helpers are not exported — tests use the public unregister path.
21
+ */
22
+ import { type ComponentType, type JSX } from 'react';
23
+ interface SlotEntry {
24
+ component: ComponentType<Record<string, unknown>>;
25
+ order: number;
26
+ owner?: string;
27
+ }
28
+ /**
29
+ * Register a component for a named slot. Lower `order` renders first; entries
30
+ * with the same order render in registration order. Default `order` is 100.
31
+ * `owner` is the pluginId for teardown-on-hot-swap; omit in test setups.
32
+ */
33
+ export declare function registerSlot<TProps>(name: string, component: ComponentType<TProps>, order?: number, owner?: string): void;
34
+ /**
35
+ * Read the registered entries for a slot. Exported for tooling / tests.
36
+ */
37
+ export declare function getSlotEntries(name: string): ReadonlyArray<SlotEntry>;
38
+ /**
39
+ * Remove every slot entry owned by the given plugin. Used by
40
+ * `unregisterPlugin` during v2 hot-swap. Entries without an `owner`
41
+ * (test registrations, pre-v2 legacy registrations) survive — callers
42
+ * that want to wipe unowned entries should re-register them after.
43
+ */
44
+ export declare function clearSlotsOwnedBy(pluginId: string): void;
45
+ interface SlotProps {
46
+ name: string;
47
+ [key: string]: unknown;
48
+ }
49
+ /**
50
+ * Render all components registered for the named slot, in order. Extra props
51
+ * are passed through to every registered component unchanged. Returns `null`
52
+ * if nothing is registered.
53
+ */
54
+ export declare function Slot({ name, ...props }: SlotProps): JSX.Element | null;
55
+ export {};
package/slots/index.js ADDED
@@ -0,0 +1,92 @@
1
+ // @bun
2
+ // packages/sdk/src/slots/index.tsx
3
+ import { useSyncExternalStore } from "react";
4
+
5
+ // packages/sdk/src/register.ts
6
+ "use client";
7
+ function buildNavItemsSnapshot(registry) {
8
+ const items = [];
9
+ for (const navItems of registry.navByPlugin.values()) {
10
+ items.push(...navItems);
11
+ }
12
+ return items.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
13
+ }
14
+ function getRegistry() {
15
+ const g = globalThis;
16
+ if (!g.__bakinClientRegistry) {
17
+ g.__bakinClientRegistry = {
18
+ navByPlugin: new Map,
19
+ routesByPlugin: new Map,
20
+ cleanupByPlugin: new Map,
21
+ navItemsSnapshot: [],
22
+ version: 0,
23
+ listeners: new Set
24
+ };
25
+ }
26
+ const registry = g.__bakinClientRegistry;
27
+ if (!Array.isArray(registry.navItemsSnapshot)) {
28
+ registry.navItemsSnapshot = buildNavItemsSnapshot(registry);
29
+ }
30
+ return registry;
31
+ }
32
+ function getRegistryVersion() {
33
+ return getRegistry().version;
34
+ }
35
+ function subscribeRegistry(listener) {
36
+ const registry = getRegistry();
37
+ registry.listeners.add(listener);
38
+ return () => {
39
+ registry.listeners.delete(listener);
40
+ };
41
+ }
42
+
43
+ // packages/sdk/src/slots/index.tsx
44
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
45
+ "use client";
46
+ function getRegistry2() {
47
+ const g = globalThis;
48
+ if (!g.__bakinSlotRegistry) {
49
+ g.__bakinSlotRegistry = new Map;
50
+ }
51
+ return g.__bakinSlotRegistry;
52
+ }
53
+ function registerSlot(name, component, order = 100, owner) {
54
+ const reg = getRegistry2();
55
+ const entries = reg.get(name) ?? [];
56
+ entries.push({ component, order, owner });
57
+ entries.sort((a, b) => a.order - b.order);
58
+ reg.set(name, entries);
59
+ }
60
+ function getSlotEntries(name) {
61
+ return getRegistry2().get(name) ?? [];
62
+ }
63
+ function clearSlotsOwnedBy(pluginId) {
64
+ const reg = getRegistry2();
65
+ for (const [name, entries] of reg.entries()) {
66
+ const filtered = entries.filter((e) => e.owner !== pluginId);
67
+ if (filtered.length === 0)
68
+ reg.delete(name);
69
+ else
70
+ reg.set(name, filtered);
71
+ }
72
+ }
73
+ function Slot({ name, ...props }) {
74
+ useSyncExternalStore(subscribeRegistry, getRegistryVersion, getRegistryVersion);
75
+ const entries = getSlotEntries(name);
76
+ if (entries.length === 0)
77
+ return null;
78
+ return /* @__PURE__ */ jsxDEV(Fragment, {
79
+ children: entries.map((entry, i) => {
80
+ const C = entry.component;
81
+ return /* @__PURE__ */ jsxDEV(C, {
82
+ ...props
83
+ }, `${name}-${i}`, false, undefined, this);
84
+ })
85
+ }, undefined, false, undefined, this);
86
+ }
87
+ export {
88
+ registerSlot,
89
+ getSlotEntries,
90
+ clearSlotsOwnedBy,
91
+ Slot
92
+ };