@yaklabs-ai/plugin-sdk 0.47.0 → 0.48.1

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.47.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.48.1"
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.47.0" },
65
+ "compatibility": { "sdk": "^0.48.1" },
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.47.0",
4
+ "version": "0.48.1",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -2152,6 +2152,8 @@ declare interface InteractiveQueuedMessage {
2152
2152
  readonly attachments?: AttachmentsDetails["refs"] | undefined;
2153
2153
  readonly context?: readonly ManagedHumanQueueContextPart[] | undefined;
2154
2154
  readonly resendError?: string | undefined;
2155
+ /** Why this message is waiting, when something is stopping its delivery. */
2156
+ readonly deliveryError?: string | undefined;
2155
2157
  /**
2156
2158
  * Managed-queue lifecycle, present only for items projected from a
2157
2159
  * `managed_human_queue_update` snapshot: `queued` (live in a delivery queue) or `editing`
@@ -2656,6 +2658,7 @@ declare interface ManagedHumanQueueItemSnapshot {
2656
2658
  readonly attachments?: AttachmentsDetails["refs"] | undefined;
2657
2659
  readonly context?: readonly ManagedHumanQueueContextPart[] | undefined;
2658
2660
  readonly resendError?: string | undefined;
2661
+ readonly deliveryError?: string | undefined;
2659
2662
  }
2660
2663
 
2661
2664
  /**
@@ -445,6 +445,7 @@ var HerdSessionProjection = z4.discriminatedUnion("type", [
445
445
  attachments: z4.array(ManagedQueueAttachmentRef).optional(),
446
446
  context: z4.array(ManagedQueueContextPart).optional(),
447
447
  resendError: z4.string().optional(),
448
+ deliveryError: z4.string().optional(),
448
449
  text: z4.string(),
449
450
  channel: z4.enum(["follow_up", "steer"]),
450
451
  status: z4.enum(["queued", "editing"])
@@ -1966,6 +1967,7 @@ function reduceManagedHumanQueueUpdate(state, event) {
1966
1967
  });
1967
1968
  const context = extractQueuedMessageContext(record);
1968
1969
  const resendError = getString(record, "resendError");
1970
+ const deliveryError = getString(record, "deliveryError");
1969
1971
  return [
1970
1972
  {
1971
1973
  id,
@@ -1976,6 +1978,7 @@ function reduceManagedHumanQueueUpdate(state, event) {
1976
1978
  ...attachments === void 0 || attachments.length === 0 ? {} : { attachments },
1977
1979
  ...context === void 0 ? {} : { context },
1978
1980
  ...resendError === void 0 ? {} : { resendError },
1981
+ ...deliveryError === void 0 ? {} : { deliveryError },
1979
1982
  ...status === "queued" || status === "editing" ? { status } : {}
1980
1983
  }
1981
1984
  ];
@@ -2444,8 +2444,12 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2444
2444
  * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2445
2445
  *
2446
2446
  * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2447
+ *
2448
+ * 0.48.0 adds the models.complete UI capability.
2449
+ *
2450
+ * 0.48.1 adds app-tool metadata, conditional tool permissions and screen-action declarations.
2447
2451
  */
2448
- declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2452
+ declare const KAY_PLUGIN_SDK_VERSION: "0.48.1";
2449
2453
 
2450
2454
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2451
2455
 
@@ -2498,8 +2498,12 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2498
2498
  * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2499
2499
  *
2500
2500
  * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2501
+ *
2502
+ * 0.48.0 adds the models.complete UI capability.
2503
+ *
2504
+ * 0.48.1 adds app-tool metadata, conditional tool permissions and screen-action declarations.
2501
2505
  */
2502
- declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2506
+ declare const KAY_PLUGIN_SDK_VERSION: "0.48.1";
2503
2507
 
2504
2508
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2505
2509
 
@@ -5362,6 +5366,32 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5362
5366
  }, z.core.$strict>;
5363
5367
  }, z.core.$strict>>;
5364
5368
  kayAgentUriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5369
+ screenActions: z.ZodExactOptional<z.ZodObject<{
5370
+ scheme: z.ZodString;
5371
+ hosts: z.ZodArray<z.ZodString>;
5372
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
5373
+ apps: z.ZodArray<z.ZodString>;
5374
+ options: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
5375
+ kind: z.ZodLiteral<"exact">;
5376
+ description: z.ZodString;
5377
+ verb: z.ZodEnum<{
5378
+ read: "read";
5379
+ write: "write";
5380
+ edit: "edit";
5381
+ delete: "delete";
5382
+ }>;
5383
+ uri: z.ZodString;
5384
+ }, z.core.$strict>, z.ZodObject<{
5385
+ kind: z.ZodLiteral<"catch-all">;
5386
+ description: z.ZodString;
5387
+ verb: z.ZodEnum<{
5388
+ read: "read";
5389
+ write: "write";
5390
+ edit: "edit";
5391
+ delete: "delete";
5392
+ }>;
5393
+ }, z.core.$strict>], "kind">>;
5394
+ }, z.core.$strict>>;
5365
5395
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
5366
5396
  kind: z.ZodLiteral<"scheme">;
