@yaklabs-ai/plugin-protocol 0.13.9 → 0.13.10

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.13.9"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.13.10"
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.13.9",
4
+ "version": "0.13.10",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -133,9 +133,9 @@ export declare type AppEventSubscription = z.infer<typeof AppEventSubscription>;
133
133
  * `kay.agent` registration seam only).
134
134
  */
135
135
  export declare const AppUriModuleContribution: z.ZodObject<{
136
+ displayName: z.ZodOptional<z.ZodString>;
136
137
  schemes: z.ZodArray<z.ZodString>;
137
138
  localId: z.ZodString;
138
- displayName: z.ZodOptional<z.ZodString>;
139
139
  }, z.core.$strict>;
140
140
 
141
141
  export declare type AppUriModuleContribution = z.infer<typeof AppUriModuleContribution>;
@@ -1249,6 +1249,28 @@ export declare const AuthAccountSelector: z.ZodDiscriminatedUnion<[z.ZodObject<{
1249
1249
 
1250
1250
  export declare type AuthAccountSelector = z.infer<typeof AuthAccountSelector>;
1251
1251
 
1252
+ /**
1253
+ * The product a person connects a shared identity through (SDK 0.13.10): a capability front door. A
1254
+ * plugin that consumes another plugin's sign-in (Gmail consuming `google.account`) names the
1255
+ * `service_connect` id and label its product is offered under, and connecting it expands the shared
1256
+ * record with this grant's scopes instead of minting a credential of its own. The door owns no
1257
+ * credential, so it is display data; the shared identity it expands is `auth.shared-identity`'s.
1258
+ */
1259
+ export declare const AuthGrantFrontDoor: z.ZodObject<{
1260
+ id: z.ZodString;
1261
+ displayName: z.ZodString;
1262
+ resourcePicker: z.ZodOptional<z.ZodObject<{
1263
+ effect: z.ZodEnum<{
1264
+ selection: "selection";
1265
+ "resource-grant": "resource-grant";
1266
+ }>;
1267
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1268
+ successNote: z.ZodOptional<z.ZodString>;
1269
+ }, z.core.$strict>>;
1270
+ }, z.core.$strict>;
1271
+
1272
+ export declare type AuthGrantFrontDoor = z.infer<typeof AuthGrantFrontDoor>;
1273
+
1252
1274
  export declare const AuthGrantOperation: z.ZodEnum<{
1253
1275
  status: "status";
1254
1276
  connect: "connect";
@@ -1295,6 +1317,18 @@ export declare const AuthGrantRequest: z.ZodObject<{
1295
1317
  kind: z.ZodLiteral<"record-id">;
1296
1318
  recordId: z.ZodString;
1297
1319
  }, z.core.$strict>], "kind">>>;
1320
+ frontDoor: z.ZodOptional<z.ZodObject<{
1321
+ id: z.ZodString;
1322
+ displayName: z.ZodString;
1323
+ resourcePicker: z.ZodOptional<z.ZodObject<{
1324
+ effect: z.ZodEnum<{
1325
+ selection: "selection";
1326
+ "resource-grant": "resource-grant";
1327
+ }>;
1328
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1329
+ successNote: z.ZodOptional<z.ZodString>;
1330
+ }, z.core.$strict>>;
1331
+ }, z.core.$strict>>;
1298
1332
  }, z.core.$strict>;
1299
1333
 
1300
1334
  export declare type AuthGrantRequest = z.infer<typeof AuthGrantRequest>;
@@ -1435,8 +1469,8 @@ export declare type CliBinaryName = z.infer<typeof CliBinaryName>;
1435
1469
  * only `external-cli` schemes. `buildCliBindingRoster` throws on either violation.
1436
1470
  * What the binding still contributes is the read/write split (already ungated —
1437
1471
  * classifier rows compose off the ungated roster) and, via the `external-cli`
1438
- * scheme's own `probeArgs`/`installHint`, a reachability probe the agent uses to
1439
- * decide whether to install the tool.
1472
+ * scheme's own connect facts (`cli.probe.args`, `cli.hints.install`), a reachability
1473
+ * probe the agent uses to decide whether to install the tool.
1440
1474
  *
1441
1475
  * Catalog membership is required for `vendored` and skipped for `path`; roster
1442
1476
  * uniqueness across every binary/alias applies to both.
@@ -1846,6 +1880,8 @@ export declare type FileExtensionToken = z.infer<typeof FileExtensionToken>;
1846
1880
  */
1847
1881
  export declare function finalizeArtifactProvenanceEnvelope(capture: ArtifactProvenanceCaptureContext, artifacts: readonly ArtifactProvenanceMutation[]): ArtifactProvenanceEnvelopeV1;
1848
1882
 
1883
+ export declare function findSkillSuggestionCitations(text: string, options?: SkillSuggestionEvidenceOptions): readonly SkillSuggestionCitation[];
1884
+
1849
1885
  /**
1850
1886
  * The Basic-auth USERNAME a git host expects beside an injected token
1851
1887
  * (`x-access-token` for GitHub, `oauth2` for GitLab). The token is the password
@@ -2059,7 +2095,7 @@ export declare const KAY_EVENT_PUBLISHER_ID: "kay";
2059
2095
  declare const KAY_PLUGIN_COMPATIBILITY_REFUSAL_CODES: readonly ["unsupported-protocol", "sdk-range-unsatisfied", "sdk-range-unsupported", "host-sdk-version-invalid"];
2060
2096
 
2061
2097
  /** Released SDK contracts still implemented by the host, alongside its current SDK. */
2062
- export declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly ["0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5", "0.13.0", "0.13.1", "0.13.2", "0.13.3", "0.13.4", "0.13.5", "0.13.6", "0.13.7", "0.13.8"];
2098
+ export declare const KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS: readonly ["0.8.0", "0.8.1", "0.8.2", "0.8.3", "0.8.4", "0.8.5", "0.9.0", "0.9.1", "0.10.0", "0.11.0", "0.11.1", "0.12.0", "0.12.1", "0.12.2", "0.12.3", "0.12.4", "0.12.5", "0.13.0", "0.13.1", "0.13.2", "0.13.3", "0.13.4", "0.13.5", "0.13.6", "0.13.7", "0.13.8", "0.13.9"];
2063
2099
 
2064
2100
  /** The file whose presence makes a directory a plugin. A directory without one is not a plugin. */
2065
2101
  export declare const KAY_PLUGIN_MANIFEST_FILENAME = "kay-plugin.json";
@@ -2365,8 +2401,15 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
2365
2401
  * code a `kay.ui` page also loads (`kay-agent` exports the same `z`). Additive: a plugin compiled
2366
2402
  * against 0.13.8 never imports it. A plugin that imports it declares `^0.13.9`, so an older host
2367
2403
  * refuses a directory or repository plugin at load instead of the import failing.
2404
+ *
2405
+ * 0.13.10 adds two optional manifest fields. An `external-cli` auth scheme's `cli` says how the host
2406
+ * connects it (the binary, its probe and sign-in argv, the hints, the install command), which the
2407
+ * host read from its own tables before. An auth grant's `frontDoor` names the product a person
2408
+ * connects a shared identity through (`gmail` over `google.account`), with an optional file picker.
2409
+ * Additive: a manifest without them parses unchanged. A plugin that declares one declares
2410
+ * `^0.13.10`, so an older host refuses it at load with that reason rather than a schema error.
2368
2411
  */
2369
- export declare const KAY_PLUGIN_SDK_VERSION: "0.13.9";
2412
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.13.10";
2370
2413
 
2371
2414
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
2372
2415
 
@@ -2529,9 +2572,9 @@ export declare const KayAppTargetManifest: z.ZodObject<{
2529
2572
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
2530
2573
  }, z.core.$strict>>>;
2531
2574
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2575
+ displayName: z.ZodOptional<z.ZodString>;
2532
2576
  schemes: z.ZodArray<z.ZodString>;
2533
2577
  localId: z.ZodString;
2534
- displayName: z.ZodOptional<z.ZodString>;
2535
2578
  }, z.core.$strict>>>;
