@yaklabs-ai/plugin-protocol 0.41.0 → 0.42.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.41.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.42.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.41.0",
4
+ "version": "0.42.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -2515,6 +2515,12 @@ declare const canonicalContributionSchemas: {
2515
2515
  displayName: z.ZodOptional<z.ZodString>;
2516
2516
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
2517
2517
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
2518
+ auth: z.ZodOptional<z.ZodObject<{
2519
+ service: z.ZodString;
2520
+ schemes: z.ZodArray<z.ZodString>;
2521
+ purpose: z.ZodString;
2522
+ }, z.core.$strict>>;
2523
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
2518
2524
  }, z.core.$strict>;
2519
2525
  WorkflowContribution: z.ZodObject<{
2520
2526
  localId: z.ZodString;
@@ -2807,6 +2813,7 @@ declare const canonicalContributionSchemas: {
2807
2813
  "artifacts.read": "artifacts.read";
2808
2814
  "artifacts.preview": "artifacts.preview";
2809
2815
  "markdown.document-view": "markdown.document-view";
2816
+ "references.open": "references.open";
2810
2817
  "billing.read": "billing.read";
2811
2818
  "automations.read": "automations.read";
2812
2819
  "automations.run": "automations.run";
@@ -2823,6 +2830,7 @@ declare const canonicalContributionSchemas: {
2823
2830
  "artifacts.read": "artifacts.read";
2824
2831
  "artifacts.preview": "artifacts.preview";
2825
2832
  "markdown.document-view": "markdown.document-view";
2833
+ "references.open": "references.open";
2826
2834
  "billing.read": "billing.read";
2827
2835
  "automations.read": "automations.read";
2828
2836
  "automations.run": "automations.run";
@@ -2893,6 +2901,7 @@ declare const canonicalContributionSchemas: {
2893
2901
  "artifacts.read": "artifacts.read";
2894
2902
  "artifacts.preview": "artifacts.preview";
2895
2903
  "markdown.document-view": "markdown.document-view";
2904
+ "references.open": "references.open";
2896
2905
  "billing.read": "billing.read";
2897
2906
  "automations.read": "automations.read";
2898
2907
  "automations.run": "automations.run";
@@ -2927,6 +2936,7 @@ declare const canonicalContributionSchemas: {
2927
2936
  "artifacts.read": "artifacts.read";
2928
2937
  "artifacts.preview": "artifacts.preview";
2929
2938
  "markdown.document-view": "markdown.document-view";
2939
+ "references.open": "references.open";
2930
2940
  "billing.read": "billing.read";
2931
2941
  "automations.read": "automations.read";
2932
2942
  "automations.run": "automations.run";
@@ -3363,6 +3373,12 @@ export declare const EndpointContribution: z.ZodObject<{
3363
3373
  displayName: z.ZodOptional<z.ZodString>;
3364
3374
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
3365
3375
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
3376
+ auth: z.ZodOptional<z.ZodObject<{
3377
+ service: z.ZodString;
3378
+ schemes: z.ZodArray<z.ZodString>;
3379
+ purpose: z.ZodString;
3380
+ }, z.core.$strict>>;
3381
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
3366
3382
  }, z.core.$strict>;
3367
3383
 
3368
3384
  export declare type EndpointContribution = z.infer<typeof EndpointContribution>;
@@ -4239,8 +4255,12 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4239
4255
  *
4240
4256
  * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
4241
4257
  * servers, using Bonsai's managed connection without a session or working directory (#16172).
4258
+ *
4259
+ * 0.42.0 hands background work the shared ResolvedCredential in auth.credential. Workflow
4260
+ * accounts carry auth resolution outcomes, and Poller callbacks receive only the credential.
4261
+ * Older SDK ranges are refused because their background success shape is no longer served.
4242
4262
  */
4243
- export declare const KAY_PLUGIN_SDK_VERSION: "0.41.0";
4263
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
4244
4264
 
4245
4265
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4246
4266
 
@@ -4580,6 +4600,12 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4580
4600
  displayName: z.ZodOptional<z.ZodString>;
4581
4601
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
4582
4602
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
4603
+ auth: z.ZodOptional<z.ZodObject<{
4604
+ service: z.ZodString;
4605
+ schemes: z.ZodArray<z.ZodString>;
4606
+ purpose: z.ZodString;
4607
+ }, z.core.$strict>>;
4608
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
4583
4609
  }, z.core.$strict>>>;
4584
4610
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
4585
4611
  description: z.ZodExactOptional<z.ZodString>;
@@ -5352,6 +5378,12 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5352
5378
  displayName: z.ZodOptional<z.ZodString>;
5353
5379
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5354
5380
  responseSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5381
+ auth: z.ZodOptional<z.ZodObject<{
5382
+ service: z.ZodString;
5383
+ schemes: z.ZodArray<z.ZodString>;
5384
+ purpose: z.ZodString;
5385
+ }, z.core.$strict>>;
5386
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
5355
5387
  }, z.core.$strict>>>;
5356
5388
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5357
5389
  description: z.ZodExactOptional<z.ZodString>;
@@ -5840,6 +5872,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5840
5872
  "artifacts.read": "artifacts.read";
5841
5873
  "artifacts.preview": "artifacts.preview";
5842
5874
  "markdown.document-view": "markdown.document-view";
5875
+ "references.open": "references.open";
5843
5876
  "billing.read": "billing.read";
5844
5877
  "automations.read": "automations.read";
5845
5878
  "automations.run": "automations.run";
@@ -5874,6 +5907,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5874
5907
  "artifacts.read": "artifacts.read";
5875
5908
  "artifacts.preview": "artifacts.preview";
5876
5909
  "markdown.document-view": "markdown.document-view";
5910
+ "references.open": "references.open";
5877
5911
  "billing.read": "billing.read";
5878
5912
  "automations.read": "automations.read";
5879
5913
  "automations.run": "automations.run";
@@ -6742,6 +6776,7 @@ export declare const KayUiAppHostCapability: z.ZodEnum<{
6742
6776
  "artifacts.read": "artifacts.read";
6743
6777
  "artifacts.preview": "artifacts.preview";
6744
6778
  "markdown.document-view": "markdown.document-view";
6779
+ "references.open": "references.open";
6745
6780
  "billing.read": "billing.read";
6746
6781
  "automations.read": "automations.read";
6747
6782
  "automations.run": "automations.run";
@@ -6994,6 +7029,7 @@ export declare const KayUiTargetManifest: z.ZodObject<{
6994
7029
  "artifacts.read": "artifacts.read";
6995
7030
  "artifacts.preview": "artifacts.preview";
6996
7031
  "markdown.document-view": "markdown.document-view";
7032
+ "references.open": "references.open";
6997
7033
  "billing.read": "billing.read";
6998
7034
  "automations.read": "automations.read";
6999
7035
  "automations.run": "automations.run";
@@ -7028,6 +7064,7 @@ export declare const KayUiTargetManifest: z.ZodObject<{
7028
7064
  "artifacts.read": "artifacts.read";
7029
7065
  "artifacts.preview": "artifacts.preview";
7030
7066
  "markdown.document-view": "markdown.document-view";
7067
+ "references.open": "references.open";
7031
7068
  "billing.read": "billing.read";
7032
7069
  "automations.read": "automations.read";
7033
7070
  "automations.run": "automations.run";
@@ -11362,6 +11399,7 @@ export declare const ResolvedKayUiApp: z.ZodObject<{
11362
11399
  "artifacts.read": "artifacts.read";
11363
11400
  "artifacts.preview": "artifacts.preview";
11364
11401
  "markdown.document-view": "markdown.document-view";
11402
+ "references.open": "references.open";
11365
11403
  "billing.read": "billing.read";
11366
11404
  "automations.read": "automations.read";
11367
11405
  "automations.run": "automations.run";
@@ -12697,6 +12735,7 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12697
12735
  "artifacts.read": "artifacts.read";
12698
12736
  "artifacts.preview": "artifacts.preview";
12699
12737
  "markdown.document-view": "markdown.document-view";
12738
+ "references.open": "references.open";
12700
12739
  "billing.read": "billing.read";
12701
12740
  "automations.read": "automations.read";
12702
12741
  "automations.run": "automations.run";
@@ -14333,6 +14372,7 @@ export declare const UiAppCapabilities: z.ZodObject<{
14333
14372
  "artifacts.read": "artifacts.read";
14334
14373
  "artifacts.preview": "artifacts.preview";
14335
14374
  "markdown.document-view": "markdown.document-view";
14375
+ "references.open": "references.open";
14336
14376
  "billing.read": "billing.read";
14337
14377
  "automations.read": "automations.read";
14338
14378
  "automations.run": "automations.run";
@@ -14370,6 +14410,7 @@ export declare const UiAppContribution: z.ZodObject<{
14370
14410
  "artifacts.read": "artifacts.read";
14371
14411
  "artifacts.preview": "artifacts.preview";
14372
14412
  "markdown.document-view": "markdown.document-view";
14413
+ "references.open": "references.open";
14373
14414
  "billing.read": "billing.read";
14374
14415
  "automations.read": "automations.read";
14375
14416
  "automations.run": "automations.run";
@@ -14404,6 +14445,7 @@ export declare const UiAppContribution: z.ZodObject<{
14404
14445
  "artifacts.read": "artifacts.read";
14405
14446
  "artifacts.preview": "artifacts.preview";
14406
14447
  "markdown.document-view": "markdown.document-view";
14448
+ "references.open": "references.open";
14407
14449
  "billing.read": "billing.read";
14408
14450
  "automations.read": "automations.read";
14409
14451
  "automations.run": "automations.run";
package/dist/index.js CHANGED
@@ -254,25 +254,8 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
254
254
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
255
255
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
256
256
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
257
- var KAY_PLUGIN_SDK_VERSION = "0.41.0";
258
- var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
259
- "0.26.3",
260
- "0.27.1",
261
- "0.28.0",
262
- "0.29.0",
263
- "0.30.0",
264
- "0.31.0",
265
- "0.32.0",
266
- "0.33.0",
267
- "0.34.0",
268
- "0.35.0",
269
- "0.36.0",
270
- "0.37.0",
271
- "0.37.1",
272
- "0.38.0",
273
- "0.39.0",
274
- "0.40.0"
275
- ];
257
+ var KAY_PLUGIN_SDK_VERSION = "0.42.0";
258
+ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [];
276
259
  var KAY_PLUGIN_TARGET_NAMES = [
277
260
  "kay.agent",
278
261
  "kay.app",
@@ -3631,7 +3614,13 @@ function createContributionsSchemas(canonical) {
3631
3614
  localId: LocalContributionId2,
3632
3615
  displayName: OptionalDisplayName,
3633
3616
  requestSchema: JsonSchema.optional(),
3634
- responseSchema: JsonSchema.optional()
3617
+ responseSchema: JsonSchema.optional(),
3618
+ auth: z12.strictObject({
3619
+ service: AuthServiceReference2,
3620
+ schemes: z12.array(AuthSchemeReference2).min(1),
3621
+ purpose: NonEmptyString3
3622
+ }).optional(),
3623
+ timeoutMs: z12.number().int().positive().optional()
3635
3624
  });
3636
3625
  const WorkflowContribution2 = z12.strictObject({
3637
3626
  localId: LocalContributionId2,
@@ -3954,6 +3943,9 @@ function createContributionsSchemas(canonical) {
3954
3943
  // Draws Bonsai's markdown document view in the app's page (`BonsaiMarkdownDocumentView`).
3955
3944
  // It reads and saves nothing: the app supplies the text and keeps the edits.
3956
3945
  "markdown.document-view",
3946
+ // Draws links the host resolves and opens (`BonsaiReferencePill`, `BonsaiReferenceRow`,
3947
+ // `BonsaiReferenceMarkdown`). A person's click on one can open a session or another plugin's page.
3948
+ "references.open",
3957
3949
  // Server-rated organization billing, distinct from local/provider cost.
3958
3950
  "billing.read",
3959
3951
  "automations.read",
@@ -5113,6 +5105,53 @@ function createManifestSchemas(canonical) {
5113
5105
  });
5114
5106
  }
5115
5107
  }
5108
+ for (const [index, endpoint] of (manifest.targets?.kay?.app?.contributes?.endpoints ?? []).entries()) {
5109
+ const { auth } = endpoint;
5110
+ if (auth === void 0)
5111
+ continue;
5112
+ const path = [
5113
+ "targets",
5114
+ "kay",
5115
+ "app",
5116
+ "contributes",
5117
+ "endpoints",
5118
+ index,
5119
+ "auth"
5120
+ ];
5121
+ const qualified = isQualifiedAuthServiceRef(auth.service);
5122
+ const service = manifest.auth?.services?.find((candidate) => candidate.localId === auth.service);
5123
+ if (!qualified && service === void 0) {
5124
+ ctx.addIssue({
5125
+ code: "custom",
5126
+ path: [...path, "service"],
5127
+ message: `endpoint ${endpoint.localId} references unknown auth service ${auth.service}`
5128
+ });
5129
+ }
5130
+ for (const [schemeIndex, scheme] of auth.schemes.entries()) {
5131
+ if (qualified ? namespaceOfQualifiedRef(scheme) !== namespaceOfQualifiedRef(auth.service) : authSchemeIdsByService.get(auth.service)?.has(scheme) !== true) {
5132
+ ctx.addIssue({
5133
+ code: "custom",
5134
+ path: [...path, "schemes", schemeIndex],
5135
+ message: `endpoint ${endpoint.localId} names auth scheme ${scheme}, which is not a scheme of its auth service`
5136
+ });
5137
+ }
5138
+ }
5139
+ if (service !== void 0 && !service.purposes.includes(auth.purpose)) {
5140
+ ctx.addIssue({
5141
+ code: "custom",
5142
+ path: [...path, "purpose"],
5143
+ message: `endpoint ${endpoint.localId} references undeclared auth purpose ${auth.purpose}`
5144
+ });
5145
+ }
5146
+ const granted = manifest.permissions?.byTarget["kay.app"]?.auth?.some((grant) => grant.service === auth.service && grant.operations.includes("resolve") && (grant.purposes === void 0 || grant.purposes.includes(auth.purpose)) && auth.schemes.every((scheme) => grant.schemes === void 0 || grant.schemes.some((grantedScheme) => grantedScheme === scheme || !qualified && `${manifest.namespace ?? manifest.id}.${grantedScheme}` === scheme || !qualified && grantedScheme === `${manifest.namespace ?? manifest.id}.${scheme}`)));
5147
+ if (granted !== true) {
5148
+ ctx.addIssue({
5149
+ code: "custom",
5150
+ path,
5151
+ message: `endpoint ${endpoint.localId} needs a kay.app auth resolve grant admitting its schemes and purpose`
5152
+ });
5153
+ }
5154
+ }
5116
5155
  const syntheticContributionIds = collectSyntheticContributionIds(manifest);
5117
5156
  for (const contribution of collectDeclaredContributionIds(manifest)) {
5118
5157
  if (syntheticContributionIds.has(contribution.localId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.41.0",
3
+ "version": "0.42.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",