5367
5397
  scheme: z.ZodString;
@@ -5398,27 +5428,27 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5398
5428
  list: "list";
5399
5429
  read: "read";
5400
5430
  write: "write";
5401
- help: "help";
5402
5431
  edit: "edit";
5403
5432
  delete: "delete";
5433
+ help: "help";
5404
5434
  }>>>;
5405
5435
  operationDocs: z.ZodExactOptional<z.ZodRecord<z.ZodEnum<{
5406
5436
  search: "search";
5407
5437
  list: "list";
5408
5438
  read: "read";
5409
5439
  write: "write";
5410
- help: "help";
5411
5440
  edit: "edit";
5412
5441
  delete: "delete";
5442
+ help: "help";
5413
5443
  }> & z.core.$partial, z.ZodString>>;
5414
5444
  operationDefaults: z.ZodExactOptional<z.ZodRecord<z.ZodEnum<{
5415
5445
  search: "search";
5416
5446
  list: "list";
5417
5447
  read: "read";
5418
5448
  write: "write";
5419
- help: "help";
5420
5449
  edit: "edit";
5421
5450
  delete: "delete";
5451
+ help: "help";
5422
5452
  }> & z.core.$partial, z.ZodEnum<{
5423
5453
  never: "never";
5424
5454
  allow: "allow";
@@ -5480,9 +5510,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5480
5510
  list: "list";
5481
5511
  read: "read";
5482
5512
  write: "write";
5483
- help: "help";
5484
5513
  edit: "edit";
5485
5514
  delete: "delete";
5515
+ help: "help";
5486
5516
  }>>>;
5487
5517
  routes: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
5488
5518
  query: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -5493,9 +5523,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5493
5523
  list: "list";
5494
5524
  read: "read";
5495
5525
  write: "write";
5496
- help: "help";
5497
5526
  edit: "edit";
5498
5527
  delete: "delete";
5528
+ help: "help";
5499
5529
  }>>>;
5500
5530
  routes: z.ZodExactOptional<z.ZodArray<z.ZodString>>;
5501
5531
  query: z.ZodExactOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -5584,15 +5614,80 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5584
5614
  scheme: z.ZodOptional<z.ZodString>;
5585
5615
  resourcePrefix: z.ZodOptional<z.ZodString>;
5586
5616
  resourceArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
5617
+ resourceTrim: z.ZodOptional<z.ZodLiteral<true>>;
5618
+ defaultPermission: z.ZodOptional<z.ZodEnum<{
5619
+ never: "never";
5620
+ allow: "allow";
5621
+ ask: "ask";
5622
+ }>>;
5623
+ classificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5624
+ when: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
5625
+ arg: z.ZodString;
5626
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
5627
+ }, z.core.$strict>, z.ZodObject<{
5628
+ arg: z.ZodString;
5629
+ present: z.ZodBoolean;
5630
+ }, z.core.$strict>]>>;
5631
+ kind: z.ZodEnum<{
5632
+ read: "read";
5633
+ mutate: "mutate";
5634
+ destructive: "destructive";
5635
+ execute: "execute";
5636
+ }>;
5637
+ ruleKey: z.ZodOptional<z.ZodString>;
5638
+ }, z.core.$strict>>>;
5587
5639
  }, z.core.$strict>>;
5588
5640
  localId: z.ZodString;
5589
5641
  globalId: z.ZodString;
5590
5642
  toolName: z.ZodString;
5591
5643
  }, z.core.$strict>>>;
