personal-bot 0.3.7 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +5 -8
  4. package/README.zh-CN.md +5 -8
  5. package/bin/pbot-pi-acp.mjs +1 -1
  6. package/docs/architecture/design.md +2 -2
  7. package/docs/architecture/extensibility.md +1 -1
  8. package/docs/guides/cross-harness-workers.md +4 -4
  9. package/docs/guides/history.md +1 -3
  10. package/docs/guides/workspace-configuration.md +4 -4
  11. package/docs/hosts/claude-code.md +2 -2
  12. package/docs/hosts/codex-qoder.md +1 -1
  13. package/lib/antigravity-plugin/bin/pbot-pi-acp.mjs +1 -1
  14. package/lib/antigravity-plugin/lib/extension/acp/member.d.ts +1 -1
  15. package/lib/antigravity-plugin/lib/extension/acp/member.js +11 -10
  16. package/lib/antigravity-plugin/lib/extension/acp-worker.js +346 -201
  17. package/lib/antigravity-plugin/lib/extension/cli.js +563 -538
  18. package/lib/antigravity-plugin/lib/extension/hosts/dsh/acp-member.js +1 -1
  19. package/lib/antigravity-plugin/lib/extension/hosts/pi/acp-member.js +3 -4
  20. package/lib/antigravity-plugin/lib/extension/hosts/plugin-runtime.js +0 -11
  21. package/lib/antigravity-plugin/lib/extension/mcp.js +397 -278
  22. package/lib/antigravity-plugin/lib/model/acp.d.ts +29 -35
  23. package/lib/antigravity-plugin/lib/model/agent.d.ts +33 -17
  24. package/lib/antigravity-plugin/lib/model/agent.js +0 -1
  25. package/lib/antigravity-plugin/lib/storage/acp-files.d.ts +5 -8
  26. package/lib/antigravity-plugin/lib/storage/acp-files.js +34 -40
  27. package/lib/antigravity-plugin/lib/storage/agent-files.d.ts +19 -10
  28. package/lib/antigravity-plugin/lib/storage/agent-files.js +147 -43
  29. package/lib/antigravity-plugin/package.json +1 -1
  30. package/lib/antigravity-plugin/plugin.json +1 -1
  31. package/lib/codex-marketplace/plugins/personal-bot/.codex-plugin/plugin.json +1 -1
  32. package/lib/codex-marketplace/plugins/personal-bot/.mcp.json +2 -2
  33. package/lib/codex-marketplace/plugins/personal-bot/hooks/hooks.json +3 -3
  34. package/lib/codex-marketplace/plugins/personal-bot/skills/pbot/SKILL.md +1 -1
  35. package/lib/extension/acp/member.d.ts +1 -1
  36. package/lib/extension/acp/member.js +11 -10
  37. package/lib/extension/acp/worker.js +34 -33
  38. package/lib/extension/acp-worker.js +346 -201
  39. package/lib/extension/cli.js +563 -538
  40. package/lib/extension/hosts/dsh/acp-member.js +1 -1
  41. package/lib/extension/hosts/dsh/command.js +1 -1
  42. package/lib/extension/hosts/dsh/workspace.js +1 -3
  43. package/lib/extension/hosts/pi/acp-member.js +3 -4
  44. package/lib/extension/hosts/plugin-runtime.js +0 -11
  45. package/lib/extension/mcp/tool-contract.d.ts +8 -50
  46. package/lib/extension/mcp/tool-contract.js +0 -8
  47. package/lib/extension/mcp/workers.d.ts +7 -27
  48. package/lib/extension/mcp/workers.js +35 -17
  49. package/lib/extension/mcp.js +397 -278
  50. package/lib/integrations/acp/agents.d.ts +2 -3
  51. package/lib/integrations/acp/agents.js +22 -22
  52. package/lib/integrations/acp/harnesses/claude.js +1 -1
  53. package/lib/model/acp.d.ts +29 -35
  54. package/lib/model/agent.d.ts +33 -17
  55. package/lib/model/agent.js +0 -1
  56. package/lib/qoder-plugin/.mcp.json +2 -2
  57. package/lib/qoder-plugin/.qoder-plugin/plugin.json +1 -1
  58. package/lib/qoder-plugin/hooks/hooks.json +3 -3
  59. package/lib/qoder-plugin/skills/pbot/SKILL.md +1 -1
  60. package/lib/services/agents/acp-run.d.ts +6 -4
  61. package/lib/services/agents/acp-run.js +62 -43
  62. package/lib/services/agents/agent-run.d.ts +10 -6
  63. package/lib/services/agents/agent-run.js +142 -65
  64. package/lib/services/agents/agent-service.d.ts +3 -21
  65. package/lib/services/agents/agent-service.js +180 -126
  66. package/lib/storage/acp-files.d.ts +5 -8
  67. package/lib/storage/acp-files.js +34 -40
  68. package/lib/storage/agent-files.d.ts +19 -10
  69. package/lib/storage/agent-files.js +147 -43
  70. package/package.json +1 -1
  71. package/src/extension/acp/member.ts +14 -11
  72. package/src/extension/acp/worker.ts +31 -28
  73. package/src/extension/cli/commands/upgrade.ts +8 -36
  74. package/src/extension/cli/commands/workspace.ts +3 -8
  75. package/src/extension/cli/index.ts +1 -2
  76. package/src/extension/hosts/dsh/acp-member.ts +1 -1
  77. package/src/extension/hosts/dsh/command.ts +1 -1
  78. package/src/extension/hosts/dsh/workspace.ts +1 -3
  79. package/src/extension/hosts/pi/acp-member.ts +3 -4
  80. package/src/extension/hosts/pi/command.ts +1 -1
  81. package/src/extension/hosts/pi/lifecycle.ts +0 -2
  82. package/src/extension/hosts/plugin-runtime.ts +0 -10
  83. package/src/extension/mcp/tool-contract.ts +0 -8
  84. package/src/extension/mcp/workers.ts +34 -17
  85. package/src/integrations/acp/agents.ts +28 -27
  86. package/src/integrations/acp/harnesses/claude.ts +1 -1
  87. package/src/integrations/hosts/dsh/session.ts +2 -2
  88. package/src/integrations/installation/cli-update.ts +2 -2
  89. package/src/integrations/installation/installers/claude.ts +4 -4
  90. package/src/integrations/installation/installers/qoder.ts +5 -5
  91. package/src/integrations/installation/upgraders/antigravity.ts +57 -15
  92. package/src/integrations/installation/upgraders/claude.ts +1 -4
  93. package/src/integrations/installation/upgraders/codex.ts +85 -15
  94. package/src/integrations/installation/upgraders/dsh.ts +46 -24
  95. package/src/integrations/installation/upgraders/pi.ts +18 -11
  96. package/src/integrations/installation/upgraders/qoder.ts +95 -20
  97. package/src/model/acp.ts +27 -29
  98. package/src/model/agent.ts +80 -16
  99. package/src/model/installation.ts +0 -2
  100. package/src/pbot.ts +1 -1
  101. package/src/services/agents/acp-run.ts +81 -49
  102. package/src/services/agents/agent-run.ts +154 -56
  103. package/src/services/agents/agent-service.ts +204 -133
  104. package/src/services/installation/upgrade-service.ts +1 -5
  105. package/src/storage/acp-files.ts +50 -45
  106. package/src/storage/agent-files.ts +159 -46
  107. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.d.ts +0 -15
  108. package/lib/antigravity-plugin/lib/services/workspace/plugin-releases.js +0 -126
  109. package/lib/services/workspace/plugin-releases.d.ts +0 -15
  110. package/lib/services/workspace/plugin-releases.js +0 -126
  111. package/src/services/workspace/plugin-releases.ts +0 -121
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "personal-bot",
3
3
  "displayName": "Personal Bot",
