@dorokuma/herdsman 0.12.1 → 0.13.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.
Files changed (61) hide show
  1. package/README.md +6 -13
  2. package/dist/src/cli/herdsman.d.ts +14 -1
  3. package/dist/src/cli/herdsman.d.ts.map +1 -1
  4. package/dist/src/cli/herdsman.js +49 -65
  5. package/dist/src/cli/herdsman.js.map +1 -1
  6. package/dist/src/daemon/agent-event-reconciler.d.ts.map +1 -1
  7. package/dist/src/daemon/agent-event-reconciler.js +53 -2
  8. package/dist/src/daemon/agent-event-reconciler.js.map +1 -1
  9. package/dist/src/daemon/herdr-session-watch-manager.d.ts +13 -1
  10. package/dist/src/daemon/herdr-session-watch-manager.d.ts.map +1 -1
  11. package/dist/src/daemon/herdr-session-watch-manager.js +52 -16
  12. package/dist/src/daemon/herdr-session-watch-manager.js.map +1 -1
  13. package/dist/src/daemon/observability-server.d.ts.map +1 -1
  14. package/dist/src/daemon/observability-server.js +16 -1
  15. package/dist/src/daemon/observability-server.js.map +1 -1
  16. package/dist/src/daemon/process-manager.d.ts +50 -49
  17. package/dist/src/daemon/process-manager.d.ts.map +1 -1
  18. package/dist/src/daemon/process-manager.js +246 -204
  19. package/dist/src/daemon/process-manager.js.map +1 -1
  20. package/dist/src/daemon/service-supervision.d.ts +68 -0
  21. package/dist/src/daemon/service-supervision.d.ts.map +1 -0
  22. package/dist/src/daemon/service-supervision.js +127 -0
  23. package/dist/src/daemon/service-supervision.js.map +1 -0
  24. package/dist/src/daemon/service.d.ts +35 -0
  25. package/dist/src/daemon/service.d.ts.map +1 -1
  26. package/dist/src/daemon/service.js +185 -27
  27. package/dist/src/daemon/service.js.map +1 -1
  28. package/dist/src/db/agent-events.d.ts +15 -0
  29. package/dist/src/db/agent-events.d.ts.map +1 -1
  30. package/dist/src/db/agent-events.js +180 -54
  31. package/dist/src/db/agent-events.js.map +1 -1
  32. package/dist/src/db/agents.js +1 -1
  33. package/dist/src/db/agents.js.map +1 -1
  34. package/dist/src/db/status-event-plans.d.ts +1 -1
  35. package/dist/src/db/status-event-plans.d.ts.map +1 -1
  36. package/dist/src/db/status-event-plans.js +5 -4
  37. package/dist/src/db/status-event-plans.js.map +1 -1
  38. package/dist/src/herdr/session-list.d.ts +11 -0
  39. package/dist/src/herdr/session-list.d.ts.map +1 -1
  40. package/dist/src/herdr/session-list.js +13 -0
  41. package/dist/src/herdr/session-list.js.map +1 -1
  42. package/dist/src/herdr/socket-client.d.ts +8 -0
  43. package/dist/src/herdr/socket-client.d.ts.map +1 -1
  44. package/dist/src/herdr/socket-client.js +43 -0
  45. package/dist/src/herdr/socket-client.js.map +1 -1
  46. package/dist/src/observability/agent-index-service.d.ts +15 -0
  47. package/dist/src/observability/agent-index-service.d.ts.map +1 -1
  48. package/dist/src/observability/agent-index-service.js +499 -135
  49. package/dist/src/observability/agent-index-service.js.map +1 -1
  50. package/dist/src/observability/agent-orchestrator-service.d.ts.map +1 -1
  51. package/dist/src/observability/agent-orchestrator-service.js +5 -1
  52. package/dist/src/observability/agent-orchestrator-service.js.map +1 -1
  53. package/dist/src/observability/contracts.d.ts +1 -0
  54. package/dist/src/observability/contracts.d.ts.map +1 -1
  55. package/dist/src/observability/contracts.js +8 -0
  56. package/dist/src/observability/contracts.js.map +1 -1
  57. package/drizzle/0010_legacy_degraded_cleanup.sql +1 -0
  58. package/drizzle/meta/0010_snapshot.json +975 -0
  59. package/drizzle/meta/_journal.json +7 -0
  60. package/package.json +3 -6
  61. package/README.ja.md +0 -153
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Read-only supervision facts for `herdsman daemon status`.
3
+ *
4
+ * These answer "who supervises this daemon, and how many times has it
5
+ * restarted?" without touching any lifecycle behaviour: nothing here starts,
6
+ * stops, restarts or locks the daemon. Every probe is best-effort, so a
7
+ * missing `systemctl`, a denied `/proc` read or a wedged system manager
8
+ * degrades the answer instead of failing `daemon status`.
9
+ *
10
+ * Diagnostic path only: `readSystemdRestartCount` runs a *synchronous* command
11
+ * (`spawnSync`), which blocks the event loop for up to the probe timeout.
12
+ * These probes belong to `daemon status`; daemon lifecycle code must never call
13
+ * them.
14
+ */
15
+ /** The systemd unit that supervises the production daemon (see AGENTS.md). */
16
+ export declare const HERDSMAN_SYSTEMD_UNIT = "herdsman.service";
17
+ /**
18
+ * Short, fixed timeout for the best-effort `systemctl` probe. `daemon status`
19
+ * is a diagnostic command, so it must never hang behind a wedged or unavailable
20
+ * system manager; 1.5s is far above a healthy `systemctl show` (single-digit
21
+ * ms) yet small enough to stay imperceptible when the manager is stuck.
22
+ */
23
+ export declare const SUPERVISION_PROBE_TIMEOUT_MS = 1500;
24
+ /**
25
+ * Who supervises the running daemon:
26
+ * - `systemd:<unit>` — the daemon pid lives in that unit's cgroup inside the
27
+ * *system* slice, i.e. systemd's system manager owns it;
28
+ * - `unmanaged` — the cgroup was readable and named something, but the pid is
29
+ * not supervised by `herdsman.service`. That is all it says: it is **not** a
30
+ * claim that nothing else supervises the process, and it is not a licence to
31
+ * kill it;
32
+ * - `unknown` — no fact was available: the cgroup could not be read, or it read
33
+ * back empty/blank. "Nothing was read" is not the same as "not managed by
34
+ * that unit", so it must not be downgraded to `unmanaged`.
35
+ *
36
+ * When no daemon pid is known, this fact is not reported at all instead of
37
+ * being set to `unknown` (see `DaemonStatusFacts` in `process-manager.ts`).
38
+ */
39
+ export type DaemonManagedBy = "unmanaged" | "unknown" | `systemd:${string}`;
40
+ /**
41
+ * Maps the content of `/proc/<pid>/cgroup` to a supervision fact. Pure, so it
42
+ * can be exercised with fabricated cgroup text. Handles both layouts:
43
+ * cgroup v2 `0::/system.slice/herdsman.service` and cgroup v1
44
+ * `1:name=systemd:/system.slice/herdsman.service`.
45
+ */
46
+ export declare function managedByFromCgroup(cgroup: string, unit?: string): DaemonManagedBy;
47
+ /** Reads `/proc/<pid>/cgroup`; undefined when procfs is absent or unreadable. */
48
+ export declare function readProcessCgroup(pid: number): string | undefined;
49
+ /** Injectable command runner so tests can supply fake `systemctl` behaviour. */
50
+ export type SystemctlRunner = (command: string, args: string[], timeoutMs: number) => string | undefined;
51
+ /**
52
+ * Best-effort `systemctl show <unit> -p NRestarts --value`. Returns undefined on
53
+ * any failure (command missing, permission denied, timeout, non-zero exit,
54
+ * unparsable output) and never throws, so the caller can omit the field.
55
+ *
56
+ * How to read the number: it is systemd's `NRestarts` for the *unit*, and
57
+ * `systemctl reset-failed`, a `systemctl stop` + `start` pair, or a unit that
58
+ * is not currently loaded all reset it to 0. So `0` means "systemd has not
59
+ * restarted this unit since it last loaded it", never "this daemon has never
60
+ * crashed".
61
+ */
62
+ export declare function readSystemdRestartCount(options?: {
63
+ command?: string;
64
+ runner?: SystemctlRunner;
65
+ timeoutMs?: number;
66
+ unit?: string;
67
+ }): number | undefined;
68
+ //# sourceMappingURL=service-supervision.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-supervision.d.ts","sourceRoot":"","sources":["../../../src/daemon/service-supervision.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,OAAO,CAAC;AAEjD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,MAAM,EAAE,CAAC;AAe5E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAA8B,GACnC,eAAe,CAkBjB;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMjE;AAED,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,MAAM,KACd,MAAM,GAAG,SAAS,CAAC;AAgCxB;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,MAAM,GAAG,SAAS,CAgBrB"}
@@ -0,0 +1,127 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { readFileSync } from "node:fs";
3
+ /**
4
+ * Read-only supervision facts for `herdsman daemon status`.
5
+ *
6
+ * These answer "who supervises this daemon, and how many times has it
7
+ * restarted?" without touching any lifecycle behaviour: nothing here starts,
8
+ * stops, restarts or locks the daemon. Every probe is best-effort, so a
9
+ * missing `systemctl`, a denied `/proc` read or a wedged system manager
10
+ * degrades the answer instead of failing `daemon status`.
11
+ *
12
+ * Diagnostic path only: `readSystemdRestartCount` runs a *synchronous* command
13
+ * (`spawnSync`), which blocks the event loop for up to the probe timeout.
14
+ * These probes belong to `daemon status`; daemon lifecycle code must never call
15
+ * them.
16
+ */
17
+ /** The systemd unit that supervises the production daemon (see AGENTS.md). */
18
+ export const HERDSMAN_SYSTEMD_UNIT = "herdsman.service";
19
+ /**
20
+ * Short, fixed timeout for the best-effort `systemctl` probe. `daemon status`
21
+ * is a diagnostic command, so it must never hang behind a wedged or unavailable
22
+ * system manager; 1.5s is far above a healthy `systemctl show` (single-digit
23
+ * ms) yet small enough to stay imperceptible when the manager is stuck.
24
+ */
25
+ export const SUPERVISION_PROBE_TIMEOUT_MS = 1500;
26
+ /** Prefix of the system manager's cgroup subtree, identical in cgroup v1 and v2. */
27
+ const SYSTEM_SLICE_PREFIX = "/system.slice/";
28
+ /**
29
+ * True when `path` is the unit's own cgroup or a nested cgroup inside it. The
30
+ * comparison is on the full path (not the basename) with a trailing-slash guard
31
+ * so `herdsman.service.dev` is not mistaken for the unit itself.
32
+ */
33
+ function isSystemUnitCgroupPath(path, unit) {
34
+ const unitPath = `${SYSTEM_SLICE_PREFIX}${unit}`;
35
+ return path === unitPath || path.startsWith(`${unitPath}/`);
36
+ }
37
+ /**
38
+ * Maps the content of `/proc/<pid>/cgroup` to a supervision fact. Pure, so it
39
+ * can be exercised with fabricated cgroup text. Handles both layouts:
40
+ * cgroup v2 `0::/system.slice/herdsman.service` and cgroup v1
41
+ * `1:name=systemd:/system.slice/herdsman.service`.
42
+ */
43
+ export function managedByFromCgroup(cgroup, unit = HERDSMAN_SYSTEMD_UNIT) {
44
+ let sawContent = false;
45
+ for (const line of cgroup.split("\n")) {
46
+ const trimmed = line.trim();
47
+ if (trimmed === "")
48
+ continue;
49
+ sawContent = true;
50
+ const path = trimmed.slice(trimmed.lastIndexOf(":") + 1);
51
+ // The path must be the unit's own cgroup *and* live in the system slice.
52
+ // The slice check is not cosmetic: a user-session unit of the same name
53
+ // (`/user.slice/user-1000.slice/user@1000.service/app.slice/herdsman.service`)
54
+ // ends in the very same basename, so a basename-only match reported it as
55
+ // `systemd:herdsman.service` — the exact same string as the system unit —
56
+ // and an operator following that would `systemctl restart` the wrong unit.
57
+ if (isSystemUnitCgroupPath(path, unit))
58
+ return `systemd:${unit}`;
59
+ }
60
+ // Blank/empty content means the read produced no fact at all, which is
61
+ // `unknown`, not "not managed by that unit".
62
+ return sawContent ? "unmanaged" : "unknown";
63
+ }
64
+ /** Reads `/proc/<pid>/cgroup`; undefined when procfs is absent or unreadable. */
65
+ export function readProcessCgroup(pid) {
66
+ try {
67
+ return readFileSync(`/proc/${pid}/cgroup`, "utf8");
68
+ }
69
+ catch {
70
+ return undefined;
71
+ }
72
+ }
73
+ /**
74
+ * Default runner: bounded `spawnSync` that never throws. On spawn error, a
75
+ * non-zero exit (including a timeout kill) or a missing stdout it reports
76
+ * `undefined`, i.e. "no fact available".
77
+ *
78
+ * `killSignal: "SIGKILL"` is what makes `timeout` a hard bound. The default is
79
+ * SIGTERM, which a child may simply ignore — and an ignoring child then keeps
80
+ * this *synchronous* call parked for its whole lifetime, so `daemon status`
81
+ * hangs behind it (measured on this machine with a `trap '' TERM; exec sleep 8`
82
+ * shim and `timeoutMs: 300`: 8003ms with the default signal, 301ms with
83
+ * SIGKILL). SIGKILL cannot be ignored, and `systemctl show` is a read-only
84
+ * client with nothing to clean up, so killing it hard is safe. Same lesson as
85
+ * the `execFile` timeout in `src/herdr/session-list.ts`.
86
+ *
87
+ * Diagnostic path only: this blocks the event loop for up to `timeoutMs`.
88
+ */
89
+ function defaultSystemctlRunner(command, args, timeoutMs) {
90
+ const result = spawnSync(command, args, {
91
+ encoding: "utf8",
92
+ killSignal: "SIGKILL",
93
+ timeout: timeoutMs,
94
+ });
95
+ if (result.error || result.status !== 0)
96
+ return undefined;
97
+ return typeof result.stdout === "string" ? result.stdout : undefined;
98
+ }
99
+ /**
100
+ * Best-effort `systemctl show <unit> -p NRestarts --value`. Returns undefined on
101
+ * any failure (command missing, permission denied, timeout, non-zero exit,
102
+ * unparsable output) and never throws, so the caller can omit the field.
103
+ *
104
+ * How to read the number: it is systemd's `NRestarts` for the *unit*, and
105
+ * `systemctl reset-failed`, a `systemctl stop` + `start` pair, or a unit that
106
+ * is not currently loaded all reset it to 0. So `0` means "systemd has not
107
+ * restarted this unit since it last loaded it", never "this daemon has never
108
+ * crashed".
109
+ */
110
+ export function readSystemdRestartCount(options) {
111
+ const unit = options?.unit ?? HERDSMAN_SYSTEMD_UNIT;
112
+ const command = options?.command ?? "systemctl";
113
+ const timeoutMs = options?.timeoutMs ?? SUPERVISION_PROBE_TIMEOUT_MS;
114
+ const runner = options?.runner ?? defaultSystemctlRunner;
115
+ let stdout;
116
+ try {
117
+ stdout = runner(command, ["show", unit, "-p", "NRestarts", "--value"], timeoutMs);
118
+ }
119
+ catch {
120
+ return undefined;
121
+ }
122
+ if (stdout === undefined)
123
+ return undefined;
124
+ const value = Number(stdout.trim());
125
+ return Number.isInteger(value) && value >= 0 ? value : undefined;
126
+ }
127
+ //# sourceMappingURL=service-supervision.js.map
@@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I,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAE3C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC"}
@@ -1,3 +1,5 @@
1
+ import { applyMigrations } from "../db/apply-migrations.js";
2
+ import { openSqlite } from "../db/client.js";
1
3
  import { type HerdrSessionListRunner } from "../herdr/session-list.js";
