@yaklabs-ai/plugin-sdk 0.14.0 → 0.15.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.
@@ -128,6 +128,8 @@ export declare interface AgentToolResult<T = JsonValue_2 | undefined> {
128
128
  * error, but `details` and `structuredContent` are kept for the UI and programmatic callers.
129
129
  */
130
130
  isError?: boolean;
131
+ /** Classification for an `isError` result; the host validates it and stamps identity and attribution. */
132
+ failure?: ToolCallFailure;
131
133
  /**
132
134
  * Hint that the agent should stop after the current tool batch.
133
135
  * Early termination only happens when every finalized tool result in the batch sets this to true.
@@ -305,6 +307,12 @@ declare interface BackgroundTaskAdoptOptions {
305
307
  readonly ownerId?: string;
306
308
  readonly inspect?: BackgroundTaskInspector;
307
309
  readonly meta?: Readonly<Record<string, unknown>>;
310
+ /**
311
+ * The task's owner waits for its result: the work was meant to finish and report back (a build,
312
+ * a test run). Absent or false: nothing waits on it (a dev server, a watcher). The kernel only
313
+ * carries this fact on the task's snapshot; what waiting means is the host's to decide.
314
+ */
315
+ readonly awaitsResult?: boolean;
308
316
  /** Scoped settlement hook for the task created by this adoption only. */
309
317
  readonly onSettled?: (completion: BackgroundTaskCompletion) => void;
310
318
  }
@@ -354,6 +362,8 @@ declare interface BackgroundTaskSnapshot {
354
362
  readonly startedAtMs: number;
355
363
  readonly updatedAtMs: number;
356
364
  readonly meta?: Readonly<Record<string, unknown>>;
365
+ /** The owner waits for this task's result; see `BackgroundTaskAdoptOptions.awaitsResult`. */
366
+ readonly awaitsResult?: boolean;
357
367
  }
358
368
 
359
369
  declare type BackgroundTaskStatus = "queued" | "running" | "completed" | "failed" | "cancelled";
