@mrciphersmith/keryx 0.4.25 → 0.4.26
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 +219 -87
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34020,7 +34020,7 @@ var package_default;
|
|
|
34020
34020
|
var init_package = __esm(() => {
|
|
34021
34021
|
package_default = {
|
|
34022
34022
|
name: "@mrciphersmith/keryx",
|
|
34023
|
-
version: "0.4.
|
|
34023
|
+
version: "0.4.26",
|
|
34024
34024
|
description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
34025
34025
|
private: false,
|
|
34026
34026
|
publishConfig: {
|
|
@@ -199090,13 +199090,13 @@ async function createShellChrome(otui, renderer, opts) {
|
|
|
199090
199090
|
textarea.focus();
|
|
199091
199091
|
syncComposerHeight();
|
|
199092
199092
|
const submitHandlers = new Set;
|
|
199093
|
-
const emitSubmit = (line) => {
|
|
199093
|
+
const emitSubmit = (line, draft = line) => {
|
|
199094
199094
|
if (line.length > 0) {
|
|
199095
199095
|
scroll.scrollTop = scroll.scrollHeight;
|
|
199096
199096
|
scroll.stickyScroll = true;
|
|
199097
199097
|
}
|
|
199098
199098
|
for (const handler of [...submitHandlers]) {
|
|
199099
|
-
handler(line);
|
|
199099
|
+
handler(line, draft);
|
|
199100
199100
|
}
|
|
199101
199101
|
};
|
|
199102
199102
|
menu.on(otui.SelectRenderableEvents.ITEM_SELECTED, () => {
|
|
@@ -199111,12 +199111,13 @@ async function createShellChrome(otui, renderer, opts) {
|
|
|
199111
199111
|
debugEvent("composer.submit-blocked", { reason: "overlay active", dockVisible: dock.visible, overlayDepth });
|
|
199112
199112
|
return;
|
|
199113
199113
|
}
|
|
199114
|
-
const
|
|
199114
|
+
const draft = input.value;
|
|
199115
|
+
const line = draft.trim();
|
|
199115
199116
|
debugEvent("composer.submit", { chars: line.length, slash: line.startsWith("/") });
|
|
199116
199117
|
input.value = "";
|
|
199117
199118
|
hideMenu();
|
|
199118
199119
|
syncComposerHeight();
|
|
199119
|
-
emitSubmit(line);
|
|
199120
|
+
emitSubmit(line, draft);
|
|
199120
199121
|
};
|
|
199121
199122
|
const unsubscribeMenuKeys = onKeypress2(r, (key) => {
|
|
199122
199123
|
if (!menu.visible || !menuNav || overlayActive()) {
|
|
@@ -199272,6 +199273,7 @@ async function createShellChrome(otui, renderer, opts) {
|
|
|
199272
199273
|
appliedTheme = theme;
|
|
199273
199274
|
};
|
|
199274
199275
|
const unsubTheme = onThemeChange((theme) => applyTheme(theme));
|
|
199276
|
+
let offEscapeInterrupt;
|
|
199275
199277
|
{
|
|
199276
199278
|
const run = currentDebugRun();
|
|
199277
199279
|
if (run !== undefined) {
|
|
@@ -199316,6 +199318,17 @@ async function createShellChrome(otui, renderer, opts) {
|
|
|
199316
199318
|
addOverlaySource,
|
|
199317
199319
|
keyboardOwnedElsewhere,
|
|
199318
199320
|
withOverlay,
|
|
199321
|
+
onEscapeInterrupt: (interrupt) => {
|
|
199322
|
+
offEscapeInterrupt?.();
|
|
199323
|
+
offEscapeInterrupt = onKeypress2(r, (key) => {
|
|
199324
|
+
if (key.name !== "escape" || key.ctrl || key.meta || key.defaultPrevented)
|
|
199325
|
+
return;
|
|
199326
|
+
if (overlayActive() || menu.visible && menuNav || !interrupt())
|
|
199327
|
+
return;
|
|
199328
|
+
key.preventDefault();
|
|
199329
|
+
key.stopPropagation();
|
|
199330
|
+
});
|
|
199331
|
+
},
|
|
199319
199332
|
showToast,
|
|
199320
199333
|
applyTheme,
|
|
199321
199334
|
startBusy,
|
|
@@ -199361,6 +199374,7 @@ async function createShellChrome(otui, renderer, opts) {
|
|
|
199361
199374
|
destroyModalHost(r);
|
|
199362
199375
|
clearBusyTimer();
|
|
199363
199376
|
clearToastTimer();
|
|
199377
|
+
offEscapeInterrupt?.();
|
|
199364
199378
|
unsubscribeMenuKeys();
|
|
199365
199379
|
unsubscribeSuggestionKeys();
|
|
199366
199380
|
try {
|
|
@@ -278111,6 +278125,46 @@ async function pickWikiEnrichMode(otui, r, dock, plan, cwd) {
|
|
|
278111
278125
|
}));
|
|
278112
278126
|
return id === "drafts" || id === "force" || id === "cancel" ? id : "cancel";
|
|
278113
278127
|
}
|
|
278128
|
+
async function routeBusyMessage(otui, chrome, cwd, line, draft, deliver) {
|
|
278129
|
+
const chosen = await journaledPick(cwd, {
|
|
278130
|
+
source: DECISION_SOURCES.queueRoute,
|
|
278131
|
+
question: "The main agent is busy. Where should this message go?",
|
|
278132
|
+
recommendationReason: "The main queue keeps the message in the main history; a side answer is read-only.",
|
|
278133
|
+
cancelId: "cancel",
|
|
278134
|
+
options: [
|
|
278135
|
+
{ id: "main", label: "Main queue", description: "queue for the main agent; remove/edit/force later", recommended: true },
|
|
278136
|
+
{ id: "side", label: "Side-1", description: "read-only answer, outside main history (as before)" }
|
|
278137
|
+
]
|
|
278138
|
+
}, (options, dismissId) => {
|
|
278139
|
+
const reason = deliver.blockedReason?.();
|
|
278140
|
+
if (reason !== undefined) {
|
|
278141
|
+
chrome.showToast(reason);
|
|
278142
|
+
return Promise.resolve(dismissId);
|
|
278143
|
+
}
|
|
278144
|
+
return showComposerChoice(otui, chrome.renderer, chrome.dock, {
|
|
278145
|
+
title: "Main agent is busy",
|
|
278146
|
+
subtitle: line,
|
|
278147
|
+
options,
|
|
278148
|
+
cancelId: dismissId,
|
|
278149
|
+
enqueue: false,
|
|
278150
|
+
onBusy: () => chrome.showToast("Answer the open approval first, then resend.")
|
|
278151
|
+
});
|
|
278152
|
+
});
|
|
278153
|
+
const blocked = chosen === "main" || chosen === "side" ? deliver.blockedReason?.() : undefined;
|
|
278154
|
+
if (blocked === undefined && chosen === "main") {
|
|
278155
|
+
deliver.main();
|
|
278156
|
+
} else if (blocked === undefined && chosen === "side") {
|
|
278157
|
+
deliver.side();
|
|
278158
|
+
} else {
|
|
278159
|
+
if (blocked !== undefined)
|
|
278160
|
+
chrome.showToast(blocked);
|
|
278161
|
+
const currentDraft = chrome.input.value;
|
|
278162
|
+
chrome.input.value = currentDraft.length === 0 ? draft : `${draft}
|
|
278163
|
+
${currentDraft}`;
|
|
278164
|
+
if (!chrome.overlayActive())
|
|
278165
|
+
chrome.input.focus();
|
|
278166
|
+
}
|
|
278167
|
+
}
|
|
278114
278168
|
function createApprovalContextLoader(cwd) {
|
|
278115
278169
|
let port;
|
|
278116
278170
|
return async (command) => {
|
|
@@ -278132,8 +278186,7 @@ async function pickShellApproval(otui, r, dock, command, loadContext, destructiv
|
|
|
278132
278186
|
{
|
|
278133
278187
|
id: "once",
|
|
278134
278188
|
label: "Allow once",
|
|
278135
|
-
description: "Run only this time"
|
|
278136
|
-
recommended: true
|
|
278189
|
+
description: "Run only this time"
|
|
278137
278190
|
},
|
|
278138
278191
|
...canOfferExact ? [
|
|
278139
278192
|
{
|
|
@@ -278152,7 +278205,8 @@ async function pickShellApproval(otui, r, dock, command, loadContext, destructiv
|
|
|
278152
278205
|
{
|
|
278153
278206
|
id: "deny",
|
|
278154
278207
|
label: "Deny",
|
|
278155
|
-
description: "Do not run"
|
|
278208
|
+
description: "Do not run",
|
|
278209
|
+
recommended: true
|
|
278156
278210
|
}
|
|
278157
278211
|
];
|
|
278158
278212
|
const id = await showComposerChoice(otui, r, dock, {
|
|
@@ -280000,6 +280054,8 @@ async function launchTuiAgentShell(opts) {
|
|
|
280000
280054
|
}
|
|
280001
280055
|
});
|
|
280002
280056
|
const foregroundOperation = createForegroundOperationOwner();
|
|
280057
|
+
let sessionTransferInProgress = false;
|
|
280058
|
+
const sessionTransferNotice = "Session switch in progress. Try again when it finishes.";
|
|
280003
280059
|
const forceHandoff = createForegroundForceHandoff();
|
|
280004
280060
|
const sessionLease = createTuiLeaseHolder();
|
|
280005
280061
|
let ctrlCPress;
|
|
@@ -280863,7 +280919,7 @@ async function launchTuiAgentShell(opts) {
|
|
|
280863
280919
|
paint: () => paintMainQueue(),
|
|
280864
280920
|
say: (text) => io.onSystem?.(text),
|
|
280865
280921
|
runLine: (line, origin, source) => runLine(line, origin, source),
|
|
280866
|
-
turnWorkInFlight: () => chrome.isBusy() || foregroundOperation.isActive || forceHandoff.isAwaitingSettlement,
|
|
280922
|
+
turnWorkInFlight: () => foregroundOperation.isDisposed || chrome.isBusy() || foregroundOperation.isActive || forceHandoff.isAwaitingSettlement,
|
|
280867
280923
|
onSettle: () => busWakeController?.onSettle(),
|
|
280868
280924
|
onDetachedFailure: (error) => {
|
|
280869
280925
|
const reason = error instanceof Error ? error.message : String(error);
|
|
@@ -281809,6 +281865,8 @@ async function launchTuiAgentShell(opts) {
|
|
|
281809
281865
|
let nextArchiveIndex = 0;
|
|
281810
281866
|
let refreshRewindSidebar = () => {};
|
|
281811
281867
|
let sessionPersistTimer;
|
|
281868
|
+
const sideQueue = [];
|
|
281869
|
+
let sideSessionAbort = new AbortController;
|
|
281812
281870
|
const bindSlateToLiveSession = () => {
|
|
281813
281871
|
slateSession = freshSlateSessionRef(liveSession.dir, sessionCwd);
|
|
281814
281872
|
executionPlanPanel.refresh();
|
|
@@ -281846,6 +281904,7 @@ async function launchTuiAgentShell(opts) {
|
|
|
281846
281904
|
foregroundOperation.invalidateSession();
|
|
281847
281905
|
usageTracker = createUsageTracker();
|
|
281848
281906
|
usageTurnOpen = false;
|
|
281907
|
+
chrome.repaintStatus();
|
|
281849
281908
|
io.resetStream();
|
|
281850
281909
|
blockIo.resetReasoningLiveState();
|
|
281851
281910
|
const parked = forceHandoff.drainPending();
|
|
@@ -281862,7 +281921,7 @@ async function launchTuiAgentShell(opts) {
|
|
|
281862
281921
|
sessionPersistTimer = undefined;
|
|
281863
281922
|
}
|
|
281864
281923
|
};
|
|
281865
|
-
const applyOpened = (opened
|
|
281924
|
+
const applyOpened = (opened) => {
|
|
281866
281925
|
if (opened.history.length > 0) {
|
|
281867
281926
|
splash?.removeIfShown();
|
|
281868
281927
|
}
|
|
@@ -281876,7 +281935,7 @@ async function launchTuiAgentShell(opts) {
|
|
|
281876
281935
|
io.trustedMcpTools?.clear();
|
|
281877
281936
|
io.hcLaunchGrants?.clear();
|
|
281878
281937
|
resetOperatorDenials();
|
|
281879
|
-
history =
|
|
281938
|
+
history = opened.history;
|
|
281880
281939
|
archive = opened.archive.length > 0 ? [...opened.archive] : [...opened.history];
|
|
281881
281940
|
nextArchiveIndex = history.length;
|
|
281882
281941
|
refreshRewindSidebar();
|
|
@@ -281912,6 +281971,24 @@ async function launchTuiAgentShell(opts) {
|
|
|
281912
281971
|
model: currentSel.model
|
|
281913
281972
|
}));
|
|
281914
281973
|
const leaseState = leaseStateLookup(sessionCwd);
|
|
281974
|
+
const showSessionPreview = () => {
|
|
281975
|
+
const recentPrompts = history.filter((message) => message.role === "user").slice(-5);
|
|
281976
|
+
if (recentPrompts.length === 0)
|
|
281977
|
+
return;
|
|
281978
|
+
transcript.add(new otui.TextRenderable(r, {
|
|
281979
|
+
id: `sesspreview${uid++}`,
|
|
281980
|
+
content: otui.t`${dimChunk(otui, "Recent prompts")}`
|
|
281981
|
+
}));
|
|
281982
|
+
for (const message of recentPrompts) {
|
|
281983
|
+
const hc = hcHistoryEcho(message.content);
|
|
281984
|
+
const text = hc?.line ?? message.content;
|
|
281985
|
+
const preview = text.length > 100 ? `${text.slice(0, 97)}\u2026` : text;
|
|
281986
|
+
transcript.add(new otui.TextRenderable(r, {
|
|
281987
|
+
id: `sessu${uid++}`,
|
|
281988
|
+
content: otui.t`${dimChunk(otui, ` ${hc?.marker ?? "\u276F"} ${preview}`)}`
|
|
281989
|
+
}));
|
|
281990
|
+
}
|
|
281991
|
+
};
|
|
281915
281992
|
const showOpenedNotes = (opened) => {
|
|
281916
281993
|
if (opened.skipped !== undefined) {
|
|
281917
281994
|
transcript.add(new otui.TextRenderable(r, {
|
|
@@ -281933,15 +282010,7 @@ async function launchTuiAgentShell(opts) {
|
|
|
281933
282010
|
content: otui.t`${dimChunk(otui, `session ${shortSessionId(liveSession.summary.id)} \xB7 ${liveSession.summary.title} \xB7 ctx ${history.length} \xB7 archive ${archive.length}`)}`,
|
|
281934
282011
|
marginTop: 1
|
|
281935
282012
|
}));
|
|
281936
|
-
|
|
281937
|
-
const hc = hcHistoryEcho(m.content);
|
|
281938
|
-
const text = hc?.line ?? m.content;
|
|
281939
|
-
const t = text.length > 100 ? `${text.slice(0, 97)}\u2026` : text;
|
|
281940
|
-
transcript.add(new otui.TextRenderable(r, {
|
|
281941
|
-
id: `sessu${uid++}`,
|
|
281942
|
-
content: otui.t`${dimChunk(otui, ` ${hc?.marker ?? "\u276F"} ${t}`)}`
|
|
281943
|
-
}));
|
|
281944
|
-
}
|
|
282013
|
+
showSessionPreview();
|
|
281945
282014
|
}
|
|
281946
282015
|
};
|
|
281947
282016
|
let startupCancelled = false;
|
|
@@ -282281,6 +282350,10 @@ async function launchTuiAgentShell(opts) {
|
|
|
282281
282350
|
};
|
|
282282
282351
|
refreshRewindSidebar();
|
|
282283
282352
|
const resetSessionSurface = () => {
|
|
282353
|
+
sideQueue.length = 0;
|
|
282354
|
+
sideSessionAbort.abort();
|
|
282355
|
+
sideSessionAbort = new AbortController;
|
|
282356
|
+
splash?.removeIfShown();
|
|
282284
282357
|
nav.exit();
|
|
282285
282358
|
chrome.stopBusy();
|
|
282286
282359
|
io.resetStream();
|
|
@@ -282295,7 +282368,13 @@ async function launchTuiAgentShell(opts) {
|
|
|
282295
282368
|
usage.resetUsage();
|
|
282296
282369
|
};
|
|
282297
282370
|
const preservedOpen = async (signal, target = {}) => {
|
|
282298
|
-
|
|
282371
|
+
const assertCanSwitch = () => {
|
|
282372
|
+
assertSessionSwitchActive(signal, sessionLease.canPersist());
|
|
282373
|
+
if (chrome.isBusy() || foregroundOperation.isActive) {
|
|
282374
|
+
throw new Error("The main agent is busy. Wait for the turn to finish.");
|
|
282375
|
+
}
|
|
282376
|
+
};
|
|
282377
|
+
assertCanSwitch();
|
|
282299
282378
|
const opened = await switchPreservedSession(sessionLease.current, () => openLeasedSession({
|
|
282300
282379
|
cwd: sessionCwd,
|
|
282301
282380
|
...target,
|
|
@@ -282304,11 +282383,19 @@ async function launchTuiAgentShell(opts) {
|
|
|
282304
282383
|
}), async () => {
|
|
282305
282384
|
flushSessionCheckpoint();
|
|
282306
282385
|
await closeSlateSession(slateSession, mintTimestampAttemptId);
|
|
282307
|
-
|
|
282386
|
+
assertCanSwitch();
|
|
282308
282387
|
});
|
|
282309
282388
|
sessionLease.hold(opened.lease);
|
|
282310
282389
|
return opened;
|
|
282311
282390
|
};
|
|
282391
|
+
const withSessionTransfer = (action) => {
|
|
282392
|
+
sessionTransferInProgress = true;
|
|
282393
|
+
const work = action().finally(() => {
|
|
282394
|
+
sessionTransferInProgress = false;
|
|
282395
|
+
});
|
|
282396
|
+
turnLoop.drain.detach(work);
|
|
282397
|
+
return work;
|
|
282398
|
+
};
|
|
282312
282399
|
const startNewSession = async (signal, note) => {
|
|
282313
282400
|
let opened;
|
|
282314
282401
|
try {
|
|
@@ -282348,27 +282435,36 @@ Staying in the current session.
|
|
|
282348
282435
|
if (found === undefined) {
|
|
282349
282436
|
return;
|
|
282350
282437
|
}
|
|
282351
|
-
|
|
282352
|
-
|
|
282353
|
-
opened = await preservedOpen(signal, { resumeId: found.id });
|
|
282354
|
-
} catch (cause) {
|
|
282355
|
-
const hint = cause instanceof SessionLeasedError ? `To continue it in this shell, start one with: keryx shell -r ${shortSessionId(found.id)} --fork
|
|
282356
|
-
` : "";
|
|
282357
|
-
io.onSystem?.(`Could not resume ${shortSessionId(found.id)}: ${cause instanceof Error ? cause.message : String(cause)}
|
|
282358
|
-
` + hint + `Staying in the current session.
|
|
282438
|
+
if (found.id === liveSession.summary.id) {
|
|
282439
|
+
io.onSystem?.(`That session is already open.
|
|
282359
282440
|
`);
|
|
282360
282441
|
return;
|
|
282361
282442
|
}
|
|
282362
|
-
|
|
282363
|
-
|
|
282364
|
-
|
|
282365
|
-
|
|
282366
|
-
|
|
282367
|
-
|
|
282443
|
+
await withSessionTransfer(async () => {
|
|
282444
|
+
let opened;
|
|
282445
|
+
try {
|
|
282446
|
+
opened = await preservedOpen(signal, { resumeId: found.id });
|
|
282447
|
+
} catch (cause) {
|
|
282448
|
+
const hint = cause instanceof SessionLeasedError ? `To continue it in this shell, start one with: keryx shell -r ${shortSessionId(found.id)} --fork
|
|
282449
|
+
` : "";
|
|
282450
|
+
io.onSystem?.(`Could not resume ${shortSessionId(found.id)}: ${cause instanceof Error ? cause.message : String(cause)}
|
|
282451
|
+
` + hint + `Staying in the current session.
|
|
282368
282452
|
`);
|
|
282369
|
-
|
|
282370
|
-
|
|
282453
|
+
return;
|
|
282454
|
+
}
|
|
282455
|
+
resetSessionSurface();
|
|
282456
|
+
applyOpened(opened);
|
|
282457
|
+
bindSlateToLiveSession();
|
|
282458
|
+
refreshWorkspaceSidebar();
|
|
282459
|
+
paintSessionHeader();
|
|
282460
|
+
if (opened.archiveDegraded !== undefined) {
|
|
282461
|
+
io.onSystem?.(`Archive unavailable \u2014 resumed from the active context (${opened.archiveDegraded})
|
|
282462
|
+
`);
|
|
282463
|
+
}
|
|
282464
|
+
io.onSystem?.(`Resumed ${shortSessionId(liveSession.summary.id)} \xB7 ${liveSession.summary.title} (ctx ${history.length} \xB7 archive ${archive.length})
|
|
282371
282465
|
`);
|
|
282466
|
+
showSessionPreview();
|
|
282467
|
+
});
|
|
282372
282468
|
});
|
|
282373
282469
|
paintSessionHeader();
|
|
282374
282470
|
const inspectorKeys = { onKeypress: (handler) => onKeypress4(r, (key) => handler(key)) };
|
|
@@ -283206,7 +283302,6 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283206
283302
|
};
|
|
283207
283303
|
const SIDE_WORKER_ID = `${SIDE_WORKER_ID_PREFIX}1`;
|
|
283208
283304
|
const sideWorkerLabelText = sideWorkerLabel(1);
|
|
283209
|
-
const sideQueue = [];
|
|
283210
283305
|
let sideWorkerRunning = false;
|
|
283211
283306
|
let sideClearTimeout;
|
|
283212
283307
|
const showSideQueueStatus = () => {
|
|
@@ -283315,6 +283410,10 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283315
283410
|
const item = turnLoop.queue[index];
|
|
283316
283411
|
if (item === undefined)
|
|
283317
283412
|
return;
|
|
283413
|
+
if (sessionTransferInProgress) {
|
|
283414
|
+
chrome.showToast(sessionTransferNotice);
|
|
283415
|
+
return;
|
|
283416
|
+
}
|
|
283318
283417
|
if (leaseView()?.held() === true) {
|
|
283319
283418
|
io.onSystem?.(`\u25C7 held \u2014 q${index + 1} stays queued until the lease is released (see /bus).
|
|
283320
283419
|
`);
|
|
@@ -283326,7 +283425,7 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283326
283425
|
announce: (interrupted) => io.onSystem?.(interrupted ? `\u25C7 main turn interrupted \u2014 q${index + 1} will run next.
|
|
283327
283426
|
` : `\u25C7 q${index + 1} will run next.
|
|
283328
283427
|
`),
|
|
283329
|
-
isBusy: () => chrome.isBusy(),
|
|
283428
|
+
isBusy: () => chrome.isBusy() || sessionTransferInProgress,
|
|
283330
283429
|
resume: () => drainSites.onLeaseRelease(),
|
|
283331
283430
|
requeue: (items) => {
|
|
283332
283431
|
if (foregroundOperation.isDisposed)
|
|
@@ -283426,6 +283525,8 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283426
283525
|
break;
|
|
283427
283526
|
}
|
|
283428
283527
|
const currentQuestion = next.question;
|
|
283528
|
+
const sideSignal = sideSessionAbort.signal;
|
|
283529
|
+
const canPaintSide = () => !sideSignal.aborted && !destroyed;
|
|
283429
283530
|
sideWorkerRunning = true;
|
|
283430
283531
|
if (sideClearTimeout !== undefined) {
|
|
283431
283532
|
clearTimeout(sideClearTimeout);
|
|
@@ -283457,6 +283558,8 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283457
283558
|
let answer = "";
|
|
283458
283559
|
try {
|
|
283459
283560
|
const base = await opts.makeAgentDeps(currentSel, liveSlateSession, undefined);
|
|
283561
|
+
if (!canPaintSide())
|
|
283562
|
+
continue;
|
|
283460
283563
|
const tools = base.tools.filter(isToolAvailableToSideWorker);
|
|
283461
283564
|
const sideDeps = {
|
|
283462
283565
|
...base,
|
|
@@ -283474,6 +283577,8 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283474
283577
|
answer = text;
|
|
283475
283578
|
},
|
|
283476
283579
|
onToolCall: (name) => {
|
|
283580
|
+
if (!canPaintSide())
|
|
283581
|
+
return;
|
|
283477
283582
|
fleet.upsert({
|
|
283478
283583
|
id: SIDE_WORKER_ID,
|
|
283479
283584
|
label: sideWorkerLabelText,
|
|
@@ -283482,9 +283587,13 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283482
283587
|
});
|
|
283483
283588
|
},
|
|
283484
283589
|
onToolResult: () => {
|
|
283590
|
+
if (!canPaintSide())
|
|
283591
|
+
return;
|
|
283485
283592
|
fleet.upsert({ id: SIDE_WORKER_ID, label: sideWorkerLabelText, status: "running", detail: "waiting" });
|
|
283486
283593
|
},
|
|
283487
283594
|
onSystem: (text) => {
|
|
283595
|
+
if (!canPaintSide())
|
|
283596
|
+
return;
|
|
283488
283597
|
transcript.add(new otui.TextRenderable(r, {
|
|
283489
283598
|
id: `side-sys${uid++}`,
|
|
283490
283599
|
content: otui.t`${dimChunk(otui, text.trimEnd())}`
|
|
@@ -283492,7 +283601,9 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283492
283601
|
},
|
|
283493
283602
|
requestApproval: async () => false
|
|
283494
283603
|
};
|
|
283495
|
-
await runAgentTurn(sideIo, sideDeps, sideHistory, prompt);
|
|
283604
|
+
await runAgentTurn(sideIo, sideDeps, sideHistory, prompt, { signal: sideSignal });
|
|
283605
|
+
if (!canPaintSide())
|
|
283606
|
+
continue;
|
|
283496
283607
|
const body = answer.trim().length > 0 ? answer.trim() : "(no reply)";
|
|
283497
283608
|
appendUserEcho(otui, r, transcript, {
|
|
283498
283609
|
id: `side-a${uid++}`,
|
|
@@ -283508,6 +283619,8 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283508
283619
|
detail: "answered"
|
|
283509
283620
|
});
|
|
283510
283621
|
} catch (cause) {
|
|
283622
|
+
if (!canPaintSide())
|
|
283623
|
+
continue;
|
|
283511
283624
|
const msg = cause instanceof Error ? cause.message : String(cause);
|
|
283512
283625
|
transcript.add(new otui.TextRenderable(r, {
|
|
283513
283626
|
id: `side-err${uid++}`,
|
|
@@ -283526,10 +283639,22 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283526
283639
|
})();
|
|
283527
283640
|
};
|
|
283528
283641
|
let consecutiveAutoWakes = 0;
|
|
283529
|
-
const runLine = (line, origin = "operator", source, skipSlashRouting = false) => {
|
|
283642
|
+
const runLine = (line, origin = "operator", source, skipSlashRouting = false, draft = line) => {
|
|
283530
283643
|
if (line.length === 0 && origin === "operator") {
|
|
283531
283644
|
return;
|
|
283532
283645
|
}
|
|
283646
|
+
if (sessionTransferInProgress && !(origin === "operator" && source !== "hub" && !skipSlashRouting && findAgentCommand(line, "agent")?.name === "/exit")) {
|
|
283647
|
+
if (source === undefined && (origin === "operator" || origin === "agent-message")) {
|
|
283648
|
+
const currentDraft = input.value;
|
|
283649
|
+
input.value = currentDraft.length === 0 ? draft : `${draft}
|
|
283650
|
+
${currentDraft}`;
|
|
283651
|
+
chrome.showToast(sessionTransferNotice);
|
|
283652
|
+
} else if (source === TG_SOURCE) {
|
|
283653
|
+
io.onSystem?.(`${sessionTransferNotice}
|
|
283654
|
+
`);
|
|
283655
|
+
}
|
|
283656
|
+
return;
|
|
283657
|
+
}
|
|
283533
283658
|
suggestionGate.cancel("new turn started");
|
|
283534
283659
|
const fromHub = source === "hub";
|
|
283535
283660
|
if (fromHub)
|
|
@@ -283798,37 +283923,14 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283798
283923
|
`);
|
|
283799
283924
|
return;
|
|
283800
283925
|
}
|
|
283801
|
-
|
|
283802
|
-
|
|
283803
|
-
|
|
283804
|
-
|
|
283805
|
-
question: "The main agent is busy. Where should this message go?",
|
|
283806
|
-
recommendationReason: "The main queue keeps the message in the main history; a side answer is read-only.",
|
|
283807
|
-
cancelId: "side",
|
|
283808
|
-
options: [
|
|
283809
|
-
{ id: "main", label: "Main queue", description: "queue for the main agent; remove/edit/force later", recommended: true },
|
|
283810
|
-
{ id: "side", label: "Side-1", description: "read-only answer, outside main history (as before)" }
|
|
283811
|
-
]
|
|
283812
|
-
}, (options, dismissId) => showComposerChoice(otui, r, chrome.dock, {
|
|
283813
|
-
title: "Main agent is busy",
|
|
283814
|
-
subtitle: line,
|
|
283815
|
-
options,
|
|
283816
|
-
cancelId: dismissId,
|
|
283817
|
-
enqueue: false,
|
|
283818
|
-
onBusy: () => {
|
|
283819
|
-
blockedByOpenDialog = true;
|
|
283820
|
-
chrome.showToast("Answer the open approval first, then resend.");
|
|
283821
|
-
}
|
|
283822
|
-
}));
|
|
283823
|
-
if (blockedByOpenDialog) {
|
|
283824
|
-
input.value = line;
|
|
283825
|
-
input.focus();
|
|
283826
|
-
return;
|
|
283827
|
-
}
|
|
283828
|
-
if (chosen === "main") {
|
|
283926
|
+
const recipientSession = sideSessionAbort.signal;
|
|
283927
|
+
routeBusyMessage(otui, chrome, sessionCwd, line, draft, {
|
|
283928
|
+
blockedReason: () => recipientSession.aborted ? "Session changed. Review the draft before sending it again." : sessionTransferInProgress ? sessionTransferNotice : undefined,
|
|
283929
|
+
main: () => {
|
|
283829
283930
|
turnLoop.enqueue(line, displayLine);
|
|
283830
|
-
turnLoop.drainAfterRecipientChoice(() => !destroyed && !chrome.isBusy() && !foregroundOperation.isActive && !forceHandoff.isAwaitingSettlement && leaseView()?.held() !== true);
|
|
283831
|
-
}
|
|
283931
|
+
turnLoop.drainAfterRecipientChoice(() => !destroyed && !sessionTransferInProgress && !chrome.isBusy() && !foregroundOperation.isActive && !forceHandoff.isAwaitingSettlement && leaseView()?.held() !== true);
|
|
283932
|
+
},
|
|
283933
|
+
side: () => {
|
|
283832
283934
|
appendUserEcho(otui, r, transcript, {
|
|
283833
283935
|
id: `side-q${uid++}`,
|
|
283834
283936
|
line: displayLine,
|
|
@@ -283837,7 +283939,7 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283837
283939
|
});
|
|
283838
283940
|
spawnSideWorker(line, displayLine);
|
|
283839
283941
|
}
|
|
283840
|
-
})
|
|
283942
|
+
});
|
|
283841
283943
|
return;
|
|
283842
283944
|
}
|
|
283843
283945
|
if (!skipSlashRouting && !agentShaped && line.startsWith("/")) {
|
|
@@ -283886,7 +283988,7 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283886
283988
|
return;
|
|
283887
283989
|
}
|
|
283888
283990
|
if (command.name === "/clear" || command.name === "/new") {
|
|
283889
|
-
sessionSwitches.run(async (
|
|
283991
|
+
sessionSwitches.run((signal) => withSessionTransfer(async () => {
|
|
283890
283992
|
if (!await startNewSession(signal)) {
|
|
283891
283993
|
return;
|
|
283892
283994
|
}
|
|
@@ -283898,7 +284000,7 @@ ${formatThemeList(getThemeId())}`);
|
|
|
283898
284000
|
deps.resetSubagentBudget?.();
|
|
283899
284001
|
io.onSystem?.(`New session ${shortSessionId(liveSession.summary.id)} (previous kept on disk \xB7 /resume)
|
|
283900
284002
|
`);
|
|
283901
|
-
});
|
|
284003
|
+
}));
|
|
283902
284004
|
return;
|
|
283903
284005
|
}
|
|
283904
284006
|
if (command.name === "/schedule") {
|
|
@@ -284970,7 +285072,7 @@ ${line}` : frameSubmittedLine(line) : line;
|
|
|
284970
285072
|
})();
|
|
284971
285073
|
};
|
|
284972
285074
|
deps.jobRegistry?.onCompletion(() => {
|
|
284973
|
-
const busy = chrome.isBusy() || foregroundOperation.isActive;
|
|
285075
|
+
const busy = sessionTransferInProgress || chrome.isBusy() || foregroundOperation.isActive;
|
|
284974
285076
|
const idle = !busy && turnLoop.queue.length === 0 && leaseView()?.held() !== true;
|
|
284975
285077
|
if (!idle) {
|
|
284976
285078
|
return;
|
|
@@ -285105,9 +285207,12 @@ Turn: ${chrome.isBusy() ? "running" : "idle"} \xB7 queue: ${turnLoop.queue.lengt
|
|
|
285105
285207
|
`);
|
|
285106
285208
|
});
|
|
285107
285209
|
}
|
|
285210
|
+
if (sessionTransferInProgress && name !== "/exit") {
|
|
285211
|
+
return { ok: false, output: sessionTransferNotice };
|
|
285212
|
+
}
|
|
285108
285213
|
return await captureShellOutput(() => runLine(line, "operator", TG_SOURCE));
|
|
285109
285214
|
};
|
|
285110
|
-
const shellIsBusy = () => chrome.isBusy() || foregroundOperation.isActive || forceHandoff.isAwaitingSettlement || turnLoop.queue.length > 0 || leaseView()?.held() === true;
|
|
285215
|
+
const shellIsBusy = () => sessionTransferInProgress || chrome.isBusy() || foregroundOperation.isActive || forceHandoff.isAwaitingSettlement || turnLoop.queue.length > 0 || leaseView()?.held() === true;
|
|
285111
285216
|
const hubShellBusy = () => shellIsBusy() || chrome.overlayActive() || turnLoop.drain.workInFlight();
|
|
285112
285217
|
const hubCommands = [
|
|
285113
285218
|
{ name: "help", description: "Show commands available in this connected shell" },
|
|
@@ -285193,7 +285298,7 @@ Turn: ${chrome.isBusy() ? "running" : "idle"} \xB7 queue: ${turnLoop.queue.lengt
|
|
|
285193
285298
|
isBusy: hubShellBusy,
|
|
285194
285299
|
turnId: currentHubTurn,
|
|
285195
285300
|
submit: (text) => {
|
|
285196
|
-
if (destroyed || !sessionLease.canPersist())
|
|
285301
|
+
if (destroyed || sessionTransferInProgress || !sessionLease.canPersist())
|
|
285197
285302
|
return false;
|
|
285198
285303
|
runLine(text, "operator", "hub");
|
|
285199
285304
|
return true;
|
|
@@ -285388,8 +285493,15 @@ ${formatUsageTable(usageTracker.snapshot())}`
|
|
|
285388
285493
|
onKeypress4(r, (key) => {
|
|
285389
285494
|
handleQueueNavKey(key);
|
|
285390
285495
|
});
|
|
285391
|
-
chrome.
|
|
285392
|
-
|
|
285496
|
+
chrome.onEscapeInterrupt(() => {
|
|
285497
|
+
if (!foregroundOperation.cancel("interrupted by Escape"))
|
|
285498
|
+
return false;
|
|
285499
|
+
io.onSystem?.(`\u25C7 main turn interrupted (Esc).
|
|
285500
|
+
`);
|
|
285501
|
+
return true;
|
|
285502
|
+
});
|
|
285503
|
+
chrome.onSubmit((line, draft) => {
|
|
285504
|
+
runLine(line, "operator", undefined, false, draft);
|
|
285393
285505
|
});
|
|
285394
285506
|
setChoicePasteSink(chrome.dock, (text, afterClose) => {
|
|
285395
285507
|
const line = text.trim();
|
|
@@ -285443,7 +285555,7 @@ ${formatUsageTable(usageTracker.snapshot())}`
|
|
|
285443
285555
|
`);
|
|
285444
285556
|
}
|
|
285445
285557
|
}
|
|
285446
|
-
var
|
|
285558
|
+
var SIDE_WORKER_DENIED_TOOL_NAMES, CUSTOM_PROVIDER_ADD_ID = "__add_custom_provider__", CUSTOM_ADD_ENTRY, REASONING_PREVIEW_THROTTLE_MS = 100, OPENAI_CACHED_INPUT_DISCOUNT = 0.5, ANTHROPIC_CACHE_READ_MULTIPLIER = 0.1, ANTHROPIC_CACHE_WRITE_MULTIPLIER = 1.25, PROVIDERS_TABS, PROVIDERS_FOOTERS, NO_KEY_ENTERED_TEXT = "no key entered", MODE_PICKER_DESCRIPTIONS;
|
|
285447
285559
|
var init_tui_shell = __esm(() => {
|
|
285448
285560
|
init_runtime_switch();
|
|
285449
285561
|
init_shell_startup_trace();
|
|
@@ -285668,6 +285780,7 @@ function createChatBridge(hooks = {}) {
|
|
|
285668
285780
|
let closed = false;
|
|
285669
285781
|
let turn = false;
|
|
285670
285782
|
let streaming = false;
|
|
285783
|
+
let interruptTurn;
|
|
285671
285784
|
let heldSeparator = false;
|
|
285672
285785
|
let waiting;
|
|
285673
285786
|
const deliver = (line) => {
|
|
@@ -285687,6 +285800,7 @@ function createChatBridge(hooks = {}) {
|
|
|
285687
285800
|
return;
|
|
285688
285801
|
}
|
|
285689
285802
|
closed = true;
|
|
285803
|
+
interruptTurn = undefined;
|
|
285690
285804
|
queue.length = 0;
|
|
285691
285805
|
const resolve = waiting;
|
|
285692
285806
|
waiting = undefined;
|
|
@@ -285698,6 +285812,7 @@ function createChatBridge(hooks = {}) {
|
|
|
285698
285812
|
if (turn) {
|
|
285699
285813
|
turn = false;
|
|
285700
285814
|
streaming = false;
|
|
285815
|
+
interruptTurn = undefined;
|
|
285701
285816
|
heldSeparator = false;
|
|
285702
285817
|
hooks.onTurnSettled?.();
|
|
285703
285818
|
}
|
|
@@ -285740,7 +285855,8 @@ function createChatBridge(hooks = {}) {
|
|
|
285740
285855
|
streaming = true;
|
|
285741
285856
|
hooks.onText?.(s);
|
|
285742
285857
|
},
|
|
285743
|
-
onTurnStart: () => {
|
|
285858
|
+
onTurnStart: (interrupt) => {
|
|
285859
|
+
interruptTurn = interrupt;
|
|
285744
285860
|
heldSeparator = false;
|
|
285745
285861
|
hooks.onTurnStart?.();
|
|
285746
285862
|
},
|
|
@@ -285775,6 +285891,14 @@ function createChatBridge(hooks = {}) {
|
|
|
285775
285891
|
return "accepted";
|
|
285776
285892
|
},
|
|
285777
285893
|
close,
|
|
285894
|
+
interruptTurn: () => {
|
|
285895
|
+
const interrupt = interruptTurn;
|
|
285896
|
+
if (interrupt === undefined)
|
|
285897
|
+
return false;
|
|
285898
|
+
interruptTurn = undefined;
|
|
285899
|
+
interrupt();
|
|
285900
|
+
return true;
|
|
285901
|
+
},
|
|
285778
285902
|
turnActive: () => turn,
|
|
285779
285903
|
pending: () => queue.length
|
|
285780
285904
|
};
|
|
@@ -285882,6 +286006,7 @@ async function mountChatShell(otui, renderer, opts) {
|
|
|
285882
286006
|
append(body.includes("[error]") ? otui.t`${roleChunk(otui, "error", body)}` : otui.t`${dimChunk(otui, body)}`);
|
|
285883
286007
|
}
|
|
285884
286008
|
});
|
|
286009
|
+
chrome.onEscapeInterrupt(bridge.interruptTurn);
|
|
285885
286010
|
const selectProviderModel = async (_io, pickOpts) => {
|
|
285886
286011
|
const picked = opts.pickSelection === undefined ? undefined : await chrome.withOverlay(() => opts.pickSelection?.(pickOpts) ?? Promise.resolve(undefined));
|
|
285887
286012
|
chrome.focusComposer();
|
|
@@ -287145,7 +287270,7 @@ Kept the current session.
|
|
|
287145
287270
|
const turn = { user: line, text: "", abort: new AbortController };
|
|
287146
287271
|
activeTurn = turn;
|
|
287147
287272
|
busWorking = true;
|
|
287148
|
-
io.onTurnStart?.();
|
|
287273
|
+
io.onTurnStart?.(() => turn.abort.abort());
|
|
287149
287274
|
try {
|
|
287150
287275
|
const streamOptions = {
|
|
287151
287276
|
attemptId: deps.idSeq(),
|
|
@@ -287153,7 +287278,7 @@ Kept the current session.
|
|
|
287153
287278
|
...modelParams.timeoutMs !== undefined ? { timeoutMs: modelParams.timeoutMs } : {}
|
|
287154
287279
|
};
|
|
287155
287280
|
for await (const event of provider.stream(request, streamOptions)) {
|
|
287156
|
-
if (closing)
|
|
287281
|
+
if (closing || turn.abort.signal.aborted)
|
|
287157
287282
|
break;
|
|
287158
287283
|
if (event.kind === "text_delta") {
|
|
287159
287284
|
const text = event.text ?? "";
|
|
@@ -287174,9 +287299,11 @@ Kept the current session.
|
|
|
287174
287299
|
} catch (cause) {
|
|
287175
287300
|
if (closing)
|
|
287176
287301
|
break;
|
|
287177
|
-
|
|
287302
|
+
if (!turn.abort.signal.aborted) {
|
|
287303
|
+
system(`
|
|
287178
287304
|
[error] ${cause instanceof Error ? cause.message : String(cause)}
|
|
287179
287305
|
`);
|
|
287306
|
+
}
|
|
287180
287307
|
errored = true;
|
|
287181
287308
|
}
|
|
287182
287309
|
if (closing)
|
|
@@ -287185,6 +287312,11 @@ Kept the current session.
|
|
|
287185
287312
|
if (accumulated.length > 0) {
|
|
287186
287313
|
io.onTurnEnd?.(accumulated);
|
|
287187
287314
|
}
|
|
287315
|
+
if (turn.abort.signal.aborted) {
|
|
287316
|
+
system(`\u25C7 chat turn interrupted (Esc).
|
|
287317
|
+
`);
|
|
287318
|
+
errored = true;
|
|
287319
|
+
}
|
|
287188
287320
|
if (!errored) {
|
|
287189
287321
|
history.push({ role: "assistant", content: accumulated, provenance: "model" });
|
|
287190
287322
|
archive.push({ role: "user", content: line, provenance: "project" });
|
|
@@ -302683,7 +302815,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
302683
302815
|
registryDigest: "286041ef4394afd4de97b4da37e31ccb2728c485cd32488c737a2686c244fbca",
|
|
302684
302816
|
contractDigest: "43cd83cfbd494ce63e1f6c86a5a0c057a160f4a537d8119358e0f262412a96c9",
|
|
302685
302817
|
subjectCatalogueDigest: "819a324bfef3387bf464f5c78d4831751b03c9c4f3cb636471e2d8f4bd88d6cc",
|
|
302686
|
-
inventoryDigest: "
|
|
302818
|
+
inventoryDigest: "606915a0fb13e4815ba0a0291cff453c528fc59956affb8de02c6536492aaa77",
|
|
302687
302819
|
releaseReady: true,
|
|
302688
302820
|
counts: {
|
|
302689
302821
|
registeredCommands: 74,
|
|
@@ -302961,7 +303093,7 @@ var init_native_coverage_generated = __esm(() => {
|
|
|
302961
303093
|
"workspace.navigate"
|
|
302962
303094
|
],
|
|
302963
303095
|
otherBlockers: [],
|
|
302964
|
-
descriptorDigest: "
|
|
303096
|
+
descriptorDigest: "dc96bae8760ee44ae261de3fa26ad8da417a231018a9e15357407567dbf6707e"
|
|
302965
303097
|
};
|
|
302966
303098
|
});
|
|
302967
303099
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrciphersmith/keryx",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.26",
|
|
4
4
|
"description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|