5592
5644
  kayAppTools: z.ZodOptional<z.ZodArray<z.ZodObject<{
5645
+ description: z.ZodOptional<z.ZodString>;
5593
5646
  localId: z.ZodString;
5594
- globalId: z.ZodString;
5647
+ displayName: z.ZodOptional<z.ZodString>;
5595
5648
  toolName: z.ZodString;
5649
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5650
+ executionMode: z.ZodOptional<z.ZodEnum<{
5651
+ sequential: "sequential";
5652
+ parallel: "parallel";
5653
+ }>>;
5654
+ promptSnippet: z.ZodOptional<z.ZodString>;
5655
+ promptGuidelines: z.ZodOptional<z.ZodArray<z.ZodString>>;
5656
+ permission: z.ZodOptional<z.ZodObject<{
5657
+ kind: z.ZodEnum<{
5658
+ read: "read";
5659
+ mutate: "mutate";
5660
+ destructive: "destructive";
5661
+ execute: "execute";
5662
+ }>;
5663
+ ruleKey: z.ZodOptional<z.ZodString>;
5664
+ scheme: z.ZodOptional<z.ZodString>;
5665
+ resourcePrefix: z.ZodOptional<z.ZodString>;
5666
+ resourceArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
5667
+ resourceTrim: z.ZodOptional<z.ZodLiteral<true>>;
5668
+ defaultPermission: z.ZodOptional<z.ZodEnum<{
5669
+ never: "never";
5670
+ allow: "allow";
5671
+ ask: "ask";
5672
+ }>>;
5673
+ classificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5674
+ when: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
5675
+ arg: z.ZodString;
5676
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
5677
+ }, z.core.$strict>, z.ZodObject<{
5678
+ arg: z.ZodString;
5679
+ present: z.ZodBoolean;
5680
+ }, z.core.$strict>]>>;
5681
+ kind: z.ZodEnum<{
5682
+ read: "read";
5683
+ mutate: "mutate";
5684
+ destructive: "destructive";
5685
+ execute: "execute";
5686
+ }>;
5687
+ ruleKey: z.ZodOptional<z.ZodString>;
5688
+ }, z.core.$strict>>>;
5689
+ }, z.core.$strict>>;
5690
+ globalId: z.ZodString;
5596
5691
  }, z.core.$strict>>>;
5597
5692
  kayAppApprovalTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
5598
5693
  kind: z.ZodLiteral<"message">;
@@ -5917,6 +6012,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5917
6012
  host: z.ZodOptional<z.ZodArray<z.ZodEnum<{
5918
6013
  "navigation.open-session": "navigation.open-session";
5919
6014
  "sessions.create": "sessions.create";
6015
+ "models.complete": "models.complete";
5920
6016
  "artifacts.read": "artifacts.read";
5921
6017
  "artifacts.preview": "artifacts.preview";
5922
6018
  "markdown.document-view": "markdown.document-view";
@@ -123,16 +123,31 @@ function createKayPluginLog(write, bound = {}) {
123
123
  }
124
124
 
125
125
  // packages/plugin-sdk/dist/kay-agent/declared-tool.js
126
- function permissionHint(permission) {
127
- const { kind, ruleKey, resourceArgs, scheme, resourcePrefix } = permission;
126
+ function declaredToolPermission(permission) {
127
+ const { kind, ruleKey, resourceArgs, scheme, resourcePrefix, resourceTrim, defaultPermission, classificationRules } = permission;
128
128
  return {
129
129
  kind,
130
130
  ...scheme === void 0 ? {} : { scheme },
131
131
  ...ruleKey === void 0 ? {} : { ruleKey },
132
+ ...defaultPermission === void 0 ? {} : { defaultPermission },
133
+ ...classificationRules === void 0 ? {} : {
134
+ deriveClassification: (input) => {
135
+ const rule = classificationRules.find((candidate) => candidate.when.every((condition) => {
136
+ const value = Object.hasOwn(input, condition.arg) ? input[condition.arg] : void 0;
137
+ return "equals" in condition ? value === condition.equals : value !== void 0 === condition.present;
138
+ }));
139
+ return rule === void 0 ? void 0 : {
140
+ kind: rule.kind,
141
+ ...rule.ruleKey === void 0 ? {} : { ruleKey: rule.ruleKey }
142
+ };
143
+ }
144
+ },
132
145
  ...resourceArgs === void 0 ? {} : {
133
146
  deriveResources: (input) => resourceArgs.flatMap((arg) => {
134
147
  const value = input[arg];
135
- return typeof value === "string" ? [`${resourcePrefix ?? ""}${value}`] : [];
148
+ return typeof value === "string" ? [
149
+ `${resourcePrefix ?? ""}${resourceTrim === true ? value.trim() : value}`
150
+ ] : [];
136
151
  })
137
152
  }
138
153
  };
@@ -156,7 +171,7 @@ function declaredToolDefinition(tool, execute) {
156
171
  ...requiresAuth.schemeId === void 0 ? {} : { schemeId: requiresAuth.schemeId }
157
172
  }
158
173
  },
159
- ...permission === void 0 ? {} : { permission: permissionHint(permission) },
174
+ ...permission === void 0 ? {} : { permission: declaredToolPermission(permission) },
160
175
  execute
161
176
  };
162
177
  }
