@yaklabs-ai/plugin-protocol 0.40.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.40.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.40.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>;
@@ -4236,8 +4252,15 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4236
4252
  * feed may now declare a `store`. It removes the `cost.read`, `skills.read`, `memory.read` and
4237
4253
  * `self-improvement.read` host capabilities, so a manifest still listing one no longer parses and
4238
4254
  * lists the feed instead. A plugin that lists feeds declares ^0.40.0.
4255
+ *
4256
+ * 0.41.0 adds app.mcp.callTool for background calls to a plugin's own manifest-declared MCP
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.
4239
4262
  */
4240
- export declare const KAY_PLUGIN_SDK_VERSION: "0.40.0";
4263
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.42.0";
4241
4264
 
4242
4265
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4243
4266
 
@@ -4577,6 +4600,12 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4577
4600
  displayName: z.ZodOptional<z.ZodString>;
4578
4601
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
4579
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>;
4580
4609
  }, z.core.$strict>>>;
4581
4610
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
4582
4611
  description: z.ZodExactOptional<z.ZodString>;
@@ -5349,6 +5378,12 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5349
5378
  displayName: z.ZodOptional<z.ZodString>;
5350
5379
  requestSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>>;
5351
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>;
5352
5387
  }, z.core.$strict>>>;
5353
5388
  uriModules: z.ZodOptional<z.ZodArray<z.ZodObject<{
5354
5389
  description: z.ZodExactOptional<z.ZodString>;
@@ -5837,6 +5872,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5837
5872
  "artifacts.read": "artifacts.read";
5838
5873
  "artifacts.preview": "artifacts.preview";
5839
5874
  "markdown.document-view": "markdown.document-view";
5875
+ "references.open": "references.open";
5840
5876
  "billing.read": "billing.read";
5841
5877
  "automations.read": "automations.read";
5842
5878
  "automations.run": "automations.run";
@@ -5871,6 +5907,7 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5871
5907
  "artifacts.read": "artifacts.read";
5872
5908
  "artifacts.preview": "artifacts.preview";
5873
5909
  "markdown.document-view": "markdown.document-view";
5910
+ "references.open": "references.open";
5874
5911
  "billing.read": "billing.read";
5875
5912
  "automations.read": "automations.read";
5876
5913
  "automations.run": "automations.run";
@@ -6739,6 +6776,7 @@ export declare const KayUiAppHostCapability: z.ZodEnum<{
6739
6776
  "artifacts.read": "artifacts.read";
6740
6777
  "artifacts.preview": "artifacts.preview";
6741
6778
  "markdown.document-view": "markdown.document-view";
6779
+ "references.open": "references.open";
6742
6780
  "billing.read": "billing.read";
6743
6781
  "automations.read": "automations.read";
6744
6782
  "automations.run": "automations.run";
@@ -6991,6 +7029,7 @@ export declare const KayUiTargetManifest: z.ZodObject<{
6991
7029
  "artifacts.read": "artifacts.read";
6992
7030
  "artifacts.preview": "artifacts.preview";
6993
7031
  "markdown.document-view": "markdown.document-view";
7032
+ "references.open": "references.open";
6994
7033
  "billing.read": "billing.read";
6995
7034
  "automations.read": "automations.read";
6996
7035
  "automations.run": "automations.run";
@@ -7025,6 +7064,7 @@ export declare const KayUiTargetManifest: z.ZodObject<{
7025
7064
  "artifacts.read": "artifacts.read";
7026
7065
  "artifacts.preview": "artifacts.preview";
7027
7066
  "markdown.document-view": "markdown.document-view";
7067
+ "references.open": "references.open";
7028
7068
  "billing.read": "billing.read";
7029
7069
  "automations.read": "automations.read";
7030
7070
  "automations.run": "automations.run";
@@ -11359,6 +11399,7 @@ export declare const ResolvedKayUiApp: z.ZodObject<{
11359
11399
  "artifacts.read": "artifacts.read";
11360
11400
  "artifacts.preview": "artifacts.preview";
11361
11401
  "markdown.document-view": "markdown.document-view";
11402
+ "references.open": "references.open";
11362
11403
  "billing.read": "billing.read";
11363
11404
  "automations.read": "automations.read";
11364
11405
  "automations.run": "automations.run";
@@ -12694,6 +12735,7 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
12694
12735
  "artifacts.read": "artifacts.read";
12695
12736
  "artifacts.preview": "artifacts.preview";
12696
12737
  "markdown.document-view": "markdown.document-view";
12738
+ "references.open": "references.open";
12697
12739
  "billing.read": "billing.read";
12698
12740
  "automations.read": "automations.read";
12699
12741
  "automations.run": "automations.run";
@@ -14330,6 +14372,7 @@ export declare const UiAppCapabilities: z.ZodObject<{
14330
14372
  "artifacts.read": "artifacts.read";
14331
14373
  "artifacts.preview": "artifacts.preview";
14332
14374
  "markdown.document-view": "markdown.document-view";
14375
+ "references.open": "references.open";
14333
14376
  "billing.read": "billing.read";
14334
14377
  "automations.read": "automations.read";
14335
14378
  "automations.run": "automations.run";
@@ -14367,6 +14410,7 @@ export declare const UiAppContribution: z.ZodObject<{
14367
14410
  "artifacts.read": "artifacts.read";
14368
14411
  "artifacts.preview": "artifacts.preview";
14369
14412
  "markdown.document-view": "markdown.document-view";
14413
+ "references.open": "references.open";
14370
14414
  "billing.read": "billing.read";
14371
14415
  "automations.read": "automations.read";
14372
14416
  "automations.run": "automations.run";
@@ -14401,6 +14445,7 @@ export declare const UiAppContribution: z.ZodObject<{
14401
14445
  "artifacts.read": "artifacts.read";
14402
14446
  "artifacts.preview": "artifacts.preview";
14403
14447
  "markdown.document-view": "markdown.document-view";
14448
+ "references.open": "references.open";
14404
14449
  "billing.read": "billing.read";
14405
14450
  "automations.read": "automations.read";
14406
14451
  "automations.run": "automations.run";
package/dist/index.js CHANGED
@@ -254,23 +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.40.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.1",
271
- "0.38.0",
272
- "0.39.0"
273
- ];
257
+ var KAY_PLUGIN_SDK_VERSION = "0.42.0";
258
+ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [];
274
259
  var KAY_PLUGIN_TARGET_NAMES = [
275
260
  "kay.agent",
276
261
  "kay.app",
@@ -3629,7 +3614,13 @@ function createContributionsSchemas(canonical) {
3629
3614
  localId: LocalContributionId2,
3630
3615
  displayName: OptionalDisplayName,
3631
3616
  requestSchema: JsonSchema.optional(),
3632
- 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()
3633
3624
  });
3634
3625
  const WorkflowContribution2 = z12.strictObject({
3635
3626
  localId: LocalContributionId2,
@@ -3952,6 +3943,9 @@ function createContributionsSchemas(canonical) {
3952
3943
  // Draws Bonsai's markdown document view in the app's page (`BonsaiMarkdownDocumentView`).
3953
3944
  // It reads and saves nothing: the app supplies the text and keeps the edits.
3954
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",
3955
3949
  // Server-rated organization billing, distinct from local/provider cost.
3956
3950
  "billing.read",
3957
3951
  "automations.read",
@@ -5111,6 +5105,53 @@ function createManifestSchemas(canonical) {
5111
5105
  });
5112
5106
  }
5113
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
+ }
5114
5155
  const syntheticContributionIds = collectSyntheticContributionIds(manifest);
5115
5156
  for (const contribution of collectDeclaredContributionIds(manifest)) {
5116
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.40.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",