@yaklabs-ai/plugin-sdk 0.28.0 → 0.30.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.28.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.30.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.28.0" },
65
+ "compatibility": { "sdk": "^0.30.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.28.0",
4
+ "version": "0.30.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -249,6 +249,7 @@ declare namespace authoringCommonSchemas {
249
249
  hostWithinDomain,
250
250
  urlHostWithinDomain,
251
251
  refineWebSessionScopeConfined,
252
+ KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES,
252
253
  KAY_PLUGIN_PROTOCOL_VERSION,
253
254
  KAY_PLUGIN_PROTOCOL_PACKAGE_NAME,
254
255
  KAY_PLUGIN_SDK_VERSION,
@@ -1771,6 +1772,9 @@ declare const KAY_EVENT_PUBLISHER_ID: "kay";
1771
1772
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
1772
1773
  declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly string[];
1773
1774
 
1775
+ /** Manifest byte cap, including declared app-data schemas; larger files are refused unread. */
1776
+ declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
1777
+
1774
1778
  declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
1775
1779
 
1776
1780
  declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
@@ -2341,8 +2345,20 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2341
2345
  * host holds may name one too. A plugin using a removed member or value stops loading until it is
2342
2346
  * rebuilt; a code search found none outside this repo. A plugin with a sign-in declares ^0.28.0. 0.26.3 and 0.27.1
2343
2347
  * stay served for a plugin that uses none of these.
2348
+ *
2349
+ * 0.29.0 replaces `servedSimulators` (`KayServedSimulators`, a lookup by adapter id) with
2350
+ * `simulator` on both targets (#14929): what the plugin's own simulator built, handed over once by
2351
+ * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2352
+ * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2353
+ * a plugin with no simulator is unaffected, so 0.28.0 stays served.
2354
+ *
2355
+ * 0.30.0 lets a scheduled workflow be described as data (#15722). `contributes.workflows` under
2356
+ * `kay.app` declares its name, schedule and sign-in, and `app.implementWorkflow(localId, run)`
2357
+ * supplies what a run does: each run is handed the workflow's accounts and tokens, so the code
2358
+ * runs the same in the daemon and in the plugin host. Additive: `app.workflows.define` stays, and
2359
+ * a plugin that declares a workflow declares ^0.30.0.
2344
2360
  */
2345
- declare const KAY_PLUGIN_SDK_VERSION: "0.28.0";
2361
+ declare const KAY_PLUGIN_SDK_VERSION: "0.30.0";
2346
2362
 
2347
2363
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2348
2364
 
@@ -2578,11 +2594,11 @@ declare interface KayAgentPluginApi {
2578
2594
  /** Absent unless the `knownResources` grant is requested and effectively granted. */
2579
2595
  readonly knownResources?: KayAgentKnownResources;
2580
2596
  /**
2581
- * Optional: absent unless a simulating Bonsai daemon serves this plugin a simulator (SDK 0.18.1).
2582
- * A production daemon never does. In this version only plugins the release carries are served;
2583
- * any plugin may ship a `./simulator` later. See {@link KayServedSimulators}.
2597
+ * What this plugin's own simulator built, in a simulated run only (SDK 0.29.0): absent in every
2598
+ * other, so treat absence as the normal case. Use it in place of the real backend; its shape is
2599
+ * the plugin's own, so narrow it before use. See {@link KayPluginSimulatorFactory}.
2584
2600
  */
2585
- readonly servedSimulators?: KayServedSimulators;
2601
+ readonly simulator?: unknown;
2586
2602
  /**
2587
2603
  * Present when the host composes Whiteboard. Each operation is checked against its exact
2588
2604
  * `whiteboard.<operation> {scope}` claim; handle presence is not consent.
@@ -3222,24 +3238,6 @@ declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
3222
3238
 
3223
3239
  declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
3224
3240
 
3225
- /**
3226
- * The simulators a simulating Bonsai daemon (evals, dev, tests) serves this plugin, keyed by the
3227
- * adapter id its simulated URI connection rows name. The daemon builds each from the plugin's own
3228
- * dev-only `./simulator` subpath; the plugin never imports its simulator.
3229
- *
3230
- * The member that carries this, `servedSimulators` on both plugin APIs, is optional and absent
3231
- * unless a simulating daemon serves it. A production daemon never does, so treat absence as the
3232
- * normal case. In this version the daemon serves it only to plugins the release carries; the seam
3233
- * is not specific to them, and any plugin may ship a `./simulator` later.
3234
- */
3235
- declare interface KayServedSimulators {
3236
- /**
3237
- * What this plugin's simulator built for `adapterId`, or `undefined` when none was served for
3238
- * that id. The shape is the plugin's own simulator contract; narrow it before use.
3239
- */
3240
- get(adapterId: string): unknown;
3241
- }
3242
-
3243
3241
  /** Applies a KeyOf action to the given type. */
3244
3242
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
3245
3243
 
@@ -224,6 +224,7 @@ declare namespace authoringCommonSchemas {
224
224
  hostWithinDomain,
225
225
  urlHostWithinDomain,
226
226
  refineWebSessionScopeConfined,
227
+ KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES,
227
228
  KAY_PLUGIN_PROTOCOL_VERSION,
228
229
  KAY_PLUGIN_PROTOCOL_PACKAGE_NAME,
229
230
  KAY_PLUGIN_SDK_VERSION,
@@ -1825,6 +1826,9 @@ declare const KAY_EVENT_PUBLISHER_ID: "kay";
1825
1826
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
1826
1827
  declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly string[];
1827
1828
 
1829
+ /** Manifest byte cap, including declared app-data schemas; larger files are refused unread. */
1830
+ declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
1831
+
1828
1832
  declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
1829
1833
 
1830
1834
  declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
@@ -2395,8 +2399,20 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2395
2399
  * host holds may name one too. A plugin using a removed member or value stops loading until it is
2396
2400
  * rebuilt; a code search found none outside this repo. A plugin with a sign-in declares ^0.28.0. 0.26.3 and 0.27.1
2397
2401
  * stay served for a plugin that uses none of these.
2402
+ *
2403
+ * 0.29.0 replaces `servedSimulators` (`KayServedSimulators`, a lookup by adapter id) with
2404
+ * `simulator` on both targets (#14929): what the plugin's own simulator built, handed over once by
2405
+ * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2406
+ * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2407
+ * a plugin with no simulator is unaffected, so 0.28.0 stays served.
2408
+ *
2409
+ * 0.30.0 lets a scheduled workflow be described as data (#15722). `contributes.workflows` under
2410
+ * `kay.app` declares its name, schedule and sign-in, and `app.implementWorkflow(localId, run)`
2411
+ * supplies what a run does: each run is handed the workflow's accounts and tokens, so the code
2412
+ * runs the same in the daemon and in the plugin host. Additive: `app.workflows.define` stays, and
2413
+ * a plugin that declares a workflow declares ^0.30.0.
2398
2414
  */
2399
- declare const KAY_PLUGIN_SDK_VERSION: "0.28.0";
2415
+ declare const KAY_PLUGIN_SDK_VERSION: "0.30.0";
2400
2416
 
2401
2417
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2402
2418
 
@@ -2629,11 +2645,11 @@ declare interface KayAgentPluginApi {
2629
2645
  /** Absent unless the `knownResources` grant is requested and effectively granted. */
2630
2646
  readonly knownResources?: KayAgentKnownResources;
2631
2647
  /**
2632
- * Optional: absent unless a simulating Bonsai daemon serves this plugin a simulator (SDK 0.18.1).
2633
- * A production daemon never does. In this version only plugins the release carries are served;
2634
- * any plugin may ship a `./simulator` later. See {@link KayServedSimulators}.
2648
+ * What this plugin's own simulator built, in a simulated run only (SDK 0.29.0): absent in every
2649
+ * other, so treat absence as the normal case. Use it in place of the real backend; its shape is
2650
+ * the plugin's own, so narrow it before use. See {@link KayPluginSimulatorFactory}.
2635
2651
  */
2636
- readonly servedSimulators?: KayServedSimulators;
2652
+ readonly simulator?: unknown;
2637
2653
  /**
2638
2654
  * Present when the host composes Whiteboard. Each operation is checked against its exact
2639
2655
  * `whiteboard.<operation> {scope}` claim; handle presence is not consent.
@@ -3273,24 +3289,6 @@ declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
3273
3289
 
3274
3290
  declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
3275
3291
 
3276
- /**
3277
- * The simulators a simulating Bonsai daemon (evals, dev, tests) serves this plugin, keyed by the
3278
- * adapter id its simulated URI connection rows name. The daemon builds each from the plugin's own
3279
- * dev-only `./simulator` subpath; the plugin never imports its simulator.
3280
- *
3281
- * The member that carries this, `servedSimulators` on both plugin APIs, is optional and absent
3282
- * unless a simulating daemon serves it. A production daemon never does, so treat absence as the
3283
- * normal case. In this version the daemon serves it only to plugins the release carries; the seam
3284
- * is not specific to them, and any plugin may ship a `./simulator` later.
3285
- */
3286
- declare interface KayServedSimulators {
3287
- /**
3288
- * What this plugin's simulator built for `adapterId`, or `undefined` when none was served for
3289
- * that id. The shape is the plugin's own simulator contract; narrow it before use.
3290
- */
3291
- get(adapterId: string): unknown;
3292
- }
3293
-
3294
3292
  /** Applies a KeyOf action to the given type. */
3295
3293
  declare function KeyOf<Type extends TSchema>(type: Type, options?: TSchemaOptions): TKeyOf_2<Type>;
3296
3294
 
@@ -4757,6 +4755,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4757
4755
  appDataSource: "appDataSource";
4758
4756
  whiteboardType: "whiteboardType";
4759
4757
  approvalType: "approvalType";
4758
+ workflow: "workflow";
4760
4759
  contextContributor: "contextContributor";
4761
4760
  transcriptionProvider: "transcriptionProvider";
4762
4761
  deviceDelegation: "deviceDelegation";
@@ -5528,6 +5527,18 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5528
5527
  moduleId: z.ZodString;
5529
5528
  authService: z.ZodOptional<z.ZodString>;
5530
5529
  }, z.core.$strict>>>;
5530
+ kayAppWorkflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
5531
+ localId: z.ZodString;
5532
+ globalId: z.ZodString;
5533
+ name: z.ZodString;
5534
+ description: z.ZodString;
5535
+ everyMs: z.ZodNumber;
5536
+ auth: z.ZodOptional<z.ZodObject<{
5537
+ serviceId: z.ZodString;
5538
+ schemeId: z.ZodString;
5539
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5540
+ }, z.core.$strict>>;
5541
+ }, z.core.$strict>>>;
5531
5542
  kayAppDataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
5532
5543
  localId: z.ZodString;
5533
5544
  globalId: z.ZodString;
@@ -317,6 +317,7 @@ declare namespace authoringCommonSchemas {
317
317
  hostWithinDomain,
318
318
  urlHostWithinDomain,
319
319
  refineWebSessionScopeConfined,
320
+ KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES,
320
321
  KAY_PLUGIN_PROTOCOL_VERSION,
321
322
  KAY_PLUGIN_PROTOCOL_PACKAGE_NAME,
322
323
  KAY_PLUGIN_SDK_VERSION,
@@ -2100,6 +2101,9 @@ declare const KAY_EVENT_PUBLISHER_ID: "kay";
2100
2101
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
2101
2102
  declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly string[];
2102
2103
 
2104
+ /** Manifest byte cap, including declared app-data schemas; larger files are refused unread. */
2105
+ declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
2106
+
2103
2107
  declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
2104
2108
 
2105
2109
  declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
@@ -2670,8 +2674,20 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2670
2674
  * host holds may name one too. A plugin using a removed member or value stops loading until it is
2671
2675
  * rebuilt; a code search found none outside this repo. A plugin with a sign-in declares ^0.28.0. 0.26.3 and 0.27.1
2672
2676
  * stay served for a plugin that uses none of these.
2677
+ *
2678
+ * 0.29.0 replaces `servedSimulators` (`KayServedSimulators`, a lookup by adapter id) with
2679
+ * `simulator` on both targets (#14929): what the plugin's own simulator built, handed over once by
2680
+ * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2681
+ * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2682
+ * a plugin with no simulator is unaffected, so 0.28.0 stays served.
2683
+ *
2684
+ * 0.30.0 lets a scheduled workflow be described as data (#15722). `contributes.workflows` under
2685
+ * `kay.app` declares its name, schedule and sign-in, and `app.implementWorkflow(localId, run)`
2686
+ * supplies what a run does: each run is handed the workflow's accounts and tokens, so the code
2687
+ * runs the same in the daemon and in the plugin host. Additive: `app.workflows.define` stays, and
2688
+ * a plugin that declares a workflow declares ^0.30.0.
2673
2689
  */
2674
- declare const KAY_PLUGIN_SDK_VERSION: "0.28.0";
2690
+ declare const KAY_PLUGIN_SDK_VERSION: "0.30.0";
2675
2691
 
2676
2692
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2677
2693
 
@@ -2936,11 +2952,11 @@ export declare interface KayAgentPluginApi {
2936
2952
  /** Absent unless the `knownResources` grant is requested and effectively granted. */
2937
2953
  readonly knownResources?: KayAgentKnownResources;
2938
2954
  /**
2939
- * Optional: absent unless a simulating Bonsai daemon serves this plugin a simulator (SDK 0.18.1).
2940
- * A production daemon never does. In this version only plugins the release carries are served;
2941
- * any plugin may ship a `./simulator` later. See {@link KayServedSimulators}.
2955
+ * What this plugin's own simulator built, in a simulated run only (SDK 0.29.0): absent in every
2956
+ * other, so treat absence as the normal case. Use it in place of the real backend; its shape is
2957
+ * the plugin's own, so narrow it before use. See {@link KayPluginSimulatorFactory}.
2942
2958
  */
2943
- readonly servedSimulators?: KayServedSimulators;
2959
+ readonly simulator?: unknown;
2944
2960
  /**
2945
2961
  * Present when the host composes Whiteboard. Each operation is checked against its exact
2946
2962
  * `whiteboard.<operation> {scope}` claim; handle presence is not consent.
@@ -3599,21 +3615,19 @@ declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
3599
3615
  declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
3600
3616
 
3601
3617
  /**
3602
- * The simulators a simulating Bonsai daemon (evals, dev, tests) serves this plugin, keyed by the
3603
- * adapter id its simulated URI connection rows name. The daemon builds each from the plugin's own
3604
- * dev-only `./simulator` subpath; the plugin never imports its simulator.
3605
- *
3606
- * The member that carries this, `servedSimulators` on both plugin APIs, is optional and absent
3607
- * unless a simulating daemon serves it. A production daemon never does, so treat absence as the
3608
- * normal case. In this version the daemon serves it only to plugins the release carries; the seam
3609
- * is not specific to them, and any plugin may ship a `./simulator` later.
3618
+ * What a plugin's dev-only simulator file exports as `createPluginSimulator`. Whichever process
3619
+ * runs the plugin calls it once and hands the result to that plugin alone, as `simulator` on both
3620
+ * plugin APIs. The result's shape is the plugin's own: nothing between the two reads it, and the
3621
+ * plugin never imports its simulator.
3610
3622
  */
3611
- export declare interface KayServedSimulators {
3612
- /**
3613
- * What this plugin's simulator built for `adapterId`, or `undefined` when none was served for
3614
- * that id. The shape is the plugin's own simulator contract; narrow it before use.
3615
- */
3616
- get(adapterId: string): unknown;
3623
+ export declare type KayPluginSimulatorFactory = (options: KayPluginSimulatorOptions) => unknown;
3624
+
3625
+ /**
3626
+ * What the launcher of a simulated run (evals, dev, tests) gives a plugin's simulator: the folder
3627
+ * its worlds live under. The simulator picks its own folders inside it.
3628
+ */
3629
+ export declare interface KayPluginSimulatorOptions {
3630
+ readonly stateRoot: string;
3617
3631
  }
3618
3632
 
3619
3633
  /** Applies a KeyOf action to the given type. */
@@ -4344,8 +4358,8 @@ export declare interface OsascriptFailureAdvice {
4344
4358
  }
4345
4359
 
4346
4360
  /**
4347
- * The activation options every osascript plugin's agent factory accepted, so the daemon's
4348
- * simulator roster set each the same way. Absent `simulator`, the plugin is exactly the shipped one.
4361
+ * The activation options every osascript plugin's agent factory accepted, each with the same
4362
+ * `simulator` option. Absent `simulator`, the plugin is exactly the shipped one.
4349
4363
  *
4350
4364
  * @deprecated See {@link OsascriptSimulatorOptions}.
4351
4365
  */
@@ -4384,10 +4398,6 @@ export declare interface OsascriptRunner {
4384
4398
  /**
4385
4399
  * The runners a module's verbs use: the host's exactly when `simulator` is absent, or the
4386
4400
  * simulator's in its place, per dispatch, after the host's connection gate.
4387
- *
4388
- * @deprecated A Bonsai daemon substitutes the runner itself, so a module uses
4389
- * {@link requireExternalCli} and `ctx.auth?.externalCli` directly. Kept so a plugin built against
4390
- * an earlier SDK keeps compiling.
4391
4401
  */
4392
4402
  readonly dispatch: (simulator: OsascriptSimulatedRunner | undefined) => OsascriptDispatch;
4393
4403
  /**
@@ -4434,25 +4444,22 @@ export declare interface OsascriptRunnerOptions {
4434
4444
  }
4435
4445
 
4436
4446
  /**
4437
- * A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. A
4438
- * Bonsai daemon that simulates an osascript plugin hands `runnerFor(ctx)` to the module as
4439
- * `ctx.auth.externalCli`; `@bonsai/uri-simulator-kit/osascript` builds one.
4447
+ * A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. An
4448
+ * osascript plugin's simulator holds one (`@bonsai/uri-simulator-kit/osascript` builds it), and the
4449
+ * module passes it to {@link OsascriptRunner.dispatch}.
4440
4450
  */
4441
4451
  export declare interface OsascriptSimulatedRunner {
4442
4452
  readonly runnerFor: (ctx: UriResolveContext) => UriExternalCliRunner;
4443
4453
  }
4444
4454
 
4445
4455
  /**
4446
- * How a plugin is told to serve its module from its simulator instead of osascript: the one
4447
- * option shape every osascript plugin's agent factory accepts as `simulator`. Only the daemon's
4448
- * URI simulator roster sets it, for evals and dev; an ordinary install never does.
4456
+ * How a plugin was once told to serve its module from its simulator instead of osascript.
4449
4457
  *
4450
- * @deprecated A Bonsai daemon now hands the module a simulated runner as `ctx.auth.externalCli`,
4451
- * so a plugin needs no simulator option; no Bonsai plugin sets this. Kept so a plugin built against
4452
- * an earlier SDK keeps compiling.
4458
+ * @deprecated A plugin gets its simulator as `api.simulator`; no Bonsai plugin sets this. Kept so a
4459
+ * plugin built against an earlier SDK keeps compiling.
4453
4460
  */
4454
4461
  export declare interface OsascriptSimulatorOptions {
4455
- /** The directory holding the simulator's world; the daemon's process config names it. */
4462
+ /** The directory holding the simulator's world. */
4456
4463
  readonly stateDir: string;
4457
4464
  }
4458
4465
 
package/dist/kay-app.d.ts CHANGED
@@ -266,6 +266,7 @@ declare namespace authoringCommonSchemas {
266
266
  hostWithinDomain,
267
267
  urlHostWithinDomain,
268
268
  refineWebSessionScopeConfined,
269
+ KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES,
269
270
  KAY_PLUGIN_PROTOCOL_VERSION,
270
271
  KAY_PLUGIN_PROTOCOL_PACKAGE_NAME,
271
272
  KAY_PLUGIN_SDK_VERSION,
@@ -2057,6 +2058,9 @@ declare const KAY_EVENT_PUBLISHER_ID: "kay";
2057
2058
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
2058
2059
  declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly string[];
2059
2060
 
2061
+ /** Manifest byte cap, including declared app-data schemas; larger files are refused unread. */
2062
+ declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
2063
+
2060
2064
  declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
2061
2065
 
2062
2066
  declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
@@ -2627,8 +2631,20 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2627
2631
  * host holds may name one too. A plugin using a removed member or value stops loading until it is
2628
2632
  * rebuilt; a code search found none outside this repo. A plugin with a sign-in declares ^0.28.0. 0.26.3 and 0.27.1
2629
2633
  * stay served for a plugin that uses none of these.
2634
+ *
2635
+ * 0.29.0 replaces `servedSimulators` (`KayServedSimulators`, a lookup by adapter id) with
2636
+ * `simulator` on both targets (#14929): what the plugin's own simulator built, handed over once by
2637
+ * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2638
+ * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2639
+ * a plugin with no simulator is unaffected, so 0.28.0 stays served.
2640
+ *
2641
+ * 0.30.0 lets a scheduled workflow be described as data (#15722). `contributes.workflows` under
2642
+ * `kay.app` declares its name, schedule and sign-in, and `app.implementWorkflow(localId, run)`
2643
+ * supplies what a run does: each run is handed the workflow's accounts and tokens, so the code
2644
+ * runs the same in the daemon and in the plugin host. Additive: `app.workflows.define` stays, and
2645
+ * a plugin that declares a workflow declares ^0.30.0.
2630
2646
  */
2631
- declare const KAY_PLUGIN_SDK_VERSION: "0.28.0";
2647
+ declare const KAY_PLUGIN_SDK_VERSION: "0.30.0";
2632
2648
 
2633
2649
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2634
2650
 
@@ -5153,13 +5169,11 @@ export declare interface KayAppPluginApi {
5153
5169
  /** Exact-account credential resolution for declared background-job purposes. */
5154
5170
  readonly backgroundAuth?: KayAppBackgroundAuth;
5155
5171
  /**
5156
- * Optional: absent unless a simulating Bonsai daemon serves this plugin a simulator (SDK 0.18.1).
5157
- * A production daemon never does. In this version only plugins the release carries are served;
5158
- * any plugin may ship a `./simulator` later. The `kay.app` target reads the same simulators its
5159
- * `kay.agent` part does, so a background job runs on the simulator its URI target does. See
5160
- * {@link KayServedSimulators}.
5172
+ * What this plugin's own simulator built, in a simulated run only (SDK 0.29.0): absent in every
5173
+ * other. Its shape is the plugin's own, so narrow it before use. See
5174
+ * {@link KayPluginSimulatorFactory}.
5161
5175
  */
5162
- readonly servedSimulators?: KayServedSimulators;
5176
+ readonly simulator?: unknown;
5163
5177
  /**
5164
5178
  * Read and write this plugin's OWN manifest-declared config sections (value + provenance), and
5165
5179
  * observe changes. Present whenever the host has a config store and the plugin declares at least
@@ -5272,6 +5286,14 @@ export declare interface KayAppPluginApi {
5272
5286
  * fail-closed at activation, exactly like {@link registerUriModule}.
5273
5287
  */
5274
5288
  registerTool(localId: string, definition: KayAppToolDefinition): void;
5289
+ /**
5290
+ * Supply the code of a workflow this plugin's manifest declares under
5291
+ * `targets.kay.app.contributes.workflows` (SDK 0.30.0). The manifest says its name, schedule and
5292
+ * sign-in, so Bonsai schedules it without this code running; each run is handed its accounts and
5293
+ * tokens, so it runs the same wherever the plugin runs. Implementing an undeclared `localId`, or
5294
+ * declaring one this activation does not implement, fails the plugin.
5295
+ */
5296
+ implementWorkflow(localId: string, run: KayAppWorkflowImplementation): void;
5275
5297
  }
5276
5298
 
5277
5299
  export declare interface KayAppPluginEvents {
@@ -8028,6 +8050,16 @@ export declare interface KayAppWhiteboardTypes {
8028
8050
  registerType(localId: string, behavior: KayAppWhiteboardTypeBehavior): void;
8029
8051
  }
8030
8052
 
8053
+ /**
8054
+ * One connected account of a declared workflow's service, and its credential for this run. An
8055
+ * account that needs signing in again, or holds none of the declared scopes, arrives with that
8056
+ * status instead of a token.
8057
+ */
8058
+ export declare interface KayAppWorkflowAccount {
8059
+ readonly account: KayAppAccountSummary;
8060
+ readonly credential: KayAppBackgroundCredentialResult;
8061
+ }
8062
+
8031
8063
  /**
8032
8064
  * What your `run` callback is handed when the trigger fires.
8033
8065
  *
@@ -8141,16 +8173,7 @@ export declare interface KayAppWorkflowDefinition<Trigger extends KayAppWorkflow
8141
8173
  * suits an event trigger whose runs each handle their own event; it cannot return `state`.
8142
8174
  */
8143
8175
  readonly concurrency?: KayAppAutomationConcurrency;
8144
- readonly run: (context: KayAppWorkflowContext<Trigger>) => Promise<{
8145
- /**
8146
- * Replacement JSON state, at most 64 KiB; omission keeps the previous value. Only a
8147
- * sequential workflow may return it: a `parallel` run that does fails.
8148
- */
8149
- readonly state?: JsonValue | undefined;
8150
- readonly summary: KayAppRunSummary;
8151
- readonly produced?: KayAppRunProduced;
8152
- readonly effect?: KayAppRunEffect;
8153
- }>;
8176
+ readonly run: (context: KayAppWorkflowContext<Trigger>) => Promise<KayAppWorkflowResult>;
8154
8177
  }
8155
8178
 
8156
8179
  /**
@@ -8169,6 +8192,9 @@ export declare class KayAppWorkflowFailure extends Error {
8169
8192
  constructor(summary: Omit<KayAppRunSummary, "author">, options?: ErrorOptions);
8170
8193
  }
8171
8194
 
8195
+ /** The code of a workflow the manifest declares under `contributes.workflows`. */
8196
+ export declare type KayAppWorkflowImplementation = (run: KayAppWorkflowRun) => Promise<KayAppWorkflowResult>;
8197
+
8172
8198
  export declare interface KayAppWorkflowInspection {
8173
8199
  readonly binding: KayAppManagedAutomation | null;
8174
8200
  readonly runs: readonly KayAppAutomationRun[];
@@ -8210,6 +8236,42 @@ export declare type KayAppWorkflowMatch<Trigger extends KayAppWorkflowTrigger =
8210
8236
  readonly kind: "time";
8211
8237
  }>);
8212
8238
 
8239
+ /** What a workflow run returns. */
8240
+ export declare interface KayAppWorkflowResult {
8241
+ /**
8242
+ * Replacement JSON state, at most 64 KiB; omission keeps the previous value. Only a
8243
+ * sequential workflow may return it: a `parallel` run that does fails.
8244
+ */
8245
+ readonly state?: JsonValue | undefined;
8246
+ readonly summary: KayAppRunSummary;
8247
+ readonly produced?: KayAppRunProduced;
8248
+ readonly effect?: KayAppRunEffect;
8249
+ }
8250
+
8251
+ /**
8252
+ * What a declared workflow's code is handed each run (`app.implementWorkflow`).
8253
+ *
8254
+ * The whole run is one recorded step, so an interrupted run starts again from the last saved
8255
+ * `state`: it may repeat provider reads and published events, so key events at their source.
8256
+ */
8257
+ export declare interface KayAppWorkflowRun {
8258
+ /** State from the last successful run; undefined until a run saves it. */
8259
+ readonly state: JsonValue | undefined;
8260
+ readonly runId: string;
8261
+ /**
8262
+ * Every connected account of the service and scheme the manifest's `auth` names, in a stable
8263
+ * order. Empty when it names none.
8264
+ */
8265
+ readonly accounts: readonly KayAppWorkflowAccount[];
8266
+ /**
8267
+ * Just runs `fn`, and returns once every event it published has reached Bonsai. Nothing is
8268
+ * recorded for now, so a repeated run runs it again. What it returns must be plain data.
8269
+ */
8270
+ readonly runStep: <T>(fn: () => Promise<T>, options?: {
8271
+ readonly name?: string;
8272
+ }) => Promise<T>;
8273
+ }
8274
+
8213
8275
  export declare interface KayAppWorkflows {
8214
8276
  define<Trigger extends KayAppWorkflowTrigger>(localId: string, definition: KayAppWorkflowDefinition<Trigger>): void;
8215
8277
  inspect(localId: string, options?: KayAppWorkflowInspectOptions): Promise<KayAppWorkflowInspection>;
@@ -8535,21 +8597,19 @@ declare const KayPluginProtocolVersion: z.ZodLiteral<"kay.plugin.v1">;
8535
8597
  declare type KayPluginProtocolVersion = z.infer<typeof KayPluginProtocolVersion>;
8536
8598
 
8537
8599
  /**
8538
- * The simulators a simulating Bonsai daemon (evals, dev, tests) serves this plugin, keyed by the
8539
- * adapter id its simulated URI connection rows name. The daemon builds each from the plugin's own
8540
- * dev-only `./simulator` subpath; the plugin never imports its simulator.
8541
- *
8542
- * The member that carries this, `servedSimulators` on both plugin APIs, is optional and absent
8543
- * unless a simulating daemon serves it. A production daemon never does, so treat absence as the
8544
- * normal case. In this version the daemon serves it only to plugins the release carries; the seam
8545
- * is not specific to them, and any plugin may ship a `./simulator` later.
8600
+ * What a plugin's dev-only simulator file exports as `createPluginSimulator`. Whichever process
8601
+ * runs the plugin calls it once and hands the result to that plugin alone, as `simulator` on both
8602
+ * plugin APIs. The result's shape is the plugin's own: nothing between the two reads it, and the
8603
+ * plugin never imports its simulator.
8546
8604
  */
8547
- export declare interface KayServedSimulators {
8548
- /**
8549
- * What this plugin's simulator built for `adapterId`, or `undefined` when none was served for
8550
- * that id. The shape is the plugin's own simulator contract; narrow it before use.
8551
- */
8552
- get(adapterId: string): unknown;
8605
+ export declare type KayPluginSimulatorFactory = (options: KayPluginSimulatorOptions) => unknown;
8606
+
8607
+ /**
8608
+ * What the launcher of a simulated run (evals, dev, tests) gives a plugin's simulator: the folder
8609
+ * its worlds live under. The simulator picks its own folders inside it.
8610
+ */
8611
+ export declare interface KayPluginSimulatorOptions {
8612
+ readonly stateRoot: string;
8553
8613
  }
8554
8614
 
8555
8615
  /** Applies a KeyOf action to the given type. */
@@ -0,0 +1,4 @@
1
+ /** Normalize underscores to hyphens; return undefined unless the result is a valid Agent Skills name (at most 64 characters). */
2
+ export declare function skillInstallTargetName(sourceName: string): string | undefined;
3
+
4
+ export { }
package/dist/skills.js ADDED
@@ -0,0 +1,12 @@
1
+ // packages/plugin-sdk/dist/skills.js
2
+ var AGENT_SKILL_NAME_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;
3
+ function skillInstallTargetName(sourceName) {
4
+ const targetName = sourceName.replace(/_+/g, "-");
5
+ if (targetName.length > 64 || targetName.includes("--") || !AGENT_SKILL_NAME_PATTERN.test(targetName)) {
6
+ return void 0;
7
+ }
8
+ return targetName;
9
+ }
10
+ export {
11
+ skillInstallTargetName
12
+ };
@@ -26,6 +26,7 @@ var JsonObject = z2.record(z2.string(), JsonValue);
26
26
  var JsonSchema = z2.record(z2.string(), JsonValue);
27
27
 
28
28
  // packages/plugin-protocol/dist/common.js
29
+ var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
29
30
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
30
31
  var KAY_PLUGIN_TARGET_NAMES = [
31
32
  "kay.agent",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-sdk",
3
- "version": "0.28.0",
3
+ "version": "0.30.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",
@@ -61,6 +61,10 @@
61
61
  "types": "./dist/whiteboard.d.ts",
62
62
  "default": "./dist/whiteboard.js"
63
63
  },
64
+ "./skills": {
65
+ "types": "./dist/skills.d.ts",
66
+ "default": "./dist/skills.js"
67
+ },
64
68
  "./transcript-review": {
65
69
  "types": "./dist/transcript-review.d.ts",
66
70
  "default": "./dist/transcript-review.js"