@makinbakin/sdk 0.0.0-bootstrap.0 → 0.0.1-rc.10

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 (40) hide show
  1. package/README.md +21 -10
  2. package/_internal/app/components/agent-select.d.ts +7 -2
  3. package/_internal/app/components/integrated-brainstorm/activity.d.ts +23 -0
  4. package/_internal/app/components/integrated-brainstorm/index.d.ts +6 -1
  5. package/_internal/app/components/integrated-brainstorm/session.d.ts +16 -0
  6. package/_internal/app/components/integrated-brainstorm/sse.d.ts +8 -0
  7. package/_internal/app/components/integrated-brainstorm/types.d.ts +7 -5
  8. package/_internal/app/components/ui/badge.d.ts +1 -1
  9. package/_internal/app/components/ui/button.d.ts +1 -1
  10. package/_internal/app/hooks/use-content-store.d.ts +2 -0
  11. package/_internal/app/hooks/use-nav-badge.d.ts +13 -0
  12. package/_internal/app/types/index.d.ts +0 -42
  13. package/_internal/core/adapters/runtime/concepts.d.ts +119 -2
  14. package/_internal/core/adapters/runtime/index.d.ts +1 -1
  15. package/_internal/core/constants.d.ts +15 -0
  16. package/_internal/core/content-dir.d.ts +42 -0
  17. package/_internal/core/generated-version.d.ts +1 -0
  18. package/_internal/core/logger.d.ts +8 -0
  19. package/_internal/core/plugin-types.d.ts +168 -37
  20. package/_internal/core/routing/index.d.ts +1 -1
  21. package/_internal/plugins/team/types.d.ts +12 -2
  22. package/components/index.d.ts +39 -3
  23. package/components/index.js +16257 -1550
  24. package/hooks/index.d.ts +58 -9
  25. package/hooks/index.js +14414 -413
  26. package/index.d.ts +43 -10
  27. package/index.js +400 -1
  28. package/metadata/index.d.ts +16 -3
  29. package/package.json +2 -2
  30. package/register.d.ts +20 -9
  31. package/routing/index.d.ts +8 -3
  32. package/routing/index.js +327 -0
  33. package/slots/index.d.ts +1 -1
  34. package/slots/index.js +20 -1
  35. package/types/index.d.ts +431 -50
  36. package/ui/index.d.ts +2 -2
  37. package/ui/index.js +2 -1
  38. package/utils/index.d.ts +24 -2
  39. package/utils/index.js +269 -1
  40. package/_internal/app/hooks/use-assets.d.ts +0 -25
@@ -109,6 +109,16 @@ export interface SkillDefinition {
109
109
  instructions: string;
110
110
  output_schema?: Record<string, unknown>;
111
111
  source?: string;
112
+ /** Absolute source markdown file path when the skill was loaded from a managed package/plugin file. */
113
+ sourcePath?: string;
114
+ }
115
+ export interface WorkflowLayoutInput {
116
+ positions?: Record<string, {
117
+ x: number;
118
+ y: number;
119
+ [key: string]: unknown;
120
+ }>;
121
+ [key: string]: unknown;
112
122
  }
