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.
- package/CHANGELOG.md +98 -0
- package/README.md +56 -1
- package/extensions/lib/plan-bridge.ts +18 -0
- package/extensions/lib/registry.ts +14 -0
- package/extensions/lib/skill-path.test.ts +35 -0
- package/extensions/lib/skill-path.ts +22 -0
- package/extensions/modules/a2a/index.ts +5 -3
- package/extensions/modules/a2a/lib/config.ts +1 -1
- package/extensions/modules/a2a/lib/registry.ts +1 -1
- package/extensions/modules/attachments/configPanel.ts +91 -0
- package/extensions/modules/attachments/index.ts +274 -0
- package/extensions/modules/attachments/lib/clipboard-files.ts +80 -0
- package/extensions/modules/attachments/lib/pastes.ts +45 -0
- package/extensions/modules/attachments/lib/paths.ts +74 -0
- package/extensions/modules/attachments/lib/registry.ts +70 -0
- package/extensions/modules/attachments/lib/settings.ts +99 -0
- package/extensions/modules/attachments/lib/tray.ts +74 -0
- package/extensions/modules/attachments/test/configPanel.test.ts +122 -0
- package/extensions/modules/attachments/test/index.test.ts +870 -0
- package/extensions/modules/attachments/test/module.test.ts +53 -0
- package/extensions/modules/composer/index.ts +19 -1
- package/extensions/modules/composer/lib/footer.ts +7 -7
- package/extensions/modules/composer/lib/shapes.ts +237 -112
- package/extensions/modules/composer/test/editor.test.ts +3 -3
- package/extensions/modules/composer/test/footer.test.ts +1 -1
- package/extensions/modules/composer/test/module.test.ts +8 -7
- package/extensions/modules/composer/test/screen.test.ts +10 -9
- package/extensions/modules/composer/test/shapes.test.ts +83 -61
- package/extensions/modules/config/index.ts +3 -0
- package/extensions/modules/config/test/renderTools.test.ts +1 -1
- package/extensions/modules/cron/configPanel.ts +103 -0
- package/extensions/modules/cron/index.ts +638 -0
- package/extensions/modules/cron/lib/jobs.ts +201 -0
- package/extensions/modules/cron/lib/schedule.ts +161 -0
- package/extensions/modules/cron/test/cwd-repro.test.ts +98 -0
- package/extensions/modules/cron/test/index.test.ts +859 -0
- package/extensions/modules/cron/test/schedule.test.ts +93 -0
- package/extensions/modules/munin/index.ts +4 -2
- package/extensions/modules/permission/index.ts +567 -0
- package/extensions/modules/permission/test/permission.test.ts +789 -0
- package/extensions/modules/plan/index.ts +5 -0
- package/extensions/modules/ponytail/index.ts +2 -2
- package/extensions/modules/repair/index.ts +134 -3
- package/extensions/modules/repair/lib/settings.ts +1 -1
- package/extensions/modules/repair/test/freshness.test.ts +169 -0
- package/extensions/modules/router/lib/provider.ts +13 -9
- package/extensions/modules/subagent/index.ts +38 -5
- package/extensions/modules/subagent/lib/runner.ts +352 -14
- package/extensions/modules/subagent/test/worktree.test.ts +230 -0
- package/extensions/modules/usage/index.ts +193 -71
- package/extensions/modules/usage/test/context.test.ts +160 -120
- package/extensions/modules/ux/index.ts +2 -2
- package/extensions/modules/web/index.ts +4 -2
- package/extensions/modules/web/lib/chrome.ts +1 -1
- package/extensions/modules/web/test/a11y.test.ts +1 -1
- package/package.json +2 -2
- package/skills/cron/SKILL.md +58 -0
|
@@ -119,28 +119,28 @@ describe("composed screen through the real TUI renderer", () => {
|
|
|
119
119
|
assert.ok(compose(editor("rail")).out.includes("▎"), "rail glyph");
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
-
it("band carries the stock status on screen: icons on every segment, context
|
|
122
|
+
it("band carries the stock status on screen: icons on every segment, gauge with the context figure", () => {
|
|
123
123
|
// At the default 60 cols the band keeps brand+model+dir and sheds the rest
|
|
124
124
|
// whole; the widest capture exercises every segment at once. Line 1 (right-
|
|
125
125
|
// justified, OMP placement) sits above the band when present: rate · stats
|
|
126
126
|
// · usage on one row.
|
|
127
|
-
const
|
|
128
|
-
const narrow = compose(editor("band")).lines.find(
|
|
129
|
-
assert.ok(narrow.includes("π
|
|
127
|
+
const isBand = (l: string) => l.includes("π >") || l.includes("π ·");
|
|
128
|
+
const narrow = compose(editor("band")).lines.find(isBand)!;
|
|
129
|
+
assert.ok(narrow.includes("π > ⬢ GLM-5.3"), narrow);
|
|
130
130
|
assert.ok(narrow.includes("📁 ~/dev/ceulen"), narrow);
|
|
131
|
-
assert.ok(narrow.includes("12.
|
|
131
|
+
assert.ok(narrow.includes("12%") && narrow.includes("─1M"), `gauge carries the context figure: ${narrow}`);
|
|
132
132
|
assert.ok(!narrow.includes("…"), "whole segments only, no half-cut segment");
|
|
133
133
|
|
|
134
134
|
const wide = compose(editor("band"), 120);
|
|
135
|
-
const wideBand = wide.lines.find(
|
|
135
|
+
const wideBand = wide.lines.find(isBand)!;
|
|
136
136
|
const usageLine = wide.lines.find((l) => l.includes("⚡ 46 tok/s"))!;
|
|
137
137
|
assert.ok(usageLine.includes("↑1.9M ↓377k R69M") && usageLine.includes("R:59%"), `rate · stats · usage on line 1: ${usageLine}`);
|
|
138
138
|
assert.ok(!wideBand.includes("⚡"), `line 1 sits above the band: ${wide.lines.join("\n")}`);
|
|
139
139
|
assert.ok(wideBand.includes("⑂ main *3 +1 ?2"), wideBand);
|
|
140
|
-
assert.ok(wideBand.includes("12.
|
|
140
|
+
assert.ok(wideBand.includes("12%") && wideBand.includes("─1M"), wideBand); // gauge-embedded labels
|
|
141
141
|
|
|
142
|
-
const
|
|
143
|
-
assert.ok(
|
|
142
|
+
const claudeBar = compose(editor("claude"), 120).lines.find((l) => l.includes("GLM-5.3"))!;
|
|
143
|
+
assert.ok(claudeBar.includes("⑂ main") && claudeBar.includes("◫ 12.0%/1M"), claudeBar);
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
it("composes at narrow widths without eating closing chrome", () => {
|
|
@@ -203,6 +203,7 @@ describe("composed screen through the real TUI renderer", () => {
|
|
|
203
203
|
dim: (s: string) => s,
|
|
204
204
|
warn: (s: string) => s,
|
|
205
205
|
error: (s: string) => s,
|
|
206
|
+
success: (s: string) => s,
|
|
206
207
|
fill: (s: string) => s,
|
|
207
208
|
inverse: (s: string) => s,
|
|
208
209
|
};
|
|
@@ -11,10 +11,11 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
|
11
11
|
import { tmpdir } from "node:os";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import {
|
|
14
|
+
bottomBar,
|
|
14
15
|
composeStatus,
|
|
15
16
|
contentWidth,
|
|
16
17
|
DEFAULT_SHAPE,
|
|
17
|
-
|
|
18
|
+
formatNumberTokens,
|
|
18
19
|
ICONS,
|
|
19
20
|
parseGitStats,
|
|
20
21
|
gutterWidth,
|
|
@@ -29,6 +30,8 @@ import {
|
|
|
29
30
|
shapeById,
|
|
30
31
|
statusSegments,
|
|
31
32
|
surfacePainter,
|
|
33
|
+
type BandData,
|
|
34
|
+
type ShapeCtx,
|
|
32
35
|
type ShapeTheme,
|
|
33
36
|
} from "../lib/shapes.ts";
|
|
34
37
|
|
|
@@ -63,6 +66,24 @@ describe("composer shape vocabulary (OMP parity)", () => {
|
|
|
63
66
|
assert.equal(isShapeId("nope"), false);
|
|
64
67
|
assert.equal(isShapeId(42), false);
|
|
65
68
|
});
|
|
69
|
+
|
|
70
|
+
it("carries OMP's per-shape statusAttachment map (bottomBar + gap)", () => {
|
|
71
|
+
// OMP: band/box embed (no bar); claude/rule bar=left (title on the rule);
|
|
72
|
+
// pi/borderless/field/rail bar=full; ONLY rule/field/rail carry the gap
|
|
73
|
+
// spacer (borderless is bottomBarGap:false — flush under the prompt row).
|
|
74
|
+
const map = (id: string) => {
|
|
75
|
+
const s = shapeById(id);
|
|
76
|
+
return [s.bottomBar, s.barGap === true];
|
|
77
|
+
};
|
|
78
|
+
assert.deepEqual(map("band"), ["none", false]);
|
|
79
|
+
assert.deepEqual(map("box"), ["none", false]);
|
|
80
|
+
assert.deepEqual(map("claude"), ["left", false]);
|
|
81
|
+
assert.deepEqual(map("rule"), ["left", true]);
|
|
82
|
+
assert.deepEqual(map("pi"), ["full", false]);
|
|
83
|
+
assert.deepEqual(map("borderless"), ["full", false], "OMP borderless: no gap");
|
|
84
|
+
assert.deepEqual(map("field"), ["full", true]);
|
|
85
|
+
assert.deepEqual(map("rail"), ["full", true]);
|
|
86
|
+
});
|
|
66
87
|
});
|
|
67
88
|
|
|
68
89
|
describe("shape geometry", () => {
|
|
@@ -121,18 +142,18 @@ describe("chrome rendering through the shared builders", () => {
|
|
|
121
142
|
assert.ok(box[0]!.endsWith("╮"), `box top closes at ${w}: ${box[0]}`);
|
|
122
143
|
assert.ok(box[box.length - 1]!.endsWith("─╯"), `box bottom closes at ${w}: ${box[box.length - 1]}`);
|
|
123
144
|
const claude = previewShape("claude", w, th, { model: "M" }).map(plain);
|
|
124
|
-
assert.
|
|
145
|
+
assert.ok(claude.length >= 2, `claude keeps both rules at ${w}`);
|
|
125
146
|
for (const l of claude) assert.equal(visibleWidth(l), w, `claude row width at ${w}`);
|
|
126
147
|
}
|
|
127
148
|
});
|
|
128
149
|
|
|
129
150
|
it("status-bearing shapes show the live status line; band reserves a blank row when empty", () => {
|
|
130
151
|
const box = previewShape("box", 40, th, { model: "GLM-5.3", cwd: "ceulen", pct: 42 }).map(plain);
|
|
131
|
-
assert.ok(box[0]!.includes("GLM-5.3") && box[0]!.includes("ceulen") && box[0]!.includes("42
|
|
152
|
+
assert.ok(box[0]!.includes("GLM-5.3") && box[0]!.includes("ceulen") && box[0]!.includes("42%"), box[0]);
|
|
132
153
|
const bandEmpty = previewShape("band", 40, th).map(plain);
|
|
133
|
-
assert.
|
|
154
|
+
assert.ok(bandEmpty.every((l) => !l.includes("π")), "no status rows without data (the layout never shifts)");
|
|
134
155
|
const bandFull = previewShape("band", 40, th, { model: "M" }).map(plain);
|
|
135
|
-
assert.ok(bandFull[0]!.
|
|
156
|
+
assert.ok(bandFull[0]!.trimStart().startsWith("π") && bandFull[0]!.includes("M"), bandFull[0]);
|
|
136
157
|
});
|
|
137
158
|
|
|
138
159
|
it("rules carry pi's scroll indicator when lines are hidden", () => {
|
|
@@ -191,12 +212,13 @@ describe("git branch read (.git/HEAD)", () => {
|
|
|
191
212
|
});
|
|
192
213
|
|
|
193
214
|
describe("status line + surface fill", () => {
|
|
194
|
-
it("statusSegments splits OMP's stock groups: identity left,
|
|
195
|
-
const s = statusSegments({ model: "M",
|
|
196
|
-
assert.equal(plain(s.left), "π
|
|
197
|
-
assert.equal(plain(s.right), "
|
|
215
|
+
it("statusSegments splits OMP's stock groups: identity left, session title right", () => {
|
|
216
|
+
const s = statusSegments({ model: "M", thinkingLevel: "max", cwd: "~/dev/ceulen", branch: "main", rate: 46, pct: 42.6, window: 1_000_000, sessionName: "fix" }, th);
|
|
217
|
+
assert.equal(plain(s.left), "π > ⬢ M · max > 📁 ~/dev/ceulen > ⑂ main");
|
|
218
|
+
assert.equal(plain(s.right), "fix");
|
|
198
219
|
// Every segment carries its icon (OMP's glyph set).
|
|
199
220
|
assert.ok(plain(s.left).startsWith("π "), "brand leads the group");
|
|
221
|
+
assert.ok(plain(s.left).includes("⬢ M"), "model icon");
|
|
200
222
|
assert.ok(plain(s.left).includes("📁 ~/dev/ceulen"), "folder icon on the dir");
|
|
201
223
|
assert.ok(plain(s.left).includes("⑂ main"), "branch icon on the git segment");
|
|
202
224
|
// Generation rate is NOT a band segment — it renders right-justified on
|
|
@@ -214,7 +236,7 @@ describe("status line + surface fill", () => {
|
|
|
214
236
|
assert.ok(plain(rateLine({ stats: "↑1k ↓500" }, th, 40)).startsWith("↑1k ↓500"), "stats alone sits left");
|
|
215
237
|
assert.ok(plain(rateLine({ usage: "(router) R:59%/2H3M" }, th, 40)).startsWith("(router) R:59%/2H3M"), "usage alone sits left");
|
|
216
238
|
// Usage tone steps (error/warn) with the tightest window.
|
|
217
|
-
const toneTheme: ShapeTheme = { ...th, warn: (t) => `W(${t})`, error: (t) => `E(${t})` };
|
|
239
|
+
const toneTheme: ShapeTheme = { ...th, warn: (t: string) => `W(${t})`, error: (t: string) => `E(${t})` };
|
|
218
240
|
assert.ok(plain(rateLine({ usage: "R:9%/1M", usageTone: "error" }, toneTheme, 40)).startsWith("E(R:9%/1M)"), "error tone paints");
|
|
219
241
|
// Over-budget: the LEFT group sheds whole trailing segments (usage first,
|
|
220
242
|
// then stats); the rate yields only when the left group is gone.
|
|
@@ -228,26 +250,23 @@ describe("status line + surface fill", () => {
|
|
|
228
250
|
assert.equal(plain(rateLine({ rate: 46, stats: "↑1.9M ↓377k" }, th, 10)), "⚡ 46 tok/s", `rate is the last thing standing: ${plain(rateLine({ rate: 46, stats: "↑1.9M ↓377k" }, th, 10))}`);
|
|
229
251
|
// Blanks drop out — never wrong, just shorter. The brand only leads a
|
|
230
252
|
// group that exists, so an empty session keeps the band blank.
|
|
231
|
-
assert.equal(plain(statusSegments({ model: "M" }, th).left), "π
|
|
253
|
+
assert.equal(plain(statusSegments({ model: "M" }, th).left), "π > ⬢ M");
|
|
232
254
|
assert.equal(statusSegments({}, th).left, "", "no data → no brand");
|
|
233
255
|
assert.equal(statusSegments(undefined, th).left, "");
|
|
234
256
|
assert.equal(statusSegments(undefined, th).right, "");
|
|
235
|
-
assert.equal(plain(statusSegments({ model: " ", cwd: "x" }, th).left), "π
|
|
257
|
+
assert.equal(plain(statusSegments({ model: " ", cwd: "x" }, th).left), "π > 📁 x", "blank segments skipped");
|
|
236
258
|
// Branch without a cwd still renders; detached renders as-is.
|
|
237
|
-
assert.equal(plain(statusSegments({ branch: "detached" }, th).left), "π
|
|
259
|
+
assert.equal(plain(statusSegments({ branch: "detached" }, th).left), "π > ⑂ detached");
|
|
260
|
+
// No session title → empty right group.
|
|
261
|
+
assert.equal(statusSegments({ model: "M" }, th).right, "");
|
|
238
262
|
// Spinner takes the brand slot while a turn runs.
|
|
239
|
-
assert.equal(plain(statusSegments({ model: "M" }, th, "⟳").left), "⟳
|
|
263
|
+
assert.equal(plain(statusSegments({ model: "M" }, th, "⟳").left), "⟳ > ⬢ M");
|
|
240
264
|
});
|
|
241
265
|
|
|
242
|
-
it("model segment:
|
|
243
|
-
|
|
244
|
-
assert.equal(plain(statusSegments({ model: "
|
|
245
|
-
|
|
246
|
-
assert.equal(plain(statusSegments({ model: "Zai/GLM", provider: "zai" }, th).left), "π · Zai/GLM");
|
|
247
|
-
assert.equal(plain(statusSegments({ model: "M", provider: "zai" }, th).left), "π · (zai) M");
|
|
248
|
-
// `off` and blank levels render nothing, not "(off)".
|
|
249
|
-
assert.equal(plain(statusSegments({ model: "M", thinkingLevel: "off" }, th).left), "π · M");
|
|
250
|
-
assert.equal(plain(statusSegments({ model: "M", thinkingLevel: " " }, th).left), "π · M");
|
|
266
|
+
it("model segment: ⬢ icon, level after OMP's dot separator; off/blank level dropped", () => {
|
|
267
|
+
assert.equal(plain(statusSegments({ model: "zai/glm-5.3", provider: "zai" }, th).left), "π > ⬢ zai/glm-5.3");
|
|
268
|
+
assert.equal(plain(statusSegments({ model: "M", thinkingLevel: "off" }, th).left), "π > ⬢ M");
|
|
269
|
+
assert.equal(plain(statusSegments({ model: "M", thinkingLevel: " " }, th).left), "π > ⬢ M");
|
|
251
270
|
// Level without a model never renders alone.
|
|
252
271
|
assert.equal(statusSegments({ thinkingLevel: "max" }, th).left, "");
|
|
253
272
|
});
|
|
@@ -258,35 +277,36 @@ describe("status line + surface fill", () => {
|
|
|
258
277
|
th,
|
|
259
278
|
);
|
|
260
279
|
const left = plain(s.left);
|
|
261
|
-
assert.equal(left, "π
|
|
280
|
+
assert.equal(left, "π > ⬢ M · high > ⑂ main *10 +1 ?4");
|
|
262
281
|
// Supplied-but-dropped figures never leak into the band — line 1
|
|
263
282
|
// (rateLine) owns rate · stats · usage.
|
|
264
283
|
assert.ok(!left.includes("R:59%") && !left.includes("↑1.9M") && !left.includes("tok/s"), "usage/stats/rate stay off the band");
|
|
265
284
|
// Usage-only line 1 keeps tone-stepping.
|
|
266
|
-
assert.equal(plain(rateLine({ usage: "(r) R:59%/2H3M", usageTone: "warning" }, { ...th, warn: (t) => `W(${t})` }, 40)), "W((r) R:59%/2H3M)");
|
|
267
|
-
assert.equal(plain(statusSegments({ model: "M", usage: " " }, th).left), "π
|
|
268
|
-
assert.equal(plain(statusSegments({ model: "M", stats: "" }, th).left), "π
|
|
285
|
+
assert.equal(plain(rateLine({ usage: "(r) R:59%/2H3M", usageTone: "warning" }, { ...th, warn: (t: string) => `W(${t})` }, 40)), "W((r) R:59%/2H3M)");
|
|
286
|
+
assert.equal(plain(statusSegments({ model: "M", usage: " " }, th).left), "π > ⬢ M");
|
|
287
|
+
assert.equal(plain(statusSegments({ model: "M", stats: "" }, th).left), "π > ⬢ M");
|
|
269
288
|
});
|
|
270
289
|
|
|
271
|
-
it("context
|
|
290
|
+
it("context segment: ◫ icon, OMP format, color-steps at OMP's thresholds (>50 warn, >90 error), ⟲ when auto", () => {
|
|
272
291
|
const seen = { warn: 0, error: 0 };
|
|
273
292
|
const stepping: ShapeTheme = {
|
|
274
293
|
...th,
|
|
275
294
|
warn: (s) => (seen.warn++, s),
|
|
276
295
|
error: (s) => (seen.error++, s),
|
|
277
296
|
};
|
|
278
|
-
|
|
297
|
+
const seg = (d: BandData) => plain(bottomBar({ w: 200, hidden: 0, theme: stepping, data: d }, "full"));
|
|
298
|
+
assert.equal(seg({ pct: 42, window: 200_000 }), "π · ◫ 42.0%/200K");
|
|
279
299
|
assert.equal(seen.warn, 0);
|
|
280
|
-
assert.equal(
|
|
300
|
+
assert.equal(seg({ pct: 75, window: 200_000 }), "π · ◫ 75.0%/200K");
|
|
281
301
|
assert.equal(seen.warn, 1);
|
|
282
|
-
assert.equal(
|
|
302
|
+
assert.equal(seg({ pct: 95, window: 200_000 }), "π · ◫ 95.0%/200K");
|
|
283
303
|
assert.equal(seen.error, 1);
|
|
284
304
|
// Unknown pct with a known window shows the window alone.
|
|
285
|
-
assert.equal(
|
|
286
|
-
assert.equal(
|
|
287
|
-
//
|
|
288
|
-
assert.equal(
|
|
289
|
-
assert.equal(
|
|
305
|
+
assert.equal(seg({ pct: null, window: 200_000 }), "π · ◫ 200K/?");
|
|
306
|
+
assert.equal(seg({}), "", "nothing to show → no segment");
|
|
307
|
+
// OMP's auto-compact icon rides the context figure.
|
|
308
|
+
assert.equal(seg({ pct: 42, window: 200_000, autoCompact: true }), "π · ◫ 42.0%/200K ⟲");
|
|
309
|
+
assert.equal(seg({ pct: 95, window: 200_000, autoCompact: true }), "π · ◫ 95.0%/200K ⟲");
|
|
290
310
|
});
|
|
291
311
|
|
|
292
312
|
it("composeStatus justifies the right group; the left group yields first when narrow", () => {
|
|
@@ -298,25 +318,25 @@ describe("status line + surface fill", () => {
|
|
|
298
318
|
assert.equal(plain(composeStatus("LLLLLL", "RRRR", 5)), "RRRR", "right alone when the left cannot fit");
|
|
299
319
|
});
|
|
300
320
|
|
|
301
|
-
it("
|
|
302
|
-
assert.equal(
|
|
303
|
-
assert.equal(
|
|
304
|
-
assert.equal(
|
|
305
|
-
assert.equal(
|
|
306
|
-
assert.equal(
|
|
307
|
-
assert.equal(
|
|
308
|
-
assert.equal(
|
|
321
|
+
it("formatNumberTokens matches OMP's token figures", () => {
|
|
322
|
+
assert.equal(formatNumberTokens(0), "0");
|
|
323
|
+
assert.equal(formatNumberTokens(999), "999");
|
|
324
|
+
assert.equal(formatNumberTokens(2_500), "2.5K");
|
|
325
|
+
assert.equal(formatNumberTokens(200_000), "200K");
|
|
326
|
+
assert.equal(formatNumberTokens(1_000_000), "1M");
|
|
327
|
+
assert.equal(formatNumberTokens(12_000_000), "12M");
|
|
328
|
+
assert.equal(formatNumberTokens(Number.NaN), "0");
|
|
309
329
|
});
|
|
310
330
|
|
|
311
331
|
it("status chips/bands carry dir, branch and the context window", () => {
|
|
312
332
|
const data = { model: "M", cwd: "~/dev/ceulen", branch: "main", pct: 42.6, window: 1_000_000 };
|
|
313
333
|
const band = previewShape("band", 60, th, data).map(plain)[0]!;
|
|
314
334
|
assert.ok(band.includes("📁 ~/dev/ceulen") && band.includes("⑂ main"), band);
|
|
315
|
-
|
|
316
|
-
//
|
|
317
|
-
assert.ok(band.
|
|
335
|
+
// The gauge carries the context figure, rounded (OMP's embedded percent),
|
|
336
|
+
// and closes the band with the window label.
|
|
337
|
+
assert.ok(band.includes("43%") && band.includes("─1M"), band);
|
|
318
338
|
const box = previewShape("box", 60, th, data).map(plain)[0]!;
|
|
319
|
-
assert.ok(box.includes("📁 ~/dev/ceulen") && box.includes("
|
|
339
|
+
assert.ok(box.includes("📁 ~/dev/ceulen") && box.includes("43%") && box.endsWith("╮"), box);
|
|
320
340
|
});
|
|
321
341
|
|
|
322
342
|
it("band fills the status chip only, not the whole line (OMP's band)", () => {
|
|
@@ -326,24 +346,26 @@ describe("status line + surface fill", () => {
|
|
|
326
346
|
const line = shapeById("band").top!(c as never)!;
|
|
327
347
|
const filled = line.slice(line.indexOf("⟦") + 1, line.indexOf("⟧"));
|
|
328
348
|
assert.ok(filled.includes("main"), `identity is filled: ${filled}`);
|
|
329
|
-
|
|
330
|
-
// The context figure survives OUTSIDE the chip, and the line is still full width.
|
|
349
|
+
// The gauge (context figure) survives OUTSIDE the chip, and the line is full width.
|
|
331
350
|
assert.equal(visibleWidth(line), 80, "band still spans the full width");
|
|
332
|
-
assert.ok(plain(line).includes("42
|
|
333
|
-
assert.ok(plain(line).indexOf("⟧") < plain(line).indexOf("42
|
|
351
|
+
assert.ok(plain(line).includes("42%"), plain(line));
|
|
352
|
+
assert.ok(plain(line).indexOf("⟧") < plain(line).indexOf("42%"), "fill ends before the gauge");
|
|
334
353
|
});
|
|
335
354
|
|
|
336
|
-
it("git segment renders OMP's indicators
|
|
337
|
-
assert.equal(plain(statusSegments({ branch: "main" }, th).left), "π
|
|
355
|
+
it("git segment renders OMP's indicators with per-indicator colors", () => {
|
|
356
|
+
assert.equal(plain(statusSegments({ branch: "main" }, th).left), "π > ⑂ main", "clean tree: branch only");
|
|
338
357
|
const dirty = statusSegments({ branch: "main", git: { staged: 1, unstaged: 3, untracked: 2 } }, th).left;
|
|
339
358
|
assert.ok(plain(dirty).endsWith("⑂ main *3 +1 ?2"), plain(dirty));
|
|
340
|
-
//
|
|
341
|
-
|
|
342
|
-
const
|
|
343
|
-
statusSegments({ branch: "main", git: { staged:
|
|
344
|
-
assert.
|
|
345
|
-
|
|
346
|
-
|
|
359
|
+
// Per-indicator colors (OMP's statusLine colors): branch warns when dirty,
|
|
360
|
+
// staged paints success, untracked dims.
|
|
361
|
+
const marks: ShapeTheme = { ...th, warn: (s) => `W<${s}>`, success: (s) => `S<${s}>`, dim: (s) => `D<${s}>` };
|
|
362
|
+
const marked = plain(statusSegments({ branch: "main", git: { staged: 1, unstaged: 3, untracked: 2 } }, marks).left);
|
|
363
|
+
assert.ok(marked.includes("W<⑂ main> W<*3>") && marked.includes("S<+1>") && marked.includes("D<?2>"), marked);
|
|
364
|
+
// Clean tree paints the branch plain (never warning) — OMP colors only
|
|
365
|
+
// the INDICATORS, not the branch itself.
|
|
366
|
+
const clean = statusSegments({ branch: "main", git: { staged: 0, unstaged: 0, untracked: 0 } }, marks).left;
|
|
367
|
+
assert.ok(!plain(clean).includes("W<") && plain(clean).includes("⑂ main"), clean);
|
|
368
|
+
assert.equal(plain(statusSegments({ branch: "main", git: { staged: 0, unstaged: 0, untracked: 0 } }, th).left), "π > ⑂ main", "zero counts are clean");
|
|
347
369
|
});
|
|
348
370
|
|
|
349
371
|
it("parseGitStats counts porcelain XY states like OMP's indicators", () => {
|
|
@@ -254,6 +254,9 @@ export default function configModule(pi: ExtensionAPI, deps?: ModuleLoadDeps): v
|
|
|
254
254
|
ponytail: { section: "Ponytail", icon: "🦥" },
|
|
255
255
|
plan: { section: "Plan mode", icon: "🗺️" },
|
|
256
256
|
todo: { section: "Todo", icon: "☑" },
|
|
257
|
+
cron: { section: "Cron", icon: "⏰" },
|
|
258
|
+
attachments: { section: "Attachments", icon: "📎" },
|
|
259
|
+
permission: { section: "Permissions", icon: "🛡" },
|
|
257
260
|
serena: { section: "Serena" },
|
|
258
261
|
repair: { section: "Repair", icon: "🔧" },
|
|
259
262
|
fff: { section: "FFF search" },
|
|
@@ -34,7 +34,7 @@ function toolGroups(): PanelGroup[] {
|
|
|
34
34
|
describe("render smoke — ported modules' /config sections", () => {
|
|
35
35
|
it("renders Enable + per-tool rows inside the boxed frame with zero overflow", () => {
|
|
36
36
|
const groups = toolGroups();
|
|
37
|
-
assert.equal(groups.length,
|
|
37
|
+
assert.equal(groups.length, 16, "serena + fff + ux + munin + classifier + advisor + subagent + repair + plan + todo + web + rules + a2a + gh + cron + steering·think (rtk has no tools)");
|
|
38
38
|
const m = new ConfigPanelModel(groups, theme, "Settings");
|
|
39
39
|
m.getHeight = () => 40;
|
|
40
40
|
for (const w of [110, 100, 80, 60]) {
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cron's /config contribution — Tasks tab, Cron section.
|
|
3
|
+
*
|
|
4
|
+
* Rows write the GLOBAL agent-dir settings.json `cron` section (a
|
|
5
|
+
* writeCronSection sibling of readCronSettings). The module re-reads settings
|
|
6
|
+
* at load (global-only) and on every session_start (project overlay), so a
|
|
7
|
+
* save applies to the next session without /reload; the tick interval also
|
|
8
|
+
* re-arms on session_start.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { row, type PanelGroup } from "../../lib/panel.js";
|
|
14
|
+
import type { ModuleConfig } from "../../lib/registry.js";
|
|
15
|
+
import { readCronSettings, type CronSettings } from "./index.ts";
|
|
16
|
+
|
|
17
|
+
/** Effective settings for the panel — the same chain the scheduler uses. */
|
|
18
|
+
export function loadCronSettings(): CronSettings {
|
|
19
|
+
return readCronSettings();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Write ONE patch into the GLOBAL agent-dir `cron` section (never the merged
|
|
23
|
+
* snapshot — a project-overlay value must not be promoted to global). */
|
|
24
|
+
export function writeCronSection(patch: Partial<CronSettings>): string {
|
|
25
|
+
const file = join(process.env.PI_CODING_AGENT_DIR || join(homedir(), ".pi", "agent"), "settings.json");
|
|
26
|
+
let settings: Record<string, unknown>;
|
|
27
|
+
try {
|
|
28
|
+
settings = existsSync(file) ? (JSON.parse(readFileSync(file, "utf8")) as Record<string, unknown>) : {};
|
|
29
|
+
} catch {
|
|
30
|
+
throw new Error(`${file} is not valid JSON — fix or remove it before saving.`);
|
|
31
|
+
}
|
|
32
|
+
const s = (settings.cron ?? {}) as Record<string, unknown>;
|
|
33
|
+
Object.assign(s, patch);
|
|
34
|
+
settings.cron = s;
|
|
35
|
+
mkdirSync(join(file, ".."), { recursive: true });
|
|
36
|
+
const tmp = file + ".tmp";
|
|
37
|
+
writeFileSync(tmp, JSON.stringify(settings, null, 2) + "\n", { mode: 0o600 });
|
|
38
|
+
renameSync(tmp, file);
|
|
39
|
+
return file;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Build the cron panel groups over a working copy (mutated by row setters).
|
|
43
|
+
* Exported for tests. */
|
|
44
|
+
export function buildCronGroups(cfg: CronSettings): PanelGroup[] {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
key: "cron",
|
|
48
|
+
label: "Cron",
|
|
49
|
+
tab: "Tasks",
|
|
50
|
+
icon: "⏰",
|
|
51
|
+
rows: [
|
|
52
|
+
row("cron.enabled", "Scheduler enabled", "toggle", cfg.enabled, (v) => {
|
|
53
|
+
cfg.enabled = Boolean(v);
|
|
54
|
+
}, {
|
|
55
|
+
description: "Global kill switch for the in-process scheduler (30s ticks fire due jobs into the live session).",
|
|
56
|
+
defaultValue: true,
|
|
57
|
+
}),
|
|
58
|
+
row("cron.tickMs", "Tick interval (ms)", "number", cfg.tickMs, (v) => {
|
|
59
|
+
const n = Number(v);
|
|
60
|
+
if (Number.isFinite(n) && n > 0) cfg.tickMs = n;
|
|
61
|
+
}, {
|
|
62
|
+
description: "How often due jobs are checked. Clamped 5s–10min on read (default 30s). Re-arms on next session.",
|
|
63
|
+
defaultValue: 30_000,
|
|
64
|
+
}),
|
|
65
|
+
row("cron.timeoutMs", "Headless child cap (ms)", "number", cfg.timeoutMs, (v) => {
|
|
66
|
+
const n = Number(v);
|
|
67
|
+
if (Number.isFinite(n) && n > 0) cfg.timeoutMs = n;
|
|
68
|
+
}, {
|
|
69
|
+
description: "Hard cap for pinned (headless) job runs: SIGTERM at the cap, SIGKILL after 5s grace. Clamped 1min–24h (default 10min).",
|
|
70
|
+
defaultValue: 600_000,
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const OWNED_PREFIX = "cron.";
|
|
78
|
+
|
|
79
|
+
/** cron's ModuleConfig for the central /config panel. */
|
|
80
|
+
export function cronConfig(): ModuleConfig {
|
|
81
|
+
const before = loadCronSettings();
|
|
82
|
+
const working: CronSettings = { ...before };
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
groups: () => buildCronGroups(working),
|
|
86
|
+
save: async (edited, ctx) => {
|
|
87
|
+
const FIELDS: (keyof CronSettings)[] = ["enabled", "tickMs", "timeoutMs"];
|
|
88
|
+
const patch: Partial<CronSettings> = {};
|
|
89
|
+
for (const key of edited) {
|
|
90
|
+
if (!key.startsWith(OWNED_PREFIX)) continue;
|
|
91
|
+
const field = key.slice(OWNED_PREFIX.length) as keyof CronSettings;
|
|
92
|
+
if (FIELDS.includes(field)) (patch as Record<string, unknown>)[field] = working[field];
|
|
93
|
+
}
|
|
94
|
+
if (!Object.keys(patch).length) return;
|
|
95
|
+
try {
|
|
96
|
+
const file = writeCronSection(patch);
|
|
97
|
+
ctx.ui.notify(`Cron settings saved to ${file} — applies next session (project .pi/settings.json may shadow per field).`, "info");
|
|
98
|
+
} catch (e) {
|
|
99
|
+
ctx.ui.notify(`Cron save failed: ${e instanceof Error ? e.message : e}`, "error");
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|