minimal-agent 0.18.20 → 0.18.22

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 (188) hide show
  1. package/README.md +16 -3
  2. package/package.json +1 -1
  3. package/plugins/cron-runner/README.md +23 -0
  4. package/plugins/cron-runner/commands/cron.md +7 -1
  5. package/plugins/cron-runner/plugin.js +9 -2
  6. package/plugins/cron-runner/plugin.ts +10 -2
  7. package/plugins/cron-runner/src/commands.js +112 -25
  8. package/plugins/cron-runner/src/commands.ts +154 -33
  9. package/plugins/cron-runner/src/contract.js +70 -0
  10. package/plugins/cron-runner/src/contract.ts +70 -0
  11. package/plugins/cron-runner/src/requests.js +22 -13
  12. package/plugins/cron-runner/src/requests.ts +34 -14
  13. package/plugins/cron-runner/src/runs.js +63 -10
  14. package/plugins/cron-runner/src/runs.ts +107 -15
  15. package/plugins/cron-runner/src/scheduler.js +188 -76
  16. package/plugins/cron-runner/src/scheduler.ts +277 -94
  17. package/plugins/cron-runner/src/schema.js +52 -17
  18. package/plugins/cron-runner/src/schema.ts +73 -22
  19. package/plugins/cron-runner/src/service.js +29 -8
  20. package/plugins/cron-runner/src/service.ts +71 -18
  21. package/plugins/cron-runner/src/store.js +92 -30
  22. package/plugins/cron-runner/src/store.ts +156 -53
  23. package/plugins/cron-runner/src/transaction.js +24 -0
  24. package/plugins/cron-runner/src/transaction.ts +36 -0
  25. package/plugins/cron-runner/src/types.ts +30 -4
  26. package/plugins/cron-runner/test/lifecycle.test.ts +419 -0
  27. package/plugins/cron-runner/test/plugin-integration.test.ts +3 -2
  28. package/plugins/cron-runner/test/reliability.test.ts +2 -2
  29. package/plugins/cron-runner/test/store-and-scheduler.test.ts +9 -7
  30. package/plugins/workflow-runner/plugin.js +1 -0
  31. package/plugins/workflow-runner/plugin.ts +1 -0
  32. package/plugins/workflow-runner/src/index.js +1 -0
  33. package/plugins/workflow-runner/src/index.ts +2 -0
  34. package/plugins/workflow-runner/src/runner.js +6 -1
  35. package/plugins/workflow-runner/src/runner.ts +5 -1
  36. package/plugins/workflow-runner/src/types.ts +1 -0
  37. package/plugins/workflow-runner/test/api.test.ts +1 -0
  38. package/plugins/workflow-runner/test/apiCapabilities.test.ts +4 -0
  39. package/plugins/workflow-runner/test/apiConcurrencyGate.test.ts +1 -0
  40. package/plugins/workflow-runner/test/childWorkflow.test.ts +19 -0
  41. package/plugins/workflow-runner/test/embeddedExecution.test.ts +23 -3
  42. package/src/advisor/README.md +17 -6
  43. package/src/advisor/advisorNudge.js +23 -3
  44. package/src/advisor/advisorNudge.ts +20 -3
  45. package/src/advisor/deliveryReview.js +9 -2
  46. package/src/advisor/deliveryReview.ts +10 -2
  47. package/src/cli/args.js +1 -0
  48. package/src/cli/args.ts +1 -0
  49. package/src/cli/headlessTurn.js +143 -0
  50. package/src/cli/headlessTurn.ts +187 -0
  51. package/src/cli/lifecycle.js +52 -0
  52. package/src/cli/lifecycle.ts +59 -0
  53. package/src/cli/print.js +91 -240
  54. package/src/cli/print.ts +99 -301
  55. package/src/cli/quickModelSetup.js +3 -0
  56. package/src/cli/quickModelSetup.tsx +3 -0
  57. package/src/cli/streamJson.js +244 -334
  58. package/src/cli/streamJson.ts +248 -416
  59. package/src/cli/wizards/contextAdvisorWizard.js +0 -7
  60. package/src/cli/wizards/contextAdvisorWizard.tsx +0 -11
  61. package/src/cli/wizards/providerPresets.js +25 -14
  62. package/src/cli/wizards/providerPresets.ts +25 -14
  63. package/src/cli/wizards/providerWizard.js +29 -11
  64. package/src/cli/wizards/providerWizard.tsx +29 -11
  65. package/src/config/configDefaults.js +2 -2
  66. package/src/config/configDefaults.ts +2 -2
  67. package/src/config/configDiagnostics.js +7 -3
  68. package/src/config/configDiagnostics.ts +6 -3
  69. package/src/config/configFile.ts +1 -1
  70. package/src/context/compact.js +40 -10
  71. package/src/context/compact.ts +51 -12
  72. package/src/context/compactResources.js +39 -0
  73. package/src/context/compactResources.ts +35 -0
  74. package/src/context/manualCompact.js +20 -0
  75. package/src/context/manualCompact.ts +28 -0
  76. package/src/llm/client.js +4 -0
  77. package/src/llm/client.ts +4 -0
  78. package/src/llm/messageProvenance.js +1 -1
  79. package/src/llm/messageProvenance.ts +1 -1
  80. package/src/loop/README.md +4 -2
  81. package/src/loop/deliveryIntent.js +3 -2
  82. package/src/loop/deliveryIntent.ts +4 -2
  83. package/src/loop/messages.js +1 -0
  84. package/src/loop/messages.ts +1 -0
  85. package/src/loop/options.ts +2 -0
  86. package/src/loop.js +10 -2
  87. package/src/loop.ts +9 -2
  88. package/src/main.js +40 -45
  89. package/src/main.tsx +33 -52
  90. package/src/plugin-sdk.js +1 -1
  91. package/src/plugin-sdk.ts +1 -1
  92. package/src/plugins/artifactDelivery.js +76 -0
  93. package/src/plugins/artifactDelivery.ts +76 -0
  94. package/src/plugins/pluginApi.ts +4 -0
  95. package/src/plugins/pluginRunner.js +2 -0
  96. package/src/plugins/pluginRunner.ts +3 -0
  97. package/src/prompts/delegation.js +2 -2
  98. package/src/prompts/delegation.ts +2 -2
  99. package/src/prompts/policyRegistry.js +7 -5
  100. package/src/prompts/policyRegistry.ts +7 -5
  101. package/src/prompts/promptAssembly.js +2 -2
  102. package/src/prompts/promptAssembly.ts +2 -2
  103. package/src/runtime/requestIntent.js +86 -0
  104. package/src/runtime/requestIntent.ts +66 -0
  105. package/src/runtime/systemEvents.js +10 -1
  106. package/src/runtime/systemEvents.ts +9 -1
  107. package/src/session/commandTranscript.js +76 -0
  108. package/src/session/commandTranscript.ts +77 -0
  109. package/src/session/executionOutcome.js +25 -0
  110. package/src/session/executionOutcome.ts +34 -0
  111. package/src/session/runAgentTurn.js +8 -1
  112. package/src/session/runAgentTurn.ts +10 -1
  113. package/src/session/runTurn.js +40 -15
  114. package/src/session/runTurn.ts +38 -12
  115. package/src/session/sessionState.js +7 -2
  116. package/src/session/sessionState.ts +7 -2
  117. package/src/team/onlineToolContract.js +1 -0
  118. package/src/team/onlineToolContract.ts +1 -0
  119. package/src/tools/advisor/advisor.js +73 -30
  120. package/src/tools/advisor/advisor.ts +73 -33
  121. package/src/tools/advisor/advisorCoordination.js +44 -0
  122. package/src/tools/advisor/advisorCoordination.ts +45 -0
  123. package/src/tools/advisor/advisorDescription.js +1 -1
  124. package/src/tools/advisor/advisorDescription.ts +1 -1
  125. package/src/tools/agent/README.md +2 -0
  126. package/src/tools/agent/agent.js +7 -3
  127. package/src/tools/agent/agent.ts +7 -3
  128. package/src/tools/agent/agentHandoff.js +2 -1
  129. package/src/tools/agent/agentHandoff.ts +2 -1
  130. package/src/tools/agent/agentTaskService.js +26 -5
  131. package/src/tools/agent/agentTaskService.ts +25 -5
  132. package/src/tools/agent/agentTypes.js +2 -2
  133. package/src/tools/agent/agentTypes.ts +2 -2
  134. package/src/tools/agent/baselineAttach.js +14 -7
  135. package/src/tools/agent/baselineAttach.ts +14 -7
  136. package/src/tools/applypatch/applyPatch.js +39 -13
  137. package/src/tools/applypatch/applyPatch.ts +35 -15
  138. package/src/tools/bash/bash.js +3 -0
  139. package/src/tools/bash/bash.ts +3 -0
  140. package/src/tools/capabilities.js +1 -0
  141. package/src/tools/capabilities.ts +1 -0
  142. package/src/tools/download/download.js +147 -11
  143. package/src/tools/download/download.ts +193 -17
  144. package/src/tools/edit/edit.js +4 -4
  145. package/src/tools/edit/edit.ts +4 -4
  146. package/src/tools/edit/multi-edit.js +2 -2
  147. package/src/tools/edit/multi-edit.ts +2 -2
  148. package/src/tools/index.js +2 -0
  149. package/src/tools/index.ts +2 -0
  150. package/src/tools/powershell/powershell.js +2 -0
  151. package/src/tools/powershell/powershell.ts +2 -0
  152. package/src/tools/schedule/schedule.js +184 -0
  153. package/src/tools/schedule/schedule.ts +214 -0
  154. package/src/tools/shared/fileUtils.js +16 -6
  155. package/src/tools/shared/fileUtils.ts +15 -6
  156. package/src/tools/tasks/backgroundTaskService.js +108 -12
  157. package/src/tools/tasks/backgroundTaskService.ts +106 -14
  158. package/src/tools/tasks/taskOutput.js +15 -5
  159. package/src/tools/tasks/taskOutput.ts +13 -5
  160. package/src/tools/tasks/taskStop.js +2 -2
  161. package/src/tools/tasks/taskStop.ts +2 -2
  162. package/src/tools/toolPromptGuides.js +4 -3
  163. package/src/tools/toolPromptGuides.ts +4 -3
  164. package/src/tools/webfetch/webfetch.js +1 -1
  165. package/src/tools/webfetch/webfetch.ts +1 -1
  166. package/src/types.ts +6 -0
  167. package/src/ui/App.js +3 -1
  168. package/src/ui/App.tsx +2 -0
  169. package/src/ui/InputBox.js +2 -2
  170. package/src/ui/InputBox.tsx +2 -2
  171. package/src/ui/LiveArea.js +6 -1
  172. package/src/ui/LiveArea.tsx +6 -1
  173. package/src/ui/MessageList.js +2 -0
  174. package/src/ui/MessageList.tsx +2 -0
  175. package/src/ui/README.md +8 -2
  176. package/src/ui/activityPresentation.js +23 -3
  177. package/src/ui/activityPresentation.ts +22 -3
  178. package/src/ui/backgroundWake.js +20 -4
  179. package/src/ui/backgroundWake.ts +19 -4
  180. package/src/ui/commandTranscript.js +2 -69
  181. package/src/ui/commandTranscript.ts +2 -71
  182. package/src/ui/hooks/useBackgroundAgents.js +33 -0
  183. package/src/ui/hooks/useBackgroundAgents.ts +36 -0
  184. package/src/ui/hooks/useChat.js +46 -25
  185. package/src/ui/hooks/useChat.ts +36 -23
  186. package/src/web/protocol.ts +5 -2
  187. package/src/cli/wizards/advisorWizard.js +0 -152
  188. package/src/cli/wizards/advisorWizard.tsx +0 -203