4
- "version": "0.3.7",
4
+ "version": "0.4.0",
5
5
  "description": "Workspace materials, skills, and cross-harness MCP worker delegation.",
6
6
  "repository": "https://github.com/realqiyan/personal-bot"
7
7
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "personal-bot",
3
- "version": "0.3.7",
3
+ "version": "0.4.0",
4
4
  "description": "Personal Bot workspace context and cross-harness workers.",
5
5
  "skills": "./skills/",
6
6
  "mcpServers": "./.mcp.json"
@@ -4,13 +4,13 @@
4
4
  "command": "sh",
5
5
  "args": [
6
6
  "-c",
7
- "if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.7 \"$@\"",
7
+ "if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.4.0 \"$@\"",
8
8
  "pbot",
9
9
  "mcp"
10
10
  ],
11
11
  "env": {
12
12
  "PBOT_HOST": "codex",
13
- "PBOT_PLUGIN_VERSION": "0.3.7"
13
+ "PBOT_PLUGIN_VERSION": "0.4.0"
14
14
  }
15
15
  }
16
16
  }
@@ -5,7 +5,7 @@
5
5
  "hooks": [
6
6
  {
7
7
  "type": "command",
8
- "command": "PBOT_PLUGIN_VERSION=0.3.7 PBOT_PLUGIN_MANIFEST=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.7 \"$@\"' pbot plugin codex hook",
8
+ "command": "PBOT_PLUGIN_VERSION=0.4.0 sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.4.0 \"$@\"' pbot plugin codex hook",
9
9
  "timeout": 120
10
10
  }
11
11
  ]
