@yaklabs-ai/plugin-protocol 0.31.0 → 0.32.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.31.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.32.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.31.0",
4
+ "version": "0.32.0",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [],
package/dist/index.d.ts CHANGED
@@ -106,6 +106,13 @@ export declare const AppDataSourceContribution: z.ZodObject<{
106
106
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
107
107
  }, z.core.$strict>;
108
108
  }, z.core.$strict>>;
109
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
110
+ shape: z.ZodLiteral<"rows">;
111
+ rowsField: z.ZodString;
112
+ key: z.ZodArray<z.ZodString>;
113
+ }, z.core.$strict>, z.ZodObject<{
114
+ shape: z.ZodLiteral<"value">;
115
+ }, z.core.$strict>], "shape">>;
109
116
  }, z.core.$strict>;
110
117
 
111
118
  export declare type AppDataSourceContribution = z.infer<typeof AppDataSourceContribution>;
@@ -2365,6 +2372,13 @@ declare const canonicalContributionSchemas: {
2365
2372
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
2366
2373
  }, z.core.$strict>;
2367
2374
  }, z.core.$strict>>;
2375
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2376
+ shape: z.ZodLiteral<"rows">;
2377
+ rowsField: z.ZodString;
2378
+ key: z.ZodArray<z.ZodString>;
2379
+ }, z.core.$strict>, z.ZodObject<{
2380
+ shape: z.ZodLiteral<"value">;
2381
+ }, z.core.$strict>], "shape">>;
2368
2382
  }, z.core.$strict>;
2369
2383
  WhiteboardTypeStorage: z.ZodDiscriminatedUnion<[z.ZodObject<{
2370
2384
  kind: z.ZodLiteral<"json">;
@@ -3991,8 +4005,12 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
3991
4005
  * `contributes` names each entry's title, page, shortcut and icon file. It replaces `activityRail` on a
3992
4006
  * UI app, which is stripped from a manifest that still carries it, so that manifest loses only the
3993
4007
  * rail button. A plugin that declares a rail entry declares ^0.31.0.
4008
+ *
4009
+ * 0.32.0 lets an app-data source declare its window store as data (#15891). `store` under
4010
+ * `contributes.dataSources` replaces a `kay.ui` data materializer, and a change too big for a live
4011
+ * update becomes a re-read of the snapshot. A plugin that declares a store declares ^0.32.0.
3994
4012
  */
3995
- export declare const KAY_PLUGIN_SDK_VERSION: "0.31.0";
4013
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.32.0";
3996
4014
 
3997
4015
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
3998
4016
 
@@ -4491,6 +4509,13 @@ export declare const KayAppTargetManifest: z.ZodObject<{
4491
4509
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
4492
4510
  }, z.core.$strict>;
4493
4511
  }, z.core.$strict>>;
4512
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
4513
+ shape: z.ZodLiteral<"rows">;
4514
+ rowsField: z.ZodString;
4515
+ key: z.ZodArray<z.ZodString>;
4516
+ }, z.core.$strict>, z.ZodObject<{
4517
+ shape: z.ZodLiteral<"value">;
4518
+ }, z.core.$strict>], "shape">>;
4494
4519
  }, z.core.$strict>>>;
4495
4520
  whiteboardTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
4496
4521
  localId: z.ZodString;
@@ -5255,6 +5280,13 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5255
5280
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
5256
5281
  }, z.core.$strict>;
5257
5282
  }, z.core.$strict>>;
5283
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
5284
+ shape: z.ZodLiteral<"rows">;
5285
+ rowsField: z.ZodString;
5286
+ key: z.ZodArray<z.ZodString>;
5287
+ }, z.core.$strict>, z.ZodObject<{
5288
+ shape: z.ZodLiteral<"value">;
5289
+ }, z.core.$strict>], "shape">>;
5258
5290
  }, z.core.$strict>>>;
5259
5291
  whiteboardTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
5260
5292
  localId: z.ZodString;
@@ -10639,6 +10671,13 @@ export declare const ResolvedKayAppDataSource: z.ZodObject<{
10639
10671
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
10640
10672
  }, z.core.$strict>;
10641
10673
  }, z.core.$strict>>;