@@ -1,8 +1,10 @@
1
- import { appendFile, mkdir, readFile, readdir, stat } from 'node:fs/promises';
1
+ import { appendFile, mkdir, readFile, readdir, stat, copyFile, writeFile, rename, } from 'node:fs/promises';
2
+ import { randomUUID } from 'node:crypto';
2
3
  import { dirname, join } from 'node:path';
3
4
  import { withStoreLock } from './lock.js';
4
5
  /** A damaged line must not hide all other runs. Preserve the file and report its location. */
5
6
  const cache = new Map();
7
+ const folded = new WeakMap();
6
8
  async function records(file) {
7
9
  let raw;
8
10
  let key;
@@ -44,12 +46,53 @@ async function append(file, record) {
44
46
  });
45
47
  }
46
48
  export async function appendRun(runsDir, record) {
47
- await append(join(runsDir, `${record.taskId}.jsonl`), record);
49
+ const file = join(runsDir, `${record.taskId}.jsonl`);
50
+ await append(file, record);
51
+ if (record.status !== 'queued' &&
52
+ record.status !== 'running' &&
53
+ (await stat(file)).size > 4 * 1024 * 1024)
54
+ await compactRunLog(runsDir, record.taskId);
48
55
  }
49
- export async function recentRuns(runsDir, taskId, limit = 5) {
56
+ /** Preserve the full raw journal before compacting old terminal payloads. IDs,
57
+ * counters and plan identities stay hot for durable deduplication/recovery. */
58
+ export async function compactRunLog(runsDir, taskId) {
59
+ await withStoreLock(runsDir, async () => {
60
+ const all = await recentRuns(runsDir, taskId, Infinity);
61
+ const old = all
62
+ .filter((r) => !['queued', 'running'].includes(r.status))
63
+ .slice(100);
64
+ if (!old.some((r) => r.result !== undefined || r.snapshot !== undefined))
65
+ return;
66
+ const file = join(runsDir, `${taskId}.jsonl`);
67
+ const archive = join(runsDir, 'archive', `${taskId}-${randomUUID()}.jsonl`);
68
+ await mkdir(dirname(archive), { recursive: true });
69
+ await copyFile(file, archive);
70
+ const ids = new Set(old.map((r) => r.id));
71
+ const rows = all.map((r) => {
72
+ if (!ids.has(r.id))
73
+ return r;
74
+ const { result, snapshot, ...rest } = r;
75
+ return {
76
+ ...rest,
77
+ planId: r.planId ?? snapshot?.planId,
78
+ archiveFile: r.archiveFile ?? archive,
79
+ };
80
+ });
81
+ const tmp = `${file}.${randomUUID()}.tmp`;
82
+ await writeFile(tmp, rows.map((r) => JSON.stringify(r)).join('\n') + '\n');
83
+ await rename(tmp, file);
84
+ });
85
+ }
86
+ export async function recentRuns(runsDir, taskId, limit = 5, activeOnly = false) {
87
+ const rows = await records(join(runsDir, `${taskId}.jsonl`));
88
+ const prior = folded.get(rows);
89
+ if (prior)
90
+ return (activeOnly ? prior.active : prior.all)
91
+ .slice(0, limit)
92
+ .map((r) => ({ ...r }));
50
93
  const byId = new Map();
51
94
  const reads = new Map();
52
- for (const record of await records(join(runsDir, `${taskId}.jsonl`))) {
95
+ for (const record of rows) {
53
96
  if (!record || typeof record.id !== 'string')
54
97
  continue;
55
98
  if (record.event === 'read') {
@@ -69,10 +112,14 @@ export async function recentRuns(runsDir, taskId, limit = 5) {
69
112
  }
70
113
  byId.set(record.id, { ...byId.get(record.id), ...record });
71
114
  }
72
- return [...byId.values()]
73
- .map((record) => (reads.has(record.id) ? { ...record, readAt: reads.get(record.id) } : record))
74
- .sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt))
75
- .slice(0, limit);
115
+ const all = [...byId.values()]
116
+ .map((record) => reads.has(record.id)
117
+ ? { ...record, readAt: reads.get(record.id) }
118
+ : record)
119
+ .sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
120
+ const active = all.filter((r) => r.status === 'queued' || r.status === 'running');
121
+ folded.set(rows, { all, active });
122
+ return (activeOnly ? active : all).slice(0, limit).map((r) => ({ ...r }));
76
123
  }
77
124
  export async function markRunsRead(runsDir, taskId) {
78
125
  const ids = taskId ? [taskId] : await listRunTaskIds(runsDir);
@@ -90,7 +137,9 @@ export async function markRunsRead(runsDir, taskId) {
90
137
  }
91
138
  export async function listRunTaskIds(runsDir) {
92
139
  try {
93
- return (await readdir(runsDir)).filter((n) => n.endsWith('.jsonl')).map((n) => n.slice(0, -6));
140
+ return (await readdir(runsDir))
141
+ .filter((n) => n.endsWith('.jsonl'))
142
+ .map((n) => n.slice(0, -6));
94
143
  }
95
144
  catch (error) {
96
145
  if (error.code === 'ENOENT')
@@ -127,6 +176,10 @@ export async function listMissed(file, limit = 20) {
127
176
  export async function markMissedRead(file, taskId) {
128
177
  for (const record of await listMissed(file, Infinity))
129
178
  if (!record.readAt && (!taskId || record.taskId === taskId)) {
130
- await append(file, { event: 'read', id: record.id, readAt: new Date().toISOString() });
179
+ await append(file, {
180
+ event: 'read',
181
+ id: record.id,
182
+ readAt: new Date().toISOString(),
183
+ });
131
184
  }
132
185
  }
@@ -1,10 +1,24 @@
1
- import { appendFile, mkdir, readFile, readdir, stat } from 'node:fs/promises';
1
+ import {
2
+ appendFile,
3
+ mkdir,
4
+ readFile,
5
+ readdir,
6
+ stat,
7
+ copyFile,
8
+ writeFile,
9
+ rename,
10
+ } from 'node:fs/promises';
11
+ import { randomUUID } from 'node:crypto';
2
12
  import { dirname, join } from 'node:path';
3
13
  import type { CronMissedRecord, CronRunRecord } from './types.js';
4
14
  import { withStoreLock } from './lock.js';
5
15
 
6
16
  /** A damaged line must not hide all other runs. Preserve the file and report its location. */
7
17
  const cache = new Map<string, { key: string; rows: any[] }>();
18
+ const folded = new WeakMap<
19
+ object,
20
+ { all: CronRunRecord[]; active: CronRunRecord[] }
21
+ >();
8
22
  async function records(file: string): Promise<any[]> {
9
23
  let raw: string;
10
24
  let key: string;
@@ -25,7 +39,9 @@ async function records(file: string): Promise<any[]> {
25
39
  try {
26
40
  return [JSON.parse(line)];
27
41
  } catch {
28
- console.error(`[cron-runner] 损坏的日志行,保留原件:${file}:${index + 1}`);
42
+ console.error(
43
+ `[cron-runner] 损坏的日志行,保留原件:${file}:${index + 1}`,
44
+ );
29
45
  return [];
30
46
  }
31
47
  });
@@ -42,17 +58,67 @@ async function append(file: string, record: unknown): Promise<void> {
42
58
  });
43
59
  }
44
60
 
45
- export async function appendRun(runsDir: string, record: CronRunRecord): Promise<void> {
46
- await append(join(runsDir, `${record.taskId}.jsonl`), record);
61
+ export async function appendRun(
62
+ runsDir: string,
63
+ record: CronRunRecord,
64
+ ): Promise<void> {
65
+ const file = join(runsDir, `${record.taskId}.jsonl`);
66
+ await append(file, record);
67
+ if (
68
+ record.status !== 'queued' &&
69
+ record.status !== 'running' &&
70
+ (await stat(file)).size > 4 * 1024 * 1024
71
+ )
72
+ await compactRunLog(runsDir, record.taskId);
73
+ }
74
+
75
+ /** Preserve the full raw journal before compacting old terminal payloads. IDs,
76
+ * counters and plan identities stay hot for durable deduplication/recovery. */
77
+ export async function compactRunLog(
78
+ runsDir: string,
79
+ taskId: string,
80
+ ): Promise<void> {
81
+ await withStoreLock(runsDir, async () => {
82
+ const all = await recentRuns(runsDir, taskId, Infinity);
83
+ const old = all
84
+ .filter((r) => !['queued', 'running'].includes(r.status))
85
+ .slice(100);
86
+ if (!old.some((r) => r.result !== undefined || r.snapshot !== undefined))
87
+ return;
88
+ const file = join(runsDir, `${taskId}.jsonl`);
89
+ const archive = join(runsDir, 'archive', `${taskId}-${randomUUID()}.jsonl`);
90
+ await mkdir(dirname(archive), { recursive: true });
91
+ await copyFile(file, archive);
92
+ const ids = new Set(old.map((r) => r.id));
93
+ const rows = all.map((r) => {
94
+ if (!ids.has(r.id)) return r;
95
+ const { result, snapshot, ...rest } = r;
96
+ return {
97
+ ...rest,
98
+ planId: r.planId ?? snapshot?.planId,
99
+ archiveFile: r.archiveFile ?? archive,
100
+ };
101
+ });
102
+ const tmp = `${file}.${randomUUID()}.tmp`;
103
+ await writeFile(tmp, rows.map((r) => JSON.stringify(r)).join('\n') + '\n');
104
+ await rename(tmp, file);
105
+ });
47
106
  }
48
107
  export async function recentRuns(
49
108
  runsDir: string,
50
109
  taskId: string,
51
110
  limit = 5,
111
+ activeOnly = false,
52
112
  ): Promise<CronRunRecord[]> {
113
+ const rows = await records(join(runsDir, `${taskId}.jsonl`));
114
+ const prior = folded.get(rows);
115
+ if (prior)
116
+ return (activeOnly ? prior.active : prior.all)
117
+ .slice(0, limit)
118
+ .map((r) => ({ ...r }));
53
119
  const byId = new Map<string, CronRunRecord>();
54
120
  const reads = new Map<string, string>();
55
- for (const record of await records(join(runsDir, `${taskId}.jsonl`))) {
121
+ for (const record of rows) {
56
122
  if (!record || typeof record.id !== 'string') continue;
57
123
  if (record.event === 'read') {
58
124
  reads.set(record.id, record.readAt);
@@ -71,12 +137,23 @@ export async function recentRuns(
71
137
  }
72
138
  byId.set(record.id, { ...byId.get(record.id), ...record });
73
139
  }
74
- return [...byId.values()]
75
- .map((record) => (reads.has(record.id) ? { ...record, readAt: reads.get(record.id) } : record))
76
- .sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt))
77
- .slice(0, limit);
140
+ const all = [...byId.values()]
141
+ .map((record) =>
142
+ reads.has(record.id)
143
+ ? { ...record, readAt: reads.get(record.id) }
144
+ : record,
145
+ )
146
+ .sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
147
+ const active = all.filter(
148
+ (r) => r.status === 'queued' || r.status === 'running',
149
+ );
150
+ folded.set(rows, { all, active });
151
+ return (activeOnly ? active : all).slice(0, limit).map((r) => ({ ...r }));
78
152
  }
79
- export async function markRunsRead(runsDir: string, taskId?: string): Promise<void> {
153
+ export async function markRunsRead(
154
+ runsDir: string,
155
+ taskId?: string,
156
+ ): Promise<void> {
80
157
  const ids = taskId ? [taskId] : await listRunTaskIds(runsDir);
81
158
  for (const id of ids)
82
159
  for (const run of await recentRuns(runsDir, id, Infinity)) {
@@ -92,16 +169,24 @@ export async function markRunsRead(runsDir: string, taskId?: string): Promise<vo
92
169
  }
93
170
  export async function listRunTaskIds(runsDir: string): Promise<string[]> {
94
171
  try {
95
- return (await readdir(runsDir)).filter((n) => n.endsWith('.jsonl')).map((n) => n.slice(0, -6));
172
+ return (await readdir(runsDir))
173
+ .filter((n) => n.endsWith('.jsonl'))
174
+ .map((n) => n.slice(0, -6));
96
175
  } catch (error) {
97
176
  if ((error as NodeJS.ErrnoException).code === 'ENOENT') return [];
98
177
  throw error;
99
178
  }
100
179
  }
101
- export async function appendMissed(file: string, record: CronMissedRecord): Promise<void> {
180
+ export async function appendMissed(
181
+ file: string,
182
+ record: CronMissedRecord,
183
+ ): Promise<void> {
102
184
  await append(file, record);
103
185
  }
104
- export async function listMissed(file: string, limit = 20): Promise<CronMissedRecord[]> {
186
+ export async function listMissed(
187
+ file: string,
188
+ limit = 20,
189
+ ): Promise<CronMissedRecord[]> {
105
190
  const bySlot = new Map<string, CronMissedRecord>();
106
191
  const reads = new Set<string>();
107
192
  for (const parsed of await records(file)) {
@@ -122,9 +207,16 @@ export async function listMissed(file: string, limit = 20): Promise<CronMissedRe
122
207
  .sort((a, b) => Date.parse(b.detectedAt) - Date.parse(a.detectedAt))
123
208
  .slice(0, limit);
124
209
  }
125
- export async function markMissedRead(file: string, taskId?: string): Promise<void> {
210
+ export async function markMissedRead(
211
+ file: string,
212
+ taskId?: string,
213
+ ): Promise<void> {
126
214
  for (const record of await listMissed(file, Infinity))
127
215
  if (!record.readAt && (!taskId || record.taskId === taskId)) {
128
- await append(file, { event: 'read', id: record.id, readAt: new Date().toISOString() });
216
+ await append(file, {
217
+ event: 'read',
218
+ id: record.id,
219
+ readAt: new Date().toISOString(),
220
+ });
129
221
  }
130
222
  }