@bojackduy/opencode-loopd 1.12.4 → 1.13.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.
- package/dist/server.js +711 -429
- package/dist/tui.js +24 -1
- package/package.json +1 -1
package/dist/tui.js
CHANGED
|
@@ -259,6 +259,9 @@ function controlDir(directory) {
|
|
|
259
259
|
function requestFile(directory, requestID) {
|
|
260
260
|
return path.join(controlDir(directory), "requests", `${requestID}.json`);
|
|
261
261
|
}
|
|
262
|
+
function processingFile(directory, requestID) {
|
|
263
|
+
return path.join(controlDir(directory), "processing", `${requestID}.json`);
|
|
264
|
+
}
|
|
262
265
|
function responseFile(directory, requestID) {
|
|
263
266
|
return path.join(controlDir(directory), "responses", `${requestID}.json`);
|
|
264
267
|
}
|
|
@@ -275,6 +278,14 @@ async function readControlResponse(directory, requestID) {
|
|
|
275
278
|
return;
|
|
276
279
|
}
|
|
277
280
|
}
|
|
281
|
+
async function statProcessingRequest(directory, requestID) {
|
|
282
|
+
try {
|
|
283
|
+
const st = await fs2.stat(processingFile(directory, requestID));
|
|
284
|
+
return { requestAgeMs: Math.max(0, Date.now() - st.mtimeMs) };
|
|
285
|
+
} catch {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
278
289
|
function commandLogFile(directory, commandID) {
|
|
279
290
|
return path.join(loopDir(directory), "commands", `${commandID}.log`);
|
|
280
291
|
}
|
|
@@ -356,10 +367,22 @@ function createControlClient(directory) {
|
|
|
356
367
|
return response;
|
|
357
368
|
await delay2(100);
|
|
358
369
|
}
|
|
370
|
+
const late = await readControlResponse(directory, request.requestID).catch(() => {
|
|
371
|
+
return;
|
|
372
|
+
});
|
|
373
|
+
if (late)
|
|
374
|
+
return late;
|
|
375
|
+
let stage = "not yet accepted by the server";
|
|
376
|
+
try {
|
|
377
|
+
const claimed = await statProcessingRequest(directory, request.requestID);
|
|
378
|
+
if (claimed) {
|
|
379
|
+
stage = `accepted by the server ${(claimed.requestAgeMs / 1000).toFixed(1)}s ago, still processing \u2014 ` + `the operation may complete later (late reply under this requestID); ` + `check the server log before retrying`;
|
|
380
|
+
}
|
|
381
|
+
} catch {}
|
|
359
382
|
return {
|
|
360
383
|
requestID: request.requestID,
|
|
361
384
|
ok: false,
|
|
362
|
-
message:
|
|
385
|
+
message: `timeout waiting for response (${stage})`,
|
|
363
386
|
errorCode: "timeout",
|
|
364
387
|
completedAt: new Date().toISOString()
|
|
365
388
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@bojackduy/opencode-loopd",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.13.0",
|
|
5
5
|
"description": "Codex-inspired background goal engine for OpenCode — autonomous subagents, engine-driven loop, child worker sessions and modal TUI dashboard. Like Claude Code loop for OpenCode.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|