@yaklabs-ai/plugin-sdk 0.45.0 → 0.47.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.
@@ -2485,9 +2485,21 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2485
2485
  * 0.44.0 adds `words.kinds` to a reference presentation (#15905): an ordered list of address patterns
2486
2486
  * and the kind each one names. Additive: a plugin that lists them declares ^0.44.0.
2487
2487
  *
2488
- * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints.
2488
+ * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints. It also
2489
+ * lets a plugin declare what the window hardcoded about it (#15906). A reference presentation gains
2490
+ * `accountLinks`, how a page opens under the account an address means, and a `local-app` open, for
2491
+ * an item an app on this machine shows; a plugin the person installed can't declare that open. A
2492
+ * `webSession` gains `signInFirst`. A URI module defines `lookupWebLink` and sets `looksUpWebLinks`
2493
+ * to find a page when someone opens the address, and a preview field marks which `part` of a message
2494
+ * it is. A claim's `brandIcon` is a file path and no longer inline markup, which only this repo's
2495
+ * Microsoft plugin used. Otherwise additive: a plugin using any of these declares ^0.45.0.
2496
+ *
2497
+ * 0.46.0 adds `@bonsai/plugin-sdk/artifact-provenance`, so a plugin shipped as files can finalize
2498
+ * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2499
+ *
2500
+ * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2489
2501
  */
2490
- declare const KAY_PLUGIN_SDK_VERSION: "0.45.0";
2502
+ declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2491
2503
 
2492
2504
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2493
2505
 
@@ -4751,6 +4763,7 @@ declare function refineWebSessionScopeConfined(webSession: {
4751
4763
  readonly probe: {
4752
4764
  readonly url: string;
4753
4765
  };
4766
+ readonly signInFirst?: string | undefined;
4754
4767
  }, ctx: z.RefinementCtx): void;
4755
4768
 
4756
4769
  declare const RegistrableDomain: z.ZodString;
@@ -4861,9 +4874,8 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4861
4874
  storage: "storage";
4862
4875
  uriModule: "uriModule";
4863
4876
  authService: "authService";
4864
- app: "app";
4865
4877
  command: "command";
4866
- configSection: "configSection";
4878
+ app: "app";
4867
4879
  skill: "skill";
4868
4880
  converter: "converter";
4869
4881
  artifactUriModule: "artifactUriModule";
@@ -4886,11 +4898,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
4886
4898
  mcpServer: "mcpServer";
4887
4899
  uiCommand: "uiCommand";
4888
4900
  uiSlot: "uiSlot";
4889
- settingsPanel: "settingsPanel";
4890
- resultRenderer: "resultRenderer";
4891
4901
  referencePresentation: "referencePresentation";
4892
- view: "view";
4893
4902
  theme: "theme";
4903
+ configSection: "configSection";
4894
4904
  }>;
4895
4905
  localId: z.ZodString;
4896
4906
  globalId: z.ZodString;
@@ -5059,6 +5069,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5059
5069
  external: "external";
5060
5070
  embedded: "embedded";
5061
5071
  }>;
5072
+ signInFirst: z.ZodOptional<z.ZodString>;
5062
5073
  }, z.core.$strict>>;
5063
5074
  }, z.core.$strict>>;
5064
5075
  grants: z.ZodOptional<z.ZodObject<{
@@ -5518,6 +5529,7 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5518
5529
  authSchemeId: z.ZodOptional<z.ZodString>;
5519
5530
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
5520
5531
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
5532
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
5521
5533
  }, z.core.$strict>>>;
5522
5534
  kayAgentArtifactUriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5523
5535
  localId: z.ZodString;
@@ -5741,9 +5753,6 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5741
5753
  bodyField: z.ZodString;
5742
5754
  }, z.core.$strict>], "kind">;
5743
5755
  valueSchema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
5744
- presentation: z.ZodOptional<z.ZodObject<{
5745
- app: z.ZodString;
5746
- }, z.core.$strict>>;
5747
5756
  }, z.core.$strict>>>;
