@yaklabs-ai/plugin-protocol 0.54.0 → 0.54.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.54.0"
14
+ "@bonsai/plugin-protocol": "npm:@yaklabs-ai/plugin-protocol@^0.54.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.54.0",
4
+ "version": "0.54.1",
5
5
  "target": "npm",
6
6
  "firstPartyLicense": "MIT",
7
7
  "bundled": [
package/dist/index.d.ts CHANGED
@@ -3305,7 +3305,10 @@ declare const canonicalContributionSchemas: {
3305
3305
  plugins: "plugins";
3306
3306
  }>>;
3307
3307
  badge: z.ZodOptional<z.ZodObject<{
3308
- source: z.ZodString;
3308
+ source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3309
+ pluginId: z.ZodString;
3310
+ localId: z.ZodString;
3311
+ }, z.core.$strict>]>;
3309
3312
  where: z.ZodOptional<z.ZodString>;
3310
3313
  label: z.ZodObject<{
3311
3314
  one: z.ZodOptional<z.ZodString>;
@@ -3315,11 +3318,9 @@ declare const canonicalContributionSchemas: {
3315
3318
  panel: z.ZodOptional<z.ZodObject<{
3316
3319
  body: z.ZodString;
3317
3320
  }, z.core.$strict>>;
3318
- featureFlagVariant: z.ZodOptional<z.ZodObject<{
3321
+ visibleWhen: z.ZodOptional<z.ZodObject<{
3319
3322
  flag: z.ZodString;
3320
- title: z.ZodOptional<z.ZodString>;
3321
- icon: z.ZodOptional<z.ZodString>;
3322
- panel: z.ZodOptional<z.ZodLiteral<false>>;
3323
+ enabled: z.ZodBoolean;
3323
3324
  }, z.core.$strict>>;
3324
3325
  }, z.core.$strict>;
3325
3326
  UiToastPreviewContribution: z.ZodObject<{
@@ -4893,8 +4894,11 @@ export declare const KAY_PLUGIN_PROTOCOL_VERSION: "kay.plugin.v1";
4893
4894
  * 0.54.0 adds named UI host grants for shared configuration/auth/account reads, retained connection
4894
4895
  * progress/dismissal and support. Built-in-only page capability scopes are removed; executable
4895
4896
  * pages declare capabilities on apps[].
4897
+ *
4898
+ * 0.54.1 adds manifest-declared plugin workers on both backend targets and exposes the canonical
4899
+ * transcript placement and answer-stretch rules through the SDK.
4896
4900
  */
4897
- export declare const KAY_PLUGIN_SDK_VERSION: "0.54.0";
4901
+ export declare const KAY_PLUGIN_SDK_VERSION: "0.54.1";
4898
4902
 
4899
4903
  export declare const KAY_PLUGIN_TARGET_NAMES: readonly ["kay.agent", "kay.app", "kay.ui"];
4900
4904
 
@@ -5844,6 +5848,10 @@ export declare const KayPluginManifestV1: z.ZodObject<{
5844
5848
  icon: z.ZodOptional<z.ZodString>;
5845
5849
  iconDark: z.ZodOptional<z.ZodString>;
5846
5850
  namespace: z.ZodOptional<z.ZodString>;
5851
+ workers: z.ZodOptional<z.ZodArray<z.ZodObject<{
5852
+ localId: z.ZodString;
5853
+ module: z.ZodString;
5854
+ }, z.core.$strict>>>;
5847
5855
  targets: z.ZodOptional<z.ZodObject<{
5848
5856
  kay: z.ZodOptional<z.ZodObject<{
5849
5857
  agent: z.ZodOptional<z.ZodObject<{
@@ -6932,7 +6940,10 @@ export declare const KayPluginManifestV1: z.ZodObject<{
6932
6940
  plugins: "plugins";
6933
6941
  }>>;
6934
6942
  badge: z.ZodOptional<z.ZodObject<{
6935
- source: z.ZodString;
6943
+ source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
6944
+ pluginId: z.ZodString;
6945
+ localId: z.ZodString;
6946
+ }, z.core.$strict>]>;
6936
6947
  where: z.ZodOptional<z.ZodString>;
6937
6948
  label: z.ZodObject<{
6938
6949
  one: z.ZodOptional<z.ZodString>;
@@ -6942,11 +6953,9 @@ export declare const KayPluginManifestV1: z.ZodObject<{
6942
6953
  panel: z.ZodOptional<z.ZodObject<{
6943
6954
  body: z.ZodString;
6944
6955
  }, z.core.$strict>>;
6945
- featureFlagVariant: z.ZodOptional<z.ZodObject<{
6956
+ visibleWhen: z.ZodOptional<z.ZodObject<{
6946
6957
  flag: z.ZodString;
6947
- title: z.ZodOptional<z.ZodString>;
6948
- icon: z.ZodOptional<z.ZodString>;
6949
- panel: z.ZodOptional<z.ZodLiteral<false>>;
6958
+ enabled: z.ZodBoolean;
6950
6959
  }, z.core.$strict>>;
6951
6960
  }, z.core.$strict>>>;
6952
6961
  toastPreviews: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -8301,7 +8310,10 @@ export declare const KayUiTargetManifest: z.ZodObject<{
8301
8310
  plugins: "plugins";
8302
8311
  }>>;
8303
8312
  badge: z.ZodOptional<z.ZodObject<{
8304
- source: z.ZodString;
8313
+ source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
8314
+ pluginId: z.ZodString;
8315
+ localId: z.ZodString;
8316
+ }, z.core.$strict>]>;
8305
8317
  where: z.ZodOptional<z.ZodString>;
8306
8318
  label: z.ZodObject<{
8307
8319
  one: z.ZodOptional<z.ZodString>;
@@ -8311,11 +8323,9 @@ export declare const KayUiTargetManifest: z.ZodObject<{
8311
8323
  panel: z.ZodOptional<z.ZodObject<{
8312
8324
  body: z.ZodString;
8313
8325
  }, z.core.$strict>>;
8314
- featureFlagVariant: z.ZodOptional<z.ZodObject<{
8326
+ visibleWhen: z.ZodOptional<z.ZodObject<{
8315
8327
  flag: z.ZodString;
8316
- title: z.ZodOptional<z.ZodString>;
8317
- icon: z.ZodOptional<z.ZodString>;
8318
- panel: z.ZodOptional<z.ZodLiteral<false>>;
8328
+ enabled: z.ZodBoolean;
8319
8329
  }, z.core.$strict>>;
8320
8330
  }, z.core.$strict>>>;
8321
8331
  toastPreviews: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -14063,6 +14073,10 @@ export declare const ResolvedPluginContractV1: z.ZodObject<{
14063
14073
  consumesAuthServices: z.ZodArray<z.ZodString>;
14064
14074
  explicitDependencies: z.ZodArray<z.ZodString>;
14065
14075
  dataDirSharedWith: z.ZodOptional<z.ZodString>;
14076
+ workers: z.ZodOptional<z.ZodArray<z.ZodObject<{
14077
+ localId: z.ZodString;
14078
+ module: z.ZodString;
14079
+ }, z.core.$strict>>>;
14066
14080
  workloadPurposes: z.ZodOptional<z.ZodArray<z.ZodObject<{
14067
14081
  purpose: z.ZodString;
14068
14082
  workloadClass: z.ZodEnum<{
@@ -17398,7 +17412,10 @@ export declare const UiRailEntryContribution: z.ZodObject<{
17398
17412
  plugins: "plugins";
17399
17413
  }>>;
17400
17414
  badge: z.ZodOptional<z.ZodObject<{
17401
- source: z.ZodString;
17415
+ source: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
17416
+ pluginId: z.ZodString;
17417
+ localId: z.ZodString;
17418
+ }, z.core.$strict>]>;
17402
17419
  where: z.ZodOptional<z.ZodString>;
17403
17420
  label: z.ZodObject<{
17404
17421
  one: z.ZodOptional<z.ZodString>;
@@ -17408,11 +17425,9 @@ export declare const UiRailEntryContribution: z.ZodObject<{
17408
17425
  panel: z.ZodOptional<z.ZodObject<{
17409
17426
  body: z.ZodString;
17410
17427
  }, z.core.$strict>>;
17411
- featureFlagVariant: z.ZodOptional<z.ZodObject<{
17428
+ visibleWhen: z.ZodOptional<z.ZodObject<{
17412
17429
  flag: z.ZodString;
17413
- title: z.ZodOptional<z.ZodString>;
17414
- icon: z.ZodOptional<z.ZodString>;
17415
- panel: z.ZodOptional<z.ZodLiteral<false>>;
17430
+ enabled: z.ZodBoolean;
17416
17431
  }, z.core.$strict>>;
17417
17432
  }, z.core.$strict>;
17418
17433
 
package/dist/index.js CHANGED
@@ -30,12 +30,6 @@ function declaredUiIconPaths(manifest) {
30
30
  const contributes = manifest.targets?.kay?.ui?.contributes;
31
31
  return [
32
32
  ...(contributes?.railEntries ?? []).flatMap((entry) => entry.icon === void 0 ? [] : [{ label: `kay.ui rail entry '${entry.id}' icon`, path: entry.icon }]),
33
- ...(contributes?.railEntries ?? []).flatMap((entry) => entry.featureFlagVariant?.icon === void 0 ? [] : [
34
- {
35
- label: "kay.ui rail variant icon",
36
- path: entry.featureFlagVariant.icon
37
- }
38
- ]),
39
33
  ...(contributes?.pages ?? []).flatMap((page) => page.icon === void 0 ? [] : [{ label: `kay.ui page '${page.id}' icon`, path: page.icon }]),
40
34
  ...(contributes?.commands ?? []).flatMap((command) => command.icon === void 0 ? [] : [
41
35
  {
@@ -266,8 +260,9 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
266
260
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
267
261
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
268
262
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
269
- var KAY_PLUGIN_SDK_VERSION = "0.54.0";
263
+ var KAY_PLUGIN_SDK_VERSION = "0.54.1";
270
264
  var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
265
+ "0.54.0",
271
266
  "0.53.0",
272
267
  "0.52.1",
273
268
  "0.52.0",
@@ -4520,7 +4515,7 @@ function createContributionsSchemas(canonical) {
4520
4515
  }
4521
4516
  });
4522
4517
  const UiRailBadge = z14.strictObject({
4523
- source: LocalContributionId2,
4518
+ source: UiAppCapabilityReference2,
4524
4519
  where: NonEmptyString3.optional(),
4525
4520
  label: z14.strictObject({
4526
4521
  one: NonEmptyString3.optional(),
@@ -4549,12 +4544,7 @@ function createContributionsSchemas(canonical) {
4549
4544
  section: z14.enum(["primary", "plugins"]).optional(),
4550
4545
  badge: UiRailBadge.optional(),
4551
4546
  panel: z14.strictObject({ body: LocalContributionId2 }).optional(),
4552
- featureFlagVariant: z14.strictObject({
4553
- flag: NonEmptyString3,
4554
- title: NonEmptyString3.optional(),
4555
- icon: PackageAssetPath2.optional(),
4556
- panel: z14.literal(false).optional()
4557
- }).optional()
4547
+ visibleWhen: z14.strictObject({ flag: NonEmptyString3, enabled: z14.boolean() }).optional()
4558
4548
  });
4559
4549
  const UiToastPreviewContribution2 = z14.strictObject({
4560
4550
  rule: LocalContributionId2,
@@ -5356,6 +5346,10 @@ function createManifestSchemas(canonical) {
5356
5346
  icon: PackageAssetPath2.optional(),
5357
5347
  iconDark: PackageAssetPath2.optional(),
5358
5348
  namespace: PluginNamespace2.optional(),
5349
+ workers: z18.array(z18.strictObject({
5350
+ localId: LocalContributionId2,
5351
+ module: PackageAssetPath2
5352
+ })).optional(),
5359
5353
  targets: z18.strictObject({
5360
5354
  kay: z18.strictObject({
5361
5355
  agent: KayAgentTargetManifest2.optional(),
@@ -5388,6 +5382,7 @@ function createManifestSchemas(canonical) {
5388
5382
  plugins: z18.array(PluginId2).optional()
5389
5383
  }).optional()
5390
5384
  }).superRefine((manifest, ctx) => {
5385
+ reportDuplicateLocalIds(ctx, ["workers"], manifest.workers, "worker");
5391
5386
  const sharedWith = manifest.storage?.dataDir?.sharedWith;
5392
5387
  if (sharedWith !== void 0 && (!manifest.storage?.dataDir?.enabled || sharedWith === manifest.id || !manifest.dependencies?.plugins?.includes(sharedWith))) {
5393
5388
  ctx.addIssue({
@@ -5552,7 +5547,7 @@ function createManifestSchemas(canonical) {
5552
5547
  index,
5553
5548
  "badge"
5554
5549
  ];
5555
- if (!declaredRowsStores.has(entry.badge.source)) {
5550
+ if (typeof entry.badge.source === "string" && !declaredRowsStores.has(entry.badge.source)) {
5556
5551
  ctx.addIssue({
5557
5552
  code: "custom",
5558
5553
  path: [...path, "source"],
@@ -6972,6 +6967,10 @@ function createResolvedContractSchemas(canonical) {
6972
6967
  // full dependency graph together with auth-inferred edges from `consumesAuthServices`.
6973
6968
  explicitDependencies: z19.array(PluginId2),
6974
6969
  dataDirSharedWith: PluginId2.optional(),
6970
+ workers: z19.array(z19.strictObject({
6971
+ localId: LocalContributionId2,
6972
+ module: PackageAssetPath2
6973
+ })).optional(),
6975
6974
  workloadPurposes: z19.array(PluginWorkloadPurpose).optional(),
6976
6975
  shellCommands: z19.array(PluginShellCommand.omit({ endpoint: true }).extend({
6977
6976
  endpointId: GlobalContributionId2
@@ -7538,6 +7537,7 @@ function resolveKayPluginContractV1(manifest) {
7538
7537
  ...manifest.dependencies?.plugins ?? []
7539
7538
  ],
7540
7539
  authServices,
7540
+ ...manifest.workers === void 0 ? {} : { workers: manifest.workers },
7541
7541
  ...manifest.storage?.dataDir?.sharedWith === void 0 ? {} : { dataDirSharedWith: manifest.storage.dataDir.sharedWith },
7542
7542
  ...manifest.workloadPurposes === void 0 ? {} : { workloadPurposes: manifest.workloadPurposes },
7543
7543
  ...manifest.shellCommands === void 0 ? {} : {
@@ -7714,6 +7714,17 @@ async function judgeKayPluginDirectory(input) {
7714
7714
  return refuse("contract-resolve", "path-escapes-plugin-dir", `${reference.label} path '${reference.path}' resolves outside the plugin directory (no symlink escapes, no traversal)`);
7715
7715
  }
7716
7716
  }
7717
+ for (const worker of manifest.workers ?? []) {
7718
+ let entry;
7719
+ try {
7720
+ entry = await tree.entry(worker.module);
7721
+ } catch {
7722
+ return refuse("contract-resolve", "invalid-worker-module", "A declared worker module could not be inspected.");
7723
+ }
7724
+ if (entry?.kind !== "file") {
7725
+ return refuse("contract-resolve", "invalid-worker-module", `worker '${worker.localId}' must name an existing regular file`);
7726
+ }
7727
+ }
7717
7728
  return {
7718
7729
  outcome: "loads",
7719
7730
  hostSdkVersion,
@@ -7789,7 +7800,10 @@ function namedIn(head) {
7789
7800
  return head.displayName === void 0 ? head.id : `${head.displayName} (${head.id})`;
7790
7801
  }
7791
7802
  function referencedPaths(manifest) {
7792
- const refs = [];
7803
+ const refs = (manifest.workers ?? []).map((worker) => ({
7804
+ label: `worker '${worker.localId}'`,
7805
+ path: worker.module
7806
+ }));
7793
7807
  const kayAgent = manifest.targets?.kay?.agent;
7794
7808
  if (kayAgent !== void 0) {
7795
7809
  refs.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.54.0",
3
+ "version": "0.54.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",