@yaklabs-ai/plugin-protocol 0.44.0 → 0.46.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
@@ -36,7 +36,13 @@ function declaredUiIconPaths(manifest) {
36
36
  label: `kay.ui command '${command.localId}' icon`,
37
37
  path: command.icon
38
38
  }
39
- ])
39
+ ]),
40
+ ...(contributes?.referencePresentations ?? []).flatMap((presentation) => (presentation.claims ?? []).flatMap((claim) => claim.brandIcon === void 0 ? [] : [
41
+ {
42
+ label: `kay.ui reference presentation '${presentation.localId}' brand icon`,
43
+ path: claim.brandIcon
44
+ }
45
+ ]))
40
46
  ];
41
47
  }
42
48
 
@@ -254,11 +260,13 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
254
260
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
255
261
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
256
262
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
257
- var KAY_PLUGIN_SDK_VERSION = "0.44.0";
263
+ var KAY_PLUGIN_SDK_VERSION = "0.46.0";
258
264
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
259
265
  "0.42.0",
260
266
  "0.42.1",
261
- "0.43.0"
267
+ "0.43.0",
268
+ "0.44.0",
269
+ "0.45.0"
262
270
  ];
263
271
  var KAY_PLUGIN_TARGET_NAMES = [
264
272
  "kay.agent",
@@ -378,6 +386,13 @@ function refineWebSessionScopeConfined(webSession, ctx) {
378
386
  message: "probe.url host must fall within a declared cookie domain"
379
387
  });
380
388
  }
389
+ if (webSession.signInFirst !== void 0 && !confined(webSession.signInFirst)) {
390
+ ctx.addIssue({
391
+ code: "custom",
392
+ path: ["signInFirst"],
393
+ message: "signInFirst host must fall within a declared cookie domain"
394
+ });
395
+ }
381
396
  }
382
397
 
383
398
  // packages/plugin-protocol/dist/app-data-read.js
