@aiwayds/dsh-opentui 0.28.1 → 0.29.0
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/CHANGELOG.md +83 -0
- package/dist/bridge/bundle-fingerprint.json +1 -1
- package/dist/bridge/index.js +2935 -207
- package/dist/client/index.js +1572 -93
- package/dist/client/index.js.map +22 -19
- package/dist/locales/en.json +71 -1
- package/dist/locales/zh-CN.json +71 -1
- package/package.json +1 -1
- package/scripts/lib/inproc-companions.mjs +1 -1
package/dist/client/index.js
CHANGED
|
@@ -10804,6 +10804,9 @@ function decodeUnknownEffect(schema, options) {
|
|
|
10804
10804
|
const parser = run(schema.ast);
|
|
10805
10805
|
return options === undefined ? parser : (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions));
|
|
10806
10806
|
}
|
|
10807
|
+
function decodeUnknownOption(schema, options) {
|
|
10808
|
+
return asOption(decodeUnknownEffect(schema, options));
|
|
10809
|
+
}
|
|
10807
10810
|
function run(ast) {
|
|
10808
10811
|
return runWithCompiler(normalCompiler, ast);
|
|
10809
10812
|
}
|
|
@@ -10829,6 +10832,20 @@ function runWithCompiler(compiler, ast) {
|
|
|
10829
10832
|
return result[args] === missing ? getValue(missing) : result;
|
|
10830
10833
|
};
|
|
10831
10834
|
}
|
|
10835
|
+
function asExit(parser) {
|
|
10836
|
+
return (input, options) => runSyncExit2(parser(input, options));
|
|
10837
|
+
}
|
|
10838
|
+
function asOption(parser) {
|
|
10839
|
+
const parserExit = asExit(parser);
|
|
10840
|
+
return (input, options) => {
|
|
10841
|
+
const exit = parserExit(input, options);
|
|
10842
|
+
if (isSuccess3(exit)) {
|
|
10843
|
+
return some2(exit.value);
|
|
10844
|
+
}
|
|
10845
|
+
getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues");
|
|
10846
|
+
return none2();
|
|
10847
|
+
};
|
|
10848
|
+
}
|
|
10832
10849
|
function runSync2(effect, message) {
|
|
10833
10850
|
const exit = runSyncExit2(effect);
|
|
10834
10851
|
if (isSuccess3(exit)) {
|
|
@@ -11459,7 +11476,7 @@ function dateTimeArbitraryInteger(minimum, maximum) {
|
|
|
11459
11476
|
maximum
|
|
11460
11477
|
}));
|
|
11461
11478
|
}
|
|
11462
|
-
var TypeId23, SchemaError, make10, optionalKey2, optional2, toType2, Any2, Unknown2, Undefined2, String6, Number6, Boolean3, Symbol3, BigInt6, ArraySchema, NonEmptyArray, UndefinedOr, makeFilter2, Finite, isGreaterThan3, isGreaterThanOrEqualTo3, isLessThanOrEqualTo3, isBetween2, Int, NonEmptyString, RegExp3, URLString, URL2, File, URLSearchParams2, Base64String, Uint8Array2, dateTimeUtcFromString, arbitraryMinimumDateTimestamp = -8640000000000000, arbitraryMaximumDateTimestamp = 8640000000000000, arbitraryMinimumZonedDateTimeTimestamp, arbitraryMaximumZonedDateTimeTimestamp, arbitraryMinimumTimeZoneOffset, arbitraryMaximumTimeZoneOffset, DateTimeUtc, Json2, JsonObject;
|
|
11479
|
+
var TypeId23, SchemaError, decodeUnknownOption2, make10, optionalKey2, optional2, toType2, Any2, Unknown2, Undefined2, String6, Number6, Boolean3, Symbol3, BigInt6, ArraySchema, NonEmptyArray, UndefinedOr, makeFilter2, Finite, isGreaterThan3, isGreaterThanOrEqualTo3, isLessThanOrEqualTo3, isBetween2, Int, NonEmptyString, RegExp3, URLString, URL2, File, URLSearchParams2, Base64String, Uint8Array2, dateTimeUtcFromString, arbitraryMinimumDateTimestamp = -8640000000000000, arbitraryMaximumDateTimestamp = 8640000000000000, arbitraryMinimumZonedDateTimeTimestamp, arbitraryMaximumZonedDateTimeTimestamp, arbitraryMinimumTimeZoneOffset, arbitraryMaximumTimeZoneOffset, DateTimeUtc, Json2, JsonObject;
|
|
11463
11480
|
var init_Schema = __esm(() => {
|
|
11464
11481
|
init_Cause();
|
|
11465
11482
|
init_Data();
|
|
@@ -11514,6 +11531,7 @@ var init_Schema = __esm(() => {
|
|
|
11514
11531
|
return `SchemaError(${this.message})`;
|
|
11515
11532
|
}
|
|
11516
11533
|
};
|
|
11534
|
+
decodeUnknownOption2 = decodeUnknownOption;
|
|
11517
11535
|
make10 = make9;
|
|
11518
11536
|
optionalKey2 = /* @__PURE__ */ lambda((schema) => make10(optionalKey(schema.ast), {
|
|
11519
11537
|
schema
|
|
@@ -13134,6 +13152,7 @@ var init_keybind = __esm(() => {
|
|
|
13134
13152
|
"session.dock.tab.todo": keybind("alt+2", "Show activity todo details"),
|
|
13135
13153
|
"session.first": keybind("ctrl+home,home,alt+home", "Navigate to first message"),
|
|
13136
13154
|
"session.last": keybind("ctrl+alt+g,end", "Navigate to last message"),
|
|
13155
|
+
"session.scroll.to_bottom": keybind("alt+shift+end", "Scroll to the latest message"),
|
|
13137
13156
|
"session.message.next": keybind("none", "Navigate to next message"),
|
|
13138
13157
|
"session.message.previous": keybind("none", "Navigate to previous message"),
|
|
13139
13158
|
"session.message.user.next": keybind("none", "Navigate to next user message"),
|
|
@@ -36697,6 +36716,14 @@ var init_dock_visibility = __esm(() => {
|
|
|
36697
36716
|
|
|
36698
36717
|
// ../tui-base/src/routes/session/seam-rows.ts
|
|
36699
36718
|
function toStoredRow(stored, index) {
|
|
36719
|
+
if (stored.kind === "notice") {
|
|
36720
|
+
return {
|
|
36721
|
+
key: `notice:${stored.id ?? "ask-outcome:unknown"}`,
|
|
36722
|
+
kind: "assistant",
|
|
36723
|
+
text: stored.text,
|
|
36724
|
+
final: true
|
|
36725
|
+
};
|
|
36726
|
+
}
|
|
36700
36727
|
const kind = stored.kind === "user" || stored.kind === "tool" || stored.kind === "ask" ? stored.kind : "assistant";
|
|
36701
36728
|
const key = `stored:${kind}:${index}`;
|
|
36702
36729
|
if (kind === "tool") {
|
|
@@ -38513,21 +38540,18 @@ function applyActivityPanelConfig(config) {
|
|
|
38513
38540
|
} catch {}
|
|
38514
38541
|
}
|
|
38515
38542
|
function activityPanelCapSpec(gear, terminalRows) {
|
|
38516
|
-
if (gear === undefined)
|
|
38517
|
-
return {
|
|
38518
|
-
maxLines: dockLineCap(terminalRows)
|
|
38519
|
-
};
|
|
38520
38543
|
if (terminalRows !== undefined && terminalRows <= COMPOSER_COMPACT_TERMINAL_ROWS) {
|
|
38521
38544
|
return {
|
|
38522
38545
|
maxLines: dockLineCap(terminalRows)
|
|
38523
38546
|
};
|
|
38524
38547
|
}
|
|
38525
|
-
|
|
38548
|
+
const effective = gear ?? DEFAULT_ACTIVITY_PANEL_GEAR;
|
|
38549
|
+
if (effective === "all")
|
|
38526
38550
|
return {
|
|
38527
38551
|
maxLines: ACTIVITY_PANEL_ALL_LINES
|
|
38528
38552
|
};
|
|
38529
38553
|
return {
|
|
38530
|
-
maxLines: Math.min(Number(
|
|
38554
|
+
maxLines: Math.min(Number(effective), MERGED_DOCK_TOTAL_LINES)
|
|
38531
38555
|
};
|
|
38532
38556
|
}
|
|
38533
38557
|
function dockHeightEase(t) {
|
|
@@ -39647,7 +39671,7 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
|
|
|
39647
39671
|
return _el$0;
|
|
39648
39672
|
})();
|
|
39649
39673
|
}
|
|
39650
|
-
var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, activityDockTab, setActivityDockTab, DOCK_TAB_ICON, DOCK_TAB_PADDING_STEPS, dockTabDigit = (label) => label.match(/^\d+/)?.[0] ?? "", todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, subagentBatchStartedAt, prevSubagentRunning = 0, TODO_TOOL_NAMES, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
|
|
39674
|
+
var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, DEFAULT_ACTIVITY_PANEL_GEAR = "5", ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, activityDockTab, setActivityDockTab, DOCK_TAB_ICON, DOCK_TAB_PADDING_STEPS, dockTabDigit = (label) => label.match(/^\d+/)?.[0] ?? "", todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, subagentBatchStartedAt, prevSubagentRunning = 0, TODO_TOOL_NAMES, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
|
|
39651
39675
|
var init_widgets_dock = __esm(() => {
|
|
39652
39676
|
init_index_bun();
|
|
39653
39677
|
init_index_bun();
|
|
@@ -39721,6 +39745,40 @@ var init_widgets_dock = __esm(() => {
|
|
|
39721
39745
|
activityFrameLatch = createFrameLatch();
|
|
39722
39746
|
});
|
|
39723
39747
|
|
|
39748
|
+
// ../tui-base/src/routes/session/transcript-scroll-hints.ts
|
|
39749
|
+
function awayFromBottom(pos) {
|
|
39750
|
+
const { scrollTop, viewportHeight, scrollHeight } = pos;
|
|
39751
|
+
if (!Number.isFinite(scrollTop) || !Number.isFinite(viewportHeight) || !Number.isFinite(scrollHeight) || viewportHeight <= 0 || scrollHeight <= 0)
|
|
39752
|
+
return false;
|
|
39753
|
+
return scrollTop + viewportHeight < scrollHeight;
|
|
39754
|
+
}
|
|
39755
|
+
function newMessageCount(rows, baseline) {
|
|
39756
|
+
return Math.max(0, Math.floor(rows) - Math.floor(baseline));
|
|
39757
|
+
}
|
|
39758
|
+
function shouldPulse(previousCount, nextCount) {
|
|
39759
|
+
return nextCount > previousCount;
|
|
39760
|
+
}
|
|
39761
|
+
function newMessageCopyKey(count) {
|
|
39762
|
+
return count === 1 ? "transcript.scroll.newMessage" : "transcript.scroll.newMessages";
|
|
39763
|
+
}
|
|
39764
|
+
function keybindLabel(value) {
|
|
39765
|
+
if (typeof value === "string")
|
|
39766
|
+
return value.split(",")[0]?.trim() ?? "";
|
|
39767
|
+
if (Array.isArray(value))
|
|
39768
|
+
return keybindLabel(value[0]);
|
|
39769
|
+
if (value && typeof value === "object" && "key" in value)
|
|
39770
|
+
return keybindLabel(value.key);
|
|
39771
|
+
return "";
|
|
39772
|
+
}
|
|
39773
|
+
function pulseLevel(elapsedMs) {
|
|
39774
|
+
if (!Number.isFinite(elapsedMs) || elapsedMs <= 0 || elapsedMs >= HINT_PULSE_TOTAL_MS)
|
|
39775
|
+
return 0;
|
|
39776
|
+
const cycleMs = HINT_PULSE_TOTAL_MS / HINT_PULSE_CYCLES;
|
|
39777
|
+
const within = elapsedMs % cycleMs / cycleMs;
|
|
39778
|
+
return within < 0.5 ? within * 2 : (1 - within) * 2;
|
|
39779
|
+
}
|
|
39780
|
+
var HINT_PULSE_TOTAL_MS = 600, HINT_PULSE_CYCLES = 2;
|
|
39781
|
+
|
|
39724
39782
|
// ../tui-base/src/routes/session/transcript.tsx
|
|
39725
39783
|
import { BoxRenderable as BoxRenderable3, SyntaxStyle as SyntaxStyle2, TextAttributes as TextAttributes6 } from "@opentui/core";
|
|
39726
39784
|
function codeBlockForm(isFinal) {
|
|
@@ -39877,6 +39935,88 @@ function Transcript(props) {
|
|
|
39877
39935
|
row
|
|
39878
39936
|
});
|
|
39879
39937
|
const visibleRows = createMemo(() => projection.rows.filter((row) => row.kind !== "tool" && row.kind !== "reasoning" && row.kind !== "subagents"));
|
|
39938
|
+
const [away, setAway] = createSignal(false);
|
|
39939
|
+
const [newRows, setNewRows] = createSignal(0);
|
|
39940
|
+
const [pulseTick, setPulseTick] = createSignal(0);
|
|
39941
|
+
let transcriptScroll;
|
|
39942
|
+
let rowsAtBottom = 0;
|
|
39943
|
+
let lastCount = 0;
|
|
39944
|
+
let wasAway = false;
|
|
39945
|
+
let pulseStartedAt;
|
|
39946
|
+
const syncAway = () => {
|
|
39947
|
+
const scroll = transcriptScroll;
|
|
39948
|
+
if (!scroll || scroll.isDestroyed)
|
|
39949
|
+
return;
|
|
39950
|
+
const awayNow = awayFromBottom({
|
|
39951
|
+
scrollTop: scroll.scrollTop,
|
|
39952
|
+
viewportHeight: scroll.viewport.height,
|
|
39953
|
+
scrollHeight: scroll.scrollHeight
|
|
39954
|
+
});
|
|
39955
|
+
const rows = visibleRows().length;
|
|
39956
|
+
if (!awayNow) {
|
|
39957
|
+
rowsAtBottom = rows;
|
|
39958
|
+
lastCount = 0;
|
|
39959
|
+
wasAway = false;
|
|
39960
|
+
pulseStartedAt = undefined;
|
|
39961
|
+
setNewRows(0);
|
|
39962
|
+
setAway(false);
|
|
39963
|
+
return;
|
|
39964
|
+
}
|
|
39965
|
+
if (!wasAway) {
|
|
39966
|
+
rowsAtBottom = rows;
|
|
39967
|
+
lastCount = 0;
|
|
39968
|
+
}
|
|
39969
|
+
const count = newMessageCount(rows, rowsAtBottom);
|
|
39970
|
+
setAway(true);
|
|
39971
|
+
setNewRows(count);
|
|
39972
|
+
if (shouldPulse(lastCount, count) && motionDecorationsEnabled()) {
|
|
39973
|
+
pulseStartedAt = Date.now();
|
|
39974
|
+
setPulseTick((t) => t + 1);
|
|
39975
|
+
}
|
|
39976
|
+
lastCount = count;
|
|
39977
|
+
wasAway = true;
|
|
39978
|
+
};
|
|
39979
|
+
createEffect(() => {
|
|
39980
|
+
visibleRows().length;
|
|
39981
|
+
syncAway();
|
|
39982
|
+
});
|
|
39983
|
+
const toBottom = () => {
|
|
39984
|
+
if (!transcriptScroll || transcriptScroll.isDestroyed)
|
|
39985
|
+
return;
|
|
39986
|
+
transcriptScroll.scrollTo(Infinity);
|
|
39987
|
+
rowsAtBottom = visibleRows().length;
|
|
39988
|
+
lastCount = 0;
|
|
39989
|
+
wasAway = false;
|
|
39990
|
+
pulseStartedAt = undefined;
|
|
39991
|
+
setNewRows(0);
|
|
39992
|
+
setAway(false);
|
|
39993
|
+
};
|
|
39994
|
+
const pulsing = () => {
|
|
39995
|
+
pulseTick();
|
|
39996
|
+
return motionDecorationsEnabled() && pulseStartedAt !== undefined && Date.now() - pulseStartedAt < HINT_PULSE_TOTAL_MS;
|
|
39997
|
+
};
|
|
39998
|
+
onAnimationTick(() => pulsing() && motionAnimationRunning() ? motionFrameRate() : undefined, () => setPulseTick((t) => t + 1));
|
|
39999
|
+
const keymap = Keymap2.useOptional();
|
|
40000
|
+
const liveToBottomKeys = keymap ? Keymap2.useShortcut("session.scroll.to_bottom") : undefined;
|
|
40001
|
+
const toBottomKeys = () => liveToBottomKeys?.() ?? keybindLabel(defaultValue("session.scroll.to_bottom"));
|
|
40002
|
+
const hintText = () => {
|
|
40003
|
+
const keys = toBottomKeys();
|
|
40004
|
+
const count = newRows();
|
|
40005
|
+
return count > 0 ? t(newMessageCopyKey(count), {
|
|
40006
|
+
count,
|
|
40007
|
+
keys
|
|
40008
|
+
}) : t("transcript.scroll.toLatest", {
|
|
40009
|
+
keys
|
|
40010
|
+
});
|
|
40011
|
+
};
|
|
40012
|
+
const hintColor = () => {
|
|
40013
|
+
const target = color.loading();
|
|
40014
|
+
pulseTick();
|
|
40015
|
+
if (!motionDecorationsEnabled() || pulseStartedAt === undefined)
|
|
40016
|
+
return target;
|
|
40017
|
+
const level = pulseLevel(Date.now() - pulseStartedAt);
|
|
40018
|
+
return level > 0 ? mixSkinColor2(target, skinFaintColor(target, color.background()), level * SKIN_PULSE_DIM) : target;
|
|
40019
|
+
};
|
|
39880
40020
|
const rowView = (row) => {
|
|
39881
40021
|
switch (row.kind) {
|
|
39882
40022
|
case "user":
|
|
@@ -39949,10 +40089,12 @@ function Transcript(props) {
|
|
|
39949
40089
|
}
|
|
39950
40090
|
};
|
|
39951
40091
|
onCleanup(() => {
|
|
40092
|
+
if (transcriptScroll && !transcriptScroll.isDestroyed)
|
|
40093
|
+
transcriptScroll.verticalScrollBar.off("change", syncAway);
|
|
39952
40094
|
props.scrollRef?.(undefined);
|
|
39953
40095
|
});
|
|
39954
40096
|
return (() => {
|
|
39955
|
-
var _el$8 = createElement("box"), _el$9 = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("scrollbox");
|
|
40097
|
+
var _el$8 = createElement("box"), _el$9 = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("scrollbox"), _el$12 = createElement("box");
|
|
39956
40098
|
insertNode(_el$8, _el$9);
|
|
39957
40099
|
setProp(_el$8, "flexDirection", "column");
|
|
39958
40100
|
setProp(_el$8, "flexGrow", 1);
|
|
@@ -39963,12 +40105,15 @@ function Transcript(props) {
|
|
|
39963
40105
|
setProp(_el$9, "flexGrow", 1);
|
|
39964
40106
|
setProp(_el$9, "minHeight", 0);
|
|
39965
40107
|
insertNode(_el$0, _el$1);
|
|
40108
|
+
insertNode(_el$0, _el$12);
|
|
39966
40109
|
setProp(_el$0, "flexGrow", 1);
|
|
39967
40110
|
setProp(_el$0, "minHeight", 0);
|
|
39968
|
-
setProp(_el$0, "
|
|
39969
|
-
setProp(_el$0, "paddingBottom", 1);
|
|
40111
|
+
setProp(_el$0, "flexDirection", "column");
|
|
39970
40112
|
use((value) => {
|
|
40113
|
+
transcriptScroll = value;
|
|
39971
40114
|
props.scrollRef?.(value);
|
|
40115
|
+
value.verticalScrollBar.off("change", syncAway);
|
|
40116
|
+
value.verticalScrollBar.on("change", syncAway);
|
|
39972
40117
|
}, _el$1);
|
|
39973
40118
|
setProp(_el$1, "flexGrow", 1);
|
|
39974
40119
|
setProp(_el$1, "overflow", "hidden");
|
|
@@ -39979,12 +40124,12 @@ function Transcript(props) {
|
|
|
39979
40124
|
return visibleRows();
|
|
39980
40125
|
},
|
|
39981
40126
|
children: (row) => (() => {
|
|
39982
|
-
var _el$
|
|
39983
|
-
setProp(_el$
|
|
39984
|
-
setProp(_el$
|
|
39985
|
-
insert(_el$
|
|
39986
|
-
effect((_$p) => setProp(_el$
|
|
39987
|
-
return _el$
|
|
40127
|
+
var _el$15 = createElement("box");
|
|
40128
|
+
setProp(_el$15, "marginTop", 1);
|
|
40129
|
+
setProp(_el$15, "flexShrink", 0);
|
|
40130
|
+
insert(_el$15, () => rowView(row));
|
|
40131
|
+
effect((_$p) => setProp(_el$15, "id", `seam-row-${row.key}`, _$p));
|
|
40132
|
+
return _el$15;
|
|
39988
40133
|
})()
|
|
39989
40134
|
}), null);
|
|
39990
40135
|
insert(_el$1, createComponent2(Show, {
|
|
@@ -40005,15 +40150,15 @@ function Transcript(props) {
|
|
|
40005
40150
|
return props.pending?.() ?? [];
|
|
40006
40151
|
},
|
|
40007
40152
|
children: (row) => (() => {
|
|
40008
|
-
var _el$
|
|
40009
|
-
setProp(_el$
|
|
40010
|
-
setProp(_el$
|
|
40011
|
-
insert(_el$
|
|
40153
|
+
var _el$16 = createElement("box");
|
|
40154
|
+
setProp(_el$16, "marginTop", 1);
|
|
40155
|
+
setProp(_el$16, "flexShrink", 0);
|
|
40156
|
+
insert(_el$16, (() => {
|
|
40012
40157
|
var _c$ = memo2(() => row.kind === "queue");
|
|
40013
40158
|
return () => _c$() ? (() => {
|
|
40014
|
-
var _el$
|
|
40015
|
-
setProp(_el$
|
|
40016
|
-
insert(_el$
|
|
40159
|
+
var _el$17 = createElement("text");
|
|
40160
|
+
setProp(_el$17, "wrapMode", "word");
|
|
40161
|
+
insert(_el$17, (() => {
|
|
40017
40162
|
var _c$2 = memo2(() => row.state === "paused");
|
|
40018
40163
|
return () => _c$2() ? t("transcript.pending.queue.paused", {
|
|
40019
40164
|
order: row.order ?? 1,
|
|
@@ -40025,18 +40170,18 @@ function Transcript(props) {
|
|
|
40025
40170
|
})());
|
|
40026
40171
|
effect((_p$) => {
|
|
40027
40172
|
var _v$14 = color.pendingQueue(), _v$15 = TextAttributes6.ITALIC;
|
|
40028
|
-
_v$14 !== _p$.e && (_p$.e = setProp(_el$
|
|
40029
|
-
_v$15 !== _p$.t && (_p$.t = setProp(_el$
|
|
40173
|
+
_v$14 !== _p$.e && (_p$.e = setProp(_el$17, "fg", _v$14, _p$.e));
|
|
40174
|
+
_v$15 !== _p$.t && (_p$.t = setProp(_el$17, "attributes", _v$15, _p$.t));
|
|
40030
40175
|
return _p$;
|
|
40031
40176
|
}, {
|
|
40032
40177
|
e: undefined,
|
|
40033
40178
|
t: undefined
|
|
40034
40179
|
});
|
|
40035
|
-
return _el$
|
|
40180
|
+
return _el$17;
|
|
40036
40181
|
})() : (() => {
|
|
40037
|
-
var _el$
|
|
40038
|
-
setProp(_el$
|
|
40039
|
-
insert(_el$
|
|
40182
|
+
var _el$18 = createElement("text");
|
|
40183
|
+
setProp(_el$18, "wrapMode", "word");
|
|
40184
|
+
insert(_el$18, (() => {
|
|
40040
40185
|
var _c$3 = memo2(() => row.state === "delivered");
|
|
40041
40186
|
return () => _c$3() ? t("transcript.pending.steer.delivered", {
|
|
40042
40187
|
text: row.text
|
|
@@ -40044,29 +40189,46 @@ function Transcript(props) {
|
|
|
40044
40189
|
text: row.text
|
|
40045
40190
|
});
|
|
40046
40191
|
})());
|
|
40047
|
-
effect((_$p) => setProp(_el$
|
|
40048
|
-
return _el$
|
|
40192
|
+
effect((_$p) => setProp(_el$18, "fg", color.pendingSteer(), _$p));
|
|
40193
|
+
return _el$18;
|
|
40049
40194
|
})();
|
|
40050
40195
|
})());
|
|
40051
|
-
effect((_$p) => setProp(_el$
|
|
40052
|
-
return _el$
|
|
40196
|
+
effect((_$p) => setProp(_el$16, "id", `pending-row-${row.id}`, _$p));
|
|
40197
|
+
return _el$16;
|
|
40053
40198
|
})()
|
|
40054
40199
|
}), null);
|
|
40200
|
+
setProp(_el$12, "id", "transcript-scroll-hint");
|
|
40201
|
+
setProp(_el$12, "flexShrink", 0);
|
|
40202
|
+
setProp(_el$12, "height", 1);
|
|
40203
|
+
setProp(_el$12, "flexDirection", "row");
|
|
40204
|
+
setProp(_el$12, "justifyContent", "flex-end");
|
|
40205
|
+
setProp(_el$12, "onMouseUp", toBottom);
|
|
40206
|
+
insert(_el$12, createComponent2(Show, {
|
|
40207
|
+
get when() {
|
|
40208
|
+
return away();
|
|
40209
|
+
},
|
|
40210
|
+
get children() {
|
|
40211
|
+
var _el$13 = createElement("text");
|
|
40212
|
+
insert(_el$13, hintText);
|
|
40213
|
+
effect((_$p) => setProp(_el$13, "fg", hintColor(), _$p));
|
|
40214
|
+
return _el$13;
|
|
40215
|
+
}
|
|
40216
|
+
}));
|
|
40055
40217
|
insert(_el$8, createComponent2(Show, {
|
|
40056
40218
|
get when() {
|
|
40057
40219
|
return props.status || props.widgets || props.children || props.footer || props.notices;
|
|
40058
40220
|
},
|
|
40059
40221
|
get children() {
|
|
40060
|
-
var _el$
|
|
40061
|
-
setProp(_el$
|
|
40062
|
-
setProp(_el$
|
|
40063
|
-
setProp(_el$
|
|
40064
|
-
insert(_el$
|
|
40065
|
-
insert(_el$
|
|
40066
|
-
insert(_el$
|
|
40067
|
-
insert(_el$
|
|
40068
|
-
insert(_el$
|
|
40069
|
-
return _el$
|
|
40222
|
+
var _el$14 = createElement("box");
|
|
40223
|
+
setProp(_el$14, "width", "100%");
|
|
40224
|
+
setProp(_el$14, "flexShrink", 0);
|
|
40225
|
+
setProp(_el$14, "flexDirection", "column");
|
|
40226
|
+
insert(_el$14, () => props.status, null);
|
|
40227
|
+
insert(_el$14, () => props.widgets, null);
|
|
40228
|
+
insert(_el$14, () => props.children, null);
|
|
40229
|
+
insert(_el$14, () => props.footer, null);
|
|
40230
|
+
insert(_el$14, () => props.notices, null);
|
|
40231
|
+
return _el$14;
|
|
40070
40232
|
}
|
|
40071
40233
|
}), null);
|
|
40072
40234
|
effect((_p$) => {
|
|
@@ -40109,55 +40271,55 @@ function AskReplayBlock(props) {
|
|
|
40109
40271
|
const askAnswerOf = (entry) => entry.selected.map((label) => splitRecommended(label).label).join(", ") || entry.custom || t("transcript.ask.declined");
|
|
40110
40272
|
const askDeclinedOf = (entry) => entry.declined || entry.selected.length === 0 && !entry.custom;
|
|
40111
40273
|
return (() => {
|
|
40112
|
-
var _el$
|
|
40113
|
-
setProp(_el$
|
|
40114
|
-
setProp(_el$
|
|
40115
|
-
insert(_el$
|
|
40274
|
+
var _el$19 = createElement("box");
|
|
40275
|
+
setProp(_el$19, "flexDirection", "column");
|
|
40276
|
+
setProp(_el$19, "gap", 1);
|
|
40277
|
+
insert(_el$19, createComponent2(For, {
|
|
40116
40278
|
get each() {
|
|
40117
40279
|
return props.row.entries;
|
|
40118
40280
|
},
|
|
40119
40281
|
children: (entry) => (() => {
|
|
40120
|
-
var _el$
|
|
40121
|
-
insertNode(_el$
|
|
40122
|
-
insertNode(_el$
|
|
40123
|
-
setProp(_el$
|
|
40124
|
-
insert(_el$
|
|
40282
|
+
var _el$20 = createElement("box"), _el$21 = createElement("text"), _el$22 = createElement("text");
|
|
40283
|
+
insertNode(_el$20, _el$21);
|
|
40284
|
+
insertNode(_el$20, _el$22);
|
|
40285
|
+
setProp(_el$20, "flexDirection", "column");
|
|
40286
|
+
insert(_el$20, createComponent2(Show, {
|
|
40125
40287
|
get when() {
|
|
40126
40288
|
return entry.header;
|
|
40127
40289
|
},
|
|
40128
40290
|
children: (header) => (() => {
|
|
40129
|
-
var _el$
|
|
40130
|
-
insert(_el$
|
|
40131
|
-
effect((_$p) => setProp(_el$
|
|
40132
|
-
return _el$
|
|
40291
|
+
var _el$23 = createElement("text");
|
|
40292
|
+
insert(_el$23, header);
|
|
40293
|
+
effect((_$p) => setProp(_el$23, "fg", reasoning(), _$p));
|
|
40294
|
+
return _el$23;
|
|
40133
40295
|
})()
|
|
40134
|
-
}), _el$
|
|
40135
|
-
insert(_el$
|
|
40136
|
-
insert(_el$
|
|
40296
|
+
}), _el$21);
|
|
40297
|
+
insert(_el$21, () => `\u2713 ${entry.question}`);
|
|
40298
|
+
insert(_el$20, createComponent2(Show, {
|
|
40137
40299
|
get when() {
|
|
40138
40300
|
return entry.detail;
|
|
40139
40301
|
},
|
|
40140
40302
|
children: (detail) => (() => {
|
|
40141
|
-
var _el$
|
|
40142
|
-
insert(_el$
|
|
40143
|
-
effect((_$p) => setProp(_el$
|
|
40144
|
-
return _el$
|
|
40303
|
+
var _el$24 = createElement("text");
|
|
40304
|
+
insert(_el$24, detail);
|
|
40305
|
+
effect((_$p) => setProp(_el$24, "fg", reasoning(), _$p));
|
|
40306
|
+
return _el$24;
|
|
40145
40307
|
})()
|
|
40146
|
-
}), _el$
|
|
40147
|
-
insert(_el$
|
|
40308
|
+
}), _el$22);
|
|
40309
|
+
insert(_el$22, () => ` \u2192 ${askAnswerOf(entry)}`);
|
|
40148
40310
|
effect((_p$) => {
|
|
40149
40311
|
var _v$16 = reasoning(), _v$17 = askDeclinedOf(entry) ? reasoning() : answer();
|
|
40150
|
-
_v$16 !== _p$.e && (_p$.e = setProp(_el$
|
|
40151
|
-
_v$17 !== _p$.t && (_p$.t = setProp(_el$
|
|
40312
|
+
_v$16 !== _p$.e && (_p$.e = setProp(_el$21, "fg", _v$16, _p$.e));
|
|
40313
|
+
_v$17 !== _p$.t && (_p$.t = setProp(_el$22, "fg", _v$17, _p$.t));
|
|
40152
40314
|
return _p$;
|
|
40153
40315
|
}, {
|
|
40154
40316
|
e: undefined,
|
|
40155
40317
|
t: undefined
|
|
40156
40318
|
});
|
|
40157
|
-
return _el$
|
|
40319
|
+
return _el$20;
|
|
40158
40320
|
})()
|
|
40159
40321
|
}));
|
|
40160
|
-
return _el$
|
|
40322
|
+
return _el$19;
|
|
40161
40323
|
})();
|
|
40162
40324
|
}
|
|
40163
40325
|
var SIDES_RULE, SIDES_FRAME, CODE_RENDER_NODE_CACHE_MAX = 256, codeRenderNodeCache;
|
|
@@ -40176,7 +40338,9 @@ var init_transcript = __esm(() => {
|
|
|
40176
40338
|
init_seam_rows();
|
|
40177
40339
|
init_ask_options();
|
|
40178
40340
|
init_theme3();
|
|
40341
|
+
init_keymap();
|
|
40179
40342
|
init_i18n();
|
|
40343
|
+
init_keybind();
|
|
40180
40344
|
init_motion();
|
|
40181
40345
|
init_semantic();
|
|
40182
40346
|
init_widgets_dock();
|
|
@@ -41564,6 +41728,23 @@ function TranscriptScrollKeys(props) {
|
|
|
41564
41728
|
}],
|
|
41565
41729
|
bindings: ["session.first", "session.last"]
|
|
41566
41730
|
}));
|
|
41731
|
+
const toBottom = () => {
|
|
41732
|
+
const scroll = props.scroll();
|
|
41733
|
+
if (!scroll || scroll.isDestroyed)
|
|
41734
|
+
return;
|
|
41735
|
+
scroll.scrollTo(Infinity);
|
|
41736
|
+
};
|
|
41737
|
+
Keymap2.createLayer(() => ({
|
|
41738
|
+
capture: "main",
|
|
41739
|
+
enabled: props.enabled(),
|
|
41740
|
+
commands: [{
|
|
41741
|
+
id: "session.scroll.to_bottom",
|
|
41742
|
+
title: "Jump to latest",
|
|
41743
|
+
group: "Session",
|
|
41744
|
+
run: toBottom
|
|
41745
|
+
}],
|
|
41746
|
+
bindings: ["session.scroll.to_bottom"]
|
|
41747
|
+
}));
|
|
41567
41748
|
return createComponent2(Show, {
|
|
41568
41749
|
when: false,
|
|
41569
41750
|
children: null
|
|
@@ -44207,6 +44388,91 @@ function persistLang(seam, lang) {
|
|
|
44207
44388
|
function seamFailureReason(error) {
|
|
44208
44389
|
return String(error instanceof Error ? error.message : error).slice(0, 150);
|
|
44209
44390
|
}
|
|
44391
|
+
function pruneReasonLabel(reason) {
|
|
44392
|
+
const key = PRUNE_REASON_KEYS[reason];
|
|
44393
|
+
return key === undefined ? t("command.prune.reason.other", { reason }) : t(key);
|
|
44394
|
+
}
|
|
44395
|
+
function formatPruneBytes(bytes) {
|
|
44396
|
+
if (!Number.isFinite(bytes) || bytes <= 0)
|
|
44397
|
+
return "0 B";
|
|
44398
|
+
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
44399
|
+
let value = bytes;
|
|
44400
|
+
let unit = 0;
|
|
44401
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
44402
|
+
value /= 1024;
|
|
44403
|
+
unit++;
|
|
44404
|
+
}
|
|
44405
|
+
const shown = unit === 0 || value >= 10 ? String(Math.round(value)) : value.toFixed(1);
|
|
44406
|
+
return `${shown} ${units[unit]}`;
|
|
44407
|
+
}
|
|
44408
|
+
function pruneBytes(plan, sizeById) {
|
|
44409
|
+
let total = 0;
|
|
44410
|
+
for (const entry of plan.entries) {
|
|
44411
|
+
if (entry.decision !== "prune")
|
|
44412
|
+
continue;
|
|
44413
|
+
const size = sizeById.get(entry.sessionId);
|
|
44414
|
+
if (typeof size === "number" && Number.isFinite(size) && size > 0)
|
|
44415
|
+
total += size;
|
|
44416
|
+
}
|
|
44417
|
+
return total;
|
|
44418
|
+
}
|
|
44419
|
+
function formatPrunePlanRows(plan, sizeById = new Map) {
|
|
44420
|
+
const rows = [
|
|
44421
|
+
t("command.prune.summary", {
|
|
44422
|
+
count: String(plan.counts.prune),
|
|
44423
|
+
skipped: String(plan.counts.skip),
|
|
44424
|
+
bytes: formatPruneBytes(pruneBytes(plan, sizeById)),
|
|
44425
|
+
days: String(plan.retentionDays)
|
|
44426
|
+
})
|
|
44427
|
+
];
|
|
44428
|
+
const candidates = plan.entries.filter((entry) => entry.decision === "prune" && typeof entry.ageDays === "number" && Number.isFinite(entry.ageDays));
|
|
44429
|
+
if (candidates.length > 0) {
|
|
44430
|
+
const oldest = candidates.reduce((a, b) => b.ageDays > a.ageDays ? b : a);
|
|
44431
|
+
const newest = candidates.reduce((a, b) => b.ageDays < a.ageDays ? b : a);
|
|
44432
|
+
rows.push(t("command.prune.oldest", { id: oldest.sessionId, days: oldest.ageDays.toFixed(1) }));
|
|
44433
|
+
rows.push(t("command.prune.newest", { id: newest.sessionId, days: newest.ageDays.toFixed(1) }));
|
|
44434
|
+
}
|
|
44435
|
+
const reasons = Object.entries(plan.counts.byReason).sort((a, b) => b[1] - a[1]).slice(0, 5);
|
|
44436
|
+
if (reasons.length > 0) {
|
|
44437
|
+
rows.push(t("command.prune.skipSummary", {
|
|
44438
|
+
list: reasons.map(([reason, count]) => `${pruneReasonLabel(reason)}:${count}`).join(", ")
|
|
44439
|
+
}));
|
|
44440
|
+
}
|
|
44441
|
+
return rows;
|
|
44442
|
+
}
|
|
44443
|
+
function formatPurgePrepareRows(result) {
|
|
44444
|
+
const rows = [t("command.prunePurge.count", { count: String(result.candidates.length) })];
|
|
44445
|
+
for (const candidate of result.candidates) {
|
|
44446
|
+
rows.push(t("command.prunePurge.entry", {
|
|
44447
|
+
id: candidate.id,
|
|
44448
|
+
days: candidate.ageDays.toFixed(1)
|
|
44449
|
+
}));
|
|
44450
|
+
}
|
|
44451
|
+
if (result.rejected.length > 0) {
|
|
44452
|
+
rows.push(t("command.prunePurge.rejected", {
|
|
44453
|
+
count: String(result.rejected.length),
|
|
44454
|
+
codes: [...new Set(result.rejected.map((row) => row.code))].join(", ")
|
|
44455
|
+
}));
|
|
44456
|
+
}
|
|
44457
|
+
return rows;
|
|
44458
|
+
}
|
|
44459
|
+
function formatRestoreListRows(list) {
|
|
44460
|
+
const rows = [t("command.pruneRestore.count", { count: String(list.entries.length) })];
|
|
44461
|
+
for (const entry of list.entries) {
|
|
44462
|
+
rows.push(t("command.pruneRestore.entry", {
|
|
44463
|
+
id: entry.id,
|
|
44464
|
+
movedAt: new Date(entry.movedAt).toISOString(),
|
|
44465
|
+
size: entry.size === undefined ? t("command.pruneRestore.unknownSize") : formatPruneBytes(entry.size)
|
|
44466
|
+
}));
|
|
44467
|
+
}
|
|
44468
|
+
if (list.rejected.length > 0) {
|
|
44469
|
+
rows.push(t("command.pruneRestore.rejected", {
|
|
44470
|
+
count: String(list.rejected.length),
|
|
44471
|
+
codes: [...new Set(list.rejected.map((row) => row.code))].join(", ")
|
|
44472
|
+
}));
|
|
44473
|
+
}
|
|
44474
|
+
return rows;
|
|
44475
|
+
}
|
|
44210
44476
|
function presetNextRow(rows, currentId) {
|
|
44211
44477
|
if (rows.length <= 1)
|
|
44212
44478
|
return;
|
|
@@ -45424,6 +45690,163 @@ function coreCommands() {
|
|
|
45424
45690
|
ctx.say(t("command.cwd.failed", { reason: seamFailureReason(error) }));
|
|
45425
45691
|
}
|
|
45426
45692
|
}
|
|
45693
|
+
},
|
|
45694
|
+
{
|
|
45695
|
+
name: "/prune",
|
|
45696
|
+
description: t("command.prune.description"),
|
|
45697
|
+
async run(ctx) {
|
|
45698
|
+
if (!ctx.seam.planPrune || !ctx.seam.applyPrune) {
|
|
45699
|
+
ctx.say(t("command.prune.unavailable"));
|
|
45700
|
+
return;
|
|
45701
|
+
}
|
|
45702
|
+
try {
|
|
45703
|
+
const plan = await ctx.seam.planPrune();
|
|
45704
|
+
const sizeById = new Map;
|
|
45705
|
+
try {
|
|
45706
|
+
for (const row of await ctx.seam.listSessions(1e4)) {
|
|
45707
|
+
if (typeof row.sizeBytes === "number" && Number.isFinite(row.sizeBytes)) {
|
|
45708
|
+
sizeById.set(row.id, row.sizeBytes);
|
|
45709
|
+
}
|
|
45710
|
+
}
|
|
45711
|
+
} catch {}
|
|
45712
|
+
for (const line of formatPrunePlanRows(plan, sizeById))
|
|
45713
|
+
ctx.say(line);
|
|
45714
|
+
if (plan.counts.prune === 0) {
|
|
45715
|
+
ctx.say(t("command.prune.nothingToApply"));
|
|
45716
|
+
return;
|
|
45717
|
+
}
|
|
45718
|
+
if (!ctx.promptText) {
|
|
45719
|
+
ctx.say(t("command.prune.promptUnavailable"));
|
|
45720
|
+
return;
|
|
45721
|
+
}
|
|
45722
|
+
if (typeof plan.fingerprint !== "string" || typeof plan.configFingerprint !== "string") {
|
|
45723
|
+
ctx.say(t("command.prune.stalePlan"));
|
|
45724
|
+
return;
|
|
45725
|
+
}
|
|
45726
|
+
const answer = await ctx.promptText(t("command.prune.confirmTitle"), {
|
|
45727
|
+
placeholder: t("command.prune.confirmPlaceholder")
|
|
45728
|
+
});
|
|
45729
|
+
if (answer?.trim() !== "prune") {
|
|
45730
|
+
ctx.say(t("command.prune.cancelled"));
|
|
45731
|
+
return;
|
|
45732
|
+
}
|
|
45733
|
+
const result = await ctx.seam.applyPrune({
|
|
45734
|
+
fingerprint: plan.fingerprint,
|
|
45735
|
+
configFingerprint: plan.configFingerprint,
|
|
45736
|
+
generatedAt: plan.generatedAt
|
|
45737
|
+
});
|
|
45738
|
+
ctx.say(t("command.prune.applied", {
|
|
45739
|
+
count: String(result.applied.length),
|
|
45740
|
+
failed: String(result.failed.length)
|
|
45741
|
+
}));
|
|
45742
|
+
for (const row of result.failed) {
|
|
45743
|
+
ctx.say(t("command.prune.applyFailed", {
|
|
45744
|
+
id: row.id,
|
|
45745
|
+
code: row.code,
|
|
45746
|
+
message: row.message
|
|
45747
|
+
}));
|
|
45748
|
+
}
|
|
45749
|
+
if (result.markedOrphans > 0) {
|
|
45750
|
+
ctx.say(t("command.prune.orphans", { count: String(result.markedOrphans) }));
|
|
45751
|
+
}
|
|
45752
|
+
} catch (error) {
|
|
45753
|
+
ctx.say(t("command.prune.failed", { reason: seamFailureReason(error) }));
|
|
45754
|
+
}
|
|
45755
|
+
}
|
|
45756
|
+
},
|
|
45757
|
+
{
|
|
45758
|
+
name: "/prune-purge",
|
|
45759
|
+
description: t("command.prunePurge.description"),
|
|
45760
|
+
async run(ctx) {
|
|
45761
|
+
if (!ctx.seam.preparePurge || !ctx.seam.commitPurge) {
|
|
45762
|
+
ctx.say(t("command.prunePurge.unavailable"));
|
|
45763
|
+
return;
|
|
45764
|
+
}
|
|
45765
|
+
try {
|
|
45766
|
+
const prepared = await ctx.seam.preparePurge();
|
|
45767
|
+
for (const line of formatPurgePrepareRows(prepared))
|
|
45768
|
+
ctx.say(line);
|
|
45769
|
+
if (prepared.candidates.length === 0) {
|
|
45770
|
+
ctx.say(t("command.prunePurge.empty"));
|
|
45771
|
+
return;
|
|
45772
|
+
}
|
|
45773
|
+
if (!ctx.promptText) {
|
|
45774
|
+
ctx.say(t("command.prunePurge.promptUnavailable"));
|
|
45775
|
+
return;
|
|
45776
|
+
}
|
|
45777
|
+
const answer = await ctx.promptText(t("command.prunePurge.confirmTitle"), {
|
|
45778
|
+
placeholder: t("command.prunePurge.confirmPlaceholder")
|
|
45779
|
+
});
|
|
45780
|
+
if (answer?.trim() !== "purge") {
|
|
45781
|
+
ctx.say(t("command.prunePurge.cancelled"));
|
|
45782
|
+
return;
|
|
45783
|
+
}
|
|
45784
|
+
const result = await ctx.seam.commitPurge({ token: prepared.token });
|
|
45785
|
+
ctx.say(t("command.prunePurge.done", {
|
|
45786
|
+
count: String(result.purged.length),
|
|
45787
|
+
failed: String(result.failed.length)
|
|
45788
|
+
}));
|
|
45789
|
+
for (const row of result.failed) {
|
|
45790
|
+
ctx.say(t("command.prunePurge.failed", {
|
|
45791
|
+
code: row.code,
|
|
45792
|
+
message: row.message
|
|
45793
|
+
}));
|
|
45794
|
+
}
|
|
45795
|
+
} catch (error) {
|
|
45796
|
+
ctx.say(t("command.prunePurge.failed", {
|
|
45797
|
+
code: "INTERNAL",
|
|
45798
|
+
message: seamFailureReason(error)
|
|
45799
|
+
}));
|
|
45800
|
+
}
|
|
45801
|
+
}
|
|
45802
|
+
},
|
|
45803
|
+
{
|
|
45804
|
+
name: "/prune-restore",
|
|
45805
|
+
description: t("command.pruneRestore.description"),
|
|
45806
|
+
async run(ctx, argText) {
|
|
45807
|
+
if (!ctx.seam.listPruneRestore || !ctx.seam.restorePrune) {
|
|
45808
|
+
ctx.say(t("command.pruneRestore.unavailable"));
|
|
45809
|
+
return;
|
|
45810
|
+
}
|
|
45811
|
+
let id = argText.trim();
|
|
45812
|
+
try {
|
|
45813
|
+
if (id === "") {
|
|
45814
|
+
const list = await ctx.seam.listPruneRestore();
|
|
45815
|
+
for (const line of formatRestoreListRows(list))
|
|
45816
|
+
ctx.say(line);
|
|
45817
|
+
if (list.entries.length === 0) {
|
|
45818
|
+
ctx.say(t("command.pruneRestore.empty"));
|
|
45819
|
+
return;
|
|
45820
|
+
}
|
|
45821
|
+
if (!ctx.pickOne) {
|
|
45822
|
+
ctx.say(t("command.pruneRestore.promptUnavailable"));
|
|
45823
|
+
return;
|
|
45824
|
+
}
|
|
45825
|
+
const picked = await ctx.pickOne(t("command.pruneRestore.pickTitle"), list.entries.map((entry) => ({
|
|
45826
|
+
title: entry.id,
|
|
45827
|
+
value: entry.id,
|
|
45828
|
+
description: new Date(entry.movedAt).toISOString()
|
|
45829
|
+
})), t("command.pruneRestore.pickHeader"));
|
|
45830
|
+
if (picked === undefined) {
|
|
45831
|
+
ctx.say(t("command.pruneRestore.cancelled"));
|
|
45832
|
+
return;
|
|
45833
|
+
}
|
|
45834
|
+
id = picked;
|
|
45835
|
+
}
|
|
45836
|
+
const result = await ctx.seam.restorePrune(id);
|
|
45837
|
+
ctx.say(t("command.pruneRestore.done", { id: result.id }));
|
|
45838
|
+
} catch (error) {
|
|
45839
|
+
const rawCode = error?.code;
|
|
45840
|
+
const code = typeof rawCode === "string" && rawCode !== "" ? rawCode : "INTERNAL";
|
|
45841
|
+
if (code === "CONFLICT" || code === "LIVE_AGENT") {
|
|
45842
|
+
ctx.say(t("command.pruneRestore.conflict", { id }));
|
|
45843
|
+
}
|
|
45844
|
+
ctx.say(t("command.pruneRestore.failed", {
|
|
45845
|
+
code,
|
|
45846
|
+
message: seamFailureReason(error)
|
|
45847
|
+
}));
|
|
45848
|
+
}
|
|
45849
|
+
}
|
|
45427
45850
|
}
|
|
45428
45851
|
];
|
|
45429
45852
|
}
|
|
@@ -45447,7 +45870,7 @@ function dispatchLine(commands, line) {
|
|
|
45447
45870
|
function unknownCommandRow(name) {
|
|
45448
45871
|
return `unknown command: ${name} (try /help)`;
|
|
45449
45872
|
}
|
|
45450
|
-
var MODEL_DEFAULT_EFFORT_PICK = "__model_default__";
|
|
45873
|
+
var MODEL_DEFAULT_EFFORT_PICK = "__model_default__", PRUNE_REASON_KEYS;
|
|
45451
45874
|
var init_commands = __esm(() => {
|
|
45452
45875
|
init_i18n();
|
|
45453
45876
|
init_hotkeys();
|
|
@@ -45456,6 +45879,28 @@ var init_commands = __esm(() => {
|
|
|
45456
45879
|
init_hints_line();
|
|
45457
45880
|
init_motion();
|
|
45458
45881
|
init_export();
|
|
45882
|
+
PRUNE_REASON_KEYS = {
|
|
45883
|
+
"retention-disabled": "command.prune.reason.retentionDisabled",
|
|
45884
|
+
"field-anomaly": "command.prune.reason.fieldAnomaly",
|
|
45885
|
+
current: "command.prune.reason.current",
|
|
45886
|
+
staged: "command.prune.reason.staged",
|
|
45887
|
+
"agent-available": "command.prune.reason.agentAvailable",
|
|
45888
|
+
running: "command.prune.reason.running",
|
|
45889
|
+
"missing-time": "command.prune.reason.missingTime",
|
|
45890
|
+
"future-time": "command.prune.reason.futureTime",
|
|
45891
|
+
"subtree-running": "command.prune.reason.subtreeRunning",
|
|
45892
|
+
unknown: "command.prune.reason.unknown",
|
|
45893
|
+
"no-location": "command.prune.reason.noLocation",
|
|
45894
|
+
"header-mismatch": "command.prune.reason.headerMismatch",
|
|
45895
|
+
"basename-mismatch": "command.prune.reason.basenameMismatch",
|
|
45896
|
+
"not-directory": "command.prune.reason.notDirectory",
|
|
45897
|
+
"escaped-root": "command.prune.reason.escapedRoot",
|
|
45898
|
+
"lock-fresh": "command.prune.reason.lockFresh",
|
|
45899
|
+
"lock-held": "command.prune.reason.lockHeld",
|
|
45900
|
+
"fresh-mtime": "command.prune.reason.freshMtime",
|
|
45901
|
+
"blank-grace": "command.prune.reason.blankGrace",
|
|
45902
|
+
"within-retention": "command.prune.reason.withinRetention"
|
|
45903
|
+
};
|
|
45459
45904
|
});
|
|
45460
45905
|
|
|
45461
45906
|
// ../tui-base/src/routes/session/slash-complete.ts
|
|
@@ -50492,9 +50937,49 @@ function narrowCacheHitMode(value) {
|
|
|
50492
50937
|
function readCacheHitMode(config) {
|
|
50493
50938
|
return narrowCacheHitMode(config?.cacheHitMode);
|
|
50494
50939
|
}
|
|
50495
|
-
|
|
50940
|
+
function configNonNegativeInt(value) {
|
|
50941
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0)
|
|
50942
|
+
return Math.floor(value);
|
|
50943
|
+
if (typeof value === "string" && /^\d+$/.test(value.trim()))
|
|
50944
|
+
return Number(value.trim());
|
|
50945
|
+
return;
|
|
50946
|
+
}
|
|
50947
|
+
function readMaxRounds(config) {
|
|
50948
|
+
return configNonNegativeInt(config?.maxRounds) ?? DEFAULT_MAX_ROUNDS;
|
|
50949
|
+
}
|
|
50950
|
+
function readRetentionDays(config) {
|
|
50951
|
+
return configNonNegativeInt(config?.retentionDays) ?? DEFAULT_RETENTION_DAYS;
|
|
50952
|
+
}
|
|
50953
|
+
function readSessionScrollbar(...configs) {
|
|
50954
|
+
for (const config of configs) {
|
|
50955
|
+
const decoded = decodeScrollbar(config ?? {});
|
|
50956
|
+
if (decoded._tag === "Some" && decoded.value.session?.scrollbar !== undefined) {
|
|
50957
|
+
return decoded.value.session.scrollbar;
|
|
50958
|
+
}
|
|
50959
|
+
}
|
|
50960
|
+
return;
|
|
50961
|
+
}
|
|
50962
|
+
function resolveSessionScrollbar(...configs) {
|
|
50963
|
+
return readSessionScrollbar(...configs) ?? DEFAULT_SESSION_SCROLLBAR;
|
|
50964
|
+
}
|
|
50965
|
+
var DEFAULT_CACHE_HIT_MODE = "lastMessage", DEFAULT_MAX_ROUNDS = 50, DEFAULT_RETENTION_DAYS = 90, SessionScrollbarConfig, decodeScrollbar, DEFAULT_SESSION_SCROLLBAR = true;
|
|
50966
|
+
var init_config2 = __esm(() => {
|
|
50967
|
+
init_dist();
|
|
50968
|
+
SessionScrollbarConfig = Struct({
|
|
50969
|
+
session: optional2(Struct({ scrollbar: Boolean3 }))
|
|
50970
|
+
});
|
|
50971
|
+
decodeScrollbar = decodeUnknownOption2(SessionScrollbarConfig);
|
|
50972
|
+
});
|
|
50496
50973
|
|
|
50497
50974
|
// ../tui-base/src/routes/session/settings-panel.tsx
|
|
50975
|
+
function unsetNumeric(config, key) {
|
|
50976
|
+
const value = config[key];
|
|
50977
|
+
if (typeof value === "number")
|
|
50978
|
+
return !Number.isFinite(value) || value < 0;
|
|
50979
|
+
if (typeof value === "string")
|
|
50980
|
+
return !/^\d+$/.test(value.trim());
|
|
50981
|
+
return true;
|
|
50982
|
+
}
|
|
50498
50983
|
function str(value) {
|
|
50499
50984
|
return typeof value === "string" && value !== "" ? value : undefined;
|
|
50500
50985
|
}
|
|
@@ -50522,6 +51007,7 @@ function buildLocalItems(input) {
|
|
|
50522
51007
|
zone: "local",
|
|
50523
51008
|
editable: writable
|
|
50524
51009
|
};
|
|
51010
|
+
const storedGear = activityPanelHeightFromConfig(merged.session?.activity_panel_height);
|
|
50525
51011
|
const items = [{
|
|
50526
51012
|
...base,
|
|
50527
51013
|
id: "theme",
|
|
@@ -50611,10 +51097,13 @@ function buildLocalItems(input) {
|
|
|
50611
51097
|
...base,
|
|
50612
51098
|
id: "activityPanelHeight",
|
|
50613
51099
|
label: t("settings.row.activityPanelHeight"),
|
|
50614
|
-
value:
|
|
51100
|
+
value: storedGear ?? DEFAULT_ACTIVITY_PANEL_GEAR,
|
|
50615
51101
|
source: "config.json \xB7 session.activity_panel_height",
|
|
50616
51102
|
kind: "enum",
|
|
50617
51103
|
options: ["default", "1", "5", "7", "10", "all"],
|
|
51104
|
+
...storedGear === undefined ? {
|
|
51105
|
+
note: effectiveDefaultNote(DEFAULT_ACTIVITY_PANEL_GEAR)
|
|
51106
|
+
} : {},
|
|
50618
51107
|
write: {
|
|
50619
51108
|
via: "config",
|
|
50620
51109
|
key: "session.activity_panel_height"
|
|
@@ -50623,10 +51112,13 @@ function buildLocalItems(input) {
|
|
|
50623
51112
|
...base,
|
|
50624
51113
|
id: "retentionDays",
|
|
50625
51114
|
label: "retentionDays",
|
|
50626
|
-
value:
|
|
51115
|
+
value: readRetentionDays(merged).toString(),
|
|
50627
51116
|
source: "config.json \xB7 retentionDays",
|
|
50628
51117
|
kind: "number",
|
|
50629
51118
|
min: 0,
|
|
51119
|
+
...unsetNumeric(merged, "retentionDays") ? {
|
|
51120
|
+
note: effectiveDefaultNote(String(readRetentionDays(undefined)))
|
|
51121
|
+
} : {},
|
|
50630
51122
|
write: {
|
|
50631
51123
|
via: "config",
|
|
50632
51124
|
key: "retentionDays"
|
|
@@ -50635,10 +51127,13 @@ function buildLocalItems(input) {
|
|
|
50635
51127
|
...base,
|
|
50636
51128
|
id: "maxRounds",
|
|
50637
51129
|
label: "maxRounds",
|
|
50638
|
-
value:
|
|
51130
|
+
value: readMaxRounds(merged).toString(),
|
|
50639
51131
|
source: "config.json \xB7 maxRounds (subagent round cap)",
|
|
50640
51132
|
kind: "number",
|
|
50641
51133
|
min: 0,
|
|
51134
|
+
...unsetNumeric(merged, "maxRounds") ? {
|
|
51135
|
+
note: effectiveDefaultNote(String(readMaxRounds(undefined)))
|
|
51136
|
+
} : {},
|
|
50642
51137
|
write: {
|
|
50643
51138
|
via: "config",
|
|
50644
51139
|
key: "maxRounds"
|
|
@@ -51250,13 +51745,16 @@ function applySettingsLive(item, applied, hints, themes) {
|
|
|
51250
51745
|
function setSettingsBridge(value) {
|
|
51251
51746
|
setBridgeOpen4(value);
|
|
51252
51747
|
}
|
|
51253
|
-
var unknownValue = () => t("settings.value.unset"), naValue = () => t("settings.value.na"), readonlyNote = () => t("settings.zone.readonlyNote"),
|
|
51748
|
+
var unknownValue = () => t("settings.value.unset"), naValue = () => t("settings.value.na"), readonlyNote = () => t("settings.zone.readonlyNote"), effectiveDefaultNote = (value) => t("settings.note.effectiveDefault", {
|
|
51749
|
+
value
|
|
51750
|
+
}), HOST_SETTINGS_WHITELIST, HIDDEN_NAMESPACES, LOCAL_SETTING_IDS, bridgeOpen4, setBridgeOpen4, panelOpen5, setPanelOpen5, settingsPanelOpen, settingsBridgeOpen;
|
|
51254
51751
|
var init_settings_panel = __esm(() => {
|
|
51255
51752
|
init_server();
|
|
51256
51753
|
init_i18n();
|
|
51257
51754
|
init_string_width();
|
|
51258
51755
|
init_motion();
|
|
51259
51756
|
init_hints_line();
|
|
51757
|
+
init_config2();
|
|
51260
51758
|
init_widgets_dock();
|
|
51261
51759
|
HOST_SETTINGS_WHITELIST = [{
|
|
51262
51760
|
id: "subagent.maxActiveSubagents",
|
|
@@ -54629,6 +55127,21 @@ function SubagentsViewer(props) {
|
|
|
54629
55127
|
return [];
|
|
54630
55128
|
return seam.subagentTranscript(id);
|
|
54631
55129
|
});
|
|
55130
|
+
const transcriptStatus = createMemo(() => {
|
|
55131
|
+
tick();
|
|
55132
|
+
const id = browsingId();
|
|
55133
|
+
if (id === undefined || props.seam.subagentTranscriptStatus === undefined)
|
|
55134
|
+
return;
|
|
55135
|
+
return props.seam.subagentTranscriptStatus(id);
|
|
55136
|
+
});
|
|
55137
|
+
const emptyTranscriptKey = () => {
|
|
55138
|
+
const state = transcriptStatus();
|
|
55139
|
+
if (state === "read-failed")
|
|
55140
|
+
return "panel.subagents.transcript.readFailed";
|
|
55141
|
+
if (state === "not-running")
|
|
55142
|
+
return "panel.subagents.transcript.ended";
|
|
55143
|
+
return "panel.subagents.transcript.empty";
|
|
55144
|
+
};
|
|
54632
55145
|
const window = createMemo(() => transcriptWindow(transcript().length, scrollOffset(), TRANSCRIPT_ROWS));
|
|
54633
55146
|
function startTicking() {
|
|
54634
55147
|
if (tickTimer !== undefined)
|
|
@@ -54948,7 +55461,7 @@ function SubagentsViewer(props) {
|
|
|
54948
55461
|
var _el$10 = createElement("text");
|
|
54949
55462
|
setProp(_el$10, "fg", muted);
|
|
54950
55463
|
setProp(_el$10, "wrapMode", "none");
|
|
54951
|
-
insert(_el$10, () => t(
|
|
55464
|
+
insert(_el$10, () => t(emptyTranscriptKey()));
|
|
54952
55465
|
return _el$10;
|
|
54953
55466
|
})();
|
|
54954
55467
|
},
|
|
@@ -55041,7 +55554,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
55041
55554
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
55042
55555
|
function resolveVersion() {
|
|
55043
55556
|
try {
|
|
55044
|
-
return "0.
|
|
55557
|
+
return "0.29.0";
|
|
55045
55558
|
} catch {
|
|
55046
55559
|
return "dev";
|
|
55047
55560
|
}
|
|
@@ -55215,7 +55728,7 @@ function buildOpentuiRows(ctx) {
|
|
|
55215
55728
|
writable: ctx.local
|
|
55216
55729
|
}).filter((item) => item.id !== "lang").map((row) => row.id === "activityPanelHeight" ? {
|
|
55217
55730
|
...row,
|
|
55218
|
-
note: t("settings.row.activityPanelHeightNote")
|
|
55731
|
+
note: row.note === undefined ? t("settings.row.activityPanelHeightNote") : `${t("settings.row.activityPanelHeightNote")} \xB7 ${row.note}`
|
|
55219
55732
|
} : row).map(fromItem);
|
|
55220
55733
|
return settingsRowsForMode(rows, ctx);
|
|
55221
55734
|
}
|
|
@@ -56624,7 +57137,7 @@ function createBtwSnapshotBuilder(seam) {
|
|
|
56624
57137
|
return [];
|
|
56625
57138
|
try {
|
|
56626
57139
|
const rows = await seam.storedTranscript(id);
|
|
56627
|
-
return rows.slice(-BTW_SNAPSHOT_ROWS).map((row) => `${row.kind}: ${row.text}`.slice(0, BTW_SNAPSHOT_ROW_CHARS));
|
|
57140
|
+
return rows.filter((row) => row.kind !== "notice").slice(-BTW_SNAPSHOT_ROWS).map((row) => `${row.kind}: ${row.text}`.slice(0, BTW_SNAPSHOT_ROW_CHARS));
|
|
56628
57141
|
} catch {
|
|
56629
57142
|
return [];
|
|
56630
57143
|
}
|
|
@@ -57633,7 +58146,7 @@ function journalToTranscriptRows(entries, skip = 0) {
|
|
|
57633
58146
|
if (callId)
|
|
57634
58147
|
toolCalls.delete(callId);
|
|
57635
58148
|
const ok = entry.data.isError !== true && message.isError !== true;
|
|
57636
|
-
const brief =
|
|
58149
|
+
const brief = toolResultText(entry.data).slice(0, 300);
|
|
57637
58150
|
items.push({
|
|
57638
58151
|
kind: "tool",
|
|
57639
58152
|
name: known?.name ?? "tool",
|
|
@@ -57655,6 +58168,31 @@ function sourceKind2(data) {
|
|
|
57655
58168
|
function assistantText(data) {
|
|
57656
58169
|
return blocksText2(asRecord4(data.message).content);
|
|
57657
58170
|
}
|
|
58171
|
+
function toolResultText(data) {
|
|
58172
|
+
const message = asRecord4(data.message);
|
|
58173
|
+
const output = asRecord4(data.output);
|
|
58174
|
+
const nestedMessage = asRecord4(output.message);
|
|
58175
|
+
const candidates = [
|
|
58176
|
+
message.content,
|
|
58177
|
+
data.content,
|
|
58178
|
+
data.output,
|
|
58179
|
+
data.text,
|
|
58180
|
+
message.text,
|
|
58181
|
+
output.content,
|
|
58182
|
+
output.text,
|
|
58183
|
+
nestedMessage.content
|
|
58184
|
+
];
|
|
58185
|
+
for (const candidate of candidates) {
|
|
58186
|
+
if (typeof candidate === "string" && candidate !== "")
|
|
58187
|
+
return candidate;
|
|
58188
|
+
if (Array.isArray(candidate)) {
|
|
58189
|
+
const text = blocksText2(candidate);
|
|
58190
|
+
if (text !== "")
|
|
58191
|
+
return text;
|
|
58192
|
+
}
|
|
58193
|
+
}
|
|
58194
|
+
return "";
|
|
58195
|
+
}
|
|
57658
58196
|
var init_remote_session_ops = __esm(() => {
|
|
57659
58197
|
init_remote_follow();
|
|
57660
58198
|
init_remote_stream();
|
|
@@ -57708,6 +58246,85 @@ var init_journal_projection = __esm(() => {
|
|
|
57708
58246
|
NOTICE_SOURCE_KINDS = new Set(["subagent-settled", "agent-message", "team-message", "webhook"]);
|
|
57709
58247
|
});
|
|
57710
58248
|
|
|
58249
|
+
// src/client/ask-outcome.ts
|
|
58250
|
+
function legacyReason(input) {
|
|
58251
|
+
if (input.journalKind === "ask.responded") {
|
|
58252
|
+
if (input.outcome === "denied")
|
|
58253
|
+
return "rejected";
|
|
58254
|
+
if (input.outcome === "approved" && input.source === "answer")
|
|
58255
|
+
return "answered";
|
|
58256
|
+
if (input.outcome === "unavailable" && input.source === "fail-closed")
|
|
58257
|
+
return "no-channel";
|
|
58258
|
+
return "unrecorded";
|
|
58259
|
+
}
|
|
58260
|
+
if (input.journalKind === "ask.cancelled") {
|
|
58261
|
+
if (input.cancelReason === "deadline")
|
|
58262
|
+
return "timeout";
|
|
58263
|
+
if (input.cancelReason === "host-abort")
|
|
58264
|
+
return "ended";
|
|
58265
|
+
return "unrecorded";
|
|
58266
|
+
}
|
|
58267
|
+
if (input.outcome === "approved")
|
|
58268
|
+
return "answered";
|
|
58269
|
+
if (input.outcome === "denied")
|
|
58270
|
+
return "rejected";
|
|
58271
|
+
if (input.outcome === "unavailable")
|
|
58272
|
+
return "no-channel";
|
|
58273
|
+
return "unrecorded";
|
|
58274
|
+
}
|
|
58275
|
+
function reasonText(reason) {
|
|
58276
|
+
if (reason === "ended")
|
|
58277
|
+
return LEGACY_ENDED_TEXT;
|
|
58278
|
+
if (reason === "unrecorded")
|
|
58279
|
+
return LEGACY_UNRECORDED_TEXT;
|
|
58280
|
+
return SETTLE_TEXT[reason] ?? LEGACY_UNRECORDED_TEXT;
|
|
58281
|
+
}
|
|
58282
|
+
function deriveAskOutcomeNotice(input) {
|
|
58283
|
+
if (input.eventId === "" || input.sessionId === "" || input.sessionId === "unknown")
|
|
58284
|
+
return;
|
|
58285
|
+
if (input.source === "summary")
|
|
58286
|
+
return;
|
|
58287
|
+
if (!input.orphan && input.askKind === "questions" && input.outcome === "approved" && input.childSessionId === undefined) {
|
|
58288
|
+
return;
|
|
58289
|
+
}
|
|
58290
|
+
const text = input.orphan ? LEGACY_ORPHAN_TEXT : reasonText(input.settleReason !== undefined && CLOSED_SETTLE_REASONS.has(input.settleReason) ? input.settleReason : legacyReason(input));
|
|
58291
|
+
return {
|
|
58292
|
+
id: `ask-outcome:${input.eventId}`,
|
|
58293
|
+
text,
|
|
58294
|
+
anchorSeq: input.anchorSeq,
|
|
58295
|
+
sessionId: input.sessionId
|
|
58296
|
+
};
|
|
58297
|
+
}
|
|
58298
|
+
var CLOSED_SETTLE_REASONS, SETTLE_TEXT, LEGACY_ENDED_TEXT = "\u8BE5\u8BF7\u6C42\u5DF2\u7ED3\u675F\uFF08\u65E7\u65E5\u5FD7\u672A\u7EC6\u5206\uFF09", LEGACY_UNRECORDED_TEXT = "\u8BE5\u8BF7\u6C42\u7ED3\u5C40\u672A\u8BB0\u5F55\uFF08\u65E7\u65E5\u5FD7\u672A\u7EC6\u5206\uFF09", LEGACY_ORPHAN_TEXT = "\u672A\u6536\u5230\u8BE5\u8BF7\u6C42\u7684\u56DE\u7B54\u7ED3\u679C";
|
|
58299
|
+
var init_ask_outcome = __esm(() => {
|
|
58300
|
+
CLOSED_SETTLE_REASONS = new Set([
|
|
58301
|
+
"answered",
|
|
58302
|
+
"rejected",
|
|
58303
|
+
"unavailable",
|
|
58304
|
+
"timeout",
|
|
58305
|
+
"aborted",
|
|
58306
|
+
"turn-ended",
|
|
58307
|
+
"session-closed",
|
|
58308
|
+
"detached",
|
|
58309
|
+
"connection-closed",
|
|
58310
|
+
"no-channel",
|
|
58311
|
+
"auto-approved"
|
|
58312
|
+
]);
|
|
58313
|
+
SETTLE_TEXT = {
|
|
58314
|
+
answered: "\u5DF2\u6536\u5230\u8BE5\u8BF7\u6C42\u7684\u56DE\u7B54",
|
|
58315
|
+
rejected: "\u8BE5\u8BF7\u6C42\u5DF2\u88AB\u62D2\u7EDD",
|
|
58316
|
+
unavailable: "\u8BE5\u8BF7\u6C42\u65E0\u53EF\u7528\u56DE\u7B54\u6E20\u9053",
|
|
58317
|
+
timeout: "\u7B49\u5F85\u8BE5\u8BF7\u6C42\u7684\u56DE\u7B54\u8D85\u65F6",
|
|
58318
|
+
aborted: "\u8BE5\u8BF7\u6C42\u88AB\u4E2D\u6B62",
|
|
58319
|
+
"turn-ended": "\u56DE\u5408\u7ED3\u675F\u65F6\u8BE5\u8BF7\u6C42\u5DF2\u53D6\u6D88",
|
|
58320
|
+
"session-closed": "\u4F1A\u8BDD\u5173\u95ED\u65F6\u8BE5\u8BF7\u6C42\u5DF2\u53D6\u6D88",
|
|
58321
|
+
detached: "\u8BE5\u8BF7\u6C42\u5DF2\u8131\u79BB\u5F53\u524D\u4F1A\u8BDD",
|
|
58322
|
+
"connection-closed": "\u8FDE\u63A5\u5173\u95ED\u65F6\u8BE5\u8BF7\u6C42\u5DF2\u53D6\u6D88",
|
|
58323
|
+
"no-channel": "\u6CA1\u6709\u53EF\u7528\u6295\u9012\u6E20\u9053\uFF0C\u8BE5\u8BF7\u6C42\u672A\u5B8C\u6210",
|
|
58324
|
+
"auto-approved": "\u8BE5\u8BF7\u6C42\u5DF2\u81EA\u52A8\u6279\u51C6"
|
|
58325
|
+
};
|
|
58326
|
+
});
|
|
58327
|
+
|
|
57711
58328
|
// src/client/bridge-side-session.ts
|
|
57712
58329
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
57713
58330
|
function classify(err, stage) {
|
|
@@ -58736,6 +59353,8 @@ var init_local_config_faces = __esm(() => {
|
|
|
58736
59353
|
"stepsDisplay",
|
|
58737
59354
|
"stepsCollapse",
|
|
58738
59355
|
"stepsFolded",
|
|
59356
|
+
"maxRounds",
|
|
59357
|
+
"retentionDays",
|
|
58739
59358
|
"agentPreset",
|
|
58740
59359
|
"skinMigration",
|
|
58741
59360
|
"workspaceTheme",
|
|
@@ -59292,6 +59911,261 @@ var init_bridge_settings_route = __esm(() => {
|
|
|
59292
59911
|
};
|
|
59293
59912
|
});
|
|
59294
59913
|
|
|
59914
|
+
// src/subagent-policy.ts
|
|
59915
|
+
function nonNegativeInt(value) {
|
|
59916
|
+
if (typeof value === "number" && Number.isFinite(value) && value >= 0)
|
|
59917
|
+
return Math.floor(value);
|
|
59918
|
+
if (typeof value === "string" && /^\d+$/.test(value.trim()))
|
|
59919
|
+
return Number(value.trim());
|
|
59920
|
+
return;
|
|
59921
|
+
}
|
|
59922
|
+
function parseSubagentRoundLimits(value) {
|
|
59923
|
+
if (value === null || typeof value !== "object")
|
|
59924
|
+
return { ...DEFAULT_SUBAGENT_ROUND_LIMITS };
|
|
59925
|
+
const record = value;
|
|
59926
|
+
const maxRounds = nonNegativeInt(record.maxRounds);
|
|
59927
|
+
const maxRoundsGrace = nonNegativeInt(record.maxRoundsGrace);
|
|
59928
|
+
return {
|
|
59929
|
+
maxRounds: maxRounds ?? DEFAULT_SUBAGENT_ROUND_LIMITS.maxRounds,
|
|
59930
|
+
maxRoundsGrace: maxRoundsGrace ?? DEFAULT_SUBAGENT_ROUND_LIMITS.maxRoundsGrace
|
|
59931
|
+
};
|
|
59932
|
+
}
|
|
59933
|
+
function earlyFloor(cap) {
|
|
59934
|
+
return Math.max(10, Math.floor(cap / 3));
|
|
59935
|
+
}
|
|
59936
|
+
function spinDecision(input) {
|
|
59937
|
+
if (input.cap <= 0)
|
|
59938
|
+
return "none";
|
|
59939
|
+
if (input.settled)
|
|
59940
|
+
return "none";
|
|
59941
|
+
if (input.streak < EARLY_STOP_SPIN_STREAK)
|
|
59942
|
+
return "none";
|
|
59943
|
+
if (input.now - input.lastStrikeAt >= SPIN_STRIKE_STALE_MS)
|
|
59944
|
+
return "none";
|
|
59945
|
+
if (!input.wrapupDelivered) {
|
|
59946
|
+
return input.count >= earlyFloor(input.cap) && input.count < input.cap ? "wrapup-early" : "none";
|
|
59947
|
+
}
|
|
59948
|
+
if (input.grace <= 0)
|
|
59949
|
+
return "none";
|
|
59950
|
+
if (input.wrapupDeliveredAt === undefined)
|
|
59951
|
+
return "none";
|
|
59952
|
+
if (input.lastStrikeAt <= input.wrapupDeliveredAt)
|
|
59953
|
+
return "none";
|
|
59954
|
+
if ((input.roundsSinceWrapup ?? 0) < 1)
|
|
59955
|
+
return "none";
|
|
59956
|
+
return "force-stop-early";
|
|
59957
|
+
}
|
|
59958
|
+
function ladderDecision(input) {
|
|
59959
|
+
if (input.cap <= 0)
|
|
59960
|
+
return "none";
|
|
59961
|
+
if (input.settled)
|
|
59962
|
+
return "none";
|
|
59963
|
+
if (!input.wrapupDelivered) {
|
|
59964
|
+
return input.count >= input.cap ? "wrapup" : "none";
|
|
59965
|
+
}
|
|
59966
|
+
if (input.grace <= 0)
|
|
59967
|
+
return "none";
|
|
59968
|
+
return input.count >= input.cap + input.grace ? "force-stop" : "none";
|
|
59969
|
+
}
|
|
59970
|
+
function wrapupMessage(maxRounds, grace) {
|
|
59971
|
+
const base = `Round limit reached (${maxRounds} LLM round-trips, set by the dsh-opentui maxRounds policy). ` + "Do NOT call any more tools. Finish this task NOW: summarize what you have accomplished so far, " + "state clearly what remains undone, and return that summary as your final answer.";
|
|
59972
|
+
return grace > 0 ? `${base} You have ${grace} more round${grace === 1 ? "" : "s"} before this run is force-stopped.` : base;
|
|
59973
|
+
}
|
|
59974
|
+
function wrapupMessageEarly() {
|
|
59975
|
+
return "This run appears to be going in circles \u2014 repeating work without forward progress, " + "as judged by the dsh-opentui attention policy. Do NOT call any more tools. Finish NOW with what you have: " + "summarize what was accomplished, state clearly what remains undone, and return that summary as your final answer. " + "If this judgment looks wrong, say so in the summary and stop.";
|
|
59976
|
+
}
|
|
59977
|
+
|
|
59978
|
+
class SubagentRoundPolicy {
|
|
59979
|
+
#options;
|
|
59980
|
+
#injected = new Set;
|
|
59981
|
+
#hardStopped = new Set;
|
|
59982
|
+
#resolvedCaps = new Map;
|
|
59983
|
+
#injectedLabel = new Map;
|
|
59984
|
+
#injectedRound = new Map;
|
|
59985
|
+
#injectedAt = new Map;
|
|
59986
|
+
#spinState = new Map;
|
|
59987
|
+
#disposed = false;
|
|
59988
|
+
constructor(options) {
|
|
59989
|
+
this.#options = options;
|
|
59990
|
+
}
|
|
59991
|
+
noteSpinVerdict(childId, score, now = Date.now()) {
|
|
59992
|
+
if (this.#disposed || !childId)
|
|
59993
|
+
return;
|
|
59994
|
+
if (typeof score !== "number" || !Number.isFinite(score))
|
|
59995
|
+
return;
|
|
59996
|
+
const previous = this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
|
|
59997
|
+
if (score >= SPIN_HIGH_SEGMENT_AT) {
|
|
59998
|
+
this.#spinState.set(childId, { streak: previous.streak + 1, lastStrikeAt: now });
|
|
59999
|
+
} else {
|
|
60000
|
+
this.#spinState.set(childId, { streak: 0, lastStrikeAt: 0 });
|
|
60001
|
+
}
|
|
60002
|
+
}
|
|
60003
|
+
getSpinState(childId) {
|
|
60004
|
+
return this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
|
|
60005
|
+
}
|
|
60006
|
+
onRoundCount(childId, count, label) {
|
|
60007
|
+
if (this.#disposed || !childId)
|
|
60008
|
+
return;
|
|
60009
|
+
if (this.#hardStopped.has(childId))
|
|
60010
|
+
return;
|
|
60011
|
+
const caps = this.#resolveCaps(childId, label ?? this.#injectedLabel.get(childId));
|
|
60012
|
+
if (caps === undefined)
|
|
60013
|
+
return;
|
|
60014
|
+
const settled = this.#options.isSettled?.(childId) ?? false;
|
|
60015
|
+
const spin = this.#spinState.get(childId) ?? { streak: 0, lastStrikeAt: 0 };
|
|
60016
|
+
const injectedRound = this.#injectedRound.get(childId);
|
|
60017
|
+
const spinAction = spinDecision({
|
|
60018
|
+
streak: spin.streak,
|
|
60019
|
+
lastStrikeAt: spin.lastStrikeAt,
|
|
60020
|
+
now: Date.now(),
|
|
60021
|
+
count,
|
|
60022
|
+
cap: caps.cap,
|
|
60023
|
+
grace: caps.grace,
|
|
60024
|
+
wrapupDelivered: this.#injected.has(childId),
|
|
60025
|
+
wrapupDeliveredAt: this.#injectedAt.get(childId),
|
|
60026
|
+
roundsSinceWrapup: injectedRound !== undefined ? count - injectedRound : undefined,
|
|
60027
|
+
settled
|
|
60028
|
+
});
|
|
60029
|
+
if (spinAction === "force-stop-early") {
|
|
60030
|
+
this.#hardStopped.add(childId);
|
|
60031
|
+
const reportEarlyStop = (stopped) => {
|
|
60032
|
+
if (!stopped)
|
|
60033
|
+
return;
|
|
60034
|
+
try {
|
|
60035
|
+
this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace, early: true });
|
|
60036
|
+
} catch {}
|
|
60037
|
+
try {
|
|
60038
|
+
this.#options.onSpinStop?.(childId, count);
|
|
60039
|
+
} catch {}
|
|
60040
|
+
};
|
|
60041
|
+
let stoppedEarly = false;
|
|
60042
|
+
try {
|
|
60043
|
+
stoppedEarly = this.#options.forceStop(childId);
|
|
60044
|
+
} catch {
|
|
60045
|
+
stoppedEarly = false;
|
|
60046
|
+
}
|
|
60047
|
+
if (stoppedEarly instanceof Promise) {
|
|
60048
|
+
stoppedEarly.then(reportEarlyStop, () => {});
|
|
60049
|
+
} else {
|
|
60050
|
+
reportEarlyStop(stoppedEarly);
|
|
60051
|
+
}
|
|
60052
|
+
return;
|
|
60053
|
+
}
|
|
60054
|
+
const action = ladderDecision({
|
|
60055
|
+
count,
|
|
60056
|
+
cap: caps.cap,
|
|
60057
|
+
grace: caps.grace,
|
|
60058
|
+
wrapupDelivered: this.#injected.has(childId),
|
|
60059
|
+
settled
|
|
60060
|
+
});
|
|
60061
|
+
if (action === "none" && spinAction !== "wrapup-early")
|
|
60062
|
+
return;
|
|
60063
|
+
if (action === "wrapup" || spinAction === "wrapup-early") {
|
|
60064
|
+
if (this.#injected.has(childId))
|
|
60065
|
+
return;
|
|
60066
|
+
const rememberedLabel = label ?? this.#injectedLabel.get(childId);
|
|
60067
|
+
const early = spinAction === "wrapup-early";
|
|
60068
|
+
queueMicrotask(() => {
|
|
60069
|
+
if (this.#disposed || this.#injected.has(childId))
|
|
60070
|
+
return;
|
|
60071
|
+
if (this.#options.isSettled?.(childId) === true)
|
|
60072
|
+
return;
|
|
60073
|
+
let delivered = false;
|
|
60074
|
+
try {
|
|
60075
|
+
delivered = this.#options.wrapup(childId, early ? wrapupMessageEarly() : wrapupMessage(caps.cap, caps.grace), rememberedLabel);
|
|
60076
|
+
} catch {
|
|
60077
|
+
delivered = false;
|
|
60078
|
+
}
|
|
60079
|
+
const latch = (ok) => {
|
|
60080
|
+
if (this.#disposed || this.#injected.has(childId) || this.#hardStopped.has(childId))
|
|
60081
|
+
return;
|
|
60082
|
+
if (!ok)
|
|
60083
|
+
return;
|
|
60084
|
+
this.#injected.add(childId);
|
|
60085
|
+
if (rememberedLabel !== undefined)
|
|
60086
|
+
this.#injectedLabel.set(childId, rememberedLabel);
|
|
60087
|
+
this.#injectedRound.set(childId, count);
|
|
60088
|
+
this.#injectedAt.set(childId, Date.now());
|
|
60089
|
+
try {
|
|
60090
|
+
this.#options.onWrapUp?.(childId, count);
|
|
60091
|
+
} catch {}
|
|
60092
|
+
};
|
|
60093
|
+
if (delivered instanceof Promise) {
|
|
60094
|
+
delivered.then(latch, () => {});
|
|
60095
|
+
return;
|
|
60096
|
+
}
|
|
60097
|
+
latch(delivered);
|
|
60098
|
+
});
|
|
60099
|
+
return;
|
|
60100
|
+
}
|
|
60101
|
+
this.#hardStopped.add(childId);
|
|
60102
|
+
const reportStop = (stopped) => {
|
|
60103
|
+
if (!stopped)
|
|
60104
|
+
return;
|
|
60105
|
+
try {
|
|
60106
|
+
this.#options.onHardStop?.({ childId, round: count, cap: caps.cap, grace: caps.grace });
|
|
60107
|
+
} catch {}
|
|
60108
|
+
try {
|
|
60109
|
+
this.#options.onForceStop?.(childId, count);
|
|
60110
|
+
} catch {}
|
|
60111
|
+
};
|
|
60112
|
+
let stopped = false;
|
|
60113
|
+
try {
|
|
60114
|
+
stopped = this.#options.forceStop(childId);
|
|
60115
|
+
} catch {
|
|
60116
|
+
stopped = false;
|
|
60117
|
+
}
|
|
60118
|
+
if (stopped instanceof Promise) {
|
|
60119
|
+
stopped.then(reportStop, () => {});
|
|
60120
|
+
} else {
|
|
60121
|
+
reportStop(stopped);
|
|
60122
|
+
}
|
|
60123
|
+
}
|
|
60124
|
+
#resolveCaps(childId, label) {
|
|
60125
|
+
const cached = this.#resolvedCaps.get(childId);
|
|
60126
|
+
if (cached !== undefined)
|
|
60127
|
+
return cached;
|
|
60128
|
+
const limits = this.#options.limits();
|
|
60129
|
+
const globalCap = limits.maxRounds;
|
|
60130
|
+
if (globalCap <= 0)
|
|
60131
|
+
return;
|
|
60132
|
+
let cap = globalCap;
|
|
60133
|
+
if (label !== undefined && this.#options.resolveAgentCap !== undefined) {
|
|
60134
|
+
try {
|
|
60135
|
+
const perAgent = this.#options.resolveAgentCap(label);
|
|
60136
|
+
if (perAgent !== undefined && perAgent > 0)
|
|
60137
|
+
cap = perAgent;
|
|
60138
|
+
} catch {}
|
|
60139
|
+
}
|
|
60140
|
+
const caps = { cap, grace: limits.maxRoundsGrace };
|
|
60141
|
+
this.#resolvedCaps.set(childId, caps);
|
|
60142
|
+
return caps;
|
|
60143
|
+
}
|
|
60144
|
+
forgetChild(childId) {
|
|
60145
|
+
this.#injected.delete(childId);
|
|
60146
|
+
this.#hardStopped.delete(childId);
|
|
60147
|
+
this.#resolvedCaps.delete(childId);
|
|
60148
|
+
this.#injectedLabel.delete(childId);
|
|
60149
|
+
this.#injectedRound.delete(childId);
|
|
60150
|
+
this.#injectedAt.delete(childId);
|
|
60151
|
+
this.#spinState.delete(childId);
|
|
60152
|
+
}
|
|
60153
|
+
dispose() {
|
|
60154
|
+
this.#disposed = true;
|
|
60155
|
+
this.#injected.clear();
|
|
60156
|
+
this.#hardStopped.clear();
|
|
60157
|
+
this.#resolvedCaps.clear();
|
|
60158
|
+
this.#injectedLabel.clear();
|
|
60159
|
+
this.#injectedRound.clear();
|
|
60160
|
+
this.#injectedAt.clear();
|
|
60161
|
+
this.#spinState.clear();
|
|
60162
|
+
}
|
|
60163
|
+
}
|
|
60164
|
+
var DEFAULT_MAX_ROUNDS2 = 50, DEFAULT_SUBAGENT_ROUND_LIMITS, SPIN_HIGH_SEGMENT_AT = 0.75, SPIN_STRIKE_STALE_MS = 90000, EARLY_STOP_SPIN_STREAK = 2;
|
|
60165
|
+
var init_subagent_policy = __esm(() => {
|
|
60166
|
+
DEFAULT_SUBAGENT_ROUND_LIMITS = { maxRounds: DEFAULT_MAX_ROUNDS2, maxRoundsGrace: 0 };
|
|
60167
|
+
});
|
|
60168
|
+
|
|
59295
60169
|
// src/client/bridge-session-seam.ts
|
|
59296
60170
|
import { existsSync as existsSync8, readFileSync as readFileSync9, readdirSync as readdirSync4 } from "fs";
|
|
59297
60171
|
import { join as join10 } from "path";
|
|
@@ -59428,6 +60302,177 @@ function accountClientMeta() {
|
|
|
59428
60302
|
timezoneOffsetSeconds: -new Date().getTimezoneOffset() * 60
|
|
59429
60303
|
};
|
|
59430
60304
|
}
|
|
60305
|
+
function projectBridgePrunePlan(value) {
|
|
60306
|
+
const record = asRecord12(value);
|
|
60307
|
+
if (!Array.isArray(record.entries)) {
|
|
60308
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no entries array");
|
|
60309
|
+
}
|
|
60310
|
+
const entries = [];
|
|
60311
|
+
for (const raw of record.entries) {
|
|
60312
|
+
const row = asRecord12(raw);
|
|
60313
|
+
if (typeof row.sessionId !== "string" || row.decision !== "prune" && row.decision !== "skip")
|
|
60314
|
+
continue;
|
|
60315
|
+
const entry = { sessionId: row.sessionId, decision: row.decision };
|
|
60316
|
+
if (typeof row.reason === "string")
|
|
60317
|
+
entry.reason = row.reason;
|
|
60318
|
+
if (typeof row.location === "string")
|
|
60319
|
+
entry.location = row.location;
|
|
60320
|
+
if (typeof row.ageDays === "number" && Number.isFinite(row.ageDays))
|
|
60321
|
+
entry.ageDays = row.ageDays;
|
|
60322
|
+
entries.push(entry);
|
|
60323
|
+
}
|
|
60324
|
+
if (typeof record.generatedAt !== "number" || !Number.isFinite(record.generatedAt)) {
|
|
60325
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid generatedAt");
|
|
60326
|
+
}
|
|
60327
|
+
if (typeof record.retentionDays !== "number" || !Number.isFinite(record.retentionDays)) {
|
|
60328
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid retentionDays");
|
|
60329
|
+
}
|
|
60330
|
+
const countsRaw = record.counts;
|
|
60331
|
+
if (countsRaw === null || typeof countsRaw !== "object" || Array.isArray(countsRaw) || typeof countsRaw.prune !== "number" || typeof countsRaw.skip !== "number" || countsRaw.byReason === null || typeof countsRaw.byReason !== "object" || Array.isArray(countsRaw.byReason)) {
|
|
60332
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.plan returned no valid counts");
|
|
60333
|
+
}
|
|
60334
|
+
const byReason = {};
|
|
60335
|
+
let prune = 0;
|
|
60336
|
+
let skip = 0;
|
|
60337
|
+
for (const entry of entries) {
|
|
60338
|
+
if (entry.decision === "prune") {
|
|
60339
|
+
prune += 1;
|
|
60340
|
+
} else {
|
|
60341
|
+
skip += 1;
|
|
60342
|
+
const reason = entry.reason ?? "unknown";
|
|
60343
|
+
byReason[reason] = (byReason[reason] ?? 0) + 1;
|
|
60344
|
+
}
|
|
60345
|
+
}
|
|
60346
|
+
return {
|
|
60347
|
+
generatedAt: record.generatedAt,
|
|
60348
|
+
retentionDays: record.retentionDays,
|
|
60349
|
+
entries,
|
|
60350
|
+
counts: { prune, skip, byReason },
|
|
60351
|
+
...typeof record.fingerprint === "string" ? { fingerprint: record.fingerprint } : {},
|
|
60352
|
+
...typeof record.configFingerprint === "string" ? { configFingerprint: record.configFingerprint } : {}
|
|
60353
|
+
};
|
|
60354
|
+
}
|
|
60355
|
+
function projectBridgePruneApply(value) {
|
|
60356
|
+
const record = asRecord12(value);
|
|
60357
|
+
if (typeof record.opId !== "string" || record.opId === "") {
|
|
60358
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.apply returned no valid opId");
|
|
60359
|
+
}
|
|
60360
|
+
if (!Array.isArray(record.applied) || !Array.isArray(record.failed)) {
|
|
60361
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.apply returned no applied/failed arrays");
|
|
60362
|
+
}
|
|
60363
|
+
const applied = [];
|
|
60364
|
+
for (const raw of record.applied) {
|
|
60365
|
+
const row = asRecord12(raw);
|
|
60366
|
+
if (typeof row.id === "string" && row.id !== "")
|
|
60367
|
+
applied.push({ id: row.id });
|
|
60368
|
+
}
|
|
60369
|
+
const failed = [];
|
|
60370
|
+
for (const raw of record.failed) {
|
|
60371
|
+
const row = asRecord12(raw);
|
|
60372
|
+
if (typeof row.id !== "string" || typeof row.code !== "string" || typeof row.message !== "string")
|
|
60373
|
+
continue;
|
|
60374
|
+
failed.push({ id: row.id, code: row.code, message: row.message.slice(0, 300) });
|
|
60375
|
+
}
|
|
60376
|
+
return {
|
|
60377
|
+
opId: record.opId,
|
|
60378
|
+
applied,
|
|
60379
|
+
failed,
|
|
60380
|
+
markedOrphans: Array.isArray(record.markedOrphans) ? record.markedOrphans.length : 0
|
|
60381
|
+
};
|
|
60382
|
+
}
|
|
60383
|
+
function projectBridgePurgePrepare(value) {
|
|
60384
|
+
const record = asRecord12(value);
|
|
60385
|
+
if (typeof record.opId !== "string" || typeof record.token !== "string" || record.token === "") {
|
|
60386
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.purge prepare returned no opId/token");
|
|
60387
|
+
}
|
|
60388
|
+
if (!Array.isArray(record.candidates) || !Array.isArray(record.rejected)) {
|
|
60389
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.purge prepare returned no candidates/rejected arrays");
|
|
60390
|
+
}
|
|
60391
|
+
const candidates = [];
|
|
60392
|
+
for (const raw of record.candidates) {
|
|
60393
|
+
const row = asRecord12(raw);
|
|
60394
|
+
if (typeof row.id !== "string" || row.id === "")
|
|
60395
|
+
continue;
|
|
60396
|
+
if (typeof row.ageDays !== "number" || !Number.isFinite(row.ageDays))
|
|
60397
|
+
continue;
|
|
60398
|
+
if (typeof row.appliedAt !== "number" || !Number.isFinite(row.appliedAt))
|
|
60399
|
+
continue;
|
|
60400
|
+
candidates.push({ id: row.id, ageDays: row.ageDays, appliedAt: row.appliedAt });
|
|
60401
|
+
}
|
|
60402
|
+
const rejected = [];
|
|
60403
|
+
for (const raw of record.rejected) {
|
|
60404
|
+
const row = asRecord12(raw);
|
|
60405
|
+
if (typeof row.code !== "string" || typeof row.message !== "string")
|
|
60406
|
+
continue;
|
|
60407
|
+
rejected.push({
|
|
60408
|
+
...typeof row.id === "string" ? { id: row.id } : {},
|
|
60409
|
+
code: row.code,
|
|
60410
|
+
message: row.message.slice(0, 300)
|
|
60411
|
+
});
|
|
60412
|
+
}
|
|
60413
|
+
return { opId: record.opId, token: record.token, candidates, rejected };
|
|
60414
|
+
}
|
|
60415
|
+
function projectBridgePurgeCommit(value) {
|
|
60416
|
+
const record = asRecord12(value);
|
|
60417
|
+
if (typeof record.opId !== "string" || record.opId === "") {
|
|
60418
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.purge commit returned no valid opId");
|
|
60419
|
+
}
|
|
60420
|
+
if (!Array.isArray(record.purged) || !Array.isArray(record.failed)) {
|
|
60421
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.purge commit returned no purged/failed arrays");
|
|
60422
|
+
}
|
|
60423
|
+
const purged = [];
|
|
60424
|
+
for (const raw of record.purged) {
|
|
60425
|
+
const row = asRecord12(raw);
|
|
60426
|
+
if (typeof row.id === "string" && row.id !== "")
|
|
60427
|
+
purged.push({ id: row.id });
|
|
60428
|
+
}
|
|
60429
|
+
const failed = [];
|
|
60430
|
+
for (const raw of record.failed) {
|
|
60431
|
+
const row = asRecord12(raw);
|
|
60432
|
+
if (typeof row.code !== "string" || typeof row.message !== "string")
|
|
60433
|
+
continue;
|
|
60434
|
+
failed.push({
|
|
60435
|
+
...typeof row.id === "string" ? { id: row.id } : {},
|
|
60436
|
+
code: row.code,
|
|
60437
|
+
message: row.message.slice(0, 300)
|
|
60438
|
+
});
|
|
60439
|
+
}
|
|
60440
|
+
return { opId: record.opId, purged, failed };
|
|
60441
|
+
}
|
|
60442
|
+
function projectBridgePruneRestoreList(value) {
|
|
60443
|
+
const record = asRecord12(value);
|
|
60444
|
+
if (!Array.isArray(record.entries) || !Array.isArray(record.rejected)) {
|
|
60445
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.restore list returned no entries/rejected arrays");
|
|
60446
|
+
}
|
|
60447
|
+
const entries = [];
|
|
60448
|
+
for (const raw of record.entries) {
|
|
60449
|
+
const row = asRecord12(raw);
|
|
60450
|
+
if (typeof row.id !== "string" || row.id === "")
|
|
60451
|
+
continue;
|
|
60452
|
+
if (typeof row.movedAt !== "number" || !Number.isFinite(row.movedAt))
|
|
60453
|
+
continue;
|
|
60454
|
+
entries.push({
|
|
60455
|
+
id: row.id,
|
|
60456
|
+
movedAt: row.movedAt,
|
|
60457
|
+
...typeof row.size === "number" && Number.isFinite(row.size) && row.size > 0 ? { size: row.size } : {}
|
|
60458
|
+
});
|
|
60459
|
+
}
|
|
60460
|
+
const rejected = [];
|
|
60461
|
+
for (const raw of record.rejected) {
|
|
60462
|
+
const row = asRecord12(raw);
|
|
60463
|
+
if (typeof row.code !== "string" || typeof row.message !== "string")
|
|
60464
|
+
continue;
|
|
60465
|
+
rejected.push({ code: row.code, message: row.message.slice(0, 300) });
|
|
60466
|
+
}
|
|
60467
|
+
return { entries, rejected };
|
|
60468
|
+
}
|
|
60469
|
+
function projectBridgePruneRestore(value) {
|
|
60470
|
+
const record = asRecord12(value);
|
|
60471
|
+
if (typeof record.id !== "string" || record.id === "" || record.restored !== true || typeof record.opId !== "string" || record.opId === "") {
|
|
60472
|
+
throw new BridgeProtocolError("INTERNAL", "session.prune.restore returned no valid id/restored/opId");
|
|
60473
|
+
}
|
|
60474
|
+
return { id: record.id, restored: true, opId: record.opId };
|
|
60475
|
+
}
|
|
59431
60476
|
function unsupported(capability) {
|
|
59432
60477
|
throw new BridgeProtocolError("UNSUPPORTED", `${capability} is not backed by the in-process bridge`, { capability });
|
|
59433
60478
|
}
|
|
@@ -59550,7 +60595,7 @@ function foldModelRouteCache(cache, rows) {
|
|
|
59550
60595
|
function liveModelRoute(fold) {
|
|
59551
60596
|
return fold.pending ?? fold.lastUsed;
|
|
59552
60597
|
}
|
|
59553
|
-
function bridgeReplayRowsToSeamTranscript(rows, skip = 0) {
|
|
60598
|
+
function bridgeReplayRowsToSeamTranscript(rows, skip = 0, sessionId) {
|
|
59554
60599
|
const entries = rows.map((row) => ({
|
|
59555
60600
|
type: row.type,
|
|
59556
60601
|
seq: row.seq,
|
|
@@ -59558,7 +60603,7 @@ function bridgeReplayRowsToSeamTranscript(rows, skip = 0) {
|
|
|
59558
60603
|
data: asRecord12(row.payload)
|
|
59559
60604
|
}));
|
|
59560
60605
|
const durable = journalToTranscriptRows(entries, skip);
|
|
59561
|
-
|
|
60606
|
+
const stored = durable.map((row) => {
|
|
59562
60607
|
if (row.kind === "ask") {
|
|
59563
60608
|
return { kind: "ask", text: "", final: true, entries: row.entries };
|
|
59564
60609
|
}
|
|
@@ -59567,11 +60612,177 @@ function bridgeReplayRowsToSeamTranscript(rows, skip = 0) {
|
|
|
59567
60612
|
}
|
|
59568
60613
|
return { kind: row.kind, text: row.text, final: true };
|
|
59569
60614
|
});
|
|
60615
|
+
if (sessionId === undefined || sessionId === "" || sessionId === "unknown")
|
|
60616
|
+
return stored;
|
|
60617
|
+
const notices = deriveAskOutcomeNoticeViews(rows, sessionId);
|
|
60618
|
+
if (notices.length === 0)
|
|
60619
|
+
return stored;
|
|
60620
|
+
const prefixCounts = new Map;
|
|
60621
|
+
const byInsert = new Map;
|
|
60622
|
+
for (const notice of notices) {
|
|
60623
|
+
let count = prefixCounts.get(notice.anchorSeq);
|
|
60624
|
+
if (count === undefined) {
|
|
60625
|
+
count = journalToTranscriptRows(entries.filter((e) => e.seq <= notice.anchorSeq), 0).length;
|
|
60626
|
+
prefixCounts.set(notice.anchorSeq, count);
|
|
60627
|
+
}
|
|
60628
|
+
const insertAt = Math.max(0, Math.min(stored.length, count - skip));
|
|
60629
|
+
const bucket = byInsert.get(insertAt);
|
|
60630
|
+
if (bucket === undefined)
|
|
60631
|
+
byInsert.set(insertAt, [notice]);
|
|
60632
|
+
else
|
|
60633
|
+
bucket.push(notice);
|
|
60634
|
+
}
|
|
60635
|
+
const merged = [];
|
|
60636
|
+
for (let i = 0;i <= stored.length; i++) {
|
|
60637
|
+
for (const notice of byInsert.get(i) ?? []) {
|
|
60638
|
+
merged.push({ kind: "notice", id: notice.id, text: notice.text, final: true });
|
|
60639
|
+
}
|
|
60640
|
+
if (i < stored.length)
|
|
60641
|
+
merged.push(stored[i]);
|
|
60642
|
+
}
|
|
60643
|
+
return merged;
|
|
59570
60644
|
}
|
|
59571
60645
|
function seamReplayEventKey(event) {
|
|
59572
60646
|
const details = asRecord12(event.details);
|
|
59573
60647
|
return `${event.type}:${String(details.id ?? details.messageID ?? "")}:${String(asRecord12(details.part).id ?? "")}`;
|
|
59574
60648
|
}
|
|
60649
|
+
function askJournalKind(row, data) {
|
|
60650
|
+
if (typeof data.kind === "string" && data.kind !== "")
|
|
60651
|
+
return data.kind;
|
|
60652
|
+
const prefix = "plugin:opentui/ask/";
|
|
60653
|
+
if (row.type.startsWith(prefix))
|
|
60654
|
+
return `ask.${row.type.slice(prefix.length)}`;
|
|
60655
|
+
return;
|
|
60656
|
+
}
|
|
60657
|
+
function deriveAskOutcomeNoticeViews(rows, sessionId) {
|
|
60658
|
+
const out = [];
|
|
60659
|
+
const terminals = new Map;
|
|
60660
|
+
for (const row of rows) {
|
|
60661
|
+
const data = asRecord12(row.payload);
|
|
60662
|
+
const kind = askJournalKind(row, data);
|
|
60663
|
+
if (kind !== "ask.responded" && kind !== "ask.cancelled")
|
|
60664
|
+
continue;
|
|
60665
|
+
const eventId = optionalStringField(data, "eventId");
|
|
60666
|
+
if (eventId === undefined || optionalStringField(data, "sessionId") !== sessionId)
|
|
60667
|
+
continue;
|
|
60668
|
+
const group = terminals.get(eventId);
|
|
60669
|
+
if (group === undefined)
|
|
60670
|
+
terminals.set(eventId, [row]);
|
|
60671
|
+
else
|
|
60672
|
+
group.push(row);
|
|
60673
|
+
}
|
|
60674
|
+
for (const [eventId, group] of terminals) {
|
|
60675
|
+
const ordered = [...group].sort((a, b) => a.seq - b.seq);
|
|
60676
|
+
const canonical = ordered[ordered.length - 1];
|
|
60677
|
+
const noticeOf = (row) => {
|
|
60678
|
+
const data = asRecord12(row.payload);
|
|
60679
|
+
return deriveAskOutcomeNotice({
|
|
60680
|
+
eventId,
|
|
60681
|
+
sessionId,
|
|
60682
|
+
anchorSeq: row.seq,
|
|
60683
|
+
settleReason: optionalStringField(data, "settleReason"),
|
|
60684
|
+
journalKind: askJournalKind(row, data),
|
|
60685
|
+
askKind: optionalStringField(data, "askKind"),
|
|
60686
|
+
outcome: optionalStringField(data, "outcome"),
|
|
60687
|
+
source: optionalStringField(data, "source"),
|
|
60688
|
+
cancelReason: optionalStringField(data, "reason"),
|
|
60689
|
+
childSessionId: optionalStringField(data, "childSessionId")
|
|
60690
|
+
});
|
|
60691
|
+
};
|
|
60692
|
+
const canonicalNotice = noticeOf(canonical);
|
|
60693
|
+
if (canonicalNotice === undefined)
|
|
60694
|
+
continue;
|
|
60695
|
+
const canonicalChild = optionalStringField(asRecord12(canonical.payload), "childSessionId");
|
|
60696
|
+
out.push({
|
|
60697
|
+
id: canonicalNotice.id,
|
|
60698
|
+
text: canonicalNotice.text,
|
|
60699
|
+
anchorSeq: canonicalNotice.anchorSeq,
|
|
60700
|
+
sessionId,
|
|
60701
|
+
...canonicalChild !== undefined ? { childSessionId: canonicalChild } : {}
|
|
60702
|
+
});
|
|
60703
|
+
const seenText = new Set([canonicalNotice.text]);
|
|
60704
|
+
for (const row of ordered) {
|
|
60705
|
+
if (row === canonical)
|
|
60706
|
+
continue;
|
|
60707
|
+
const other = noticeOf(row);
|
|
60708
|
+
if (other === undefined || seenText.has(other.text))
|
|
60709
|
+
continue;
|
|
60710
|
+
seenText.add(other.text);
|
|
60711
|
+
const childSessionId = optionalStringField(asRecord12(row.payload), "childSessionId");
|
|
60712
|
+
out.push({
|
|
60713
|
+
id: `${other.id}:seq-${row.seq}`,
|
|
60714
|
+
text: `\u3010\u65E5\u5FD7\u7ED3\u5C40\u51B2\u7A81\u3011${other.text}`,
|
|
60715
|
+
anchorSeq: other.anchorSeq,
|
|
60716
|
+
sessionId,
|
|
60717
|
+
...childSessionId !== undefined ? { childSessionId } : {}
|
|
60718
|
+
});
|
|
60719
|
+
}
|
|
60720
|
+
}
|
|
60721
|
+
const terminalIds = new Set(terminals.keys());
|
|
60722
|
+
const turnEnds = new Map;
|
|
60723
|
+
for (const row of rows) {
|
|
60724
|
+
if (row.type !== "turn/end")
|
|
60725
|
+
continue;
|
|
60726
|
+
const data = asRecord12(row.payload);
|
|
60727
|
+
const keys = [optionalStringField(data, "turnId")];
|
|
60728
|
+
if (typeof data.turn === "number" && Number.isFinite(data.turn))
|
|
60729
|
+
keys.push(String(data.turn));
|
|
60730
|
+
for (const key of keys) {
|
|
60731
|
+
if (key === undefined)
|
|
60732
|
+
continue;
|
|
60733
|
+
const prior = turnEnds.get(key);
|
|
60734
|
+
if (prior === undefined || row.seq > prior.seq)
|
|
60735
|
+
turnEnds.set(key, row);
|
|
60736
|
+
}
|
|
60737
|
+
}
|
|
60738
|
+
for (const row of rows) {
|
|
60739
|
+
const data = asRecord12(row.payload);
|
|
60740
|
+
if (askJournalKind(row, data) !== "ask.requested")
|
|
60741
|
+
continue;
|
|
60742
|
+
const eventId = optionalStringField(data, "eventId");
|
|
60743
|
+
if (eventId === undefined || terminalIds.has(eventId))
|
|
60744
|
+
continue;
|
|
60745
|
+
if (optionalStringField(data, "sessionId") !== sessionId)
|
|
60746
|
+
continue;
|
|
60747
|
+
const turnKey = optionalStringField(data, "turnId") ?? askTurnId(eventId);
|
|
60748
|
+
if (turnKey === undefined || turnKey === "")
|
|
60749
|
+
continue;
|
|
60750
|
+
const turnEnd = turnEnds.get(turnKey);
|
|
60751
|
+
if (turnEnd === undefined)
|
|
60752
|
+
continue;
|
|
60753
|
+
const notice = deriveAskOutcomeNotice({
|
|
60754
|
+
eventId,
|
|
60755
|
+
sessionId,
|
|
60756
|
+
anchorSeq: turnEnd.seq,
|
|
60757
|
+
orphan: true,
|
|
60758
|
+
askKind: optionalStringField(data, "askKind"),
|
|
60759
|
+
childSessionId: optionalStringField(data, "childSessionId")
|
|
60760
|
+
});
|
|
60761
|
+
if (notice !== undefined) {
|
|
60762
|
+
const childSessionId = optionalStringField(data, "childSessionId");
|
|
60763
|
+
out.push({
|
|
60764
|
+
id: notice.id,
|
|
60765
|
+
text: notice.text,
|
|
60766
|
+
anchorSeq: notice.anchorSeq,
|
|
60767
|
+
sessionId,
|
|
60768
|
+
...childSessionId !== undefined ? { childSessionId } : {}
|
|
60769
|
+
});
|
|
60770
|
+
}
|
|
60771
|
+
}
|
|
60772
|
+
return out;
|
|
60773
|
+
}
|
|
60774
|
+
function askOutcomeEvent(view) {
|
|
60775
|
+
return {
|
|
60776
|
+
type: "message.updated",
|
|
60777
|
+
details: {
|
|
60778
|
+
id: view.id,
|
|
60779
|
+
role: "notice",
|
|
60780
|
+
text: view.text,
|
|
60781
|
+
sessionID: view.sessionId,
|
|
60782
|
+
...view.childSessionId !== undefined ? { childSessionId: view.childSessionId } : {}
|
|
60783
|
+
}
|
|
60784
|
+
};
|
|
60785
|
+
}
|
|
59575
60786
|
function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
59576
60787
|
const events = [];
|
|
59577
60788
|
const seen = new Set;
|
|
@@ -59582,6 +60793,14 @@ function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
|
59582
60793
|
seen.add(key);
|
|
59583
60794
|
events.push(event);
|
|
59584
60795
|
};
|
|
60796
|
+
const noticeViews = [...deriveAskOutcomeNoticeViews(rows, sessionId)].sort((a, b) => a.anchorSeq - b.anchorSeq);
|
|
60797
|
+
let nextNotice = 0;
|
|
60798
|
+
const flushNoticesThrough = (seq) => {
|
|
60799
|
+
while (nextNotice < noticeViews.length && noticeViews[nextNotice].anchorSeq <= seq) {
|
|
60800
|
+
push(askOutcomeEvent(noticeViews[nextNotice]));
|
|
60801
|
+
nextNotice++;
|
|
60802
|
+
}
|
|
60803
|
+
};
|
|
59585
60804
|
const toolCalls = new Map;
|
|
59586
60805
|
for (const row of rows) {
|
|
59587
60806
|
const entry = { type: row.type, seq: row.seq, time: 0, data: asRecord12(row.payload) };
|
|
@@ -59622,7 +60841,9 @@ function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
|
59622
60841
|
});
|
|
59623
60842
|
}
|
|
59624
60843
|
}
|
|
60844
|
+
flushNoticesThrough(row.seq);
|
|
59625
60845
|
}
|
|
60846
|
+
flushNoticesThrough(Number.POSITIVE_INFINITY);
|
|
59626
60847
|
return events;
|
|
59627
60848
|
}
|
|
59628
60849
|
function bridgeAgentRunKey(runId, seq) {
|
|
@@ -59843,7 +61064,7 @@ function bridgeChildJournalMeta(rows) {
|
|
|
59843
61064
|
};
|
|
59844
61065
|
}
|
|
59845
61066
|
function bridgeReplayRowsToChildLog(rows) {
|
|
59846
|
-
return bridgeReplayRowsToSeamTranscript(rows).map((row) => {
|
|
61067
|
+
return bridgeReplayRowsToSeamTranscript(rows).filter((row) => row.kind !== "notice").map((row) => {
|
|
59847
61068
|
if (row.kind === "tool") {
|
|
59848
61069
|
return row.output ? `\u25B6 ${row.text}
|
|
59849
61070
|
\u23BF ${row.output}` : `\u25B6 ${row.text}`;
|
|
@@ -59853,6 +61074,52 @@ function bridgeReplayRowsToChildLog(rows) {
|
|
|
59853
61074
|
return row.text;
|
|
59854
61075
|
}).filter((line) => line !== "");
|
|
59855
61076
|
}
|
|
61077
|
+
function childTranscriptBytes(line) {
|
|
61078
|
+
return childTextEncoder.encode(line).length;
|
|
61079
|
+
}
|
|
61080
|
+
function childTranscriptTruncate(line) {
|
|
61081
|
+
const bytes = childTextEncoder.encode(line);
|
|
61082
|
+
if (bytes.length <= CHILD_TRANSCRIPT_LINE_BUDGET)
|
|
61083
|
+
return line;
|
|
61084
|
+
const cutBudget = CHILD_TRANSCRIPT_LINE_BUDGET - CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES;
|
|
61085
|
+
for (let end = cutBudget;end > 0; end -= 1) {
|
|
61086
|
+
try {
|
|
61087
|
+
return childStrictTextDecoder.decode(bytes.slice(0, end)) + CHILD_TRANSCRIPT_TRUNCATION_MARKER;
|
|
61088
|
+
} catch {}
|
|
61089
|
+
}
|
|
61090
|
+
return CHILD_TRANSCRIPT_TRUNCATION_MARKER;
|
|
61091
|
+
}
|
|
61092
|
+
function capChildLog(lines) {
|
|
61093
|
+
const out = lines.map((line) => childTranscriptTruncate(line));
|
|
61094
|
+
let bytes = out.reduce((total, line) => total + childTranscriptBytes(line) + 1, 0);
|
|
61095
|
+
while (out.length > CHILD_TRANSCRIPT_MAX_LINES || out.length > 0 && bytes > CHILD_TRANSCRIPT_MAX_BYTES) {
|
|
61096
|
+
const dropped = out.shift();
|
|
61097
|
+
bytes -= childTranscriptBytes(dropped) + 1;
|
|
61098
|
+
}
|
|
61099
|
+
return out;
|
|
61100
|
+
}
|
|
61101
|
+
function childTranscriptRowToLine(row) {
|
|
61102
|
+
const r = asRecord12(row);
|
|
61103
|
+
if (r.kind !== "assistant" && r.kind !== "tool")
|
|
61104
|
+
return "";
|
|
61105
|
+
const text = typeof r.text === "string" ? r.text : "";
|
|
61106
|
+
const output = typeof r.output === "string" ? r.output : "";
|
|
61107
|
+
if (r.kind === "tool")
|
|
61108
|
+
return output !== "" ? `\u25B6 ${text}
|
|
61109
|
+
\u23BF ${output}` : `\u25B6 ${text}`;
|
|
61110
|
+
return text;
|
|
61111
|
+
}
|
|
61112
|
+
function splitChildLogLines(lines) {
|
|
61113
|
+
const out = [];
|
|
61114
|
+
for (const line of lines) {
|
|
61115
|
+
for (const part of line.split(`
|
|
61116
|
+
`)) {
|
|
61117
|
+
if (part !== "")
|
|
61118
|
+
out.push(part);
|
|
61119
|
+
}
|
|
61120
|
+
}
|
|
61121
|
+
return out;
|
|
61122
|
+
}
|
|
59856
61123
|
function bridgeChildStopReason(rows) {
|
|
59857
61124
|
for (let i = rows.length - 1;i >= 0; i -= 1) {
|
|
59858
61125
|
const row = rows[i];
|
|
@@ -60362,10 +61629,14 @@ class BridgeSessionSeam {
|
|
|
60362
61629
|
#subagentLiveStarts = new Set;
|
|
60363
61630
|
#subagentListeners = new Set;
|
|
60364
61631
|
#subagentProgress = new Map;
|
|
61632
|
+
#roundPolicy;
|
|
60365
61633
|
#subagentSessionId;
|
|
60366
61634
|
#subagentJournalLoaded = new Set;
|
|
60367
61635
|
#subagentJournalMeta = new Map;
|
|
60368
61636
|
#subagentTranscripts = new Map;
|
|
61637
|
+
#subagentTranscriptRuns = new Map;
|
|
61638
|
+
#subagentTranscriptSettled = new Set;
|
|
61639
|
+
#subagentTranscriptReadFailed = new Set;
|
|
60369
61640
|
#sweepSettledRuns = new Map;
|
|
60370
61641
|
#subagentSettleSnapshots = new Map;
|
|
60371
61642
|
#interruptInFlight = new Map;
|
|
@@ -60412,6 +61683,7 @@ class BridgeSessionSeam {
|
|
|
60412
61683
|
#deadInFlight;
|
|
60413
61684
|
#inFlightPartial = "";
|
|
60414
61685
|
#invalidatedAsks = new Map;
|
|
61686
|
+
#emittedAskOutcomes = new Set;
|
|
60415
61687
|
#disposed = false;
|
|
60416
61688
|
constructor(options) {
|
|
60417
61689
|
this.#transport = options.transport;
|
|
@@ -60609,7 +61881,7 @@ class BridgeSessionSeam {
|
|
|
60609
61881
|
this.#foldAgentReplayRows(drained.rows, boundId);
|
|
60610
61882
|
this.#foldModelRouteFromDrain(boundId, drained.rows, from);
|
|
60611
61883
|
await this.#sweepSubagents(boundId);
|
|
60612
|
-
const rows = bridgeReplayRowsToSeamTranscript(drained.rows);
|
|
61884
|
+
const rows = bridgeReplayRowsToSeamTranscript(drained.rows, 0, boundId);
|
|
60613
61885
|
if (drained.rows.length > 0) {
|
|
60614
61886
|
const maxSeq = drained.rows.reduce((m, row) => Math.max(m, row.seq), -Infinity);
|
|
60615
61887
|
this.#lastAppliedSeq = Math.max(this.#lastAppliedSeq ?? 0, maxSeq);
|
|
@@ -61002,6 +62274,17 @@ class BridgeSessionSeam {
|
|
|
61002
62274
|
subagentTranscript(id) {
|
|
61003
62275
|
return [...this.#subagentTranscripts.get(id) ?? []];
|
|
61004
62276
|
}
|
|
62277
|
+
subagentTranscriptStatus(id) {
|
|
62278
|
+
const lines = this.#subagentTranscripts.get(id);
|
|
62279
|
+
if (lines !== undefined && lines.length > 0)
|
|
62280
|
+
return "ready";
|
|
62281
|
+
if (this.#subagentTranscriptReadFailed.has(id))
|
|
62282
|
+
return "read-failed";
|
|
62283
|
+
const view = this.#subagentViews.get(id);
|
|
62284
|
+
if (view === undefined || view.status !== "running")
|
|
62285
|
+
return "not-running";
|
|
62286
|
+
return "pending";
|
|
62287
|
+
}
|
|
61005
62288
|
steerChild(id, text) {
|
|
61006
62289
|
const view = this.#subagentViews.get(id);
|
|
61007
62290
|
if (view === undefined || view.status !== "running")
|
|
@@ -61124,6 +62407,7 @@ class BridgeSessionSeam {
|
|
|
61124
62407
|
const view = this.#subagentViews.get(childId);
|
|
61125
62408
|
if (view === undefined || view.status === "running")
|
|
61126
62409
|
continue;
|
|
62410
|
+
this.#roundPolicy?.forgetChild(childId);
|
|
61127
62411
|
if (view.elapsedSec === undefined || view.endedAt === undefined)
|
|
61128
62412
|
continue;
|
|
61129
62413
|
const runKey = `${childId}@${startedAt ?? ""}`;
|
|
@@ -61204,13 +62488,17 @@ class BridgeSessionSeam {
|
|
|
61204
62488
|
try {
|
|
61205
62489
|
const value = asRecord12(await this.#transport.request("journal.replay", { sessionId: childId }));
|
|
61206
62490
|
const rows = value.rows;
|
|
61207
|
-
if (!Array.isArray(rows))
|
|
62491
|
+
if (!Array.isArray(rows)) {
|
|
62492
|
+
this.#subagentTranscriptReadFailed.add(childId);
|
|
61208
62493
|
return;
|
|
62494
|
+
}
|
|
61209
62495
|
const cleanRows = rows.filter((row) => row !== null && typeof row === "object" && !Array.isArray(row));
|
|
61210
62496
|
const meta = bridgeChildJournalMeta(cleanRows);
|
|
61211
62497
|
if (this.#subagentSessionId !== sessionAtStart || this.#disposed)
|
|
61212
62498
|
return;
|
|
61213
|
-
this.#subagentTranscripts.set(childId, bridgeReplayRowsToChildLog(cleanRows));
|
|
62499
|
+
this.#subagentTranscripts.set(childId, capChildLog(splitChildLogLines(bridgeReplayRowsToChildLog(cleanRows))));
|
|
62500
|
+
this.#subagentTranscriptReadFailed.delete(childId);
|
|
62501
|
+
this.#subagentTranscriptRuns.delete(childId);
|
|
61214
62502
|
this.#subagentJournalMeta.set(key, meta);
|
|
61215
62503
|
const existing = this.#subagentViews.get(childId);
|
|
61216
62504
|
if (existing === undefined || bridgeChildJournalKey(existing) !== key)
|
|
@@ -61222,7 +62510,9 @@ class BridgeSessionSeam {
|
|
|
61222
62510
|
...meta.model !== undefined ? { model: meta.model } : {}
|
|
61223
62511
|
});
|
|
61224
62512
|
this.#emitSubagentViews();
|
|
61225
|
-
} catch {
|
|
62513
|
+
} catch {
|
|
62514
|
+
this.#subagentTranscriptReadFailed.add(childId);
|
|
62515
|
+
}
|
|
61226
62516
|
}
|
|
61227
62517
|
#syncSubagentMeta(emit = true) {
|
|
61228
62518
|
let changed = false;
|
|
@@ -61323,10 +62613,21 @@ class BridgeSessionSeam {
|
|
|
61323
62613
|
if (frame.type === "agent.spawn") {
|
|
61324
62614
|
const runId = typeof payload.runId === "string" ? payload.runId : "";
|
|
61325
62615
|
const childId = typeof payload.childId === "string" ? payload.childId : "";
|
|
62616
|
+
if (childId !== "") {
|
|
62617
|
+
this.#subagentTranscriptRuns.delete(childId);
|
|
62618
|
+
this.#subagentTranscriptSettled.delete(childId);
|
|
62619
|
+
this.#subagentTranscriptReadFailed.delete(childId);
|
|
62620
|
+
}
|
|
62621
|
+
if (this.#subagentSessionId === undefined && frameSession !== "") {
|
|
62622
|
+
this.#subagentSessionId = frameSession;
|
|
62623
|
+
}
|
|
61326
62624
|
changed = runId === `${BRIDGE_CATALOG_RUN_PREFIX}${childId}` ? this.#foldWithFrozenSettle(BRIDGE_SUBAGENT_CATALOG, payload, now, true) : this.#foldWithFrozenSettle(BRIDGE_AGENT_START, payload, now, true);
|
|
61327
62625
|
} else if (frame.type === "agent.settle") {
|
|
61328
62626
|
const childId = typeof payload.childId === "string" ? payload.childId : "";
|
|
61329
62627
|
const existing = childId !== "" ? this.#subagentViews.get(childId) : undefined;
|
|
62628
|
+
const lockedChild = childId !== "" ? childId : this.#subagentRunSeq.get(bridgeAgentRunKey(typeof payload.runId === "string" ? payload.runId : "", typeof payload.seq === "number" ? payload.seq : -1));
|
|
62629
|
+
if (lockedChild !== undefined)
|
|
62630
|
+
this.#subagentTranscriptSettled.add(lockedChild);
|
|
61330
62631
|
if (existing !== undefined && existing.status === "running") {
|
|
61331
62632
|
if (this.#subagentSessionId === undefined && frameSession !== "") {
|
|
61332
62633
|
this.#subagentSessionId = frameSession;
|
|
@@ -61340,6 +62641,41 @@ class BridgeSessionSeam {
|
|
|
61340
62641
|
this.#emitSubagentViews();
|
|
61341
62642
|
}
|
|
61342
62643
|
}
|
|
62644
|
+
#ensureRoundPolicy() {
|
|
62645
|
+
if (this.#roundPolicy === undefined) {
|
|
62646
|
+
this.#roundPolicy = new SubagentRoundPolicy({
|
|
62647
|
+
limits: () => parseSubagentRoundLimits(this.configLoad()),
|
|
62648
|
+
isSettled: (childId) => {
|
|
62649
|
+
const view = this.#subagentViews.get(childId);
|
|
62650
|
+
return view === undefined || view.status !== "running";
|
|
62651
|
+
},
|
|
62652
|
+
wrapup: (childId, message) => this.steerChild(childId, message),
|
|
62653
|
+
forceStop: (childId) => this.interruptChild(childId).then(() => true, () => false),
|
|
62654
|
+
onWrapUp: (childId, round) => this.#markRoundPolicy(childId, "injectedRound", round),
|
|
62655
|
+
onForceStop: (childId, round) => this.#markRoundPolicy(childId, "hardStopRound", round),
|
|
62656
|
+
onSpinStop: (childId, round) => this.#markRoundPolicy(childId, "spinStopRound", round)
|
|
62657
|
+
});
|
|
62658
|
+
}
|
|
62659
|
+
return this.#roundPolicy;
|
|
62660
|
+
}
|
|
62661
|
+
#resetRoundPolicy() {
|
|
62662
|
+
this.#roundPolicy?.dispose();
|
|
62663
|
+
this.#roundPolicy = undefined;
|
|
62664
|
+
}
|
|
62665
|
+
#markRoundPolicy(childId, field, round) {
|
|
62666
|
+
const view = this.#subagentViews.get(childId);
|
|
62667
|
+
if (view === undefined || view[field] !== undefined)
|
|
62668
|
+
return;
|
|
62669
|
+
const next = { ...view };
|
|
62670
|
+
if (field === "injectedRound")
|
|
62671
|
+
next.injectedRound = round;
|
|
62672
|
+
else if (field === "hardStopRound")
|
|
62673
|
+
next.hardStopRound = round;
|
|
62674
|
+
else
|
|
62675
|
+
next.spinStopRound = round;
|
|
62676
|
+
this.#subagentViews.set(childId, next);
|
|
62677
|
+
this.#emitSubagentViews();
|
|
62678
|
+
}
|
|
61343
62679
|
#foldAgentProgress(frame) {
|
|
61344
62680
|
const payload = asRecord12(frame.payload);
|
|
61345
62681
|
const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
|
|
@@ -61355,14 +62691,56 @@ class BridgeSessionSeam {
|
|
|
61355
62691
|
const lastLine = typeof payload.lastLine === "string" ? payload.lastLine : undefined;
|
|
61356
62692
|
const elapsedSec = typeof payload.elapsedSec === "number" && Number.isFinite(payload.elapsedSec) ? payload.elapsedSec : undefined;
|
|
61357
62693
|
const prev = this.#subagentProgress.get(childId);
|
|
61358
|
-
|
|
62694
|
+
const merged = {
|
|
61359
62695
|
rounds: Math.max(prev?.rounds ?? 0, rounds),
|
|
61360
62696
|
...lastLine !== undefined ? { lastLine } : prev?.lastLine !== undefined ? { lastLine: prev.lastLine } : {},
|
|
61361
62697
|
...elapsedSec !== undefined ? { elapsedSec } : prev?.elapsedSec !== undefined ? { elapsedSec: prev.elapsedSec } : {}
|
|
61362
|
-
}
|
|
62698
|
+
};
|
|
62699
|
+
this.#subagentProgress.set(childId, merged);
|
|
62700
|
+
if (merged.rounds > (prev?.rounds ?? 0)) {
|
|
62701
|
+
this.#ensureRoundPolicy().onRoundCount(childId, merged.rounds, view.label);
|
|
62702
|
+
}
|
|
61363
62703
|
this.#syncSubagentMeta(false);
|
|
61364
62704
|
this.#emitSubagentViews();
|
|
61365
62705
|
}
|
|
62706
|
+
#foldAgentTranscript(frame) {
|
|
62707
|
+
const payload = asRecord12(frame.payload);
|
|
62708
|
+
const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
|
|
62709
|
+
const childId = typeof payload.childId === "string" ? payload.childId : "";
|
|
62710
|
+
const turnId = typeof payload.turnId === "string" ? payload.turnId : "";
|
|
62711
|
+
const runId = typeof payload.runId === "string" && payload.runId !== "" ? payload.runId : turnId;
|
|
62712
|
+
const seq = typeof payload.seq === "number" && Number.isFinite(payload.seq) ? payload.seq : -1;
|
|
62713
|
+
const rows = payload.rows;
|
|
62714
|
+
if (childId === "" || turnId === "" || seq < 0 || !Array.isArray(rows))
|
|
62715
|
+
return;
|
|
62716
|
+
if (this.#subagentTranscriptSettled.has(childId))
|
|
62717
|
+
return;
|
|
62718
|
+
const view = this.#subagentViews.get(childId);
|
|
62719
|
+
if (view === undefined || view.status !== "running")
|
|
62720
|
+
return;
|
|
62721
|
+
if (this.#subagentSessionId === undefined) {
|
|
62722
|
+
if (frameSession !== "")
|
|
62723
|
+
this.#subagentSessionId = frameSession;
|
|
62724
|
+
} else if (frameSession !== "" && frameSession !== this.#subagentSessionId)
|
|
62725
|
+
return;
|
|
62726
|
+
let run = this.#subagentTranscriptRuns.get(childId);
|
|
62727
|
+
if (run === undefined || run.runId !== runId) {
|
|
62728
|
+
run = { runId, seen: new Set };
|
|
62729
|
+
this.#subagentTranscriptRuns.set(childId, run);
|
|
62730
|
+
}
|
|
62731
|
+
if (run.seen.has(seq))
|
|
62732
|
+
return;
|
|
62733
|
+
run.seen.add(seq);
|
|
62734
|
+
const lines = [...this.#subagentTranscripts.get(childId) ?? []];
|
|
62735
|
+
for (const row of rows) {
|
|
62736
|
+
const line = childTranscriptRowToLine(row);
|
|
62737
|
+
if (line !== "")
|
|
62738
|
+
lines.push(line);
|
|
62739
|
+
}
|
|
62740
|
+
this.#subagentTranscripts.set(childId, capChildLog(splitChildLogLines(lines)));
|
|
62741
|
+
this.#subagentTranscriptReadFailed.delete(childId);
|
|
62742
|
+
this.#emitSubagentViews();
|
|
62743
|
+
}
|
|
61366
62744
|
#foldAgentReplayRows(rows, sessionId) {
|
|
61367
62745
|
let rosterReset = false;
|
|
61368
62746
|
if (sessionId !== this.#subagentSessionId) {
|
|
@@ -61370,9 +62748,13 @@ class BridgeSessionSeam {
|
|
|
61370
62748
|
this.#subagentRunSeq.clear();
|
|
61371
62749
|
this.#subagentLiveStarts.clear();
|
|
61372
62750
|
this.#subagentProgress.clear();
|
|
62751
|
+
this.#resetRoundPolicy();
|
|
61373
62752
|
this.#subagentJournalLoaded.clear();
|
|
61374
62753
|
this.#subagentJournalMeta.clear();
|
|
61375
62754
|
this.#subagentTranscripts.clear();
|
|
62755
|
+
this.#subagentTranscriptRuns.clear();
|
|
62756
|
+
this.#subagentTranscriptSettled.clear();
|
|
62757
|
+
this.#subagentTranscriptReadFailed.clear();
|
|
61376
62758
|
this.#sweepSettledRuns.clear();
|
|
61377
62759
|
this.#subagentSettleSnapshots.clear();
|
|
61378
62760
|
this.#interruptInFlight.clear();
|
|
@@ -61420,6 +62802,44 @@ class BridgeSessionSeam {
|
|
|
61420
62802
|
const value = await this.#transport.request("session.list");
|
|
61421
62803
|
return projectBridgeSessionList(asRecord12(value).items, limit);
|
|
61422
62804
|
}
|
|
62805
|
+
async planPrune(params) {
|
|
62806
|
+
const staged = this.stagedSessionId();
|
|
62807
|
+
const ids = new Set(params?.stagedIds ?? []);
|
|
62808
|
+
if (staged !== undefined && staged !== "")
|
|
62809
|
+
ids.add(staged);
|
|
62810
|
+
const wireParams = ids.size > 0 ? { ...params ?? {}, stagedIds: [...ids] } : { ...params ?? {} };
|
|
62811
|
+
const value = await this.#transport.request("session.prune.plan", wireParams);
|
|
62812
|
+
return projectBridgePrunePlan(value);
|
|
62813
|
+
}
|
|
62814
|
+
async applyPrune(params) {
|
|
62815
|
+
const staged = this.stagedSessionId();
|
|
62816
|
+
const ids = new Set(params.stagedIds ?? []);
|
|
62817
|
+
if (staged !== undefined && staged !== "")
|
|
62818
|
+
ids.add(staged);
|
|
62819
|
+
const value = await this.#transport.request("session.prune.apply", {
|
|
62820
|
+
fingerprint: params.fingerprint,
|
|
62821
|
+
configFingerprint: params.configFingerprint,
|
|
62822
|
+
generatedAt: params.generatedAt,
|
|
62823
|
+
...ids.size > 0 ? { stagedIds: [...ids] } : {}
|
|
62824
|
+
});
|
|
62825
|
+
return projectBridgePruneApply(value);
|
|
62826
|
+
}
|
|
62827
|
+
async preparePurge() {
|
|
62828
|
+
const value = await this.#transport.request("session.prune.purge", { phase: "prepare" });
|
|
62829
|
+
return projectBridgePurgePrepare(value);
|
|
62830
|
+
}
|
|
62831
|
+
async commitPurge(params) {
|
|
62832
|
+
const value = await this.#transport.request("session.prune.purge", { phase: "commit", token: params.token });
|
|
62833
|
+
return projectBridgePurgeCommit(value);
|
|
62834
|
+
}
|
|
62835
|
+
async listPruneRestore() {
|
|
62836
|
+
const value = await this.#transport.request("session.prune.restore", { phase: "list" });
|
|
62837
|
+
return projectBridgePruneRestoreList(value);
|
|
62838
|
+
}
|
|
62839
|
+
async restorePrune(id) {
|
|
62840
|
+
const value = await this.#transport.request("session.prune.restore", { phase: "restore", id });
|
|
62841
|
+
return projectBridgePruneRestore(value);
|
|
62842
|
+
}
|
|
61423
62843
|
async cwd() {
|
|
61424
62844
|
const sessionId = this.currentSessionId();
|
|
61425
62845
|
if (sessionId === undefined || sessionId === "")
|
|
@@ -61432,7 +62852,7 @@ class BridgeSessionSeam {
|
|
|
61432
62852
|
const rows = Array.isArray(asRecord12(value).rows) ? asRecord12(value).rows : [];
|
|
61433
62853
|
this.#foldAgentReplayRows(rows, id);
|
|
61434
62854
|
this.#sweepSubagents(id);
|
|
61435
|
-
return bridgeReplayRowsToSeamTranscript(rows, skip);
|
|
62855
|
+
return bridgeReplayRowsToSeamTranscript(rows, skip, id);
|
|
61436
62856
|
}
|
|
61437
62857
|
async sessionJournal(id) {
|
|
61438
62858
|
const value = await this.#transport.request("journal.replay", { sessionId: id });
|
|
@@ -61671,8 +63091,13 @@ class BridgeSessionSeam {
|
|
|
61671
63091
|
this.#subagentRunSeq.clear();
|
|
61672
63092
|
this.#subagentLiveStarts.clear();
|
|
61673
63093
|
this.#subagentProgress.clear();
|
|
63094
|
+
this.#resetRoundPolicy();
|
|
61674
63095
|
this.#subagentJournalLoaded.clear();
|
|
61675
63096
|
this.#subagentJournalMeta.clear();
|
|
63097
|
+
this.#subagentTranscripts.clear();
|
|
63098
|
+
this.#subagentTranscriptRuns.clear();
|
|
63099
|
+
this.#subagentTranscriptSettled.clear();
|
|
63100
|
+
this.#subagentTranscriptReadFailed.clear();
|
|
61676
63101
|
this.#sweepSettledRuns.clear();
|
|
61677
63102
|
this.#subagentSettleSnapshots.clear();
|
|
61678
63103
|
this.#interruptInFlight.clear();
|
|
@@ -61941,6 +63366,33 @@ class BridgeSessionSeam {
|
|
|
61941
63366
|
const eventId = optionalStringField(payload, "eventId");
|
|
61942
63367
|
if (eventId !== undefined)
|
|
61943
63368
|
this.#settlePendingAsk(eventId);
|
|
63369
|
+
const bound = this.currentSessionId();
|
|
63370
|
+
const sid = optionalStringField(payload, "sessionId");
|
|
63371
|
+
const childSessionId = optionalStringField(payload, "childSessionId");
|
|
63372
|
+
if (eventId !== undefined && bound !== undefined && sid === bound && !this.#emittedAskOutcomes.has(eventId)) {
|
|
63373
|
+
const notice = deriveAskOutcomeNotice({
|
|
63374
|
+
eventId,
|
|
63375
|
+
sessionId: sid,
|
|
63376
|
+
anchorSeq: 0,
|
|
63377
|
+
settleReason: optionalStringField(payload, "reason"),
|
|
63378
|
+
askKind: optionalStringField(payload, "kind"),
|
|
63379
|
+
outcome: optionalStringField(payload, "outcome"),
|
|
63380
|
+
childSessionId
|
|
63381
|
+
});
|
|
63382
|
+
if (notice !== undefined) {
|
|
63383
|
+
this.#emittedAskOutcomes.add(eventId);
|
|
63384
|
+
this.#emitEvent({
|
|
63385
|
+
type: "message.updated",
|
|
63386
|
+
details: {
|
|
63387
|
+
id: notice.id,
|
|
63388
|
+
role: "notice",
|
|
63389
|
+
text: notice.text,
|
|
63390
|
+
sessionID: notice.sessionId,
|
|
63391
|
+
...childSessionId !== undefined ? { childSessionId } : {}
|
|
63392
|
+
}
|
|
63393
|
+
});
|
|
63394
|
+
}
|
|
63395
|
+
}
|
|
61944
63396
|
return true;
|
|
61945
63397
|
}
|
|
61946
63398
|
case "ask.pending": {
|
|
@@ -62040,6 +63492,10 @@ class BridgeSessionSeam {
|
|
|
62040
63492
|
this.#foldAgentProgress(frame);
|
|
62041
63493
|
return;
|
|
62042
63494
|
}
|
|
63495
|
+
if (frame.type === "agent.transcript") {
|
|
63496
|
+
this.#foldAgentTranscript(frame);
|
|
63497
|
+
return;
|
|
63498
|
+
}
|
|
62043
63499
|
if (frame.type === "bridge.dead") {
|
|
62044
63500
|
const cause = asDeadCause(frame.payload);
|
|
62045
63501
|
if (this.#inFlightGeneration !== 0 && this.#inFlightTurnId !== undefined && this.#inFlightTurnId !== "") {
|
|
@@ -62140,10 +63596,11 @@ class BridgeSessionSeam {
|
|
|
62140
63596
|
}
|
|
62141
63597
|
}
|
|
62142
63598
|
}
|
|
62143
|
-
var CONFIRM_REQUIRED = (method) => new BridgeProtocolError("CONFIRM_REQUIRED", `${method}: write requires a confirmed TUI modal token`), BridgeProtocolError, ACCOUNT_STATUSES, ACCOUNT_PHASES, ROUTE_ROW_TYPES, BRIDGE_AGENT_START = "tool-workflow/agent-start", BRIDGE_AGENT_END = "tool-workflow/agent-end", BRIDGE_SUBAGENT_CATALOG = "subagent/catalog", BRIDGE_SUBAGENT_SETTLED = "subagent-settled", BRIDGE_CATALOG_RUN_PREFIX = "catalog:", CONFIRM_POLL_INITIAL_MS = 250, CONFIRM_POLL_MAX_MS = 1000, CONFIRM_TIMEOUT_MS = 45000, fmtTokens = (n) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`;
|
|
63599
|
+
var CONFIRM_REQUIRED = (method) => new BridgeProtocolError("CONFIRM_REQUIRED", `${method}: write requires a confirmed TUI modal token`), BridgeProtocolError, ACCOUNT_STATUSES, ACCOUNT_PHASES, ROUTE_ROW_TYPES, BRIDGE_AGENT_START = "tool-workflow/agent-start", BRIDGE_AGENT_END = "tool-workflow/agent-end", BRIDGE_SUBAGENT_CATALOG = "subagent/catalog", BRIDGE_SUBAGENT_SETTLED = "subagent-settled", BRIDGE_CATALOG_RUN_PREFIX = "catalog:", CHILD_TRANSCRIPT_MAX_LINES = 500, CHILD_TRANSCRIPT_MAX_BYTES, childTextEncoder, childStrictTextDecoder, CHILD_TRANSCRIPT_LINE_BUDGET, CHILD_TRANSCRIPT_TRUNCATION_MARKER = "\u2026", CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES, CONFIRM_POLL_INITIAL_MS = 250, CONFIRM_POLL_MAX_MS = 1000, CONFIRM_TIMEOUT_MS = 45000, fmtTokens = (n) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`;
|
|
62144
63600
|
var init_bridge_session_seam = __esm(() => {
|
|
62145
63601
|
init_remote_session_ops();
|
|
62146
63602
|
init_journal_projection();
|
|
63603
|
+
init_ask_outcome();
|
|
62147
63604
|
init_bridge_side_session();
|
|
62148
63605
|
init_loop();
|
|
62149
63606
|
init_local_config_faces();
|
|
@@ -62151,6 +63608,7 @@ var init_bridge_session_seam = __esm(() => {
|
|
|
62151
63608
|
init_profile_constants();
|
|
62152
63609
|
init_bridge_goals();
|
|
62153
63610
|
init_bridge_settings_route();
|
|
63611
|
+
init_subagent_policy();
|
|
62154
63612
|
BridgeProtocolError = class BridgeProtocolError extends Error {
|
|
62155
63613
|
code;
|
|
62156
63614
|
detail;
|
|
@@ -62174,6 +63632,11 @@ var init_bridge_session_seam = __esm(() => {
|
|
|
62174
63632
|
"failed"
|
|
62175
63633
|
]);
|
|
62176
63634
|
ROUTE_ROW_TYPES = new Set(["model/selection", "request/header", "request/context"]);
|
|
63635
|
+
CHILD_TRANSCRIPT_MAX_BYTES = 64 * 1024;
|
|
63636
|
+
childTextEncoder = new TextEncoder;
|
|
63637
|
+
childStrictTextDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
63638
|
+
CHILD_TRANSCRIPT_LINE_BUDGET = CHILD_TRANSCRIPT_MAX_BYTES - 1;
|
|
63639
|
+
CHILD_TRANSCRIPT_TRUNCATION_MARKER_BYTES = childTextEncoder.encode(CHILD_TRANSCRIPT_TRUNCATION_MARKER).length;
|
|
62177
63640
|
});
|
|
62178
63641
|
|
|
62179
63642
|
// scripts/lib/bridge-failfast-text.mjs
|
|
@@ -62536,6 +63999,17 @@ function V2SessionPageBody(props) {
|
|
|
62536
63999
|
showNotice(pendingAgentsHomeNotice);
|
|
62537
64000
|
pendingAgentsHomeNotice = undefined;
|
|
62538
64001
|
}
|
|
64002
|
+
let pruneNoticeDisposed = false;
|
|
64003
|
+
onCleanup(() => {
|
|
64004
|
+
pruneNoticeDisposed = true;
|
|
64005
|
+
});
|
|
64006
|
+
if (seam.planPrune) {
|
|
64007
|
+
seam.planPrune().then((plan) => {
|
|
64008
|
+
if (pruneNoticeDisposed || plan.counts.prune <= 0)
|
|
64009
|
+
return;
|
|
64010
|
+
showNotice(t("notice.prune.available", { n: String(plan.counts.prune) }));
|
|
64011
|
+
}).catch(() => {});
|
|
64012
|
+
}
|
|
62539
64013
|
const timer = setInterval(() => setNow(new Date), 1000);
|
|
62540
64014
|
onCleanup(() => clearInterval(timer));
|
|
62541
64015
|
});
|
|
@@ -62546,6 +64020,7 @@ function V2SessionPageBody(props) {
|
|
|
62546
64020
|
turnAborted = false;
|
|
62547
64021
|
setTurnBusy(true);
|
|
62548
64022
|
setLastRequest(text);
|
|
64023
|
+
transcriptScroll?.scrollTo(Infinity);
|
|
62549
64024
|
const done = projection.send(text);
|
|
62550
64025
|
done.finally(() => setTurnBusy(false));
|
|
62551
64026
|
return done;
|
|
@@ -63016,6 +64491,9 @@ function V2SessionPageBody(props) {
|
|
|
63016
64491
|
createComponent2(Transcript, {
|
|
63017
64492
|
seam,
|
|
63018
64493
|
projection,
|
|
64494
|
+
get scrollbar() {
|
|
64495
|
+
return resolveSessionScrollbar(seam.workspaceConfig?.(), seam.configRaw?.(), seam.configLoad?.());
|
|
64496
|
+
},
|
|
63019
64497
|
focused: paneFocus.transcriptFocused,
|
|
63020
64498
|
scrollRef: (value) => transcriptScroll = value,
|
|
63021
64499
|
widgets: createComponent2(WidgetsDock, {
|
|
@@ -63351,6 +64829,7 @@ var init_v2_entry = __esm(() => {
|
|
|
63351
64829
|
init_subagents_viewer();
|
|
63352
64830
|
init_settings_modal();
|
|
63353
64831
|
init_btw_overlay();
|
|
64832
|
+
init_config2();
|
|
63354
64833
|
init_dialog_select();
|
|
63355
64834
|
init_dialog_prompt();
|
|
63356
64835
|
init_dialog_confirm();
|
|
@@ -63685,5 +65164,5 @@ if (import.meta.main) {
|
|
|
63685
65164
|
main();
|
|
63686
65165
|
}
|
|
63687
65166
|
|
|
63688
|
-
//# debugId=
|
|
65167
|
+
//# debugId=2A5F7C9D91CE94DC64756E2164756E21
|
|
63689
65168
|
//# sourceMappingURL=index.js.map
|