@@ -2773,8 +2773,12 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2773
2773
  * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2774
2774
  *
2775
2775
  * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2776
+ *
2777
+ * 0.48.0 adds the models.complete UI capability.
2778
+ *
2779
+ * 0.48.1 adds app-tool metadata, conditional tool permissions and screen-action declarations.
2776
2780
  */
2777
- declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2781
+ declare const KAY_PLUGIN_SDK_VERSION: "0.48.1";
2778
2782
 
2779
2783
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2780
2784
 
package/dist/kay-app.d.ts CHANGED
@@ -1139,6 +1139,9 @@ declare interface Decision<Q extends DecideQuestions = DecideQuestions> {
1139
1139
  readonly usage?: SystemOneTokenUsage;
1140
1140
  }
1141
1141
 
1142
+ /** Builds an app tool from manifest facts, retaining its execution, availability and preview callbacks. */
1143
+ export declare function declaredAppToolDefinition(tool: ToolContribution, implementation: KayAppToolImplementation): KayAppToolDefinition;
1144
+
1142
1145
  /** Createsa uni-directional Codec with Decode only. The Decode function is called on Value.Decode */
1143
1146
  declare function Decode<Type extends TSchema, Callback extends TDecodeCallback<StaticDecode<Type>, unknown>>(type: Type, callback: Callback): TCodec<Type, ReturnType<Callback>>;
1144
1147
 
@@ -2880,8 +2883,12 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2880
2883
  * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2881
2884
  *
2882
2885
  * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2886
+ *
2887
+ * 0.48.0 adds the models.complete UI capability.
2888
+ *
2889
+ * 0.48.1 adds app-tool metadata, conditional tool permissions and screen-action declarations.
2883
2890
  */
2884
- declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2891
+ declare const KAY_PLUGIN_SDK_VERSION: "0.48.1";
2885
2892
 
2886
2893
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2887
2894
 
@@ -7860,6 +7867,10 @@ export declare interface KayAppToolEvents {
7860
7867
  subscribe(handler: (event: unknown) => void): () => void;
7861
7868
  }
7862
7869
 
7870
+ export declare type KayAppToolImplementation = Omit<KayAppToolDefinition, "label" | "description" | "parameters" | "permission" | "executionMode" | "promptSnippet" | "promptGuidelines"> & {
7871
+ readonly permission?: Pick<ToolPermissionHint, "describePreview">;
7872
+ };
7873
+
7863
7874
  /** Where a described tool or address comes from. */
7864
7875
  export declare type KayAppToolOrigin =
7865
7876
  /** The agent kernel's own (`bash`, `read`, `help`, `skill://`). */
@@ -14198,6 +14209,56 @@ declare interface ToolContext {
14198
14209
  readonly paths?: ExtensionPaths;
14199
14210
  }
14200
14211
 
