@yaklabs-ai/plugin-protocol 0.45.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/README.md CHANGED
@@ -11,7 +11,7 @@ flow.
11
11
  ```json
12
12
  {
13
13
  "dependencies": {
14
- "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.45.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.46.0"
15
15
  }
16
16
  }
17
17
  ```
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@yaklabs-ai/plugin-protocol",
4
- "version": "0.45.0",
4
+ "version": "0.46.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -1642,6 +1642,8 @@ declare namespace authoringCommonSchemas {
1642
1642
 
1643
1643
  declare namespace authoringContributionSchemas {
1644
1644
  export {
1645
+ isUiAppSourceModule,
1646
+ uiAppSourceStylePath,
1645
1647
  MCP_SIGN_IN_SCHEME_KIND,
1646
1648
  PLUGIN_NOTIFICATION_RULE_HOST_KEYS,
1647
1649
  ApprovalCardForm,
@@ -1694,6 +1696,7 @@ declare namespace authoringContributionSchemas {
1694
1696
  ReferencePresentationUrlClaim,
1695
1697
  ReferencePresentationTooltip,
1696
1698
  ReferencePresentationAddress,
1699
+ ReferencePresentationAccountLinks,
1697
1700
  ReferencePresentationWords,
1698
1701
  ReferencePresentationContribution,
1699
1702
  RichViewContribution,
@@ -2095,6 +2098,7 @@ declare const canonicalContributionSchemas: {
2095
2098
  authScheme: z.ZodOptional<z.ZodString>;
2096
2099
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
2097
2100
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
2101
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
2098
2102
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2099
2103
  kind: z.ZodLiteral<"scheme">;
2100
2104
  scheme: z.ZodString;
@@ -2608,7 +2612,7 @@ declare const canonicalContributionSchemas: {
2608
2612
  PluginNotificationRuleContribution: z.ZodObject<{
2609
2613
  localId: z.ZodString;
2610
2614
  event: z.ZodString;
2611
- where: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>>;
2615
+ where: z.ZodOptional<z.ZodString>;
2612
2616
  rule: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
2613
2617
  }, z.core.$strict>;
2614
2618
  PluginProductEventContribution: z.ZodUnion<readonly [z.ZodObject<{
@@ -2675,6 +2679,9 @@ declare const canonicalContributionSchemas: {
2675
2679
  }, z.core.$strict>, z.ZodObject<{
2676
2680
  kind: z.ZodLiteral<"page">;
2677
2681
  pageId: z.ZodString;
2682
+ }, z.core.$strict>, z.ZodObject<{
2683
+ kind: z.ZodLiteral<"local-app">;
2684
+ schemes: z.ZodArray<z.ZodString>;
2678
2685
  }, z.core.$strict>], "kind">;
2679
2686
  ReferencePresentationVariant: z.ZodObject<{
2680
2687
  resourceKind: z.ZodString;
@@ -2724,6 +2731,28 @@ declare const canonicalContributionSchemas: {
2724
2731
  kind: z.ZodLiteral<"none">;
2725
2732
  }, z.core.$strict>>;
2726
2733
  }, z.core.$strict>;
2734
+ ReferencePresentationAccountLinks: z.ZodObject<{
2735
+ label: z.ZodOptional<z.ZodEnum<{
2736
+ email: "email";
2737
+ name: "name";
2738
+ }>>;
2739
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
2740
+ hostname: z.ZodString;
2741
+ pathname: z.ZodOptional<z.ZodString>;
2742
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
2743
+ setPathname: z.ZodOptional<z.ZodString>;
2744
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
2745
+ }, z.core.$strict>>>;
2746
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
2747
+ pattern: z.ZodObject<{
2748
+ protocol: z.ZodString;
2749
+ hostname: z.ZodString;
2750
+ pathname: z.ZodOptional<z.ZodString>;
2751
+ search: z.ZodOptional<z.ZodString>;
2752
+ }, z.core.$strict>;
2753
+ url: z.ZodString;
2754
+ }, z.core.$strict>>>;
2755
+ }, z.core.$strict>;
2727
2756
  ReferencePresentationWords: z.ZodObject<{
2728
2757
  glyph: z.ZodOptional<z.ZodEnum<{
2729
2758
  file: "file";
@@ -2788,6 +2817,9 @@ declare const canonicalContributionSchemas: {
2788
2817
  }, z.core.$strict>, z.ZodObject<{
2789
2818
  kind: z.ZodLiteral<"page">;
2790
2819
  pageId: z.ZodString;
2820
+ }, z.core.$strict>, z.ZodObject<{
2821
+ kind: z.ZodLiteral<"local-app">;
2822
+ schemes: z.ZodArray<z.ZodString>;
2791
2823
  }, z.core.$strict>], "kind">>;
2792
2824
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2793
2825
  resourceKind: z.ZodString;
@@ -2855,6 +2887,28 @@ declare const canonicalContributionSchemas: {
2855
2887
  target: z.ZodOptional<z.ZodString>;
2856
2888
  kindNamesSource: z.ZodOptional<z.ZodLiteral<true>>;
2857
2889
  }, z.core.$strict>>;
2890
+ accountLinks: z.ZodOptional<z.ZodObject<{
2891
+ label: z.ZodOptional<z.ZodEnum<{
2892
+ email: "email";
2893
+ name: "name";
2894
+ }>>;
2895
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
2896
+ hostname: z.ZodString;
2897
+ pathname: z.ZodOptional<z.ZodString>;
2898
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
2899
+ setPathname: z.ZodOptional<z.ZodString>;
2900
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
2901
+ }, z.core.$strict>>>;
2902
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
2903
+ pattern: z.ZodObject<{
2904
+ protocol: z.ZodString;
2905
+ hostname: z.ZodString;
2906
+ pathname: z.ZodOptional<z.ZodString>;
2907
+ search: z.ZodOptional<z.ZodString>;
2908
+ }, z.core.$strict>;
2909
+ url: z.ZodString;
2910
+ }, z.core.$strict>>>;
2911
+ }, z.core.$strict>>;
2858
2912
  }, z.core.$strict>;
2859
2913
  RichViewContribution: z.ZodObject<{
2860
2914
  localId: z.ZodString;
@@ -3353,6 +3407,11 @@ export declare interface DeclaredKayPluginCompatibility {
3353
3407
  readonly sdk?: string | undefined;
3354
3408
  }
3355
3409
 
3410
+ /** The address schemes whose items an app on this machine opens, rather than a page on the web. */
3411
+ export declare function declaredLocalAppSchemes<TPlugin extends {
3412
+ readonly contributes: Readonly<Record<string, unknown>>;
3413
+ }>(plugins: readonly TPlugin[]): ReadonlySet<string>;
3414
+
3356
3415
  /**
3357
3416
  * Every plugin's reference presentations. The daemon delivers this one kind from the resolved
3358
3417
  * contract rather than the manifest, so its rows carry `schemes`.
@@ -3478,6 +3537,12 @@ export declare const EventGrantRequest: z.ZodObject<{
3478
3537
 
3479
3538
  export declare type EventGrantRequest = z.infer<typeof EventGrantRequest>;
3480
3539
 
3540
+ /**
3541
+ * {@link whereProblem}, for a `where` a plugin event is matched against: every key must also be a
3542
+ * safe path, at most 10 identifier segments and 256 bytes.
3543
+ */
3544
+ export declare function eventWhereProblem(value: unknown): string | undefined;
3545
+
3481
3546
  export declare const FileExtensionToken: z.ZodString;
3482
3547
 
3483
3548
  export declare type FileExtensionToken = z.infer<typeof FileExtensionToken>;
@@ -3499,6 +3564,9 @@ export declare function finalizeArtifactProvenanceEnvelope(capture: ArtifactProv
3499
3564
 
3500
3565
  export declare function findSkillSuggestionCitations(text: string, options?: SkillSuggestionEvidenceOptions): readonly SkillSuggestionCitation[];
3501
3566
 
3567
+ /** One literal as an expression writes it: single-quoted strings, JSON-form numbers. */
3568
+ export declare function formatWhereLiteral(value: WhereLiteral): string;
3569
+
3502
3570
  export declare const GitBasicAuthUser: z.ZodString;
3503
3571
 
3504
3572
  export declare type GitBasicAuthUser = z.infer<typeof GitBasicAuthUser>;
@@ -3570,6 +3638,11 @@ export declare function isCompatible(report: KayPluginCompatibilityReport): bool
3570
3638
  */
3571
3639
  export declare function isCredentialShapedText(value: unknown): boolean;
3572
3640
 
3641
+ /** Whether `url` uses a link scheme a loaded plugin declared for an app on this machine. */
3642
+ export declare function isDeclaredLocalAppLink<TPlugin extends {
3643
+ readonly contributes: Readonly<Record<string, unknown>>;
3644
+ }>(url: string, plugins: readonly TPlugin[]): boolean;
3645
+
3573
3646
  /**
3574
3647
  * Whether a refusal `code` came from the compatibility check: the plugin was written for another
3575
3648
  * SDK or protocol, as opposed to being malformed.
@@ -3601,6 +3674,12 @@ export declare function isQualifiedAuthServiceRef(ref: string): boolean;
3601
3674
  /** Whether a range is one {@link satisfiesSemverRange} can answer for at all. */
3602
3675
  export declare function isSupportedSemverRange(range: string): boolean;
3603
3676
 
3677
+ /**
3678
+ * An app entry naming source rather than built JavaScript. Bonsai compiles it when it loads the
3679
+ * plugin, so a plugin in `~/.kay/plugins` needs no build tool for a page.
3680
+ */
3681
+ export declare function isUiAppSourceModule(module: string): boolean;
3682
+
3604
3683
  export declare const JsonObject: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
3605
3684
 
3606
3685
  export declare type JsonObject = z.infer<typeof JsonObject>;
@@ -4327,9 +4406,19 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4327
4406
  * 0.44.0 adds `words.kinds` to a reference presentation (#15905): an ordered list of address patterns
4328
4407
  * and the kind each one names. Additive: a plugin that lists them declares ^0.44.0.
4329
4408
  *
4330
- * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints.
4409
+ * 0.45.0 adds declared plugin cards and app.implementCard for their read/submit endpoints. It also
4410
+ * lets a plugin declare what the window hardcoded about it (#15906). A reference presentation gains
4411
+ * `accountLinks`, how a page opens under the account an address means, and a `local-app` open, for
4412
+ * an item an app on this machine shows; a plugin the person installed can't declare that open. A
4413
+ * `webSession` gains `signInFirst`. A URI module defines `lookupWebLink` and sets `looksUpWebLinks`
4414
+ * to find a page when someone opens the address, and a preview field marks which `part` of a message
4415
+ * it is. A claim's `brandIcon` is a file path and no longer inline markup, which only this repo's
4416
+ * Microsoft plugin used. Otherwise additive: a plugin using any of these declares ^0.45.0.
4417
+ *
4418
+ * 0.46.0 adds `@bonsai/plugin-sdk/artifact-provenance`, so a plugin shipped as files can finalize
4419
+ * and read the provenance the host captured. Additive: a plugin that imports it declares ^0.46.0.
4331
4420
  */
4332
- export declare const KAY_PLUGIN_SDK_VERSION: "0.45.0";
4421
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.46.0";
4333
4422
 
4334
4423
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4335
4424
 
@@ -4392,6 +4481,7 @@ export declare const KayAgentTargetManifest: z.ZodObject<{
4392
4481
  authScheme: z.ZodOptional<z.ZodString>;
4393
4482
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
4394
4483
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
4484
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
4395
4485
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
4396
4486
  kind: z.ZodLiteral<"scheme">;
4397
4487
  scheme: z.ZodString;
@@ -4973,7 +5063,7 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4973
5063
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
4974
5064
  localId: z.ZodString;
4975
5065
  event: z.ZodString;
4976
- where: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>>;
5066
+ where: z.ZodOptional<z.ZodString>;
4977
5067
  rule: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
4978
5068
  }, z.core.$strict>>>;
4979
5069
  productEvents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -5196,6 +5286,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5196
5286
  authScheme: z.ZodOptional<z.ZodString>;
5197
5287
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
5198
5288
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
5289
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
5199
5290
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
5200
5291
  kind: z.ZodLiteral<"scheme">;
5201
5292
  scheme: z.ZodString;
@@ -5774,7 +5865,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5774
5865
  notificationRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5775
5866
  localId: z.ZodString;
5776
5867
  event: z.ZodString;
5777
- where: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>>;
5868
+ where: z.ZodOptional<z.ZodString>;
5778
5869
  rule: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
5779
5870
  }, z.core.$strict>>>;
5780
5871
  productEvents: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
@@ -5899,6 +5990,9 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5899
5990
  }, z.core.$strict>, z.ZodObject<{
5900
5991
  kind: z.ZodLiteral<"page">;
5901
5992
  pageId: z.ZodString;
5993
+ }, z.core.$strict>, z.ZodObject<{
5994
+ kind: z.ZodLiteral<"local-app">;
5995
+ schemes: z.ZodArray<z.ZodString>;
5902
5996
  }, z.core.$strict>], "kind">>;
5903
5997
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
5904
5998
  resourceKind: z.ZodString;
@@ -5966,6 +6060,28 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5966
6060
  target: z.ZodOptional<z.ZodString>;
5967
6061
  kindNamesSource: z.ZodOptional<z.ZodLiteral<true>>;
5968
6062
  }, z.core.$strict>>;
6063
+ accountLinks: z.ZodOptional<z.ZodObject<{
6064
+ label: z.ZodOptional<z.ZodEnum<{
6065
+ email: "email";
6066
+ name: "name";
6067
+ }>>;
6068
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
6069
+ hostname: z.ZodString;
6070
+ pathname: z.ZodOptional<z.ZodString>;
6071
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
6072
+ setPathname: z.ZodOptional<z.ZodString>;
6073
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
6074
+ }, z.core.$strict>>>;
6075
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
6076
+ pattern: z.ZodObject<{
6077
+ protocol: z.ZodString;
6078
+ hostname: z.ZodString;
6079
+ pathname: z.ZodOptional<z.ZodString>;
6080
+ search: z.ZodOptional<z.ZodString>;
6081
+ }, z.core.$strict>;
6082
+ url: z.ZodString;
6083
+ }, z.core.$strict>>>;
6084
+ }, z.core.$strict>>;
5969
6085
  }, z.core.$strict>>>;