10674
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
10675
+ shape: z.ZodLiteral<"rows">;
10676
+ rowsField: z.ZodString;
10677
+ key: z.ZodArray<z.ZodString>;
10678
+ }, z.core.$strict>, z.ZodObject<{
10679
+ shape: z.ZodLiteral<"value">;
10680
+ }, z.core.$strict>], "shape">>;
10642
10681
  }, z.core.$strict>;
10643
10682
 
10644
10683
  export declare type ResolvedKayAppDataSource = z.infer<typeof ResolvedKayAppDataSource>;
@@ -11911,6 +11950,13 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
11911
11950
  schema: z.ZodRecord<z.ZodString, z.ZodType<authoringCommonSchemas.JsonValue, unknown, z.core.$ZodTypeInternals<authoringCommonSchemas.JsonValue, unknown>>>;
11912
11951
  }, z.core.$strict>;
11913
11952
  }, z.core.$strict>>;
11953
+ store: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
11954
+ shape: z.ZodLiteral<"rows">;
11955
+ rowsField: z.ZodString;
11956
+ key: z.ZodArray<z.ZodString>;
11957
+ }, z.core.$strict>, z.ZodObject<{
11958
+ shape: z.ZodLiteral<"value">;
11959
+ }, z.core.$strict>], "shape">>;
11914
11960
  }, z.core.$strict>>>;
11915
11961
  kayAppWhiteboardTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
11916
11962
  localId: z.ZodString;
package/dist/index.js CHANGED
@@ -230,13 +230,14 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
230
230
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
231
231
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
232
232
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
233
- var KAY_PLUGIN_SDK_VERSION = "0.31.0";
233
+ var KAY_PLUGIN_SDK_VERSION = "0.32.0";
234
234
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
235
235
  "0.26.3",
236
236
  "0.27.1",
237
237
  "0.28.0",
238
238
  "0.29.0",
239
- "0.30.0"
239
+ "0.30.0",
240
+ "0.31.0"
240
241
  ];
241
242
  var KAY_PLUGIN_TARGET_NAMES = [
242
243
  "kay.agent",
@@ -3095,6 +3096,14 @@ function createContributionsSchemas(canonical) {
3095
3096
  knownResources: true,
3096
3097
  describesOperations: true
3097
3098
  });
3099
+ const AppDataSourceStore = z12.discriminatedUnion("shape", [
3100
+ z12.strictObject({
3101
+ shape: z12.literal("rows"),
3102
+ rowsField: NonEmptyString3,
3103
+ key: z12.array(NonEmptyString3).min(1)
3104
+ }),
3105
+ z12.strictObject({ shape: z12.literal("value") })
3106
+ ]);
3098
3107
  const AppDataSourceContribution2 = z12.strictObject({
3099
3108
  localId: LocalContributionId2,
3100
3109
  scope: z12.enum(["runtime", "account", "session"]),
@@ -3115,7 +3124,8 @@ function createContributionsSchemas(canonical) {
3115
3124
  })
3116
3125
  ]).optional()
3117
3126
  }),
