harnery 0.45.0 → 0.45.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commander.js +0 -1
- package/dist/commands/files.d.ts +2 -2
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +4 -7
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/commands/servers.js +17 -11
- package/dist/commands/tunnel.d.ts +0 -15
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +153 -453
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +6 -45
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +0 -18
- package/dist/core/agents/live-authority-v3.d.ts +0 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +0 -11
- package/dist/core/agents/live-lifecycle-v3.d.ts +2 -4
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
- package/dist/core/agents/live-lifecycle-v3.js +7 -28
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +14 -25
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-writer.js +0 -5
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +2 -7
- package/dist/core/agents/state/proc-start.d.ts +20 -31
- package/dist/core/agents/state/proc-start.d.ts.map +1 -1
- package/dist/core/agents/state/proc-start.js +37 -70
- package/dist/core/agents/state/service-process.d.ts +61 -0
- package/dist/core/agents/state/service-process.d.ts.map +1 -0
- package/dist/core/agents/state/service-process.js +143 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +70 -180
- package/dist/core/artifacts/activity.d.ts +4 -1
- package/dist/core/artifacts/activity.d.ts.map +1 -1
- package/dist/core/artifacts/activity.js +8 -2
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
- package/dist/core/artifacts/delivery-card.js +1 -2
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +38 -12
- package/dist/core/context/index.d.ts +6 -4
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +194 -256
- package/dist/core/context/observation.d.ts +9 -9
- package/dist/core/context/observation.d.ts.map +1 -1
- package/dist/core/context/observation.js +37 -6
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +0 -29
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +0 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +0 -7
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +64 -77
- package/dist/core/events/v3/runtime-build.d.ts +14 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-build.js +44 -0
- package/dist/core/governor/index.d.ts +2 -1
- package/dist/core/governor/index.d.ts.map +1 -1
- package/dist/core/governor/index.js +2 -1
- package/dist/core/governor/service-read.d.ts +3 -10
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +10 -94
- package/dist/core/governor/service.d.ts +3 -7
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +17 -182
- package/dist/core/hooks/cli.js +78 -48
- package/dist/core/hooks/resolve/owner.js +2 -2
- package/dist/core/resources/sampler.js +2 -2
- package/dist/core/resources/service-status.d.ts +2 -14
- package/dist/core/resources/service-status.d.ts.map +1 -1
- package/dist/core/resources/service-status.js +3 -23
- package/dist/core/resources/service.d.ts +3 -7
- package/dist/core/resources/service.d.ts.map +1 -1
- package/dist/core/resources/service.js +12 -101
- package/dist/core/resources/status.d.ts.map +1 -1
- package/dist/core/resources/status.js +3 -2
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +9 -2
- package/dist/core/servers/index.d.ts +11 -10
- package/dist/core/servers/index.d.ts.map +1 -1
- package/dist/core/servers/index.js +82 -192
- package/dist/core/servers/tunnels.d.ts +3 -5
- package/dist/core/servers/tunnels.d.ts.map +1 -1
- package/dist/core/servers/tunnels.js +2 -45
- package/dist/core/storage/durable-history.js +56 -22
- package/dist/core/storage/segments.d.ts.map +1 -1
- package/dist/core/storage/segments.js +73 -17
- package/dist/core/supervisor/service.d.ts +4 -7
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +23 -122
- package/dist/core/supervisor/services.js +2 -2
- package/dist/core/supervisor/status.d.ts +3 -17
- package/dist/core/supervisor/status.d.ts.map +1 -1
- package/dist/core/supervisor/status.js +7 -70
- package/dist/core/work/state.js +7 -7
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +23 -66
- package/dist/core/workflow/index.d.ts +3 -4
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -2
- package/dist/core/workflow/live-session-v3.d.ts +0 -6
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +5 -126
- package/dist/core/workflow/proof.d.ts +4 -4
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +34 -86
- package/dist/core/workflow/resume-lock.d.ts +17 -0
- package/dist/core/workflow/resume-lock.d.ts.map +1 -0
- package/dist/core/workflow/resume-lock.js +158 -0
- package/dist/core/workflow/run-state.d.ts +0 -21
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +3 -174
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +0 -19
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +0 -13
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +0 -19
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
- package/dist/core/workflow/spawn-opencode.js +0 -14
- package/dist/core/workflow/types.d.ts +11 -54
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.d.ts +4 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +1 -1
- package/dist/core/workflow/workspaces/local-git.js +91 -210
- package/dist/core/workflow/workspaces/ownership.d.ts +0 -7
- package/dist/core/workflow/workspaces/ownership.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/ownership.js +3 -130
- package/dist/core/workflow/workspaces/reclaim.d.ts +4 -7
- package/dist/core/workflow/workspaces/reclaim.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/reclaim.js +0 -4
- package/dist/core/workflow/workspaces/recovery.d.ts +1 -1
- package/dist/core/workflow/workspaces/recovery.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/recovery.js +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +1 -4
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +0 -4
- package/dist/lib/tunnel/state.d.ts +6 -13
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +12 -58
- package/package.json +1 -6
- package/src/commander.ts +0 -10
- package/src/commands/files.ts +5 -13
- package/src/commands/servers.ts +23 -12
- package/src/commands/tunnel.ts +166 -533
- package/src/commands/workflow.ts +8 -58
- package/src/core/agents/coord-client.ts +0 -20
- package/src/core/agents/live-authority-v3.ts +0 -17
- package/src/core/agents/live-lifecycle-v3.ts +14 -52
- package/src/core/agents/state/heartbeat-writer.ts +12 -29
- package/src/core/agents/state/live-coordination-writer.ts +0 -29
- package/src/core/agents/state/pidmap.ts +2 -15
- package/src/core/agents/state/proc-start.ts +41 -69
- package/src/core/agents/state/service-process.ts +217 -0
- package/src/core/agents/state/stale-sweep.ts +82 -247
- package/src/core/artifacts/activity.ts +9 -2
- package/src/core/artifacts/delivery-card.ts +1 -7
- package/src/core/artifacts/index.ts +45 -12
- package/src/core/context/index.ts +207 -272
- package/src/core/context/observation.ts +40 -9
- package/src/core/events/v3/authority-outbox.ts +0 -56
- package/src/core/events/v3/producers/coordination-recorder.ts +0 -15
- package/src/core/events/v3/producers/recorder.ts +68 -94
- package/src/core/events/v3/runtime-build.ts +62 -0
- package/src/core/governor/index.ts +1 -2
- package/src/core/governor/service-read.ts +15 -114
- package/src/core/governor/service.ts +36 -220
- package/src/core/hooks/cli.ts +85 -47
- package/src/core/hooks/resolve/owner.ts +2 -2
- package/src/core/resources/sampler.ts +3 -2
- package/src/core/resources/service-status.ts +6 -35
- package/src/core/resources/service.ts +23 -133
- package/src/core/resources/status.ts +3 -2
- package/src/core/semantic/service.ts +8 -2
- package/src/core/servers/index.ts +86 -228
- package/src/core/servers/tunnels.ts +3 -55
- package/src/core/storage/durable-history.ts +52 -20
- package/src/core/storage/segments.ts +79 -17
- package/src/core/supervisor/service.ts +33 -155
- package/src/core/supervisor/services.ts +2 -2
- package/src/core/supervisor/status.ts +10 -85
- package/src/core/work/state.ts +7 -7
- package/src/core/workflow/engine.ts +22 -74
- package/src/core/workflow/index.ts +2 -13
- package/src/core/workflow/live-session-v3.ts +5 -146
- package/src/core/workflow/proof.ts +40 -104
- package/src/core/workflow/resume-lock.ts +179 -0
- package/src/core/workflow/run-state.ts +3 -207
- package/src/core/workflow/spawn-claude.ts +0 -18
- package/src/core/workflow/spawn-codex.ts +0 -13
- package/src/core/workflow/spawn-cursor.ts +0 -18
- package/src/core/workflow/spawn-opencode.ts +0 -14
- package/src/core/workflow/types.ts +11 -41
- package/src/core/workflow/workspaces/leases.ts +1 -1
- package/src/core/workflow/workspaces/local-git.ts +120 -239
- package/src/core/workflow/workspaces/ownership.ts +3 -158
- package/src/core/workflow/workspaces/reclaim.ts +3 -9
- package/src/core/workflow/workspaces/recovery.ts +1 -1
- package/src/core/workflow/workspaces/state.ts +1 -5
- package/src/lib/identities/assume.ts +0 -4
- package/src/lib/tunnel/state.ts +15 -70
- package/dist/commands/turn-rollback.d.ts +0 -5
- package/dist/commands/turn-rollback.d.ts.map +0 -1
- package/dist/commands/turn-rollback.js +0 -76
- package/dist/core/agents/state/process-handle.d.ts +0 -26
- package/dist/core/agents/state/process-handle.d.ts.map +0 -1
- package/dist/core/agents/state/process-handle.js +0 -121
- package/dist/core/agents/state/unchanged-file.d.ts +0 -44
- package/dist/core/agents/state/unchanged-file.d.ts.map +0 -1
- package/dist/core/agents/state/unchanged-file.js +0 -390
- package/dist/core/events/v3/generation-custody.d.ts +0 -5
- package/dist/core/events/v3/generation-custody.d.ts.map +0 -1
- package/dist/core/events/v3/generation-custody.js +0 -50
- package/dist/core/turn-rollback/content.d.ts +0 -53
- package/dist/core/turn-rollback/content.d.ts.map +0 -1
- package/dist/core/turn-rollback/content.js +0 -396
- package/dist/core/turn-rollback/index.d.ts +0 -72
- package/dist/core/turn-rollback/index.d.ts.map +0 -1
- package/dist/core/turn-rollback/index.js +0 -443
- package/dist/core/workflow/failure-evidence.d.ts +0 -16
- package/dist/core/workflow/failure-evidence.d.ts.map +0 -1
- package/dist/core/workflow/failure-evidence.js +0 -114
- package/dist/core/workflow/recovery-audit.d.ts +0 -30
- package/dist/core/workflow/recovery-audit.d.ts.map +0 -1
- package/dist/core/workflow/recovery-audit.js +0 -116
- package/src/commands/turn-rollback.ts +0 -111
- package/src/core/agents/state/process-handle.ts +0 -165
- package/src/core/agents/state/unchanged-file.ts +0 -456
- package/src/core/events/v3/generation-custody.ts +0 -59
- package/src/core/turn-rollback/content.ts +0 -499
- package/src/core/turn-rollback/index.ts +0 -580
- package/src/core/workflow/failure-evidence.ts +0 -141
- package/src/core/workflow/recovery-audit.ts +0 -181
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import { verifyProcessGeneration, } from "../agents/state/proc-start.js";
|
|
2
|
+
import { observeServiceProcess, } from "../agents/state/service-process.js";
|
|
4
3
|
import { RESOURCE_SERVICE_STATUS_SCHEMA_VERSION, } from "./contract.js";
|
|
5
4
|
import { readResourceServiceRecord, resourcePaths } from "./storage.js";
|
|
6
5
|
const STALE_HEARTBEAT_MS = 15_000;
|
|
@@ -19,12 +18,11 @@ export function readResourceServiceStatus(coordRoot, nowMs = Date.now(), depende
|
|
|
19
18
|
}
|
|
20
19
|
const heartbeatAt = Date.parse(record.heartbeat_at);
|
|
21
20
|
const stale = !Number.isFinite(heartbeatAt) || nowMs - heartbeatAt > STALE_HEARTBEAT_MS;
|
|
22
|
-
const
|
|
23
|
-
const liveness = owner.generation === "same" && record.state === "stopped" ? "stopped" : owner.liveness;
|
|
21
|
+
const { generation, liveness } = observeServiceProcess(record, dependencies);
|
|
24
22
|
return {
|
|
25
23
|
running: liveness === "running" && !stale,
|
|
26
24
|
stale,
|
|
27
|
-
generation
|
|
25
|
+
generation,
|
|
28
26
|
liveness,
|
|
29
27
|
record,
|
|
30
28
|
status_path: paths.service,
|
|
@@ -38,21 +36,3 @@ function validRecord(value) {
|
|
|
38
36
|
typeof value.host === "string" &&
|
|
39
37
|
typeof value.heartbeat_at === "string");
|
|
40
38
|
}
|
|
41
|
-
export function resourceProcessLiveness(owner, dependencies = {}) {
|
|
42
|
-
if (owner.host !== hostname())
|
|
43
|
-
return { generation: "unknown", liveness: "unknown" };
|
|
44
|
-
try {
|
|
45
|
-
(dependencies.probePid ?? ((pid) => process.kill(pid, 0)))(owner.pid);
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
return {
|
|
49
|
-
generation: "unknown",
|
|
50
|
-
liveness: error.code === "ESRCH" ? "stopped" : "unknown",
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
const generation = verifyProcessGeneration(owner.pid, owner.start_token, dependencies.readToken);
|
|
54
|
-
return {
|
|
55
|
-
generation,
|
|
56
|
-
liveness: generation === "same" ? "running" : generation === "different" ? "stopped" : "unknown",
|
|
57
|
-
};
|
|
58
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ServiceProcessDependencies, type ServiceStopFields } from "../agents/state/service-process.js";
|
|
2
2
|
import { type ResourceServiceStatus, type ResourceServiceStatusRecord } from "./contract.js";
|
|
3
3
|
import { sampleResources } from "./sampler.js";
|
|
4
|
-
import { type ResourceProcessDependencies } from "./service-status.js";
|
|
5
4
|
export declare const RESOURCE_SERVICE_DEFAULT_INTERVAL_MS = 2000;
|
|
6
5
|
export interface RunResourceServiceInput {
|
|
7
6
|
coordRoot: string;
|
|
@@ -11,10 +10,7 @@ export interface RunResourceServiceInput {
|
|
|
11
10
|
sample?: typeof sampleResources;
|
|
12
11
|
wait?: (milliseconds: number) => Promise<void>;
|
|
13
12
|
}
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
signal_verdict: ProcessGenerationVerdict;
|
|
17
|
-
}
|
|
18
|
-
export declare function requestResourceServiceStop(coordRootRaw: string, dependencies?: ResourceProcessDependencies & ProcessGenerationSignalDependencies): ResourceServiceStopResult;
|
|
13
|
+
export type ResourceServiceStopResult = ResourceServiceStatus & ServiceStopFields;
|
|
14
|
+
export declare function requestResourceServiceStop(coordRootRaw: string, dependencies?: ServiceProcessDependencies): ResourceServiceStopResult;
|
|
19
15
|
export declare function runResourceService(input: RunResourceServiceInput): Promise<ResourceServiceStatusRecord>;
|
|
20
16
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/resources/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/core/resources/service.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EAEvB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EACjC,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAI/C,eAAO,MAAM,oCAAoC,OAAQ,CAAC;AAI1D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,eAAe,CAAC;IAChC,IAAI,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAElF,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,YAAY,GAAE,0BAA+B,GAC5C,yBAAyB,CAI3B;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,2BAA2B,CAAC,CA0FtC"}
|
|
@@ -1,49 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, rmSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
1
|
+
import { existsSync, rmSync } from "node:fs";
|
|
3
2
|
import { hostname } from "node:os";
|
|
4
3
|
import { resolve } from "node:path";
|
|
5
|
-
import { processStartToken
|
|
4
|
+
import { processStartToken } from "../agents/state/proc-start.js";
|
|
5
|
+
import { acquireServiceLease, requestServiceStop, serviceStartRefusal, } from "../agents/state/service-process.js";
|
|
6
6
|
import { resolveBinName } from "../config.js";
|
|
7
7
|
import { closeProcessLoggers, legacyLogFields, processLogger } from "../storage/logger.js";
|
|
8
|
-
import { stateDirMode, stateFileMode } from "../storage/modes.js";
|
|
9
8
|
import { RESOURCE_SERVICE_STATUS_SCHEMA_VERSION, } from "./contract.js";
|
|
10
9
|
import { sampleResources } from "./sampler.js";
|
|
11
|
-
import { readResourceServiceStatus
|
|
10
|
+
import { readResourceServiceStatus } from "./service-status.js";
|
|
12
11
|
import { resourcePaths, writePrivateJsonAtomic } from "./storage.js";
|
|
13
12
|
export const RESOURCE_SERVICE_DEFAULT_INTERVAL_MS = 2_000;
|
|
14
13
|
const RESOURCE_SERVICE_MIN_INTERVAL_MS = 500;
|
|
15
14
|
const RESOURCE_SERVICE_MAX_INTERVAL_MS = 60_000;
|
|
16
15
|
export function requestResourceServiceStop(coordRootRaw, dependencies = {}) {
|
|
17
16
|
const coordRoot = resolve(coordRootRaw);
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
mkdirSync(paths.root, { recursive: true, mode: stateDirMode() });
|
|
21
|
-
writePrivateJsonAtomic(paths.stop, {
|
|
22
|
-
requested_at: new Date().toISOString(),
|
|
23
|
-
requested_by_pid: process.pid,
|
|
24
|
-
});
|
|
25
|
-
const signal = status.liveness === "running" && status.record?.host === hostname()
|
|
26
|
-
? signalIfSameGeneration(status.record.pid, status.record.start_token, "SIGTERM", dependencies)
|
|
27
|
-
: { sent: false, verdict: status.generation };
|
|
28
|
-
return {
|
|
29
|
-
...readResourceServiceStatus(coordRoot, Date.now(), dependencies),
|
|
30
|
-
signal_sent: signal.sent,
|
|
31
|
-
signal_verdict: signal.verdict,
|
|
32
|
-
};
|
|
17
|
+
const read = () => readResourceServiceStatus(coordRoot, Date.now(), dependencies);
|
|
18
|
+
return requestServiceStop(read(), read, resourcePaths(coordRoot).stop, dependencies);
|
|
33
19
|
}
|
|
34
20
|
export async function runResourceService(input) {
|
|
35
21
|
const coordRoot = resolve(input.coordRoot);
|
|
36
22
|
const current = readResourceServiceStatus(coordRoot);
|
|
37
|
-
if (current.liveness
|
|
38
|
-
throw
|
|
39
|
-
if (current.liveness === "running")
|
|
40
|
-
throw new Error(`resource observer is already running under pid ${current.record?.pid}`);
|
|
23
|
+
if (current.liveness !== "stopped")
|
|
24
|
+
throw startRefusal(current.record?.pid, current.liveness);
|
|
41
25
|
const paths = resourcePaths(coordRoot);
|
|
42
26
|
const intervalMs = normalizeInterval(input.intervalMs);
|
|
43
27
|
const now = input.now ?? (() => new Date());
|
|
44
28
|
const sample = input.sample ?? sampleResources;
|
|
45
29
|
const wait = input.wait ?? delay;
|
|
46
|
-
const lease =
|
|
30
|
+
const lease = acquireServiceLease(paths.lease, startRefusal);
|
|
47
31
|
rmSync(paths.stop, { force: true });
|
|
48
32
|
const startedAt = now().toISOString();
|
|
49
33
|
const daemonStartToken = processStartToken(process.pid);
|
|
@@ -121,86 +105,13 @@ export async function runResourceService(input) {
|
|
|
121
105
|
await closeProcessLoggers();
|
|
122
106
|
}
|
|
123
107
|
finally {
|
|
124
|
-
|
|
108
|
+
lease.release();
|
|
125
109
|
}
|
|
126
110
|
}
|
|
127
111
|
return status;
|
|
128
112
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
mkdirSync(paths.root, { recursive: true, mode: stateDirMode() });
|
|
132
|
-
for (let attempt = 0; attempt < 2; attempt++) {
|
|
133
|
-
const daemonStartToken = processStartToken(process.pid);
|
|
134
|
-
const lease = {
|
|
135
|
-
pid: process.pid,
|
|
136
|
-
...(daemonStartToken ? { start_token: daemonStartToken } : {}),
|
|
137
|
-
host: hostname(),
|
|
138
|
-
nonce: randomUUID(),
|
|
139
|
-
created_at: now.toISOString(),
|
|
140
|
-
};
|
|
141
|
-
try {
|
|
142
|
-
const fd = openSync(paths.lease, "wx", stateFileMode());
|
|
143
|
-
try {
|
|
144
|
-
writeFileSync(fd, `${JSON.stringify(lease)}\n`, "utf8");
|
|
145
|
-
}
|
|
146
|
-
finally {
|
|
147
|
-
closeSync(fd);
|
|
148
|
-
}
|
|
149
|
-
return lease;
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
if (error.code !== "EEXIST")
|
|
153
|
-
throw error;
|
|
154
|
-
const existing = readLease(paths.lease);
|
|
155
|
-
const liveness = existing ? leaseIsLive(existing) : "unknown";
|
|
156
|
-
if (liveness === "unknown")
|
|
157
|
-
throw unknownResourceOwnerError();
|
|
158
|
-
if (existing && liveness === "running") {
|
|
159
|
-
throw new Error(`resource observer lease is held by pid ${existing.pid}`);
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
unlinkSync(paths.lease);
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
// A concurrent starter may have replaced or removed the stale lease.
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
throw new Error("resource observer could not acquire its singleton lease");
|
|
170
|
-
}
|
|
171
|
-
function releaseLease(path, nonce) {
|
|
172
|
-
const current = readLease(path);
|
|
173
|
-
if (current?.nonce !== nonce)
|
|
174
|
-
return;
|
|
175
|
-
try {
|
|
176
|
-
unlinkSync(path);
|
|
177
|
-
}
|
|
178
|
-
catch {
|
|
179
|
-
// A missing lease is already released.
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
function readLease(path) {
|
|
183
|
-
try {
|
|
184
|
-
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
185
|
-
return value &&
|
|
186
|
-
Number.isSafeInteger(value.pid) &&
|
|
187
|
-
value.pid > 0 &&
|
|
188
|
-
typeof value.host === "string" &&
|
|
189
|
-
value.host.length > 0 &&
|
|
190
|
-
typeof value.nonce === "string" &&
|
|
191
|
-
value.nonce.length > 0
|
|
192
|
-
? value
|
|
193
|
-
: undefined;
|
|
194
|
-
}
|
|
195
|
-
catch {
|
|
196
|
-
return undefined;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function leaseIsLive(lease) {
|
|
200
|
-
return resourceProcessLiveness(lease).liveness;
|
|
201
|
-
}
|
|
202
|
-
function unknownResourceOwnerError() {
|
|
203
|
-
return new Error(`resource observer process identity is unknown; run ${resolveBinName()} supervisor stop to write the durable stop request before starting again`);
|
|
113
|
+
function startRefusal(pid, liveness) {
|
|
114
|
+
return serviceStartRefusal("resource observer", `${resolveBinName()} supervisor stop`, pid, liveness);
|
|
204
115
|
}
|
|
205
116
|
function log(coordRoot, event, fields, error) {
|
|
206
117
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/core/resources/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/core/resources/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC7B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EAEtB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,yBAAyB,QAAkB,CAAC;AACzD,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAGpD,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,aAAa,CAAC;IACzC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE,MAA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AE,GAAG,EAAE,MAAM,GAAG,MAAM,CA6EhF;AAaD,eAAO,MAAM,yBAAyB,QAAa,CAAC;AAEpD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,kBAAkB,CAAC;IAC/B,gBAAgB,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACjD,UAAU,EAAE,oBAAoB,CAAC;IACjC,MAAM,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,MAAM,EACjB,KAAK,SAAa,EAClB,MAAM,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,GAChC,iBAAiB,CAkFnB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { closeSync, fstatSync, openSync, readSync, statSync } from "node:fs";
|
|
2
2
|
import { unknownPressureAssessment } from "../diagnostics/advice.js";
|
|
3
3
|
import { PRESSURE_ASSESSMENT_SCHEMA_VERSION, PRESSURE_POLICY, } from "../diagnostics/contract.js";
|
|
4
|
+
import { installedHarneryBuild } from "../events/v3/runtime-build.js";
|
|
4
5
|
import { SUPERVISOR_PRESSURE_SCHEMA_VERSION, } from "../supervisor/contract.js";
|
|
5
|
-
import {
|
|
6
|
+
import { readSupervisorStatus } from "../supervisor/status.js";
|
|
6
7
|
import { supervisorPaths } from "../supervisor/storage.js";
|
|
7
8
|
import { RESOURCE_SNAPSHOT_SCHEMA_VERSION, } from "./contract.js";
|
|
8
9
|
import { resourcePaths } from "./storage.js";
|
|
@@ -313,7 +314,7 @@ function unknownWriterState() {
|
|
|
313
314
|
generation: "unknown",
|
|
314
315
|
liveness: "unknown",
|
|
315
316
|
running_build: null,
|
|
316
|
-
installed_build:
|
|
317
|
+
installed_build: installedHarneryBuild(),
|
|
317
318
|
restart_needed: true,
|
|
318
319
|
build_status: "running build unknown; restart needed",
|
|
319
320
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources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AAK,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC7D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C;AAED,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GACtC,OAAO,CAAC,qBAAqB,CAAC,CAgDhC;AAED;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAChD,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,OAAO,CAAC,iCAAiC,CAAM,GACzD,OAAO,CAAC,2BAA2B,CAAC,CAsBtC;AAED,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,qBAAqB,CAgBtF;AAED,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,6BAA6B,GACnC,OAAO,CAAC,2BAA2B,CAAC,CA8MtC;AAED,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,IAAI,CAuC5E;AAmID,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,QAAQ,GAAG,QAAQ,CAerB"}
|
|
@@ -132,13 +132,20 @@ export async function ensureSemanticServiceRunning(coordRootRaw, overrides = {})
|
|
|
132
132
|
}
|
|
133
133
|
export function requestSemanticServiceStop(coordRootRaw) {
|
|
134
134
|
const coordRoot = resolve(coordRootRaw);
|
|
135
|
+
const status = readSemanticServiceStatus(coordRoot);
|
|
135
136
|
mkdirSync(semanticPaths(coordRoot).root, { recursive: true, mode: stateDirMode() });
|
|
136
137
|
writePrivateJsonAtomic(semanticPaths(coordRoot).stop, {
|
|
137
138
|
requested_at: new Date().toISOString(),
|
|
138
139
|
requested_by_pid: process.pid,
|
|
139
140
|
});
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
if (status.running && status.record?.host === hostname()) {
|
|
142
|
+
try {
|
|
143
|
+
process.kill(status.record.pid, "SIGTERM");
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// The durable stop request remains for a racing or restarted daemon.
|
|
147
|
+
}
|
|
148
|
+
}
|
|
142
149
|
return readSemanticServiceStatus(coordRoot);
|
|
143
150
|
}
|
|
144
151
|
export async function runSemanticServiceDaemon(input) {
|
|
@@ -24,15 +24,14 @@ import { type ScanSupport } from "./net.js";
|
|
|
24
24
|
export { processStartToken, signalIfSameGeneration, verifyProcessGeneration, } from "../agents/state/proc-start.js";
|
|
25
25
|
export { acquireNoClobberLease } from "../workflow/workspaces/leases.js";
|
|
26
26
|
export { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, lsofConnectionCounts, lsofListeningSockets, parseElapsed, parseLsofListen, parseProcNetTcp, processStartedAt, psProcessInfo, readProcessInfo, scanSupport, } from "./net.js";
|
|
27
|
-
export {
|
|
28
|
-
export declare const SERVER_RECORD_SCHEMA_VERSION =
|
|
27
|
+
export { tunnelServerId, tunnelServerInput } from "./tunnels.js";
|
|
28
|
+
export declare const SERVER_RECORD_SCHEMA_VERSION = 1;
|
|
29
29
|
export declare const SERVER_DEFAULT_IDLE_HOURS = 2;
|
|
30
30
|
export declare const SERVER_DEFAULT_OWNER_STALE_HOURS = 24;
|
|
31
31
|
export type ServerKind = "service" | "session";
|
|
32
32
|
export interface ServerRecord {
|
|
33
33
|
schema_version: typeof SERVER_RECORD_SCHEMA_VERSION;
|
|
34
34
|
id: string;
|
|
35
|
-
registration_id: string;
|
|
36
35
|
kind: ServerKind;
|
|
37
36
|
/** Free-form family name: `preview`, `tunnel`, `dashboard`, ... */
|
|
38
37
|
type: string;
|
|
@@ -122,11 +121,13 @@ export declare function isValidServerId(id: string): boolean;
|
|
|
122
121
|
export declare function registerServer(input: RegisterServerInput, options?: ServerOptions): ServerRecord | null;
|
|
123
122
|
/** Best-effort registration that never throws (for server start paths). */
|
|
124
123
|
export declare function tryRegisterServer(input: RegisterServerInput, options?: ServerOptions): ServerRecord | null;
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
export declare function
|
|
124
|
+
/**
|
|
125
|
+
* Remove a server's record. With `pid`, only a record still naming that pid
|
|
126
|
+
* is removed, so a replacement that re-registered the same id survives.
|
|
127
|
+
*/
|
|
128
|
+
export declare function unregisterServer(id: string, options?: ServerOptions & {
|
|
129
|
+
pid?: number;
|
|
130
|
+
}): boolean;
|
|
130
131
|
export declare function readServer(id: string, options?: ServerOptions): ServerRecord | null;
|
|
131
132
|
/** Mark a server as used now. */
|
|
132
133
|
export declare function touchServer(id: string, options?: ServerOptions & {
|
|
@@ -187,8 +188,8 @@ export interface ServerProcessDependencies extends ProcessGenerationSignalDepend
|
|
|
187
188
|
}
|
|
188
189
|
/**
|
|
189
190
|
* Stop a verified server with SIGTERM, then SIGKILL after the grace period.
|
|
190
|
-
*
|
|
191
|
-
*
|
|
191
|
+
* Each signal, including the process group and auxiliary processes, requires
|
|
192
|
+
* a fresh generation check. Unknown or different generations retain the record.
|
|
192
193
|
*/
|
|
193
194
|
export declare function stopServer(record: ServerRecord, options?: ServerOptions & {
|
|
194
195
|
graceMs?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/servers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAI9B,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/servers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,OAAO,EACL,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAI9B,MA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