5970
6086
  views: z.ZodOptional<z.ZodArray<z.ZodObject<{
5971
6087
  localId: z.ZodString;
@@ -6274,6 +6390,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
6274
6390
  external: "external";
6275
6391
  embedded: "embedded";
6276
6392
  }>;
6393
+ signInFirst: z.ZodOptional<z.ZodString>;
6277
6394
  }, z.core.$strict>>;
6278
6395
  }, z.core.$strict>>>;
6279
6396
  }, z.core.$strict>>;
@@ -7065,6 +7182,9 @@ export declare const KayUiTargetManifest: z.ZodObject<{
7065
7182
  }, z.core.$strict>, z.ZodObject<{
7066
7183
  kind: z.ZodLiteral<"page">;
7067
7184
  pageId: z.ZodString;
7185
+ }, z.core.$strict>, z.ZodObject<{
7186
+ kind: z.ZodLiteral<"local-app">;
7187
+ schemes: z.ZodArray<z.ZodString>;
7068
7188
  }, z.core.$strict>], "kind">>;
7069
7189
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
7070
7190
  resourceKind: z.ZodString;
@@ -7132,6 +7252,28 @@ export declare const KayUiTargetManifest: z.ZodObject<{
7132
7252
  target: z.ZodOptional<z.ZodString>;
7133
7253
  kindNamesSource: z.ZodOptional<z.ZodLiteral<true>>;
7134
7254
  }, z.core.$strict>>;
