lark-coding-assistant 0.2.7 → 0.2.8
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 +32 -6
- package/dist/cli.js.map +1 -1
- package/dist/daemon-entry.js +73 -32
- package/dist/daemon-entry.js.map +1 -1
- package/dist/hook-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -948,6 +948,19 @@ function formatKnownError(error, context) {
|
|
|
948
948
|
` lark-coding-assistant attach ${ownerSessionId}`
|
|
949
949
|
];
|
|
950
950
|
}
|
|
951
|
+
case "AGENT_EXITED": {
|
|
952
|
+
const exitStatus = typeof context.exitStatus === "number" ? `\uFF08\u9000\u51FA\u7801 ${context.exitStatus}\uFF09` : "";
|
|
953
|
+
return [
|
|
954
|
+
`Agent \u5DF2\u9000\u51FA${exitStatus}\uFF0Csession\u300C${sessionId}\u300D\u5DF2\u5173\u95ED\u3002`,
|
|
955
|
+
"",
|
|
956
|
+
"\u539F\u59CB\u9519\u8BEF\uFF1A",
|
|
957
|
+
safeValue(context.terminalExcerpt, "Agent \u672A\u8F93\u51FA\u53EF\u7528\u9519\u8BEF\u4FE1\u606F\u3002"),
|
|
958
|
+
"",
|
|
959
|
+
"\u53EF\u67E5\u770B\u65E5\u5FD7\u6216\u91CD\u65B0\u542F\u52A8\uFF1A",
|
|
960
|
+
" lark-coding-assistant logs",
|
|
961
|
+
` lark-coding-assistant start --name ${sessionId} --agent ${safeValue(context.agent, "codex")}`
|
|
962
|
+
];
|
|
963
|
+
}
|
|
951
964
|
case "AGENT_EXITED_DURING_STARTUP": {
|
|
952
965
|
const exitStatus = typeof context.exitStatus === "number" ? `\uFF08\u9000\u51FA\u7801 ${context.exitStatus}\uFF09` : "";
|
|
953
966
|
return [
|
|
@@ -1453,7 +1466,7 @@ async function attachLocal(name) {
|
|
|
1453
1466
|
const session = state.sessions?.[name];
|
|
1454
1467
|
if (!session) {
|
|
1455
1468
|
const exitEvent2 = state.recentSessionExits?.[name];
|
|
1456
|
-
if (exitEvent2
|
|
1469
|
+
if (exitEvent2) throw sessionExitError(exitEvent2);
|
|
1457
1470
|
throw new AppError("SESSION_NOT_FOUND", `no managed session: ${name}`, { sessionId: name });
|
|
1458
1471
|
}
|
|
1459
1472
|
if (!config) throw new AppError("NOT_INITIALIZED", "not initialized");
|
|
@@ -1466,7 +1479,7 @@ async function attachLocal(name) {
|
|
|
1466
1479
|
}, { cause: error });
|
|
1467
1480
|
}
|
|
1468
1481
|
const exitEvent2 = (await store.loadState()).recentSessionExits?.[name];
|
|
1469
|
-
if (exitEvent2
|
|
1482
|
+
if (exitEvent2) throw sessionExitError(exitEvent2);
|
|
1470
1483
|
throw new AppError("SESSION_NOT_FOUND", `managed session is no longer running: ${name}`, {
|
|
1471
1484
|
sessionId: name
|
|
1472
1485
|
}, { cause: error });
|
|
@@ -1485,16 +1498,29 @@ async function attachLocal(name) {
|
|
|
1485
1498
|
});
|
|
1486
1499
|
child.once("exit", resolveExit);
|
|
1487
1500
|
});
|
|
1501
|
+
await requestDaemon(paths.socket, { method: "reconcile" }, 2500).catch(() => void 0);
|
|
1488
1502
|
const exitEvent = (await store.loadState()).recentSessionExits?.[name];
|
|
1489
|
-
if (exitEvent
|
|
1490
|
-
throw
|
|
1503
|
+
if (exitEvent && exitEvent.occurredAt >= attachedAt) {
|
|
1504
|
+
throw sessionExitError(exitEvent);
|
|
1491
1505
|
}
|
|
1492
1506
|
if (code && code !== 0) process.exitCode = code;
|
|
1493
1507
|
}
|
|
1494
|
-
function
|
|
1508
|
+
function sessionExitError(event) {
|
|
1509
|
+
if (event.reason === "agent-exited") {
|
|
1510
|
+
return new AppError(
|
|
1511
|
+
"AGENT_EXITED",
|
|
1512
|
+
`agent exited: ${event.sessionId}`,
|
|
1513
|
+
{
|
|
1514
|
+
sessionId: event.sessionId,
|
|
1515
|
+
agent: event.agent,
|
|
1516
|
+
exitStatus: event.exitStatus,
|
|
1517
|
+
terminalExcerpt: event.terminalExcerpt
|
|
1518
|
+
}
|
|
1519
|
+
);
|
|
1520
|
+
}
|
|
1495
1521
|
return new AppError(
|
|
1496
1522
|
"AGENT_SESSION_IN_USE",
|
|
1497
|
-
`agent session is already managed by ${event.ownerSessionId}`,
|
|
1523
|
+
`agent session is already managed by ${event.ownerSessionId ?? "another session"}`,
|
|
1498
1524
|
{
|
|
1499
1525
|
sessionId: event.sessionId,
|
|
1500
1526
|
agent: event.agent,
|