@@ -16,7 +16,7 @@
16
16
  "hooks": [
17
17
  {
18
18
  "type": "command",
19
- "command": "PBOT_PLUGIN_VERSION=0.3.7 PBOT_PLUGIN_MANIFEST=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.7 \"$@\"' pbot plugin codex hook",
19
+ "command": "PBOT_PLUGIN_VERSION=0.4.0 sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.4.0 \"$@\"' pbot plugin codex hook",
20
20
  "timeout": 120
21
21
  }
22
22
  ]
@@ -27,7 +27,7 @@
27
27
  "hooks": [
28
28
  {
29
29
  "type": "command",
30
- "command": "PBOT_PLUGIN_VERSION=0.3.7 PBOT_PLUGIN_MANIFEST=\"${PLUGIN_ROOT:+$PLUGIN_ROOT/.codex-plugin/plugin.json}\" sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.3.7 \"$@\"' pbot plugin codex hook",
30
+ "command": "PBOT_PLUGIN_VERSION=0.4.0 sh -c 'if pbot --at-least 0.3.3 </dev/null >/dev/null 2>&1; then exec pbot \"$@\"; fi\nexec npx --yes --ignore-scripts --prefer-offline personal-bot@0.4.0 \"$@\"' pbot plugin codex hook",
31
31
  "timeout": 120
32
32
  }
33
33
  ]
@@ -6,4 +6,4 @@ disable-model-invocation: true
6
6
 
7
7
  `--workspace` 传入当前会话的 `workspaceRoot`(工作区未启用时使用当前工作区根目录)。省略子命令时使用 `status`。可执行 `init`、`status`、`history status|list|summary|migrate|search|read`,保留用户指定的维度、模型和筛选参数。
8
8
 
9
- 若 `pbot --at-least 0.3.7` 返回 0,运行 `pbot <子命令> --workspace "<workspaceRoot>"`;否则运行 `npx --yes personal-bot@0.3.7 <子命令> --workspace "<workspaceRoot>"`。返回实际结果。
9
+ 若 `pbot --at-least 0.4.0` 返回 0,运行 `pbot <子命令> --workspace "<workspaceRoot>"`;否则运行 `npx --yes personal-bot@0.4.0 <子命令> --workspace "<workspaceRoot>"`。返回实际结果。
@@ -1,5 +1,5 @@
1
1
  import { AgentFiles } from "../../storage/agent-files.js";
