ceulen 0.15.0 → 0.15.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.2 — 2026-10-08
4
+
5
+ Deferred-tier re-evaluation from live session usage (211 transcripts, 13K tool
6
+ calls). Four tools promoted from `tool_search`-only back to always-declared:
7
+
8
+ - **munin_search / munin_get** — the Memory Protocol is injected into every
9
+ configured session and its before-acting rule is a search; the old deferred
10
+ tier forced a discovery round-trip in front of the protocol's own workflow.
11
+ - **github** — the top user among deferred tools (61 calls/17 sessions, all
12
+ pre-dating the deferred pass). Since deferral, release verification did not
13
+ discover it via tool_search and fell back to raw bash gh, forfeiting the
14
+ wrapper's deadline, output cap, and read-only guardrails.
15
+ - **ux_audit** — every ux_* skill routes into it pre-code; the ux module is
16
+ always loaded, so the deferred tier was a pure-latency detour.
17
+
18
+ 52 tools stay discover-only (serena, a2a, web cold tools, sg, fff extras,
19
+ munin store/list/…, jfind, cron, shell, notify, rule_get). Declared block goes
20
+ ~438 → ~507 tokens, still ~47% below the pre-deferral ~955. Docs swept
21
+ (AGENTS.md module-convention + module sections, README tool-loading, stale
22
+ defaultTools docstring); +registry tier guard test.
23
+
24
+ ## 0.15.1 — 2026-10-08
25
+
26
+ pi 1.1.0 compatibility (audit found the API diff purely additive — SettingsManager,
27
+ ProviderConfig, jiti loader, composer/editor duck-typing, `defaultTools` semantics
28
+ and all root exports unchanged):
29
+
30
+ - **Peer deps widened** to `>=0.99.1 <1.2.0` for both `@earendil-works/pi-coding-agent`
31
+ and `@earendil-works/pi-tui` — the old range excluded 1.1.0 semver-wise. Dev lockfile
32
+ refreshed; typecheck + full suite now run against 1.1.0 types (2767 pass).
33
+ - **advisor**: the background review skips `agent_settled` events flagged `aborted`
34
+ (pi 1.1.0; user hit Escape) — no isolated review of a half-finished transcript.
35
+ Absent flag on older pi → unchanged behavior.
36
+ - **plan**: auto-approve never fires off an aborted settle; `planReadyForReview`
37
+ stays set, so the plan still approves/executes on the next clean settle.
38
+
3
39
  ## 0.15.0 — 2026-10-08
4
40
 
5
41
  Deferred-exposure pass + config kill-switch removal (net −660 lines):
package/README.md CHANGED
@@ -174,7 +174,7 @@ In `~/.pi/agent/settings.json` or a trusted project's `.pi/settings.json` — a
174
174
 
175
175
  The core set — router, usage, ux, classifier, composer, advisor, and the `/config` panel itself — is always on and never appears in the kill-switch list.
176
176
 
177
- **Tool loading**: most tools register *deferred* — not declared to the model, loaded on demand by `tool_search` (pi activates it for you). Only the hot core (subagent, todo, web search/extract/screenshot/interact, fffgrep/fffind, plan/repair tools, advisor, classify, think) is declared every request, keeping the standing token cost small no matter how many tools ceulen ships.
177
+ **Tool loading**: most tools register *deferred* — not declared to the model, loaded on demand by `tool_search` (pi activates it for you). Declared every request: the hot core (subagent, herdr, todo, write_plan, ask_user_question, apply_patch, str_replace_editor, web_search/extract/screenshot/interact, ffgrep/fffind, advisor, classify, think) plus four tools promoted in the 2026-10-08 usage re-eval — `munin_search`, `munin_get`, `github`, `ux_audit`. Everything else stays discover-only, keeping the standing token cost small no matter how many tools ceulen ships.
178
178
 
179
179
  ## License
180
180
 
@@ -48,6 +48,18 @@ describe("isProjectTrusted", () => {
48
48
  });
49
49
  });
50
50
 
