@timmyjl12/pi-subagents 0.20.0 → 0.21.1

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 (159) hide show
  1. package/CHANGELOG.md +862 -827
  2. package/README.md +1125 -1080
  3. package/dist/active-agents-prompt.d.ts +31 -9
  4. package/dist/active-agents-prompt.js +73 -9
  5. package/dist/agent-color.js +9 -1
  6. package/dist/agent-file-toggle.d.ts +1 -1
  7. package/dist/agent-manager.d.ts +405 -18
  8. package/dist/agent-manager.js +1661 -131
  9. package/dist/agent-runner.d.ts +45 -6
  10. package/dist/agent-runner.js +109 -18
  11. package/dist/agent-types.d.ts +30 -7
  12. package/dist/agent-types.js +38 -9
  13. package/dist/awaited-result.d.ts +37 -0
  14. package/dist/awaited-result.js +150 -0
  15. package/dist/child-session-shutdown.d.ts +19 -1
  16. package/dist/child-session-shutdown.js +60 -11
  17. package/dist/cleanup-plans.d.ts +10 -0
  18. package/dist/cleanup-plans.js +112 -0
  19. package/dist/cross-extension-rpc.d.ts +8 -1
  20. package/dist/cross-extension-rpc.js +59 -5
  21. package/dist/custom-agents.d.ts +34 -9
  22. package/dist/custom-agents.js +308 -111
  23. package/dist/default-agents.d.ts +1 -1
  24. package/dist/env.d.ts +1 -1
  25. package/dist/error-log.d.ts +6 -0
  26. package/dist/error-log.js +8 -0
  27. package/dist/force-main-model.d.ts +21 -0
  28. package/dist/force-main-model.js +28 -0
  29. package/dist/goal-bridge.d.ts +155 -0
  30. package/dist/goal-bridge.js +305 -0
  31. package/dist/group-join.d.ts +5 -1
  32. package/dist/group-join.js +52 -7
  33. package/dist/index.d.ts +5 -5
  34. package/dist/index.js +2827 -333
  35. package/dist/invocation-config.d.ts +30 -3
  36. package/dist/invocation-config.js +30 -1
  37. package/dist/memory.d.ts +1 -1
  38. package/dist/mention-clone.d.ts +1 -1
  39. package/dist/model-scope.d.ts +1 -1
  40. package/dist/nested-tools.d.ts +22 -1
  41. package/dist/nested-tools.js +120 -26
  42. package/dist/output-file.d.ts +15 -4
  43. package/dist/output-file.js +146 -43
  44. package/dist/prompts.d.ts +1 -1
  45. package/dist/recovery.d.ts +1 -1
  46. package/dist/report-cleanup.d.ts +204 -0
  47. package/dist/report-cleanup.js +1632 -0
  48. package/dist/report-store.d.ts +738 -0
  49. package/dist/report-store.js +3616 -0
  50. package/dist/schedule-store.d.ts +14 -6
  51. package/dist/schedule-store.js +88 -58
  52. package/dist/schedule.d.ts +20 -8
  53. package/dist/schedule.js +135 -74
  54. package/dist/settings.d.ts +39 -11
  55. package/dist/settings.js +22 -5
  56. package/dist/status-note.d.ts +1 -1
  57. package/dist/structured-output.d.ts +1 -1
  58. package/dist/types.d.ts +32 -3
  59. package/dist/ui/agent-mention.d.ts +2 -2
  60. package/dist/ui/agent-widget.d.ts +82 -13
  61. package/dist/ui/agent-widget.js +155 -37
  62. package/dist/ui/cleanup-preview.d.ts +59 -0
  63. package/dist/ui/cleanup-preview.js +466 -0
  64. package/dist/ui/conversation-viewer.d.ts +4 -4
  65. package/dist/ui/conversation-viewer.js +10 -6
  66. package/dist/ui/fleet-list.d.ts +3 -3
  67. package/dist/ui/fleet-list.js +3 -3
  68. package/dist/ui/fleet-overlay.d.ts +37 -6
  69. package/dist/ui/fleet-overlay.js +214 -18
  70. package/dist/ui/hub-feed.d.ts +52 -0
  71. package/dist/ui/hub-feed.js +148 -0
  72. package/dist/ui/native-transcript.js +5 -1
  73. package/dist/ui/schedule-menu.d.ts +1 -1
  74. package/dist/ui/schedule-menu.js +1 -1
  75. package/dist/ui/workflow-card.d.ts +4 -4
  76. package/dist/ui/workflow-dialog.d.ts +4 -4
  77. package/dist/ui/workflow-dialog.js +8 -3
  78. package/dist/ui/workflow-menu.d.ts +2 -2
  79. package/dist/usage.d.ts +12 -0
  80. package/dist/usage.js +28 -1
  81. package/dist/workflow/entry.d.ts +3 -3
  82. package/dist/workflow/host.d.ts +7 -4
  83. package/dist/workflow/host.js +162 -48
  84. package/dist/workflow/journal.d.ts +23 -7
  85. package/dist/workflow/journal.js +80 -23
  86. package/dist/workflow/progress.d.ts +1 -1
  87. package/dist/workflow/runtime.d.ts +45 -6
  88. package/dist/workflow/runtime.js +105 -16
  89. package/dist/workflow/task.d.ts +13 -4
  90. package/dist/workflow/task.js +7 -1
  91. package/dist/workflow/tool-description.d.ts +7 -2
  92. package/dist/workflow/tool-description.js +10 -5
  93. package/docs/{FORK.md → DEVELOPMENT.md} +4 -4
  94. package/docs/artifacts.md +93 -0
  95. package/docs/rpc.md +252 -189
  96. package/docs/runtime-performance.md +53 -0
  97. package/docs/workflows.md +48 -18
  98. package/examples/agent-tool-description.md +2 -2
  99. package/examples/workflows/review-panel.js +6 -3
  100. package/package.json +5 -5
  101. package/src/active-agents-prompt.ts +115 -39
  102. package/src/agent-color.ts +10 -2
  103. package/src/agent-file-toggle.ts +2 -2
  104. package/src/agent-manager.ts +3312 -1601
  105. package/src/agent-runner.ts +164 -36
  106. package/src/agent-types.ts +56 -11
  107. package/src/awaited-result.ts +187 -0
  108. package/src/child-session-shutdown.ts +114 -46
  109. package/src/cleanup-plans.ts +112 -0
  110. package/src/cross-extension-rpc.ts +68 -9
  111. package/src/custom-agents.ts +384 -112
  112. package/src/default-agents.ts +1 -1
  113. package/src/enabled-models.ts +1 -1
  114. package/src/env.ts +1 -1
  115. package/src/error-log.ts +10 -1
  116. package/src/force-main-model.ts +29 -0
  117. package/src/goal-bridge.ts +468 -0
  118. package/src/group-join.ts +56 -9
  119. package/src/index.ts +2987 -349
  120. package/src/invocation-config.ts +50 -4
  121. package/src/memory.ts +1 -1
  122. package/src/mention-clone.ts +3 -3
  123. package/src/model-scope.ts +1 -1
  124. package/src/nested-tools.ts +164 -33
  125. package/src/output-file.ts +168 -46
  126. package/src/prompts.ts +1 -1
  127. package/src/recovery.ts +2 -2
  128. package/src/report-cleanup.ts +2044 -0
  129. package/src/report-store.ts +4133 -0
  130. package/src/schedule-store.ts +244 -201
  131. package/src/schedule.ts +144 -80
  132. package/src/settings.ts +61 -16
  133. package/src/skill-loader.ts +1 -1
  134. package/src/standalone-fallback.ts +2 -2
  135. package/src/status-note.ts +1 -1
  136. package/src/structured-output.ts +1 -1
  137. package/src/types.ts +33 -3
  138. package/src/ui/agent-mention.ts +3 -3
  139. package/src/ui/agent-widget.ts +179 -45
  140. package/src/ui/cleanup-preview.ts +518 -0
  141. package/src/ui/conversation-viewer.ts +19 -15
  142. package/src/ui/fleet-list.ts +7 -7
  143. package/src/ui/fleet-overlay.ts +1048 -847
  144. package/src/ui/hub-feed.ts +179 -0
  145. package/src/ui/native-transcript.ts +7 -3
  146. package/src/ui/schedule-menu.ts +4 -4
  147. package/src/ui/workflow-card.ts +4 -4
  148. package/src/ui/workflow-dialog.ts +10 -6
  149. package/src/ui/workflow-menu.ts +4 -4
  150. package/src/usage.ts +53 -3
  151. package/src/workflow/collisions.ts +1 -1
  152. package/src/workflow/entry.ts +3 -3
  153. package/src/workflow/host.ts +174 -54
  154. package/src/workflow/journal.ts +80 -23
  155. package/src/workflow/progress.ts +1 -1
  156. package/src/workflow/runtime.ts +146 -23
  157. package/src/workflow/saved.ts +3 -3
  158. package/src/workflow/task.ts +18 -7
  159. package/src/workflow/tool-description.ts +10 -5
