@yaklabs-ai/plugin-protocol 0.27.0 → 0.27.1

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.27.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.27.1"
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.27.0",
4
+ "version": "0.27.1",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -2039,6 +2039,7 @@ declare const canonicalContributionSchemas: {
2039
2039
  }, z.core.$strict>;
2040
2040
  UriModuleContribution: z.ZodObject<{
2041
2041
  authService: z.ZodOptional<z.ZodString>;
2042
+ authScheme: z.ZodOptional<z.ZodString>;
2042
2043
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
2043
2044
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
2044
2045
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -3901,8 +3902,14 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
3901
3902
  * `write`. `app.approvals`, its `prepare`, `finalize` and `resolveResource` are gone, and a write can
3902
3903
  * refuse in the person's words with `UriProviderError.refusalMessage`. No plugin outside this repo
3903
3904
  * declared a card, so 0.26.3 stays served. A plugin that declares a card declares ^0.27.0.
3905
+ *
3906
+ * 0.27.1 lets a manifest URI module name the exact sign-in scheme its calls use, as a tool can
3907
+ * (#14928): `authScheme`, a scheme of the module's `authService`, local or another plugin's. A
3908
+ * hosted module's code and manifest must agree on it, and the daemon reads it to find an
3909
+ * external-CLI scheme without running the module. A module that runs in the daemon is unchanged,
3910
+ * so this is additive; a plugin whose manifest sets `authScheme` declares ^0.27.1.
3904
3911
  */
3905
- export declare const KAY_PLUGIN_SDK_VERSION: "0.27.0";
3912
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.27.1";
3906
3913
 
3907
3914
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
3908
3915
 
@@ -3954,6 +3961,7 @@ export declare const KayAgentTargetManifest: z.ZodObject<{
3954
3961
  }, z.core.$strict>>>;
3955
3962
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
3956
3963
  authService: z.ZodOptional<z.ZodString>;
3964
+ authScheme: z.ZodOptional<z.ZodString>;
3957
3965
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
3958
3966
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
3959
3967
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -4709,6 +4717,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
4709
4717
  }, z.core.$strict>>>;
4710
4718
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
4711
4719
  authService: z.ZodOptional<z.ZodString>;
4720
+ authScheme: z.ZodOptional<z.ZodString>;
4712
4721
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
4713
4722
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
4714
4723
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -6599,6 +6608,9 @@ export declare function mintOperation(input: OperationCaptureInput, clock?: Capt
6599
6608
  readonly gaps: readonly ArtifactProvenanceGap[];
6600
6609
  };
6601
6610
 
6611
+ /** The namespace of a qualified auth ref (`google` in `google.oauth`); empty for a local ref. */
6612
+ export declare function namespaceOfQualifiedRef(ref: string): string;
6613
+
6602
6614
  export declare const NonEmptyString: z.ZodString;
6603
6615
 
6604
6616
  /**
@@ -10344,6 +10356,7 @@ export declare const ResolvedKayAgentUriModule: z.ZodObject<{
10344
10356
  schemes: z.ZodArray<z.ZodString>;
10345
10357
  displayName: z.ZodOptional<z.ZodString>;
10346
10358
  authServiceId: z.ZodOptional<z.ZodString>;
10359
+ authSchemeId: z.ZodOptional<z.ZodString>;
10347
10360
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
10348
10361
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
10349
10362
  }, z.core.$strict>;
@@ -11560,6 +11573,7 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
11560
11573
  schemes: z.ZodArray<z.ZodString>;
11561
11574
  displayName: z.ZodOptional<z.ZodString>;
11562
11575
  authServiceId: z.ZodOptional<z.ZodString>;
11576
+ authSchemeId: z.ZodOptional<z.ZodString>;
11563
11577
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
11564
11578
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
11565
11579
  }, z.core.$strict>>>;
@@ -13535,6 +13549,7 @@ export declare type UiSlotContribution = z.infer<typeof UiSlotContribution>;
13535
13549
 
13536
13550
  export declare const UriModuleContribution: z.ZodObject<{
13537
13551
  authService: z.ZodOptional<z.ZodString>;
13552
+ authScheme: z.ZodOptional<z.ZodString>;
13538
13553
  knownResources: z.ZodOptional<z.ZodLiteral<true>>;
13539
13554
  describesOperations: z.ZodOptional<z.ZodLiteral<true>>;
13540
13555
  claims: z.ZodExactOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
package/dist/index.js CHANGED
@@ -222,7 +222,7 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
222
222
  // packages/plugin-protocol/dist/common.js
223
223
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
224
224
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
225
- var KAY_PLUGIN_SDK_VERSION = "0.27.0";
225
+ var KAY_PLUGIN_SDK_VERSION = "0.27.1";
226
226
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = ["0.26.3"];
227
227
  var KAY_PLUGIN_TARGET_NAMES = [
228
228
  "kay.agent",
@@ -1235,6 +1235,9 @@ function isQualifiedAuthServiceRef(ref) {
1235
1235
  function isQualifiedAuthSchemeRef(ref) {
1236
1236
  return ref.includes(".");
1237
1237
  }
1238
+ function namespaceOfQualifiedRef(ref) {
1239
+ return ref.slice(0, Math.max(0, ref.lastIndexOf(".")));
1240
+ }
1238
1241
  function resolveAdapterId(globalId, declaredAdapterId) {
1239
1242
  return declaredAdapterId ?? globalId;
1240
1243
  }
@@ -2817,7 +2820,7 @@ var PLUGIN_NOTIFICATION_RULE_HOST_KEYS = [
2817
2820
  ];
2818
2821
  function createContributionsSchemas(canonical) {
2819
2822
  const { PluginEventLocalId: PluginEventLocalId2 } = canonical ? canonicalPluginEventSchemas : plugin_events_exports;
2820
- const { AuthServiceReference: AuthServiceReference2, CliAuthEnvVarName: CliAuthEnvVarName2, CliBinaryName: CliBinaryName2, FileExtensionToken: FileExtensionToken2, GitBasicAuthUser: GitBasicAuthUser2, GitHostName: GitHostName2, LocalContributionId: LocalContributionId2, MimeTypeString: MimeTypeString2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginToolName: PluginToolName2, TargetEntrypoint: TargetEntrypoint2, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
2823
+ const { AuthSchemeReference: AuthSchemeReference2, AuthServiceReference: AuthServiceReference2, CliAuthEnvVarName: CliAuthEnvVarName2, CliBinaryName: CliBinaryName2, FileExtensionToken: FileExtensionToken2, GitBasicAuthUser: GitBasicAuthUser2, GitHostName: GitHostName2, LocalContributionId: LocalContributionId2, MimeTypeString: MimeTypeString2, NonEmptyString: NonEmptyString3, PackageAssetPath: PackageAssetPath2, PluginId: PluginId2, PluginToolName: PluginToolName2, TargetEntrypoint: TargetEntrypoint2, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
2821
2824
  const { ScopeRequirement: ScopeRequirement2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
2822
2825
  const OptionalDisplayName = NonEmptyString3.optional();
2823
2826
  const ApprovalCardValueName = z12.string().regex(/^[A-Za-z][A-Za-z0-9_]{0,63}$/u, "must be a plain field name");
@@ -3049,6 +3052,12 @@ function createContributionsSchemas(canonical) {
3049
3052
  // plugin's already-minted global id and is recorded, not resolved, here (see
3050
3053
  // `consumesAuthServices` on the resolved contract).
3051
3054
  authService: AuthServiceReference2.optional(),
3055
+ // A scheme of the module's `authService`: every call to this module must use exactly this
3056
+ // scheme. A local ref names a scheme of a service in this manifest; a dotted ref names a scheme
3057
+ // of another plugin's service (`google.oauth`). The daemon reads it here because it may hold
3058
+ // only the manifest (a plugin that runs in the plugin host), and the host refuses a module
3059
+ // whose code names a different one.
3060
+ authScheme: AuthSchemeReference2.optional(),
3052
3061
  // Opt this module's traffic into the daemon's known-resources ledger: the
3053
3062
  // HOST records the canonical URIs (plus title/summary/mime facts) that flow
3054
3063
  // through the module's successful read/list/search resolutions (a read only
@@ -3067,6 +3076,7 @@ function createContributionsSchemas(canonical) {
3067
3076
  const AppUriModuleContribution2 = UriModuleContribution2.omit({
3068
3077
  authActions: true,
3069
3078
  authService: true,
3079
+ authScheme: true,
3070
3080
  knownResources: true,
3071
3081
  describesOperations: true
3072
3082
  });
@@ -4434,6 +4444,13 @@ function createManifestSchemas(canonical) {
4434
4444
  message: `uri module ${module.localId} references unknown auth service ${module.authService}`
4435
4445
  });
4436
4446
  }
4447
+ if (module.authScheme !== void 0 && (module.authService === void 0 || (isQualifiedAuthServiceRef(module.authService) ? namespaceOfQualifiedRef(module.authScheme) !== namespaceOfQualifiedRef(module.authService) : authSchemeIdsByService.get(module.authService)?.has(module.authScheme) !== true))) {
4448
+ ctx.addIssue({
4449
+ code: "custom",
4450
+ path: ["targets", "kay", "agent", "contributes", "uriModules"],
4451
+ message: `uri module ${module.localId} names auth scheme ${module.authScheme}, which is not a scheme of its authService`
4452
+ });
4453
+ }
4437
4454
  }
4438
4455
  for (const [index, tool] of (manifest.targets?.kay?.agent?.contributes?.tools ?? []).entries()) {
4439
4456
  const path = ["targets", "kay", "agent", "contributes", "tools", index];
@@ -5075,6 +5092,8 @@ function createResolvedContractSchemas(canonical) {
5075
5092
  schemes: z14.array(UriScheme2).min(1),
5076
5093
  displayName: NonEmptyString3.optional(),
5077
5094
  authServiceId: GlobalContributionId2.optional(),
5095
+ /** Mirrors `UriModuleContribution.authScheme`; a local ref takes the plugin's namespace. */
5096
+ authSchemeId: GlobalContributionId2.optional(),
5078
5097
  /** Mirrors `UriModuleContribution.knownResources` (host-side recording opt-in). */
5079
5098
  knownResources: z14.literal(true).optional(),
5080
5099
  /** Mirrors `UriModuleContribution.describesOperations`. */
@@ -5689,6 +5708,9 @@ function resolveKayPluginContractV1(manifest) {
5689
5708
  ...module.authService === void 0 ? {} : {
5690
5709
  authServiceId: isQualifiedAuthServiceRef(module.authService) ? module.authService : resolveGlobalContributionId(namespace, module.authService)
5691
5710
  },
5711
+ ...module.authScheme === void 0 ? {} : {
5712
+ authSchemeId: isQualifiedAuthSchemeRef(module.authScheme) ? module.authScheme : resolveGlobalContributionId(namespace, module.authScheme)
5713
+ },
5692
5714
  ...module.knownResources === void 0 ? {} : { knownResources: module.knownResources },
5693
5715
  ...module.describesOperations === void 0 ? {} : { describesOperations: module.describesOperations },
5694
5716
  ...uriModuleFacts(module)
@@ -5808,7 +5830,7 @@ function safeResolveKayPluginContractV1(manifest) {
5808
5830
  throw error;
5809
5831
  }
5810
5832
  }
5811
- function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, knownResources: _knownResources, describesOperations: _describesOperations, ...facts }) {
5833
+ function uriModuleFacts({ localId: _localId, schemes: _schemes, displayName: _displayName, authService: _authService, authScheme: _authScheme, knownResources: _knownResources, describesOperations: _describesOperations, ...facts }) {
5812
5834
  return facts;
5813
5835
  }
5814
5836
 
@@ -6765,6 +6787,7 @@ export {
6765
6787
  kayPluginHostCompatibility,
6766
6788
  kayUiEventSubscriptionsFromManifest,
6767
6789
  mintOperation,
6790
+ namespaceOfQualifiedRef,
6768
6791
  normalizeNetworkConnectHost,
6769
6792
  parseArtifactOutputUri,
6770
6793
  parseArtifactProvenanceCaptureContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
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",