@aeolus-fleet/trierarch 0.20.5 → 0.21.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 +8 -8
- package/dist/adapters/claude-code-detector.js +7 -0
- package/dist/adapters/claude-code-detector.js.map +1 -1
- package/dist/adapters/claude-code-screen.js +4 -2
- package/dist/adapters/claude-code-screen.js.map +1 -1
- package/dist/adapters/claude-code-setup.d.ts +37 -1
- package/dist/adapters/claude-code-setup.js +60 -4
- package/dist/adapters/claude-code-setup.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +19 -5
- package/dist/adapters/claude-code.js +60 -4
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex-detector.d.ts +1 -1
- package/dist/adapters/codex-setup.js +4 -0
- package/dist/adapters/codex-setup.js.map +1 -1
- package/dist/adapters/command-line.d.ts +3 -1
- package/dist/adapters/command-line.js +5 -2
- package/dist/adapters/command-line.js.map +1 -1
- package/dist/adapters/detected-file.js +1 -0
- package/dist/adapters/detected-file.js.map +1 -1
- package/dist/adapters/detectors.d.ts +1 -0
- package/dist/adapters/detectors.js +2 -1
- package/dist/adapters/detectors.js.map +1 -1
- package/dist/adapters/harnesses.d.ts +20 -5
- package/dist/adapters/harnesses.js +15 -9
- package/dist/adapters/harnesses.js.map +1 -1
- package/dist/adapters/json-state.js +1 -1
- package/dist/adapters/json-state.js.map +1 -1
- package/dist/adapters/plugin.d.ts +12 -2
- package/dist/adapters/plugin.js +34 -4
- package/dist/adapters/plugin.js.map +1 -1
- package/dist/adapters/rest-fleet.js +1 -1
- package/dist/adapters/rest-fleet.js.map +1 -1
- package/dist/adapters/run-command.d.ts +10 -0
- package/dist/adapters/run-command.js +30 -0
- package/dist/adapters/run-command.js.map +1 -1
- package/dist/adapters/service.d.ts +2 -0
- package/dist/adapters/service.js +9 -4
- package/dist/adapters/service.js.map +1 -1
- package/dist/adapters/trust.d.ts +2 -1
- package/dist/adapters/trust.js +3 -3
- package/dist/adapters/trust.js.map +1 -1
- package/dist/bin/aeolus-trierarch.js +2 -1
- package/dist/bin/aeolus-trierarch.js.map +1 -1
- package/dist/cli/config-check.d.ts +2 -1
- package/dist/cli/config-check.js +6 -5
- package/dist/cli/config-check.js.map +1 -1
- package/dist/cli/init.js +3 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/logs.d.ts +37 -2
- package/dist/cli/logs.js +32 -2
- package/dist/cli/logs.js.map +1 -1
- package/dist/cli/main.d.ts +7 -1
- package/dist/cli/main.js +45 -31
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/new-process.d.ts +3 -8
- package/dist/cli/new-process.js +7 -4
- package/dist/cli/new-process.js.map +1 -1
- package/dist/cli/run.d.ts +1 -0
- package/dist/cli/run.js +4 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/service-command.d.ts +25 -0
- package/dist/cli/service-command.js +16 -0
- package/dist/cli/service-command.js.map +1 -0
- package/dist/cli/status.d.ts +6 -1
- package/dist/cli/status.js +20 -1
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/upgrade.d.ts +16 -3
- package/dist/cli/upgrade.js +34 -23
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/core/entry.d.ts +2 -2
- package/dist/core/ports.d.ts +4 -0
- package/dist/core/reconciler.js +25 -21
- package/dist/core/reconciler.js.map +1 -1
- package/dist/core/run-pass.js +49 -18
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +3 -3
package/dist/cli/run.d.ts
CHANGED
package/dist/cli/run.js
CHANGED
|
@@ -26,13 +26,13 @@ export const PASS_INTERVAL_MS = 5000;
|
|
|
26
26
|
* pass starts from the saved state.
|
|
27
27
|
*/
|
|
28
28
|
export async function runTrierarch(input) {
|
|
29
|
-
const { paths, homeDirectory, env, signal, logger } = input;
|
|
29
|
+
const { paths, homeDirectory, env, managedSettings, signal, logger } = input;
|
|
30
30
|
const configured = await loadConfiguration(paths.config);
|
|
31
31
|
const crew = await readCrewFile(paths.crewToken);
|
|
32
32
|
const fleet = createRestFleet(crew);
|
|
33
33
|
// Detected again only for a harness whose version changed since (#365); the operator's own options win.
|
|
34
34
|
const detectedStore = createDetectedFile(paths.detected);
|
|
35
|
-
const detectHarnesses = createDetectHarnesses({ detectors: createDetectors({ homeDirectory }), store: detectedStore, clock: { now: () => new Date() }, logger });
|
|
35
|
+
const detectHarnesses = createDetectHarnesses({ detectors: createDetectors({ homeDirectory, env }), store: detectedStore, clock: { now: () => new Date() }, logger });
|
|
36
36
|
const detected = await detectHarnesses({ harnesses: Object.keys(configured.harnesses), by: 'start' });
|
|
37
37
|
await createReportDetectionProblems({ fleet })(detected).catch((error) => {
|
|
38
38
|
logger.warn(`Could not tell argo what detection found: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -44,10 +44,10 @@ export async function runTrierarch(input) {
|
|
|
44
44
|
// What the machine offers changes while it runs, as sessions refuse models (#382): each pass and report reads it afresh.
|
|
45
45
|
let offered = { configuration, detected };
|
|
46
46
|
const tmux = createTmux();
|
|
47
|
-
const { harnesses, plugins } = await createHarnesses({ configuration, homeDirectory, env, sessions: tmux });
|
|
47
|
+
const { harnesses, plugins } = await createHarnesses({ configuration, homeDirectory, env, managedSettings, detected: () => offered.detected, sessions: tmux });
|
|
48
48
|
const workspace = createGitWorkspace({ configuration, root: configuration.worktreeRoot ?? paths.worktrees });
|
|
49
49
|
const state = createJsonState(paths.state);
|
|
50
|
-
const trust = createTrust({ configuration, homeDirectory, env });
|
|
50
|
+
const trust = createTrust({ configuration, homeDirectory, env, managedSettings });
|
|
51
51
|
const clock = { now: () => new Date() };
|
|
52
52
|
const setup = {
|
|
53
53
|
get configuration() {
|
package/dist/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EA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C,CAAC;gBACtG,MAAM,KAAK,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,MAAM,CACJ,KAAK,IAAI,EAAE;YACT,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChD,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,EACD,EAAE,OAAO,EAAE,KAAK,EAAE,CACnB;QACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KACnC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RunningFile } from '../adapters/files.js';
|
|
2
|
+
import type { Service, ServiceStatus } from '../adapters/service.js';
|
|
3
|
+
/**
|
|
4
|
+
* `aeolus-trierarch start`, `restart` and `install`: each starts a new
|
|
5
|
+
* trierarch process and answers once it has said its version, through the one
|
|
6
|
+
* wait every start shares (#466), so the status it answers is the new
|
|
7
|
+
* process's.
|
|
8
|
+
*/
|
|
9
|
+
export type ServiceCommand = 'start' | 'restart' | 'install';
|
|
10
|
+
export interface ServiceAnswer {
|
|
11
|
+
readonly status: ServiceStatus;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
}
|
|
14
|
+
/** How the service stands after a command, in the operator's words. */
|
|
15
|
+
export declare function describeService(verb: string, status: ServiceStatus): string;
|
|
16
|
+
export declare function runServiceCommand(at: {
|
|
17
|
+
command: ServiceCommand;
|
|
18
|
+
service: Pick<Service, ServiceCommand | 'status'>;
|
|
19
|
+
/** The folder of the logs, named after an install. */
|
|
20
|
+
logs: string;
|
|
21
|
+
/** What running.json says now: the new process writes it as it starts. */
|
|
22
|
+
running: () => Promise<RunningFile | undefined>;
|
|
23
|
+
/** Waits between reads of running.json; a test passes one that does not wait. */
|
|
24
|
+
sleep?: (ms: number) => Promise<void>;
|
|
25
|
+
}): Promise<ServiceAnswer>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NOT_SAID_YET, startNewProcess } from './new-process.js';
|
|
2
|
+
/** How the service stands after a command, in the operator's words. */
|
|
3
|
+
export function describeService(verb, status) {
|
|
4
|
+
return status.isRunning ? `The trierarch ${verb}: it runs${status.pid === undefined ? '' : ` as pid ${String(status.pid)}`}.` : `The trierarch ${verb}: it does not run.`;
|
|
5
|
+
}
|
|
6
|
+
export async function runServiceCommand(at) {
|
|
7
|
+
const { command, service } = at;
|
|
8
|
+
const { status, hasSaidVersion } = await startNewProcess({ start: () => service[command](), service, running: at.running, ...(at.sleep !== undefined && { sleep: at.sleep }) });
|
|
9
|
+
const done = {
|
|
10
|
+
start: () => describeService('started', status),
|
|
11
|
+
restart: () => describeService('restarted', status),
|
|
12
|
+
install: () => `Installed ${status.file}. Logs: ${at.logs}`,
|
|
13
|
+
}[command]();
|
|
14
|
+
return { status, text: [done, ...(hasSaidVersion ? [] : [NOT_SAID_YET])].join(' ') };
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=service-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-command.js","sourceRoot":"","sources":["../../src/cli/service-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAgBjE,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,MAAqB;IACjE,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,IAAI,YAAY,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,iBAAiB,IAAI,oBAAoB,CAAC;AAC5K,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EASvC;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAChL,MAAM,IAAI,GAAG;QACX,KAAK,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,CAAC;QAC/C,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC;QACnD,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC,IAAI,EAAE;KAC5D,CAAC,OAAO,CAAC,EAAE,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AACvF,CAAC"}
|
package/dist/cli/status.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ import type { ProcessPort, StatePort } from '../core/ports.js';
|
|
|
7
7
|
import { type Style } from '../adapters/style.js';
|
|
8
8
|
/**
|
|
9
9
|
* `aeolus-trierarch status`: how the trierarch stands on this machine, from
|
|
10
|
-
* what is on it. The
|
|
10
|
+
* what is on it. The aeolus plugin version per configured harness, the
|
|
11
|
+
* service and its process, the fleet and the trierarch's
|
|
11
12
|
* own lease (one whoami, no message), the caps in use, the entries by state,
|
|
12
13
|
* and the worktrees kept or orphaned.
|
|
13
14
|
*/
|
|
@@ -18,6 +19,8 @@ export interface StatusReport {
|
|
|
18
19
|
readonly version: string;
|
|
19
20
|
/** The version the running service runs, as it said when it started; none when it does not run or did not say. */
|
|
20
21
|
readonly runningVersion?: string;
|
|
22
|
+
/** The aeolus plugin version per configured harness; null where the harness has none (#480). */
|
|
23
|
+
readonly plugins: Readonly<Record<string, string | null>>;
|
|
21
24
|
readonly service: ServiceStatus;
|
|
22
25
|
readonly fleet: {
|
|
23
26
|
readonly url: string;
|
|
@@ -42,6 +45,8 @@ export declare function leaseFrom(whoami: () => Promise<unknown>): () => Promise
|
|
|
42
45
|
export declare function inspectStatus(at: {
|
|
43
46
|
configuration: TrierarchConfiguration;
|
|
44
47
|
version: string;
|
|
48
|
+
/** The aeolus plugin version the harness uses; none when it has no aeolus plugin. */
|
|
49
|
+
pluginVersion: (harness: string) => Promise<string | undefined>;
|
|
45
50
|
running: () => Promise<RunningFile | undefined>;
|
|
46
51
|
crew: CrewFile;
|
|
47
52
|
service: Pick<Service, 'status'>;
|
package/dist/cli/status.js
CHANGED
|
@@ -17,7 +17,16 @@ export function leaseFrom(whoami) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
export async function inspectStatus(at) {
|
|
20
|
-
const
|
|
20
|
+
const harnesses = Object.keys(at.configuration.harnesses);
|
|
21
|
+
const [service, lease, sessions, state, running, pluginVersions] = await Promise.all([
|
|
22
|
+
at.service.status(),
|
|
23
|
+
at.lease(),
|
|
24
|
+
at.processes.list(),
|
|
25
|
+
at.state.load(),
|
|
26
|
+
at.running(),
|
|
27
|
+
Promise.all(harnesses.map((harness) => at.pluginVersion(harness))),
|
|
28
|
+
]);
|
|
29
|
+
const plugins = Object.fromEntries(harnesses.map((harness, index) => [harness, pluginVersions[index] ?? null]));
|
|
21
30
|
// Only the service's own process counts: a file left by an earlier process, or by a `run` outside the service, says nothing of it.
|
|
22
31
|
const runningVersion = service.isRunning && running !== undefined && running.pid === service.pid ? running.version : undefined;
|
|
23
32
|
const entries = { crewing: 0, running: 0, restarting: 0, crashed: 0, releasing: 0 };
|
|
@@ -27,6 +36,7 @@ export async function inspectStatus(at) {
|
|
|
27
36
|
return {
|
|
28
37
|
version: at.version,
|
|
29
38
|
...(runningVersion !== undefined && { runningVersion }),
|
|
39
|
+
plugins,
|
|
30
40
|
service,
|
|
31
41
|
fleet: { url: at.crew.fleetUrl, ...(at.crew.shipId !== undefined && { shipId: at.crew.shipId }), lease },
|
|
32
42
|
caps: {
|
|
@@ -69,12 +79,21 @@ function describeVersion(report, style) {
|
|
|
69
79
|
}
|
|
70
80
|
return style.tone('busy', `${report.version} installed, ${report.runningVersion} running: restart the service to run the installed one (${RESTART})`);
|
|
71
81
|
}
|
|
82
|
+
/** Each configured harness with the aeolus plugin version it uses, or that it has none. */
|
|
83
|
+
function describePlugins(plugins, style) {
|
|
84
|
+
const harnesses = Object.entries(plugins);
|
|
85
|
+
if (harnesses.length === 0) {
|
|
86
|
+
return 'no harness configured';
|
|
87
|
+
}
|
|
88
|
+
return harnesses.map(([harness, version]) => (version === null ? style.tone('bad', `${harness} not found (install the aeolus plugin for it)`) : `${harness} ${version}`)).join(', ');
|
|
89
|
+
}
|
|
72
90
|
/** Each line its label and how it stands; where the style colours, the label strong and each state in its tone. */
|
|
73
91
|
export function describeStatus(report, style = PLAIN) {
|
|
74
92
|
const counted = Object.entries(report.entries).filter(([, count]) => count > 0);
|
|
75
93
|
const line = (label, text) => `${style.tone('strong', `${label}:`)} ${text}`;
|
|
76
94
|
return [
|
|
77
95
|
line('Version', describeVersion(report, style)),
|
|
96
|
+
line('Aeolus plugin', describePlugins(report.plugins, style)),
|
|
78
97
|
line('Service', describeService(report.service, style)),
|
|
79
98
|
line('Fleet', describeFleet(report.fleet, style)),
|
|
80
99
|
line('Caps', `${String(report.caps.ships.used)} of ${String(report.caps.ships.cap)} ships crewed here, ${String(report.caps.running.used)} of ${String(report.caps.running.cap)} sessions running`),
|
package/dist/cli/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/cli/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/cli/status.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAc,MAAM,sBAAsB,CAAC;AA4BpE,MAAM,UAAU,SAAS,CAAC,MAA8B;IACtD,OAAO,KAAK,IAAI,EAAE;QAChB,IAAI,CAAC;YACH,MAAM,MAAM,EAAE,CAAC;YACf,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,YAAY,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,EAAE,CAAC;gBACrG,OAAO,OAAO,CAAC;YACjB,CAAC;YACD,OAAO,aAAa,CAAC;QACvB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,EAWnC;IACC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1D,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,cAA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AAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;KACtG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,qFAAqF;AACrF,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC"}
|
package/dist/cli/upgrade.d.ts
CHANGED
|
@@ -7,13 +7,24 @@ import type { Service } from '../adapters/service.js';
|
|
|
7
7
|
* starts the new one. Sessions are not touched: they run on the trierarch's
|
|
8
8
|
* own tmux server, and the new process takes them over from its saved state.
|
|
9
9
|
* It reports once the new process has said its version in running.json, so
|
|
10
|
-
* the status that follows shows it running (#376), waiting at most 30 seconds
|
|
10
|
+
* the status that follows shows it running (#376), waiting at most 30 seconds,
|
|
11
|
+
* as every start waits (#466). Before the stop, the installed version writes
|
|
12
|
+
* the service's file, as its own init does, and the supervisor reads it again,
|
|
13
|
+
* so the stop already follows it (#485) and a change to the file arrives with
|
|
14
|
+
* the version that makes it, not one upgrade later (#492).
|
|
11
15
|
* It never upgrades on its own. A failed install leaves the old version
|
|
12
|
-
* running.
|
|
16
|
+
* running. Where npm's global folder is not the user's to write, as under a
|
|
17
|
+
* system Node install, it installs nothing and says what to run instead
|
|
18
|
+
* (#480): it never runs sudo itself.
|
|
13
19
|
*/
|
|
14
20
|
export declare const PACKAGE = "@aeolus-fleet/trierarch";
|
|
15
21
|
/** npm, as upgrade needs it. */
|
|
16
22
|
export interface Npm {
|
|
23
|
+
/** Where `npm install --global` puts packages, and whether the user may write there. */
|
|
24
|
+
globalFolder(): Promise<{
|
|
25
|
+
path: string;
|
|
26
|
+
isWritable: boolean;
|
|
27
|
+
}>;
|
|
17
28
|
/** The latest version on npm. */
|
|
18
29
|
latest(): Promise<string>;
|
|
19
30
|
/** `npm install --global <spec>`. */
|
|
@@ -30,7 +41,9 @@ export declare function upgradeTrierarch(at: {
|
|
|
30
41
|
/** The version installed now, read afresh each time: the install replaces it. */
|
|
31
42
|
installedVersion: () => string;
|
|
32
43
|
npm: Npm;
|
|
33
|
-
|
|
44
|
+
/** The installed version's `install --no-load`: this process still runs the code of the version it replaces. */
|
|
45
|
+
writeInstalledServiceFile: () => Promise<CommandResult>;
|
|
46
|
+
service: Pick<Service, 'reload' | 'stop' | 'start' | 'status'>;
|
|
34
47
|
/** What running.json says now: the new process writes it as it starts. */
|
|
35
48
|
running: () => Promise<RunningFile | undefined>;
|
|
36
49
|
/** Waits between reads of running.json; a test passes one that does not wait. */
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,31 +1,23 @@
|
|
|
1
1
|
import { TrierarchFileError } from '../adapters/files.js';
|
|
2
|
+
import { NOT_SAID_YET_REASON, startNewProcess } from './new-process.js';
|
|
2
3
|
/**
|
|
3
4
|
* `aeolus-trierarch upgrade [version]` (#255): installs the given version, or
|
|
4
5
|
* the latest on npm, globally and pinned to it, then stops the old process and
|
|
5
6
|
* starts the new one. Sessions are not touched: they run on the trierarch's
|
|
6
7
|
* own tmux server, and the new process takes them over from its saved state.
|
|
7
8
|
* It reports once the new process has said its version in running.json, so
|
|
8
|
-
* the status that follows shows it running (#376), waiting at most 30 seconds
|
|
9
|
+
* the status that follows shows it running (#376), waiting at most 30 seconds,
|
|
10
|
+
* as every start waits (#466). Before the stop, the installed version writes
|
|
11
|
+
* the service's file, as its own init does, and the supervisor reads it again,
|
|
12
|
+
* so the stop already follows it (#485) and a change to the file arrives with
|
|
13
|
+
* the version that makes it, not one upgrade later (#492).
|
|
9
14
|
* It never upgrades on its own. A failed install leaves the old version
|
|
10
|
-
* running.
|
|
15
|
+
* running. Where npm's global folder is not the user's to write, as under a
|
|
16
|
+
* system Node install, it installs nothing and says what to run instead
|
|
17
|
+
* (#480): it never runs sudo itself.
|
|
11
18
|
*/
|
|
12
19
|
export const PACKAGE = '@aeolus-fleet/trierarch';
|
|
13
20
|
const VERSION = /^\d+\.\d+\.\d+$/;
|
|
14
|
-
const VERSION_CHECK_MS = 1000;
|
|
15
|
-
const VERSION_TIMEOUT_MS = 30_000;
|
|
16
|
-
const MS_PER_SECOND = 1000;
|
|
17
|
-
/** Whether the running process says the version within the timeout, reading running.json once a second. */
|
|
18
|
-
async function saysVersion(version, at) {
|
|
19
|
-
for (let waited = 0;; waited += VERSION_CHECK_MS) {
|
|
20
|
-
if ((await at.running())?.version === version) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
if (waited >= VERSION_TIMEOUT_MS) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
await at.sleep(VERSION_CHECK_MS);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
21
|
export async function upgradeTrierarch(at) {
|
|
30
22
|
const from = at.installedVersion();
|
|
31
23
|
if (at.version !== undefined && !VERSION.test(at.version)) {
|
|
@@ -36,6 +28,11 @@ export async function upgradeTrierarch(at) {
|
|
|
36
28
|
return { from, to: from, isUpgraded: false, said: [`The trierarch is already on ${from}.`] };
|
|
37
29
|
}
|
|
38
30
|
const spec = `${PACKAGE}@${target}`;
|
|
31
|
+
const folder = await at.npm.globalFolder();
|
|
32
|
+
if (!folder.isWritable) {
|
|
33
|
+
const instead = [`sudo npm install --global ${spec}`, ...((await at.service.status()).isInstalled ? ['aeolus-trierarch install'] : [])];
|
|
34
|
+
throw new TrierarchFileError(`npm's global folder ${folder.path} is not yours to write: a system Node install owns it. Run instead:\n${instead.map((line) => ` ${line}`).join('\n')}\nThe trierarch keeps running ${from}.`);
|
|
35
|
+
}
|
|
39
36
|
const installed = await at.npm.install(spec);
|
|
40
37
|
if (installed.status !== 0) {
|
|
41
38
|
throw new TrierarchFileError(`npm install --global ${spec} failed: ${installed.stderr.trim()}\nThe trierarch keeps running ${from}. Fix what npm says, then run aeolus-trierarch upgrade again.`);
|
|
@@ -43,13 +40,27 @@ export async function upgradeTrierarch(at) {
|
|
|
43
40
|
const to = at.installedVersion();
|
|
44
41
|
const said = [`Upgraded the trierarch from ${from} to ${to}.`];
|
|
45
42
|
if ((await at.service.status()).isInstalled) {
|
|
46
|
-
|
|
47
|
-
await
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
const { service } = at;
|
|
44
|
+
const { hasSaidVersion } = await startNewProcess({
|
|
45
|
+
start: async () => {
|
|
46
|
+
const written = await at.writeInstalledServiceFile();
|
|
47
|
+
// aeolus-trierarch says a failure on stdout, node one it cannot run on stderr.
|
|
48
|
+
if (written.status !== 0) {
|
|
49
|
+
throw new TrierarchFileError(`The trierarch ${to} could not write the service's file: ${`${written.stdout}${written.stderr}`.trim()}\nThe service keeps running ${from}. Fix what it says, then run aeolus-trierarch install to write the file and restart the service.`);
|
|
50
|
+
}
|
|
51
|
+
// Reloaded before the stop: on Linux the stop follows the reloaded unit, which ends the trierarch only (#479).
|
|
52
|
+
await service.reload();
|
|
53
|
+
// Stop waits until the old process has exited, so only the new one ever runs the loop.
|
|
54
|
+
await service.stop();
|
|
55
|
+
await service.start();
|
|
56
|
+
},
|
|
57
|
+
service,
|
|
58
|
+
running: at.running,
|
|
59
|
+
...(at.sleep !== undefined && { sleep: at.sleep }),
|
|
60
|
+
});
|
|
61
|
+
said.push(hasSaidVersion
|
|
51
62
|
? `The service runs ${to} now. Its sessions kept running: the new process takes them over.`
|
|
52
|
-
: `The service started ${to}, but
|
|
63
|
+
: `The service started ${to}, but ${NOT_SAID_YET_REASON}`);
|
|
53
64
|
}
|
|
54
65
|
else {
|
|
55
66
|
said.push('The service is not installed: run aeolus-trierarch install to run it.');
|
package/dist/cli/upgrade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/cli/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/cli/upgrade.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,sBAAsB,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,yBAAyB,CAAC;AAmBjD,MAAM,OAAO,GAAG,iBAAiB,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,EAYtC;IACC,MAAM,IAAI,GAAG,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACnC,IAAI,EAAE,CAAC,OAAO,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,kBAAkB,CAAC,GAAG,EAAE,CAAC,OAAO,yCAAyC,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5D,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACpB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,+BAA+B,IAAI,GAAG,CAAC,EAAE,CAAC;IAC/F,CAAC;IAED,MAAM,IAAI,GAAG,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;IAC3C,IAAI,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AC,EAAE,CAAC;oBACzB,MAAM,IAAI,kBAAkB,CAC1B,iBAAiB,EAAE,wCAAwC,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,+BAA+B,IAAI,kGAAkG,CAC5O,CAAC;gBACJ,CAAC;gBACD,+GAA+G;gBAC/G,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;gBACvB,uFAAuF;gBACvF,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACrB,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;YACxB,CAAC;YACD,OAAO;YACP,OAAO,EAAE,EAAE,CAAC,OAAO;YACnB,GAAG,CAAC,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;SACnD,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,CACP,cAAc;YACZ,CAAC,CAAC,oBAAoB,EAAE,mEAAmE;YAC3F,CAAC,CAAC,uBAAuB,EAAE,SAAS,mBAAmB,EAAE,CAC5D,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC"}
|
package/dist/core/entry.d.ts
CHANGED
|
@@ -42,8 +42,8 @@ export interface Entry {
|
|
|
42
42
|
readonly hasStarted: boolean;
|
|
43
43
|
/** When the session crewing checks in its launch window started (#382), ISO 8601; none before its launch. */
|
|
44
44
|
readonly launchedAt?: string;
|
|
45
|
-
/** Set
|
|
46
|
-
readonly
|
|
45
|
+
/** Set as it goes back to crewing after a release elsewhere (row 11): its worktree goes before it is crewed again (#475). */
|
|
46
|
+
readonly isReleasedElsewhere?: true;
|
|
47
47
|
/** The inbox count last seen, and whether a wake waits for the session to turn idle. */
|
|
48
48
|
readonly wake: {
|
|
49
49
|
readonly waiting: number;
|
package/dist/core/ports.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface AssignedRequest {
|
|
|
47
47
|
readonly settingsVersion: number;
|
|
48
48
|
/** How the trierarch last said the crew stands; releasing once the requester removed it; null until any. */
|
|
49
49
|
readonly status: CrewStatus | null;
|
|
50
|
+
/** Whether its crew is final as the fleet holds it (decision 0029): read, never derived from the status (#477). */
|
|
51
|
+
readonly isFinal: boolean;
|
|
50
52
|
}
|
|
51
53
|
/** A plain-text report to argo, the operator, stored once under its idempotency key. */
|
|
52
54
|
export interface ArgoReport {
|
|
@@ -274,6 +276,8 @@ export interface DetectedHarness {
|
|
|
274
276
|
readonly confirmedAt: Date | null;
|
|
275
277
|
/** Its options as detected: its models, and its effort levels where its CLI has a flag for them. */
|
|
276
278
|
readonly options: Readonly<Record<string, ConfiguredOption>>;
|
|
279
|
+
/** The permission modes its CLI lists for its permission mode flag (#517), so a launch names a mode the installed version documents; none when it lists none. */
|
|
280
|
+
readonly permissionModes?: readonly string[];
|
|
277
281
|
/** Why detection could not find what it should, for argo, once per version; none when it found it. */
|
|
278
282
|
readonly problem?: string;
|
|
279
283
|
/** The model ids a session on this machine refused at this version (#382), never offered again until the version changes or a hand detect; none when none was. */
|
package/dist/core/reconciler.js
CHANGED
|
@@ -10,11 +10,9 @@ const CRASHED_NOTE = 'blocked: session crashed, restart budget spent';
|
|
|
10
10
|
/** The statuses the reconciler writes; crewing and running at the first crew are the crew's own to write. */
|
|
11
11
|
const WRITTEN = new Set(['running', 'restarting', 'crashed']);
|
|
12
12
|
const NOTHING = { actions: [], starts: 0 };
|
|
13
|
-
/** The statuses at which a crew is final (decision 0029): it is no longer given back. */
|
|
14
|
-
const FINAL = new Set(['running', 'restarting', 'crashed']);
|
|
15
13
|
/**
|
|
16
14
|
* What the trierarch does with settings it cannot crew (#382): while the
|
|
17
|
-
* crew is not final as the fleet holds it, it gives the request back with
|
|
15
|
+
* crew is not final as the fleet holds it (#477), it gives the request back with
|
|
18
16
|
* the field at fault as the reason, ending the entry it crewed with; once it
|
|
19
17
|
* is final, it tells argo, once per settings version.
|
|
20
18
|
*/
|
|
@@ -24,7 +22,7 @@ function uncrewable(at) {
|
|
|
24
22
|
if (state.refused[shipId] === settingsVersion) {
|
|
25
23
|
return [];
|
|
26
24
|
}
|
|
27
|
-
if (
|
|
25
|
+
if (!request.isFinal) {
|
|
28
26
|
const reason = refusal.field === undefined ? refusal.reason : `${refusal.field}: ${refusal.reason}`;
|
|
29
27
|
return [{ kind: 'giveBack', shipId, settingsVersion, reason, ...(entry !== undefined && { entry }) }];
|
|
30
28
|
}
|
|
@@ -50,7 +48,7 @@ export function reconcile(state, context) {
|
|
|
50
48
|
continue;
|
|
51
49
|
}
|
|
52
50
|
const step = request.settingsVersion === entry.settingsVersion
|
|
53
|
-
? trustedStep(entry, { step: stepOf(entry, { ...context, canStart: canStart() }), request, state: next, context })
|
|
51
|
+
? trustedStep(entry, { step: stepOf(entry, { ...context, canStart: canStart(), isFinal: request.isFinal }), request, state: next, context })
|
|
54
52
|
: newVersionStep(entry, { request, state: next, context });
|
|
55
53
|
if (step.isGivenBack === true) {
|
|
56
54
|
next = removeEntry(next, entry.shipId);
|
|
@@ -140,8 +138,9 @@ function entryOf(checked, at) {
|
|
|
140
138
|
* It is a first start (#443): a fresh session with the new version's first
|
|
141
139
|
* prompt, never the old conversation continued.
|
|
142
140
|
* Settings this trierarch cannot crew are given back while the crew is not
|
|
143
|
-
* final, its entry ending
|
|
144
|
-
*
|
|
141
|
+
* final, its entry ending: a new version clears final (decision 0029), so a
|
|
142
|
+
* running crew's is given back too. Once the fleet holds it final, argo is
|
|
143
|
+
* told and the entry stays as it was.
|
|
145
144
|
*/
|
|
146
145
|
function newVersionStep(entry, at) {
|
|
147
146
|
const { request, state, context } = at;
|
|
@@ -151,7 +150,7 @@ function newVersionStep(entry, at) {
|
|
|
151
150
|
if (uncrewed.some((action) => action.kind === 'giveBack')) {
|
|
152
151
|
return { isGivenBack: true, actions: uncrewed, starts: 0 };
|
|
153
152
|
}
|
|
154
|
-
const step = stepOf(entry, { ...context, canStart: false });
|
|
153
|
+
const step = stepOf(entry, { ...context, canStart: false, isFinal: request.isFinal });
|
|
155
154
|
return { ...step, actions: [...step.actions, ...uncrewed] };
|
|
156
155
|
}
|
|
157
156
|
const fresh = entryOf(checked.value, { shipId: entry.shipId, settingsVersion: request.settingsVersion, now: context.now });
|
|
@@ -184,13 +183,13 @@ function trustedStep(entry, at) {
|
|
|
184
183
|
const uncrewed = uncrewable({ request, refusal, state, entry });
|
|
185
184
|
return { ...(uncrewed.some((action) => action.kind === 'giveBack') && { isGivenBack: true }), actions: [...held, ...uncrewed], starts: 0 };
|
|
186
185
|
}
|
|
186
|
+
/** Steps an entry of the settings version it crews, with whether the fleet holds its crew final (#477). */
|
|
187
187
|
function stepOf(entry, context) {
|
|
188
188
|
const { observed, now, canStart } = context;
|
|
189
189
|
const seen = observed.ships[entry.shipId];
|
|
190
190
|
if (seen?.inbox.kind === 'leaseEnded') {
|
|
191
|
-
// Released elsewhere (row 11): its session stops and the ship is crewed again, in its
|
|
192
|
-
|
|
193
|
-
return { entry: FINAL.has(entry.state) ? { ...crewing, isFinal: true } : crewing, actions: [{ kind: 'stop', shipId: entry.shipId }, { kind: 'crew', shipId: entry.shipId, isResumed: false }], starts: 0 };
|
|
191
|
+
// Released elsewhere (row 11): its session stops and the ship is crewed again, in a fresh worktree as a first start, with its first prompt and no resume (#475). A final crew stays final in the fleet (#469).
|
|
192
|
+
return { entry: { ...withState(entry, { state: 'crewing', now }), isReleasedElsewhere: true, hasStarted: false }, actions: [{ kind: 'stop', shipId: entry.shipId }, { kind: 'crew', shipId: entry.shipId, isResumed: false }], starts: 0 };
|
|
194
193
|
}
|
|
195
194
|
switch (entry.state) {
|
|
196
195
|
case 'crewing':
|
|
@@ -211,21 +210,21 @@ function stepOf(entry, context) {
|
|
|
211
210
|
* launch window (#382). Activity makes the crew final, so it runs from when
|
|
212
211
|
* its session started. A model refused, or no activity within the minute,
|
|
213
212
|
* gives the request back, its entry ending, the reason naming the harness's
|
|
214
|
-
* screen the session stopped at when it knows it (#403); for a crew
|
|
215
|
-
* final, crewed again after a release elsewhere, it is a
|
|
216
|
-
* the restart budget instead (#469). A session gone, as after the machine
|
|
213
|
+
* screen the session stopped at when it knows it (#403); for a crew the fleet
|
|
214
|
+
* holds final (#477), as one crewed again after a release elsewhere, it is a
|
|
215
|
+
* failed start against the restart budget instead (#469). A session gone, as after the machine
|
|
217
216
|
* restarts, is crewed again. Until its start fails, its session is watched
|
|
218
217
|
* and woken as any other (#473).
|
|
219
218
|
*/
|
|
220
219
|
function launchStep(entry, context) {
|
|
221
|
-
const { observed, now } = context;
|
|
222
|
-
const { launchedAt,
|
|
220
|
+
const { observed, now, isFinal } = context;
|
|
221
|
+
const { launchedAt, ...running } = entry;
|
|
223
222
|
const seen = observed.launches[entry.shipId];
|
|
224
223
|
if (launchedAt === undefined || seen === undefined) {
|
|
225
224
|
return { actions: [{ kind: 'crew', shipId: entry.shipId, isResumed: true }], starts: 1 };
|
|
226
225
|
}
|
|
227
226
|
const failedStart = (reason, first = []) => {
|
|
228
|
-
if (isFinal
|
|
227
|
+
if (isFinal) {
|
|
229
228
|
const step = exitStep(running, { now, failedStart: reason });
|
|
230
229
|
return { ...step, actions: [...first, ...step.actions] };
|
|
231
230
|
}
|
|
@@ -246,9 +245,13 @@ function launchStep(entry, context) {
|
|
|
246
245
|
if (!isWindowOver(launchedAt, now)) {
|
|
247
246
|
return wakeStep(entry, observed.ships[entry.shipId]);
|
|
248
247
|
}
|
|
249
|
-
return failedStart(
|
|
248
|
+
return failedStart(noActivityReason(entry, seen.screen));
|
|
250
249
|
}
|
|
251
250
|
}
|
|
251
|
+
/** Why a start failed for no activity, naming the harness's screen the session stopped at when it knows it (#403). */
|
|
252
|
+
function noActivityReason(entry, screen) {
|
|
253
|
+
return screen === undefined ? NO_ACTIVITY_REASON : `${NO_ACTIVITY_REASON}, stopped at ${entry.harness}'s ${screen}`;
|
|
254
|
+
}
|
|
252
255
|
/** The entry with no launch window open. */
|
|
253
256
|
function withoutLaunch(entry) {
|
|
254
257
|
const { launchedAt, ...rest } = entry;
|
|
@@ -288,8 +291,9 @@ function runningStep(entry, context) {
|
|
|
288
291
|
* A running entry whose session started again (#397): its crew is final, so
|
|
289
292
|
* the check only observes. The session runs, is watched and woken as any
|
|
290
293
|
* other; activity closes the window. A model refused, or no activity within
|
|
291
|
-
* the minute, is a failed start
|
|
292
|
-
* the
|
|
294
|
+
* the minute, is a failed start, naming the screen it stopped at when it
|
|
295
|
+
* knows it (#474): the session stops, and it counts against the restart
|
|
296
|
+
* budget as an exit does, nothing given back.
|
|
293
297
|
*/
|
|
294
298
|
function restartWindowStep(entry, context) {
|
|
295
299
|
const { observed, now } = context;
|
|
@@ -311,7 +315,7 @@ function restartWindowStep(entry, context) {
|
|
|
311
315
|
return { ...step, actions: [...refused.actions, ...step.actions] };
|
|
312
316
|
}
|
|
313
317
|
case 'none':
|
|
314
|
-
return isWindowOver(launchedAt, now) ? exitStep(entry, { now, failedStart:
|
|
318
|
+
return isWindowOver(launchedAt, now) ? exitStep(entry, { now, failedStart: noActivityReason(entry, launch.screen) }) : wakeStep(entry, seen);
|
|
315
319
|
}
|
|
316
320
|
}
|
|
317
321
|
/**
|