@@ -9,7 +9,7 @@
9
9
  * mutation acquires a PID-based exclusion lock, re-reads the latest state
10
10
  * from disk, applies the change, atomic-writes via temp+rename, releases.
11
11
  */
12
- import type { ScheduledSubagent } from "./types.js";
12
+ import type { ScheduledSubagent } from "./types.ts";
13
13
  /**
14
14
  * A lock older than this is stale whatever its PID says: Windows reuses PIDs
15
15
  * aggressively, so "that process is alive" does not mean it holds the lock.
@@ -25,8 +25,14 @@ export declare class ScheduleStore {
25
25
  constructor(filePath: string);
26
26
  /** Create the backing directory lazily — only when we're about to persist. */
27
27
  private ensureDir;
28
- /** Load from disk into the in-memory cache. Silent on parse errors. */
28
+ /**
29
+ * One cold synchronous read preserves the synchronous constructor and the
30
+ * list/get snapshot API. Every reload on a mutation path uses async I/O.
31
+ */
32
+ private loadInitial;
33
+ /** Reload from disk into the in-memory cache. Silent on parse errors. */
29
34
  private load;
35
+ private replaceJobs;
30
36
  /** Atomic write via temp file + rename (POSIX-atomic). */
31
37
  private save;
32
38
  /** Acquire lock → reload → mutate → save → release. */
