@yaklabs-ai/plugin-sdk 0.13.8 → 0.13.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.
package/README.md CHANGED
@@ -13,7 +13,7 @@ it under the name your plugin code actually imports:
13
13
  ```json
14
14
  {
15
15
  "dependencies": {
16
- "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.13.8"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.13.10"
17
17
  }
18
18
  }
19
19
  ```
@@ -62,7 +62,7 @@ Every tool the entrypoint registers is declared in the manifest too:
62
62
  "description": "Greets people by name.",
63
63
  "version": "0.1.0",
64
64
  "namespace": "widgets",
65
- "compatibility": { "sdk": "^0.13.8" },
65
+ "compatibility": { "sdk": "^0.13.10" },
66
66
  "targets": {
67
67
  "kay": {
68
68
  "agent": {
@@ -129,12 +129,23 @@ naming both versions, instead of loading it and finding no `activate`.
129
129
  | `@bonsai/plugin-sdk/app-data` | The app-data size caps, on an entry with no other import, from 0.13.7 |
130
130
  | `@bonsai/plugin-sdk/vendored-mcp` | The kit for a plugin built on a vendor's hosted MCP server, from 0.13.7 |
131
131
  | `@bonsai/plugin-sdk/system-one` | The types and error class for `api.systemOne` / `app.systemOne`, from 0.13.8 |
132
+ | `@bonsai/plugin-sdk/zod` | `z` (the host's in the daemon), on an entry with no other import, from 0.13.9 |
132
133
 
133
134
  A plugin that imports a subpath declares at least the version its row names (`^0.13.7` for the
134
- four from 0.13.7, `^0.13.8` for `system-one`). `vendored-mcp` builds the plugin's URI module (its link cards and help); hosting the
135
+ four from 0.13.7, `^0.13.8` for `system-one`, `^0.13.9` for `zod`). `vendored-mcp` builds the plugin's URI module (its link cards and help); hosting the
135
136
  vendor's MCP server itself is a separate host decision: Bonsai hosts it once a person approves
136
137
  the plugin's `mcp.host-server` grant for that server's name and URL. A server that needs an OAuth
137
- sign-in is, for now, supported only for Bonsai's own plugins.
138
+ sign-in names one of the plugin's auth services in `authService`; that service must declare exactly
139
+ one `delegated` scheme, which Bonsai uses to sign the person in to the server. Bonsai declares that
140
+ scheme at runtime; the plugin's code must not declare it again.
141
+
142
+ From 0.13.10 the manifest schema carries two facts Bonsai reads for its own plugins only; another
143
+ plugin's are ignored, with a load diagnostic. An `external-cli` auth scheme's `cli` says how Bonsai
144
+ connects a local CLI: the `binary`, the `probe` argv (a zero exit is the connection) with the CLI's
145
+ signed-out marker (required with `login`), an optional `login` argv the CLI runs itself, the `hints` a person reads, and the
146
+ `install` argv, which Bonsai only shows or hands to an agent session and never runs. A `kay.agent`
147
+ auth grant on another plugin's sign-in (`google.account`) can carry a `frontDoor`: the door `id` and
148
+ label a product is offered under, and an optional file picker.
138
149
 
139
150
  `kay-agent/host` is intentionally not published; it is Bonsai's own loading
140
151
  machinery, not an authoring API.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.13.8",
4
+ "version": "0.13.10",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -610,7 +610,7 @@ declare interface DecideBoolAnswer {
610
610
  /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
611
611
  declare interface DecideBoolQuestion {
612
612
  readonly type: "bool";
613
- readonly instructions: string;
613
+ readonly instructions: DecideInstructions;
614
614
  readonly criteria?: {
615
615
  readonly true: string;
616
616
  readonly false: string;
@@ -628,10 +628,13 @@ declare interface DecideChoiceAnswer<L extends string = string> {
628
628
  /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
629
629
  declare interface DecideChoiceQuestion<L extends string = string> {
630
630
  readonly type: "choice";
631
- readonly instructions: string;
631
+ readonly instructions: DecideInstructions;
632
632
  readonly criteria: Readonly<Record<L, string>>;
633
633
  }
634
634
 
635
+ /** What a question asks: text, or a JSON object the client sends as its JSON text. */
636
+ declare type DecideInstructions = string | object;
637
+
635
638
  declare type DecideModelId = "jev" | "clef" | "clef-flash";
636
639
 
637
640
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
@@ -656,7 +659,7 @@ declare interface DecideScoreAnswer {
656
659
  /** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
657
660
  declare interface DecideScoreQuestion {
658
661
  readonly type: "score";
659
- readonly instructions: string;
662
+ readonly instructions: DecideInstructions;
660
663
  readonly criteria: readonly string[];
661
664
  }
662
665
 
@@ -3915,18 +3918,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
3915
3918
  /** Creates a deferred ReturnType action. */
3916
3919
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
3917
3920
 
3918
- /**
3919
- * ---
3920
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
3921
- * owns:
3922
- * - {@link RunFailureReason}.
3923
- * does_not_own:
3924
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
3925
- * run-error mapping and recovery policy (`@herd/herd-agent`).
3926
- * ---
3927
- */
3928
- /** Provider-neutral factual category for a failed model run. */
3929
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
3921
+ /** Observed cause of a failed request or interrupted run. */
3922
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
3923
+
3924
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
3930
3925
 
3931
3926
  declare namespace S {
3932
3927
  export {
@@ -4604,6 +4599,8 @@ declare interface SystemOneCallOptions {
4604
4599
  readonly signal?: AbortSignal;
4605
4600
  /** Bounds the whole call, retries included. */
4606
4601
  readonly timeoutMs?: number;
4602
+ /** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
4603
+ readonly purpose?: string;
4607
4604
  }
4608
4605
 
4609
4606
  declare interface SystemOneClient {
@@ -768,7 +768,7 @@ var DEFAULT_DECIDE_MODEL = "jev";
768
768
  var SYSTEM_ONE_LIMITS = {
769
769
  /** The serialized request body, in bytes. */
770
770
  maxBodyBytes: 64 * 1024,
771
- maxQuestions: 8,
771
+ maxQuestions: 64,
772
772
  maxFields: 32,
773
773
  minChoiceOptions: 2,
774
774
  maxChoiceOptions: 255,
@@ -521,7 +521,7 @@ declare interface DecideBoolAnswer {
521
521
  /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
522
522
  declare interface DecideBoolQuestion {
523
523
  readonly type: "bool";
524
- readonly instructions: string;
524
+ readonly instructions: DecideInstructions;
525
525
  readonly criteria?: {
526
526
  readonly true: string;
527
527
  readonly false: string;
@@ -539,10 +539,13 @@ declare interface DecideChoiceAnswer<L extends string = string> {
539
539
  /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
540
540
  declare interface DecideChoiceQuestion<L extends string = string> {
541
541
  readonly type: "choice";
542
- readonly instructions: string;
542
+ readonly instructions: DecideInstructions;
543
543
  readonly criteria: Readonly<Record<L, string>>;
544
544
  }
545
545
 
546
+ /** What a question asks: text, or a JSON object the client sends as its JSON text. */
547
+ declare type DecideInstructions = string | object;
548
+
546
549
  declare type DecideModelId = "jev" | "clef" | "clef-flash";
547
550
 
548
551
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
@@ -567,7 +570,7 @@ declare interface DecideScoreAnswer {
567
570
  /** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
568
571
  declare interface DecideScoreQuestion {
569
572
  readonly type: "score";
570
- readonly instructions: string;
573
+ readonly instructions: DecideInstructions;
571
574
  readonly criteria: readonly string[];
572
575
  }
573
576
 
@@ -3826,18 +3829,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
3826
3829
  /** Creates a deferred ReturnType action. */
3827
3830
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
3828
3831
 
3829
- /**
3830
- * ---
3831
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
3832
- * owns:
3833
- * - {@link RunFailureReason}.
3834
- * does_not_own:
3835
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
3836
- * run-error mapping and recovery policy (`@herd/herd-agent`).
3837
- * ---
3838
- */
3839
- /** Provider-neutral factual category for a failed model run. */
3840
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
3832
+ /** Observed cause of a failed request or interrupted run. */
3833
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
3834
+
3835
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
3841
3836
 
3842
3837
  declare namespace S {
3843
3838
  export {
@@ -4515,6 +4510,8 @@ declare interface SystemOneCallOptions {
4515
4510
  readonly signal?: AbortSignal;
4516
4511
  /** Bounds the whole call, retries included. */
4517
4512
  readonly timeoutMs?: number;
4513
+ /** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
4514
+ readonly purpose?: string;
4518
4515
  }
4519
4516
 
4520
4517
  declare interface SystemOneClient {
@@ -61,7 +61,7 @@ var DEFAULT_DECIDE_MODEL = "jev";
61
61
  var SYSTEM_ONE_LIMITS = {
62
62
  /** The serialized request body, in bytes. */
63
63
  maxBodyBytes: 64 * 1024,
64
- maxQuestions: 8,
64
+ maxQuestions: 64,
65
65
  maxFields: 32,
66
66
  minChoiceOptions: 2,
67
67
  maxChoiceOptions: 255,
@@ -754,7 +754,7 @@ declare interface DecideBoolAnswer {
754
754
  /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
755
755
  declare interface DecideBoolQuestion {
756
756
  readonly type: "bool";
757
- readonly instructions: string;
757
+ readonly instructions: DecideInstructions;
758
758
  readonly criteria?: {
759
759
  readonly true: string;
760
760
  readonly false: string;
@@ -772,10 +772,13 @@ declare interface DecideChoiceAnswer<L extends string = string> {
772
772
  /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
773
773
  declare interface DecideChoiceQuestion<L extends string = string> {
774
774
  readonly type: "choice";
775
- readonly instructions: string;
775
+ readonly instructions: DecideInstructions;
776
776
  readonly criteria: Readonly<Record<L, string>>;
777
777
  }
778
778
 
779
+ /** What a question asks: text, or a JSON object the client sends as its JSON text. */
780
+ declare type DecideInstructions = string | object;
781
+
779
782
  declare type DecideModelId = "jev" | "clef" | "clef-flash";
780
783
 
781
784
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
@@ -800,7 +803,7 @@ declare interface DecideScoreAnswer {
800
803
  /** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
801
804
  declare interface DecideScoreQuestion {
802
805
  readonly type: "score";
803
- readonly instructions: string;
806
+ readonly instructions: DecideInstructions;
804
807
  readonly criteria: readonly string[];
805
808
  }
806
809
 
@@ -3018,9 +3021,9 @@ declare const KayPluginManifestV1: z.ZodObject<{
3018
3021
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue_3, unknown, z.core.$ZodTypeInternals<JsonValue_3, unknown>>>>;
3019
3022
  }, z.core.$strict>>>;
3020
3023
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
3024
+ displayName: z.ZodOptional<z.ZodString>;
3021
3025
  schemes: z.ZodArray<z.ZodString>;
3022
3026
  localId: z.ZodString;
3023
- displayName: z.ZodOptional<z.ZodString>;
3024
3027
  }, z.core.$strict>>>;
3025
3028
  dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
3026
3029
  localId: z.ZodString;
@@ -3361,6 +3364,26 @@ declare const KayPluginManifestV1: z.ZodObject<{
3361
3364
  localId: z.ZodString;
3362
3365
  kind: z.ZodLiteral<"external-cli">;
3363
3366
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3367
+ cli: z.ZodOptional<z.ZodObject<{
3368
+ binary: z.ZodString;
3369
+ probe: z.ZodObject<{
3370
+ args: z.ZodArray<z.ZodString>;
3371
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
3372
+ signedOutMarker: z.ZodOptional<z.ZodString>;
3373
+ }, z.core.$strict>;
3374
+ login: z.ZodOptional<z.ZodObject<{
3375
+ args: z.ZodArray<z.ZodString>;
3376
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
3377
+ }, z.core.$strict>>;
3378
+ install: z.ZodOptional<z.ZodObject<{
3379
+ command: z.ZodString;
3380
+ args: z.ZodArray<z.ZodString>;
3381
+ }, z.core.$strict>>;
3382
+ hints: z.ZodObject<{
3383
+ install: z.ZodString;
3384
+ login: z.ZodString;
3385
+ }, z.core.$strict>;
3386
+ }, z.core.$strict>>;
3364
3387
  displayName: z.ZodOptional<z.ZodString>;
3365
3388
  agentHint: z.ZodOptional<z.ZodString>;
3366
3389
  summary: z.ZodOptional<z.ZodString>;
@@ -3428,6 +3451,18 @@ declare const KayPluginManifestV1: z.ZodObject<{
3428
3451
  kind: z.ZodLiteral<"record-id">;
3429
3452
  recordId: z.ZodString;
3430
3453
  }, z.core.$strict>], "kind">>>;
3454
+ frontDoor: z.ZodOptional<z.ZodObject<{
3455
+ id: z.ZodString;
3456
+ displayName: z.ZodString;
3457
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3458
+ effect: z.ZodEnum<{
3459
+ selection: "selection";
3460
+ "resource-grant": "resource-grant";
3461
+ }>;
3462
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3463
+ successNote: z.ZodOptional<z.ZodString>;
3464
+ }, z.core.$strict>>;
3465
+ }, z.core.$strict>>;
3431
3466
  }, z.core.$strict>>>;
3432
3467
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3433
3468
  kind: z.ZodEnum<{
@@ -3510,6 +3545,18 @@ declare const KayPluginManifestV1: z.ZodObject<{
3510
3545
  kind: z.ZodLiteral<"record-id">;
3511
3546
  recordId: z.ZodString;
3512
3547
  }, z.core.$strict>], "kind">>>;
3548
+ frontDoor: z.ZodOptional<z.ZodObject<{
3549
+ id: z.ZodString;
3550
+ displayName: z.ZodString;
3551
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3552
+ effect: z.ZodEnum<{
3553
+ selection: "selection";
3554
+ "resource-grant": "resource-grant";
3555
+ }>;
3556
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3557
+ successNote: z.ZodOptional<z.ZodString>;
3558
+ }, z.core.$strict>>;
3559
+ }, z.core.$strict>>;
3513
3560
  }, z.core.$strict>>>;
3514
3561
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3515
3562
  kind: z.ZodEnum<{
@@ -3592,6 +3639,18 @@ declare const KayPluginManifestV1: z.ZodObject<{
3592
3639
  kind: z.ZodLiteral<"record-id">;
3593
3640
  recordId: z.ZodString;
3594
3641
  }, z.core.$strict>], "kind">>>;
3642
+ frontDoor: z.ZodOptional<z.ZodObject<{
3643
+ id: z.ZodString;
3644
+ displayName: z.ZodString;
3645
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3646
+ effect: z.ZodEnum<{
3647
+ selection: "selection";
3648
+ "resource-grant": "resource-grant";
3649
+ }>;
3650
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3651
+ successNote: z.ZodOptional<z.ZodString>;
3652
+ }, z.core.$strict>>;
3653
+ }, z.core.$strict>>;
3595
3654
  }, z.core.$strict>>>;
3596
3655
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3597
3656
  kind: z.ZodEnum<{
@@ -5763,18 +5822,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
5763
5822
  /** Creates a deferred ReturnType action. */
5764
5823
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
5765
5824
 
5766
- /**
5767
- * ---
5768
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
5769
- * owns:
5770
- * - {@link RunFailureReason}.
5771
- * does_not_own:
5772
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
5773
- * run-error mapping and recovery policy (`@herd/herd-agent`).
5774
- * ---
5775
- */
5776
- /** Provider-neutral factual category for a failed model run. */
5777
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
5825
+ /** Observed cause of a failed request or interrupted run. */
5826
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
5827
+
5828
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
5778
5829
 
5779
5830
  declare namespace S {
5780
5831
  export {
@@ -6478,6 +6529,8 @@ declare interface SystemOneCallOptions {
6478
6529
  readonly signal?: AbortSignal;
6479
6530
  /** Bounds the whole call, retries included. */
6480
6531
  readonly timeoutMs?: number;
6532
+ /** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
6533
+ readonly purpose?: string;
6481
6534
  }
6482
6535
 
6483
6536
  declare interface SystemOneClient {
package/dist/kay-app.d.ts CHANGED
@@ -827,7 +827,7 @@ declare interface DecideBoolAnswer {
827
827
  /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
828
828
  declare interface DecideBoolQuestion {
829
829
  readonly type: "bool";
830
- readonly instructions: string;
830
+ readonly instructions: DecideInstructions;
831
831
  readonly criteria?: {
832
832
  readonly true: string;
833
833
  readonly false: string;
@@ -845,10 +845,13 @@ declare interface DecideChoiceAnswer<L extends string = string> {
845
845
  /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
846
846
  declare interface DecideChoiceQuestion<L extends string = string> {
847
847
  readonly type: "choice";
848
- readonly instructions: string;
848
+ readonly instructions: DecideInstructions;
849
849
  readonly criteria: Readonly<Record<L, string>>;
850
850
  }
851
851
 
852
+ /** What a question asks: text, or a JSON object the client sends as its JSON text. */
853
+ declare type DecideInstructions = string | object;
854
+
852
855
  declare type DecideModelId = "jev" | "clef" | "clef-flash";
853
856
 
854
857
  declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
@@ -873,7 +876,7 @@ declare interface DecideScoreAnswer {
873
876
  /** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
874
877
  declare interface DecideScoreQuestion {
875
878
  readonly type: "score";
876
- readonly instructions: string;
879
+ readonly instructions: DecideInstructions;
877
880
  readonly criteria: readonly string[];
878
881
  }
879
882
 
@@ -7638,18 +7641,10 @@ declare function ReturnType_2<Type extends TSchema>(type: Type, options?: TSchem
7638
7641
  /** Creates a deferred ReturnType action. */
7639
7642
  declare function ReturnTypeDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TReturnTypeDeferred<Type>;
7640
7643
 
7641
- /**
7642
- * ---
7643
- * responsibility: The closed vocabulary of why a model run failed, as plain data.
7644
- * owns:
7645
- * - {@link RunFailureReason}.
7646
- * does_not_own:
7647
- * - Classifying a failure into a reason (`./run-failure-classifier.ts`), or the engine's
7648
- * run-error mapping and recovery policy (`@herd/herd-agent`).
7649
- * ---
7650
- */
7651
- /** Provider-neutral factual category for a failed model run. */
7652
- declare type RunFailureReason = "auth" | "content_blocked" | "context_overflow" | "invalid_request" | "model_disabled" | "model_unavailable" | "network" | "overloaded" | "quota_exhausted" | "rate_limit" | "safeguard_block" | "seat_unpaid" | "server_error" | "stream_interrupted" | "timeout" | "unknown";
7644
+ /** Observed cause of a failed request or interrupted run. */
7645
+ declare const RUN_FAILURE_REASONS: readonly ["auth", "cancelled", "content_blocked", "context_overflow", "invalid_request", "model_disabled", "model_unavailable", "network", "organization_unavailable", "overloaded", "quota_exhausted", "rate_limit", "runtime_interrupted", "safeguard_block", "seat_unpaid", "server_error", "sign_in_required", "stream_interrupted", "timeout", "unknown"];
7646
+
7647
+ declare type RunFailureReason = (typeof RUN_FAILURE_REASONS)[number];
7653
7648
 
7654
7649
  /**
7655
7650
  * A durable runtime notice: the daemon telling the HUMAN, in the transcript,
@@ -8612,6 +8607,8 @@ declare interface SystemOneCallOptions {
8612
8607
  readonly signal?: AbortSignal;
8613
8608
  /** Bounds the whole call, retries included. */
8614
8609
  readonly timeoutMs?: number;
8610
+ /** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
8611
+ readonly purpose?: string;
8615
8612
  }
8616
8613
 
8617
8614
  declare interface SystemOneClient {
@@ -17,7 +17,7 @@ export declare interface DecideBoolAnswer {
17
17
  /** A yes/no question. `criteria` says what yes and what no mean; omit it to leave both open. */
18
18
  export declare interface DecideBoolQuestion {
19
19
  readonly type: "bool";
20
- readonly instructions: string;
20
+ readonly instructions: DecideInstructions;
21
21
  readonly criteria?: {
22
22
  readonly true: string;
23
23
  readonly false: string;
@@ -35,10 +35,13 @@ export declare interface DecideChoiceAnswer<L extends string = string> {
35
35
  /** A choice among labels. Each label maps to what it means; an empty string leaves it open. */
36
36
  export declare interface DecideChoiceQuestion<L extends string = string> {
37
37
  readonly type: "choice";
38
- readonly instructions: string;
38
+ readonly instructions: DecideInstructions;
39
39
  readonly criteria: Readonly<Record<L, string>>;
40
40
  }
41
41
 
42
+ /** What a question asks: text, or a JSON object the client sends as its JSON text. */
43
+ export declare type DecideInstructions = string | object;
44
+
42
45
  export declare type DecideModelId = "jev" | "clef" | "clef-flash";
43
46
 
44
47
  export declare type DecideQuestion = DecideBoolQuestion | DecideChoiceQuestion | DecideScoreQuestion;
@@ -63,7 +66,7 @@ export declare interface DecideScoreAnswer {
63
66
  /** A score over ordered levels: the first criterion scores 0, the next 1, and so on. */
64
67
  export declare interface DecideScoreQuestion {
65
68
  readonly type: "score";
66
- readonly instructions: string;
69
+ readonly instructions: DecideInstructions;
67
70
  readonly criteria: readonly string[];
68
71
  }
69
72
 
@@ -232,6 +235,8 @@ export declare interface SystemOneCallOptions {
232
235
  readonly signal?: AbortSignal;
233
236
  /** Bounds the whole call, retries included. */
234
237
  readonly timeoutMs?: number;
238
+ /** What the call is for, carried to the host's usage accounting. Never sent to a provider. */
239
+ readonly purpose?: string;
235
240
  }
236
241
 
237
242
  export declare interface SystemOneClient {
@@ -28,7 +28,7 @@ var DEFAULT_DECIDE_MODEL = "jev";
28
28
  var SYSTEM_ONE_LIMITS = {
29
29
  /** The serialized request body, in bytes. */
30
30
  maxBodyBytes: 64 * 1024,
31
- maxQuestions: 8,
31
+ maxQuestions: 64,
32
32
  maxFields: 32,
33
33
  minChoiceOptions: 2,
34
34
  maxChoiceOptions: 255,
package/dist/zod.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+
3
+ export { z }
4
+
5
+ export { }
package/dist/zod.js ADDED
@@ -0,0 +1,5 @@
1
+ // packages/plugin-sdk/dist/zod.js
2
+ import { z } from "zod";
3
+ export {
4
+ z
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.13.8",
3
+ "version": "0.13.10",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",
@@ -68,6 +68,10 @@
68
68
  "./system-one": {
69
69
  "types": "./dist/system-one.d.ts",
70
70
  "default": "./dist/system-one.js"
71
+ },
72
+ "./zod": {
73
+ "types": "./dist/zod.d.ts",
74
+ "default": "./dist/zod.js"
71
75
  }
72
76
  },
73
77
  "files": [
@@ -92,12 +92,19 @@ It never reads the declared files or applies the roster's rules: a missing entry
92
92
  file, an `activate()` that throws, the disclosure audit, and an id another installed plugin already
93
93
  claims all show only after enabling, in `read plugin://<id>`.
94
94
 
95
+ Two manifest fields parse for any plugin but work for Bonsai's own plugins only (SDK 0.13.10): an
96
+ `external-cli` scheme's `cli` (how a local CLI is probed, signed in to and installed) and an auth
97
+ grant's `frontDoor` (a product door onto a shared sign-in). Bonsai drops either from any other
98
+ plugin at load, with a `release-only-connect-facts-ignored` diagnostic, so do not reach for them in
99
+ a plugin you install yourself.
100
+
95
101
  ## The SDK resolution contract
96
102
 
97
103
  - Plugin source imports `@bonsai/plugin-sdk/<subpath>` as a **bare specifier**
98
104
  (`@bonsai/plugin-sdk/kay-agent`, `/kay-agent/testing`, `/kay-app`, `/disclosure`, `/fs`, `/jev`,
99
105
  `/signals`, `/phase-shift`, `/time`, `/transcript`, `/transcript-review`, `/agent-conversation`,
100
- `/app-data`, `/vendored-mcp` — only declared exports exist).
106
+ `/app-data`, `/vendored-mcp`, `/system-one`, `/zod` — only declared exports exist). Take `z`
107
+ from the SDK (`/kay-agent`, or `/zod` in code a page also loads), never from `zod` itself.
101
108
  - The daemon's plugin loader bundles each declared TypeScript entrypoint and its relative imports.
102
109
  It keeps `@bonsai/plugin-sdk` imports external and resolves them to the running app's own built SDK.
103
110
  Multi-file plugins are supported, and no plugin-local build is needed for Bonsai to load them.