2
4
  /**
3
5
  * Periodic reconcile cadence. The 7-day (settled events) and 30-day (released
@@ -9,6 +11,36 @@ import { type HerdrSessionListRunner } from "../herdr/session-list.js";
9
11
  * per-tick socket traffic.
10
12
  */
11
13
  export declare const RECONCILE_INTERVAL_MS: number;
14
+ /**
15
+ * Ceiling for the whole shutdown sequence. It must stay clearly below the unit's
16
+ * TimeoutStopSec (10s in /etc/systemd/system/herdsman.service): a shutdown that
17
+ * outlives it is SIGKILLed, which skips the finally cleanup (instance lock, pid
18
+ * file, helper child) and leaves the daemon half-stopped. Every step is bounded
19
+ * by whatever budget is left, so a single wedged step cannot run the sequence
20
+ * past this ceiling.
21
+ */
22
+ export declare const SHUTDOWN_BUDGET_MS = 5000;
23
+ /**
24
+ * Floor granted to a step once the budget is spent. The sequence may therefore
25
+ * overshoot the budget by at most (steps - 1) * SHUTDOWN_MIN_STEP_MS, which still
26
+ * leaves several seconds of headroom under TimeoutStopSec; in exchange no step is
27
+ * skipped outright, so the pid file and socket are always cleaned up.
28
+ */
29
+ export declare const SHUTDOWN_MIN_STEP_MS = 250;
30
+ export type ShutdownStep = {
31
+ name: string;
32
+ run: () => Promise<unknown> | unknown;
33
+ };
34
+ /**
35
+ * Runs shutdown steps in order under one shared budget. Each step is raced
36
+ * against the time left: a step that overruns is logged and abandoned so the
37
+ * next step (and the caller's finally cleanup) still runs. Failures that are not
38
+ * timeouts are not swallowed — they reject the sequence as before, so a genuine
39
+ * shutdown error still surfaces instead of hiding behind the budget.
40
+ */
41
+ export declare function runShutdownSteps(steps: readonly ShutdownStep[], options?: {
42
+ budgetMs?: number;
43
+ }): Promise<void>;
12
44
  type ReconcileRun = () => Promise<unknown>;
