ceulen 0.9.0 → 0.10.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/extensions/lib/registry.ts +8 -2
  3. package/extensions/lib/skill-path.test.ts +35 -0
  4. package/extensions/lib/skill-path.ts +22 -0
  5. package/extensions/modules/a2a/index.ts +2 -2
  6. package/extensions/modules/a2a/lib/config.ts +1 -1
  7. package/extensions/modules/a2a/lib/registry.ts +1 -1
  8. package/extensions/modules/composer/index.ts +19 -1
  9. package/extensions/modules/composer/lib/footer.ts +7 -7
  10. package/extensions/modules/composer/lib/shapes.ts +237 -112
  11. package/extensions/modules/composer/test/editor.test.ts +3 -3
  12. package/extensions/modules/composer/test/footer.test.ts +1 -1
  13. package/extensions/modules/composer/test/module.test.ts +8 -7
  14. package/extensions/modules/composer/test/screen.test.ts +10 -9
  15. package/extensions/modules/composer/test/shapes.test.ts +83 -61
  16. package/extensions/modules/config/index.ts +1 -0
  17. package/extensions/modules/config/test/renderTools.test.ts +1 -1
  18. package/extensions/modules/gh/configPanel.ts +82 -0
  19. package/extensions/modules/gh/index.ts +86 -0
  20. package/extensions/modules/gh/lib/gh-cli.ts +337 -0
  21. package/extensions/modules/gh/lib/ops.ts +771 -0
  22. package/extensions/modules/gh/test/gh.test.ts +280 -0
  23. package/extensions/modules/munin/index.ts +2 -2
  24. package/extensions/modules/plan/lib/plan-tools.ts +8 -0
  25. package/extensions/modules/ponytail/index.ts +2 -2
  26. package/extensions/modules/repair/index.ts +138 -0
  27. package/extensions/modules/repair/lib/guards.ts +1 -1
  28. package/extensions/modules/repair/lib/read-selector.ts +242 -0
  29. package/extensions/modules/repair/lib/settings.ts +1 -1
  30. package/extensions/modules/repair/test/read-selector.test.ts +198 -0
  31. package/extensions/modules/router/lib/provider.ts +13 -9
  32. package/extensions/modules/steering/configPanel.ts +8 -0
  33. package/extensions/modules/steering/index.ts +6 -0
  34. package/extensions/modules/steering/lib/settings.ts +6 -2
  35. package/extensions/modules/steering/lib/think.ts +66 -0
  36. package/extensions/modules/steering/test/harness.ts +5 -0
  37. package/extensions/modules/steering/test/settings.test.ts +2 -0
  38. package/extensions/modules/steering/test/think.test.ts +77 -0
  39. package/extensions/modules/subagent/lib/runner.ts +4 -2
  40. package/extensions/modules/ux/index.ts +2 -2
  41. package/extensions/modules/web/index.ts +39 -3
  42. package/extensions/modules/web/lib/a11y.ts +252 -0
  43. package/extensions/modules/web/lib/chrome.ts +1 -1
  44. package/extensions/modules/web/test/a11y.test.ts +218 -0
  45. package/extensions/modules/web/test/extension.test.ts +2 -2
  46. package/extensions/modules/web/test/hook.test.ts +2 -2
  47. package/extensions/modules/web/vendor/axe/LICENSE +362 -0
  48. package/extensions/modules/web/vendor/axe/LICENSE-3RD-PARTY.txt +66 -0
  49. package/extensions/modules/web/vendor/axe/README.md +19 -0
  50. package/extensions/modules/web/vendor/axe/axe.min.js +12 -0
  51. package/package.json +2 -2
  52. package/skills/web/SKILL.md +1 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.10.1 — 2026-10-07