5748
5757
  kayAppMcpServers: z.ZodOptional<z.ZodArray<z.ZodObject<{
5749
5758
  name: z.ZodString;
@@ -5769,6 +5778,29 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5769
5778
  uriModule: z.ZodOptional<z.ZodString>;
5770
5779
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5771
5780
  displayName: z.ZodOptional<z.ZodString>;
5781
+ authService: z.ZodOptional<z.ZodString>;
5782
+ accountLinks: z.ZodOptional<z.ZodObject<{
5783
+ label: z.ZodOptional<z.ZodEnum<{
5784
+ email: "email";
5785
+ name: "name";
5786
+ }>>;
5787
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
5788
+ hostname: z.ZodString;
5789
+ pathname: z.ZodOptional<z.ZodString>;
5790
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
5791
+ setPathname: z.ZodOptional<z.ZodString>;
5792
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
5793
+ }, z.core.$strict>>>;
5794
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
5795
+ pattern: z.ZodObject<{
5796
+ protocol: z.ZodString;
5797
+ hostname: z.ZodString;
5798
+ pathname: z.ZodOptional<z.ZodString>;
5799
+ search: z.ZodOptional<z.ZodString>;
5800
+ }, z.core.$strict>;
5801
+ url: z.ZodString;
5802
+ }, z.core.$strict>>>;
5803
+ }, z.core.$strict>>;
5772
5804
  addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
5773
5805
  pattern: z.ZodObject<{
5774
5806
  protocol: z.ZodString;
@@ -5789,6 +5821,9 @@ declare const ResolvedPluginContractV1: z.ZodObject<{
5789
5821
  }, z.core.$strict>, z.ZodObject<{
5790
5822
  kind: z.ZodLiteral<"page">;
5791
5823
  pageId: z.ZodString;
5824
+ }, z.core.$strict>, z.ZodObject<{
5825
+ kind: z.ZodLiteral<"local-app">;
5826
+ schemes: z.ZodArray<z.ZodString>;
5792
5827
  }, z.core.$strict>], "kind">>;
5793
5828
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
5794
5829
  resourceKind: z.ZodString;
@@ -8957,6 +8992,7 @@ declare const toolCallFailureCauseSchema: z.ZodObject<{
8957
8992
  errorName: z.ZodOptional<z.ZodString>;
8958
8993
  errorCode: z.ZodOptional<z.ZodString>;
8959
8994
  providerCode: z.ZodOptional<z.ZodString>;
8995
+ provider: z.ZodOptional<z.ZodString>;
8960
8996
  status: z.ZodOptional<z.ZodNumber>;
8961
8997
  editIndex: z.ZodOptional<z.ZodNumber>;
8962
8998
  occurrences: z.ZodOptional<z.ZodNumber>;
@@ -10670,6 +10706,11 @@ declare type UriClaim = UriSchemeClaim | UriPatternClaim | UrlPatternClaim;
10670
10706
  * - `base64`: unpadded base64 of the UTF-8 text (`{base64(:id :calendar)}`).
10671
10707
  * - `slackTimestamp`: a Slack archive message token as the API's timestamp
10672
10708
  * (`p1783350000000100` becomes `1783350000.000100`).
10709
+ * - `beforeColon`: the part of a `<team>:<user>` id before the colon. It fills nothing for an id
10710
+ * with no colon or nothing before it.
10711
+ * - `beforeTilde`: the part of an id before its last `~`. It fills nothing with no `~`.
10712
+ * - `encoded`: every reserved character escaped, `:` and `@` too, for a whole URL carried as a
10713
+ * query value (`continue={encoded(:url)}`).
10673
10714
  *
10674
10715
  * A transform that cannot read its input fills nothing. A claim whose `normalizeTo` fills nothing
10675
10716
  * does not match; a `sourceUrl` that fills nothing paints no link.
@@ -10928,6 +10969,13 @@ declare interface UriModule {
10928
10969
  readonly uri: string;
10929
10970
  readonly payload: unknown;
10930
10971
  }, ctx: UriResolveContext): Promise<UriOperationDescription | undefined>;