13
45
  type IntervalHandle = ReturnType<typeof setInterval>;
14
46
  /**
@@ -33,14 +65,17 @@ export declare class PeriodicReconcileScheduler {
33
65
  stop(): Promise<void>;
34
66
  }
35
67
  export declare function runObservabilityDaemonService(input?: {
68
+ applyMigrations?: typeof applyMigrations;
36
69
  connectSocket?: (socketPath: string) => Promise<boolean>;
37
70
  environment?: NodeJS.ProcessEnv | undefined;
38
71
  exit?: (code?: number) => void;
72
+ openSqlite?: typeof openSqlite;
39
73
  pid?: number;
40
74
  reconcileClearInterval?: (handle: ReturnType<typeof setInterval>) => void;
41
75
  reconcileIntervalMs?: number;
42
76
  reconcileSetInterval?: (callback: () => void, delay: number) => ReturnType<typeof setInterval>;
43
77
  sessionList?: HerdrSessionListRunner;
78
+ shutdownBudgetMs?: number;
44
79
  signalTarget?: {
45
80
  off?: (event: "SIGINT" | "SIGTERM", listener: () => void | Promise<void>) => void;
46
81
  once: (event: "SIGINT" | "SIGTERM", listener: () => void | Promise<void>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/daemon/service.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAgC,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AASpG;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,QAAiB,CAAC;AAEpD,KAAK,YAAY,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAC3C,KAAK,cAAc,GAAG,UAAU,CAAC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uB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAahE"}
@@ -1,4 +1,4 @@
1
- import { chmodSync, existsSync, mkdirSync } from "node:fs";
1
+ import { chmodSync, existsSync, mkdirSync, rmSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { env, exit } from "node:process";
4
4
  import { fileURLToPath } from "node:url";
@@ -33,6 +33,78 @@ import { ObservabilityRpcServer } from "./observability-server.js";
33
33
  * per-tick socket traffic.
34
34
  */
