@rasensio/aidlc 1.63.0 → 1.65.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/dist/autopilot/driver.d.ts +52 -1
- package/dist/autopilot/driver.d.ts.map +1 -1
- package/dist/autopilot/driver.js +170 -51
- package/dist/autopilot/driver.js.map +1 -1
- package/dist/autopilot/notify.d.ts +33 -0
- package/dist/autopilot/notify.d.ts.map +1 -0
- package/dist/autopilot/notify.js +66 -0
- package/dist/autopilot/notify.js.map +1 -0
- package/dist/autopilot/presets.d.ts +2 -0
- package/dist/autopilot/presets.d.ts.map +1 -1
- package/dist/autopilot/presets.js +20 -2
- package/dist/autopilot/presets.js.map +1 -1
- package/dist/autopilot/run.d.ts +14 -1
- package/dist/autopilot/run.d.ts.map +1 -1
- package/dist/autopilot/run.js +80 -9
- package/dist/autopilot/run.js.map +1 -1
- package/dist/autopilot/state.d.ts +24 -0
- package/dist/autopilot/state.d.ts.map +1 -1
- package/dist/autopilot/state.js +10 -1
- package/dist/autopilot/state.js.map +1 -1
- package/dist/autopilot/team.d.ts +2 -1
- package/dist/autopilot/team.d.ts.map +1 -1
- package/dist/autopilot/team.js +6 -1
- package/dist/autopilot/team.js.map +1 -1
- package/dist/autopilot/watch.d.ts +58 -0
- package/dist/autopilot/watch.d.ts.map +1 -0
- package/dist/autopilot/watch.js +165 -0
- package/dist/autopilot/watch.js.map +1 -0
- package/dist/commands/autopilot.d.ts +10 -4
- package/dist/commands/autopilot.d.ts.map +1 -1
- package/dist/commands/autopilot.js +42 -16
- package/dist/commands/autopilot.js.map +1 -1
- package/package.json +2 -2
|
@@ -29,6 +29,8 @@ export interface AutopilotPaths {
|
|
|
29
29
|
*/
|
|
30
30
|
export type ItemStep = 'building' | 'pr-open' | 'queued' | 'awaiting-review' | 'approved' | 'awaiting-merge' | 'error';
|
|
31
31
|
export type ResumeStep = Exclude<ItemStep, 'error'>;
|
|
32
|
+
/** The checks on an item's pull request, as the driver last read them (autopilot-live-progress/AC-13). */
|
|
33
|
+
export type CiState = 'waiting' | 'pending' | 'passed' | 'failed';
|
|
32
34
|
export interface AutopilotItem {
|
|
33
35
|
name: string;
|
|
34
36
|
file: string;
|
|
@@ -62,6 +64,21 @@ export interface AutopilotItem {
|
|
|
62
64
|
approved?: PausePhase[];
|
|
63
65
|
/** The phase an `awaiting-review` or `approved` item stopped after. */
|
|
64
66
|
review?: PausePhase;
|
|
67
|
+
/**
|
|
68
|
+
* The step the item was in when last seen to change, and when. Absent on an item that
|
|
69
|
+
* has not moved since this was recorded, so the view never counts from an upgrade
|
|
70
|
+
* (autopilot-live-progress/AC-11).
|
|
71
|
+
*/
|
|
72
|
+
step_since?: {
|
|
73
|
+
step: ItemStep;
|
|
74
|
+
at: string;
|
|
75
|
+
};
|
|
76
|
+
/** The last thing the driver said about the item, first said at `at` (autopilot-live-progress/AC-12). */
|
|
77
|
+
last_event?: {
|
|
78
|
+
at: string;
|
|
79
|
+
text: string;
|
|
80
|
+
};
|
|
81
|
+
ci?: CiState;
|
|
65
82
|
bump?: string;
|
|
66
83
|
version?: string;
|
|
67
84
|
}
|
|
@@ -85,6 +102,8 @@ export interface AutopilotConfig {
|
|
|
85
102
|
stop_at?: StopAt;
|
|
86
103
|
/** Phases to pause after for review. Absent = none, as before. */
|
|
87
104
|
pause_after?: PausePhase[];
|
|
105
|
+
/** Desktop notifications from a background run. Absent = on (autopilot-live-progress/AC-23). */
|
|
106
|
+
notify?: boolean;
|
|
88
107
|
}
|
|
89
108
|
/** One background run (autopilot-on-demand/AC-1..AC-4). */
|
|
90
109
|
export interface RunRecord {
|
|
@@ -107,6 +126,11 @@ export declare function autopilotPaths(dir: string): AutopilotPaths;
|
|
|
107
126
|
export declare function emptyState(): AutopilotState;
|
|
108
127
|
export declare function loadState(p: AutopilotPaths): AutopilotState;
|
|
109
128
|
export declare function saveState(p: AutopilotPaths, state: AutopilotState): void;
|
|
129
|
+
/**
|
|
130
|
+
* The machine config, with a retired preset command read as its replacement. Every
|
|
131
|
+
* reader comes through here, so the driver, setup and init see the same command; the
|
|
132
|
+
* file itself changes only when one of those next saves it (codex-preset-removed-flag/AC-4, AC-13).
|
|
133
|
+
*/
|
|
110
134
|
export declare function loadConfig(p: AutopilotPaths): AutopilotConfig | null;
|
|
111
135
|
export declare function saveConfig(p: AutopilotPaths, config: AutopilotConfig): void;
|
|
112
136
|
export declare function loadRun(p: AutopilotPaths): RunRecord | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE5D,0DAA0D;AAC1D,eAAO,MAAM,aAAa,QAAiB,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,iBAAiB,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAAC;AAEvH,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAEpD,0GAA0G;AAC1G,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElE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,wBAAgB,SAAS,CAAC,CAAC,EAAE,cAAc,GAAG,cAAc,CAE3D;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,CAExE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,GAAG,eAAe,GAAG,IAAI,CAIpE;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAE3E;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI,CAE3D;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAE/D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,cAAc,GAAG,IAAI,CAEhD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,CAAC,EAAE,cAAc,EACjB,GAAG,EAAE,MAAM,MAAM,EACjB,EAAE,EAAE,MAAM,CAAC,GACV;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAoBhD"}
|
package/dist/autopilot/state.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
12
12
|
import { join } from 'node:path';
|
|
13
13
|
import { coordinationRoot } from '../concurrency/common-dir.js';
|
|
14
|
+
import { currentCommand } from './presets.js';
|
|
14
15
|
/** A lock older than this belongs to a pass that died. */
|
|
15
16
|
export const STALE_LOCK_MS = 60 * 60 * 1000;
|
|
16
17
|
export function autopilotDir(cwd) {
|
|
@@ -50,8 +51,16 @@ export function loadState(p) {
|
|
|
50
51
|
export function saveState(p, state) {
|
|
51
52
|
writeJson(p.state, state);
|
|
52
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* The machine config, with a retired preset command read as its replacement. Every
|
|
56
|
+
* reader comes through here, so the driver, setup and init see the same command; the
|
|
57
|
+
* file itself changes only when one of those next saves it (codex-preset-removed-flag/AC-4, AC-13).
|
|
58
|
+
*/
|
|
53
59
|
export function loadConfig(p) {
|
|
54
|
-
|
|
60
|
+
const config = readJson(p.config);
|
|
61
|
+
if (config === null || !Array.isArray(config.agent_command))
|
|
62
|
+
return config;
|
|
63
|
+
return { ...config, agent_command: currentCommand(config.agent_command) };
|
|
55
64
|
}
|
|
56
65
|
export function saveConfig(p, config) {
|
|
57
66
|
writeJson(p.config, config);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/autopilot/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3G,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAkH5C,MAAM,UAA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iB;IACxC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,CAAiB,EACjB,GAAiB,EACjB,EAAW;IAEX,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,IAAI,CAAC;QACH,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC;YACH,GAAG,GAAG,GAAG,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,yEAAyE;QAC3E,CAAC;QACD,IAAI,GAAG,GAAG,aAAa;YAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACjD,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,IAAI,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;IACxC,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
package/dist/autopilot/team.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Team defaults for autopilot: the `autopilot:` section of the committed
|
|
3
3
|
* `.aidlc/config.yaml` (init-sets-work-mode/AC-21..AC-23).
|
|
4
4
|
*
|
|
5
|
-
* Only the cost cap, the release step
|
|
5
|
+
* Only the cost cap, the release step, the stops and notifications are team decisions. The agent, its
|
|
6
6
|
* permissions and how many items build at once belong to the machine that runs
|
|
7
7
|
* them, so those keys are never read from a committed file — a clone must not be
|
|
8
8
|
* able to hand an agent full access on somebody else's machine.
|
|
@@ -23,6 +23,7 @@ export interface TeamDefaults {
|
|
|
23
23
|
release?: TeamReleaseId;
|
|
24
24
|
stop_at?: StopAt;
|
|
25
25
|
pause_after?: PausePhase[];
|
|
26
|
+
notify?: boolean;
|
|
26
27
|
}
|
|
27
28
|
/**
|
|
28
29
|
* The validated `autopilot:` section of `<projectRoot>/.aidlc/config.yaml`. Never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/autopilot/team.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAgC,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,wCAAyC,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"team.d.ts","sourceRoot":"","sources":["../../src/autopilot/team.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAgC,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAExF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,wCAAyC,CAAC;AACvE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,WAAW,YAAY;IAC3B,qBAAqB;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,CA+BlE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,MAAM,GAClB,eAAe,GAAG,IAAI,CAYxB"}
|
package/dist/autopilot/team.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Team defaults for autopilot: the `autopilot:` section of the committed
|
|
3
3
|
* `.aidlc/config.yaml` (init-sets-work-mode/AC-21..AC-23).
|
|
4
4
|
*
|
|
5
|
-
* Only the cost cap, the release step
|
|
5
|
+
* Only the cost cap, the release step, the stops and notifications are team decisions. The agent, its
|
|
6
6
|
* permissions and how many items build at once belong to the machine that runs
|
|
7
7
|
* them, so those keys are never read from a committed file — a clone must not be
|
|
8
8
|
* able to hand an agent full access on somebody else's machine.
|
|
@@ -59,6 +59,9 @@ export function loadTeamDefaults(projectRoot) {
|
|
|
59
59
|
const pauses = parsePauseAfter(raw.pause_after);
|
|
60
60
|
if (pauses !== undefined)
|
|
61
61
|
team.pause_after = pauses;
|
|
62
|
+
// A yes or no only: `notify: off` is ignored, not read as off (autopilot-live-progress/AC-23).
|
|
63
|
+
if (typeof raw.notify === 'boolean')
|
|
64
|
+
team.notify = raw.notify;
|
|
62
65
|
return team;
|
|
63
66
|
}
|
|
64
67
|
/**
|
|
@@ -83,6 +86,8 @@ export function withTeamDefaults(machine, team, projectRoot) {
|
|
|
83
86
|
base.stop_at = team.stop_at;
|
|
84
87
|
if (team.pause_after !== undefined)
|
|
85
88
|
base.pause_after = team.pause_after;
|
|
89
|
+
if (team.notify !== undefined)
|
|
90
|
+
base.notify = team.notify;
|
|
86
91
|
return { ...base, ...machine };
|
|
87
92
|
}
|
|
88
93
|
//# sourceMappingURL=team.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/autopilot/team.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAgC,MAAM,YAAY,CAAC;AAExF;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,aAAa,EAAE,YAAY,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"team.js","sourceRoot":"","sources":["../../src/autopilot/team.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAgC,MAAM,YAAY,CAAC;AAExF;;;GAGG;AACH,MAAM,CAAC,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AAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IACzD,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aidlc autopilot status --watch` — the run, one line per item, redrawn in place
|
|
3
|
+
* until the run ends (autopilot-live-progress/AC-1..AC-9).
|
|
4
|
+
*
|
|
5
|
+
* Reads only. It takes no lock and writes no file, so it can never slow the run or
|
|
6
|
+
* contend with it, and Ctrl-C ends the view and nothing else. CI state comes from
|
|
7
|
+
* what the driver recorded: a view polling `gh` every two seconds would spend the
|
|
8
|
+
* rate limit the driver backs off on.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { type PauseRecord } from './pause.js';
|
|
13
|
+
import type { AutopilotItem, AutopilotState, RunRecord } from './state.js';
|
|
14
|
+
export declare const WATCH_INTERVAL_MS = 2000;
|
|
15
|
+
/** Everything a frame reads from an item's worktree. Never writes. */
|
|
16
|
+
export interface WatchReader {
|
|
17
|
+
read(path: string): string | null;
|
|
18
|
+
title(roadmapItemFile: string): string | null;
|
|
19
|
+
tasks(worktree: string, name: string): string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare const fileReader: WatchReader;
|
|
22
|
+
/** `<1m`, `14m`, `2h05m`, `3d4h`. */
|
|
23
|
+
export declare function span(ms: number): string;
|
|
24
|
+
export declare const COLUMNS: string[];
|
|
25
|
+
/** One item's cells, in `COLUMNS` order (AC-2, AC-3). */
|
|
26
|
+
export declare function itemCells(r: WatchReader, item: AutopilotItem, now: number): string[];
|
|
27
|
+
/** Pad every column but the last to its widest cell. */
|
|
28
|
+
export declare function alignRows(rows: string[][]): string[];
|
|
29
|
+
export interface FrameInput {
|
|
30
|
+
run: RunRecord | null;
|
|
31
|
+
paused: PauseRecord | null;
|
|
32
|
+
state: AutopilotState;
|
|
33
|
+
/** Whether the STOP file exists. */
|
|
34
|
+
stopped: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** The header, then a row per item, then the merge queue (AC-2, AC-4). */
|
|
37
|
+
export declare function frameLines(r: WatchReader, input: FrameInput, now: number): string[];
|
|
38
|
+
/** Cut each line to the terminal's width, so an item never wraps onto a second line (AC-5). */
|
|
39
|
+
export declare function fitWidth(lines: string[], columns: number | undefined): string[];
|
|
40
|
+
export interface WatchDeps {
|
|
41
|
+
frame(): string[];
|
|
42
|
+
running(): boolean;
|
|
43
|
+
write(text: string): void;
|
|
44
|
+
tty: boolean;
|
|
45
|
+
columns(): number | undefined;
|
|
46
|
+
/** Resolves after `ms`, or as soon as `signal` aborts. */
|
|
47
|
+
sleep(ms: number, signal: AbortSignal): Promise<void>;
|
|
48
|
+
/** Call `handler` on Ctrl-C; returns the function that stops listening. */
|
|
49
|
+
onInterrupt(handler: () => void): () => void;
|
|
50
|
+
}
|
|
51
|
+
/** This process's terminal, clock and Ctrl-C, for `watch`. */
|
|
52
|
+
export declare function processWatchDeps(): Omit<WatchDeps, 'frame' | 'running'>;
|
|
53
|
+
/**
|
|
54
|
+
* Draw until the run ends or Ctrl-C. Always exits 0: watching cannot fail the run,
|
|
55
|
+
* and nothing here signals it or writes its STOP file (AC-7).
|
|
56
|
+
*/
|
|
57
|
+
export declare function watch(deps: WatchDeps): Promise<number>;
|
|
58
|
+
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../src/autopilot/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE3E,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAKtC,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,IAAI,E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AM,GAAG,SAAS,CAAC;IAC9B,0DAA0D;IAC1D,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,2EAA2E;IAC3E,WAAW,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC9C;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,IAAI,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC,CAYvE;AAED;;;GAGG;AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC5D"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `aidlc autopilot status --watch` — the run, one line per item, redrawn in place
|
|
3
|
+
* until the run ends (autopilot-live-progress/AC-1..AC-9).
|
|
4
|
+
*
|
|
5
|
+
* Reads only. It takes no lock and writes no file, so it can never slow the run or
|
|
6
|
+
* contend with it, and Ctrl-C ends the view and nothing else. CI state comes from
|
|
7
|
+
* what the driver recorded: a view polling `gh` every two seconds would spend the
|
|
8
|
+
* rate limit the driver backs off on.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import { readFileSync } from 'node:fs';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
15
|
+
import { readItem } from '../roadmap/paths.js';
|
|
16
|
+
import { formatTasks, tasksForStatus } from '../tasks/status.js';
|
|
17
|
+
import { driverLine, instancePhase, queueLine } from './driver.js';
|
|
18
|
+
import { pauseStatusLines } from './pause.js';
|
|
19
|
+
import { runStatusLines } from './run.js';
|
|
20
|
+
export const WATCH_INTERVAL_MS = 2000;
|
|
21
|
+
/** Wide enough for most roadmap titles, narrow enough to leave the rest of the row on screen. */
|
|
22
|
+
const TITLE_MAX = 40;
|
|
23
|
+
export const fileReader = {
|
|
24
|
+
read: (f) => {
|
|
25
|
+
try {
|
|
26
|
+
return readFileSync(f, 'utf8');
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
title: (f) => readItem(f, 'in-progress')?.title ?? null,
|
|
33
|
+
// The worktree is the project root the item's own `aidlc status` would read
|
|
34
|
+
// tasks from, so this counts them exactly as that does (AC-3).
|
|
35
|
+
tasks: (worktree, name) => {
|
|
36
|
+
const summary = tasksForStatus(worktree, name);
|
|
37
|
+
return summary ? formatTasks(summary) : null;
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
/** `<1m`, `14m`, `2h05m`, `3d4h`. */
|
|
41
|
+
export function span(ms) {
|
|
42
|
+
const mins = Math.floor(ms / 60000);
|
|
43
|
+
if (mins < 1)
|
|
44
|
+
return '<1m';
|
|
45
|
+
if (mins < 60)
|
|
46
|
+
return `${mins}m`;
|
|
47
|
+
const hours = Math.floor(mins / 60);
|
|
48
|
+
if (hours < 24)
|
|
49
|
+
return `${hours}h${String(mins % 60).padStart(2, '0')}m`;
|
|
50
|
+
return `${Math.floor(hours / 24)}d${hours % 24}h`;
|
|
51
|
+
}
|
|
52
|
+
function since(iso, now) {
|
|
53
|
+
const t = Date.parse(iso);
|
|
54
|
+
return Number.isNaN(t) ? '?' : span(Math.max(0, now - t));
|
|
55
|
+
}
|
|
56
|
+
function cut(text, max) {
|
|
57
|
+
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
58
|
+
}
|
|
59
|
+
export const COLUMNS = ['item', 'step', 'phase', 'tasks', 'in step', 'pull request', 'last event'];
|
|
60
|
+
/** One item's cells, in `COLUMNS` order (AC-2, AC-3). */
|
|
61
|
+
export function itemCells(r, item, now) {
|
|
62
|
+
const title = r.title(join(item.worktree, '.aidlc', 'state', item.name, 'roadmap-item.md')) ?? item.name;
|
|
63
|
+
// A time counted from before the step was recorded would be a guess (AC-11).
|
|
64
|
+
const inStep = item.step_since?.step === item.step ? since(item.step_since.at, now) : '-';
|
|
65
|
+
const pr = item.pr ? `#${item.pr}${item.ci ? ` CI ${item.ci}` : ''}` : '-';
|
|
66
|
+
const event = item.last_event ? `${item.last_event.text}, ${since(item.last_event.at, now)} ago` : (item.error ?? '-');
|
|
67
|
+
return [
|
|
68
|
+
cut(title, TITLE_MAX),
|
|
69
|
+
item.step,
|
|
70
|
+
instancePhase(r.read, item) ?? '-',
|
|
71
|
+
r.tasks(item.worktree, item.name) ?? '-',
|
|
72
|
+
inStep,
|
|
73
|
+
pr,
|
|
74
|
+
event,
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
/** Pad every column but the last to its widest cell. */
|
|
78
|
+
export function alignRows(rows) {
|
|
79
|
+
const widths = [];
|
|
80
|
+
for (const row of rows)
|
|
81
|
+
row.forEach((c, i) => (widths[i] = Math.max(widths[i] ?? 0, c.length)));
|
|
82
|
+
return rows.map((row) => row.map((c, i) => (i === row.length - 1 ? c : c.padEnd(widths[i]))).join(' ').trimEnd());
|
|
83
|
+
}
|
|
84
|
+
/** The header, then a row per item, then the merge queue (AC-2, AC-4). */
|
|
85
|
+
export function frameLines(r, input, now) {
|
|
86
|
+
const { state } = input;
|
|
87
|
+
const lines = [
|
|
88
|
+
...runStatusLines(input.run),
|
|
89
|
+
...pauseStatusLines(input.paused),
|
|
90
|
+
driverLine(input.stopped, state, now, (iso) => `${since(iso, now)} ago`),
|
|
91
|
+
];
|
|
92
|
+
if (state.items.length === 0)
|
|
93
|
+
lines.push('no items in flight');
|
|
94
|
+
else
|
|
95
|
+
lines.push('', ...alignRows([COLUMNS, ...state.items.map((i) => itemCells(r, i, now))]));
|
|
96
|
+
const queue = queueLine(state);
|
|
97
|
+
if (queue !== null)
|
|
98
|
+
lines.push('', queue);
|
|
99
|
+
return lines;
|
|
100
|
+
}
|
|
101
|
+
/** Cut each line to the terminal's width, so an item never wraps onto a second line (AC-5). */
|
|
102
|
+
export function fitWidth(lines, columns) {
|
|
103
|
+
if (!columns || columns < 2)
|
|
104
|
+
return lines;
|
|
105
|
+
return lines.map((l) => cut(l, columns));
|
|
106
|
+
}
|
|
107
|
+
const HOME = '\x1b[H';
|
|
108
|
+
const CLEAR_SCREEN = '\x1b[2J';
|
|
109
|
+
const CLEAR_LINE_END = '\x1b[K';
|
|
110
|
+
const CLEAR_BELOW = '\x1b[J';
|
|
111
|
+
const HIDE_CURSOR = '\x1b[?25l';
|
|
112
|
+
const SHOW_CURSOR = '\x1b[?25h';
|
|
113
|
+
/** This process's terminal, clock and Ctrl-C, for `watch`. */
|
|
114
|
+
export function processWatchDeps() {
|
|
115
|
+
return {
|
|
116
|
+
write: (t) => process.stdout.write(t),
|
|
117
|
+
tty: process.stdout.isTTY === true,
|
|
118
|
+
columns: () => process.stdout.columns,
|
|
119
|
+
// Aborting clears the timer too, so Ctrl-C exits at once rather than after it.
|
|
120
|
+
sleep: (ms, signal) => delay(ms, undefined, { signal }).catch(() => { }),
|
|
121
|
+
onInterrupt: (handler) => {
|
|
122
|
+
process.once('SIGINT', handler);
|
|
123
|
+
return () => process.off('SIGINT', handler);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Draw until the run ends or Ctrl-C. Always exits 0: watching cannot fail the run,
|
|
129
|
+
* and nothing here signals it or writes its STOP file (AC-7).
|
|
130
|
+
*/
|
|
131
|
+
export async function watch(deps) {
|
|
132
|
+
// Off a terminal — piped, or an agent's tool call — one plain frame, at once:
|
|
133
|
+
// a call that waits for the run would block an agent for hours (AC-9).
|
|
134
|
+
if (!deps.tty) {
|
|
135
|
+
deps.write(`${deps.frame().join('\n')}\n`);
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
// Overwrite in place, line by line, so the screen does not flash between frames.
|
|
139
|
+
const draw = (lines) => deps.write(`${HOME}${fitWidth(lines, deps.columns()).map((l) => `${l}${CLEAR_LINE_END}`).join('\n')}${CLEAR_BELOW}`);
|
|
140
|
+
if (!deps.running()) {
|
|
141
|
+
deps.write(`${fitWidth(deps.frame(), deps.columns()).join('\n')}\n`);
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
const stop = new AbortController();
|
|
145
|
+
const off = deps.onInterrupt(() => stop.abort());
|
|
146
|
+
deps.write(`${HIDE_CURSOR}${HOME}${CLEAR_SCREEN}`);
|
|
147
|
+
try {
|
|
148
|
+
for (;;) {
|
|
149
|
+
// Read before the frame, so the last frame drawn is never older than the end.
|
|
150
|
+
const running = deps.running();
|
|
151
|
+
draw(running ? deps.frame() : [...deps.frame(), '', 'run ended']);
|
|
152
|
+
if (!running)
|
|
153
|
+
break;
|
|
154
|
+
await deps.sleep(WATCH_INTERVAL_MS, stop.signal);
|
|
155
|
+
if (stop.signal.aborted)
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
off();
|
|
161
|
+
deps.write(`${SHOW_CURSOR}\n`);
|
|
162
|
+
}
|
|
163
|
+
return 0;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../src/autopilot/watch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,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CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACjD,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO;gBAAE,MAAM;QACjC,CAAC;IACH,CAAC;YAAS,CAAC;QACT,GAAG,EAAE,CAAC;QACN,IAAI,CAAC,KAAK,CAAC,GAAG,WAAW,IAAI,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - `run` — start one background run for `--items n` or `--all`, and return.
|
|
8
8
|
* - `stop` — create the STOP file; the run ends at its next step.
|
|
9
9
|
* - `pause` — freeze the run and its agents where they stand; `resume` thaws them.
|
|
10
|
-
* - `status` — the active run and every tracked item
|
|
10
|
+
* - `status` — the active run and every tracked item; `--watch` follows each item
|
|
11
|
+
* live until the run ends (autopilot-live-progress).
|
|
11
12
|
* - `approve` — carry on an item paused for review (autopilot-stop-controls).
|
|
12
13
|
* - `forget` — stop tracking an item finished or abandoned by hand.
|
|
13
14
|
* - `tick` — one pass, in the foreground; kept for debugging.
|
|
@@ -19,8 +20,10 @@
|
|
|
19
20
|
*/
|
|
20
21
|
import { Command } from 'commander';
|
|
21
22
|
import { type Prompter } from '../core/prompt.js';
|
|
22
|
-
import {
|
|
23
|
+
import { runStatusLines } from '../autopilot/run.js';
|
|
24
|
+
import { type AutopilotConfig, type AutopilotPaths } from '../autopilot/state.js';
|
|
23
25
|
import { type StopOverrides } from '../autopilot/stops.js';
|
|
26
|
+
export { runStatusLines };
|
|
24
27
|
export interface SetupOptions {
|
|
25
28
|
agent?: string;
|
|
26
29
|
parallel?: string;
|
|
@@ -78,7 +81,10 @@ export declare function forgetCommand(name: string): number;
|
|
|
78
81
|
* (autopilot-stop-controls/AC-16, AC-17).
|
|
79
82
|
*/
|
|
80
83
|
export declare function approveCommand(name: string): number;
|
|
81
|
-
/**
|
|
82
|
-
|
|
84
|
+
/**
|
|
85
|
+
* `aidlc autopilot status --watch`. Every read here is one that writes nothing:
|
|
86
|
+
* `liveRun`, not `activeRun`, which clears a dead run's record (autopilot-live-progress/AC-6).
|
|
87
|
+
*/
|
|
88
|
+
export declare function watchCommand(): Promise<number>;
|
|
83
89
|
export declare function registerAutopilot(program: Command): Command;
|
|
84
90
|
//# sourceMappingURL=autopilot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autopilot.d.ts","sourceRoot":"","sources":["../../src/commands/autopilot.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"autopilot.d.ts","sourceRoot":"","sources":["../../src/commands/autopilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAI5C,OAAO,EAAmB,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA0BnE,OAAO,EAAwC,cAAc,EAA+B,MAAM,qBAAqB,CAAC;AACxH,OAAO,EAQL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EASL,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,cAAc,EAAE,CAAC;AA8C1B,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAQjG;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,cAAc,EACjB,IAAI,EAAE,YAAY,EAClB,MAAM,GAAE,QAA0B,GACjC,OAAO,CAAC,YAAY,CAAC,CAsEvB;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAY5E;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,GAAE,QAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAa1G;AAgBD,oHAAoH;AACpH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAajJ;AAED,kHAAkH;AAClH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,CAQ1F;AAmID;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBlD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BnD;AAaD;;;GAGG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAapD;AAwBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAwF3D"}
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* - `run` — start one background run for `--items n` or `--all`, and return.
|
|
8
8
|
* - `stop` — create the STOP file; the run ends at its next step.
|
|
9
9
|
* - `pause` — freeze the run and its agents where they stand; `resume` thaws them.
|
|
10
|
-
* - `status` — the active run and every tracked item
|
|
10
|
+
* - `status` — the active run and every tracked item; `--watch` follows each item
|
|
11
|
+
* live until the run ends (autopilot-live-progress).
|
|
11
12
|
* - `approve` — carry on an item paused for review (autopilot-stop-controls).
|
|
12
13
|
* - `forget` — stop tracking an item finished or abandoned by hand.
|
|
13
14
|
* - `tick` — one pass, in the foreground; kept for debugging.
|
|
@@ -18,18 +19,22 @@
|
|
|
18
19
|
* @module
|
|
19
20
|
*/
|
|
20
21
|
import { Command, Option } from 'commander';
|
|
21
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
22
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
22
23
|
import { primaryWorkingTree } from '../concurrency/common-dir.js';
|
|
23
24
|
import { defaultPrompter } from '../core/prompt.js';
|
|
24
25
|
import { resolveProjectRoot } from '../core/project-root.js';
|
|
25
|
-
import { approveItem, forgetItem, statusLines, tick } from '../autopilot/driver.js';
|
|
26
|
+
import { approveItem, forgetItem, markStepChanges, statusLines, stepsOf, tick } from '../autopilot/driver.js';
|
|
27
|
+
import { desktopNotifier } from '../autopilot/notify.js';
|
|
26
28
|
import { AGENT_PRESETS, COST_CAP_CHOICES, PARALLEL_CHOICES, PAUSE_CHOICES, STOP_AT_CHOICES, agentPreset, releasePresets, } from '../autopilot/presets.js';
|
|
27
29
|
import { currentSystem, identify, livePause, pauseRun, pauseStatusLines, processTable, realPauseDeps, resumeRun, } from '../autopilot/pause.js';
|
|
28
30
|
import { askAutopilotQuestions, recommended } from '../autopilot/questions.js';
|
|
29
|
-
import { activeRun, realCtx, runLoop, spawnLoopDetached, startRun } from '../autopilot/run.js';
|
|
31
|
+
import { activeRun, liveRun, realCtx, runLoop, runStatusLines, spawnLoopDetached, startRun } from '../autopilot/run.js';
|
|
30
32
|
import { autopilotDir, autopilotPaths, loadConfig, loadState, saveConfig, saveState, withLock, } from '../autopilot/state.js';
|
|
31
33
|
import { PAUSE_PHASES, STOP_AT, describePauses, describeStopAt, parsePauseFlag, parseStopAt, stopsInForce, stopsLine, } from '../autopilot/stops.js';
|
|
32
34
|
import { loadTeamDefaults, withTeamDefaults } from '../autopilot/team.js';
|
|
35
|
+
import { fileReader, frameLines, processWatchDeps, watch } from '../autopilot/watch.js';
|
|
36
|
+
// Moved beside the run record it describes, so the watch view need not import a command.
|
|
37
|
+
export { runStatusLines };
|
|
33
38
|
/** The primary checkout and the autopilot directory, or null outside a git repo. */
|
|
34
39
|
function locate(cwd = resolveProjectRoot()) {
|
|
35
40
|
const dir = autopilotDir(cwd);
|
|
@@ -231,6 +236,7 @@ async function runCommand(opts) {
|
|
|
231
236
|
return 1;
|
|
232
237
|
const { repo, paths: p } = where;
|
|
233
238
|
if (opts.foreground) {
|
|
239
|
+
const notifier = desktopNotifier();
|
|
234
240
|
const result = await runLoop(p, {
|
|
235
241
|
limit,
|
|
236
242
|
intervalSec,
|
|
@@ -239,7 +245,10 @@ async function runCommand(opts) {
|
|
|
239
245
|
startedAt: new Date().toISOString(),
|
|
240
246
|
identity: identify(process.pid),
|
|
241
247
|
stops,
|
|
242
|
-
},
|
|
248
|
+
},
|
|
249
|
+
// The only ctx handed a notifier: notices come from a background run alone
|
|
250
|
+
// (autopilot-live-progress/AC-20).
|
|
251
|
+
{ ctx: () => realCtx(repo, p, false, stamp, notifier), sleep: (ms) => new Promise((r) => setTimeout(r, ms)) });
|
|
243
252
|
if (result === 'already-running') {
|
|
244
253
|
stamp('another run is active — this one exits without doing anything');
|
|
245
254
|
return 1;
|
|
@@ -260,7 +269,7 @@ async function runCommand(opts) {
|
|
|
260
269
|
runStopsLine(repo, p, stops),
|
|
261
270
|
...(r.resumed.length > 0 ? [`resumed: ${r.resumed.join(', ')}`] : []),
|
|
262
271
|
`log: ${r.log}`,
|
|
263
|
-
'watch: aidlc autopilot status',
|
|
272
|
+
'watch: aidlc autopilot status --watch',
|
|
264
273
|
'pause: aidlc autopilot pause (before closing the laptop), then aidlc autopilot resume',
|
|
265
274
|
'stop: aidlc autopilot stop',
|
|
266
275
|
].join('\n') + '\n');
|
|
@@ -361,9 +370,12 @@ export function approveCommand(name) {
|
|
|
361
370
|
const p = where.paths;
|
|
362
371
|
const pass = withLock(p, () => Date.now(), () => {
|
|
363
372
|
const state = loadState(p);
|
|
373
|
+
const before = stepsOf(state);
|
|
364
374
|
const r = approveItem(state, name);
|
|
365
|
-
if (r.ok)
|
|
375
|
+
if (r.ok) {
|
|
376
|
+
markStepChanges(state, before, Date.now());
|
|
366
377
|
saveState(p, state);
|
|
378
|
+
}
|
|
367
379
|
return r;
|
|
368
380
|
});
|
|
369
381
|
if (pass.locked) {
|
|
@@ -381,13 +393,6 @@ export function approveCommand(name) {
|
|
|
381
393
|
process.stdout.write(`${lines.join('\n')}\n`);
|
|
382
394
|
return 0;
|
|
383
395
|
}
|
|
384
|
-
/** The run half of `status`: whether a run is active and what it has left (autopilot-on-demand/AC-9). */
|
|
385
|
-
export function runStatusLines(run) {
|
|
386
|
-
if (run === null)
|
|
387
|
-
return ['run: none active'];
|
|
388
|
-
const left = run.limit === null ? 'until the backlog is empty' : `${Math.max(0, run.limit - run.started.length)} of ${run.limit} left to start`;
|
|
389
|
-
return [`run: active (pid ${run.pid}), ${left}; ${run.finished.length} finished`, `log: ${run.log}`];
|
|
390
|
-
}
|
|
391
396
|
function statusCommand() {
|
|
392
397
|
const where = needRepo();
|
|
393
398
|
if (where === null)
|
|
@@ -399,6 +404,26 @@ function statusCommand() {
|
|
|
399
404
|
process.stdout.write(`${lines.join('\n')}\n`);
|
|
400
405
|
return 0;
|
|
401
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* `aidlc autopilot status --watch`. Every read here is one that writes nothing:
|
|
409
|
+
* `liveRun`, not `activeRun`, which clears a dead run's record (autopilot-live-progress/AC-6).
|
|
410
|
+
*/
|
|
411
|
+
export async function watchCommand() {
|
|
412
|
+
const where = needRepo();
|
|
413
|
+
if (where === null)
|
|
414
|
+
return 1;
|
|
415
|
+
const p = where.paths;
|
|
416
|
+
const frame = () => {
|
|
417
|
+
try {
|
|
418
|
+
return frameLines(fileReader, { run: liveRun(p), paused: pausedNow(p), state: loadState(p), stopped: existsSync(p.stop) }, Date.now());
|
|
419
|
+
}
|
|
420
|
+
catch (err) {
|
|
421
|
+
// A state file someone hand-edited badly is shown, not crashed on.
|
|
422
|
+
return [`autopilot state unreadable: ${err.message}`];
|
|
423
|
+
}
|
|
424
|
+
};
|
|
425
|
+
return watch({ ...processWatchDeps(), frame, running: () => liveRun(p) !== null });
|
|
426
|
+
}
|
|
402
427
|
function tickCommand(opts) {
|
|
403
428
|
const where = needRepo();
|
|
404
429
|
if (where === null)
|
|
@@ -474,8 +499,9 @@ export function registerAutopilot(program) {
|
|
|
474
499
|
group
|
|
475
500
|
.command('status')
|
|
476
501
|
.description('Show the active run and every tracked item')
|
|
477
|
-
.
|
|
478
|
-
|
|
502
|
+
.option('--watch', 'Redraw every 2 seconds until the run ends; Ctrl-C leaves the run running')
|
|
503
|
+
.action(async (opts) => {
|
|
504
|
+
process.exitCode = opts.watch ? await watchCommand() : statusCommand();
|
|
479
505
|
});
|
|
480
506
|
group
|
|
481
507
|
.command('approve')
|