3118
- read: AppDataSourceRead.optional()
3127
+ read: AppDataSourceRead.optional(),
3128
+ store: AppDataSourceStore.optional()
3119
3129
  }).superRefine((source, ctx) => {
3120
3130
  if (source.read !== void 0 && source.scope !== "session") {
3121
3131
  ctx.addIssue({
@@ -3124,6 +3134,23 @@ function createContributionsSchemas(canonical) {
3124
3134
  message: "App-data read operations require session scope."
3125
3135
  });
3126
3136
  }
3137
+ if (source.store === void 0)
3138
+ return;
3139
+ if (source.scope === "session") {
3140
+ ctx.addIssue({
3141
+ code: "custom",
3142
+ path: ["store"],
3143
+ message: "A declared app-data store requires runtime or account scope."
3144
+ });
3145
+ }
3146
+ const replaces = source.change.semantics?.kind === "snapshot-replacement";
3147
+ if (replaces !== (source.store.shape === "value")) {
3148
+ ctx.addIssue({
3149
+ code: "custom",
3150
+ path: ["store"],
3151
+ message: "A value store requires snapshot-replacement changes, and a rows store forbids them."
3152
+ });
3153
+ }
3127
3154
  });
3128
3155
  const WhiteboardTypeStorage2 = z12.discriminatedUnion("kind", [
3129
3156
  z12.strictObject({ kind: z12.literal("json") }),
@@ -4291,6 +4318,7 @@ function createManifestSchemas(canonical) {
4291
4318
  }
4292
4319
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "notificationRules"], manifest.targets?.kay?.app?.contributes?.notificationRules, "notification rule");
4293
4320
  const declaredAppDataSources = new Set(manifest.targets?.kay?.app?.contributes?.dataSources?.map((source) => source.localId) ?? []);
4321
+ const declaredAppDataStores = new Set(manifest.targets?.kay?.app?.contributes?.dataSources?.filter((source) => source.store !== void 0).map((source) => source.localId) ?? []);
4294
4322
  const materializedAppDataSources = /* @__PURE__ */ new Set();
4295
4323
  for (const [index, materializer] of (manifest.targets?.kay?.ui?.contributes?.dataMaterializers ?? []).entries()) {
4296
4324
  if (!declaredAppDataSources.has(materializer.source)) {
@@ -4323,15 +4351,30 @@ function createManifestSchemas(canonical) {
4323
4351
  message: `app-data source ${materializer.source} has more than one materializer`
4324
4352
  });
4325
4353
  }
4354
+ if (declaredAppDataStores.has(materializer.source)) {
4355
+ ctx.addIssue({
4356
+ code: "custom",
4357
+ path: [
4358
+ "targets",
4359
+ "kay",
4360
+ "ui",
4361
+ "contributes",
4362
+ "dataMaterializers",
4363
+ index,
4364
+ "source"
4365
+ ],
4366
+ message: `app-data source ${materializer.source} declares a store and a materializer`
4367
+ });
4368
+ }
4326
4369
  materializedAppDataSources.add(materializer.source);
4327
4370
  }
4328
4371
  for (const source of declaredAppDataSources) {
4329
- if (materializedAppDataSources.has(source))
4372
+ if (materializedAppDataSources.has(source) || declaredAppDataStores.has(source))
4330
4373
  continue;
4331
4374
  ctx.addIssue({
4332
4375
  code: "custom",
4333
4376
  path: ["targets", "kay", "app", "contributes", "dataSources"],
4334
- message: `app-data source ${source} has no same-plugin UI materializer`
4377
+ message: `app-data source ${source} has no declared store and no same-plugin UI materializer`
4335
4378
  });
4336
4379
  }
4337
4380
  reportDuplicateLocalIds(ctx, ["targets", "kay", "app", "contributes", "whiteboardTypes"], manifest.targets?.kay?.app?.contributes?.whiteboardTypes, "Whiteboard type");
@@ -5128,7 +5171,15 @@ function createResolvedContractSchemas(canonical) {
5128
5171
  })
5129
5172
  ]).optional()
5130
5173
  }),
5131
- read: AppDataSourceRead.optional()
5174
+ read: AppDataSourceRead.optional(),
5175
+ store: z14.discriminatedUnion("shape", [
5176
+ z14.strictObject({
5177
+ shape: z14.literal("rows"),
5178
+ rowsField: z14.string().min(1),
5179
+ key: z14.array(z14.string().min(1)).min(1)
5180
+ }),
5181
+ z14.strictObject({ shape: z14.literal("value") })
5182
+ ]).optional()
5132
5183
  }).superRefine((source, ctx) => {
5133
5184
  if (source.read !== void 0 && source.scope !== "session") {
5134
5185
  ctx.addIssue({
@@ -5769,7 +5820,8 @@ function resolveKayPluginContractV1(manifest) {
5769
5820
  scope: source.scope,
5770
5821
  snapshot: source.snapshot,
5771
5822
  change: source.change,
5772
- ...source.read === void 0 ? {} : { read: source.read }
5823
+ ...source.read === void 0 ? {} : { read: source.read },
5824
+ ...source.store === void 0 ? {} : { store: source.store }
5773
5825
  }));
5774
5826
  const kayAppApprovalTypes = manifest.targets?.kay?.app?.contributes?.approvalTypes?.map(({ uriModule, ...type }) => {
5775
5827
  const authService = manifest.targets?.kay?.agent?.contributes?.uriModules?.find((candidate) => candidate.localId === uriModule)?.authService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.31.0",
3
+ "version": "0.32.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",