@capybara-hq/plugin-tools 0.1.0-rc.5 → 0.1.0-rc.6

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.
@@ -22,7 +22,9 @@ export interface ToolRegistration {
22
22
  * - perm-hooks: the mount point of ctx.hooks.on(mount, …) is not in permissions.hooks (the mount
23
23
  * point must be a string literal or a same-file const, like the names below), or the options are
24
24
  * `{ mode: "policy" }` and the mount point is not in permissions.policyHooks;
25
- * - perm-reserved:用了尚未提供的 ctx.models。
25
+ * - perm-models: ctx.models is used but permissions.models is not declared (the purposes it may use
26
+ * are checked at run time);
27
+ * - perm-reserved: platform access that cannot be confirmed (a destructured ctx, a computed member).
26
28
  * 路由路径、工具名、能力 ref、界面 id 须是字符串字面量或本文件的 const;动态的写法报「无法静态确认」,
27
29
  * 豁免:`// capybara:allow-dynamic-permission <原因>`(行尾或紧邻上一行,原因必填)。
28
30
  * ctx 会跟踪本地别名,以及按位置传给同文件函数的参数。
@@ -129,7 +129,11 @@ function readManifest(obj, decls) {
129
129
  m.secrets = !!secrets && resolve(secrets.value, decls).value === true;
130
130
  const storage = prop(pe, "storage");
131
131
  m.storage = !!storage && resolve(storage.value, decls).value === true;
132
- m.models = !!prop(pe, "models");
132
+ // an empty list declares nothing (ctx.models is gated on at least one purpose)
133
+ const models = prop(pe, "models");
134
+ const me = models ? resolve(models.value, decls) : undefined;
135
+ m.models =
136
+ me !== undefined && !(me.type === "ArrayExpression" && me.elements.length === 0);
133
137
  for (const t of strings(prop(pe, "tools")?.value, decls))
134
138
  m.tools.add(t);
135
139
  for (const h of strings(prop(pe, "hooks")?.value, decls))
@@ -312,7 +316,9 @@ function scanSetup(f, m, decls, onTool, onCall) {
312
316
  }
313
317
  }
314
318
  else if (name === "models") {
315
- add(n, "perm-reserved", "ctx.models is reserved and not provided in this release; remove the access");
319
+ if (!m.models) {
320
+ add(n, "perm-models", "ctx.models is used but not declared; declare its purposes in permissions.models in the extension manifest");
321
+ }
316
322
  }
317
323
  else if (name === "http" ||
318
324
  name === "tools" ||
@@ -376,7 +382,9 @@ function scanFile(f, onTool, onCall) {
376
382
  * - perm-hooks: the mount point of ctx.hooks.on(mount, …) is not in permissions.hooks (the mount
377
383
  * point must be a string literal or a same-file const, like the names below), or the options are
378
384
  * `{ mode: "policy" }` and the mount point is not in permissions.policyHooks;
379
- * - perm-reserved:用了尚未提供的 ctx.models。
385
+ * - perm-models: ctx.models is used but permissions.models is not declared (the purposes it may use
386
+ * are checked at run time);
387
+ * - perm-reserved: platform access that cannot be confirmed (a destructured ctx, a computed member).
380
388
  * 路由路径、工具名、能力 ref、界面 id 须是字符串字面量或本文件的 const;动态的写法报「无法静态确认」,
381
389
  * 豁免:`// capybara:allow-dynamic-permission <原因>`(行尾或紧邻上一行,原因必填)。
382
390
  * ctx 会跟踪本地别名,以及按位置传给同文件函数的参数。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capybara-hq/plugin-tools",
3
- "version": "0.1.0-rc.5",
3
+ "version": "0.1.0-rc.6",
4
4
  "description": "Capybara plugin toolchain: the capybara-plugin CLI to pack, check and release Capybara plugins",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -51,12 +51,12 @@
51
51
  "esbuild": "0.28.2",
52
52
  "oxc-parser": "^0.154.0",
53
53
  "tar-stream": "3.2.2",
54
- "@capybara-hq/kernel": "^0.1.0-rc.5",
55
- "@capybara-hq/plugin-sdk": "^0.1.0-rc.3"
54
+ "@capybara-hq/kernel": "^0.1.0-rc.6",
55
+ "@capybara-hq/plugin-sdk": "^0.1.0-rc.4"
56
56
  },
57
57
  "devDependencies": {
58
58
  "zod": "^4.6.7",
59
- "@capybara-hq/testing": "0.1.0-rc.6"
59
+ "@capybara-hq/testing": "0.1.0-rc.7"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsc -b"