u-foo 1.0.6 → 1.1.9

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 (149) hide show
  1. package/README.md +44 -4
  2. package/SKILLS/ufoo/SKILL.md +17 -2
  3. package/SKILLS/uinit/SKILL.md +8 -3
  4. package/bin/ucode-core.js +15 -0
  5. package/bin/ucode.js +125 -0
  6. package/bin/ufoo-assistant-agent.js +5 -0
  7. package/bin/ufoo-engine.js +25 -0
  8. package/bin/ufoo.js +4 -0
  9. package/modules/AGENTS.template.md +14 -4
  10. package/modules/bus/README.md +8 -5
  11. package/modules/bus/SKILLS/ubus/SKILL.md +5 -4
  12. package/modules/context/SKILLS/uctx/SKILL.md +3 -1
  13. package/modules/online/SKILLS/ufoo-online/SKILL.md +144 -0
  14. package/package.json +12 -3
  15. package/scripts/import-pi-mono.js +124 -0
  16. package/scripts/postinstall.js +20 -49
  17. package/scripts/sync-claude-skills.sh +21 -0
  18. package/src/agent/cliRunner.js +524 -31
  19. package/src/agent/internalRunner.js +76 -9
  20. package/src/agent/launcher.js +97 -45
  21. package/src/agent/normalizeOutput.js +1 -1
  22. package/src/agent/notifier.js +144 -4
  23. package/src/agent/ptyRunner.js +480 -10
  24. package/src/agent/ptyWrapper.js +28 -3
  25. package/src/agent/readyDetector.js +16 -0
  26. package/src/agent/ucode.js +443 -0
  27. package/src/agent/ucodeBootstrap.js +113 -0
  28. package/src/agent/ucodeBuild.js +67 -0
  29. package/src/agent/ucodeDoctor.js +184 -0
  30. package/src/agent/ucodeRuntimeConfig.js +129 -0
  31. package/src/agent/ufooAgent.js +11 -2
  32. package/src/assistant/agent.js +260 -0
  33. package/src/assistant/bridge.js +172 -0
  34. package/src/assistant/engine.js +252 -0
  35. package/src/assistant/stdio.js +58 -0
  36. package/src/assistant/ufooEngineCli.js +306 -0
  37. package/src/bus/activate.js +27 -11
  38. package/src/bus/daemon.js +133 -5
  39. package/src/bus/index.js +137 -80
  40. package/src/bus/inject.js +47 -17
  41. package/src/bus/message.js +145 -17
  42. package/src/bus/nickname.js +3 -1
  43. package/src/bus/queue.js +6 -1
  44. package/src/bus/store.js +189 -0
  45. package/src/bus/subscriber.js +20 -4
  46. package/src/bus/utils.js +9 -3
  47. package/src/chat/agentBar.js +117 -0
  48. package/src/chat/agentDirectory.js +88 -0
  49. package/src/chat/agentSockets.js +225 -0
  50. package/src/chat/agentViewController.js +298 -0
  51. package/src/chat/chatLogController.js +115 -0
  52. package/src/chat/commandExecutor.js +700 -0
  53. package/src/chat/commands.js +132 -0
  54. package/src/chat/completionController.js +414 -0
  55. package/src/chat/cronScheduler.js +160 -0
  56. package/src/chat/daemonConnection.js +166 -0
  57. package/src/chat/daemonCoordinator.js +64 -0
  58. package/src/chat/daemonMessageRouter.js +257 -0
  59. package/src/chat/daemonReconnect.js +41 -0
  60. package/src/chat/daemonTransport.js +36 -0
  61. package/src/chat/daemonTransportDefaults.js +10 -0
  62. package/src/chat/dashboardKeyController.js +480 -0
  63. package/src/chat/dashboardView.js +154 -0
  64. package/src/chat/index.js +935 -2909
  65. package/src/chat/inputHistoryController.js +105 -0
  66. package/src/chat/inputListenerController.js +304 -0
  67. package/src/chat/inputMath.js +104 -0
  68. package/src/chat/inputSubmitHandler.js +171 -0
  69. package/src/chat/layout.js +165 -0
  70. package/src/chat/pasteController.js +81 -0
  71. package/src/chat/rawKeyMap.js +42 -0
  72. package/src/chat/settingsController.js +132 -0
  73. package/src/chat/statusLineController.js +177 -0
  74. package/src/chat/streamTracker.js +138 -0
  75. package/src/chat/text.js +70 -0
  76. package/src/chat/transport.js +61 -0
  77. package/src/cli/busCoreCommands.js +59 -0
  78. package/src/cli/ctxCoreCommands.js +199 -0
  79. package/src/cli/onlineCoreCommands.js +379 -0
  80. package/src/cli.js +741 -238
  81. package/src/code/README.md +29 -0
  82. package/src/code/UCODE_PROMPT.md +32 -0
  83. package/src/code/agent.js +1651 -0
  84. package/src/code/cli.js +158 -0
  85. package/src/code/config +0 -0
  86. package/src/code/dispatch.js +42 -0
  87. package/src/code/index.js +70 -0
  88. package/src/code/nativeRunner.js +1213 -0
  89. package/src/code/runtime.js +154 -0
  90. package/src/code/sessionStore.js +162 -0
  91. package/src/code/taskDecomposer.js +269 -0
  92. package/src/code/tools/bash.js +53 -0
  93. package/src/code/tools/common.js +42 -0
  94. package/src/code/tools/edit.js +70 -0
  95. package/src/code/tools/read.js +44 -0
  96. package/src/code/tools/write.js +35 -0
  97. package/src/code/tui.js +1580 -0
  98. package/src/config.js +47 -1
  99. package/src/context/decisions.js +12 -2
  100. package/src/context/index.js +18 -1
  101. package/src/context/sync.js +127 -0
  102. package/src/daemon/agentProcessManager.js +74 -0
  103. package/src/daemon/cronOps.js +241 -0
  104. package/src/daemon/index.js +661 -488
  105. package/src/daemon/ipcServer.js +99 -0
  106. package/src/daemon/ops.js +417 -179
  107. package/src/daemon/promptLoop.js +319 -0
  108. package/src/daemon/promptRequest.js +101 -0
  109. package/src/daemon/providerSessions.js +32 -17
  110. package/src/daemon/reporting.js +90 -0
  111. package/src/daemon/run.js +2 -5
  112. package/src/daemon/status.js +24 -1
  113. package/src/init/index.js +68 -14
  114. package/src/online/bridge.js +663 -0
  115. package/src/online/client.js +245 -0
  116. package/src/online/runner.js +253 -0
  117. package/src/online/server.js +992 -0
  118. package/src/online/tokens.js +103 -0
  119. package/src/report/store.js +331 -0
  120. package/src/shared/eventContract.js +35 -0
  121. package/src/shared/ptySocketContract.js +21 -0
  122. package/src/status/index.js +50 -17
  123. package/src/terminal/adapterContract.js +87 -0
  124. package/src/terminal/adapterRouter.js +84 -0
  125. package/src/terminal/adapters/externalAdapter.js +14 -0
  126. package/src/terminal/adapters/internalAdapter.js +13 -0
  127. package/src/terminal/adapters/internalPtyAdapter.js +42 -0
  128. package/src/terminal/adapters/internalQueueAdapter.js +37 -0
  129. package/src/terminal/adapters/terminalAdapter.js +31 -0
  130. package/src/terminal/adapters/tmuxAdapter.js +30 -0
  131. package/src/ufoo/agentsStore.js +69 -3
  132. package/src/utils/banner.js +5 -2
  133. package/scripts/.archived/bash-to-js-migration/README.md +0 -46
  134. package/scripts/.archived/bash-to-js-migration/banner.sh +0 -89
  135. package/scripts/.archived/bash-to-js-migration/bus-alert.sh +0 -6
  136. package/scripts/.archived/bash-to-js-migration/bus-autotrigger.sh +0 -6
  137. package/scripts/.archived/bash-to-js-migration/bus-daemon.sh +0 -231
  138. package/scripts/.archived/bash-to-js-migration/bus-inject.sh +0 -176
  139. package/scripts/.archived/bash-to-js-migration/bus-listen.sh +0 -6
  140. package/scripts/.archived/bash-to-js-migration/bus.sh +0 -986
  141. package/scripts/.archived/bash-to-js-migration/context-decisions.sh +0 -167
  142. package/scripts/.archived/bash-to-js-migration/context-doctor.sh +0 -72
  143. package/scripts/.archived/bash-to-js-migration/context-lint.sh +0 -110
  144. package/scripts/.archived/bash-to-js-migration/doctor.sh +0 -22
  145. package/scripts/.archived/bash-to-js-migration/init.sh +0 -247
  146. package/scripts/.archived/bash-to-js-migration/skills.sh +0 -113
  147. package/scripts/.archived/bash-to-js-migration/status.sh +0 -125
  148. package/scripts/banner.sh +0 -2
  149. package/src/bus/API_DESIGN.md +0 -204
