@yaklabs-ai/plugin-protocol 0.37.1 → 0.39.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/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.1";
257
+ var KAY_PLUGIN_SDK_VERSION = "0.39.0";
258
258
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
259
259
  "0.26.3",
260
260
  "0.27.1",
@@ -266,7 +266,9 @@ 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",
271
+ "0.38.0"
270
272
  ];
271
273
  var KAY_PLUGIN_TARGET_NAMES = [
272
274
  "kay.agent",
@@ -1755,6 +1757,7 @@ var PLUGIN_CAPABILITY_SLUGS = [
1755
1757
  "automations.write",
1756
1758
  "automations.run",
1757
1759
  "workflows.define",
1760
+ "workflows.signals",
1758
1761
  "session-events.subscribe",
1759
1762
  "agents.run",
1760
1763
  "dynamic-context.register",
@@ -1786,7 +1789,8 @@ var PRIVATE_PLUGIN_CAPABILITY_SLUGS = [
1786
1789
  "soul.write",
1787
1790
  "skills.share",
1788
1791
  "plugins.set-enabled",
1789
- "system-prompt.register"
1792
+ "system-prompt.register",
1793
+ "workflows.signals"
1790
1794
  ];
1791
1795
  function isPrivateCapabilityClaim(claim) {
1792
1796
  return PRIVATE_PLUGIN_CAPABILITY_SLUGS.includes(claim.slug);
@@ -2011,6 +2015,14 @@ function createAuthoritySchemas(canonical) {
2011
2015
  slug: z10.literal("workflows.define"),
2012
2016
  envelope: z10.strictObject({})
2013
2017
  }),
2018
+ z10.strictObject({
2019
+ // Start a declared workflow on every plugin's signal events (`signals: true`), which carry
2020
+ // other plugins' data. Private (PRIVATE_PLUGIN_CAPABILITY_SLUGS): only a plugin the release
2021
+ // carries may hold it, so a third-party plugin cannot read every source's signals.
2022
+ target: z10.literal("kay.app"),
2023
+ slug: z10.literal("workflows.signals"),
2024
+ envelope: z10.strictObject({})
2025
+ }),
2014
2026
  z10.strictObject({
2015
2027
  target: z10.literal("kay.app"),
2016
2028
  slug: z10.literal("session-events.subscribe"),
@@ -2242,6 +2254,7 @@ function sameClaim(a, b) {
2242
2254
  case "automations.write":
2243
2255
  case "automations.run":
2244
2256
  case "workflows.define":
2257
+ case "workflows.signals":
2245
2258
  case "session-events.subscribe":
2246
2259
  case "agents.run":
2247
2260
  case "account.assert":
@@ -2326,6 +2339,7 @@ function envelopePairs(a, b) {
2326
2339
  case "automations.write":
2327
2340
  case "automations.run":
2328
2341
  case "workflows.define":
2342
+ case "workflows.signals":
2329
2343
  case "session-events.subscribe":
2330
2344
  case "agents.run":
2331
2345
  case "account.assert":
@@ -2746,6 +2760,7 @@ __export(contributions_exports, {
2746
2760
  ReferencePresentationUrlClaim: () => ReferencePresentationUrlClaim,
2747
2761
  ReferencePresentationVariant: () => ReferencePresentationVariant,
2748
2762
  ReferencePresentationVariants: () => ReferencePresentationVariants,
2763
+ ReferencePresentationWords: () => ReferencePresentationWords,
2749
2764
  ResourceContribution: () => ResourceContribution,
2750
2765
  ResultRendererContribution: () => ResultRendererContribution,
2751
2766
  RichViewContribution: () => RichViewContribution,
@@ -2777,6 +2792,13 @@ import { z as z12 } from "zod";
2777
2792
  var plugin_events_exports = {};
2778
2793
  __export(plugin_events_exports, {
2779
2794
  PLUGIN_EVENT_ID_MAX_BYTES: () => PLUGIN_EVENT_ID_MAX_BYTES,
2795
+ PLUGIN_EVENT_REFUSED_ERROR_NAME: () => PLUGIN_EVENT_REFUSED_ERROR_NAME,
2796
+ PLUGIN_SIGNAL_KINDS: () => PLUGIN_SIGNAL_KINDS,
2797
+ PLUGIN_SIGNAL_LABELS_MAX: () => PLUGIN_SIGNAL_LABELS_MAX,
2798
+ PLUGIN_SIGNAL_LABEL_MAX: () => PLUGIN_SIGNAL_LABEL_MAX,
2799
+ PLUGIN_SIGNAL_RELATED_KEYS: () => PLUGIN_SIGNAL_RELATED_KEYS,
2800
+ PLUGIN_SIGNAL_SNIPPET_MAX: () => PLUGIN_SIGNAL_SNIPPET_MAX,
2801
+ PLUGIN_SIGNAL_TITLE_MAX: () => PLUGIN_SIGNAL_TITLE_MAX,
2780
2802
  PluginEventEnvelope: () => PluginEventEnvelope,
2781
2803
  PluginEventId: () => PluginEventId,
2782
2804
  PluginEventLocalId: () => PluginEventLocalId,
@@ -2786,9 +2808,34 @@ __export(plugin_events_exports, {
2786
2808
  PluginEventSource: () => PluginEventSource,
2787
2809
  PluginEventTimestamp: () => PluginEventTimestamp,
2788
2810
  PluginEventUri: () => PluginEventUri,
2789
- canonicalPluginEventSchemas: () => canonicalPluginEventSchemas
2811
+ PluginSignal: () => PluginSignal,
2812
+ PluginSignalPublish: () => PluginSignalPublish,
2813
+ canonicalPluginEventSchemas: () => canonicalPluginEventSchemas,
2814
+ pluginSignalPayloadJsonSchema: () => pluginSignalPayloadJsonSchema
2790
2815
  });
2791
2816
  import { z as z11 } from "zod";
2817
+
2818
+ // packages/plugin-protocol/dist/plugin-signal-limits.js
2819
+ var PLUGIN_EVENT_REFUSED_ERROR_NAME = "PluginEventRefusedError";
2820
+ var PLUGIN_SIGNAL_KINDS = [
2821
+ "message",
2822
+ "request",
2823
+ "mention",
2824
+ "invite",
2825
+ "status"
2826
+ ];
2827
+ var PLUGIN_SIGNAL_TITLE_MAX = 300;
2828
+ var PLUGIN_SIGNAL_SNIPPET_MAX = 500;
2829
+ var PLUGIN_SIGNAL_LABELS_MAX = 20;
2830
+ var PLUGIN_SIGNAL_LABEL_MAX = 64;
2831
+ var PLUGIN_SIGNAL_RELATED_KEYS = [
2832
+ "thread",
2833
+ "from",
2834
+ "to",
2835
+ "cc"
2836
+ ];
2837
+
2838
+ // packages/plugin-protocol/dist/plugin-events.js
2792
2839
  var PLUGIN_EVENT_ID_MAX_BYTES = 1024;
2793
2840
  function createPluginEventsSchemas(canonical) {
2794
2841
  const { GlobalContributionId: GlobalContributionId2, NonEmptyString: NonEmptyString3 } = canonical ? canonicalCommonSchemas : common_exports;
@@ -2840,7 +2887,39 @@ function createPluginEventsSchemas(canonical) {
2840
2887
  source: PluginEventSource2,
2841
2888
  payload: JsonValue.optional()
2842
2889
  });
2890
+ const PluginSignal2 = z11.strictObject({
2891
+ kind: z11.enum(PLUGIN_SIGNAL_KINDS),
2892
+ direction: z11.enum(["in", "out"]).optional(),
2893
+ title: z11.string().max(PLUGIN_SIGNAL_TITLE_MAX).optional(),
2894
+ snippet: z11.string().max(PLUGIN_SIGNAL_SNIPPET_MAX).optional(),
2895
+ actor: z11.strictObject({
2896
+ name: z11.string().max(PLUGIN_SIGNAL_TITLE_MAX).optional(),
2897
+ uri: PluginEventUri2
2898
+ }).optional(),
2899
+ addressed: z11.enum(["direct", "cc", "mention", "group", "none"]).optional(),
2900
+ labels: z11.array(z11.string().min(1).max(PLUGIN_SIGNAL_LABEL_MAX)).max(PLUGIN_SIGNAL_LABELS_MAX).optional(),
2901
+ dueAt: PluginEventTimestamp2.optional(),
2902
+ state: z11.enum(["open", "resolved"]).optional()
2903
+ }).refine((signal) => signal.state === void 0 || signal.kind === "status", {
2904
+ message: "state is only for a status signal",
2905
+ path: ["state"]
2906
+ });
2907
+ const PluginSignalRelatedValue = z11.union([
2908
+ PluginEventUri2,
2909
+ z11.array(PluginEventUri2)
2910
+ ]);
2911
+ const PluginSignalPublish2 = z11.object({
2912
+ payload: PluginSignal2,
2913
+ related: z11.strictObject({
2914
+ thread: PluginEventUri2,
2915
+ from: PluginSignalRelatedValue.optional(),
2916
+ to: PluginSignalRelatedValue.optional(),
2917
+ cc: PluginSignalRelatedValue.optional()
2918
+ })
2919
+ });
2843
2920
  return {
2921
+ PluginSignal: PluginSignal2,
2922
+ PluginSignalPublish: PluginSignalPublish2,
2844
2923
  PluginEventLocalId: PluginEventLocalId2,
2845
2924
  PluginEventUri: PluginEventUri2,
2846
2925
  PluginEventTimestamp: PluginEventTimestamp2,
@@ -2852,8 +2931,14 @@ function createPluginEventsSchemas(canonical) {
2852
2931
  PluginEventEnvelope: PluginEventEnvelope2
2853
2932
  };
2854
2933
  }
2855
- var { PluginEventLocalId, PluginEventUri, PluginEventTimestamp, PluginEventRelated, PluginEventPublishSource, PluginEventSource, PluginEventId, PluginEventPublishInput, PluginEventEnvelope } = createPluginEventsSchemas(false);
2934
+ var { PluginSignal, PluginSignalPublish, PluginEventLocalId, PluginEventUri, PluginEventTimestamp, PluginEventRelated, PluginEventPublishSource, PluginEventSource, PluginEventId, PluginEventPublishInput, PluginEventEnvelope } = createPluginEventsSchemas(false);
2856
2935
  var canonicalPluginEventSchemas = createPluginEventsSchemas(true);
2936
+ function pluginSignalPayloadJsonSchema() {
2937
+ return z11.toJSONSchema(PluginSignal, {
2938
+ io: "input",
2939
+ unrepresentable: "any"
2940
+ });
2941
+ }
2857
2942
 
2858
2943
  // packages/plugin-protocol/dist/where-expression.js
2859
2944
  var TOKEN = /\s*(?:(\|\||&&|==|!=|!|\(|\))|'([^']*)'|"([^"]*)"|([A-Za-z][A-Za-z0-9]*(?:\.[A-Za-z][A-Za-z0-9]*)*))/y;
@@ -3035,6 +3120,33 @@ function evaluateCommandWhere(where, values) {
3035
3120
  return evaluateWhere(where, (key) => values[key]);
3036
3121
  }
3037
3122
 
3123
+ // packages/plugin-protocol/dist/tool-glyph.js
3124
+ var TOOL_GLYPHS = [
3125
+ "terminal",
3126
+ "file",
3127
+ "search",
3128
+ "folder",
3129
+ "person",
3130
+ "repo",
3131
+ "clock",
3132
+ "robot",
3133
+ "globe",
3134
+ "browser",
3135
+ "skill",
3136
+ "memory",
3137
+ "session",
3138
+ "plan",
3139
+ "download",
3140
+ "attachment",
3141
+ "settings",
3142
+ "catalog",
3143
+ "model",
3144
+ "doc",
3145
+ "feedback",
3146
+ "plugin",
3147
+ "note"
3148
+ ];
3149
+
3038
3150
  // packages/plugin-protocol/dist/contributions.js
3039
3151
  var MCP_SERVER_LOCAL_HTTP_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
3040
3152
  var MCP_SIGN_IN_SCHEME_KIND = {
@@ -3588,7 +3700,34 @@ function createContributionsSchemas(canonical) {
3588
3700
  version: canonical ? EventDefinitionVersion : EventDefinitionVersion.default(1),
3589
3701
  uriScheme: UriScheme2,
3590
3702
  relatedKeys: z12.array(NonEmptyString3).readonly().optional(),
3591
- payloadSchema: JsonSchema.optional()
3703
+ payloadSchema: JsonSchema.optional(),
3704
+ /**
3705
+ * This event is a signal: its payload is the shared `PluginSignal` v1 and every publish
3706
+ * names `related.thread`. Bundled workflows that subscribe with `signals: true` receive it
3707
+ * without naming it. The payload schema is the shared one, so `payloadSchema` is omitted,
3708
+ * and `relatedKeys` holds `thread` plus any of `from`, `to`, `cc`. Turning it on changes
3709
+ * the payload, so bump `version` with it.
3710
+ */
3711
+ signal: z12.boolean().optional()
3712
+ }).superRefine((definition, context) => {
3713
+ if (definition.signal !== true)
3714
+ return;
3715
+ if (definition.payloadSchema !== void 0) {
3716
+ context.addIssue({
3717
+ code: "custom",
3718
+ path: ["payloadSchema"],
3719
+ message: "A signal event uses the shared PluginSignal v1 payload; omit payloadSchema."
3720
+ });
3721
+ }
3722
+ const allowed = PLUGIN_SIGNAL_RELATED_KEYS;
3723
+ const keys = definition.relatedKeys ?? [];
3724
+ if (!keys.includes("thread") || keys.some((key) => !allowed.includes(key))) {
3725
+ context.addIssue({
3726
+ code: "custom",
3727
+ path: ["relatedKeys"],
3728
+ message: `A signal event declares relatedKeys 'thread' plus any of ${allowed.filter((key) => key !== "thread").map((key) => `'${key}'`).join(", ")}.`
3729
+ });
3730
+ }
3592
3731
  });
3593
3732
  const PluginNotificationRuleContribution2 = z12.strictObject({
3594
3733
  localId: LocalContributionId2,
@@ -3691,6 +3830,26 @@ function createContributionsSchemas(canonical) {
3691
3830
  objectId: NonEmptyString3.optional(),
3692
3831
  open: z12.strictObject({ kind: z12.literal("none") }).optional()
3693
3832
  });
3833
+ const ReferencePresentationWords2 = z12.strictObject({
3834
+ /** The row's mark, for a source with no icon of its own. Left out: the plugin's main icon. */
3835
+ glyph: z12.enum(TOOL_GLYPHS).optional(),
3836
+ /** The thing an address names ("channel" in "Read Slack channel"). Left out: the row reads the scheme's own name. */
3837
+ kind: NonEmptyString3.optional(),
3838
+ /** What a tally counts one address as ("Slack message"). Left out: `kind`, else "item". */
3839
+ noun: NonEmptyString3.optional(),
3840
+ /** What the live phrase names ("Slack" in "Reading Slack"). Left out: the bare verb ("Reading"). */
3841
+ target: NonEmptyString3.optional(),
3842
+ /** `kind` already says which source this is: "Edited plan", not "Edited Plan plan". */
3843
+ kindNamesSource: z12.literal(true).optional()
3844
+ }).superRefine((value, ctx) => {
3845
+ if (value.kind === void 0 && (value.glyph !== void 0 || value.kindNamesSource !== void 0)) {
3846
+ ctx.addIssue({
3847
+ code: "custom",
3848
+ path: ["kind"],
3849
+ message: "glyph and kindNamesSource describe a row, which needs a kind."
3850
+ });
3851
+ }
3852
+ });
3694
3853
  const ReferencePresentationContribution2 = z12.strictObject({
3695
3854
  localId: LocalContributionId2,
3696
3855
  /** This manifest's URI module. Leave it out only for an address another layer serves. */
@@ -3703,16 +3862,48 @@ function createContributionsSchemas(canonical) {
3703
3862
  scheme: UriScheme2.optional(),
3704
3863
  /** Which of the addresses open the page, and on what. Read by the window. */
3705
3864
  addresses: z12.array(ReferencePresentationAddress2).min(1).optional(),
3706
- resourceKind: NonEmptyString3,
3707
- open: ReferenceOpenBehavior2,
3865
+ /** Comes with `open`. A presentation with neither only words its module's addresses. */
3866
+ resourceKind: NonEmptyString3.optional(),
3867
+ /** How the address opens. Left out, it stays plain text. */
3868
+ open: ReferenceOpenBehavior2.optional(),
3708
3869
  /** MIME-specific resource kinds; absent keys use the base presentation. */
3709
3870
  variants: ReferencePresentationVariants2.optional(),
3710
3871
  /** Lexical public URL claims used only for host-rendered browser presentations. */
3711
3872
  claims: z12.array(ReferencePresentationUrlClaim2).optional(),
3712
3873
  /** Informational app presentation matched against the canonical resource URI. */
3713
- tooltip: ReferencePresentationTooltip2.optional()
3874
+ tooltip: ReferencePresentationTooltip2.optional(),
3875
+ /** What the transcript calls this module's addresses. Needs a `uriModule`. */
3876
+ words: ReferencePresentationWords2.optional()
3714
3877
  }).superRefine((value, ctx) => {
3715
- if (value.claims !== void 0 && value.claims.length > 0 && value.open.kind !== "browser-pane") {
3878
+ if (value.open === void 0 !== (value.resourceKind === void 0)) {
3879
+ ctx.addIssue({
3880
+ code: "custom",
3881
+ path: ["open"],
3882
+ message: "open and resourceKind come together: name both or neither."
3883
+ });
3884
+ }
3885
+ if (value.open === void 0 && value.words === void 0) {
3886
+ ctx.addIssue({
3887
+ code: "custom",
3888
+ path: ["words"],
3889
+ message: "A reference presentation that opens nothing must have words."
3890
+ });
3891
+ }
3892
+ if (value.words !== void 0 && value.uriModule === void 0) {
3893
+ ctx.addIssue({
3894
+ code: "custom",
3895
+ path: ["words"],
3896
+ message: "Words belong to a URI module: name its uriModule."
3897
+ });
3898
+ }
3899
+ if (value.open === void 0 && (value.variants !== void 0 || value.tooltip !== void 0)) {
3900
+ ctx.addIssue({
3901
+ code: "custom",
3902
+ path: ["open"],
3903
+ message: "variants and tooltip need an open."
3904
+ });
3905
+ }
3906
+ if (value.claims !== void 0 && value.claims.length > 0 && value.open?.kind !== "browser-pane") {
3716
3907
  ctx.addIssue({
3717
3908
  code: "custom",
3718
3909
  path: ["claims"],
@@ -3726,14 +3917,14 @@ function createContributionsSchemas(canonical) {
3726
3917
  message: "A reference presentation names a uriModule or a scheme."
3727
3918
  });
3728
3919
  }
3729
- if ((value.scheme !== void 0 || value.addresses !== void 0) && value.open.kind !== "page") {
3920
+ if ((value.scheme !== void 0 || value.addresses !== void 0) && value.open?.kind !== "page") {
3730
3921
  ctx.addIssue({
3731
3922
  code: "custom",
3732
3923
  path: ["open"],
3733
3924
  message: "scheme and addresses require page opening."
3734
3925
  });
3735
3926
  }
3736
- if (value.tooltip !== void 0 && value.open.kind === "page") {
3927
+ if (value.tooltip !== void 0 && value.open?.kind === "page") {
3737
3928
  ctx.addIssue({
3738
3929
  code: "custom",
3739
3930
  path: ["tooltip"],
@@ -3994,6 +4185,7 @@ function createContributionsSchemas(canonical) {
3994
4185
  ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2,
3995
4186
  ReferencePresentationTooltip: ReferencePresentationTooltip2,
3996
4187
  ReferencePresentationAddress: ReferencePresentationAddress2,
4188
+ ReferencePresentationWords: ReferencePresentationWords2,
3997
4189
  ReferencePresentationContribution: ReferencePresentationContribution2,
3998
4190
  RichViewContribution: RichViewContribution2,
3999
4191
  KayUiAppHostCapability: KayUiAppHostCapability2,
@@ -4008,7 +4200,7 @@ function createContributionsSchemas(canonical) {
4008
4200
  PluginContributionKind: PluginContributionKind2
4009
4201
  };
4010
4202
  }
4011
- var { ApprovalCardForm, ApprovalCardStoredForm, ApprovalTypeContribution, UriModuleFacts, ToolContribution, ToolPermission, AgentToolContribution, ConverterContribution, UriModuleContribution, AppUriModuleContribution, AppDataSourceContribution, WhiteboardTypeStorage, WhiteboardTypeContribution, AppDataMaterializerContribution, ArtifactUriModuleContribution, CliBindingContribution, GitHostContribution, ResourceContribution, SkillContribution, PluginSkillSourceDeclaration, SearchProviderContribution, InteractionDriverContribution, EntityResolverContribution, AgentRenderContribution, EndpointContribution, WorkflowContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationAddress, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiRailEntryContribution, UiToastPreviewContribution, UiPageContribution, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
4203
+ var { ApprovalCardForm, ApprovalCardStoredForm, ApprovalTypeContribution, UriModuleFacts, ToolContribution, ToolPermission, AgentToolContribution, ConverterContribution, UriModuleContribution, AppUriModuleContribution, AppDataSourceContribution, WhiteboardTypeStorage, WhiteboardTypeContribution, AppDataMaterializerContribution, ArtifactUriModuleContribution, CliBindingContribution, GitHostContribution, ResourceContribution, SkillContribution, PluginSkillSourceDeclaration, SearchProviderContribution, InteractionDriverContribution, EntityResolverContribution, AgentRenderContribution, EndpointContribution, WorkflowContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationAddress, ReferencePresentationWords, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiRailEntryContribution, UiToastPreviewContribution, UiPageContribution, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
4012
4204
  var canonicalContributionSchemas = createContributionsSchemas(true);
4013
4205
 
4014
4206
  // packages/plugin-protocol/dist/icon-shape.js
@@ -4833,7 +5025,7 @@ function createManifestSchemas(canonical) {
4833
5025
  message: `reference presentation ${presentation.localId} references unknown ui app ${presentation.tooltip.app}`
4834
5026
  });
4835
5027
  }
4836
- if (presentation.open.kind === "page" && !declaredPageIds.has(presentation.open.pageId)) {
5028
+ if (presentation.open?.kind === "page" && !declaredPageIds.has(presentation.open.pageId)) {
4837
5029
  ctx.addIssue({
4838
5030
  code: "custom",
4839
5031
  path: [...path, "open", "pageId"],
@@ -4879,6 +5071,27 @@ function createManifestSchemas(canonical) {
4879
5071
  });
4880
5072
  }
4881
5073
  }
5074
+ const ownSchemes = new Set([
5075
+ ...manifest.targets?.kay?.agent?.contributes?.uriModules ?? [],
5076
+ ...manifest.targets?.kay?.app?.contributes?.uriModules ?? []
5077
+ ].flatMap((module) => module.schemes));
5078
+ for (const [index, definition] of (manifest.targets?.kay?.app?.contributes?.eventDefinitions ?? []).entries()) {
5079
+ if (definition.signal !== true || ownSchemes.has(definition.uriScheme))
5080
+ continue;
5081
+ ctx.addIssue({
5082
+ code: "custom",
5083
+ path: [
5084
+ "targets",
5085
+ "kay",
5086
+ "app",
5087
+ "contributes",
5088
+ "eventDefinitions",
5089
+ index,
5090
+ "uriScheme"
5091
+ ],
5092
+ 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`
5093
+ });
5094
+ }
4882
5095
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "workflows"], manifest.targets?.kay?.app?.contributes?.workflows, "workflow");
4883
5096
  for (const [index, workflow] of (manifest.targets?.kay?.app?.contributes?.workflows ?? []).entries()) {
4884
5097
  const path = [
@@ -5532,7 +5745,7 @@ function boundPluginDiagnosticMessage(message) {
5532
5745
  import { z as z14 } from "zod";
5533
5746
  function createResolvedContractSchemas(canonical) {
5534
5747
  const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
5535
- const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationAddress: ReferencePresentationAddress2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
5748
+ const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationAddress: ReferencePresentationAddress2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, ReferencePresentationWords: ReferencePresentationWords2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
5536
5749
  const { FileExtensionToken: FileExtensionToken2, GitBasicAuthUser: GitBasicAuthUser2, GitHostName: GitHostName2, GlobalContributionId: GlobalContributionId2, HttpsUrl: HttpsUrl2, LocalContributionId: LocalContributionId2, MimeTypeString: MimeTypeString2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginNamespace: PluginNamespace2, PluginToolName: PluginToolName2, RegistrableDomain: RegistrableDomain2, SignedInStatusCode: SignedInStatusCode2, TargetEntrypoint: TargetEntrypoint2, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
5537
5750
  const { PluginExternalCliConnect: PluginExternalCliConnect2, PluginOAuthClientSupplier: PluginOAuthClientSupplier2 } = canonical ? canonicalManifestSchemas : manifest_exports;
5538
5751
  const { ResolvedPluginGrants: ResolvedPluginGrants2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
@@ -5696,18 +5909,22 @@ function createResolvedContractSchemas(canonical) {
5696
5909
  localId: LocalContributionId2,
5697
5910
  globalId: GlobalContributionId2,
5698
5911
  uriModule: GlobalContributionId2.optional(),
5699
- /** The schemes a page-opening presentation answers for: its `scheme`, or its module's. */
5912
+ /** The schemes this presentation is about: its `scheme`, or its module's. */
5700
5913
  schemes: z14.array(UriScheme2).min(1).optional(),
5914
+ /** The module's `displayName`: the source's name in a row. */
5915
+ displayName: NonEmptyString3.optional(),
5701
5916
  addresses: z14.array(ReferencePresentationAddress2).min(1).optional(),
5702
- resourceKind: NonEmptyString3,
5703
- open: ReferenceOpenBehavior2,
5917
+ /** Comes with `open`. A presentation with neither only words its module's addresses. */
5918
+ resourceKind: NonEmptyString3.optional(),
5919
+ open: ReferenceOpenBehavior2.optional(),
5704
5920
  /** MIME-specific resource kinds; absent keys use the base presentation. */
5705
5921
  variants: ReferencePresentationVariants2.optional(),
5706
5922
  claims: z14.array(ReferencePresentationUrlClaim2).optional(),
5707
5923
  tooltip: z14.strictObject({
5708
5924
  app: GlobalContributionId2,
5709
5925
  pattern: ReferencePresentationUriPattern2
5710
- }).optional()
5926
+ }).optional(),
5927
+ words: ReferencePresentationWords2.optional()
5711
5928
  });
5712
5929
  const ResolvedPluginProvisioningRequirement2 = z14.strictObject({
5713
5930
  id: LocalContributionId2,
@@ -6323,10 +6540,13 @@ function resolveKayPluginContractV1(manifest) {
6323
6540
  ...presentation.uriModule === void 0 ? {} : {
6324
6541
  uriModule: resolveGlobalContributionId(namespace, presentation.uriModule)
6325
6542
  },
6326
- ...presentationSchemes(manifest, presentation),
6543
+ ...presentationSource(manifest, presentation),
6327
6544
  ...presentation.addresses === void 0 ? {} : { addresses: presentation.addresses },
6328
- resourceKind: presentation.resourceKind,
6329
- open: presentation.open,
6545
+ ...presentation.open === void 0 || presentation.resourceKind === void 0 ? {} : {
6546
+ resourceKind: presentation.resourceKind,
6547
+ open: presentation.open
6548
+ },
6549
+ ...presentation.words === void 0 ? {} : { words: { ...presentation.words } },
6330
6550
  ...presentation.tooltip === void 0 ? {} : {
6331
6551
  tooltip: {
6332
6552
  app: resolveGlobalContributionId(namespace, presentation.tooltip.app),
@@ -6409,18 +6629,17 @@ function safeResolveKayPluginContractV1(manifest) {
6409
6629
  throw error;
6410
6630
  }
6411
6631
  }
6412
- function presentationSchemes(manifest, presentation) {
6413
- if (presentation.scheme !== void 0) {
6414
- return { schemes: [presentation.scheme] };
6415
- }
6416
- if (presentation.open.kind !== "page")
6417
- return {};
6632
+ function presentationSource(manifest, presentation) {
6418
6633
  const contributes = manifest.targets?.kay;
6419
6634
  const module = [
6420
6635
  ...contributes?.agent?.contributes?.uriModules ?? [],
6421
6636
  ...contributes?.app?.contributes?.uriModules ?? []
6422
6637
  ].find((candidate) => candidate.localId === presentation.uriModule);
6423
- return module === void 0 ? {} : { schemes: [...module.schemes] };
6638
+ const schemes = presentation.scheme === void 0 ? module?.schemes : [presentation.scheme];
6639
+ return {
6640
+ ...schemes === void 0 ? {} : { schemes: [...schemes] },
6641
+ ...module?.displayName === void 0 ? {} : { displayName: module.displayName }
6642
+ };
6424
6643
  }
6425
6644
  function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, authScheme: _authScheme, knownResources: _knownResources, describesOperations: _describesOperations, ...facts }) {
6426
6645
  return facts;
@@ -7046,6 +7265,45 @@ var ArtifactOutputChange = z20.union([
7046
7265
  z20.strictObject({ sessionId: Segment })
7047
7266
  ]);
7048
7267
 
7268
+ // packages/plugin-protocol/dist/credential-text.js
7269
+ var CREDENTIAL_VALUE_PATTERNS = [
7270
+ // Anthropic / OpenAI-style secret keys (`sk-`, `sk-ant-`, `sk-proj-`).
7271
+ /^sk-[A-Za-z0-9_-]{16,}$/u,
7272
+ // GitHub classic, fine-grained, app, and OAuth tokens.
7273
+ /^gh[pousr]_[A-Za-z0-9]{16,}$/u,
7274
+ /^github_pat_[A-Za-z0-9_]{20,}$/u,
7275
+ // GitLab personal access tokens.
7276
+ /^glpat-[A-Za-z0-9_-]{16,}$/u,
7277
+ // Slack bot/user/app tokens.
7278
+ /^xox[baprse]-[A-Za-z0-9-]{10,}$/u,
7279
+ // AWS access key ids, long-lived and STS-issued.
7280
+ /^(?:AKIA|ASIA)[0-9A-Z]{16}$/u,
7281
+ // Google API keys, both published shapes.
7282
+ /^AIza[0-9A-Za-z_-]{35}$/u,
7283
+ /^AQ\.[A-Za-z0-9_-]{20,}$/u,
7284
+ // npm automation tokens.
7285
+ /^npm_[A-Za-z0-9]{30,}$/u,
7286
+ // SendGrid API keys (SG.<key id>.<secret>).
7287
+ /^SG\.[A-Za-z0-9_-]{16,}\.[A-Za-z0-9_-]{16,}$/u,
7288
+ // HashiCorp Vault service/batch/recovery tokens.
7289
+ /^hv[sbr]\.[A-Za-z0-9_-]{20,}$/u,
7290
+ // Shopify access tokens.
7291
+ /^shp(?:at|ss|ca|pa)_[a-fA-F0-9]{32}$/u,
7292
+ // Stripe live/test secret and restricted keys.
7293
+ /^(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}$/u,
7294
+ // JSON Web Tokens - header.payload.signature, header always starts `eyJ`.
7295
+ /^eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$/u,
7296
+ // A whole Authorization header value carried as data.
7297
+ /^(?:Bearer|Basic) [A-Za-z0-9+/._~-]{16,}={0,2}$/iu,
7298
+ // PEM private key blocks, anywhere in the string.
7299
+ /-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----/u
7300
+ ];
7301
+ function isCredentialShapedText(value) {
7302
+ if (typeof value !== "string" || value.length === 0)
7303
+ return false;
7304
+ return CREDENTIAL_VALUE_PATTERNS.some((pattern) => pattern.test(value));
7305
+ }
7306
+
7049
7307
  // packages/plugin-protocol/dist/ui-module-bundle.js
7050
7308
  import { z as z21 } from "zod";
7051
7309
  var KAY_UI_MODULE_BUNDLE_PROTOCOL = "kay.ui.module-bundle.v1";
@@ -7216,8 +7474,15 @@ export {
7216
7474
  PLUGIN_CAPABILITY_SLUGS,
7217
7475
  PLUGIN_DIAGNOSTIC_MESSAGE_CAP,
7218
7476
  PLUGIN_EVENT_ID_MAX_BYTES,
7477
+ PLUGIN_EVENT_REFUSED_ERROR_NAME,
7219
7478
  PLUGIN_ICON_SHAPE_ATTRIBUTE,
7220
7479
  PLUGIN_NOTIFICATION_RULE_HOST_KEYS,
7480
+ PLUGIN_SIGNAL_KINDS,
7481
+ PLUGIN_SIGNAL_LABELS_MAX,
7482
+ PLUGIN_SIGNAL_LABEL_MAX,
7483
+ PLUGIN_SIGNAL_RELATED_KEYS,
7484
+ PLUGIN_SIGNAL_SNIPPET_MAX,
7485
+ PLUGIN_SIGNAL_TITLE_MAX,
7221
7486
  PRIVATE_PLUGIN_CAPABILITY_SLUGS,
7222
7487
  PackageAssetPath,
7223
7488
  PluginAgentDefinitionPermissionRule,
@@ -7253,6 +7518,8 @@ export {
7253
7518
  PluginPermissionManifest,
7254
7519
  PluginProvisioningProbe,
7255
7520
  PluginProvisioningRequirement,
7521
+ PluginSignal,
7522
+ PluginSignalPublish,
7256
7523
  PluginSkillSourceDeclaration,
7257
7524
  PluginSourceClass,
7258
7525
  PluginStorageManifest,
@@ -7274,6 +7541,7 @@ export {
7274
7541
  ReferencePresentationUrlClaim,
7275
7542
  ReferencePresentationVariant,
7276
7543
  ReferencePresentationVariants,
7544
+ ReferencePresentationWords,
7277
7545
  RegistrableDomain,
7278
7546
  ResolvedAuthGrantRequest,
7279
7547
  ResolvedEndpointGrantRequest,
@@ -7325,6 +7593,7 @@ export {
7325
7593
  SignedInStatusCode,
7326
7594
  SkillContribution,
7327
7595
  StorageGrantRequest,
7596
+ TOOL_GLYPHS,
7328
7597
  TargetEntrypoint,
7329
7598
  TargetPermissionSet,
7330
7599
  TargetPermissionWiring,
@@ -7381,6 +7650,7 @@ export {
7381
7650
  hostWithinDomain,
7382
7651
  isCanonicalArtifactOutputUri,
7383
7652
  isCompatible,
7653
+ isCredentialShapedText,
7384
7654
  isKayPluginCompatibilityRefusal,
7385
7655
  isPrivateCapabilityClaim,
7386
7656
  isQualifiedAuthSchemeRef,
@@ -7404,6 +7674,7 @@ export {
7404
7674
  parseSemver,
7405
7675
  parseWhere,
7406
7676
  pluginIconShape,
7677
+ pluginSignalPayloadJsonSchema,
7407
7678
  precedingPersonMessages,
7408
7679
  readKayPluginDeclaredCompatibility,
7409
7680
  refineWebSessionScopeConfined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.37.1",
3
+ "version": "0.39.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",