linco-connect 1.0.5 → 1.0.6
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/package.json +1 -1
- package/src/agents/codex.js +16 -7
package/package.json
CHANGED
package/src/agents/codex.js
CHANGED
|
@@ -43,6 +43,7 @@ function runAppServerTurn(input, ws, session, config) {
|
|
|
43
43
|
session.isTurnActive = true;
|
|
44
44
|
session.currentInputForNoOutput = input;
|
|
45
45
|
session.sawPartialAssistantText = false;
|
|
46
|
+
session.codexAssistantEnded = false;
|
|
46
47
|
resetCodexAssistantText(session);
|
|
47
48
|
session._lastWs = ws;
|
|
48
49
|
session._lastConfig = config;
|
|
@@ -257,6 +258,13 @@ function startNewThread(session, agentConfig) {
|
|
|
257
258
|
});
|
|
258
259
|
}
|
|
259
260
|
|
|
261
|
+
function sendCodexAssistantEnd(ws, session) {
|
|
262
|
+
if (session.codexAssistantEnded) return;
|
|
263
|
+
session.codexAssistantEnded = true;
|
|
264
|
+
flushCodexAssistantText(ws, session);
|
|
265
|
+
send(ws, 'assistant_end', {});
|
|
266
|
+
}
|
|
267
|
+
|
|
260
268
|
function clearTurnState(session) {
|
|
261
269
|
flushCodexAssistantText(session._lastWs, session);
|
|
262
270
|
session.isTurnActive = false;
|
|
@@ -275,6 +283,7 @@ function ensureCodexStreamState(session) {
|
|
|
275
283
|
}
|
|
276
284
|
|
|
277
285
|
function appendCodexAssistantText(text, ws, session, ensureAssistantStarted) {
|
|
286
|
+
if (session.codexAssistantEnded) return;
|
|
278
287
|
const state = ensureCodexStreamState(session);
|
|
279
288
|
state.onStart = ensureAssistantStarted;
|
|
280
289
|
appendTextStream(text, ws, state);
|
|
@@ -529,21 +538,21 @@ function handleAppServerMessage(message, session) {
|
|
|
529
538
|
if (text && !session.sawPartialAssistantText) {
|
|
530
539
|
appendCodexAssistantText(text, ws, session, () => send(ws, 'assistant_start', {}));
|
|
531
540
|
}
|
|
532
|
-
// Safety fallback: if turn/completed doesn't
|
|
533
|
-
// clear isTurnActive so the next message doesn't get stuck.
|
|
541
|
+
// Safety fallback: if turn/completed never arrives, clear isTurnActive so the next message doesn't get stuck.
|
|
534
542
|
if (session.turnCompletedTimerId) clearTimeout(session.turnCompletedTimerId);
|
|
535
543
|
session.turnCompletedTimerId = setTimeout(() => {
|
|
536
544
|
if (session.isTurnActive) {
|
|
537
545
|
session.isTurnActive = false;
|
|
538
546
|
session.currentInputForNoOutput = null;
|
|
539
547
|
if (session.sawPartialAssistantText) {
|
|
540
|
-
|
|
541
|
-
|
|
548
|
+
sendCodexAssistantEnd(ws, session);
|
|
549
|
+
} else {
|
|
550
|
+
sendSystem(ws, 'Codex 本次执行没有输出。');
|
|
542
551
|
}
|
|
543
552
|
const cfg = session._lastConfig;
|
|
544
553
|
if (cfg) drainQueue(ws, session, cfg);
|
|
545
554
|
}
|
|
546
|
-
},
|
|
555
|
+
}, 10000);
|
|
547
556
|
return;
|
|
548
557
|
}
|
|
549
558
|
|
|
@@ -555,8 +564,7 @@ function handleAppServerMessage(message, session) {
|
|
|
555
564
|
updateCodexSessionStats(session, params);
|
|
556
565
|
clearTurnState(session);
|
|
557
566
|
if (session.sawPartialAssistantText) {
|
|
558
|
-
|
|
559
|
-
send(ws, 'assistant_end', {});
|
|
567
|
+
sendCodexAssistantEnd(ws, session);
|
|
560
568
|
} else {
|
|
561
569
|
sendSystem(ws, 'Codex 本次执行没有输出。');
|
|
562
570
|
}
|
|
@@ -725,6 +733,7 @@ function runExecTurn(input, ws, session, config) {
|
|
|
725
733
|
session.isTurnActive = true;
|
|
726
734
|
session.currentInputForNoOutput = input;
|
|
727
735
|
session.sawPartialAssistantText = false;
|
|
736
|
+
session.codexAssistantEnded = false;
|
|
728
737
|
resetCodexAssistantText(session);
|
|
729
738
|
|
|
730
739
|
const agentConfig = config.agents?.codex || {};
|