@centralu/win32-x64 0.1.0-beta.73 → 0.1.0-beta.75
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/Centralu/centralu.exe
CHANGED
|
Binary file
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"commit": "
|
|
2
|
+
"commit": "a401449",
|
|
3
3
|
"protocolVersion": 1,
|
|
4
4
|
"hostProof": 1,
|
|
5
5
|
"tokenOnStdin": 1,
|
|
6
6
|
"verifiers": 1,
|
|
7
7
|
"keyPairing": 1,
|
|
8
|
-
"builtAt": "2026-11-
|
|
8
|
+
"builtAt": "2026-11-17T06:45:44.132Z",
|
|
9
9
|
"runtime": "system-node",
|
|
10
10
|
"platform": "win32",
|
|
11
11
|
"arch": "x64"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "centralu",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.75",
|
|
4
4
|
"description": "Run, watch and steer several Claude Code and Codex CLI sessions from one window",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ijun17",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"win32"
|
|
39
39
|
],
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@centralu/darwin-arm64": "0.1.0-beta.
|
|
42
|
-
"@centralu/linux-arm64": "0.1.0-beta.
|
|
43
|
-
"@centralu/linux-x64": "0.1.0-beta.
|
|
44
|
-
"@centralu/win32-x64": "0.1.0-beta.
|
|
41
|
+
"@centralu/darwin-arm64": "0.1.0-beta.75",
|
|
42
|
+
"@centralu/linux-arm64": "0.1.0-beta.75",
|
|
43
|
+
"@centralu/linux-x64": "0.1.0-beta.75",
|
|
44
|
+
"@centralu/win32-x64": "0.1.0-beta.75"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -43046,7 +43046,7 @@ import { dirname as dirname27, join as join58 } from "node:path";
|
|
|
43046
43046
|
import { mkdirSync as mkdirSync21, readFileSync as readFileSync27, writeSync as writeSync4 } from "node:fs";
|
|
43047
43047
|
|
|
43048
43048
|
// packages/protocol/src/version.generated.ts
|
|
43049
|
-
var APP_VERSION = "0.1.0-beta.
|
|
43049
|
+
var APP_VERSION = "0.1.0-beta.75";
|
|
43050
43050
|
|
|
43051
43051
|
// packages/protocol/src/brand.ts
|
|
43052
43052
|
var APP_NAME = "Centralu";
|
|
@@ -64755,8 +64755,9 @@ function activityCounts(s) {
|
|
|
64755
64755
|
function turnCut(s) {
|
|
64756
64756
|
return inTurn(s.state);
|
|
64757
64757
|
}
|
|
64758
|
-
function cutTurns(s) {
|
|
64759
|
-
|
|
64758
|
+
function cutTurns(s, woken = []) {
|
|
64759
|
+
const inTurnNow = s.sessions.flatMap((x) => x.id !== void 0 && turnCut(x) ? [{ id: x.id }] : []);
|
|
64760
|
+
return [...inTurnNow, ...woken.filter((id3) => !inTurnNow.some((t) => t.id === id3)).map((id3) => ({ id: id3, woken: true }))];
|
|
64760
64761
|
}
|
|
64761
64762
|
function sessionIdle(s, process4) {
|
|
64762
64763
|
const busy = busyWith(s);
|
|
@@ -112783,6 +112784,10 @@ var ChildReports = class {
|
|
|
112783
112784
|
if (cut3) this.cutsUntold.add(sessionId);
|
|
112784
112785
|
this.answerAtRest(sessionId, true);
|
|
112785
112786
|
}
|
|
112787
|
+
/** An update cut the turn and Centralu continued it (#1966), and the turn's end is a later one's (#2318): the answer that follows says so */
|
|
112788
|
+
noteCut(sessionId) {
|
|
112789
|
+
this.cutsUntold.add(sessionId);
|
|
112790
|
+
}
|
|
112786
112791
|
/** A turn stopped: its stop notice releases what the session owed, so a cut kept from a turn before is no later answer's to tell (#1966) */
|
|
112787
112792
|
turnStopped(sessionId) {
|
|
112788
112793
|
this.cutsUntold.delete(sessionId);
|
|
@@ -113154,6 +113159,12 @@ var InputReceipts = class {
|
|
|
113154
113159
|
get ids() {
|
|
113155
113160
|
return [...this.pending.keys()];
|
|
113156
113161
|
}
|
|
113162
|
+
/** How many wait for the tool to take them: not taken by a turn, and not among `except` (the ones the turn ending now took) */
|
|
113163
|
+
untaken(except) {
|
|
113164
|
+
let n = 0;
|
|
113165
|
+
for (const [id3, p] of this.pending) if (!p.accepted && !except.includes(id3)) n++;
|
|
113166
|
+
return n;
|
|
113167
|
+
}
|
|
113157
113168
|
/** The tool took the input (once): the observer is told before the turn is recorded */
|
|
113158
113169
|
accept(id3) {
|
|
113159
113170
|
const p = this.pending.get(id3);
|
|
@@ -113291,7 +113302,7 @@ var CONTINUE_NOTES = {
|
|
|
113291
113302
|
var UPDATE_WAKES_AT_ONCE = 3;
|
|
113292
113303
|
var UPDATE_SLOT_MS = 12e4;
|
|
113293
113304
|
var ANSWERED = /* @__PURE__ */ new Set(["message_delta", "reasoning_delta", "tool_call", "usage_update", "approval_request", "question_request", "error", "limit_reached", "session_deleted"]);
|
|
113294
|
-
var wakeEnded = (e) => ANSWERED.has(e.type) || e.type === "
|
|
113305
|
+
var wakeEnded = (e) => ANSWERED.has(e.type) || e.type === "state_change" && e.state !== "working" || e.type === "session_live" && !e.live;
|
|
113295
113306
|
var RESET_MARGIN_MS = 6e4;
|
|
113296
113307
|
var NO_RESET_RETRY_MS = 30 * 6e4;
|
|
113297
113308
|
var PROBE_STEPS_MS = [15e3, 3e4, 6e4, 12e4, 3e5];
|
|
@@ -113385,27 +113396,12 @@ ${spentWords(tries)}` } };
|
|
|
113385
113396
|
this.wait(m.id, { cause: i.reason, tool: m.tool, at: a.at, tries: a.tries, phase: "waiting" });
|
|
113386
113397
|
}
|
|
113387
113398
|
}
|
|
113388
|
-
/**
|
|
113389
|
-
* Holds `e` when it is the turn end a process resumed by an update's wake says of its own before the note's turn (`ANSWERED`), and says whether it
|
|
113390
|
-
* did: the first `turn_complete` once the wake is in (`waking`), nothing having answered it. It ends no turn of the session's (#2312). Read as one, it
|
|
113391
|
-
* answered the continued turn's tasks with the cut turn's words and left the session at rest while the note's turn ran, so the real end reported
|
|
113392
|
-
* nothing. A second one is the turn's end. Held, it is said after all when the slot runs out with nothing run (`slotOver`). Only for a tool that
|
|
113393
|
-
* says it ends such a turn (`AgentAdapter.resumeEndsOwnTurn`): another's first end is the turn's
|
|
113394
|
-
*/
|
|
113395
|
-
holdOwnEnd(e) {
|
|
113396
|
-
const w = e.type === "turn_complete" ? this.updates.get(e.sessionId) : void 0;
|
|
113397
|
-
if (w?.phase !== "waking" || w.ownEnd || !this.host.resumeEndsOwnTurn(w.sessionId)) return false;
|
|
113398
|
-
w.ownEnd = true;
|
|
113399
|
-
console.error(`[agent-host] ${w.sessionId.slice(0, 8)}: held the turn end its resumed process said of its own before the update's note (#2312)`);
|
|
113400
|
-
return true;
|
|
113401
|
-
}
|
|
113402
113399
|
/** Every event of a session: the ones that end a held turn take its wait away; a finished turn starts every count over and says its tool's API answers */
|
|
113403
113400
|
observe(e) {
|
|
113404
113401
|
const id3 = e.sessionId;
|
|
113405
113402
|
if (!id3) return;
|
|
113406
113403
|
const u = this.updates.get(id3);
|
|
113407
113404
|
if (u?.phase === "waking" && wakeEnded(e)) this.endUpdate(id3, u, null);
|
|
113408
|
-
else if (u?.phase === "waking" && u.ownEnd && e.type === "activity" && e.activity !== null) u.running = true;
|
|
113409
113405
|
else if (u && e.type === "session_deleted") this.endUpdate(id3, u, "dropped");
|
|
113410
113406
|
if (e.type === "turn_complete" || e.type === "error" || e.type === "limit_reached" || e.type === "session_deleted" || e.type === "state_change" && e.state !== "working") this.cancelHeld(id3);
|
|
113411
113407
|
if (e.type === "session_deleted") this.dropStop(id3, false);
|
|
@@ -113641,8 +113637,8 @@ Centralu was going to retry this turn, but it restarted first. Send a message to
|
|
|
113641
113637
|
if (this.updates.size) setTimeout(() => this.pump(), 0);
|
|
113642
113638
|
}
|
|
113643
113639
|
/**
|
|
113644
|
-
* The wakes whose note went in and that have not answered yet (#2264 review): a stop for an update now lists
|
|
113645
|
-
*
|
|
113640
|
+
* The wakes whose note went in and that have not answered yet (#2264 review): a stop for an update now lists them again (`cutTurns`). Their entry
|
|
113641
|
+
* left the list at the send, and the resumed process reads at rest until its request streams (its own turn end comes first). One silent for
|
|
113646
113642
|
* `UPDATE_SLOT_MS` gave its slot up and is not among them: a stop after that does not list it again (accepted, as a request that hangs that long)
|
|
113647
113643
|
*/
|
|
113648
113644
|
unanswered() {
|
|
@@ -113657,18 +113653,6 @@ Centralu was going to retry this turn, but it restarted first. Send a message to
|
|
|
113657
113653
|
void this.fireUpdate(id3, w);
|
|
113658
113654
|
}
|
|
113659
113655
|
}
|
|
113660
|
-
/**
|
|
113661
|
-
* A woken session said nothing for `UPDATE_SLOT_MS`: its slot goes to the next. One whose resumed process's turn end was held (`holdOwnEnd`), that
|
|
113662
|
-
* is still in its turn and whose tool said nothing of being busy since (`running`) ran nothing after it: that end was the turn's, and is said now,
|
|
113663
|
-
* so the session is not left working with no turn
|
|
113664
|
-
*/
|
|
113665
|
-
slotOver(id3, w) {
|
|
113666
|
-
this.endUpdate(id3, w, null);
|
|
113667
|
-
const m = this.host.meta.get(id3);
|
|
113668
|
-
if (!w.ownEnd || w.running || !m || !inTurn(m.state) || this.host.leaving()) return;
|
|
113669
|
-
console.error(`[agent-host] ${id3.slice(0, 8)}: nothing ran after the turn end held for ${UPDATE_SLOT_MS / 1e3} s, so it ends the turn (#2312)`);
|
|
113670
|
-
this.host.note({ type: "turn_complete", sessionId: id3 });
|
|
113671
|
-
}
|
|
113672
113656
|
/** An update's wake is over (answered, or `step`): its slot goes to the next */
|
|
113673
113657
|
endUpdate(id3, w, step, err) {
|
|
113674
113658
|
if (this.updates.get(id3) === w) this.updates.delete(id3);
|
|
@@ -113691,7 +113675,7 @@ Centralu was going to retry this turn, but it restarted first. Send a message to
|
|
|
113691
113675
|
handed: () => {
|
|
113692
113676
|
handed = true;
|
|
113693
113677
|
w.phase = "waking";
|
|
113694
|
-
w.slot = setTimeout(() => this.
|
|
113678
|
+
w.slot = setTimeout(() => this.endUpdate(id3, w, null), UPDATE_SLOT_MS);
|
|
113695
113679
|
w.slot.unref?.();
|
|
113696
113680
|
}
|
|
113697
113681
|
});
|
|
@@ -124002,7 +123986,6 @@ var SessionEvents = class {
|
|
|
124002
123986
|
return this.onEvent({ ...e, live: m.backgroundTasks.filter((t) => t.status === "running") });
|
|
124003
123987
|
}
|
|
124004
123988
|
if (e.type === "error") e = this.host.turnContinue.hold(e);
|
|
124005
|
-
if (this.host.turnContinue.holdOwnEnd(e)) return;
|
|
124006
123989
|
if (e.sessionId) this.host.turnContinue.observe(e);
|
|
124007
123990
|
const unborn = e.sessionId && !this.host.meta.has(e.sessionId) ? this.host.record.unborn.get(e.sessionId) : void 0;
|
|
124008
123991
|
if (unborn) {
|
|
@@ -124045,6 +124028,8 @@ var SessionEvents = class {
|
|
|
124045
124028
|
if (this.host.restartPolicy.backgroundUnknown.has(m.id)) this.host.restartPolicy.backgroundUnknown.set(m.id, Date.now());
|
|
124046
124029
|
if (!wasBusy && inTurn(m.state)) {
|
|
124047
124030
|
continues = this.host.selfCompaction.stepOpens(m.id);
|
|
124031
|
+
this.host.reports.stopSettling(m.id);
|
|
124032
|
+
this.inputWaits.delete(m.id);
|
|
124048
124033
|
this.host.children.turnStarted(m.id);
|
|
124049
124034
|
this.host.children.noteTurnStart(m.id, m.lastSeq);
|
|
124050
124035
|
}
|
|
@@ -124086,11 +124071,30 @@ var SessionEvents = class {
|
|
|
124086
124071
|
const runOpen = !!run2 && !run2.finished;
|
|
124087
124072
|
const delegation = runOpen ? [...this.host.children.delegations.values()].find((d2) => d2.wait === run2) : void 0;
|
|
124088
124073
|
const waited = runOpen && (!delegation || (delegation.waiters ?? 0) > 0);
|
|
124089
|
-
run2?.onEvent(e);
|
|
124090
|
-
if (e.sessionId) for (const observer of this.host.turnObservers.get(e.sessionId) ?? []) observer.onEvent(e);
|
|
124091
124074
|
const processWent = e.type === "error" && (e.error.code === "adapter_crashed" || e.error.code === "conversation_locked");
|
|
124092
124075
|
const taken = endedTurn && e.sessionId ? this.host.handles.get(e.sessionId)?.turnInputs?.() : void 0;
|
|
124076
|
+
const ownTurn = endedTurn && e.type === "turn_complete" && !!e.sessionId && Array.isArray(taken) && taken.length === 0 && (this.host.handles.get(e.sessionId)?.queuedInputs?.() ?? 0) > 0;
|
|
124077
|
+
if (!ownTurn) {
|
|
124078
|
+
run2?.onEvent(e);
|
|
124079
|
+
if (e.sessionId) for (const observer of this.host.turnObservers.get(e.sessionId) ?? []) observer.onEvent(e);
|
|
124080
|
+
}
|
|
124093
124081
|
const owned = endedTurn && e.sessionId ? this.host.children.turnEnded(e.sessionId, taken) : void 0;
|
|
124082
|
+
if (ownTurn && e.sessionId) {
|
|
124083
|
+
console.error(`[agent-host] ${e.sessionId.slice(0, 8)}: its tool ended a turn of its own while an input waits to run: not the work's end (#2318)`);
|
|
124084
|
+
if (owned?.cut) {
|
|
124085
|
+
this.host.children.noteContinuedCut(e.sessionId);
|
|
124086
|
+
this.host.reports.noteCut(e.sessionId);
|
|
124087
|
+
}
|
|
124088
|
+
this.host.reports.settleAtRest(e.sessionId);
|
|
124089
|
+
this.inputWaits.add(e.sessionId);
|
|
124090
|
+
}
|
|
124091
|
+
if (processWent && !endedTurn && e.sessionId && this.inputWaits.delete(e.sessionId)) {
|
|
124092
|
+
this.host.children.dropContinuedCut(e.sessionId);
|
|
124093
|
+
this.host.reports.stopSettling(e.sessionId);
|
|
124094
|
+
this.host.reports.turnStopped(e.sessionId);
|
|
124095
|
+
this.host.mailStopped(e.sessionId, "error", this.stopTold(e.sessionId, false, void 0));
|
|
124096
|
+
}
|
|
124097
|
+
if (e.type === "session_deleted") this.inputWaits.delete(e.sessionId);
|
|
124094
124098
|
const turnBy = e.sessionId && endedTurn && this.host.selfCompaction.compactTurn(e.sessionId) ? { ...owned ?? { by: "work" }, compaction: true } : owned;
|
|
124095
124099
|
const since = turnBy && e.sessionId ? this.host.children.turnRows(e.sessionId)?.after : void 0;
|
|
124096
124100
|
const turnSaid = turnBy && (e.type === "turn_complete" || e.type === "state_change" || e.type === "error" || e.type === "limit_reached") ? { ...e, turn: since === void 0 ? turnBy : { ...turnBy, since } } : e;
|
|
@@ -124102,7 +124106,7 @@ var SessionEvents = class {
|
|
|
124102
124106
|
this.host.emit({ type: "interruption", sessionId: e.sessionId, interruption: nowInterrupted });
|
|
124103
124107
|
}
|
|
124104
124108
|
if (endedTurn && e.sessionId) this.host.mailTurnInputs(e.sessionId, { took: processWent ? void 0 : taken });
|
|
124105
|
-
const workEnded = endedTurn && !!e.sessionId && !this.host.selfCompaction.compactTurn(e.sessionId);
|
|
124109
|
+
const workEnded = endedTurn && !ownTurn && !!e.sessionId && !this.host.selfCompaction.compactTurn(e.sessionId);
|
|
124106
124110
|
const stopWhy = workEnded && e.sessionId && !this.host.restartPolicy.continuingTurns.has(e.sessionId) ? stopOf(e, nowInterrupted) : null;
|
|
124107
124111
|
if (stopWhy && e.sessionId) {
|
|
124108
124112
|
this.host.reports.turnStopped(e.sessionId);
|
|
@@ -124114,7 +124118,7 @@ var SessionEvents = class {
|
|
|
124114
124118
|
}
|
|
124115
124119
|
if ((e.type === "question_request" || e.type === "approval_request") && e.sessionId) this.host.cards.routeCard(e.sessionId, e.requestId, e.type === "question_request" ? "question" : "approval");
|
|
124116
124120
|
if ((endedTurn || e.type === "question_resolved" || e.type === "approval_resolved") && e.sessionId) this.host.cards.cardsEnded(e.sessionId);
|
|
124117
|
-
if (endedTurn && e.sessionId) this.endHubAsk(e.sessionId);
|
|
124121
|
+
if (endedTurn && !ownTurn && e.sessionId) this.endHubAsk(e.sessionId);
|
|
124118
124122
|
if (e.type === "approval_resolved" && e.sessionId) this.host.hostCards.raiseHostAsks(e.sessionId);
|
|
124119
124123
|
if (endedTurn && e.sessionId && this.host.meta.get(e.sessionId)?.state !== "error") this.host.hostCards.raiseHostAsks(e.sessionId);
|
|
124120
124124
|
if (endedTurn && e.sessionId) this.forgetCommits(e.sessionId);
|
|
@@ -124140,6 +124144,8 @@ var SessionEvents = class {
|
|
|
124140
124144
|
if (!asker || !this.host.meta.has(asker)) return { starter: null };
|
|
124141
124145
|
return { ...waited ? { told: [asker] } : {}, starter: asker };
|
|
124142
124146
|
}
|
|
124147
|
+
/** Sessions whose tool ended a turn of its own while an input waits to run, until that input's turn begins (#2318, `ownTurn`) */
|
|
124148
|
+
inputWaits = /* @__PURE__ */ new Set();
|
|
124143
124149
|
shareOf(e) {
|
|
124144
124150
|
const m = this.host.meta.get(e.sessionId);
|
|
124145
124151
|
if (!m) return e;
|
|
@@ -125532,7 +125538,7 @@ var HostTenure = class {
|
|
|
125532
125538
|
this.disposing = true;
|
|
125533
125539
|
this.leaveHost("Centralu is shutting down");
|
|
125534
125540
|
const sessions = this.stoppingForUpdate && this.host.keeperOpts.updateResume ? this.host.listSessions() : [];
|
|
125535
|
-
const cut3 = cutTurns({ sessions, terminals: 0, commandRuns: 0 });
|
|
125541
|
+
const cut3 = cutTurns({ sessions, terminals: 0, commandRuns: 0 }, woken.filter((w) => w.turn).map((w) => w.sessionId));
|
|
125536
125542
|
const stopped = stoppedAtUpdate(sessions, (id3, callId) => this.host.store.messages.toolCallInput(id3, callId), woken.flatMap((w) => w.stopped ? [w.stopped] : []));
|
|
125537
125543
|
for (const [id3, run2] of this.host.record.streams) this.host.record.flushStream(id3, run2);
|
|
125538
125544
|
await Promise.allSettled([...[...this.host.handles.values()].map((h) => h.dispose()), ...this.host.merges.mergeChecks]);
|
|
@@ -130697,7 +130703,12 @@ var INJECTED_TAGS = [
|
|
|
130697
130703
|
"command-args",
|
|
130698
130704
|
"local-command-stdout",
|
|
130699
130705
|
"local-command-stderr",
|
|
130700
|
-
"user-prompt-submit-hook"
|
|
130706
|
+
"user-prompt-submit-hook",
|
|
130707
|
+
/*
|
|
130708
|
+
* Claude Code's notice that a background task ended (#2323). A Claude transcript says who wrote such a line
|
|
130709
|
+
* (claude/history.ts `writtenByTheCli`); the tag is for a line read without that, from an SDK or CLI that does not give it
|
|
130710
|
+
*/
|
|
130711
|
+
"task-notification"
|
|
130701
130712
|
];
|
|
130702
130713
|
var BLOCK = new RegExp(`<(${INJECTED_TAGS.join("|")})\\b[^>]*>[\\s\\S]*?</\\1>`, "gi");
|
|
130703
130714
|
var OPEN_ONLY = new RegExp(`<(${INJECTED_TAGS.join("|")})\\b[^>]*>[\\s\\S]*$`, "i");
|
|
@@ -131041,8 +131052,8 @@ async function readClaudeTranscriptTail(externalId, cwd, last) {
|
|
|
131041
131052
|
var COMPACT_SUMMARY = /^This session is being continued from a previous conversation that ran out of context\./;
|
|
131042
131053
|
async function readClaudeHistory(externalId, cwd, limit) {
|
|
131043
131054
|
const sdk = await sessionApi();
|
|
131044
|
-
if (!sdk
|
|
131045
|
-
const rows3 = await sdk
|
|
131055
|
+
if (!sdk) throw new Error(UNSUPPORTED);
|
|
131056
|
+
const { rows: rows3, byTheCli } = await readTranscript(sdk, externalId, cwd);
|
|
131046
131057
|
if (!Array.isArray(rows3)) return [];
|
|
131047
131058
|
const out = [];
|
|
131048
131059
|
const agents = /* @__PURE__ */ new Set();
|
|
@@ -131050,13 +131061,40 @@ async function readClaudeHistory(externalId, cwd, limit) {
|
|
|
131050
131061
|
try {
|
|
131051
131062
|
const message = readableMessage(r?.message);
|
|
131052
131063
|
if (r?.type === "assistant") out.push(...assistantLines(message, agents));
|
|
131053
|
-
else if (r?.type === "user")
|
|
131064
|
+
else if (r?.type === "user") {
|
|
131065
|
+
const sent = isCentraluInputId(r.uuid);
|
|
131066
|
+
out.push(...userLines(message, agents, sent, !sent && typeof r.uuid === "string" && byTheCli.has(r.uuid)));
|
|
131067
|
+
}
|
|
131054
131068
|
} catch (err) {
|
|
131055
131069
|
console.error(`[claude] a transcript row was skipped on read-back: ${err.message}`);
|
|
131056
131070
|
}
|
|
131057
131071
|
}
|
|
131058
131072
|
return lastLines(out, limit);
|
|
131059
131073
|
}
|
|
131074
|
+
async function readTranscript(sdk, externalId, cwd) {
|
|
131075
|
+
if (!sdk.getSessionMessages) throw new Error(UNSUPPORTED);
|
|
131076
|
+
if (sdk.importSessionToStore) {
|
|
131077
|
+
const kept = [];
|
|
131078
|
+
const store2 = {
|
|
131079
|
+
append: async (_key, batch) => void kept.push(...batch),
|
|
131080
|
+
load: async (key2) => isObj(key2) && key2.subpath !== void 0 ? null : kept
|
|
131081
|
+
};
|
|
131082
|
+
try {
|
|
131083
|
+
await sdk.importSessionToStore(externalId, store2, { dir: cwd, includeSubagents: false });
|
|
131084
|
+
const rows3 = await sdk.getSessionMessages(externalId, { dir: cwd, sessionStore: store2 });
|
|
131085
|
+
const byTheCli = /* @__PURE__ */ new Set();
|
|
131086
|
+
for (const e of kept) if (isObj(e) && e.type === "user" && typeof e.uuid === "string" && writtenByTheCli(e)) byTheCli.add(e.uuid);
|
|
131087
|
+
return { rows: rows3, byTheCli };
|
|
131088
|
+
} catch (err) {
|
|
131089
|
+
console.error(`[claude] the transcript's own entries could not be read, so who wrote a line is judged by its text: ${errorMessage(err)}`);
|
|
131090
|
+
}
|
|
131091
|
+
}
|
|
131092
|
+
return { rows: await sdk.getSessionMessages(externalId, { dir: cwd }), byTheCli: /* @__PURE__ */ new Set() };
|
|
131093
|
+
}
|
|
131094
|
+
function writtenByTheCli(entry) {
|
|
131095
|
+
if (entry.isMeta === true || entry.promptSource === "system") return true;
|
|
131096
|
+
return isObj(entry.origin) && entry.origin.kind !== "human";
|
|
131097
|
+
}
|
|
131060
131098
|
function readableMessage(message) {
|
|
131061
131099
|
if (typeof message === "string") return { content: [{ type: "text", text: message }] };
|
|
131062
131100
|
if (!isObj(message)) return { content: [] };
|
|
@@ -131079,10 +131117,10 @@ function agentResult(e, agents) {
|
|
|
131079
131117
|
return toolResultEvent(HISTORY_SESSION, e.callId, e.ok, "", AGENT_REPORT_NOT_RECORDED);
|
|
131080
131118
|
}
|
|
131081
131119
|
var INTERRUPT_LINE = /^\[Request interrupted by user( for tool use)?\]$/;
|
|
131082
|
-
function userLines(message, agents, sent) {
|
|
131120
|
+
function userLines(message, agents, sent, cli) {
|
|
131083
131121
|
const raw = userText(message);
|
|
131084
131122
|
if (COMPACT_SUMMARY.test(raw)) return [{ role: "system", event: { type: "compaction", sessionId: HISTORY_SESSION, failed: false } }];
|
|
131085
|
-
const text3 = INTERRUPT_LINE.test(raw) ? "" : stripInjectedBlocks(raw);
|
|
131123
|
+
const text3 = cli || INTERRUPT_LINE.test(raw) ? "" : stripInjectedBlocks(raw);
|
|
131086
131124
|
const note = isCentraluNote(text3);
|
|
131087
131125
|
if (note && !sent) console.error("[claude] Centralu's Continue note is in the transcript without the input id Centralu gave it: this CLI does not keep it. The catch-up recognises the note by its text");
|
|
131088
131126
|
const out = text3 ? [{ role: "user", text: text3, ...sent || note ? { sent: true } : {} }] : [];
|
|
@@ -132364,6 +132402,10 @@ var MidTurnLedger = class {
|
|
|
132364
132402
|
get tracking() {
|
|
132365
132403
|
return this.receipts.size;
|
|
132366
132404
|
}
|
|
132405
|
+
/** How many tracked inputs the tool has not taken yet: not the turn that is running, nor the one whose end is being said (`endingInputs`) */
|
|
132406
|
+
get untaken() {
|
|
132407
|
+
return this.receipts.untaken(this.ending ?? []);
|
|
132408
|
+
}
|
|
132367
132409
|
/** Every tracked input fails, and nothing is stopped (the turn already failed): the ids that did */
|
|
132368
132410
|
failTracked(reason) {
|
|
132369
132411
|
const ids = this.receipts.ids;
|
|
@@ -133963,11 +134005,11 @@ var ClaudeSession = class {
|
|
|
133963
134005
|
this.sendInput(text3, opts?.id !== void 0 && isUuid(opts.id) ? opts.id : centraluInputId(), void 0, opts?.origin, opts?.quiet);
|
|
133964
134006
|
}
|
|
133965
134007
|
/**
|
|
133966
|
-
* Inputs that will run as a turn and have not: waiting in the queue the CLI reads, or read and not named by a finished turn's result (`personInputs`)
|
|
133967
|
-
*
|
|
134008
|
+
* Inputs that will run as a turn and have not: waiting in the queue the CLI reads, or read and not named by a finished turn's result (`personInputs`),
|
|
134009
|
+
* and the tracked ones (mail, an update's Continue, a parent's note) no turn took yet, which the ledger counts (#2318 review). Quiet inputs start no turn
|
|
133968
134010
|
*/
|
|
133969
134011
|
queuedInputs() {
|
|
133970
|
-
return this.queue.filter((input) => !input.quiet && !input.parentNote).length + this.personInputs.size;
|
|
134012
|
+
return this.queue.filter((input) => !input.quiet && !input.parentNote).length + this.personInputs.size + this.ledger.untaken;
|
|
133971
134013
|
}
|
|
133972
134014
|
/** A note read with the next message or at the running turn's next tool round, starting nothing (#1492): quiet input, stamped as Centralu's */
|
|
133973
134015
|
nudge(text3) {
|
|
@@ -134265,11 +134307,6 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
134265
134307
|
contextAtRequest = true;
|
|
134266
134308
|
/** `shouldQuery: false` (sdk.d.ts, measured on the Mac 2026-10-20: no turn, merged into the next message) */
|
|
134267
134309
|
quietInput = true;
|
|
134268
|
-
/**
|
|
134269
|
-
* Measured with Claude Code 2.1.296 on a real host swap: about 2 s after the first input, before that input's turn, when the update's stop ended a
|
|
134270
|
-
* background task of the session; a cut turn that ran in the foreground only resumed with none (`ANSWERED`, turn-continue.ts)
|
|
134271
|
-
*/
|
|
134272
|
-
resumeEndsOwnTurn = true;
|
|
134273
134310
|
cacheBilling = "anthropic";
|
|
134274
134311
|
/** What Claude Code offers against what this adapter limits (#270) */
|
|
134275
134312
|
surface = CLAUDE_SURFACE;
|
|
@@ -148222,10 +148259,6 @@ var SessionManager = class {
|
|
|
148222
148259
|
},
|
|
148223
148260
|
waitEnded: (id3, cause2, end) => this.mail.mailWaitEnded(id3, cause2, this.meta.get(id3)?.askedBy ?? null, end),
|
|
148224
148261
|
updateStep: (cut3, step, err) => this.tenure.updateStep(cut3, step, err),
|
|
148225
|
-
resumeEndsOwnTurn: (id3) => {
|
|
148226
|
-
const tool = this.meta.get(id3)?.tool;
|
|
148227
|
-
return !!tool && this.adapters.get(tool)?.resumeEndsOwnTurn === true;
|
|
148228
|
-
},
|
|
148229
148262
|
// Through Centralu's channel: sent only while the wait still stands (a Stop or a message of the person's takes it away, even while a restart is waited out)
|
|
148230
148263
|
send: (id3, note, gate) => {
|
|
148231
148264
|
const skipLine = () => !note.line || note.cause === "update" && this.tenure.leavingForUpdate();
|
|
@@ -164112,7 +164145,7 @@ var handedToken = launch.tokenOnStdin ? await readHandedToken(process.stdin).cat
|
|
|
164112
164145
|
console.error(`[agent-host] the launcher did not hand over the token: ${e.message}`);
|
|
164113
164146
|
process.exit(1);
|
|
164114
164147
|
}) : launch.token;
|
|
164115
|
-
var BUILD = true ? "
|
|
164148
|
+
var BUILD = true ? "a401449" : "dev";
|
|
164116
164149
|
var { values } = parseArgs({
|
|
164117
164150
|
options: {
|
|
164118
164151
|
port: { type: "string", default: "5175" },
|