agent-lyceum 0.33.0 → 0.34.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/README.md +1 -0
- package/README.zh-TW.md +1 -0
- package/dist/status-watch.d.ts +11 -0
- package/dist/status-watch.js +34 -10
- package/package.json +1 -1
- package/web/dist/public/favicon.svg +4 -0
- package/web/dist/public/index.html +1 -0
package/README.md
CHANGED
|
@@ -90,4 +90,5 @@ Likewise, older versions refuse a `project.yaml` that contains `verify` ("Unreco
|
|
|
90
90
|
| Letting an agent search or fetch the web | [Web access](docs/web-access.md) |
|
|
91
91
|
| Live run status inside Claude Code (a framed, state-coloured tree of agents; pane or full-width band) | [Monitor mod](docs/monitor.md) |
|
|
92
92
|
| All commands in full | [Commands](docs/commands.md) |
|
|
93
|
+
| A task file template (scope, acceptance criteria, verification) | [Task template](docs/task-template.md) |
|
|
93
94
|
| Coming from an older version | [Upgrading to run v2](docs/upgrading-run-v2.md) |
|
package/README.zh-TW.md
CHANGED
|
@@ -90,4 +90,5 @@ agents:
|
|
|
90
90
|
| 讓 agent 搜尋或讀取網頁 | [網路存取](docs/web-access.zh-TW.md) |
|
|
91
91
|
| 在 Claude Code 內看即時 run 狀態(每個 agent 一個依狀態上色的外框,樹狀排列;面板或整寬橫幅) | [監控 mod](docs/monitor.zh-TW.md) |
|
|
92
92
|
| 所有指令的完整說明 | [指令](docs/commands.zh-TW.md) |
|
|
93
|
+
| 任務檔範本(範圍、驗收條件、驗證指令) | [任務檔範本](docs/task-template.zh-TW.md) |
|
|
93
94
|
| 從舊版升級 | [升級到 run v2](docs/upgrading-run-v2.md) |
|
package/dist/status-watch.d.ts
CHANGED
|
@@ -13,8 +13,19 @@ export type WatchFrame = {
|
|
|
13
13
|
* A task that was running in the previous frame and has finished (completed or partial) since is included once more, so the reader sees
|
|
14
14
|
* it finish (and can toast) before it is dropped. `tracked` is that previous set; it is replaced by the ids running now.
|
|
15
15
|
*/
|
|
16
|
+
/**
|
|
17
|
+
* Reports of finished runs, kept so a sweep does not rebuild them (about 300 ms each). An entry is reused while the
|
|
18
|
+
* run's state.json is unchanged and it is younger than `FINISHED_TTL_MS`; the TTL picks up what lives outside that file
|
|
19
|
+
* (unread mail, memory advice).
|
|
20
|
+
*/
|
|
21
|
+
export type FinishedCache = Map<string, {
|
|
22
|
+
stamp: string;
|
|
23
|
+
at: number;
|
|
24
|
+
report: StatusReport;
|
|
25
|
+
}>;
|
|
16
26
|
export declare function buildWatchFrame(project: ResolvedProject, tracked: Set<string>, opts?: {
|
|
17
27
|
allTasks?: boolean;
|
|
28
|
+
cache?: FinishedCache;
|
|
18
29
|
}): WatchFrame;
|
|
19
30
|
export interface WatchDeps {
|
|
20
31
|
/** The project, loaded again each time so config edits and new runs show up. */
|
package/dist/status-watch.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { buildStatusReport, buildTaskListReport, currentRun, isFinishedRun } from "./status.js";
|
|
4
|
+
const FINISHED_TTL_MS = 5 * 60_000;
|
|
5
|
+
function stampOf(project, id) {
|
|
6
|
+
try {
|
|
7
|
+
const st = fs.statSync(path.join(project.paths.runs, id, "state.json"));
|
|
8
|
+
return `${st.mtimeMs}:${st.size}`;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
export function buildWatchFrame(project, tracked, opts) {
|
|
10
15
|
const all = buildTaskListReport(project).runs;
|
|
11
16
|
const running = all.filter((r) => r.state === "running").map((r) => r.run_id);
|
|
@@ -13,9 +18,27 @@ export function buildWatchFrame(project, tracked, opts) {
|
|
|
13
18
|
const runs = {};
|
|
14
19
|
// The web page keeps every task. The terminal watch drops one after it has finished, once the finish has been seen.
|
|
15
20
|
const ids = opts?.allTasks ? all.map((r) => r.run_id) : [...open, ...tracked];
|
|
16
|
-
|
|
21
|
+
const finished = new Set(all.filter(isFinishedRun).map((r) => r.run_id));
|
|
22
|
+
const cache = opts?.cache;
|
|
23
|
+
const now = Date.now();
|
|
24
|
+
for (const id of new Set(ids)) {
|
|
25
|
+
const stamp = cache && finished.has(id) ? stampOf(project, id) : "";
|
|
26
|
+
const hit = stamp ? cache?.get(id) : undefined;
|
|
27
|
+
if (hit && hit.stamp === stamp && now - hit.at < FINISHED_TTL_MS) {
|
|
28
|
+
runs[id] = hit.report;
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
17
31
|
runs[id] = buildStatusReport(project, id);
|
|
18
|
-
|
|
32
|
+
if (stamp)
|
|
33
|
+
cache?.set(id, { stamp, at: now, report: runs[id] });
|
|
34
|
+
}
|
|
35
|
+
if (cache)
|
|
36
|
+
for (const id of cache.keys())
|
|
37
|
+
if (!finished.has(id))
|
|
38
|
+
cache.delete(id);
|
|
39
|
+
// The project's own report shows the current run, which is usually one already built above.
|
|
40
|
+
const currentId = currentRun(project)?.state.run_id;
|
|
41
|
+
const report = currentId && runs[currentId] ? runs[currentId] : buildStatusReport(project);
|
|
19
42
|
tracked.clear();
|
|
20
43
|
for (const id of running)
|
|
21
44
|
tracked.add(id);
|
|
@@ -31,6 +54,7 @@ function fsWatch(dir, onChange) {
|
|
|
31
54
|
*/
|
|
32
55
|
export function createStatusWatcher(d) {
|
|
33
56
|
const tracked = new Set();
|
|
57
|
+
const cache = new Map();
|
|
34
58
|
const watch = d.watch ?? fsWatch;
|
|
35
59
|
let lastLine = "";
|
|
36
60
|
let watching = "";
|
|
@@ -41,7 +65,7 @@ export function createStatusWatcher(d) {
|
|
|
41
65
|
let project;
|
|
42
66
|
try {
|
|
43
67
|
project = d.load();
|
|
44
|
-
frame = buildWatchFrame(project, tracked, { allTasks: d.allTasks });
|
|
68
|
+
frame = buildWatchFrame(project, tracked, { allTasks: d.allTasks, cache });
|
|
45
69
|
}
|
|
46
70
|
catch (e) {
|
|
47
71
|
frame = { schema_version: 1, error: e.message };
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
7
|
<title>agent-lyceum</title>
|
|
7
8
|
<script type="module" crossorigin src="/assets/index-BgL-BtfE.js"></script>
|
|
8
9
|
<link rel="stylesheet" crossorigin href="/assets/index-4MtRuQC3.css">
|