@yaklabs-ai/plugin-sdk 0.26.3 → 0.27.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.
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.26.3"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.27.0"
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.26.3" },
65
+ "compatibility": { "sdk": "^0.27.0" },
66
66
  "targets": {
67
67
  "kay": {
68
68
  "agent": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-sdk",
4
- "version": "0.26.3",
4
+ "version": "0.27.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -1113,7 +1113,7 @@ function mergeMessageContent(item, event, status) {
1113
1113
  // The terminal merge (message_end) stamps completion; `startedAt` was
1114
1114
  // stamped at message_start and is never overwritten by later events.
1115
1115
  ...status === "streaming" || item.completedAt !== void 0 ? {} : stringField("completedAt", getTimestamp(event)),
1116
- ...messageMetadata(event, textPhaseFor(event, effectiveParts), effectiveParts)
1116
+ ...messageMetadata(event, textPhaseFor(event, effectiveParts, item.parts), effectiveParts)
1117
1117
  };
1118
1118
  }
1119
1119
  function mergeMessageDelta(item, event) {
@@ -1263,12 +1263,12 @@ function messageFailureReason(event) {
1263
1263
  ...errorText === void 0 ? {} : { failureText: readableFailureText(errorText) }
1264
1264
  };
1265
1265
  }
1266
- function textPhaseFor(event, parts) {
1266
+ function textPhaseFor(event, parts, streamedParts = []) {
1267
1267
  if (event.type !== "message_end")
1268
1268
  return "provisional";
1269
+ const isCall = (part) => part.type === "tool_call";
1270
+ const callsTool = parts.some(isCall) || streamedParts.some(isCall);
1269
1271
  switch (finishReasonFor(event, parts)) {
1270
- case "tool_use":
1271
- return "narration";
1272
1272
  case "complete":
1273
1273
  return "final";
1274
1274
  case "interrupted":
@@ -1276,8 +1276,11 @@ function textPhaseFor(event, parts) {
1276
1276
  return "interrupted";
1277
1277
  case "error":
1278
1278
  return "error";
1279
+ // Text is narration only beside a call it leads into. A provider can report `tool_use`
1280
+ // with no call in the message; that text is the reply, as a stop's would be.
1281
+ case "tool_use":
1279
1282
  case "unknown":
1280
- return parts.some((part) => part.type === "tool_call") ? "narration" : "final";
1283
+ return callsTool ? "narration" : "final";
1281
1284
  case void 0:
1282
1285
  return "final";
1283
1286
  }
@@ -2306,8 +2306,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2306
2306
  * registers the named function on any such scheme, its own client's included, and the SDK refuses a
2307
2307
  * plugin whose lookup and manifest disagree. An own-client (`pkce`) scheme may carry the
2308
2308
  * `clientSecret` that goes with its `clientId`. A plugin with an `oauth2` sign-in declares ^0.26.3.
2309
+ *
2310
+ * 0.27.0 makes a message approval card manifest data (#14574). `approvalTypes` declares the card's
2311
+ * facts and forms, and Bonsai draws it with the module's `describeOperation` and sends it with its
2312
+ * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
2313
+ * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
2314
+ * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
2309
2315
  */
2310
- declare const KAY_PLUGIN_SDK_VERSION: "0.26.3";
2316
+ declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
2311
2317
 
2312
2318
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2313
2319
 
@@ -2360,8 +2360,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2360
2360
  * registers the named function on any such scheme, its own client's included, and the SDK refuses a
2361
2361
  * plugin whose lookup and manifest disagree. An own-client (`pkce`) scheme may carry the
2362
2362
  * `clientSecret` that goes with its `clientId`. A plugin with an `oauth2` sign-in declares ^0.26.3.
2363
+ *
2364
+ * 0.27.0 makes a message approval card manifest data (#14574). `approvalTypes` declares the card's
2365
+ * facts and forms, and Bonsai draws it with the module's `describeOperation` and sends it with its
2366
+ * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
2367
+ * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
2368
+ * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
2363
2369
  */
2364
- declare const KAY_PLUGIN_SDK_VERSION: "0.26.3";
2370
+ declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
2365
2371
 
2366
2372
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2367
2373
 
@@ -4703,9 +4709,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4703
4709
  endpoint: "endpoint";
4704
4710
  storage: "storage";
4705
4711
  command: "command";
4712
+ uriModule: "uriModule";
4706
4713
  authService: "authService";
4707
4714
  app: "app";
4708
- uriModule: "uriModule";
4709
4715
  configSection: "configSection";
4710
4716
  skill: "skill";
4711
4717
  converter: "converter";
@@ -5419,14 +5425,80 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5419
5425
  toolName: z.ZodString;
5420
5426
  }, z.core.$strict>>>;
5421
5427
  kayAppApprovalTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
5428
+ kind: z.ZodLiteral<"message">;
5422
5429
  localId: z.ZodString;
5430
+ provider: z.ZodString;
5431
+ unknownMessage: z.ZodString;
5432
+ fields: z.ZodObject<{
5433
+ body: z.ZodObject<{
5434
+ key: z.ZodString;
5435
+ max: z.ZodNumber;
5436
+ }, z.core.$strict>;
5437
+ subject: z.ZodOptional<z.ZodObject<{
5438
+ key: z.ZodString;
5439
+ max: z.ZodNumber;
5440
+ }, z.core.$strict>>;
5441
+ }, z.core.$strict>;
5442
+ presentation: z.ZodObject<{
5443
+ showAccount: z.ZodBoolean;
5444
+ recipient: z.ZodEnum<{
5445
+ target: "target";
5446
+ person: "person";
5447
+ }>;
5448
+ }, z.core.$strict>;
5449
+ forms: z.ZodObject<{
5450
+ inline: z.ZodOptional<z.ZodObject<{
5451
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5452
+ fixed: z.ZodString;
5453
+ }, z.core.$strict>, z.ZodObject<{
5454
+ value: z.ZodString;
5455
+ }, z.core.$strict>]>;
5456
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5457
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5458
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5459
+ }, z.core.$strict>>;
5460
+ saved: z.ZodOptional<z.ZodObject<{
5461
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5462
+ fixed: z.ZodString;
5463
+ }, z.core.$strict>, z.ZodObject<{
5464
+ value: z.ZodString;
5465
+ }, z.core.$strict>]>;
5466
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5467
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5468
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5469
+ }, z.core.$strict>>;
5470
+ stored: z.ZodOptional<z.ZodObject<{
5471
+ uri: z.ZodUnion<readonly [z.ZodObject<{
5472
+ fixed: z.ZodString;
5473
+ }, z.core.$strict>, z.ZodObject<{
5474
+ value: z.ZodString;
5475
+ }, z.core.$strict>]>;
5476
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
5477
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
5478
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
5479
+ read: z.ZodObject<{
5480
+ revision: z.ZodString;
5481
+ body: z.ZodString;
5482
+ subject: z.ZodOptional<z.ZodString>;
5483
+ to: z.ZodOptional<z.ZodString>;
5484
+ cc: z.ZodOptional<z.ZodString>;
5485
+ bcc: z.ZodOptional<z.ZodString>;
5486
+ attachments: z.ZodOptional<z.ZodString>;
5487
+ }, z.core.$strict>;
5488
+ }, z.core.$strict>>;
5489
+ }, z.core.$strict>;
5490
+ display: z.ZodOptional<z.ZodObject<{
5491
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
5492
+ replyField: z.ZodOptional<z.ZodString>;
5493
+ replyLabel: z.ZodOptional<z.ZodString>;
5494
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
5495
+ label: z.ZodString;
5496
+ field: z.ZodString;
5497
+ }, z.core.$strict>>>;
5498
+ }, z.core.$strict>>;
5423
5499
  globalId: z.ZodString;
