@yaklabs-ai/plugin-protocol 0.37.0 → 0.38.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
@@ -11,7 +11,7 @@ flow.
11
11
  ```json
12
12
  {
13
13
  "dependencies": {
14
- "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.37.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.38.0"
15
15
  }
16
16
  }
17
17
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-protocol",
4
- "version": "0.37.0",
4
+ "version": "0.38.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -2528,25 +2528,25 @@ declare const canonicalContributionSchemas: {
2528
2528
  }, z.core.$strict>;
2529
2529
  McpServerUrl: z.ZodString;
2530
2530
  McpServerAuthMode: z.ZodEnum<{
2531
+ none: "none";
2531
2532
  oauth: "oauth";
2532
2533
  "api-key": "api-key";
2533
- none: "none";
2534
2534
  }>;
2535
2535
  McpServerContribution: z.ZodObject<{
2536
2536
  url: z.ZodString;
2537
2537
  auth: z.ZodOptional<z.ZodEnum<{
2538
+ none: "none";
2538
2539
  oauth: "oauth";
2539
2540
  "api-key": "api-key";
2540
- none: "none";
2541
2541
  }>>;
2542
2542
  authService: z.ZodOptional<z.ZodString>;
2543
2543
  }, z.core.$strict>;
2544
2544
  McpServerContributions: z.ZodRecord<z.ZodString, z.ZodObject<{
2545
2545
  url: z.ZodString;
2546
2546
  auth: z.ZodOptional<z.ZodEnum<{
2547
+ none: "none";
2547
2548
  oauth: "oauth";
2548
2549
  "api-key": "api-key";
2549
- none: "none";
2550
2550
  }>>;
2551
2551
  authService: z.ZodOptional<z.ZodString>;
2552
2552
  }, z.core.$strict>>;
@@ -2567,6 +2567,7 @@ declare const canonicalContributionSchemas: {
2567
2567
  uriScheme: z.ZodString;
2568
2568
  relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
2569
2569
  payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
2570
+ signal: z.ZodOptional<z.ZodBoolean>;
2570
2571
  }, z.core.$strict>;
2571
2572
  PluginNotificationRuleContribution: z.ZodObject<{
2572
2573
  localId: z.ZodString;
@@ -3434,6 +3435,20 @@ export declare function isCanonicalArtifactOutputUri(uri: string): boolean;
3434
3435
  /** Whether the report permits the plugin to load. */
3435
3436
  export declare function isCompatible(report: KayPluginCompatibilityReport): boolean;
3436
3437
 
3438
+ /**
3439
+ * The recognized credential VALUE formats: one detector for the runtime wire's raw-credential
3440
+ * tripwire (`@bonsai/agent-runtime-protocol`'s `hasRawCredentialField`) and for a plugin that
3441
+ * must keep such text out of what it publishes, so the two cannot disagree on what a hit is.
3442
+ * Lives here, below both, because a plugin cannot import the runtime protocol.
3443
+ */
3444
+ /**
3445
+ * Whether `value` is a string in a recognized credential format (a whole `sk-...`, `ghp_...` or
3446
+ * `xoxb-...` token, a JWT, an Authorization header value, or anything holding a PEM private key
3447
+ * block). A publisher that copies outside text into an event drops or replaces such a string:
3448
+ * the daemon refuses an event that carries one.
3449
+ */
3450
+ export declare function isCredentialShapedText(value: unknown): boolean;
3451
+
3437
3452
  /**
3438
3453
  * Whether a refusal `code` came from the compatibility check: the plugin was written for another
3439
3454
  * SDK or protocol, as opposed to being malformed.
@@ -4152,8 +4167,17 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4152
4167
  * `contributes` names the `rule`, the `body` that fills the preview, either a `contextOnly` app in
4153
4168
  * the plugin or a body the host ships, and the `address` it is about. Additive. A plugin that
4154
4169
  * declares a preview declares ^0.37.0.
4170
+ *
4171
+ * 0.37.1 adds the required, ungated `featureFlags.value(key)` reader to both backend targets.
4172
+ * Unknown keys return false; the host supplies evaluated values before activation and updates them.
4173
+ * Additive: existing plugins keep loading. A consumer declares ^0.37.1.
4174
+ *
4175
+ * 0.38.0 adds signals (epic #15668). An event definition may declare `signal: true`, and its payload
4176
+ * is then the shared `PluginSignal` v1 with a `related.thread`; a workflow of a plugin the release
4177
+ * carries may start on every plugin's signals with `{ kind: "plugin-event", signals: true }` (the
4178
+ * private `workflows.signals` claim). Additive: a plugin that declares a signal declares ^0.38.0.
4155
4179
  */
4156
- export declare const KAY_PLUGIN_SDK_VERSION: "0.37.0";
4180
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.38.0";
4157
4181
 
4158
4182
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4159
4183
 
@@ -4770,6 +4794,7 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4770
4794
  uriScheme: z.ZodString;
4771
4795
  relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
4772
4796
  payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
4797
+ signal: z.ZodOptional<z.ZodBoolean>;
4773
4798
  }, z.core.$strict>>>;
4774
4799
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
4775
4800
  localId: z.ZodString;
@@ -4809,9 +4834,9 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4809
4834
  mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
4810
4835
  url: z.ZodString;
4811
4836
  auth: z.ZodOptional<z.ZodEnum<{
4837
+ none: "none";
4812
4838
  oauth: "oauth";
4813
4839
  "api-key": "api-key";
4814
- none: "none";
4815
4840
  }>>;
4816
4841
  authService: z.ZodOptional<z.ZodString>;
4817
4842
  }, z.core.$strict>>>;
@@ -5541,6 +5566,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5541
5566
  uriScheme: z.ZodString;
5542
5567
  relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
5543
5568
  payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5569
+ signal: z.ZodOptional<z.ZodBoolean>;
5544
5570
  }, z.core.$strict>>>;
5545
5571
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5546
5572
  localId: z.ZodString;
@@ -5580,9 +5606,9 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5580
5606
  mcpServers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
5581
5607
  url: z.ZodString;
5582
5608
  auth: z.ZodOptional<z.ZodEnum<{
5609
+ none: "none";
5583
5610
  oauth: "oauth";
5584
5611
  "api-key": "api-key";
5585
- none: "none";
5586
5612
  }>>;
5587
5613
  authService: z.ZodOptional<z.ZodString>;
5588
5614
  }, z.core.$strict>>>;
@@ -6992,9 +7018,9 @@ export declare const MCP_SIGN_IN_SCHEME_KIND: {
6992
7018
  };
6993
7019
 
6994
7020
  export declare const McpServerAuthMode: z.ZodEnum<{
7021
+ none: "none";
6995
7022
  oauth: "oauth";
6996
7023
  "api-key": "api-key";
6997
- none: "none";
6998
7024
  }>;
6999
7025
 
7000
7026
  export declare type McpServerAuthMode = z.infer<typeof McpServerAuthMode>;
@@ -7002,9 +7028,9 @@ export declare type McpServerAuthMode = z.infer<typeof McpServerAuthMode>;
7002
7028
  export declare const McpServerContribution: z.ZodObject<{
7003
7029
  url: z.ZodString;
7004
7030
  auth: z.ZodOptional<z.ZodEnum<{
7031
+ none: "none";
7005
7032
  oauth: "oauth";
7006
7033
  "api-key": "api-key";
7007
- none: "none";
7008
7034
  }>>;
7009
7035
  authService: z.ZodOptional<z.ZodString>;
7010
7036
  }, z.core.$strict>;
@@ -7014,9 +7040,9 @@ export declare type McpServerContribution = z.infer<typeof McpServerContribution
7014
7040
  export declare const McpServerContributions: z.ZodRecord<z.ZodString, z.ZodObject<{
7015
7041
  url: z.ZodString;
7016
7042
  auth: z.ZodOptional<z.ZodEnum<{
7043
+ none: "none";
7017
7044
  oauth: "oauth";
7018
7045
  "api-key": "api-key";
7019
- none: "none";
7020
7046
  }>>;
7021
7047
  authService: z.ZodOptional<z.ZodString>;
7022
7048
  }, z.core.$strict>>;
@@ -7145,7 +7171,7 @@ export declare function parseSemver(value: string): ParsedSemver | undefined;
7145
7171
  export declare function parseWhere(source: string, keyTypes?: WhereKeyTypes): WhereParseResult;
7146
7172
 
7147
7173
  /** Every capability slug {@link PluginCapabilityClaimV1} can express, for exhaustive table checks. */
7148
- export declare const PLUGIN_CAPABILITY_SLUGS: readonly ["sessions.run", "network.connect", "web-session.request", "web-session.download", "process.spawn", "sessions.read", "signals.read", "memory.read", "memory.write", "skills.read", "skills.write", "skills.share", "plugins.set-enabled", "sessions.annotate", "sessions.compact", "soul.write", "tools.describe", "workspace.command", "sessions.create", "sessions.update", "models.complete", "systemOne.use", "automations.write", "automations.run", "workflows.define", "session-events.subscribe", "agents.run", "dynamic-context.register", "app-data.register", "knowledge-source.register", "artifacts.read", "account.assert", "account.update", "agents.permissions", "tool-interception.register", "interaction.surface", "config.declare-section", "auth.own-service", "auth.shared-identity", "cli.bind", "mcp.host-server", "prompt.resident", "skills.declared-source", "whiteboard.discover", "whiteboard.read", "whiteboard.create", "whiteboard.update", "whiteboard.remove", "model-selection.register", "system-prompt.register"];
7174
+ export declare const PLUGIN_CAPABILITY_SLUGS: readonly ["sessions.run", "network.connect", "web-session.request", "web-session.download", "process.spawn", "sessions.read", "signals.read", "memory.read", "memory.write", "skills.read", "skills.write", "skills.share", "plugins.set-enabled", "sessions.annotate", "sessions.compact", "soul.write", "tools.describe", "workspace.command", "sessions.create", "sessions.update", "models.complete", "systemOne.use", "automations.write", "automations.run", "workflows.define", "workflows.signals", "session-events.subscribe", "agents.run", "dynamic-context.register", "app-data.register", "knowledge-source.register", "artifacts.read", "account.assert", "account.update", "agents.permissions", "tool-interception.register", "interaction.surface", "config.declare-section", "auth.own-service", "auth.shared-identity", "cli.bind", "mcp.host-server", "prompt.resident", "skills.declared-source", "whiteboard.discover", "whiteboard.read", "whiteboard.create", "whiteboard.update", "whiteboard.remove", "model-selection.register", "system-prompt.register"];
7149
7175
 
7150
7176
  /** Diagnostic messages carry plugin-controlled text (parse errors, module errors); bound it so a
7151
7177
  * hostile or accidental multi-megabyte error can never blow up a log line or a render surface. */
@@ -7153,12 +7179,32 @@ export declare const PLUGIN_DIAGNOSTIC_MESSAGE_CAP = 300;
7153
7179
 
7154
7180
  export declare const PLUGIN_EVENT_ID_MAX_BYTES = 1024;
7155
7181
 
7182
+ /**
7183
+ * The `name` of the error a host throws when it refuses a publish because the event is invalid.
7184
+ * A publisher skips such an event; any other publish failure may be transient.
7185
+ */
7186
+ export declare const PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
7187
+
7156
7188
  /** The root `<svg>` attribute a tile icon declares itself with. */
7157
7189
  export declare const PLUGIN_ICON_SHAPE_ATTRIBUTE = "data-icon-shape";
7158
7190
 
7159
7191
  /** Rule-body keys the host stamps, so a manifest's `rule` may not carry them. */
7160
7192
  export declare const PLUGIN_NOTIFICATION_RULE_HOST_KEYS: readonly ["id", "match", "sender"];
7161
7193
 
7194
+ /** The `kind` values of `PluginSignal` v1. `status` is system state that clears itself. */
7195
+ export declare const PLUGIN_SIGNAL_KINDS: readonly ["message", "request", "mention", "invite", "status"];
7196
+
7197
+ export declare const PLUGIN_SIGNAL_LABEL_MAX = 64;
7198
+
7199
+ export declare const PLUGIN_SIGNAL_LABELS_MAX = 20;
7200
+
7201
+ /** The `related` keys a signal may use; `thread` is required on every signal publish. */
7202
+ export declare const PLUGIN_SIGNAL_RELATED_KEYS: readonly ["thread", "from", "to", "cc"];
7203
+
7204
+ export declare const PLUGIN_SIGNAL_SNIPPET_MAX = 500;
7205
+
7206
+ export declare const PLUGIN_SIGNAL_TITLE_MAX = 300;
7207
+
7162
7208
  export declare const PluginAgentDefinitionPermissionRule: z.ZodObject<{
7163
7209
  effect: z.ZodEnum<{
7164
7210
  allow: "allow";
@@ -7747,6 +7793,10 @@ export declare const PluginCapabilityClaimInputV1: z.ZodCustom<{
7747
7793
  target: "kay.app";
7748
7794
  slug: "workflows.define";
7749
7795
  envelope: Record<string, never>;
7796
+ } | {
7797
+ target: "kay.app";
7798
+ slug: "workflows.signals";
7799
+ envelope: Record<string, never>;
7750
7800
  } | {
7751
7801
  target: "kay.app";
7752
7802
  slug: "session-events.subscribe";
@@ -7992,6 +8042,10 @@ export declare const PluginCapabilityClaimInputV1: z.ZodCustom<{
7992
8042
  target: "kay.app";
7993
8043
  slug: "workflows.define";
7994
8044
  envelope: Record<string, never>;
8045
+ } | {
8046
+ target: "kay.app";
8047
+ slug: "workflows.signals";
8048
+ envelope: Record<string, never>;
7995
8049
  } | {
7996
8050
  target: "kay.app";
7997
8051
  slug: "session-events.subscribe";
@@ -8233,6 +8287,10 @@ export declare const PluginCapabilityClaimV1: z.ZodDiscriminatedUnion<[z.ZodObje
8233
8287
  target: z.ZodLiteral<"kay.app">;
8234
8288
  slug: z.ZodLiteral<"workflows.define">;
8235
8289
  envelope: z.ZodObject<{}, z.core.$strict>;
8290
+ }, z.core.$strict>, z.ZodObject<{
8291
+ target: z.ZodLiteral<"kay.app">;
8292
+ slug: z.ZodLiteral<"workflows.signals">;
8293
+ envelope: z.ZodObject<{}, z.core.$strict>;
8236
8294
  }, z.core.$strict>, z.ZodObject<{
8237
8295
  target: z.ZodLiteral<"kay.app">;
8238
8296
  slug: z.ZodLiteral<"session-events.subscribe">;
@@ -8517,6 +8575,10 @@ export declare const PluginCapabilityDecisionV1: z.ZodDiscriminatedUnion<[z.ZodO
8517
8575
  target: z.ZodLiteral<"kay.app">;
8518
8576
  slug: z.ZodLiteral<"workflows.define">;
8519
8577
  envelope: z.ZodObject<{}, z.core.$strict>;
8578
+ }, z.core.$strict>, z.ZodObject<{
8579
+ target: z.ZodLiteral<"kay.app">;
8580
+ slug: z.ZodLiteral<"workflows.signals">;
8581
+ envelope: z.ZodObject<{}, z.core.$strict>;
8520
8582
  }, z.core.$strict>, z.ZodObject<{
8521
8583
  target: z.ZodLiteral<"kay.app">;
8522
8584
  slug: z.ZodLiteral<"session-events.subscribe">;
@@ -8800,6 +8862,10 @@ export declare const PluginCapabilityDecisionV1: z.ZodDiscriminatedUnion<[z.ZodO
8800
8862
  target: z.ZodLiteral<"kay.app">;
8801
8863
  slug: z.ZodLiteral<"workflows.define">;
8802
8864
  envelope: z.ZodObject<{}, z.core.$strict>;
8865
+ }, z.core.$strict>, z.ZodObject<{
8866
+ target: z.ZodLiteral<"kay.app">;
8867
+ slug: z.ZodLiteral<"workflows.signals">;
8868
+ envelope: z.ZodObject<{}, z.core.$strict>;
8803
8869
  }, z.core.$strict>, z.ZodObject<{
8804
8870
  target: z.ZodLiteral<"kay.app">;
8805
8871
  slug: z.ZodLiteral<"session-events.subscribe">;
@@ -9117,6 +9183,10 @@ export declare const PluginCapabilityRefusalV1: z.ZodObject<{
9117
9183
  target: z.ZodLiteral<"kay.app">;
9118
9184
  slug: z.ZodLiteral<"workflows.define">;
9119
9185
  envelope: z.ZodObject<{}, z.core.$strict>;
9186
+ }, z.core.$strict>, z.ZodObject<{
9187
+ target: z.ZodLiteral<"kay.app">;
9188
+ slug: z.ZodLiteral<"workflows.signals">;
9189
+ envelope: z.ZodObject<{}, z.core.$strict>;
9120
9190
  }, z.core.$strict>, z.ZodObject<{
9121
9191
  target: z.ZodLiteral<"kay.app">;
9122
9192
  slug: z.ZodLiteral<"session-events.subscribe">;
@@ -9399,6 +9469,7 @@ export declare const PluginEventDefinitionContribution: z.ZodObject<{
9399
9469
  uriScheme: z.ZodString;
9400
9470
  relatedKeys: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
9401
9471
  payloadSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
9472
+ signal: z.ZodOptional<z.ZodBoolean>;
9402
9473
  }, z.core.$strict>;
9403
9474
 
9404
9475
  export declare type PluginEventDefinitionContribution = z.infer<typeof PluginEventDefinitionContribution>;
@@ -10207,6 +10278,92 @@ export declare const PluginProvisioningRequirement: z.ZodObject<{
10207
10278
 
10208
10279
  export declare type PluginProvisioningRequirement = z.infer<typeof PluginProvisioningRequirement>;
10209
10280
 
10281
+ export declare const PluginSignal: z.ZodObject<{
10282
+ kind: z.ZodEnum<{
10283
+ message: "message";
10284
+ status: "status";
10285
+ request: "request";
10286
+ mention: "mention";
10287
+ invite: "invite";
10288
+ }>;
10289
+ direction: z.ZodOptional<z.ZodEnum<{
10290
+ out: "out";
10291
+ in: "in";
10292
+ }>>;
10293
+ title: z.ZodOptional<z.ZodString>;
10294
+ snippet: z.ZodOptional<z.ZodString>;
10295
+ actor: z.ZodOptional<z.ZodObject<{
10296
+ name: z.ZodOptional<z.ZodString>;
10297
+ uri: z.ZodString;
10298
+ }, z.core.$strict>>;
10299
+ addressed: z.ZodOptional<z.ZodEnum<{
10300
+ mention: "mention";
10301
+ cc: "cc";
10302
+ direct: "direct";
10303
+ group: "group";
10304
+ none: "none";
10305
+ }>>;
10306
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
10307
+ dueAt: z.ZodOptional<z.ZodISODateTime>;
10308
+ state: z.ZodOptional<z.ZodEnum<{
10309
+ open: "open";
10310
+ resolved: "resolved";
10311
+ }>>;
10312
+ }, z.core.$strict>;
10313
+
10314
+ export declare type PluginSignal = z.infer<typeof PluginSignal>;
10315
+
10316
+ export declare type PluginSignalKind = (typeof PLUGIN_SIGNAL_KINDS)[number];
10317
+
10318
+ /**
10319
+ * `PluginSignal` v1 as JSON Schema, for the hosts that check a `payload.*` filter path against a
10320
+ * declaration. A signal definition declares no `payloadSchema`; this stands in for it.
10321
+ */
10322
+ export declare function pluginSignalPayloadJsonSchema(): Record<string, unknown>;
10323
+
10324
+ export declare const PluginSignalPublish: z.ZodObject<{
10325
+ payload: z.ZodObject<{
10326
+ kind: z.ZodEnum<{
10327
+ message: "message";
10328
+ status: "status";
10329
+ request: "request";
10330
+ mention: "mention";
10331
+ invite: "invite";
10332
+ }>;
10333
+ direction: z.ZodOptional<z.ZodEnum<{
10334
+ out: "out";
10335
+ in: "in";
10336
+ }>>;
10337
+ title: z.ZodOptional<z.ZodString>;
10338
+ snippet: z.ZodOptional<z.ZodString>;
10339
+ actor: z.ZodOptional<z.ZodObject<{
10340
+ name: z.ZodOptional<z.ZodString>;
10341
+ uri: z.ZodString;
10342
+ }, z.core.$strict>>;
10343
+ addressed: z.ZodOptional<z.ZodEnum<{
10344
+ mention: "mention";
10345
+ cc: "cc";
10346
+ direct: "direct";
10347
+ group: "group";
10348
+ none: "none";
10349
+ }>>;
10350
+ labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
10351
+ dueAt: z.ZodOptional<z.ZodISODateTime>;
10352
+ state: z.ZodOptional<z.ZodEnum<{
10353
+ open: "open";
10354
+ resolved: "resolved";
10355
+ }>>;
10356
+ }, z.core.$strict>;
10357
+ related: z.ZodObject<{
10358
+ thread: z.ZodString;
10359
+ from: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
10360
+ to: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
10361
+ cc: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
10362
+ }, z.core.$strict>;
10363
+ }, z.core.$strip>;
10364
+
10365
+ export declare type PluginSignalPublish = z.infer<typeof PluginSignalPublish>;
10366
+
10210
10367
  export declare const PluginSkillSourceDeclaration: z.ZodDiscriminatedUnion<[z.ZodObject<{
10211
10368
  channel: z.ZodLiteral<"installer">;
10212
10369
  localId: z.ZodString;
@@ -10950,9 +11107,9 @@ export declare const ResolvedKayAppMcpServer: z.ZodObject<{
10950
11107
  pluginId: z.ZodString;
10951
11108
  url: z.ZodString;
10952
11109
  auth: z.ZodEnum<{
11110
+ none: "none";
10953
11111
  oauth: "oauth";
10954
11112
  "api-key": "api-key";
10955
- none: "none";
10956
11113
  }>;
10957
11114
  authServiceId: z.ZodOptional<z.ZodString>;
10958
11115
  }, z.core.$strict>;
@@ -12243,9 +12400,9 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12243
12400
  pluginId: z.ZodString;
12244
12401
  url: z.ZodString;
12245
12402
  auth: z.ZodEnum<{
12403
+ none: "none";
12246
12404
  oauth: "oauth";
12247
12405
  "api-key": "api-key";
12248
- none: "none";
12249
12406
  }>;
12250
12407
  authServiceId: z.ZodOptional<z.ZodString>;
12251
12408
  }, z.core.$strict>>>;
package/dist/index.js CHANGED
@@ -254,7 +254,7 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
254
254
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
255
255
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
256
256
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
257
- var KAY_PLUGIN_SDK_VERSION = "0.37.0";
257
+ var KAY_PLUGIN_SDK_VERSION = "0.38.0";
258
258
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
259
259
  "0.26.3",
260
260
  "0.27.1",
@@ -266,7 +266,8 @@ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
266
266
  "0.33.0",
267
267
  "0.34.0",
268
268
  "0.35.0",
269
- "0.36.0"
269
+ "0.36.0",
270
+ "0.37.1"
270
271
  ];
271
272
  var KAY_PLUGIN_TARGET_NAMES = [
272
273
  "kay.agent",
@@ -1755,6 +1756,7 @@ var PLUGIN_CAPABILITY_SLUGS = [
1755
1756
  "automations.write",
1756
1757
  "automations.run",
1757
1758
  "workflows.define",
1759
+ "workflows.signals",
1758
1760
  "session-events.subscribe",
1759
1761
  "agents.run",
1760
1762
  "dynamic-context.register",
@@ -1786,7 +1788,8 @@ var PRIVATE_PLUGIN_CAPABILITY_SLUGS = [
1786
1788
  "soul.write",
1787
1789
  "skills.share",
1788
1790
  "plugins.set-enabled",
1789
- "system-prompt.register"
1791
+ "system-prompt.register",
1792
+ "workflows.signals"
1790
1793
  ];
1791
1794
  function isPrivateCapabilityClaim(claim) {
1792
1795
  return PRIVATE_PLUGIN_CAPABILITY_SLUGS.includes(claim.slug);
@@ -2011,6 +2014,14 @@ function createAuthoritySchemas(canonical) {
2011
2014
  slug: z10.literal("workflows.define"),
2012
2015
  envelope: z10.strictObject({})
2013
2016
  }),
2017
+ z10.strictObject({
2018
+ // Start a declared workflow on every plugin's signal events (`signals: true`), which carry
2019
+ // other plugins' data. Private (PRIVATE_PLUGIN_CAPABILITY_SLUGS): only a plugin the release
2020
+ // carries may hold it, so a third-party plugin cannot read every source's signals.
2021
+ target: z10.literal("kay.app"),
2022
+ slug: z10.literal("workflows.signals"),
2023
+ envelope: z10.strictObject({})
2024
+ }),
2014
2025
  z10.strictObject({
2015
2026
  target: z10.literal("kay.app"),
2016
2027
  slug: z10.literal("session-events.subscribe"),
@@ -2242,6 +2253,7 @@ function sameClaim(a, b) {
2242
2253
  case "automations.write":
2243
2254
  case "automations.run":
2244
2255
  case "workflows.define":
2256
+ case "workflows.signals":
2245
2257
  case "session-events.subscribe":
2246
2258
  case "agents.run":
2247
2259
  case "account.assert":
@@ -2326,6 +2338,7 @@ function envelopePairs(a, b) {
2326
2338
  case "automations.write":
2327
2339
  case "automations.run":
2328
2340
  case "workflows.define":
2341
+ case "workflows.signals":
2329
2342
  case "session-events.subscribe":
2330
2343
  case "agents.run":
2331
2344
  case "account.assert":
@@ -2777,6 +2790,13 @@ import { z as z12 } from "zod";
2777
2790
  var plugin_events_exports = {};
2778
2791
  __export(plugin_events_exports, {
2779
2792
  PLUGIN_EVENT_ID_MAX_BYTES: () => PLUGIN_EVENT_ID_MAX_BYTES,
2793
+ PLUGIN_EVENT_REFUSED_ERROR_NAME: () => PLUGIN_EVENT_REFUSED_ERROR_NAME,
2794
+ PLUGIN_SIGNAL_KINDS: () => PLUGIN_SIGNAL_KINDS,
2795
+ PLUGIN_SIGNAL_LABELS_MAX: () => PLUGIN_SIGNAL_LABELS_MAX,
2796
+ PLUGIN_SIGNAL_LABEL_MAX: () => PLUGIN_SIGNAL_LABEL_MAX,
2797
+ PLUGIN_SIGNAL_RELATED_KEYS: () => PLUGIN_SIGNAL_RELATED_KEYS,
2798
+ PLUGIN_SIGNAL_SNIPPET_MAX: () => PLUGIN_SIGNAL_SNIPPET_MAX,
2799
+ PLUGIN_SIGNAL_TITLE_MAX: () => PLUGIN_SIGNAL_TITLE_MAX,
2780
2800
  PluginEventEnvelope: () => PluginEventEnvelope,
2781
2801
  PluginEventId: () => PluginEventId,
2782
2802
  PluginEventLocalId: () => PluginEventLocalId,
@@ -2786,9 +2806,34 @@ __export(plugin_events_exports, {
2786
2806
  PluginEventSource: () => PluginEventSource,
2787
2807
  PluginEventTimestamp: () => PluginEventTimestamp,
2788
2808
  PluginEventUri: () => PluginEventUri,
2789
- canonicalPluginEventSchemas: () => canonicalPluginEventSchemas
2809
+ PluginSignal: () => PluginSignal,
2810
+ PluginSignalPublish: () => PluginSignalPublish,
2811
+ canonicalPluginEventSchemas: () => canonicalPluginEventSchemas,
2812
+ pluginSignalPayloadJsonSchema: () => pluginSignalPayloadJsonSchema
2790
2813
  });
2791
2814
  import { z as z11 } from "zod";
2815
+
2816
+ // packages/plugin-protocol/dist/plugin-signal-limits.js
2817
+ var PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
2818
+ var PLUGIN_SIGNAL_KINDS = [
2819
+ "message",
2820
+ "request",
2821
+ "mention",
2822
+ "invite",
2823
+ "status"
2824
+ ];
2825
+ var PLUGIN_SIGNAL_TITLE_MAX = 300;
2826
+ var PLUGIN_SIGNAL_SNIPPET_MAX = 500;
2827
+ var PLUGIN_SIGNAL_LABELS_MAX = 20;
2828
+ var PLUGIN_SIGNAL_LABEL_MAX = 64;
2829
+ var PLUGIN_SIGNAL_RELATED_KEYS = [
2830
+ "thread",
2831
+ "from",
2832
+ "to",
2833
+ "cc"
2834
+ ];
2835
+
2836
+ // packages/plugin-protocol/dist/plugin-events.js
2792
2837
  var PLUGIN_EVENT_ID_MAX_BYTES = 1024;
2793
2838
  function createPluginEventsSchemas(canonical) {
2794
2839
  const { GlobalContributionId: GlobalContributionId2, NonEmptyString: NonEmptyString3 } = canonical ? canonicalCommonSchemas : common_exports;
@@ -2840,7 +2885,39 @@ function createPluginEventsSchemas(canonical) {
2840
2885
  source: PluginEventSource2,
2841
2886
  payload: JsonValue.optional()
2842
2887
  });
2888
+ const PluginSignal2 = z11.strictObject({
2889
+ kind: z11.enum(PLUGIN_SIGNAL_KINDS),
2890
+ direction: z11.enum(["in", "out"]).optional(),
2891
+ title: z11.string().max(PLUGIN_SIGNAL_TITLE_MAX).optional(),
2892
+ snippet: z11.string().max(PLUGIN_SIGNAL_SNIPPET_MAX).optional(),
2893
+ actor: z11.strictObject({
2894
+ name: z11.string().max(PLUGIN_SIGNAL_TITLE_MAX).optional(),
2895
+ uri: PluginEventUri2
2896
+ }).optional(),
2897
+ addressed: z11.enum(["direct", "cc", "mention", "group", "none"]).optional(),
2898
+ labels: z11.array(z11.string().min(1).max(PLUGIN_SIGNAL_LABEL_MAX)).max(PLUGIN_SIGNAL_LABELS_MAX).optional(),
2899
+ dueAt: PluginEventTimestamp2.optional(),
2900
+ state: z11.enum(["open", "resolved"]).optional()
2901
+ }).refine((signal) => signal.state === void 0 || signal.kind === "status", {
2902
+ message: "state is only for a status signal",
2903
+ path: ["state"]
2904
+ });
2905
+ const PluginSignalRelatedValue = z11.union([
2906
+ PluginEventUri2,
2907
+ z11.array(PluginEventUri2)
2908
+ ]);
2909
+ const PluginSignalPublish2 = z11.object({
2910
+ payload: PluginSignal2,
2911
+ related: z11.strictObject({
2912
+ thread: PluginEventUri2,
2913
+ from: PluginSignalRelatedValue.optional(),
2914
+ to: PluginSignalRelatedValue.optional(),
2915
+ cc: PluginSignalRelatedValue.optional()
2916
+ })
2917
+ });
2843
2918
  return {
2919
+ PluginSignal: PluginSignal2,
2920
+ PluginSignalPublish: PluginSignalPublish2,
2844
2921
  PluginEventLocalId: PluginEventLocalId2,
2845
2922
  PluginEventUri: PluginEventUri2,
2846
2923
  PluginEventTimestamp: PluginEventTimestamp2,
@@ -2852,8 +2929,14 @@ function createPluginEventsSchemas(canonical) {
2852
2929
  PluginEventEnvelope: PluginEventEnvelope2
2853
2930
  };
2854
2931
  }
2855
- var { PluginEventLocalId, PluginEventUri, PluginEventTimestamp, PluginEventRelated, PluginEventPublishSource, PluginEventSource, PluginEventId, PluginEventPublishInput, PluginEventEnvelope } = createPluginEventsSchemas(false);
2932
+ var { PluginSignal, PluginSignalPublish, PluginEventLocalId, PluginEventUri, PluginEventTimestamp, PluginEventRelated, PluginEventPublishSource, PluginEventSource, PluginEventId, PluginEventPublishInput, PluginEventEnvelope } = createPluginEventsSchemas(false);
2856
2933
  var canonicalPluginEventSchemas = createPluginEventsSchemas(true);
2934
+ function pluginSignalPayloadJsonSchema() {
2935
+ return z11.toJSONSchema(PluginSignal, {
2936
+ io: "input",
2937
+ unrepresentable: "any"
2938
+ });
2939
+ }
2857
2940
 
2858
2941
  // packages/plugin-protocol/dist/where-expression.js
2859
2942
  var TOKEN = /\s*(?:(\|\||&&|==|!=|!|\(|\))|'([^']*)'|"([^"]*)"|([A-Za-z][A-Za-z0-9]*(?:\.[A-Za-z][A-Za-z0-9]*)*))/y;
@@ -3588,7 +3671,34 @@ function createContributionsSchemas(canonical) {
3588
3671
  version: canonical ? EventDefinitionVersion : EventDefinitionVersion.default(1),
3589
3672
  uriScheme: UriScheme2,
3590
3673
  relatedKeys: z12.array(NonEmptyString3).readonly().optional(),
3591
- payloadSchema: JsonSchema.optional()
3674
+ payloadSchema: JsonSchema.optional(),
3675
+ /**
3676
+ * This event is a signal: its payload is the shared `PluginSignal` v1 and every publish
3677
+ * names `related.thread`. Bundled workflows that subscribe with `signals: true` receive it
3678
+ * without naming it. The payload schema is the shared one, so `payloadSchema` is omitted,
3679
+ * and `relatedKeys` holds `thread` plus any of `from`, `to`, `cc`. Turning it on changes
3680
+ * the payload, so bump `version` with it.
3681
+ */
3682
+ signal: z12.boolean().optional()
3683
+ }).superRefine((definition, context) => {
3684
+ if (definition.signal !== true)
3685
+ return;
3686
+ if (definition.payloadSchema !== void 0) {
3687
+ context.addIssue({
3688
+ code: "custom",
3689
+ path: ["payloadSchema"],
3690
+ message: "A signal event uses the shared PluginSignal v1 payload; omit payloadSchema."
3691
+ });
3692
+ }
3693
+ const allowed = PLUGIN_SIGNAL_RELATED_KEYS;
3694
+ const keys = definition.relatedKeys ?? [];
3695
+ if (!keys.includes("thread") || keys.some((key) => !allowed.includes(key))) {
3696
+ context.addIssue({
3697
+ code: "custom",
3698
+ path: ["relatedKeys"],
3699
+ message: `A signal event declares relatedKeys 'thread' plus any of ${allowed.filter((key) => key !== "thread").map((key) => `'${key}'`).join(", ")}.`
3700
+ });
3701
+ }
3592
3702
  });
3593
3703
  const PluginNotificationRuleContribution2 = z12.strictObject({
3594
3704
  localId: LocalContributionId2,
@@ -4879,6 +4989,27 @@ function createManifestSchemas(canonical) {
4879
4989
  });
4880
4990
  }
4881
4991
  }
4992
+ const ownSchemes = new Set([
4993
+ ...manifest.targets?.kay?.agent?.contributes?.uriModules ?? [],
4994
+ ...manifest.targets?.kay?.app?.contributes?.uriModules ?? []
4995
+ ].flatMap((module) => module.schemes));
4996
+ for (const [index, definition] of (manifest.targets?.kay?.app?.contributes?.eventDefinitions ?? []).entries()) {
4997
+ if (definition.signal !== true || ownSchemes.has(definition.uriScheme))
4998
+ continue;
4999
+ ctx.addIssue({
5000
+ code: "custom",
5001
+ path: [
5002
+ "targets",
5003
+ "kay",
5004
+ "app",
5005
+ "contributes",
5006
+ "eventDefinitions",
5007
+ index,
5008
+ "uriScheme"
5009
+ ],
5010
+ message: `signal event ${definition.localId} must use a URI scheme one of this plugin's own URI modules serves; '${definition.uriScheme}' is not among them`
5011
+ });
5012
+ }
4882
5013
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "workflows"], manifest.targets?.kay?.app?.contributes?.workflows, "workflow");
4883
5014
  for (const [index, workflow] of (manifest.targets?.kay?.app?.contributes?.workflows ?? []).entries()) {
4884
5015
  const path = [
@@ -7046,6 +7177,45 @@ var ArtifactOutputChange = z20.union([
7046
7177
  z20.strictObject({ sessionId: Segment })
7047
7178
  ]);
7048
7179
 
7180
+ // packages/plugin-protocol/dist/credential-text.js
7181
+ var CREDENTIAL_VALUE_PATTERNS = [
7182
+ // Anthropic / OpenAI-style secret keys (`sk-`, `sk-ant-`, `sk-proj-`).
7183
+ /^sk-[A-Za-z0-9_-]{16,}$/u,
7184
+ // GitHub classic, fine-grained, app, and OAuth tokens.
7185
+ /^gh[pousr]_[A-Za-z0-9]{16,}$/u,
7186
+ /^github_pat_[A-Za-z0-9_]{20,}$/u,
7187
+ // GitLab personal access tokens.
7188
+ /^glpat-[A-Za-z0-9_-]{16,}$/u,
7189
+ // Slack bot/user/app tokens.
7190
+ /^xox[baprse]-[A-Za-z0-9-]{10,}$/u,
7191
+ // AWS access key ids, long-lived and STS-issued.
7192
+ /^(?:AKIA|ASIA)[0-9A-Z]{16}$/u,
7193
+ // Google API keys, both published shapes.
7194
+ /^AIza[0-9A-Za-z_-]{35}$/u,
7195
+ /^AQ\.[A-Za-z0-9_-]{20,}$/u,
7196
+ // npm automation tokens.
7197
+ /^npm_[A-Za-z0-9]{30,}$/u,
7198
+ // SendGrid API keys (SG.<key id>.<secret>).
7199
+ /^SG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}$/u,
7200
+ // HashiCorp Vault service/batch/recovery tokens.
7201
+ /^hv[sbr]\.[A-Za-z0-9_-]{20,}$/u,
7202
+ // Shopify access tokens.
7203
+ /^shp(?:at|ss|ca|pa)_[a-fA-F0-9]{32}$/u,
7204
+ // Stripe live/test secret and restricted keys.
7205
+ /^(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}$/u,
7206
+ // JSON Web Tokens - header.payload.signature, header always starts `eyJ`.
7207
+ /^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/u,
7208
+ // A whole Authorization header value carried as data.
7209
+ /^(?:Bearer|Basic) [A-Za-z0-9+/._~-]{16,}={0,2}$/iu,
7210
+ // PEM private key blocks, anywhere in the string.
7211
+ /-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----/u
7212
+ ];
7213
+ function isCredentialShapedText(value) {
7214
+ if (typeof value !== "string" || value.length === 0)
7215
+ return false;
7216
+ return CREDENTIAL_VALUE_PATTERNS.some((pattern) => pattern.test(value));
7217
+ }
7218
+
7049
7219
  // packages/plugin-protocol/dist/ui-module-bundle.js
7050
7220
  import { z as z21 } from "zod";
7051
7221
  var KAY_UI_MODULE_BUNDLE_PROTOCOL = "kay.ui.module-bundle.v1";
@@ -7216,8 +7386,15 @@ export {
7216
7386
  PLUGIN_CAPABILITY_SLUGS,
7217
7387
  PLUGIN_DIAGNOSTIC_MESSAGE_CAP,
7218
7388
  PLUGIN_EVENT_ID_MAX_BYTES,
7389
+ PLUGIN_EVENT_REFUSED_ERROR_NAME,
7219
7390
  PLUGIN_ICON_SHAPE_ATTRIBUTE,
7220
7391
  PLUGIN_NOTIFICATION_RULE_HOST_KEYS,
7392
+ PLUGIN_SIGNAL_KINDS,
7393
+ PLUGIN_SIGNAL_LABELS_MAX,
7394
+ PLUGIN_SIGNAL_LABEL_MAX,
7395
+ PLUGIN_SIGNAL_RELATED_KEYS,
7396
+ PLUGIN_SIGNAL_SNIPPET_MAX,
7397
+ PLUGIN_SIGNAL_TITLE_MAX,
7221
7398
  PRIVATE_PLUGIN_CAPABILITY_SLUGS,
7222
7399
  PackageAssetPath,
7223
7400
  PluginAgentDefinitionPermissionRule,
@@ -7253,6 +7430,8 @@ export {
7253
7430
  PluginPermissionManifest,
7254
7431
  PluginProvisioningProbe,
7255
7432
  PluginProvisioningRequirement,
7433
+ PluginSignal,
7434
+ PluginSignalPublish,
7256
7435
  PluginSkillSourceDeclaration,
7257
7436
  PluginSourceClass,
7258
7437
  PluginStorageManifest,
@@ -7381,6 +7560,7 @@ export {
7381
7560
  hostWithinDomain,
7382
7561
  isCanonicalArtifactOutputUri,
7383
7562
  isCompatible,
7563
+ isCredentialShapedText,
7384
7564
  isKayPluginCompatibilityRefusal,
7385
7565
  isPrivateCapabilityClaim,
7386
7566
  isQualifiedAuthSchemeRef,
@@ -7404,6 +7584,7 @@ export {
7404
7584
  parseSemver,
7405
7585
  parseWhere,
7406
7586
  pluginIconShape,
7587
+ pluginSignalPayloadJsonSchema,
7407
7588
  precedingPersonMessages,
7408
7589
  readKayPluginDeclaredCompatibility,
7409
7590
  refineWebSessionScopeConfined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "The Kay plugin manifest schema (`kay.plugin.v1`) — parse and validate a kay-plugin.json.",
5
5
  "author": "YakLabs",
6
6
  "type": "module",