@@ -36,9 +42,11 @@ export declare class ScheduleStore {
36
42
  /** Read-only check — uses the cache. */
37
43
  hasName(name: string, exceptId?: string): boolean;
38
44
  get(id: string): ScheduledSubagent | undefined;
39
- add(job: ScheduledSubagent): void;
40
- update(id: string, patch: Partial<ScheduledSubagent>): ScheduledSubagent | undefined;
41
- remove(id: string): boolean;
45
+ add(job: ScheduledSubagent): Promise<void>;
46
+ /** Atomically re-check the latest committed names and insert only if unique. */
47
+ addUnlessNameExists(job: ScheduledSubagent): Promise<boolean>;
48
+ update(id: string, patch: Partial<ScheduledSubagent>): Promise<ScheduledSubagent | undefined>;
49
+ remove(id: string): Promise<boolean>;
42
50
  /** Delete the backing file (used when no jobs remain, optional cleanup). */
43
- deleteFileIfEmpty(): void;
51
+ deleteFileIfEmpty(): Promise<void>;
44
52
  }
@@ -10,10 +10,12 @@
10
10
  * from disk, applies the change, atomic-writes via temp+rename, releases.
11
11
  */
12
12
  import { randomBytes } from "node:crypto";
13
- import { existsSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "node:fs";
13
+ import { readFileSync } from "node:fs";
14
+ import { mkdir, readFile, rename, stat, unlink, writeFile } from "node:fs/promises";
14
15
  import { dirname, join } from "node:path";
16
+ import { setTimeout as sleep } from "node:timers/promises";
15
17
  const LOCK_RETRY_MS = 50;
16
- /** Total synchronous wait for the lock. Mutations run on the UI thread. */
18
+ /** Total asynchronous wait for the lock. */
17
19
  const LOCK_MAX_WAIT_MS = 1000;
18
20
  /**
19
21
  * A lock older than this is stale whatever its PID says: Windows reuses PIDs
@@ -23,10 +25,6 @@ const LOCK_MAX_WAIT_MS = 1000;
23
25
  export const LOCK_STALE_MS = 30_000;
24
26
  const RENAME_RETRIES = 5;
25
27
  const RENAME_RETRY_MS = 20;
26
- /** Block the thread without spinning the CPU. */
27
- function sleepSync(ms) {
28
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
29
- }
30
28
  function isProcessRunning(pid) {
31
29
  try {
32
30
  process.kill(pid, 0);
@@ -41,11 +39,11 @@ function errorCode(e) {
41
39
  return typeof code === "string" ? code : undefined;
42
40
  }
43
41
  /** True when the existing lock file can be broken: too old, or its owner is gone. */
44
- function isLockStale(lockPath) {
42
+ async function isLockStale(lockPath) {
45
43
  try {
46
- if (Date.now() - statSync(lockPath).mtimeMs > LOCK_STALE_MS)
44
+ if (Date.now() - (await stat(lockPath)).mtimeMs > LOCK_STALE_MS)
47
45
  return true;
48
- const pid = parseInt(readFileSync(lockPath, "utf-8"), 10);
46
+ const pid = parseInt(await readFile(lockPath, "utf-8"), 10);
49
47
  return Number.isInteger(pid) && pid > 0 && !isProcessRunning(pid);
50
48
  }
51
49
  catch (e) {
@@ -53,20 +51,20 @@ function isLockStale(lockPath) {
53
51
  return errorCode(e) === "ENOENT";
54
52
  }
55
53
  }
56
- function acquireLock(lockPath) {
54
+ async function acquireLock(lockPath) {
57
55
  const deadline = Date.now() + LOCK_MAX_WAIT_MS;
58
56
  for (;;) {
59
57
  try {
60
- writeFileSync(lockPath, `${process.pid}`, { flag: "wx" });
58
+ await writeFile(lockPath, `${process.pid}`, { flag: "wx" });
61
59
  return;
62
60
  }
63
61
  catch (e) {
64
62
  if (errorCode(e) !== "EEXIST")
65
63
  throw e;
66
64
  }
67
- if (isLockStale(lockPath)) {
65
+ if (await isLockStale(lockPath)) {
68
66
  try {
69
- unlinkSync(lockPath);
67
+ await unlink(lockPath);
70
68
  }
71
69
  catch (e) {
72
70
  if (errorCode(e) !== "ENOENT")
@@ -76,41 +74,44 @@ function acquireLock(lockPath) {
76
74
  }
77
75
  if (Date.now() >= deadline)
78
76
  break;
79
- sleepSync(LOCK_RETRY_MS);
77
+ await sleep(LOCK_RETRY_MS);
80
78
  }
81
79
  throw new Error(`Failed to acquire schedule lock: ${lockPath}`);
82
80
  }
83
81
  /** rename with a bounded retry: Windows reports EPERM/EBUSY while AV or an indexer holds the target. */
84
- function renameWithRetry(from, to) {
82
+ async function renameWithRetry(from, to) {
85
83
  for (let attempt = 0;; attempt++) {
86
84
  try {
87
- renameSync(from, to);
85
+ await rename(from, to);
88
86
  return;
89
87
  }
90
88
  catch (e) {
91
89
  const code = errorCode(e);
92
90
  const transient = code === "EPERM" || code === "EBUSY" || code === "EACCES";
93
91
  if (!transient || attempt >= RENAME_RETRIES) {
94
- try {
95
- unlinkSync(from);
96
- }
97
- catch { /* best effort: the rename error below is the one that matters */ }
92
+ // Best effort: the rename error below is the one that matters.
93
+ await unlink(from).catch(() => undefined);
98
94
  throw e;
99
95
  }
100
- sleepSync(RENAME_RETRY_MS * (attempt + 1));
96
+ await sleep(RENAME_RETRY_MS * (attempt + 1));
101
97
  }
102
98
  }
103
99
  }
104
- function releaseLock(lockPath) {
105
- try {
106
- unlinkSync(lockPath);
107
- }
108
- catch { /* ignore */ }
100
+ async function releaseLock(lockPath) {
101
+ await unlink(lockPath).catch(() => undefined);
109
102
  }
110
103
  /** Resolve the storage path for a session-scoped store. */
111
104
  export function resolveStorePath(cwd, sessionId) {
112
105
  return join(cwd, ".pi", "subagent-schedules", `${sessionId}.json`);
113
106
  }
107
+ function parseStoreData(serialized) {
108
+ try {
109
+ return JSON.parse(serialized);
110
+ }
111
+ catch {
112
+ return undefined;
113
+ }
114
+ }
114
115
  export class ScheduleStore {
115
116
  filePath;
116
117
  lockPath;
@@ -118,44 +119,68 @@ export class ScheduleStore {
118
119
  constructor(filePath) {
119
120
  this.filePath = filePath;
120
121
  this.lockPath = filePath + ".lock";
121
- this.load();
122
+ this.loadInitial();
122
123
  }
123
124
  /** Create the backing directory lazily — only when we're about to persist. */
124
- ensureDir() {
125
- mkdirSync(dirname(this.filePath), { recursive: true });
126
- }
127
- /** Load from disk into the in-memory cache. Silent on parse errors. */
128
- load() {
129
- if (!existsSync(this.filePath))
125
+ async ensureDir() {
126
+ await mkdir(dirname(this.filePath), { recursive: true });
127
+ }
128
+ /**
129
+ * One cold synchronous read preserves the synchronous constructor and the
130
+ * list/get snapshot API. Every reload on a mutation path uses async I/O.
131
+ */
132
+ loadInitial() {
133
+ let serialized;
134
+ try {
135
+ serialized = readFileSync(this.filePath, "utf-8");
136
+ }
137
+ catch {
130
138
  return;
139
+ }
140
+ const data = parseStoreData(serialized);
141
+ if (data)
142
+ this.replaceJobs(data);
143
+ }
144
+ /** Reload from disk into the in-memory cache. Silent on parse errors. */
145
+ async load() {
146
+ let serialized;
131
147
  try {
132
- const data = JSON.parse(readFileSync(this.filePath, "utf-8"));
133
- this.jobs.clear();
134
- for (const j of data.jobs ?? [])
135
- this.jobs.set(j.id, j);
148
+ serialized = await readFile(this.filePath, "utf-8");
149
+ }
150
+ catch (e) {
151
+ if (errorCode(e) === "ENOENT")
152
+ return;
153
+ throw e;
136
154
  }
137
- catch { /* corrupt — start fresh, next save rewrites */ }
155
+ const data = parseStoreData(serialized);
156
+ if (data)
157
+ this.replaceJobs(data);
158
+ }
159
+ replaceJobs(data) {
160
+ this.jobs.clear();
161
+ for (const j of data.jobs ?? [])
162
+ this.jobs.set(j.id, j);
138
163
  }
139
164
  /** Atomic write via temp file + rename (POSIX-atomic). */
140
- save() {
165
+ async save() {
141
166
  const data = { version: 1, jobs: [...this.jobs.values()] };
142
167
  // Unique per write, so two writers can never clobber each other's temp file.
143
168
  const tmp = `${this.filePath}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
144
- writeFileSync(tmp, JSON.stringify(data, null, 2));
145
- renameWithRetry(tmp, this.filePath);
169
+ await writeFile(tmp, JSON.stringify(data, null, 2));
170
+ await renameWithRetry(tmp, this.filePath);
146
171
  }
147
172
  /** Acquire lock → reload → mutate → save → release. */
148
- withLock(fn) {
149
- this.ensureDir();
150
- acquireLock(this.lockPath);
173
+ async withLock(fn) {
174
+ await this.ensureDir();
175
+ await acquireLock(this.lockPath);
151
176
  try {
152
- this.load();
177
+ await this.load();
153
178
  const result = fn();
154
- this.save();
179
+ await this.save();
155
180
  return result;
156
181
  }
157
182
  finally {
158
- releaseLock(this.lockPath);
183
+ await releaseLock(this.lockPath);
159
184
  }
160
185
  }
161
186
  /** Read-only — returns a snapshot of the in-memory cache. */
@@ -173,12 +198,21 @@ export class ScheduleStore {
173
198
  get(id) {
174
199
  return this.jobs.get(id);
175
200
  }
176
- add(job) {
177
- this.withLock(() => {
201
+ async add(job) {
202
+ await this.withLock(() => {
203
+ this.jobs.set(job.id, job);
204
+ });
205
+ }
206
+ /** Atomically re-check the latest committed names and insert only if unique. */
207
+ async addUnlessNameExists(job) {
208
+ return this.withLock(() => {
209
+ if (this.hasName(job.name))
210
+ return false;
178
211
  this.jobs.set(job.id, job);
212
+ return true;
179
213
  });
180
214
  }
181
- update(id, patch) {
215
+ async update(id, patch) {
182
216
  // No-op fast path — an unknown id changes nothing, so don't lock or touch
183
217
  // disk (which would otherwise lazily create the backing directory).
184
218
  if (!this.jobs.has(id))
@@ -192,19 +226,15 @@ export class ScheduleStore {
192
226
  return updated;
193
227
  });
194
228
  }
195
- remove(id) {
229
+ async remove(id) {
196
230
  // No-op fast path — see update().
197
231
  if (!this.jobs.has(id))
198
232
  return false;
199
233
  return this.withLock(() => this.jobs.delete(id));
200
234
  }
201
235
  /** Delete the backing file (used when no jobs remain, optional cleanup). */
202
- deleteFileIfEmpty() {
203
- if (this.jobs.size === 0 && existsSync(this.filePath)) {
204
- try {
205
- unlinkSync(this.filePath);
206
- }
207
- catch { /* ignore */ }
208
- }
236
+ async deleteFileIfEmpty() {
237
+ if (this.jobs.size === 0)
238
+ await unlink(this.filePath).catch(() => undefined);
209
239
  }
210
240
  }
@@ -15,9 +15,9 @@
15
15
  * `subagent-notification` followUp path. No new delivery code.
16
16
  */
17
17
  import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
18
- import type { AgentManager } from "./agent-manager.js";
19
- import type { ScheduleStore } from "./schedule-store.js";
20
- import type { IsolationMode, ScheduledSubagent, SubagentType, ThinkingLevel } from "./types.js";
18
+ import type { AgentManager } from "./agent-manager.ts";
19
+ import type { ScheduleStore } from "./schedule-store.ts";
20
+ import type { IsolationMode, ScheduledSubagent, SubagentType, ThinkingLevel } from "./types.ts";
21
21
  /** Event emitted on `pi.events` for cross-extension consumers. */
22
22
  export type ScheduleChangeEvent = {
23
23
  type: "added";
@@ -33,6 +33,11 @@ export type ScheduleChangeEvent = {
33
33
  jobId: string;
34
34
  agentId: string;
35
35
  name: string;
36
+ } | {
37
+ type: "skipped";
38
+ jobId: string;
39
+ name: string;
40
+ reason: "overlap";
36
41
  } | {
37
42
  type: "error";
38
43
  jobId: string;
@@ -54,6 +59,7 @@ export interface NewJobInput {
54
59
  export declare class SubagentScheduler {
55
60
  private jobs;
56
61
  private intervals;
62
+ private activeRuns;
57
63
  private store;
58
64
  private pi;
59
65
  private ctx;
@@ -71,20 +77,26 @@ export declare class SubagentScheduler {
71
77
  */
72
78
  buildJob(input: NewJobInput): ScheduledSubagent;
73
79
  /** Add a job, persist, and arm if enabled. Returns the stored job. */
74
- addJob(input: NewJobInput): ScheduledSubagent;
75
- removeJob(id: string): boolean;
80
+ addJob(input: NewJobInput): Promise<ScheduledSubagent>;
81
+ removeJob(id: string): Promise<boolean>;
76
82
  /** Toggle / mutate a job. Re-arms based on the new `enabled` state. */
77
- updateJob(id: string, patch: Partial<ScheduledSubagent>): ScheduledSubagent | undefined;
83
+ updateJob(id: string, patch: Partial<ScheduledSubagent>): Promise<ScheduledSubagent | undefined>;
78
84
  /** Next-run time as ISO, or undefined if not currently armed. */
79
85
  getNextRun(jobId: string): string | undefined;
80
86
  private scheduleJob;
87
+ private dispatchJob;
88
+ private executeOnce;
89
+ private disableJobWithError;
81
90
  private unscheduleJob;
82
91
  /**
83
92
  * Fire a job: persist running state, spawn (bypassing the concurrency
84
- * queue), persist completion. Fire-and-forget: the timer tick returns
85
- * immediately so other jobs keep firing.
93
+ * queue), persist completion. The in-memory guard covers the complete run,
94
+ * so persisted `running` state from a previous process never blocks recovery.
86
95
  */
87
96
  private executeJob;
97
+ private finalizeRun;
98
+ private recordRunError;
99
+ private reportError;
88
100
  private emit;
89
101
  private requireStore;
90
102
  /**