5424
- kind: z.ZodEnum<{
5425
- message: "message";
5426
- change: "change";
5427
- action: "action";
5428
- access: "access";
5429
- }>;
5500
+ moduleId: z.ZodString;
5501
+ authService: z.ZodOptional<z.ZodString>;
5430
5502
  }, z.core.$strict>>>;
5431
5503
  kayAppDataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
5432
5504
  localId: z.ZodString;
@@ -2635,8 +2635,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2635
2635
  * registers the named function on any such scheme, its own client's included, and the SDK refuses a
2636
2636
  * plugin whose lookup and manifest disagree. An own-client (`pkce`) scheme may carry the
2637
2637
  * `clientSecret` that goes with its `clientId`. A plugin with an `oauth2` sign-in declares ^0.26.3.
2638
+ *
2639
+ * 0.27.0 makes a message approval card manifest data (#14574). `approvalTypes` declares the card's
2640
+ * facts and forms, and Bonsai draws it with the module's `describeOperation` and sends it with its
2641
+ * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
2642
+ * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
2643
+ * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
2638
2644
  */
2639
- declare const KAY_PLUGIN_SDK_VERSION: "0.26.3";
2645
+ declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
2640
2646
 
2641
2647
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2642
2648
 
@@ -11198,6 +11204,8 @@ export declare class UriProviderError extends UriError {
11198
11204
  readonly retryAfterMs?: number;
11199
11205
  /** See {@link UriProviderErrorOptions.effect}. */
11200
11206
  readonly effect?: "none";
11207
+ /** See {@link UriProviderErrorOptions.refusalMessage}. */
11208
+ readonly refusalMessage?: string;
11201
11209
  constructor(options: UriProviderErrorOptions);
11202
11210
  }
11203
11211
 
@@ -11220,6 +11228,11 @@ export declare interface UriProviderErrorOptions {
11220
11228
  * earlier request may have changed something.
11221
11229
  */
11222
11230
  readonly effect?: "none";
11231
+ /**
11232
+ * What to tell the person when a write they approved was refused, in their words. Only with
11233
+ * `effect: "none"`: it is the plugin saying nothing happened and why.
11234
+ */
11235
+ readonly refusalMessage?: string;
11223
11236
  }
11224
11237
 
11225
11238
  export declare interface UriResolveContext {
package/dist/kay-agent.js CHANGED
@@ -388,6 +388,8 @@ var UriProviderError = class extends UriError {
388
388
  retryAfterMs;
389
389
  /** See {@link UriProviderErrorOptions.effect}. */
390
390
  effect;
391
+ /** See {@link UriProviderErrorOptions.refusalMessage}. */
392
+ refusalMessage;
391
393
  constructor(options) {
392
394
  super(options.message);
393
395
  this.name = "UriProviderError";
@@ -408,6 +410,12 @@ var UriProviderError = class extends UriError {
408
410
  }
409
411
  if (options.effect !== void 0)
410
412
  this.effect = options.effect;
413
+ if (options.refusalMessage !== void 0) {
414
+ if (options.effect !== "none") {
415
+ throw new TypeError('refusalMessage requires effect: "none".');
416
+ }
417
+ this.refusalMessage = options.refusalMessage;
418
+ }
411
419
  }
412
420
  };
413
421
  var UriNotFoundError = class extends UriError {
package/dist/kay-app.d.ts CHANGED
@@ -2,6 +2,10 @@ import { pathToFileURL } from 'node:url';
2
2
  import type { StatementSync } from 'node:sqlite';
3
3
  import { z } from 'zod';
4
4
 
5
+ export declare interface AccessApprovalContext {
6
+ readonly signal: AbortSignal;
7
+ }
8
+
5
9
  export declare interface AccessApprovalInput {
6
10
  readonly uri: string;
7
11
  readonly content: Record<string, unknown>;
@@ -27,7 +31,7 @@ export declare interface AccessApprovalTypeDefinition {
27
31
  readonly prepare: (input: AccessApprovalInput) => PreparedAccessApproval | undefined;
28
32
  readonly finalize: (input: {
29
33
  readonly prepared: PreparedAccessApproval;
30
- }, ctx: ApprovalTypeContext) => Promise<FinalizedAccessApproval>;
34
+ }, ctx: AccessApprovalContext) => Promise<FinalizedAccessApproval>;
31
35
  }
32
36
 
33
37
  declare const AdapterPlacement: z.ZodEnum<{
@@ -142,9 +146,6 @@ declare const AnthropicMessagesCompatSchema: Type.TObject<{
142
146
  /** Creates a Any type. */
143
147
  declare function Any(options?: TSchemaOptions): TAny;
144
148
 
145
- /** Every approval type kind, for registration and storage boundaries. */
146
- export declare type AnyApprovalTypeDefinition = MessageApprovalTypeDefinition | AccessApprovalTypeDefinition;
147
-
148
149
  declare type Api = KnownApi | (string & {});
149
150
 
150
151
  export declare const ApprovalOrigin: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -157,24 +158,6 @@ export declare const ApprovalOrigin: z.ZodDiscriminatedUnion<[z.ZodObject<{
157
158
 
158
159
  export declare type ApprovalOrigin = z.infer<typeof ApprovalOrigin>;
159
160
 
160
- export declare interface ApprovalTypeContext {
161
- readonly signal: AbortSignal;
162
- readonly read?: (uri: string) => Promise<{
163
- readonly content: string | Uint8Array;
164
- }>;
165
- readonly edit?: (uri: string, patch: unknown, options: {
166
- readonly signal: AbortSignal;
167
- }) => Promise<{
168
- readonly resource: unknown;
169
- }>;
170
- readonly report?: (stage: "edit" | "verify", attributes: Readonly<Record<string, string>>) => void;
171
- }
172
-
173
- /** Legacy name for a message approval type; message-only plugins keep compiling against it. */
174
- export declare type ApprovalTypeDefinition = MessageApprovalTypeDefinition;
175
-
176
- export declare type ApprovalTypeResolver = (provider: string) => RegisteredApprovalType | undefined;
177
-
178
161
  /** Creates an Array type. */
179
162
  declare function _Array_<Type extends TSchema>(items: Type, options?: TArrayOptions): TArray<Type>;
180
163
 
@@ -372,10 +355,6 @@ declare type AvailabilityFactsMessage = CustomMessage<AvailabilityFactsDetails>
372
355
  readonly display: true;
373
356
  };
374
357
 
375
- declare type AvailableDraft = Extract<UiMessageDraftResource, {
376
- status: "available";
377
- }>;
378
-
379
358
  declare const BACKGROUND_TASK_RESULT_CUSTOM_TYPE = "background_task_result";
380
359
 
381
360
  declare interface BackgroundTaskAdoptOptions {
@@ -1552,13 +1531,10 @@ declare const FileExtensionToken: z.ZodString;
1552
1531
 
1553
1532
  declare type FileExtensionToken = z.infer<typeof FileExtensionToken>;
1554
1533
 
1555
- export declare type FinalizedAccessApproval = FinalizedMessageApproval;
1556
-
1557
- export declare type FinalizedMessageApproval = {
1534
+ export declare type FinalizedAccessApproval = {
1558
1535
  readonly status: "ready";
1559
1536
  readonly uri: string;
1560
1537
  readonly content: Record<string, unknown>;
1561
- readonly resourceChanged?: true;
1562
1538
  } | {
1563
1539
  readonly status: "failed";
1564
1540
  readonly message: string;
@@ -2630,8 +2606,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2630
2606
  * registers the named function on any such scheme, its own client's included, and the SDK refuses a
2631
2607
  * plugin whose lookup and manifest disagree. An own-client (`pkce`) scheme may carry the
2632
2608
  * `clientSecret` that goes with its `clientId`. A plugin with an `oauth2` sign-in declares ^0.26.3.
2609
+ *
2610
+ * 0.27.0 makes a message approval card manifest data (#14574). `approvalTypes` declares the card's
2611
+ * facts and forms, and Bonsai draws it with the module's `describeOperation` and sends it with its
2612
+ * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
2613
+ * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
2614
+ * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
2633
2615
  */
2634
- declare const KAY_PLUGIN_SDK_VERSION: "0.26.3";
2616
+ declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
2635
2617
 
2636
2618
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2637
2619
 
@@ -3151,11 +3133,6 @@ export declare interface KayAppAgents {
3151
3133
  }): Promise<KayAppSessionRunOutcome>;
3152
3134
  }
3153
3135
 
3154
- export declare interface KayAppApprovals {
3155
- /** Register a declared type exactly once during activation. */
3156
- registerType(localId: string, definition: AnyApprovalTypeDefinition): void;
3157
- }
3158
-
3159
3136
  export declare interface KayAppArtifact {
3160
3137
  readonly uri: string;
3161
3138
  readonly kind: string;
@@ -5024,7 +5001,6 @@ export declare interface KayAppPhaseShiftSessionEvent extends KayAppSessionEvent
5024
5001
  export declare interface KayAppPluginApi {
5025
5002
  /** This plugin's canonical id (already validated by the host registry). */
5026
5003
  readonly id: string;
5027
- readonly approvals: KayAppApprovals;
5028
5004
  /** Register app-lifetime cleanup for plugin-owned processes, sockets, watchers, or timers. */
5029
5005
  readonly lifecycle: KayAppLifecycle;
5030
5006
  /**
@@ -8722,175 +8698,12 @@ export declare namespace Memory {
8722
8698
 
8723
8699
  declare type Message = SystemMessage | UserMessage | AssistantMessage | ToolResultMessage;
8724
8700
 
8725
- export declare const MESSAGE_DRAFT_BODY_MAX = 20000;
8726
-
8727
- export declare const MESSAGE_DRAFT_SUBJECT_MAX = 300;
8728
-
8729
- export declare type MessageApprovalContent = AvailableDraft["content"] | {
8730
- readonly kind: "inline-email";
8731
- readonly to: readonly string[];
8732
- readonly cc?: readonly string[];
8733
- readonly bcc?: readonly string[];
8734
- readonly subject: string;
8735
- readonly body: string;
8736
- } | {
8737
- readonly kind: "inline-chat";
8738
- readonly provider: "slack";
8739
- readonly conversationUri: string;
8740
- readonly body: string;
8741
- };
8742
-
8743
- export declare interface MessageApprovalInput {
8744
- readonly content: MessageApprovalContent;
8745
- readonly request: UiMessageDraftDeliveryRequest | UiMessageDraftInlineDeliveryRequest;
8746
- /** Unqualified provider URI after host account validation. */
8747
- readonly uri: string;
8748
- readonly resource?: AvailableDraft;
8749
- }
8750
-
8751
- /** A fixed delivery refusal from pure preparation; safe across separately bundled SDK copies. */
8752
- export declare class MessageApprovalPreparationError extends Error {
8753
- readonly reason: "invalid-destination" | "invalid-content";
8754
- constructor(reason: "invalid-destination" | "invalid-content");
8755
- }
8756
-
8757
- export declare interface MessageApprovalTypeDefinition {
8758
- readonly kind: "message";
8759
- readonly provider: string;
8760
- readonly moduleId: string;
8761
- readonly unknownMessage: string;
8762
- readonly fields: {
8763
- readonly body: {
8764
- readonly key: string;
8765
- readonly max: number;
8766
- };
8767
- readonly subject?: {
8768
- readonly key: string;
8769
- readonly max: number;
8770
- };
8771
- };
8772
- readonly presentation: {
8773
- readonly showAccount: boolean;
8774
- readonly recipient: "person" | "target";
8775
- };
8776
- /** Pure preparation; does not execute the reviewed operation. Async because the host may call it across a process boundary. */
8777
- readonly prepare: (input: MessageApprovalInput) => Promise<PreparedMessageApproval | undefined>;
8778
- readonly finalize: (input: {
8779
- readonly prepared: PreparedMessageApproval;
8780
- readonly failure?: {
8781
- readonly error: unknown;
8782
- };
8783
- readonly body: string;
8784
- readonly subject?: string;
8785
- }, ctx: ApprovalTypeContext) => Promise<FinalizedMessageApproval>;
8786
- /** Finds a saved draft this provider keeps. Omit it when the provider keeps none. */
8787
- readonly resolveResource?: (uri: string, ctx: ApprovalTypeContext) => Promise<UiMessageDraftResource | undefined>;
8788
- }
8789
-
8790
- /** Review-specific routing inputs. The host must resolve the stable account and validate the provider route. */
8791
- declare const messageDraftDeliveryRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8792
- provider: z.ZodLiteral<"gmail">;
8793
- accountId: z.ZodString;
8794
- threadId: z.ZodOptional<z.ZodString>;
8795
- inReplyTo: z.ZodOptional<z.ZodString>;
8796
- references: z.ZodOptional<z.ZodArray<z.ZodString>>;
8797
- }, z.core.$strict>, z.ZodObject<{
8798
- provider: z.ZodLiteral<"slack">;
8799
- accountId: z.ZodString;
8800
- threadTs: z.ZodOptional<z.ZodString>;
8801
- }, z.core.$strict>, z.ZodObject<{
8802
- provider: z.ZodLiteral<"teams">;
8803
- accountId: z.ZodString;
8804
- replyTo: z.ZodOptional<z.ZodString>;
8805
- }, z.core.$strict>], "provider">;
8806
-
8807
8701
  /**
8808
- * The routing an INLINE card may ask the host for: Gmail, whose recipients are the card's own
8809
- * props, or Slack, whose request names its conversation. An inline Teams card names no
8810
- * destination the host could bind to the press, so it keeps the agent's own write.
8702
+ * A message approval card's facts as Bonsai resolves them from the plugin's manifest. A card runs
8703
+ * no card-specific plugin code: it is drawn with the module's `describeOperation` and sent with its
8704
+ * `write`.
8811
8705
  */
8812
- declare const messageDraftInlineDeliveryRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8813
- provider: z.ZodLiteral<"gmail">;
8814
- accountId: z.ZodString;
8815
- threadId: z.ZodOptional<z.ZodString>;
8816
- inReplyTo: z.ZodOptional<z.ZodString>;
8817
- references: z.ZodOptional<z.ZodArray<z.ZodString>>;
8818
- }, z.core.$strict>, z.ZodObject<{
8819
- provider: z.ZodLiteral<"slack">;
8820
- accountId: z.ZodString;
8821
- conversationUri: z.ZodString;
8822
- threadTs: z.ZodOptional<z.ZodString>;
8823
- }, z.core.$strict>], "provider">;
8824
-
8825
- /** Immutable display evidence, not an approval or an editable copy of the draft. */
8826
- export declare const messageDraftResourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
8827
- status: z.ZodLiteral<"available">;
8828
- draftUri: z.ZodString;
8829
- revision: z.ZodString;
8830
- content: z.ZodDiscriminatedUnion<[z.ZodObject<{
8831
- kind: z.ZodLiteral<"email">;
8832
- to: z.ZodArray<z.ZodString>;
8833
- cc: z.ZodOptional<z.ZodArray<z.ZodString>>;
8834
- bcc: z.ZodOptional<z.ZodArray<z.ZodString>>;
8835
- subject: z.ZodString;
8836
- bodyMarkdown: z.ZodString;
8837
- bodyFormat: z.ZodOptional<z.ZodLiteral<"plain">>;
8838
- attachments: z.ZodOptional<z.ZodArray<z.ZodString>>;
8839
- }, z.core.$strict>, z.ZodObject<{
8840
- kind: z.ZodLiteral<"chat">;
8841
- provider: z.ZodEnum<{
8842
- slack: "slack";
8843
- teams: "teams";
8844
- }>;
8845
- conversationUri: z.ZodOptional<z.ZodString>;
8846
- bodyMarkdown: z.ZodString;
8847
- }, z.core.$strict>], "kind">;
8848
- delivery: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
8849
- status: z.ZodLiteral<"ready">;
8850
- sessionId: z.ZodString;
8851
- request: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
8852
- provider: z.ZodLiteral<"gmail">;
8853
- accountId: z.ZodString;
8854
- threadId: z.ZodOptional<z.ZodString>;
8855
- inReplyTo: z.ZodOptional<z.ZodString>;
8856
- references: z.ZodOptional<z.ZodArray<z.ZodString>>;
8857
- }, z.core.$strict>, z.ZodObject<{
8858
- provider: z.ZodLiteral<"slack">;
8859
- accountId: z.ZodString;
8860
- threadTs: z.ZodOptional<z.ZodString>;
8861
- }, z.core.$strict>, z.ZodObject<{
8862
- provider: z.ZodLiteral<"teams">;
8863
- accountId: z.ZodString;
8864
- replyTo: z.ZodOptional<z.ZodString>;
8865
- }, z.core.$strict>], "provider">, z.ZodObject<{
8866
- provider: z.ZodLiteral<"slack">;
8867
- accountId: z.ZodString;
8868
- conversationUri: z.ZodString;
8869
- threadTs: z.ZodOptional<z.ZodString>;
8870
- }, z.core.$strict>]>;
8871
- accountName: z.ZodOptional<z.ZodString>;
8872
- destination: z.ZodOptional<z.ZodString>;
8873
- writeUri: z.ZodString;
8874
- }, z.core.$strict>, z.ZodObject<{
8875
- status: z.ZodLiteral<"unavailable">;
8876
- reason: z.ZodEnum<{
8877
- "missing-context": "missing-context";
8878
- "account-unavailable": "account-unavailable";
8879
- "invalid-destination": "invalid-destination";
8880
- "invalid-content": "invalid-content";
8881
- "unnamed-destination": "unnamed-destination";
8882
- }>;
8883
- }, z.core.$strict>], "status">>;
8884
- }, z.core.$strict>, z.ZodObject<{
8885
- status: z.ZodEnum<{
8886
- unavailable: "unavailable";
8887
- missing: "missing";
8888
- invalid: "invalid";
8889
- "unsupported-version": "unsupported-version";
8890
- "too-large": "too-large";
8891
- }>;
8892
- draftUri: z.ZodString;
8893
- }, z.core.$strict>], "status">;
8706
+ export declare type MessageApprovalFacts = ResolvedKayAppApprovalType;
8894
8707
 