@@ -0,0 +1,172 @@
1
+ const { spawn } = require("child_process");
2
+ const path = require("path");
3
+
4
+ function resolveAssistantCommand() {
5
+ const raw = String(process.env.UFOO_ASSISTANT_CMD || "ufoo-assistant-agent").trim();
6
+ if (!raw || raw === "ufoo-assistant-agent") {
7
+ return {
8
+ command: process.execPath,
9
+ args: [path.resolve(__dirname, "../../bin/ufoo-assistant-agent.js")],
10
+ };
11
+ }
12
+ const parts = raw.split(/\s+/).filter(Boolean);
13
+ if (parts.length === 0) {
14
+ return {
15
+ command: process.execPath,
16
+ args: [path.resolve(__dirname, "../../bin/ufoo-assistant-agent.js")],
17
+ };
18
+ }
19
+ return { command: parts[0], args: parts.slice(1) };
20
+ }
21
+
22
+ function parseAssistantOutput(stdout) {
23
+ const text = String(stdout || "").trim();
24
+ if (!text) return null;
25
+ try {
26
+ return JSON.parse(text);
27
+ } catch {
28
+ // Continue to line-based fallback.
29
+ }
30
+
31
+ const lines = text.split(/\r?\n/).filter(Boolean);
32
+ for (let i = lines.length - 1; i >= 0; i -= 1) {
33
+ try {
34
+ return JSON.parse(lines[i]);
35
+ } catch {
36
+ // ignore malformed line
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+
42
+ function normalizeResponse(parsed, fallbackError = "") {
43
+ if (!parsed || typeof parsed !== "object") {
44
+ return {
45
+ ok: false,
46
+ summary: "",
47
+ artifacts: [],
48
+ logs: [],
49
+ error: fallbackError || "assistant returned invalid JSON",
50
+ metrics: {},
51
+ };
52
+ }
53
+
54
+ return {
55
+ ok: parsed.ok !== false,
56
+ summary: typeof parsed.summary === "string" ? parsed.summary : "",
57
+ artifacts: Array.isArray(parsed.artifacts) ? parsed.artifacts : [],
58
+ logs: Array.isArray(parsed.logs) ? parsed.logs : [],
59
+ error: typeof parsed.error === "string" ? parsed.error : "",
60
+ metrics: parsed.metrics && typeof parsed.metrics === "object" ? parsed.metrics : {},
61
+ };
62
+ }
63
+
64
+ async function runAssistantTask({
65
+ projectRoot,
66
+ provider = "",
67
+ fallbackProvider = "",
68
+ model = "",
69
+ task = "",
70
+ kind = "mixed",
71
+ context = "",
72
+ expect = "",
73
+ timeoutMs = 60000,
74
+ } = {}) {
75
+ return new Promise((resolve) => {
76
+ const startedAt = Date.now();
77
+ const { command, args } = resolveAssistantCommand();
78
+ const payload = {
79
+ request_id: `assistant-${startedAt}`,
80
+ project_root: projectRoot,
81
+ provider,
82
+ fallback_provider: fallbackProvider,
83
+ model,
84
+ task,
85
+ kind,
86
+ context,
87
+ expect,
88
+ timeout_ms: timeoutMs,
89
+ };
90
+
91
+ const child = spawn(command, args, {
92
+ cwd: projectRoot,
93
+ env: { ...process.env, UFOO_ASSISTANT_MODE: "private" },
94
+ stdio: ["pipe", "pipe", "pipe"],
95
+ });
96
+
97
+ let stdout = "";
98
+ let stderr = "";
99
+ let settled = false;
100
+ const finish = (result) => {
101
+ if (settled) return;
102
+ settled = true;
103
+ resolve(result);
104
+ };
105
+
106
+ const timer = setTimeout(() => {
107
+ try {
108
+ child.kill("SIGTERM");
109
+ } catch {
110
+ // ignore
111
+ }
112
+ finish({
113
+ ok: false,
114
+ summary: "",
115
+ artifacts: [],
116
+ logs: [],
117
+ error: "assistant timeout",
118
+ metrics: { duration_ms: Date.now() - startedAt },
119
+ });
120
+ }, timeoutMs);
121
+
122
+ child.on("error", (err) => {
123
+ clearTimeout(timer);
124
+ finish({
125
+ ok: false,
126
+ summary: "",
127
+ artifacts: [],
128
+ logs: [],
129
+ error: err && err.message ? err.message : "assistant spawn failed",
130
+ metrics: { duration_ms: Date.now() - startedAt },
131
+ });
132
+ });
133
+
134
+ child.stdout.on("data", (chunk) => {
135
+ stdout += chunk.toString("utf8");
136
+ });
137
+ child.stderr.on("data", (chunk) => {
138
+ stderr += chunk.toString("utf8");
139
+ });
140
+
141
+ child.on("close", (code) => {
142
+ clearTimeout(timer);
143
+ const parsed = parseAssistantOutput(stdout);
144
+ const fallbackError = code === 0
145
+ ? ""
146
+ : (stderr || `assistant exited with code ${code}`);
147
+ const normalized = normalizeResponse(parsed, fallbackError);
148
+ normalized.metrics = {
149
+ ...normalized.metrics,
150
+ duration_ms: Date.now() - startedAt,
151
+ };
152
+ if (!normalized.ok && !normalized.error) {
153
+ normalized.error = fallbackError || "assistant failed";
154
+ }
155
+ finish(normalized);
156
+ });
157
+
158
+ try {
159
+ child.stdin.write(`${JSON.stringify(payload)}\n`);
160
+ child.stdin.end();
161
+ } catch {
162
+ // stdin may already be closed.
163
+ }
164
+ });
165
+ }
166
+
167
+ module.exports = {
168
+ runAssistantTask,
169
+ parseAssistantOutput,
170
+ normalizeResponse,
171
+ resolveAssistantCommand,
172
+ };
@@ -0,0 +1,252 @@
1
+ const { spawn } = require("child_process");
2
+ const { loadConfig, normalizeAssistantEngine } = require("../config");
3
+
4
+ function splitCommand(raw, fallback = "ufoo-engine") {
5
+ const text = String(raw || "").trim();
6
+ if (!text) return { command: fallback, args: [] };
7
+ const parts = text.split(/\s+/).filter(Boolean);
8
+ if (parts.length === 0) return { command: fallback, args: [] };
9
+ return { command: parts[0], args: parts.slice(1) };
10
+ }
11
+
12
+ function resolveAssistantEngine({
13
+ projectRoot,
14
+ requestedProvider = "",
15
+ requestedModel = "",
16
+ fallbackProvider = "",
17
+ } = {}) {
18
+ const config = loadConfig(projectRoot);
19
+
20
+ const hasRequestedProvider = String(requestedProvider || "").trim().length > 0;
21
+ const requested = normalizeAssistantEngine(requestedProvider);
22
+ const configEngine = normalizeAssistantEngine(config.assistantEngine);
23
+ const fallback = normalizeAssistantEngine(fallbackProvider) || "codex";
24
+
25
+ let selected = requested;
26
+ if (selected === "auto") {
27
+ // Explicit assistant_call provider=auto should inherit current main agent provider.
28
+ selected = hasRequestedProvider ? fallback : configEngine;
29
+ }
30
+ if (selected === "auto") selected = fallback;
31
+ if (selected === "auto") selected = "codex";
32
+
33
+ const model =
34
+ String(requestedModel || "").trim()
35
+ || String(process.env.UFOO_ASSISTANT_MODEL || "").trim()
36
+ || String(config.assistantModel || "").trim()
37
+ || "";
38
+
39
+ if (selected === "claude") {
40
+ return {
41
+ engine: "claude",
42
+ kind: "cli",
43
+ provider: "claude-cli",
44
+ model,
45
+ };
46
+ }
47
+
48
+ if (selected === "ufoo") {
49
+ const { command, args } = splitCommand(
50
+ process.env.UFOO_ASSISTANT_UFOO_CMD || config.assistantUfooCmd,
51
+ "ufoo-engine"
52
+ );
53
+ return {
54
+ engine: "ufoo",
55
+ kind: "external",
56
+ command,
57
+ args,
58
+ model,
59
+ };
60
+ }
61
+
62
+ return {
63
+ engine: "codex",
64
+ kind: "cli",
65
+ provider: "codex-cli",
66
+ model,
67
+ };
68
+ }
69
+
70
+ function parseEngineJson(stdout) {
71
+ const text = String(stdout || "").trim();
72
+ if (!text) return null;
73
+ try {
74
+ return JSON.parse(text);
75
+ } catch {
76
+ // continue to line fallback
77
+ }
78
+ const lines = text.split(/\r?\n/).filter(Boolean);
79
+ for (let i = lines.length - 1; i >= 0; i -= 1) {
80
+ try {
81
+ return JSON.parse(lines[i]);
82
+ } catch {
83
+ // ignore bad lines
84
+ }
85
+ }
86
+ return null;
87
+ }
88
+
89
+ function isUnsupportedArgError(errText) {
90
+ const text = String(errText || "").toLowerCase();
91
+ return text.includes("unknown option")
92
+ || text.includes("unknown argument")
93
+ || text.includes("unexpected argument")
94
+ || text.includes("unrecognized option");
95
+ }
96
+
97
+ function buildExternalEngineArgs(engine = {}, payload = {}) {
98
+ const args = Array.isArray(engine.args) ? [...engine.args] : [];
99
+ args.push("--assistant-task", "--json");
100
+ if (payload.model) args.push("--model", String(payload.model));
101
+ if (payload.session_id) args.push("--session-id", String(payload.session_id));
102
+ if (payload.project_root) args.push("--cwd", String(payload.project_root));
103
+ if (payload.kind) args.push("--kind", String(payload.kind));
104
+ if (payload.context) args.push("--context", String(payload.context));
105
+ if (payload.expect) args.push("--expect", String(payload.expect));
106
+ args.push(String(payload.task || ""));
107
+ return args;
108
+ }
109
+
110
+ function extractSessionId(parsed) {
111
+ if (!parsed || typeof parsed !== "object") return "";
112
+ return String(parsed.session_id || parsed.sessionId || parsed.session || "").trim();
113
+ }
114
+
115
+ async function runExternalAssistantEngine({
116
+ engine,
117
+ payload,
118
+ timeoutMs = 60000,
119
+ }) {
120
+ const startedAt = Date.now();
121
+
122
+ const runAttempt = (attempt = {}) => new Promise((resolve) => {
123
+ const child = spawn(engine.command, attempt.args || [], {
124
+ cwd: payload.project_root || process.cwd(),
125
+ env: { ...process.env, UFOO_ASSISTANT_ENGINE: engine.engine || "ufoo" },
126
+ stdio: ["pipe", "pipe", "pipe"],
127
+ });
128
+
129
+ let stdout = "";
130
+ let stderr = "";
131
+ let settled = false;
132
+ const finish = (result) => {
133
+ if (settled) return;
134
+ settled = true;
135
+ resolve(result);
136
+ };
137
+
138
+ const timer = setTimeout(() => {
139
+ try {
140
+ child.kill("SIGTERM");
141
+ } catch {
142
+ // ignore
143
+ }
144
+ finish({
145
+ ok: false,
146
+ mode: attempt.mode,
147
+ code: -1,
148
+ stdout,
149
+ stderr,
150
+ error: "assistant engine timeout",
151
+ });
152
+ }, timeoutMs);
153
+
154
+ child.on("error", (err) => {
155
+ clearTimeout(timer);
156
+ finish({
157
+ ok: false,
158
+ mode: attempt.mode,
159
+ code: -1,
160
+ stdout,
161
+ stderr,
162
+ error: err && err.message ? err.message : "assistant engine spawn failed",
163
+ });
164
+ });
165
+
166
+ child.stdout.on("data", (chunk) => {
167
+ stdout += chunk.toString("utf8");
168
+ });
169
+ child.stderr.on("data", (chunk) => {
170
+ stderr += chunk.toString("utf8");
171
+ });
172
+
173
+ child.on("close", (code) => {
174
+ clearTimeout(timer);
175
+ finish({
176
+ ok: code === 0,
177
+ mode: attempt.mode,
178
+ code,
179
+ stdout,
180
+ stderr,
181
+ error: "",
182
+ });
183
+ });
184
+
185
+ try {
186
+ if (attempt.input) child.stdin.write(attempt.input);
187
+ child.stdin.end();
188
+ } catch {
189
+ // ignore stdin errors
190
+ }
191
+ });
192
+
193
+ const argsAttempt = {
194
+ mode: "args",
195
+ args: buildExternalEngineArgs(engine, payload),
196
+ input: "",
197
+ };
198
+ let result = await runAttempt(argsAttempt);
199
+
200
+ if (!result.ok && isUnsupportedArgError(result.stderr || result.stdout || result.error)) {
201
+ result = await runAttempt({
202
+ mode: "stdin-json",
203
+ args: Array.isArray(engine.args) ? [...engine.args] : [],
204
+ input: `${JSON.stringify(payload)}\n`,
205
+ });
206
+ }
207
+
208
+ const parsed = parseEngineJson(result.stdout);
209
+ if (parsed && typeof parsed === "object") {
210
+ return {
211
+ ...parsed,
212
+ sessionId: extractSessionId(parsed),
213
+ metrics: {
214
+ ...(parsed.metrics && typeof parsed.metrics === "object" ? parsed.metrics : {}),
215
+ duration_ms: Date.now() - startedAt,
216
+ },
217
+ };
218
+ }
219
+
220
+ if (result.ok) {
221
+ const summary = String(result.stdout || "").trim();
222
+ return {
223
+ ok: true,
224
+ summary,
225
+ artifacts: [],
226
+ logs: [],
227
+ error: "",
228
+ sessionId: "",
229
+ metrics: { duration_ms: Date.now() - startedAt },
230
+ };
231
+ }
232
+
233
+ return {
234
+ ok: false,
235
+ summary: "",
236
+ artifacts: [],
237
+ logs: [],
238
+ error: String(result.stderr || result.stdout || result.error || `assistant engine exited with code ${result.code}`).trim(),
239
+ sessionId: "",
240
+ metrics: { duration_ms: Date.now() - startedAt },
241
+ };
242
+ }
243
+
244
+ module.exports = {
245
+ resolveAssistantEngine,
246
+ runExternalAssistantEngine,
247
+ parseEngineJson,
248
+ splitCommand,
249
+ buildExternalEngineArgs,
250
+ isUnsupportedArgError,
251
+ extractSessionId,
252
+ };
@@ -0,0 +1,58 @@
1
+ const { runAssistantAgentTask } = require("./agent");
2
+
3
+ function readStdin() {
4
+ return new Promise((resolve) => {
5
+ let data = "";
6
+ process.stdin.setEncoding("utf8");
7
+ process.stdin.on("data", (chunk) => {
8
+ data += chunk;
9
+ });
10
+ process.stdin.on("end", () => resolve(data));
11
+ process.stdin.resume();
12
+ });
13
+ }
14
+
15
+ async function runAssistantStdio() {
16
+ const startedAt = Date.now();
17
+ try {
18
+ const input = await readStdin();
19
+ const line = String(input || "")
20
+ .split(/\r?\n/)
21
+ .map((part) => part.trim())
22
+ .find(Boolean);
23
+
24
+ if (!line) {
25
+ process.stdout.write(
26
+ `${JSON.stringify({
27
+ ok: false,
28
+ summary: "",
29
+ artifacts: [],
30
+ logs: [],
31
+ error: "missing request payload",
32
+ metrics: { duration_ms: Date.now() - startedAt },
33
+ })}\n`
34
+ );
35
+ process.exitCode = 1;
36
+ return;
37
+ }
38
+
39
+ const payload = JSON.parse(line);
40
+ const result = await runAssistantAgentTask(payload);
41
+ process.stdout.write(`${JSON.stringify(result)}\n`);
42
+ process.exitCode = result.ok ? 0 : 1;
43
+ } catch (err) {
44
+ process.stdout.write(
45
+ `${JSON.stringify({
46
+ ok: false,
47
+ summary: "",
48
+ artifacts: [],
49
+ logs: [],
50
+ error: err && err.message ? err.message : "assistant stdio failed",
51
+ metrics: { duration_ms: Date.now() - startedAt },
52
+ })}\n`
53
+ );
54
+ process.exitCode = 1;
55
+ }
56
+ }
57
+
58
+ module.exports = { runAssistantStdio };