51
+ describe("deferredTools tiers", () => {
52
+ // 2026-10-08 usage re-eval: these four were promoted from deferred to
53
+ // direct. A registry edit that silently reverts them must fail here.
54
+ it("keeps the promoted hot tools out of every deferred list", async () => {
55
+ const { MODULES } = await import("./registry.js");
56
+ const allDeferred = new Set(MODULES.flatMap((m) => m.deferredTools ?? []));
57
+ for (const hot of ["munin_search", "munin_get", "github", "ux_audit"]) {
58
+ assert.equal(allDeferred.has(hot), false, `${hot} must stay direct`);
59
+ }
60
+ });
61
+ });
62
+
51
63
  describe("MODULES load order", () => {
52
64
  // The steering entry must stay behind every before_agent_start prompt
53
65
  // rewriter (its ds-anchor bootstrap REPLACES the final prompt; a rewriter
@@ -124,10 +124,20 @@ export const MODULES: ModuleEntry[] = [
124
124
  // ── Appearance ─────────────────────────────────────────────────────────
125
125
  { name: "usage", core: true, category: "Appearance", describe: "Subscription-usage footer (5h/weekly/monthly windows + credits).", load: usageModule },
126
126
  { name: "composer", core: true, category: "Appearance", describe: "Composer shape for the input editor — pick one in /config with a live preview. Core: always on.", load: composerModule, config: composerConfig },
127
- { name: "ux", core: true, category: "Appearance", describe: "Anti-slop UI/UX design discipline: /ux modes, ux_audit tool, design skills. No status-bar footprint.", load: uxModule, config: uxConfig, deferredTools: ["ux_audit"] },
127
+ // ux_audit is DIRECT (2026-10-08 usage re-eval): every ux_* skill routes to
128
+ // it, it must run pre-code in the ux workflow, and it has no fs/network side
129
+ // effects. The ux module is CORE (always loaded), so registration alone
130
+ // declares it — no tool_search detour to start the UX discipline.
131
+ { name: "ux", core: true, category: "Appearance", describe: "Anti-slop UI/UX design discipline: /ux modes, ux_audit tool, design skills. No status-bar footprint.", load: uxModule, config: uxConfig },
128
132
  // ── Memory ─────────────────────────────────────────────────────────────
133
+ // munin_search + munin_get are DIRECT (2026-10-08 usage re-eval): the Memory
134
+ // Protocol is injected into every configured session and its before-acting
135
+ // rule is a search — forcing a tool_search round-trip first was pure
136
+ // latency. The remaining six stay deferred: store/list/recent/delete/
137
+ // capabilities/share are needed only after search/get evidence is in hand
138
+ // (and store/delete/share stay behind plan mode's BLOCKED_TOOLS).
129
139
  { name: "munin", category: "Memory", describe: "Munin long-term memory tools (search/get/store/list/recent/delete/capabilities/share) + memory protocol. Config at project level.", load: muninModule, config: muninConfig, deferredTools: [
130
- "munin_search", "munin_get", "munin_store", "munin_list", "munin_recent", "munin_delete", "munin_capabilities", "munin_share",
140
+ "munin_store", "munin_list", "munin_recent", "munin_delete", "munin_capabilities", "munin_share",
131
141
  ] },
132
142
  // ── Tasks ──────────────────────────────────────────────────────────────
133
143
  { name: "ponytail", category: "Tasks", describe: "Lazy-senior-dev mode: prompts, skills, subagent instructions.", load: ponytailModule, config: ponytailConfig },
@@ -179,7 +189,12 @@ export const MODULES: ModuleEntry[] = [
179
189
  // gh after web: same class of external-fetch tooling; fail-open on a missing
180
190
  // gh binary (registers nothing until installed). Read-only ops only, so
181
191
  // plan mode auto-allows it (plan-tools.ts READ_ONLY_TOOLS).
182
- { name: "gh", category: "Tools", describe: "GitHub tool over the gh CLI: repo/file/PR views, PR diff, five search flavors, Actions run_watch. Read-only; mutating flows stay on bash gh.", load: ghModule, config: ghConfig, deferredTools: ["github"] },
192
+ // github is DIRECT (2026-10-08 usage re-eval): 61 calls across 17 sessions
193
+ // made it the top deferred-tool user — and every one of them happened in the
194
+ // pre-deferral direct era. After the deferred pass, release verification did
195
+ // not discover it via tool_search at all and fell back to raw bash gh,
196
+ // forfeiting the wrapper's deadline, output cap, and read-only guardrails.
197
+ { name: "gh", category: "Tools", describe: "GitHub tool over the gh CLI: repo/file/PR views, PR diff, five search flavors, Actions run_watch. Read-only; mutating flows stay on bash gh.", load: ghModule, config: ghConfig },
183
198
  // sg after gh: the same external-binary fail-open shape, for ast-grep.
184
199
  { name: "sg", category: "Tools", describe: "Structural search & rewrite via the ast-grep CLI: ast_grep search, ast_edit dry-run-default rewrites. Registers nothing until ast-grep/sg is installed.", load: sgModule, deferredTools: ["ast_grep", "ast_edit"] },
185
200
  // notify: harmless desktop ping (bell fallback), herdr multi-pane ergonomics.
@@ -176,8 +176,13 @@ export default function advisorModule(pi: ExtensionAPI): void {
176
176
  pi.on("session_compact", (_event, ctx) => resetForRewrite(ctx));
177
177
  pi.on("session_before_switch", (_event, ctx) => resetForRewrite(ctx));
178
178
 
179
- pi.on("agent_settled", async (_event, ctx) => {
179
+ pi.on("agent_settled", async (event, ctx) => {
180
180
  if (!runtime || !watchEnabled || runtime.stats.paused) return;
181
+ // pi 1.1.0 flags runs the user cancelled (Escape). A half-finished
182
+ // transcript is not worth an isolated review — and reviewing it would
183
+ // steer on work the user deliberately stopped. Absent on older pi →
184
+ // undefined → falsy → today's behavior.
185
+ if ((event as { aborted?: boolean }).aborted) return;
181
186
  // Only TUI: a floating review would die at process exit in headless
182
187
  // modes, and a note there fired an unrequested follow-up run. Fail-safe:
183
188
  // unknown/mode-less contexts skip too (missed review < surprise run).
@@ -93,9 +93,9 @@ function fakeCtx(entries: any[], sessionId = "test-session"): any {
93
93
  return ctx;
94
94
  }
95
95
 
96
- async function fire(_pi: any, state: any, channel: string, ctx: any): Promise<void> {
96
+ async function fire(_pi: any, state: any, channel: string, ctx: any, event: any = {}): Promise<void> {
97
97
  const handlers = state.eventHandlers.get(channel) ?? [];
98
- for (const h of handlers) await h({}, ctx);
98
+ for (const h of handlers) await h(event, ctx);
99
99
  // agent_settled schedules the review fire-and-forget (never blocks the
100
100
  // settle) — drain the event loop so a floating review settles before
101
101
  // assertions.
@@ -202,6 +202,22 @@ describe("advisor module wiring", () => {
202
202
  assert.equal(calls, 1, "review resumed after re-enabling");
203
203
  });
204
204
 
205
+ it("skips the review when the run settled aborted (pi 1.1.0 Escape flag)", async () => {
206
+ const { pi, state } = createFakePi();
207
+ advisorModule(pi);
208
+ writeSettings({ advisor: { models: [MODEL] } });
209
+ await fire(pi, state, "session_start", available(fakeCtx([])));
210
+ let calls = 0;
211
+ __setIsolatedForTest(async (_c, models) => { calls++; return { text: '{"severity":"nit","note":"live"}', model: models[0], usage: NO_USAGE }; });
212
+ const settled = step(available(fakeCtx(toolCalls(4))), "tui");
213
+ // User cancelled the run → no review of a half-finished transcript.
214
+ await fire(pi, state, "agent_settled", settled, { aborted: true });
215
+ assert.equal(calls, 0, "aborted settle does not burn a review");
216
+ // A clean settle (field absent — older pi passes nothing) still reviews.
217
+ await fire(pi, state, "agent_settled", settled);
218
+ assert.equal(calls, 1, "clean settle reviews as before");
219
+ });
220
+
205
221
  it("/advisor on re-syncs tool availability after the model becomes available again", async () => {
206
222
  const { pi, state } = createFakePi();
207
223
  advisorModule(pi);
@@ -2,8 +2,7 @@
2
2
  * Pi's built-in tools as /config toggles over the `defaultTools` setting.
3
3
  *
4
4
  * Rows live on the Tools tab ("Built-in tools" section): one toggle per
5
- * built-in tool plus the two built-in extension tools (codemode,
6
- * tool_search). The stock four (read, bash, edit, write) default on — pi
5
+ * built-in tool plus codemode (the built-in extension tool). The stock four (read, bash, edit, write) default on — pi
7
6
  * enables exactly those unless `defaultTools` changes them. A plain-list
8
7
  * write only replaces the BUILT-IN startup selection; extension tools with
9
8
  * `defaultActive: true` still self-activate, so ceulen's tools are never
@@ -2,7 +2,8 @@
2
2
  //
3
3
  // Ported from @bacnh85/pi-munin 0.5.12 extensions/index.ts (SDK vendored to
4
4
  // lib/sdk.ts; dotenv dropped — ceulen's bundle env.ts ingests trusted .env).
5
- // Registers the 8 munin_* tools (all deferred — tool_search loads them),
5
+ // Registers the 8 munin_* tools (search/get direct; the other six deferred —
6
+ // tool_search loads them),
6
7
  // /munin-status, the Munin Memory Protocol injection (only when configured),
7
8
  // the tool_result error sanitizer, and the munin skill (resources_discover).
8
9
  // Config lives at PROJECT level (.pi/settings.json `munin` section) — see
@@ -68,9 +69,8 @@ const MUNIN_PROTOCOL_HEADER = `## Munin Memory Protocol
68
69
 
69
70
  Use Munin to recover and preserve verified project knowledge, not as a task log.
70
71
  If Munin is unavailable, state that briefly when it matters and continue from
71
- repository evidence. The munin_* tools are deferred: if none are declared yet,
72
- load them with one tool_search call for "munin" (they stay declared for the
73
- rest of the session).
72
+ repository evidence. munin_search/munin_get are always declared; the other
73
+ munin_* tools load on demand with one tool_search call for "munin".
74
74
 
75
75
  ### Before acting
76
76
 
@@ -889,8 +889,12 @@ export default function planModule(pi: ExtensionAPI): void {
889
889
 
890
890
  /** Plan written → prefill /plan-approve, or execute immediately under
891
891
  * auto-approve. */
892
- pi.on("agent_settled", async (_event, ctx) => {
892
+ pi.on("agent_settled", async (event, ctx) => {
893
893
  if (!planModeEnabled || !planReadyForReview) return;
894
+ // pi 1.1.0 flags runs the user cancelled (Escape): never approve off a
895
+ // settle they aborted. Leave planReadyForReview set — a later clean
896
+ // settle still picks the plan up.
897
+ if ((event as { aborted?: boolean }).aborted) return;
894
898
  planReadyForReview = false;
895
899
  persistState();
896
900
  if (settings.autoApprove && ctx.mode !== "print") {
@@ -200,6 +200,20 @@ describe("plan mode — prompt + approval flow", () => {
200
200
  assert.match(h.userMessages[0].content, /Execute the approved plan/);
201
201
  });
202
202
 
203
+ it("auto-approve never fires off an aborted settle; the plan still approves on a clean one", async () => {
204
+ setPlanSettings(agent.dir, { autoApprove: true });
205
+ const h = await start();
206
+ await h.commands.plan.handler("", h.ctx({ cwd: REPO }));
207
+ await h.tools.write_plan.execute("tc1", { title: "T", content: "body" }, undefined, undefined, h.ctx({ cwd: REPO }));
208
+ // User hit Escape after write_plan → no autonomous execution.
209
+ await h.fire("agent_settled", { aborted: true }, h.ctx({ cwd: REPO }));
210
+ assert.equal(h.userMessages.length, 0, "aborted settle does not execute");
211
+ // The plan stays pending: the next clean settle approves it.
212
+ await h.fire("agent_settled", {}, h.ctx({ cwd: REPO }));
213
+ assert.equal(h.userMessages.length, 1);
214
+ assert.match(h.userMessages[0].content, /Execute the approved plan/);
215
+ });
216
+
203
217
  it("/plan-approve without a plan warns", async () => {
204
218
  const h = await start();
205
219
  await h.commands["plan-approve"].handler("current", h.ctx({ cwd: REPO }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ceulen",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Ceulen — the Pi coding agent, fully dressed: one bundle extension carrying the full toolkit with a single /ceulen config command.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -52,8 +52,8 @@
52
52
  ]
53
53
  },
54
54
  "peerDependencies": {
55
- "@earendil-works/pi-coding-agent": ">=0.99.1 <1.1.0",
56
- "@earendil-works/pi-tui": ">=0.99.1 <1.1.0",
55
+ "@earendil-works/pi-coding-agent": ">=0.99.1 <1.2.0",
56
+ "@earendil-works/pi-tui": ">=0.99.1 <1.2.0",
57
57
  "typebox": "*"
58
58
  },
59
59
  "devDependencies": {