8895
8708
  declare interface MessageEntry extends EntryBase {
8896
8709
  type: "message";
@@ -9884,13 +9697,6 @@ export declare interface PreparedAccessApproval {
9884
9697
  readonly binding?: unknown;
9885
9698
  }
9886
9699
 
9887
- export declare interface PreparedMessageApproval {
9888
- readonly uri: string;
9889
- readonly content: Record<string, unknown>;
9890
- /** Provider-private state retained only in host memory. */
9891
- readonly binding?: unknown;
9892
- }
9893
-
9894
9700
  declare const Properties: (input: string) => [unknown, string] | [];
9895
9701
 
9896
9702
  declare function PropertiesMapping(input: [unknown, unknown, unknown]): unknown;
@@ -9959,8 +9765,6 @@ export declare interface QualifiedApprovalTypeId {
9959
9765
  readonly localId: string;
9960
9766
  }
9961
9767
 
9962
- export declare type QualifiedApprovalTypeResolver = (id: QualifiedApprovalTypeId) => ResolvedApprovalType | undefined;
9963
-
9964
9768
  export declare interface RawResource {
9965
9769
  readonly uri: string;
9966
9770
  readonly content: string | Uint8Array;
@@ -10126,18 +9930,18 @@ declare function refineWebSessionScopeConfined(webSession: {
10126
9930
  };
10127
9931
  }, ctx: z.RefinementCtx): void;
10128
9932
 
10129
- export declare interface RegisteredApprovalType<D extends AnyApprovalTypeDefinition = MessageApprovalTypeDefinition> {
10130
- readonly pluginId: string;
10131
- readonly localId: string;
10132
- readonly definition: D;
10133
- }
10134
-
10135
9933
  export declare interface RegisteredHostApprovalType {
10136
9934
  readonly hostId: string;
10137
9935
  readonly localId: string;
10138
9936
  readonly definition: AccessApprovalTypeDefinition;
10139
9937
  }
10140
9938
 
9939
+ export declare interface RegisteredMessageApprovalFacts {
9940
+ readonly pluginId: string;
9941
+ readonly localId: string;
9942
+ readonly definition: MessageApprovalFacts;
9943
+ }
9944
+
10141
9945
  declare const RegistrableDomain: z.ZodString;
10142
9946
 
10143
9947
  declare type RegistrableDomain = z.infer<typeof RegistrableDomain>;
@@ -10219,8 +10023,6 @@ declare interface RequiresAuth {
10219
10023
  */
10220
10024
  export declare function requireWriteContent(payload: UriPayload | Uint8Array | undefined, uri: string): UriPayload;
10221
10025
 
10222
- export declare type ResolvedApprovalType = RegisteredApprovalType<AnyApprovalTypeDefinition> | RegisteredHostApprovalType;
10223
-
10224
10026
  /**
10225
10027
  * The credential the host resolved for one call to plugin code that declares `requiresAuth`: a URI
10226
10028
  * verb (`ctx.auth.credential`), a tool (`ctx.credential`) or a search provider (`ctx.credential`).
@@ -10239,6 +10041,85 @@ declare interface ResolvedCredential {
10239
10041
  readonly fields?: Readonly<Record<string, string>>;
10240
10042
  }
10241
10043
 
10044
+ declare const ResolvedKayAppApprovalType: z.ZodObject<{
10045
+ kind: z.ZodLiteral<"message">;
10046
+ localId: z.ZodString;
10047
+ provider: z.ZodString;
10048
+ unknownMessage: z.ZodString;
10049
+ fields: z.ZodObject<{
10050
+ body: z.ZodObject<{
10051
+ key: z.ZodString;
10052
+ max: z.ZodNumber;
10053
+ }, z.core.$strict>;
10054
+ subject: z.ZodOptional<z.ZodObject<{
10055
+ key: z.ZodString;
10056
+ max: z.ZodNumber;
10057
+ }, z.core.$strict>>;
10058
+ }, z.core.$strict>;
10059
+ presentation: z.ZodObject<{
10060
+ showAccount: z.ZodBoolean;
10061
+ recipient: z.ZodEnum<{
10062
+ target: "target";
10063
+ person: "person";
10064
+ }>;
10065
+ }, z.core.$strict>;
10066
+ forms: z.ZodObject<{
10067
+ inline: z.ZodOptional<z.ZodObject<{
10068
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10069
+ fixed: z.ZodString;
10070
+ }, z.core.$strict>, z.ZodObject<{
10071
+ value: z.ZodString;
10072
+ }, z.core.$strict>]>;
10073
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10074
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10075
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10076
+ }, z.core.$strict>>;
10077
+ saved: z.ZodOptional<z.ZodObject<{
10078
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10079
+ fixed: z.ZodString;
10080
+ }, z.core.$strict>, z.ZodObject<{
10081
+ value: z.ZodString;
10082
+ }, z.core.$strict>]>;
10083
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10084
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10085
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10086
+ }, z.core.$strict>>;
10087
+ stored: z.ZodOptional<z.ZodObject<{
10088
+ uri: z.ZodUnion<readonly [z.ZodObject<{
10089
+ fixed: z.ZodString;
10090
+ }, z.core.$strict>, z.ZodObject<{
10091
+ value: z.ZodString;
10092
+ }, z.core.$strict>]>;
10093
+ requestFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
10094
+ payload: z.ZodRecord<z.ZodString, z.ZodString>;
10095
+ fixed: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>>>;
10096
+ read: z.ZodObject<{
10097
+ revision: z.ZodString;
10098
+ body: z.ZodString;
10099
+ subject: z.ZodOptional<z.ZodString>;
10100
+ to: z.ZodOptional<z.ZodString>;
10101
+ cc: z.ZodOptional<z.ZodString>;
10102
+ bcc: z.ZodOptional<z.ZodString>;
10103
+ attachments: z.ZodOptional<z.ZodString>;
10104
+ }, z.core.$strict>;
10105
+ }, z.core.$strict>>;
10106
+ }, z.core.$strict>;
10107
+ display: z.ZodOptional<z.ZodObject<{
10108
+ bodyFormat: z.ZodOptional<z.ZodLiteral<"mrkdwn">>;
10109
+ replyField: z.ZodOptional<z.ZodString>;
10110
+ replyLabel: z.ZodOptional<z.ZodString>;
10111
+ facts: z.ZodOptional<z.ZodArray<z.ZodObject<{
10112
+ label: z.ZodString;
10113
+ field: z.ZodString;
10114
+ }, z.core.$strict>>>;
10115
+ }, z.core.$strict>>;
10116
+ globalId: z.ZodString;
10117
+ moduleId: z.ZodString;
10118
+ authService: z.ZodOptional<z.ZodString>;
10119
+ }, z.core.$strict>;
10120
+
10121
+ declare type ResolvedKayAppApprovalType = z.infer<typeof ResolvedKayAppApprovalType>;
10122
+
10242
10123
  /** Match remaining characters in the buffer until end. If no characters are in buffer, no match */
10243
10124
  declare function Rest<Input extends string>(input: Input): TRest<Input>;
10244
10125
 
@@ -15321,12 +15202,6 @@ declare type UiActionMessage = CustomMessage<UiActionDetails> & {
15321
15202
  readonly display: true;
15322
15203
  };
15323
15204
 
15324
- declare type UiMessageDraftDeliveryRequest = z.infer<typeof messageDraftDeliveryRequestSchema>;
15325
-
15326
- declare type UiMessageDraftInlineDeliveryRequest = z.infer<typeof messageDraftInlineDeliveryRequestSchema>;
15327
-
15328
- export declare type UiMessageDraftResource = z.infer<typeof messageDraftResourceSchema>;
15329
-
15330
15205
  /** Applies a Uncapitalize action to the given type. */
15331
15206
  declare function Uncapitalize_2<Type extends TSchema>(type: Type, options?: TSchemaOptions): TUncapitalize<Type>;
15332
15207
 
@@ -16069,6 +15944,8 @@ export declare class UriProviderError extends UriError {
16069
15944
  readonly retryAfterMs?: number;
16070
15945
  /** See {@link UriProviderErrorOptions.effect}. */
16071
15946
  readonly effect?: "none";
15947
+ /** See {@link UriProviderErrorOptions.refusalMessage}. */
15948
+ readonly refusalMessage?: string;
16072
15949
  constructor(options: UriProviderErrorOptions);
16073
15950
  }
16074
15951
 
@@ -16091,6 +15968,11 @@ export declare interface UriProviderErrorOptions {
16091
15968
  * earlier request may have changed something.
16092
15969
  */
16093
15970
  readonly effect?: "none";
15971
+ /**
15972
+ * What to tell the person when a write they approved was refused, in their words. Only with
15973
+ * `effect: "none"`: it is the plugin saying nothing happened and why.
15974
+ */
15975
+ readonly refusalMessage?: string;
16094
15976
  }
16095
15977
 
16096
15978
  /**
package/dist/kay-app.js CHANGED
@@ -299,6 +299,8 @@ var UriProviderError = class extends UriError {
299
299
  retryAfterMs;
300
300
  /** See {@link UriProviderErrorOptions.effect}. */
301
301
  effect;
302
+ /** See {@link UriProviderErrorOptions.refusalMessage}. */
303
+ refusalMessage;
302
304
  constructor(options) {
303
305
  super(options.message);
304
306
  this.name = "UriProviderError";
@@ -319,6 +321,12 @@ var UriProviderError = class extends UriError {
319
321
  }
320
322
  if (options.effect !== void 0)
321
323
  this.effect = options.effect;
324
+ if (options.refusalMessage !== void 0) {
325
+ if (options.effect !== "none") {
326
+ throw new TypeError('refusalMessage requires effect: "none".');
327
+ }
328
+ this.refusalMessage = options.refusalMessage;
329
+ }
322
330
  }
323
331
  };
324
332
  var UriNotFoundError = class extends UriError {
@@ -537,189 +545,6 @@ function isRetryable(result) {
537
545
  return result.status === "not-ready";
538
546
  }
539
547
 
540
- // packages/kay-ui-catalog/dist/message-draft-resource.js
541
- import { z as z7 } from "zod";
542
- var MESSAGE_DRAFT_SUBJECT_MAX = 300;
543
- var MESSAGE_DRAFT_BODY_MAX = 2e4;
544
- var MESSAGE_DRAFT_RESOURCE_MAX = 8;
545
- var UI_RENDER_RESULT_MAX_BYTES = 64 * 1024;
546
- var contextIdSchema = z7.string().min(1).max(2048);
547
- var gmailDeliveryRequestSchema = z7.strictObject({
548
- provider: z7.literal("gmail"),
549
- accountId: contextIdSchema,
550
- threadId: contextIdSchema.optional(),
551
- inReplyTo: contextIdSchema.optional(),
552
- references: z7.array(contextIdSchema).max(50).optional()
553
- });
554
- var messageDraftDeliveryRequestSchema = z7.discriminatedUnion("provider", [
555
- gmailDeliveryRequestSchema,
556
- z7.strictObject({
557
- provider: z7.literal("slack"),
558
- accountId: contextIdSchema,
559
- threadTs: contextIdSchema.optional()
560
- }),
561
- z7.strictObject({
562
- provider: z7.literal("teams"),
563
- accountId: contextIdSchema,
564
- replyTo: contextIdSchema.optional()
565
- })
566
- ]);
567
- var slackInlineDeliveryRequestSchema = z7.strictObject({
568
- provider: z7.literal("slack"),
569
- accountId: contextIdSchema,
570
- /**
571
- * The conversation itself: `slack://channels/<id>`, or the same under `slack://@<accountId>/`.
572
- * A thread's address is refused unless `threadTs` names the same thread, because the card shows
573
- * a reply only from `threadTs`.
574
- */
575
- conversationUri: contextIdSchema,
576
- threadTs: contextIdSchema.optional()
577
- });
578
- var messageDraftInlineDeliveryRequestSchema = z7.discriminatedUnion("provider", [gmailDeliveryRequestSchema, slackInlineDeliveryRequestSchema]);
579
- var messageDraftResourcePropsSchema = z7.strictObject({
580
- draftUri: z7.string().min(1).max(2048),
581
- editable: z7.boolean().optional(),
582
- delivery: messageDraftDeliveryRequestSchema.optional()
583
- });
584
- var deliveryResultSchema = z7.discriminatedUnion("status", [
585
- z7.strictObject({
586
- status: z7.literal("ready"),
587
- sessionId: contextIdSchema,
588
- // A saved draft's request, or an inline card's. They differ only for Slack, where the inline
589
- // form carries `conversationUri`; each strict variant refuses the other's shape.
590
- request: z7.union([
591
- messageDraftDeliveryRequestSchema,
592
- slackInlineDeliveryRequestSchema
593
- ]),
594
- accountName: z7.string().min(1).max(2048).optional(),
595
- /**
596
- * Where a chat message lands, named as the provider named it when the card was drawn
597
- * (`#engineering`, `Alex Kim <alex@example.com> (direct message)`: a direct message by the
598
- * person's name and Slack email, never a display name alone; Slack's module may answer from its
599
- * own name cache, up to a day old, never for another conversation). The card shows this instead of the
600
- * agent's own `to` label. Absent for email, whose recipients are the card's own props.
601
- */
602
- destination: z7.string().min(1).max(2048).optional(),
603
- writeUri: contextIdSchema
604
- }),
605
- z7.strictObject({
606
- status: z7.literal("unavailable"),
607
- reason: z7.enum([
608
- "missing-context",
609
- "account-unavailable",
610
- "invalid-destination",
611
- "invalid-content",
612
- // The provider could not name the conversation in time, so the card could not show the
613
- // person where Send would post.
614
- "unnamed-destination"
615
- ])
616
- })
617
- ]);
618
- var contentSchema = z7.discriminatedUnion("kind", [
619
- z7.strictObject({
620
- kind: z7.literal("email"),
621
- to: z7.array(z7.string().max(320)).max(50),
622
- /** Copy recipients a draft stored in the mail provider carries; a Whiteboard draft has none. */
623
- cc: z7.array(z7.string().max(320)).max(50).optional(),
624
- bcc: z7.array(z7.string().max(320)).max(50).optional(),
625
- subject: z7.string().max(MESSAGE_DRAFT_SUBJECT_MAX),
626
- bodyMarkdown: z7.string().max(MESSAGE_DRAFT_BODY_MAX),
627
- /**
628
- * `plain` when `bodyMarkdown` holds the literal text of a draft stored in the mail provider,
629
- * which is sent as written and must not be shown through a Markdown reading. Absent means
630
- * Markdown, the Whiteboard draft's format.
631
- */
632
- bodyFormat: z7.literal("plain").optional(),
633
- /** File names a draft stored in the mail provider carries (names only, never content). */
634
- attachments: z7.array(z7.string().min(1).max(200)).max(20).optional()
635
- }),
636
- z7.strictObject({
637
- kind: z7.literal("chat"),
638
- provider: z7.enum(["slack", "teams"]),
639
- conversationUri: z7.string().max(2048).optional(),
640
- bodyMarkdown: z7.string().max(MESSAGE_DRAFT_BODY_MAX)
641
- })
642
- ]);
643
- var messageDraftResourceSchema = z7.discriminatedUnion("status", [
644
- z7.strictObject({
645
- status: z7.literal("available"),
646
- draftUri: z7.string().min(1).max(2048),
647
- revision: z7.string().min(1).max(256),
648
- content: contentSchema,
649
- delivery: deliveryResultSchema.optional()
650
- }).refine(({ content, delivery }) => delivery?.status !== "ready" || delivery.request.provider === (content.kind === "email" ? "gmail" : content.provider) && // A saved draft names its own conversation; only an inline card's request carries one.
651
- messageDraftDeliveryRequestSchema.safeParse(delivery.request).success, "Delivery provider must match the saved content"),
652
- z7.strictObject({
653
- status: z7.enum([
654
- "missing",
655
- "unavailable",
656
- "invalid",
657
- "unsupported-version",
658
- "too-large"
659
- ]),
660
- draftUri: z7.string().max(2048)
661
- })
662
- ]);
663
- var messageDraftResourceSubmissionSchema = z7.strictObject({
664
- version: z7.literal(1),
665
- approved: z7.literal(true),
666
- elementId: z7.string().min(1).max(2048),
667
- draftUri: z7.string().min(1).max(2048),
668
- revision: z7.string().min(1).max(256),
669
- body: z7.string().max(MESSAGE_DRAFT_BODY_MAX),
670
- subject: z7.string().max(MESSAGE_DRAFT_SUBJECT_MAX).optional()
671
- });
672
- var messageDraftApprovalWriteSchema = z7.strictObject({
673
- messageDraftApproval: z7.strictObject({
674
- version: z7.literal(1),
675
- toolCallId: contextIdSchema
676
- })
677
- });
678
- var messageDraftSentDetailsSchema = z7.object({
679
- version: z7.literal(1),
680
- /** The `ui_render` call that drew the card. */
681
- reviewToolCallId: z7.string().min(1),
682
- /** The MessageDraft element within that render. */
683
- elementId: z7.string().min(1),
684
- /** The send intent that produced this record. */
685
- clientIntentId: z7.string().min(1),
686
- provider: z7.enum(["gmail", "slack"]),
687
- accountId: z7.string().min(1),
688
- accountName: z7.string().min(1).optional(),
689
- /** A chat message's conversation as the card named it (`#engineering`); absent for email. */
690
- destination: z7.string().min(1).optional(),
691
- /** ISO 8601 instant the provider accepted the send. */
692
- sentAt: z7.string().min(1),
693
- /**
694
- * The sent message, addressed under its account (`gmail://@<accountId>/messages/<id>`,
695
- * `slack://@<accountId>/channels/<id>/messages/<ts>`), when the provider named it.
696
- */
697
- sentMessageUri: z7.string().min(1).optional(),
698
- subject: z7.string().max(MESSAGE_DRAFT_SUBJECT_MAX).optional(),
699
- body: z7.string().max(MESSAGE_DRAFT_BODY_MAX)
700
- });
701
- var uiRenderResultDetailsSchema = z7.union([
702
- z7.strictObject({
703
- version: z7.literal(1),
704
- messageDrafts: z7.record(z7.string(), messageDraftResourceSchema).refine((drafts) => Object.keys(drafts).length <= MESSAGE_DRAFT_RESOURCE_MAX).optional(),
705
- inlineDeliveries: z7.record(z7.string(), deliveryResultSchema).refine((deliveries) => Object.keys(deliveries).length <= MESSAGE_DRAFT_RESOURCE_MAX).refine((deliveries) => Object.values(deliveries).every((delivery) => delivery.status !== "ready" || messageDraftInlineDeliveryRequestSchema.safeParse(delivery.request).success)).optional()
706
- }).refine((details) => details.messageDrafts !== void 0 || details.inlineDeliveries !== void 0).refine((details) => new TextEncoder().encode(JSON.stringify(details)).byteLength <= UI_RENDER_RESULT_MAX_BYTES),
707
- z7.strictObject({
708
- version: z7.literal(1),
709
- error: z7.literal("resource-limit-exceeded")
710
- })
711
- ]);
712
-
713
- // packages/plugin-sdk/dist/kay-app/approvals.js
714
- var MessageApprovalPreparationError = class extends Error {
715
- reason;
716
- constructor(reason) {
717
- super(reason);
718
- this.reason = reason;
719
- this.name = "MessageApprovalPreparationError";
720
- }
721
- };
722
-
723
548
  // packages/plugin-sdk/dist/kay-app/auth.js
724
549
  var KayAppCredentialRejectedError = class extends Error {
725
550
  name = "KayAppCredentialRejectedError";
@@ -1072,9 +897,6 @@ export {
1072
897
  KayAppCredentialRejectedError,
1073
898
  KayAppWorkflowFailure,
1074
899
  MAX_CHOICE_LABELS,
1075
- MESSAGE_DRAFT_BODY_MAX,
1076
- MESSAGE_DRAFT_SUBJECT_MAX,
1077
- MessageApprovalPreparationError,
1078
900
  SIGNAL_TIME_MAX_MS,
1079
901
  STORED_TRANSCRIPT_MESSAGE_FILTER,
1080
902
  STORED_TRANSCRIPT_MESSAGE_KINDS,
@@ -1094,7 +916,6 @@ export {
1094
916
  failedRunCause,
1095
917
  invalidObservation,
1096
918
  isRetryable,
1097
- messageDraftResourceSchema,
1098
919
  parseLineSelector,
1099
920
  parseStoredTranscriptKindFilter,
1100
921
  pathToFileURL,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.26.3",
3
+ "version": "0.27.0",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",