@keyou007/agent-bot 0.1.11 → 0.1.13-alpha.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 (97) hide show
  1. package/.env.example +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +63 -44
  4. package/README.zh.md +63 -44
  5. package/config.example.yaml +8 -22
  6. package/dist/cli/AgentPrerequisites.js +262 -0
  7. package/dist/cli/AgentPrerequisites.js.map +1 -0
  8. package/dist/cli/DefaultAgentSelection.js +47 -0
  9. package/dist/cli/DefaultAgentSelection.js.map +1 -0
  10. package/dist/cli/FeishuAppConfiguration.js +1 -1
  11. package/dist/cli/FeishuAppConfiguration.js.map +1 -1
  12. package/dist/cli/FeishuAppRegistration.js +2 -2
  13. package/dist/cli/FeishuAppRegistration.js.map +1 -1
  14. package/dist/cli/Initializer.js +166 -3
  15. package/dist/cli/Initializer.js.map +1 -1
  16. package/dist/cli/ServerStarter.js +7 -2
  17. package/dist/cli/ServerStarter.js.map +1 -1
  18. package/dist/cli/controlProtocol.js.map +1 -1
  19. package/dist/cli/help.js +24 -20
  20. package/dist/cli/help.js.map +1 -1
  21. package/dist/cli/taskGroupOptions.js +95 -0
  22. package/dist/cli/taskGroupOptions.js.map +1 -0
  23. package/dist/cli.js +268 -6
  24. package/dist/cli.js.map +1 -1
  25. package/dist/codex/AppServerConnection.js +3 -3
  26. package/dist/codex/AppServerConnection.js.map +1 -1
  27. package/dist/codex/CodexProcessManager.js +4 -4
  28. package/dist/codex/CodexProcessManager.js.map +1 -1
  29. package/dist/codex/CodexRuntime.js +63 -25
  30. package/dist/codex/CodexRuntime.js.map +1 -1
  31. package/dist/config/loadConfig.js +8 -22
  32. package/dist/config/loadConfig.js.map +1 -1
  33. package/dist/config/schema.js +6 -1
  34. package/dist/config/schema.js.map +1 -1
  35. package/dist/console/ConsoleConnector.js +3 -3
  36. package/dist/console/ConsoleConnector.js.map +1 -1
  37. package/dist/console/ConsoleTurnPresenter.js +14 -7
  38. package/dist/console/ConsoleTurnPresenter.js.map +1 -1
  39. package/dist/deprecated-cli.js +5 -0
  40. package/dist/deprecated-cli.js.map +1 -0
  41. package/dist/feishu/CardRenderer.js +13 -12
  42. package/dist/feishu/CardRenderer.js.map +1 -1
  43. package/dist/feishu/FeishuTurnPresenter.js +9 -5
  44. package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
  45. package/dist/feishu/transport.js +1 -1
  46. package/dist/feishu/transport.js.map +1 -1
  47. package/dist/index.js +21 -3
  48. package/dist/index.js.map +1 -1
  49. package/dist/presentation/OutboundRouter.js +2 -2
  50. package/dist/presentation/OutboundRouter.js.map +1 -1
  51. package/dist/presentation/TurnStateReducer.js +2 -1
  52. package/dist/presentation/TurnStateReducer.js.map +1 -1
  53. package/dist/proxy/ProxySessionController.js +128 -72
  54. package/dist/proxy/ProxySessionController.js.map +1 -1
  55. package/dist/runtime/AcpRuntimeAdapter.js +3 -2
  56. package/dist/runtime/AcpRuntimeAdapter.js.map +1 -1
  57. package/dist/runtime/createAgentRuntimeRegistry.js +1 -1
  58. package/dist/runtime/createAgentRuntimeRegistry.js.map +1 -1
  59. package/dist/supervision/systemEnvironment.js +129 -0
  60. package/dist/supervision/systemEnvironment.js.map +1 -0
  61. package/dist/supervisor.js +13 -1
  62. package/dist/supervisor.js.map +1 -1
  63. package/docs/technical-reference.md +53 -34
  64. package/docs/technical-reference.zh.md +53 -34
  65. package/npm-shrinkwrap.json +4 -3
  66. package/package.json +9 -4
  67. package/skills/agent-bot/SKILL.md +72 -33
  68. package/src/cli/AgentPrerequisites.ts +377 -0
  69. package/src/cli/DefaultAgentSelection.ts +56 -0
  70. package/src/cli/FeishuAppConfiguration.ts +2 -2
  71. package/src/cli/FeishuAppRegistration.ts +4 -4
  72. package/src/cli/Initializer.ts +206 -5
  73. package/src/cli/ServerStarter.ts +8 -3
  74. package/src/cli/controlProtocol.ts +21 -1
  75. package/src/cli/help.ts +24 -20
  76. package/src/cli/taskGroupOptions.ts +149 -0
  77. package/src/cli.ts +391 -9
  78. package/src/codex/AppServerConnection.ts +3 -3
  79. package/src/codex/CodexProcessManager.ts +4 -4
  80. package/src/codex/CodexRuntime.ts +84 -31
  81. package/src/config/loadConfig.ts +8 -22
  82. package/src/config/schema.ts +7 -1
  83. package/src/console/ConsoleConnector.ts +3 -3
  84. package/src/console/ConsoleTurnPresenter.ts +20 -7
  85. package/src/deprecated-cli.ts +9 -0
  86. package/src/feishu/CardRenderer.ts +13 -12
  87. package/src/feishu/FeishuTurnPresenter.ts +15 -1
  88. package/src/feishu/transport.ts +1 -1
  89. package/src/index.ts +34 -3
  90. package/src/presentation/OutboundRouter.ts +15 -3
  91. package/src/presentation/TurnStateReducer.ts +2 -0
  92. package/src/presentation/turnViewTypes.ts +1 -0
  93. package/src/proxy/ProxySessionController.ts +217 -73
  94. package/src/runtime/AcpRuntimeAdapter.ts +3 -1
  95. package/src/runtime/createAgentRuntimeRegistry.ts +1 -1
  96. package/src/supervision/systemEnvironment.ts +174 -0
  97. package/src/supervisor.ts +12 -1
