@aeolus-fleet/trierarch 0.20.4 → 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 +9 -9
- 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 +14 -2
- package/dist/adapters/claude-code-screen.js.map +1 -1
- package/dist/adapters/claude-code-setup.d.ts +44 -2
- package/dist/adapters/claude-code-setup.js +71 -4
- package/dist/adapters/claude-code-setup.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +24 -2
- package/dist/adapters/claude-code.js +68 -6
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex-detector.d.ts +1 -1
- package/dist/adapters/codex-screen.js +1 -0
- package/dist/adapters/codex-screen.js.map +1 -1
- package/dist/adapters/codex-setup.js +4 -0
- package/dist/adapters/codex-setup.js.map +1 -1
- package/dist/adapters/codex.js +1 -1
- package/dist/adapters/codex.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/flags.d.ts +0 -8
- package/dist/adapters/flags.js +1 -12
- package/dist/adapters/flags.js.map +1 -1
- package/dist/adapters/harnesses.d.ts +20 -5
- package/dist/adapters/harnesses.js +16 -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/launch-screen.d.ts +8 -2
- package/dist/adapters/launch-screen.js +8 -3
- package/dist/adapters/launch-screen.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 +4 -0
- package/dist/adapters/service.js +16 -2
- package/dist/adapters/service.js.map +1 -1
- package/dist/adapters/trust.d.ts +5 -2
- package/dist/adapters/trust.js +13 -5
- 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 +8 -6
- package/dist/cli/config-check.js.map +1 -1
- package/dist/cli/init.d.ts +3 -3
- package/dist/cli/init.js +55 -31
- 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/check-settings.d.ts +13 -1
- package/dist/core/check-settings.js +19 -1
- package/dist/core/check-settings.js.map +1 -1
- package/dist/core/effective-flags.d.ts +9 -0
- package/dist/core/effective-flags.js +13 -0
- package/dist/core/effective-flags.js.map +1 -0
- package/dist/core/entry.d.ts +2 -2
- package/dist/core/ports.d.ts +14 -2
- package/dist/core/reconciler.js +42 -28
- package/dist/core/reconciler.js.map +1 -1
- package/dist/core/run-pass.js +52 -20
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +3 -3
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,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AC,IAAI,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACrJ,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,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;I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AC/C,KAAK,EAAE,KAAK,IAAI,EAAE;gBAChB,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,yBAAyB,EAAE,CAAC;gBACrD,+EAA+E;gBAC/E,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,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"}
|
|
@@ -24,11 +24,23 @@ export declare function trustRefusal(at: {
|
|
|
24
24
|
workspace: CrewSettings['workspace'];
|
|
25
25
|
trusted: TrustedPlaces;
|
|
26
26
|
}): Refusal | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Why a harness may not start a session with its flags: one of them waits on
|
|
29
|
+
* a one-time question it still asks, as Claude Code's bypass permissions
|
|
30
|
+
* (#403). Init is where the operator accepts it, so the reason says to do that.
|
|
31
|
+
*/
|
|
32
|
+
export declare function unacceptedRefusal(at: {
|
|
33
|
+
harness: string;
|
|
34
|
+
configuration: TrierarchConfiguration;
|
|
35
|
+
options: Readonly<Record<string, string>>;
|
|
36
|
+
trusted: TrustedPlaces;
|
|
37
|
+
}): Refusal | undefined;
|
|
27
38
|
/**
|
|
28
39
|
* Checks a crew request's settings again before crewing (decision 0027):
|
|
29
40
|
* the crew settings schema, then what this trierarch's configuration offers
|
|
30
41
|
* (harness, repository or folder, each option and its value), that the
|
|
31
|
-
* harness trusts the repository or folder (#381), and one folder per ship
|
|
42
|
+
* harness trusts the repository or folder (#381), and one folder per ship,
|
|
43
|
+
* and that no flag it launches with waits on a question (#403). The trierarch plugin checked them already; this machine's
|
|
32
44
|
* configuration may have changed since.
|
|
33
45
|
*/
|
|
34
46
|
export declare function checkSettings(raw: unknown, context: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { crewSettingsSchema } from '@aeolus-fleet/common';
|
|
2
|
+
import { effectiveFlags } from './effective-flags.js';
|
|
2
3
|
import { err, ok } from './shared/result.js';
|
|
3
4
|
/**
|
|
4
5
|
* Why a harness may not start a session in a place: it does not trust it
|
|
@@ -12,6 +13,18 @@ export function trustRefusal(at) {
|
|
|
12
13
|
: ['workspace.name', 'folder', workspace.name, trusted[harness]?.folders ?? []];
|
|
13
14
|
return places.includes(name) ? undefined : { field, reason: `${harness} does not trust the ${kind} ${name}: add it with aeolus-trierarch init, which trusts it` };
|
|
14
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Why a harness may not start a session with its flags: one of them waits on
|
|
18
|
+
* a one-time question it still asks, as Claude Code's bypass permissions
|
|
19
|
+
* (#403). Init is where the operator accepts it, so the reason says to do that.
|
|
20
|
+
*/
|
|
21
|
+
export function unacceptedRefusal(at) {
|
|
22
|
+
const { harness, configuration, options, trusted } = at;
|
|
23
|
+
const settings = configuration.harnesses[harness];
|
|
24
|
+
const unaccepted = trusted[harness]?.unacceptedFlags ?? [];
|
|
25
|
+
const flag = settings === undefined ? undefined : effectiveFlags(settings, options).find((each) => unaccepted.includes(each));
|
|
26
|
+
return flag === undefined ? undefined : { field: 'harness', reason: `${harness} still asks to accept ${flag}: accept it with aeolus-trierarch init` };
|
|
27
|
+
}
|
|
15
28
|
/** The field an issue names, as `options.model`, when it names one. */
|
|
16
29
|
function fieldOf(path) {
|
|
17
30
|
return path.length === 0 ? {} : { field: path.map(String).join('.') };
|
|
@@ -20,7 +33,8 @@ function fieldOf(path) {
|
|
|
20
33
|
* Checks a crew request's settings again before crewing (decision 0027):
|
|
21
34
|
* the crew settings schema, then what this trierarch's configuration offers
|
|
22
35
|
* (harness, repository or folder, each option and its value), that the
|
|
23
|
-
* harness trusts the repository or folder (#381), and one folder per ship
|
|
36
|
+
* harness trusts the repository or folder (#381), and one folder per ship,
|
|
37
|
+
* and that no flag it launches with waits on a question (#403). The trierarch plugin checked them already; this machine's
|
|
24
38
|
* configuration may have changed since.
|
|
25
39
|
*/
|
|
26
40
|
export function checkSettings(raw, context) {
|
|
@@ -65,6 +79,10 @@ export function checkSettings(raw, context) {
|
|
|
65
79
|
}
|
|
66
80
|
options[name] = value;
|
|
67
81
|
}
|
|
82
|
+
const unaccepted = unacceptedRefusal({ harness: harnessName, configuration, options, trusted });
|
|
83
|
+
if (unaccepted !== undefined) {
|
|
84
|
+
return err(unaccepted);
|
|
85
|
+
}
|
|
68
86
|
return ok({ settings, harness: harnessName, options });
|
|
69
87
|
}
|
|
70
88
|
//# sourceMappingURL=check-settings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-settings.js","sourceRoot":"","sources":["../../src/core/check-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+D,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"check-settings.js","sourceRoot":"","sources":["../../src/core/check-settings.ts"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AAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TrierarchConfiguration } from '@aeolus-fleet/common';
|
|
2
|
+
type HarnessConfiguration = TrierarchConfiguration['harnesses'][string];
|
|
3
|
+
/**
|
|
4
|
+
* The flags a launch gets: the harness's own, then each option's value as the
|
|
5
|
+
* settings picked it, or its default. Settings pick names only; the flags come
|
|
6
|
+
* from the configuration alone.
|
|
7
|
+
*/
|
|
8
|
+
export declare function effectiveFlags(harness: HarnessConfiguration, options: Readonly<Record<string, string>>): string[];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The flags a launch gets: the harness's own, then each option's value as the
|
|
3
|
+
* settings picked it, or its default. Settings pick names only; the flags come
|
|
4
|
+
* from the configuration alone.
|
|
5
|
+
*/
|
|
6
|
+
export function effectiveFlags(harness, options) {
|
|
7
|
+
const picked = Object.entries(harness.options).flatMap(([name, option]) => {
|
|
8
|
+
const value = options[name] ?? option.default;
|
|
9
|
+
return value === undefined ? [] : (option.values[value] ?? []);
|
|
10
|
+
});
|
|
11
|
+
return [...harness.flags, ...picked];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=effective-flags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"effective-flags.js","sourceRoot":"","sources":["../../src/core/effective-flags.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,OAA6B,EAAE,OAAyC;IACrG,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;QACxE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;QAC9C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC;AACvC,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 {
|
|
@@ -180,7 +182,9 @@ export interface HarnessPort {
|
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
184
|
* What a session's screen shows in its launch window (#382): activity once
|
|
183
|
-
* its first prompt made a tool call, the model refused, or neither yet
|
|
185
|
+
* its first prompt made a tool call, the model refused, or neither yet, with
|
|
186
|
+
* the harness's own screen it stopped at when it knows that screen (#403),
|
|
187
|
+
* such as `bypass permissions warning`.
|
|
184
188
|
*/
|
|
185
189
|
export type LaunchSeen = {
|
|
186
190
|
readonly kind: 'active';
|
|
@@ -189,6 +193,7 @@ export type LaunchSeen = {
|
|
|
189
193
|
readonly model: string;
|
|
190
194
|
} | {
|
|
191
195
|
readonly kind: 'none';
|
|
196
|
+
readonly screen?: string;
|
|
192
197
|
};
|
|
193
198
|
/** A session the process supervisor runs, by ship id: running, or exited and kept so the exit is seen. */
|
|
194
199
|
export interface ObservedSession {
|
|
@@ -206,10 +211,15 @@ export interface ObservedWorktree {
|
|
|
206
211
|
readonly name: string;
|
|
207
212
|
readonly shipId?: ShipId;
|
|
208
213
|
}
|
|
209
|
-
/**
|
|
214
|
+
/**
|
|
215
|
+
* The configured repositories and folders each configured harness trusts, by
|
|
216
|
+
* name (#381), and its flags whose one-time question is not accepted yet: a
|
|
217
|
+
* session launched with one waits on that question (#403).
|
|
218
|
+
*/
|
|
210
219
|
export type TrustedPlaces = Readonly<Record<string, {
|
|
211
220
|
readonly repositories: readonly string[];
|
|
212
221
|
readonly folders: readonly string[];
|
|
222
|
+
readonly unacceptedFlags: readonly string[];
|
|
213
223
|
}>>;
|
|
214
224
|
/**
|
|
215
225
|
* What each harness trusts now, as its own files say (#381). Init trusts a
|
|
@@ -266,6 +276,8 @@ export interface DetectedHarness {
|
|
|
266
276
|
readonly confirmedAt: Date | null;
|
|
267
277
|
/** Its options as detected: its models, and its effort levels where its CLI has a flag for them. */
|
|
268
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[];
|
|
269
281
|
/** Why detection could not find what it should, for argo, once per version; none when it found it. */
|
|
270
282
|
readonly problem?: string;
|
|
271
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkSettings, trustRefusal } from './check-settings.js';
|
|
1
|
+
import { checkSettings, trustRefusal, unacceptedRefusal } from './check-settings.js';
|
|
2
2
|
import { MODEL_OPTION } from './detected-options.js';
|
|
3
3
|
import { putEntry, removeEntry, withState } from './entry.js';
|
|
4
4
|
import { decideRestart, exitsInWindow } from './restart-policy.js';
|
|
@@ -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 });
|
|
@@ -166,15 +165,17 @@ function newVersionStep(entry, at) {
|
|
|
166
165
|
}
|
|
167
166
|
/**
|
|
168
167
|
* A step that would start the entry's session, held while its harness does
|
|
169
|
-
* not trust its repository or folder (#381)
|
|
170
|
-
* launch, a restart too. While the crew is not final the request is given
|
|
168
|
+
* not trust its repository or folder (#381), or still asks about a flag it
|
|
169
|
+
* launches with (#403): both are checked before every launch, a restart too. While the crew is not final the request is given
|
|
171
170
|
* back and the entry ends (#382); once it is final, the entry stays as it is
|
|
172
171
|
* and argo is told once per settings version.
|
|
173
172
|
*/
|
|
174
173
|
function trustedStep(entry, at) {
|
|
175
174
|
const { step, request, state, context } = at;
|
|
176
175
|
const isLaunching = step.actions.some((action) => action.kind === 'crew' || action.kind === 'launch');
|
|
177
|
-
const
|
|
176
|
+
const { harness, workspace, options } = entry;
|
|
177
|
+
const { trusted, configuration } = context;
|
|
178
|
+
const refusal = isLaunching ? (trustRefusal({ harness, workspace, trusted }) ?? unacceptedRefusal({ harness, configuration, options, trusted })) : undefined;
|
|
178
179
|
if (refusal === undefined) {
|
|
179
180
|
return step;
|
|
180
181
|
}
|
|
@@ -182,13 +183,13 @@ function trustedStep(entry, at) {
|
|
|
182
183
|
const uncrewed = uncrewable({ request, refusal, state, entry });
|
|
183
184
|
return { ...(uncrewed.some((action) => action.kind === 'giveBack') && { isGivenBack: true }), actions: [...held, ...uncrewed], starts: 0 };
|
|
184
185
|
}
|
|
186
|
+
/** Steps an entry of the settings version it crews, with whether the fleet holds its crew final (#477). */
|
|
185
187
|
function stepOf(entry, context) {
|
|
186
188
|
const { observed, now, canStart } = context;
|
|
187
189
|
const seen = observed.ships[entry.shipId];
|
|
188
190
|
if (seen?.inbox.kind === 'leaseEnded') {
|
|
189
|
-
// Released elsewhere (row 11): its session stops and the ship is crewed again, in its
|
|
190
|
-
|
|
191
|
-
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 };
|
|
192
193
|
}
|
|
193
194
|
switch (entry.state) {
|
|
194
195
|
case 'crewing':
|
|
@@ -208,37 +209,49 @@ function stepOf(entry, context) {
|
|
|
208
209
|
* An entry crewing: crewed (again) until its session started, then in its
|
|
209
210
|
* launch window (#382). Activity makes the crew final, so it runs from when
|
|
210
211
|
* its session started. A model refused, or no activity within the minute,
|
|
211
|
-
* gives the request back, its entry ending
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
212
|
+
* gives the request back, its entry ending, the reason naming the harness's
|
|
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
|
|
216
|
+
* restarts, is crewed again. Until its start fails, its session is watched
|
|
217
|
+
* and woken as any other (#473).
|
|
215
218
|
*/
|
|
216
219
|
function launchStep(entry, context) {
|
|
217
|
-
const { observed, now } = context;
|
|
218
|
-
const { launchedAt,
|
|
220
|
+
const { observed, now, isFinal } = context;
|
|
221
|
+
const { launchedAt, ...running } = entry;
|
|
219
222
|
const seen = observed.launches[entry.shipId];
|
|
220
223
|
if (launchedAt === undefined || seen === undefined) {
|
|
221
224
|
return { actions: [{ kind: 'crew', shipId: entry.shipId, isResumed: true }], starts: 1 };
|
|
222
225
|
}
|
|
223
226
|
const failedStart = (reason, first = []) => {
|
|
224
|
-
if (isFinal
|
|
227
|
+
if (isFinal) {
|
|
225
228
|
const step = exitStep(running, { now, failedStart: reason });
|
|
226
229
|
return { ...step, actions: [...first, ...step.actions] };
|
|
227
230
|
}
|
|
228
231
|
return { isGivenBack: true, actions: [...first, { kind: 'giveBack', shipId: entry.shipId, settingsVersion: entry.settingsVersion, reason, entry }], starts: 0 };
|
|
229
232
|
};
|
|
230
233
|
switch (seen.kind) {
|
|
231
|
-
case 'active':
|
|
234
|
+
case 'active': {
|
|
232
235
|
// Running since its session started, so the session start it writes is that start; the window is closed.
|
|
233
|
-
|
|
236
|
+
const final = { ...running, state: 'running', since: launchedAt };
|
|
237
|
+
const step = wakeStep(final, observed.ships[entry.shipId]);
|
|
238
|
+
return { ...step, entry: step.entry ?? final };
|
|
239
|
+
}
|
|
234
240
|
case 'refused': {
|
|
235
241
|
const refused = modelRefusal(entry, { model: seen.model, versions: context.versions });
|
|
236
242
|
return failedStart(refused.reason, refused.actions);
|
|
237
243
|
}
|
|
238
244
|
case 'none':
|
|
239
|
-
|
|
245
|
+
if (!isWindowOver(launchedAt, now)) {
|
|
246
|
+
return wakeStep(entry, observed.ships[entry.shipId]);
|
|
247
|
+
}
|
|
248
|
+
return failedStart(noActivityReason(entry, seen.screen));
|
|
240
249
|
}
|
|
241
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
|
+
}
|
|
242
255
|
/** The entry with no launch window open. */
|
|
243
256
|
function withoutLaunch(entry) {
|
|
244
257
|
const { launchedAt, ...rest } = entry;
|
|
@@ -278,8 +291,9 @@ function runningStep(entry, context) {
|
|
|
278
291
|
* A running entry whose session started again (#397): its crew is final, so
|
|
279
292
|
* the check only observes. The session runs, is watched and woken as any
|
|
280
293
|
* other; activity closes the window. A model refused, or no activity within
|
|
281
|
-
* the minute, is a failed start
|
|
282
|
-
* 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.
|
|
283
297
|
*/
|
|
284
298
|
function restartWindowStep(entry, context) {
|
|
285
299
|
const { observed, now } = context;
|
|
@@ -301,7 +315,7 @@ function restartWindowStep(entry, context) {
|
|
|
301
315
|
return { ...step, actions: [...refused.actions, ...step.actions] };
|
|
302
316
|
}
|
|
303
317
|
case 'none':
|
|
304
|
-
return isWindowOver(launchedAt, now) ? exitStep(entry, { now, failedStart:
|
|
318
|
+
return isWindowOver(launchedAt, now) ? exitStep(entry, { now, failedStart: noActivityReason(entry, launch.screen) }) : wakeStep(entry, seen);
|
|
305
319
|
}
|
|
306
320
|
}
|
|
307
321
|
/**
|