10972
+ /**
10973
+ * Find the web address of `uri` by asking the provider, for a resource whose address alone can't
10974
+ * name its page. Called only when someone opens the address, under the account it means, and never
10975
+ * to draw a reference. `undefined` means there's no page to open. A plugin module that defines
10976
+ * this sets `looksUpWebLinks` in its manifest.
10977
+ */
10978
+ lookupWebLink?(uri: string, ctx: UriResolveContext): Promise<string | undefined>;
10931
10979
  readonly getCachePolicy?: UriCachePolicyResolver;
10932
10980
  /**
10933
10981
  * Code matching, for the host's own modules whose addresses no claim can describe (a bare file
@@ -11049,6 +11097,11 @@ declare interface UriOperationDescription {
11049
11097
  readonly editable?: true;
11050
11098
  /** Longest edited value, in UTF-16 code units. Meaningful only with `editable`. */
11051
11099
  readonly maxLength?: number;
11100
+ /**
11101
+ * Which part of a message this field is, when the call sends one. A preview with a `to` and
11102
+ * a `text` is drawn as a message; without them it stays labelled rows.
11103
+ */
11104
+ readonly part?: "to" | "cc" | "bcc" | "subject" | "text";
11052
11105
  }[];
11053
11106
  };
11054
11107
  /** True only when every displayed fact comes from the input, independent of the executing account. */
@@ -11654,9 +11707,6 @@ declare const WhiteboardTypeInfo: z.ZodObject<{
11654
11707
  displayName: z.ZodString;
11655
11708
  schemaVersion: z.ZodNumber;
11656
11709
  available: z.ZodBoolean;
11657
- presentation: z.ZodOptional<z.ZodObject<{
11658
- app: z.ZodString;
11659
- }, z.core.$strict>>;
11660
11710
  }, z.core.$strict>;
11661
11711
 
11662
11712
  declare type WhiteboardTypeInfo = Readonly<z.infer<typeof WhiteboardTypeInfo>>;
