@yaklabs-ai/plugin-sdk 0.42.0 → 0.43.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.42.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.43.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.42.0" },
65
+ "compatibility": { "sdk": "^0.43.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.42.0",
4
+ "version": "0.43.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -2421,8 +2421,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2421
2421
  * 0.42.0 hands background work the shared ResolvedCredential in auth.credential. Workflow
2422
2422
  * accounts carry auth resolution outcomes, and Poller callbacks receive only the credential.
2423
2423
  * Older SDK ranges are refused because their background success shape is no longer served.
2424
+ *
2425
+ * 0.42.1 adds current-session tool lifetimes and invocation-bound artifact reads/new outputs,
2426
+ * plus described-tool execution, guidance and permission resource metadata.
2427
+ *
2428
+ * 0.43.0 adds product events (#15769). `productEvents` in a plugin's `kay.app` target declares them,
2429
+ * and `app.productEvents.send` sends them. Additive: a plugin that declares one declares ^0.43.0.
2424
2430
  */
2425
- declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
2431
+ declare const KAY_PLUGIN_SDK_VERSION: "0.43.0";
2426
2432
 
2427
2433
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2428
2434
 
@@ -2871,8 +2877,42 @@ declare interface KayAgentProcessRunResult {
2871
2877
  readonly stderrTruncated?: boolean;
2872
2878
  }
2873
2879
 
2880
+ /** A loaded session's volatile lifetime. Reopening a released session gets a fresh key. */
2881
+ declare interface KayAgentSession {
2882
+ readonly key: string;
2883
+ /** Registers synchronous cleanup, invoked once on release. Returns an unregister function. */
2884
+ onDispose(disposer: () => void): () => void;
2885
+ /** Valid only while this tool call is active. */
2886
+ readonly artifacts: KayAgentSessionArtifacts;
2887
+ }
2888
+
2889
+ /** Metadata returned by a current-session artifact operation; no filesystem authority. */
2890
+ declare interface KayAgentSessionArtifact {
2891
+ readonly uri: string;
2892
+ readonly name: string;
2893
+ readonly mimeType?: string;
2894
+ }
2895
+
2896
+ /** Current-session file access, authorized at each call; never retained between tool calls. */
2897
+ declare interface KayAgentSessionArtifacts {
2898
+ readBytes(input: {
2899
+ readonly uri: string;
2900
+ readonly maxBytes?: number;
2901
+ }): Promise<KayAgentSessionArtifact & {
2902
+ readonly bytes: Uint8Array;
2903
+ }>;
2904
+ publishNew(input: {
2905
+ readonly name: string;
2906
+ readonly bytes: Uint8Array;
2907
+ }): Promise<KayAgentSessionArtifact>;
2908
+ }
2909
+
2910
+ declare type KayAgentToolContext = Parameters<ToolDefinition["execute"]>[4] & {
2911
+ readonly session?: KayAgentSession;
2912
+ };
2913
+
2874
2914
  /** The `execute` a plugin supplies for a tool its manifest describes. */
2875
- declare type KayAgentToolExecute = ToolDefinition["execute"];
2915
+ declare type KayAgentToolExecute = (toolCallId: string, params: Parameters<ToolDefinition["execute"]>[1], signal: AbortSignal | undefined, onUpdate: Parameters<ToolDefinition["execute"]>[3], ctx: KayAgentToolContext) => ReturnType<ToolDefinition["execute"]>;
2876
2916
 
2877
2917
  /**
2878
2918
  * Calls tools on the plugin's own vendored MCP servers. See {@link KayAgentPluginApi.vendoredMcp}.
@@ -3089,13 +3129,14 @@ declare interface KayAppUserFileEntry {
3089
3129
  * The plugin-facing user-files contract: file I/O in folders the user owns, done by the host on
3090
3130
  * its own worker threads.
3091
3131
  *
3092
- * Ungated and always present, like `app.paths`. It confers no authority: a plugin runs in the
3093
- * daemon's process and can call `node:fs` itself. What the door adds is where the work runs. A
3094
- * `node:fs` sync call blocks the daemon's event loop for as long as the path takes to answer,
3095
- * which under a macOS-protected folder or on a drive that stopped answering can be a very long
3096
- * time (kay#11575); an async one holds a thread of the pool the whole daemon shares. The host runs
3097
- * each request on a dedicated worker, gives it a deadline, and answers a typed result instead of
3098
- * throwing.
3132
+ * Ungated and always present, like `app.paths`. It confers no authority: the process a plugin
3133
+ * runs in, the daemon or the plugin host, could call `node:fs` itself. What the door adds is where
3134
+ * the work runs. A `node:fs` sync call blocks that process's event loop for as long as the path
3135
+ * takes to answer, which under a macOS-protected folder or on a drive that stopped answering can
3136
+ * be a very long time (kay#11575); an async one holds a thread of the pool the whole process
3137
+ * shares. The daemon's user-files service runs each request on a dedicated worker, gives it a
3138
+ * deadline, and answers a typed result instead of throwing. A plugin in the plugin host reaches
3139
+ * the same service: each call is sent to the daemon and answered from there.
3099
3140
  *
3100
3141
  * This is a leaf module. It lives beside both target SDKs, like `time.ts`, so the `kay.agent` SDK
3101
3142
  * exposes the same door without importing the `kay.app` surface.
@@ -3136,7 +3177,12 @@ declare interface KayAppUserFiles {
3136
3177
  }
3137
3178
 
3138
3179
  declare interface KayAppUserFilesCallOptions {
3139
- /** Deadline in milliseconds from the call, waiting included. Default 5000, at most 60000. */
3180
+ /**
3181
+ * Deadline in milliseconds, waiting included. Default 5000, at most 60000. It starts when the
3182
+ * daemon's user-files service receives the request: from the call in the daemon, or, for a
3183
+ * plugin in the plugin host, once the request has crossed to the daemon. A daemon that never
3184
+ * reads the request leaves the call waiting until the host's connection to it is closed.
3185
+ */
3140
3186
  readonly timeoutMs?: number;
3141
3187
  readonly signal?: AbortSignal;
3142
3188
  }
@@ -1629,7 +1629,7 @@ declare class InvalidLiteralValue extends Error {
1629
1629
  * `ctx` (with a `credential` for an auth-gated tool) to exercise anything beyond the
1630
1630
  * happy-path default.
1631
1631
  */
1632
- export declare function invokeToolForTest<TDetails = unknown>(tool: ToolDefinition<any, TDetails>, params: Record<string, unknown>, ctx?: ToolContext): Promise<AgentToolResult<TDetails>>;
1632
+ export declare function invokeToolForTest<TDetails = unknown>(tool: ToolDefinition<any, TDetails>, params: Record<string, unknown>, ctx?: KayAgentToolContext): Promise<AgentToolResult<TDetails>>;
1633
1633
 
1634
1634
  /** Returns true if the given value is a TAny. */
1635
1635
  declare function IsAny(value: unknown): value is TAny;
@@ -2475,8 +2475,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2475
2475
  * 0.42.0 hands background work the shared ResolvedCredential in auth.credential. Workflow
2476
2476
  * accounts carry auth resolution outcomes, and Poller callbacks receive only the credential.
2477
2477
  * Older SDK ranges are refused because their background success shape is no longer served.
2478
+ *
2479
+ * 0.42.1 adds current-session tool lifetimes and invocation-bound artifact reads/new outputs,
2480
+ * plus described-tool execution, guidance and permission resource metadata.
2481
+ *
2482
+ * 0.43.0 adds product events (#15769). `productEvents` in a plugin's `kay.app` target declares them,
2483
+ * and `app.productEvents.send` sends them. Additive: a plugin that declares one declares ^0.43.0.
2478
2484
  */
2479
- declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
2485
+ declare const KAY_PLUGIN_SDK_VERSION: "0.43.0";
2480
2486
 
2481
2487
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2482
2488
 
@@ -2922,8 +2928,42 @@ declare interface KayAgentProcessRunResult {
2922
2928
  readonly stderrTruncated?: boolean;
2923
2929
  }
2924
2930
 
2931
+ /** A loaded session's volatile lifetime. Reopening a released session gets a fresh key. */
2932
+ declare interface KayAgentSession {
2933
+ readonly key: string;
2934
+ /** Registers synchronous cleanup, invoked once on release. Returns an unregister function. */
2935
+ onDispose(disposer: () => void): () => void;
2936
+ /** Valid only while this tool call is active. */
2937
+ readonly artifacts: KayAgentSessionArtifacts;
2938
+ }
2939
+
2940
+ /** Metadata returned by a current-session artifact operation; no filesystem authority. */
2941
+ declare interface KayAgentSessionArtifact {
2942
+ readonly uri: string;
2943
+ readonly name: string;
2944
+ readonly mimeType?: string;
2945
+ }
2946
+
2947
+ /** Current-session file access, authorized at each call; never retained between tool calls. */
2948
+ declare interface KayAgentSessionArtifacts {
2949
+ readBytes(input: {
2950
+ readonly uri: string;
2951
+ readonly maxBytes?: number;
2952
+ }): Promise<KayAgentSessionArtifact & {
2953
+ readonly bytes: Uint8Array;
2954
+ }>;
2955
+ publishNew(input: {
2956
+ readonly name: string;
2957
+ readonly bytes: Uint8Array;
2958
+ }): Promise<KayAgentSessionArtifact>;
2959
+ }
2960
+
2961
+ declare type KayAgentToolContext = Parameters<ToolDefinition["execute"]>[4] & {
2962
+ readonly session?: KayAgentSession;
2963
+ };
2964
+
2925
2965
  /** The `execute` a plugin supplies for a tool its manifest describes. */
2926
- declare type KayAgentToolExecute = ToolDefinition["execute"];
2966
+ declare type KayAgentToolExecute = (toolCallId: string, params: Parameters<ToolDefinition["execute"]>[1], signal: AbortSignal | undefined, onUpdate: Parameters<ToolDefinition["execute"]>[3], ctx: KayAgentToolContext) => ReturnType<ToolDefinition["execute"]>;
2927
2967
 
2928
2968
  /**
2929
2969
  * Calls tools on the plugin's own vendored MCP servers. See {@link KayAgentPluginApi.vendoredMcp}.
@@ -3140,13 +3180,14 @@ declare interface KayAppUserFileEntry {
3140
3180
  * The plugin-facing user-files contract: file I/O in folders the user owns, done by the host on
3141
3181
  * its own worker threads.
3142
3182
  *
3143
- * Ungated and always present, like `app.paths`. It confers no authority: a plugin runs in the
3144
- * daemon's process and can call `node:fs` itself. What the door adds is where the work runs. A
3145
- * `node:fs` sync call blocks the daemon's event loop for as long as the path takes to answer,
3146
- * which under a macOS-protected folder or on a drive that stopped answering can be a very long
3147
- * time (kay#11575); an async one holds a thread of the pool the whole daemon shares. The host runs
3148
- * each request on a dedicated worker, gives it a deadline, and answers a typed result instead of
3149
- * throwing.
3183
+ * Ungated and always present, like `app.paths`. It confers no authority: the process a plugin
3184
+ * runs in, the daemon or the plugin host, could call `node:fs` itself. What the door adds is where
3185
+ * the work runs. A `node:fs` sync call blocks that process's event loop for as long as the path
3186
+ * takes to answer, which under a macOS-protected folder or on a drive that stopped answering can
3187
+ * be a very long time (kay#11575); an async one holds a thread of the pool the whole process
3188
+ * shares. The daemon's user-files service runs each request on a dedicated worker, gives it a
3189
+ * deadline, and answers a typed result instead of throwing. A plugin in the plugin host reaches
3190
+ * the same service: each call is sent to the daemon and answered from there.
3150
3191
  *
3151
3192
  * This is a leaf module. It lives beside both target SDKs, like `time.ts`, so the `kay.agent` SDK
3152
3193
  * exposes the same door without importing the `kay.app` surface.
@@ -3187,7 +3228,12 @@ declare interface KayAppUserFiles {
3187
3228
  }
3188
3229
 
3189
3230
  declare interface KayAppUserFilesCallOptions {
3190
- /** Deadline in milliseconds from the call, waiting included. Default 5000, at most 60000. */
3231
+ /**
3232
+ * Deadline in milliseconds, waiting included. Default 5000, at most 60000. It starts when the
3233
+ * daemon's user-files service receives the request: from the call in the daemon, or, for a
3234
+ * plugin in the plugin host, once the request has crossed to the daemon. A daemon that never
3235
+ * reads the request leaves the call waiting until the host's connection to it is closed.
3236
+ */
3191
3237
  readonly timeoutMs?: number;
3192
3238
  readonly signal?: AbortSignal;
3193
3239
  }
@@ -5499,6 +5545,12 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5499
5545
  displayName: z.ZodOptional<z.ZodString>;
5500
5546
  description: z.ZodOptional<z.ZodString>;
5501
5547
  parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5548
+ executionMode: z.ZodOptional<z.ZodEnum<{
5549
+ sequential: "sequential";
5550
+ parallel: "parallel";
5551
+ }>>;
5552
+ promptSnippet: z.ZodOptional<z.ZodString>;
5553
+ promptGuidelines: z.ZodOptional<z.ZodArray<z.ZodString>>;
5502
5554
  requiresAuth: z.ZodOptional<z.ZodObject<{
5503
5555
  serviceId: z.ZodString;
5504
5556
  schemeId: z.ZodOptional<z.ZodString>;
@@ -5511,6 +5563,8 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5511
5563
  execute: "execute";
5512
5564
  }>;
5513
5565
  ruleKey: z.ZodOptional<z.ZodString>;
5566
+ scheme: z.ZodOptional<z.ZodString>;
5567
+ resourcePrefix: z.ZodOptional<z.ZodString>;
5514
5568
  resourceArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
5515
5569
  }, z.core.$strict>>;
5516
5570
  localId: z.ZodString;
@@ -124,14 +124,15 @@ function createKayPluginLog(write, bound = {}) {
124
124
 
125
125
  // packages/plugin-sdk/dist/kay-agent/declared-tool.js
126
126
  function permissionHint(permission) {
127
- const { kind, ruleKey, resourceArgs } = permission;
127
+ const { kind, ruleKey, resourceArgs, scheme, resourcePrefix } = permission;
128
128
  return {
129
129
  kind,
130
+ ...scheme === void 0 ? {} : { scheme },
130
131
  ...ruleKey === void 0 ? {} : { ruleKey },
131
132
  ...resourceArgs === void 0 ? {} : {
132
133
  deriveResources: (input) => resourceArgs.flatMap((arg) => {
133
134
  const value = input[arg];
134
- return typeof value === "string" ? [value] : [];
135
+ return typeof value === "string" ? [`${resourcePrefix ?? ""}${value}`] : [];
135
136
  })
136
137
  }
137
138
  };
@@ -146,6 +147,9 @@ function declaredToolDefinition(tool, execute) {
146
147
  label: tool.displayName ?? tool.toolName,
147
148
  description,
148
149
  parameters,
150
+ ...tool.executionMode === void 0 ? {} : { executionMode: tool.executionMode },
151
+ ...tool.promptSnippet === void 0 ? {} : { promptSnippet: tool.promptSnippet },
152
+ ...tool.promptGuidelines === void 0 ? {} : { promptGuidelines: tool.promptGuidelines },
149
153
  ...requiresAuth === void 0 ? {} : {
150
154
  requiresAuth: {
151
155
  serviceId: requiresAuth.serviceId,
@@ -2750,8 +2750,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2750
2750
  * 0.42.0 hands background work the shared ResolvedCredential in auth.credential. Workflow
2751
2751
  * accounts carry auth resolution outcomes, and Poller callbacks receive only the credential.
2752
2752
  * Older SDK ranges are refused because their background success shape is no longer served.
2753
+ *
2754
+ * 0.42.1 adds current-session tool lifetimes and invocation-bound artifact reads/new outputs,
2755
+ * plus described-tool execution, guidance and permission resource metadata.
2756
+ *
2757
+ * 0.43.0 adds product events (#15769). `productEvents` in a plugin's `kay.app` target declares them,
2758
+ * and `app.productEvents.send` sends them. Additive: a plugin that declares one declares ^0.43.0.
2753
2759
  */
2754
- declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
2760
+ declare const KAY_PLUGIN_SDK_VERSION: "0.43.0";
2755
2761
 
2756
2762
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2757
2763
 
@@ -3229,8 +3235,42 @@ export declare interface KayAgentProcessRunResult {
3229
3235
  readonly stderrTruncated?: boolean;
3230
3236
  }
3231
3237
 
3238
+ /** A loaded session's volatile lifetime. Reopening a released session gets a fresh key. */
3239
+ export declare interface KayAgentSession {
3240
+ readonly key: string;
3241
+ /** Registers synchronous cleanup, invoked once on release. Returns an unregister function. */
3242
+ onDispose(disposer: () => void): () => void;
3243
+ /** Valid only while this tool call is active. */
3244
+ readonly artifacts: KayAgentSessionArtifacts;
3245
+ }
3246
+
3247
+ /** Metadata returned by a current-session artifact operation; no filesystem authority. */
3248
+ export declare interface KayAgentSessionArtifact {
3249
+ readonly uri: string;
3250
+ readonly name: string;
3251
+ readonly mimeType?: string;
3252
+ }
3253
+
3254
+ /** Current-session file access, authorized at each call; never retained between tool calls. */
3255
+ export declare interface KayAgentSessionArtifacts {
3256
+ readBytes(input: {
3257
+ readonly uri: string;
3258
+ readonly maxBytes?: number;
3259
+ }): Promise<KayAgentSessionArtifact & {
3260
+ readonly bytes: Uint8Array;
3261
+ }>;
3262
+ publishNew(input: {
3263
+ readonly name: string;
3264
+ readonly bytes: Uint8Array;
3265
+ }): Promise<KayAgentSessionArtifact>;
3266
+ }
3267
+
3268
+ export declare type KayAgentToolContext = Parameters<ToolDefinition["execute"]>[4] & {
3269
+ readonly session?: KayAgentSession;
3270
+ };
3271
+
3232
3272
  /** The `execute` a plugin supplies for a tool its manifest describes. */
3233
- export declare type KayAgentToolExecute = ToolDefinition["execute"];
3273
+ export declare type KayAgentToolExecute = (toolCallId: string, params: Parameters<ToolDefinition["execute"]>[1], signal: AbortSignal | undefined, onUpdate: Parameters<ToolDefinition["execute"]>[3], ctx: KayAgentToolContext) => ReturnType<ToolDefinition["execute"]>;
3234
3274
 
3235
3275
  /**
3236
3276
  * The facts a plugin declares about a URI module in its manifest (`contributes.uriModules[]`), so
@@ -3465,13 +3505,14 @@ export declare interface KayAppUserFileEntry {
3465
3505
  * The plugin-facing user-files contract: file I/O in folders the user owns, done by the host on
3466
3506
  * its own worker threads.
3467
3507
  *
3468
- * Ungated and always present, like `app.paths`. It confers no authority: a plugin runs in the
3469
- * daemon's process and can call `node:fs` itself. What the door adds is where the work runs. A
3470
- * `node:fs` sync call blocks the daemon's event loop for as long as the path takes to answer,
3471
- * which under a macOS-protected folder or on a drive that stopped answering can be a very long
3472
- * time (kay#11575); an async one holds a thread of the pool the whole daemon shares. The host runs
3473
- * each request on a dedicated worker, gives it a deadline, and answers a typed result instead of
3474
- * throwing.
3508
+ * Ungated and always present, like `app.paths`. It confers no authority: the process a plugin
3509
+ * runs in, the daemon or the plugin host, could call `node:fs` itself. What the door adds is where
3510
+ * the work runs. A `node:fs` sync call blocks that process's event loop for as long as the path
3511
+ * takes to answer, which under a macOS-protected folder or on a drive that stopped answering can
3512
+ * be a very long time (kay#11575); an async one holds a thread of the pool the whole process
3513
+ * shares. The daemon's user-files service runs each request on a dedicated worker, gives it a
3514
+ * deadline, and answers a typed result instead of throwing. A plugin in the plugin host reaches
3515
+ * the same service: each call is sent to the daemon and answered from there.
3475
3516
  *
3476
3517
  * This is a leaf module. It lives beside both target SDKs, like `time.ts`, so the `kay.agent` SDK
3477
3518
  * exposes the same door without importing the `kay.app` surface.
@@ -3512,7 +3553,12 @@ export declare interface KayAppUserFiles {
3512
3553
  }
3513
3554
 
3514
3555
  export declare interface KayAppUserFilesCallOptions {
3515
- /** Deadline in milliseconds from the call, waiting included. Default 5000, at most 60000. */
3556
+ /**
3557
+ * Deadline in milliseconds, waiting included. Default 5000, at most 60000. It starts when the
3558
+ * daemon's user-files service receives the request: from the call in the daemon, or, for a
3559
+ * plugin in the plugin host, once the request has crossed to the daemon. A daemon that never
3560
+ * reads the request leaves the call waiting until the host's connection to it is closed.
3561
+ */
3516
3562
  readonly timeoutMs?: number;
3517
3563
  readonly signal?: AbortSignal;
3518
3564
  }
@@ -5133,6 +5179,21 @@ declare const PluginCapabilityRefusalV1: z.ZodObject<{
5133
5179
  envelope: z.ZodObject<{
5134
5180
  source: z.ZodString;
5135
5181
  }, z.core.$strict>;
5182
+ }, z.core.$strict>, z.ZodObject<{
5183
+ target: z.ZodLiteral<"kay.agent">;
5184
+ slug: z.ZodLiteral<"session-artifacts.read">;
5185
+ envelope: z.ZodObject<{
5186
+ kind: z.ZodEnum<{
5187
+ output: "output";
5188
+ upload: "upload";
5189
+ }>;
5190
+ }, z.core.$strict>;
5191
+ }, z.core.$strict>, z.ZodObject<{
5192
+ target: z.ZodLiteral<"kay.agent">;
5193
+ slug: z.ZodLiteral<"session-artifacts.create">;
5194
+ envelope: z.ZodObject<{
5195
+ kind: z.ZodLiteral<"output">;
5196
+ }, z.core.$strict>;
5136
5197
  }, z.core.$strict>, z.ZodObject<{
5137
5198
  target: z.ZodLiteral<"kay.app">;
5138
5199
  slug: z.ZodLiteral<"artifacts.read">;
@@ -5477,7 +5538,7 @@ declare const PluginTargetName: z.ZodEnum<{
5477
5538
  declare type PluginTargetName = z.infer<typeof PluginTargetName>;
5478
5539
 
5479
5540
  export declare type PluginToolDefinition<TParams extends ToolParametersWire = ToolParametersWire, TDetails = unknown> = Omit<ToolDefinition<TParams, TDetails>, "execute"> & {
5480
- readonly execute: (toolCallId: string, params: ToolExecutionAwareParams<InferToolInput<TParams>>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx: ToolContext) => Promise<AgentToolResult<TDetails>>;
5541
+ readonly execute: (toolCallId: string, params: ToolExecutionAwareParams<InferToolInput<TParams>>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<TDetails> | undefined, ctx: KayAgentToolContext) => Promise<AgentToolResult<TDetails>>;
5481
5542
  };
5482
5543
 
5483
5544
  declare const PluginToolName: z.ZodString;
@@ -9204,7 +9265,7 @@ export declare interface ToolDefinition<TParams extends ToolParametersWire = Too
9204
9265
  * The `execute` of a described tool for {@link KayAgentPluginApi.implementTool}: `body` receives
9205
9266
  * the call's arguments parsed by `schema`, the schema the manifest's `parameters` came from.
9206
9267
  */
9207
- export declare function toolExecute<TSchema extends z_2.ZodType>(schema: TSchema, body: (toolCallId: string, input: z_2.output<TSchema>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<unknown> | undefined, ctx: ToolContext) => Promise<AgentToolResult<unknown>>): KayAgentToolExecute;
9268
+ export declare function toolExecute<TSchema extends z_2.ZodType>(schema: TSchema, body: (toolCallId: string, input: z_2.output<TSchema>, signal: AbortSignal | undefined, onUpdate: AgentToolUpdateCallback<unknown> | undefined, ctx: KayAgentToolContext) => Promise<AgentToolResult<unknown>>): KayAgentToolExecute;
9208
9269
 
9209
9270
  /** Runtime execute input shape that always allows reserved execution directives. */
9210
9271
  export declare type ToolExecutionAwareParams<T> = T & {
package/dist/kay-app.d.ts CHANGED
@@ -501,6 +501,15 @@ declare function BigInt_3(options?: TNumberOptions): TBigInt;
501
501
 
502
502
  declare const BigIntPattern = "-?(?:0|[1-9][0-9]*)n";
503
503
 
504
+ export declare interface BonsaiProductEvents {
505
+ /**
506
+ * Sends one event this plugin declares in its manifest, or a catalog event it names there. A
507
+ * field the declaration does not name is not sent. An event it does not declare, or a value that
508
+ * does not fit, is dropped with a diagnostic in the daemon's log. Returns nothing and never throws.
509
+ */
510
+ send(name: string, input?: PluginProductEventSend): void;
511
+ }
512
+
504
513
  /** Creates a Boolean type. */
505
514
  declare function Boolean_2(options?: TSchemaOptions): TBoolean;
506
515
 
@@ -2726,8 +2735,14 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2726
2735
  * 0.42.0 hands background work the shared ResolvedCredential in auth.credential. Workflow
2727
2736
  * accounts carry auth resolution outcomes, and Poller callbacks receive only the credential.
2728
2737
  * Older SDK ranges are refused because their background success shape is no longer served.
2738
+ *
2739
+ * 0.42.1 adds current-session tool lifetimes and invocation-bound artifact reads/new outputs,
2740
+ * plus described-tool execution, guidance and permission resource metadata.
2741
+ *
2742
+ * 0.43.0 adds product events (#15769). `productEvents` in a plugin's `kay.app` target declares them,
2743
+ * and `app.productEvents.send` sends them. Additive: a plugin that declares one declares ^0.43.0.
2729
2744
  */
2730
- declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
2745
+ declare const KAY_PLUGIN_SDK_VERSION: "0.43.0";
2731
2746
 
2732
2747
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2733
2748
 
@@ -5352,6 +5367,8 @@ export declare interface KayAppPluginApi {
5352
5367
  readonly endpoints: KayAppEndpoints;
5353
5368
  /** Publish one event declared by this plugin's `kay.app` manifest target. */
5354
5369
  readonly events: KayAppPluginEvents;
5370
+ /** Sends the product events this plugin declares in its manifest. */
5371
+ readonly productEvents: BonsaiProductEvents;
5355
5372
  /** The fine per-tool, app-wide event stream. */
5356
5373
  readonly toolEvents: KayAppToolEvents;
5357
5374
  /** Register an app-scoped URI module, active-by-default in every session. */
@@ -7926,13 +7943,14 @@ export declare interface KayAppUserFileEntry {
7926
7943
  * The plugin-facing user-files contract: file I/O in folders the user owns, done by the host on
7927
7944
  * its own worker threads.
7928
7945
  *
7929
- * Ungated and always present, like `app.paths`. It confers no authority: a plugin runs in the
7930
- * daemon's process and can call `node:fs` itself. What the door adds is where the work runs. A
7931
- * `node:fs` sync call blocks the daemon's event loop for as long as the path takes to answer,
7932
- * which under a macOS-protected folder or on a drive that stopped answering can be a very long
7933
- * time (kay#11575); an async one holds a thread of the pool the whole daemon shares. The host runs
7934
- * each request on a dedicated worker, gives it a deadline, and answers a typed result instead of
7935
- * throwing.
7946
+ * Ungated and always present, like `app.paths`. It confers no authority: the process a plugin
7947
+ * runs in, the daemon or the plugin host, could call `node:fs` itself. What the door adds is where
7948
+ * the work runs. A `node:fs` sync call blocks that process's event loop for as long as the path
7949
+ * takes to answer, which under a macOS-protected folder or on a drive that stopped answering can
7950
+ * be a very long time (kay#11575); an async one holds a thread of the pool the whole process
7951
+ * shares. The daemon's user-files service runs each request on a dedicated worker, gives it a
7952
+ * deadline, and answers a typed result instead of throwing. A plugin in the plugin host reaches
7953
+ * the same service: each call is sent to the daemon and answered from there.
7936
7954
  *
7937
7955
  * This is a leaf module. It lives beside both target SDKs, like `time.ts`, so the `kay.agent` SDK
7938
7956
  * exposes the same door without importing the `kay.app` surface.
@@ -7973,7 +7991,12 @@ export declare interface KayAppUserFiles {
7973
7991
  }
7974
7992
 
7975
7993
  export declare interface KayAppUserFilesCallOptions {
7976
- /** Deadline in milliseconds from the call, waiting included. Default 5000, at most 60000. */
7994
+ /**
7995
+ * Deadline in milliseconds, waiting included. Default 5000, at most 60000. It starts when the
7996
+ * daemon's user-files service receives the request: from the call in the daemon, or, for a
7997
+ * plugin in the plugin host, once the request has crossed to the daemon. A daemon that never
7998
+ * reads the request leaves the call waiting until the host's connection to it is closed.
7999
+ */
7977
8000
  readonly timeoutMs?: number;
7978
8001
  readonly signal?: AbortSignal;
7979
8002
  }
@@ -9822,6 +9845,16 @@ declare const PluginNamespace: z.ZodString;
9822
9845
 
9823
9846
  declare type PluginNamespace = z.infer<typeof PluginNamespace>;
9824
9847
 
9848
+ /** What a send of a product event carries, from a plugin's code or its page. */
9849
+ export declare interface PluginProductEventSend {
9850
+ /** Declared fields of either class. A field the declaration does not name is not sent. */
9851
+ readonly properties?: Readonly<Record<string, string | number | boolean>>;
9852
+ /** The session it is about, when there is one. Exported, so it must be a session id. */
9853
+ readonly sessionId?: string;
9854
+ /** The address it is about. Stays on the device. */
9855
+ readonly subjectUri?: string;
9856
+ }
9857
+
9825
9858
  export declare const PluginSignal: z.ZodObject<{
9826
9859
  kind: z.ZodEnum<{
9827
9860
  message: "message";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.42.0",
3
+ "version": "0.43.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",