35
35
  export const RECONCILE_INTERVAL_MS = 15 * 60 * 1000;
36
+ /**
37
+ * Ceiling for the whole shutdown sequence. It must stay clearly below the unit's
38
+ * TimeoutStopSec (10s in /etc/systemd/system/herdsman.service): a shutdown that
39
+ * outlives it is SIGKILLed, which skips the finally cleanup (instance lock, pid
40
+ * file, helper child) and leaves the daemon half-stopped. Every step is bounded
41
+ * by whatever budget is left, so a single wedged step cannot run the sequence
42
+ * past this ceiling.
43
+ */
44
+ export const SHUTDOWN_BUDGET_MS = 5_000;
45
+ /**
46
+ * Floor granted to a step once the budget is spent. The sequence may therefore
47
+ * overshoot the budget by at most (steps - 1) * SHUTDOWN_MIN_STEP_MS, which still
48
+ * leaves several seconds of headroom under TimeoutStopSec; in exchange no step is
49
+ * skipped outright, so the pid file and socket are always cleaned up.
50
+ */
51
+ export const SHUTDOWN_MIN_STEP_MS = 250;
52
+ /**
53
+ * Runs shutdown steps in order under one shared budget. Each step is raced
54
+ * against the time left: a step that overruns is logged and abandoned so the
55
+ * next step (and the caller's finally cleanup) still runs. Failures that are not
56
+ * timeouts are not swallowed — they reject the sequence as before, so a genuine
57
+ * shutdown error still surfaces instead of hiding behind the budget.
58
+ */
59
+ export async function runShutdownSteps(steps, options = {}) {
60
+ const budgetMs = options.budgetMs ?? SHUTDOWN_BUDGET_MS;
61
+ const startedAt = Date.now();
62
+ const deadlineMs = startedAt + budgetMs;
63
+ for (const step of steps) {
64
+ const stepStartedAt = Date.now();
65
+ const remainingMs = deadlineMs - stepStartedAt;
66
+ const timeoutMs = Math.max(remainingMs, SHUTDOWN_MIN_STEP_MS);
67
+ console.log("Herdsman daemon shutdown step starting", {
68
+ budgetRemainingMs: Math.max(remainingMs, 0),
69
+ step: step.name,
70
+ timeoutMs,
71
+ });
72
+ const timedOut = await raceShutdownStep(step, timeoutMs);
73
+ const elapsedMs = Date.now() - stepStartedAt;
74
+ if (timedOut) {
75
+ console.warn("Herdsman daemon shutdown step timed out; continuing", {
76
+ budgetMs,
77
+ elapsedMs,
78
+ step: step.name,
79
+ timeoutMs,
80
+ });
81
+ continue;
82
+ }
83
+ console.log("Herdsman daemon shutdown step finished", { elapsedMs, step: step.name });
84
+ }
85
+ console.log("Herdsman daemon shutdown steps finished", {
86
+ budgetMs,
87
+ elapsedMs: Date.now() - startedAt,
88
+ });
89
+ }
90
+ /** Returns true when the timeout won; a step rejection propagates unchanged. */
91
+ async function raceShutdownStep(step, timeoutMs) {
92
+ let timer;
93
+ try {
94
+ const timedOut = new Promise((resolve) => {
95
+ timer = setTimeout(() => resolve(true), timeoutMs);
96
+ timer.unref();
97
+ });
98
+ const finished = Promise.resolve()
99
+ .then(() => step.run())
100
+ .then(() => false);
101
+ return await Promise.race([finished, timedOut]);
102
+ }
103
+ finally {
104
+ if (timer !== undefined)
105
+ clearTimeout(timer);
106
+ }
107
+ }
36
108
  /**
37
109
  * Runs the reconcile cycle on a fixed cadence while guaranteeing at most one
38
110
  * in-flight run: a tick that fires while the previous run is still executing is
@@ -89,7 +161,25 @@ export async function runObservabilityDaemonService(input = {}) {
89
161
  chmodSync(dirname(runtime.paths.dbPath), 0o700);
90
162
  mkdirSync(dirname(runtime.paths.socketPath), { mode: 0o700, recursive: true });
91
163
  chmodSync(dirname(runtime.paths.socketPath), 0o700);
92
- const { sqlite } = openSqlite(runtime.paths.dbPath);
164
+ const currentPid = input.pid ?? process.pid;
165
+ let releaseInstanceLock;
166
+ const releaseInstanceLockIfHeld = () => {
167
+ if (releaseInstanceLock) {
168
+ releaseInstanceLock();
169
+ releaseInstanceLock = undefined;
170
+ }
171
+ };
172
+ // The bare daemon entrypoint (herdsman-daemon.js) takes an instance lock so
173
+ // two daemon processes cannot share one HERDSMAN_HOME. It is acquired before
174
+ // the SQLite database is opened: a second or orphaned daemon is rejected
175
+ // while it has not touched (opened, migrated, or locked) the database at all.
176
+ // The lock is released on graceful stop and on every startup failure path.
177
+ releaseInstanceLock = acquireDaemonLock(daemonInstanceLockPath(runtime.paths.pidPath), {
178
+ pid: currentPid,
179
+ });
180
+ const openSqliteImpl = input.openSqlite ?? openSqlite;
181
+ const applyMigrationsImpl = input.applyMigrations ?? applyMigrations;
182
+ const { sqlite } = openSqliteImpl(runtime.paths.dbPath);
93
183
  for (const path of [
94
184
  runtime.paths.dbPath,
95
185
  `${runtime.paths.dbPath}-wal`,
@@ -98,7 +188,7 @@ export async function runObservabilityDaemonService(input = {}) {
98
188
  if (existsSync(path))
99
189
  chmodSync(path, 0o600);
100
190
  }
101
- applyMigrations(sqlite, {
191
+ applyMigrationsImpl(sqlite, {
102
192
  migrationsFolder: resolveMigrationsFolder(dirname(fileURLToPath(import.meta.url))),
103
193
  });
104
194
  const herdrSessions = new HerdrSessionStore(sqlite);
@@ -121,8 +211,16 @@ export async function runObservabilityDaemonService(input = {}) {
121
211
  scopes: agentOrchestratorScopes,
122
212
  });
123
213
  const turnCompletions = new TurnCompletionRegistry();
214
+ let publishEvent = (_event) => { };
215
+ // One controller drives every cancellable wait in the daemon. It is aborted at
216
+ // the start of stop(), so in-flight status waits (history-advance window, turn
217
+ // waits) and watcher loops end immediately instead of running out their own
218
+ // 30s / 12s windows and pushing the daemon past TimeoutStopSec.
219
+ const shutdownController = new AbortController();
124
220
  const index = new AgentIndexService({
125
221
  context: daemonServices.context,
222
+ onAgentEvent: (event) => publishEvent(event), // 闭包注入
223
+ shutdownSignal: shutdownController.signal,
126
224
  stores: {
127
225
  agentEvents,
128
226
  agentHistoryCache,
@@ -156,6 +254,7 @@ export async function runObservabilityDaemonService(input = {}) {
156
254
  turnCompletions,
157
255
  });
158
256
  connectedTerminal = (input) => server.isTerminalConnected(input);
257
+ publishEvent = (event) => server.publishAgentEvent(event); // 接通推送
159
258
  const watchManager = new HerdrSessionWatchManager({
160
259
  agents,
161
260
  herdrSessions,
@@ -164,6 +263,7 @@ export async function runObservabilityDaemonService(input = {}) {
164
263
  onAgentEvent: (event) => server.publishAgentEvent(event),
165
264
  onAgentIndexRefreshed: (refreshed) => server.reconcileAgentLocations(refreshed),
166
265
  sessionList,
266
+ shutdownSignal: shutdownController.signal,
167
267
  });
168
268
  const onUnhandledRejection = (reason) => {
169
269
  console.error("Herdsman daemon unhandled rejection", reason);
@@ -173,30 +273,80 @@ export async function runObservabilityDaemonService(input = {}) {
173
273
  };
174
274
  process.on("unhandledRejection", onUnhandledRejection);
175
275
  process.on("uncaughtException", onUncaughtException);
176
- const currentPid = input.pid ?? process.pid;
177
276
  const signalTarget = input.signalTarget ?? process;
178
277
  const doExit = input.exit ?? exit;
278
+ const shutdownBudgetMs = input.shutdownBudgetMs ?? SHUTDOWN_BUDGET_MS;
179
279
  // Register signal handlers before the first await that can block (server
180
280
  // start, reconcile): once the pid file is written the daemon must always
181
281
  // clean it up on a graceful shutdown, even if startup is still in progress.
182
282
  let reconcileScheduler;
183
- let releaseInstanceLock;
184
- const releaseInstanceLockIfHeld = () => {
185
- if (releaseInstanceLock) {
186
- releaseInstanceLock();
187
- releaseInstanceLock = undefined;
283
+ let stopping = false;
284
+ let exitRequested = false;
285
+ // The forced-exit path can win the race against the graceful one; whichever
286
+ // gets there first decides the exit code, and the loser must not exit again.
287
+ const requestExit = (code) => {
288
+ if (exitRequested)
289
+ return;
290
+ exitRequested = true;
291
+ doExit(code);
292
+ };
293
+ // A second SIGTERM/SIGINT means the first shutdown is not converging (or the
294
+ // supervisor is about to SIGKILL). Re-arming through these handlers keeps that
295
+ // signal away from Node's default action, which would kill the process before
296
+ // the finally cleanup and leave the pid file, socket and instance lock behind.
297
+ const onSecondSignal = () => {
298
+ console.warn("Herdsman daemon received a second shutdown signal; forcing exit", {
299
+ pid: currentPid,
300
+ });
301
+ try {
302
+ removeDaemonPidFile(runtime.paths.pidPath, currentPid);
303
+ }
304
+ catch { }
305
+ try {
306
+ rmSync(runtime.paths.socketPath, { force: true });
307
+ }
308
+ catch { }
309
+ try {
310
+ releaseInstanceLockIfHeld();
188
311
  }
312
+ catch { }
313
+ // Exit 0 on purpose: this is still an intentional stop, and a non-zero code
314
+ // would make `Restart=on-failure` pull the daemon back up.
315
+ requestExit(0);
189
316
  };
190
317
  const stop = async () => {
318
+ if (stopping)
319
+ return;
320
+ stopping = true;
321
+ detachSignalHandlers();
322
+ attachSignalHandlers(onSecondSignal);
323
+ const startedAt = Date.now();
191
324
  let exitCode = 0;
325
+ console.log("Herdsman daemon shutdown starting", {
326
+ budgetMs: shutdownBudgetMs,
327
+ pid: currentPid,
328
+ });
192
329
  try {
193
330
  process.off("unhandledRejection", onUnhandledRejection);
194
331
  process.off("uncaughtException", onUncaughtException);
195
332
  index.stopWaitingHistoryRetries();
196
- await index.drainInFlightPlans();
197
- await reconcileScheduler?.stop();
198
- await watchManager.stop();
199
- await server.stop();
333
+ // Abort before draining: waits that are already in flight end now instead
334
+ // of holding the drain open for their own window.
335
+ shutdownController.abort();
336
+ console.log("Herdsman daemon shutdown aborted in-flight waits", {
337
+ elapsedMs: Date.now() - startedAt,
338
+ });
339
+ await runShutdownSteps([
340
+ { name: "index.drainInFlightPlans", run: () => index.drainInFlightPlans() },
341
+ {
342
+ name: "reconcileScheduler.stop",
343
+ run: async () => {
344
+ await reconcileScheduler?.stop();
345
+ },
346
+ },
347
+ { name: "watchManager.stop", run: () => watchManager.stop() },
348
+ { name: "server.stop", run: () => server.stop() },
349
+ ], { budgetMs: shutdownBudgetMs });
200
350
  sqlite.close();
201
351
  }
202
352
  catch (error) {
@@ -206,19 +356,27 @@ export async function runObservabilityDaemonService(input = {}) {
206
356
  finally {
207
357
  removeDaemonPidFile(runtime.paths.pidPath, currentPid);
208
358
  releaseInstanceLockIfHeld();
209
- doExit(exitCode);
359
+ console.log("Herdsman daemon shutdown finished", {
360
+ elapsedMs: Date.now() - startedAt,
361
+ exitCode,
362
+ });
363
+ requestExit(exitCode);
210
364
  }
211
365
  };
212
- signalTarget.once("SIGINT", stop);
213
- signalTarget.once("SIGTERM", stop);
366
+ const attachSignalHandlers = (handler) => {
367
+ signalTarget.once("SIGINT", handler);
368
+ signalTarget.once("SIGTERM", handler);
369
+ };
370
+ const detachSignalHandlers = () => {
371
+ if (typeof signalTarget.off !== "function")
372
+ return;
373
+ signalTarget.off("SIGINT", stop);
374
+ signalTarget.off("SIGTERM", stop);
375
+ signalTarget.off("SIGINT", onSecondSignal);
376
+ signalTarget.off("SIGTERM", onSecondSignal);
377
+ };
378
+ attachSignalHandlers(stop);
214
379
  try {
215
- // The bare daemon entrypoint (herdsman-daemon.js) takes an instance lock
216
- // distinct from the CLI operation lock so two daemon processes cannot
217
- // share one HERDSMAN_HOME even when neither goes through the CLI. The lock
218
- // is released on graceful stop and on every startup failure path.
219
- releaseInstanceLock = acquireDaemonLock(daemonInstanceLockPath(runtime.paths.pidPath), {
220
- pid: currentPid,
221
- });
222
380
  await server.start();
223
381
  writeDaemonPidFile(runtime.paths.pidPath, currentPid);
224
382
  await reconciler.reconcile({ releaseStaleOwners: false });
@@ -250,10 +408,10 @@ export async function runObservabilityDaemonService(input = {}) {
250
408
  catch (error) {
251
409
  process.off("unhandledRejection", onUnhandledRejection);
252
410
  process.off("uncaughtException", onUncaughtException);
253
- if (typeof signalTarget.off === "function") {
254
- signalTarget.off("SIGINT", stop);
255
- signalTarget.off("SIGTERM", stop);
256
- }
411
+ detachSignalHandlers();
412
+ // Same abort as the graceful path: a half-started watcher must not keep its
413
+ // socket (and the failing startup) alive.
414
+ shutdownController.abort();
257
415
  try {
258
416
  await reconcileScheduler?.stop();
259
417
  }
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["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AAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACvD,yBAAyB,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,QAAgB;IACtD,IAAI,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,gBAAgB,GAAG,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACrD,IAAI,UAAU,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC;YACnE,OAAO,gBAAgB,CAAC;QAC1B,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,WAA8B;IACtD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;;YACpC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -67,7 +67,22 @@ export declare class AgentEventStore {
67
67
  paneGeneration?: string | null;
68
68
  invalidatedReason?: string;
69
69
  }): void;
70
+ /**
71
+ * Direct invalidatePane without wrapping in a transaction.
72
+ *
73
+ * ONLY call this when the caller already holds an SQLite transaction
74
+ * (for example from AgentStore.replaceForSession). Calling this outside
75
+ * an explicit transaction will leave the two-step invalidation non-atomic
76
+ * with respect to other concurrent writers.
77
+ */
78
+ invalidatePaneDirect(input: {
79
+ herdrSessionName: string;
80
+ paneId: string;
81
+ paneGeneration?: string | null;
82
+ invalidatedReason?: string;
83
+ }): void;
70
84
  listReconcileCandidates(limit?: number, afterId?: number): AgentEventRecord[];
85
+ markRetainedInvalidated(id: number): boolean;
71
86
  deleteReconcileCandidate(id: number): boolean;
72
87
  /**
73
88
  * Physically removes invalidated events older than the given age, measured from