@ai-setting/roy-task-plugin 0.4.0 → 0.4.1
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/cli.js +27 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1239,6 +1239,18 @@ class NdjsonAssembler {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
1241
|
// ../../../packages/cli/src/daemon/runners/claude-stream.ts
|
|
1242
|
+
function errorDetail(result) {
|
|
1243
|
+
if (typeof result.result === "string" && result.result.trim() !== "") {
|
|
1244
|
+
return result.result.trim();
|
|
1245
|
+
}
|
|
1246
|
+
if (Array.isArray(result.errors)) {
|
|
1247
|
+
const parts = result.errors.map((e) => typeof e === "string" ? e.trim() : "").filter((e) => e !== "");
|
|
1248
|
+
if (parts.length > 0)
|
|
1249
|
+
return parts.join("; ");
|
|
1250
|
+
}
|
|
1251
|
+
return result.subtype === undefined ? "claude reported is_error" : `claude reported ${result.subtype}`;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1242
1254
|
class ClaudeStreamDecoder {
|
|
1243
1255
|
lines = new LineSplitter;
|
|
1244
1256
|
state = { assistantText: [], tools: [] };
|
|
@@ -1300,7 +1312,7 @@ class ClaudeStreamDecoder {
|
|
|
1300
1312
|
const toolCalls = this.state.tools.length > 0 ? this.state.tools.length : undefined;
|
|
1301
1313
|
const tools = this.state.tools.length > 0 ? [...this.state.tools] : undefined;
|
|
1302
1314
|
if (result?.is_error) {
|
|
1303
|
-
const detail =
|
|
1315
|
+
const detail = errorDetail(result);
|
|
1304
1316
|
return { text: "", sessionId: this.state.sessionId, toolCalls, tools, error: detail.slice(0, 1000) };
|
|
1305
1317
|
}
|
|
1306
1318
|
if (typeof result?.result === "string" && result.result.trim() !== "") {
|
|
@@ -1387,27 +1399,30 @@ function makeClaudeRunner(opts = {}) {
|
|
|
1387
1399
|
return { text: "", error: errMsg(err) };
|
|
1388
1400
|
}
|
|
1389
1401
|
const result = decoder.finish();
|
|
1390
|
-
|
|
1391
|
-
|
|
1402
|
+
const stderrText = stderr.trim();
|
|
1403
|
+
const combined = result.error ? stderrText && !result.error.includes(stderrText) ? `${result.error} | ${stderrText}` : result.error : undefined;
|
|
1404
|
+
const effective = combined ? { ...result, error: combined.slice(0, 1000) } : result;
|
|
1405
|
+
if (input.sessionId && effective.sessionId) {
|
|
1406
|
+
sessions.set(input.sessionId, effective.sessionId);
|
|
1392
1407
|
}
|
|
1393
1408
|
if (code === 124) {
|
|
1394
|
-
return { ...
|
|
1409
|
+
return { ...effective, error: `claude timed out after ${timeoutMs}ms` };
|
|
1395
1410
|
}
|
|
1396
|
-
if (
|
|
1397
|
-
if (input.sessionId && /No conversation found|not a UUID|session title/i.test(
|
|
1411
|
+
if (effective.error) {
|
|
1412
|
+
if (input.sessionId && /No conversation found|not a UUID|session title/i.test(effective.error)) {
|
|
1398
1413
|
sessions.delete(input.sessionId);
|
|
1399
1414
|
}
|
|
1400
|
-
return
|
|
1415
|
+
return effective;
|
|
1401
1416
|
}
|
|
1402
|
-
if (code !== 0 && !
|
|
1417
|
+
if (code !== 0 && !effective.text) {
|
|
1403
1418
|
return {
|
|
1404
1419
|
text: "",
|
|
1405
|
-
toolCalls:
|
|
1406
|
-
tools:
|
|
1420
|
+
toolCalls: effective.toolCalls,
|
|
1421
|
+
tools: effective.tools,
|
|
1407
1422
|
error: `claude exited ${code}: ${(stderr || "no stderr").trim().slice(0, 1000)}`
|
|
1408
1423
|
};
|
|
1409
1424
|
}
|
|
1410
|
-
return
|
|
1425
|
+
return effective;
|
|
1411
1426
|
};
|
|
1412
1427
|
}
|
|
1413
1428
|
function errMsg(err) {
|
|
@@ -1855,7 +1870,7 @@ function formatStatus(report) {
|
|
|
1855
1870
|
}
|
|
1856
1871
|
|
|
1857
1872
|
// ../../../packages/cli/src/main.ts
|
|
1858
|
-
var VERSION = "0.4.
|
|
1873
|
+
var VERSION = "0.4.1";
|
|
1859
1874
|
async function main(argv) {
|
|
1860
1875
|
const parsed = parseArgs(argv);
|
|
1861
1876
|
switch (parsed.command) {
|