@@ -768,7 +778,7 @@ declare interface DecideChoiceQuestion<L extends string = string> {
768
778
  /** What a question asks: text, or a JSON object the client sends as its JSON text. */
769
779
  declare type DecideInstructions = string | object;
770
780
 
771
- declare type DecideModelId = "jev" | "clef" | "clef-flash";
781
+ declare type DecideModelId = "jev" | "clef" | "clef-flash" | "gpt-6-luna";
772
782
 
773
783
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
774
784
 
@@ -776,10 +786,10 @@ declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | Decide
776
786
  declare type DecideQuestions = Readonly<Record<string, DecideQuestion>>;
777
787
 
778
788
  declare interface DecideRequest<Q extends DecideQuestions = DecideQuestions> {
779
- /** Defaults to `jev`. */
780
- readonly model?: DecideModelId;
789
+ readonly model: DecideModelId;
781
790
  readonly state: DecideState;
782
791
  readonly questions: Q;
792
+ readonly image?: SystemOneImage;
783
793
  }
784
794
 
785
795
  declare interface DecideScoreAnswer {
@@ -1179,7 +1189,10 @@ export declare interface ExtensionAuthContext {
1179
1189
 
1180
1190
  /** Optional extension-facing APIs for background task orchestration. */
1181
1191
  declare interface ExtensionBackgroundTasksApi {
1182
- adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options?: BackgroundTaskAdoptOptions): string;
1192
+ adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options?: BackgroundTaskAdoptOptions & {
1193
+ readonly awaitsResult?: false;
1194
+ }): string;
1195
+ adopt(taskKind: BackgroundTaskKind, label: string, run: BackgroundTaskRun, options: BackgroundTaskAdoptOptions): string | Promise<string>;
1183
1196
  list(): readonly BackgroundTaskSnapshot[];
1184
1197
  get(taskId: string): BackgroundTaskSnapshot | undefined;
1185
1198
  }
@@ -2022,8 +2035,8 @@ export declare class KayAgentCapabilityError extends Error {
2022
2035
  */
2023
2036
  export declare interface KayAgentEvents {
2024
2037
  /**
2025
- * Publish one event the plugin declares in its `kay.app` `eventDefinitions`, with a payload that
2026
- * matches that definition's `payloadSchema`.
2038
+ * Publish one event the plugin declares in its `kay.app` `eventDefinitions`, with its resource URI and optional
2039
+ * payload matching that definition's `payloadSchema` when declared.
2027
2040
  *
2028
2041
  * The host stamps the publisher (this plugin) and the session this activation belongs to; the
2029
2042
  * plugin names neither. Fire-and-forget: it returns nothing and never throws. A publish the host
@@ -2031,7 +2044,7 @@ export declare interface KayAgentEvents {
2031
2044
  * is reported to the host's diagnostics and dropped, so the work that raised the event never
2032
2045
  * fails because the event did not go out.
2033
2046
  */
2034
- publish(localId: string, payload: unknown): void;
2047
+ publish(localId: string, input: PluginEventPublishInput): void;
2035
2048
  }
2036
2049
 
2037
2050
  /** This plugin's folder in the session family's shared Whiteboard. */
@@ -2856,16 +2869,16 @@ declare const KayPluginManifestV1: z.ZodObject<{
2856
2869
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>>;
2857
2870
  }, z.core.$strict>>>;
2858
2871
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2872
+ localId: z.ZodString;
2859
2873
  displayName: z.ZodOptional<z.ZodString>;
2860
2874
  schemes: z.ZodArray<z.ZodString>;
2861
- localId: z.ZodString;
2862
2875
  }, z.core.$strict>>>;
2863
2876
  dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
2864
2877
  localId: z.ZodString;
2865
2878
  scope: z.ZodEnum<{
2866
2879
  session: "session";
2867
- account: "account";
2868
2880
  runtime: "runtime";
2881
+ account: "account";
2869
2882
  }>;
2870
2883
  snapshot: z.ZodObject<{
2871
2884
  version: z.ZodNumber;
@@ -2915,7 +2928,9 @@ declare const KayPluginManifestV1: z.ZodObject<{
2915
2928
  displayName: z.ZodOptional<z.ZodString>;
2916
2929
  description: z.ZodOptional<z.ZodString>;
2917
2930
  version: z.ZodDefault<z.ZodNumber>;
2918
- payloadSchema: z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
2931
+ uriScheme: z.ZodString;
2932
+ relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
2933
+ payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>>;
2919
2934
  }, z.core.$strict>>>;
2920
2935
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2921
2936
  localId: z.ZodString;
@@ -2954,6 +2969,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
2954
2969
  url: z.ZodString;
2955
2970
  auth: z.ZodOptional<z.ZodEnum<{
2956
2971
  oauth: "oauth";
2972
+ "api-key": "api-key";
2957
2973
  none: "none";
2958
2974
  }>>;
2959
2975
  authService: z.ZodOptional<z.ZodString>;
@@ -3060,6 +3076,8 @@ declare const KayPluginManifestV1: z.ZodObject<{
3060
3076
  "skills.read": "skills.read";
3061
3077
  "automations.run": "automations.run";
3062
3078
  "navigation.open-session": "navigation.open-session";
3079
+ "artifacts.read": "artifacts.read";
3080
+ "artifacts.preview": "artifacts.preview";
3063
3081
  "cost.read": "cost.read";
3064
3082
  "billing.read": "billing.read";
3065
3083
  "context.read": "context.read";
@@ -3072,6 +3090,16 @@ declare const KayPluginManifestV1: z.ZodObject<{
3072
3090
  "workspace.arrange": "workspace.arrange";
3073
3091
  }>>>;
3074
3092
  }, z.core.$strict>>;
3093
+ activityRail: z.ZodOptional<z.ZodObject<{
3094
+ section: z.ZodOptional<z.ZodEnum<{
3095
+ primary: "primary";
3096
+ plugins: "plugins";
3097
+ }>>;
3098
+ order: z.ZodOptional<z.ZodNumber>;
3099
+ icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3100
+ svg: z.ZodString;
3101
+ }, z.core.$strict>]>>;
3102
+ }, z.core.$strict>>;
3075
3103
  }, z.core.$strict>>>;