@@ -71,8 +71,9 @@ export class AcpRuntimeAdapter {
71
71
  }
72
72
  async startTurn(sessionId, prompt) {
73
73
  const { text, localImagePaths } = normalizeRuntimePrompt(prompt);
74
- if (localImagePaths.length > 0)
75
- throw new Error("当前 ACP Agent 不支持图片输入,请切换到 Codex 后重试。");
74
+ if (localImagePaths.length > 0) {
75
+ throw new Error("当前 ACP Agent 不支持图片输入,请切换到支持图片输入的 App Server Agent 后重试。");
76
+ }
76
77
  const session = this.requireSession(sessionId);
77
78
  const turnId = createId("turn");
78
79
  session.activeTurnId = turnId;
@@ -1 +1 @@
1
- {"version":3,"file":"AcpRuntimeAdapter.js","sourceRoot":"","sources":["../../src/runtime/AcpRuntimeAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAoB1C,MAAM,OAAO,iBAAiB;IAWC,GAAG;IAVvB,IAAI,GAAG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,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACjH,OAAO,WAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC;AACvD,CAAC;AAED,SAAS,eAAe,CAAC,MAAiC;IACxD,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3G,OAAO,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,sBAAsB,CAAC,MAAqB;IACnD,OAAO,OAAO,MAAM,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE;QACvC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE,EAAE,CAAC;AAC3E,CAAC"}
@@ -8,7 +8,7 @@ export function createAgentRuntimeRegistry(config, logger) {
8
8
  const runtimes = {};
9
9
  for (const [agentName, agent] of Object.entries(config.agents)) {
10
10
  const runtimeLogger = logger.child({ agentName, runtimeKind: agent.kind });
11
- if (agent.kind === "codex") {
11
+ if (agent.kind === "app-server") {
12
12
  const processManager = new CodexProcessManager(agent.command, agent.args, agent.env, runtimeLogger);
13
13
  runtimes[agentName] = new CodexRuntime(processManager, runtimeLogger);
14
14
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"createAgentRuntimeRegistry.js","sourceRoot":"","sources":["../../src/runtime/createAgentRuntimeRegistry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAi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 +1,129 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import path from "node:path";
3
+ const PROCESS_LOCAL_ENVIRONMENT_PREFIXES = ["AGENT_BOT_", "FEISHU_"];
4
+ export function refreshedSystemEnvironment(inherited = process.env, platform = process.platform, loadWindowsEnvironment = readWindowsEnvironment) {
5
+ const fallback = { ...inherited };
6
+ if (platform !== "win32") {
7
+ return { environment: fallback, refreshed: false, pathChanged: false };
8
+ }
9
+ try {
10
+ const snapshot = loadWindowsEnvironment();
11
+ const environment = mergeWindowsEnvironment(inherited, snapshot);
12
+ return {
13
+ environment,
14
+ refreshed: true,
15
+ pathChanged: environmentValue(environment, "Path") !== environmentValue(inherited, "Path"),
16
+ };
17
+ }
18
+ catch (error) {
19
+ return {
20
+ environment: fallback,
21
+ refreshed: false,
22
+ pathChanged: false,
23
+ error: error instanceof Error ? error.message : String(error),
24
+ };
25
+ }
26
+ }
27
+ export function mergeWindowsEnvironment(inherited, snapshot) {
28
+ const environment = { ...inherited };
29
+ applyEnvironment(environment, snapshot.machine);
30
+ applyEnvironment(environment, snapshot.user);
31
+ const machinePath = environmentValue(snapshot.machine, "Path")?.trim();
32
+ const userPath = environmentValue(snapshot.user, "Path")?.trim();
33
+ if (machinePath || userPath) {
34
+ const inheritedPath = environmentValue(inherited, "Path")?.trim();
35
+ setEnvironmentValue(environment, "Path", mergePathValues(expandEnvironmentReferences([machinePath, userPath, inheritedPath].filter(Boolean).join(";"), environment)));
36
+ }
37
+ return environment;
38
+ }
39
+ function readWindowsEnvironment() {
40
+ const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
41
+ const executable = path.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
42
+ const script = [
43
+ "[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false)",
44
+ "$machine = @{}",
45
+ "foreach ($entry in [Environment]::GetEnvironmentVariables([EnvironmentVariableTarget]::Machine).GetEnumerator()) { $machine[[string]$entry.Key] = [string]$entry.Value }",
46
+ "$user = @{}",
47
+ "foreach ($entry in [Environment]::GetEnvironmentVariables([EnvironmentVariableTarget]::User).GetEnumerator()) { $user[[string]$entry.Key] = [string]$entry.Value }",
48
+ "[pscustomobject]@{ machine = $machine; user = $user } | ConvertTo-Json -Compress -Depth 3",
49
+ ].join("; ");
50
+ const result = spawnSync(executable, [
51
+ "-NoLogo",
52
+ "-NoProfile",
53
+ "-NonInteractive",
54
+ "-ExecutionPolicy",
55
+ "Bypass",
56
+ "-Command",
57
+ script,
58
+ ], {
59
+ encoding: "utf8",
60
+ windowsHide: true,
61
+ timeout: 5_000,
62
+ maxBuffer: 8 * 1024 * 1024,
63
+ });
64
+ if (result.error)
65
+ throw result.error;
66
+ if (result.status !== 0) {
67
+ throw new Error(result.stderr.trim() || `PowerShell exited with code ${result.status ?? "unknown"}.`);
68
+ }
69
+ const parsed = JSON.parse(result.stdout);
70
+ return {
71
+ machine: environmentRecord(parsed.machine),
72
+ user: environmentRecord(parsed.user),
73
+ };
74
+ }
75
+ function environmentRecord(value) {
76
+ if (!value || typeof value !== "object" || Array.isArray(value))
77
+ return {};
78
+ return Object.fromEntries(Object.entries(value).flatMap(([name, entry]) => typeof entry === "string" ? [[name, entry]] : []));
79
+ }
80
+ function applyEnvironment(target, source) {
81
+ for (const [name, value] of Object.entries(source)) {
82
+ if (name.toLowerCase() === "path" || isProcessLocalEnvironmentName(name))
83
+ continue;
84
+ setEnvironmentValue(target, name, value);
85
+ }
86
+ }
87
+ function isProcessLocalEnvironmentName(name) {
88
+ const normalized = name.toUpperCase();
89
+ return PROCESS_LOCAL_ENVIRONMENT_PREFIXES.some((prefix) => normalized.startsWith(prefix));
90
+ }
91
+ function setEnvironmentValue(environment, name, value) {
92
+ for (const existingName of Object.keys(environment)) {
93
+ if (existingName !== name && existingName.toLowerCase() === name.toLowerCase()) {
94
+ delete environment[existingName];
95
+ }
96
+ }
97
+ environment[name] = value;
98
+ }
99
+ function environmentValue(environment, name) {
100
+ const key = Object.keys(environment).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
101
+ return key === undefined ? undefined : environment[key];
102
+ }
103
+ function expandEnvironmentReferences(value, environment) {
104
+ let expanded = value;
105
+ for (let attempt = 0; attempt < 5; attempt += 1) {
106
+ const next = expanded.replace(/%([^%]+)%/g, (match, name) => environmentValue(environment, name) ?? match);
107
+ if (next === expanded)
108
+ break;
109
+ expanded = next;
110
+ }
111
+ return expanded;
112
+ }
113
+ function mergePathValues(value) {
114
+ const seen = new Set();
115
+ return value
116
+ .split(";")
117
+ .map((entry) => entry.trim())
118
+ .filter((entry) => {
119
+ if (!entry)
120
+ return false;
121
+ const normalized = entry.replace(/[\\/]+$/, "").toLowerCase();
122
+ if (seen.has(normalized))
123
+ return false;
124
+ seen.add(normalized);
125
+ return true;
126
+ })
127
+ .join(";");
128
+ }
129
+ //# sourceMappingURL=systemEnvironment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"systemEnvironment.js","sourceRoot":"","sources":["../../src/supervision/systemEnvironment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAgB7B,MAAM,kCAAkC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;AAErE,MAAM,UAAU,0BAA0B,CACxC,SAAS,GAAsB,OAAO,CAAC,GAAG,EAC1C,QAAQ,GAAoB,OAAO,CAAC,QAAQ,EAC5C,sBAAsB,GAA6B,sBAAsB;IAEzE,MAAM,QAAQ,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC;IAClC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;IACzE,CAAC;IAED,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,sBAAsB,EAAE,CAAC;QAC1C,MAAM,WAAW,GAAG,uBAAuB,CAAC,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,CAAC,CAAC,WAAW,EAAE,CAAC;QAC9D,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -6,6 +6,7 @@ import { loadConfig } from "./config/loadConfig.js";
6
6
  import { requireServerFeishuTransport } from "./feishu/transport.js";
7
7
  import { crashRestartDelayMs, describeRestartReason, INTENTIONAL_RESTART_DELAY_MS, RESTART_EXIT_CODE, STABLE_UPTIME_MS, STOP_EXIT_CODE, } from "./supervision/restartPolicy.js";
8
8
  import { SupervisorDiagnostics, nodeDiagnosticReportArguments } from "./supervision/SupervisorDiagnostics.js";
9
+ import { refreshedSystemEnvironment } from "./supervision/systemEnvironment.js";
9
10
  const childEntry = fileURLToPath(new URL("./index.js", import.meta.url));
10
11
  const config = loadConfig();
11
12
  requireServerFeishuTransport(config.feishu);
@@ -30,13 +31,24 @@ async function startChild() {
30
31
  const restartReason = nextStartReason;
31
32
  nextStartReason = "Supervisor 重新拉起进程";
32
33
  const workerStderr = diagnostics.openWorkerStderr();
34
+ const environmentRefresh = refreshedSystemEnvironment();
35
+ if (environmentRefresh.error) {
36
+ writeSupervisorLog("environment_refresh_failed", { error: environmentRefresh.error });
37
+ }
38
+ else if (environmentRefresh.refreshed) {
39
+ writeSupervisorLog("environment_refreshed", { pathChanged: environmentRefresh.pathChanged });
40
+ }
33
41
  try {
34
42
  child = spawn(process.execPath, [
35
43
  ...nodeDiagnosticReportArguments(diagnostics.paths.crashReportDirectory),
36
44
  childEntry,
37
45
  ], {
38
46
  cwd: process.cwd(),
39
- env: { ...process.env, AGENT_BOT_SUPERVISED: "1", AGENT_BOT_RESTART_REASON: restartReason },
47
+ env: {
48
+ ...environmentRefresh.environment,
49
+ AGENT_BOT_SUPERVISED: "1",
50
+ AGENT_BOT_RESTART_REASON: restartReason,
51
+ },
40
52
  stdio: ["ignore", "ignore", workerStderr],
41
53
  windowsHide: true,
42
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,4BAA4B,EAC5B,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,GACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AAE9G,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACzE,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;AAC5B,4BAA4B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC5C,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;AAC7C,MAAM,cAAc,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AACnD,MAAM,WAAW,GAAG,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACtD,WAAW,CAAC,UAAU,EAAE,CAAC;AACzB,IAAI,KAA+B,CAAC;AACpC,IAAI,YAAwC,CAAC;AAC7C,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAC5B,IAAI,e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cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC;AACzE,IAAI,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;IAC1D,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,UAAU,EAAE,EAAE,cAAc,CAAC,CAAC;AACrE,CAAC;KAAM,CAAC;IACN,KAAK,UAAU,EAAE,CAAC;AACpB,CAAC"}
@@ -9,10 +9,10 @@ This document covers deployment, configuration, runtime behavior, persistence, a
9
9
  Agent Bot is a Node.js 22+ ESM TypeScript application built around these components:
10
10
 
11
11
  - The supervisor owns the long-running service and restarts the worker.
12
- - The worker starts the configured Codex and ACP runtimes, Feishu transport, Console transport, local control server, and SQLite store.
12
+ - The worker starts the configured Agent runtimes, Feishu transport, Console transport, local control server, and SQLite store.
13
13
  - Feishu events and Console input are normalized into the same task controller.
14
14
  - Presentation components maintain one progress card per turn and send the final Markdown response separately.
15
- - Codex agents use Codex App Server over stdio; other configured agents use ACP.
15
+ - App Server agents use the App Server protocol over stdio; other configured agents use ACP.
16
16
 
17
17
  Relevant source areas:
18
18
 
@@ -22,7 +22,7 @@ Relevant source areas:
22
22
  | `src/cli/` | Initialization, app registration, app auditing, and service/task commands |
23
23
  | `src/feishu/` | Feishu WebSocket events, API calls, cards, images, and context keys |
24
24
  | `src/runtime/` | Shared runtime abstraction |
25
- | `src/codex/` | Codex App Server protocol integration |
25
+ | `src/codex/` | App Server protocol integration for Codex, TraeX, and compatible Agents |
26
26
  | `src/acp/` | ACP process and JSON-RPC integration |
27
27
  | `src/proxy/` | Tasks, turns, steering, queues, forks, and command execution |
28
28
  | `src/presentation/` | Turn-state reduction and outbound routing |
@@ -35,7 +35,7 @@ The default user-data root is `~/.agent-bot`. `AGENT_BOT_HOME` replaces that roo
35
35
 
36
36
  The CLI also supports explicit directory-based profiles. Without `--profile`, commands use the main profile and the normal environment-based path rules. `--profile <directory>` pins both `AGENT_BOT_HOME` and `AGENT_BOT_CONFIG` for the command and every spawned supervisor or worker, with the configuration fixed at `<directory>/config.yaml`. It also clears inherited Feishu credential variables before loading the selected profile's `.env`, which prevents a secondary service launched from inside the primary Agent Bot process tree from accidentally reusing the primary bot. It cannot be combined with `--config`. Alternative profiles must be selected explicitly on every command; Agent Bot does not maintain a named-profile registry.
37
37
 
38
- The CLI reads the system locale through Node.js internationalization support. Locales beginning with `zh` use Chinese interface text; English and every unsupported locale use English. This applies to help, status, progress, prompts, and CLI-owned errors. JSON field names and enum values are not localized. System-generated restart reasons remain Chinese because they are rendered in Chinese Lark status cards; an explicit `--reason` is preserved verbatim. `agent-bot server status` reports the running worker's Lark App ID as `feishuAppId` in JSON; when the server is stopped or predates that health field, the CLI falls back to the selected profile's configured App ID.
38
+ The CLI reads the system locale through Node.js internationalization support. Locales beginning with `zh` use Chinese interface text; English and every unsupported locale use English. This applies to help, status, progress, prompts, and CLI-owned errors. JSON field names and enum values are not localized. System-generated restart reasons remain Chinese because they are rendered in Chinese Lark status cards; an explicit `--reason` is preserved verbatim. `agentbot server status` reports the running worker's Lark App ID as `feishuAppId` in JSON; when the server is stopped or predates that health field, the CLI falls back to the selected profile's configured App ID.
39
39
 
40
40
  | Default path | Contents |
41
41
  | ------------------------------------ | ---------------------------------- |
@@ -58,7 +58,15 @@ Relative `storage.sqlitePath` and `logging.path` values resolve against the dire
58
58
 
59
59
  ## Initialization
60
60
 
61
- `agent-bot init` copies the packaged `config.example.yaml` and `.env.example` when their target files do not exist, creates the data and log directories, and restricts `.env` permissions where the platform supports POSIX modes.
61
+ Early in initialization, `agentbot init` checks the supported Codex and TraeX CLIs in parallel and reports each installed version. Codex is compared with the latest stable `@openai/codex` package, while TraeX is compared with its Alpha channel. Missing or outdated Agents are gathered into one numbered list containing their exact install or upgrade commands. An interactive user can enter comma- or space-separated action numbers, `all`, or an empty answer to skip maintenance. Selected commands run sequentially with inherited stdio; skipped and failed actions are recorded and initialization continues. In a non-interactive terminal, commands are printed for manual use. With `--json`, progress and prompts use stderr and the final `agents` array records detection and assistance results. Codex upgrades first use `codex update` and fall back to the current npm package command when an older updater fails.
62
+
63
+ After version and maintenance checks, an interactive `init` requires a default-Agent selection by number or standard name. Configured custom Agents remain selectable without a version check; Codex or TraeX is omitted while its CLI is missing. When the current default remains selectable, an empty answer confirms it. The selected standard name is written to `defaults.agent` through the same comment-preserving atomic YAML update used for configuration upgrades. A non-interactive invocation retains an existing valid configured default because it cannot prompt, and fails when no valid default exists. The JSON result reports this as `defaultAgent.name` and `defaultAgent.status` (`selected` or `existing`).
64
+
65
+ `agentbot init` copies the packaged `config.example.yaml` and `.env.example` when their target files do not exist, creates the data and log directories, and restricts `.env` permissions where the platform supports POSIX modes.
66
+
67
+ When `config.yaml` already exists, `init` treats the packaged `config.example.yaml` as the configuration upgrade template. It parses both files as YAML and recursively adds missing mapping entries while preserving existing scalar values, sequences, comments, and custom entries. An existing `agents` mapping is treated as user-owned: template Agents that the user omitted are not re-added, while missing fields are filled for same-named Agents. A missing `defaults.agent` is not inferred because doing so could silently change the selected Agent. Invalid YAML is reported without replacing the existing file. Changed configuration is written through an atomic replacement, and a second run is idempotent. Use `--reset` when a complete replacement from the current template is intended.
68
+
69
+ When `.env` already exists, `init` appends active assignments missing from the packaged `.env.example`. Existing values, comments, ordering, and line endings are preserved, and commented optional examples are not enabled. The update uses the same atomic replacement behavior and is idempotent.
62
70
 
63
71
  Credential behavior:
64
72
 
@@ -90,9 +98,9 @@ Optional polling failures and timeouts return a partial configuration result ins
90
98
 
91
99
  The generated authorization links do not contain the app secret.
92
100
 
93
- `agent-bot --profile <directory> init --reset` fully resets an explicitly selected Profile. The Profile server must be stopped first. The command moves the active `config.yaml`, `.env`, `data/`, and `logs/` into a unique timestamped directory under `<profile>/.reset-backups/`, creates clean replacements from the packaged templates, and proceeds through normal initialization. Existing reset backups and unrelated files are retained. Because backups can contain old app secrets and conversation data, protect the Profile directory accordingly. The remote Feishu app is not deleted. `--reset --skip-feishu` creates a clean Console-only Profile, while `--reset` and `--reconfigure-feishu` cannot be combined.
101
+ `agentbot --profile <directory> init --reset` fully resets an explicitly selected Profile. The Profile server must be stopped first. The command moves the active `config.yaml`, `.env`, `data/`, and `logs/` into a unique timestamped directory under `<profile>/.reset-backups/`, creates clean replacements from the packaged templates, and proceeds through normal initialization. Existing reset backups and unrelated files are retained. Because backups can contain old app secrets and conversation data, protect the Profile directory accordingly. The remote Feishu app is not deleted. `--reset --skip-feishu` creates a clean Console-only Profile, while `--reset` and `--reconfigure-feishu` cannot be combined.
94
102
 
95
- After Feishu initialization succeeds, the CLI releases the initialization lock and starts the detached supervisor through the same readiness path as `agent-bot server start`. It waits up to 45 seconds for the worker to connect to Feishu and become ready. If the selected profile is already running, no second supervisor is created. `--skip-feishu` skips automatic server startup, and `--json` includes the resulting `server.status` without adding non-JSON output.
103
+ After Feishu initialization succeeds, the CLI releases the initialization lock and starts the detached supervisor through the same readiness path as `agentbot server start`. It waits up to 45 seconds for the worker to connect to Feishu and become ready. If the selected profile is already running, no second supervisor is created. `--skip-feishu` skips automatic server startup, and `--json` includes the resulting `server.status` without adding non-JSON output.
96
104
 
97
105
  ## Feishu App Requirements
98
106
 
@@ -118,7 +126,7 @@ Optional configuration:
118
126
  | Image and chat permissions | Generated group avatars |
119
127
  | `card.action.trigger` | Interactive card actions |
120
128
 
121
- Optional authorization failures are returned in the final initialization result with the affected feature names. Rerunning `agent-bot init` repeats the audit.
129
+ Optional authorization failures are returned in the final initialization result with the affected feature names. Rerunning `agentbot init` repeats the audit.
122
130
 
123
131
  ## Configuration Model
124
132
 
@@ -136,12 +144,19 @@ console:
136
144
 
137
145
  agents:
138
146
  codex:
139
- kind: "codex"
147
+ kind: "app-server"
140
148
  title: "Codex"
141
149
  command: "codex"
142
150
  args: ["app-server", "--enable", "goals", "--listen", "stdio://"]
143
151
  env: {}
144
152
 
153
+ traex:
154
+ kind: "app-server"
155
+ title: "TraeX"
156
+ command: "traex"
157
+ args: ["app-server", "--listen", "stdio://"]
158
+ env: {}
159
+
145
160
  defaults:
146
161
  agent: "codex"
147
162
  cwd: "."
@@ -156,7 +171,7 @@ logging:
156
171
 
157
172
  `feishu.respondToAllGroupMessages` defaults to `true`. Set it to `false` to ignore group messages unless they mention the current bot. The worker resolves the bot's Open ID at startup so mentioning another member does not trigger it. Private messages are always accepted. Initialization requests all-user group-message delivery regardless of this runtime option, allowing it to be changed later without another authorization.
158
173
 
159
- `agent-bot server start` requires both Feishu credentials. The worker starts the SDK's persistent connection without inspecting SDK logs or private connection state, then sends startup status cards as an outbound readiness check. Each startup card includes the Agent Bot version read from the installed package metadata. It normally targets known private chats and recently active groups. If the database has no known chat yet, it sends the card to `feishu.userOpenId` using an `open_id` private message. When notification targets exist, at least one card must be delivered before the server reports ready; individual target failures remain isolated. If neither a known chat nor `feishu.userOpenId` is available, startup continues without the outbound check. Missing credentials still fail startup with an initialization hint. `agent-bot console` is the explicit local-only path and does not require Feishu credentials.
174
+ `agentbot server start` requires both Feishu credentials. The worker starts the SDK's persistent connection without inspecting SDK logs or private connection state, then sends startup status cards as an outbound readiness check. Each startup card includes the Agent Bot version read from the installed package metadata. It normally targets known private chats and recently active groups. If the database has no known chat yet, it sends the card to `feishu.userOpenId` using an `open_id` private message. When notification targets exist, at least one card must be delivered before the server reports ready; individual target failures remain isolated. If neither a known chat nor `feishu.userOpenId` is available, startup continues without the outbound check. Missing credentials still fail startup with an initialization hint. `agentbot console` is the explicit local-only path and does not require Feishu credentials.
160
175
 
161
176
  At least one agent must be configured. `defaults.agent` must name a configured agent.
162
177
 
@@ -164,7 +179,7 @@ At least one agent must be configured. `defaults.agent` must name a configured a
164
179
 
165
180
  The configured Agent standard name is the runtime isolation key. Every configured Agent owns a separate, lazily started child process and runtime instance, even when multiple Agents use the same `kind`. Tasks using different Agents never share a command, environment, protocol connection, session map, or event stream. Tasks using the same Agent share that Agent process while keeping separate protocol sessions.
166
181
 
167
- `kind` selects only the connection adapter. An agent with `kind: "codex"` uses its own Codex App Server process. Agent Bot passes project directory, model, reasoning effort, permission mode, text input, and local images through the App Server protocol. `/sessions` aggregates tasks reported by every configured Codex Agent while preserving the owning Agent for Switch, Status, Stop, New, and Fork actions.
182
+ `kind` selects only the connection adapter. An agent with `kind: "app-server"` uses its own App Server process, whether the executable is Codex, TraeX, or another compatible product. Agent Bot passes project directory, model, reasoning effort, permission mode, text input, and local images through the App Server protocol. `/sessions` aggregates tasks reported by every configured App Server Agent while preserving the owning Agent for Switch, Status, Stop, New, and Fork actions. The previous `kind: "codex"` value is normalized to `app-server` when existing profiles are loaded.
168
183
 
169
184
  An agent with `kind: "acp"`, or without a `kind`, uses its own ACP process. Multiple tasks create separate ACP sessions on that connection. Agent-specific `env` values are added only to that Agent's environment.
170
185
 
@@ -187,7 +202,7 @@ The message route determines the current task:
187
202
 
188
203
  Commands, card callbacks, progress cards, and final responses stay on the originating route.
189
204
 
190
- Starting a Feishu thread from a mapped user message, progress card, or final response forks from the associated completed Codex turn. If no reliable completed source turn exists, the operation fails instead of selecting an arbitrary point.
205
+ Starting a Feishu thread from a mapped user message, progress card, or final response forks from the associated completed App Server turn. If no reliable completed source turn exists, the operation fails instead of selecting an arbitrary point.
191
206
 
192
207
  `/forkgroup` has thread-aware source selection. An unbound thread, or a bound thread task with no completed turn of its own, forks directly from the thread's original anchor turn without creating an intermediate thread task. Once the thread task has completed a turn, `/forkgroup` uses its latest locally persisted completed turn. A newer active turn does not block the command and is excluded from the fork point.
193
208
 
@@ -198,7 +213,7 @@ The new group's welcome message reports the persisted fork settings: Provider, m
198
213
  ## Turn And Message Behavior
199
214
 
200
215
  - Plain text creates a task when the route has no current task.
201
- - Text received during an active Codex turn is sent through steering.
216
+ - Text received during an active App Server turn is sent through steering.
202
217
  - A steering race at turn completion becomes the next queued request.
203
218
  - `/nosteer` always creates a persistent FIFO queue item.
204
219
  - Queue card actions can cancel individual pending items.
@@ -209,21 +224,23 @@ Each turn owns one progress card. Normal updates are throttled to one every two
209
224
 
210
225
  After the durable message-deduplication claim, Agent Bot awaits the `OnIt` reaction before chat persistence, image downloads, queue waits, command execution, or runtime calls. It replaces that reaction with `DONE`, `ERROR`, or `CrossMark` when the turn succeeds, fails, or is canceled. Reaction failures are logged but do not block task execution.
211
226
 
212
- Incoming rich-text images are downloaded into the inbound image cache and passed to Codex as `localImage` inputs. An image-only message uses the default Prompt `请查看这张图片`. An ACP runtime that cannot accept image input returns an explicit error.
227
+ Incoming rich-text images are downloaded into the inbound image cache and passed to the App Server as `localImage` inputs. An image-only message uses the default Prompt `请查看这张图片`. An ACP runtime that cannot accept image input returns an explicit error.
213
228
 
214
- ## Tasks, Projects, And External Codex Work
229
+ ## Tasks, Projects, And External App Server Work
215
230
 
216
- `/sessions` reads Codex tasks through `thread/list` and can discover tasks created by Codex Desktop, CLI, Agent Bot, or another App Server client under the same `CODEX_HOME`.
231
+ `/sessions` reads tasks through `thread/list` from every configured App Server Agent. For Codex, this includes tasks created by Codex Desktop, CLI, Agent Bot, or another App Server client under the same `CODEX_HOME`; other Agents expose their own task stores through the same protocol.
217
232
 
218
233
  Each task entry exposes `NewGroup` and `ForkGroup` callbacks. The callback payload keeps the selected task ID and source context, while the Lark operator `open_id` is used to invite the user to the new group. `NewGroup` resolves the selected task's project and execution settings; `ForkGroup` resolves its latest available completed turn.
219
234
 
220
- ## Codex Provider Settings
235
+ The CLI exposes the same task-targeted operations through `agentbot task newgroup <task> [title] [--agent <name>] [--dir <cwd> | --nodir]` and `agentbot task forkgroup <task> [title]`. Both commands require a running Server and send the stable local task ID over the Profile's local control endpoint. Since a CLI process has no Lark operator, the Server invites `feishu.userOpenId`, which initialization stores as `FEISHU_USER_OPEN_ID`. New-group creation inherits the selected task's Agent and execution settings by default. `--agent <standard-name>` selects another configured runtime while retaining the source project shape; execution settings are omitted so that runtime applies its own defaults. ForkGroup uses the source task's latest available completed turn and leaves an active source turn running. Both control responses include the new chat, group context, source task, and created task; `--json` prints that structure without localization.
221
236
 
222
- Provider is a task-level setting stored as `model_provider` alongside model, reasoning effort, and permission mode. Agent Bot passes `modelProvider` through `thread/start`, `thread/resume`, and `thread/fork` whenever a task explicitly inherits or selects one. For a brand-new task with no inherited Provider, Agent Bot omits `modelProvider`; the Codex App Server therefore uses the effective `model_provider` from Codex configuration and returns the selected Provider in its thread response for persistence.
237
+ ## App Server Provider Settings
238
+
239
+ Provider is a task-level setting stored as `model_provider` alongside model, reasoning effort, and permission mode. Agent Bot passes `modelProvider` through `thread/start`, `thread/resume`, and `thread/fork` whenever a task explicitly inherits or selects one. For a brand-new task with no inherited Provider, Agent Bot omits `modelProvider`; the selected App Server Agent uses its own effective default and returns the selected Provider in its thread response for persistence.
223
240
 
224
241
  `/provider`, `/model`, `/thinking`, and `/permissions` open one Card 2.0 execution-settings surface with the matching tab active. All four commands reject arguments; tab navigation and setting changes use card callbacks only. Provider choices come from App Server `config/read`. A Provider change resumes the thread with the selected Provider and the current compatible model, reasoning effort, and permission mode. Model, reasoning, and permission choices update their focused setting immediately, refresh the same card in place, and apply from the next request.
225
242
 
226
- Agent Bot keeps a local routing key for Feishu cards and delivery state, but presents the Codex task ID to users. It does not resume, steer, stop, or fork externally running Codex work without an explicit user action.
243
+ Agent Bot keeps a local routing key for Feishu cards and delivery state, but presents the owning App Server's task ID to users. It does not resume, steer, stop, or fork externally running Agent work without an explicit user action.
227
244
 
228
245
  Project behavior:
229
246
 
@@ -240,19 +257,21 @@ Forks use the latest available completed turn and do not interrupt an active sou
240
257
  SQLite stores:
241
258
 
242
259
  - Current and previous tasks for each route
243
- - Local and Codex task/thread identifiers
260
+ - Local and App Server task/thread identifiers
244
261
  - Model, reasoning effort, and permission mode
245
262
  - Queued Prompts
246
263
  - Progress snapshots and message bindings
247
264
  - Final-message delivery records
248
265
 
249
- On startup, Agent Bot reconciles persisted active work with Codex through `thread/read`. It also reconciles when turn identifiers change, terminal notifications arrive, or control requests fail.
266
+ On startup, Agent Bot reconciles persisted active work with its owning App Server through `thread/read`. It also reconciles when turn identifiers change, terminal notifications arrive, or control requests fail.
250
267
 
251
- The final-delivery ledger prevents duplicate successful replies. App Server requests use finite timeouts so a stalled request cannot permanently occupy a message route.
268
+ The final-delivery ledger prevents duplicate successful replies. App Server requests use finite timeouts so a stalled request cannot permanently occupy a message route. Session lifecycle requests allow 60 seconds because compatible third-party Agents may need more than 30 seconds for `thread/start`; control requests remain shorter.
252
269
 
253
270
  ## Supervisor And Restart
254
271
 
255
- `agent-bot server start` starts a detached supervisor. The supervisor restarts the worker after unexpected exits and applies exponential backoff from one to 30 seconds after repeated crashes.
272
+ `agentbot server start` starts a detached supervisor. The supervisor restarts the worker after unexpected exits and applies exponential backoff from one to 30 seconds after repeated crashes.
273
+
274
+ On Windows, the CLI refreshes Machine and User environment variables before the initial Supervisor launch, a Worker refreshes them before launching a replacement Supervisor, and the Supervisor refreshes them before every Worker launch. Fresh values override inherited values, while `PATH` retains process-only entries after the current Machine and User paths. `AGENT_BOT_*` and `FEISHU_*` values remain process-local so an active Profile cannot accidentally switch data roots or bot credentials. A registry-read failure falls back to the inherited environment without blocking startup and is recorded when a runtime logger is available.
256
275
 
257
276
  Supervisor crash diagnostics are isolated to the selected profile:
258
277
 
@@ -275,11 +294,11 @@ The first safe-restart status card is delayed by three seconds so a task's final
275
294
 
276
295
  Pending safe-restart cards include a bottom `Cancel` action. The action carries the scheduler's monotonic schedule ID, so an old card cannot cancel a newer restart. A successful cancellation updates every existing status card in place and removes the action; the action is also absent once the scheduler enters the irreversible restarting phase.
277
296
 
278
- The local control server implements task mutations and service restart requests. Read-only task queries access SQLite directly.
297
+ The local control server implements task mutations, task-targeted NewGroup and ForkGroup operations, and service restart requests. Read-only task queries access SQLite directly.
279
298
 
280
299
  ## Permission Modes
281
300
 
282
- - `auto`: Codex runs with `approvalPolicy=never` and `danger-full-access`.
301
+ - `auto`: the App Server Agent runs with `approvalPolicy=never` and `danger-full-access`.
283
302
  - `confirm`: approval requests are presented through card actions for one-time approval, session approval, denial, or task cancellation.
284
303
 
285
304
  Model, reasoning effort, permission mode, and project shape are inherited where applicable when creating or forking tasks.
@@ -289,16 +308,16 @@ Model, reasoning effort, permission mode, and project shape are inherited where
289
308
  The packaged Agent Bot skill can be installed into the shared agent skill directory:
290
309
 
291
310
  ```powershell
292
- agent-bot skills install
293
- agent-bot skills status
294
- agent-bot skills uninstall
311
+ agentbot skills install
312
+ agentbot skills status
313
+ agentbot skills uninstall
295
314
  ```
296
315
 
297
316
  The default target is `~/.agents/skills`. `AGENT_BOT_SKILLS_DIR` or `--target` selects another root. Installation is a managed copy; uninstall does not remove an unrelated same-named directory.
298
317
 
299
318
  ## npm Package And Releases
300
319
 
301
- The public package is `@keyou007/agent-bot`; its executable remains `agent-bot`. The package uses a `files` allowlist so runtime code, templates, the managed skill, source code, and user-facing documentation are published without tests or internal design plans.
320
+ The public package is `@keyou007/agent-bot`; its primary executable is `agentbot`. The deprecated `agent-bot` executable remains as a forwarding compatibility entry and prints a localized warning before each invocation. The package uses a `files` allowlist so runtime code, templates, the managed skill, source code, and user-facing documentation are published without tests or internal design plans.
302
321
 
303
322
  `npm-shrinkwrap.json` is published with the CLI to keep transitive runtime dependencies reproducible. Direct runtime and development dependencies are also pinned to exact versions.
304
323
 
@@ -308,18 +327,18 @@ Package lifecycle:
308
327
  - `prepack` builds a clean `dist/` and validates the tarball manifest.
309
328
  - `npm run package:smoke` packs the project, installs the tarball into a temporary directory, runs the CLI, and performs Console-only initialization.
310
329
 
311
- Prepare the next patch release from a clean worktree:
330
+ Prepare the next Alpha release from a clean worktree:
312
331
 
313
332
  ```powershell
314
333
  npm run release
315
334
  git add package.json npm-shrinkwrap.json CHANGELOG.md
316
- git commit -m "release: v0.1.1"
335
+ git commit -m "release: v0.1.13-alpha.0"
317
336
  git push origin master
318
337
  ```
319
338
 
320
- `npm run release` increments the patch version by default and moves the current `Unreleased` entries into a dated version section. Use `npm run release -- minor`, `npm run release -- major`, or `npm run release -- 0.2.0` to select another stable version. The command refuses to modify a dirty worktree or publish an empty changelog.
339
+ `npm run release` now defaults to the Alpha channel. A stable `0.1.12` becomes `0.1.13-alpha.0`; a current `0.1.13-alpha.0` becomes `0.1.13-alpha.1`. `npm run release:alpha` is the explicit equivalent. Use `npm run release:stable` to promote the current Alpha to its stable core version, or to increment the patch when the current version is already stable. `patch`, `minor`, `major`, and exact stable or `-alpha.N` versions remain available through `npm run release -- <version>`. Every release moves the current `Unreleased` entries into a dated version section. The command refuses to modify a dirty worktree or publish an empty changelog.
321
340
 
322
- No local publish command is required after the push. When CI succeeds for a first-party push to `master`, `publish.yml` checks the package version against npm. An existing version is skipped successfully. An unpublished stable version requires a matching `CHANGELOG.md` section, then runs verification and the package smoke test before publishing. After npm accepts the package, the workflow creates the matching `v<package version>` GitHub Release.
341
+ No local publish command is required after the push. When CI succeeds for a first-party push to `master`, `publish.yml` checks the package version against npm. An existing version is skipped successfully. An unpublished stable or Alpha version requires a matching `CHANGELOG.md` section, then runs verification and the package smoke test before publishing. Alpha versions use npm's `alpha` dist-tag and create a GitHub prerelease; stable versions use `latest` and create a regular GitHub Release.
323
342
 
324
343
  The workflow can also be retried manually from **GitHub Actions → Publish to npm → Run workflow** on `master`. Pull requests, forked repositories, failed CI runs, and pushes to other branches cannot enter the publish job.
325
344
 
@@ -343,4 +362,4 @@ npm run build
343
362
  npm link
344
363
  ```
345
364
 
346
- `npm link` registers the checkout's `agent-bot` executable globally. Without it, built CLI commands can be invoked through `npm run cli --`. `npm run dev` runs one foreground worker, while `npm start` runs the supervisor in the current terminal.
365
+ `npm link` registers the checkout's `agentbot` executable and deprecated `agent-bot` compatibility executable globally. Without it, built CLI commands can be invoked through `npm run cli --`. `npm run dev` runs one foreground worker, while `npm start` runs the supervisor in the current terminal.