@yaklabs-ai/plugin-protocol 0.48.0 → 0.49.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/dist/index.js CHANGED
@@ -260,14 +260,8 @@ var JsonSchema = z4.record(z4.string(), JsonValue);
260
260
  var KAY_PLUGIN_MANIFEST_SIZE_CAP_BYTES = 1024 * 1024;
261
261
  var KAY_PLUGIN_PROTOCOL_VERSION = "kay.plugin.v1";
262
262
  var KAY_PLUGIN_PROTOCOL_PACKAGE_NAME = "@bonsai/plugin-protocol";
263
- var KAY_PLUGIN_SDK_VERSION = "0.48.0";
264
- var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [
265
- "0.47.0",
266
- "0.42.0",
267
- "0.42.1",
268
- "0.43.0",
269
- "0.44.0"
270
- ];
263
+ var KAY_PLUGIN_SDK_VERSION = "0.49.0";
264
+ var KAY_PLUGIN_COMPATIBLE_SDK_VERSIONS = [];
271
265
  var KAY_PLUGIN_TARGET_NAMES = [
272
266
  "kay.agent",
273
267
  "kay.app",
@@ -1730,7 +1724,9 @@ function retiredPermissionAsksIn(rawManifest) {
1730
1724
  // packages/plugin-protocol/dist/authority.js
1731
1725
  var RETIRED_PLUGIN_CAPABILITY_SLUGS = [
1732
1726
  "filesystem.read",
1733
- "filesystem.write"
1727
+ "filesystem.write",
1728
+ "memory.read",
1729
+ "memory.write"
1734
1730
  ];
1735
1731
  var RENAMED_PLUGIN_CAPABILITY_SLUGS = {
1736
1732
  "jev.use": "systemOne.use",
@@ -1744,8 +1740,7 @@ var PLUGIN_CAPABILITY_SLUGS = [
1744
1740
  "process.spawn",
1745
1741
  "sessions.read",
1746
1742
  "signals.read",
1747
- "memory.read",
1748
- "memory.write",
1743
+ "uri.call",
1749
1744
  "skills.read",
1750
1745
  "skills.write",
1751
1746
  "skills.share",
@@ -1811,7 +1806,7 @@ var AGENT_PERMISSION_RULE_FIELDS = [
1811
1806
  "mode"
1812
1807
  ];
1813
1808
  function createAuthoritySchemas(canonical) {
1814
- const { ArtifactGenerationId: ArtifactGenerationId2, NonEmptyString: NonEmptyString3 } = canonical ? canonicalCommonSchemas : common_exports;
1809
+ const { ArtifactGenerationId: ArtifactGenerationId2, NonEmptyString: NonEmptyString3, UriScheme: UriScheme2 } = canonical ? canonicalCommonSchemas : common_exports;
1815
1810
  const { PluginAgentDefinitionPermissionRule: PluginAgentDefinitionPermissionRule2 } = canonical ? canonicalPermissionSchemas : permissions_exports;
1816
1811
  const WhiteboardCapabilityScope2 = z10.enum(["own-types", "all-types"]);
1817
1812
  const WhiteboardCapabilityOperation2 = z10.enum([
@@ -1902,14 +1897,12 @@ function createAuthoritySchemas(canonical) {
1902
1897
  envelope: z10.strictObject({})
1903
1898
  }),
1904
1899
  z10.strictObject({
1905
- target: z10.literal("kay.app"),
1906
- slug: z10.literal("memory.read"),
1907
- envelope: z10.strictObject({})
1908
- }),
1909
- z10.strictObject({
1910
- target: z10.literal("kay.app"),
1911
- slug: z10.literal("memory.write"),
1912
- envelope: z10.strictObject({})
1900
+ target: z10.enum(["kay.agent", "kay.app"]),
1901
+ slug: z10.literal("uri.call"),
1902
+ envelope: z10.strictObject({
1903
+ scheme: UriScheme2,
1904
+ verb: z10.enum(["read", "list", "search", "write", "edit", "delete"])
1905
+ })
1913
1906
  }),
1914
1907
  z10.strictObject({
1915
1908
  // Read every managed skill and its history: identity, versions, revisions, changes against
@@ -2255,8 +2248,6 @@ function sameClaim(a, b) {
2255
2248
  case "sessions.update":
2256
2249
  case "sessions.read":
2257
2250
  case "signals.read":
2258
- case "memory.read":
2259
- case "memory.write":
2260
2251
  case "skills.read":
2261
2252
  case "skills.write":
2262
2253
  case "skills.share":
@@ -2281,6 +2272,8 @@ function sameClaim(a, b) {
2281
2272
  case "model-selection.register":
2282
2273
  case "system-prompt.register":
2283
2274
  return true;
2275
+ case "uri.call":
2276
+ return b.slug === "uri.call" && a.envelope.scheme === b.envelope.scheme && a.envelope.verb === b.envelope.verb;
2284
2277
  case "network.connect":
2285
2278
  return b.slug === "network.connect" && a.envelope.connect === b.envelope.connect;
2286
2279
  case "web-session.request":
@@ -2342,8 +2335,6 @@ function envelopePairs(a, b) {
2342
2335
  case "sessions.update":
2343
2336
  case "sessions.read":
2344
2337
  case "signals.read":
2345
- case "memory.read":
2346
- case "memory.write":
2347
2338
  case "skills.read":
2348
2339
  case "skills.write":
2349
2340
  case "skills.share":
@@ -2368,6 +2359,11 @@ function envelopePairs(a, b) {
2368
2359
  case "model-selection.register":
2369
2360
  case "system-prompt.register":
2370
2361
  return [];
2362
+ case "uri.call":
2363
+ return b.slug === "uri.call" ? [
2364
+ [a.envelope.scheme, b.envelope.scheme],
2365
+ [a.envelope.verb, b.envelope.verb]
2366
+ ] : [];
2371
2367
  case "network.connect":
2372
2368
  return b.slug === "network.connect" ? [[a.envelope.connect, b.envelope.connect]] : [];
2373
2369
  case "web-session.request":
@@ -3381,7 +3377,7 @@ function createContributionsSchemas(canonical) {
3381
3377
  })).optional()
3382
3378
  }).optional()
3383
3379
  });
3384
- const ToolContribution2 = z12.strictObject({
3380
+ const ToolIdentity = z12.strictObject({
3385
3381
  localId: LocalContributionId2,
3386
3382
  toolName: PluginToolName2,
3387
3383
  displayName: OptionalDisplayName,
@@ -3393,7 +3389,34 @@ function createContributionsSchemas(canonical) {
3393
3389
  scheme: NonEmptyString3.optional(),
3394
3390
  resourcePrefix: z12.string().max(256).optional(),
3395
3391
  // Arguments whose string values name the resources a call touches.
3396
- resourceArgs: z12.array(NonEmptyString3).min(1).optional()
3392
+ resourceArgs: z12.array(NonEmptyString3).min(1).optional(),
3393
+ resourceTrim: z12.literal(true).optional(),
3394
+ defaultPermission: z12.enum(["allow", "ask", "never"]).optional(),
3395
+ /** First matching rule wins; every condition in its when list must hold. */
3396
+ classificationRules: z12.array(z12.strictObject({
3397
+ when: z12.array(z12.union([
3398
+ z12.strictObject({
3399
+ arg: NonEmptyString3,
3400
+ equals: z12.union([
3401
+ z12.string(),
3402
+ z12.number(),
3403
+ z12.boolean(),
3404
+ z12.null()
3405
+ ])
3406
+ }),
3407
+ z12.strictObject({ arg: NonEmptyString3, present: z12.boolean() })
3408
+ ])).min(1).max(32),
3409
+ kind: z12.enum(["read", "mutate", "destructive", "execute"]),
3410
+ ruleKey: NonEmptyString3.optional()
3411
+ })).min(1).max(64).optional()
3412
+ });
3413
+ const ToolContribution2 = z12.strictObject({
3414
+ ...ToolIdentity.shape,
3415
+ parameters: JsonSchema.optional(),
3416
+ executionMode: z12.enum(["sequential", "parallel"]).optional(),
3417
+ promptSnippet: NonEmptyString3.optional(),
3418
+ promptGuidelines: z12.array(NonEmptyString3).optional(),
3419
+ permission: ToolPermission2.optional()
3397
3420
  });
3398
3421
  const AgentToolContribution2 = z12.strictObject({
3399
3422
  ...ToolContribution2.shape,
@@ -3491,7 +3514,49 @@ function createContributionsSchemas(canonical) {
3491
3514
  }).exactOptional(),
3492
3515
  skills: z12.array(NonEmptyString3).exactOptional()
3493
3516
  });
3517
+ const ScreenActionOption = z12.discriminatedUnion("kind", [
3518
+ z12.strictObject({
3519
+ kind: z12.literal("exact"),
3520
+ description: NonEmptyString3,
3521
+ verb: z12.enum(["read", "write", "edit", "delete"]),
3522
+ uri: NonEmptyString3
3523
+ }),
3524
+ z12.strictObject({
3525
+ kind: z12.literal("catch-all"),
3526
+ description: NonEmptyString3,
3527
+ verb: z12.enum(["read", "write", "edit", "delete"])
3528
+ })
3529
+ ]);
3494
3530
  const UriModuleFactsShape = {
3531
+ screenActions: z12.strictObject({
3532
+ scheme: UriScheme2,
3533
+ hosts: z12.array(NonEmptyString3),
3534
+ paths: z12.array(NonEmptyString3).min(1).optional(),
3535
+ apps: z12.array(NonEmptyString3),
3536
+ options: z12.record(NonEmptyString3, ScreenActionOption)
3537
+ }).superRefine((catalog, ctx) => {
3538
+ if (catalog.hosts.length === 0 && catalog.apps.length === 0) {
3539
+ ctx.addIssue({
3540
+ code: "custom",
3541
+ message: "screen actions need a host or app"
3542
+ });
3543
+ }
3544
+ for (const [key, option] of Object.entries(catalog.options)) {
3545
+ if (key === "none")
3546
+ ctx.addIssue({
3547
+ code: "custom",
3548
+ path: ["options", key],
3549
+ message: "none is reserved"
3550
+ });
3551
+ if (option.kind === "exact" && !option.uri.startsWith(`${catalog.scheme}://`)) {
3552
+ ctx.addIssue({
3553
+ code: "custom",
3554
+ path: ["options", key, "uri"],
3555
+ message: "screen action URI must use its catalog scheme"
3556
+ });
3557
+ }
3558
+ }
3559
+ }).exactOptional(),
3495
3560
  /** Addresses the module answers, in match order; see `@herd/uri`'s `UriClaim`. */
3496
3561
  claims: z12.array(UriClaimContribution).min(1).exactOptional(),
3497
3562
  /** The module's routes, as its scheme-root `help` lists them. */
@@ -5419,6 +5484,35 @@ function createManifestSchemas(canonical) {
5419
5484
  for (const target of ["agent", "app"]) {
5420
5485
  const contributes = target === "agent" ? manifest.targets?.kay?.agent?.contributes : manifest.targets?.kay?.app?.contributes;
5421
5486
  for (const tool of contributes?.tools ?? []) {
5487
+ const toolPath = ["targets", "kay", target, "contributes", "tools"];
5488
+ if (tool.parameters === void 0 && tool.permission !== void 0 && target === "app") {
5489
+ ctx.addIssue({
5490
+ code: "custom",
5491
+ path: toolPath,
5492
+ message: `tool ${tool.localId} declares permission without parameters`
5493
+ });
5494
+ }
5495
+ if (tool.parameters !== void 0 && tool.description === void 0 && target === "app") {
5496
+ ctx.addIssue({
5497
+ code: "custom",
5498
+ path: toolPath,
5499
+ message: `tool ${tool.localId} declares parameters without a description`
5500
+ });
5501
+ }
5502
+ const properties = tool.parameters?.["properties"];
5503
+ const argumentsUsed = [
5504
+ ...target === "app" ? tool.permission?.resourceArgs ?? [] : [],
5505
+ ...(tool.permission?.classificationRules ?? []).flatMap((rule) => rule.when.map((condition) => condition.arg))
5506
+ ];
5507
+ for (const arg of argumentsUsed) {
5508
+ if (typeof properties !== "object" || properties === null || !Object.hasOwn(properties, arg)) {
5509
+ ctx.addIssue({
5510
+ code: "custom",
5511
+ path: toolPath,
5512
+ message: `tool ${tool.localId} names permission argument ${arg}, which is not a parameter`
5513
+ });
5514
+ }
5515
+ }
5422
5516
  const existing = toolNames.get(tool.toolName);
5423
5517
  if (existing !== void 0) {
5424
5518
  ctx.addIssue({
@@ -5429,6 +5523,15 @@ function createManifestSchemas(canonical) {
5429
5523
  }
5430
5524
  toolNames.set(tool.toolName, tool.localId);
5431
5525
  }
5526
+ for (const module of contributes?.uriModules ?? []) {
5527
+ if (module.screenActions !== void 0 && !module.schemes.includes(module.screenActions.scheme)) {
5528
+ ctx.addIssue({
5529
+ code: "custom",
5530
+ path: ["targets", "kay", target, "contributes", "uriModules"],
5531
+ message: `screen actions must use a scheme owned by module ${module.localId}`
5532
+ });
5533
+ }
5534
+ }
5432
5535
  }
5433
5536
  const converterMimeTypes = /* @__PURE__ */ new Map();
5434
5537
  for (const converter of manifest.targets?.kay?.agent?.contributes?.converters ?? []) {
@@ -6064,7 +6167,7 @@ function createResolvedContractSchemas(canonical) {
6064
6167
  }).optional(),
6065
6168
  permission: canonical ? canonicalContributionSchemas.ToolPermission.optional() : ToolPermission.optional()
6066
6169
  });
6067
- const ResolvedKayAppTool2 = ResolvedKayToolId;
6170
+ const ResolvedKayAppTool2 = ResolvedKayAgentTool2.omit({ requiresAuth: true });
6068
6171
  const ResolvedKayAppDataSource2 = z14.strictObject({
6069
6172
  localId: LocalContributionId2,
6070
6173
  globalId: GlobalContributionId2,
@@ -6750,6 +6853,7 @@ function resolveKayPluginContractV1(manifest) {
6750
6853
  ...tool.permission === void 0 ? {} : { permission: tool.permission }
6751
6854
  }));
6752
6855
  const kayAppTools = manifest.targets?.kay?.app?.contributes?.tools?.map((tool) => ({
6856
+ ...tool,
6753
6857
  localId: tool.localId,
6754
6858
  globalId: resolveGlobalContributionId(namespace, tool.localId),
6755
6859
  toolName: tool.toolName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaklabs-ai/plugin-protocol",
3
- "version": "0.48.0",
3
+ "version": "0.49.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",