7255
+ accountLinks: z.ZodOptional<z.ZodObject<{
7256
+ label: z.ZodOptional<z.ZodEnum<{
7257
+ email: "email";
7258
+ name: "name";
7259
+ }>>;
7260
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
7261
+ hostname: z.ZodString;
7262
+ pathname: z.ZodOptional<z.ZodString>;
7263
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
7264
+ setPathname: z.ZodOptional<z.ZodString>;
7265
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
7266
+ }, z.core.$strict>>>;
7267
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
7268
+ pattern: z.ZodObject<{
7269
+ protocol: z.ZodString;
7270
+ hostname: z.ZodString;
7271
+ pathname: z.ZodOptional<z.ZodString>;
7272
+ search: z.ZodOptional<z.ZodString>;
7273
+ }, z.core.$strict>;
7274
+ url: z.ZodString;
7275
+ }, z.core.$strict>>>;
7276
+ }, z.core.$strict>>;
7135
7277
  }, z.core.$strict>>>;
7136
7278
  views: z.ZodOptional<z.ZodArray<z.ZodObject<{
7137
7279
  localId: z.ZodString;
@@ -7443,9 +7585,12 @@ export declare function parseResolvedPluginContractV1(value: unknown): ResolvedP
7443
7585
  export declare function parseSemver(value: string): ParsedSemver | undefined;
7444
7586
 
7445
7587
  /**
7446
- * Parses a `where` expression: `||`, `&&`, `!`, parentheses, `==`, `!=`, strings, `true`, `false`
7447
- * and dotted keys, for example `markedForRetirement || proposedRewrite.stale == false`. A bare key
7448
- * means "is set". With `keyTypes`, only those keys parse, and each is checked against its type.
7588
+ * Parses a `where` expression: `||`, `&&`, `!`, parentheses, `==`, `!=`, `contains`, strings,
7589
+ * numbers, `true`, `false` and dotted keys, for example
7590
+ * `markedForRetirement || proposedRewrite.stale == false`. A bare key means "is set". `==` and `!=`
7591
+ * compare a whole value, so a list never equals a scalar; `labels contains 'urgent'` looks inside a
7592
+ * list. With `keyTypes`, only those keys parse, each is checked against its type, and `contains` is
7593
+ * refused, because those keys are scalars.
7449
7594
  */
7450
7595
  export declare function parseWhere(source: string, keyTypes?: WhereKeyTypes): WhereParseResult;
7451
7596
 
@@ -7664,6 +7809,7 @@ export declare const PluginAuthManifest: z.ZodObject<{
7664
7809
  external: "external";
7665
7810
  embedded: "embedded";
7666
7811
  }>;
7812
+ signInFirst: z.ZodOptional<z.ZodString>;
7667
7813
  }, z.core.$strict>>;
7668
7814
  }, z.core.$strict>>>;
7669
7815
  }, z.core.$strict>;
@@ -7955,6 +8101,7 @@ export declare const PluginAuthService: z.ZodObject<{
7955
8101
  external: "external";
7956
8102
  embedded: "embedded";
7957
8103
  }>;
8104
+ signInFirst: z.ZodOptional<z.ZodString>;
7958
8105
  }, z.core.$strict>>;
7959
8106
  }, z.core.$strict>;
7960
8107
 
@@ -10053,7 +10200,7 @@ export declare type PluginNamespace = z.infer<typeof PluginNamespace>;
10053
10200
  export declare const PluginNotificationRuleContribution: z.ZodObject<{
10054
10201
  localId: z.ZodString;
10055
10202
  event: z.ZodString;
10056
- where: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>>;
10203
+ where: z.ZodOptional<z.ZodString>;
10057
10204
  rule: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
10058
10205
  }, z.core.$strict>;
10059
10206
 
@@ -10880,6 +11027,7 @@ export declare const PluginWebSessionDeclaration: z.ZodObject<{
10880
11027
  external: "external";
10881
11028
  embedded: "embedded";
10882
11029
  }>;
11030
+ signInFirst: z.ZodOptional<z.ZodString>;
10883
11031
  }, z.core.$strict>;
10884
11032
 
10885
11033
  export declare type PluginWebSessionDeclaration = z.infer<typeof PluginWebSessionDeclaration>;
@@ -10930,10 +11078,38 @@ export declare const ReferenceOpenBehavior: z.ZodDiscriminatedUnion<[z.ZodObject
10930
11078
  }, z.core.$strict>, z.ZodObject<{
10931
11079
  kind: z.ZodLiteral<"page">;
10932
11080
  pageId: z.ZodString;
11081
+ }, z.core.$strict>, z.ZodObject<{
11082
+ kind: z.ZodLiteral<"local-app">;
11083
+ schemes: z.ZodArray<z.ZodString>;
10933
11084
  }, z.core.$strict>], "kind">;
10934
11085
 
10935
11086
  export declare type ReferenceOpenBehavior = z.infer<typeof ReferenceOpenBehavior>;
10936
11087
 