3076
3104
  themes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3077
3105
  localId: z.ZodString;
@@ -3254,6 +3282,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
3254
3282
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3255
3283
  operations: z.ZodArray<z.ZodEnum<{
3256
3284
  status: "status";
3285
+ list: "list";
3257
3286
  connect: "connect";
3258
3287
  disconnect: "disconnect";
3259
3288
  resolve: "resolve";
@@ -3348,6 +3377,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
3348
3377
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3349
3378
  operations: z.ZodArray<z.ZodEnum<{
3350
3379
  status: "status";
3380
+ list: "list";
3351
3381
  connect: "connect";
3352
3382
  disconnect: "disconnect";
3353
3383
  resolve: "resolve";
@@ -3442,6 +3472,7 @@ declare const KayPluginManifestV1: z.ZodObject<{
3442
3472
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3443
3473
  operations: z.ZodArray<z.ZodEnum<{
3444
3474
  status: "status";
3475
+ list: "list";
3445
3476
  connect: "connect";
3446
3477
  disconnect: "disconnect";
3447
3478
  resolve: "resolve";
@@ -4277,9 +4308,10 @@ export declare interface OsascriptFailureAdvice {
4277
4308
  }
4278
4309
 
4279
4310
  /**
4280
- * The activation options every osascript plugin's agent factory accepts
4281
- * (`createAppleCalendarKayAgent(options)`), so the daemon's simulator roster sets each the same
4282
- * way. Absent `simulator`, the plugin is exactly the shipped one.
4311
+ * The activation options every osascript plugin's agent factory accepted, so the daemon's
4312
+ * simulator roster set each the same way. Absent `simulator`, the plugin is exactly the shipped one.
4313
+ *
4314
+ * @deprecated See {@link OsascriptSimulatorOptions}.
4283
4315
  */
4284
4316
  export declare interface OsascriptKayAgentOptions {
4285
4317
  readonly simulator?: OsascriptSimulatorOptions;
@@ -4316,6 +4348,10 @@ export declare interface OsascriptRunner {
4316
4348
  /**
4317
4349
  * The runners a module's verbs use: the host's exactly when `simulator` is absent, or the
4318
4350
  * simulator's in its place, per dispatch, after the host's connection gate.
4351
+ *
4352
+ * @deprecated A Bonsai daemon substitutes the runner itself, so a module uses
4353
+ * {@link requireExternalCli} and `ctx.auth?.externalCli` directly. Kept so a plugin built against
4354
+ * an earlier SDK keeps compiling.
4319
4355
  */
4320
4356
  readonly dispatch: (simulator: OsascriptSimulatedRunner | undefined) => OsascriptDispatch;
4321
4357
  /**
@@ -4361,7 +4397,11 @@ export declare interface OsascriptRunnerOptions {
4361
4397
  readonly appNotRunning?: OsascriptFailureAdvice;
4362
4398
  }
4363
4399
 
4364
- /** A plugin's simulator, as the runner sees it: the runner one dispatch uses in the host's place. */
4400
+ /**
4401
+ * A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. A
4402
+ * Bonsai daemon that simulates an osascript plugin hands `runnerFor(ctx)` to the module as
4403
+ * `ctx.auth.externalCli`; `@bonsai/uri-simulator-kit/osascript` builds one.
4404
+ */
4365
4405
  export declare interface OsascriptSimulatedRunner {
4366
4406
  readonly runnerFor: (ctx: UriResolveContext) => UriExternalCliRunner;
4367
4407
  }
@@ -4370,6 +4410,10 @@ export declare interface OsascriptSimulatedRunner {
4370
4410
  * How a plugin is told to serve its module from its simulator instead of osascript: the one
4371
4411
  * option shape every osascript plugin's agent factory accepts as `simulator`. Only the daemon's
4372
4412
  * URI simulator roster sets it, for evals and dev; an ordinary install never does.
4413
+ *
4414
+ * @deprecated A Bonsai daemon now hands the module a simulated runner as `ctx.auth.externalCli`,
4415
+ * so a plugin needs no simulator option; no Bonsai plugin sets this. Kept so a plugin built against
4416
+ * an earlier SDK keeps compiling.
4373
4417
  */
4374
4418
  export declare interface OsascriptSimulatorOptions {
4375
4419
  /** The directory holding the simulator's world; the daemon's process config names it. */
@@ -5158,6 +5202,42 @@ export declare interface PluginDelegatedServiceEntry {
5158
5202
  readonly scheme: PluginDelegatedScheme;
5159
5203
  }
5160
5204
 
5205
+ export declare const PluginEventEnvelope: z.ZodObject<{
5206
+ id: z.ZodString;
5207
+ localId: z.ZodString;
5208
+ type: z.ZodString;
5209
+ version: z.ZodNumber;
5210
+ uri: z.ZodString;
5211
+ related: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
5212
+ key: z.ZodOptional<z.ZodString>;
5213
+ occurredAt: z.ZodISODateTime;
5214
+ publishedAt: z.ZodISODateTime;
5215
+ source: z.ZodObject<{
5216
+ poller: z.ZodOptional<z.ZodString>;
5217
+ runId: z.ZodOptional<z.ZodString>;
5218
+ layer: z.ZodLiteral<"runtime">;
5219
+ pluginId: z.ZodString;
5220
+ sessionId: z.ZodOptional<z.ZodString>;
5221
+ }, z.core.$strict>;
5222
+ payload: z.ZodOptional<z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
5223
+ }, z.core.$strict>;
5224
+
5225
+ export declare type PluginEventEnvelope = z.infer<typeof PluginEventEnvelope>;
5226
+
5227
+ export declare const PluginEventPublishInput: z.ZodObject<{
5228
+ uri: z.ZodString;
5229
+ related: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
5230
+ key: z.ZodOptional<z.ZodString>;
5231
+ occurredAt: z.ZodOptional<z.ZodISODateTime>;
5232
+ source: z.ZodOptional<z.ZodObject<{
5233
+ poller: z.ZodOptional<z.ZodString>;
5234
+ runId: z.ZodOptional<z.ZodString>;
5235
+ }, z.core.$strict>>;
5236
+ payload: z.ZodOptional<z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>;
5237
+ }, z.core.$strict>;
5238
+
5239
+ export declare type PluginEventPublishInput = z.infer<typeof PluginEventPublishInput>;
5240
+
5161
5241
  /**
5162
5242
  * An external-CLI readiness scheme the plugin declares: a non-injectable marker for a
5163
5243
  * host-probed local binary (e.g. `osascript`, `gh`). Connecting runs `binary probeArgs`
@@ -6372,7 +6452,7 @@ declare interface SystemOneClient {
6372
6452
  decide<const Q extends DecideQuestions>(request: DecideRequest<Q>, options?: SystemOneCallOptions): Promise<Decision<Q>>;
6373
6453
  extract<const F extends ExtractFields>(request: ExtractRequest<F>, options?: SystemOneCallOptions): Promise<Extraction<F>>;
6374
6454
  /** Whether some provider in the current order can serve `(kind, model)`. Never rejects. */
6375
- availability(kind: SystemOneKind, model?: SystemOneModelId): Promise<Availability>;
6455
+ availability(kind: SystemOneKind, model: SystemOneModelId): Promise<Availability>;
6376
6456
  }
6377
6457
 
6378
6458
  /**
@@ -6407,6 +6487,12 @@ declare type SystemOneFailureCause = {
6407
6487
  readonly kind: "invalid-answer";
6408
6488
  };
6409
6489
 
6490
+ /** One PNG attachment. `data` is padded base64, without a data-URL prefix. */
6491
+ declare interface SystemOneImage {
6492
+ readonly mimeType: "image/png";
6493
+ readonly data: string;
6494
+ }
6495
+
6410
6496
  /**
6411
6497
  * ---
6412
6498
  * responsibility: The data shapes of the System One surface: models, the decide and extract
@@ -8598,6 +8684,14 @@ declare type TOmitDeferred<Type extends TSchema, Indexer extends TSchema> = (TDe
8598
8684
 
8599
8685
  declare type TOmitInstantiate<Context extends TProperties, State extends TState, Type extends TSchema, Indexer extends TSchema, InstantiatedType extends TSchema = TInstantiateType<Context, State, Type>, InstantiatedIndexer extends TSchema = TInstantiateType<Context, State, Indexer>> = TOmitAction<InstantiatedType, InstantiatedIndexer>;
8600
8686
 
8687
+ /**
8688
+ * The closed vocabulary of tool call failure codes. The engine and the tools
8689
+ * mint only these; a returned failure with a code outside it is not a
8690
+ * classification (the engine records the rejection on an unexplained failure),
8691
+ * and a stored record with one reads as none.
8692
+ */
8693
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
8694
+
8601
8695
  /**
8602
8696
  * ---
8603
8697
  * responsibility: The declarative permission classification a tool carries on its definition
@@ -8627,6 +8721,56 @@ export declare interface ToolAvailability {
8627
8721
  description: string;
8628
8722
  }
8629
8723
 
8724
+ /**
8725
+ * The lane's classification of why one tool invocation failed: a searchable
8726
+ * machine code and the cause the tool or engine classified at execution.
8727
+ */
8728
+ export declare interface ToolCallFailure extends ToolCallFailureCause {
8729
+ readonly code: ToolCallFailureCode;
8730
+ }
8731
+
8732
+ declare type ToolCallFailureCause = z.infer<typeof toolCallFailureCauseSchema>;
8733
+
8734
+ declare const toolCallFailureCauseSchema: z.ZodObject<{
8735
+ category: z.ZodEnum<{
8736
+ cancelled: "cancelled";
8737
+ timeout: "timeout";
8738
+ unknown: "unknown";
8739
+ provider: "provider";
8740
+ "invalid-input": "invalid-input";
8741
+ "not-connected": "not-connected";
8742
+ "unsupported-operation": "unsupported-operation";
8743
+ "not-found": "not-found";
8744
+ permission: "permission";
8745
+ unavailable: "unavailable";
8746
+ }>;
8747
+ retryable: z.ZodBoolean;
8748
+ action: z.ZodEnum<{
8749
+ unknown: "unknown";
8750
+ none: "none";
8751
+ retry: "retry";
8752
+ "correct-input": "correct-input";
8753
+ connect: "connect";
8754
+ }>;
8755
+ details: z.ZodOptional<z.ZodObject<{
8756
+ moduleId: z.ZodOptional<z.ZodString>;
8757
+ toolOwnerId: z.ZodOptional<z.ZodString>;
8758
+ operation: z.ZodOptional<z.ZodString>;
8759
+ uri: z.ZodOptional<z.ZodString>;
8760
+ path: z.ZodOptional<z.ZodString>;
8761
+ validationField: z.ZodOptional<z.ZodString>;
8762
+ errorName: z.ZodOptional<z.ZodString>;
8763
+ errorCode: z.ZodOptional<z.ZodString>;
8764
+ providerCode: z.ZodOptional<z.ZodString>;
8765
+ status: z.ZodOptional<z.ZodNumber>;
8766
+ editIndex: z.ZodOptional<z.ZodNumber>;
8767
+ occurrences: z.ZodOptional<z.ZodNumber>;
8768
+ retryAfterMs: z.ZodOptional<z.ZodNumber>;
8769
+ }, z.core.$strict>>;
8770
+ }, z.core.$strict>;
8771
+
8772
+ declare type ToolCallFailureCode = (typeof TOOL_CALL_FAILURE_CODES)[number];
8773
+
8630
8774
  /**
8631
8775
  * The neutral around-execution hook: return `next()`'s result (possibly transformed) to run the
8632
8776
  * real tool, or return a result without calling `next()` to substitute one — the tool then never