2
- import type { AcpInput, AcpAnswer } from "../../model/acp.js";
2
+ import type { AcpAnswer, AcpInput } from "../../model/acp.js";
3
3
  export declare function acpMember(): Promise<{
4
4
  files: AgentFiles;
5
5
  d: import("../../model/agent.js").AgentDescriptor;
@@ -1,7 +1,7 @@
1
1
  import { dirname } from "node:path";
2
2
  import { realpathSync } from "node:fs";
3
- import { AgentFiles, descriptor, launch } from "../../storage/agent-files.js";
4
- import { acpInput, acpAnswer } from "../../storage/acp-files.js";
3
+ import { AgentFiles, status, toDescriptor } from "../../storage/agent-files.js";
4
+ import { acpAnswer } from "../../storage/acp-files.js";
5
5
  import { requireThat } from "../../common/validation.js";
6
6
  import { packageVersion, releaseLine } from "../../common/version.js";
7
7
  import { loadWorkspaceContext } from "../../integrations/agent-resources.js";
@@ -11,15 +11,15 @@ export async function acpMember() {
11
11
  requireThat(id && directory && generation, "缺少 ACP 成员启动身份。");
12
12
  const files = new AgentFiles(dirname(realpathSync(directory)));
13
13
  requireThat(files.directory(id) === realpathSync(directory), "ACP 成员目录不匹配。");
14
- const d = files.read(id, "descriptor.json", descriptor);
14
+ const d = toDescriptor(files.worker(id));
15
15
  requireThat(d.agentId === id && releaseLine(d.release) === releaseLine(packageVersion), "ACP 成员身份或版本无效。");
16
16
  const configuration = await readWorkspaceConfig(d.workspace);
17
17
  requireThat(configuration.enabled, workspaceDisabledMessage(configuration));
18
18
  const features = workspaceFeatures(configuration);
19
19
  const check = () => {
20
20
  files.check();
21
- const run = files.read(id, "launch.json", launch);
22
- requireThat(run.generation === generation && (!run.stop || process.env.PBOT_ACP_VALIDATE === "1"), "ACP 成员已停止或启动代次变化。");
21
+ const w = files.worker(id);
22
+ requireThat(w.generation === generation && (!w.stop || process.env.PBOT_ACP_VALIDATE === "1"), "ACP 成员已停止或启动代次变化。");
23
23
  };
24
24
  const context = async () => {
25
25
  const reference = files.reference(id);
@@ -27,16 +27,17 @@ export async function acpMember() {
27
27
  const loaded = await loadWorkspaceContext({ host, root: d.workspace, role: "general-purpose" });
28
28
  return { workspace: loaded.workspace, role: loaded.role, environment: JSON.stringify(loaded.environment) };
29
29
  };
30
- return { files, d, id, generation, configuration, features, check, context,
30
+ return {
31
+ files, d, id, generation, configuration, features, check, context,
31
32
  input() {
32
33
  check();
33
- const input = files.read(id, "acp-input.json", acpInput);
34
- requireThat(input.generation === generation, "ACP 输入代次无效。");
35
- return input;
34
+ const saved = files.read(id, "state.json", status);
35
+ requireThat(saved.generation === generation && typeof saved.activeRequestId === "string" && saved.activeRequestId.length > 0, "ACP 输入代次无效。");
36
+ return { generation, requestId: saved.activeRequestId };
36
37
  },
37
38
  answer(input, state, answer, error) {
38
39
  // A stop can race the native terminal event. The current generation may still seal its result.
39
- if (files.read(id, "launch.json", launch).generation !== generation)
40
+ if (files.worker(id).generation !== generation)
40
41
  return;
41
42
  files.write(id, "acp-answer.json", { ...input, state, answer, ...(error ? { error } : {}) }, acpAnswer);
42
43
  },
@@ -1,8 +1,9 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { dirname, join, resolve } from "node:path";
3
- import { AgentFiles, descriptor, launch, status } from "../../storage/agent-files.js";
4
- import { acpModelState, acpReference } from "../../storage/acp-files.js";
3
+ import { AgentFiles, status, toDescriptor } from "../../storage/agent-files.js";
4
+ import { acpReference } from "../../storage/acp-files.js";
5
5
  import { AcpAgentRun } from "../../services/agents/acp-run.js";
6
+ import { AgentRun } from "../../services/agents/agent-run.js";
6
7
  import { openAcp } from "../../integrations/acp/connection.js";
7
8
  import { acpExecutable } from "../../integrations/acp/executable.js";
8
9
  import { acpContent } from "../../integrations/acp/input.js";
@@ -93,16 +94,17 @@ async function runWorker(args) {
93
94
  requireThat(directory && id && generation, "缺少 ACP worker 启动信息。");
94
95
  const files = new AgentFiles(dirname(directory));
95
96
  requireThat(files.directory(id) === directory, "ACP worker 目录不匹配。");
96
- const d = files.read(id, "descriptor.json", descriptor), reference = files.read(id, "acp-session.json", acpReference);
97
+ const d = toDescriptor(files.worker(id)), reference = files.reference(id);
97
98
  requireThat(d.agentId === id && releaseLine(d.release) === releaseLine(packageVersion), "ACP worker 身份或版本不匹配。");
98
99
  const validating = args.includes("--validate"), lifetime = new AbortController();
100
+ const agentRun = validating ? undefined : new AgentRun(files, id, generation);
99
101
  let execution;
100
102
  const stop = () => { void execution?.stop().catch(error => lifetime.abort(error)); if (!execution)
101
103
  lifetime.abort(); };
102
104
  process.on("SIGTERM", stop);
103
105
  process.on("SIGINT", stop);
104
106
  async function main() {
105
- requireThat(files.read(id, "launch.json", launch).generation === generation, "ACP worker 启动代次已失效。");
107
+ requireThat(files.worker(id).generation === generation, "ACP worker 启动代次已失效。");
106
108
  const harness = resolveAcpHarness(reference.backend);
107
109
  const exactAnswer = Boolean(harness.exactAnswer);
108
110
  const packageRoot = resolve(resourceRoot, "..");
@@ -116,7 +118,7 @@ async function runWorker(args) {
116
118
  ...(validating ? { PBOT_ACP_VALIDATE: "1" } : {}),
117
119
  };
118
120
  const prepared = harness.prepareLaunch
119
- ? await harness.prepareLaunch({ reference, cwd: d.cwd, directory: directory, packageRoot, options: d.options, env: baseEnv, features })
121
+ ? await harness.prepareLaunch({ reference, workspace: d.workspace, directory: directory, packageRoot, options: d.options, env: baseEnv, features })
120
122
  : { command: { ...reference, args: [...reference.args] }, env: { ...baseEnv, ...(reference.env ?? {}) } };
121
123
  let prompt;
122
124
  if (!exactAnswer) {
@@ -142,16 +144,16 @@ async function runWorker(args) {
142
144
  mcpServers = toAcpMcpServers(resolved);
143
145
  }
144
146
  }
145
- // Only publish acp-model.json after requested model/thinking options are applied so callers can detect startup readiness.
147
+ // Only publish selection after requested model/thinking options are applied so callers can detect startup readiness.
146
148
  let configured = false;
147
149
  const saveSelection = (selection) => {
148
- if (validating || !configured)
150
+ if (validating || !configured || !agentRun)
149
151
  return;
150
- const run = files.read(id, "launch.json", launch);
151
- if (run.generation === generation && !run.stop)
152
- files.write(id, "acp-model.json", { generation, ...selection }, acpModelState);
152
+ const w = files.worker(id);
153
+ if (w.generation === generation && !w.stop)
154
+ agentRun.setSelection(selection);
153
155
  };
154
- const connection = await openAcp(prepared.command, d.cwd, prepared.env, {
156
+ const connection = await openAcp(prepared.command, d.workspace, prepared.env, {
155
157
  selection: saveSelection,
156
158
  update(update) {
157
159
  if (update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
@@ -210,12 +212,10 @@ async function runWorker(args) {
210
212
  }
211
213
  if (reference.sessionId === null)
212
214
  await connection.configure(d.options);
213
- requireThat(files.read(id, "launch.json", launch).generation === generation && !files.read(id, "launch.json", launch).stop, "ACP 启动已取消。");
214
- files.write(id, "acp-session.json", {
215
- ...reference,
216
- sessionId: harness.eagerSessionId || reference.sessionId !== null ? connection.sessionId : null,
217
- capabilities: connection.capabilities,
218
- }, acpReference);
215
+ const currentWorker = files.worker(id);
216
+ requireThat(currentWorker.generation === generation && !currentWorker.stop, "ACP 启动已取消。");
217
+ let sessionId = harness.eagerSessionId || reference.sessionId !== null ? connection.sessionId : null;
218
+ agentRun.setSession(sessionId, connection.capabilities);
219
219
  configured = true;
220
220
  saveSelection(connection.selection());
221
221
  let promptInjected = reference.sessionId !== null || connection.systemPrompt;
@@ -227,16 +227,17 @@ async function runWorker(args) {
227
227
  : request;
228
228
  promptInjected = true;
229
229
  const content = await acpContent(effective, connection.images, connection.signal);
230
- const run = files.read(id, "launch.json", launch);
231
- requireThat(run.generation === generation && !run.stop, "ACP 输入已取消或启动代次变化。");
230
+ const w = files.worker(id);
231
+ requireThat(w.generation === generation && !w.stop, "ACP 输入已取消或启动代次变化。");
232
232
  connection.signal.throwIfAborted();
233
- const saved = files.read(id, "acp-session.json", acpReference);
234
- if (saved.sessionId === null)
235
- files.write(id, "acp-session.json", { ...saved, sessionId: connection.sessionId }, acpReference);
233
+ if (sessionId === null) {
234
+ sessionId = connection.sessionId;
235
+ agentRun.setSession(sessionId, connection.capabilities);
236
+ }
236
237
  return connection.prompt(content);
237
238
  },
238
239
  cancel: () => connection.cancel(),
239
- }, exactAnswer);
240
+ }, exactAnswer, agentRun);
240
241
  await execution.run();
241
242
  }
242
243
  finally {
@@ -250,24 +251,24 @@ async function runWorker(args) {
250
251
  }
251
252
  try {
252
253
  await main();
253
- if (!validating && files.read(id, "launch.json", launch).generation === generation) {
254
- if (execution)
255
- execution.execution.save({ state: "stopped", activity: "已停止" });
256
- else
257
- files.write(id, "status.json", { generation, state: "stopped", activity: "已停止", updatedAt: Date.now() }, status);
254
+ if (!validating && files.worker(id).generation === generation) {
255
+ agentRun.save({ state: "stopped", activity: "已停止" });
256
+ files.clearTransient(id);
258
257
  }
259
258
  }
260
259
  catch (error) {
261
260
  if (validating) {
262
261
  await sendIpc({ type: "error", error: errorMessage(error) });
263
262
  }
264
- else if (files.read(id, "launch.json", launch).generation === generation) {
265
- const stopped = files.read(id, "launch.json", launch).stop;
263
+ else if (files.worker(id).generation === generation) {
264
+ const stopped = files.worker(id).stop;
266
265
  const patch = { state: stopped ? "stopped" : "error", activity: stopped ? "已停止" : "ACP 执行失败", ...(stopped ? {} : { error: errorMessage(error) }) };
267
- if (execution)
268
- execution.execution.save(patch);
266
+ if (agentRun)
267
+ agentRun.save(patch);
269
268
  else
270
- files.write(id, "status.json", { generation, ...patch, updatedAt: Date.now() }, status);
269
+ files.write(id, "state.json", { generation, ...patch, updatedAt: Date.now() }, status);
270
+ if (stopped)
271
+ files.clearTransient(id);
271
272
  }
272
273
  process.exitCode = 1;
273
274
  }