@@ -2760,9 +2760,21 @@ declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2760
2760
  * 0.44.0 adds `words.kinds` to a reference presentation (#15905): an ordered list of address patterns
2761
2761
  * and the kind each one names. Additive: a plugin that lists them declares ^0.44.0.
2762
2762
  *
2763
- * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints.
2763
+ * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints. It also
2764
+ * lets a plugin declare what the window hardcoded about it (#15906). A reference presentation gains
2765
+ * `accountLinks`, how a page opens under the account an address means, and a `local-app` open, for
2766
+ * an item an app on this machine shows; a plugin the person installed can't declare that open. A
2767
+ * `webSession` gains `signInFirst`. A URI module defines `lookupWebLink` and sets `looksUpWebLinks`
2768
+ * to find a page when someone opens the address, and a preview field marks which `part` of a message
2769
+ * it is. A claim's `brandIcon` is a file path and no longer inline markup, which only this repo's
2770
+ * Microsoft plugin used. Otherwise additive: a plugin using any of these declares ^0.45.0.
2771
+ *
2772
+ * 0.46.0 adds `@bonsai/plugin-sdk/artifact-provenance`, so a plugin shipped as files can finalize
2773
+ * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
2774
+ *
2775
+ * 0.47.0 adds card layouts and builders; successful card submits now require a summary.
2764
2776
  */
2765
- declare const KAY_PLUGIN_SDK_VERSION: "0.45.0";
2777
+ declare const KAY_PLUGIN_SDK_VERSION: "0.47.0";
2766
2778
 
2767
2779
  declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2768
2780
 
@@ -5800,6 +5812,7 @@ declare function refineWebSessionScopeConfined(webSession: {
5800
5812
  readonly probe: {
5801
5813
  readonly url: string;
5802
5814
  };
5815
+ readonly signInFirst?: string | undefined;
5803
5816
  }, ctx: z.RefinementCtx): void;
5804
5817
 
5805
5818
  declare const RegistrableDomain: z.ZodString;
@@ -9038,6 +9051,7 @@ declare const toolCallFailureCauseSchema: z.ZodObject<{
9038
9051
  errorName: z.ZodOptional<z.ZodString>;
9039
9052
  errorCode: z.ZodOptional<z.ZodString>;
9040
9053
  providerCode: z.ZodOptional<z.ZodString>;
9054
+ provider: z.ZodOptional<z.ZodString>;
9041
9055
  status: z.ZodOptional<z.ZodNumber>;
9042
9056
  editIndex: z.ZodOptional<z.ZodNumber>;
9043
9057
  occurrences: z.ZodOptional<z.ZodNumber>;
@@ -10790,6 +10804,11 @@ export declare type UriClaim = UriSchemeClaim | UriPatternClaim | UrlPatternClai
10790
10804
  * - `base64`: unpadded base64 of the UTF-8 text (`{base64(:id :calendar)}`).
10791
10805
  * - `slackTimestamp`: a Slack archive message token as the API's timestamp
10792
10806
  * (`p1783350000000100` becomes `1783350000.000100`).
10807
+ * - `beforeColon`: the part of a `<team>:<user>` id before the colon. It fills nothing for an id
10808
+ * with no colon or nothing before it.
10809
+ * - `beforeTilde`: the part of an id before its last `~`. It fills nothing with no `~`.
10810
+ * - `encoded`: every reserved character escaped, `:` and `@` too, for a whole URL carried as a
10811
+ * query value (`continue={encoded(:url)}`).
10793
10812
  *
10794
10813
  * A transform that cannot read its input fills nothing. A claim whose `normalizeTo` fills nothing
10795
10814
  * does not match; a `sourceUrl` that fills nothing paints no link.
@@ -11096,6 +11115,13 @@ export declare interface UriModule {
11096
11115
  readonly uri: string;
11097
11116
  readonly payload: unknown;
11098
11117
  }, ctx: UriResolveContext): Promise<UriOperationDescription | undefined>;
11118
+ /**
11119
+ * Find the web address of `uri` by asking the provider, for a resource whose address alone can't
11120
+ * name its page. Called only when someone opens the address, under the account it means, and never
11121
+ * to draw a reference. `undefined` means there's no page to open. A plugin module that defines
11122
+ * this sets `looksUpWebLinks` in its manifest.
11123
+ */
11124
+ lookupWebLink?(uri: string, ctx: UriResolveContext): Promise<string | undefined>;
11099
11125
  readonly getCachePolicy?: UriCachePolicyResolver;
11100
11126
  /**
11101
11127
  * Code matching, for the host's own modules whose addresses no claim can describe (a bare file
@@ -11234,6 +11260,11 @@ export declare interface UriOperationDescription {
11234
11260
  readonly editable?: true;
11235
11261
  /** Longest edited value, in UTF-16 code units. Meaningful only with `editable`. */
11236
11262
  readonly maxLength?: number;
11263
+ /**
11264
+ * Which part of a message this field is, when the call sends one. A preview with a `to` and
11265
+ * a `text` is drawn as a message; without them it stays labelled rows.
11266
+ */
11267
+ readonly part?: "to" | "cc" | "bcc" | "subject" | "text";
11237
11268
  }[];
11238
11269
  };
11239
11270
  /** True only when every displayed fact comes from the input, independent of the executing account. */
@@ -12030,9 +12061,6 @@ export declare const WhiteboardTypeInfo: z.ZodObject<{
12030
12061
  displayName: z.ZodString;
12031
12062
  schemaVersion: z.ZodNumber;
12032
12063
  available: z.ZodBoolean;
12033
- presentation: z.ZodOptional<z.ZodObject<{
12034
- app: z.ZodString;
12035
- }, z.core.$strict>>;
12036
12064
  }, z.core.$strict>;
12037
12065
 
12038
12066
  export declare type WhiteboardTypeInfo = Readonly<z.infer<typeof WhiteboardTypeInfo>>;
