pi-goal-delegate 0.2.0 → 0.3.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/CHANGELOG.md +89 -0
- package/README.md +391 -296
- package/package.json +2 -2
- package/skills/delegate/SKILL.md +128 -44
- package/src/command.ts +88 -27
- package/src/contract.ts +9 -0
- package/src/doctor.ts +385 -0
- package/src/index.ts +426 -303
- package/src/registry.ts +31 -8
- package/src/result-schema.ts +23 -12
- package/src/retention.ts +87 -26
- package/src/run.ts +20 -11
- package/src/spawn.ts +1 -1
- package/src/verify.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,95 @@ All notable changes to this package are recorded here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project uses
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.3.1] - 2026-12-02
|
|
8
|
+
|
|
9
|
+
The tool surface and the waiting model changed. A caller that passed `wait` or
|
|
10
|
+
`inlineSettleMs`, or called `delegate_list`, needs one edit; everything else
|
|
11
|
+
keeps working.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **`delegate_start` waits for the outcome by default.** `wait` defaults to
|
|
16
|
+
`true`, and the wait is bounded by the run's own `timeoutMinutes` instead of by
|
|
17
|
+
a separate knob. Every recorded delegation ran longer than 60 seconds (median
|
|
18
|
+
1102 s), so a synchronous caller could never see a result and was pushed into
|
|
19
|
+
cross-turn polling. Inline completion is now the ordinary path in `codemode`,
|
|
20
|
+
in a fan-out, and under `/goal`; `wait: false` is the deliberate background
|
|
21
|
+
opt-in.
|
|
22
|
+
- **The wait ceiling is the delegation budget.** `MAX_WAIT_MS` follows
|
|
23
|
+
`MAX_TIMEOUT_MINUTES` (4 hours) instead of 50 seconds, for both the inline
|
|
24
|
+
window and `delegate_status.waitMs`. A `codemode` script accepts
|
|
25
|
+
`timeout_ms` up to 2^31-1, so the old 50-second cap was a limit this package
|
|
26
|
+
invented and then enforced against its own callers.
|
|
27
|
+
- **Four tools instead of five.** `delegate_list` folded into
|
|
28
|
+
`delegate_status`, which lists when called with no `runIds` and waits when
|
|
29
|
+
given one. `delegate_start` exposes seven top-level parameters instead of
|
|
30
|
+
eighteen: `goal`, `doneWhen`, `verify`, `context`, `wait`, `worktree`, and
|
|
31
|
+
an `options` object for the budget, model, scope, and resume knobs. The
|
|
32
|
+
declared output schema is a compact projection: the four declarations measure
|
|
33
|
+
8,223 characters on the same metric that measured 20,257 for the five they
|
|
34
|
+
replace.
|
|
35
|
+
- **`inlineSettleMs` is gone from the tool schema.** One knob decides the mode,
|
|
36
|
+
and the run's own `timeoutMinutes` decides the ceiling: a call can never wait
|
|
37
|
+
longer than the delegation it waits for. `wait: false` returns the handle as
|
|
38
|
+
soon as the run is admitted; any later wait is
|
|
39
|
+
`delegate_status({ runIds, waitMs })`.
|
|
40
|
+
- **`/goal` guidance is unconditional and exact.** When `delegate_start`
|
|
41
|
+
returns a live handle it reads the active goal id from the session and prints
|
|
42
|
+
the `goal_wait` call that pauses Goal mode until `delegate-completion`
|
|
43
|
+
arrives, instead of a paragraph of advice.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **Trusted publishing uses a capable npm CLI.** The release job installs npm
|
|
48
|
+
11 before publishing. Node 22's bundled npm 10 required an interactive login
|
|
49
|
+
instead of exchanging GitHub's OIDC token, so the first tag stopped at
|
|
50
|
+
`ENEEDAUTH` before any package version was published.
|
|
51
|
+
- **A settle is claimed only by an active caller.** `delegate_start` and
|
|
52
|
+
`delegate_status` leave every settle that races an abort on the completion
|
|
53
|
+
channel. A `codemode` hard deadline can discard a nested return value even
|
|
54
|
+
when the child settled during the abort, so redelivery is safer than a lost
|
|
55
|
+
outcome; an active caller still claims the settle it reports.
|
|
56
|
+
- **The progress callback cannot read a handle that does not exist yet.**
|
|
57
|
+
`registry.start({ onProgress })` passes the run id to the callback, so the
|
|
58
|
+
callback no longer closes over the `const handle` that `await start()` has not
|
|
59
|
+
assigned. The one real call in the 24 November session crashed Pi with exactly
|
|
60
|
+
that temporal-dead-zone read.
|
|
61
|
+
- **A near-miss argument starts the run.** A known option name passed at the top
|
|
62
|
+
level instead of inside `options` is lifted before validation, so `timeoutMinutes`
|
|
63
|
+
is not a schema error.
|
|
64
|
+
- **The run-root probe measures the path a start actually uses.** A missing
|
|
65
|
+
root is checked through its nearest existing ancestor, a symlink to a writable
|
|
66
|
+
directory is accepted, and the probe uses a unique exclusive file. Existing
|
|
67
|
+
files are never truncated, and a failed create, write, close or unlink fails
|
|
68
|
+
the check instead of letting a read-only root pass.
|
|
69
|
+
- **`/delegate` takes its output sink as a dependency.** The print-mode path wrote
|
|
70
|
+
to `process.stdout` directly, so the command suite had to replace that stream to
|
|
71
|
+
read what it wrote; in a test runner that reports over the same stream, every
|
|
72
|
+
result produced while the replacement was installed vanished. Seven tests ran
|
|
73
|
+
without being reported. `DelegateCommandOptions.write` replaces the module-level
|
|
74
|
+
stream, and no suite patches `process.stdout` any more.
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- **`/delegate doctor`.** One check per line for the parts that fail silently:
|
|
79
|
+
the extension path and package manifest, run-root existence and writability,
|
|
80
|
+
the child launcher, git, live runs, the retention plan, the configured limits,
|
|
81
|
+
the session mode, and the containment mode. The same run-root check runs at
|
|
82
|
+
`session_start` and warns instead of failing days later.
|
|
83
|
+
- **A reported retention plan.** `scanRetention()` answers what the next prune
|
|
84
|
+
would remove and why, without deleting anything.
|
|
85
|
+
- **`delegate_status` reports the run root** and the record count when the
|
|
86
|
+
session has no runs, so an agent can tell "nothing has run" from "the record
|
|
87
|
+
root moved".
|
|
88
|
+
- **`/delegate --wait` and `/delegate --background`** select the mode the command
|
|
89
|
+
otherwise derives from the session: TUI returns a handle, print mode waits.
|
|
90
|
+
- `tests/surface.test.mjs`: the four-tool surface, the schema size budget, option
|
|
91
|
+
hoisting, the inline default, the `goal_wait` text, and the `onProgress`
|
|
92
|
+
contract.
|
|
93
|
+
|
|
94
|
+
[0.3.1]: https://github.com/Zhuocheng-Lang/pi-goal-delegate/compare/v0.2.0...v0.3.1
|
|
95
|
+
|
|
7
96
|
## [0.2.0] - 2026-12-01
|
|
8
97
|
|
|
9
98
|
### Added
|