@yaklabs-ai/plugin-sdk 0.29.0 → 0.31.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.29.0"
16
+ "@bonsai/plugin-sdk": "npm:@yaklabs-ai/plugin-sdk@^0.31.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.29.0" },
65
+ "compatibility": { "sdk": "^0.31.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.29.0",
4
+ "version": "0.31.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
@@ -1722,39 +1722,48 @@ declare type GrammarVariants = Partial<Record<GrammarFormat, string>>;
1722
1722
  */
1723
1723
  declare type HerdHarnessEvent = {
1724
1724
  readonly type: "agent_start";
1725
+ readonly kernelRunId?: string;
1725
1726
  } | {
1726
1727
  readonly type: "agent_end";
1727
1728
  readonly messages: readonly AgentMessage[];
1728
1729
  } | {
1729
1730
  readonly type: "turn_start";
1731
+ readonly kernelRunId?: string;
1730
1732
  } | {
1731
1733
  readonly type: "turn_end";
1734
+ readonly kernelRunId?: string;
1732
1735
  readonly message: AssistantMessage;
1733
1736
  readonly toolResults: readonly ToolResultMessage[];
1734
1737
  } | {
1735
1738
  readonly type: "message_start";
1739
+ readonly kernelRunId?: string;
1736
1740
  readonly message: AgentMessage;
1737
1741
  } | {
1738
1742
  readonly type: "message_update";
1743
+ readonly kernelRunId?: string;
1739
1744
  readonly message: AgentMessage;
1740
1745
  readonly assistantMessageEvent: AssistantMessageEvent;
1741
1746
  } | {
1742
1747
  readonly type: "message_end";
1748
+ readonly kernelRunId?: string;
1743
1749
  readonly message: AgentMessage;
1744
1750
  readonly entryId?: string;
1745
1751
  } | {
1746
1752
  readonly type: "tool_execution_start";
1753
+ readonly kernelRunId?: string;
1747
1754
  readonly toolCallId: string;
1748
1755
  readonly toolName: string;
1749
1756
  readonly args: unknown;
1750
1757
  } | {
1751
1758
  readonly type: "tool_execution_update";
1759
+ readonly kernelRunId?: string;
1752
1760
  readonly toolCallId: string;
1753
1761
  readonly toolName: string;
1754
1762
  readonly args: unknown;
1755
1763
  readonly partialResult: unknown;
1756
1764
  } | {
1757
1765
  readonly type: "tool_execution_end";
1766
+ readonly kernelRunId?: string;
1758
1767
  readonly toolCallId: string;
1759
1768
  readonly toolName: string;
1760
1769
  readonly result: unknown;
@@ -396,7 +396,7 @@ var boundedDeltaPlacement = z4.json().refine((delta) => {
396
396
  var HerdSessionProjection = z4.discriminatedUnion("type", [
397
397
  z4.strictObject({
398
398
  type: z4.literal("herd.message.delta"),
399
- runId: z4.string().min(1).optional(),
399
+ kernelRunId: z4.string().min(1).optional(),
400
400
  messageId: z4.string().min(1).optional(),
401
401
  timestamp: z4.iso.datetime(),
402
402
  delta: boundedDeltaPlacement
@@ -671,7 +671,17 @@ var TOOL_CALL_FAILURE_CODES = [
671
671
  "edit.text_not_unique",
672
672
  "edit.empty_old_text",
673
673
  "edit.overlapping_edits",
674
- "edit.no_change"
674
+ "edit.no_change",
675
+ // Situation codes for two lumped codes above. Each reads exactly as its
676
+ // parent (same category, retryable and action); the parent stays for every
677
+ // case without the evidence. An app older than these codes rejects a stored
678
+ // record that carries one.
679
+ "uri.not_connected.pick_account",
680
+ "uri.not_connected.account_not_allowed",
681
+ "uri.not_connected.sign_in_expired",
682
+ "tool.blocked.by_user",
683
+ "tool.blocked.by_rule",
684
+ "tool.blocked.by_bonsai"
675
685
  ];
676
686
  var count = z5.number().int().nonnegative();
677
687
  var toolCallFailureDetailsSchema = z5.strictObject({
@@ -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";
@@ -2347,8 +2351,19 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2347
2351
  * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2348
2352
  * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2349
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.
2360
+ *
2361
+ * 0.31.0 lets a plugin declare its rail entries as data (#15896). `railEntries` under `kay.ui`
2362
+ * `contributes` names each entry's title, page, shortcut and icon file. It replaces `activityRail` on a
2363
+ * UI app, which is stripped from a manifest that still carries it, so that manifest loses only the
2364
+ * rail button. A plugin that declares a rail entry declares ^0.31.0.
2350
2365
  */
2351
- declare const KAY_PLUGIN_SDK_VERSION: "0.29.0";
2366
+ declare const KAY_PLUGIN_SDK_VERSION: "0.31.0";
2352
2367
 
2353
2368
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2354
2369
 
@@ -7601,7 +7616,7 @@ declare type TOmitInstantiate<Context extends TProperties, State extends TState,
7601
7616
  * classification (the engine records the rejection on an unexplained failure),
7602
7617
  * and a stored record with one reads as none.
7603
7618
  */
7604
- declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
7619
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change", "uri.not_connected.pick_account", "uri.not_connected.account_not_allowed", "uri.not_connected.sign_in_expired", "tool.blocked.by_user", "tool.blocked.by_rule", "tool.blocked.by_bonsai"];
7605
7620
 
7606
7621
  /**
7607
7622
  * ---
@@ -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";
@@ -2401,8 +2405,19 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2401
2405
  * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2402
2406
  * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2403
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.
2414
+ *
2415
+ * 0.31.0 lets a plugin declare its rail entries as data (#15896). `railEntries` under `kay.ui`
2416
+ * `contributes` names each entry's title, page, shortcut and icon file. It replaces `activityRail` on a
2417
+ * UI app, which is stripped from a manifest that still carries it, so that manifest loses only the
2418
+ * rail button. A plugin that declares a rail entry declares ^0.31.0.
2404
2419
  */
2405
- declare const KAY_PLUGIN_SDK_VERSION: "0.29.0";
2420
+ declare const KAY_PLUGIN_SDK_VERSION: "0.31.0";
2406
2421
 
2407
2422
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2408
2423
 
@@ -4745,6 +4760,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4745
4760
  appDataSource: "appDataSource";
4746
4761
  whiteboardType: "whiteboardType";
4747
4762
  approvalType: "approvalType";
4763
+ workflow: "workflow";
4748
4764
  contextContributor: "contextContributor";
4749
4765
  transcriptionProvider: "transcriptionProvider";
4750
4766
  deviceDelegation: "deviceDelegation";
@@ -5516,6 +5532,18 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5516
5532
  moduleId: z.ZodString;
5517
5533
  authService: z.ZodOptional<z.ZodString>;
5518
5534
  }, z.core.$strict>>>;
5535
+ kayAppWorkflows: z.ZodOptional<z.ZodArray<z.ZodObject<{
5536
+ localId: z.ZodString;
5537
+ globalId: z.ZodString;
5538
+ name: z.ZodString;
5539
+ description: z.ZodString;
5540
+ everyMs: z.ZodNumber;
5541
+ auth: z.ZodOptional<z.ZodObject<{
5542
+ serviceId: z.ZodString;
5543
+ schemeId: z.ZodString;
5544
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5545
+ }, z.core.$strict>>;
5546
+ }, z.core.$strict>>>;
5519
5547
  kayAppDataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
5520
5548
  localId: z.ZodString;
5521
5549
  globalId: z.ZodString;
@@ -5631,16 +5659,6 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5631
5659
  globalId: z.ZodString;
5632
5660
  displayName: z.ZodString;
5633
5661
  contextOnly: z.ZodOptional<z.ZodLiteral<true>>;
5634
- activityRail: z.ZodOptional<z.ZodObject<{
5635
- section: z.ZodOptional<z.ZodEnum<{
5636
- primary: "primary";
5637
- plugins: "plugins";
5638
- }>>;
5639
- order: z.ZodOptional<z.ZodNumber>;
5640
- icon: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
5641
- svg: z.ZodString;
5642
- }, z.core.$strict>]>>;
5643
- }, z.core.$strict>>;
5644
5662
  description: z.ZodOptional<z.ZodString>;
5645
5663
  icon: z.ZodOptional<z.ZodString>;
5646
5664
  runtime: z.ZodLiteral<"kay.react-app.v1">;
@@ -8664,7 +8682,7 @@ declare type TOmitInstantiate<Context extends TProperties, State extends TState,
8664
8682
  * classification (the engine records the rejection on an unexplained failure),
8665
8683
  * and a stored record with one reads as none.
8666
8684
  */
8667
- declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
8685
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change", "uri.not_connected.pick_account", "uri.not_connected.account_not_allowed", "uri.not_connected.sign_in_expired", "tool.blocked.by_user", "tool.blocked.by_rule", "tool.blocked.by_bonsai"];
8668
8686
 
8669
8687
  /**
8670
8688
  * ---
@@ -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";
@@ -2676,8 +2680,19 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2676
2680
  * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2677
2681
  * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2678
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.
2689
+ *
2690
+ * 0.31.0 lets a plugin declare its rail entries as data (#15896). `railEntries` under `kay.ui`
2691
+ * `contributes` names each entry's title, page, shortcut and icon file. It replaces `activityRail` on a
2692
+ * UI app, which is stripped from a manifest that still carries it, so that manifest loses only the
2693
+ * rail button. A plugin that declares a rail entry declares ^0.31.0.
2679
2694
  */
2680
- declare const KAY_PLUGIN_SDK_VERSION: "0.29.0";
2695
+ declare const KAY_PLUGIN_SDK_VERSION: "0.31.0";
2681
2696
 
2682
2697
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2683
2698
 
@@ -4348,8 +4363,8 @@ export declare interface OsascriptFailureAdvice {
4348
4363
  }
4349
4364
 
4350
4365
  /**
4351
- * The activation options every osascript plugin's agent factory accepted, so the daemon's
4352
- * simulator roster set each the same way. Absent `simulator`, the plugin is exactly the shipped one.
4366
+ * The activation options every osascript plugin's agent factory accepted, each with the same
4367
+ * `simulator` option. Absent `simulator`, the plugin is exactly the shipped one.
4353
4368
  *
4354
4369
  * @deprecated See {@link OsascriptSimulatorOptions}.
4355
4370
  */
@@ -4388,10 +4403,6 @@ export declare interface OsascriptRunner {
4388
4403
  /**
4389
4404
  * The runners a module's verbs use: the host's exactly when `simulator` is absent, or the
4390
4405
  * simulator's in its place, per dispatch, after the host's connection gate.
4391
- *
4392
- * @deprecated A Bonsai daemon substitutes the runner itself, so a module uses
4393
- * {@link requireExternalCli} and `ctx.auth?.externalCli` directly. Kept so a plugin built against
4394
- * an earlier SDK keeps compiling.
4395
4406
  */
4396
4407
  readonly dispatch: (simulator: OsascriptSimulatedRunner | undefined) => OsascriptDispatch;
4397
4408
  /**
@@ -4438,25 +4449,22 @@ export declare interface OsascriptRunnerOptions {
4438
4449
  }
4439
4450
 
4440
4451
  /**
4441
- * A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. A
4442
- * Bonsai daemon that simulates an osascript plugin hands `runnerFor(ctx)` to the module as
4443
- * `ctx.auth.externalCli`; `@bonsai/uri-simulator-kit/osascript` builds one.
4452
+ * A simulated runner, as a module sees it: the runner one dispatch uses in the host's place. An
4453
+ * osascript plugin's simulator holds one (`@bonsai/uri-simulator-kit/osascript` builds it), and the
4454
+ * module passes it to {@link OsascriptRunner.dispatch}.
4444
4455
  */
4445
4456
  export declare interface OsascriptSimulatedRunner {
4446
4457
  readonly runnerFor: (ctx: UriResolveContext) => UriExternalCliRunner;
4447
4458
  }
4448
4459
 
4449
4460
  /**
4450
- * How a plugin is told to serve its module from its simulator instead of osascript: the one
4451
- * option shape every osascript plugin's agent factory accepts as `simulator`. Only the daemon's
4452
- * URI simulator roster sets it, for evals and dev; an ordinary install never does.
4461
+ * How a plugin was once told to serve its module from its simulator instead of osascript.
4453
4462
  *
4454
- * @deprecated A Bonsai daemon now hands the module a simulated runner as `ctx.auth.externalCli`,
4455
- * so a plugin needs no simulator option; no Bonsai plugin sets this. Kept so a plugin built against
4456
- * an earlier SDK keeps compiling.
4463
+ * @deprecated A plugin gets its simulator as `api.simulator`; no Bonsai plugin sets this. Kept so a
4464
+ * plugin built against an earlier SDK keeps compiling.
4457
4465
  */
4458
4466
  export declare interface OsascriptSimulatorOptions {
4459
- /** The directory holding the simulator's world; the daemon's process config names it. */
4467
+ /** The directory holding the simulator's world. */
4460
4468
  readonly stateDir: string;
4461
4469
  }
4462
4470
 
@@ -8819,7 +8827,7 @@ declare type TOmitInstantiate<Context extends TProperties, State extends TState,
8819
8827
  * classification (the engine records the rejection on an unexplained failure),
8820
8828
  * and a stored record with one reads as none.
8821
8829
  */
8822
- declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
8830
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change", "uri.not_connected.pick_account", "uri.not_connected.account_not_allowed", "uri.not_connected.sign_in_expired", "tool.blocked.by_user", "tool.blocked.by_rule", "tool.blocked.by_bonsai"];
8823
8831
 
8824
8832
  /**
8825
8833
  * ---
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,
@@ -1055,18 +1056,16 @@ declare interface DeferredHandle {
1055
1056
  }
1056
1057
 
1057
1058
  /**
1058
- * Register an ordinary workflow that polls connected accounts with independent JSON cursors.
1059
+ * Supply the run of a described workflow that polls its handed accounts with independent JSON
1060
+ * cursors. The manifest describes the workflow: its name, how often it runs, and which accounts.
1059
1061
  * First polls initialize silently. Failed or skipped accounts retain their cursor; removed
1060
1062
  * accounts are pruned. Publication finishes before replacement state is returned.
1061
1063
  *
1062
- * Each account's credential comes from `app.backgroundAuth` with no named scopes, so the host picks
1063
- * one from the manifest's `background-job` grant. Credential resolution and provider reads share a
1064
- * step so credentials are never step outputs.
1065
- * Poll callbacks must keep secrets out of their returned cursor, events, and summary. Resolution
1066
- * errors fail the run with a sanitized message; provider poll errors isolate the account.
1067
- * Key events at their source: a step can repeat before its result commits or after an engine update.
1064
+ * Poll callbacks must keep secrets out of their returned cursor, events, and summary. A failed poll
1065
+ * or a missing credential stays that account's.
1066
+ * Key events at their source: a run can repeat before its state commits.
1068
1067
  */
1069
- export declare function definePoller<Cursor extends JsonValue>(app: Pick<KayAppPluginApi, "workflows" | "auth" | "backgroundAuth" | "events">, localId: string, options: KayAppPollerOptions<Cursor>): void;
1068
+ export declare function definePoller<Cursor extends JsonValue>(app: Pick<KayAppPluginApi, "implementWorkflow" | "events">, localId: string, options: KayAppPollerOptions<Cursor>): void;
1070
1069
 
1071
1070
  /** Creates a Dependent type */
1072
1071
  declare function Dependent<If extends TSchema, Then extends TSchema, Else extends TSchema>(if_: If, then_: Then, else_: Else, options?: TSchemaOptions): TDependent<If, Then, Else>;
@@ -2057,6 +2056,9 @@ declare const KAY_EVENT_PUBLISHER_ID: "kay";
2057
2056
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
2058
2057
  declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly string[];
2059
2058
 
2059
+ /** Manifest byte cap, including declared app-data schemas; larger files are refused unread. */
2060
+ declare const KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES: number;
2061
+
2060
2062
  declare const KAY_PLUGIN_PROTOCOL_PACKAGE_NAME: "@bonsai/plugin-protocol";
2061
2063
 
2062
2064
  declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
@@ -2633,8 +2635,19 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2633
2635
  * whichever process runs the plugin. A plugin's simulator file exports `createPluginSimulator`
2634
2636
  * (`KayPluginSimulatorFactory`). A clean break: only this repo's plugins read the old member, and
2635
2637
  * a plugin with no simulator is unaffected, so 0.28.0 stays served.
2638
+ *
2639
+ * 0.30.0 lets a scheduled workflow be described as data (#15722). `contributes.workflows` under
2640
+ * `kay.app` declares its name, schedule and sign-in, and `app.implementWorkflow(localId, run)`
2641
+ * supplies what a run does: each run is handed the workflow's accounts and tokens, so the code
2642
+ * runs the same in the daemon and in the plugin host. Additive: `app.workflows.define` stays, and
2643
+ * a plugin that declares a workflow declares ^0.30.0.
2644
+ *
2645
+ * 0.31.0 lets a plugin declare its rail entries as data (#15896). `railEntries` under `kay.ui`
2646
+ * `contributes` names each entry's title, page, shortcut and icon file. It replaces `activityRail` on a
2647
+ * UI app, which is stripped from a manifest that still carries it, so that manifest loses only the
2648
+ * rail button. A plugin that declares a rail entry declares ^0.31.0.
2636
2649
  */
2637
- declare const KAY_PLUGIN_SDK_VERSION: "0.29.0";
2650
+ declare const KAY_PLUGIN_SDK_VERSION: "0.31.0";
2638
2651
 
2639
2652
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2640
2653
 
@@ -4334,9 +4347,12 @@ export declare interface KayAppImageModelInfo {
4334
4347
  export declare interface KayAppKnowledge {
4335
4348
  registerSource(localId: string, source: KayAppKnowledgeSource): KayAppKnowledgeSourceHandle;
4336
4349
  /**
4337
- * Search the daemon's knowledge index within the schemes this plugin owns. Present only when
4338
- * the plugin's `kay.app` target declares the `knowledgeSearch` (`own-schemes`) permission and
4339
- * the daemon composed an index. A handle kept past disable or replacement never returns hits:
4350
+ * Search the daemon's knowledge index within the schemes this plugin owns, and within the URIs
4351
+ * its granted knowledge sources observe (an `output://` prefix while this plugin holds the
4352
+ * outputs grant, which `artifacts.outputs()` requests). A prefix outside both rejects the call;
4353
+ * a hit outside both is dropped; the host re-reads the source grant before and after the search, and a grant lost during the call answers `unavailable`.
4354
+ * Present only when the plugin's `kay.app` target declares the `knowledgeSearch` (`own-schemes`)
4355
+ * permission and the daemon composed an index. A handle kept past disable or replacement never returns hits:
4340
4356
  * the call rejects while the extension is disabled and resolves `unavailable` once a newer
4341
4357
  * activation has replaced it.
4342
4358
  */
@@ -4734,6 +4750,12 @@ export declare type KayAppModelSelection = {
4734
4750
  readonly kind: "tier";
4735
4751
  readonly tierId: KayAppModelTierId;
4736
4752
  readonly provider?: string | undefined;
4753
+ readonly constraints?: KayAppRouteConstraints | undefined;
4754
+ } | {
4755
+ /** One model by its bare id (`gpt-6-astra`), on whichever provider route serves it. */
4756
+ readonly kind: "model";
4757
+ readonly model: string;
4758
+ readonly constraints?: KayAppRouteConstraints | undefined;
4737
4759
  };
4738
4760
 
4739
4761
  /** `app.modelSelection`: registering the policy the daemon consults. */
@@ -5276,6 +5298,14 @@ export declare interface KayAppPluginApi {
5276
5298
  * fail-closed at activation, exactly like {@link registerUriModule}.
5277
5299
  */
5278
5300
  registerTool(localId: string, definition: KayAppToolDefinition): void;
5301
+ /**
5302
+ * Supply the code of a workflow this plugin's manifest declares under
5303
+ * `targets.kay.app.contributes.workflows` (SDK 0.30.0). The manifest says its name, schedule and
5304
+ * sign-in, so Bonsai schedules it without this code running; each run is handed its accounts and
5305
+ * tokens, so it runs the same wherever the plugin runs. Implementing an undeclared `localId`, or
5306
+ * declaring one this activation does not implement, fails the plugin.
5307
+ */
5308
+ implementWorkflow(localId: string, run: KayAppWorkflowImplementation): void;
5279
5309
  }
5280
5310
 
5281
5311
  export declare interface KayAppPluginEvents {
@@ -5308,12 +5338,6 @@ export declare interface KayAppPollerEvent {
5308
5338
  }
5309
5339
 
5310
5340
  export declare interface KayAppPollerOptions<Cursor extends JsonValue> {
5311
- readonly name: string;
5312
- readonly description: string;
5313
- /** Interval in milliseconds; the workflow engine enforces its scheduling floor. */
5314
- readonly every: number;
5315
- readonly serviceId: string;
5316
- readonly schemeId?: string;
5317
5341
  /** Cursor, events, and summary must contain no credentials or other secrets. */
5318
5342
  readonly poll: (input: {
5319
5343
  readonly account: KayAppAccountSummary;
@@ -5520,6 +5544,16 @@ export declare interface KayAppResolvedCredential {
5520
5544
  readonly fields?: Readonly<Record<string, string>>;
5521
5545
  }
5522
5546
 
5547
+ /** Hard limits on the routes a `tier` or `model` selection may use. */
5548
+ export declare interface KayAppRouteConstraints {
5549
+ /** Only this provider (a family such as `openai` covers its routes). */
5550
+ readonly provider?: string | undefined;
5551
+ /** Only models this vendor made. */
5552
+ readonly vendor?: string | undefined;
5553
+ /** No models this vendor made; an unknown vendor is excluded too. */
5554
+ readonly notVendor?: string | undefined;
5555
+ }
5556
+
5523
5557
  /**
5524
5558
  * What one run's work came to: `{ result: "deferred", reason: "catalog_not_ready" }`. Optional;
5525
5559
  * Bonsai keeps it on the run's record and does not show it to a person.
@@ -8032,6 +8066,16 @@ export declare interface KayAppWhiteboardTypes {
8032
8066
  registerType(localId: string, behavior: KayAppWhiteboardTypeBehavior): void;
8033
8067
  }
8034
8068
 
8069
+ /**
8070
+ * One connected account of a declared workflow's service, and its credential for this run. An
8071
+ * account that needs signing in again, or is missing a declared scope, arrives with that status
8072
+ * instead of a token. With no declared scopes, it needs one scope from the plugin's grant.
8073
+ */
8074
+ export declare interface KayAppWorkflowAccount {
8075
+ readonly account: KayAppAccountSummary;
8076
+ readonly credential: KayAppBackgroundCredentialResult;
8077
+ }
8078
+
8035
8079
  /**
8036
8080
  * What your `run` callback is handed when the trigger fires.
8037
8081
  *
@@ -8145,16 +8189,7 @@ export declare interface KayAppWorkflowDefinition<Trigger extends KayAppWorkflow
8145
8189
  * suits an event trigger whose runs each handle their own event; it cannot return `state`.
8146
8190
  */
8147
8191
  readonly concurrency?: KayAppAutomationConcurrency;
8148
- readonly run: (context: KayAppWorkflowContext<Trigger>) => Promise<{
8149
- /**
8150
- * Replacement JSON state, at most 64 KiB; omission keeps the previous value. Only a
8151
- * sequential workflow may return it: a `parallel` run that does fails.
8152
- */
8153
- readonly state?: JsonValue | undefined;
8154
- readonly summary: KayAppRunSummary;
8155
- readonly produced?: KayAppRunProduced;
8156
- readonly effect?: KayAppRunEffect;
8157
- }>;
8192
+ readonly run: (context: KayAppWorkflowContext<Trigger>) => Promise<KayAppWorkflowResult>;
8158
8193
  }
8159
8194
 
8160
8195
  /**
@@ -8173,6 +8208,9 @@ export declare class KayAppWorkflowFailure extends Error {
8173
8208
  constructor(summary: Omit<KayAppRunSummary, "author">, options?: ErrorOptions);
8174
8209
  }
8175
8210
 
8211
+ /** The code of a workflow the manifest declares under `contributes.workflows`. */
8212
+ export declare type KayAppWorkflowImplementation = (run: KayAppWorkflowRun) => Promise<KayAppWorkflowResult>;
8213
+
8176
8214
  export declare interface KayAppWorkflowInspection {
8177
8215
  readonly binding: KayAppManagedAutomation | null;
8178
8216
  readonly runs: readonly KayAppAutomationRun[];
@@ -8214,6 +8252,42 @@ export declare type KayAppWorkflowMatch<Trigger extends KayAppWorkflowTrigger =
8214
8252
  readonly kind: "time";
8215
8253
  }>);
8216
8254
 
8255
+ /** What a workflow run returns. */
8256
+ export declare interface KayAppWorkflowResult {
8257
+ /**
8258
+ * Replacement JSON state, at most 64 KiB; omission keeps the previous value. Only a
8259
+ * sequential workflow may return it: a `parallel` run that does fails.
8260
+ */
8261
+ readonly state?: JsonValue | undefined;
8262
+ readonly summary: KayAppRunSummary;
8263
+ readonly produced?: KayAppRunProduced;
8264
+ readonly effect?: KayAppRunEffect;
8265
+ }
8266
+
8267
+ /**
8268
+ * What a declared workflow's code is handed each run (`app.implementWorkflow`).
8269
+ *
8270
+ * The whole run is one recorded step, so an interrupted run starts again from the last saved
8271
+ * `state`: it may repeat provider reads and published events, so key events at their source.
8272
+ */
8273
+ export declare interface KayAppWorkflowRun {
8274
+ /** State from the last successful run; undefined until a run saves it. */
8275
+ readonly state: JsonValue | undefined;
8276
+ readonly runId: string;
8277
+ /**
8278
+ * Every connected account of the service and scheme the manifest's `auth` names, in a stable
8279
+ * order. Empty when it names none.
8280
+ */
8281
+ readonly accounts: readonly KayAppWorkflowAccount[];
8282
+ /**
8283
+ * Just runs `fn`, and returns once every event it published has reached Bonsai. Nothing is
8284
+ * recorded for now, so a repeated run runs it again. What it returns must be plain data.
8285
+ */
8286
+ readonly runStep: <T>(fn: () => Promise<T>, options?: {
8287
+ readonly name?: string;
8288
+ }) => Promise<T>;
8289
+ }
8290
+
8217
8291
  export declare interface KayAppWorkflows {
8218
8292
  define<Trigger extends KayAppWorkflowTrigger>(localId: string, definition: KayAppWorkflowDefinition<Trigger>): void;
8219
8293
  inspect(localId: string, options?: KayAppWorkflowInspectOptions): Promise<KayAppWorkflowInspection>;
@@ -13522,7 +13596,7 @@ declare interface Tool<TParameters extends TSchema = TSchema> {
13522
13596
  * classification (the engine records the rejection on an unexplained failure),
13523
13597
  * and a stored record with one reads as none.
13524
13598
  */
13525
- declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change"];
13599
+ declare const TOOL_CALL_FAILURE_CODES: readonly ["tool.invalid_input", "tool.blocked", "tool.cancelled", "tool.timeout", "tool.not_found", "tool.unavailable", "tool.execution_failed", "tool.auth_unavailable", "tool.replies_owed", "provider.http", "provider.api", "provider.transport", "uri.not_found", "uri.unsupported_operation", "uri.not_connected", "uri.auth_unavailable", "permission.denied", "edit.empty_edits", "edit.text_not_found", "edit.text_not_unique", "edit.empty_old_text", "edit.overlapping_edits", "edit.no_change", "uri.not_connected.pick_account", "uri.not_connected.account_not_allowed", "uri.not_connected.sign_in_expired", "tool.blocked.by_user", "tool.blocked.by_rule", "tool.blocked.by_bonsai"];
13526
13600
 
13527
13601
  /**
13528
13602
  * ---
package/dist/kay-app.js CHANGED
@@ -634,9 +634,6 @@ function accountCursors(state) {
634
634
  };
635
635
  });
636
636
  }
637
- function ordinal(left, right) {
638
- return left < right ? -1 : left > right ? 1 : 0;
639
- }
640
637
  function plainText(value, max) {
641
638
  let text = "";
642
639
  for (const character of value) {
@@ -649,125 +646,70 @@ function plainText(value, max) {
649
646
  return text;
650
647
  }
651
648
  function definePoller(app, localId, options) {
652
- const { workflows, auth, backgroundAuth, events } = app;
653
- if (!workflows)
654
- throw new Error("Poller requires workflows");
655
- if (!Number.isSafeInteger(options.every) || options.every <= 0) {
656
- throw new TypeError("Poller interval must be a positive integer in milliseconds");
657
- }
658
- workflows.define(localId, {
659
- name: options.name,
660
- description: options.description,
661
- trigger: {
662
- kind: "time",
663
- schedule: { kind: "every", intervalMs: options.every, anchorAtMs: 0 }
664
- },
665
- async run(ctx) {
666
- if (!auth)
667
- throw new Error("Poller requires account listing");
668
- if (!backgroundAuth)
669
- throw new Error("Poller requires background auth");
670
- const previous = accountCursors(ctx.state);
671
- const accounts = await ctx.runStep(async () => {
672
- const listed = await auth.listAccounts({
673
- serviceId: options.serviceId,
674
- ...options.schemeId === void 0 ? {} : { schemeId: options.schemeId }
675
- });
676
- return [...listed].sort((a, b) => ordinal(a.schemeId, b.schemeId) || ordinal(a.accountId, b.accountId));
677
- }, { name: "list-poller-accounts" });
678
- const next = [];
679
- const details = [];
680
- let published = 0;
681
- let initialized = 0;
682
- let skipped = 0;
683
- let failed = 0;
684
- for (const account of accounts) {
685
- const saved = previous.find((entry) => entry.schemeId === account.schemeId && entry.accountId === account.accountId);
686
- const outcome = await ctx.runStep(async () => {
687
- if (account.status === "needs_reauth" || account.status === "refresh_failed" || account.status === "revoked") {
688
- return {
689
- status: "skipped",
690
- summary: `Sign-in required (${account.status})`
691
- };
692
- }
693
- let credential;
694
- try {
695
- credential = await backgroundAuth.resolveCredential({
696
- serviceId: options.serviceId,
697
- schemeId: account.schemeId,
698
- accountId: account.accountId,
699
- jobId: ctx.runId
700
- });
701
- } catch {
702
- throw new Error("Poller credential resolution failed");
703
- }
704
- if (credential.status !== "resolved") {
705
- return {
706
- status: "skipped",
707
- summary: credential.status === "requires-auth" ? "Sign-in or required scope missing" : "Credential missing"
708
- };
709
- }
710
- try {
711
- const result = await options.poll({
712
- account,
713
- cursor: structuredClone(saved?.cursor),
714
- credential,
715
- runId: ctx.runId
716
- });
717
- return {
718
- status: "polled",
719
- result: {
720
- cursor: result.cursor,
721
- ...saved === void 0 || result.events === void 0 ? {} : { events: result.events },
722
- ...result.summary === void 0 ? {} : { summary: plainText(result.summary, 600) }
723
- }
724
- };
725
- } catch {
726
- return {
727
- status: "failed",
728
- summary: "Provider poll failed; cursor retained"
729
- };
730
- }
731
- }, { name: "poll-account" });
732
- if (outcome.status !== "polled") {
733
- if (saved !== void 0)
734
- next.push(saved);
735
- if (outcome.status === "skipped")
736
- skipped++;
737
- else
738
- failed++;
739
- details.push(`${account.schemeId}/${account.accountId}: ${outcome.summary}`);
740
- continue;
741
- }
742
- await ctx.runStep(async () => {
743
- for (const event of outcome.result.events ?? []) {
744
- events.publish(event.localId, {
745
- ...event.input,
746
- source: { poller: localId, runId: ctx.runId }
747
- });
748
- }
749
- return null;
750
- }, { name: "publish-poller-events" });
751
- published += outcome.result.events?.length ?? 0;
752
- if (saved === void 0)
753
- initialized++;
754
- next.push({
755
- schemeId: account.schemeId,
756
- accountId: account.accountId,
757
- cursor: outcome.result.cursor
649
+ const { events } = app;
650
+ app.implementWorkflow(localId, async ({ state, runId, accounts, runStep }) => {
651
+ const previous = accountCursors(state);
652
+ const next = [];
653
+ const details = [];
654
+ let published = 0;
655
+ let initialized = 0;
656
+ let skipped = 0;
657
+ let failed = 0;
658
+ for (const { account, credential } of accounts) {
659
+ const saved = previous.find((entry) => entry.schemeId === account.schemeId && entry.accountId === account.accountId);
660
+ const name = `${account.schemeId}/${account.accountId}`;
661
+ const keepSaved = (summary) => {
662
+ if (saved !== void 0)
663
+ next.push(saved);
664
+ details.push(`${name}: ${summary}`);
665
+ };
666
+ if (credential.status !== "resolved") {
667
+ skipped++;
668
+ keepSaved(credential.status === "requires-auth" ? "Sign-in or required scope missing" : "Credential missing");
669
+ continue;
670
+ }
671
+ let result;
672
+ try {
673
+ result = await options.poll({
674
+ account,
675
+ cursor: structuredClone(saved?.cursor),
676
+ credential,
677
+ runId
758
678
  });
759
- if (outcome.result.summary)
760
- details.push(`${account.schemeId}/${account.accountId}: ${outcome.result.summary}`);
679
+ } catch {
680
+ failed++;
681
+ keepSaved("Provider poll failed; cursor retained");
682
+ continue;
761
683
  }
762
- return {
763
- state: { accounts: next },
764
- summary: {
765
- headline: plainText(`${published} events; ${initialized} initialized; ${skipped} skipped; ${failed} failed`, 100),
766
- ...details.length === 0 ? {} : { details: plainText(details.join("; "), 600) },
767
- author: "automation"
684
+ const toPublish = saved === void 0 ? [] : result.events ?? [];
685
+ await runStep(async () => {
686
+ for (const event of toPublish) {
687
+ events.publish(event.localId, {
688
+ ...event.input,
689
+ source: { poller: localId, runId }
690
+ });
768
691
  }
769
- };
692
+ });
693
+ published += toPublish.length;
694
+ if (saved === void 0)
695
+ initialized++;
696
+ next.push({
697
+ schemeId: account.schemeId,
698
+ accountId: account.accountId,
699
+ cursor: result.cursor
700
+ });
701
+ if (result.summary) {
702
+ details.push(`${name}: ${plainText(result.summary, 600)}`);
703
+ }
770
704
  }
705
+ return {
706
+ state: { accounts: next },
707
+ summary: {
708
+ headline: plainText(`${published} events; ${initialized} initialized; ${skipped} skipped; ${failed} failed`, 100),
709
+ ...details.length === 0 ? {} : { details: plainText(details.join("; "), 600) },
710
+ author: "automation"
711
+ }
712
+ };
771
713
  });
772
714
  }
773
715
 
@@ -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.29.0",
3
+ "version": "0.31.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",
@@ -127,15 +127,18 @@ self-contained module: unlike the daemon targets, `ui.tsx` cannot import sibling
127
127
  plugin UI contributes through `api.slots` (`registerPage`, `registerSidebarItem`,
128
128
  `registerPaneAction`, and the rest of `buildSlots` in
129
129
  `packages/kay-renderer/src/renderer/src/extension-loader/build-extension-api.ts`). A page gets its own
130
- activity-rail button when a `registerSidebarItem({ pageId, placement: "activityRail" })` from the
131
- same plugin points at it.
130
+ activity-rail button when the manifest declares it: `railEntries` under `targets.kay.ui.contributes`,
131
+ with `id`, `title` and `page`, and optionally `icon`, `shortcut`, `order` and `section`. That
132
+ declaration works with no `ui.tsx` at all.
132
133
 
133
134
  **Icons: declare one plugin icon, override only where you mean it.** Set the manifest `icon` (a
134
135
  package-relative SVG) and every surface the plugin contributes inherits it: reference pills, its
135
136
  rail button, and its pages' tabs, pane headers and palette entries (shown as your full-colour mark
136
- on a small white tile). Set `icon` on a `registerSidebarItem` or `registerPage` descriptor only to
137
- show a monochrome glyph there instead (a glyph name such as `"git-branch"`, or `{ svg }`); a page
138
- and its rail item borrow each other's glyph, so one declaration covers the destination. Full
137
+ on a small white tile). Set `icon` on a rail entry to show a single-colour glyph on the rail: a path to an SVG in
138
+ the plugin (`"./assets/rail.svg"`). Only its shape is used, painted in the rail's colour, so colours
139
+ in the file are ignored, and it must be transparent where nothing should draw. A missing file is a
140
+ load diagnostic and the entry falls back to the plugin icon. The page the entry opens wears the same
141
+ icon unless `registerPage`'s `icon` says otherwise. Full
139
142
  precedence: `packages/kay-frontend-sdk/ARCHITECTURE.md`, "Plugin icon".
140
143
 
141
144
  `ui.tsx` has no `node_modules` of its own. The renderer bundles it and rewrites its `react` and