113
123
  export interface WorkflowDefinitionInput {
114
124
  /** Stable workflow id. Falls back to slug(name) when omitted. */
@@ -117,7 +127,9 @@ export interface WorkflowDefinitionInput {
117
127
  description: string;
118
128
  version: number;
119
129
  inputs?: Record<string, unknown>;
130
+ layout?: WorkflowLayoutInput;
120
131
  steps: unknown[];
132
+ [key: string]: unknown;
121
133
  }
122
134
  export interface ActivityAPI {
123
135
  /** Log a human-readable message to the live activity feed */
@@ -128,6 +140,12 @@ export interface ActivityAPI {
128
140
  /** Log a structured audit event */
129
141
  audit(event: string, agent: string, data?: Record<string, unknown>): void;
130
142
  }
143
+ export interface PluginLogger {
144
+ debug(message: string, data?: Record<string, unknown>): void;
145
+ info(message: string, data?: Record<string, unknown>): void;
146
+ warn(message: string, errorOrData?: unknown, data?: Record<string, unknown>): void;
147
+ error(message: string, errorOrData?: unknown, data?: Record<string, unknown>): void;
148
+ }
131
149
  export interface HookAPI {
132
150
  /** Register a handler for a named hook. Returns unsubscribe function. */
133
151
  register(name: string, handler: (data: any) => any, metadata?: HookRegistrationMetadata): () => void;
@@ -218,6 +236,33 @@ export interface HealthCheckResult {
218
236
  message: string;
219
237
  autoFixable: boolean;
220
238
  }
239
+ export type HealthRepairSafety = 'safe' | 'manual' | 'destructive';
240
+ export interface HealthRepairChange {
241
+ kind: 'file' | 'setting' | 'service' | 'runtime' | 'task' | 'other';
242
+ target: string;
243
+ action: 'create' | 'update' | 'delete' | 'install' | 'invoke';
244
+ description: string;
245
+ }
246
+ export interface HealthRepairPlanItem {
247
+ id: string;
248
+ checkId: string;
249
+ title: string;
250
+ reason: string;
251
+ safety: HealthRepairSafety;
252
+ requiresConfirmation: boolean;
253
+ changes: HealthRepairChange[];
254
+ }
255
+ export interface HealthRepairApplyResult {
256
+ id: string;
257
+ checkId: string;
258
+ status: 'applied' | 'skipped' | 'failed';
259
+ message: string;
260
+ changes: HealthRepairChange[];
261
+ }
262
+ export interface HealthRepairHandler {
263
+ plan(rows: HealthCheckResult[]): Promise<HealthRepairPlanItem[]>;
264
+ apply(items: HealthRepairPlanItem[]): Promise<HealthRepairApplyResult[]>;
265
+ }
221
266
  /**
222
267
  * Input shape plugins pass to `ctx.registerHealthCheck`. The plugin id is
223
268
  * auto-namespaced as `{pluginId}.{id}`. `run()` returns an array so one
@@ -234,12 +279,15 @@ export interface PluginHealthCheckInput {
234
279
  */
235
280
  run: () => Promise<HealthCheckResult[]>;
236
281
  /**
237
- * Advisory flag for admin UIs: `true` if `run()` may perform safe
238
- * auto-fixes internally. Pure metadata in v1 — the orchestrator always
239
- * invokes every registered check regardless of this value. Plugins that
240
- * do internal auto-fixes gate on `getSettings().doctor.*` themselves.
282
+ * Legacy advisory flag for older admin surfaces. New code should derive
283
+ * repairability from `repair`.
241
284
  */
242
285
  autoFix?: boolean;
286
+ /**
287
+ * Optional explicit repair contract. Diagnostics call only `run()`; repair
288
+ * flows call `plan()` first, then `apply()` after explicit confirmation.
289
+ */
290
+ repair?: HealthRepairHandler;
243
291
  }
244
292
  export interface HealthCheckDef extends PluginHealthCheckInput {
245
293
  runtime: 'plugin';
@@ -306,6 +354,8 @@ export interface PluginContext {
306
354
  updateSettings(patch: Record<string, unknown>): void;
307
355
  /** Structured activity logging */
308
356
  activity: ActivityAPI;
357
+ /** Plugin-scoped server log. Prefer this over console.* for lifecycle logs. */
358
+ log?: PluginLogger;
309
359
  /** Cross-plugin hook registration */
310
360
  hooks: HookAPI;
311
361
  /** Adapter-backed search — register content types, index, query */
@@ -328,10 +378,19 @@ export interface PluginTask {
328
378
  workflowId?: string;
329
379
  scheduleJobId?: string;
330
380
  projectId?: string;
381
+ availableAt?: string;
382
+ dueAt?: string;
383
+ source?: PluginTaskSource;
331
384
  order?: number;
332
385
  createdAt?: string;
333
386
  updatedAt?: string;
334
387
  }
388
+ export interface PluginTaskSource {
389
+ pluginId?: string;
390
+ entityType?: string;
391
+ entityId?: string;
392
+ purpose?: string;
393
+ }
335
394
  export interface TaskLogEntry {
336
395
  timestamp: string;
337
396
  author: string;
@@ -349,6 +408,9 @@ export interface PluginTaskCreateInput {
349
408
  workflowId?: string;
350
409
  projectId?: string;
351
410
  parentId?: string | null;
411
+ availableAt?: string;
412
+ dueAt?: string;
413
+ source?: PluginTaskSource;
352
414
  skipWorkflowReason?: string;
353
415
  }
354
416
  export interface PluginTaskUpdateInput {
@@ -364,6 +426,9 @@ export interface PluginTaskUpdateInput {
364
426
  scheduleJobId?: string;
365
427
  projectId?: string;
366
428
  parentId?: string | null;
429
+ availableAt?: string | null;
430
+ dueAt?: string | null;
431
+ source?: PluginTaskSource | null;
367
432
  }
368
433
  export interface PluginTaskService {
369
434
  create(input: PluginTaskCreateInput): Promise<PluginTask>;
@@ -378,44 +443,93 @@ export interface PluginTaskService {
378
443
  }): Promise<PluginTask[]>;
379
444
  appendLog(id: string, entry: TaskLogEntry): Promise<void>;
380
445
  }
381
- export interface AssetVariantMeta {
382
- role: 'thumbnail' | 'optimized' | 'webp';
383
- path: string;
384
- filename: string;
385
- size: number;
446
+ /** The asset type taxonomy (mirrors ASSET_TYPES in the assets plugin). */
447
+ export type AssetTypeName = 'text' | 'images' | 'video' | 'audio' | 'plans' | 'research' | 'pdf' | 'data' | 'other';
448
+ /** Per-version generation provenance (matches the manifest's `generation` block). */
449
+ export interface AssetGenerationInfo {
450
+ provider: string;
451
+ model: string;
452
+ surface: string;
453
+ quality: string;
454
+ routeSource: string;
455
+ routeReason?: string;
456
+ }
457
+ /** Create a new versioned asset (v1) from a source file. */
458
+ export interface AssetCreateInput {
459
+ sourceFilePath: string;
460
+ type: AssetTypeName;
461
+ agent: string;
462
+ taskId: string | null;
463
+ slug?: string;
464
+ op?: 'generate' | 'upload' | 'import';
465
+ tool?: string | null;
466
+ prompt?: string | null;
467
+ promptHash?: string | null;
468
+ description?: string;
469
+ tags?: string[];
470
+ source?: {
471
+ kind: 'generated' | 'upload' | 'import' | 'clipboard' | 'workspace-file';
472
+ path: string | null;
473
+ };
474
+ generation?: AssetGenerationInfo | null;
475
+ }
476
+ /** Append a new version to an existing asset. */
477
+ export interface AssetVersionCreateInput {
478
+ sourceFilePath: string;
479
+ op?: 'edit' | 'generate' | 'upload' | 'import';
480
+ tool?: string | null;
481
+ prompt?: string | null;
482
+ promptHash?: string | null;
483
+ description?: string;
484
+ tags?: string[];
485
+ generation?: AssetGenerationInfo | null;
486
+ }
487
+ /** Render a derived export of a version (keyed/idempotent by surface). */
488
+ export interface AssetExportRequest {
489
+ fromVersion?: number;
490
+ surface: string;
491
+ format: 'jpg' | 'png' | 'webp';
492
+ width: number;
493
+ height: number;
494
+ quality?: number;
495
+ }
496
+ export interface VersionedAssetRef {
497
+ assetId: string;
498
+ version: number;
499
+ }
500
+ export interface AssetVersionFileRef {
501
+ absPath: string;
386
502
  mimeType: string;
503
+ version: number;
387
504
  }
388
- export interface AssetMeta {
389
- path: string;
390
- filename: string;
391
- type: 'text' | 'images' | 'video' | 'audio' | 'plans' | 'research' | 'pdf' | 'data' | 'other';
505
+ /** Current-version summary of an asset, addressed by id. */
506
+ export interface AssetSummary {
507
+ assetId: string;
508
+ type: AssetTypeName;
509
+ agent: string;
510
+ taskId: string | null;
511
+ created: string;
512
+ updated: string;
513
+ currentVersion: number;
514
+ versionCount: number;
515
+ description: string;
516
+ tags: string[];
392
517
  mimeType: string;
518
+ width: number | null;
519
+ height: number | null;
393
520
  size: number;
394
- mtimeMs?: number;
395
- metadata: {
396
- agent: string;
397
- taskId: string | null;
398
- created: string;
399
- tool?: string;
400
- description?: string;
401
- tags?: string[];
402
- originalFilename?: string;
403
- };
404
- variants?: AssetVariantMeta[];
405
- }
406
- export interface AssetFileRef {
407
- kind: 'asset';
408
- filename: string;
409
- mimeType?: string;
521
+ hasThumb: boolean;
410
522
  }
411
523
  export interface AssetsAPI {
412
- getByFilename(filename: string): Promise<AssetMeta | null>;
413
- list(filter?: {
414
- type?: AssetMeta['type'];
415
- taskId?: string | null;
416
- }): Promise<AssetMeta[]>;
417
- exists(filename: string): Promise<boolean>;
418
- fileRef(filename: string): Promise<AssetFileRef>;
524
+ createAsset(input: AssetCreateInput): Promise<VersionedAssetRef>;
525
+ /** Read an asset's current-version summary by id (metadata: type/description/tags/etc.), or null. */
526
+ getAsset(assetId: string): Promise<AssetSummary | null>;
527
+ addVersion(assetId: string, input: AssetVersionCreateInput): Promise<VersionedAssetRef>;
528
+ addExport(assetId: string, input: AssetExportRequest): Promise<{
529
+ name: string;
530
+ file: string;
531
+ }>;
532
+ resolveVersionFile(assetId: string, version?: number): Promise<AssetVersionFileRef | null>;
419
533
  }
420
534
  /** Field type for search content type schemas */
421
535
  export interface SearchSchemaField {
@@ -544,6 +658,8 @@ export interface SearchResult {
544
658
  fields: Record<string, unknown>;
545
659
  /** Cross-encoder reranker score (present when a reranker was used). */
546
660
  rerankScore?: number;
661
+ /** Per-index score breakdown (e.g. { full_text_index_v0, assets_text, assets_visual }). */
662
+ indexScores?: Record<string, number>;
547
663
  }
548
664
  /** Search response from a query */
549
665
  export interface SearchResponse {
@@ -667,6 +783,13 @@ export interface FileBackedContentTypeDefinition extends SearchContentTypeDefini
667
783
  * own initial population (rare).
668
784
  */
669
785
  buildOnStartup?: boolean;
786
+ /**
787
+ * Keep indexed documents that are not represented by a matched file when
788
+ * verifyExists(key) still returns true. Use this only for hybrid content
789
+ * types that combine file-backed rows with registry/runtime rows in the
790
+ * same table.
791
+ */
792
+ preserveVirtualDocuments?: boolean;
670
793
  }
671
794
  /** Search API provided to plugins via ctx.search */
672
795
  export interface SearchAPI {
@@ -818,6 +941,14 @@ export interface PluginManifestSignature {
818
941
  publicKey: string;
819
942
  signature: string;
820
943
  }
944
+ export interface SecretDeclaration {
945
+ /** Canonical environment variable name, for example `ANTHROPIC_API_KEY`. */
946
+ name: string;
947
+ /** Human-readable setup note. Never include a secret value here. */
948
+ description: string;
949
+ /** Missing required secrets should be reported by setup/health checks. Defaults to true. */
950
+ required: boolean;
951
+ }
821
952
  export interface PluginManifest {
822
953
  id: string;
823
954
  name: string;
@@ -829,7 +960,7 @@ export interface PluginManifest {
829
960
  client?: string;
830
961
  };
831
962
  contentFiles?: string[];
832
- secrets?: string[];
963
+ secrets?: SecretDeclaration[];
833
964
  tests?: string;
834
965
  dependencies?: string[];
835
966
  permissions?: string[];
@@ -2,7 +2,7 @@
2
2
  * `@bakin/core/routing` — typed route contracts.
3
3
  *
4
4
  * Re-exports the route types and authoring helpers used by both the host and
5
- * plugin authors (via `@bakin/sdk/routing`).
5
+ * plugin authors (via `@makinbakin/sdk/routing`).
6
6
  */
7
7
  export type { HttpMethod, HttpStatus, RouteContext, PluginContextLite, CoreContext, JsonBodySpec, MultipartBodySpec, RawBodySpec, NoBodySpec, BodySpec, JsonResponseSpec, NoContentResponseSpec, NonJsonResponseSpec, ResponseSpec, ParsedInput, APIRoute, PluginWithRoutes, } from './types';
8
8
  export { defineRoute, defineCoreRoute, definePlugin } from './define';
@@ -67,12 +67,13 @@ export interface SkillSummary {
67
67
  * client doesn't reach across the package boundary for types.
68
68
  *
69
69
  * The server today returns 4 states (`absent | unmanaged | adopted | managed`).
70
- * `drifted` and `update-available` are declared on the badge component for
71
- * forward-compat wiring handles them but the API doesn't yet emit them.
70
+ * `drifted` and `update-available` are display states layered on top of the
71
+ * server row when diagnostics or update checks report additional status.
72
72
  */
73
73
  export interface PackageStateRow {
74
74
  agentId: string;
75
75
  state: 'absent' | 'unmanaged' | 'adopted' | 'managed' | 'drifted' | 'update-available';
76
+ version?: string;
76
77
  packageId?: string;
77
78
  entry?: {
78
79
  source: string;
@@ -82,6 +83,15 @@ export interface PackageStateRow {
82
83
  version?: string;
83
84
  dependencies?: string[];
84
85
  };
86
+ updateStatus?: {
87
+ currentVersion: string;
88
+ latestVersion: string | null;
89
+ currentCommitSha: string;
90
+ latestCommitSha: string | null;
91
+ upgradeAvailable: boolean;
92
+ checkedAt: string;
93
+ error?: string;
94
+ };
85
95
  }
86
96
  /**
87
97
  * Single message from a runtime session JSONL. Used by the Active Context
@@ -1,33 +1,69 @@
1
1
  /**
2
- * `@bakin/sdk/components` — shared layout + compound components.
2
+ * `@makinbakin/sdk/components` — shared layout + compound components.
3
3
  *
4
4
  * Plugin-author-visible components that wrap shadcn primitives with Bakin-
5
5
  * specific behavior (headers, filters, markdown, agent displays, etc.). Does
6
6
  * not include layout chrome (sidebar, header, toaster) — those are Bakin's
7
7
  * shell, not plugin-author territory.
8
8
  */
9
+ /** Round avatar image for an agent, falls back to initials. */
9
10
  export { AgentAvatar } from '../_internal/app/components/agent-avatar';
11
+ /** Multi-select facet filter scoped to agents. */
10
12
  export { AgentFilter } from '../_internal/app/components/agent-filter';
13
+ /** Single-agent picker dropdown for form fields. */
11
14
  export { AgentSelect } from '../_internal/app/components/agent-select';
12
- export { AgentDot, AgentStatus } from '../_internal/app/components/agent-status';
15
+ /** Small status dot showing an agent's online/offline state. */
16
+ export { AgentDot } from '../_internal/app/components/agent-status';
17
+ /** Compound agent status (dot + label + last-seen timestamp). */
18
+ export { AgentStatus } from '../_internal/app/components/agent-status';
19
+ /** Right-side slide-out drawer with backdrop and focus trap. */
13
20
  export { BakinDrawer } from '../_internal/app/components/bakin-drawer';
21
+ /** Color picker swatch grid for tag/agent color assignment. */
14
22
  export { ColorPicker } from '../_internal/app/components/color-picker';
23
+ /** Centered empty-state component with icon, title, and CTA. */
15
24
  export { EmptyState } from '../_internal/app/components/empty-state';
25
+ /** Inline error banner with dismiss + retry actions. */
16
26
  export { ErrorBanner } from '../_internal/app/components/error-banner';
27
+ /** Full-page error state with title, description, and retry button. */
17
28
  export { ErrorState } from '../_internal/app/components/error-state';
29
+ /** Popover multi-select facet filter (column, owner, tag, etc.). */
18
30
  export { FacetFilter } from '../_internal/app/components/facet-filter';
19
31
  export type { FacetOption } from '../_internal/app/components/facet-filter';
32
+ /** Chat + plan-proposal review panel for brainstorm sessions. */
20
33
  export { IntegratedBrainstorm } from '../_internal/app/components/integrated-brainstorm';
21
- export type { BrainstormMessage, IntegratedBrainstormProps, BrainstormOnSend, SendContext, AssistantTransformed, } from '../_internal/app/components/integrated-brainstorm';
34
+ export type { BrainstormMessage, IntegratedBrainstormProps, BrainstormOnSend, SendContext, AssistantTransformed, BrainstormActivityInput, BrainstormActivityStorageInput, BrainstormActivityStorageRecord, BrainstormTimelineActivityInput, BrainstormTimelineMessageInput, } from '../_internal/app/components/integrated-brainstorm';
35
+ /** Convert a custom activity message back into a brainstorm activity. */
36
+ export { brainstormActivityMessageFromCustom } from '../_internal/app/components/integrated-brainstorm';
37
+ /** Compute the canonical thread ID for a brainstorm session. */
38
+ export { brainstormThreadId } from '../_internal/app/components/integrated-brainstorm';
39
+ /** Normalize a brainstorm activity payload for persistence. */
40
+ export { normalizeBrainstormActivityForStorage } from '../_internal/app/components/integrated-brainstorm';
41
+ /** Normalize a single brainstorm message for persistence. */
42
+ export { normalizeBrainstormActivityMessageForStorage } from '../_internal/app/components/integrated-brainstorm';
43
+ /** Read an SSE response stream into brainstorm activity events. */
44
+ export { readBrainstormSseResponse } from '../_internal/app/components/integrated-brainstorm';
45
+ /** Convert a runtime chat chunk to a brainstorm activity event. */
46
+ export { runtimeChunkToBrainstormActivity } from '../_internal/app/components/integrated-brainstorm';
47
+ /** Fold a brainstorm session's events into a renderable timeline. */
48
+ export { toBrainstormTimeline } from '../_internal/app/components/integrated-brainstorm';
49
+ /** Render markdown content with syntax highlighting and link handling. */
22
50
  export { MarkdownContent } from '../_internal/app/components/markdown-content';
51
+ /** Editable markdown text area with preview toggle. */
23
52
  export { MarkdownEditor } from '../_internal/app/components/markdown-editor';
53
+ /** Model picker dropdown listing available models from the catalog. */
24
54
  export { ModelSelect } from '../_internal/app/components/model-select';
55
+ /** Standard plugin page wrapper with header, content area, and toaster. */
25
56
  export { PageLayout } from '../_internal/app/components/page-layout';
57
+ /** Plugin page header with title, count badge, search, and action buttons. */
26
58
  export { PluginHeader } from '../_internal/app/components/plugin-header';
59
+ /** Render a settings form from a PluginSettingsSchema definition. */
27
60
  export { PluginSettingsRenderer } from '../_internal/app/components/plugin-settings-renderer';
28
61
  export type { PluginSettingsSchema } from '../_internal/app/components/plugin-settings-renderer';
62
+ /** Sortable table column header with ascending/descending indicator. */
29
63
  export { SortableHead } from '../_internal/app/components/sortable-head';
30
64
  export type { SortDir } from '../_internal/app/components/sortable-head';
65
+ /** Tab list with animated underline indicator. */
31
66
  export { UnderlineTabs } from '../_internal/app/components/underline-tabs';
32
67
  export type { UnderlineTab } from '../_internal/app/components/underline-tabs';
68
+ /** Icon component for a notification channel (Discord, Slack, email, etc.). */
33
69
  export { ChannelIcon } from '../_internal/plugins/workflows/hooks/channel-icon';