2536
2579
  dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
2537
2580
  localId: z.ZodString;
@@ -2911,9 +2954,9 @@ export declare const KayPluginManifestV1: z.ZodObject<{
2911
2954
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
2912
2955
  }, z.core.$strict>>>;
2913
2956
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2957
+ displayName: z.ZodOptional<z.ZodString>;
2914
2958
  schemes: z.ZodArray<z.ZodString>;
2915
2959
  localId: z.ZodString;
2916
- displayName: z.ZodOptional<z.ZodString>;
2917
2960
  }, z.core.$strict>>>;
2918
2961
  dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
2919
2962
  localId: z.ZodString;
@@ -3254,6 +3297,26 @@ export declare const KayPluginManifestV1: z.ZodObject<{
3254
3297
  localId: z.ZodString;
3255
3298
  kind: z.ZodLiteral<"external-cli">;
3256
3299
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3300
+ cli: z.ZodOptional<z.ZodObject<{
3301
+ binary: z.ZodString;
3302
+ probe: z.ZodObject<{
3303
+ args: z.ZodArray<z.ZodString>;
3304
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
3305
+ signedOutMarker: z.ZodOptional<z.ZodString>;
3306
+ }, z.core.$strict>;
3307
+ login: z.ZodOptional<z.ZodObject<{
3308
+ args: z.ZodArray<z.ZodString>;
3309
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
3310
+ }, z.core.$strict>>;
3311
+ install: z.ZodOptional<z.ZodObject<{
3312
+ command: z.ZodString;
3313
+ args: z.ZodArray<z.ZodString>;
3314
+ }, z.core.$strict>>;
3315
+ hints: z.ZodObject<{
3316
+ install: z.ZodString;
3317
+ login: z.ZodString;
3318
+ }, z.core.$strict>;
3319
+ }, z.core.$strict>>;
3257
3320
  displayName: z.ZodOptional<z.ZodString>;
3258
3321
  agentHint: z.ZodOptional<z.ZodString>;
3259
3322
  summary: z.ZodOptional<z.ZodString>;
@@ -3321,6 +3384,18 @@ export declare const KayPluginManifestV1: z.ZodObject<{
3321
3384
  kind: z.ZodLiteral<"record-id">;
3322
3385
  recordId: z.ZodString;
3323
3386
  }, z.core.$strict>], "kind">>>;
3387
+ frontDoor: z.ZodOptional<z.ZodObject<{
3388
+ id: z.ZodString;
3389
+ displayName: z.ZodString;
3390
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3391
+ effect: z.ZodEnum<{
3392
+ selection: "selection";
3393
+ "resource-grant": "resource-grant";
3394
+ }>;
3395
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3396
+ successNote: z.ZodOptional<z.ZodString>;
3397
+ }, z.core.$strict>>;
3398
+ }, z.core.$strict>>;
3324
3399
  }, z.core.$strict>>>;
3325
3400
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3326
3401
  kind: z.ZodEnum<{
@@ -3403,6 +3478,18 @@ export declare const KayPluginManifestV1: z.ZodObject<{
3403
3478
  kind: z.ZodLiteral<"record-id">;
3404
3479
  recordId: z.ZodString;
3405
3480
  }, z.core.$strict>], "kind">>>;
3481
+ frontDoor: z.ZodOptional<z.ZodObject<{
3482
+ id: z.ZodString;
3483
+ displayName: z.ZodString;
3484
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3485
+ effect: z.ZodEnum<{
3486
+ selection: "selection";
3487
+ "resource-grant": "resource-grant";
3488
+ }>;
3489
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3490
+ successNote: z.ZodOptional<z.ZodString>;
3491
+ }, z.core.$strict>>;
3492
+ }, z.core.$strict>>;
3406
3493
  }, z.core.$strict>>>;
3407
3494
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3408
3495
  kind: z.ZodEnum<{
@@ -3485,6 +3572,18 @@ export declare const KayPluginManifestV1: z.ZodObject<{
3485
3572
  kind: z.ZodLiteral<"record-id">;
3486
3573
  recordId: z.ZodString;
3487
3574
  }, z.core.$strict>], "kind">>>;
3575
+ frontDoor: z.ZodOptional<z.ZodObject<{
3576
+ id: z.ZodString;
3577
+ displayName: z.ZodString;
3578
+ resourcePicker: z.ZodOptional<z.ZodObject<{
3579
+ effect: z.ZodEnum<{
3580
+ selection: "selection";
3581
+ "resource-grant": "resource-grant";
3582
+ }>;
3583
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3584
+ successNote: z.ZodOptional<z.ZodString>;
3585
+ }, z.core.$strict>>;
3586
+ }, z.core.$strict>>;
3488
3587
  }, z.core.$strict>>>;
