pi-daddy 0.13.0 → 0.15.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/CHANGELOG.md +113 -0
- package/README.md +113 -7
- package/dist/catalog.d.ts +9 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +90 -0
- package/dist/catalog.js.map +1 -1
- package/dist/cli.d.ts +31 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/delegate.d.ts.map +1 -1
- package/dist/delegate.js +14 -2
- package/dist/delegate.js.map +1 -1
- package/dist/grant-env.d.ts +73 -0
- package/dist/grant-env.d.ts.map +1 -0
- package/dist/grant-env.js +131 -0
- package/dist/grant-env.js.map +1 -0
- package/dist/grant-store.d.ts +68 -0
- package/dist/grant-store.d.ts.map +1 -0
- package/dist/grant-store.js +142 -0
- package/dist/grant-store.js.map +1 -0
- package/dist/init.d.ts +117 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +286 -0
- package/dist/init.js.map +1 -0
- package/dist/skill-packages.d.ts +128 -0
- package/dist/skill-packages.d.ts.map +1 -0
- package/dist/skill-packages.js +245 -0
- package/dist/skill-packages.js.map +1 -0
- package/extensions/grants-command.ts +31 -0
- package/extensions/grants.ts +57 -5
- package/extensions/init-command.ts +132 -0
- package/extensions/session.ts +75 -6
- package/extensions/spawn-summary.ts +214 -0
- package/package.json +12 -1
- package/src/catalog.ts +92 -0
- package/src/cli.ts +266 -0
- package/src/delegate.ts +14 -2
- package/src/grant-env.ts +188 -0
- package/src/grant-store.ts +151 -0
- package/src/init.ts +344 -0
- package/src/skill-packages.ts +282 -0
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,119 @@ the record of how the package got here and are worth keeping; they are not worth
|
|
|
12
12
|
> the record of how the package arrived at what it does, and because the reasoning behind each one is
|
|
13
13
|
> usually the clearest statement of why the current behaviour is what it is.
|
|
14
14
|
|
|
15
|
+
## 0.14.0 — `pi-daddy init`, and a startup line that names what it will and will not spawn
|
|
16
|
+
|
|
17
|
+
> **Reviewed before release by five independent agents, one hypothesis each. All five found something, and
|
|
18
|
+
> nine defects were fixed here** — including one that executed arbitrary code from the file this feature
|
|
19
|
+
> tells you to commit (R-78), one that overwrote an operator's file and wrote through symlinks (R-79), and
|
|
20
|
+
> one where the startup line blamed your `SKILL.md` files for a misconfigured environment variable (R-81).
|
|
21
|
+
> **ADR-0029 came out of that review**: the generated grant is read-only by default. The reasoning for each
|
|
22
|
+
> is in `docs/03-risks.md` R-78 through R-82.
|
|
23
|
+
|
|
24
|
+
The pi-daddy half of making this package and a package of skills work together out of the box
|
|
25
|
+
(`docs/HANDOFF-principal-pi-skills-integration.md`, items B1/B2/B4; **ADR-0028**). Nothing about grant
|
|
26
|
+
resolution, enforcement, approvals or the ledger changed — this is the part before and around them.
|
|
27
|
+
|
|
28
|
+
- **The generated grant is READ-ONLY by default** (ADR-0029). `init` grants what the copied skills declare
|
|
29
|
+
minus anything that can change your machine — `bash`, `write`, `edit` and the universal capabilities are
|
|
30
|
+
written **commented**, naming the definitions that need them. `init` + `source` gives a working read-only
|
|
31
|
+
setup; widening costs one deliberate uncomment. The reason: `PI_GRANTS_GRANT` is what *bounds* a declared
|
|
32
|
+
ceiling, so generating it from those ceilings would give the bound and the bounded one author, and it
|
|
33
|
+
would not be you.
|
|
34
|
+
|
|
35
|
+
- **`npx pi-daddy init` scaffolds a governed project.** It reads `<cwd>/node_modules` for packages declaring
|
|
36
|
+
skills in their own `package.json` (`"pi": {"skills": [...]}`, pi's convention), copies each declared
|
|
37
|
+
`SKILL.md` into `.pi/skills/`, and writes an annotated `.pi/grants.env`. That replaces, per skill: make a
|
|
38
|
+
directory, copy the body, hand-write frontmatter, choose a capability set with no guidance, and assemble a
|
|
39
|
+
`PI_GRANTS_GRANT` string by hand — seven times for `principal-pi-skills`.
|
|
40
|
+
|
|
41
|
+
**It chooses no ceiling, and that boundary is the whole design.** A skill that declares `allowed-tools` is
|
|
42
|
+
copied byte for byte; one that declares none is copied with a *commented* placeholder and stays
|
|
43
|
+
unspawnable until a human fills it in. The placeholder is deliberately not a working example, so
|
|
44
|
+
uncommenting it unedited fails loudly instead of granting something nobody decided. An existing file is
|
|
45
|
+
**kept**, never overwritten — that edit is the capability decision, and a second `init` run is exactly
|
|
46
|
+
when it would be destroyed. `--force` exists and says what it costs.
|
|
47
|
+
|
|
48
|
+
- **Session start says how many definitions are spawnable, and names the withheld ones.** The line reported
|
|
49
|
+
the grant and never the definitions, so *"governance is working"* and *"did the install fail?"* looked
|
|
50
|
+
identical:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
grants: 1 of 7 definitions spawnable — review
|
|
54
|
+
withheld: architect, build, … — need agent:architect, …, which this session does not hold
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Classified by the same planner a real spawn comes through (no human is asked, stored approvals count), and
|
|
58
|
+
it speaks even when **nothing** is spawnable — which is the state most worth being told about. It is an
|
|
59
|
+
upper bound: it runs before the tool surface is observed, and `/grants` is the settled answer.
|
|
60
|
+
|
|
61
|
+
- **A worked `principal-pi-skills` example in the README**, replacing the invented one, with every line
|
|
62
|
+
produced by running the commands (`docs/probes/b2-init-principal-pi-skills`).
|
|
63
|
+
|
|
64
|
+
- **Fixed before release: a skill's `allowed-tools` VALUE could execute code from the generated grant file**
|
|
65
|
+
(R-78). `ceilingForDefinition` passes `ext:`/`skill:`/`agent:` entries through as written — correct for
|
|
66
|
+
enforcement, where the catalog refuses what it does not know — so a package declaring
|
|
67
|
+
`allowed-tools: Read,ext:x";touch /tmp/pwned;PI_GRANTS_GRANT="` produced a `.pi/grants.env` that ran the
|
|
68
|
+
payload when sourced: silently, exit 0, with the variable left looking plausible. It survives
|
|
69
|
+
`--ignore-scripts` and travels in the file you commit. Declared ids are whitelisted now, `tool:*`/`agent:*`
|
|
70
|
+
from a package are refused, and the assembled grant is charset-checked before the file is written at all.
|
|
71
|
+
|
|
72
|
+
- **Fixed before release: `init` overwrote an operator's file and wrote through symlinks** (R-79). The
|
|
73
|
+
presence probe was `readFile`, which treats *unreadable* as *absent* — so a permissions-restricted
|
|
74
|
+
`SKILL.md` was replaced and its ceiling **widened**, with no `--force`. And `writeFile` follows symlinks, so
|
|
75
|
+
a dangling link at a target path created the file outside the project while reporting an in-project path.
|
|
76
|
+
Both are one `open(path, "wx")`. `--force` no longer regenerates `.pi/grants.env`, and `pi-daddy init
|
|
77
|
+
--Force` is no longer accepted as a silent no-op.
|
|
78
|
+
|
|
79
|
+
- **Fixed before release: the startup line blamed your files for a session-level refusal** (R-81). A session
|
|
80
|
+
at its depth limit, or with a malformed `PI_GRANTS_MAX_DEPTH`, was told its `SKILL.md` files were written
|
|
81
|
+
wrong — two lines above `/grants` saying "delegation is disabled (maxDepth 0)". A session with no
|
|
82
|
+
`tool:delegate`, which has no delegate tool at all, was told definitions were spawnable.
|
|
83
|
+
|
|
84
|
+
- **Fixed before release: a skill's directory name could write a capability into the generated grant**
|
|
85
|
+
(R-77). A name is interpolated into a comma-separated `PI_GRANTS_GRANT`, into a file the operator sources,
|
|
86
|
+
and into a path. A package shipping a directory called `a,tool:bash` produced
|
|
87
|
+
`PI_GRANTS_GRANT="agent:a,tool:bash,…"` — `tool:bash` in an operator's grant, declared by no definition.
|
|
88
|
+
Names are now whitelisted at discovery and a refusal is printed with its reason.
|
|
89
|
+
|
|
90
|
+
- **Fixed before release: `npx pi-daddy init` printed nothing and exited 0 for every installed copy** (R-73).
|
|
91
|
+
npm installs a bin as a symlink, so `process.argv[1]` is the link and the entry-point guard compared it
|
|
92
|
+
against the real file's URL. Caught by the smoke test, which now runs the installed bin — the same class of
|
|
93
|
+
defect as the `exports` map that worked in the tree and threw for every consumer, and the second time that
|
|
94
|
+
script has caught it.
|
|
95
|
+
|
|
96
|
+
## 0.15.0 — `/grants init`, a grant that survives without an env var, and a setup that was wrong
|
|
97
|
+
|
|
98
|
+
**Setup is two steps instead of five, and one of the five was wrong.**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pi install npm:pi-daddy
|
|
102
|
+
pi install npm:principal-pi-skills
|
|
103
|
+
pi
|
|
104
|
+
/grants init
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- **`pi install`, not `npm install`.** This package's own documentation said `npm install`, and that is not
|
|
108
|
+
how pi packages are installed: `pi install` registers the package in pi's settings, which is what makes
|
|
109
|
+
the extension auto-load, and it installs to `$PI_CODING_AGENT_DIR/npm/node_modules` rather than the
|
|
110
|
+
project. **`init` searched only the project and so found nothing for anyone who followed pi's own
|
|
111
|
+
instructions** — telling them to install a package they had just installed. It now searches both roots,
|
|
112
|
+
project first so a pinned copy outranks the machine-wide one.
|
|
113
|
+
- **`/grants init`** scaffolds definitions, asks about the capabilities that can change your machine, and
|
|
114
|
+
applies the answer to the session you are already in — **no `source`, no restart**.
|
|
115
|
+
- **A grant can now come from a store**, at `$PI_CODING_AGENT_DIR/grants/<project>.json` — **outside** your
|
|
116
|
+
project, because a ceiling a child holding `tool:write` could rewrite is not a ceiling. `PI_GRANTS_GRANT`
|
|
117
|
+
**always wins**: it is how a child is governed and how CI is configured. `.pi/grants.env` is still written
|
|
118
|
+
and still worth committing — it is the reviewable record, no longer what the enforcer reads. (ADR-0030)
|
|
119
|
+
- **The dialog does not ask questions whose answers cannot matter.** `tool:bash` subsumes `write` and
|
|
120
|
+
`edit`, so once bash is granted those are conferred; asking anyway let an operator answer *no* to
|
|
121
|
+
`tool:write` and then watch `build` be allowed it. It now reports them as already conferred instead.
|
|
122
|
+
- **An unknown `/grants` subcommand is refused rather than ignored.** `/grants init` used to print the
|
|
123
|
+
ordinary status screen with the word silently dropped, so a command that did not exist looked like it had
|
|
124
|
+
worked.
|
|
125
|
+
- **`init` counted authorisations and called them declarations** — "7 skill(s), 3 declaring allowed-tools"
|
|
126
|
+
when all seven declared.
|
|
127
|
+
|
|
15
128
|
## 0.13.0 — the approvals file gets the lock the ledger already had, and two silences end
|
|
16
129
|
|
|
17
130
|
Closing the last items that were open rather than out of scope, then **red-teaming the result**: an
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ configured.
|
|
|
8
8
|
Both qualifiers are load-bearing and are not buried: a child granted `bash` can escape governance entirely
|
|
9
9
|
(ADR-0012, measured), and the ledger is opt-in. See *What this governs, and what it does not*.
|
|
10
10
|
|
|
11
|
-
> **0.13.0
|
|
11
|
+
> **0.13.0 was the first published release.** Earlier versions were developed in-repo and never shipped, so
|
|
12
12
|
> the breaking changes in the changelog describe how this package arrived at its current behaviour rather
|
|
13
13
|
> than anything you need to migrate from.
|
|
14
14
|
>
|
|
@@ -300,9 +300,13 @@ as the record of that run and are not a description of this version.
|
|
|
300
300
|
PI_GRANTS_GRANT="agent:review,tool:read,tool:grep,tool:find,tool:ls,tool:delegate" \
|
|
301
301
|
PI_GRANTS_LEDGER=.pi/grants.jsonl \
|
|
302
302
|
PI_GRANTS_MAX_DEPTH=2 \
|
|
303
|
-
pi
|
|
303
|
+
pi
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
+
**Plain `pi`, no `-e`, when you installed this from npm** — the package declares `pi.extensions` and pi
|
|
307
|
+
auto-loads it (verified by execution). `-e ./extensions/grants.ts` is for running from a **clone** of the
|
|
308
|
+
repository, where there is no `node_modules/pi-daddy` for pi to find.
|
|
309
|
+
|
|
306
310
|
`/grants` shows the session's grant, its depth, the catalog by kind, and an allow/BLOCK verdict per known
|
|
307
311
|
definition — computed by **the same function a real spawn uses**, so the diagnostic cannot disagree with the
|
|
308
312
|
enforcer. That is not cosmetic, and it has been got wrong twice. R-28 was a `/grants` that reported "allow"
|
|
@@ -327,6 +331,105 @@ digest, each compared against the file on disk (`current` / `CHANGED since`), wh
|
|
|
327
331
|
back, so a torn line was indistinguishable from a spawn that never happened. A corrupt line is **evidence**
|
|
328
332
|
and is left alone rather than repaired. Nothing runs this check automatically.
|
|
329
333
|
|
|
334
|
+
## Worked example: governing `principal-pi-skills`
|
|
335
|
+
|
|
336
|
+
The abstract examples above use invented definitions. This one uses the seven skills people actually have
|
|
337
|
+
installed. Every transcript below is **copied from a run**, not retyped — the run is
|
|
338
|
+
`docs/probes/b2-init-principal-pi-skills` (2026-08-17, `principal-pi-skills@2.3.1`, pi 0.84.1), and where
|
|
339
|
+
this section abridges output it says so.
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
pi install npm:pi-daddy
|
|
343
|
+
pi install npm:principal-pi-skills
|
|
344
|
+
pi # then, inside pi:
|
|
345
|
+
/grants init
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
**`pi install`, not `npm install`** — it registers the package with pi, which is what makes the extension
|
|
349
|
+
auto-load; presence in `node_modules` alone does nothing. `/grants init` asks only about the capabilities
|
|
350
|
+
that can change your machine and applies the answer to the running session, no restart (ADR-0030).
|
|
351
|
+
`npx pi-daddy init` does the same scaffolding from a shell, and both search pi's install root as well as
|
|
352
|
+
the project's.
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
found principal-pi-skills@2.3.1 — 7 skill(s), 0 declaring allowed-tools
|
|
356
|
+
wrote .pi/skills/decide/SKILL.md
|
|
357
|
+
… six more `wrote` lines, one per skill …
|
|
358
|
+
wrote .pi/grants.env
|
|
359
|
+
|
|
360
|
+
7 skill(s) declare no allowed-tools and cannot be spawned until they do: decide, architect, plan,
|
|
361
|
+
build, review, debug, git-ops. Each copy carries a commented `allowed-tools:` line. pi-daddy does
|
|
362
|
+
not choose ceilings — that decision is what you review and commit, so it is yours to write.
|
|
363
|
+
|
|
364
|
+
Live grant (1 capabilities): tool:delegate
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**That is the honest state today, and the zero is the interesting number.** `principal-pi-skills@2.3.1` —
|
|
368
|
+
the published version — declares `allowed-tools` on none of its seven skills, so none of them is spawnable
|
|
369
|
+
and `init` says so rather than inventing capability sets to make its output look better. (It is being fixed
|
|
370
|
+
at the source, in their PR #30; until that ships, this is what `npm install` gives you.) `init` did the
|
|
371
|
+
mechanical work — seven directories, seven copies, the grant file — and left the one decision that has to be
|
|
372
|
+
a human's.
|
|
373
|
+
|
|
374
|
+
You make it, in the file. This is the copy `init` wrote for `decide`, with its commented block elided, and
|
|
375
|
+
the ceiling is the one `principal-pi-skills` PR #30 settled on by re-deriving it from the skill's own body:
|
|
376
|
+
|
|
377
|
+
```diff
|
|
378
|
+
---
|
|
379
|
+
name: decide
|
|
380
|
+
description: >
|
|
381
|
+
Use when a decision needs making …
|
|
382
|
+
# pi-daddy: this skill declares no `allowed-tools`, so it CANNOT be spawned as a governed sub-agent —
|
|
383
|
+
… four more comment lines …
|
|
384
|
+
- # allowed-tools: <list the tools this skill needs, e.g. Read, Grep>
|
|
385
|
+
+ allowed-tools: read, grep, find, ls
|
|
386
|
+
---
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
and in `.pi/grants.env`, whose `PI_GRANTS_GRANT` line `init` wrote as `"tool:delegate"` — you add the rest:
|
|
390
|
+
|
|
391
|
+
```sh
|
|
392
|
+
export PI_GRANTS_GRANT="agent:decide,tool:read,tool:grep,tool:find,tool:ls,tool:delegate"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
source .pi/grants.env && pi
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
```
|
|
400
|
+
grants: depth 0/2, holding [agent:decide, tool:read, tool:grep, tool:find, tool:ls, tool:delegate]
|
|
401
|
+
grants: 1 of 7 definitions spawnable — decide
|
|
402
|
+
withheld: architect (needs agent:architect); build (needs agent:build); debug (needs agent:debug);
|
|
403
|
+
git-ops (needs agent:git-ops); plan (needs agent:plan); review (needs agent:review)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
The second line is the one worth having. A `decide` sub-agent that **physically cannot write** is a
|
|
407
|
+
different object from one that has been asked not to — and now that is enforced by `--tools` rather than
|
|
408
|
+
requested in prose. The other six are visibly withheld, each naming its own missing capability, which is the
|
|
409
|
+
difference between *governance is working* and *did the install fail?*
|
|
410
|
+
|
|
411
|
+
**`decide` and not `review`, and the reason is worth a sentence.** An earlier version of this section used
|
|
412
|
+
`review` as the read-only example and sourced that to its description saying *"Reports findings; never
|
|
413
|
+
edits"* — **a string that appears nowhere in `principal-pi-skills`**. It was invented for a demo file in
|
|
414
|
+
this repository and then cited back as their evidence. `review`'s real ceiling, settled upstream from its
|
|
415
|
+
body, is `read, grep, find, ls, bash`: it creates a disposable worktree and runs the tests, and denied
|
|
416
|
+
`bash` every verdict it returns is `UNVERIFIED`. The structurally read-only tier is `decide`, `architect`
|
|
417
|
+
and `plan`.
|
|
418
|
+
|
|
419
|
+
**Capabilities that can change your machine are written commented** (ADR-0029). When the seven skills do
|
|
420
|
+
declare their ceilings, `init` puts `tool:read`, `tool:grep` and friends in the live grant and writes
|
|
421
|
+
`tool:bash`, `tool:write` and `tool:edit` — plus the `agent:` ids of the definitions that need them — as
|
|
422
|
+
commented lines naming who asked for what. `init` + `source` gives you a working read-only setup; the wide
|
|
423
|
+
half costs one deliberate uncomment. The reason is that `PI_GRANTS_GRANT` is what *bounds* a declared
|
|
424
|
+
ceiling, so generating it from those same ceilings would give the bound and the bounded one author, and it
|
|
425
|
+
would not be you.
|
|
426
|
+
|
|
427
|
+
Two things this example does **not** claim. pi-daddy governs which **tools**, never which **paths**: a
|
|
428
|
+
`Write(docs/**)` is refused rather than reinterpreted, so *"an architect that may write an ADR but not your
|
|
429
|
+
source"* is not expressible — the honest choice is between a document-producing agent with real write power
|
|
430
|
+
and a read-only one that hands its output back for the parent to write. And the ceilings above are an
|
|
431
|
+
example, not a recommendation: what each skill needs is the skill author's call.
|
|
432
|
+
|
|
330
433
|
### The tripwire
|
|
331
434
|
|
|
332
435
|
In a **governed** session the `tool_call` hook refuses third-party spawn tools (`Agent`, `subagent`,
|
|
@@ -511,9 +614,11 @@ Subpaths are exported individually (`pi-daddy/resolve`, `/ledger`, `/spawn`, `/d
|
|
|
511
614
|
```bash
|
|
512
615
|
pi install npm:pi-daddy # as a pi extension
|
|
513
616
|
npm i pi-daddy # as a library (the resolver, ledger and spawn planner are pure)
|
|
617
|
+
npx pi-daddy init # as a command: scaffold .pi/skills/ and .pi/grants.env from installed
|
|
618
|
+
# skill packages — see the worked example above
|
|
514
619
|
```
|
|
515
620
|
|
|
516
|
-
The package is
|
|
621
|
+
The package is all three. pi loads `extensions/grants.ts` through its own transpiling loader, which reads
|
|
517
622
|
TypeScript from `node_modules` quite happily; **Node does not** — it refuses to strip types under
|
|
518
623
|
`node_modules` — so the library entry points are compiled to `dist/`. Until 0.6.0 `exports` pointed at
|
|
519
624
|
`./src/*.ts`, and every consumer import failed with `ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING` while
|
|
@@ -523,10 +628,11 @@ every in-repo test passed. `npm run test:smoke` packs a tarball, installs it int
|
|
|
523
628
|
## Testing
|
|
524
629
|
|
|
525
630
|
```bash
|
|
526
|
-
npm test #
|
|
631
|
+
npm test # 353 unit tests. Fast, pure, no pi, no network.
|
|
527
632
|
npm run typecheck # src + extensions + tests + integration tests
|
|
528
|
-
npm run test:integration #
|
|
529
|
-
npm run test:smoke # pack, install into a scratch project, import and use it
|
|
633
|
+
npm run test:integration # 28 tests against a REAL pi process. ~40s, no model tokens.
|
|
634
|
+
npm run test:smoke # pack, install into a scratch project, import and use it — and run the
|
|
635
|
+
# installed `pi-daddy init` bin, which is how R-73 was found
|
|
530
636
|
PI_GRANTS_IT_MODEL=1 npm run test:integration # + 4 end-to-end tests with a real model. ~60s, costs money.
|
|
531
637
|
```
|
|
532
638
|
|
|
@@ -552,7 +658,7 @@ its own author the day after it was added: rather than raise the cap, `delegatio
|
|
|
552
658
|
|
|
553
659
|
## Status
|
|
554
660
|
|
|
555
|
-
**0.
|
|
661
|
+
**0.14.0 — usable, and honest about scope.** What exists and is verified against real pi: the resolver, the
|
|
556
662
|
ledger with an integrity reader, the spawn planner, `SKILL.md` definitions with `allowed-tools` as an
|
|
557
663
|
enforced ceiling, `delegate` and `delegate_all` with a subtree budget, two executors, and human approval for
|
|
558
664
|
gated capabilities (once / session / always, inheritable down the tree, persisted for `always` and pinned to
|
package/dist/catalog.d.ts
CHANGED
|
@@ -69,6 +69,15 @@ export declare function buildCatalog(input: {
|
|
|
69
69
|
* stale grant referring to an uninstalled package. Silently treating unknown as denied hides that.
|
|
70
70
|
*/
|
|
71
71
|
export declare function unknownCapabilities(requested: Capability[], catalog: Catalog): Capability[];
|
|
72
|
+
/**
|
|
73
|
+
* The capability an unknown one was most likely meant to be, or null when nothing is close enough.
|
|
74
|
+
*
|
|
75
|
+
* Two sources, in order. A known foreign name wins outright — `Glob` is not a typo for `find`, so no
|
|
76
|
+
* distance metric would ever connect them, and that is exactly the case worth naming. Otherwise the
|
|
77
|
+
* nearest catalog entry within a small edit distance, which catches `raed`/`serach` and stops well short
|
|
78
|
+
* of guessing: the threshold scales with the name's length and never exceeds two.
|
|
79
|
+
*/
|
|
80
|
+
export declare function suggestForUnknown(unknown: Capability, catalog: Catalog): Capability | null;
|
|
72
81
|
/**
|
|
73
82
|
* Skill name -> absolute path, for `planSpawn`'s `--skill` flags (R-32).
|
|
74
83
|
*
|
package/dist/catalog.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAmB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,cAAc,CAAC;IACrB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,E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,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,EAAE,CAQ3F;AA6DD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAuB1F;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO9E"}
|
package/dist/catalog.js
CHANGED
|
@@ -144,6 +144,96 @@ export function unknownCapabilities(requested, catalog) {
|
|
|
144
144
|
// unspawnable from any grant. The wildcard is live only at the root without this.
|
|
145
145
|
return requested.filter((c) => c !== WILDCARD && c !== AGENT_WILDCARD && !catalog.has(c)).sort();
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Tool names that exist in OTHER harnesses' vocabularies, mapped to the pi tool that does the same job.
|
|
149
|
+
*
|
|
150
|
+
* This is a hint for an error message and nothing else. `ceilingForDefinition` deliberately refuses to
|
|
151
|
+
* translate names — lowercasing and no more — because a translation table there would have to decide what
|
|
152
|
+
* `Glob` *means* and would either invent a grant or silently drop one. Naming a likely intent in the
|
|
153
|
+
* refusal costs nothing and keeps that property: the delegation is still refused, and the author still
|
|
154
|
+
* edits the file.
|
|
155
|
+
*
|
|
156
|
+
* Populated from the names an author actually reaches for. `allowed-tools` is an Agent Skills field, so
|
|
157
|
+
* the frontmatter people copy in is usually written against Claude Code's toolset; `Glob` is the one that
|
|
158
|
+
* bit a real consumer (principal-pi-skills, seven definitions), because pi's equivalent is `find`.
|
|
159
|
+
*/
|
|
160
|
+
const FOREIGN_TOOL_NAMES = {
|
|
161
|
+
"tool:glob": "tool:find",
|
|
162
|
+
"tool:searchfiles": "tool:find",
|
|
163
|
+
"tool:bashtool": "tool:bash",
|
|
164
|
+
"tool:readfile": "tool:read",
|
|
165
|
+
"tool:writefile": "tool:write",
|
|
166
|
+
"tool:str_replace_editor": "tool:edit",
|
|
167
|
+
"tool:multiedit": "tool:edit",
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Optimal string alignment distance — Levenshtein plus adjacent transposition.
|
|
171
|
+
*
|
|
172
|
+
* Transposition counts as ONE edit, not two, because it is the typo people actually make: `raed` for
|
|
173
|
+
* `read` is a single slip of the fingers, and plain Levenshtein scores it 2 — the same as two unrelated
|
|
174
|
+
* substitutions. With the threshold this small, that difference is the whole feature.
|
|
175
|
+
*/
|
|
176
|
+
function editDistance(a, b) {
|
|
177
|
+
// Three rows, because a transposition needs the row before last.
|
|
178
|
+
const rows = [
|
|
179
|
+
Array.from({ length: b.length + 1 }, (_, j) => j),
|
|
180
|
+
new Array(b.length + 1).fill(0),
|
|
181
|
+
new Array(b.length + 1).fill(0),
|
|
182
|
+
];
|
|
183
|
+
let twoBack = rows[2];
|
|
184
|
+
let prev = rows[0];
|
|
185
|
+
let cur = rows[1];
|
|
186
|
+
for (let i = 1; i <= a.length; i++) {
|
|
187
|
+
cur[0] = i;
|
|
188
|
+
for (let j = 1; j <= b.length; j++) {
|
|
189
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
190
|
+
let d = Math.min(prev[j] + 1, cur[j - 1] + 1, prev[j - 1] + cost);
|
|
191
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) {
|
|
192
|
+
d = Math.min(d, twoBack[j - 2] + 1);
|
|
193
|
+
}
|
|
194
|
+
cur[j] = d;
|
|
195
|
+
}
|
|
196
|
+
const spent = twoBack;
|
|
197
|
+
twoBack = prev;
|
|
198
|
+
prev = cur;
|
|
199
|
+
cur = spent;
|
|
200
|
+
}
|
|
201
|
+
return prev[b.length];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* The capability an unknown one was most likely meant to be, or null when nothing is close enough.
|
|
205
|
+
*
|
|
206
|
+
* Two sources, in order. A known foreign name wins outright — `Glob` is not a typo for `find`, so no
|
|
207
|
+
* distance metric would ever connect them, and that is exactly the case worth naming. Otherwise the
|
|
208
|
+
* nearest catalog entry within a small edit distance, which catches `raed`/`serach` and stops well short
|
|
209
|
+
* of guessing: the threshold scales with the name's length and never exceeds two.
|
|
210
|
+
*/
|
|
211
|
+
export function suggestForUnknown(unknown, catalog) {
|
|
212
|
+
const foreign = FOREIGN_TOOL_NAMES[unknown.toLowerCase()];
|
|
213
|
+
if (foreign && catalog.has(foreign))
|
|
214
|
+
return foreign;
|
|
215
|
+
// Only among capabilities of the same namespace: suggesting `skill:review` for a mistyped tool name
|
|
216
|
+
// would be a worse message than none, because it points the author at the wrong kind of fix.
|
|
217
|
+
const ns = unknown.slice(0, unknown.indexOf(":") + 1);
|
|
218
|
+
if (!ns)
|
|
219
|
+
return null;
|
|
220
|
+
const bare = unknown.slice(ns.length);
|
|
221
|
+
const limit = Math.min(2, Math.floor(bare.length / 3));
|
|
222
|
+
if (limit < 1)
|
|
223
|
+
return null;
|
|
224
|
+
let best = null;
|
|
225
|
+
let bestDistance = limit + 1;
|
|
226
|
+
for (const candidate of catalog.all) {
|
|
227
|
+
if (!candidate.startsWith(ns))
|
|
228
|
+
continue;
|
|
229
|
+
const d = editDistance(bare, candidate.slice(ns.length));
|
|
230
|
+
if (d < bestDistance) {
|
|
231
|
+
bestDistance = d;
|
|
232
|
+
best = candidate;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return bestDistance <= limit ? best : null;
|
|
236
|
+
}
|
|
147
237
|
/**
|
|
148
238
|
* Skill name -> absolute path, for `planSpawn`'s `--skill` flags (R-32).
|
|
149
239
|
*
|
package/dist/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,O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,CAAC,CAAC;YACjB,IAAI,GAAG,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,YAAY,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IACpD,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,SAAS;QACtD,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `pi-daddy` — the command line, which today has exactly one subcommand.
|
|
4
|
+
*
|
|
5
|
+
* Thin on purpose: argv in, `discoverSkillPackages` + `planInit` + `applyInit`, report out. Every decision
|
|
6
|
+
* lives in `./init.ts`, `./grant-env.ts` and `./skill-packages.ts` as functions that touch no argv and print
|
|
7
|
+
* nothing, so the scaffolding is testable without running a process — the same split `extensions/grants.ts`
|
|
8
|
+
* was cut along after four wiring bugs in a row lived in the part nothing could test.
|
|
9
|
+
*
|
|
10
|
+
* **`parseArgs` is exported and tested, which it was not** (R-79). This file shipped with zero tests and
|
|
11
|
+
* promptly earned two of them: an entry-point guard that was false for every installed copy (R-73), and an
|
|
12
|
+
* unknown-option check that exempted `argv[0]` whenever `--dir` was absent, so `pi-daddy init --Force`
|
|
13
|
+
* was accepted in silence — the exact failure the check's own comment says it prevents.
|
|
14
|
+
*/
|
|
15
|
+
export interface ParsedArgs {
|
|
16
|
+
command: "init" | "help" | "version";
|
|
17
|
+
dir?: string;
|
|
18
|
+
force: boolean;
|
|
19
|
+
/** Non-empty means refuse: argv said something this program does not understand. */
|
|
20
|
+
errors: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse argv. Pure, exported, and tested — argv handling is where both of this file's defects lived.
|
|
24
|
+
*
|
|
25
|
+
* Rule 8 throughout: an unrecognised option is refused rather than ignored, and `--dir` refuses a value
|
|
26
|
+
* that looks like a flag, because `init --dir --force` used to scaffold into a directory named `--force`
|
|
27
|
+
* with `force` simultaneously true.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
30
|
+
export declare function main(argv: string[]): Promise<number>;
|
|
31
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG;AAyBH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,oFAAoF;IACpF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAoCpD;AAkID,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B1D"}
|