agent-lyceum 0.16.0 → 0.16.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.
- package/dist/status.d.ts +6 -1
- package/dist/status.js +7 -2
- package/package.json +1 -1
package/dist/status.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { type ActiveWake, type EndReason, type RunState, type WakeRecord } from
|
|
|
2
2
|
import type { RunOutcome } from "./schema.js";
|
|
3
3
|
import type { ResolvedProject } from "./config.js";
|
|
4
4
|
import { type DigestSection, type Step } from "./format.js";
|
|
5
|
+
/** The run to show: the newest one still running (a resumed run keeps its old id, so newer runs may sit above it), else the newest run. */
|
|
6
|
+
export declare function currentRun(project: ResolvedProject): {
|
|
7
|
+
dir: string;
|
|
8
|
+
state: RunState;
|
|
9
|
+
} | undefined;
|
|
5
10
|
export declare function latestRun(project: ResolvedProject): {
|
|
6
11
|
dir: string;
|
|
7
12
|
state: RunState;
|
|
@@ -140,7 +145,7 @@ export declare function buildRunReport(run: {
|
|
|
140
145
|
}, project?: ResolvedProject, opts?: {
|
|
141
146
|
detail?: boolean;
|
|
142
147
|
}): RunReport;
|
|
143
|
-
/** The status of a project: its agents and one run (the newest, or the one named by `runId`). */
|
|
148
|
+
/** The status of a project: its agents and one run (the newest running one, else the newest, or the one named by `runId`). */
|
|
144
149
|
export declare function buildStatusReport(base: ResolvedProject, runId?: string): StatusReport;
|
|
145
150
|
/** Every run of the project, newest first. */
|
|
146
151
|
export declare function buildTaskListReport(project: ResolvedProject): TaskListReport;
|
package/dist/status.js
CHANGED
|
@@ -7,6 +7,11 @@ import { briefOf, digestOf } from "./format.js";
|
|
|
7
7
|
import { listUnread } from "./mailbox.js";
|
|
8
8
|
import { tidyAdvice } from "./memory-tidy.js";
|
|
9
9
|
import { inspectRunLock, lockHolderAlive } from "./project-lock.js";
|
|
10
|
+
/** The run to show: the newest one still running (a resumed run keeps its old id, so newer runs may sit above it), else the newest run. */
|
|
11
|
+
export function currentRun(project) {
|
|
12
|
+
const running = listRuns(project, Infinity).find((r) => !r.state.end_reason && runIsAlive(r.state, project));
|
|
13
|
+
return running ?? latestRun(project);
|
|
14
|
+
}
|
|
10
15
|
export function latestRun(project) {
|
|
11
16
|
const root = project.paths.runs;
|
|
12
17
|
if (!fs.existsSync(root))
|
|
@@ -220,7 +225,7 @@ export function buildRunReport(run, project, opts = {}) {
|
|
|
220
225
|
};
|
|
221
226
|
}
|
|
222
227
|
const projectInfo = (p) => ({ name: p.name, dir: p.dir, lead: p.lead });
|
|
223
|
-
/** The status of a project: its agents and one run (the newest, or the one named by `runId`). */
|
|
228
|
+
/** The status of a project: its agents and one run (the newest running one, else the newest, or the one named by `runId`). */
|
|
224
229
|
export function buildStatusReport(base, runId) {
|
|
225
230
|
let run;
|
|
226
231
|
if (runId) {
|
|
@@ -230,7 +235,7 @@ export function buildStatusReport(base, runId) {
|
|
|
230
235
|
run = { dir, state: loadRunState(dir) };
|
|
231
236
|
}
|
|
232
237
|
else
|
|
233
|
-
run =
|
|
238
|
+
run = currentRun(base);
|
|
234
239
|
// Mail is per run: count the unread mail of the run being shown.
|
|
235
240
|
const project = run ? bindRunProject(base, run.dir, run.state.mail_layout) : base;
|
|
236
241
|
const report = run ? buildRunReport(run, base) : undefined;
|