14212
+ export declare const ToolContribution: z.ZodObject<{
14213
+ parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
14214
+ executionMode: z.ZodOptional<z.ZodEnum<{
14215
+ sequential: "sequential";
14216
+ parallel: "parallel";
14217
+ }>>;
14218
+ promptSnippet: z.ZodOptional<z.ZodString>;
14219
+ promptGuidelines: z.ZodOptional<z.ZodArray<z.ZodString>>;
14220
+ permission: z.ZodOptional<z.ZodObject<{
14221
+ kind: z.ZodEnum<{
14222
+ read: "read";
14223
+ mutate: "mutate";
14224
+ destructive: "destructive";
14225
+ execute: "execute";
14226
+ }>;
14227
+ ruleKey: z.ZodOptional<z.ZodString>;
14228
+ scheme: z.ZodOptional<z.ZodString>;
14229
+ resourcePrefix: z.ZodOptional<z.ZodString>;
14230
+ resourceArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
14231
+ resourceTrim: z.ZodOptional<z.ZodLiteral<true>>;
14232
+ defaultPermission: z.ZodOptional<z.ZodEnum<{
14233
+ never: "never";
14234
+ allow: "allow";
14235
+ ask: "ask";
14236
+ }>>;
14237
+ classificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
14238
+ when: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
14239
+ arg: z.ZodString;
14240
+ equals: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
14241
+ }, z.core.$strict>, z.ZodObject<{
14242
+ arg: z.ZodString;
14243
+ present: z.ZodBoolean;
14244
+ }, z.core.$strict>]>>;
14245
+ kind: z.ZodEnum<{
14246
+ read: "read";
14247
+ mutate: "mutate";
14248
+ destructive: "destructive";
14249
+ execute: "execute";
14250
+ }>;
14251
+ ruleKey: z.ZodOptional<z.ZodString>;
14252
+ }, z.core.$strict>>>;
14253
+ }, z.core.$strict>>;
14254
+ localId: z.ZodString;
14255
+ toolName: z.ZodString;
14256
+ displayName: z.ZodOptional<z.ZodString>;
14257
+ description: z.ZodOptional<z.ZodString>;
14258
+ }, z.core.$strict>;
14259
+
14260
+ export declare type ToolContribution = z.infer<typeof ToolContribution>;
14261
+
14201
14262
  export declare interface ToolDefinition<TParams extends ToolParametersWire = ToolParametersWire, TDetails = unknown> {
14202
14263
  /** Tool name (used in LLM tool calls) */
14203
14264
  name: string;
package/dist/kay-app.js CHANGED
@@ -880,6 +880,60 @@ function refusedCountOf(error) {
880
880
  return typeof count === "number" && Number.isSafeInteger(count) && count > 0 ? count : 1;
881
881
  }
882
882
 
883
+ // packages/plugin-sdk/dist/kay-agent/declared-tool.js
884
+ function declaredToolPermission(permission) {
885
+ const { kind, ruleKey, resourceArgs, scheme, resourcePrefix, resourceTrim, defaultPermission, classificationRules } = permission;
886
+ return {
887
+ kind,
888
+ ...scheme === void 0 ? {} : { scheme },
889
+ ...ruleKey === void 0 ? {} : { ruleKey },
890
+ ...defaultPermission === void 0 ? {} : { defaultPermission },
891
+ ...classificationRules === void 0 ? {} : {
892
+ deriveClassification: (input) => {
893
+ const rule = classificationRules.find((candidate) => candidate.when.every((condition) => {
894
+ const value = Object.hasOwn(input, condition.arg) ? input[condition.arg] : void 0;
895
+ return "equals" in condition ? value === condition.equals : value !== void 0 === condition.present;
896
+ }));
897
+ return rule === void 0 ? void 0 : {
898
+ kind: rule.kind,
899
+ ...rule.ruleKey === void 0 ? {} : { ruleKey: rule.ruleKey }
900
+ };
901
+ }
902
+ },
903
+ ...resourceArgs === void 0 ? {} : {
904
+ deriveResources: (input) => resourceArgs.flatMap((arg) => {
905
+ const value = input[arg];
906
+ return typeof value === "string" ? [
907
+ `${resourcePrefix ?? ""}${resourceTrim === true ? value.trim() : value}`
908
+ ] : [];
909
+ })
910
+ }
911
+ };
912
+ }
913
+
914
+ // packages/plugin-sdk/dist/kay-app/declared-tool.js
915
+ function declaredAppToolDefinition(tool, implementation) {
916
+ if (tool.parameters === void 0 || tool.description === void 0) {
917
+ throw new Error(`Tool '${tool.toolName}' declares no parameters or description.`);
918
+ }
919
+ const { permission: preview, label: _label, description: _description, parameters: _parameters, executionMode: _executionMode, promptSnippet: _promptSnippet, promptGuidelines: _promptGuidelines, ...callbacks } = implementation;
920
+ return {
921
+ ...callbacks,
922
+ label: tool.displayName ?? tool.toolName,
923
+ description: tool.description,
924
+ parameters: tool.parameters,
925
+ ...tool.executionMode === void 0 ? {} : { executionMode: tool.executionMode },
926
+ ...tool.promptSnippet === void 0 ? {} : { promptSnippet: tool.promptSnippet },
927
+ ...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines },
928
+ ...tool.permission === void 0 ? {} : {
929
+ permission: {
930
+ ...declaredToolPermission(tool.permission),
931
+ ...preview?.describePreview === void 0 ? {} : { describePreview: preview.describePreview }
932
+ }
933
+ }
934
+ };
935
+ }
936
+
883
937
  // packages/plugin-sdk/dist/kay-app/sealing.js
884
938
  var KAY_APP_SEALING_MAX_BYTES = 1048576;
885
939
  function createUnavailableSealing(message) {
@@ -1031,6 +1085,7 @@ export {
1031
1085
  createUnavailableSkills,
1032
1086
  createUnavailableTools,
1033
1087
  createUnavailableUsage,
1088
+ declaredAppToolDefinition,
1034
1089
  definePoller,
1035
1090
  failedRunCause,
1036
1091
  invalidObservation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.47.0",
3
+ "version": "0.48.1",
4
4
  "description": "The Kay plugin SDK — types and helpers for authoring a Kay directory plugin.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",