ceulen 0.10.0 → 0.11.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +56 -1
  3. package/extensions/lib/plan-bridge.ts +18 -0
  4. package/extensions/lib/registry.ts +14 -0
  5. package/extensions/lib/skill-path.test.ts +35 -0
  6. package/extensions/lib/skill-path.ts +22 -0
  7. package/extensions/modules/a2a/index.ts +5 -3
  8. package/extensions/modules/a2a/lib/config.ts +1 -1
  9. package/extensions/modules/a2a/lib/registry.ts +1 -1
  10. package/extensions/modules/attachments/configPanel.ts +91 -0
  11. package/extensions/modules/attachments/index.ts +274 -0
  12. package/extensions/modules/attachments/lib/clipboard-files.ts +80 -0
  13. package/extensions/modules/attachments/lib/pastes.ts +45 -0
  14. package/extensions/modules/attachments/lib/paths.ts +74 -0
  15. package/extensions/modules/attachments/lib/registry.ts +70 -0
  16. package/extensions/modules/attachments/lib/settings.ts +99 -0
  17. package/extensions/modules/attachments/lib/tray.ts +74 -0
  18. package/extensions/modules/attachments/test/configPanel.test.ts +122 -0
  19. package/extensions/modules/attachments/test/index.test.ts +870 -0
  20. package/extensions/modules/attachments/test/module.test.ts +53 -0
  21. package/extensions/modules/composer/index.ts +19 -1
  22. package/extensions/modules/composer/lib/footer.ts +7 -7
  23. package/extensions/modules/composer/lib/shapes.ts +237 -112
  24. package/extensions/modules/composer/test/editor.test.ts +3 -3
  25. package/extensions/modules/composer/test/footer.test.ts +1 -1
  26. package/extensions/modules/composer/test/module.test.ts +8 -7
  27. package/extensions/modules/composer/test/screen.test.ts +10 -9
  28. package/extensions/modules/composer/test/shapes.test.ts +83 -61
  29. package/extensions/modules/config/index.ts +3 -0
  30. package/extensions/modules/config/test/renderTools.test.ts +1 -1
  31. package/extensions/modules/cron/configPanel.ts +103 -0
  32. package/extensions/modules/cron/index.ts +638 -0
  33. package/extensions/modules/cron/lib/jobs.ts +201 -0
  34. package/extensions/modules/cron/lib/schedule.ts +161 -0
  35. package/extensions/modules/cron/test/cwd-repro.test.ts +98 -0
  36. package/extensions/modules/cron/test/index.test.ts +859 -0
  37. package/extensions/modules/cron/test/schedule.test.ts +93 -0
  38. package/extensions/modules/munin/index.ts +4 -2
  39. package/extensions/modules/permission/index.ts +567 -0
  40. package/extensions/modules/permission/test/permission.test.ts +789 -0
  41. package/extensions/modules/plan/index.ts +5 -0
  42. package/extensions/modules/ponytail/index.ts +2 -2
  43. package/extensions/modules/repair/index.ts +134 -3
  44. package/extensions/modules/repair/lib/settings.ts +1 -1
  45. package/extensions/modules/repair/test/freshness.test.ts +169 -0
  46. package/extensions/modules/router/lib/provider.ts +13 -9
  47. package/extensions/modules/subagent/index.ts +38 -5
  48. package/extensions/modules/subagent/lib/runner.ts +352 -14
  49. package/extensions/modules/subagent/test/worktree.test.ts +230 -0
  50. package/extensions/modules/usage/index.ts +193 -71
  51. package/extensions/modules/usage/test/context.test.ts +160 -120
  52. package/extensions/modules/ux/index.ts +2 -2
  53. package/extensions/modules/web/index.ts +4 -2
  54. package/extensions/modules/web/lib/chrome.ts +1 -1
  55. package/extensions/modules/web/test/a11y.test.ts +1 -1
  56. package/package.json +2 -2
  57. package/skills/cron/SKILL.md +58 -0
@@ -0,0 +1,53 @@
1
+ // attachments module wiring: the ceulen- widget key, the node:test conversion
2
+ // invariants, and the registry entry shape.
3
+ import assert from "node:assert/strict";
4
+ import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join } from "node:path";
7
+ import { after, before, describe, it } from "node:test";
8
+ import { readFileSync } from "node:fs";
9
+ import { MODULES } from "../../../lib/registry.js";
10
+ import attachmentsModule from "../index.js";
11
+
12
+ let TMP: string;
13
+
14
+ before(() => {
15
+ TMP = mkdtempSync(join(tmpdir(), "ceulen-att-mod-"));
16
+ mkdirSync(join(TMP, "agent"), { recursive: true });
17
+ process.env.PI_CODING_AGENT_DIR = join(TMP, "agent");
18
+ });
19
+
20
+ after(() => {
21
+ rmSync(TMP, { recursive: true, force: true });
22
+ if (process.env.PI_CODING_AGENT_DIR === join(TMP, "agent")) delete process.env.PI_CODING_AGENT_DIR;
23
+ });
24
+
25
+ describe("attachments module wiring", () => {
26
+ it("registers in the MODULES registry on the Files tab with its config factory", () => {
27
+ const entry = MODULES.find((m) => m.name === "attachments");
28
+ assert.ok(entry, "registry entry exists");
29
+ assert.equal(entry.category, "Files");
30
+ assert.equal(entry.load, attachmentsModule);
31
+ assert.ok(entry.config, "config factory wired");
32
+ assert.ok(!("tools" in entry) || entry.tools === undefined, "no tools to per-toggle");
33
+ assert.ok(!entry.core, "kill-switchable");
34
+ });
35
+
36
+ it("widget key is ceulen-prefixed (source scan — no pi- attachments key)", () => {
37
+ const src = readFileSync(new URL("../index.ts", import.meta.url), "utf8");
38
+ assert.ok(src.includes('"ceulen-attachments"'), "ceulen-attachments widget key present");
39
+ assert.ok(!src.includes('"pi-attachments"'), "upstream widget key gone");
40
+ assert.ok(!src.includes("pi-attachments-test"), "no upstream temp-dir prefix");
41
+ });
42
+
43
+ it("factory registers the shortcut + input/session handlers via guarded pi surface", () => {
44
+ const registered: string[] = [];
45
+ const shortcuts: string[] = [];
46
+ attachmentsModule({
47
+ on: (event: string) => registered.push(event),
48
+ registerShortcut: (key: string) => shortcuts.push(key),
49
+ } as any);
50
+ assert.deepEqual(registered.sort(), ["input", "session_start"]);
51
+ assert.equal(shortcuts.length, 1);
52
+ });
53
+ });
@@ -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
  }