@@ -2754,12 +2769,14 @@ __export(contributions_exports, {
2754
2769
  McpServerContributions: () => McpServerContributions,
2755
2770
  McpServerUrl: () => McpServerUrl,
2756
2771
  PLUGIN_NOTIFICATION_RULE_HOST_KEYS: () => PLUGIN_NOTIFICATION_RULE_HOST_KEYS,
2772
+ PluginCardContribution: () => PluginCardContribution,
2757
2773
  PluginContributionKind: () => PluginContributionKind,
2758
2774
  PluginEventDefinitionContribution: () => PluginEventDefinitionContribution,
2759
2775
  PluginNotificationRuleContribution: () => PluginNotificationRuleContribution,
2760
2776
  PluginProductEventContribution: () => PluginProductEventContribution,
2761
2777
  PluginSkillSourceDeclaration: () => PluginSkillSourceDeclaration,
2762
2778
  ReferenceOpenBehavior: () => ReferenceOpenBehavior,
2779
+ ReferencePresentationAccountLinks: () => ReferencePresentationAccountLinks,
2763
2780
  ReferencePresentationAddress: () => ReferencePresentationAddress,
2764
2781
  ReferencePresentationContribution: () => ReferencePresentationContribution,
2765
2782
  ReferencePresentationTooltip: () => ReferencePresentationTooltip,
@@ -2791,7 +2808,9 @@ __export(contributions_exports, {
2791
2808
  WhiteboardTypeContribution: () => WhiteboardTypeContribution,
2792
2809
  WhiteboardTypeStorage: () => WhiteboardTypeStorage,
2793
2810
  WorkflowContribution: () => WorkflowContribution,
2794
- canonicalContributionSchemas: () => canonicalContributionSchemas
2811
+ canonicalContributionSchemas: () => canonicalContributionSchemas,
2812
+ isUiAppSourceModule: () => isUiAppSourceModule,
2813
+ uiAppSourceStylePath: () => uiAppSourceStylePath
2795
2814
  });
2796
2815
  import { z as z12 } from "zod";
2797
2816
 
@@ -2948,7 +2967,21 @@ function pluginSignalPayloadJsonSchema() {
2948
2967
  }
2949
2968
 
2950
2969
  // packages/plugin-protocol/dist/where-expression.js
2951
- var TOKEN = /\s*(?:(\|\||&&|==|!=|!|\(|\))|'([^']*)'|"([^"]*)"|([A-Za-z][A-Za-z0-9]*(?:\.[A-Za-z][A-Za-z0-9]*)*))/y;
2970
+ var NUMBER_SOURCE = String.raw`-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?`;
2971
+ var SEGMENT_SOURCE = "[A-Za-z0-9_][A-Za-z0-9_-]*";
2972
+ var TOKEN = new RegExp(String.raw`\s*(?:(\|\||&&|==|!=|!|\(|\))` + String.raw`|'((?:[^'\\]|\\[\s\S])*)'|"((?:[^"\\]|\\[\s\S])*)"` + // A number that runs on into a key's characters is a key: `1.5.2`, `1-a`.
2973
+ String.raw`|(${NUMBER_SOURCE})(?![A-Za-z0-9_.-])` + `|(${SEGMENT_SOURCE}(?:\\.${SEGMENT_SOURCE})*))`, "y");
2974
+ var WHOLE_NUMBER = new RegExp(`^${NUMBER_SOURCE}$`);
2975
+ var WHOLE_KEY = new RegExp(`^${SEGMENT_SOURCE}(?:\\.${SEGMENT_SOURCE})*$`);
2976
+ function unescapeString(text) {
2977
+ return text.replace(/\\([\s\S])/g, (_, character) => {
2978
+ if (character === "\\" || character === "'" || character === '"') {
2979
+ return character;
2980
+ }
2981
+ throw new Error(`unknown escape '\\${character}'; a string can escape only \\, ' and "`);
2982
+ });
2983
+ }
2984
+ var MAX_TOKENS = 2e3;
2952
2985
  function tokenize(source) {
2953
2986
  const tokens = [];
2954
2987
  TOKEN.lastIndex = 0;
@@ -2958,13 +2991,21 @@ function tokenize(source) {
2958
2991
  if (match === null) {
2959
2992
  throw new Error(`unexpected text at '${source.slice(start).trim()}'`);
2960
2993
  }
2961
- const [, operator, single, double, word] = match;
2994
+ if (tokens.length === MAX_TOKENS) {
2995
+ throw new Error(`the expression has more than ${MAX_TOKENS} parts`);
2996
+ }
2997
+ const [, operator, single, double, number, word] = match;
2962
2998
  if (operator !== void 0)
2963
2999
  tokens.push({ kind: "operator", text: operator });
3000
+ else if (number !== void 0)
3001
+ tokens.push({ kind: "number", text: number });
2964
3002
  else if (word !== void 0)
2965
3003
  tokens.push({ kind: "word", text: word });
2966
3004
  else
2967
- tokens.push({ kind: "string", text: single ?? double ?? "" });
3005
+ tokens.push({
3006
+ kind: "string",
3007
+ text: unescapeString(single ?? double ?? "")
3008
+ });
2968
3009
  }
2969
3010
  return tokens;
2970
3011
  }
@@ -3016,6 +3057,14 @@ function parseTokens(tokens, keyTypes) {
3016
3057
  };
3017
3058
  const parseKeyAtom = (key) => {
3018
3059
  const keyType = keyTypes?.[key];
3060
+ const next = tokens[position];
3061
+ if (next?.kind === "word" && next.text === "contains") {
3062
+ if (keyTypes !== void 0) {
3063
+ throw new Error(`'${key}' is not a list; compare it with == or !=`);
3064
+ }
3065
+ position += 1;
3066
+ return { kind: "contains", key, value: parseLiteral("contains") };
3067
+ }
3019
3068
  const negated = takeOperator("!=");
3020
3069
  if (!negated && !takeOperator("==")) {
3021
3070
  if (keyType === "string") {
@@ -3023,22 +3072,29 @@ function parseTokens(tokens, keyTypes) {
3023
3072
  }
3024
3073
  return { kind: "key", key };
3025
3074
  }
3026
- const value = parseLiteral();
3075
+ const value = parseLiteral("== or !=");
3027
3076
  if (keyType !== void 0 && typeof value !== keyType) {
3028
3077
  throw new Error(`'${key}' compares to a ${keyType}`);
3029
3078
  }
3030
3079
  return { kind: "equals", key, value, negated };
3031
3080
  };
3032
- const parseLiteral = () => {
3081
+ const parseLiteral = (after) => {
3033
3082
  const token = tokens[position];
3034
3083
  position += 1;
3035
3084
  if (token?.kind === "string")
3036
3085
  return token.text;
3086
+ if (token?.kind === "number") {
3087
+ const value = Number(token.text);
3088
+ if (!Number.isFinite(value)) {
3089
+ throw new Error(`the number ${token.text} is too large`);
3090
+ }
3091
+ return value;
3092
+ }
3037
3093
  if (token?.kind === "word" && token.text === "true")
3038
3094
  return true;
3039
3095
  if (token?.kind === "word" && token.text === "false")
3040
3096
  return false;
3041
- throw new Error("expected a string, true or false after == or !=");
3097
+ throw new Error(`expected a string, number, true or false after ${after}`);
3042
3098
  };
3043
3099
  const where = parseOr();
3044
3100
  const extra = tokens[position];
@@ -3053,6 +3109,80 @@ function parseWhere(source, keyTypes) {
3053
3109
  return { ok: false, message: error.message };
3054
3110
  }
3055
3111
  }
3112
+ function whereKeyUses(where) {
3113
+ switch (where.kind) {
3114
+ case "literal":
3115
+ return [];
3116
+ case "key":
3117
+ return [{ key: where.key, use: "bare" }];
3118
+ case "equals":
3119
+ return [{ key: where.key, use: "compared" }];
3120
+ case "contains":
3121
+ return [{ key: where.key, use: "contained" }];
3122
+ case "not":
3123
+ return whereKeyUses(where.operand);
3124
+ case "and":
3125
+ case "or":
3126
+ return [...whereKeyUses(where.left), ...whereKeyUses(where.right)];
3127
+ }
3128
+ }
3129
+ function formatWhereLiteral(value) {
3130
+ return typeof value === "string" ? `'${value.replace(/[\\']/g, "\\$&")}'` : String(value);
3131
+ }
3132
+ function whereClausesAsExpression(clauses, looksInsideLists = () => false) {
3133
+ if (!Array.isArray(clauses) || clauses.length === 0)
3134
+ return void 0;
3135
+ const written = [];
3136
+ for (const clause of clauses) {
3137
+ if (typeof clause !== "object" || clause === null)
3138
+ return void 0;
3139
+ const { path, equals } = clause;
3140
+ if (Object.keys(clause).length !== 2 || typeof path !== "string" || !WHOLE_KEY.test(path) || !(typeof equals === "string" || typeof equals === "boolean" || typeof equals === "number" && Number.isFinite(equals))) {
3141
+ return void 0;
3142
+ }
3143
+ if (path === "true" || path === "false" || WHOLE_NUMBER.test(path)) {
3144
+ written.push("false");
3145
+ continue;
3146
+ }
3147
+ const literal = formatWhereLiteral(equals);
3148
+ written.push(looksInsideLists(path) ? `(${path} == ${literal} || ${path} contains ${literal})` : `${path} == ${literal}`);
3149
+ }
3150
+ return written.join(" && ");
3151
+ }
3152
+ function whereNotAStringMessage(value) {
3153
+ const expression = whereClausesAsExpression(value);
3154
+ if (expression !== void 0) {
3155
+ return `where is now an expression, not a list of {path, equals}: write \`${expression}\`, and use \`contains\` to look inside a list`;
3156
+ }
3157
+ return Array.isArray(value) ? "where is now an expression, not a list of {path, equals}, for example `payload.status == 'open' && payload.labels contains 'urgent'`" : "where must be an expression string";
3158
+ }
3159
+ var WHERE_MAX_BYTES = 256 * 1024;
3160
+ function whereProblem(value) {
3161
+ if (typeof value !== "string")
3162
+ return whereNotAStringMessage(value);
3163
+ if (new TextEncoder().encode(value).length > WHERE_MAX_BYTES) {
3164
+ return `where must be at most ${WHERE_MAX_BYTES} bytes of UTF-8`;
3165
+ }
3166
+ const parsed = parseWhere(value);
3167
+ return parsed.ok ? void 0 : `where is not a valid expression: ${parsed.message}`;
3168
+ }
3169
+ var MAX_EVENT_KEY_BYTES = 256;
3170
+ var MAX_EVENT_KEY_SEGMENTS = 10;
3171
+ function eventWhereProblem(value) {
3172
+ const problem = whereProblem(value);
3173
+ if (problem !== void 0)
3174
+ return problem;
3175
+ const parsed = parseWhere(value);
3176
+ if (!parsed.ok)
3177
+ return void 0;
3178
+ for (const { key } of whereKeyUses(parsed.where)) {
3179
+ const segments = key.split(".");
3180
+ if (new TextEncoder().encode(key).length > MAX_EVENT_KEY_BYTES || segments.length > MAX_EVENT_KEY_SEGMENTS || segments.some((segment) => !/^[a-zA-Z_]/.test(segment) || ["__proto__", "prototype", "constructor"].includes(segment))) {
3181
+ return `where key '${key}' must be a safe dot path of at most ${MAX_EVENT_KEY_SEGMENTS} identifier segments and ${MAX_EVENT_KEY_BYTES} bytes`;
3182
+ }
3183
+ }
3184
+ return void 0;
3185
+ }
3056
3186
  function resolve(where, read) {
3057
3187
  switch (where.kind) {
3058
3188
  case "literal":
@@ -3067,6 +3197,12 @@ function resolve(where, read) {
3067
3197
  return void 0;
3068
3198
  return value === where.value !== where.negated;
3069
3199
  }
3200
+ case "contains": {
3201
+ const value = read(where.key);
3202
+ if (value === void 0)
3203
+ return void 0;
3204
+ return Array.isArray(value) && value.includes(where.value);
3205
+ }
3070
3206
  case "not": {
3071
3207
  const operand = resolve(where.operand, read);
3072
3208
  return operand === void 0 ? void 0 : !operand;
@@ -3113,6 +3249,15 @@ function declarationsOfKind(plugins, kind) {
3113
3249
  function declaredReferencePresentations(plugins) {
3114
3250
  return plugins.flatMap((plugin) => (plugin.contributes["referencePresentations"] ?? []).map((declaration) => ({ plugin, declaration })));
3115
3251
  }
3252
+ function declaredLocalAppSchemes(plugins) {
3253
+ return new Set(declaredReferencePresentations(plugins).flatMap(({ declaration }) => declaration.open?.kind === "local-app" ? declaration.schemes ?? [] : []));
3254
+ }
3255
+ function isDeclaredLocalAppLink(url, plugins) {
3256
+ if (!URL.canParse(url))
3257
+ return false;
3258
+ const scheme = new URL(url).protocol.slice(0, -1).toLowerCase();
3259
+ return declaredReferencePresentations(plugins).some(({ declaration }) => declaration.open?.kind === "local-app" && declaration.open.schemes.includes(scheme));
3260
+ }
3116
3261
  function declaredCommandId(pluginId, localId) {
3117
3262
  return `${pluginId}/${localId}`;
3118
3263
  }
@@ -3423,14 +3568,19 @@ function createContributionsSchemas(canonical) {
3423
3568
  // The module's code defines `describeOperation`, the approval card's facts for a call. The
3424
3569
  // daemon reads it here because it may hold only the manifest (a plugin that runs in the
3425
3570
  // plugin host), and the host refuses a module whose code disagrees.
3426
- describesOperations: z12.literal(true).optional()
3571
+ describesOperations: z12.literal(true).optional(),
3572
+ // The module's code defines `lookupWebLink`, which finds a resource's page when someone opens
3573
+ // it. The daemon reads it here for the same reason, and the host refuses a module whose code
3574
+ // disagrees.
3575
+ looksUpWebLinks: z12.literal(true).optional()
3427
3576
  });
3428
3577
  const AppUriModuleContribution2 = UriModuleContribution2.omit({
3429
3578
  authActions: true,
3430
3579
  authService: true,
3431
3580
  authScheme: true,
3432
3581
  knownResources: true,
3433
- describesOperations: true
3582
+ describesOperations: true,
3583
+ looksUpWebLinks: true
3434
3584
  });
3435
3585
  const AppDataSourceStore = z12.discriminatedUnion("shape", [
3436
3586
  z12.strictObject({
@@ -3636,6 +3786,14 @@ function createContributionsSchemas(canonical) {
3636
3786
  localId: LocalContributionId2,
3637
3787
  resultKinds: z12.array(NonEmptyString3).min(1)
3638
3788
  });
3789
+ const PluginCardContribution2 = z12.strictObject({
3790
+ localId: LocalContributionId2,
3791
+ description: NonEmptyString3,
3792
+ inputs: JsonSchema,
3793
+ readEndpoint: LocalContributionId2,
3794
+ submitEndpoint: LocalContributionId2,
3795
+ authService: AuthServiceReference2.optional()
3796
+ });
3639
3797
  const EndpointContribution2 = z12.strictObject({
3640
3798
  localId: LocalContributionId2,
3641
3799
  displayName: OptionalDisplayName,
@@ -3744,7 +3902,7 @@ function createContributionsSchemas(canonical) {
3744
3902
  localId: LocalContributionId2,
3745
3903
  /** The same-plugin `eventDefinitions` local id this rule matches. */
3746
3904
  event: PluginEventLocalId2,
3747
- where: z12.array(JsonObject).optional(),
3905
+ where: z12.string({ error: (issue) => whereNotAStringMessage(issue.input) }).optional(),
3748
3906
  rule: JsonObject
3749
3907
  });
3750
3908
  const PluginProductEventContribution2 = z12.union([
@@ -3810,6 +3968,15 @@ function createContributionsSchemas(canonical) {
3810
3968
  localId: LocalContributionId2,
3811
3969
  resultKinds: z12.array(NonEmptyString3).min(1)
3812
3970
  });
3971
+ const NOT_LOCAL_APP_SCHEMES = /* @__PURE__ */ new Set([
3972
+ "http",
3973
+ "https",
3974
+ "file",
3975
+ "javascript",
3976
+ "data",
3977
+ "blob",
3978
+ "about"
3979
+ ]);
3813
3980
  const ReferenceOpenBehavior2 = z12.discriminatedUnion("kind", [
3814
3981
  z12.strictObject({ kind: z12.literal("working-document") }),
3815
3982
  z12.strictObject({ kind: z12.literal("browser-pane") }),
@@ -3818,14 +3985,22 @@ function createContributionsSchemas(canonical) {
3818
3985
  * manifest, and the page gets the whole address as its `objectId` unless `addresses` says
3819
3986
  * otherwise. Needs no web address, so a plugin-only resource (`user-todo://items/3`) can pill.
3820
3987
  */
3821
- z12.strictObject({ kind: z12.literal("page"), pageId: NonEmptyString3 })
3988
+ z12.strictObject({ kind: z12.literal("page"), pageId: NonEmptyString3 }),
3989
+ /**
3990
+ * Hand the address's link to an app on this machine. The module's claims fill the link as its
3991
+ * `sourceUrl`, and `schemes` names every scheme those links may use: main opens a link only when
3992
+ * a loaded plugin declares its scheme here. A plugin the person installed can't declare this.
3993
+ */
3994
+ z12.strictObject({
3995
+ kind: z12.literal("local-app"),
3996
+ schemes: z12.array(UriScheme2.refine((scheme) => !NOT_LOCAL_APP_SCHEMES.has(scheme), "Names the web, a file or script, not an app on this machine")).min(1)
3997
+ })
3822
3998
  ]);
3823
3999
  const ReferencePresentationVariant2 = z12.strictObject({
3824
4000
  resourceKind: NonEmptyString3,
3825
4001
  presentationPluginId: PluginId2.optional()
3826
4002
  });
3827
4003
  const ReferencePresentationVariants2 = z12.record(MimeTypeString2, ReferencePresentationVariant2);
3828
- const InlineSvg = z12.string().max(64 * 1024).refine((value) => /^\s*(?:<\?xml[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*(?:<!DOCTYPE[^>]*>\s*)?<svg[\s>]/iu.test(value), { message: "brandIcon must be inline SVG markup." });
3829
4004
  const ReferencePresentationUriPattern2 = z12.strictObject({
3830
4005
  protocol: NonEmptyString3,
3831
4006
  hostname: NonEmptyString3,
@@ -3837,7 +4012,8 @@ function createContributionsSchemas(canonical) {
3837
4012
  pattern: ReferencePresentationUriPattern2.extend({
3838
4013
  protocol: z12.enum(["http", "https"])
3839
4014
  }),
3840
- brandIcon: InlineSvg.optional()
4015
+ /** The claim's mark: an SVG file in the plugin, drawn in its own colours. */
4016
+ brandIcon: PackageAssetPath2.optional()
3841
4017
  });
3842
4018
  const ReferencePresentationTooltip2 = z12.strictObject({
3843
4019
  /** Same-plugin kay.ui app mounted with read-only reference URI context. */
@@ -3849,6 +4025,26 @@ function createContributionsSchemas(canonical) {
3849
4025
  objectId: NonEmptyString3.optional(),
3850
4026
  open: z12.strictObject({ kind: z12.literal("none") }).optional()
3851
4027
  });
4028
+ const ReferencePresentationAccountLinkPage = z12.strictObject({
4029
+ /** A literal host name. */
4030
+ hostname: z12.string().regex(/^[a-z0-9.-]+$/, "An account link's hostname is a literal lower-case host name."),
4031
+ pathname: z12.string().optional(),
4032
+ /** A page matching one of these already names its account, so it stays as it is. */
4033
+ unlessPathname: z12.array(z12.string()).min(1).optional(),
4034
+ /** The path the page opens at, in place of its own. */
4035
+ setPathname: z12.string().startsWith("/").optional(),
4036
+ /** Query values to add. A page that already has one of these names stays as it is. */
4037
+ addQuery: z12.record(NonEmptyString3, NonEmptyString3)
4038
+ });
4039
+ const ReferencePresentationAccountLinkAddress = z12.strictObject({
4040
+ pattern: ReferencePresentationUriPattern2,
4041
+ url: z12.string().regex(/^https?:\/\//, "An account link's url is a web page.")
4042
+ });
4043
+ const ReferencePresentationAccountLinks2 = z12.strictObject({
4044
+ label: z12.enum(["email", "name"]).optional(),
4045
+ pages: z12.array(ReferencePresentationAccountLinkPage).min(1).optional(),
4046
+ addresses: z12.array(ReferencePresentationAccountLinkAddress).min(1).optional()
4047
+ });
3852
4048
  const ReferencePresentationWords2 = z12.strictObject({
3853
4049
  /** The row's mark, for a source with no icon of its own. Left out: the plugin's main icon. */
3854
4050
  glyph: z12.enum(TOOL_GLYPHS).optional(),
@@ -3900,7 +4096,9 @@ function createContributionsSchemas(canonical) {
3900
4096
  /** Informational app presentation matched against the canonical resource URI. */
3901
4097
  tooltip: ReferencePresentationTooltip2.optional(),
3902
4098
  /** What the transcript calls this module's addresses. Needs a `uriModule`. */
3903
- words: ReferencePresentationWords2.optional()
4099
+ words: ReferencePresentationWords2.optional(),
4100
+ /** How this module's web pages open under the right account. Needs a `uriModule`. */
4101
+ accountLinks: ReferencePresentationAccountLinks2.optional()
3904
4102
  }).superRefine((value, ctx) => {
3905
4103
  if (value.open === void 0 !== (value.resourceKind === void 0)) {
3906
4104
  ctx.addIssue({
@@ -3909,13 +4107,20 @@ function createContributionsSchemas(canonical) {
3909
4107
  message: "open and resourceKind come together: name both or neither."
3910
4108
  });
3911
4109
  }
3912
- if (value.open === void 0 && value.words === void 0) {
4110
+ if (value.open === void 0 && value.words === void 0 && value.accountLinks === void 0) {
3913
4111
  ctx.addIssue({
3914
4112
  code: "custom",
3915
4113
  path: ["words"],
3916
4114
  message: "A reference presentation that opens nothing must have words."
3917
4115
  });
3918
4116
  }
4117
+ if (value.accountLinks !== void 0 && value.uriModule === void 0) {
4118
+ ctx.addIssue({
4119
+ code: "custom",
4120
+ path: ["accountLinks"],
4121
+ message: "Account links belong to a URI module: name its uriModule."
4122
+ });
4123
+ }
3919
4124
  if (value.words !== void 0 && value.uriModule === void 0) {
3920
4125
  ctx.addIssue({
3921
4126
  code: "custom",
@@ -4138,6 +4343,7 @@ function createContributionsSchemas(canonical) {
4138
4343
  "entityResolver",
4139
4344
  "agentRenderer",
4140
4345
  "endpoint",
4346
+ "pluginCard",
4141
4347
  "command",
4142
4348
  "eventDefinition",
4143
4349
  "eventSubscription",
@@ -4188,6 +4394,7 @@ function createContributionsSchemas(canonical) {
4188
4394
  EntityResolverContribution: EntityResolverContribution2,
4189
4395
  AgentRenderContribution: AgentRenderContribution2,
4190
4396
  EndpointContribution: EndpointContribution2,
4397
+ PluginCardContribution: PluginCardContribution2,
4191
4398
  WorkflowContribution: WorkflowContribution2,
4192
4399
  McpServerUrl: McpServerUrl2,
4193
4400
  McpServerAuthMode: McpServerAuthMode2,
@@ -4212,6 +4419,7 @@ function createContributionsSchemas(canonical) {
4212
4419
  ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2,
4213
4420
  ReferencePresentationTooltip: ReferencePresentationTooltip2,
4214
4421
  ReferencePresentationAddress: ReferencePresentationAddress2,
4422
+ ReferencePresentationAccountLinks: ReferencePresentationAccountLinks2,
4215
4423
  ReferencePresentationWords: ReferencePresentationWords2,
4216
4424
  ReferencePresentationContribution: ReferencePresentationContribution2,
4217
4425
  RichViewContribution: RichViewContribution2,
@@ -4227,8 +4435,15 @@ function createContributionsSchemas(canonical) {
4227
4435
  PluginContributionKind: PluginContributionKind2
4228
4436
  };
4229
4437
  }
4230
- 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, PluginProductEventContribution, 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);
4438
+ 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, PluginCardContribution, WorkflowContribution, McpServerUrl, McpServerAuthMode, McpServerContribution, McpServerContributions, AppEventSubscription, ContextContributorContribution, PluginEventDefinitionContribution, PluginNotificationRuleContribution, PluginProductEventContribution, UiEventSubscriptionContribution, DeviceDelegationContribution, SessionReaderContribution, UiCommandContribution, UiSlotContribution, SettingsPanelContribution, ResultRendererContribution, ReferenceOpenBehavior, ReferencePresentationVariant, ReferencePresentationVariants, ReferencePresentationUriPattern, ReferencePresentationUrlClaim, ReferencePresentationTooltip, ReferencePresentationAddress, ReferencePresentationAccountLinks, ReferencePresentationWords, ReferencePresentationContribution, RichViewContribution, KayUiAppHostCapability, UiAppCapabilities, UiRailEntryContribution, UiToastPreviewContribution, UiPageContribution, UiAppContribution, ThemeContribution, CommandHandler, CommandContribution, PluginContributionKind } = createContributionsSchemas(false);
4231
4439
  var canonicalContributionSchemas = createContributionsSchemas(true);
4440
+ var UI_APP_SOURCE_MODULE = /\.(?:tsx|ts|jsx)$/;
4441
+ function isUiAppSourceModule(module) {
4442
+ return UI_APP_SOURCE_MODULE.test(module);
4443
+ }
4444
+ function uiAppSourceStylePath(module) {
4445
+ return module.replace(UI_APP_SOURCE_MODULE, ".css");
4446
+ }
4232
4447
 
4233
4448
  // packages/plugin-protocol/dist/icon-shape.js
4234
4449
  var SVG_PROLOG = String.raw`^\s*(?:<\?xml[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*(?:<!DOCTYPE[^>]*>\s*)?`;
@@ -4301,7 +4516,7 @@ var KAY_UI_NATIVE_EVENT_SUBSCRIPTIONS = [
4301
4516
  var KAY_UI_NATIVE_EVENT_ALLOWLIST = new Set(KAY_UI_NATIVE_EVENT_SUBSCRIPTIONS);
4302
4517
  var RETIRED_COMPATIBILITY_KEYS = ["policy"];
4303
4518
  function createManifestSchemas(canonical) {
4304
- const { AgentRenderContribution: AgentRenderContribution2, ApprovalTypeContribution: ApprovalTypeContribution2, WorkflowContribution: WorkflowContribution2, AppDataMaterializerContribution: AppDataMaterializerContribution2, AppDataSourceContribution: AppDataSourceContribution2, AppUriModuleContribution: AppUriModuleContribution2, AppEventSubscription: AppEventSubscription2, ArtifactUriModuleContribution: ArtifactUriModuleContribution2, CliBindingContribution: CliBindingContribution2, CommandContribution: CommandContribution2, ContextContributorContribution: ContextContributorContribution2, ConverterContribution: ConverterContribution2, SessionReaderContribution: SessionReaderContribution2, DeviceDelegationContribution: DeviceDelegationContribution2, EndpointContribution: EndpointContribution2, EntityResolverContribution: EntityResolverContribution2, GitHostContribution: GitHostContribution2, McpServerContributions: McpServerContributions2, PluginEventDefinitionContribution: PluginEventDefinitionContribution2, PluginNotificationRuleContribution: PluginNotificationRuleContribution2, PluginProductEventContribution: PluginProductEventContribution2, ResourceContribution: ResourceContribution2, ReferencePresentationContribution: ReferencePresentationContribution2, ResultRendererContribution: ResultRendererContribution2, RichViewContribution: RichViewContribution2, PluginSkillSourceDeclaration: PluginSkillSourceDeclaration2, InteractionDriverContribution: InteractionDriverContribution2, SearchProviderContribution: SearchProviderContribution2, SkillContribution: SkillContribution2, SettingsPanelContribution: SettingsPanelContribution2, ThemeContribution: ThemeContribution2, AgentToolContribution: AgentToolContribution2, ToolContribution: ToolContribution2, UiCommandContribution: UiCommandContribution2, UiAppContribution: UiAppContribution2, UiRailEntryContribution: UiRailEntryContribution2, UiToastPreviewContribution: UiToastPreviewContribution2, UiPageContribution: UiPageContribution2, UiEventSubscriptionContribution: UiEventSubscriptionContribution2, UiSlotContribution: UiSlotContribution2, UriModuleContribution: UriModuleContribution2, WhiteboardTypeContribution: WhiteboardTypeContribution2 } = canonical ? canonicalContributionSchemas : contributions_exports;
4519
+ const { AgentRenderContribution: AgentRenderContribution2, ApprovalTypeContribution: ApprovalTypeContribution2, WorkflowContribution: WorkflowContribution2, PluginCardContribution: PluginCardContribution2, AppDataMaterializerContribution: AppDataMaterializerContribution2, AppDataSourceContribution: AppDataSourceContribution2, AppUriModuleContribution: AppUriModuleContribution2, AppEventSubscription: AppEventSubscription2, ArtifactUriModuleContribution: ArtifactUriModuleContribution2, CliBindingContribution: CliBindingContribution2, CommandContribution: CommandContribution2, ContextContributorContribution: ContextContributorContribution2, ConverterContribution: ConverterContribution2, SessionReaderContribution: SessionReaderContribution2, DeviceDelegationContribution: DeviceDelegationContribution2, EndpointContribution: EndpointContribution2, EntityResolverContribution: EntityResolverContribution2, GitHostContribution: GitHostContribution2, McpServerContributions: McpServerContributions2, PluginEventDefinitionContribution: PluginEventDefinitionContribution2, PluginNotificationRuleContribution: PluginNotificationRuleContribution2, PluginProductEventContribution: PluginProductEventContribution2, ResourceContribution: ResourceContribution2, ReferencePresentationContribution: ReferencePresentationContribution2, ResultRendererContribution: ResultRendererContribution2, RichViewContribution: RichViewContribution2, PluginSkillSourceDeclaration: PluginSkillSourceDeclaration2, InteractionDriverContribution: InteractionDriverContribution2, SearchProviderContribution: SearchProviderContribution2, SkillContribution: SkillContribution2, SettingsPanelContribution: SettingsPanelContribution2, ThemeContribution: ThemeContribution2, AgentToolContribution: AgentToolContribution2, ToolContribution: ToolContribution2, UiCommandContribution: UiCommandContribution2, UiAppContribution: UiAppContribution2, UiRailEntryContribution: UiRailEntryContribution2, UiToastPreviewContribution: UiToastPreviewContribution2, UiPageContribution: UiPageContribution2, UiEventSubscriptionContribution: UiEventSubscriptionContribution2, UiSlotContribution: UiSlotContribution2, UriModuleContribution: UriModuleContribution2, WhiteboardTypeContribution: WhiteboardTypeContribution2 } = canonical ? canonicalContributionSchemas : contributions_exports;
4305
4520
  const { HttpsUrl: HttpsUrl2, LocalContributionId: LocalContributionId2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginNamespace: PluginNamespace2, RegistrableDomain: RegistrableDomain2, SignedInStatusCode: SignedInStatusCode2, TargetEntrypoint: TargetEntrypoint2 } = canonical ? canonicalCommonSchemas : common_exports;
4306
4521
  const { PluginPermissionManifest: PluginPermissionManifest2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
4307
4522
  const KayAgentTargetManifest2 = z13.strictObject({
@@ -4390,6 +4605,7 @@ function createManifestSchemas(canonical) {
4390
4605
  // namespace with them (enforced by the manifest-level refinement below).
4391
4606
  tools: z13.array(ToolContribution2).optional(),
4392
4607
  endpoints: z13.array(EndpointContribution2).optional(),
4608
+ cards: z13.array(PluginCardContribution2).optional(),
4393
4609
  uriModules: z13.array(AppUriModuleContribution2).optional(),
4394
4610
  dataSources: z13.array(AppDataSourceContribution2).optional(),
4395
4611
  whiteboardTypes: z13.array(WhiteboardTypeContribution2).optional(),
@@ -4703,7 +4919,13 @@ function createManifestSchemas(canonical) {
4703
4919
  loginUrl: HttpsUrl2,
4704
4920
  cookieDomains: z13.array(RegistrableDomain2).min(1),
4705
4921
  probe: PluginWebSessionProbe2,
4706
- oauthVenue: z13.enum(["embedded", "external"])
4922
+ oauthVenue: z13.enum(["embedded", "external"]),
4923
+ /**
4924
+ * Where a page goes first when it opens in one of Bonsai's browser panes and this site login
4925
+ * is missing: a sign-in page that continues to the page. A template with `:email` and `:url`
4926
+ * (see `UriClaimTemplate`), on a host within `cookieDomains`.
4927
+ */
4928
+ signInFirst: z13.string().optional()
4707
4929
  }).superRefine(refineWebSessionScopeConfined);
4708
4930
  const PluginAuthService2 = z13.strictObject({
4709
4931
  localId: LocalContributionId2,
@@ -5120,6 +5342,39 @@ function createManifestSchemas(canonical) {
5120
5342
  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`
5121
5343
  });
5122
5344
  }
5345
+ for (const [index, card] of (manifest.targets?.kay?.app?.contributes?.cards ?? []).entries()) {
5346
+ const path = ["targets", "kay", "app", "contributes", "cards", index];
5347
+ if (manifest.targets?.kay?.app?.entrypoint === void 0) {
5348
+ ctx.addIssue({
5349
+ code: "custom",
5350
+ path,
5351
+ message: `plugin card ${card.localId} needs a kay.app entrypoint to implement it`
5352
+ });
5353
+ }
5354
+ for (const field of ["readEndpoint", "submitEndpoint"]) {
5355
+ if (!endpointIds.has(card[field])) {
5356
+ ctx.addIssue({
5357
+ code: "custom",
5358
+ path: [...path, field],
5359
+ message: `plugin card ${card.localId} references unknown endpoint ${card[field]}`
5360
+ });
5361
+ }
5362
+ }
5363
+ if (card.readEndpoint === card.submitEndpoint) {
5364
+ ctx.addIssue({
5365
+ code: "custom",
5366
+ path: [...path, "submitEndpoint"],
5367
+ message: `plugin card ${card.localId} needs distinct read and submit endpoints`
5368
+ });
5369
+ }
5370
+ if (card.authService !== void 0 && !isQualifiedAuthServiceRef(card.authService) && !authServices.has(card.authService)) {
5371
+ ctx.addIssue({
5372
+ code: "custom",
5373
+ path: [...path, "authService"],
5374
+ message: `plugin card ${card.localId} references unknown auth service ${card.authService}`
5375
+ });
5376
+ }
5377
+ }
5123
5378
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "workflows"], manifest.targets?.kay?.app?.contributes?.workflows, "workflow");
5124
5379
  for (const [index, workflow] of (manifest.targets?.kay?.app?.contributes?.workflows ?? []).entries()) {
5125
5380
  const path = [
@@ -5744,6 +5999,7 @@ function collectKayAppContributionIds(manifest) {
5744
5999
  const contributes = manifest.targets?.kay?.app?.contributes;
5745
6000
  const output = [];
5746
6001
  pushContributionIds(output, ["targets", "kay", "app", "contributes", "approvalTypes"], contributes?.approvalTypes);
6002
+ pushContributionIds(output, ["targets", "kay", "app", "contributes", "cards"], contributes?.cards);
5747
6003
  pushContributionIds(output, ["targets", "kay", "app", "contributes", "workflows"], contributes?.workflows);
5748
6004
  pushContributionIds(output, ["targets", "kay", "app", "contributes", "tools"], contributes?.tools);
5749
6005
  pushContributionIds(output, ["targets", "kay", "app", "contributes", "endpoints"], contributes?.endpoints);
@@ -5820,7 +6076,7 @@ function boundPluginDiagnosticMessage(message) {
5820
6076
  import { z as z14 } from "zod";
5821
6077
  function createResolvedContractSchemas(canonical) {
5822
6078
  const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
5823
- 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;
6079
+ const { ApprovalTypeContribution: ApprovalTypeContribution2, KayUiAppHostCapability: KayUiAppHostCapability2, McpServerAuthMode: McpServerAuthMode2, McpServerUrl: McpServerUrl2, PluginContributionKind: PluginContributionKindSchema, ReferenceOpenBehavior: ReferenceOpenBehavior2, ReferencePresentationUriPattern: ReferencePresentationUriPattern2, ReferencePresentationAccountLinks: ReferencePresentationAccountLinks2, ReferencePresentationAddress: ReferencePresentationAddress2, ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2, ReferencePresentationVariants: ReferencePresentationVariants2, ReferencePresentationWords: ReferencePresentationWords2, UriModuleFacts: UriModuleFacts2, WhiteboardTypeStorage: WhiteboardTypeStorage2 } = canonical ? canonicalContributionSchemas : contributions_exports;
5824
6080
  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;
5825
6081
  const { PluginExternalCliConnect: PluginExternalCliConnect2, PluginOAuthClientSupplier: PluginOAuthClientSupplier2 } = canonical ? canonicalManifestSchemas : manifest_exports;
5826
6082
  const { ResolvedPluginGrants: ResolvedPluginGrants2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
@@ -5905,6 +6161,22 @@ function createResolvedContractSchemas(canonical) {
5905
6161
  /** The auth service that module signs in through, whose accounts a card may send from. */
5906
6162
  authService: GlobalContributionId2.optional()
5907
6163
  });
6164
+ const ResolvedPluginCard2 = z14.strictObject({
6165
+ localId: LocalContributionId2,
6166
+ globalId: GlobalContributionId2,
6167
+ pluginId: PluginId2,
6168
+ description: NonEmptyString3,
6169
+ inputs: JsonSchema,
6170
+ readEndpoint: z14.strictObject({
6171
+ localId: LocalContributionId2,
6172
+ globalId: GlobalContributionId2
6173
+ }),
6174
+ submitEndpoint: z14.strictObject({
6175
+ localId: LocalContributionId2,
6176
+ globalId: GlobalContributionId2
6177
+ }),
6178
+ authService: GlobalContributionId2.optional()
6179
+ });
5908
6180
  const ResolvedKayAppWorkflow2 = z14.strictObject({
5909
6181
  localId: LocalContributionId2,
5910
6182
  globalId: GlobalContributionId2,
@@ -5947,6 +6219,8 @@ function createResolvedContractSchemas(canonical) {
5947
6219
  knownResources: z14.literal(true).optional(),
5948
6220
  /** Mirrors `UriModuleContribution.describesOperations`. */
5949
6221
  describesOperations: z14.literal(true).optional(),
6222
+ /** Mirrors `UriModuleContribution.looksUpWebLinks`. */
6223
+ looksUpWebLinks: z14.literal(true).optional(),
5950
6224
  ...UriModuleFacts2.shape
5951
6225
  });
5952
6226
  const ResolvedKayAgentArtifactUriModule2 = z14.strictObject({
@@ -5983,6 +6257,9 @@ function createResolvedContractSchemas(canonical) {
5983
6257
  mimeTypes: z14.array(MimeTypeString2).min(1),
5984
6258
  extensions: z14.array(FileExtensionToken2).min(1).optional()
5985
6259
  });
6260
+ const ResolvedReferencePresentationUrlClaim = ReferencePresentationUrlClaim2.extend({
6261
+ brandIcon: z14.string().max(64 * 1024).optional()
6262
+ });
5986
6263
  const ResolvedReferencePresentation2 = z14.strictObject({
5987
6264
  localId: LocalContributionId2,
5988
6265
  globalId: GlobalContributionId2,
@@ -5991,13 +6268,16 @@ function createResolvedContractSchemas(canonical) {
5991
6268
  schemes: z14.array(UriScheme2).min(1).optional(),
5992
6269
  /** The module's `displayName`: the source's name in a row. */
5993
6270
  displayName: NonEmptyString3.optional(),
6271
+ /** The module's auth service, qualified: whose accounts `accountLinks` reads. */
6272
+ authService: GlobalContributionId2.optional(),
6273
+ accountLinks: ReferencePresentationAccountLinks2.optional(),
5994
6274
  addresses: z14.array(ReferencePresentationAddress2).min(1).optional(),
5995
6275
  /** Comes with `open`. A presentation with neither only words its module's addresses. */
5996
6276
  resourceKind: NonEmptyString3.optional(),
5997
6277
  open: ReferenceOpenBehavior2.optional(),
5998
6278
  /** MIME-specific resource kinds; absent keys use the base presentation. */
5999
6279
  variants: ReferencePresentationVariants2.optional(),
6000
- claims: z14.array(ReferencePresentationUrlClaim2).optional(),
6280
+ claims: z14.array(ResolvedReferencePresentationUrlClaim).optional(),
6001
6281
  tooltip: z14.strictObject({
6002
6282
  app: GlobalContributionId2,
6003
6283
  pattern: ReferencePresentationUriPattern2
@@ -6102,7 +6382,8 @@ function createResolvedContractSchemas(canonical) {
6102
6382
  method: z14.enum(["GET", "POST"]),
6103
6383
  signedInStatuses: z14.array(SignedInStatusCode2).min(1)
6104
6384
  }),
6105
- oauthVenue: z14.enum(["embedded", "external"])
6385
+ oauthVenue: z14.enum(["embedded", "external"]),
6386
+ signInFirst: z14.string().optional()
6106
6387
  }).superRefine(refineWebSessionScopeConfined);
6107
6388
  const ResolvedPluginAuthService2 = z14.strictObject({
6108
6389
  localId: LocalContributionId2,
@@ -6143,7 +6424,7 @@ function createResolvedContractSchemas(canonical) {
6143
6424
  contributions: z14.array(ResolvedPluginContributionId2),
6144
6425
  // The deduplicated set of qualified (dotted) external auth-service ids this
6145
6426
  // plugin references, from agent uriModule, tool and cliBinding
6146
- // `authService` refs, and auth-grant `service` refs. Always present - a plugin
6427
+ // `authService` refs, card sign-in refs, and auth-grant `service` refs. Always present - a plugin
6147
6428
  // that only references its own local services carries an empty array. This
6148
6429
  // is a recorded dependency, not a resolution: there is no runtime plugin
6149
6430
  // loader in v1, so nothing here verifies the reference resolves within a
@@ -6168,6 +6449,7 @@ function createResolvedContractSchemas(canonical) {
6168
6449
  kayAppTools: z14.array(ResolvedKayAppTool2).optional(),
6169
6450
  kayAppApprovalTypes: z14.array(ResolvedKayAppApprovalType2).optional(),
6170
6451
  kayAppWorkflows: z14.array(ResolvedKayAppWorkflow2).optional(),
6452
+ kayAppCards: z14.array(ResolvedPluginCard2).optional(),
6171
6453
  kayAppDataSources: z14.array(ResolvedKayAppDataSource2).optional(),
6172
6454
  kayAppWhiteboardTypes: z14.array(ResolvedKayAppWhiteboardType2).optional(),
6173
6455
  kayAppMcpServers: z14.array(ResolvedKayAppMcpServer2).optional(),
@@ -6181,6 +6463,7 @@ function createResolvedContractSchemas(canonical) {
6181
6463
  ResolvedKayAppTool: ResolvedKayAppTool2,
6182
6464
  ResolvedKayAppApprovalType: ResolvedKayAppApprovalType2,
6183
6465
  ResolvedKayAppWorkflow: ResolvedKayAppWorkflow2,
6466
+ ResolvedPluginCard: ResolvedPluginCard2,
6184
6467
  ResolvedKayAppDataSource: ResolvedKayAppDataSource2,
6185
6468
  ResolvedKayAppWhiteboardType: ResolvedKayAppWhiteboardType2,
6186
6469
  ResolvedKayAppMcpServer: ResolvedKayAppMcpServer2,
@@ -6199,7 +6482,7 @@ function createResolvedContractSchemas(canonical) {
6199
6482
  ResolvedPluginContractV1: ResolvedPluginContractV12
6200
6483
  };
6201
6484
  }
6202
- var { ResolvedKayAppApprovalType, ResolvedKayAppWorkflow, ResolvedPluginContributionId, ResolvedKayAgentTool, ResolvedKayAppTool, ResolvedKayAppDataSource, ResolvedKayAppWhiteboardType, ResolvedKayAppMcpServer, ResolvedKayAgentUriModule, ResolvedKayAgentArtifactUriModule, ResolvedKayAgentEntityResolver, ResolvedKayAgentGitHostClaim, ResolvedKayAgentConverter, ResolvedReferencePresentation, ResolvedPluginProvisioningRequirement, ResolvedPluginAuthScheme, ResolvedPluginWebSession, ResolvedPluginAuthService, ResolvedKayUiAppEndpointCapability, ResolvedKayUiApp, ResolvedPluginContractV1 } = createResolvedContractSchemas(false);
6485
+ var { ResolvedKayAppApprovalType, ResolvedKayAppWorkflow, ResolvedPluginCard, ResolvedPluginContributionId, ResolvedKayAgentTool, ResolvedKayAppTool, ResolvedKayAppDataSource, ResolvedKayAppWhiteboardType, ResolvedKayAppMcpServer, ResolvedKayAgentUriModule, ResolvedKayAgentArtifactUriModule, ResolvedKayAgentEntityResolver, ResolvedKayAgentGitHostClaim, ResolvedKayAgentConverter, ResolvedReferencePresentation, ResolvedPluginProvisioningRequirement, ResolvedPluginAuthScheme, ResolvedPluginWebSession, ResolvedPluginAuthService, ResolvedKayUiAppEndpointCapability, ResolvedKayUiApp, ResolvedPluginContractV1 } = createResolvedContractSchemas(false);
6203
6486
  var canonicalResolvedContractSchemas = createResolvedContractSchemas(true);
6204
6487
  function narrowestAccountSelectors() {
6205
6488
  return [{ kind: "active" }];
@@ -6235,6 +6518,7 @@ function collectContributionSources(manifest) {
6235
6518
  const app = manifest.targets?.kay?.app?.contributes;
6236
6519
  pushAll(output, "kay.app", "tool", app?.tools);
6237
6520
  pushAll(output, "kay.app", "endpoint", app?.endpoints);
6521
+ pushAll(output, "kay.app", "pluginCard", app?.cards);
6238
6522
  pushAll(output, "kay.app", "uriModule", app?.uriModules);
6239
6523
  pushAll(output, "kay.app", "appDataSource", app?.dataSources);
6240
6524
  pushAll(output, "kay.app", "whiteboardType", app?.whiteboardTypes);
@@ -6339,6 +6623,9 @@ function collectConsumedAuthServiceIds(manifest) {
6339
6623
  for (const binding of manifest.targets?.kay?.agent?.contributes?.cliBindings ?? []) {
6340
6624
  add(binding.authService);
6341
6625
  }
6626
+ for (const card of manifest.targets?.kay?.app?.contributes?.cards ?? []) {
6627
+ add(card.authService);
6628
+ }
6342
6629
  for (const target of KAY_PLUGIN_TARGET_NAMES) {
6343
6630
  for (const grant of manifest.permissions?.byTarget[target]?.auth ?? []) {
6344
6631
  add(grant.service);
@@ -6366,7 +6653,8 @@ function resolveAuthServices(namespace, manifest) {
6366
6653
  method: service.webSession.probe.method ?? "GET",
6367
6654
  signedInStatuses: [...service.webSession.probe.signedInStatuses]
6368
6655
  },
6369
- oauthVenue: service.webSession.oauthVenue
6656
+ oauthVenue: service.webSession.oauthVenue,
6657
+ ...service.webSession.signInFirst === void 0 ? {} : { signInFirst: service.webSession.signInFirst }
6370
6658
  }
6371
6659
  },
6372
6660
  schemes: service.schemes.map((scheme) => {
@@ -6521,6 +6809,24 @@ function resolveKayPluginContractV1(manifest) {
6521
6809
  globalId: resolveGlobalContributionId(namespace, tool.localId),
6522
6810
  toolName: tool.toolName
6523
6811
  }));
6812
+ const kayAppCards = manifest.targets?.kay?.app?.contributes?.cards?.map((card) => ({
6813
+ localId: card.localId,
6814
+ globalId: resolveGlobalContributionId(namespace, card.localId),
6815
+ pluginId: manifest.id,
6816
+ description: card.description,
6817
+ inputs: card.inputs,
6818
+ readEndpoint: {
6819
+ localId: card.readEndpoint,
6820
+ globalId: resolveGlobalContributionId(namespace, card.readEndpoint)
6821
+ },
6822
+ submitEndpoint: {
6823
+ localId: card.submitEndpoint,
6824
+ globalId: resolveGlobalContributionId(namespace, card.submitEndpoint)
6825
+ },
6826
+ ...card.authService === void 0 ? {} : {
6827
+ authService: isQualifiedAuthServiceRef(card.authService) ? card.authService : resolveGlobalContributionId(namespace, card.authService)
6828
+ }
6829
+ }));
6524
6830
  const kayAppWorkflows = manifest.targets?.kay?.app?.contributes?.workflows?.map(({ auth, ...workflow }) => ({
6525
6831
  ...workflow,
6526
6832
  globalId: resolveGlobalContributionId(namespace, workflow.localId),
@@ -6587,6 +6893,7 @@ function resolveKayPluginContractV1(manifest) {
6587
6893
  },
6588
6894
  ...module.knownResources === void 0 ? {} : { knownResources: module.knownResources },
6589
6895
  ...module.describesOperations === void 0 ? {} : { describesOperations: module.describesOperations },
6896
+ ...module.looksUpWebLinks === void 0 ? {} : { looksUpWebLinks: module.looksUpWebLinks },
6590
6897
  ...uriModuleFacts(module)
6591
6898
  }));
6592
6899
  const kayAgentArtifactUriModules = manifest.targets?.kay?.agent?.contributes?.artifactUriModules?.map((module) => ({
@@ -6622,13 +6929,14 @@ function resolveKayPluginContractV1(manifest) {
6622
6929
  ...presentation.uriModule === void 0 ? {} : {
6623
6930
  uriModule: resolveGlobalContributionId(namespace, presentation.uriModule)
6624
6931
  },
6625
- ...presentationSource(manifest, presentation),
6932
+ ...presentationSource(namespace, manifest, presentation),
6626
6933
  ...presentation.addresses === void 0 ? {} : { addresses: presentation.addresses },
6627
6934
  ...presentation.open === void 0 || presentation.resourceKind === void 0 ? {} : {
6628
6935
  resourceKind: presentation.resourceKind,
6629
6936
  open: presentation.open
6630
6937
  },
6631
6938
  ...presentation.words === void 0 ? {} : { words: { ...presentation.words } },
6939
+ ...presentation.accountLinks === void 0 ? {} : { accountLinks: presentation.accountLinks },
6632
6940
  ...presentation.tooltip === void 0 ? {} : {
6633
6941
  tooltip: {
6634
6942
  app: resolveGlobalContributionId(namespace, presentation.tooltip.app),
@@ -6689,6 +6997,7 @@ function resolveKayPluginContractV1(manifest) {
6689
6997
  ...kayAgentGitHostClaims.length > 0 ? { kayAgentGitHostClaims } : {},
6690
6998
  ...kayAgentTools && kayAgentTools.length > 0 ? { kayAgentTools } : {},
6691
6999
  ...kayAppTools && kayAppTools.length > 0 ? { kayAppTools } : {},
7000
+ ...kayAppCards && kayAppCards.length > 0 ? { kayAppCards } : {},
6692
7001
  ...kayAppApprovalTypes && kayAppApprovalTypes.length > 0 ? { kayAppApprovalTypes } : {},
6693
7002
  ...kayAppWorkflows && kayAppWorkflows.length > 0 ? { kayAppWorkflows } : {},
6694
7003
  ...kayAppDataSources && kayAppDataSources.length > 0 ? { kayAppDataSources } : {},
@@ -6712,19 +7021,23 @@ function safeResolveKayPluginContractV1(manifest) {
6712
7021
  throw error;
6713
7022
  }
6714
7023
  }
6715
- function presentationSource(manifest, presentation) {
7024
+ function presentationSource(namespace, manifest, presentation) {
6716
7025
  const contributes = manifest.targets?.kay;
6717
7026
  const module = [
6718
7027
  ...contributes?.agent?.contributes?.uriModules ?? [],
6719
7028
  ...contributes?.app?.contributes?.uriModules ?? []
6720
7029
  ].find((candidate) => candidate.localId === presentation.uriModule);
6721
7030
  const schemes = presentation.scheme === void 0 ? module?.schemes : [presentation.scheme];
7031
+ const authService = module !== void 0 && "authService" in module ? module.authService : void 0;
6722
7032
  return {
6723
7033
  ...schemes === void 0 ? {} : { schemes: [...schemes] },
6724
- ...module?.displayName === void 0 ? {} : { displayName: module.displayName }
7034
+ ...module?.displayName === void 0 ? {} : { displayName: module.displayName },
7035
+ ...typeof authService === "string" ? {
7036
+ authService: isQualifiedAuthServiceRef(authService) ? authService : resolveGlobalContributionId(namespace, authService)
7037
+ } : {}
6725
7038
  };
6726
7039
  }
6727
- function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, authScheme: _authScheme, knownResources: _knownResources, describesOperations: _describesOperations, ...facts }) {
7040
+ function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, authScheme: _authScheme, knownResources: _knownResources, describesOperations: _describesOperations, looksUpWebLinks: _looksUpWebLinks, ...facts }) {
6728
7041
  return facts;
6729
7042
  }
6730
7043
 
@@ -7616,6 +7929,7 @@ export {
7616
7929
  PluginCapabilityRefusalCode,
7617
7930
  PluginCapabilityRefusalLayer,
7618
7931
  PluginCapabilityRefusalV1,
7932
+ PluginCardContribution,
7619
7933
  PluginCompatibilityManifest,
7620
7934
  PluginConfigManifest,
7621
7935
  PluginConfigScope,
@@ -7657,6 +7971,7 @@ export {
7657
7971
  RETIRED_PLUGIN_CAPABILITY_SLUGS,
7658
7972
  RETIRED_WEB_SESSION_ROW_KEYS,
7659
7973
  ReferenceOpenBehavior,
7974
+ ReferencePresentationAccountLinks,
7660
7975
  ReferencePresentationAddress,
7661
7976
  ReferencePresentationContribution,
7662
7977
  ReferencePresentationTooltip,
@@ -7684,6 +7999,7 @@ export {
7684
7999
  ResolvedKayUiAppEndpointCapability,
7685
8000
  ResolvedPluginAuthScheme,
7686
8001
  ResolvedPluginAuthService,
8002
+ ResolvedPluginCard,
7687
8003
  ResolvedPluginContractV1,
7688
8004
  ResolvedPluginContributionId,
7689
8005
  ResolvedPluginGrants,
@@ -7734,6 +8050,7 @@ export {
7734
8050
  UriModuleContribution,
7735
8051
  UriScheme,
7736
8052
  WEB_SESSION_CSRF_SELECTOR_PATTERN,
8053
+ WHERE_MAX_BYTES,
7737
8054
  WebSessionCsrfSelector,
7738
8055
  WebSessionGrantRequest,
7739
8056
  WhiteboardCapabilityClaimV1,
@@ -7761,25 +8078,30 @@ export {
7761
8078
  configSectionKeysForManifest,
7762
8079
  declarationsOfKind,
7763
8080
  declaredCommandId,
8081
+ declaredLocalAppSchemes,
7764
8082
  declaredReferencePresentations,
7765
8083
  declaredUiIconPaths,
7766
8084
  dedupeClaims,
7767
8085
  deriveDirectoryPluginToolName,
7768
8086
  evaluateCommandWhere,
7769
8087
  evaluateWhere,
8088
+ eventWhereProblem,
7770
8089
  finalizeArtifactProvenanceEnvelope,
7771
8090
  findSkillSuggestionCitations,
8091
+ formatWhereLiteral,
7772
8092
  hasClaim,
7773
8093
  hostWithinDomain,
7774
8094
  isCanonicalArtifactOutputUri,
7775
8095
  isCompatible,
7776
8096
  isCredentialShapedText,
8097
+ isDeclaredLocalAppLink,
7777
8098
  isKayPluginCompatibilityRefusal,
7778
8099
  isPluginProductEventName,
7779
8100
  isPrivateCapabilityClaim,
7780
8101
  isQualifiedAuthSchemeRef,
7781
8102
  isQualifiedAuthServiceRef,
7782
8103
  isSupportedSemverRange,
8104
+ isUiAppSourceModule,
7783
8105
  judgeKayPluginDirectory,
7784
8106
  kayPluginCompatibilityAdvisories,
7785
8107
  kayPluginHostCompatibility,
@@ -7820,8 +8142,13 @@ export {
7820
8142
  skillSuggestionEvidenceKey,
7821
8143
  turnMessageOrigin,
7822
8144
  turnPacket,
8145
+ uiAppSourceStylePath,
7823
8146
  urlHostWithinDomain,
7824
8147
  validateKayUiEventSubscription,
7825
8148
  webSessionPathWithinPrefix,
8149
+ whereClausesAsExpression,
8150
+ whereKeyUses,
8151
+ whereNotAStringMessage,
8152
+ whereProblem,
7826
8153
  whiteboardCapabilityClaim
7827
8154
  };