@standardagents/code 0.11.5 → 0.11.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/dist/index.js +47 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1565,8 +1565,9 @@ var Bridge = class {
|
|
|
1565
1565
|
} finally {
|
|
1566
1566
|
this.hooks.onStatus?.(callKey, null);
|
|
1567
1567
|
}
|
|
1568
|
-
|
|
1569
|
-
|
|
1568
|
+
const ledgerKey = req.toolCallId ?? req.id;
|
|
1569
|
+
if (ledgerKey) {
|
|
1570
|
+
this.ledger.record(ledgerKey, {
|
|
1570
1571
|
ok: result.ok,
|
|
1571
1572
|
result: result.ok ? result.result ?? "" : void 0,
|
|
1572
1573
|
error: result.ok ? void 0 : result.error
|
|
@@ -3299,6 +3300,7 @@ function parseToolCalls(message) {
|
|
|
3299
3300
|
var EMPTY_BOUNDARY_STALE_MS = 15e4;
|
|
3300
3301
|
var WAITING_FOR_CLIENT_MARKER = "Waiting for your machine to reconnect";
|
|
3301
3302
|
var PENDING_TAIL_STALE_MS = 10 * 6e4;
|
|
3303
|
+
var FORWARDED_TOOL_STALE_MS = 6.5 * 6e4;
|
|
3302
3304
|
var BUSY_TAIL_STALE_MS = 30 * 6e4;
|
|
3303
3305
|
function toMs(raw) {
|
|
3304
3306
|
return raw > 1e14 ? raw / 1e3 : raw < 1e12 ? raw * 1e3 : raw;
|
|
@@ -3328,7 +3330,17 @@ function deriveSessionActivity(messages, nowMs = Date.now()) {
|
|
|
3328
3330
|
return { busy: true, currentTool: { ...tool ?? { id: last.tool_call_id ?? "", name: "forwarded", arguments: {} }, waitingForHost: true } };
|
|
3329
3331
|
}
|
|
3330
3332
|
const currentTool = unresolvedTool(visible);
|
|
3331
|
-
if (currentTool)
|
|
3333
|
+
if (currentTool) {
|
|
3334
|
+
const carrier = [...visible].reverse().find((message) => {
|
|
3335
|
+
const raw = message.tool_calls;
|
|
3336
|
+
return typeof raw === "string" && raw.includes(currentTool.id);
|
|
3337
|
+
});
|
|
3338
|
+
const carrierMs = carrier ? toMs(createdAt(carrier)) : 0;
|
|
3339
|
+
if (carrierMs > 0 && nowMs - carrierMs > FORWARDED_TOOL_STALE_MS) {
|
|
3340
|
+
return { busy: false, currentTool: null, stalled: true };
|
|
3341
|
+
}
|
|
3342
|
+
return { busy: true, currentTool };
|
|
3343
|
+
}
|
|
3332
3344
|
if (last.role === "user" || last.role === "tool") {
|
|
3333
3345
|
const lastMs = toMs(createdAt(last));
|
|
3334
3346
|
if (lastMs > 0 && nowMs - lastMs > BUSY_TAIL_STALE_MS) {
|
|
@@ -4464,7 +4476,7 @@ var Tui = class _Tui {
|
|
|
4464
4476
|
// The `[⚙ n bg]` prompt badge can be selected with ← from the start of the
|
|
4465
4477
|
// input (rendered inverted); Enter then opens the background-process panel.
|
|
4466
4478
|
bgBadgeSelected = false;
|
|
4467
|
-
|
|
4479
|
+
queuedMessages = [];
|
|
4468
4480
|
subagents = [];
|
|
4469
4481
|
// active subagents (one line each)
|
|
4470
4482
|
subagentColorByID = /* @__PURE__ */ new Map();
|
|
@@ -5139,11 +5151,10 @@ var Tui = class _Tui {
|
|
|
5139
5151
|
}
|
|
5140
5152
|
/** The prompt line prefix (with ANSI colour) that precedes the typed text. */
|
|
5141
5153
|
promptPrefix() {
|
|
5142
|
-
const q = this.queuedCount > 0 ? `${C.yellow}[\u23F3 ${this.queuedCount} queued]${C.reset} ` : "";
|
|
5143
5154
|
const attachments2 = this.externalAttachmentNames.length > 0 ? `${C.gray}[\u{1F4CE} ${this.externalAttachmentNames.length}]${C.reset} ` : "";
|
|
5144
5155
|
const bgText = `[\u2699 ${this.bgCount} bg]`;
|
|
5145
5156
|
const bg = this.bgCount > 0 ? this.bgBadgeSelected ? `${C.cyan}\x1B[7m${bgText}\x1B[27m${C.reset} ` : `${C.cyan}${bgText}${C.reset} ` : "";
|
|
5146
|
-
return `${
|
|
5157
|
+
return `${attachments2}${bg}${this.levelColor()}\u276F${C.reset} `;
|
|
5147
5158
|
}
|
|
5148
5159
|
visibleWidth(s) {
|
|
5149
5160
|
let w = 0;
|
|
@@ -5331,6 +5342,13 @@ var Tui = class _Tui {
|
|
|
5331
5342
|
}
|
|
5332
5343
|
const goalLines = this.goalLines(workCols);
|
|
5333
5344
|
for (const line of goalLines) writeHudRow(workPad + line);
|
|
5345
|
+
for (const [i, text] of this.queuedMessages.entries()) {
|
|
5346
|
+
const hint = i === 0 ? ` ${C.dim}esc to steer \xB7 /queue to edit${C.reset}` : "";
|
|
5347
|
+
const budget = workCols - 3 - (i === 0 ? 30 : 0);
|
|
5348
|
+
let msg = text.replace(/\s+/g, " ").trim();
|
|
5349
|
+
if (budget > 1 && msg.length > budget) msg = msg.slice(0, budget - 1) + "\u2026";
|
|
5350
|
+
writeHudRow(workPad + `${C.yellow}\u23F3${C.reset} ${C.gray}${msg}${C.reset}${hint}`);
|
|
5351
|
+
}
|
|
5334
5352
|
const prefix = this.promptPrefix();
|
|
5335
5353
|
const pw = this.visibleWidth(prefix);
|
|
5336
5354
|
const borderAnimating = this.working;
|
|
@@ -5684,9 +5702,9 @@ var Tui = class _Tui {
|
|
|
5684
5702
|
if (n === 0) this.bgBadgeSelected = false;
|
|
5685
5703
|
this.renderBottom();
|
|
5686
5704
|
}
|
|
5687
|
-
|
|
5688
|
-
if (
|
|
5689
|
-
this.
|
|
5705
|
+
setQueuedMessages(texts) {
|
|
5706
|
+
if (texts.length === this.queuedMessages.length && texts.every((t, i) => t === this.queuedMessages[i])) return;
|
|
5707
|
+
this.queuedMessages = texts;
|
|
5690
5708
|
this.renderBottom();
|
|
5691
5709
|
}
|
|
5692
5710
|
setConnected(connected) {
|
|
@@ -6442,7 +6460,7 @@ function readVersion() {
|
|
|
6442
6460
|
if (typeof pkg.version === "string" && pkg.version) return pkg.version;
|
|
6443
6461
|
} catch {
|
|
6444
6462
|
}
|
|
6445
|
-
return "0.11.
|
|
6463
|
+
return "0.11.6" ;
|
|
6446
6464
|
}
|
|
6447
6465
|
function isLocalHost(host) {
|
|
6448
6466
|
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host.endsWith(".local") || host.endsWith(".localhost") || /^10\./.test(host) || /^192\.168\./.test(host) || /^172\.(1[6-9]|2\d|3[01])\./.test(host);
|
|
@@ -9435,7 +9453,7 @@ why: ${req.requestPermission}` : ""}`,
|
|
|
9435
9453
|
sharedMessaging = firstSnapshot ? snapshot : mergeSharedMessagingSnapshot(sharedMessaging, snapshot);
|
|
9436
9454
|
sharedMessagingReady = true;
|
|
9437
9455
|
sharedMessagingUnavailableShown = false;
|
|
9438
|
-
tui.
|
|
9456
|
+
tui.setQueuedMessages(sharedMessaging.pending.items.map((item) => item.content));
|
|
9439
9457
|
if (mirrorDraft && (firstSnapshot || sharedMessaging.draft.revision > previousDraftRevision) && (firstSnapshot || sharedMessaging.draft.originClientId !== messagingOrigin.originClientId)) {
|
|
9440
9458
|
mirroredDraftRefs = sharedMessaging.draft.attachments.filter(isSharedAttachmentRef);
|
|
9441
9459
|
tui.setExternalAttachmentNames(mirroredDraftRefs.map((attachment) => attachment.name));
|
|
@@ -9859,9 +9877,7 @@ ${c4.gray}Close another session (its slot frees within ~90s), then resend your m
|
|
|
9859
9877
|
return;
|
|
9860
9878
|
}
|
|
9861
9879
|
if (busy) {
|
|
9862
|
-
if (await appendSharedPending(text, images, draftRefs)) {
|
|
9863
|
-
tui.print(`${c4.gray}\u23F3 pending:${c4.reset} ${text} ${c4.dim}(/queue to edit, steer, or dismiss)${c4.reset}`);
|
|
9864
|
-
} else {
|
|
9880
|
+
if (await appendSharedPending(text, images, draftRefs)) ; else {
|
|
9865
9881
|
mirroredDraftRefs = draftRefs;
|
|
9866
9882
|
tui.setExternalAttachmentNames(draftRefs.map((attachment) => attachment.name));
|
|
9867
9883
|
tui.setInput(text, images);
|
|
@@ -9888,8 +9904,13 @@ ${c4.gray}Close another session (its slot frees within ~90s), then resend your m
|
|
|
9888
9904
|
return;
|
|
9889
9905
|
}
|
|
9890
9906
|
if (busy) {
|
|
9891
|
-
const
|
|
9892
|
-
|
|
9907
|
+
const head = sharedMessaging.pending.items[0];
|
|
9908
|
+
if (head) {
|
|
9909
|
+
tui.print(`${c4.yellow}\u21AA steering \u2014 stopping the current step to run the queued message${c4.reset}`);
|
|
9910
|
+
void promoteSharedPending(head);
|
|
9911
|
+
return;
|
|
9912
|
+
}
|
|
9913
|
+
tui.print(`${c4.yellow}\u25A0 stopping now${c4.reset}`);
|
|
9893
9914
|
const stops = [api.stopThread(threadId).catch(() => {
|
|
9894
9915
|
})];
|
|
9895
9916
|
for (const childId of activeSubagents.keys()) {
|
|
@@ -9996,6 +10017,7 @@ ${c4.dim}runs on ${request.machine || runnerName}${c4.reset}`,
|
|
|
9996
10017
|
approvalPromptOpen = false;
|
|
9997
10018
|
}
|
|
9998
10019
|
};
|
|
10020
|
+
let stalledNoticeShown = false;
|
|
9999
10021
|
const poll = async () => {
|
|
10000
10022
|
let msgs;
|
|
10001
10023
|
let serverBusy = null;
|
|
@@ -10005,6 +10027,14 @@ ${c4.dim}runs on ${request.machine || runnerName}${c4.reset}`,
|
|
|
10005
10027
|
msgs = snapshot.messages.slice(-60);
|
|
10006
10028
|
serverBusy = snapshot.busy;
|
|
10007
10029
|
serverTool = snapshot.current_tool;
|
|
10030
|
+
if (snapshot.stalled && !stalledNoticeShown) {
|
|
10031
|
+
stalledNoticeShown = true;
|
|
10032
|
+
tui.print(
|
|
10033
|
+
`${c4.yellow}\u26A0 session interrupted${c4.reset} ${c4.dim}\u2014 the last operation never finished (the runtime is attempting recovery). Send a message to continue.${c4.reset}`
|
|
10034
|
+
);
|
|
10035
|
+
} else if (!snapshot.stalled && stalledNoticeShown && snapshot.busy) {
|
|
10036
|
+
stalledNoticeShown = false;
|
|
10037
|
+
}
|
|
10008
10038
|
} catch {
|
|
10009
10039
|
try {
|
|
10010
10040
|
msgs = await api.getMessages(threadId, 60);
|
|
@@ -10122,7 +10152,7 @@ ${c4.dim}runs on ${request.machine || runnerName}${c4.reset}`,
|
|
|
10122
10152
|
tui.setWorking(false);
|
|
10123
10153
|
tui.setSubagents([]);
|
|
10124
10154
|
tui.setGoal(null);
|
|
10125
|
-
tui.
|
|
10155
|
+
tui.setQueuedMessages([]);
|
|
10126
10156
|
tui.setContextPct(null);
|
|
10127
10157
|
tui.setStep(null, 0);
|
|
10128
10158
|
tui.setBackgroundCount(0);
|