11088
+ export declare const ReferencePresentationAccountLinks: z.ZodObject<{
11089
+ label: z.ZodOptional<z.ZodEnum<{
11090
+ email: "email";
11091
+ name: "name";
11092
+ }>>;
11093
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
11094
+ hostname: z.ZodString;
11095
+ pathname: z.ZodOptional<z.ZodString>;
11096
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
11097
+ setPathname: z.ZodOptional<z.ZodString>;
11098
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
11099
+ }, z.core.$strict>>>;
11100
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
11101
+ pattern: z.ZodObject<{
11102
+ protocol: z.ZodString;
11103
+ hostname: z.ZodString;
11104
+ pathname: z.ZodOptional<z.ZodString>;
11105
+ search: z.ZodOptional<z.ZodString>;
11106
+ }, z.core.$strict>;
11107
+ url: z.ZodString;
11108
+ }, z.core.$strict>>>;
11109
+ }, z.core.$strict>;
11110
+
11111
+ export declare type ReferencePresentationAccountLinks = z.infer<typeof ReferencePresentationAccountLinks>;
11112
+
10937
11113
  export declare const ReferencePresentationAddress: z.ZodObject<{
10938
11114
  pattern: z.ZodObject<{
10939
11115
  protocol: z.ZodString;
@@ -10973,6 +11149,9 @@ export declare const ReferencePresentationContribution: z.ZodObject<{
10973
11149
  }, z.core.$strict>, z.ZodObject<{
10974
11150
  kind: z.ZodLiteral<"page">;
10975
11151
  pageId: z.ZodString;
11152
+ }, z.core.$strict>, z.ZodObject<{
11153
+ kind: z.ZodLiteral<"local-app">;
11154
+ schemes: z.ZodArray<z.ZodString>;
10976
11155
  }, z.core.$strict>], "kind">>;
10977
11156
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
10978
11157
  resourceKind: z.ZodString;
@@ -11040,6 +11219,28 @@ export declare const ReferencePresentationContribution: z.ZodObject<{
11040
11219
  target: z.ZodOptional<z.ZodString>;
11041
11220
  kindNamesSource: z.ZodOptional<z.ZodLiteral<true>>;
11042
11221
  }, z.core.$strict>>;
11222
+ accountLinks: z.ZodOptional<z.ZodObject<{
11223
+ label: z.ZodOptional<z.ZodEnum<{
11224
+ email: "email";
11225
+ name: "name";
11226
+ }>>;
11227
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
11228
+ hostname: z.ZodString;
11229
+ pathname: z.ZodOptional<z.ZodString>;
11230
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
11231
+ setPathname: z.ZodOptional<z.ZodString>;
11232
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
11233
+ }, z.core.$strict>>>;
11234
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
11235
+ pattern: z.ZodObject<{
11236
+ protocol: z.ZodString;
11237
+ hostname: z.ZodString;
11238
+ pathname: z.ZodOptional<z.ZodString>;
11239
+ search: z.ZodOptional<z.ZodString>;
11240
+ }, z.core.$strict>;
11241
+ url: z.ZodString;
11242
+ }, z.core.$strict>>>;
11243
+ }, z.core.$strict>>;
11043
11244
  }, z.core.$strict>;
11044
11245
 
11045
11246
  export declare type ReferencePresentationContribution = z.infer<typeof ReferencePresentationContribution>;
@@ -11155,6 +11356,7 @@ export declare function refineWebSessionScopeConfined(webSession: {
11155
11356
  readonly probe: {
11156
11357
  readonly url: string;
11157
11358
  };
11359
+ readonly signInFirst?: string | undefined;
11158
11360
  }, ctx: z.RefinementCtx): void;
11159
11361
 
11160
11362
  export declare const RegistrableDomain: z.ZodString;
@@ -11510,6 +11712,7 @@ export declare const ResolvedKayAgentUriModule: z.ZodObject<{
11510
11712
  authSchemeId: z.ZodOptional<z.ZodString>;
11511
11713
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
11512
11714
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
11715
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
11513
11716
  }, z.core.$strict>;
11514
11717
 
11515
11718
  export declare type ResolvedKayAgentUriModule = z.infer<typeof ResolvedKayAgentUriModule>;
@@ -12047,6 +12250,7 @@ export declare const ResolvedPluginAuthService: z.ZodObject<{
12047
12250
  external: "external";
12048
12251
  embedded: "embedded";
12049
12252
  }>;
12253
+ signInFirst: z.ZodOptional<z.ZodString>;
12050
12254
  }, z.core.$strict>>;
12051
12255
  }, z.core.$strict>;
12052
12256
 
@@ -12286,6 +12490,7 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12286
12490
  external: "external";
12287
12491
  embedded: "embedded";
12288
12492
  }>;
12493
+ signInFirst: z.ZodOptional<z.ZodString>;
12289
12494
  }, z.core.$strict>>;
12290
12495
  }, z.core.$strict>>;
12291
12496
  grants: z.ZodOptional<z.ZodObject<{
@@ -12745,6 +12950,7 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12745
12950
  authSchemeId: z.ZodOptional<z.ZodString>;
12746
12951
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
12747
12952
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
12953
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
12748
12954
  }, z.core.$strict>>>;
12749
12955
  kayAgentArtifactUriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
12750
12956
  localId: z.ZodString;
@@ -12996,6 +13202,29 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12996
13202
  uriModule: z.ZodOptional<z.ZodString>;
12997
13203
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
12998
13204
  displayName: z.ZodOptional<z.ZodString>;
13205
+ authService: z.ZodOptional<z.ZodString>;
13206
+ accountLinks: z.ZodOptional<z.ZodObject<{
13207
+ label: z.ZodOptional<z.ZodEnum<{
13208
+ email: "email";
13209
+ name: "name";
13210
+ }>>;
13211
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
13212
+ hostname: z.ZodString;
13213
+ pathname: z.ZodOptional<z.ZodString>;
13214
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
13215
+ setPathname: z.ZodOptional<z.ZodString>;
13216
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
13217
+ }, z.core.$strict>>>;
13218
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
13219
+ pattern: z.ZodObject<{
13220
+ protocol: z.ZodString;
13221
+ hostname: z.ZodString;
13222
+ pathname: z.ZodOptional<z.ZodString>;
13223
+ search: z.ZodOptional<z.ZodString>;
13224
+ }, z.core.$strict>;
13225
+ url: z.ZodString;
13226
+ }, z.core.$strict>>>;
13227
+ }, z.core.$strict>>;
12999
13228
  addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
13000
13229
  pattern: z.ZodObject<{
13001
13230
  protocol: z.ZodString;
@@ -13016,6 +13245,9 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
13016
13245
  }, z.core.$strict>, z.ZodObject<{
13017
13246
  kind: z.ZodLiteral<"page">;
13018
13247
  pageId: z.ZodString;
13248
+ }, z.core.$strict>, z.ZodObject<{
13249
+ kind: z.ZodLiteral<"local-app">;
13250
+ schemes: z.ZodArray<z.ZodString>;
13019
13251
  }, z.core.$strict>], "kind">>;
13020
13252
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
13021
13253
  resourceKind: z.ZodString;
@@ -13506,6 +13738,7 @@ export declare const ResolvedPluginWebSession: z.ZodObject<{
13506
13738
  external: "external";
13507
13739
  embedded: "embedded";
13508
13740
  }>;
13741
+ signInFirst: z.ZodOptional<z.ZodString>;
13509
13742
  }, z.core.$strict>;
13510
13743
 
13511
13744
  export declare type ResolvedPluginWebSession = z.infer<typeof ResolvedPluginWebSession>;
