@ours.network/fleet 0.10.0-nightly.3 → 0.10.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 +138 -21
- package/dist/atomic-file.d.ts +30 -0
- package/dist/atomic-file.js +86 -0
- package/dist/briefing.d.ts +6 -0
- package/dist/briefing.js +43 -13
- package/dist/cli.js +98 -22
- package/dist/config.d.ts +24 -3
- package/dist/config.js +84 -11
- package/dist/creation.d.ts +179 -0
- package/dist/creation.js +254 -0
- package/dist/docs.d.ts +28 -1
- package/dist/docs.js +155 -8
- package/dist/doctor.js +75 -17
- package/dist/harness/claude-code.d.ts +39 -3
- package/dist/harness/claude-code.js +128 -26
- package/dist/harness/codex.d.ts +7 -1
- package/dist/harness/codex.js +58 -11
- package/dist/harness/registry.d.ts +2 -0
- package/dist/harness/registry.js +19 -0
- package/dist/harness/types.d.ts +51 -4
- package/dist/isolation/bubblewrap.js +7 -1
- package/dist/isolation/policy.d.ts +34 -5
- package/dist/isolation/policy.js +114 -7
- package/dist/isolation/resources.d.ts +6 -3
- package/dist/isolation/resources.js +6 -3
- package/dist/isolation/types.d.ts +19 -1
- package/dist/monitor.d.ts +33 -4
- package/dist/monitor.js +150 -32
- package/dist/ops.d.ts +15 -2
- package/dist/ops.js +32 -9
- package/dist/permissions.d.ts +70 -0
- package/dist/permissions.js +97 -0
- package/dist/runner.d.ts +65 -2
- package/dist/runner.js +262 -27
- package/dist/session/acp.d.ts +25 -2
- package/dist/session/acp.js +143 -26
- package/dist/session/control.d.ts +49 -1
- package/dist/session/control.js +116 -12
- package/dist/session/tmux.d.ts +9 -2
- package/dist/session/tmux.js +36 -4
- package/dist/session/types.d.ts +99 -2
- package/dist/session/types.js +42 -1
- package/dist/spawn.d.ts +27 -2
- package/dist/spawn.js +153 -15
- package/dist/supervisor/launchd.d.ts +50 -0
- package/dist/supervisor/launchd.js +121 -4
- package/dist/supervisor/none.js +22 -4
- package/dist/supervisor/systemd.d.ts +8 -1
- package/dist/supervisor/systemd.js +94 -4
- package/dist/supervisor/types.d.ts +36 -3
- package/dist/tmux.d.ts +34 -2
- package/dist/tmux.js +48 -11
- package/package.json +1 -1
package/dist/ops.js
CHANGED
|
@@ -5,6 +5,7 @@ import { agentDir, fleetDDir } from './paths.js';
|
|
|
5
5
|
import { findRole } from './config.js';
|
|
6
6
|
import { getAdapter } from './harness/registry.js';
|
|
7
7
|
import { generateBriefing } from './briefing.js';
|
|
8
|
+
import { resetRestartLedger } from './runner.js';
|
|
8
9
|
// Launch staggering now lives at the harness-launch point (the runner's start
|
|
9
10
|
// gate, driven by `start_stagger_ms`), so it covers systemd host-boot too — not
|
|
10
11
|
// just the `up`/`restart` command loop below. The old in-loop FLEET_START_STAGGER
|
|
@@ -36,6 +37,7 @@ export function applyRole(role, opts = {}) {
|
|
|
36
37
|
writeFileSync(join(dir, 'briefing.md'), generateBriefing(role, adapter.vocabulary, {
|
|
37
38
|
stateDir: dir, worklogPath: join(dir, 'WORKLOG.md'),
|
|
38
39
|
routinesPath: join(dir, 'ROUTINES.md'), briefingBody,
|
|
40
|
+
identityGuarantee: opts.identityGuarantee,
|
|
39
41
|
}));
|
|
40
42
|
if (opts.fresh)
|
|
41
43
|
for (const f of ['.booted', '.session-id', '.exit-status'])
|
|
@@ -46,32 +48,53 @@ function selectRoles(cfg, names) {
|
|
|
46
48
|
return names.length ? names.map(n => findRole(cfg, n)) : cfg.roles;
|
|
47
49
|
}
|
|
48
50
|
/** Create/start roles declaratively. Idempotent; active roles keep their context. */
|
|
49
|
-
export async function up(cfg, names, deps, configPath) {
|
|
51
|
+
export async function up(cfg, names, deps, configPath, identityGuarantee) {
|
|
52
|
+
const outcomes = [];
|
|
50
53
|
for (const role of selectRoles(cfg, names)) {
|
|
51
|
-
const dir = applyRole(role, { configPath });
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
const dir = applyRole(role, { configPath, identityGuarantee });
|
|
55
|
+
// Only a *definite* stop boots fresh so the role reads the briefing we just
|
|
56
|
+
// wrote. A running, restarting, or unprobeable role keeps its context —
|
|
57
|
+
// guessing "stopped" from an unanswered probe silently discards a live
|
|
58
|
+
// conversation.
|
|
59
|
+
// An explicit operator `up` is the sanctioned way to release a held-down
|
|
60
|
+
// role: the still-alive runner polls this file and resumes (3.2).
|
|
61
|
+
resetRestartLedger(dir);
|
|
62
|
+
const live = await deps.backend.liveness(role.name)
|
|
63
|
+
.catch(e => ({ state: 'unknown', detail: e instanceof Error ? e.message : String(e) }));
|
|
64
|
+
if (live.state === 'stopped')
|
|
55
65
|
rmSync(join(dir, '.booted'), { force: true });
|
|
56
|
-
|
|
66
|
+
else if (live.state === 'unknown')
|
|
67
|
+
deps.log(` ! ${role.name}: liveness unknown, keeping session context — ${live.detail}`);
|
|
68
|
+
// Report what each install actually did, so a creation transaction can undo
|
|
69
|
+
// only the registrations IT made (6.2). Announced immediately as well as
|
|
70
|
+
// returned: a later role in this same loop can throw, and the registrations
|
|
71
|
+
// already made must still be undoable.
|
|
72
|
+
const outcome = { ...await deps.backend.install(role.name, deps.binPath), role: role.name };
|
|
73
|
+
if (outcome.created)
|
|
74
|
+
deps.onInstalled?.(outcome);
|
|
75
|
+
outcomes.push(outcome);
|
|
57
76
|
deps.log(`↑ up: ${role.name} (harness: ${role.harness}, identity: ${role.identity}${role.cwd ? `, cwd: ${role.cwd}` : ''})`);
|
|
58
77
|
}
|
|
78
|
+
return outcomes;
|
|
59
79
|
}
|
|
60
80
|
export async function down(cfg, names, deps) {
|
|
61
81
|
for (const role of selectRoles(cfg, names)) {
|
|
82
|
+
// Never swallow the backend's reason. "maybe not running" hid real stop
|
|
83
|
+
// failures — a wedged unit, an unreachable user bus — behind a guess.
|
|
62
84
|
try {
|
|
63
85
|
await deps.backend.stop(role.name);
|
|
64
86
|
deps.log(`■ stopped ${role.name}`);
|
|
65
87
|
}
|
|
66
|
-
catch {
|
|
67
|
-
deps.log(`
|
|
88
|
+
catch (e) {
|
|
89
|
+
deps.log(` ! could not stop ${role.name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
68
90
|
}
|
|
69
91
|
}
|
|
70
92
|
}
|
|
71
93
|
/** Re-sync from config + bounce. mode 'keep' resumes context; 'fresh' wipes it. */
|
|
72
94
|
export async function restartRoles(cfg, names, deps, mode, configPath) {
|
|
73
95
|
for (const role of selectRoles(cfg, names)) {
|
|
74
|
-
applyRole(role, { fresh: mode === 'fresh', configPath });
|
|
96
|
+
const dir = applyRole(role, { fresh: mode === 'fresh', configPath });
|
|
97
|
+
resetRestartLedger(dir); // explicit restart closes the circuit
|
|
75
98
|
await deps.backend.restart(role.name);
|
|
76
99
|
deps.log(mode === 'fresh'
|
|
77
100
|
? `↻ ${role.name} — force-restarted (FRESH — context cleared, briefing reloaded)`
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { CommonPermissions, ResolvedRole } from './config.js';
|
|
2
|
+
import type { UnattendedCapability } from './harness/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The capability floor every unattended role must clear. These are not
|
|
5
|
+
* nice-to-haves: an agent that cannot read its briefing, append its worklog,
|
|
6
|
+
* bind its identity, arm its monitor, edit its workspace, or run the status
|
|
7
|
+
* commands its briefing prescribes cannot carry out the job it was spawned for
|
|
8
|
+
* — and, being unattended, will report no error while failing to.
|
|
9
|
+
*/
|
|
10
|
+
export declare const UNATTENDED_FLOOR: readonly UnattendedCapability[];
|
|
11
|
+
export interface FloorResult {
|
|
12
|
+
meets: boolean;
|
|
13
|
+
missing: UnattendedCapability[];
|
|
14
|
+
}
|
|
15
|
+
/** Which floor capabilities a set of granted capabilities fails to cover. */
|
|
16
|
+
export declare function checkUnattendedFloor(granted: readonly UnattendedCapability[]): FloorResult;
|
|
17
|
+
/**
|
|
18
|
+
* One role's neutral permissions, resolved through its harness adapter.
|
|
19
|
+
*
|
|
20
|
+
* Both `ours-fleet config` and `ours-fleet doctor` render this same object, so
|
|
21
|
+
* the two commands cannot disagree about what a configuration actually means.
|
|
22
|
+
* Before this existed, `translatePermissions()` was implemented by every
|
|
23
|
+
* adapter and called by nobody: the warnings it produced — including "this
|
|
24
|
+
* combination is not represented exactly" — were unreachable.
|
|
25
|
+
*/
|
|
26
|
+
export interface RolePermissionAnalysis {
|
|
27
|
+
role: string;
|
|
28
|
+
harness: string;
|
|
29
|
+
permissions: CommonPermissions;
|
|
30
|
+
/** Whether the harness can express neutral permissions at all. */
|
|
31
|
+
supported: boolean;
|
|
32
|
+
/** The harness's own settings, when it can. */
|
|
33
|
+
native?: Record<string, unknown>;
|
|
34
|
+
/** Whether those settings represent the neutral intent exactly. */
|
|
35
|
+
exact?: boolean;
|
|
36
|
+
/** What the native settings actually permit an unattended agent to do. */
|
|
37
|
+
capabilities?: UnattendedCapability[];
|
|
38
|
+
/** Whether those capabilities clear the unattended floor. */
|
|
39
|
+
floor?: FloorResult;
|
|
40
|
+
/**
|
|
41
|
+
* How hard a floor shortfall is. A role that auto-denies (`unattended: deny`)
|
|
42
|
+
* silently does less than asked, so that is a failure; one that waits can at
|
|
43
|
+
* least be rescued by a human attaching a console, so that is a warning.
|
|
44
|
+
*/
|
|
45
|
+
floorSeverity?: 'fail' | 'warn';
|
|
46
|
+
/** Native settings that contradict the neutral block; empty when they agree. */
|
|
47
|
+
conflicts?: PermissionConflict[];
|
|
48
|
+
/** A role-named line when the floor is not met; absent when it is. */
|
|
49
|
+
floorWarning?: string;
|
|
50
|
+
/** Role-named translation warnings, ready to print verbatim by any command. */
|
|
51
|
+
warnings: string[];
|
|
52
|
+
}
|
|
53
|
+
export interface PermissionConflict {
|
|
54
|
+
/** The native setting both sources speak to, e.g. `permission_mode`. */
|
|
55
|
+
key: string;
|
|
56
|
+
/** What the neutral `permissions:` block translates to. */
|
|
57
|
+
fromNeutral: string;
|
|
58
|
+
/** What `harness_options` states directly. */
|
|
59
|
+
fromNative: string;
|
|
60
|
+
/** The role-named line commands print. */
|
|
61
|
+
warning: string;
|
|
62
|
+
}
|
|
63
|
+
/** Resolve one role's permissions through its adapter. Never throws. */
|
|
64
|
+
export declare function analyzeRolePermissions(role: ResolvedRole): RolePermissionAnalysis;
|
|
65
|
+
/** Every line a command should show for a role: translation, conflicts, floor. */
|
|
66
|
+
export declare function allWarnings(a: RolePermissionAnalysis): string[];
|
|
67
|
+
/** Resolve every role's permissions, in config order. */
|
|
68
|
+
export declare function analyzeFleetPermissions(roles: ResolvedRole[]): RolePermissionAnalysis[];
|
|
69
|
+
/** Render an analysis's native settings compactly, for one-line reporting. */
|
|
70
|
+
export declare function formatNative(native: Record<string, unknown> | undefined): string;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getAdapter } from './harness/registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* The capability floor every unattended role must clear. These are not
|
|
4
|
+
* nice-to-haves: an agent that cannot read its briefing, append its worklog,
|
|
5
|
+
* bind its identity, arm its monitor, edit its workspace, or run the status
|
|
6
|
+
* commands its briefing prescribes cannot carry out the job it was spawned for
|
|
7
|
+
* — and, being unattended, will report no error while failing to.
|
|
8
|
+
*/
|
|
9
|
+
export const UNATTENDED_FLOOR = [
|
|
10
|
+
'read-state', 'write-state', 'messaging', 'monitor', 'workspace-edit', 'status-commands',
|
|
11
|
+
];
|
|
12
|
+
/** Which floor capabilities a set of granted capabilities fails to cover. */
|
|
13
|
+
export function checkUnattendedFloor(granted) {
|
|
14
|
+
const missing = UNATTENDED_FLOOR.filter(c => !granted.includes(c));
|
|
15
|
+
return { meets: missing.length === 0, missing };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Find native settings that contradict the neutral block. Only fires when the
|
|
19
|
+
* operator wrote BOTH — a role that states its intent once, neutrally or
|
|
20
|
+
* natively, has nothing to contradict and stays quiet. `harness_options` wins
|
|
21
|
+
* at launch, which is precisely why a silent disagreement is dangerous: the
|
|
22
|
+
* neutral block reads like the source of truth and is not.
|
|
23
|
+
*/
|
|
24
|
+
function findConflicts(role, fromNeutral, fromNative) {
|
|
25
|
+
if (!role.permissionsDeclared)
|
|
26
|
+
return [];
|
|
27
|
+
const conflicts = [];
|
|
28
|
+
for (const [key, nativeValue] of Object.entries(fromNative)) {
|
|
29
|
+
const neutralValue = fromNeutral[key];
|
|
30
|
+
if (neutralValue === undefined || String(neutralValue) === String(nativeValue))
|
|
31
|
+
continue;
|
|
32
|
+
conflicts.push({
|
|
33
|
+
key,
|
|
34
|
+
fromNeutral: String(neutralValue),
|
|
35
|
+
fromNative: String(nativeValue),
|
|
36
|
+
warning: `role '${role.name}': harness_options.${key}=${String(nativeValue)} contradicts the `
|
|
37
|
+
+ `permissions block, which translates to ${key}=${String(neutralValue)} — `
|
|
38
|
+
+ `harness_options.${key}=${String(nativeValue)} wins`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return conflicts;
|
|
42
|
+
}
|
|
43
|
+
/** Resolve one role's permissions through its adapter. Never throws. */
|
|
44
|
+
export function analyzeRolePermissions(role) {
|
|
45
|
+
const base = { role: role.name, harness: role.harness, permissions: role.permissions };
|
|
46
|
+
let adapter;
|
|
47
|
+
try {
|
|
48
|
+
adapter = getAdapter(role.harness);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
return { ...base, supported: false, warnings: [`role '${role.name}': ${e.message}`] };
|
|
52
|
+
}
|
|
53
|
+
const translation = adapter.translatePermissions(role.permissions);
|
|
54
|
+
if (!translation.supported) {
|
|
55
|
+
return {
|
|
56
|
+
...base, supported: false,
|
|
57
|
+
warnings: [`role '${role.name}': harness '${role.harness}' cannot express neutral ` +
|
|
58
|
+
`permissions — ${translation.reason}`],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const conflicts = findConflicts(role, translation.native, adapter.nativePermissionOverrides(role.harness_options));
|
|
62
|
+
const floor = checkUnattendedFloor(translation.capabilities);
|
|
63
|
+
const floorSeverity = role.permissions.unattended === 'deny' ? 'fail' : 'warn';
|
|
64
|
+
return {
|
|
65
|
+
...base,
|
|
66
|
+
supported: true,
|
|
67
|
+
native: translation.native,
|
|
68
|
+
exact: translation.exact,
|
|
69
|
+
capabilities: translation.capabilities,
|
|
70
|
+
floor,
|
|
71
|
+
floorSeverity,
|
|
72
|
+
conflicts,
|
|
73
|
+
floorWarning: floor.meets ? undefined : (`role '${role.name}': resolved ${role.harness} permissions do not meet the unattended ` +
|
|
74
|
+
`capability floor — missing ${floor.missing.join(', ')} ` +
|
|
75
|
+
`(${formatNative(translation.native)}; unattended=${role.permissions.unattended} means these ` +
|
|
76
|
+
`requests will ${role.permissions.unattended === 'deny' ? 'be denied silently' : 'block the turn'})`),
|
|
77
|
+
warnings: translation.warnings.map(w => `role '${role.name}': ${w}`),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/** Every line a command should show for a role: translation, conflicts, floor. */
|
|
81
|
+
export function allWarnings(a) {
|
|
82
|
+
return [
|
|
83
|
+
...a.warnings,
|
|
84
|
+
...(a.conflicts ?? []).map(c => c.warning),
|
|
85
|
+
...(a.floorWarning ? [a.floorWarning] : []),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
/** Resolve every role's permissions, in config order. */
|
|
89
|
+
export function analyzeFleetPermissions(roles) {
|
|
90
|
+
return roles.map(analyzeRolePermissions);
|
|
91
|
+
}
|
|
92
|
+
/** Render an analysis's native settings compactly, for one-line reporting. */
|
|
93
|
+
export function formatNative(native) {
|
|
94
|
+
if (!native || !Object.keys(native).length)
|
|
95
|
+
return '(none)';
|
|
96
|
+
return Object.entries(native).map(([k, v]) => `${k}=${String(v)}`).join(' ');
|
|
97
|
+
}
|
package/dist/runner.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Launch } from './harness/types.js';
|
|
|
3
3
|
import { Tmux } from './tmux.js';
|
|
4
4
|
import { type MonitorHandle, type MonitorOpts, type FetchLike } from './monitor.js';
|
|
5
5
|
import { type Exec } from './exec.js';
|
|
6
|
+
import type { ExitRecord } from './session/types.js';
|
|
6
7
|
export interface RunnerDeps {
|
|
7
8
|
tmux: Tmux;
|
|
8
9
|
exec: Exec;
|
|
@@ -15,6 +16,8 @@ export interface RunnerDeps {
|
|
|
15
16
|
fetch: FetchLike;
|
|
16
17
|
/** Construct the supervisor mail monitor (injectable so tests stub it out). */
|
|
17
18
|
createMonitor(opts: MonitorOpts): MonitorHandle;
|
|
19
|
+
/** Lets a test (or a shutdown path) end the supervised restart loop. */
|
|
20
|
+
shouldStop?(): boolean;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Compose the tmux pane shell command: env prefix + argv + exit-status capture.
|
|
@@ -24,6 +27,41 @@ export interface RunnerDeps {
|
|
|
24
27
|
* still sees the real exit code.
|
|
25
28
|
*/
|
|
26
29
|
export declare function buildPaneCommand(launch: Launch, roleEnv: Record<string, string> | undefined, exitStatusPath: string, paneArgv?: string[]): string;
|
|
30
|
+
/**
|
|
31
|
+
* Read the pane's `.exit-status`. Three shapes are accepted: the structured
|
|
32
|
+
* record written above, a bare number left by a pre-upgrade pane (so an
|
|
33
|
+
* in-place upgrade does not misread a real exit), and anything else — which is
|
|
34
|
+
* `unknown`, never an invented failure. A missing file returns null so the
|
|
35
|
+
* caller can distinguish "no record" from "a record saying unknown".
|
|
36
|
+
*/
|
|
37
|
+
export declare function readExitRecord(path: string): ExitRecord | null;
|
|
38
|
+
export declare const RESTART_LEDGER_FILE = ".restart-ledger.json";
|
|
39
|
+
/** Consecutive immediate failures tolerated before the agent is held down. */
|
|
40
|
+
export declare const RESTART_FAIL_THRESHOLD = 5;
|
|
41
|
+
export interface RestartLedger {
|
|
42
|
+
version: 1;
|
|
43
|
+
consecutiveImmediateFailures: number;
|
|
44
|
+
lastReason: string;
|
|
45
|
+
nextDelayMs: number;
|
|
46
|
+
/** Whether this failure sequence has already thrown away resume state. */
|
|
47
|
+
resumeDiscarded: boolean;
|
|
48
|
+
circuit: 'closed' | 'open';
|
|
49
|
+
updatedAt: string;
|
|
50
|
+
/** When the circuit opened, for the held-down status line. */
|
|
51
|
+
openedAt?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Bounded exponential backoff for the nth consecutive immediate failure. */
|
|
54
|
+
export declare function backoffFor(consecutiveFailures: number): number;
|
|
55
|
+
/** Read a role's restart ledger; a missing or corrupt one starts clean. */
|
|
56
|
+
export declare function readRestartLedger(dir: string): RestartLedger;
|
|
57
|
+
export declare function writeRestartLedger(dir: string, ledger: RestartLedger): void;
|
|
58
|
+
/**
|
|
59
|
+
* Close the circuit and forget the failure streak. Called by an explicit
|
|
60
|
+
* operator `up`/`restart`, which is the only thing that may release a held-down
|
|
61
|
+
* role — a held-down runner polls this file, so a role can be released without
|
|
62
|
+
* bouncing its unit.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resetRestartLedger(dir: string): void;
|
|
27
65
|
/** Filename spawnTemp writes into a temp agent dir to carry the fleet start-stagger. */
|
|
28
66
|
export declare const START_STAGGER_FILE = ".start-stagger-ms";
|
|
29
67
|
/**
|
|
@@ -37,10 +75,35 @@ export declare const START_STAGGER_FILE = ".start-stagger-ms";
|
|
|
37
75
|
export declare function reserveLaunchSlot(root: string, staggerMs: number, deps: Pick<RunnerDeps, 'now' | 'sleep' | 'log'>): Promise<number>;
|
|
38
76
|
/** Read a temp role's config snapshot written by spawnTemp. */
|
|
39
77
|
export declare function loadTempRole(name: string): ResolvedRole;
|
|
40
|
-
/**
|
|
78
|
+
/** What one child session did, so the supervising loop can decide what follows. */
|
|
79
|
+
export interface AttemptResult {
|
|
80
|
+
elapsedSecs: number;
|
|
81
|
+
exit: ExitRecord;
|
|
82
|
+
/** Whether this attempt threw away resume state to start fresh. */
|
|
83
|
+
rotated: boolean;
|
|
84
|
+
mode: 'fresh' | 'resume';
|
|
85
|
+
}
|
|
86
|
+
/** One session lifecycle. `runSupervised` (or a one-shot caller) drives it. */
|
|
41
87
|
export declare function runOnce(name: string, opts?: {
|
|
42
88
|
temp?: boolean;
|
|
43
89
|
configPath?: string;
|
|
44
|
-
|
|
90
|
+
allowResumeRotation?: boolean;
|
|
91
|
+
}, partialDeps?: Partial<RunnerDeps>): Promise<AttemptResult>;
|
|
92
|
+
/**
|
|
93
|
+
* The persistent supervisor for one permanent role: run child sessions in a
|
|
94
|
+
* loop, count consecutive immediate failures across them, back off between
|
|
95
|
+
* attempts, and after `RESTART_FAIL_THRESHOLD` hold the agent down while
|
|
96
|
+
* staying alive — so the service manager has nothing to restart and cannot
|
|
97
|
+
* resume the two-second loop behind our back.
|
|
98
|
+
*
|
|
99
|
+
* `attempt` is injectable so the policy can be tested against a fake clock and
|
|
100
|
+
* fake child instead of real sessions.
|
|
101
|
+
*/
|
|
102
|
+
export declare function runSupervised(name: string, opts?: {
|
|
103
|
+
configPath?: string;
|
|
104
|
+
}, partialDeps?: Partial<RunnerDeps>, attempt?: (n: string, o: {
|
|
105
|
+
configPath?: string;
|
|
106
|
+
allowResumeRotation?: boolean;
|
|
107
|
+
}, d: Partial<RunnerDeps>) => Promise<AttemptResult>): Promise<RestartLedger>;
|
|
45
108
|
/** Temp-agent entrypoint: run one session, then remove the temp dir. */
|
|
46
109
|
export declare function runTemp(name: string, deps?: Partial<RunnerDeps>): Promise<void>;
|