3489
3588
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
3490
3589
  kind: z.ZodEnum<{
@@ -4095,6 +4194,26 @@ export declare const PluginAuthManifest: z.ZodObject<{
4095
4194
  localId: z.ZodString;
4096
4195
  kind: z.ZodLiteral<"external-cli">;
4097
4196
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
4197
+ cli: z.ZodOptional<z.ZodObject<{
4198
+ binary: z.ZodString;
4199
+ probe: z.ZodObject<{
4200
+ args: z.ZodArray<z.ZodString>;
4201
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4202
+ signedOutMarker: z.ZodOptional<z.ZodString>;
4203
+ }, z.core.$strict>;
4204
+ login: z.ZodOptional<z.ZodObject<{
4205
+ args: z.ZodArray<z.ZodString>;
4206
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4207
+ }, z.core.$strict>>;
4208
+ install: z.ZodOptional<z.ZodObject<{
4209
+ command: z.ZodString;
4210
+ args: z.ZodArray<z.ZodString>;
4211
+ }, z.core.$strict>>;
4212
+ hints: z.ZodObject<{
4213
+ install: z.ZodString;
4214
+ login: z.ZodString;
4215
+ }, z.core.$strict>;
4216
+ }, z.core.$strict>>;
4098
4217
  displayName: z.ZodOptional<z.ZodString>;
4099
4218
  agentHint: z.ZodOptional<z.ZodString>;
4100
4219
  summary: z.ZodOptional<z.ZodString>;
@@ -4206,6 +4325,26 @@ export declare const PluginAuthScheme: z.ZodDiscriminatedUnion<[z.ZodDiscriminat
4206
4325
  localId: z.ZodString;
4207
4326
  kind: z.ZodLiteral<"external-cli">;
4208
4327
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
4328
+ cli: z.ZodOptional<z.ZodObject<{
4329
+ binary: z.ZodString;
4330
+ probe: z.ZodObject<{
4331
+ args: z.ZodArray<z.ZodString>;
4332
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4333
+ signedOutMarker: z.ZodOptional<z.ZodString>;
4334
+ }, z.core.$strict>;
4335
+ login: z.ZodOptional<z.ZodObject<{
4336
+ args: z.ZodArray<z.ZodString>;
4337
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4338
+ }, z.core.$strict>>;
4339
+ install: z.ZodOptional<z.ZodObject<{
4340
+ command: z.ZodString;
4341
+ args: z.ZodArray<z.ZodString>;
4342
+ }, z.core.$strict>>;
4343
+ hints: z.ZodObject<{
4344
+ install: z.ZodString;
4345
+ login: z.ZodString;
4346
+ }, z.core.$strict>;
4347
+ }, z.core.$strict>>;
4209
4348
  displayName: z.ZodOptional<z.ZodString>;
4210
4349
  agentHint: z.ZodOptional<z.ZodString>;
4211
4350
  summary: z.ZodOptional<z.ZodString>;
@@ -4297,6 +4436,26 @@ export declare const PluginAuthService: z.ZodObject<{
4297
4436
  localId: z.ZodString;
4298
4437
  kind: z.ZodLiteral<"external-cli">;
4299
4438
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
4439
+ cli: z.ZodOptional<z.ZodObject<{
4440
+ binary: z.ZodString;
4441
+ probe: z.ZodObject<{
4442
+ args: z.ZodArray<z.ZodString>;
4443
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4444
+ signedOutMarker: z.ZodOptional<z.ZodString>;
4445
+ }, z.core.$strict>;
4446
+ login: z.ZodOptional<z.ZodObject<{
4447
+ args: z.ZodArray<z.ZodString>;
4448
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4449
+ }, z.core.$strict>>;
4450
+ install: z.ZodOptional<z.ZodObject<{
4451
+ command: z.ZodString;
4452
+ args: z.ZodArray<z.ZodString>;
4453
+ }, z.core.$strict>>;
4454
+ hints: z.ZodObject<{
4455
+ install: z.ZodString;
4456
+ login: z.ZodString;
4457
+ }, z.core.$strict>;
4458
+ }, z.core.$strict>>;
4300
4459
  displayName: z.ZodOptional<z.ZodString>;
4301
4460
  agentHint: z.ZodOptional<z.ZodString>;
4302
4461
  summary: z.ZodOptional<z.ZodString>;
@@ -5453,6 +5612,39 @@ export declare const PluginEventDefinitionContribution: z.ZodObject<{
5453
5612
 
5454
5613
  export declare type PluginEventDefinitionContribution = z.infer<typeof PluginEventDefinitionContribution>;
5455
5614
 
5615
+ /**
5616
+ * How the host connects an `external-cli` scheme (SDK 0.13.10). Bonsai reads it for its own plugins
5617
+ * only; any other plugin's is ignored, with a load diagnostic.
5618
+ *
5619
+ * Connecting runs `binary probe.args`, and a zero exit is the connection. A failed probe surfaces the
5620
+ * hints, and when `login` is declared and the failure carries `probe.signedOutMarker`, connect hands
5621
+ * the sign-in to the CLI itself (`binary login.args`, which opens the CLI's own browser flow) and
5622
+ * probes again. The credential stays in the CLI's own store; the host records only that the probe
5623
+ * passed. Each `timeoutMs` is a budget the host enforces and may clamp to a shorter one.
5624
+ */
5625
+ export declare const PluginExternalCliConnect: z.ZodObject<{
5626
+ binary: z.ZodString;
5627
+ probe: z.ZodObject<{
5628
+ args: z.ZodArray<z.ZodString>;
5629
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
5630
+ signedOutMarker: z.ZodOptional<z.ZodString>;
5631
+ }, z.core.$strict>;
5632
+ login: z.ZodOptional<z.ZodObject<{
5633
+ args: z.ZodArray<z.ZodString>;
5634
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
5635
+ }, z.core.$strict>>;
5636
+ install: z.ZodOptional<z.ZodObject<{
5637
+ command: z.ZodString;
5638
+ args: z.ZodArray<z.ZodString>;
5639
+ }, z.core.$strict>>;
5640
+ hints: z.ZodObject<{
5641
+ install: z.ZodString;
5642
+ login: z.ZodString;
5643
+ }, z.core.$strict>;
5644
+ }, z.core.$strict>;
5645
+
5646
+ export declare type PluginExternalCliConnect = z.infer<typeof PluginExternalCliConnect>;
5647
+
5456
5648
  /**
5457
5649
  * How a plugin icon asks to be drawn.
5458
5650
  *
@@ -5623,6 +5815,18 @@ export declare const PluginPermissionManifest: z.ZodObject<{
5623
5815
  kind: z.ZodLiteral<"record-id">;
5624
5816
  recordId: z.ZodString;
5625
5817
  }, z.core.$strict>], "kind">>>;
5818
+ frontDoor: z.ZodOptional<z.ZodObject<{
5819
+ id: z.ZodString;
5820
+ displayName: z.ZodString;
5821
+ resourcePicker: z.ZodOptional<z.ZodObject<{
5822
+ effect: z.ZodEnum<{
5823
+ selection: "selection";
5824
+ "resource-grant": "resource-grant";
5825
+ }>;
5826
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5827
+ successNote: z.ZodOptional<z.ZodString>;
5828
+ }, z.core.$strict>>;
5829
+ }, z.core.$strict>>;
5626
5830
  }, z.core.$strict>>>;
5627
5831
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
5628
5832
  kind: z.ZodEnum<{
@@ -5705,6 +5909,18 @@ export declare const PluginPermissionManifest: z.ZodObject<{
5705
5909
  kind: z.ZodLiteral<"record-id">;
5706
5910
  recordId: z.ZodString;
5707
5911
  }, z.core.$strict>], "kind">>>;
5912
+ frontDoor: z.ZodOptional<z.ZodObject<{
5913
+ id: z.ZodString;
5914
+ displayName: z.ZodString;
5915
+ resourcePicker: z.ZodOptional<z.ZodObject<{
5916
+ effect: z.ZodEnum<{
5917
+ selection: "selection";
5918
+ "resource-grant": "resource-grant";
5919
+ }>;
5920
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
5921
+ successNote: z.ZodOptional<z.ZodString>;
5922
+ }, z.core.$strict>>;
5923
+ }, z.core.$strict>>;
5708
5924
  }, z.core.$strict>>>;
5709
5925
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
5710
5926
  kind: z.ZodEnum<{
@@ -5787,6 +6003,18 @@ export declare const PluginPermissionManifest: z.ZodObject<{
5787
6003
  kind: z.ZodLiteral<"record-id">;
5788
6004
  recordId: z.ZodString;
5789
6005
  }, z.core.$strict>], "kind">>>;
6006
+ frontDoor: z.ZodOptional<z.ZodObject<{
6007
+ id: z.ZodString;
6008
+ displayName: z.ZodString;
6009
+ resourcePicker: z.ZodOptional<z.ZodObject<{
6010
+ effect: z.ZodEnum<{
6011
+ selection: "selection";
6012
+ "resource-grant": "resource-grant";
6013
+ }>;
6014
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6015
+ successNote: z.ZodOptional<z.ZodString>;
6016
+ }, z.core.$strict>>;
6017
+ }, z.core.$strict>>;
5790
6018
  }, z.core.$strict>>>;
5791
6019
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
5792
6020
  kind: z.ZodEnum<{
@@ -6218,6 +6446,18 @@ export declare const ResolvedAuthGrantRequest: z.ZodObject<{
6218
6446
  description: z.ZodString;
6219
6447
  documentationUrl: z.ZodOptional<z.ZodURL>;
6220
6448
  }, z.core.$strict>>>;
6449
+ frontDoor: z.ZodOptional<z.ZodObject<{
6450
+ id: z.ZodString;
6451
+ displayName: z.ZodString;
6452
+ resourcePicker: z.ZodOptional<z.ZodObject<{
6453
+ effect: z.ZodEnum<{
6454
+ selection: "selection";
6455
+ "resource-grant": "resource-grant";
6456
+ }>;
6457
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6458
+ successNote: z.ZodOptional<z.ZodString>;
6459
+ }, z.core.$strict>>;
6460
+ }, z.core.$strict>>;
6221
6461
  service: z.ZodString;
6222
6462
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6223
6463
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -6585,6 +6825,26 @@ export declare const ResolvedPluginAuthScheme: z.ZodDiscriminatedUnion<[z.ZodDis
6585
6825
  globalId: z.ZodString;
6586
6826
  kind: z.ZodLiteral<"external-cli">;
6587
6827
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6828
+ cli: z.ZodOptional<z.ZodObject<{
6829
+ binary: z.ZodString;
6830
+ probe: z.ZodObject<{
6831
+ args: z.ZodArray<z.ZodString>;
6832
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
6833
+ signedOutMarker: z.ZodOptional<z.ZodString>;
6834
+ }, z.core.$strict>;
6835
+ login: z.ZodOptional<z.ZodObject<{
6836
+ args: z.ZodArray<z.ZodString>;
6837
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
6838
+ }, z.core.$strict>>;
6839
+ install: z.ZodOptional<z.ZodObject<{
6840
+ command: z.ZodString;
6841
+ args: z.ZodArray<z.ZodString>;
6842
+ }, z.core.$strict>>;
6843
+ hints: z.ZodObject<{
6844
+ install: z.ZodString;
6845
+ login: z.ZodString;
6846
+ }, z.core.$strict>;
6847
+ }, z.core.$strict>>;
6588
6848
  displayName: z.ZodOptional<z.ZodString>;
6589
6849
  agentHint: z.ZodOptional<z.ZodString>;
6590
6850
  summary: z.ZodOptional<z.ZodString>;
@@ -6692,6 +6952,26 @@ export declare const ResolvedPluginAuthService: z.ZodObject<{
6692
6952
  globalId: z.ZodString;
6693
6953
  kind: z.ZodLiteral<"external-cli">;
6694
6954
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6955
+ cli: z.ZodOptional<z.ZodObject<{
6956
+ binary: z.ZodString;
6957
+ probe: z.ZodObject<{
6958
+ args: z.ZodArray<z.ZodString>;
6959
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
6960
+ signedOutMarker: z.ZodOptional<z.ZodString>;
6961
+ }, z.core.$strict>;
6962
+ login: z.ZodOptional<z.ZodObject<{
6963
+ args: z.ZodArray<z.ZodString>;
6964
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
6965
+ }, z.core.$strict>>;
6966
+ install: z.ZodOptional<z.ZodObject<{
6967
+ command: z.ZodString;
6968
+ args: z.ZodArray<z.ZodString>;
6969
+ }, z.core.$strict>>;
6970
+ hints: z.ZodObject<{
6971
+ install: z.ZodString;
6972
+ login: z.ZodString;
6973
+ }, z.core.$strict>;
6974
+ }, z.core.$strict>>;
6695
6975
  displayName: z.ZodOptional<z.ZodString>;
6696
6976
  agentHint: z.ZodOptional<z.ZodString>;
6697
6977
  summary: z.ZodOptional<z.ZodString>;
@@ -6861,6 +7141,26 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
6861
7141
  globalId: z.ZodString;
6862
7142
  kind: z.ZodLiteral<"external-cli">;
6863
7143
  scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7144
+ cli: z.ZodOptional<z.ZodObject<{
7145
+ binary: z.ZodString;
7146
+ probe: z.ZodObject<{
7147
+ args: z.ZodArray<z.ZodString>;
7148
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
7149
+ signedOutMarker: z.ZodOptional<z.ZodString>;
7150
+ }, z.core.$strict>;
7151
+ login: z.ZodOptional<z.ZodObject<{
7152
+ args: z.ZodArray<z.ZodString>;
7153
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
7154
+ }, z.core.$strict>>;
7155
+ install: z.ZodOptional<z.ZodObject<{
7156
+ command: z.ZodString;
7157
+ args: z.ZodArray<z.ZodString>;
7158
+ }, z.core.$strict>>;
7159
+ hints: z.ZodObject<{
7160
+ install: z.ZodString;
7161
+ login: z.ZodString;
7162
+ }, z.core.$strict>;
7163
+ }, z.core.$strict>>;
6864
7164
  displayName: z.ZodOptional<z.ZodString>;
6865
7165
  agentHint: z.ZodOptional<z.ZodString>;
6866
7166
  summary: z.ZodOptional<z.ZodString>;
@@ -6916,6 +7216,18 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
6916
7216
  description: z.ZodString;
6917
7217
  documentationUrl: z.ZodOptional<z.ZodURL>;
6918
7218
  }, z.core.$strict>>>;
7219
+ frontDoor: z.ZodOptional<z.ZodObject<{
7220
+ id: z.ZodString;
7221
+ displayName: z.ZodString;
7222
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7223
+ effect: z.ZodEnum<{
7224
+ selection: "selection";
7225
+ "resource-grant": "resource-grant";
7226
+ }>;
7227
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7228
+ successNote: z.ZodOptional<z.ZodString>;
7229
+ }, z.core.$strict>>;
7230
+ }, z.core.$strict>>;
6919
7231
  service: z.ZodString;
6920
7232
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
6921
7233
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -6998,6 +7310,18 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
6998
7310
  description: z.ZodString;
6999
7311
  documentationUrl: z.ZodOptional<z.ZodURL>;
7000
7312
  }, z.core.$strict>>>;
7313
+ frontDoor: z.ZodOptional<z.ZodObject<{
7314
+ id: z.ZodString;
7315
+ displayName: z.ZodString;
7316
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7317
+ effect: z.ZodEnum<{
7318
+ selection: "selection";
7319
+ "resource-grant": "resource-grant";
7320
+ }>;
7321
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7322
+ successNote: z.ZodOptional<z.ZodString>;
7323
+ }, z.core.$strict>>;
7324
+ }, z.core.$strict>>;
7001
7325
  service: z.ZodString;
7002
7326
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7003
7327
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -7080,6 +7404,18 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
7080
7404
  description: z.ZodString;
7081
7405
  documentationUrl: z.ZodOptional<z.ZodURL>;
7082
7406
  }, z.core.$strict>>>;
7407
+ frontDoor: z.ZodOptional<z.ZodObject<{
7408
+ id: z.ZodString;
7409
+ displayName: z.ZodString;
7410
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7411
+ effect: z.ZodEnum<{
7412
+ selection: "selection";
7413
+ "resource-grant": "resource-grant";
7414
+ }>;
7415
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7416
+ successNote: z.ZodOptional<z.ZodString>;
7417
+ }, z.core.$strict>>;
7418
+ }, z.core.$strict>>;
7083
7419
  service: z.ZodString;
7084
7420
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7085
7421
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -7401,6 +7737,18 @@ export declare const ResolvedPluginGrants: z.ZodObject<{
7401
7737
  description: z.ZodString;
7402
7738
  documentationUrl: z.ZodOptional<z.ZodURL>;
7403
7739
  }, z.core.$strict>>>;
7740
+ frontDoor: z.ZodOptional<z.ZodObject<{
7741
+ id: z.ZodString;
7742
+ displayName: z.ZodString;
7743
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7744
+ effect: z.ZodEnum<{
7745
+ selection: "selection";
7746
+ "resource-grant": "resource-grant";
7747
+ }>;
7748
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7749
+ successNote: z.ZodOptional<z.ZodString>;
7750
+ }, z.core.$strict>>;
7751
+ }, z.core.$strict>>;
7404
7752
  service: z.ZodString;
7405
7753
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7406
7754
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -7483,6 +7831,18 @@ export declare const ResolvedPluginGrants: z.ZodObject<{
7483
7831
  description: z.ZodString;
7484
7832
  documentationUrl: z.ZodOptional<z.ZodURL>;
7485
7833
  }, z.core.$strict>>>;
7834
+ frontDoor: z.ZodOptional<z.ZodObject<{
7835
+ id: z.ZodString;
7836
+ displayName: z.ZodString;
7837
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7838
+ effect: z.ZodEnum<{
7839
+ selection: "selection";
7840
+ "resource-grant": "resource-grant";
7841
+ }>;
7842
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7843
+ successNote: z.ZodOptional<z.ZodString>;
7844
+ }, z.core.$strict>>;
7845
+ }, z.core.$strict>>;
7486
7846
  service: z.ZodString;
7487
7847
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7488
7848
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -7565,6 +7925,18 @@ export declare const ResolvedPluginGrants: z.ZodObject<{
7565
7925
  description: z.ZodString;
7566
7926
  documentationUrl: z.ZodOptional<z.ZodURL>;
7567
7927
  }, z.core.$strict>>>;
7928
+ frontDoor: z.ZodOptional<z.ZodObject<{
7929
+ id: z.ZodString;
7930
+ displayName: z.ZodString;
7931
+ resourcePicker: z.ZodOptional<z.ZodObject<{
7932
+ effect: z.ZodEnum<{
7933
+ selection: "selection";
7934
+ "resource-grant": "resource-grant";
7935
+ }>;
7936
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7937
+ successNote: z.ZodOptional<z.ZodString>;
7938
+ }, z.core.$strict>>;
7939
+ }, z.core.$strict>>;
7568
7940
  service: z.ZodString;
7569
7941
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7570
7942
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -7754,6 +8126,18 @@ export declare const ResolvedTargetGrantSet: z.ZodObject<{
7754
8126
  description: z.ZodString;
7755
8127
  documentationUrl: z.ZodOptional<z.ZodURL>;
7756
8128
  }, z.core.$strict>>>;
8129
+ frontDoor: z.ZodOptional<z.ZodObject<{
8130
+ id: z.ZodString;
8131
+ displayName: z.ZodString;
8132
+ resourcePicker: z.ZodOptional<z.ZodObject<{
8133
+ effect: z.ZodEnum<{
8134
+ selection: "selection";
8135
+ "resource-grant": "resource-grant";
8136
+ }>;
8137
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8138
+ successNote: z.ZodOptional<z.ZodString>;
8139
+ }, z.core.$strict>>;
8140
+ }, z.core.$strict>>;
7757
8141
  service: z.ZodString;
7758
8142
  schemes: z.ZodOptional<z.ZodArray<z.ZodString>>;
7759
8143
  accountSelectors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -8396,6 +8780,44 @@ export declare const SkillContribution: z.ZodObject<{
8396
8780
 
8397
8781
  export declare type SkillContribution = z.infer<typeof SkillContribution>;
8398
8782
 
8783
+ export declare interface SkillSuggestionCitation {
8784
+ readonly start: number;
8785
+ readonly end: number;
8786
+ readonly ref: SkillSuggestionEvidenceRef;
8787
+ }
8788
+
8789
+ export declare type SkillSuggestionEvidenceItem = SkillSuggestionEvidenceRef | {
8790
+ readonly kind: "text";
8791
+ readonly text: string;
8792
+ };
8793
+
8794
+ export declare function skillSuggestionEvidenceItems(evidence: unknown, options?: SkillSuggestionEvidenceOptions): readonly SkillSuggestionEvidenceItem[];
8795
+
8796
+ export declare function skillSuggestionEvidenceKey(item: SkillSuggestionEvidenceItem): string;
8797
+
8798
+ export declare interface SkillSuggestionEvidenceOptions {
8799
+ readonly sessionIds?: readonly string[];
8800
+ }
8801
+
8802
+ export declare type SkillSuggestionEvidenceRef = {
8803
+ readonly kind: "message";
8804
+ readonly sessionId: string;
8805
+ readonly entryId: string;
8806
+ readonly raw: string;
8807
+ } | {
8808
+ readonly kind: "session";
8809
+ readonly sessionId: string;
8810
+ readonly raw: string;
8811
+ } | {
8812
+ readonly kind: "friction";
8813
+ readonly reference: string;
8814
+ readonly raw: string;
8815
+ } | {
8816
+ readonly kind: "uri";
8817
+ readonly uri: string;
8818
+ readonly raw: string;
8819
+ };
8820
+
8399
8821
  export declare const StorageGrantRequest: z.ZodObject<{
8400
8822
  kind: z.ZodEnum<{
8401
8823
  sqlite: "sqlite";
@@ -8463,6 +8885,18 @@ export declare const TargetPermissionSet: z.ZodPreprocess<z.ZodObject<{
8463
8885
  kind: z.ZodLiteral<"record-id">;
8464
8886
  recordId: z.ZodString;
8465
8887
  }, z.core.$strict>], "kind">>>;
8888
+ frontDoor: z.ZodOptional<z.ZodObject<{
8889
+ id: z.ZodString;
8890
+ displayName: z.ZodString;
8891
+ resourcePicker: z.ZodOptional<z.ZodObject<{
8892
+ effect: z.ZodEnum<{
8893
+ selection: "selection";
8894
+ "resource-grant": "resource-grant";
8895
+ }>;
8896
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8897
+ successNote: z.ZodOptional<z.ZodString>;
8898
+ }, z.core.$strict>>;
8899
+ }, z.core.$strict>>;
8466
8900
  }, z.core.$strict>>>;
8467
8901
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
8468
8902
  kind: z.ZodEnum<{
@@ -8577,6 +9011,18 @@ export declare const TargetPermissionWiring: z.ZodObject<{
8577
9011
  kind: z.ZodLiteral<"record-id">;
8578
9012
  recordId: z.ZodString;
8579
9013
  }, z.core.$strict>], "kind">>>;
9014
+ frontDoor: z.ZodOptional<z.ZodObject<{
9015
+ id: z.ZodString;
9016
+ displayName: z.ZodString;
9017
+ resourcePicker: z.ZodOptional<z.ZodObject<{
9018
+ effect: z.ZodEnum<{
9019
+ selection: "selection";
9020
+ "resource-grant": "resource-grant";
9021
+ }>;
9022
+ mimeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
9023
+ successNote: z.ZodOptional<z.ZodString>;
9024
+ }, z.core.$strict>>;
9025
+ }, z.core.$strict>>;
8580
9026
  }, z.core.$strict>>>;
8581
9027
  storage: z.ZodOptional<z.ZodArray<z.ZodObject<{
8582
9028
  kind: z.ZodEnum<{
package/dist/index.js CHANGED
@@ -136,7 +136,7 @@ var JsonSchema = z2.record(z2.string(), JsonValue);
136
136
  // packages/plugin-protocol/dist/common.js
137
137
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
138
138
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
139
- var KAY_PLUGIN_SDK_VERSION = "0.13.9";
139
+ var KAY_PLUGIN_SDK_VERSION = "0.13.10";
140
140
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
141
141
  "0.8.0",
142
142
  "0.8.1",
@@ -163,7 +163,8 @@ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
163
163
  "0.13.5",
164
164
  "0.13.6",
165
165
  "0.13.7",
166
- "0.13.8"
166
+ "0.13.8",
167
+ "0.13.9"
167
168
  ];
168
169
  var KAY_PLUGIN_TARGET_NAMES = [
169
170
  "kay.agent",
@@ -1093,6 +1094,31 @@ import { z as z8 } from "zod";
1093
1094
 
1094
1095
  // packages/plugin-protocol/dist/permissions.js
1095
1096
  import { z as z7 } from "zod";
1097
+
1098
+ // packages/plugin-protocol/dist/ids.js
1099
+ function resolvePluginNamespace(pluginId, namespace) {
1100
+ return namespace ?? pluginId;
1101
+ }
1102
+ function resolveGlobalContributionId(namespace, localId) {
1103
+ return `${namespace}.${localId}`;
1104
+ }
1105
+ function deriveDirectoryPluginToolName(namespace, localId) {
1106
+ return `${namespace.replaceAll(".", "_")}_${localId}`;
1107
+ }
1108
+ function resolvePluginEventType(namespace, localId) {
1109
+ return resolveGlobalContributionId(namespace, localId);
1110
+ }
1111
+ function isQualifiedAuthServiceRef(ref) {
1112
+ return ref.includes(".");
1113
+ }
1114
+ function isQualifiedAuthSchemeRef(ref) {
1115
+ return ref.includes(".");
1116
+ }
1117
+ function resolveAdapterId(globalId, declaredAdapterId) {
1118
+ return declaredAdapterId ?? globalId;
1119
+ }
1120
+
1121
+ // packages/plugin-protocol/dist/permissions.js
1096
1122
  var AuthGrantOperation = z7.enum([
1097
1123
  "status",
1098
1124
  "connect",
@@ -1121,6 +1147,26 @@ var ScopeRequirement = z7.strictObject({
1121
1147
  purpose: NonEmptyString,
1122
1148
  alternatives: z7.array(ScopeAlternative).min(1)
1123
1149
  });
1150
+ var AuthGrantFrontDoor = z7.strictObject({
1151
+ /**
1152
+ * The door id: the id `service_connect` takes (`gmail`). Never a registered auth service's id, and
1153
+ * not the grant's `service`, which names the shared sign-in the door expands.
1154
+ */
1155
+ id: LocalContributionId,
1156
+ displayName: NonEmptyString.max(120),
1157
+ /**
1158
+ * A file picker the connect runs. `resource-grant`: the scope reaches only picked files, so a
1159
+ * first connect chains into a pick. `selection`: the scope already reaches every file of the
1160
+ * type, and the pick only records which ones the person meant.
1161
+ */
1162
+ resourcePicker: z7.strictObject({
1163
+ effect: z7.enum(["selection", "resource-grant"]),
1164
+ /** The file types the picker offers. */
1165
+ mimeTypes: z7.array(NonEmptyString.max(255)).min(1).max(32).optional(),
1166
+ /** What the agent is told about the picked set once the pick lands. */
1167
+ successNote: NonEmptyString.max(2048).optional()
1168
+ }).optional()
1169
+ });
1124
1170
  var AuthGrantRequestBase = z7.strictObject({
1125
1171
  // A local (undotted) service must be declared in this same manifest; a
1126
1172
  // qualified (dotted) service names another plugin's global id and is an
@@ -1145,9 +1191,17 @@ var AuthGrantRequestBase = z7.strictObject({
1145
1191
  connectScopes: z7.array(NonEmptyString).min(1).optional(),
1146
1192
  scopeRequirement: ScopeRequirement.optional(),
1147
1193
  scopeDefinitions: z7.array(AuthScopeDefinition).min(1).optional(),
1148
- accountSelectors: z7.array(AuthAccountSelector).min(1).optional()
1194
+ accountSelectors: z7.array(AuthAccountSelector).min(1).optional(),
1195
+ frontDoor: AuthGrantFrontDoor.optional()
1149
1196
  });
1150
1197
  function validateAuthGrantRequest(grant, ctx) {
1198
+ if (grant.frontDoor !== void 0 && !isQualifiedAuthServiceRef(grant.service)) {
1199
+ ctx.addIssue({
1200
+ code: "custom",
1201
+ path: ["frontDoor"],
1202
+ message: "frontDoor needs a shared service (a qualified ref such as google.account): a door expands another plugin's sign-in"
1203
+ });
1204
+ }
1151
1205
  if (grant.allowedScopes !== void 0 && grant.requiredScopes !== void 0) {
1152
1206
  ctx.addIssue({
1153
1207
  code: "custom",
@@ -2814,29 +2868,6 @@ function pluginIconShape(svg) {
2814
2868
  return "mark";
2815
2869
  }
2816
2870
 
2817
- // packages/plugin-protocol/dist/ids.js
2818
- function resolvePluginNamespace(pluginId, namespace) {
2819
- return namespace ?? pluginId;
2820
- }
2821
- function resolveGlobalContributionId(namespace, localId) {
2822
- return `${namespace}.${localId}`;
2823
- }
2824
- function deriveDirectoryPluginToolName(namespace, localId) {
2825
- return `${namespace.replaceAll(".", "_")}_${localId}`;
2826
- }
2827
- function resolvePluginEventType(namespace, localId) {
2828
- return resolveGlobalContributionId(namespace, localId);
2829
- }
2830
- function isQualifiedAuthServiceRef(ref) {
2831
- return ref.includes(".");
2832
- }
2833
- function isQualifiedAuthSchemeRef(ref) {
2834
- return ref.includes(".");
2835
- }
2836
- function resolveAdapterId(globalId, declaredAdapterId) {
2837
- return declaredAdapterId ?? globalId;
2838
- }
2839
-
2840
2871
  // packages/plugin-protocol/dist/manifest.js
2841
2872
  import { z as z10 } from "zod";
2842
2873
 
@@ -3117,11 +3148,60 @@ var PluginAuthSchemeDelegated = z10.strictObject({
3117
3148
  kind: z10.literal("delegated"),
3118
3149
  scopes: z10.array(NonEmptyString).optional()
3119
3150
  });
3151
+ var ExternalCliArgument = z10.string().min(1).max(16384).refine((value) => ![...value].some(isUnsafeArgumentCharacter), {
3152
+ message: "an argument may hold tabs and line breaks, but no other control character, no invisible character and no bidirectional override"
3153
+ });
3154
+ function isUnsafeArgumentCharacter(character) {
3155
+ const code = character.codePointAt(0) ?? 0;
3156
+ return code <= 31 && code !== 9 && code !== 10 || code >= 127 && code <= 159 || code === 1564 || code >= 8203 && code <= 8207 || code === 8232 || code === 8233 || code >= 8234 && code <= 8238 || code >= 8288 && code <= 8297 || code === 65279;
3157
+ }
3158
+ var ExternalCliCommand = z10.string().max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._+-]*$/, {
3159
+ message: "a command is an executable's basename (letters, digits, '.', '_', '+', '-'), never a path"
3160
+ });
3161
+ var ExternalCliHint = NonEmptyString.max(2048);
3162
+ var ExternalCliArguments = z10.array(ExternalCliArgument).max(64);
3163
+ var PluginExternalCliConnect = z10.strictObject({
3164
+ /** A basename the host finds on `PATH` (`osascript`, `wrangler`), never a path. */
3165
+ binary: ExternalCliCommand,
3166
+ probe: z10.strictObject({
3167
+ args: ExternalCliArguments.min(1),
3168
+ timeoutMs: z10.number().int().min(1).max(12e4).optional(),
3169
+ /**
3170
+ * The CLI's own signed-out marker: text a failed probe's output (stderr, else stdout) contains
3171
+ * when the CLI is signed out. A failure that carries it is a sign-in problem, and only such a
3172
+ * failure runs `login`; a failure without it (a timeout, a provider outage) is reported as
3173
+ * unavailable. Required when `login` is declared, so a timeout never starts a sign-in.
3174
+ */
3175
+ signedOutMarker: ExternalCliArgument.refine((value) => value.trim() !== "", { message: "a signed-out marker needs text beyond whitespace" }).optional()
3176
+ }),
3177
+ /** The CLI's interactive sign-in. Absent: connect only probes and reports. */
3178
+ login: z10.strictObject({
3179
+ args: ExternalCliArguments.min(1),
3180
+ timeoutMs: z10.number().int().min(1).max(6e5).optional()
3181
+ }).optional(),
3182
+ /**
3183
+ * The command that installs `binary`, as an argv. Bonsai never runs it: a surface shows it, joined
3184
+ * for display, or hands it to an agent session that runs it behind the ordinary bash approval.
3185
+ * Absent for a binary the OS ships (`osascript`).
3186
+ */
3187
+ install: z10.strictObject({ command: ExternalCliCommand, args: ExternalCliArguments }).optional(),
3188
+ /** Prose for a person: `install` when the binary is missing, `login` when the probe fails. */
3189
+ hints: z10.strictObject({ install: ExternalCliHint, login: ExternalCliHint })
3190
+ }).superRefine((cli, ctx) => {
3191
+ if (cli.login !== void 0 && cli.probe.signedOutMarker === void 0) {
3192
+ ctx.addIssue({
3193
+ code: "custom",
3194
+ path: ["probe", "signedOutMarker"],
3195
+ message: "a CLI connect that declares login needs probe.signedOutMarker, so only a signed-out probe runs login"
3196
+ });
3197
+ }
3198
+ });
3120
3199
  var PluginAuthSchemeExternalCli = z10.strictObject({
3121
3200
  ...PluginAuthSchemeDescriptionFields,
3122
3201
  localId: LocalContributionId,
3123
3202
  kind: z10.literal("external-cli"),
3124
- scopes: z10.array(NonEmptyString).optional()
3203
+ scopes: z10.array(NonEmptyString).optional(),
3204
+ cli: PluginExternalCliConnect.optional()
3125
3205
  });
3126
3206
  var PluginAuthScheme = z10.discriminatedUnion("kind", [
3127
3207
  PluginAuthSchemeOAuth2,
@@ -3706,6 +3786,21 @@ var KayPluginManifestV1 = z10.strictObject({
3706
3786
  message: `permission references unknown auth service ${grant.service}`
3707
3787
  });
3708
3788
  }
3789
+ if (grant.frontDoor !== void 0) {
3790
+ if (target !== "kay.agent") {
3791
+ ctx.addIssue({
3792
+ code: "custom",
3793
+ path: ["permissions", "byTarget", target, "auth"],
3794
+ message: "frontDoor is read only on a kay.agent auth grant"
3795
+ });
3796
+ } else if (manifest.namespace !== void 0 && grant.service.startsWith(`${manifest.namespace}.`) && authServices.has(grant.service.slice(manifest.namespace.length + 1))) {
3797
+ ctx.addIssue({
3798
+ code: "custom",
3799
+ path: ["permissions", "byTarget", target, "auth"],
3800
+ message: `frontDoor needs another plugin's sign-in; ${grant.service} is this plugin's own`
3801
+ });
3802
+ }
3803
+ }
3709
3804
  if (!isQualifiedAuthServiceRef(grant.service)) {
3710
3805
  const declaredSchemes = authSchemeIdsByService.get(grant.service);
3711
3806
  for (const scheme of grant.schemes ?? []) {
@@ -4095,7 +4190,9 @@ var ResolvedPluginAuthSchemeExternalCli = z11.strictObject({
4095
4190
  localId: LocalContributionId,
4096
4191
  globalId: GlobalContributionId,
4097
4192
  kind: z11.literal("external-cli"),
4098
- scopes: z11.array(z11.string()).optional()
4193
+ scopes: z11.array(z11.string()).optional(),
4194
+ /** The manifest's connect facts, verbatim. */
4195
+ cli: PluginExternalCliConnect.optional()
4099
4196
  });
4100
4197
  var ResolvedPluginAuthScheme = z11.discriminatedUnion("kind", [
4101
4198
  ResolvedPluginAuthSchemeOAuth2,
@@ -4396,7 +4493,8 @@ function resolveAuthServices(namespace, manifest) {
4396
4493
  kind: scheme.kind,
4397
4494
  ...scopesField,
4398
4495
  ...descriptionFields,
4399
- ...provisioningField
4496
+ ...provisioningField,
4497
+ ...scheme.kind === "external-cli" && scheme.cli !== void 0 ? { cli: structuredClone(scheme.cli) } : {}
4400
4498
  };
4401
4499
  })
4402
4500
  }));
@@ -4887,6 +4985,180 @@ var CorpusResourceInvocationQuery = z14.strictObject({
4887
4985
  message: "since must precede until"
4888
4986
  });
4889
4987
 
4988
+ // packages/plugin-protocol/dist/skill-suggestion-evidence.js
4989
+ var UUID = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
4990
+ var UUID_ID = new RegExp(`^${UUID}$`, "i");
4991
+ var ENTRY = "[a-z0-9_-]+";
4992
+ var ENTRY_ID = new RegExp(`^${ENTRY}$`, "i");
4993
+ var FRICTION_URI = /^friction:\/\/([a-z0-9]+(?:-[a-z0-9]+)*)$/;
4994
+ var normalizeId = (value) => UUID_ID.test(value) ? value.toLowerCase() : value;
4995
+ function sessionPattern(options) {
4996
+ const known = (options.sessionIds ?? []).filter((id) => ENTRY_ID.test(id) && !UUID_ID.test(id)).map((id) => id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
4997
+ return `(?:${[UUID, ...new Set(known)].join("|")})`;
4998
+ }
4999
+ function sessionRef(sessionId, entryId, raw) {
5000
+ return entryId === void 0 ? { kind: "session", sessionId: normalizeId(sessionId), raw } : {
5001
+ kind: "message",
5002
+ sessionId: normalizeId(sessionId),
5003
+ entryId: normalizeId(entryId),
5004
+ raw
5005
+ };
5006
+ }
5007
+ function parseToken(raw, sessions) {
5008
+ if (/^sessions?:\/\//i.test(raw)) {
5009
+ const match = /^sessions?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/i.exec(raw);
5010
+ if (match === null)
5011
+ return void 0;
5012
+ const sessionId = match[1].replace(/\.jsonl$/i, "");
5013
+ if (!new RegExp(`^${sessions}$`, "i").test(sessionId))
5014
+ return void 0;
5015
+ const path = match[2];
5016
+ if (path !== "" && path !== "/" && !new RegExp(`^/${ENTRY}$`, "i").test(path))
5017
+ return void 0;
5018
+ const query = new URLSearchParams(match[3]);
5019
+ const entryId = query.get("entry") ?? query.get("span") ?? query.get("from") ?? (path.length > 1 ? path.slice(1) : match[4]);
5020
+ if (entryId !== void 0 && !ENTRY_ID.test(entryId))
5021
+ return void 0;
5022
+ return sessionRef(sessionId, entryId, raw);
5023
+ }
5024
+ if (/^friction:\/\//i.test(raw)) {
5025
+ const reference = FRICTION_URI.exec(raw)?.[1];
5026
+ return reference === void 0 || reference === "summary" ? void 0 : { kind: "friction", reference, raw };
5027
+ }
5028
+ if (/^[a-z][a-z0-9+.-]*:\/\//i.test(raw)) {
5029
+ return { kind: "uri", uri: raw, raw };
5030
+ }
5031
+ const message = new RegExp(`^(${sessions})(?:\\.jsonl)?(?:[/#](${ENTRY})(?:#[0-9]+)?)?$`, "i").exec(raw);
5032
+ return message === null ? void 0 : sessionRef(message[1], message[2], raw);
5033
+ }
5034
+ function findSkillSuggestionCitations(text, options = {}) {
5035
+ const sessions = sessionPattern(options);
5036
+ const tokens = new RegExp(`(?<![\\w/.:#-])(?:[a-z][a-z0-9+.-]*://[^\\s<>\`"'|\\[\\]()]+|${sessions}(?:\\.jsonl)?(?:[/#]${ENTRY}(?:#[0-9]+)?)?(?![\\w/#-]))`, "gi");
5037
+ const citations = [];
5038
+ for (const match of text.matchAll(tokens)) {
5039
+ const raw = match[0].replace(/[.,;:!?]+$/u, "");
5040
+ if (new RegExp(`^${UUID}(?:#[0-9]+)?$`, "i").test(raw) && /\b(?:call|result)(?:\s*:\s*|\s+)$/i.test(text.slice(0, match.index)))
5041
+ continue;
5042
+ const ref = parseToken(raw, sessions);
5043
+ if (ref !== void 0)
5044
+ citations.push({
5045
+ start: match.index,
5046
+ end: match.index + raw.length,
5047
+ ref
5048
+ });
5049
+ }
5050
+ const sessionIds = new Set(citations.flatMap(({ ref }) => ref.kind === "message" || ref.kind === "session" && ref.raw.indexOf("://") >= 0 ? [ref.sessionId] : []));
5051
+ if (sessionIds.size === 1) {
5052
+ const sessionId = [...sessionIds][0];
5053
+ const relative = new RegExp(`\\b(?:call|result)(?:\\s*:\\s*|\\s+)((?:${UUID}|[0-9a-f]{8,32}|[0-9]+)|${ENTRY}(?=#[0-9]+))(?:#[0-9]+)?(?![\\w/#-])`, "gi");
5054
+ for (const match of text.matchAll(relative)) {
5055
+ const start = match.index;
5056
+ const end = start + match[0].length;
5057
+ if (citations.some((item) => start < item.end && end > item.start))
5058
+ continue;
5059
+ citations.push({
5060
+ start,
5061
+ end,
5062
+ ref: sessionRef(sessionId, match[1], match[0])
5063
+ });
5064
+ }
5065
+ }
5066
+ return citations.sort((a, b) => a.start - b.start);
5067
+ }
5068
+ function skillSuggestionEvidenceKey(item) {
5069
+ switch (item.kind) {
5070
+ case "message":
5071
+ return `message:${item.sessionId}/${item.entryId}`;
5072
+ case "session":
5073
+ return `session:${item.sessionId}`;
5074
+ case "friction":
5075
+ return `friction:${item.reference}`;
5076
+ case "uri":
5077
+ return `uri:${item.uri}`;
5078
+ case "text":
5079
+ return `text:${item.text.trim()}`;
5080
+ }
5081
+ }
5082
+ function skillSuggestionEvidenceItems(evidence, options = {}) {
5083
+ const items = [];
5084
+ const keys = /* @__PURE__ */ new Set();
5085
+ const visited = /* @__PURE__ */ new WeakSet();
5086
+ const add = (item) => {
5087
+ const key = skillSuggestionEvidenceKey(item);
5088
+ if (keys.has(key))
5089
+ return;
5090
+ keys.add(key);
5091
+ items.push(item);
5092
+ };
5093
+ const text = (value) => {
5094
+ const citations = findSkillSuggestionCitations(value, options);
5095
+ if (citations.length === 0) {
5096
+ if (value.trim() !== "")
5097
+ add({ kind: "text", text: value });
5098
+ return;
5099
+ }
5100
+ let cursor = 0;
5101
+ const rest = [];
5102
+ for (const citation of citations) {
5103
+ rest.push(value.slice(cursor, citation.start));
5104
+ cursor = citation.end;
5105
+ }
5106
+ rest.push(value.slice(cursor));
5107
+ const note = rest.join(" ").trim();
5108
+ if (citations.every(({ ref }) => ref.kind === "uri") && /[\p{L}\p{N}]/u.test(note)) {
5109
+ add({ kind: "text", text: value });
5110
+ return;
5111
+ }
5112
+ for (const citation of citations)
5113
+ add(citation.ref);
5114
+ if (/[\p{L}\p{N}]/u.test(note.replace(/\b(?:call|result|view|pointer|and)\b/gi, "")))
5115
+ add({ kind: "text", text: note.replace(/^[\s|,;`]+|[\s|,;`]+$/g, "") });
5116
+ };
5117
+ const visit = (value, depth) => {
5118
+ if (value === null || value === void 0)
5119
+ return;
5120
+ if (typeof value === "string")
5121
+ return text(value);
5122
+ if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint")
5123
+ return text(String(value));
5124
+ if (typeof value !== "object" || visited.has(value))
5125
+ return;
5126
+ visited.add(value);
5127
+ if (depth >= 32) {
5128
+ add({ kind: "text", text: "[evidence nested too deeply]" });
5129
+ return;
5130
+ }
5131
+ if (Array.isArray(value)) {
5132
+ for (const entry of value)
5133
+ visit(entry, depth + 1);
5134
+ return;
5135
+ }
5136
+ const object = value;
5137
+ const sessionId = object.sessionId;
5138
+ const entryId = object.entryId ?? object.messageId;
5139
+ if (typeof sessionId === "string" && ENTRY_ID.test(sessionId) && (entryId === void 0 || typeof entryId === "string" && ENTRY_ID.test(entryId))) {
5140
+ add(sessionRef(sessionId, entryId, `sessions://${sessionId}${entryId === void 0 ? "" : `/${entryId}`}`));
5141
+ return;
5142
+ }
5143
+ if (object.kind === "text" && typeof object.text === "string") {
5144
+ text(object.text);
5145
+ return;
5146
+ }
5147
+ if (object.kind === "friction" && typeof object.reference === "string") {
5148
+ text(`friction://${object.reference}`);
5149
+ return;
5150
+ }
5151
+ if (object.kind === "uri" && typeof object.uri === "string") {
5152
+ text(object.uri);
5153
+ return;
5154
+ }
5155
+ for (const entry of Object.values(object))
5156
+ visit(entry, depth + 1);
5157
+ };
5158
+ visit(evidence, 0);
5159
+ return items;
5160
+ }
5161
+
4890
5162
  // packages/plugin-protocol/dist/ui-app-package.js
4891
5163
  import { z as z15 } from "zod";
4892
5164
  var KAY_UI_APP_PACKAGE_PROTOCOL = "kay.ui.app-package.v1";
@@ -5041,6 +5313,7 @@ export {
5041
5313
  ArtifactProvenanceSource,
5042
5314
  ArtifactUriModuleContribution,
5043
5315
  AuthAccountSelector,
5316
+ AuthGrantFrontDoor,
5044
5317
  AuthGrantOperation,
5045
5318
  AuthGrantRequest,
5046
5319
  AuthSchemeReference,
@@ -5130,6 +5403,7 @@ export {
5130
5403
  PluginConfigSectionManifest,
5131
5404
  PluginContributionKind,
5132
5405
  PluginEventDefinitionContribution,
5406
+ PluginExternalCliConnect,
5133
5407
  PluginId,
5134
5408
  PluginNamespace,
5135
5409
  PluginNotificationRuleContribution,
@@ -5241,6 +5515,7 @@ export {
5241
5515
  dedupeClaims,
5242
5516
  deriveDirectoryPluginToolName,
5243
5517
  finalizeArtifactProvenanceEnvelope,
5518
+ findSkillSuggestionCitations,
5244
5519
  hasClaim,
5245
5520
  hostWithinDomain,
5246
5521
  isCompatible,
@@ -5277,6 +5552,8 @@ export {
5277
5552
  satisfiesSemverRange,
5278
5553
  sessionHealthEntrySchema,
5279
5554
  sessionHealthPWellDecile,
5555
+ skillSuggestionEvidenceItems,
5556
+ skillSuggestionEvidenceKey,
5280
5557
  turnMessageOrigin,
5281
5558
  turnPacket,
5282
5559
  urlHostWithinDomain,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.13.9",
3
+ "version": "0.13.10",
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",