repoburg 1.3.305 → 1.3.307
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/agent-pane/backend/dist/index.js +214 -7
- package/agent-pane/backend/dist/server.js +214 -7
- package/agent-pane/frontend/dist/assets/{TerminalView-CWb7lwEQ.js → TerminalView-DPvOhRXU.js} +1 -1
- package/agent-pane/frontend/dist/assets/index-Cko45vc_.js +841 -0
- package/agent-pane/frontend/dist/assets/index-wFHgyM6i.css +1 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/tabtape/extension/dist/build-info.json +3 -3
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/ui/dist/build-info.json +3 -3
- package/agent-pane/frontend/dist/assets/index-B5j2jGP4.css +0 -1
- package/agent-pane/frontend/dist/assets/index-BhyGOapD.js +0 -836
|
@@ -41237,6 +41237,12 @@ CREATE INDEX IF NOT EXISTS idx_workspaces_path ON workspaces(path);
|
|
|
41237
41237
|
if (!turnColumns.some((c) => c.name === "stream_cursor")) {
|
|
41238
41238
|
database.exec("ALTER TABLE turns ADD COLUMN stream_cursor TEXT");
|
|
41239
41239
|
}
|
|
41240
|
+
if (!turnColumns.some((c) => c.name === "origin")) {
|
|
41241
|
+
database.exec("ALTER TABLE turns ADD COLUMN origin TEXT");
|
|
41242
|
+
}
|
|
41243
|
+
if (!turnColumns.some((c) => c.name === "origin_name")) {
|
|
41244
|
+
database.exec("ALTER TABLE turns ADD COLUMN origin_name TEXT");
|
|
41245
|
+
}
|
|
41240
41246
|
const processColumns = database.prepare("PRAGMA table_info(cli_processes)").all();
|
|
41241
41247
|
if (!processColumns.some((c) => c.name === "runtime")) {
|
|
41242
41248
|
database.exec("ALTER TABLE cli_processes ADD COLUMN runtime TEXT NOT NULL DEFAULT 'claude'");
|
|
@@ -42387,8 +42393,8 @@ async function registerSessionRoutes(fastify) {
|
|
|
42387
42393
|
for (const turn of turnRows) {
|
|
42388
42394
|
const newTurnId = v4_default();
|
|
42389
42395
|
db2.prepare(
|
|
42390
|
-
`INSERT INTO turns (id, session_id, user_prompt, agent_response, thoughts, token_usage, external_turn_id, status, error, attachments, created_at, updated_at)
|
|
42391
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
42396
|
+
`INSERT INTO turns (id, session_id, user_prompt, agent_response, thoughts, token_usage, external_turn_id, status, error, attachments, origin, origin_name, created_at, updated_at)
|
|
42397
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
42392
42398
|
).run(
|
|
42393
42399
|
newTurnId,
|
|
42394
42400
|
newSessionId,
|
|
@@ -42400,6 +42406,8 @@ async function registerSessionRoutes(fastify) {
|
|
|
42400
42406
|
turn.status,
|
|
42401
42407
|
turn.error,
|
|
42402
42408
|
turn.attachments,
|
|
42409
|
+
turn.origin ?? null,
|
|
42410
|
+
turn.origin_name ?? null,
|
|
42403
42411
|
turn.created_at,
|
|
42404
42412
|
turn.updated_at
|
|
42405
42413
|
);
|
|
@@ -116803,6 +116811,12 @@ function parseTranscript(text2) {
|
|
|
116803
116811
|
link.origin = raw.origin ?? null;
|
|
116804
116812
|
link.message = raw.message ?? null;
|
|
116805
116813
|
link.toolUseResult = raw.toolUseResult;
|
|
116814
|
+
} else if (raw.type === "attachment") {
|
|
116815
|
+
const attachment = raw.attachment;
|
|
116816
|
+
if (attachment?.type === "queued_command" && attachment.origin?.kind === "peer") {
|
|
116817
|
+
link.origin = attachment.origin;
|
|
116818
|
+
link.queuedPrompt = typeof attachment.prompt === "string" ? attachment.prompt : "";
|
|
116819
|
+
}
|
|
116806
116820
|
}
|
|
116807
116821
|
entries.push(link);
|
|
116808
116822
|
}
|
|
@@ -116876,6 +116890,21 @@ function classifyUserInput(entry) {
|
|
|
116876
116890
|
const imageNote = images > 0 && !trimmed.includes("[Image") ? Array(images).fill("[Image]").join(" ") : "";
|
|
116877
116891
|
return { kind: "prompt", text: [trimmed, imageNote].filter(Boolean).join("\n") };
|
|
116878
116892
|
}
|
|
116893
|
+
function hasToolResult(content) {
|
|
116894
|
+
return Array.isArray(content) && content.some((b) => b?.type === "tool_result");
|
|
116895
|
+
}
|
|
116896
|
+
var PEER_ENVELOPE = /<cross-session-message\b[^>]*>([\s\S]*?)<\/cross-session-message>/;
|
|
116897
|
+
function peerMessageData(origin, content) {
|
|
116898
|
+
let body = typeof origin.body === "string" ? origin.body.trim() : "";
|
|
116899
|
+
if (!body) {
|
|
116900
|
+
const text2 = typeof content === "string" ? content : Array.isArray(content) ? content.map(
|
|
116901
|
+
(b) => b && typeof b === "object" && b.type === "text" ? String(b.text ?? "") : ""
|
|
116902
|
+
).join("\n") : "";
|
|
116903
|
+
const enveloped = PEER_ENVELOPE.exec(text2);
|
|
116904
|
+
body = (enveloped ? enveloped[1] : text2).trim();
|
|
116905
|
+
}
|
|
116906
|
+
return { name: origin.name?.trim() || null, from: origin.from ?? null, body };
|
|
116907
|
+
}
|
|
116879
116908
|
function syntheticText(content) {
|
|
116880
116909
|
if (typeof content === "string") return content;
|
|
116881
116910
|
if (!Array.isArray(content)) return "";
|
|
@@ -116896,6 +116925,8 @@ function buildTurns(chain) {
|
|
|
116896
116925
|
const at = stamp(entry);
|
|
116897
116926
|
const turn = {
|
|
116898
116927
|
userPrompt: prompt,
|
|
116928
|
+
origin: null,
|
|
116929
|
+
originName: null,
|
|
116899
116930
|
status: "completed",
|
|
116900
116931
|
agentResponse: null,
|
|
116901
116932
|
thoughts: null,
|
|
@@ -116928,7 +116959,25 @@ function buildTurns(chain) {
|
|
|
116928
116959
|
}
|
|
116929
116960
|
continue;
|
|
116930
116961
|
}
|
|
116962
|
+
if (entry.type === "attachment") {
|
|
116963
|
+
if (entry.origin?.kind === "peer" && current) {
|
|
116964
|
+
addItem(current, entry, {
|
|
116965
|
+
type: "peer_message",
|
|
116966
|
+
externalId: `peer-${entry.uuid}`,
|
|
116967
|
+
data: peerMessageData(entry.origin, entry.queuedPrompt ?? ""),
|
|
116968
|
+
status: "completed"
|
|
116969
|
+
});
|
|
116970
|
+
}
|
|
116971
|
+
continue;
|
|
116972
|
+
}
|
|
116931
116973
|
if (entry.type === "user") {
|
|
116974
|
+
if (entry.origin?.kind === "peer" && !hasToolResult(entry.message?.content)) {
|
|
116975
|
+
const data = peerMessageData(entry.origin, entry.message?.content);
|
|
116976
|
+
current = openTurn(data.body, entry);
|
|
116977
|
+
current.origin = "peer";
|
|
116978
|
+
current.originName = data.name;
|
|
116979
|
+
continue;
|
|
116980
|
+
}
|
|
116932
116981
|
if (entry.isMeta || entry.isCompactSummary) continue;
|
|
116933
116982
|
const content = entry.message?.content;
|
|
116934
116983
|
if (Array.isArray(content) && content.some((b) => b?.type === "tool_result")) {
|
|
@@ -117141,8 +117190,8 @@ async function importClaudeSession(db2, claudeSessionId, workspacePath) {
|
|
|
117141
117190
|
);
|
|
117142
117191
|
const insertTurn = db2.prepare(
|
|
117143
117192
|
`INSERT INTO turns (id, session_id, user_prompt, agent_response, thoughts, token_usage, external_turn_id, status,
|
|
117144
|
-
error, created_at, updated_at)
|
|
117145
|
-
VALUES (?, ?, ?, ?, ?, NULL, ?, ?, NULL, ?, ?)`
|
|
117193
|
+
error, origin, origin_name, created_at, updated_at)
|
|
117194
|
+
VALUES (?, ?, ?, ?, ?, NULL, ?, ?, NULL, ?, ?, ?, ?)`
|
|
117146
117195
|
);
|
|
117147
117196
|
const insertItem2 = db2.prepare(
|
|
117148
117197
|
`INSERT INTO items (id, turn_id, external_item_id, type, data, status, created_at, updated_at)
|
|
@@ -117172,6 +117221,8 @@ async function importClaudeSession(db2, claudeSessionId, workspacePath) {
|
|
|
117172
117221
|
turn.thoughts,
|
|
117173
117222
|
turn.externalTurnId,
|
|
117174
117223
|
turn.status,
|
|
117224
|
+
turn.origin ?? null,
|
|
117225
|
+
turn.originName ?? null,
|
|
117175
117226
|
turn.createdAt,
|
|
117176
117227
|
turn.updatedAt
|
|
117177
117228
|
);
|
|
@@ -118158,6 +118209,9 @@ function setStartupGate(started) {
|
|
|
118158
118209
|
if (startupGate === gate) startupPending = false;
|
|
118159
118210
|
});
|
|
118160
118211
|
}
|
|
118212
|
+
function noteAdoptedTurn(turnId) {
|
|
118213
|
+
if (startupPending) lastResult.turnIds.add(turnId);
|
|
118214
|
+
}
|
|
118161
118215
|
function lastAdoption() {
|
|
118162
118216
|
return lastResult;
|
|
118163
118217
|
}
|
|
@@ -121171,7 +121225,11 @@ function rescueWaitMs() {
|
|
|
121171
121225
|
}
|
|
121172
121226
|
var RESCUE_ENV = ["CLAUDE_CODE_RESUME_INTERRUPTED_TURN", "CLAUDE_CODE_RESUME_REASON"];
|
|
121173
121227
|
function spawnEnv(sessionId, resume) {
|
|
121174
|
-
const env = {
|
|
121228
|
+
const env = {
|
|
121229
|
+
...process.env,
|
|
121230
|
+
AGENT_PANE_SESSION_ID: sessionId,
|
|
121231
|
+
CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS: "1"
|
|
121232
|
+
};
|
|
121175
121233
|
for (const k of RESCUE_ENV) delete env[k];
|
|
121176
121234
|
if (resume) {
|
|
121177
121235
|
env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN = "1";
|
|
@@ -121354,6 +121412,9 @@ async function ensureSessionStarted(session, mapKey, resumeSessionId, resume, ad
|
|
|
121354
121412
|
permissionMode: "bypassPermissions",
|
|
121355
121413
|
allowDangerouslySkipPermissions: true,
|
|
121356
121414
|
includePartialMessages: true,
|
|
121415
|
+
// Echo user messages: a message from another Claude session (SendMessage)
|
|
121416
|
+
// reaches the pane only this way, with its sender in `origin` (MUH-102).
|
|
121417
|
+
extraArgs: { "replay-user-messages": null },
|
|
121357
121418
|
// Inline visuals: the model's show_widget calls render in the chat.
|
|
121358
121419
|
mcpServers: { [WIDGET_SERVER_NAME]: createWidgetMcpServer() },
|
|
121359
121420
|
...CLI_OVERRIDE,
|
|
@@ -121461,12 +121522,26 @@ async function dispatchFrame(entry, sessionId, message, db2, opts = {}) {
|
|
|
121461
121522
|
entry.rateLimit = message.rate_limit_info;
|
|
121462
121523
|
return;
|
|
121463
121524
|
}
|
|
121525
|
+
const state = sessionStateOf(message);
|
|
121526
|
+
if (state) {
|
|
121527
|
+
handleSessionState(entry, state, db2);
|
|
121528
|
+
return;
|
|
121529
|
+
}
|
|
121530
|
+
const peer = peerOriginOf(message);
|
|
121531
|
+
if (peer) {
|
|
121532
|
+
handlePeerMessage(entry, sessionId, message, peer, db2);
|
|
121533
|
+
return;
|
|
121534
|
+
}
|
|
121535
|
+
if (entry.selfStarted && isModelFrame(message)) reopenForFollowUp(entry, sessionId, db2);
|
|
121464
121536
|
const currentTurnId = entry.turnId;
|
|
121465
121537
|
if (!currentTurnId) {
|
|
121466
121538
|
handleTaskFrame(message, sessionId, entry, db2);
|
|
121467
121539
|
return;
|
|
121468
121540
|
}
|
|
121469
121541
|
if (entry.resume && !trackResumeFrame(entry, message, db2)) return;
|
|
121542
|
+
if (message.type === "result" && !message.parent_tool_use_id) {
|
|
121543
|
+
entry.resultTurnId = currentTurnId;
|
|
121544
|
+
}
|
|
121470
121545
|
if (opts.awaitResult && message.type === "result") {
|
|
121471
121546
|
await handleResultMessage(message, sessionId, currentTurnId, entry, db2);
|
|
121472
121547
|
return;
|
|
@@ -121477,6 +121552,119 @@ function isTurnLive2(db2, turnId) {
|
|
|
121477
121552
|
const row = db2.prepare("SELECT status FROM turns WHERE id = ?").get(turnId);
|
|
121478
121553
|
return row?.status === "pending" || row?.status === "running";
|
|
121479
121554
|
}
|
|
121555
|
+
function sessionStateOf(message) {
|
|
121556
|
+
if (message.type !== "system") return null;
|
|
121557
|
+
const m = message;
|
|
121558
|
+
if (m.subtype !== "session_state_changed") return null;
|
|
121559
|
+
return m.state === "idle" || m.state === "running" || m.state === "requires_action" ? m.state : null;
|
|
121560
|
+
}
|
|
121561
|
+
function peerOriginOf(message) {
|
|
121562
|
+
if (message.type !== "user") return null;
|
|
121563
|
+
if (message.parent_tool_use_id) return null;
|
|
121564
|
+
const origin = message.origin;
|
|
121565
|
+
return origin?.kind === "peer" ? origin : null;
|
|
121566
|
+
}
|
|
121567
|
+
var PEER_ENVELOPE2 = /<cross-session-message\b[^>]*>([\s\S]*?)<\/cross-session-message>/;
|
|
121568
|
+
function peerMessageBody(content, origin) {
|
|
121569
|
+
if (typeof origin.body === "string" && origin.body.trim()) return origin.body.trim();
|
|
121570
|
+
let text2 = "";
|
|
121571
|
+
if (typeof content === "string") text2 = content;
|
|
121572
|
+
else if (Array.isArray(content)) {
|
|
121573
|
+
text2 = content.map((b) => b && typeof b === "object" && b.type === "text" ? String(b.text ?? "") : "").join("\n");
|
|
121574
|
+
}
|
|
121575
|
+
const enveloped = PEER_ENVELOPE2.exec(text2);
|
|
121576
|
+
return (enveloped ? enveloped[1] : text2).trim();
|
|
121577
|
+
}
|
|
121578
|
+
function turnInProgress(entry, db2) {
|
|
121579
|
+
return !!entry.turnId && entry.resultTurnId !== entry.turnId && isTurnLive2(db2, entry.turnId);
|
|
121580
|
+
}
|
|
121581
|
+
function handleSessionState(entry, state, db2) {
|
|
121582
|
+
if (state === "running") {
|
|
121583
|
+
entry.selfStarted = !entry.resume && !turnInProgress(entry, db2);
|
|
121584
|
+
} else if (state === "idle") {
|
|
121585
|
+
entry.selfStarted = false;
|
|
121586
|
+
}
|
|
121587
|
+
}
|
|
121588
|
+
function handlePeerMessage(entry, sessionId, message, origin, db2) {
|
|
121589
|
+
const uuid3 = message.uuid ?? null;
|
|
121590
|
+
const body = peerMessageBody(message.message?.content, origin);
|
|
121591
|
+
const name = origin.name?.trim() || null;
|
|
121592
|
+
entry.selfStarted = false;
|
|
121593
|
+
if (uuid3) {
|
|
121594
|
+
const known = db2.prepare("SELECT id FROM turns WHERE session_id = ? AND runtime_input_ids = ?").get(sessionId, JSON.stringify([uuid3]));
|
|
121595
|
+
if (known) {
|
|
121596
|
+
entry.turnId = known.id;
|
|
121597
|
+
return;
|
|
121598
|
+
}
|
|
121599
|
+
}
|
|
121600
|
+
if (entry.turnId && turnInProgress(entry, db2)) {
|
|
121601
|
+
upsertItem(
|
|
121602
|
+
db2,
|
|
121603
|
+
{ type: "peer_message", data: { name, from: origin.from ?? null, body }, externalId: `peer-${uuid3 ?? v4_default()}` },
|
|
121604
|
+
sessionId,
|
|
121605
|
+
entry.turnId,
|
|
121606
|
+
"completed",
|
|
121607
|
+
"item:completed"
|
|
121608
|
+
);
|
|
121609
|
+
return;
|
|
121610
|
+
}
|
|
121611
|
+
openPeerTurn(entry, sessionId, { body, name, uuid: uuid3 }, db2);
|
|
121612
|
+
}
|
|
121613
|
+
function openPeerTurn(entry, sessionId, peer, db2) {
|
|
121614
|
+
const previous = entry.turnId;
|
|
121615
|
+
if (previous && previous !== entry.resultTurnId && isTurnLive2(db2, previous)) {
|
|
121616
|
+
const prev = db2.prepare("SELECT token_usage FROM turns WHERE id = ?").get(previous);
|
|
121617
|
+
completeTurn2(db2, sessionId, previous, prev?.token_usage ? JSON.parse(prev.token_usage) : null);
|
|
121618
|
+
}
|
|
121619
|
+
if (previous) streamingMessageIds.delete(previous);
|
|
121620
|
+
const threadId = entry.threadId ?? null;
|
|
121621
|
+
const turnId = v4_default();
|
|
121622
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
121623
|
+
const inputIds = peer.uuid ? JSON.stringify([peer.uuid]) : null;
|
|
121624
|
+
db2.prepare(
|
|
121625
|
+
`INSERT INTO turns (id, session_id, user_prompt, status, thread_id, runtime_input_ids, origin, origin_name, created_at, updated_at)
|
|
121626
|
+
VALUES (?, ?, ?, 'running', ?, ?, 'peer', ?, ?, ?)`
|
|
121627
|
+
).run(turnId, sessionId, peer.body, threadId, inputIds, peer.name, now, now);
|
|
121628
|
+
entry.turnId = turnId;
|
|
121629
|
+
entry.lastApiError = null;
|
|
121630
|
+
entry.reopenedTurnId = null;
|
|
121631
|
+
bindHostTurn2(entry, turnId);
|
|
121632
|
+
setSessionStatus2(db2, sessionId, 1, "running", now);
|
|
121633
|
+
const row = db2.prepare("SELECT * FROM turns WHERE id = ?").get(turnId);
|
|
121634
|
+
const turn = {
|
|
121635
|
+
...row,
|
|
121636
|
+
token_usage: null,
|
|
121637
|
+
attachments: null,
|
|
121638
|
+
runtime_input_ids: peer.uuid ? [peer.uuid] : null,
|
|
121639
|
+
items: []
|
|
121640
|
+
};
|
|
121641
|
+
if (threadId) {
|
|
121642
|
+
db2.prepare("UPDATE discussion_threads SET updated_at = ? WHERE id = ?").run(now, threadId);
|
|
121643
|
+
broadcast("thread:followup", { sessionId, threadId, turn });
|
|
121644
|
+
} else {
|
|
121645
|
+
broadcast("turn:created", { sessionId, turn });
|
|
121646
|
+
}
|
|
121647
|
+
broadcast("turn:started", { sessionId, turnId });
|
|
121648
|
+
}
|
|
121649
|
+
function reopenForFollowUp(entry, sessionId, db2) {
|
|
121650
|
+
entry.selfStarted = false;
|
|
121651
|
+
const turnId = entry.turnId;
|
|
121652
|
+
if (!turnId) return;
|
|
121653
|
+
entry.reopenedTurnId = turnId;
|
|
121654
|
+
const reopen = () => {
|
|
121655
|
+
if (entry.turnId !== turnId || entry.reopenedTurnId !== turnId || entry.closeReason) return;
|
|
121656
|
+
const row = db2.prepare("SELECT status FROM turns WHERE id = ?").get(turnId);
|
|
121657
|
+
if (row?.status !== "completed") return;
|
|
121658
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
121659
|
+
db2.prepare("UPDATE turns SET status = 'running', updated_at = ? WHERE id = ?").run(now, turnId);
|
|
121660
|
+
if (entry.resultTurnId === turnId) entry.resultTurnId = null;
|
|
121661
|
+
bindHostTurn2(entry, turnId);
|
|
121662
|
+
setSessionStatus2(db2, sessionId, 1, "running", now);
|
|
121663
|
+
broadcast("turn:started", { sessionId, turnId });
|
|
121664
|
+
};
|
|
121665
|
+
if (entry.settling) void entry.settling.then(reopen, reopen);
|
|
121666
|
+
else reopen();
|
|
121667
|
+
}
|
|
121480
121668
|
async function startTurn3(session, turn) {
|
|
121481
121669
|
if (isAdoptionPending()) await waitForAdoption();
|
|
121482
121670
|
const db2 = getDb();
|
|
@@ -121517,6 +121705,9 @@ async function startTurn3(session, turn) {
|
|
|
121517
121705
|
}
|
|
121518
121706
|
entry.turnId = turn.id;
|
|
121519
121707
|
entry.lastApiError = null;
|
|
121708
|
+
entry.reopenedTurnId = null;
|
|
121709
|
+
entry.resultTurnId = null;
|
|
121710
|
+
entry.selfStarted = false;
|
|
121520
121711
|
clearResume(entry);
|
|
121521
121712
|
bindHostTurn2(entry, turn.id);
|
|
121522
121713
|
db2.prepare("UPDATE turns SET status = ?, updated_at = ? WHERE id = ?").run("running", now, turn.id);
|
|
@@ -121984,14 +122175,25 @@ function handleBackgroundTasksChanged(message, sessionId, entry) {
|
|
|
121984
122175
|
async function handleResultMessage(message, sessionId, turnId, entry, db2) {
|
|
121985
122176
|
const parentToolUseId = message.parent_tool_use_id ?? null;
|
|
121986
122177
|
if (parentToolUseId) return;
|
|
122178
|
+
const followUp = entry.reopenedTurnId === turnId;
|
|
122179
|
+
const settling = settleResult(message, sessionId, turnId, entry, db2, followUp);
|
|
122180
|
+
const tracked = settling.then(
|
|
122181
|
+
() => {
|
|
122182
|
+
},
|
|
122183
|
+
() => {
|
|
122184
|
+
}
|
|
122185
|
+
);
|
|
122186
|
+
entry.settling = tracked;
|
|
121987
122187
|
try {
|
|
121988
|
-
await
|
|
122188
|
+
await settling;
|
|
121989
122189
|
} finally {
|
|
122190
|
+
if (followUp && entry.reopenedTurnId === turnId) entry.reopenedTurnId = null;
|
|
122191
|
+
if (entry.settling === tracked) entry.settling = null;
|
|
121990
122192
|
settleHostTurn2(entry);
|
|
121991
122193
|
maybeRetire2(entry);
|
|
121992
122194
|
}
|
|
121993
122195
|
}
|
|
121994
|
-
async function settleResult(message, sessionId, turnId, entry, db2) {
|
|
122196
|
+
async function settleResult(message, sessionId, turnId, entry, db2, followUp = false) {
|
|
121995
122197
|
if (message.subtype === "success") {
|
|
121996
122198
|
const usage = mapUsage(message.usage);
|
|
121997
122199
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -122002,6 +122204,10 @@ async function settleResult(message, sessionId, turnId, entry, db2) {
|
|
|
122002
122204
|
if (message.is_error) {
|
|
122003
122205
|
const row = db2.prepare("SELECT status, resume_state FROM turns WHERE id = ?").get(turnId);
|
|
122004
122206
|
if (!row || row.status === "pending" && row.resume_state === "waiting") return;
|
|
122207
|
+
if (followUp && row.status === "running") {
|
|
122208
|
+
completeTurn2(db2, sessionId, turnId, null);
|
|
122209
|
+
row.status = "completed";
|
|
122210
|
+
}
|
|
122005
122211
|
const text2 = (message.result || apiError?.text || "Claude API error").trim();
|
|
122006
122212
|
const kind = classifyApiError({
|
|
122007
122213
|
error: apiError?.error,
|
|
@@ -122550,6 +122756,7 @@ function bindHostTurn2(entry, turnId) {
|
|
|
122550
122756
|
const host = entry.host;
|
|
122551
122757
|
const proc = host?.proc;
|
|
122552
122758
|
if (!host || !proc?.hosted) return;
|
|
122759
|
+
noteAdoptedTurn(turnId);
|
|
122553
122760
|
const offset = proc.consumedLineEnd;
|
|
122554
122761
|
try {
|
|
122555
122762
|
setHostTurn(getDb(), host.id, turnId, offset);
|