pi-permission-system-lean 41.0.0 → 42.0.2

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/index.ts +23 -6
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-permission-system-lean
2
2
 
3
- Based on [`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system) by [Chris Lasher](https://github.com/gotgenes), MIT-licensed (see LICENSE). Upstream is pinned to `41.0.0`.
3
+ Based on [`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system) by [Chris Lasher](https://github.com/gotgenes), MIT-licensed (see LICENSE). Upstream is pinned to `42.0.0`.
4
4
 
5
5
  A description-only lean wrapper: upstream registers one slash command and **zero tools**, so there are no tool schemas to trim. This package re-registers the same command with a shorter description; the name, handler, events, and the whole permission-enforcement engine (per-turn tool hiding, allow/ask/deny gates, subagent forwarding) run the original upstream code untouched.
6
6
 
@@ -29,8 +29,8 @@ Same command as upstream: `/permission-system` (configure logging and yolo mode,
29
29
 
30
30
  ## Versions
31
31
 
32
- - Lean wrapper: `41.0.0`
33
- - Upstream dependency is pinned to `@gotgenes/pi-permission-system@41.0.0`.
32
+ - Lean wrapper: `42.0.0-lean.1` (`-lean.1`: wrapper-only fix, upstream still `42.0.0`)
33
+ - Upstream dependency is pinned to `@gotgenes/pi-permission-system@42.0.0`.
34
34
 
35
35
  ## Development
36
36
 
package/index.ts CHANGED
@@ -1,20 +1,37 @@
1
1
  // pi-permission-system-lean — description-only facade over @gotgenes/pi-permission-system.
2
2
  //
3
- // Upstream 41.0.0 registers one slash command and zero tools, so there are no
3
+ // Upstream 42.0.0 registers one slash command and zero tools, so there are no
4
4
  // tool schemas to trim. The whole saving is in the command description:
5
5
  // 61 chars upstream vs 39 here. The command name, handler, event
6
6
  // subscriptions, and the entire permission-enforcement engine (per-turn tool
7
7
  // hiding, allow/ask/deny gates, subagent forwarding, service publication) run
8
8
  // the original upstream code untouched.
9
9
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
+ import { existsSync } from "node:fs";
11
+ import path from "node:path";
12
+ import { fileURLToPath, pathToFileURL } from "node:url";
13
+
10
14
  // The upstream package's exports map only exposes "." (the cross-extension
11
15
  // service surface), so the extension entry point is unreachable by package
12
- // subpath. Reach it by file path instead: every lean package installs its own
13
- // dependencies in its own node_modules (no workspaces), which keeps this
14
- // relative import stable.
15
- import upstreamActivate from "./node_modules/@gotgenes/pi-permission-system/src/index.ts";
16
+ // subpath and must be reached by file path. Which file path depends on the
17
+ // installer layout: pi installs extensions flat (upstream sits alongside as a
18
+ // sibling), while a local `npm install` nests it under ./node_modules.
19
+ // Prefer the sibling; fall back to the nested copy.
20
+ export function resolveUpstreamEntry(fromDir: string): string {
21
+ const candidates = [
22
+ path.join(fromDir, "../@gotgenes/pi-permission-system/src/index.ts"),
23
+ path.join(fromDir, "node_modules/@gotgenes/pi-permission-system/src/index.ts"),
24
+ ];
25
+ return candidates.find((p) => existsSync(p)) ?? candidates[0];
26
+ }
27
+
28
+ type UpstreamActivate = (pi: ExtensionAPI) => void;
29
+
30
+ const { default: upstreamActivate } = (await import(
31
+ pathToFileURL(resolveUpstreamEntry(path.dirname(fileURLToPath(import.meta.url)))).href
32
+ )) as unknown as { default: UpstreamActivate };
16
33
 
17
- const UPSTREAM_VERSION = "41.0.0";
34
+ const UPSTREAM_VERSION = "42.0.0";
18
35
 
19
36
  type RegisterCommandOptions = Parameters<ExtensionAPI["registerCommand"]>[1];
20
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-permission-system-lean",
3
- "version": "41.0.0",
3
+ "version": "42.0.2",
4
4
  "description": "Lean wrapper of @gotgenes/pi-permission-system: same permission-system command with trimmed startup description.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "check": "npm run typecheck && npm test"
23
23
  },
24
24
  "dependencies": {
25
- "@gotgenes/pi-permission-system": "41.0.0"
25
+ "@gotgenes/pi-permission-system": "42.0.2"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@earendil-works/pi-coding-agent": "*",