@aeolus-fleet/trierarch 0.20.1 → 0.20.3
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 -7
- package/dist/adapters/claude-code-detector.d.ts +26 -0
- package/dist/adapters/claude-code-detector.js +115 -0
- package/dist/adapters/claude-code-detector.js.map +1 -0
- package/dist/adapters/claude-code-screen.d.ts +5 -0
- package/dist/adapters/claude-code-screen.js +15 -0
- package/dist/adapters/claude-code-screen.js.map +1 -0
- package/dist/adapters/claude-code-setup.d.ts +2 -0
- package/dist/adapters/claude-code-setup.js +4 -0
- package/dist/adapters/claude-code-setup.js.map +1 -1
- package/dist/adapters/claude-code.d.ts +5 -3
- package/dist/adapters/claude-code.js +21 -3
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex-detector.d.ts +17 -0
- package/dist/adapters/codex-detector.js +89 -0
- package/dist/adapters/codex-detector.js.map +1 -0
- package/dist/adapters/codex-screen.d.ts +5 -0
- package/dist/adapters/codex-screen.js +16 -0
- package/dist/adapters/codex-screen.js.map +1 -0
- package/dist/adapters/codex-setup.d.ts +9 -0
- package/dist/adapters/codex-setup.js +36 -0
- package/dist/adapters/codex-setup.js.map +1 -1
- package/dist/adapters/codex.d.ts +1 -1
- package/dist/adapters/codex.js +2 -0
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/detected-file.d.ts +2 -0
- package/dist/adapters/detected-file.js +50 -0
- package/dist/adapters/detected-file.js.map +1 -0
- package/dist/adapters/detectors.d.ts +5 -0
- package/dist/adapters/detectors.js +23 -0
- package/dist/adapters/detectors.js.map +1 -0
- package/dist/adapters/harnesses.d.ts +1 -1
- package/dist/adapters/harnesses.js +2 -1
- package/dist/adapters/harnesses.js.map +1 -1
- package/dist/adapters/json-state.js +1 -0
- package/dist/adapters/json-state.js.map +1 -1
- package/dist/adapters/launch-screen.d.ts +18 -0
- package/dist/adapters/launch-screen.js +15 -0
- package/dist/adapters/launch-screen.js.map +1 -0
- package/dist/adapters/log.d.ts +1 -1
- package/dist/adapters/paths.d.ts +2 -0
- package/dist/adapters/paths.js +1 -0
- package/dist/adapters/paths.js.map +1 -1
- package/dist/adapters/rest-fleet.d.ts +3 -7
- package/dist/adapters/rest-fleet.js +18 -4
- package/dist/adapters/rest-fleet.js.map +1 -1
- package/dist/adapters/run-command.d.ts +6 -1
- package/dist/adapters/run-command.js +14 -2
- package/dist/adapters/run-command.js.map +1 -1
- package/dist/adapters/tmux.d.ts +2 -0
- package/dist/adapters/tmux.js +6 -0
- package/dist/adapters/tmux.js.map +1 -1
- package/dist/adapters/trust.d.ts +14 -0
- package/dist/adapters/trust.js +29 -0
- package/dist/adapters/trust.js.map +1 -0
- package/dist/cli/add.d.ts +35 -0
- package/dist/cli/add.js +51 -0
- package/dist/cli/add.js.map +1 -0
- package/dist/cli/config-check.js +11 -2
- package/dist/cli/config-check.js.map +1 -1
- package/dist/cli/detect.d.ts +26 -0
- package/dist/cli/detect.js +31 -0
- package/dist/cli/detect.js.map +1 -0
- package/dist/cli/init.d.ts +4 -1
- package/dist/cli/init.js +20 -15
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/main.js +30 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/places.d.ts +8 -0
- package/dist/cli/places.js +20 -0
- package/dist/cli/places.js.map +1 -0
- package/dist/cli/run.js +39 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/upgrade.d.ts +7 -0
- package/dist/cli/upgrade.js +21 -1
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/core/check-settings.d.ts +14 -2
- package/dist/core/check-settings.js +19 -3
- package/dist/core/check-settings.js.map +1 -1
- package/dist/core/detect-harnesses.d.ts +27 -0
- package/dist/core/detect-harnesses.js +44 -0
- package/dist/core/detect-harnesses.js.map +1 -0
- package/dist/core/detected-options.d.ts +15 -0
- package/dist/core/detected-options.js +49 -0
- package/dist/core/detected-options.js.map +1 -0
- package/dist/core/entry.d.ts +2 -0
- package/dist/core/entry.js.map +1 -1
- package/dist/core/ports.d.ts +93 -0
- package/dist/core/reconciler.d.ts +31 -2
- package/dist/core/reconciler.js +100 -13
- package/dist/core/reconciler.js.map +1 -1
- package/dist/core/refuse-model.d.ts +22 -0
- package/dist/core/refuse-model.js +32 -0
- package/dist/core/refuse-model.js.map +1 -0
- package/dist/core/report-detection-problems.d.ts +11 -0
- package/dist/core/report-detection-problems.js +16 -0
- package/dist/core/report-detection-problems.js.map +1 -0
- package/dist/core/report-self.d.ts +2 -1
- package/dist/core/report-self.js +25 -12
- package/dist/core/report-self.js.map +1 -1
- package/dist/core/run-pass.d.ts +6 -1
- package/dist/core/run-pass.js +68 -8
- package/dist/core/run-pass.js.map +1 -1
- package/package.json +3 -3
package/dist/cli/run.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { setTimeout as wait } from 'node:timers/promises';
|
|
2
2
|
import { loadConfiguration, readCrewFile, writeRunningFile } from '../adapters/files.js';
|
|
3
|
+
import { createDetectedFile } from '../adapters/detected-file.js';
|
|
4
|
+
import { createDetectors } from '../adapters/detectors.js';
|
|
3
5
|
import { createGitWorkspace } from '../adapters/git-workspace.js';
|
|
4
6
|
import { adapterFlagsOf, createHarnesses, riskyFlagsOf } from '../adapters/harnesses.js';
|
|
5
7
|
import { createJsonState } from '../adapters/json-state.js';
|
|
6
8
|
import { createRestFleet } from '../adapters/rest-fleet.js';
|
|
7
9
|
import { createTmux } from '../adapters/tmux.js';
|
|
10
|
+
import { createTrust } from '../adapters/trust.js';
|
|
8
11
|
import { runningVersion } from '../adapters/version.js';
|
|
12
|
+
import { createDetectHarnesses } from '../core/detect-harnesses.js';
|
|
13
|
+
import { modelOptionsIgnored, withDetectedOptions } from '../core/detected-options.js';
|
|
14
|
+
import { createRefuseModel } from '../core/refuse-model.js';
|
|
15
|
+
import { createReportDetectionProblems } from '../core/report-detection-problems.js';
|
|
9
16
|
import { createHandleDelivery } from '../core/handle-delivery.js';
|
|
10
17
|
import { machineOf } from '../core/machine.js';
|
|
11
18
|
import { createReportSelf } from '../core/report-self.js';
|
|
@@ -20,24 +27,52 @@ export const PASS_INTERVAL_MS = 5000;
|
|
|
20
27
|
*/
|
|
21
28
|
export async function runTrierarch(input) {
|
|
22
29
|
const { paths, homeDirectory, env, signal, logger } = input;
|
|
23
|
-
const
|
|
30
|
+
const configured = await loadConfiguration(paths.config);
|
|
24
31
|
const crew = await readCrewFile(paths.crewToken);
|
|
25
32
|
const fleet = createRestFleet(crew);
|
|
33
|
+
// Detected again only for a harness whose version changed since (#365); the operator's own options win.
|
|
34
|
+
const detectedStore = createDetectedFile(paths.detected);
|
|
35
|
+
const detectHarnesses = createDetectHarnesses({ detectors: createDetectors({ homeDirectory }), store: detectedStore, clock: { now: () => new Date() }, logger });
|
|
36
|
+
const detected = await detectHarnesses({ harnesses: Object.keys(configured.harnesses), by: 'start' });
|
|
37
|
+
await createReportDetectionProblems({ fleet })(detected).catch((error) => {
|
|
38
|
+
logger.warn(`Could not tell argo what detection found: ${error instanceof Error ? error.message : String(error)}`);
|
|
39
|
+
});
|
|
40
|
+
for (const harness of modelOptionsIgnored(configured)) {
|
|
41
|
+
logger.warn(`${harness}: the configuration's model option is ignored: model ids come from detection only (#382); remove it`);
|
|
42
|
+
}
|
|
43
|
+
const configuration = withDetectedOptions(configured, detected);
|
|
44
|
+
// What the machine offers changes while it runs, as sessions refuse models (#382): each pass and report reads it afresh.
|
|
45
|
+
let offered = { configuration, detected };
|
|
26
46
|
const tmux = createTmux();
|
|
27
47
|
const { harnesses, plugins } = await createHarnesses({ configuration, homeDirectory, env, sessions: tmux });
|
|
28
48
|
const workspace = createGitWorkspace({ configuration, root: configuration.worktreeRoot ?? paths.worktrees });
|
|
29
49
|
const state = createJsonState(paths.state);
|
|
50
|
+
const trust = createTrust({ configuration, homeDirectory, env });
|
|
30
51
|
const clock = { now: () => new Date() };
|
|
31
52
|
const setup = {
|
|
32
|
-
configuration
|
|
53
|
+
get configuration() {
|
|
54
|
+
return offered.configuration;
|
|
55
|
+
},
|
|
33
56
|
version: runningVersion(),
|
|
34
57
|
adapterFlags: adapterFlagsOf(configuration),
|
|
35
58
|
riskyFlags: riskyFlagsOf(configuration),
|
|
36
59
|
machine: machineOf({ platform: process.platform, arch: process.arch }),
|
|
60
|
+
get detected() {
|
|
61
|
+
return offered.detected;
|
|
62
|
+
},
|
|
37
63
|
};
|
|
64
|
+
const refuseModel = createRefuseModel({
|
|
65
|
+
store: detectedStore,
|
|
66
|
+
detect: detectHarnesses,
|
|
67
|
+
onDetected: (found) => {
|
|
68
|
+
const kept = Object.fromEntries(Object.entries(found).filter(([harness]) => harness in configured.harnesses));
|
|
69
|
+
offered = { configuration: withDetectedOptions(configured, kept), detected: kept };
|
|
70
|
+
},
|
|
71
|
+
logger,
|
|
72
|
+
});
|
|
38
73
|
const handle = createHandleDelivery({ fleet, logger });
|
|
39
|
-
const runPass = createRunPass({ fleet, harnesses, processes: tmux, workspace, state, setup, clock, logger });
|
|
40
|
-
const reportSelf = createReportSelf({ fleet, processes: tmux, state, setup });
|
|
74
|
+
const runPass = createRunPass({ fleet, harnesses, processes: tmux, workspace, trust, state, setup, clock, logger, refuseModel });
|
|
75
|
+
const reportSelf = createReportSelf({ fleet, processes: tmux, trust, state, setup });
|
|
41
76
|
// Each pass ends with the trierarch's own report: the first at start, then only when it changed.
|
|
42
77
|
const pass = async () => {
|
|
43
78
|
await runPass();
|
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,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE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
|
|
1
|
+
import { type RunningFile } from '../adapters/files.js';
|
|
1
2
|
import type { CommandResult } from '../adapters/run-command.js';
|
|
2
3
|
import type { Service } from '../adapters/service.js';
|
|
3
4
|
/**
|
|
@@ -5,6 +6,8 @@ import type { Service } from '../adapters/service.js';
|
|
|
5
6
|
* the latest on npm, globally and pinned to it, then stops the old process and
|
|
6
7
|
* starts the new one. Sessions are not touched: they run on the trierarch's
|
|
7
8
|
* own tmux server, and the new process takes them over from its saved state.
|
|
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.
|
|
8
11
|
* It never upgrades on its own. A failed install leaves the old version
|
|
9
12
|
* running.
|
|
10
13
|
*/
|
|
@@ -28,4 +31,8 @@ export declare function upgradeTrierarch(at: {
|
|
|
28
31
|
installedVersion: () => string;
|
|
29
32
|
npm: Npm;
|
|
30
33
|
service: Pick<Service, 'stop' | 'start' | 'status'>;
|
|
34
|
+
/** What running.json says now: the new process writes it as it starts. */
|
|
35
|
+
running: () => Promise<RunningFile | undefined>;
|
|
36
|
+
/** Waits between reads of running.json; a test passes one that does not wait. */
|
|
37
|
+
sleep?: (ms: number) => Promise<void>;
|
|
31
38
|
}): Promise<UpgradeReport>;
|
package/dist/cli/upgrade.js
CHANGED
|
@@ -4,11 +4,28 @@ import { TrierarchFileError } from '../adapters/files.js';
|
|
|
4
4
|
* the latest on npm, globally and pinned to it, then stops the old process and
|
|
5
5
|
* starts the new one. Sessions are not touched: they run on the trierarch's
|
|
6
6
|
* own tmux server, and the new process takes them over from its saved state.
|
|
7
|
+
* 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.
|
|
7
9
|
* It never upgrades on its own. A failed install leaves the old version
|
|
8
10
|
* running.
|
|
9
11
|
*/
|
|
10
12
|
export const PACKAGE = '@aeolus-fleet/trierarch';
|
|
11
13
|
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
|
+
}
|
|
12
29
|
export async function upgradeTrierarch(at) {
|
|
13
30
|
const from = at.installedVersion();
|
|
14
31
|
if (at.version !== undefined && !VERSION.test(at.version)) {
|
|
@@ -29,7 +46,10 @@ export async function upgradeTrierarch(at) {
|
|
|
29
46
|
// Stop waits until the old process has exited, so only the new one ever runs the loop.
|
|
30
47
|
await at.service.stop();
|
|
31
48
|
await at.service.start();
|
|
32
|
-
|
|
49
|
+
const sleep = at.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
50
|
+
said.push((await saysVersion(to, { running: at.running, sleep }))
|
|
51
|
+
? `The service runs ${to} now. Its sessions kept running: the new process takes them over.`
|
|
52
|
+
: `The service started ${to}, but the new process has not said its version after ${String(VERSION_TIMEOUT_MS / MS_PER_SECOND)} seconds: aeolus-trierarch status shows the version it runs once it does.`);
|
|
33
53
|
}
|
|
34
54
|
else {
|
|
35
55
|
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,
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../src/cli/upgrade.ts"],"names":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EAA2E,CAC3M,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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type CrewSettings, type ShipId, type TrierarchConfiguration } from '@aeolus-fleet/common';
|
|
2
2
|
import type { TrierarchState } from './entry.js';
|
|
3
|
+
import type { TrustedPlaces } from './ports.js';
|
|
3
4
|
import { type Result } from './shared/result.js';
|
|
4
5
|
/** Why the trierarch cannot crew settings: the field at fault, when one is, and a reason argo can read. */
|
|
5
6
|
export interface Refusal {
|
|
@@ -13,15 +14,26 @@ export interface CheckedSettings {
|
|
|
13
14
|
readonly harness: string;
|
|
14
15
|
readonly options: Readonly<Record<string, string>>;
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Why a harness may not start a session in a place: it does not trust it
|
|
19
|
+
* (#381). Adding a place through init is what trusts it, so the reason says
|
|
20
|
+
* to do that.
|
|
21
|
+
*/
|
|
22
|
+
export declare function trustRefusal(at: {
|
|
23
|
+
harness: string;
|
|
24
|
+
workspace: CrewSettings['workspace'];
|
|
25
|
+
trusted: TrustedPlaces;
|
|
26
|
+
}): Refusal | undefined;
|
|
16
27
|
/**
|
|
17
28
|
* Checks a crew request's settings again before crewing (decision 0027):
|
|
18
29
|
* the crew settings schema, then what this trierarch's configuration offers
|
|
19
|
-
* (harness, repository or folder, each option and its value),
|
|
20
|
-
* per ship. The trierarch plugin checked them already; this machine's
|
|
30
|
+
* (harness, repository or folder, each option and its value), that the
|
|
31
|
+
* harness trusts the repository or folder (#381), and one folder per ship. The trierarch plugin checked them already; this machine's
|
|
21
32
|
* configuration may have changed since.
|
|
22
33
|
*/
|
|
23
34
|
export declare function checkSettings(raw: unknown, context: {
|
|
24
35
|
shipId: ShipId;
|
|
25
36
|
configuration: TrierarchConfiguration;
|
|
26
37
|
state: TrierarchState;
|
|
38
|
+
trusted: TrustedPlaces;
|
|
27
39
|
}): Result<CheckedSettings, Refusal>;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { crewSettingsSchema } from '@aeolus-fleet/common';
|
|
2
2
|
import { err, ok } from './shared/result.js';
|
|
3
|
+
/**
|
|
4
|
+
* Why a harness may not start a session in a place: it does not trust it
|
|
5
|
+
* (#381). Adding a place through init is what trusts it, so the reason says
|
|
6
|
+
* to do that.
|
|
7
|
+
*/
|
|
8
|
+
export function trustRefusal(at) {
|
|
9
|
+
const { harness, workspace, trusted } = at;
|
|
10
|
+
const [field, kind, name, places] = workspace.kind === 'worktree'
|
|
11
|
+
? ['workspace.repository', 'repository', workspace.repository, trusted[harness]?.repositories ?? []]
|
|
12
|
+
: ['workspace.name', 'folder', workspace.name, trusted[harness]?.folders ?? []];
|
|
13
|
+
return places.includes(name) ? undefined : { field, reason: `${harness} does not trust the ${kind} ${name}: add it with aeolus-trierarch init, which trusts it` };
|
|
14
|
+
}
|
|
3
15
|
/** The field an issue names, as `options.model`, when it names one. */
|
|
4
16
|
function fieldOf(path) {
|
|
5
17
|
return path.length === 0 ? {} : { field: path.map(String).join('.') };
|
|
@@ -7,8 +19,8 @@ function fieldOf(path) {
|
|
|
7
19
|
/**
|
|
8
20
|
* Checks a crew request's settings again before crewing (decision 0027):
|
|
9
21
|
* the crew settings schema, then what this trierarch's configuration offers
|
|
10
|
-
* (harness, repository or folder, each option and its value),
|
|
11
|
-
* per ship. The trierarch plugin checked them already; this machine's
|
|
22
|
+
* (harness, repository or folder, each option and its value), that the
|
|
23
|
+
* harness trusts the repository or folder (#381), and one folder per ship. The trierarch plugin checked them already; this machine's
|
|
12
24
|
* configuration may have changed since.
|
|
13
25
|
*/
|
|
14
26
|
export function checkSettings(raw, context) {
|
|
@@ -18,7 +30,7 @@ export function checkSettings(raw, context) {
|
|
|
18
30
|
return err({ ...fieldOf(issue?.path ?? []), reason: issue?.message ?? 'The settings do not parse' });
|
|
19
31
|
}
|
|
20
32
|
const settings = parsed.data;
|
|
21
|
-
const { configuration, state, shipId } = context;
|
|
33
|
+
const { configuration, state, shipId, trusted } = context;
|
|
22
34
|
const harnessName = settings.harness ?? Object.keys(configuration.harnesses)[0];
|
|
23
35
|
const harness = harnessName === undefined ? undefined : configuration.harnesses[harnessName];
|
|
24
36
|
if (harnessName === undefined || harness === undefined) {
|
|
@@ -37,6 +49,10 @@ export function checkSettings(raw, context) {
|
|
|
37
49
|
return err({ field: 'workspace.name', reason: `The folder ${workspace.name} crews ${crewing.shipId} already: one folder crews one ship` });
|
|
38
50
|
}
|
|
39
51
|
}
|
|
52
|
+
const untrusted = trustRefusal({ harness: harnessName, workspace, trusted });
|
|
53
|
+
if (untrusted !== undefined) {
|
|
54
|
+
return err(untrusted);
|
|
55
|
+
}
|
|
40
56
|
const options = {};
|
|
41
57
|
for (const [name, value] of Object.entries(settings.options)) {
|
|
42
58
|
const option = harness.options[name];
|
|
@@ -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"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAA+D,MAAM,sBAAsB,CAAC;AAIvH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,oBAAoB,CAAC;AAgB1D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAqF;IAChH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IAC3C,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,GAC/B,SAAS,CAAC,IAAI,KAAK,UAAU;QAC3B,C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ACD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Detected, DetectedStore, HarnessDetector, Logger } from './ports.js';
|
|
2
|
+
import type { Clock } from './shared/clock.js';
|
|
3
|
+
/**
|
|
4
|
+
* Why it detects: at start, only a harness whose version changed; by hand,
|
|
5
|
+
* every harness, clearing the ids sessions refused; after a refusal, the
|
|
6
|
+
* harness again, keeping them while its version is the same (#382).
|
|
7
|
+
*/
|
|
8
|
+
export type DetectedBy = 'start' | 'hand' | 'refusal';
|
|
9
|
+
export type DetectHarnesses = (at: {
|
|
10
|
+
harnesses: readonly string[];
|
|
11
|
+
by: DetectedBy;
|
|
12
|
+
}) => Promise<Detected>;
|
|
13
|
+
/**
|
|
14
|
+
* Use case: detect what the machine's harnesses offer (#365; docs/trierarch.md,
|
|
15
|
+
* "Detected options"). A harness is detected when it has no detection yet,
|
|
16
|
+
* when its version differs from the one detected, by hand, or after a
|
|
17
|
+
* session refused a model, never more often: a probe costs a call. A harness whose CLI does not say its version,
|
|
18
|
+
* or gives nothing to detect, keeps what was detected before, and the
|
|
19
|
+
* operator is told. Only the harnesses given that have a detector are
|
|
20
|
+
* detected; what was found is kept.
|
|
21
|
+
*/
|
|
22
|
+
export declare function createDetectHarnesses(deps: {
|
|
23
|
+
detectors: Readonly<Record<string, HarnessDetector>>;
|
|
24
|
+
store: DetectedStore;
|
|
25
|
+
clock: Clock;
|
|
26
|
+
logger: Pick<Logger, 'warn'>;
|
|
27
|
+
}): DetectHarnesses;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use case: detect what the machine's harnesses offer (#365; docs/trierarch.md,
|
|
3
|
+
* "Detected options"). A harness is detected when it has no detection yet,
|
|
4
|
+
* when its version differs from the one detected, by hand, or after a
|
|
5
|
+
* session refused a model, never more often: a probe costs a call. A harness whose CLI does not say its version,
|
|
6
|
+
* or gives nothing to detect, keeps what was detected before, and the
|
|
7
|
+
* operator is told. Only the harnesses given that have a detector are
|
|
8
|
+
* detected; what was found is kept.
|
|
9
|
+
*/
|
|
10
|
+
export function createDetectHarnesses(deps) {
|
|
11
|
+
return async ({ harnesses, by }) => {
|
|
12
|
+
const before = await deps.store.load();
|
|
13
|
+
const detected = { ...before };
|
|
14
|
+
let isChanged = false;
|
|
15
|
+
for (const name of harnesses) {
|
|
16
|
+
const detector = deps.detectors[name];
|
|
17
|
+
if (detector === undefined) {
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const previous = before[name];
|
|
21
|
+
const version = await detector.version();
|
|
22
|
+
if (version === undefined) {
|
|
23
|
+
deps.logger.warn(`${name} did not say its version, so its options stay as detected before`);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (by === 'start' && previous?.version === version) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const found = await detector.detect({ version, previous, now: deps.clock.now() });
|
|
30
|
+
if (found === undefined) {
|
|
31
|
+
deps.logger.warn(`${name} ${version} gave nothing to detect, so its options stay as detected before`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const refused = by === 'refusal' && previous?.version === version ? previous.refused : undefined;
|
|
35
|
+
detected[name] = refused === undefined ? found : { ...found, refused };
|
|
36
|
+
isChanged = true;
|
|
37
|
+
}
|
|
38
|
+
if (isChanged) {
|
|
39
|
+
await deps.store.save(detected);
|
|
40
|
+
}
|
|
41
|
+
return Object.fromEntries(harnesses.flatMap((name) => (detected[name] === undefined ? [] : [[name, detected[name]]])));
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=detect-harnesses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-harnesses.js","sourceRoot":"","sources":["../../src/core/detect-harnesses.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,M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O,CAAC,CAAC,CAAC,SAAS,CAAC;YACjG,QAAQ,CAAC,IAAI,CAAC,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC;YACvE,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,OAAO,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TrierarchConfiguration } from '@aeolus-fleet/common';
|
|
2
|
+
import type { Detected } from './ports.js';
|
|
3
|
+
/** The option that names the model: its ids come from detection only (#382). */
|
|
4
|
+
export declare const MODEL_OPTION = "model";
|
|
5
|
+
/**
|
|
6
|
+
* The configuration with each configured harness's detected options added
|
|
7
|
+
* (#365): an option the operator wrote replaces the detected one of its name
|
|
8
|
+
* whole, values and default, so a hand edit is never overwritten and nothing
|
|
9
|
+
* is merged. The model is the exception (#382): its ids come from detection
|
|
10
|
+
* only, without the ids the machine refused, so a model the operator wrote is
|
|
11
|
+
* ignored. A detected harness the configuration does not offer is left out.
|
|
12
|
+
*/
|
|
13
|
+
export declare function withDetectedOptions(configuration: TrierarchConfiguration, detected: Detected): TrierarchConfiguration;
|
|
14
|
+
/** The harnesses whose configuration writes a model option, which is ignored (#382): the operator is told. */
|
|
15
|
+
export declare function modelOptionsIgnored(configuration: TrierarchConfiguration): string[];
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** The option that names the model: its ids come from detection only (#382). */
|
|
2
|
+
export const MODEL_OPTION = 'model';
|
|
3
|
+
/** The detected model option without the ids the machine refused, its default moving to the first id left; none when none is left. */
|
|
4
|
+
function offeredModel(found) {
|
|
5
|
+
const model = found.options[MODEL_OPTION];
|
|
6
|
+
if (model === undefined) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const refused = new Set((found.refused ?? []).map((each) => each.id));
|
|
10
|
+
const values = Object.fromEntries(Object.entries(model.values).filter(([id]) => !refused.has(id)));
|
|
11
|
+
const [first] = Object.keys(values);
|
|
12
|
+
if (first === undefined) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const isDefaultLeft = model.default !== undefined && model.default in values;
|
|
16
|
+
return { values, ...(model.default !== undefined && { default: isDefaultLeft ? model.default : first }) };
|
|
17
|
+
}
|
|
18
|
+
/** The options without the model. */
|
|
19
|
+
function withoutModel(options) {
|
|
20
|
+
return Object.fromEntries(Object.entries(options).filter(([name]) => name !== MODEL_OPTION));
|
|
21
|
+
}
|
|
22
|
+
/** The detected options of a harness as offered: every one detected, the model without its refused ids. */
|
|
23
|
+
function offeredOptions(found) {
|
|
24
|
+
if (found === undefined) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
const rest = withoutModel(found.options);
|
|
28
|
+
const model = offeredModel(found);
|
|
29
|
+
return model === undefined ? rest : { [MODEL_OPTION]: model, ...rest };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The configuration with each configured harness's detected options added
|
|
33
|
+
* (#365): an option the operator wrote replaces the detected one of its name
|
|
34
|
+
* whole, values and default, so a hand edit is never overwritten and nothing
|
|
35
|
+
* is merged. The model is the exception (#382): its ids come from detection
|
|
36
|
+
* only, without the ids the machine refused, so a model the operator wrote is
|
|
37
|
+
* ignored. A detected harness the configuration does not offer is left out.
|
|
38
|
+
*/
|
|
39
|
+
export function withDetectedOptions(configuration, detected) {
|
|
40
|
+
const harnesses = Object.fromEntries(Object.entries(configuration.harnesses).map(([name, harness]) => [name, { ...harness, options: { ...offeredOptions(detected[name]), ...withoutModel(harness.options) } }]));
|
|
41
|
+
return { ...configuration, harnesses };
|
|
42
|
+
}
|
|
43
|
+
/** The harnesses whose configuration writes a model option, which is ignored (#382): the operator is told. */
|
|
44
|
+
export function modelOptionsIgnored(configuration) {
|
|
45
|
+
return Object.entries(configuration.harnesses)
|
|
46
|
+
.filter(([, harness]) => MODEL_OPTION in harness.options)
|
|
47
|
+
.map(([name]) => name);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=detected-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detected-options.js","sourceRoot":"","sources":["../../src/core/detected-options.ts"],"names":[],"mappings":"AAIA,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,sIAAsI;AACtI,SAAS,YAAY,CAAC,KAAsB;IAC1C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACnG,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM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E,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,CAC3K,CAAC;IACF,OAAO,EAAE,GAAG,aAAa,EAAE,SAAS,EAAE,CAAC;AACzC,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,mBAAmB,CAAC,aAAqC;IACvE,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC;SAC3C,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC;SACxD,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/core/entry.d.ts
CHANGED
|
@@ -40,6 +40,8 @@ export interface Entry {
|
|
|
40
40
|
/** Where its workspace is, once made. */
|
|
41
41
|
readonly folder?: string;
|
|
42
42
|
readonly hasStarted: boolean;
|
|
43
|
+
/** When the session crewing checks in its launch window started (#382), ISO 8601; none before its launch. */
|
|
44
|
+
readonly launchedAt?: string;
|
|
43
45
|
/** The inbox count last seen, and whether a wake waits for the session to turn idle. */
|
|
44
46
|
readonly wake: {
|
|
45
47
|
readonly waiting: number;
|
package/dist/core/entry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/core/entry.ts"],"names":[],"mappings":"AAiBA,kGAAkG;AAClG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../src/core/entry.ts"],"names":[],"mappings":"AAiBA,kGAAkG;AAClG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,CAAU,CAAC;AAgDlG,MAAM,CAAC,MAAM,WAAW,GAAmB,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAE/F,0CAA0C;AAC1C,MAAM,UAAU,SAAS,CAAC,KAAY,EAAE,MAAwC;IAC9E,OAAO,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;AAC5E,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,QAAQ,CAAC,KAAqB,EAAE,KAAY;IAC1D,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;AAC5E,CAAC;AAED,0CAA0C;AAC1C,MAAM,UAAU,WAAW,CAAC,KAAqB,EAAE,MAAc;IAC/D,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC;IAClG,OAAO,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/core/ports.d.ts
CHANGED
|
@@ -63,6 +63,14 @@ export interface WrittenStatus {
|
|
|
63
63
|
readonly attempt: number;
|
|
64
64
|
readonly startedAt: Date | null;
|
|
65
65
|
}
|
|
66
|
+
/** How the fleet answered a give-back (#382): it took the request back, or refused with its code and message. */
|
|
67
|
+
export type GiveBackAnswer = {
|
|
68
|
+
readonly kind: 'givenBack';
|
|
69
|
+
} | {
|
|
70
|
+
readonly kind: 'refused';
|
|
71
|
+
readonly code: string;
|
|
72
|
+
readonly message: string;
|
|
73
|
+
};
|
|
66
74
|
export interface FleetPort {
|
|
67
75
|
/** The fleet's URL, written into each session's identity. */
|
|
68
76
|
readonly url: string;
|
|
@@ -70,6 +78,20 @@ export interface FleetPort {
|
|
|
70
78
|
assignedRequests(): Promise<readonly AssignedRequest[]>;
|
|
71
79
|
/** Says how its crew of an assigned ship stands, with the restart attempt and when the session started (#332). */
|
|
72
80
|
writeStatus(shipId: ShipId, written: WrittenStatus): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Gives back a request it cannot crew, for the settings version it tried,
|
|
83
|
+
* while its crew is not final (#382): the fleet unassigns it and ends the
|
|
84
|
+
* ship's lease. A refusal is answered, not thrown.
|
|
85
|
+
*/
|
|
86
|
+
giveBack(shipId: ShipId, given: {
|
|
87
|
+
settingsVersion: number;
|
|
88
|
+
reason: string;
|
|
89
|
+
}): Promise<GiveBackAnswer>;
|
|
90
|
+
/** The trierarch's own ship, as its crew token says: its name names the machine. It answers while the lease holds. */
|
|
91
|
+
whoami(): Promise<{
|
|
92
|
+
shipId: ShipId;
|
|
93
|
+
name: string;
|
|
94
|
+
}>;
|
|
73
95
|
/** Confirms it released the ship of a releasing request, which then goes. */
|
|
74
96
|
confirmRelease(shipId: ShipId): Promise<void>;
|
|
75
97
|
ship(shipId: ShipId): Promise<FleetShipStatus>;
|
|
@@ -150,7 +172,24 @@ export interface HarnessPort {
|
|
|
150
172
|
shipId: ShipId;
|
|
151
173
|
folder: string;
|
|
152
174
|
}): Promise<void>;
|
|
175
|
+
/** What the session's screen shows in its launch window (#382), for the model it launched with; any model refused when it launched with none. */
|
|
176
|
+
launchSeen(session: {
|
|
177
|
+
shipId: ShipId;
|
|
178
|
+
model?: string;
|
|
179
|
+
}): Promise<LaunchSeen>;
|
|
153
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* 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.
|
|
184
|
+
*/
|
|
185
|
+
export type LaunchSeen = {
|
|
186
|
+
readonly kind: 'active';
|
|
187
|
+
} | {
|
|
188
|
+
readonly kind: 'refused';
|
|
189
|
+
readonly model: string;
|
|
190
|
+
} | {
|
|
191
|
+
readonly kind: 'none';
|
|
192
|
+
};
|
|
154
193
|
/** A session the process supervisor runs, by ship id: running, or exited and kept so the exit is seen. */
|
|
155
194
|
export interface ObservedSession {
|
|
156
195
|
readonly shipId: ShipId;
|
|
@@ -167,6 +206,19 @@ export interface ObservedWorktree {
|
|
|
167
206
|
readonly name: string;
|
|
168
207
|
readonly shipId?: ShipId;
|
|
169
208
|
}
|
|
209
|
+
/** The configured repositories and folders each configured harness trusts, by name (#381). */
|
|
210
|
+
export type TrustedPlaces = Readonly<Record<string, {
|
|
211
|
+
readonly repositories: readonly string[];
|
|
212
|
+
readonly folders: readonly string[];
|
|
213
|
+
}>>;
|
|
214
|
+
/**
|
|
215
|
+
* What each harness trusts now, as its own files say (#381). Init trusts a
|
|
216
|
+
* place as it adds it; the trierarch only reads: a place a harness does not
|
|
217
|
+
* trust is never offered and never crewed.
|
|
218
|
+
*/
|
|
219
|
+
export interface TrustPort {
|
|
220
|
+
trusted(): Promise<TrustedPlaces>;
|
|
221
|
+
}
|
|
170
222
|
export interface WorkspacePort {
|
|
171
223
|
/** Makes the workspace, or finds the one a stop mid-crew left half made: its folder. */
|
|
172
224
|
prepare(workspace: {
|
|
@@ -197,6 +249,45 @@ export interface LoggedAction {
|
|
|
197
249
|
/** For a failure: what happens next, and where to look. */
|
|
198
250
|
readonly next?: string;
|
|
199
251
|
}
|
|
252
|
+
/** An option as the configuration gives it: its values by name, each with its flags, and its default. */
|
|
253
|
+
export type ConfiguredOption = TrierarchConfiguration['harnesses'][string]['options'][string];
|
|
254
|
+
/** What detection found for one harness on this machine (#365). */
|
|
255
|
+
export interface DetectedHarness {
|
|
256
|
+
/** Its version, as its CLI says it. */
|
|
257
|
+
readonly version: string;
|
|
258
|
+
readonly detectedAt: Date;
|
|
259
|
+
/** When its models were last confirmed; null while none is. */
|
|
260
|
+
readonly confirmedAt: Date | null;
|
|
261
|
+
/** Its options as detected: its models, and its effort levels where its CLI has a flag for them. */
|
|
262
|
+
readonly options: Readonly<Record<string, ConfiguredOption>>;
|
|
263
|
+
/** Why detection could not find what it should, for argo, once per version; none when it found it. */
|
|
264
|
+
readonly problem?: string;
|
|
265
|
+
/** 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. */
|
|
266
|
+
readonly refused?: readonly RefusedModel[];
|
|
267
|
+
}
|
|
268
|
+
/** A model id a session refused, and when it was seen on its screen. */
|
|
269
|
+
export interface RefusedModel {
|
|
270
|
+
readonly id: string;
|
|
271
|
+
readonly at: Date;
|
|
272
|
+
}
|
|
273
|
+
/** What detection found, per harness. */
|
|
274
|
+
export type Detected = Readonly<Record<string, DetectedHarness | undefined>>;
|
|
275
|
+
/** A harness's CLI as detection asks it (#365). */
|
|
276
|
+
export interface HarnessDetector {
|
|
277
|
+
/** Its version; undefined when it does not say one, such as when it is not installed. */
|
|
278
|
+
version(): Promise<string | undefined>;
|
|
279
|
+
/** Its options at that version, given what was detected before; undefined when it gives nothing to detect. */
|
|
280
|
+
detect(at: {
|
|
281
|
+
version: string;
|
|
282
|
+
previous: DetectedHarness | undefined;
|
|
283
|
+
now: Date;
|
|
284
|
+
}): Promise<DetectedHarness | undefined>;
|
|
285
|
+
}
|
|
286
|
+
/** Where the trierarch keeps what it detected, apart from the operator's configuration. */
|
|
287
|
+
export interface DetectedStore {
|
|
288
|
+
load(): Promise<Detected>;
|
|
289
|
+
save(detected: Detected): Promise<void>;
|
|
290
|
+
}
|
|
200
291
|
export interface Logger {
|
|
201
292
|
warn(message: string): void;
|
|
202
293
|
action(logged: LoggedAction): void;
|
|
@@ -214,4 +305,6 @@ export interface TrierarchSetup {
|
|
|
214
305
|
readonly riskyFlags: Readonly<Record<string, readonly string[]>>;
|
|
215
306
|
/** The machine it runs on, by os and arch, for the trierarch plugin's labels (#102); none reports none. */
|
|
216
307
|
readonly machine?: Machine;
|
|
308
|
+
/** What detection found per harness (#365), for the version and confirmed time the report gives. */
|
|
309
|
+
readonly detected?: Detected;
|
|
217
310
|
}
|