@makinbakin/sdk 0.0.1-rc.15 → 0.0.1-rc.17

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.
@@ -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?: "info" | "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;
@@ -82,11 +82,6 @@ export interface ChatChunk {
82
82
  content?: string;
83
83
  data?: RuntimeMetadata | RuntimeToolActivity;
84
84
  }
85
- export interface ToolDefinition {
86
- name: string;
87
- description?: string;
88
- inputSchema?: unknown;
89
- }
90
85
  export interface ToolResult {
91
86
  ok: boolean;
92
87
  output?: unknown;
@@ -203,31 +198,6 @@ export interface ApprovalResolveEvent {
203
198
  response: ApprovalResponse;
204
199
  channelId: string;
205
200
  }
206
- export interface ChannelMessageEvent {
207
- channelId: string;
208
- messageId: string;
209
- actor: {
210
- type: 'agent' | 'human';
211
- id: string;
212
- displayName?: string;
213
- };
214
- body: string;
215
- threadId?: string;
216
- receivedAt: string;
217
- metadata?: RuntimeMetadata;
218
- }
219
- export interface ChannelInteractionEvent {
220
- channelId: string;
221
- interactionId: string;
222
- actor: {
223
- type: 'agent' | 'human';
224
- id: string;
225
- displayName?: string;
226
- };
227
- kind: string;
228
- payload: RuntimeMetadata;
229
- receivedAt: string;
230
- }
231
201
  export interface DurableApprovalRecord {
232
202
  approvalId: string;
233
203
  owner: {
@@ -316,7 +286,7 @@ export type RuntimeImageBackground = 'transparent' | 'opaque' | 'auto';
316
286
  * provider with a defaultModel); a rich runtime fills more. Consumers MUST
317
287
  * treat a sparse capability as normal and never require a field a thin runtime
318
288
  * cannot provide — gaps are filled below, in the adapter/shim, not pushed up
319
- * into plugins. See .claude/specs/media-generation-adapter-architecture.md.
289
+ * into plugins. See .claude/knowledge/media-generation-adapter-architecture.md.
320
290
  */
321
291
  export interface RuntimeImageProviderCapabilities {
322
292
  generate?: {
@@ -396,39 +366,6 @@ export interface RuntimeImagesAccess {
396
366
  generate(input: RuntimeImageGenerateInput): Promise<RuntimeImageGenerationResult>;
397
367
  edit(input: RuntimeImageEditInput): Promise<RuntimeImageGenerationResult>;
398
368
  }
399
- export interface TaskDispatchArgs {
400
- bakinTaskId: string;
401
- agentId?: string;
402
- title: string;
403
- description?: string;
404
- metadata?: RuntimeMetadata;
405
- }
406
- export interface TaskDispatchResult {
407
- flowId: string;
408
- }
409
- export interface TaskExecutionStatus {
410
- flowId: string;
411
- bakinTaskId?: string;
412
- state: 'queued' | 'running' | 'blocked' | 'succeeded' | 'failed' | 'cancelled' | 'unknown';
413
- currentStep?: string | null;
414
- blockingReason?: string | null;
415
- retryCount?: number;
416
- startedAt?: string | null;
417
- endedAt?: string | null;
418
- updatedAt?: string | null;
419
- metadata?: RuntimeMetadata;
420
- }
421
- export interface ListExecutionsOpts {
422
- bakinTaskId?: string;
423
- agentId?: string;
424
- state?: TaskExecutionStatus['state'];
425
- limit?: number;
426
- }
427
- export interface TaskExecutionEvent {
428
- flowId: string;
429
- bakinTaskId?: string;
430
- status: TaskExecutionStatus;
431
- }
432
369
  export interface CronJob {
433
370
  id: string;
434
371
  name: string;
@@ -491,7 +428,6 @@ export interface AgentRuntimeAdapter {
491
428
  removeWorkspaceFile(agentId: string, path: string): Promise<void>;
492
429
  updatePermissions(agentId: string, patch: RuntimePermissionPatch): Promise<void>;
493
430
  updateAllowlist(agentId: string, patch: RuntimeAllowlistPatch): Promise<void>;
494
- heartbeat(agentId: string): Promise<boolean>;
495
431
  };
496
432
  messaging: {
497
433
  send(args: MessageArgs): Promise<MessageResult>;
@@ -499,7 +435,6 @@ export interface AgentRuntimeAdapter {
499
435
  };
500
436
  tools: {
501
437
  invoke(agentId: string, name: string, args: unknown): Promise<ToolResult>;
502
- list(agentId: string): Promise<ToolDefinition[]>;
503
438
  };
504
439
  channels: {
505
440
  list(): Promise<ChannelInfo[]>;
@@ -511,8 +446,6 @@ export interface AgentRuntimeAdapter {
511
446
  cancelApproval(args: CancelApprovalArgs): Promise<void>;
512
447
  resolveApproval(args: ResolveApprovalArgs): Promise<void>;
513
448
  subscribeApprovalResponses(handler: (event: ApprovalResolveEvent) => void): Unsubscribe;
514
- onMessage(handler: (event: ChannelMessageEvent) => void): Unsubscribe;
515
- onInteraction(handler: (event: ChannelInteractionEvent) => void): Unsubscribe;
516
449
  };
517
450
  skills: {
518
451
  list(agentId?: string): Promise<RuntimeSkill[]>;
@@ -553,13 +486,6 @@ export interface AgentRuntimeAdapter {
553
486
  }): Promise<RuntimeAvailableModel[]>;
554
487
  };
555
488
  images?: RuntimeImagesAccess;
556
- tasks: {
557
- dispatch(args: TaskDispatchArgs): Promise<TaskDispatchResult>;
558
- getExecutionStatus(flowId: string): Promise<TaskExecutionStatus>;
559
- listExecutions(opts?: ListExecutionsOpts): Promise<TaskExecutionStatus[]>;
560
- cancelExecution(flowId: string): Promise<void>;
561
- subscribeExecutionUpdates(handler: (event: TaskExecutionEvent) => void): Unsubscribe;
562
- };
563
489
  cron: {
564
490
  list(): Promise<CronJob[]>;
565
491
  get(id: string): Promise<CronJob | null>;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Typed runtime-failure contracts crossing the adapter boundary.
3
+ *
4
+ * Adapters map every provider failure to a `RuntimeError` with a structural
5
+ * `kind` before it leaves the adapter package. Core (dispatch) classifies on
6
+ * `kind` exclusively — never on error-message text. The original provider
7
+ * error is always preserved on `cause` so transport-level codes
8
+ * (ECONNRESET, AbortError, …) survive the boundary for logging/diagnostics.
9
+ */
10
+ export type RuntimeErrorKind =
11
+ /** Socket drop, disconnect, not-connected, fetch failure — transient. */
12
+ 'transport'
13
+ /** An RPC/transport timer fired without a final response. */
14
+ | 'timeout'
15
+ /** The provider session died mid-turn; carries a RuntimeTurnDiagnosis. */
16
+ | 'session_death'
17
+ /** Provider/auth cooldown — model provider unavailable, retry later. */
18
+ | 'provider_cooldown'
19
+ /** Structured runtime failure (HTTP-status class, CLI exit, protocol). */
20
+ | 'runtime_failed';
21
+ /**
22
+ * Structured provider metadata for `provider_cooldown` failures, extracted by
23
+ * the adapter from provider-specific error payloads so core never parses
24
+ * provider strings.
25
+ */
26
+ export interface RuntimeProviderInfo {
27
+ provider?: string;
28
+ model?: string;
29
+ /** e.g. 'timeout' when the provider entered cooldown after a timeout. */
30
+ cooldownReason?: string;
31
+ /** No auth profile was available (vs. an active profile in cooldown). */
32
+ authProfileUnavailable?: boolean;
33
+ }
34
+ export interface RuntimeErrorOptions {
35
+ kind: RuntimeErrorKind;
36
+ cause?: unknown;
37
+ providerInfo?: RuntimeProviderInfo;
38
+ }
39
+ export declare class RuntimeError extends Error {
40
+ readonly kind: RuntimeErrorKind;
41
+ readonly providerInfo?: RuntimeProviderInfo;
42
+ constructor(message: string, options: RuntimeErrorOptions);
43
+ }
44
+ export type RuntimeTurnFailureReason =
45
+ /** session.ended with a non-success status that was not a runtime timeout. */
46
+ 'session_interrupted'
47
+ /** The session/turn genuinely timed out server-side. */
48
+ | 'runtime_timeout';
49
+ /**
50
+ * Post-mortem of a dead provider turn, assembled entirely inside the runtime
51
+ * adapter (Bakin core never reads provider files). Every field is optional
52
+ * evidence — a partial diagnosis is still more useful than a generic timeout.
53
+ */
54
+ export interface RuntimeTurnDiagnosis {
55
+ reason: RuntimeTurnFailureReason;
56
+ /** Provider session id the turn ran in. */
57
+ sessionId?: string;
58
+ /** Raw provider session end status, e.g. 'interrupted'. */
59
+ sessionStatus?: string;
60
+ /** Provider-reported timeout flag from the session end event. */
61
+ timedOut?: boolean;
62
+ /** Total bytes of the final assistant output that killed the turn. */
63
+ completionBytes?: number;
64
+ /** Provider truncated the recorded completion (trajectory size limit). */
65
+ outputTruncated?: boolean;
66
+ /** completionBytes exceeded the configured oversized-output threshold. */
67
+ oversizedOutput?: boolean;
68
+ /** Last tool the agent invoked before the turn died. */
69
+ lastToolCall?: string;
70
+ /** Truncated completion text preserved for salvage (capped by the adapter). */
71
+ salvagedText?: string;
72
+ /** Token usage recorded for the fatal completion, when available. */
73
+ usage?: {
74
+ input?: number;
75
+ output?: number;
76
+ total?: number;
77
+ };
78
+ /** One-line human-readable diagnosis. */
79
+ detail?: string;
80
+ }
81
+ export declare class RuntimeTurnError extends RuntimeError {
82
+ readonly diagnosis: RuntimeTurnDiagnosis;
83
+ constructor(diagnosis: RuntimeTurnDiagnosis, options?: {
84
+ cause?: unknown;
85
+ });
86
+ }
@@ -1,5 +1,7 @@
1
1
  export type { AdapterAuditEvent, AdapterHealthCheckDefinition, AdapterHealthCheckResult, AdapterInitOpts, AdapterLogger, Unsubscribe, } from '../shared';
2
2
  export type { ChannelCapability } from './capabilities';
3
3
  export { hasChannelCapability } from './capabilities';
4
+ export { RuntimeError, RuntimeTurnError } from './errors';
5
+ export type { RuntimeErrorKind, RuntimeErrorOptions, RuntimeProviderInfo, RuntimeTurnDiagnosis, RuntimeTurnFailureReason, } from './errors';
4
6
  export { getRuntimeMainAgent, getRuntimeMainAgentId, getRuntimeMainAgentName, selectRuntimeMainAgent, } from './helpers';
5
- export type { AgentRuntimeAdapter, ApprovalDelivery, ApprovalOption, ApprovalPatch, ApprovalRenderRef, ApprovalRenderResult, ApprovalResolveEvent, ApprovalResponse, CancelApprovalArgs, ChannelInfo, ChannelInteractionEvent, ChannelMessageArgs, ChannelMessageEvent, ChatChunk, ContentDeliveryArgs, CreateApprovalArgs, CreateCronJobInput, CreateRuntimeAgentInput, CronJob, CronRun, DeliveryResult, DurableApprovalRecord, EditApprovalArgs, ListExecutionsOpts, MessageArgs, MessageResult, NotificationArgs, ResolveApprovalArgs, RuntimeAgent, RuntimeAllowlistPatch, RuntimeToolActivity, RuntimeAvailableModel, RuntimeConfigAccess, RuntimeImageBackground, RuntimeImageEditInput, RuntimeImageFile, RuntimeImageGenerateInput, RuntimeImageGenerationResult, RuntimeImageOutputFormat, RuntimeImageProvider, RuntimeImageProviderCapabilities, RuntimeImagesAccess, RuntimeMemoryEntry, RuntimeMemoryEntryStat, RuntimeMemoryPathMatch, RuntimeMemoryReadRange, RuntimeMemorySearchResult, RuntimeMemoryTier, RuntimeMessageToolPolicy, RuntimeMessageToolsMode, RuntimeMetadata, RuntimePermissionPatch, RawCronSnapshot, RuntimeSession, RuntimeSkill, TaskDispatchArgs, TaskDispatchResult, TaskExecutionEvent, TaskExecutionStatus, ToolDefinition, ToolResult, UpdateCronJobInput, UpdateRuntimeAgentInput, WorkspaceFile, } from './concepts';
7
+ export type { AgentRuntimeAdapter, ApprovalDelivery, ApprovalOption, ApprovalPatch, ApprovalRenderRef, ApprovalRenderResult, ApprovalResolveEvent, ApprovalResponse, CancelApprovalArgs, ChannelInfo, ChannelMessageArgs, ChatChunk, ContentDeliveryArgs, CreateApprovalArgs, CreateCronJobInput, CreateRuntimeAgentInput, CronJob, CronRun, DeliveryResult, DurableApprovalRecord, EditApprovalArgs, MessageArgs, MessageResult, NotificationArgs, ResolveApprovalArgs, RuntimeAgent, RuntimeAllowlistPatch, RuntimeToolActivity, RuntimeAvailableModel, RuntimeConfigAccess, RuntimeImageBackground, RuntimeImageEditInput, RuntimeImageFile, RuntimeImageGenerateInput, RuntimeImageGenerationResult, RuntimeImageOutputFormat, RuntimeImageProvider, RuntimeImageProviderCapabilities, RuntimeImagesAccess, RuntimeMemoryEntry, RuntimeMemoryEntryStat, RuntimeMemoryPathMatch, RuntimeMemoryReadRange, RuntimeMemorySearchResult, RuntimeMemoryTier, RuntimeMessageToolPolicy, RuntimeMessageToolsMode, RuntimeMetadata, RuntimePermissionPatch, RawCronSnapshot, RuntimeSession, RuntimeSkill, ToolResult, UpdateCronJobInput, UpdateRuntimeAgentInput, WorkspaceFile, } from './concepts';
@@ -30,6 +30,7 @@ export interface BakinPaths {
30
30
  workflows: string;
31
31
  settings: string;
32
32
  logs: string;
33
+ db: string;
33
34
  }
34
35
  export declare function getBakinPaths(): BakinPaths;
35
36
  /**
@@ -473,7 +473,10 @@ export interface AssetCreateInput {
473
473
  };
474
474
  generation?: AssetGenerationInfo | null;
475
475
  }
476
- /** Append a new version to an existing asset. */
476
+ /**
477
+ * Append a new version to an existing asset. Note: no `tags` — tags are an
478
+ * asset-level organizational namespace that versioning never touches.
479
+ */
477
480
  export interface AssetVersionCreateInput {
478
481
  sourceFilePath: string;
479
482
  op?: 'edit' | 'generate' | 'upload' | 'import';
@@ -481,7 +484,6 @@ export interface AssetVersionCreateInput {
481
484
  prompt?: string | null;
482
485
  promptHash?: string | null;
483
486
  description?: string;
484
- tags?: string[];
485
487
  generation?: AssetGenerationInfo | null;
486
488
  }
487
489
  /** Render a derived export of a version (keyed/idempotent by surface). */