6
+
7
+ - **Windows fix**: extension load crashed with `ENOENT ... lstat 'D:\C:'` —
8
+ the resources_discover skill path was built with `new URL(...).pathname`,
9
+ which on Windows yields `/C:/...` (leading slash before the drive letter);
10
+ realpathSync resolved it against the current drive. The bug existed in FIVE
11
+ modules (web, munin, a2a, ponytail, ux). One shared helper
12
+ `extensions/lib/skill-path.ts` (`fileURLToPath`) now serves all call sites,
13
+ with a regression test.
14
+
15
+ - **Security & robustness review** (12 files): three settings writers (a2a
16
+ `writeSettingsA2A`, repair settings, a2a session registry) now write
17
+ `mode: 0o600` like every sibling writer — the files carry API keys/tokens;
18
+ router `refreshModels` no longer throws on null entries in a hand-edited
19
+ models-store.json; web `--virtual-time-budget` clamped non-negative;
20
+ subagent worktree patch temp file gets a randomUUID name + exclusive
21
+ (`wx`) write (shared-/tmp symlink hardening; cleanup already existed).
22
+
23
+ - **composer**: status layer aligned with OMP's actual rendering (source-level
24
+ study of `packages/tui/src/components/composer/*` + `status-line/component.ts`):
25
+ band/box embed OMP's POWERLINE row — bg-filled left group
26
+ `π > ⬢ model · level > 📁 dir > ⑂ git` (thin `>` separators, model icon,
27
+ dot-joined thinking level) over the context-reactive GAUGE (accent used-
28
+ portion, rounded `N%` label riding the used cells, `┃` at pi's compaction
29
+ threshold (window − 16384) when armed, window figure right-justified), with
30
+ the session-title chip on box (`─ omp ─╮`); the band starts FLUSH (OMP's
31
+ `sep.powerlineCapLeft` is empty outside the nerd set — no `╭─` cap). claude
32
+ and rule dock the title chip on the top rule and render the left group +
33
+ `◫ N%/window ⟲` context segment on a standalone BOTTOM status bar (after
34
+ the closing rule for claude, after a spacer row for rule) — pi/borderless/
35
+ field/rail render the full bar with the title right-justified. Context
36
+ segment steps at OMP's thresholds (>50 warning, >90 error) and carries the
37
+ `⟲` auto-compact icon; git indicators get OMP's per-indicator colors
38
+ (`*n` warn, `+n` success, `?n` dim; branch warns only when dirty); token
39
+ figures use OMP's formatNumber (`200K`, `1.0M`, trailing `.0` trimmed);
40
+ thinking level rides the model segment as `⬢ model · level` (was
41
+ `(provider) model (level)`). Session title sourced from
42
+ `sessionManager.getSessionName()`; line 1 (rate · token stats · quota
43
+ windows) unchanged.
44
+
45
+ ## 0.10.0 — 2026-10-05
46
+
47
+ - **gh module**: new module — ONE read-only `github` tool over the `gh` CLI
48
+ (port of oh-my-pi's github tool surface): `repo_view`, `file_read`,
49
+ `pr_view`, `pr_diff`, the five `search_*` flavors (issues/prs/code/commits/
50
+ repos, with repo:/org:/user: scope detection + since/until qualifiers), and
51
+ `run_watch` (lean JSON poller with failed-job log tails; budget
52
+ `gh.runWatchTimeoutSecs`, default 600s, on /config → Tools → GitHub).
53
+ Zero npm deps (`node:child_process` spawn, non-interactive env, 5-min
54
+ deadline, 8-MB output cap, one runner seam); fails open on a missing `gh`
55
+ binary. Mutating flows (pr_create/checkout/push) deliberately deferred to
56
+ bash `gh` — plan-mode auto-allow stays valid via READ_ONLY_TOOLS.
57
+
58
+ - **Read path selectors** (repair module): the wrapped `read` accepts OMP-style
59
+ suffixes — `:50`, `:50-200`, `:50+150`, `:50-`, `:-60`, comma-joined
60
+ multi-ranges (`:5-16,960-973`, `:19,59`), `:raw` compounds, and `:conflicts`
61
+ (one block per unresolved merge conflict). Literal-path-wins resolution (OMP
62
+ #4618); multi-range/conflicts slice in-memory with `[lines … of N]` headers.
63
+
64
+ - **think scratchpad tool** (steering module): OMP-parity private scratchpad,
65
+ opt-in via `steering.thinkTool` (default off; binds at load — autoBg
66
+ precedent). The call renders as one dim `· think (N chars)` marker so
67
+ planning notes stay out of the visible transcript while remaining in context
68
+ for later rounds. OMP's externalThinking reasoning-suppression is NOT ported
69
+ (providers flag the request shape as abuse; pi's thinking levels are the
70
+ honest off-switch).
71
+
72
+ - **web_a11y** (web module, 12th tool): real rendered-page accessibility audit
73
+ — axe-core 4.13 vendored unmodified (`vendor/axe/`, MPL-2.0, lazy-loaded,
74
+ zero new deps) injected into local headless Chrome over the existing
75
+ web_interact CDP lifecycle. Returns OMP-format violation reports (impact,
76
+ rule, helpUrl, node targets, `… and N more`); `tags`/`rules`/`selector`/
77
+ `include_incomplete` params; same-origin iframes only (axe walks them
78
+ in-page). The runtime complement to `ux_audit`'s static CSS checks. In-page
79
+ failures ride back through the evaluate value (the CDP connection layer
80
+ drops top-level exceptionDetails).
81
+
3
82
  ## 0.9.0 — 2026-10-04
4
83
 
5
84
  - **todo HUD**: OMP-parity live UI for the todo module — an above-editor
@@ -42,6 +42,8 @@ import muninModule from "../modules/munin/index.ts";
42
42
  import { muninConfig } from "../modules/munin/configPanel.ts";
43
43
  import webModule from "../modules/web/index.ts";
44
44
  import { webConfig } from "../modules/web/configPanel.ts";
45
+ import ghModule from "../modules/gh/index.ts";
46
+ import { ghConfig } from "../modules/gh/configPanel.js";
45
47
  import rulesModule from "../modules/rules/index.ts";
46
48
  import configModule from "../modules/config/index.ts";
47
49
 
@@ -150,9 +152,13 @@ export const MODULES: ModuleEntry[] = [
150
152
  // (conditional on web_* tools being active) — no prompt-rewrite contract
151
153
  // beyond fff's shipped precedent.
152
154
  { name: "web", category: "Tools", describe: "Unified web tools: search (SearXNG/Brave/Firecrawl), extract & crawl (JSDOM/Firecrawl/Crawl4AI/agy), screenshot/PDF, CDP browser interaction, Gemini research, image generation, one-off chat.", load: webModule, config: webConfig, tools: [
153
- "web_search", "web_extract", "web_map", "web_crawl", "web_screenshot", "web_pdf", "web_interact", "web_research", "web_image", "web_chat", "web_status",
155
+ "web_search", "web_extract", "web_map", "web_crawl", "web_screenshot", "web_pdf", "web_interact", "web_research", "web_image", "web_chat", "web_status", "web_a11y",
154
156
  ] },
155
157
  { name: "rules", category: "Context", describe: "Sticky RULES.md constraints carried in every request + a rulebook of on-demand rules served by rule_get. Nearest-first project walk over user-level.", load: rulesModule, tools: ["rule_get"] },
158
+ // gh after web: same class of external-fetch tooling; fail-open on a missing
159
+ // gh binary (registers nothing until installed). Read-only ops only, so
160
+ // plan mode auto-allows it (plan-tools.ts READ_ONLY_TOOLS).
161
+ { 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, tools: ["github"] },
156
162
  // Steering LAST of the prompt rewriters, i.e. after EVERY before_agent_start
157
163
  // composer (ponytail/plan/subagent/munin/advisor/ux/fff/serena/web/rules) and
158
164
  // before the config module (load order is load-bearing even though its
@@ -162,7 +168,7 @@ export const MODULES: ModuleEntry[] = [
162
168
  // (byte-identical minimal prompt) instead of appending to a prompt that
163
169
  // serena/web then append to. Nothing after this entry (rtk, config) touches
164
170
  // the prompt — do not move it earlier or add a prompt rewriter after it.
165
- { name: "steering", category: "Model", describe: "Per-model-family steering (DeepSeek/GLM): first-tool hints, reasoning strip, leak cleaning, error recovery hints, DeepSeek guidance + v4-pro minimal-mode anchor.", load: steeringModule, config: steeringConfig },
171
+ { name: "steering", category: "Model", describe: "Per-model-family steering (DeepSeek/GLM): first-tool hints, reasoning strip, leak cleaning, error recovery hints, DeepSeek guidance + v4-pro minimal-mode anchor.", load: steeringModule, config: steeringConfig, tools: ["think"] },
166
172
  // ── Shell ──────────────────────────────────────────────────────────────
167
173
  { name: "rtk", category: "Shell", describe: "Route shell commands through RTK for token savings.", load: rtkModule },
168
174
  // ── Plugins ────────────────────────────────────────────────────────────
@@ -0,0 +1,35 @@
1
+ // Windows regression: `new URL("../../../skills/", import.meta.url).pathname`
2
+ // yields "/C:/repo/skills/" — a leading slash before the drive letter — and
3
+ // fs.realpathSync then resolves it against the CURRENT drive, dying with
4
+ // `ENOENT ... lstat 'D:\C:'` at extension load. skillsRoot() must return a
5
+ // native path (fileURLToPath), i.e. never the drive-slash shape.
6
+
7
+ import { describe, it } from "node:test";
8
+ import assert from "node:assert/strict";
9
+ import { existsSync, realpathSync } from "node:fs";
10
+ import { isAbsolute, join } from "node:path";
11
+
12
+ import { skillsRoot } from "./skill-path.js";
13
+
14
+ describe("skillsRoot", () => {
15
+ it("resolves the in-package skills/ dir on disk", () => {
16
+ const root = skillsRoot();
17
+ assert.ok(existsSync(root), `skills root exists: ${root}`);
18
+ // realpathSync is the call that blew up on Windows — it must not throw.
19
+ assert.equal(typeof realpathSync(root), "string");
20
+ });
21
+
22
+ it("never produces a drive-letter path with a leading slash", () => {
23
+ assert.doesNotMatch(skillsRoot(), /^\/[A-Za-z]:\//);
24
+ });
25
+
26
+ it("joins to this package's own skill dirs", () => {
27
+ for (const name of ["web", "munin", "a2a", "ponytail", "ux-design"]) {
28
+ assert.ok(existsSync(join(skillsRoot(), name)), `skill dir exists: ${name}`);
29
+ }
30
+ });
31
+
32
+ it("is absolute (never resolved against cwd)", () => {
33
+ assert.ok(isAbsolute(skillsRoot()));
34
+ });
35
+ });
@@ -0,0 +1,22 @@
1
+ // Shared skills/ root resolution for every module's resources_discover handler.
2
+ //
3
+ // `new URL("../../../skills/", import.meta.url).pathname` is WRONG on Windows:
4
+ // the WHATWG URL pathname keeps the authority-style leading slash and percent
5
+ // encoding, so a file URL like file:///C:/repo/skills/ yields "/C:/repo/skills/".
6
+ // fs.realpathSync("/C:/...") then resolves against the CURRENT drive's root
7
+ // (e.g. D:\) and load dies with `ENOENT ... lstat 'D:\C:'`.
8
+ // fileURLToPath decodes and strips the leading slash on drive-letter paths,
9
+ // giving the native `C:\repo\skills\` shape.
10
+
11
+ import { fileURLToPath } from "node:url";
12
+
13
+ // This file sits at extensions/lib/, so the repo-root skills/ dir is TWO
14
+ // levels up (modules/<name>/index.ts callers need three — they import this
15
+ // helper instead of building the URL themselves).
16
+ //
17
+ // ponytail: assumes the standard in-repo layout (extensions/lib/ next to
18
+ // skills/). A future relocated build should set an explicit package-root
19
+ // constant here rather than deepen the relative walk.
20
+ export function skillsRoot(): string {
21
+ return fileURLToPath(new URL("../../skills/", import.meta.url));
22
+ }
@@ -41,6 +41,7 @@ import { Container, Text } from "@earendil-works/pi-tui";
41
41
  // (configPanel.ts). ceulen deltas: ceulen-a2a-inbound customType/status key,
42
42
  // per-tool kill-switch wrap, resources_discover skill, restart bridge export.
43
43
  import { readDisabledTools } from "../../lib/tools.js";
44
+ import { skillsRoot } from "../../lib/skill-path.js";
44
45
 
45
46
  // ---------------------------------------------------------------------------
46
47
  // Module state
@@ -546,8 +547,7 @@ export default function a2aExtension(pi: ExtensionAPI): void {
546
547
  // resources_discover — NOT via the package.json pi.skills manifest — so the
547
548
  // kill-switch gates it too (web module pattern).
548
549
  pi.on("resources_discover", () => {
549
- const skillsRoot = new URL("../../../skills/", import.meta.url).pathname;
550
- return { skillPaths: [join(realpathSync(skillsRoot), "a2a")] };
550
+ return { skillPaths: [join(realpathSync(skillsRoot()), "a2a")] };
551
551
  });
552
552
 
553
553
  pi.registerTool({
@@ -768,7 +768,7 @@ export function writeSettingsA2A(opts: {
768
768
 
769
769
  // Atomic write: temp file + rename.
770
770
  const tmp = target + ".tmp";
771
- writeFileSync(tmp, JSON.stringify(json, null, 2) + "\n", "utf-8");
771
+ writeFileSync(tmp, JSON.stringify(json, null, 2) + "\n", { encoding: "utf-8", mode: 0o600 });
772
772
  renameSync(tmp, target);
773
773
  return target;
774
774
  }
@@ -62,7 +62,7 @@ export function register(desc: SessionDescriptor, piDir: string): void {
62
62
  try {
63
63
  const p = fileFor(piDir, desc.pid);
64
64
  mkdirSync(dir(piDir), { recursive: true });
65
- writeFileSync(p, JSON.stringify(desc, null, 2), { encoding: "utf-8" });
65
+ writeFileSync(p, JSON.stringify(desc, null, 2), { encoding: "utf-8", mode: 0o600 });
66
66
  } catch {
67
67
  /* best-effort */
68
68
  }
@@ -21,7 +21,6 @@ import { row, type PanelGroup, type PanelMenuOption } from "../../lib/panel.js";
21
21
  import { getGenRate } from "../../lib/rate.js";
22
22
  import { USAGE_STATUS_KEY, getUsageItem } from "../../lib/usage-store.js";
23
23
  import { ComposerFooter, statsLine, sessionTotals } from "./lib/footer.ts";
24
- import { formatCompact } from "./lib/shapes.ts";
25
24
  import { execFile } from "node:child_process";
26
25
  import { DEFAULT_SHAPE, IDENTITY_THEME, isShapeId, parseGitStats, previewShape, readGitBranch, ShapeEditor, shapeById, shapeTheme, SHAPES, type BandData, type GitStats, type ShapeTheme } from "./lib/shapes.ts";
27
26
  import { readComposerShape, writeComposerSection } from "./lib/settings.ts";
@@ -57,6 +56,24 @@ function bandStats(ctx: ExtensionContext | undefined): string {
57
56
  }
58
57
  }
59
58
 
59
+ /** Session title (OMP's session_name segment — the right group / rule chip).
60
+ * Cached with the same keys as the stats scan. */
61
+ let nameCache: { sessionId: string; name: string } | undefined;
62
+
63
+ function bandSessionName(ctx: ExtensionContext | undefined): string {
64
+ if (!ctx) return "";
65
+ try {
66
+ const sm = ctx.sessionManager;
67
+ const sessionId = sm.getSessionId();
68
+ if (nameCache?.sessionId === sessionId) return nameCache.name;
69
+ const name = sm.getSessionName() ?? "";
70
+ nameCache = { sessionId, name };
71
+ return name;
72
+ } catch {
73
+ return "";
74
+ }
75
+ }
76
+
60
77
  /** Extension `setStatus` items for the footer's last line — key-sorted like
61
78
  * pi's own footer, minus the usage module's item (the band carries the quota
62
79
  * windows; printing them twice is the duplication this footer exists to
@@ -170,6 +187,7 @@ function shapeData(ctx: ExtensionContext | undefined): BandData {
170
187
  pct: usage?.percent ?? null,
171
188
  window: usage?.contextWindow,
172
189
  autoCompact: liveAutoCompact,
190
+ sessionName: bandSessionName(ctx),
173
191
  rate: getGenRate().tps,
174
192
  usage: getUsageItem().windows,
175
193
  usageTone: getUsageItem().tone,
@@ -14,7 +14,7 @@
14
14
  */
15
15
 
16
16
  import { truncateToWidth, type Component } from "@earendil-works/pi-tui";
17
- import { formatCompact, type ShapeTheme } from "./shapes.ts";
17
+ import { formatNumberTokens, type ShapeTheme } from "./shapes.ts";
18
18
 
19
19
  /** Usage fields the totals read (structural — pi's Usage satisfies it). */
20
20
  interface UsageLike {
@@ -69,14 +69,14 @@ export function sessionTotals(entries: readonly EntryLike[]): SessionTotals {
69
69
  return t;
70
70
  }
71
71
 
72
- /** Band token stats for line 1 (`↑1.9M ↓377k R69M CH99.7%` — cost stays
73
- * /usage-only; "" before any usage). */
72
+ /** Band token stats for line 1 (`↑1.9M ↓377k R69M CH99.7%` — OMP's
73
+ * formatNumber figures; cost stays /usage-only; "" before any usage). */
74
74
  export function statsLine(t: SessionTotals): string {
75
75
  const parts: string[] = [];
76
- if (t.input) parts.push(`↑${formatCompact(t.input)}`);
77
- if (t.output) parts.push(`↓${formatCompact(t.output)}`);
78
- if (t.cacheRead) parts.push(`R${formatCompact(t.cacheRead)}`);
79
- if (t.cacheWrite) parts.push(`W${formatCompact(t.cacheWrite)}`);
76
+ if (t.input) parts.push(`↑${formatNumberTokens(t.input)}`);
77
+ if (t.output) parts.push(`↓${formatNumberTokens(t.output)}`);
78
+ if (t.cacheRead) parts.push(`R${formatNumberTokens(t.cacheRead)}`);
79
+ if (t.cacheWrite) parts.push(`W${formatNumberTokens(t.cacheWrite)}`);
80
80
  if (t.cacheHitRate !== undefined) parts.push(`CH${t.cacheHitRate.toFixed(1)}%`);
81
81
  return parts.join(" ");
82
82
  }