package/dist/kay-agent.js CHANGED
@@ -5,12 +5,15 @@ var REST_CAPTURE_RE = /^:([A-Za-z_][A-Za-z0-9_]*)\*$/;
5
5
  var CONSTRAINED_CAPTURE_RE = /^([A-Za-z_][A-Za-z0-9_]*)(?:\((.*)\))?(\.[A-Za-z0-9]+)?$/;
6
6
  var MAX_CAPTURE_CONSTRAINT_LENGTH = 64;
7
7
  function compileUriClaim(claim) {
8
+ return compileClaim(claim);
9
+ }
10
+ function compileClaim(claim) {
8
11
  if (claim.kind === "scheme") {
9
12
  const scheme = normalizeProtocol(claim.scheme);
10
13
  return {
11
14
  claim,
12
15
  match(input) {
13
- const actual = SCHEME_RE.exec(input.trim())?.[1]?.toLowerCase();
16
+ const actual = typeof input === "string" ? SCHEME_RE.exec(input.trim())?.[1]?.toLowerCase() : input.scheme;
14
17
  if (actual !== scheme)
15
18
  return void 0;
16
19
  return { claimKind: claim.kind };
@@ -20,8 +23,7 @@ function compileUriClaim(claim) {
20
23
  const pattern = compileRoutePattern(claim.pattern);
21
24
  const normalizeTo = claim.normalizeTo === void 0 ? void 0 : compileTemplate(claim.normalizeTo);
22
25
  const sourceUrl = claim.kind === "uriPattern" && claim.sourceUrl !== void 0 ? compileTemplate(claim.sourceUrl) : void 0;
23
- const matchAt = (target, selector) => {
24
- const parsed = parsePatternInput(target);
26
+ const matchAt = (parsed, selector) => {
25
27
  if (parsed === void 0)
26
28
  return void 0;
27
29
  const captures = matchRoute(pattern, parsed);
@@ -47,14 +49,14 @@ function compileUriClaim(claim) {
47
49
  claim,
48
50
  match(input) {
49
51
  if (claim.kind === "uriPattern") {
50
- const { selector, rest } = parseUriConnectionSelector(input);
52
+ const { selector, rest } = typeof input === "string" ? parseUriConnectionSelector(input) : input.connection;
51
53
  if (selector !== void 0) {
52
- const match = matchAt(rest, selector);
54
+ const match = matchAt(typeof input === "string" ? parsePatternInput(rest) : input.selected, selector);
53
55
  if (match !== void 0)
54
56
  return match;
55
57
  }
56
58
  }
57
- return matchAt(input, void 0);
59
+ return matchAt(typeof input === "string" ? parsePatternInput(input) : input.raw, void 0);
58
60
  }
59
61
  };
60
62
  }
@@ -252,7 +254,16 @@ var TRANSFORMS = {
252
254
  slackTimestamp: (value) => {
253
255
  const match = /^p(\d+)(\d{6})$/.exec(value);
254
256
  return match === null ? void 0 : `${match[1]}.${match[2]}`;
255
- }
257
+ },
258
+ beforeColon: (value) => {
259
+ const end = value.indexOf(":");
260
+ return end > 0 ? value.slice(0, end) : void 0;
261
+ },
262
+ beforeTilde: (value) => {
263
+ const end = value.lastIndexOf("~");
264
+ return end > 0 ? value.slice(0, end) : void 0;
265
+ },
266
+ encoded: encodeURIComponent
256
267
  };
257
268
  function isTransform(name) {
258
269
  return Object.prototype.hasOwnProperty.call(TRANSFORMS, name);
@@ -323,7 +334,7 @@ function fillTemplate(parts, captures, restCaptures) {
323
334
  const transformed = TRANSFORMS[part.transform](raw);
324
335
  if (transformed === void 0)
325
336
  return void 0;
326
- out += escapeForPosition(transformed, part.position);
337
+ out += part.transform === "encoded" ? transformed : escapeForPosition(transformed, part.position);
327
338
  }
328
339
  return out;
329
340
  }