@@ -13516,6 +13749,29 @@ export declare const ResolvedReferencePresentation: z.ZodObject<{
13516
13749
  uriModule: z.ZodOptional<z.ZodString>;
13517
13750
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
13518
13751
  displayName: z.ZodOptional<z.ZodString>;
13752
+ authService: z.ZodOptional<z.ZodString>;
13753
+ accountLinks: z.ZodOptional<z.ZodObject<{
13754
+ label: z.ZodOptional<z.ZodEnum<{
13755
+ email: "email";
13756
+ name: "name";
13757
+ }>>;
13758
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
13759
+ hostname: z.ZodString;
13760
+ pathname: z.ZodOptional<z.ZodString>;
13761
+ unlessPathname: z.ZodOptional<z.ZodArray<z.ZodString>>;
13762
+ setPathname: z.ZodOptional<z.ZodString>;
13763
+ addQuery: z.ZodRecord<z.ZodString, z.ZodString>;
13764
+ }, z.core.$strict>>>;
13765
+ addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
13766
+ pattern: z.ZodObject<{
13767
+ protocol: z.ZodString;
13768
+ hostname: z.ZodString;
13769
+ pathname: z.ZodOptional<z.ZodString>;
13770
+ search: z.ZodOptional<z.ZodString>;
13771
+ }, z.core.$strict>;
13772
+ url: z.ZodString;
13773
+ }, z.core.$strict>>>;
13774
+ }, z.core.$strict>>;
13519
13775
  addresses: z.ZodOptional<z.ZodArray<z.ZodObject<{
13520
13776
  pattern: z.ZodObject<{
13521
13777
  protocol: z.ZodString;
@@ -13536,6 +13792,9 @@ export declare const ResolvedReferencePresentation: z.ZodObject<{
13536
13792
  }, z.core.$strict>, z.ZodObject<{
13537
13793
  kind: z.ZodLiteral<"page">;
13538
13794
  pageId: z.ZodString;
13795
+ }, z.core.$strict>, z.ZodObject<{
13796
+ kind: z.ZodLiteral<"local-app">;
13797
+ schemes: z.ZodArray<z.ZodString>;
13539
13798
  }, z.core.$strict>], "kind">>;
13540
13799
  variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
13541
13800
  resourceKind: z.ZodString;
@@ -14849,6 +15108,9 @@ export declare const UiAppContribution: z.ZodObject<{
14849
15108
 
14850
15109
  export declare type UiAppContribution = z.infer<typeof UiAppContribution>;
14851
15110
 
15111
+ /** Where a source entry's compiled stylesheet sits in its package, beside the entry. */
15112
+ export declare function uiAppSourceStylePath(module: string): string;
15113
+
14852
15114
  export declare const UiCommandContribution: z.ZodObject<{
14853
15115
  localId: z.ZodString;
14854
15116
  title: z.ZodString;
@@ -14931,6 +15193,7 @@ export declare const UriModuleContribution: z.ZodObject<{
14931
15193
  authScheme: z.ZodOptional<z.ZodString>;
14932
15194
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
14933
15195
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
15196
+ looksUpWebLinks: z.ZodOptional<z.ZodLiteral<true>>;
14934
15197
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
14935
15198
  kind: z.ZodLiteral<"scheme">;
14936
15199
  scheme: z.ZodString;
@@ -15324,8 +15587,12 @@ export declare type Where = {
15324
15587
  } | {
15325
15588
  readonly kind: "equals";
15326
15589
  readonly key: string;
15327
- readonly value: boolean | string;
15590
+ readonly value: WhereLiteral;
15328
15591
  readonly negated: boolean;
15592
+ } | {
15593
+ readonly kind: "contains";
15594
+ readonly key: string;
15595
+ readonly value: WhereLiteral;
15329
15596
  } | {
15330
15597
  readonly kind: "not";
15331
15598
  readonly operand: Where;
@@ -15341,9 +15608,33 @@ declare const WHERE_KEY_TYPES: {
15341
15608
  readonly "app.channel": "string";
15342
15609
  };
15343
15610
 
15611
+ /** The longest `where`: the largest a rule file can be, so anything that loaded still loads. */
15612
+ export declare const WHERE_MAX_BYTES: number;
15613
+
15614
+ /**
15615
+ * The old list form of `where`, written as an expression: each clause is
15616
+ * `path == value`, or `(path == value || path contains value)` where `looksInsideLists` says so, and
15617
+ * all must hold. A path spelled `true`, `false` or as a number never resolved to anything, so its
15618
+ * clause is `false`. Undefined when the list isn't a non-empty list of `{ path, equals }`.
15619
+ */
15620
+ export declare function whereClausesAsExpression(clauses: unknown, looksInsideLists?: (path: string) => boolean): string | undefined;
15621
+
15344
15622
  /** What a caller's keys are, when it has a fixed set. A bare string key must be compared. */
15345
15623
  export declare type WhereKeyTypes = Readonly<Record<string, "boolean" | "string">>;
15346
15624
 
15625
+ export declare type WhereKeyUse = "bare" | "compared" | "contained";
15626
+
15627
+ /** Every key an expression reads, each with how that read uses it. */
15628
+ export declare function whereKeyUses(where: Where): readonly {
15629
+ readonly key: string;
15630
+ readonly use: WhereKeyUse;
15631
+ }[];
15632
+
15633
+ export declare type WhereLiteral = boolean | number | string;
15634
+
15635
+ /** Why a value that isn't a string can't be a `where`, showing an old list in its new form. */
15636
+ export declare function whereNotAStringMessage(value: unknown): string;
15637
+
15347
15638
  export declare type WhereParseResult = {
15348
15639
  readonly ok: true;
15349
15640
  readonly where: Where;
@@ -15352,6 +15643,9 @@ export declare type WhereParseResult = {
15352
15643
  readonly message: string;
15353
15644
  };
15354
15645
 
15646
+ /** Why a value can't be a saved `where`, or undefined when it can. */
15647
+ export declare function whereProblem(value: unknown): string | undefined;
15648
+
15355
15649
  /** Construct the exact claim row for one Whiteboard scope and operation. */
15356
15650
  export declare function whiteboardCapabilityClaim(operation: WhiteboardCapabilityOperation, scope: WhiteboardCapabilityScope, target?: "kay.agent"): WhiteboardCapabilityClaimV1;
15357
15651
 
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,12 +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.45.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
267
  "0.43.0",
262
- "0.44.0"
268
+ "0.44.0",
269
+ "0.45.0"
263
270
  ];
264
271
  var KAY_PLUGIN_TARGET_NAMES = [
265
272
  "kay.agent",
@@ -379,6 +386,13 @@ function refineWebSessionScopeConfined(webSession, ctx) {
379
386
  message: "probe.url host must fall within a declared cookie domain"
380
387
  });
381
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
+ }
382
396
  }
383
397
 
384
398
  // packages/plugin-protocol/dist/app-data-read.js
@@ -2762,6 +2776,7 @@ __export(contributions_exports, {
2762
2776
  PluginProductEventContribution: () => PluginProductEventContribution,
2763
2777
  PluginSkillSourceDeclaration: () => PluginSkillSourceDeclaration,
2764
2778
  ReferenceOpenBehavior: () => ReferenceOpenBehavior,
2779
+ ReferencePresentationAccountLinks: () => ReferencePresentationAccountLinks,
2765
2780
  ReferencePresentationAddress: () => ReferencePresentationAddress,
2766
2781
  ReferencePresentationContribution: () => ReferencePresentationContribution,
2767
2782
  ReferencePresentationTooltip: () => ReferencePresentationTooltip,
@@ -2793,7 +2808,9 @@ __export(contributions_exports, {
2793
2808
  WhiteboardTypeContribution: () => WhiteboardTypeContribution,
2794
2809
  WhiteboardTypeStorage: () => WhiteboardTypeStorage,
2795
2810
  WorkflowContribution: () => WorkflowContribution,
2796
- canonicalContributionSchemas: () => canonicalContributionSchemas
2811
+ canonicalContributionSchemas: () => canonicalContributionSchemas,
2812
+ isUiAppSourceModule: () => isUiAppSourceModule,
2813
+ uiAppSourceStylePath: () => uiAppSourceStylePath
2797
2814
  });
2798
2815
  import { z as z12 } from "zod";
2799
2816
 
@@ -2950,7 +2967,21 @@ function pluginSignalPayloadJsonSchema() {
2950
2967
  }
2951
2968
 
2952
2969
  // packages/plugin-protocol/dist/where-expression.js
2953
- 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;
2954
2985
  function tokenize(source) {
2955
2986
  const tokens = [];
2956
2987
  TOKEN.lastIndex = 0;
@@ -2960,13 +2991,21 @@ function tokenize(source) {
2960
2991
  if (match === null) {
2961
2992
  throw new Error(`unexpected text at '${source.slice(start).trim()}'`);
2962
2993
  }
2963
- 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;
2964
2998
  if (operator !== void 0)
2965
2999
  tokens.push({ kind: "operator", text: operator });
3000
+ else if (number !== void 0)
3001
+ tokens.push({ kind: "number", text: number });
2966
3002
  else if (word !== void 0)
2967
3003
  tokens.push({ kind: "word", text: word });
2968
3004
  else
2969
- tokens.push({ kind: "string", text: single ?? double ?? "" });
3005
+ tokens.push({
3006
+ kind: "string",
3007
+ text: unescapeString(single ?? double ?? "")
3008
+ });
2970
3009
  }
2971
3010
  return tokens;
2972
3011
  }
@@ -3018,6 +3057,14 @@ function parseTokens(tokens, keyTypes) {
3018
3057
  };
3019
3058
  const parseKeyAtom = (key) => {
3020
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
+ }
3021
3068
  const negated = takeOperator("!=");
3022
3069
  if (!negated && !takeOperator("==")) {
3023
3070
  if (keyType === "string") {
@@ -3025,22 +3072,29 @@ function parseTokens(tokens, keyTypes) {
3025
3072
  }
3026
3073
  return { kind: "key", key };
3027
3074
  }
3028
- const value = parseLiteral();
3075
+ const value = parseLiteral("== or !=");
3029
3076
  if (keyType !== void 0 && typeof value !== keyType) {
3030
3077
  throw new Error(`'${key}' compares to a ${keyType}`);
3031
3078
  }
3032
3079
  return { kind: "equals", key, value, negated };
3033
3080
  };
3034
- const parseLiteral = () => {
3081
+ const parseLiteral = (after) => {
3035
3082
  const token = tokens[position];
3036
3083
  position += 1;
3037
3084
  if (token?.kind === "string")
3038
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
+ }
3039
3093
  if (token?.kind === "word" && token.text === "true")
3040
3094
  return true;
3041
3095
  if (token?.kind === "word" && token.text === "false")
3042
3096
  return false;
3043
- throw new Error("expected a string, true or false after == or !=");
3097
+ throw new Error(`expected a string, number, true or false after ${after}`);
3044
3098
  };
3045
3099
  const where = parseOr();
3046
3100
  const extra = tokens[position];
@@ -3055,6 +3109,80 @@ function parseWhere(source, keyTypes) {
3055
3109
  return { ok: false, message: error.message };
3056
3110
  }
3057
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
+ }
3058
3186
  function resolve(where, read) {
3059
3187
  switch (where.kind) {
3060
3188
  case "literal":
@@ -3069,6 +3197,12 @@ function resolve(where, read) {
3069
3197
  return void 0;
3070
3198
  return value === where.value !== where.negated;
3071
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
+ }
3072
3206
  case "not": {
3073
3207
  const operand = resolve(where.operand, read);
3074
3208
  return operand === void 0 ? void 0 : !operand;
@@ -3115,6 +3249,15 @@ function declarationsOfKind(plugins, kind) {
3115
3249
  function declaredReferencePresentations(plugins) {
3116
3250
  return plugins.flatMap((plugin) => (plugin.contributes["referencePresentations"] ?? []).map((declaration) => ({ plugin, declaration })));
3117
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
+ }
3118
3261
  function declaredCommandId(pluginId, localId) {
3119
3262
  return `${pluginId}/${localId}`;
3120
3263
  }
@@ -3425,14 +3568,19 @@ function createContributionsSchemas(canonical) {
3425
3568
  // The module's code defines `describeOperation`, the approval card's facts for a call. The
3426
3569
  // daemon reads it here because it may hold only the manifest (a plugin that runs in the
3427
3570
  // plugin host), and the host refuses a module whose code disagrees.
3428
- 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()
3429
3576
  });
3430
3577
  const AppUriModuleContribution2 = UriModuleContribution2.omit({
3431
3578
  authActions: true,
3432
3579
  authService: true,
3433
3580
  authScheme: true,
3434
3581
  knownResources: true,
3435
- describesOperations: true
3582
+ describesOperations: true,
3583
+ looksUpWebLinks: true
3436
3584
  });
3437
3585
  const AppDataSourceStore = z12.discriminatedUnion("shape", [
3438
3586
  z12.strictObject({
@@ -3754,7 +3902,7 @@ function createContributionsSchemas(canonical) {
3754
3902
  localId: LocalContributionId2,
3755
3903
  /** The same-plugin `eventDefinitions` local id this rule matches. */
3756
3904
  event: PluginEventLocalId2,
3757
- where: z12.array(JsonObject).optional(),
3905
+ where: z12.string({ error: (issue) => whereNotAStringMessage(issue.input) }).optional(),
3758
3906
  rule: JsonObject
3759
3907
  });
3760
3908
  const PluginProductEventContribution2 = z12.union([
@@ -3820,6 +3968,15 @@ function createContributionsSchemas(canonical) {
3820
3968
  localId: LocalContributionId2,
3821
3969
  resultKinds: z12.array(NonEmptyString3).min(1)
3822
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
+ ]);
3823
3980
  const ReferenceOpenBehavior2 = z12.discriminatedUnion("kind", [
3824
3981
  z12.strictObject({ kind: z12.literal("working-document") }),
3825
3982
  z12.strictObject({ kind: z12.literal("browser-pane") }),
@@ -3828,14 +3985,22 @@ function createContributionsSchemas(canonical) {
3828
3985
  * manifest, and the page gets the whole address as its `objectId` unless `addresses` says
3829
3986
  * otherwise. Needs no web address, so a plugin-only resource (`user-todo://items/3`) can pill.
3830
3987
  */
3831
- 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
+ })
3832
3998
  ]);
3833
3999
  const ReferencePresentationVariant2 = z12.strictObject({
3834
4000
  resourceKind: NonEmptyString3,
3835
4001
  presentationPluginId: PluginId2.optional()
3836
4002
  });
3837
4003
  const ReferencePresentationVariants2 = z12.record(MimeTypeString2, ReferencePresentationVariant2);
3838
- 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." });
3839
4004
  const ReferencePresentationUriPattern2 = z12.strictObject({
3840
4005
  protocol: NonEmptyString3,
3841
4006
  hostname: NonEmptyString3,
@@ -3847,7 +4012,8 @@ function createContributionsSchemas(canonical) {
3847
4012
  pattern: ReferencePresentationUriPattern2.extend({
3848
4013
  protocol: z12.enum(["http", "https"])
3849
4014
  }),
3850
- brandIcon: InlineSvg.optional()
4015
+ /** The claim's mark: an SVG file in the plugin, drawn in its own colours. */
4016
+ brandIcon: PackageAssetPath2.optional()
3851
4017
  });
3852
4018
  const ReferencePresentationTooltip2 = z12.strictObject({
3853
4019
  /** Same-plugin kay.ui app mounted with read-only reference URI context. */
@@ -3859,6 +4025,26 @@ function createContributionsSchemas(canonical) {
3859
4025
  objectId: NonEmptyString3.optional(),
3860
4026
  open: z12.strictObject({ kind: z12.literal("none") }).optional()
3861
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
+ });
3862
4048
  const ReferencePresentationWords2 = z12.strictObject({
3863
4049
  /** The row's mark, for a source with no icon of its own. Left out: the plugin's main icon. */
3864
4050
  glyph: z12.enum(TOOL_GLYPHS).optional(),
@@ -3910,7 +4096,9 @@ function createContributionsSchemas(canonical) {
3910
4096
  /** Informational app presentation matched against the canonical resource URI. */
3911
4097
  tooltip: ReferencePresentationTooltip2.optional(),
3912
4098
  /** What the transcript calls this module's addresses. Needs a `uriModule`. */
3913
- 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()
3914
4102
  }).superRefine((value, ctx) => {
3915
4103
  if (value.open === void 0 !== (value.resourceKind === void 0)) {
3916
4104
  ctx.addIssue({
@@ -3919,13 +4107,20 @@ function createContributionsSchemas(canonical) {
3919
4107
  message: "open and resourceKind come together: name both or neither."
3920
4108
  });
3921
4109
  }
3922
- if (value.open === void 0 && value.words === void 0) {
4110
+ if (value.open === void 0 && value.words === void 0 && value.accountLinks === void 0) {
3923
4111
  ctx.addIssue({
3924
4112
  code: "custom",
3925
4113
  path: ["words"],
3926
4114
  message: "A reference presentation that opens nothing must have words."
3927
4115
  });
3928
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
+ }
3929
4124
  if (value.words !== void 0 && value.uriModule === void 0) {
3930
4125
  ctx.addIssue({
3931
4126
  code: "custom",
@@ -4224,6 +4419,7 @@ function createContributionsSchemas(canonical) {
4224
4419
  ReferencePresentationUrlClaim: ReferencePresentationUrlClaim2,
4225
4420
  ReferencePresentationTooltip: ReferencePresentationTooltip2,
4226
4421
  ReferencePresentationAddress: ReferencePresentationAddress2,
4422
+ ReferencePresentationAccountLinks: ReferencePresentationAccountLinks2,
4227
4423
  ReferencePresentationWords: ReferencePresentationWords2,
4228
4424
  ReferencePresentationContribution: ReferencePresentationContribution2,
4229
4425
  RichViewContribution: RichViewContribution2,
@@ -4239,8 +4435,15 @@ function createContributionsSchemas(canonical) {
4239
4435
  PluginContributionKind: PluginContributionKind2
4240
4436
  };
4241
4437
  }
4242
- 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, 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);
4243
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
+ }
4244
4447
 
4245
4448
  // packages/plugin-protocol/dist/icon-shape.js
4246
4449
  var SVG_PROLOG = String.raw`^\s*(?:<\?xml[^>]*>\s*)?(?:<!--[\s\S]*?-->\s*)*(?:<!DOCTYPE[^>]*>\s*)?`;
@@ -4716,7 +4919,13 @@ function createManifestSchemas(canonical) {
4716
4919
  loginUrl: HttpsUrl2,
4717
4920
  cookieDomains: z13.array(RegistrableDomain2).min(1),
4718
4921
  probe: PluginWebSessionProbe2,
4719
- 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()
4720
4929
  }).superRefine(refineWebSessionScopeConfined);
4721
4930
  const PluginAuthService2 = z13.strictObject({
4722
4931
  localId: LocalContributionId2,
@@ -5867,7 +6076,7 @@ function boundPluginDiagnosticMessage(message) {
5867
6076
  import { z as z14 } from "zod";
5868
6077
  function createResolvedContractSchemas(canonical) {
5869
6078
  const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
5870
- 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;
5871
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;
5872
6081
  const { PluginExternalCliConnect: PluginExternalCliConnect2, PluginOAuthClientSupplier: PluginOAuthClientSupplier2 } = canonical ? canonicalManifestSchemas : manifest_exports;
5873
6082
  const { ResolvedPluginGrants: ResolvedPluginGrants2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
@@ -6010,6 +6219,8 @@ function createResolvedContractSchemas(canonical) {
6010
6219
  knownResources: z14.literal(true).optional(),
6011
6220
  /** Mirrors `UriModuleContribution.describesOperations`. */
6012
6221
  describesOperations: z14.literal(true).optional(),
6222
+ /** Mirrors `UriModuleContribution.looksUpWebLinks`. */
6223
+ looksUpWebLinks: z14.literal(true).optional(),
6013
6224
  ...UriModuleFacts2.shape
6014
6225
  });
6015
6226
  const ResolvedKayAgentArtifactUriModule2 = z14.strictObject({
@@ -6046,6 +6257,9 @@ function createResolvedContractSchemas(canonical) {
6046
6257
  mimeTypes: z14.array(MimeTypeString2).min(1),
6047
6258
  extensions: z14.array(FileExtensionToken2).min(1).optional()
6048
6259
  });
6260
+ const ResolvedReferencePresentationUrlClaim = ReferencePresentationUrlClaim2.extend({
6261
+ brandIcon: z14.string().max(64 * 1024).optional()
6262
+ });
6049
6263
  const ResolvedReferencePresentation2 = z14.strictObject({
6050
6264
  localId: LocalContributionId2,
6051
6265
  globalId: GlobalContributionId2,
@@ -6054,13 +6268,16 @@ function createResolvedContractSchemas(canonical) {
6054
6268
  schemes: z14.array(UriScheme2).min(1).optional(),
6055
6269
  /** The module's `displayName`: the source's name in a row. */
6056
6270
  displayName: NonEmptyString3.optional(),
6271
+ /** The module's auth service, qualified: whose accounts `accountLinks` reads. */
6272
+ authService: GlobalContributionId2.optional(),
6273
+ accountLinks: ReferencePresentationAccountLinks2.optional(),
6057
6274
  addresses: z14.array(ReferencePresentationAddress2).min(1).optional(),
6058
6275
  /** Comes with `open`. A presentation with neither only words its module's addresses. */
6059
6276
  resourceKind: NonEmptyString3.optional(),
6060
6277
  open: ReferenceOpenBehavior2.optional(),
6061
6278
  /** MIME-specific resource kinds; absent keys use the base presentation. */
6062
6279
  variants: ReferencePresentationVariants2.optional(),
6063
- claims: z14.array(ReferencePresentationUrlClaim2).optional(),
6280
+ claims: z14.array(ResolvedReferencePresentationUrlClaim).optional(),
6064
6281
  tooltip: z14.strictObject({
6065
6282
  app: GlobalContributionId2,
6066
6283
  pattern: ReferencePresentationUriPattern2
@@ -6165,7 +6382,8 @@ function createResolvedContractSchemas(canonical) {
6165
6382
  method: z14.enum(["GET", "POST"]),
6166
6383
  signedInStatuses: z14.array(SignedInStatusCode2).min(1)
6167
6384
  }),
6168
- oauthVenue: z14.enum(["embedded", "external"])
6385
+ oauthVenue: z14.enum(["embedded", "external"]),
6386
+ signInFirst: z14.string().optional()
6169
6387
  }).superRefine(refineWebSessionScopeConfined);
6170
6388
  const ResolvedPluginAuthService2 = z14.strictObject({
6171
6389
  localId: LocalContributionId2,
@@ -6435,7 +6653,8 @@ function resolveAuthServices(namespace, manifest) {
6435
6653
  method: service.webSession.probe.method ?? "GET",
6436
6654
  signedInStatuses: [...service.webSession.probe.signedInStatuses]
6437
6655
  },
6438
- oauthVenue: service.webSession.oauthVenue
6656
+ oauthVenue: service.webSession.oauthVenue,
6657
+ ...service.webSession.signInFirst === void 0 ? {} : { signInFirst: service.webSession.signInFirst }
6439
6658
  }
6440
6659
  },
6441
6660
  schemes: service.schemes.map((scheme) => {
@@ -6674,6 +6893,7 @@ function resolveKayPluginContractV1(manifest) {
6674
6893
  },
6675
6894
  ...module.knownResources === void 0 ? {} : { knownResources: module.knownResources },
6676
6895
  ...module.describesOperations === void 0 ? {} : { describesOperations: module.describesOperations },
6896
+ ...module.looksUpWebLinks === void 0 ? {} : { looksUpWebLinks: module.looksUpWebLinks },
6677
6897
  ...uriModuleFacts(module)
6678
6898
  }));
6679
6899
  const kayAgentArtifactUriModules = manifest.targets?.kay?.agent?.contributes?.artifactUriModules?.map((module) => ({
@@ -6709,13 +6929,14 @@ function resolveKayPluginContractV1(manifest) {
6709
6929
  ...presentation.uriModule === void 0 ? {} : {
6710
6930
  uriModule: resolveGlobalContributionId(namespace, presentation.uriModule)
6711
6931
  },
6712
- ...presentationSource(manifest, presentation),
6932
+ ...presentationSource(namespace, manifest, presentation),
6713
6933
  ...presentation.addresses === void 0 ? {} : { addresses: presentation.addresses },
6714
6934
  ...presentation.open === void 0 || presentation.resourceKind === void 0 ? {} : {
6715
6935
  resourceKind: presentation.resourceKind,
6716
6936
  open: presentation.open
6717
6937
  },
6718
6938
  ...presentation.words === void 0 ? {} : { words: { ...presentation.words } },
6939
+ ...presentation.accountLinks === void 0 ? {} : { accountLinks: presentation.accountLinks },
6719
6940
  ...presentation.tooltip === void 0 ? {} : {
6720
6941
  tooltip: {
6721
6942
  app: resolveGlobalContributionId(namespace, presentation.tooltip.app),
@@ -6800,19 +7021,23 @@ function safeResolveKayPluginContractV1(manifest) {
6800
7021
  throw error;
6801
7022
  }
6802
7023
  }
6803
- function presentationSource(manifest, presentation) {
7024
+ function presentationSource(namespace, manifest, presentation) {
6804
7025
  const contributes = manifest.targets?.kay;
6805
7026
  const module = [
6806
7027
  ...contributes?.agent?.contributes?.uriModules ?? [],
6807
7028
  ...contributes?.app?.contributes?.uriModules ?? []
6808
7029
  ].find((candidate) => candidate.localId === presentation.uriModule);
6809
7030
  const schemes = presentation.scheme === void 0 ? module?.schemes : [presentation.scheme];
7031
+ const authService = module !== void 0 && "authService" in module ? module.authService : void 0;
6810
7032
  return {
6811
7033
  ...schemes === void 0 ? {} : { schemes: [...schemes] },
6812
- ...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
+ } : {}
6813
7038
  };
6814
7039
  }
6815
- 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 }) {
6816
7041
  return facts;
6817
7042
  }
6818
7043
 
@@ -7746,6 +7971,7 @@ export {
7746
7971
  RETIRED_PLUGIN_CAPABILITY_SLUGS,
7747
7972
  RETIRED_WEB_SESSION_ROW_KEYS,
7748
7973
  ReferenceOpenBehavior,
7974
+ ReferencePresentationAccountLinks,
7749
7975
  ReferencePresentationAddress,
7750
7976
  ReferencePresentationContribution,
7751
7977
  ReferencePresentationTooltip,
@@ -7824,6 +8050,7 @@ export {
7824
8050
  UriModuleContribution,
7825
8051
  UriScheme,
7826
8052
  WEB_SESSION_CSRF_SELECTOR_PATTERN,
8053
+ WHERE_MAX_BYTES,
7827
8054
  WebSessionCsrfSelector,
7828
8055
  WebSessionGrantRequest,
7829
8056
  WhiteboardCapabilityClaimV1,
@@ -7851,25 +8078,30 @@ export {
7851
8078
  configSectionKeysForManifest,
7852
8079
  declarationsOfKind,
7853
8080
  declaredCommandId,
8081
+ declaredLocalAppSchemes,
7854
8082
  declaredReferencePresentations,
7855
8083
  declaredUiIconPaths,
7856
8084
  dedupeClaims,
7857
8085
  deriveDirectoryPluginToolName,
7858
8086
  evaluateCommandWhere,
7859
8087
  evaluateWhere,
8088
+ eventWhereProblem,
7860
8089
  finalizeArtifactProvenanceEnvelope,
7861
8090
  findSkillSuggestionCitations,
8091
+ formatWhereLiteral,
7862
8092
  hasClaim,
7863
8093
  hostWithinDomain,
7864
8094
  isCanonicalArtifactOutputUri,
7865
8095
  isCompatible,
7866
8096
  isCredentialShapedText,
8097
+ isDeclaredLocalAppLink,
7867
8098
  isKayPluginCompatibilityRefusal,
7868
8099
  isPluginProductEventName,
7869
8100
  isPrivateCapabilityClaim,
7870
8101
  isQualifiedAuthSchemeRef,
7871
8102
  isQualifiedAuthServiceRef,
7872
8103
  isSupportedSemverRange,
8104
+ isUiAppSourceModule,
7873
8105
  judgeKayPluginDirectory,
7874
8106
  kayPluginCompatibilityAdvisories,
7875
8107
  kayPluginHostCompatibility,
@@ -7910,8 +8142,13 @@ export {
7910
8142
  skillSuggestionEvidenceKey,
7911
8143
  turnMessageOrigin,
7912
8144
  turnPacket,
8145
+ uiAppSourceStylePath,
7913
8146
  urlHostWithinDomain,
7914
8147
  validateKayUiEventSubscription,
7915
8148
  webSessionPathWithinPrefix,
8149
+ whereClausesAsExpression,
8150
+ whereKeyUses,
8151
+ whereNotAStringMessage,
8152
+ whereProblem,
7916
8153
  whiteboardCapabilityClaim
7917
8154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.45.0",
3
+ "version": "0.46.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",