@qwen-code/web-shell 0.28.1-preview.1 → 0.28.3-nightly.20261121.56ef346859
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PierreFilePreview-CsARQefS.js → PierreFilePreview-BirhX9A8.js} +1 -1
- package/dist/{SpreadsheetPreview-D3YGKe0n.js → SpreadsheetPreview-YvYBq0r3.js} +2 -2
- package/dist/{WorkspaceFileBrowser-1GbG0WLt.js → WorkspaceFileBrowser-CuqdtAcy.js} +2 -2
- package/dist/{WorkspacePdfRangePreview-it3G4-Se.js → WorkspacePdfRangePreview-D2qKhlQp.js} +2 -2
- package/dist/{agents-route-Dbjm9Y2P.js → agents-route-DGqnucS8.js} +2 -2
- package/dist/daemon-react-sdk.js +1 -1
- package/dist/{i18n-ru-CfZvlNRX.js → i18n-ru-CQurqwP6.js} +1 -1
- package/dist/{i18n-zh-cn-oYBQlyci.js → i18n-zh-cn-C3owX7KJ.js} +3 -1
- package/dist/{index-ChVhTKLB.js → index-CVklLnTX.js} +50295 -50136
- package/dist/index.js +3 -3
- package/dist/sw.js +1 -1
- package/dist/transcript.js +7767 -7725
- package/dist/types/adapters/messageTypes.d.ts +4 -0
- package/dist/types/components/messages/AssistantMessage.d.ts +5 -1
- package/dist/types/components/messages/ModAssistantMessage.d.ts +8 -1
- package/dist/types/components/messages/ThinkingBody.d.ts +20 -0
- package/dist/types/components/messages/ThinkingBody.transcript-stub.d.ts +8 -0
- package/dist/types/components/messages/ToolGroup.d.ts +2 -6
- package/dist/types/daemon/session/types.d.ts +7 -0
- package/dist/types/utils/visualViewportInset.d.ts +13 -0
- package/dist/{useDaemonMidTurnInjected-BjQ9zxRv.js → useDaemonMidTurnInjected-BQiO1GP_.js} +910 -894
- package/package.json +1 -1
|
@@ -358,9 +358,9 @@ function cp(e, t) {
|
|
|
358
358
|
{ length: s.length + 1 },
|
|
359
359
|
() => []
|
|
360
360
|
), E = [];
|
|
361
|
-
let
|
|
361
|
+
let R;
|
|
362
362
|
for (const $ of m)
|
|
363
|
-
typeof $ == "string" && (
|
|
363
|
+
typeof $ == "string" && (R = v.get($) ?? R), E.push(R);
|
|
364
364
|
let q;
|
|
365
365
|
for (let $ = m.length - 1; $ >= 0; $--) {
|
|
366
366
|
const M = m[$];
|
|
@@ -839,21 +839,21 @@ function vp(e) {
|
|
|
839
839
|
if (n !== "idle" && n !== "running" && n !== "verifying")
|
|
840
840
|
return;
|
|
841
841
|
if (t?.goal === null) {
|
|
842
|
-
const
|
|
843
|
-
return t.clearedGoal !== void 0 && (!V ||
|
|
842
|
+
const P = Le(t.clearedGoal), V = Se(P, "goalId"), X = Gt(P, "revision"), ae = Gt(P, "updatedAt");
|
|
843
|
+
return t.clearedGoal !== void 0 && (!V || X === void 0 || X <= 0 || ae === void 0) ? void 0 : {
|
|
844
844
|
v: 2,
|
|
845
845
|
goal: null,
|
|
846
846
|
activity: n,
|
|
847
|
-
...V &&
|
|
847
|
+
...V && X !== void 0 && ae !== void 0 ? {
|
|
848
848
|
clearedGoal: {
|
|
849
849
|
goalId: V,
|
|
850
|
-
revision:
|
|
850
|
+
revision: X,
|
|
851
851
|
updatedAt: ae
|
|
852
852
|
}
|
|
853
853
|
} : {}
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
|
-
const o = Le(t?.goal), a = Se(o, "goalId"), r = Gt(o, "revision"), s = Se(o, "objective"), i = Se(o, "status"), u = Le(o?.evidenceCursor)?.recordId, m = Gt(o, "turnCount"), g = Gt(o, "activeTimeMs"), v = Gt(o, "tokensUsed"), I = Gt(o, "tokenBudget"), E = Gt(o, "turnBudget"),
|
|
856
|
+
const o = Le(t?.goal), a = Se(o, "goalId"), r = Gt(o, "revision"), s = Se(o, "objective"), i = Se(o, "status"), u = Le(o?.evidenceCursor)?.recordId, m = Gt(o, "turnCount"), g = Gt(o, "activeTimeMs"), v = Gt(o, "tokensUsed"), I = Gt(o, "tokenBudget"), E = Gt(o, "turnBudget"), R = Gt(o, "activeTimeBudgetMs"), q = Gt(o, "createdAt"), $ = Gt(o, "updatedAt");
|
|
857
857
|
if (!a || r === void 0 || !s || i !== "active" && i !== "paused" && i !== "blocked" && i !== "usage_limited" && i !== "complete" || u !== null && typeof u != "string" || m === void 0 || g === void 0 || q === void 0 || $ === void 0)
|
|
858
858
|
return;
|
|
859
859
|
const M = Se(o, "lastReason"), B = Se(o, "limitKind"), U = B === "evidence_catalog" || B === "checkpoint_request" || B === "token_budget" || B === "turn_budget" || B === "time_budget" ? B : void 0;
|
|
@@ -871,7 +871,7 @@ function vp(e) {
|
|
|
871
871
|
...v !== void 0 ? { tokensUsed: v } : {},
|
|
872
872
|
...I !== void 0 ? { tokenBudget: I } : {},
|
|
873
873
|
...E !== void 0 ? { turnBudget: E } : {},
|
|
874
|
-
...
|
|
874
|
+
...R !== void 0 ? { activeTimeBudgetMs: R } : {},
|
|
875
875
|
createdAt: q,
|
|
876
876
|
updatedAt: $,
|
|
877
877
|
...M ? { lastReason: M } : {},
|
|
@@ -1150,22 +1150,22 @@ function qc(e, t, n, o = !1) {
|
|
|
1150
1150
|
const i = o ? void 0 : dr(e, t, a), l = i?.getGeneration();
|
|
1151
1151
|
if (i?.assertAvailable(), typeof a.requestRest == "function")
|
|
1152
1152
|
try {
|
|
1153
|
-
const
|
|
1153
|
+
const R = await a.requestRest(
|
|
1154
1154
|
r,
|
|
1155
1155
|
s,
|
|
1156
1156
|
s.signal ? 0 : void 0
|
|
1157
1157
|
);
|
|
1158
1158
|
return i?.reportFailure(
|
|
1159
|
-
{ status:
|
|
1159
|
+
{ status: R.status },
|
|
1160
1160
|
s.signal ?? void 0,
|
|
1161
1161
|
l
|
|
1162
|
-
),
|
|
1163
|
-
} catch (
|
|
1162
|
+
), R;
|
|
1163
|
+
} catch (R) {
|
|
1164
1164
|
throw i?.reportFailure(
|
|
1165
|
-
|
|
1165
|
+
R,
|
|
1166
1166
|
s.signal ?? void 0,
|
|
1167
1167
|
l
|
|
1168
|
-
),
|
|
1168
|
+
), R;
|
|
1169
1169
|
}
|
|
1170
1170
|
if (!/^\/(?![/\\\t\r\n])/.test(r) || new URL(r, "http://daemon.invalid").origin !== "http://daemon.invalid")
|
|
1171
1171
|
throw new Error("Daemon REST requests require an absolute route path");
|
|
@@ -1178,7 +1178,7 @@ function qc(e, t, n, o = !1) {
|
|
|
1178
1178
|
t ? { Authorization: `Bearer ${t}` } : {}
|
|
1179
1179
|
);
|
|
1180
1180
|
new Headers(s.headers).forEach(
|
|
1181
|
-
(
|
|
1181
|
+
(R, q) => g.set(q, R)
|
|
1182
1182
|
);
|
|
1183
1183
|
const v = a.transport?.restFetch ?? globalThis.fetch.bind(globalThis), I = s.signal ? void 0 : new AbortController(), E = I ? setTimeout(
|
|
1184
1184
|
() => I.abort(new DOMException("timeout", "TimeoutError")),
|
|
@@ -1456,23 +1456,23 @@ function _p({
|
|
|
1456
1456
|
daemonActivePromptRef: v,
|
|
1457
1457
|
settleRestoredActivePrompt: I,
|
|
1458
1458
|
flushTranscript: E,
|
|
1459
|
-
getCreateSessionRequest:
|
|
1459
|
+
getCreateSessionRequest: R,
|
|
1460
1460
|
createDetachedSession: q,
|
|
1461
1461
|
createDetachedStandaloneSession: $,
|
|
1462
1462
|
getDefaultSessionContext: M,
|
|
1463
1463
|
getClient: B,
|
|
1464
1464
|
getConnection: U,
|
|
1465
|
-
getPromptStatus:
|
|
1465
|
+
getPromptStatus: P,
|
|
1466
1466
|
getEventDetailMode: V,
|
|
1467
|
-
hasSessionActivePrompt:
|
|
1467
|
+
hasSessionActivePrompt: X,
|
|
1468
1468
|
resetCurrentSessionActivePrompt: ae,
|
|
1469
1469
|
restartEventStream: et,
|
|
1470
1470
|
addNotice: F,
|
|
1471
1471
|
setConnection: S,
|
|
1472
|
-
setPromptStatus:
|
|
1473
|
-
setRestoreSessionId:
|
|
1472
|
+
setPromptStatus: D,
|
|
1473
|
+
setRestoreSessionId: H,
|
|
1474
1474
|
setRestoreSessionContext: z,
|
|
1475
|
-
setRestoreMode:
|
|
1475
|
+
setRestoreMode: Y,
|
|
1476
1476
|
setRestoreSessionNonce: oe,
|
|
1477
1477
|
setAttachSessionNonce: ne,
|
|
1478
1478
|
setNewSessionNonce: Pe,
|
|
@@ -1487,7 +1487,7 @@ function _p({
|
|
|
1487
1487
|
let Ae = t.current, Tt = 0, vt = 0, Be = 0, on, yn = !1;
|
|
1488
1488
|
const Zt = /* @__PURE__ */ new WeakSet();
|
|
1489
1489
|
let eo = t.current?.client, At = t.current?.sessionId, Rn = t.current?.clientId;
|
|
1490
|
-
async function
|
|
1490
|
+
async function ee(c) {
|
|
1491
1491
|
const d = As(
|
|
1492
1492
|
i,
|
|
1493
1493
|
c
|
|
@@ -1555,27 +1555,27 @@ function _p({
|
|
|
1555
1555
|
const y = C.slice(1).trim().split(/\s+/, 1)[0];
|
|
1556
1556
|
if (!y || y.includes("/") || y.includes("\\")) return !1;
|
|
1557
1557
|
let k = t.current === c ? U().commands : void 0;
|
|
1558
|
-
const O = () => k?.find((W) => W.name === y) ?? k?.find((W) => W.altNames?.includes(y)),
|
|
1559
|
-
if (p && !
|
|
1558
|
+
const O = () => k?.find((W) => W.name === y) ?? k?.find((W) => W.altNames?.includes(y)), L = O();
|
|
1559
|
+
if (p && !L && !k?.some((W) => W.source === "builtin-command")) {
|
|
1560
1560
|
const W = _(
|
|
1561
1561
|
c.supportedCommands(),
|
|
1562
1562
|
"Loading commands timed out",
|
|
1563
1563
|
5e3
|
|
1564
1564
|
);
|
|
1565
|
-
return (h ? Promise.race([W, Lp(h)]) : W).then((
|
|
1565
|
+
return (h ? Promise.race([W, Lp(h)]) : W).then((j) => {
|
|
1566
1566
|
if (!f())
|
|
1567
1567
|
throw new Error("Session changed before prompt submission");
|
|
1568
|
-
const N = Gi(
|
|
1568
|
+
const N = Gi(j);
|
|
1569
1569
|
k = N.commands, S(
|
|
1570
|
-
(ie) => t.current === c ? { ...ie, ...N, supportedCommands:
|
|
1570
|
+
(ie) => t.current === c ? { ...ie, ...N, supportedCommands: j } : ie
|
|
1571
1571
|
);
|
|
1572
|
-
const
|
|
1573
|
-
return
|
|
1572
|
+
const Z = O();
|
|
1573
|
+
return Z ? Z.source === "builtin-command" : !k.some(
|
|
1574
1574
|
(ie) => ie.source === "builtin-command"
|
|
1575
1575
|
);
|
|
1576
1576
|
});
|
|
1577
1577
|
}
|
|
1578
|
-
return
|
|
1578
|
+
return L ? L.source === "builtin-command" : !k?.some(
|
|
1579
1579
|
(W) => W.source === "builtin-command"
|
|
1580
1580
|
);
|
|
1581
1581
|
}
|
|
@@ -1589,9 +1589,9 @@ function _p({
|
|
|
1589
1589
|
const k = U().capabilities?.features.includes("session_attachments") === !0 && typeof c.uploadAttachment == "function";
|
|
1590
1590
|
if (h.length > 0 && !k)
|
|
1591
1591
|
throw new Error("File attachment upload is not supported");
|
|
1592
|
-
const O = k ? p.filter((Q) => Q.mimeType !== "image/*") : [],
|
|
1592
|
+
const O = k ? p.filter((Q) => Q.mimeType !== "image/*") : [], L = p.filter(
|
|
1593
1593
|
(Q) => !O.includes(Q)
|
|
1594
|
-
), W = k ? h : [],
|
|
1594
|
+
), W = k ? h : [], j = h.filter((Q) => !W.includes(Q));
|
|
1595
1595
|
if (O.length === 0 && W.length === 0)
|
|
1596
1596
|
return {
|
|
1597
1597
|
content: na(d, p, h),
|
|
@@ -1615,13 +1615,13 @@ function _p({
|
|
|
1615
1615
|
C
|
|
1616
1616
|
)
|
|
1617
1617
|
)
|
|
1618
|
-
]),
|
|
1618
|
+
]), Z = N.flatMap(
|
|
1619
1619
|
(Q) => Q.status === "fulfilled" ? [Q.value] : []
|
|
1620
1620
|
), ie = N.find(
|
|
1621
1621
|
(Q) => Q.status === "rejected"
|
|
1622
1622
|
);
|
|
1623
1623
|
if (!ie) {
|
|
1624
|
-
const Q = na(d,
|
|
1624
|
+
const Q = na(d, L, j), se = Z.slice(O.length);
|
|
1625
1625
|
return Q[0] = {
|
|
1626
1626
|
type: "text",
|
|
1627
1627
|
text: Wc(
|
|
@@ -1632,13 +1632,13 @@ function _p({
|
|
|
1632
1632
|
)
|
|
1633
1633
|
)
|
|
1634
1634
|
)
|
|
1635
|
-
}, Q.splice(1, 0, ...
|
|
1635
|
+
}, Q.splice(1, 0, ...Z), {
|
|
1636
1636
|
content: Q,
|
|
1637
|
-
references:
|
|
1637
|
+
references: Z,
|
|
1638
1638
|
fileReferences: se
|
|
1639
1639
|
};
|
|
1640
1640
|
}
|
|
1641
|
-
if (await dt(c,
|
|
1641
|
+
if (await dt(c, Z), mn(ie.reason) === 404) {
|
|
1642
1642
|
if (W.length > 0)
|
|
1643
1643
|
throw new sa(ie.reason);
|
|
1644
1644
|
return {
|
|
@@ -1671,23 +1671,23 @@ function _p({
|
|
|
1671
1671
|
if (t.current !== c) return;
|
|
1672
1672
|
const O = await Promise.allSettled(
|
|
1673
1673
|
y.map(
|
|
1674
|
-
({ reference:
|
|
1674
|
+
({ reference: L, title: W }) => c.client.upsertSessionSource(
|
|
1675
1675
|
f,
|
|
1676
1676
|
{
|
|
1677
1677
|
title: W,
|
|
1678
1678
|
locator: {
|
|
1679
1679
|
type: "attachment",
|
|
1680
|
-
attachmentId:
|
|
1680
|
+
attachmentId: L.attachmentId
|
|
1681
1681
|
}
|
|
1682
1682
|
},
|
|
1683
1683
|
C
|
|
1684
1684
|
)
|
|
1685
1685
|
)
|
|
1686
1686
|
);
|
|
1687
|
-
y = y.filter((
|
|
1688
|
-
const
|
|
1689
|
-
if (
|
|
1690
|
-
const N = Jn(
|
|
1687
|
+
y = y.filter((L, W) => {
|
|
1688
|
+
const j = O[W];
|
|
1689
|
+
if (j?.status !== "rejected") return !1;
|
|
1690
|
+
const N = Jn(j.reason);
|
|
1691
1691
|
return N !== "source_limit_reached" && N !== "invalid_source" && N !== "source_attachment_not_found";
|
|
1692
1692
|
}), !(t.current !== c || !y.length) && Vt(c)({
|
|
1693
1693
|
severity: "warning",
|
|
@@ -1709,9 +1709,9 @@ function _p({
|
|
|
1709
1709
|
qe(), at.clear();
|
|
1710
1710
|
for (const [, c] of n.current)
|
|
1711
1711
|
c.controller.abort();
|
|
1712
|
-
n.current.clear(), o.current.clear(),
|
|
1712
|
+
n.current.clear(), o.current.clear(), D("idle"), ft(g), a.current && (m.current?.sessionId === a.current.sessionId && (m.current = void 0), Il(a.current), a.current.reject(
|
|
1713
1713
|
new DOMException("Session cleared", "AbortError")
|
|
1714
|
-
), a.current = void 0), e.reset(),
|
|
1714
|
+
), a.current = void 0), e.reset(), H(void 0), z(void 0);
|
|
1715
1715
|
}
|
|
1716
1716
|
function bt(c, d, p, h, f) {
|
|
1717
1717
|
const C = r.current + 1;
|
|
@@ -1721,10 +1721,10 @@ function _p({
|
|
|
1721
1721
|
"AbortError"
|
|
1722
1722
|
)
|
|
1723
1723
|
)), new Promise((k, O) => {
|
|
1724
|
-
const
|
|
1724
|
+
const L = zc(
|
|
1725
1725
|
U().capabilities
|
|
1726
|
-
), W = d === "attach" ? Pp :
|
|
1727
|
-
a.current?.id === C && (a.current = void 0, t.current?.sessionId !== c && (u.current = !0,
|
|
1726
|
+
), W = d === "attach" ? Pp : L.watchdogTimeoutMs, j = W === void 0 ? void 0 : setTimeout(() => {
|
|
1727
|
+
a.current?.id === C && (a.current = void 0, t.current?.sessionId !== c && (u.current = !0, H(void 0), z(void 0), S((N) => N.status !== "connecting" || N.sessionId !== c ? N : {
|
|
1728
1728
|
...Wo(N, c),
|
|
1729
1729
|
status: "disconnected",
|
|
1730
1730
|
sessionId: void 0
|
|
@@ -1742,8 +1742,8 @@ function _p({
|
|
|
1742
1742
|
sessionId: c,
|
|
1743
1743
|
mode: d,
|
|
1744
1744
|
...p ? { sessionContext: p } : {},
|
|
1745
|
-
timeout:
|
|
1746
|
-
...d !== "attach" ? { requestTimeoutMs:
|
|
1745
|
+
timeout: j,
|
|
1746
|
+
...d !== "attach" ? { requestTimeoutMs: L.requestTimeoutMs } : {},
|
|
1747
1747
|
resolve: k,
|
|
1748
1748
|
reject: O,
|
|
1749
1749
|
...h ? { signal: h } : {},
|
|
@@ -1757,18 +1757,18 @@ function _p({
|
|
|
1757
1757
|
new DOMException("Session load cancelled", "AbortError")
|
|
1758
1758
|
);
|
|
1759
1759
|
u.current = !1;
|
|
1760
|
-
const C = t.current, y = C?.sessionId, k = U(), O = k.sessionContext ?? (k.workspaceCwd ? { kind: "workspace", cwd: k.workspaceCwd } : Si(C)),
|
|
1760
|
+
const C = t.current, y = C?.sessionId, k = U(), O = k.sessionContext ?? (k.workspaceCwd ? { kind: "workspace", cwd: k.workspaceCwd } : Si(C)), L = k.error ? M() : O ?? M(), W = yl(
|
|
1761
1761
|
p?.sessionContext,
|
|
1762
1762
|
p?.workspaceCwd,
|
|
1763
|
-
|
|
1764
|
-
),
|
|
1763
|
+
L
|
|
1764
|
+
), j = W?.kind === "workspace" ? W.cwd : void 0, N = bt(
|
|
1765
1765
|
c,
|
|
1766
1766
|
d,
|
|
1767
1767
|
W,
|
|
1768
1768
|
h,
|
|
1769
1769
|
f
|
|
1770
|
-
),
|
|
1771
|
-
|
|
1770
|
+
), Z = a.current;
|
|
1771
|
+
Z && p?.reconcilePromptActivity && (Z.reconcilePromptActivity = !0), (y ? n.current.get(y) : void 0)?.reject?.(
|
|
1772
1772
|
new DOMException("Session switch interrupted prompt wait", "AbortError")
|
|
1773
1773
|
), y && n.current.delete(y), v.current = void 0, ae();
|
|
1774
1774
|
const Q = d === "load" && y === c && _t(O) === _t(W), se = _t(O) !== _t(W) && (O?.kind === "standalone" || O?.kind === "live" || W?.kind === "standalone" || W?.kind === "live"), re = k.sessionId !== void 0 && k.sessionId !== c && O?.kind === W?.kind && (W?.kind === "standalone" || W?.kind === "live");
|
|
@@ -1791,8 +1791,8 @@ function _p({
|
|
|
1791
1791
|
status: "connecting",
|
|
1792
1792
|
sessionId: c,
|
|
1793
1793
|
sessionContext: W,
|
|
1794
|
-
workspaceCwd:
|
|
1795
|
-
gitBranch: ce.workspaceCwd ===
|
|
1794
|
+
workspaceCwd: j,
|
|
1795
|
+
gitBranch: ce.workspaceCwd === j ? Ue.gitBranch : void 0,
|
|
1796
1796
|
standaloneSession: void 0,
|
|
1797
1797
|
clientId: void 0,
|
|
1798
1798
|
displayName: void 0,
|
|
@@ -1812,8 +1812,8 @@ function _p({
|
|
|
1812
1812
|
artifactCountHint: p?.artifactCountHint,
|
|
1813
1813
|
artifactCountHintSessionId: p?.artifactCountHint !== void 0 ? c : void 0
|
|
1814
1814
|
};
|
|
1815
|
-
}), (!Q || !p?.reconcilePromptActivity) &&
|
|
1816
|
-
throw
|
|
1815
|
+
}), (!Q || !p?.reconcilePromptActivity) && D("idle"), o.current.clear(), ft(g), Q || e.reset(), Y(d), H(c), z(W), oe((ce) => ce + 1), N.catch((ce) => {
|
|
1816
|
+
throw Z?.reconcilePromptActivity && r.current !== Z.id || !Io(ce) && (a.current === void 0 || a.current === Z) && (Z?.reconcilePromptActivity && U().sessionId === c && !Ji(n.current, c) && D("idle"), S((Ue) => ({
|
|
1817
1817
|
...Ue,
|
|
1818
1818
|
error: ce instanceof Error ? ce.message : String(ce),
|
|
1819
1819
|
errorStatus: mn(ce),
|
|
@@ -1843,22 +1843,22 @@ function _p({
|
|
|
1843
1843
|
const y = v.current, k = a.current, O = k?.reconcilePromptActivity === !0 && k.sessionId === d.sessionId && C?.workspaceCwd === d.workspaceCwd;
|
|
1844
1844
|
if (O && y?.active === !1 && y.sessionId === d.sessionId && y.workspaceCwd === d.workspaceCwd && c !== !1)
|
|
1845
1845
|
return;
|
|
1846
|
-
v.current = { active: c, ...d }, c !== void 0 && C?.sessionId === d.sessionId && C?.workspaceCwd === d.workspaceCwd && S((
|
|
1847
|
-
const N =
|
|
1848
|
-
return
|
|
1849
|
-
...
|
|
1846
|
+
v.current = { active: c, ...d }, c !== void 0 && C?.sessionId === d.sessionId && C?.workspaceCwd === d.workspaceCwd && S((j) => {
|
|
1847
|
+
const N = j.finishedBackgroundTurnId === p?.turnId ? void 0 : p;
|
|
1848
|
+
return j.backgroundTurn === N ? j : {
|
|
1849
|
+
...j,
|
|
1850
1850
|
backgroundTurn: N,
|
|
1851
|
-
backgroundTurnObservedAt: h ??
|
|
1852
|
-
finishedBackgroundTurnId:
|
|
1851
|
+
backgroundTurnObservedAt: h ?? j.backgroundTurnObservedAt,
|
|
1852
|
+
finishedBackgroundTurnId: j.backgroundTurn && !N ? j.backgroundTurn.turnId : j.finishedBackgroundTurnId
|
|
1853
1853
|
};
|
|
1854
1854
|
});
|
|
1855
|
-
const
|
|
1856
|
-
if (C === void 0 || C.workspaceCwd !== d.workspaceCwd || C.sessionId !== d.sessionId || c === !0 || !
|
|
1855
|
+
const L = y?.active === !0 && y.workspaceCwd === d.workspaceCwd && y.sessionId === d.sessionId;
|
|
1856
|
+
if (C === void 0 || C.workspaceCwd !== d.workspaceCwd || C.sessionId !== d.sessionId || c === !0 || !L && c !== !1 || Ji(
|
|
1857
1857
|
n.current,
|
|
1858
1858
|
C.sessionId
|
|
1859
1859
|
))
|
|
1860
1860
|
return;
|
|
1861
|
-
if (c === void 0 &&
|
|
1861
|
+
if (c === void 0 && P() !== "idle") {
|
|
1862
1862
|
w(C.sessionId, "load", {
|
|
1863
1863
|
sessionContext: f.sessionContext ?? Si(C),
|
|
1864
1864
|
reconcilePromptActivity: !0
|
|
@@ -1867,11 +1867,11 @@ function _p({
|
|
|
1867
1867
|
return;
|
|
1868
1868
|
}
|
|
1869
1869
|
const W = I();
|
|
1870
|
-
!
|
|
1870
|
+
!L && !W && !f.backgroundTurn && !O || (E(), e.getSnapshot().activeAssistantBlockId && (e.dispatch({ type: "assistant.done", reason: "daemon_idle" }), ft(g)), console.debug(
|
|
1871
1871
|
"[DaemonSessionActions] settled turn from daemon prompt state (sessionId=%s, daemonActivePrompt=%s)",
|
|
1872
1872
|
C.sessionId,
|
|
1873
1873
|
String(c)
|
|
1874
|
-
),
|
|
1874
|
+
), D("idle"));
|
|
1875
1875
|
},
|
|
1876
1876
|
async sendPrompt(c, d) {
|
|
1877
1877
|
const p = _e(
|
|
@@ -1889,7 +1889,7 @@ function _p({
|
|
|
1889
1889
|
);
|
|
1890
1890
|
ft(g);
|
|
1891
1891
|
const f = { sessionId: h, startedAt: Date.now() };
|
|
1892
|
-
S((k) => ({ ...k, localPrompt: f })),
|
|
1892
|
+
S((k) => ({ ...k, localPrompt: f })), D("waiting");
|
|
1893
1893
|
const C = new AbortController();
|
|
1894
1894
|
n.current.set(h, {
|
|
1895
1895
|
controller: C,
|
|
@@ -1900,21 +1900,21 @@ function _p({
|
|
|
1900
1900
|
const k = (d?.images ?? []).map((Ne) => ({
|
|
1901
1901
|
data: Ne.data,
|
|
1902
1902
|
mimeType: Ne.mimeType || Ne.mediaType || Ne.media_type || "image/*"
|
|
1903
|
-
})), O = Ti(d?.files),
|
|
1903
|
+
})), O = Ti(d?.files), L = Tn(
|
|
1904
1904
|
p,
|
|
1905
1905
|
c,
|
|
1906
1906
|
k.length > 0 || O.length > 0,
|
|
1907
1907
|
C.signal
|
|
1908
|
-
), W = typeof
|
|
1908
|
+
), W = typeof L == "boolean" ? L : await L;
|
|
1909
1909
|
if (t.current !== p)
|
|
1910
1910
|
throw new Error("Session changed before prompt submission");
|
|
1911
1911
|
C.signal.throwIfAborted();
|
|
1912
|
-
const
|
|
1912
|
+
const j = W ? [] : k, N = W ? [] : O, Z = d?.inputAnnotations && d.inputAnnotations.length > 0 ? d.inputAnnotations : void 0, ie = d?.optimisticUserMessage !== !1, Q = ie && j.length === 0 && N.length === 0;
|
|
1913
1913
|
let se = d?.bindBlockId;
|
|
1914
1914
|
Q && (e.appendLocalUserMessage(
|
|
1915
1915
|
c,
|
|
1916
|
-
|
|
1917
|
-
|
|
1916
|
+
j,
|
|
1917
|
+
Z ? { inputAnnotations: Z } : void 0,
|
|
1918
1918
|
[]
|
|
1919
1919
|
), ze && (se = e.getSnapshot().blocks.at(-1)?.id));
|
|
1920
1920
|
let re;
|
|
@@ -1930,24 +1930,24 @@ function _p({
|
|
|
1930
1930
|
} catch (Ne) {
|
|
1931
1931
|
throw ie && !Q && e.appendLocalUserMessage(
|
|
1932
1932
|
c,
|
|
1933
|
-
|
|
1934
|
-
|
|
1933
|
+
j,
|
|
1934
|
+
Z ? { inputAnnotations: Z } : void 0,
|
|
1935
1935
|
Oo(N, [], !0)
|
|
1936
1936
|
), Ne instanceof sa ? Ne.reason : Ne;
|
|
1937
1937
|
}
|
|
1938
1938
|
C.signal.aborted && (await dt(p, re.references), ie && !Q && e.appendLocalUserMessage(
|
|
1939
1939
|
c,
|
|
1940
|
-
|
|
1941
|
-
|
|
1940
|
+
j,
|
|
1941
|
+
Z ? { inputAnnotations: Z } : void 0,
|
|
1942
1942
|
Oo(N, [], !0)
|
|
1943
1943
|
), C.signal.throwIfAborted());
|
|
1944
1944
|
const ce = {
|
|
1945
1945
|
prompt: re.content,
|
|
1946
1946
|
eventDetailMode: V()
|
|
1947
1947
|
};
|
|
1948
|
-
d?.onAdmissionStarted?.(), (
|
|
1948
|
+
d?.onAdmissionStarted?.(), (Z || typeof d?.submittedPrompt == "string") && (ce._meta = {
|
|
1949
1949
|
...typeof d?.submittedPrompt == "string" ? { "qwen.submittedPrompt": d.submittedPrompt } : {},
|
|
1950
|
-
...
|
|
1950
|
+
...Z ? { inputAnnotations: Z } : {}
|
|
1951
1951
|
}), d?.retry && (ce.retry = !0);
|
|
1952
1952
|
let Ue;
|
|
1953
1953
|
try {
|
|
@@ -1961,8 +1961,8 @@ function _p({
|
|
|
1961
1961
|
const Wt = Xt(Ne);
|
|
1962
1962
|
throw Wt && await dt(p, re.references), ie && !Q && e.appendLocalUserMessage(
|
|
1963
1963
|
c,
|
|
1964
|
-
|
|
1965
|
-
|
|
1964
|
+
j,
|
|
1965
|
+
Z ? { inputAnnotations: Z } : void 0,
|
|
1966
1966
|
Oo(
|
|
1967
1967
|
N,
|
|
1968
1968
|
Wt ? [] : re.fileReferences,
|
|
@@ -1977,8 +1977,8 @@ function _p({
|
|
|
1977
1977
|
}
|
|
1978
1978
|
ie && !Q && (e.appendLocalUserMessage(
|
|
1979
1979
|
c,
|
|
1980
|
-
|
|
1981
|
-
|
|
1980
|
+
j,
|
|
1981
|
+
Z ? { inputAnnotations: Z } : void 0,
|
|
1982
1982
|
Oo(N, re.fileReferences)
|
|
1983
1983
|
), ze && (se = e.getSnapshot().blocks.at(-1)?.id));
|
|
1984
1984
|
const Et = n.current.get(h);
|
|
@@ -2012,9 +2012,9 @@ function _p({
|
|
|
2012
2012
|
} finally {
|
|
2013
2013
|
S((O) => {
|
|
2014
2014
|
if (O.localPrompt !== f) return O;
|
|
2015
|
-
const
|
|
2016
|
-
return delete
|
|
2017
|
-
}), n.current.get(h)?.controller === C && n.current.delete(h), t.current?.sessionId === h && !
|
|
2015
|
+
const L = { ...O };
|
|
2016
|
+
return delete L.localPrompt, L;
|
|
2017
|
+
}), n.current.get(h)?.controller === C && n.current.delete(h), t.current?.sessionId === h && !X() && D("idle");
|
|
2018
2018
|
}
|
|
2019
2019
|
},
|
|
2020
2020
|
async continueSession(c = {}) {
|
|
@@ -2024,7 +2024,7 @@ function _p({
|
|
|
2024
2024
|
"Continue failed",
|
|
2025
2025
|
"continue_session"
|
|
2026
2026
|
), p = d.sessionId;
|
|
2027
|
-
if (
|
|
2027
|
+
if (X() || n.current.has(p))
|
|
2028
2028
|
throw be(
|
|
2029
2029
|
F,
|
|
2030
2030
|
"Continue failed",
|
|
@@ -2044,49 +2044,49 @@ function _p({
|
|
|
2044
2044
|
n.current.set(p, {
|
|
2045
2045
|
controller: f,
|
|
2046
2046
|
replayedTurnEvents: /* @__PURE__ */ new Map()
|
|
2047
|
-
}), ft(g),
|
|
2048
|
-
(
|
|
2049
|
-
...
|
|
2050
|
-
context:
|
|
2051
|
-
...
|
|
2047
|
+
}), ft(g), D("waiting"), As(i, d), S(
|
|
2048
|
+
(L) => t.current === d ? {
|
|
2049
|
+
...L,
|
|
2050
|
+
context: L.context?.recovery ? {
|
|
2051
|
+
...L.context,
|
|
2052
2052
|
recovery: {
|
|
2053
|
-
...
|
|
2053
|
+
...L.context.recovery,
|
|
2054
2054
|
canContinue: !1
|
|
2055
2055
|
}
|
|
2056
|
-
} :
|
|
2057
|
-
} :
|
|
2056
|
+
} : L.context
|
|
2057
|
+
} : L
|
|
2058
2058
|
);
|
|
2059
2059
|
try {
|
|
2060
|
-
const
|
|
2061
|
-
if (k =
|
|
2060
|
+
const L = await d.continueSession(f.signal, c);
|
|
2061
|
+
if (k = L.accepted, O = !k, !L.accepted || !y()) return;
|
|
2062
2062
|
const W = n.current.get(p);
|
|
2063
|
-
W?.controller === f && (W.promptId =
|
|
2063
|
+
W?.controller === f && (W.promptId = L.promptId), Te?.(
|
|
2064
2064
|
t.current ?? d,
|
|
2065
|
-
|
|
2065
|
+
L.promptId
|
|
2066
2066
|
), n.current.get(p)?.controller === f && et(p), await Al(
|
|
2067
2067
|
n.current,
|
|
2068
2068
|
o.current,
|
|
2069
2069
|
p,
|
|
2070
2070
|
f,
|
|
2071
|
-
|
|
2071
|
+
L.promptId
|
|
2072
2072
|
);
|
|
2073
|
-
} catch (
|
|
2074
|
-
if (O = !k &&
|
|
2075
|
-
if (Io(
|
|
2073
|
+
} catch (L) {
|
|
2074
|
+
if (O = !k && L instanceof kn && L.status >= 400 && L.status < 500, !y()) throw L;
|
|
2075
|
+
if (Io(L)) {
|
|
2076
2076
|
e.dispatch({ type: "assistant.done", reason: "cancelled" });
|
|
2077
2077
|
return;
|
|
2078
2078
|
}
|
|
2079
|
-
throw cl(
|
|
2079
|
+
throw cl(L) ? L : (Ot(p, L), be(
|
|
2080
2080
|
F,
|
|
2081
2081
|
"Continue failed",
|
|
2082
|
-
|
|
2082
|
+
L,
|
|
2083
2083
|
"continue_session"
|
|
2084
2084
|
));
|
|
2085
2085
|
} finally {
|
|
2086
|
-
const
|
|
2087
|
-
n.current.get(p)?.controller === f && n.current.delete(p),
|
|
2086
|
+
const L = y();
|
|
2087
|
+
n.current.get(p)?.controller === f && n.current.delete(p), L && !X() && !e.getSnapshot().activeAssistantBlockId && D("idle");
|
|
2088
2088
|
const W = t.current;
|
|
2089
|
-
|
|
2089
|
+
L && W?.sessionId === p && O && await ee(W);
|
|
2090
2090
|
}
|
|
2091
2091
|
},
|
|
2092
2092
|
async submitPrompt(c, d) {
|
|
@@ -2110,39 +2110,39 @@ function _p({
|
|
|
2110
2110
|
if (t.current !== p)
|
|
2111
2111
|
throw new Error("Session changed before prompt submission");
|
|
2112
2112
|
typeof C != "boolean" && d?.signal?.throwIfAborted();
|
|
2113
|
-
const k = y ? [] : h, O = y ? [] : f,
|
|
2113
|
+
const k = y ? [] : h, O = y ? [] : f, L = d?.inputAnnotations && d.inputAnnotations.length > 0 ? d.inputAnnotations : void 0, W = d?.optimisticUserMessage !== !1, j = W && k.length === 0 && O.length === 0;
|
|
2114
2114
|
let N;
|
|
2115
|
-
|
|
2115
|
+
j && (e.appendLocalUserMessage(
|
|
2116
2116
|
c,
|
|
2117
2117
|
k,
|
|
2118
|
-
|
|
2118
|
+
L ? { inputAnnotations: L } : void 0,
|
|
2119
2119
|
[]
|
|
2120
2120
|
), ze && (N = e.getSnapshot().blocks.at(-1)?.id));
|
|
2121
|
-
let
|
|
2121
|
+
let Z;
|
|
2122
2122
|
try {
|
|
2123
|
-
|
|
2123
|
+
Z = await $t(
|
|
2124
2124
|
p,
|
|
2125
2125
|
c,
|
|
2126
2126
|
h,
|
|
2127
2127
|
f,
|
|
2128
2128
|
y,
|
|
2129
2129
|
d?.signal
|
|
2130
|
-
), d?.signal?.aborted &&
|
|
2130
|
+
), d?.signal?.aborted && Z.references.length > 0 && (await dt(p, Z.references), d.signal.throwIfAborted());
|
|
2131
2131
|
} catch (se) {
|
|
2132
|
-
throw W && !
|
|
2132
|
+
throw W && !j && e.appendLocalUserMessage(
|
|
2133
2133
|
c,
|
|
2134
2134
|
k,
|
|
2135
|
-
|
|
2135
|
+
L ? { inputAnnotations: L } : void 0,
|
|
2136
2136
|
Oo(O, [], !0)
|
|
2137
2137
|
), se instanceof sa ? se.reason : se;
|
|
2138
2138
|
}
|
|
2139
2139
|
const ie = {
|
|
2140
|
-
prompt:
|
|
2140
|
+
prompt: Z.content,
|
|
2141
2141
|
eventDetailMode: V()
|
|
2142
2142
|
};
|
|
2143
|
-
(
|
|
2143
|
+
(L || typeof d?.submittedPrompt == "string") && (ie._meta = {
|
|
2144
2144
|
...typeof d?.submittedPrompt == "string" ? { "qwen.submittedPrompt": d.submittedPrompt } : {},
|
|
2145
|
-
...
|
|
2145
|
+
...L ? { inputAnnotations: L } : {}
|
|
2146
2146
|
}), d?.retry && (ie.retry = !0), d?.onAdmissionStarted?.();
|
|
2147
2147
|
let Q;
|
|
2148
2148
|
try {
|
|
@@ -2151,22 +2151,22 @@ function _p({
|
|
|
2151
2151
|
} catch (se) {
|
|
2152
2152
|
Ot(p.sessionId, se);
|
|
2153
2153
|
const re = Xt(se);
|
|
2154
|
-
throw re && await dt(p,
|
|
2154
|
+
throw re && await dt(p, Z.references), W && !j && e.appendLocalUserMessage(
|
|
2155
2155
|
c,
|
|
2156
2156
|
k,
|
|
2157
|
-
|
|
2157
|
+
L ? { inputAnnotations: L } : void 0,
|
|
2158
2158
|
Oo(
|
|
2159
2159
|
O,
|
|
2160
|
-
re ? [] :
|
|
2160
|
+
re ? [] : Z.fileReferences,
|
|
2161
2161
|
re
|
|
2162
2162
|
)
|
|
2163
2163
|
), se;
|
|
2164
2164
|
}
|
|
2165
|
-
if (W && !
|
|
2165
|
+
if (W && !j && (e.appendLocalUserMessage(
|
|
2166
2166
|
c,
|
|
2167
2167
|
k,
|
|
2168
|
-
|
|
2169
|
-
Oo(O,
|
|
2168
|
+
L ? { inputAnnotations: L } : void 0,
|
|
2169
|
+
Oo(O, Z.fileReferences)
|
|
2170
2170
|
), ze && (N = e.getSnapshot().blocks.at(-1)?.id)), ze?.(p, {
|
|
2171
2171
|
promptId: Q.promptId,
|
|
2172
2172
|
label: c,
|
|
@@ -2174,7 +2174,7 @@ function _p({
|
|
|
2174
2174
|
}), d?.signal?.aborted)
|
|
2175
2175
|
try {
|
|
2176
2176
|
if ((await p.removePendingPrompt(Q.promptId)).removed)
|
|
2177
|
-
return st?.(p, Q.promptId), await dt(p,
|
|
2177
|
+
return st?.(p, Q.promptId), await dt(p, Z.references), { promptId: Q.promptId, removedAfterAbort: !0 };
|
|
2178
2178
|
} catch (se) {
|
|
2179
2179
|
console.warn(
|
|
2180
2180
|
"[submitPrompt] removePendingPrompt failed after abort",
|
|
@@ -2191,8 +2191,8 @@ function _p({
|
|
|
2191
2191
|
}
|
|
2192
2192
|
if (me(
|
|
2193
2193
|
p,
|
|
2194
|
-
|
|
2195
|
-
|
|
2194
|
+
Z.references,
|
|
2195
|
+
Z.fileReferences,
|
|
2196
2196
|
O
|
|
2197
2197
|
), d?.signal?.aborted)
|
|
2198
2198
|
throw d.signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
@@ -2200,9 +2200,9 @@ function _p({
|
|
|
2200
2200
|
},
|
|
2201
2201
|
async sendDetachedPrompt(c, d, p) {
|
|
2202
2202
|
try {
|
|
2203
|
-
const h = (p?.images ?? []).map((
|
|
2204
|
-
data:
|
|
2205
|
-
mimeType:
|
|
2203
|
+
const h = (p?.images ?? []).map((j) => ({
|
|
2204
|
+
data: j.data,
|
|
2205
|
+
mimeType: j.mimeType || j.mediaType || j.media_type || "image/*"
|
|
2206
2206
|
})), f = Ti(p?.files), C = Tn(
|
|
2207
2207
|
c,
|
|
2208
2208
|
d,
|
|
@@ -2219,21 +2219,21 @@ function _p({
|
|
|
2219
2219
|
h,
|
|
2220
2220
|
f,
|
|
2221
2221
|
y
|
|
2222
|
-
), O = p?.inputAnnotations && p.inputAnnotations.length > 0 ? p.inputAnnotations : void 0,
|
|
2222
|
+
), O = p?.inputAnnotations && p.inputAnnotations.length > 0 ? p.inputAnnotations : void 0, L = {
|
|
2223
2223
|
prompt: k.content,
|
|
2224
2224
|
eventDetailMode: V()
|
|
2225
2225
|
};
|
|
2226
|
-
(O || typeof p?.submittedPrompt == "string") && (
|
|
2226
|
+
(O || typeof p?.submittedPrompt == "string") && (L._meta = {
|
|
2227
2227
|
...typeof p?.submittedPrompt == "string" ? { "qwen.submittedPrompt": p.submittedPrompt } : {},
|
|
2228
2228
|
...O ? { inputAnnotations: O } : {}
|
|
2229
|
-
}), p?.retry && (
|
|
2229
|
+
}), p?.retry && (L.retry = !0), p?.onAdmissionStarted?.();
|
|
2230
2230
|
let W;
|
|
2231
2231
|
try {
|
|
2232
2232
|
W = await c.submitPrompt(
|
|
2233
|
-
|
|
2233
|
+
L
|
|
2234
2234
|
);
|
|
2235
|
-
} catch (
|
|
2236
|
-
throw Xt(
|
|
2235
|
+
} catch (j) {
|
|
2236
|
+
throw Xt(j) && await dt(c, k.references), j;
|
|
2237
2237
|
}
|
|
2238
2238
|
return p?.onAdmitted?.({ promptId: W.promptId }), { promptId: W.promptId };
|
|
2239
2239
|
} finally {
|
|
@@ -2258,7 +2258,7 @@ function _p({
|
|
|
2258
2258
|
controller: p
|
|
2259
2259
|
});
|
|
2260
2260
|
try {
|
|
2261
|
-
await _(c.cancel(), "Cancel timed out"), p && t.current === c && n.current.get(c.sessionId)?.controller === p && U().context?.recovery &&
|
|
2261
|
+
await _(c.cancel(), "Cancel timed out"), p && t.current === c && n.current.get(c.sessionId)?.controller === p && U().context?.recovery && ee(c);
|
|
2262
2262
|
} catch (h) {
|
|
2263
2263
|
throw be(
|
|
2264
2264
|
F,
|
|
@@ -2267,54 +2267,54 @@ function _p({
|
|
|
2267
2267
|
"cancel_prompt"
|
|
2268
2268
|
);
|
|
2269
2269
|
} finally {
|
|
2270
|
-
p && n.current.get(c.sessionId)?.controller === p && n.current.delete(c.sessionId), t.current?.sessionId === c.sessionId && !
|
|
2270
|
+
p && n.current.get(c.sessionId)?.controller === p && n.current.delete(c.sessionId), t.current?.sessionId === c.sessionId && !X() && D("idle");
|
|
2271
2271
|
}
|
|
2272
2272
|
},
|
|
2273
2273
|
async refreshModels(c, d) {
|
|
2274
2274
|
const p = t.current, h = U(), f = d?.reloadProviders === !1, C = Be, y = h.sessionContext, k = p?.client ?? B?.(), O = p?.workspaceCwd ?? (y?.kind === "workspace" ? y.cwd : h.workspaceCwd);
|
|
2275
2275
|
if (!k || !O || h.status !== "connected" || y && y.kind !== "workspace")
|
|
2276
2276
|
throw new Error("Model refresh requires a connected workspace.");
|
|
2277
|
-
const
|
|
2278
|
-
const
|
|
2277
|
+
const L = (N = U()) => t.current === p && N.sessionId === h.sessionId && _t(N.sessionContext) === _t(y) && N.workspaceCwd === h.workspaceCwd && N.status === "connected" && (p ? p.client === k : B?.() === k) && (!f || C === Be && N.currentModel === h.currentModel), W = (N) => {
|
|
2278
|
+
const Z = h.models?.find(
|
|
2279
2279
|
(ie) => ie.id === h.currentModel
|
|
2280
2280
|
);
|
|
2281
|
-
if (
|
|
2281
|
+
if (Z?.authType === "qwen-subscription" && !N?.some((ie) => ie.id === h.currentModel))
|
|
2282
2282
|
throw new Error(
|
|
2283
|
-
`The selected model, ${
|
|
2283
|
+
`The selected model, ${Z.baseModelId ?? Z.label}, is no longer available. Run /model to choose another model.`
|
|
2284
2284
|
);
|
|
2285
2285
|
};
|
|
2286
|
-
if (await c?.({ workspaceCwd: O, sessionId: p?.sessionId }), !
|
|
2286
|
+
if (await c?.({ workspaceCwd: O, sessionId: p?.sessionId }), !L()) return;
|
|
2287
2287
|
f && p && Uc(s, p);
|
|
2288
|
-
const
|
|
2288
|
+
const j = k.workspaceByCwd(O);
|
|
2289
2289
|
if (!f) {
|
|
2290
|
-
const N =
|
|
2290
|
+
const N = j.reloadModelProviders({
|
|
2291
2291
|
clientId: p?.clientId
|
|
2292
|
-
}),
|
|
2292
|
+
}), Z = await (p ? He(
|
|
2293
2293
|
p,
|
|
2294
2294
|
N,
|
|
2295
2295
|
"Reload models timed out"
|
|
2296
2296
|
) : N);
|
|
2297
|
-
if (!
|
|
2298
|
-
if (
|
|
2297
|
+
if (!L()) return;
|
|
2298
|
+
if (Z.status !== "applied" && !(Z.status === "deferred" && !p))
|
|
2299
2299
|
throw new Error("Unable to reload model providers.");
|
|
2300
2300
|
}
|
|
2301
2301
|
if (p) {
|
|
2302
2302
|
const N = await p.context();
|
|
2303
|
-
if (!
|
|
2304
|
-
const
|
|
2305
|
-
if (!
|
|
2306
|
-
if (!
|
|
2303
|
+
if (!L()) return;
|
|
2304
|
+
const Z = await j.workspaceProviders();
|
|
2305
|
+
if (!L()) return;
|
|
2306
|
+
if (!Z.initialized)
|
|
2307
2307
|
throw new Error(
|
|
2308
|
-
|
|
2308
|
+
Z.errors?.[0]?.error ?? "Unable to read the refreshed model list."
|
|
2309
2309
|
);
|
|
2310
2310
|
const ie = gr(N);
|
|
2311
|
-
if (N.sessionId !== p.sessionId || !ie &&
|
|
2311
|
+
if (N.sessionId !== p.sessionId || !ie && Z.current?.authType)
|
|
2312
2312
|
throw new Error("Unable to read the refreshed session model list.");
|
|
2313
2313
|
const Q = ie ?? { models: [] }, se = f || Q.models.some((re) => re.id === ie?.currentModel) ? ie?.currentModel : void 0;
|
|
2314
2314
|
S(
|
|
2315
|
-
(re) =>
|
|
2315
|
+
(re) => L(re) ? {
|
|
2316
2316
|
...re,
|
|
2317
|
-
providers:
|
|
2317
|
+
providers: Z,
|
|
2318
2318
|
models: Q.models,
|
|
2319
2319
|
...f && re.context ? {
|
|
2320
2320
|
context: {
|
|
@@ -2332,7 +2332,7 @@ function _p({
|
|
|
2332
2332
|
contextWindow: Q.models.find(
|
|
2333
2333
|
(ce) => ce.id === re.currentModel
|
|
2334
2334
|
)?.contextWindow ?? re.contextWindow,
|
|
2335
|
-
...(f || Q.models.length === 0 && !
|
|
2335
|
+
...(f || Q.models.length === 0 && !Z.current?.authType) && C === Be ? {
|
|
2336
2336
|
currentModel: se,
|
|
2337
2337
|
contextWindow: Q.models.find((ce) => ce.id === se)?.contextWindow ?? (re.currentModel === se ? re.contextWindow : void 0),
|
|
2338
2338
|
reasoning: re.currentModel === se ? re.reasoning : void 0
|
|
@@ -2340,24 +2340,24 @@ function _p({
|
|
|
2340
2340
|
} : re
|
|
2341
2341
|
), f || W(Q.models);
|
|
2342
2342
|
} else {
|
|
2343
|
-
const N = await
|
|
2344
|
-
if (!
|
|
2345
|
-
const { models:
|
|
2346
|
-
if (!N.initialized ||
|
|
2343
|
+
const N = await j.workspaceProviders();
|
|
2344
|
+
if (!L()) return;
|
|
2345
|
+
const { models: Z, currentModel: ie, contextWindow: Q } = Is(N);
|
|
2346
|
+
if (!N.initialized || Z.length === 0 && N.current?.authType && !(f && N.current.authType === "qwen-subscription"))
|
|
2347
2347
|
throw new Error(
|
|
2348
2348
|
N.errors?.[0]?.error ?? "Unable to read the refreshed model list."
|
|
2349
2349
|
);
|
|
2350
2350
|
S(
|
|
2351
|
-
(se) =>
|
|
2351
|
+
(se) => L(se) ? {
|
|
2352
2352
|
...se,
|
|
2353
2353
|
providers: N,
|
|
2354
|
-
models:
|
|
2354
|
+
models: Z,
|
|
2355
2355
|
...f ? {
|
|
2356
2356
|
currentModel: N.current?.authType ? ie : void 0,
|
|
2357
2357
|
contextWindow: N.current?.authType ? Q ?? (se.currentModel === ie ? se.contextWindow : void 0) : void 0
|
|
2358
2358
|
} : {}
|
|
2359
2359
|
} : se
|
|
2360
|
-
), f || W(
|
|
2360
|
+
), f || W(Z);
|
|
2361
2361
|
}
|
|
2362
2362
|
},
|
|
2363
2363
|
async setModel(c) {
|
|
@@ -2471,7 +2471,7 @@ function _p({
|
|
|
2471
2471
|
h = W;
|
|
2472
2472
|
}) : void 0;
|
|
2473
2473
|
f && (on = f);
|
|
2474
|
-
const C = ++Tt, y = U().currentModel, k = Be, O = Sn(p),
|
|
2474
|
+
const C = ++Tt, y = U().currentModel, k = Be, O = Sn(p), L = wi(
|
|
2475
2475
|
s,
|
|
2476
2476
|
p
|
|
2477
2477
|
);
|
|
@@ -2480,21 +2480,21 @@ function _p({
|
|
|
2480
2480
|
p,
|
|
2481
2481
|
p.setConfigOption("reasoning_effort", c, d),
|
|
2482
2482
|
"Set reasoning effort timed out",
|
|
2483
|
-
|
|
2483
|
+
L,
|
|
2484
2484
|
!1
|
|
2485
|
-
),
|
|
2486
|
-
if (!(c === "none" ?
|
|
2485
|
+
), j = _a(W.configOptions);
|
|
2486
|
+
if (!(c === "none" ? j?.enabled === !1 : c === "default" ? j !== void 0 : j?.enabled === !0 && j.effort === c) || d?.persist && W.persisted !== !0)
|
|
2487
2487
|
throw new Error(
|
|
2488
2488
|
`Daemon did not confirm reasoning effort ${JSON.stringify(c)}`
|
|
2489
2489
|
);
|
|
2490
|
-
const
|
|
2491
|
-
O() &&
|
|
2490
|
+
const Z = U();
|
|
2491
|
+
O() && L.isCurrent() && k === Be && Z.currentModel === y && C > vt && (vt = C, S((ie) => {
|
|
2492
2492
|
if (!O(ie) || k !== Be || ie.currentModel !== y)
|
|
2493
2493
|
return ie;
|
|
2494
2494
|
const Q = W.configOptions;
|
|
2495
2495
|
return {
|
|
2496
2496
|
...ie,
|
|
2497
|
-
reasoning:
|
|
2497
|
+
reasoning: j,
|
|
2498
2498
|
providers: d?.persist && W.persisted ? Mp(
|
|
2499
2499
|
ie.providers,
|
|
2500
2500
|
y,
|
|
@@ -2524,7 +2524,7 @@ function _p({
|
|
|
2524
2524
|
"set_reasoning_effort"
|
|
2525
2525
|
);
|
|
2526
2526
|
} finally {
|
|
2527
|
-
|
|
2527
|
+
L.finish(), O() && U().workflowModeStatus !== void 0 && ks(s, p, () => {
|
|
2528
2528
|
zt(p, O);
|
|
2529
2529
|
}), h?.(), on === f && (on = void 0);
|
|
2530
2530
|
}
|
|
@@ -2661,8 +2661,8 @@ function _p({
|
|
|
2661
2661
|
async createSession(c) {
|
|
2662
2662
|
let d, p = !1, h = !1, f = !1, C = !1;
|
|
2663
2663
|
const y = (k, O) => (p = !0, k.then(
|
|
2664
|
-
(
|
|
2665
|
-
h = !0, f && O(
|
|
2664
|
+
(L) => {
|
|
2665
|
+
h = !0, f && O(L).catch((W) => {
|
|
2666
2666
|
console.warn(
|
|
2667
2667
|
"[DaemonSessionActions] detach after timed-out create failed:",
|
|
2668
2668
|
W
|
|
@@ -2675,12 +2675,12 @@ function _p({
|
|
|
2675
2675
|
), k);
|
|
2676
2676
|
try {
|
|
2677
2677
|
u.current = !1;
|
|
2678
|
-
const k = U(), O = k.sessionId,
|
|
2678
|
+
const k = U(), O = k.sessionId, L = () => {
|
|
2679
2679
|
const ce = c?.getCurrentWorkspaceCwd?.();
|
|
2680
2680
|
return _t(
|
|
2681
2681
|
ce === void 0 ? void 0 : { kind: "workspace", cwd: ce }
|
|
2682
2682
|
);
|
|
2683
|
-
}, W =
|
|
2683
|
+
}, W = L();
|
|
2684
2684
|
if (d = yl(
|
|
2685
2685
|
c?.sessionContext,
|
|
2686
2686
|
c?.workspaceCwd,
|
|
@@ -2695,14 +2695,14 @@ function _p({
|
|
|
2695
2695
|
throw new Error(
|
|
2696
2696
|
"Per-call modelServiceId is only supported for standalone session creation"
|
|
2697
2697
|
);
|
|
2698
|
-
const
|
|
2698
|
+
const j = {
|
|
2699
2699
|
...c?.approvalMode !== void 0 ? { approvalMode: c.approvalMode } : {},
|
|
2700
2700
|
...c?.sourceType !== void 0 ? { sourceType: c.sourceType } : {},
|
|
2701
2701
|
...c?.worktree !== void 0 ? { worktree: c.worktree } : {},
|
|
2702
2702
|
...c?.branch !== void 0 ? { branch: c.branch } : {},
|
|
2703
2703
|
...c?.startupConfig ? { startupConfig: c.startupConfig } : {}
|
|
2704
|
-
}, N = t.current,
|
|
2705
|
-
if (
|
|
2704
|
+
}, N = t.current, Z = N && U().sessionId === N.sessionId ? N : void 0;
|
|
2705
|
+
if (Z) {
|
|
2706
2706
|
if (d?.kind === "standalone") {
|
|
2707
2707
|
const Ue = await y(
|
|
2708
2708
|
$({
|
|
@@ -2715,12 +2715,12 @@ function _p({
|
|
|
2715
2715
|
}
|
|
2716
2716
|
const ce = await _(
|
|
2717
2717
|
y(
|
|
2718
|
-
|
|
2719
|
-
...
|
|
2718
|
+
Z.client.createOrAttachSession({
|
|
2719
|
+
...R(),
|
|
2720
2720
|
...d?.kind === "workspace" ? { workspaceCwd: d.cwd } : {},
|
|
2721
|
-
...
|
|
2721
|
+
...j
|
|
2722
2722
|
}),
|
|
2723
|
-
(Ue) =>
|
|
2723
|
+
(Ue) => Z.client.detachSession(
|
|
2724
2724
|
Ue.sessionId,
|
|
2725
2725
|
Ue.clientId
|
|
2726
2726
|
)
|
|
@@ -2737,14 +2737,14 @@ function _p({
|
|
|
2737
2737
|
...c?.approvalMode !== void 0 ? { approvalMode: c.approvalMode } : {}
|
|
2738
2738
|
}) : q(
|
|
2739
2739
|
d?.kind === "workspace" ? d.cwd : void 0,
|
|
2740
|
-
|
|
2740
|
+
j
|
|
2741
2741
|
),
|
|
2742
2742
|
(ce) => ce.detach()
|
|
2743
2743
|
), Q = d?.kind === "standalone" ? await ie : await _(
|
|
2744
2744
|
ie,
|
|
2745
2745
|
"Create session timed out",
|
|
2746
2746
|
Cl(U().capabilities)
|
|
2747
|
-
), se = (U().sessionId !== O ||
|
|
2747
|
+
), se = (U().sessionId !== O || L() !== W || c?.sourceVersion !== void 0 && c.getCurrentSourceVersion?.() !== c.sourceVersion) && U().sessionId !== Q.sessionId;
|
|
2748
2748
|
if (u.current || se) {
|
|
2749
2749
|
if (c?.keepOnNavigation)
|
|
2750
2750
|
return c.navigationOutcome && (c.navigationOutcome.bound = !1), Q;
|
|
@@ -3076,6 +3076,18 @@ function _p({
|
|
|
3076
3076
|
);
|
|
3077
3077
|
}
|
|
3078
3078
|
},
|
|
3079
|
+
async rateAssistantTurn(c, d) {
|
|
3080
|
+
const p = t.current;
|
|
3081
|
+
if (p)
|
|
3082
|
+
try {
|
|
3083
|
+
await _(
|
|
3084
|
+
p.rateSessionTurn(c, d),
|
|
3085
|
+
"Assistant feedback telemetry timed out"
|
|
3086
|
+
);
|
|
3087
|
+
} catch (h) {
|
|
3088
|
+
console.warn("[web-shell] assistant feedback telemetry failed:", h);
|
|
3089
|
+
}
|
|
3090
|
+
},
|
|
3079
3091
|
async *generateSessionContent(c, d) {
|
|
3080
3092
|
yield* _e(
|
|
3081
3093
|
F,
|
|
@@ -3325,7 +3337,7 @@ function _p({
|
|
|
3325
3337
|
"Shell command failed",
|
|
3326
3338
|
"send_shell_command"
|
|
3327
3339
|
), p = Vc(d.sessionId);
|
|
3328
|
-
|
|
3340
|
+
D("waiting");
|
|
3329
3341
|
const h = new AbortController();
|
|
3330
3342
|
n.current.set(p, { controller: h });
|
|
3331
3343
|
try {
|
|
@@ -3338,7 +3350,7 @@ function _p({
|
|
|
3338
3350
|
"send_shell_command"
|
|
3339
3351
|
);
|
|
3340
3352
|
} finally {
|
|
3341
|
-
n.current.get(p)?.controller === h && n.current.delete(p), t.current?.sessionId === d.sessionId && !
|
|
3353
|
+
n.current.get(p)?.controller === h && n.current.delete(p), t.current?.sessionId === d.sessionId && !X() && D("idle");
|
|
3342
3354
|
}
|
|
3343
3355
|
},
|
|
3344
3356
|
async getTasks(c) {
|
|
@@ -4095,8 +4107,8 @@ function Kp() {
|
|
|
4095
4107
|
return;
|
|
4096
4108
|
}
|
|
4097
4109
|
if (o = g ?? o, m.type === "state_resync_required") {
|
|
4098
|
-
const E = m.data,
|
|
4099
|
-
l(u,
|
|
4110
|
+
const E = m.data, R = E && typeof E == "object" && "reason" in E && typeof E.reason == "string" ? E.reason : "state_resync_required";
|
|
4111
|
+
l(u, R);
|
|
4100
4112
|
return;
|
|
4101
4113
|
}
|
|
4102
4114
|
if (m.type === "session_closed" || m.type === "session_died" || m.type === "stream_error") {
|
|
@@ -7855,9 +7867,9 @@ const ym = {
|
|
|
7855
7867
|
"managed.mcp.noCatalog": "Для этого сервера каталог не опубликован.",
|
|
7856
7868
|
"managed.mcp.empty": "Для этой сессии MCP-серверы не настроены."
|
|
7857
7869
|
}, Tm = /* @__PURE__ */ new Map(), Cm = /* @__PURE__ */ new Map([
|
|
7858
|
-
["zh-CN", () => import("./i18n-zh-cn-
|
|
7870
|
+
["zh-CN", () => import("./i18n-zh-cn-C3owX7KJ.js").then(({ ZH: e }) => e)],
|
|
7859
7871
|
["zh-TW", () => import("./i18n-zh-tw-meIHyJiH.js").then(({ ZH_TW: e }) => e)],
|
|
7860
|
-
["ru", () => import("./i18n-ru-
|
|
7872
|
+
["ru", () => import("./i18n-ru-CQurqwP6.js").then(({ RU: e }) => e)]
|
|
7861
7873
|
]), Pl = ["en", "zh-CN", "zh-TW", "ru"], Ls = {
|
|
7862
7874
|
"You've used up your weekly credits.{{reset}} You can wait or run /upgrade to get more credits.": (e) => `You've used up your weekly credits.${e?.reset ?? ""} You can wait or run /upgrade to get more credits.`,
|
|
7863
7875
|
"You've used up your weekly credits.{{reset}} Please try again after the reset.": (e) => `You've used up your weekly credits.${e?.reset ?? ""} Please try again after the reset.`,
|
|
@@ -10104,6 +10116,8 @@ Write the explanation as a self-contained single-file HTML (inline CSS, no exter
|
|
|
10104
10116
|
"sidebar.sessionIssueStateNotPlanned": "Not planned",
|
|
10105
10117
|
"sidebar.userInputNeeded": "User input needed",
|
|
10106
10118
|
"sidebar.userInputNeededShort": "Input",
|
|
10119
|
+
"sidebar.continuationNeeded": "Continue execution needed",
|
|
10120
|
+
"sidebar.continuationNeededShort": "Continue",
|
|
10107
10121
|
"sidebar.completedUnread": "Finished",
|
|
10108
10122
|
"sidebar.pin": "Pin",
|
|
10109
10123
|
"sidebar.selectSessions": "Select sessions",
|
|
@@ -12735,20 +12749,21 @@ class Wm {
|
|
|
12735
12749
|
const m = s.snapshot.page.sessions.map((g) => {
|
|
12736
12750
|
if (g.workspaceCwd && g.workspaceCwd !== t)
|
|
12737
12751
|
return g;
|
|
12738
|
-
const v = a.get(g.sessionId), I = v?.clientCount ?? 0, E = v?.hasActivePrompt ?? !1,
|
|
12752
|
+
const v = a.get(g.sessionId), I = v?.clientCount ?? 0, E = v?.hasActivePrompt ?? !1, R = v?.activeWorkState, q = v?.isWaitingForPermission ?? !1, $ = v?.isWaitingForUserQuestion ?? !1, M = v?.hasTurnError ?? g.hasTurnError, B = i && g.isArchived !== !0 ? v?.updatedAt : void 0, U = B !== void 0 ? Date.parse(B) : Number.NaN;
|
|
12739
12753
|
Number.isFinite(U) && r.add(g.sessionId);
|
|
12740
|
-
const
|
|
12741
|
-
return g.clientCount === I && g.hasActivePrompt === E && g.activeWorkState ===
|
|
12754
|
+
const P = B !== void 0 && Number.isFinite(U) && U > er(g), V = P ? B : g.updatedAt, X = P ? void 0 : g.needsContinuation;
|
|
12755
|
+
return g.clientCount === I && g.hasActivePrompt === E && g.activeWorkState === R && g.hasRunningBackgroundTasks === v?.hasRunningBackgroundTasks && JSON.stringify(g.backgroundTurn) === JSON.stringify(v?.backgroundTurn) && g.isWaitingForPermission === q && g.isWaitingForUserQuestion === $ && g.hasTurnError === M && g.needsContinuation === X && g.updatedAt === V ? g : (l = !0, g.updatedAt !== V && (u = !0), {
|
|
12742
12756
|
...g,
|
|
12743
12757
|
clientCount: I,
|
|
12744
12758
|
hasActivePrompt: E,
|
|
12745
|
-
activeWorkState:
|
|
12759
|
+
activeWorkState: R,
|
|
12746
12760
|
backgroundTurn: v?.backgroundTurn,
|
|
12747
12761
|
hasRunningBackgroundTasks: v?.hasRunningBackgroundTasks,
|
|
12748
12762
|
isWaitingForPermission: q,
|
|
12749
12763
|
isWaitingForUserQuestion: $,
|
|
12750
12764
|
hasTurnError: M,
|
|
12751
|
-
|
|
12765
|
+
needsContinuation: X,
|
|
12766
|
+
...V !== void 0 ? { updatedAt: V } : {}
|
|
12752
12767
|
});
|
|
12753
12768
|
});
|
|
12754
12769
|
l && (u && s.query.options.sortBy !== "lastUserPromptAt" && m.sort(
|
|
@@ -13619,8 +13634,8 @@ function Fm({
|
|
|
13619
13634
|
];
|
|
13620
13635
|
let I;
|
|
13621
13636
|
for (const E of v) {
|
|
13622
|
-
const
|
|
13623
|
-
|
|
13637
|
+
const R = await (E === "workspace" ? u.setMcpServerEnabled(s, i === "enable") : l.setUserMcpServerEnabled(s, i === "enable"));
|
|
13638
|
+
R.changed !== void 0 && (I = (I ?? !1) || R.changed);
|
|
13624
13639
|
}
|
|
13625
13640
|
return {
|
|
13626
13641
|
serverName: s,
|
|
@@ -14453,11 +14468,11 @@ function Dv({
|
|
|
14453
14468
|
[o, e, t, a, s]
|
|
14454
14469
|
), l = J(/* @__PURE__ */ new Set()), u = J(i);
|
|
14455
14470
|
u.current = i;
|
|
14456
|
-
const m = J(void 0), g = J(void 0), v = J(0), I = J(n), [E,
|
|
14471
|
+
const m = J(void 0), g = J(void 0), v = J(0), I = J(n), [E, R] = wt(void 0), [q, $] = wt(void 0), [M, B] = wt(!1), [U, P] = wt(
|
|
14457
14472
|
o ? "connecting" : "idle"
|
|
14458
14473
|
), V = J(U);
|
|
14459
14474
|
V.current = U;
|
|
14460
|
-
const [
|
|
14475
|
+
const [X, ae] = wt(void 0), [et, F] = wt(
|
|
14461
14476
|
i
|
|
14462
14477
|
);
|
|
14463
14478
|
et !== i && (F(i), $(void 0), B(!1));
|
|
@@ -14471,7 +14486,7 @@ function Dv({
|
|
|
14471
14486
|
g.current = Te;
|
|
14472
14487
|
}
|
|
14473
14488
|
return g.current;
|
|
14474
|
-
}, [i]),
|
|
14489
|
+
}, [i]), D = de(() => {
|
|
14475
14490
|
if (!i)
|
|
14476
14491
|
return Promise.reject(new Error("Daemon workspace client unavailable"));
|
|
14477
14492
|
m.current !== i && (m.current = i, v.current++);
|
|
@@ -14481,41 +14496,41 @@ function Dv({
|
|
|
14481
14496
|
new Error("Capabilities refresh was superseded by a client change")
|
|
14482
14497
|
);
|
|
14483
14498
|
}, at = i.capabilities().then(
|
|
14484
|
-
(Ae) => m.current !== i || v.current !== Te ? st() : (
|
|
14499
|
+
(Ae) => m.current !== i || v.current !== Te ? st() : (R(Ae), P("connected"), ae(void 0), Ae),
|
|
14485
14500
|
(Ae) => {
|
|
14486
14501
|
if (m.current !== i || v.current !== Te)
|
|
14487
14502
|
return st();
|
|
14488
|
-
throw ae(Ae instanceof Error ? Ae : new Error(String(Ae))),
|
|
14503
|
+
throw ae(Ae instanceof Error ? Ae : new Error(String(Ae))), P("error"), Ae;
|
|
14489
14504
|
}
|
|
14490
14505
|
);
|
|
14491
14506
|
return g.current = at, at;
|
|
14492
14507
|
}, [i]);
|
|
14493
14508
|
ct(() => {
|
|
14494
14509
|
if (!i) return;
|
|
14495
|
-
|
|
14510
|
+
P("connecting"), ae(void 0), R(void 0);
|
|
14496
14511
|
const Te = l.current;
|
|
14497
14512
|
Te.delete(i);
|
|
14498
14513
|
let st = !1;
|
|
14499
14514
|
const at = S(), Ae = v.current;
|
|
14500
14515
|
return at.then((Tt) => {
|
|
14501
|
-
!st && m.current === i && g.current === at && (
|
|
14516
|
+
!st && m.current === i && g.current === at && (R(Tt), P("connected"));
|
|
14502
14517
|
}).catch((Tt) => {
|
|
14503
|
-
!st && m.current === i && v.current === Ae && (ae(Tt instanceof Error ? Tt : new Error(String(Tt))),
|
|
14518
|
+
!st && m.current === i && v.current === Ae && (ae(Tt instanceof Error ? Tt : new Error(String(Tt))), P("error"));
|
|
14504
14519
|
}), () => {
|
|
14505
14520
|
st = !0, Te.add(i), queueMicrotask(() => {
|
|
14506
14521
|
Te.delete(i) && (i.dispose(), s?.dispose());
|
|
14507
14522
|
});
|
|
14508
14523
|
};
|
|
14509
14524
|
}, [i, S, s]);
|
|
14510
|
-
const
|
|
14525
|
+
const H = J(0), z = J(!1), Y = J(
|
|
14511
14526
|
void 0
|
|
14512
14527
|
), oe = de(
|
|
14513
14528
|
(Te, st = !1) => {
|
|
14514
|
-
const at = ++
|
|
14529
|
+
const at = ++H.current;
|
|
14515
14530
|
z.current = !0, $(void 0), B(!1), Promise.resolve().then(() => Te.brand()).then((Ae) => {
|
|
14516
|
-
|
|
14531
|
+
H.current === at && ($(Ae), B(!0));
|
|
14517
14532
|
}).catch((Ae) => {
|
|
14518
|
-
if (
|
|
14533
|
+
if (H.current === at) {
|
|
14519
14534
|
if (Ae instanceof kn && Ae.status === 404) {
|
|
14520
14535
|
B(!0);
|
|
14521
14536
|
return;
|
|
@@ -14526,19 +14541,19 @@ function Dv({
|
|
|
14526
14541
|
);
|
|
14527
14542
|
return;
|
|
14528
14543
|
}
|
|
14529
|
-
|
|
14530
|
-
|
|
14544
|
+
Y.current = setTimeout(() => {
|
|
14545
|
+
Y.current = void 0;
|
|
14531
14546
|
const Tt = u.current;
|
|
14532
|
-
Tt !== void 0 &&
|
|
14547
|
+
Tt !== void 0 && H.current === at && oe(Tt, !0);
|
|
14533
14548
|
}, Vm);
|
|
14534
14549
|
}
|
|
14535
14550
|
}).finally(() => {
|
|
14536
|
-
|
|
14551
|
+
H.current === at && (z.current = !1);
|
|
14537
14552
|
});
|
|
14538
14553
|
},
|
|
14539
14554
|
[]
|
|
14540
14555
|
), ne = de(() => {
|
|
14541
|
-
|
|
14556
|
+
H.current++, z.current = !1, Y.current !== void 0 && (clearTimeout(Y.current), Y.current = void 0);
|
|
14542
14557
|
}, []);
|
|
14543
14558
|
ct(() => {
|
|
14544
14559
|
if (i)
|
|
@@ -14555,7 +14570,7 @@ function Dv({
|
|
|
14555
14570
|
const vt = s.getSnapshot() === "available", Be = vt && !st;
|
|
14556
14571
|
if (st = vt, br(i).setPaused(!vt), !vt) return;
|
|
14557
14572
|
const on = s.recoveredCapabilities;
|
|
14558
|
-
on && (Be || V.current !== "connected") && (m.current = i, v.current++, g.current = Promise.resolve(on),
|
|
14573
|
+
on && (Be || V.current !== "connected") && (m.current = i, v.current++, g.current = Promise.resolve(on), R(on), P("connected"), ae(void 0), Be && qe.current());
|
|
14559
14574
|
}, Ae = s.subscribe(at);
|
|
14560
14575
|
at();
|
|
14561
14576
|
const Tt = () => {
|
|
@@ -14582,12 +14597,12 @@ function Dv({
|
|
|
14582
14597
|
baseUrl: e,
|
|
14583
14598
|
workspaceCwd: E?.workspaceCwd ?? n,
|
|
14584
14599
|
status: U,
|
|
14585
|
-
error:
|
|
14600
|
+
error: X,
|
|
14586
14601
|
capabilities: E,
|
|
14587
14602
|
brand: q,
|
|
14588
14603
|
brandSettled: M,
|
|
14589
14604
|
getCapabilities: S,
|
|
14590
|
-
refreshCapabilities:
|
|
14605
|
+
refreshCapabilities: D,
|
|
14591
14606
|
refreshBrand: Pe,
|
|
14592
14607
|
actions: Ie
|
|
14593
14608
|
};
|
|
@@ -14597,12 +14612,12 @@ function Dv({
|
|
|
14597
14612
|
e,
|
|
14598
14613
|
n,
|
|
14599
14614
|
U,
|
|
14600
|
-
|
|
14615
|
+
X,
|
|
14601
14616
|
E,
|
|
14602
14617
|
q,
|
|
14603
14618
|
M,
|
|
14604
14619
|
S,
|
|
14605
|
-
|
|
14620
|
+
D,
|
|
14606
14621
|
Pe,
|
|
14607
14622
|
Ie
|
|
14608
14623
|
]);
|
|
@@ -15374,7 +15389,7 @@ function nw(e) {
|
|
|
15374
15389
|
if (g.status === "in_progress" && I !== "in_progress")
|
|
15375
15390
|
a.has(v) && (a.delete(v), o.delete(v), t.delete(v)), o.get(v) === void 0 && (o.set(v, u), m !== void 0 && (s(v).startTs = m));
|
|
15376
15391
|
else if (g.status === "completed" && I !== "completed" && I !== void 0) {
|
|
15377
|
-
const E = o.get(v),
|
|
15392
|
+
const E = o.get(v), R = E && u ? Tg(E, u) : void 0, q = t.get(v)?.startTs, $ = q !== void 0 && m !== void 0 ? Sg(r, q, m) : void 0, M = Cg(R, $);
|
|
15378
15393
|
if (m !== void 0 || M) {
|
|
15379
15394
|
const B = s(v);
|
|
15380
15395
|
m !== void 0 && (B.endTs = m), M && (B.resources = M);
|
|
@@ -15493,10 +15508,10 @@ function xg(e) {
|
|
|
15493
15508
|
a.set(I.taskId, s), r.add(I.taskId);
|
|
15494
15509
|
const E = n.get(I.taskId);
|
|
15495
15510
|
o.set(I.turnId, E);
|
|
15496
|
-
const
|
|
15511
|
+
const R = t.get(
|
|
15497
15512
|
I.toolUseId ?? Ct(E, "toolUseId") ?? ""
|
|
15498
15513
|
);
|
|
15499
|
-
|
|
15514
|
+
R && (R.awaitingProcessing = !1);
|
|
15500
15515
|
}
|
|
15501
15516
|
return {
|
|
15502
15517
|
agentUpdates: t,
|
|
@@ -15648,19 +15663,19 @@ function sw(e, t = {}) {
|
|
|
15648
15663
|
lastConsumedTaskIndex: g,
|
|
15649
15664
|
automaticTaskIds: v
|
|
15650
15665
|
} = xg(e);
|
|
15651
|
-
let I = null, E = null,
|
|
15666
|
+
let I = null, E = null, R = !1, q;
|
|
15652
15667
|
const $ = /* @__PURE__ */ new Map(), M = new Set(
|
|
15653
15668
|
e.flatMap(
|
|
15654
15669
|
(U) => U.kind === "tool" ? [U.toolCallId] : []
|
|
15655
15670
|
)
|
|
15656
15671
|
), B = /* @__PURE__ */ new Set();
|
|
15657
15672
|
for (let U = 0; U < e.length; U++) {
|
|
15658
|
-
const
|
|
15659
|
-
|
|
15673
|
+
const P = e[U], V = P.serverTimestamp ?? P.clientReceivedAt, X = Xe(
|
|
15674
|
+
P.meta
|
|
15660
15675
|
), ae = Pa(
|
|
15661
|
-
|
|
15662
|
-
) ?? (
|
|
15663
|
-
if (et !== void 0 && q !== void 0 && et !== q && (I = null, E = null,
|
|
15676
|
+
P.backgroundTurn ?? X?.backgroundTurn
|
|
15677
|
+
) ?? (P.promptId ? $.get(P.promptId) : void 0), et = ae?.turnId ?? P.promptId;
|
|
15678
|
+
if (et !== void 0 && q !== void 0 && et !== q && (I = null, E = null, R = !0), et !== void 0 && (q = et), ae && X?.source !== "background_task_completed" && !(P.kind === "status" && P.source === "background_task_completed") && !("parentToolCallId" in P && P.parentToolCallId) && !$.has(ae.turnId) && ($.set(ae.turnId, ae), n.push({
|
|
15664
15679
|
id: `background-turn:${ae.turnId}`,
|
|
15665
15680
|
role: "system",
|
|
15666
15681
|
variant: "info",
|
|
@@ -15672,57 +15687,57 @@ function sw(e, t = {}) {
|
|
|
15672
15687
|
},
|
|
15673
15688
|
backgroundTurn: ae,
|
|
15674
15689
|
timestamp: ae.startedAt,
|
|
15675
|
-
sourceBlockIds: [
|
|
15676
|
-
}), I = null, E = null,
|
|
15690
|
+
sourceBlockIds: [P.id]
|
|
15691
|
+
}), I = null, E = null, R = !0), X?.source === "background_notification_turn_started" || P.kind === "status" && P.source === "background_notification_turn_started")
|
|
15677
15692
|
continue;
|
|
15678
|
-
if (
|
|
15693
|
+
if (P.kind === "status" && P.source === "background_task_completed" || (P.kind === "assistant" || P.kind === "user") && X?.source === "background_task_completed") {
|
|
15679
15694
|
const S = Xe(
|
|
15680
|
-
|
|
15681
|
-
),
|
|
15682
|
-
|
|
15683
|
-
const
|
|
15684
|
-
if (!
|
|
15695
|
+
P.kind === "status" ? P.data : X?.backgroundTask
|
|
15696
|
+
), D = Ct(S, "taskId");
|
|
15697
|
+
D && B.add(D);
|
|
15698
|
+
const H = (g.get(D ?? "") ?? -1) <= U;
|
|
15699
|
+
if (!H || S?.kind === "agent" && M.has(Ct(S, "toolUseId") ?? ""))
|
|
15685
15700
|
continue;
|
|
15686
15701
|
n.push({
|
|
15687
|
-
id:
|
|
15702
|
+
id: P.id,
|
|
15688
15703
|
role: "system",
|
|
15689
15704
|
variant: "info",
|
|
15690
15705
|
source: "background_task_completed",
|
|
15691
|
-
content:
|
|
15706
|
+
content: P.text,
|
|
15692
15707
|
data: {
|
|
15693
15708
|
...S,
|
|
15694
|
-
awaitingProcessing:
|
|
15709
|
+
awaitingProcessing: H
|
|
15695
15710
|
},
|
|
15696
15711
|
timestamp: V,
|
|
15697
|
-
sourceBlockIds: [
|
|
15698
|
-
}), I = null, E = null,
|
|
15712
|
+
sourceBlockIds: [P.id]
|
|
15713
|
+
}), I = null, E = null, R = !0;
|
|
15699
15714
|
continue;
|
|
15700
15715
|
}
|
|
15701
15716
|
const F = Ct(
|
|
15702
|
-
Xe(
|
|
15717
|
+
Xe(X?.backgroundTask),
|
|
15703
15718
|
"taskId"
|
|
15704
15719
|
);
|
|
15705
|
-
if (!(
|
|
15706
|
-
switch (
|
|
15720
|
+
if (!(X?.source === "background_notification" && F && (ae || B.has(F) || v.has(F))))
|
|
15721
|
+
switch (P.kind) {
|
|
15707
15722
|
case "user": {
|
|
15708
|
-
const S =
|
|
15723
|
+
const S = P;
|
|
15709
15724
|
if (yd(S)) {
|
|
15710
|
-
I = null, E = null,
|
|
15711
|
-
id:
|
|
15725
|
+
I = null, E = null, R = !0, n.push({
|
|
15726
|
+
id: P.id,
|
|
15712
15727
|
role: "system",
|
|
15713
15728
|
content: S.text,
|
|
15714
15729
|
variant: "info",
|
|
15715
15730
|
source: "background_notification",
|
|
15716
15731
|
data: Sd(S),
|
|
15717
15732
|
timestamp: V,
|
|
15718
|
-
sourceBlockIds: [
|
|
15733
|
+
sourceBlockIds: [P.id]
|
|
15719
15734
|
});
|
|
15720
15735
|
break;
|
|
15721
15736
|
}
|
|
15722
|
-
I = null, E = null,
|
|
15723
|
-
const
|
|
15737
|
+
I = null, E = null, R = !1;
|
|
15738
|
+
const D = Xe(
|
|
15724
15739
|
S.meta
|
|
15725
|
-
),
|
|
15740
|
+
), H = Ct(D, "source"), z = S.meta?.sourceAnnotation, Y = S.meta?.inputAnnotations, oe = S.images?.map((Ie) => ({
|
|
15726
15741
|
data: Ie.data,
|
|
15727
15742
|
mimeType: Ie.mimeType || "image/*",
|
|
15728
15743
|
...Ie.attachmentId ? { attachmentId: Ie.attachmentId } : {}
|
|
@@ -15733,27 +15748,27 @@ function sw(e, t = {}) {
|
|
|
15733
15748
|
...Ie.text !== void 0 ? { text: Ie.text } : {},
|
|
15734
15749
|
...Ie.attachmentId ? { attachmentId: Ie.attachmentId } : {}
|
|
15735
15750
|
}));
|
|
15736
|
-
if (
|
|
15751
|
+
if (H === "mid_turn_message_injected") {
|
|
15737
15752
|
n.push({
|
|
15738
|
-
id:
|
|
15753
|
+
id: P.id,
|
|
15739
15754
|
role: "system",
|
|
15740
15755
|
content: S.text,
|
|
15741
15756
|
variant: "info",
|
|
15742
|
-
source:
|
|
15757
|
+
source: H,
|
|
15743
15758
|
timestamp: V,
|
|
15744
15759
|
...oe && oe.length > 0 ? { images: oe } : {},
|
|
15745
15760
|
...ne && ne.length > 0 ? { files: ne } : {}
|
|
15746
|
-
}),
|
|
15761
|
+
}), R = !0;
|
|
15747
15762
|
break;
|
|
15748
15763
|
}
|
|
15749
|
-
const Pe = Ql(S,
|
|
15750
|
-
id:
|
|
15764
|
+
const Pe = Ql(S, D), qe = {
|
|
15765
|
+
id: P.id,
|
|
15751
15766
|
role: "user",
|
|
15752
15767
|
content: S.text,
|
|
15753
15768
|
timestamp: V,
|
|
15754
|
-
sourceBlockIds: [
|
|
15755
|
-
...
|
|
15756
|
-
...
|
|
15769
|
+
sourceBlockIds: [P.id],
|
|
15770
|
+
...H ? { source: H } : {},
|
|
15771
|
+
...Y?.length ? { inputAnnotations: Y } : {},
|
|
15757
15772
|
...z ? { sentFrom: z } : {},
|
|
15758
15773
|
...Pe ? { agentMessage: Pe } : {},
|
|
15759
15774
|
...Pe?.author ? {
|
|
@@ -15767,68 +15782,68 @@ function sw(e, t = {}) {
|
|
|
15767
15782
|
break;
|
|
15768
15783
|
}
|
|
15769
15784
|
case "assistant": {
|
|
15770
|
-
const S =
|
|
15771
|
-
if (
|
|
15785
|
+
const S = P, { parentToolCallId: D } = S, H = Td(S);
|
|
15786
|
+
if (H && (I = null, E = null, R = !0), H?.source === "background_notification") {
|
|
15772
15787
|
n.push({
|
|
15773
|
-
id:
|
|
15788
|
+
id: P.id,
|
|
15774
15789
|
role: "system",
|
|
15775
15790
|
content: S.text,
|
|
15776
15791
|
variant: "info",
|
|
15777
15792
|
source: "background_notification",
|
|
15778
|
-
data:
|
|
15793
|
+
data: H.data,
|
|
15779
15794
|
timestamp: V,
|
|
15780
|
-
sourceBlockIds: [
|
|
15795
|
+
sourceBlockIds: [P.id]
|
|
15781
15796
|
});
|
|
15782
15797
|
break;
|
|
15783
15798
|
}
|
|
15784
|
-
const z = Xe(S.meta),
|
|
15785
|
-
if (
|
|
15799
|
+
const z = Xe(S.meta), Y = Ct(z, "source"), oe = pg(z ?? void 0);
|
|
15800
|
+
if (H?.source === "vision_bridge_notice") {
|
|
15786
15801
|
n.push({
|
|
15787
|
-
id:
|
|
15802
|
+
id: P.id,
|
|
15788
15803
|
role: "system",
|
|
15789
15804
|
content: S.text,
|
|
15790
15805
|
variant: "info",
|
|
15791
15806
|
source: "vision_bridge_notice",
|
|
15792
|
-
...
|
|
15807
|
+
...H.data !== void 0 ? { data: H.data } : {},
|
|
15793
15808
|
timestamp: V
|
|
15794
15809
|
});
|
|
15795
15810
|
break;
|
|
15796
15811
|
}
|
|
15797
|
-
if (
|
|
15798
|
-
|
|
15799
|
-
id: `${
|
|
15812
|
+
if (H?.source === "context_compression") {
|
|
15813
|
+
H.notice && n.push({
|
|
15814
|
+
id: `${P.id}-notice`,
|
|
15800
15815
|
role: "system",
|
|
15801
15816
|
content: S.text,
|
|
15802
15817
|
variant: "info",
|
|
15803
15818
|
source: "context_compression",
|
|
15804
|
-
data:
|
|
15819
|
+
data: H.noticePayload,
|
|
15805
15820
|
timestamp: V
|
|
15806
15821
|
});
|
|
15807
|
-
const Te =
|
|
15822
|
+
const Te = H.compression;
|
|
15808
15823
|
if (!Te || Te.phase === "progress" && S.streaming !== !0)
|
|
15809
15824
|
break;
|
|
15810
15825
|
n.push({
|
|
15811
|
-
id:
|
|
15826
|
+
id: P.id,
|
|
15812
15827
|
role: "system",
|
|
15813
15828
|
content: S.text,
|
|
15814
15829
|
variant: "info",
|
|
15815
15830
|
source: "context_compression",
|
|
15816
15831
|
// The raw payload, not the parsed view: SystemMessage falls back to
|
|
15817
15832
|
// `content` when it meets a payload this client cannot read.
|
|
15818
|
-
data:
|
|
15833
|
+
data: H.compressionPayload,
|
|
15819
15834
|
timestamp: V
|
|
15820
15835
|
});
|
|
15821
15836
|
break;
|
|
15822
15837
|
}
|
|
15823
|
-
const ne =
|
|
15838
|
+
const ne = D ? void 0 : Ql(S, z);
|
|
15824
15839
|
if (ne?.kind === "agent_message") {
|
|
15825
15840
|
n.push({
|
|
15826
|
-
id:
|
|
15841
|
+
id: P.id,
|
|
15827
15842
|
role: "assistant",
|
|
15828
15843
|
content: S.text,
|
|
15829
15844
|
isStreaming: S.streaming,
|
|
15830
15845
|
timestamp: V,
|
|
15831
|
-
sourceBlockIds: [
|
|
15846
|
+
sourceBlockIds: [P.id],
|
|
15832
15847
|
agentMessage: ne,
|
|
15833
15848
|
...ne.author ? {
|
|
15834
15849
|
author: {
|
|
@@ -15837,13 +15852,13 @@ function sw(e, t = {}) {
|
|
|
15837
15852
|
}
|
|
15838
15853
|
} : {},
|
|
15839
15854
|
...S.usage ? { usage: S.usage } : {}
|
|
15840
|
-
}), I = null, E = null,
|
|
15855
|
+
}), I = null, E = null, R = !0;
|
|
15841
15856
|
break;
|
|
15842
15857
|
}
|
|
15843
15858
|
if (!S.text && !S.usage) break;
|
|
15844
|
-
const Pe =
|
|
15859
|
+
const Pe = D ? s.get(D) : void 0;
|
|
15845
15860
|
if (Pe) {
|
|
15846
|
-
Jl(Pe, S.text,
|
|
15861
|
+
Jl(Pe, S.text, P.id);
|
|
15847
15862
|
break;
|
|
15848
15863
|
}
|
|
15849
15864
|
const qe = oe.length > 0 ? null : Cr(S.text);
|
|
@@ -15851,27 +15866,27 @@ function sw(e, t = {}) {
|
|
|
15851
15866
|
let Te = null, st = !1, at = 0, Ae = 0, Tt = 0, vt = null;
|
|
15852
15867
|
for (const Be of qe)
|
|
15853
15868
|
Be.kind === "insight" ? Be.data.type === "insight_progress" ? Te = Be.data : Be.data.type === "insight_ready" ? (st = !0, n.push({
|
|
15854
|
-
id: `${
|
|
15869
|
+
id: `${P.id}-ir-${at++}`,
|
|
15855
15870
|
role: "insight_ready",
|
|
15856
15871
|
path: Be.data.path,
|
|
15857
15872
|
timestamp: V,
|
|
15858
|
-
sourceBlockIds: [
|
|
15873
|
+
sourceBlockIds: [P.id]
|
|
15859
15874
|
})) : Be.data.type === "insight_error" && (st = !0, n.push({
|
|
15860
|
-
id: `${
|
|
15875
|
+
id: `${P.id}-ie-${Ae++}`,
|
|
15861
15876
|
role: "insight_error",
|
|
15862
15877
|
error: Be.data.error,
|
|
15863
15878
|
timestamp: V,
|
|
15864
|
-
sourceBlockIds: [
|
|
15879
|
+
sourceBlockIds: [P.id]
|
|
15865
15880
|
})) : (n.push({
|
|
15866
|
-
id: o ? `${
|
|
15881
|
+
id: o ? `${P.id}-t-${Tt++}` : `${P.id}-t-${n.length}`,
|
|
15867
15882
|
role: "assistant",
|
|
15868
15883
|
content: Be.text,
|
|
15869
|
-
...
|
|
15870
|
-
...
|
|
15884
|
+
...Y ? { source: Y } : {},
|
|
15885
|
+
...D ? { parentToolCallId: D } : {},
|
|
15871
15886
|
isStreaming: S.streaming,
|
|
15872
15887
|
...ae ? { backgroundTurn: ae } : {},
|
|
15873
15888
|
timestamp: V,
|
|
15874
|
-
sourceBlockIds: [
|
|
15889
|
+
sourceBlockIds: [P.id]
|
|
15875
15890
|
}), I = n.length - 1, vt = I, E = null);
|
|
15876
15891
|
if (S.branchRecordId && vt !== null) {
|
|
15877
15892
|
const Be = n[vt];
|
|
@@ -15881,18 +15896,18 @@ function sw(e, t = {}) {
|
|
|
15881
15896
|
});
|
|
15882
15897
|
}
|
|
15883
15898
|
Te && !st && n.push({
|
|
15884
|
-
id: `${
|
|
15899
|
+
id: `${P.id}-ip`,
|
|
15885
15900
|
role: "insight_progress",
|
|
15886
15901
|
stage: Te.stage,
|
|
15887
15902
|
progress: Te.progress,
|
|
15888
15903
|
detail: Te.detail,
|
|
15889
15904
|
timestamp: V,
|
|
15890
|
-
sourceBlockIds: [
|
|
15891
|
-
}),
|
|
15905
|
+
sourceBlockIds: [P.id]
|
|
15906
|
+
}), R = !0;
|
|
15892
15907
|
break;
|
|
15893
15908
|
}
|
|
15894
|
-
const Ie = I !== null ? n[I] : void 0, ze = Ie?.role === "assistant" && Ie.parentToolCallId ===
|
|
15895
|
-
if (ze && ze.source === "slash_command" == (
|
|
15909
|
+
const Ie = I !== null ? n[I] : void 0, ze = Ie?.role === "assistant" && Ie.parentToolCallId === D ? Ie : void 0;
|
|
15910
|
+
if (ze && ze.source === "slash_command" == (Y === "slash_command") && !R && S.segmentId === void 0 && !Fg(S)) {
|
|
15896
15911
|
const Te = Kl(ze.usage, S.usage);
|
|
15897
15912
|
n[I] = {
|
|
15898
15913
|
...ze,
|
|
@@ -15904,25 +15919,25 @@ function sw(e, t = {}) {
|
|
|
15904
15919
|
]
|
|
15905
15920
|
} : {},
|
|
15906
15921
|
isStreaming: S.streaming,
|
|
15907
|
-
sourceBlockIds: vo(ze.sourceBlockIds,
|
|
15922
|
+
sourceBlockIds: vo(ze.sourceBlockIds, P.id),
|
|
15908
15923
|
...S.branchRecordId ? { branchRecordId: S.branchRecordId } : {},
|
|
15909
15924
|
...Te ? { usage: Te } : {}
|
|
15910
|
-
},
|
|
15925
|
+
}, R = !1, E = null;
|
|
15911
15926
|
} else if (S.text.trim().length > 0)
|
|
15912
15927
|
n.push({
|
|
15913
|
-
id:
|
|
15928
|
+
id: P.id,
|
|
15914
15929
|
role: "assistant",
|
|
15915
15930
|
content: S.text,
|
|
15916
|
-
...
|
|
15917
|
-
...
|
|
15931
|
+
...Y ? { source: Y } : {},
|
|
15932
|
+
...D ? { parentToolCallId: D } : {},
|
|
15918
15933
|
...oe.length ? { reportedArtifacts: oe } : {},
|
|
15919
15934
|
...ae ? { backgroundTurn: ae } : {},
|
|
15920
15935
|
isStreaming: S.streaming,
|
|
15921
15936
|
timestamp: V,
|
|
15922
|
-
sourceBlockIds: [
|
|
15937
|
+
sourceBlockIds: [P.id],
|
|
15923
15938
|
...S.branchRecordId ? { branchRecordId: S.branchRecordId } : {},
|
|
15924
15939
|
...S.usage ? { usage: S.usage } : {}
|
|
15925
|
-
}), I = n.length - 1, E = null,
|
|
15940
|
+
}), I = n.length - 1, E = null, R = !1;
|
|
15926
15941
|
else if (S.usage && ze) {
|
|
15927
15942
|
const Te = Kl(ze.usage, S.usage);
|
|
15928
15943
|
n[I] = {
|
|
@@ -15934,41 +15949,42 @@ function sw(e, t = {}) {
|
|
|
15934
15949
|
break;
|
|
15935
15950
|
}
|
|
15936
15951
|
case "thought": {
|
|
15937
|
-
const S =
|
|
15938
|
-
if (
|
|
15939
|
-
Jl(
|
|
15952
|
+
const S = P, { parentToolCallId: D } = S, H = D ? s.get(D) : void 0;
|
|
15953
|
+
if (H) {
|
|
15954
|
+
Jl(H, S.text, P.id);
|
|
15940
15955
|
break;
|
|
15941
15956
|
}
|
|
15942
|
-
const
|
|
15943
|
-
|
|
15944
|
-
...
|
|
15945
|
-
content:
|
|
15957
|
+
const z = E !== null ? n[E] : void 0, Y = z?.role === "thinking" && z.parentToolCallId === D ? z : void 0;
|
|
15958
|
+
Y && !R && S.segmentId === void 0 ? (n[E] = {
|
|
15959
|
+
...Y,
|
|
15960
|
+
content: Y.content + S.text,
|
|
15946
15961
|
isStreaming: S.streaming,
|
|
15947
|
-
sourceBlockIds: vo(
|
|
15948
|
-
},
|
|
15949
|
-
id:
|
|
15962
|
+
sourceBlockIds: vo(Y.sourceBlockIds, P.id)
|
|
15963
|
+
}, R = !1) : (n.push({
|
|
15964
|
+
id: P.id,
|
|
15950
15965
|
role: "thinking",
|
|
15951
15966
|
content: S.text,
|
|
15967
|
+
...D ? { parentToolCallId: D } : {},
|
|
15952
15968
|
isStreaming: S.streaming,
|
|
15953
15969
|
timestamp: V,
|
|
15954
|
-
sourceBlockIds: [
|
|
15955
|
-
}), E = n.length - 1,
|
|
15970
|
+
sourceBlockIds: [P.id]
|
|
15971
|
+
}), E = n.length - 1, R = !1), I = null;
|
|
15956
15972
|
break;
|
|
15957
15973
|
}
|
|
15958
15974
|
case "tool": {
|
|
15959
|
-
const S =
|
|
15975
|
+
const S = P, D = Jg(
|
|
15960
15976
|
S,
|
|
15961
15977
|
a
|
|
15962
|
-
),
|
|
15963
|
-
|
|
15978
|
+
), H = u.get(
|
|
15979
|
+
D.callId
|
|
15964
15980
|
), z = fg(
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15981
|
+
D,
|
|
15982
|
+
H?.status,
|
|
15983
|
+
H?.endTime,
|
|
15968
15984
|
a
|
|
15969
15985
|
);
|
|
15970
|
-
S.serverTimestamp !== void 0 && i.set(z.callId, S.serverTimestamp),
|
|
15971
|
-
const
|
|
15986
|
+
S.serverTimestamp !== void 0 && i.set(z.callId, S.serverTimestamp), H && (z.backgroundResultPending = H.awaitingProcessing);
|
|
15987
|
+
const Y = z.parentToolCallId ? s.get(z.parentToolCallId) : void 0, oe = s.get(z.callId);
|
|
15972
15988
|
if (oe) {
|
|
15973
15989
|
oe.backgroundResultPending = z.backgroundResultPending, Yl(oe, z, {
|
|
15974
15990
|
replaceArgs: a || S.rawInput !== void 0 || oe.args === void 0,
|
|
@@ -15976,191 +15992,191 @@ function sw(e, t = {}) {
|
|
|
15976
15992
|
});
|
|
15977
15993
|
break;
|
|
15978
15994
|
}
|
|
15979
|
-
if (
|
|
15980
|
-
zg(
|
|
15995
|
+
if (Y) {
|
|
15996
|
+
zg(Y, z), s.set(z.callId, z);
|
|
15981
15997
|
break;
|
|
15982
15998
|
}
|
|
15983
|
-
Mi(n,
|
|
15999
|
+
Mi(n, P.id, z, V), s.set(z.callId, z), I = null, E = null, R = !0;
|
|
15984
16000
|
break;
|
|
15985
16001
|
}
|
|
15986
16002
|
case "shell": {
|
|
15987
|
-
const S =
|
|
15988
|
-
if (
|
|
15989
|
-
const
|
|
16003
|
+
const S = P, D = n[n.length - 1];
|
|
16004
|
+
if (D && D.role === "tool_group") {
|
|
16005
|
+
const H = Vg(D.tools), z = D.tools[H];
|
|
15990
16006
|
if (z) {
|
|
15991
|
-
const
|
|
16007
|
+
const Y = typeof z.rawOutput == "string" ? z.rawOutput : "", oe = {
|
|
15992
16008
|
...z,
|
|
15993
|
-
rawOutput:
|
|
16009
|
+
rawOutput: Y + S.text,
|
|
15994
16010
|
sourceBlockIds: vo(
|
|
15995
16011
|
z.sourceBlockIds,
|
|
15996
|
-
|
|
16012
|
+
P.id
|
|
15997
16013
|
)
|
|
15998
16014
|
};
|
|
15999
16015
|
n[n.length - 1] = {
|
|
16000
|
-
...
|
|
16001
|
-
sourceBlockIds: vo(
|
|
16016
|
+
...D,
|
|
16017
|
+
sourceBlockIds: vo(D.sourceBlockIds, P.id),
|
|
16002
16018
|
tools: [
|
|
16003
|
-
...
|
|
16019
|
+
...D.tools.slice(0, H),
|
|
16004
16020
|
oe,
|
|
16005
|
-
...
|
|
16021
|
+
...D.tools.slice(H + 1)
|
|
16006
16022
|
]
|
|
16007
16023
|
}, s.get(z.callId) === z && s.set(z.callId, oe);
|
|
16008
16024
|
}
|
|
16009
16025
|
} else
|
|
16010
16026
|
n.push({
|
|
16011
|
-
id:
|
|
16027
|
+
id: P.id,
|
|
16012
16028
|
role: "tool_group",
|
|
16013
|
-
sourceBlockIds: [
|
|
16029
|
+
sourceBlockIds: [P.id],
|
|
16014
16030
|
tools: [
|
|
16015
16031
|
{
|
|
16016
|
-
callId:
|
|
16032
|
+
callId: P.id,
|
|
16017
16033
|
toolName: "shell",
|
|
16018
16034
|
status: "completed",
|
|
16019
16035
|
kind: "execute",
|
|
16020
16036
|
rawOutput: S.text,
|
|
16021
|
-
sourceBlockIds: [
|
|
16037
|
+
sourceBlockIds: [P.id]
|
|
16022
16038
|
}
|
|
16023
16039
|
],
|
|
16024
16040
|
timestamp: V
|
|
16025
|
-
}),
|
|
16041
|
+
}), R = !0;
|
|
16026
16042
|
break;
|
|
16027
16043
|
}
|
|
16028
16044
|
case "user_shell": {
|
|
16029
|
-
const S =
|
|
16045
|
+
const S = P;
|
|
16030
16046
|
n.push({
|
|
16031
|
-
id:
|
|
16047
|
+
id: P.id,
|
|
16032
16048
|
role: "user_shell",
|
|
16033
|
-
sourceBlockIds: [
|
|
16049
|
+
sourceBlockIds: [P.id],
|
|
16034
16050
|
command: S.command,
|
|
16035
16051
|
output: S.text,
|
|
16036
16052
|
...S.cwd ? { cwd: S.cwd } : {},
|
|
16037
16053
|
timestamp: V
|
|
16038
|
-
}),
|
|
16054
|
+
}), R = !0;
|
|
16039
16055
|
break;
|
|
16040
16056
|
}
|
|
16041
16057
|
case "permission": {
|
|
16042
|
-
const S =
|
|
16058
|
+
const S = P;
|
|
16043
16059
|
Xg(
|
|
16044
16060
|
S,
|
|
16045
16061
|
l,
|
|
16046
16062
|
a
|
|
16047
16063
|
);
|
|
16048
|
-
const
|
|
16064
|
+
const D = Zg(
|
|
16049
16065
|
S,
|
|
16050
16066
|
a
|
|
16051
16067
|
);
|
|
16052
|
-
if (!
|
|
16053
|
-
S.serverTimestamp !== void 0 && !i.has(
|
|
16054
|
-
|
|
16068
|
+
if (!D) break;
|
|
16069
|
+
S.serverTimestamp !== void 0 && !i.has(D.callId) && i.set(
|
|
16070
|
+
D.callId,
|
|
16055
16071
|
S.serverTimestamp
|
|
16056
16072
|
);
|
|
16057
|
-
const
|
|
16073
|
+
const H = $s(D);
|
|
16058
16074
|
if (!S.resolved)
|
|
16059
16075
|
break;
|
|
16060
|
-
const z = s.get(
|
|
16076
|
+
const z = s.get(D.callId);
|
|
16061
16077
|
if (z) {
|
|
16062
|
-
const
|
|
16063
|
-
|
|
16078
|
+
const Y = z.status, oe = z.endTime;
|
|
16079
|
+
D.toolName = z.toolName, S.resolved && (_i(S.resolved) ? D.status = H ? D.status : "in_progress" : (D.status = a && Zl(S.resolved) ? "completed" : "failed", D.endTime = S.updatedAt)), Yl(z, D), (Qg(Y) || S.resolved && H && _i(S.resolved)) && (z.status = Y, z.endTime = oe);
|
|
16064
16080
|
break;
|
|
16065
16081
|
}
|
|
16066
16082
|
if (S.resolved) {
|
|
16067
|
-
_i(S.resolved) ? (
|
|
16083
|
+
_i(S.resolved) ? (H || (D.status = "in_progress"), Mi(
|
|
16068
16084
|
n,
|
|
16069
|
-
|
|
16070
|
-
|
|
16085
|
+
P.id,
|
|
16086
|
+
D,
|
|
16071
16087
|
V
|
|
16072
|
-
), s.set(
|
|
16088
|
+
), s.set(D.callId, D), R = !0) : (D.status = a && Zl(S.resolved) ? "completed" : "failed", D.endTime = S.updatedAt, Mi(
|
|
16073
16089
|
n,
|
|
16074
|
-
|
|
16075
|
-
|
|
16090
|
+
P.id,
|
|
16091
|
+
D,
|
|
16076
16092
|
V
|
|
16077
|
-
), s.set(
|
|
16093
|
+
), s.set(D.callId, D), R = !0);
|
|
16078
16094
|
break;
|
|
16079
16095
|
}
|
|
16080
16096
|
break;
|
|
16081
16097
|
}
|
|
16082
16098
|
case "status":
|
|
16083
16099
|
case "debug": {
|
|
16084
|
-
const S =
|
|
16100
|
+
const S = P;
|
|
16085
16101
|
if (_g(S)) break;
|
|
16086
16102
|
if (S.source === "mid_turn_message_injected") {
|
|
16087
|
-
const
|
|
16103
|
+
const Y = Og(
|
|
16088
16104
|
S.data
|
|
16089
16105
|
), oe = Wg(
|
|
16090
16106
|
S.data
|
|
16091
16107
|
);
|
|
16092
16108
|
n.push({
|
|
16093
|
-
id:
|
|
16109
|
+
id: P.id,
|
|
16094
16110
|
role: "system",
|
|
16095
16111
|
content: S.text.length > 0 ? S.text : qg(S.data) ?? S.text,
|
|
16096
16112
|
variant: "info",
|
|
16097
16113
|
timestamp: V,
|
|
16098
16114
|
source: S.source,
|
|
16099
16115
|
...S.data !== void 0 ? { data: S.data } : {},
|
|
16100
|
-
...
|
|
16116
|
+
...Y ? { images: Y } : {},
|
|
16101
16117
|
...oe ? { files: oe } : {}
|
|
16102
|
-
}),
|
|
16118
|
+
}), R = !0;
|
|
16103
16119
|
break;
|
|
16104
16120
|
}
|
|
16105
|
-
const
|
|
16106
|
-
if (Rg(
|
|
16107
|
-
const z = Kg(
|
|
16121
|
+
const D = S.source === "session_branched" ? Ug(S.data) : null, H = D && t.labels?.branchSuccess ? t.labels.branchSuccess(D) : S.text;
|
|
16122
|
+
if (Rg(H)) break;
|
|
16123
|
+
const z = Kg(H);
|
|
16108
16124
|
if (z) {
|
|
16109
16125
|
n.push({
|
|
16110
|
-
id:
|
|
16126
|
+
id: P.id,
|
|
16111
16127
|
role: "plan",
|
|
16112
16128
|
todos: z,
|
|
16113
16129
|
timestamp: V,
|
|
16114
|
-
sourceBlockIds: [
|
|
16115
|
-
}),
|
|
16130
|
+
sourceBlockIds: [P.id]
|
|
16131
|
+
}), R = !0;
|
|
16116
16132
|
break;
|
|
16117
16133
|
}
|
|
16118
16134
|
n.push({
|
|
16119
|
-
id:
|
|
16135
|
+
id: P.id,
|
|
16120
16136
|
role: "system",
|
|
16121
|
-
content:
|
|
16137
|
+
content: H,
|
|
16122
16138
|
variant: "info",
|
|
16123
16139
|
timestamp: V,
|
|
16124
|
-
sourceBlockIds: [
|
|
16140
|
+
sourceBlockIds: [P.id],
|
|
16125
16141
|
...S.source ? { source: S.source } : {},
|
|
16126
16142
|
...S.data !== void 0 ? { data: S.data } : {}
|
|
16127
|
-
}),
|
|
16143
|
+
}), R = !0;
|
|
16128
16144
|
break;
|
|
16129
16145
|
}
|
|
16130
16146
|
case "error": {
|
|
16131
|
-
const S =
|
|
16147
|
+
const S = P, D = S.errorKind;
|
|
16132
16148
|
n.push({
|
|
16133
|
-
id:
|
|
16149
|
+
id: P.id,
|
|
16134
16150
|
role: "system",
|
|
16135
16151
|
content: Dg(S, t.labels),
|
|
16136
16152
|
variant: "error",
|
|
16137
|
-
retryable: S.source === "turn_error" && $g(
|
|
16153
|
+
retryable: S.source === "turn_error" && $g(D),
|
|
16138
16154
|
...ae ? { backgroundTurn: ae } : {},
|
|
16139
16155
|
timestamp: V,
|
|
16140
|
-
sourceBlockIds: [
|
|
16156
|
+
sourceBlockIds: [P.id],
|
|
16141
16157
|
...S.source ? { source: S.source } : {},
|
|
16142
|
-
...Lg(S.data,
|
|
16143
|
-
}),
|
|
16158
|
+
...Lg(S.data, D)
|
|
16159
|
+
}), R = !0;
|
|
16144
16160
|
break;
|
|
16145
16161
|
}
|
|
16146
16162
|
case "prompt_cancelled":
|
|
16147
16163
|
n.push({
|
|
16148
|
-
id:
|
|
16164
|
+
id: P.id,
|
|
16149
16165
|
role: "system",
|
|
16150
16166
|
content: r,
|
|
16151
16167
|
variant: "info",
|
|
16152
16168
|
source: "prompt_cancelled",
|
|
16153
16169
|
...ae ? { backgroundTurn: ae } : {},
|
|
16154
|
-
...
|
|
16170
|
+
...P.elapsedMs !== void 0 ? { data: { elapsedMs: P.elapsedMs } } : {},
|
|
16155
16171
|
timestamp: V,
|
|
16156
|
-
sourceBlockIds: [
|
|
16157
|
-
}),
|
|
16172
|
+
sourceBlockIds: [P.id]
|
|
16173
|
+
}), R = !0;
|
|
16158
16174
|
break;
|
|
16159
16175
|
}
|
|
16160
16176
|
}
|
|
16161
16177
|
for (const U of s.values()) {
|
|
16162
|
-
const
|
|
16163
|
-
|
|
16178
|
+
const P = l.get(U.callId);
|
|
16179
|
+
P?.title && (U.title = P.title), !Array.isArray(U.args?.questions) && P?.args && (U.args = P.args), ($s(U) || /^(shell|bash|run_shell_command|execute_command)$/i.test(
|
|
16164
16180
|
U.toolName
|
|
16165
16181
|
)) && wd(U.status) && U.endTime === void 0 && (U.startTime = i.get(U.callId) ?? U.startTime);
|
|
16166
16182
|
}
|
|
@@ -16900,8 +16916,8 @@ function lw(e) {
|
|
|
16900
16916
|
if (!g || g.references === 0) return;
|
|
16901
16917
|
const v = l.data;
|
|
16902
16918
|
if (!v || typeof v != "object") return;
|
|
16903
|
-
const I = v, E = I.promptId,
|
|
16904
|
-
if (I.sessionId !== i ||
|
|
16919
|
+
const I = v, E = I.promptId, R = l.sessionId;
|
|
16920
|
+
if (I.sessionId !== i || R !== void 0 && R !== i)
|
|
16905
16921
|
return;
|
|
16906
16922
|
if (l.type === "permission_request") {
|
|
16907
16923
|
const $ = I.requestId;
|
|
@@ -16912,8 +16928,8 @@ function lw(e) {
|
|
|
16912
16928
|
try {
|
|
16913
16929
|
const B = typeof m == "function" ? m() : m;
|
|
16914
16930
|
if (!B?.attention) return;
|
|
16915
|
-
const { attention: U, ...
|
|
16916
|
-
a(M) && e({ ...
|
|
16931
|
+
const { attention: U, ...P } = B;
|
|
16932
|
+
a(M) && e({ ...P, key: M, outcome: U });
|
|
16917
16933
|
} catch {
|
|
16918
16934
|
}
|
|
16919
16935
|
return;
|
|
@@ -17094,7 +17110,7 @@ class Sh {
|
|
|
17094
17110
|
older: this.nextBoundary("older", n, l, o),
|
|
17095
17111
|
newer: { kind: "live" }
|
|
17096
17112
|
}), g = this.snapshot, v = new Map(this.cachedBoundaryRequests), I = new Map(this.rangeAccess), E = new Map(g.pages);
|
|
17097
|
-
let
|
|
17113
|
+
let R = [...g.ranges];
|
|
17098
17114
|
try {
|
|
17099
17115
|
for (const q of g.ranges)
|
|
17100
17116
|
if (!("anchorTurnId" in q) && q.pageIds.some(
|
|
@@ -17106,8 +17122,8 @@ class Sh {
|
|
|
17106
17122
|
($) => [...this.viewportPins.values()].includes($)
|
|
17107
17123
|
))
|
|
17108
17124
|
throw new fo();
|
|
17109
|
-
|
|
17110
|
-
|
|
17125
|
+
R = this.restoreCachedBoundaries(
|
|
17126
|
+
R.filter(($) => $.id !== q.id),
|
|
17111
17127
|
q.id
|
|
17112
17128
|
);
|
|
17113
17129
|
for (const $ of q.pageIds) E.delete($);
|
|
@@ -17119,7 +17135,7 @@ class Sh {
|
|
|
17119
17135
|
}
|
|
17120
17136
|
return E.set(l.id, l), this.snapshot = {
|
|
17121
17137
|
pages: E,
|
|
17122
|
-
ranges: Object.freeze([...
|
|
17138
|
+
ranges: Object.freeze([...R, m]),
|
|
17123
17139
|
retainedBytes: 0
|
|
17124
17140
|
}, this.evict(u, l.id), { rangeId: u, pageId: l.id, blockId: s.at(-1).id };
|
|
17125
17141
|
} catch (q) {
|
|
@@ -17159,23 +17175,23 @@ class Sh {
|
|
|
17159
17175
|
const s = this.findTurn(n);
|
|
17160
17176
|
if (s && (!r || this.snapshot.pages.get(s.pageId)?.recordIds.has(r)))
|
|
17161
17177
|
return s;
|
|
17162
|
-
const i = r ? new Set([...this.liveRecordIds].filter((
|
|
17178
|
+
const i = r ? new Set([...this.liveRecordIds].filter((P) => P !== n)) : this.liveRecordIds, l = this.materializePage(
|
|
17163
17179
|
o,
|
|
17164
17180
|
a.events,
|
|
17165
17181
|
i
|
|
17166
17182
|
), u = [...l.encounteredRecordIds].some(
|
|
17167
|
-
(
|
|
17183
|
+
(P) => this.liveRecordIds.has(P)
|
|
17168
17184
|
), m = Di(
|
|
17169
17185
|
l.page.blocks,
|
|
17170
17186
|
i
|
|
17171
17187
|
), g = m.length === l.page.blocks.length ? l.page : this.pageFromBlocks(l.page.id, o, m), v = this.fitPageWithinBudget(
|
|
17172
17188
|
this.withNewerRequest(g, ac(a))
|
|
17173
17189
|
), I = v.turnBlockById.get(n) ?? (r ? v.blocks.find(
|
|
17174
|
-
(
|
|
17190
|
+
(P) => P.sourceRecordIds?.includes(r)
|
|
17175
17191
|
)?.id : void 0);
|
|
17176
17192
|
if (!I)
|
|
17177
17193
|
throw new Error("Anchored transcript target could not be materialized");
|
|
17178
|
-
const E = `history-range-${this.nextRangeId++}`,
|
|
17194
|
+
const E = `history-range-${this.nextRangeId++}`, R = a.hasOlder && v.firstRecordId ? {
|
|
17179
17195
|
kind: "loadable",
|
|
17180
17196
|
request: {
|
|
17181
17197
|
kind: "older",
|
|
@@ -17190,32 +17206,32 @@ class Sh {
|
|
|
17190
17206
|
anchorOrdinal: t,
|
|
17191
17207
|
anchorTurnId: n,
|
|
17192
17208
|
pageIds: Object.freeze([v.id]),
|
|
17193
|
-
older:
|
|
17209
|
+
older: R,
|
|
17194
17210
|
newer: q
|
|
17195
17211
|
});
|
|
17196
17212
|
if (this.measureRetainedBytes(/* @__PURE__ */ new Map([[v.id, v]]), [$]) > this.options.maxRetainedBytes)
|
|
17197
17213
|
throw new ba();
|
|
17198
17214
|
const M = new Map(this.snapshot.pages);
|
|
17199
17215
|
let B = [...this.snapshot.ranges];
|
|
17200
|
-
for (const
|
|
17201
|
-
if ("anchorTurnId" in
|
|
17216
|
+
for (const P of this.snapshot.ranges)
|
|
17217
|
+
if ("anchorTurnId" in P && P.pageIds.some(
|
|
17202
17218
|
(V) => [...M.get(V)?.recordIds ?? []].some(
|
|
17203
|
-
(
|
|
17219
|
+
(X) => v.recordIds.has(X)
|
|
17204
17220
|
)
|
|
17205
17221
|
)) {
|
|
17206
|
-
if (
|
|
17222
|
+
if (P.pageIds.some(
|
|
17207
17223
|
(V) => [...this.viewportPins.values()].includes(V)
|
|
17208
17224
|
))
|
|
17209
17225
|
throw new fo();
|
|
17210
17226
|
B = this.restoreCachedBoundaries(
|
|
17211
|
-
B.filter((V) => V.id !==
|
|
17212
|
-
|
|
17227
|
+
B.filter((V) => V.id !== P.id),
|
|
17228
|
+
P.id
|
|
17213
17229
|
);
|
|
17214
|
-
for (const V of
|
|
17215
|
-
this.rangeAccess.delete(
|
|
17216
|
-
this.boundaryKey(
|
|
17230
|
+
for (const V of P.pageIds) M.delete(V);
|
|
17231
|
+
this.rangeAccess.delete(P.id), this.cachedBoundaryRequests.delete(
|
|
17232
|
+
this.boundaryKey(P.id, "older")
|
|
17217
17233
|
), this.cachedBoundaryRequests.delete(
|
|
17218
|
-
this.boundaryKey(
|
|
17234
|
+
this.boundaryKey(P.id, "newer")
|
|
17219
17235
|
);
|
|
17220
17236
|
}
|
|
17221
17237
|
M.set(v.id, v);
|
|
@@ -17333,13 +17349,13 @@ class Sh {
|
|
|
17333
17349
|
u.encounteredRecordIds,
|
|
17334
17350
|
t,
|
|
17335
17351
|
n
|
|
17336
|
-
), I = Di(m.blocks, l), E = I.length === m.blocks.length ? m : this.pageFromBlocks(m.id, o, I),
|
|
17352
|
+
), I = Di(m.blocks, l), E = I.length === m.blocks.length ? m : this.pageFromBlocks(m.id, o, I), R = ("beforeRecordId" in s || i.kind === "gap" && i.beforeAnchor === !0) && r?.fromAnchor === !0, q = (n === "older" || r && !r.fromAnchor) && E.lastRecordId ? {
|
|
17337
17353
|
kind: "gap",
|
|
17338
17354
|
...i.kind === "gap" && i.beforeAnchor ? { beforeAnchor: !0 } : {},
|
|
17339
17355
|
anchorRecordId: i.kind === "gap" ? i.anchorRecordId : "anchorTurnId" in s ? s.anchorTurnId : s.beforeRecordId,
|
|
17340
17356
|
afterRecordId: E.lastRecordId,
|
|
17341
17357
|
snapshot: "beforeRecordId" in s ? s.snapshot : o
|
|
17342
|
-
} :
|
|
17358
|
+
} : R ? void 0 : ac(a), $ = this.withNewerRequest(E, q);
|
|
17343
17359
|
if ($.blocks.length === 0) {
|
|
17344
17360
|
if (r && !r.fromAnchor && !g && !v)
|
|
17345
17361
|
throw new Error("Gap recovery did not materialize newer records");
|
|
@@ -17347,11 +17363,11 @@ class Sh {
|
|
|
17347
17363
|
s,
|
|
17348
17364
|
n,
|
|
17349
17365
|
a,
|
|
17350
|
-
g ||
|
|
17366
|
+
g || R,
|
|
17351
17367
|
v
|
|
17352
17368
|
);
|
|
17353
17369
|
const F = "beforeRecordId" in s ? t : this.selectedRangeId ?? t, S = this.snapshot.ranges.find(
|
|
17354
|
-
(
|
|
17370
|
+
(D) => D.id === F
|
|
17355
17371
|
);
|
|
17356
17372
|
this.evict(
|
|
17357
17373
|
F,
|
|
@@ -17362,7 +17378,7 @@ class Sh {
|
|
|
17362
17378
|
}
|
|
17363
17379
|
const M = this.fitPageWithinBudget($), B = new Map(this.snapshot.pages);
|
|
17364
17380
|
B.set(M.id, M);
|
|
17365
|
-
const U = n === "older" ? [M.id, ...s.pageIds] : [...s.pageIds, M.id],
|
|
17381
|
+
const U = n === "older" ? [M.id, ...s.pageIds] : [...s.pageIds, M.id], P = g || R ? { kind: "live" } : v ? this.cachedBoundary(
|
|
17366
17382
|
t,
|
|
17367
17383
|
n,
|
|
17368
17384
|
v,
|
|
@@ -17370,16 +17386,16 @@ class Sh {
|
|
|
17370
17386
|
) : n === "newer" ? ic(q) : this.nextBoundary(n, o, M, a), V = Object.freeze({
|
|
17371
17387
|
...s,
|
|
17372
17388
|
pageIds: Object.freeze(U),
|
|
17373
|
-
[n]:
|
|
17374
|
-
}),
|
|
17389
|
+
[n]: P
|
|
17390
|
+
}), X = Object.freeze(
|
|
17375
17391
|
this.restoreCachedBoundaries(this.snapshot.ranges, t).map(
|
|
17376
17392
|
(F) => F.id === t ? V : F
|
|
17377
17393
|
)
|
|
17378
17394
|
);
|
|
17379
17395
|
this.snapshot = Object.freeze({
|
|
17380
17396
|
pages: B,
|
|
17381
|
-
ranges:
|
|
17382
|
-
retainedBytes: this.measureRetainedBytes(B,
|
|
17397
|
+
ranges: X,
|
|
17398
|
+
retainedBytes: this.measureRetainedBytes(B, X)
|
|
17383
17399
|
}), this.touch(t);
|
|
17384
17400
|
const ae = "beforeRecordId" in s ? t : this.selectedRangeId ?? t, et = this.snapshot.ranges.find(
|
|
17385
17401
|
(F) => F.id === ae
|
|
@@ -17556,16 +17572,16 @@ class Sh {
|
|
|
17556
17572
|
const s = () => a.size > this.options.maxPages || this.measureRetainedBytes(a, r) > this.options.maxRetainedBytes;
|
|
17557
17573
|
for (; s(); ) {
|
|
17558
17574
|
const i = r.filter(
|
|
17559
|
-
(
|
|
17575
|
+
(R) => R.id !== t && R.id !== this.selectedRangeId && !R.pageIds.some(
|
|
17560
17576
|
(q) => [...this.viewportPins.values()].includes(q)
|
|
17561
17577
|
)
|
|
17562
17578
|
).sort(
|
|
17563
|
-
(
|
|
17579
|
+
(R, q) => (this.rangeAccess.get(R.id) ?? 0) - (this.rangeAccess.get(q.id) ?? 0)
|
|
17564
17580
|
)[0];
|
|
17565
17581
|
if (i) {
|
|
17566
|
-
r = r.filter((
|
|
17567
|
-
for (const
|
|
17568
|
-
a.delete(
|
|
17582
|
+
r = r.filter((R) => R.id !== i.id), r = this.restoreCachedBoundaries(r, i.id);
|
|
17583
|
+
for (const R of i.pageIds)
|
|
17584
|
+
a.delete(R);
|
|
17569
17585
|
this.cachedBoundaryRequests.delete(
|
|
17570
17586
|
this.boundaryKey(i.id, "older")
|
|
17571
17587
|
), this.cachedBoundaryRequests.delete(
|
|
@@ -17573,19 +17589,19 @@ class Sh {
|
|
|
17573
17589
|
), this.rangeAccess.delete(i.id);
|
|
17574
17590
|
continue;
|
|
17575
17591
|
}
|
|
17576
|
-
const l = r.find((
|
|
17592
|
+
const l = r.find((R) => R.id === t);
|
|
17577
17593
|
if (!l || l.pageIds.length <= 1) {
|
|
17578
17594
|
if (l && o)
|
|
17579
17595
|
throw this.cachedBoundaryRequests.delete(
|
|
17580
17596
|
this.boundaryKey(l.id, o.direction)
|
|
17581
17597
|
), r = r.map(
|
|
17582
|
-
(
|
|
17583
|
-
...
|
|
17598
|
+
(R) => R.id === l.id ? Object.freeze({
|
|
17599
|
+
...R,
|
|
17584
17600
|
[o.direction]: {
|
|
17585
17601
|
kind: "loading",
|
|
17586
17602
|
request: o.request
|
|
17587
17603
|
}
|
|
17588
|
-
}) :
|
|
17604
|
+
}) : R
|
|
17589
17605
|
), this.snapshot = Object.freeze({
|
|
17590
17606
|
pages: a,
|
|
17591
17607
|
ranges: Object.freeze(r),
|
|
@@ -17595,12 +17611,12 @@ class Sh {
|
|
|
17595
17611
|
break;
|
|
17596
17612
|
}
|
|
17597
17613
|
const m = (o?.direction === "older" ? [l.pageIds.at(-1), l.pageIds[0]] : [l.pageIds[0], l.pageIds.at(-1)]).find(
|
|
17598
|
-
(
|
|
17614
|
+
(R) => R !== n && R !== this.selectedPageId && R !== o?.pageId && ![...this.viewportPins.values()].includes(R)
|
|
17599
17615
|
);
|
|
17600
17616
|
if (!m) throw new fo();
|
|
17601
17617
|
const g = m === l.pageIds[0];
|
|
17602
17618
|
a.delete(m);
|
|
17603
|
-
const v = l.pageIds.filter((
|
|
17619
|
+
const v = l.pageIds.filter((R) => R !== m), I = v[0] ? a.get(v[0]) : void 0, E = a.get(v.at(-1));
|
|
17604
17620
|
if (!g && !E?.newerRequest)
|
|
17605
17621
|
throw new fo();
|
|
17606
17622
|
g ? this.cachedBoundaryRequests.delete(
|
|
@@ -17608,8 +17624,8 @@ class Sh {
|
|
|
17608
17624
|
) : this.cachedBoundaryRequests.delete(
|
|
17609
17625
|
this.boundaryKey(l.id, "newer")
|
|
17610
17626
|
), r = this.restoreCachedBoundaries(r, l.id), r = r.map(
|
|
17611
|
-
(
|
|
17612
|
-
...
|
|
17627
|
+
(R) => R.id === l.id ? Object.freeze({
|
|
17628
|
+
...R,
|
|
17613
17629
|
pageIds: Object.freeze(v),
|
|
17614
17630
|
...g && I?.firstRecordId ? {
|
|
17615
17631
|
older: {
|
|
@@ -17628,7 +17644,7 @@ class Sh {
|
|
|
17628
17644
|
} : g ? {} : {
|
|
17629
17645
|
newer: ic(E?.newerRequest)
|
|
17630
17646
|
}
|
|
17631
|
-
}) :
|
|
17647
|
+
}) : R
|
|
17632
17648
|
);
|
|
17633
17649
|
}
|
|
17634
17650
|
this.snapshot = Object.freeze({
|
|
@@ -17725,17 +17741,17 @@ const ka = /* @__PURE__ */ new Map(), lc = Object.freeze({
|
|
|
17725
17741
|
});
|
|
17726
17742
|
function Ch(e = {}) {
|
|
17727
17743
|
const t = e.indexPageSize ?? oc, n = e.maxIndexPages ?? vh, o = e.maxIndexBytes ?? wh, a = /* @__PURE__ */ new Set();
|
|
17728
|
-
let r = lc, s, i, l, u = !1, m = 0, g = 0, v = 0, I = 0, E = /* @__PURE__ */ new Map(),
|
|
17744
|
+
let r = lc, s, i, l, u = !1, m = 0, g = 0, v = 0, I = 0, E = /* @__PURE__ */ new Map(), R = [];
|
|
17729
17745
|
const q = /* @__PURE__ */ new Set();
|
|
17730
|
-
let $ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Map(),
|
|
17746
|
+
let $ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Map(), P;
|
|
17731
17747
|
const V = /* @__PURE__ */ new Map();
|
|
17732
|
-
let
|
|
17748
|
+
let X, ae = 0, et = 0, F = !1, S = !1, D = !1, H = Y(), z = Object.freeze({
|
|
17733
17749
|
revision: 0,
|
|
17734
17750
|
connected: !1,
|
|
17735
17751
|
pages: ka,
|
|
17736
17752
|
ranges: Object.freeze([])
|
|
17737
17753
|
});
|
|
17738
|
-
function
|
|
17754
|
+
function Y() {
|
|
17739
17755
|
return new Sh({
|
|
17740
17756
|
maxPages: e.maxHistoricalPages ?? bh,
|
|
17741
17757
|
maxRetainedBytes: e.maxHistoricalBytes ?? kh,
|
|
@@ -17754,34 +17770,34 @@ function Ch(e = {}) {
|
|
|
17754
17770
|
return i?.owner === w.owner;
|
|
17755
17771
|
}
|
|
17756
17772
|
function ne(w = {}) {
|
|
17757
|
-
("selected" in w ? w.selected : r.selected)?.location?.view !== "historical" &&
|
|
17758
|
-
const d =
|
|
17759
|
-
(
|
|
17773
|
+
("selected" in w ? w.selected : r.selected)?.location?.view !== "historical" && H.clearSelection();
|
|
17774
|
+
const d = H.getSnapshot(), p = d.ranges.filter(
|
|
17775
|
+
(j) => "anchorTurnId" in j
|
|
17760
17776
|
), h = new Set(
|
|
17761
|
-
p.flatMap((
|
|
17777
|
+
p.flatMap((j) => j.pageIds)
|
|
17762
17778
|
), f = new Map(
|
|
17763
|
-
[...d.pages].filter(([
|
|
17779
|
+
[...d.pages].filter(([j]) => h.has(j))
|
|
17764
17780
|
), C = f.size === r.historicalPages.size && [...f].every(
|
|
17765
|
-
([
|
|
17781
|
+
([j, N]) => r.historicalPages.get(j) === N
|
|
17766
17782
|
) ? r.historicalPages : f, y = "error" in w ? w.error : r.error, k = y?.operation === "older" || y?.operation === "newer" ? y.operation : void 0, O = k !== void 0 && !d.ranges.some(
|
|
17767
|
-
(
|
|
17768
|
-
),
|
|
17769
|
-
[...Ko(E).values()].map((
|
|
17783
|
+
(j) => j.id === y?.rangeId && j[k].kind === "error"
|
|
17784
|
+
), L = new Set(
|
|
17785
|
+
[...Ko(E).values()].map((j) => j.turnId)
|
|
17770
17786
|
), W = /* @__PURE__ */ new Map();
|
|
17771
|
-
for (const [
|
|
17772
|
-
|
|
17773
|
-
for (const [
|
|
17774
|
-
|
|
17775
|
-
for (const
|
|
17776
|
-
for (const N of
|
|
17777
|
-
const
|
|
17778
|
-
if (
|
|
17779
|
-
for (const [ie, Q] of
|
|
17780
|
-
|
|
17787
|
+
for (const [j, N] of $)
|
|
17788
|
+
L.has(j) && W.set(j, N);
|
|
17789
|
+
for (const [j, N] of M)
|
|
17790
|
+
L.has(j) && !W.has(j) && W.set(j, N);
|
|
17791
|
+
for (const j of p)
|
|
17792
|
+
for (const N of j.pageIds) {
|
|
17793
|
+
const Z = d.pages.get(N);
|
|
17794
|
+
if (Z)
|
|
17795
|
+
for (const [ie, Q] of Z.turnBlockById)
|
|
17796
|
+
L.has(ie) && !W.has(ie) && W.set(ie, {
|
|
17781
17797
|
turnId: ie,
|
|
17782
17798
|
blockId: Q,
|
|
17783
17799
|
view: "historical",
|
|
17784
|
-
rangeId:
|
|
17800
|
+
rangeId: j.id,
|
|
17785
17801
|
pageId: N
|
|
17786
17802
|
});
|
|
17787
17803
|
}
|
|
@@ -17791,13 +17807,13 @@ function Ch(e = {}) {
|
|
|
17791
17807
|
error: O ? void 0 : y,
|
|
17792
17808
|
sessionId: s,
|
|
17793
17809
|
indexPages: new Map(
|
|
17794
|
-
[...E.entries()].map(([
|
|
17795
|
-
|
|
17810
|
+
[...E.entries()].map(([j, N]) => [
|
|
17811
|
+
j,
|
|
17796
17812
|
Ih(N)
|
|
17797
17813
|
])
|
|
17798
17814
|
),
|
|
17799
|
-
provisionalTurns: Object.freeze([...
|
|
17800
|
-
effectiveTurnCount: (w.totalTurns ?? r.totalTurns) +
|
|
17815
|
+
provisionalTurns: Object.freeze([...R]),
|
|
17816
|
+
effectiveTurnCount: (w.totalTurns ?? r.totalTurns) + R.length,
|
|
17801
17817
|
historicalPages: C,
|
|
17802
17818
|
historicalRanges: Object.freeze(p),
|
|
17803
17819
|
locations: W
|
|
@@ -17808,16 +17824,16 @@ function Ch(e = {}) {
|
|
|
17808
17824
|
pages: d.pages,
|
|
17809
17825
|
ranges: d.ranges
|
|
17810
17826
|
});
|
|
17811
|
-
for (const
|
|
17827
|
+
for (const j of a) j();
|
|
17812
17828
|
}
|
|
17813
17829
|
function Pe(w) {
|
|
17814
|
-
s = w, m += 1, g += 1, v += 1, i = void 0, l = void 0, u = !1, E = /* @__PURE__ */ new Map(),
|
|
17830
|
+
s = w, m += 1, g += 1, v += 1, i = void 0, l = void 0, u = !1, E = /* @__PURE__ */ new Map(), R = [], q.clear(), $ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), P = void 0, X = void 0, F = !1, S = !1, D = !1, H = Y(), r = Object.freeze({
|
|
17815
17831
|
...lc,
|
|
17816
17832
|
sessionId: w
|
|
17817
17833
|
});
|
|
17818
17834
|
}
|
|
17819
17835
|
function qe() {
|
|
17820
|
-
g += 1, v += 1, E = /* @__PURE__ */ new Map(),
|
|
17836
|
+
g += 1, v += 1, E = /* @__PURE__ */ new Map(), R = [], q.clear(), M = /* @__PURE__ */ new Map(), S = !1, H.reset(), dt(), r = Object.freeze({
|
|
17821
17837
|
...r,
|
|
17822
17838
|
totalTurns: 0,
|
|
17823
17839
|
effectiveTurnCount: 0,
|
|
@@ -17832,7 +17848,7 @@ function Ch(e = {}) {
|
|
|
17832
17848
|
function Ie(w) {
|
|
17833
17849
|
const c = w.sessionId !== s;
|
|
17834
17850
|
if (c && Pe(w.sessionId), !w.sessionId || !w.supported) {
|
|
17835
|
-
!c && (i !== void 0 || r.mode !== "legacy" || r.fallbackReason !== "unsupported") && (m += 1, g += 1, v += 1,
|
|
17851
|
+
!c && (i !== void 0 || r.mode !== "legacy" || r.fallbackReason !== "unsupported") && (m += 1, g += 1, v += 1, X = void 0, F = !1), i = void 0, l = void 0, u = !1, R = [], q.clear(), M = /* @__PURE__ */ new Map(), (r.mode !== "legacy" || r.fallbackReason !== "unsupported" || c) && (E = /* @__PURE__ */ new Map(), H.reset(), H.setLiveRecordIds(B), ne({
|
|
17836
17852
|
mode: "legacy",
|
|
17837
17853
|
fallbackReason: "unsupported",
|
|
17838
17854
|
totalTurns: 0,
|
|
@@ -17841,7 +17857,7 @@ function Ch(e = {}) {
|
|
|
17841
17857
|
}));
|
|
17842
17858
|
return;
|
|
17843
17859
|
}
|
|
17844
|
-
if (
|
|
17860
|
+
if (D) {
|
|
17845
17861
|
i = w.client, l = w.client?.owner, u = w.client !== void 0, r.fallbackReason !== "too_large" && ne({
|
|
17846
17862
|
mode: "legacy",
|
|
17847
17863
|
fallbackReason: "too_large",
|
|
@@ -17854,7 +17870,7 @@ function Ch(e = {}) {
|
|
|
17854
17870
|
if (!w.client) {
|
|
17855
17871
|
const h = i !== void 0;
|
|
17856
17872
|
let f = !1;
|
|
17857
|
-
i && (m += 1, v += 1,
|
|
17873
|
+
i && (m += 1, v += 1, X = void 0, F = !1, f = H.releaseLoadingBoundaries()), i = void 0, u = !1, (c || h || f || r.selected?.status === "loading") && ne({
|
|
17858
17874
|
...c ? {
|
|
17859
17875
|
mode: "loading",
|
|
17860
17876
|
fallbackReason: void 0,
|
|
@@ -17866,23 +17882,23 @@ function Ch(e = {}) {
|
|
|
17866
17882
|
return;
|
|
17867
17883
|
}
|
|
17868
17884
|
const d = l !== w.client.owner;
|
|
17869
|
-
d && l !== void 0 && (et += 1, m += 1, v += 1,
|
|
17885
|
+
d && l !== void 0 && (et += 1, m += 1, v += 1, X = void 0, F = !1, (H.releaseLoadingBoundaries() || r.selected?.status === "loading") && ne({ selected: void 0, error: void 0 }));
|
|
17870
17886
|
const p = d || !u;
|
|
17871
17887
|
i = w.client, l = w.client.owner, u = !0, p && ne(), !(!p || r.fallbackReason === "too_large") && (E.size === 0 && ne({ mode: "loading", fallbackReason: void 0 }), Ae());
|
|
17872
17888
|
}
|
|
17873
17889
|
function ze(w) {
|
|
17874
|
-
if (w ===
|
|
17875
|
-
|
|
17890
|
+
if (w === P) return;
|
|
17891
|
+
P = w;
|
|
17876
17892
|
const c = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Set();
|
|
17877
17893
|
for (const k of w) {
|
|
17878
|
-
for (const
|
|
17879
|
-
h.add(
|
|
17894
|
+
for (const L of k.sourceRecordIds ?? [])
|
|
17895
|
+
h.add(L);
|
|
17880
17896
|
if (k.kind !== "user") continue;
|
|
17881
17897
|
d.add(k.id);
|
|
17882
17898
|
const O = k.promptId ?? k.meta?.promptId;
|
|
17883
17899
|
typeof O == "string" && p.set(O, k.id);
|
|
17884
|
-
for (const
|
|
17885
|
-
c.set(
|
|
17900
|
+
for (const L of k.sourceRecordIds ?? [])
|
|
17901
|
+
c.set(L, { turnId: L, blockId: k.id, view: "live" });
|
|
17886
17902
|
}
|
|
17887
17903
|
B = h, U = p;
|
|
17888
17904
|
const f = new Map(
|
|
@@ -17898,22 +17914,22 @@ function Ch(e = {}) {
|
|
|
17898
17914
|
view: "live"
|
|
17899
17915
|
});
|
|
17900
17916
|
}
|
|
17901
|
-
const C =
|
|
17902
|
-
const O = p.get(k.promptId),
|
|
17903
|
-
if (
|
|
17904
|
-
const { blockId: W, ...
|
|
17917
|
+
const C = R.map((k) => {
|
|
17918
|
+
const O = p.get(k.promptId), L = d.has(k.blockId ?? "") ? k.blockId : O;
|
|
17919
|
+
if (L === k.blockId) return k;
|
|
17920
|
+
const { blockId: W, ...j } = k;
|
|
17905
17921
|
return Object.freeze({
|
|
17906
|
-
...
|
|
17907
|
-
...
|
|
17922
|
+
...j,
|
|
17923
|
+
...L ? { blockId: L } : {}
|
|
17908
17924
|
});
|
|
17909
17925
|
});
|
|
17910
17926
|
if (!C.some(
|
|
17911
|
-
(k, O) => k !==
|
|
17927
|
+
(k, O) => k !== R[O]
|
|
17912
17928
|
) && cc($, c) && cc(M, f)) {
|
|
17913
17929
|
dt();
|
|
17914
17930
|
return;
|
|
17915
17931
|
}
|
|
17916
|
-
$ = c, M = f,
|
|
17932
|
+
$ = c, M = f, R = C, $t(), dt(), ne();
|
|
17917
17933
|
}
|
|
17918
17934
|
function Te(w) {
|
|
17919
17935
|
if (q.has(w.promptId)) return;
|
|
@@ -17928,15 +17944,15 @@ function Ch(e = {}) {
|
|
|
17928
17944
|
}), dt(), ne());
|
|
17929
17945
|
return;
|
|
17930
17946
|
}
|
|
17931
|
-
if (!(r.mode === "legacy" ||
|
|
17947
|
+
if (!(r.mode === "legacy" || R.some((h) => h.promptId === w.promptId) || d.some(
|
|
17932
17948
|
(h) => c !== void 0 && bt(h.turnId)?.blockId === c
|
|
17933
17949
|
))) {
|
|
17934
|
-
if (
|
|
17950
|
+
if (R.length >= t) {
|
|
17935
17951
|
ut();
|
|
17936
17952
|
return;
|
|
17937
17953
|
}
|
|
17938
|
-
|
|
17939
|
-
...
|
|
17954
|
+
R = [
|
|
17955
|
+
...R,
|
|
17940
17956
|
Object.freeze({
|
|
17941
17957
|
provisionalId: `live:${w.promptId}`,
|
|
17942
17958
|
promptId: w.promptId,
|
|
@@ -17950,12 +17966,12 @@ function Ch(e = {}) {
|
|
|
17950
17966
|
if (r.mode === "legacy") return;
|
|
17951
17967
|
for (q.add(w); q.size > oc; )
|
|
17952
17968
|
q.delete(q.values().next().value);
|
|
17953
|
-
const c =
|
|
17954
|
-
c.length !==
|
|
17969
|
+
const c = R.filter((d) => d.promptId !== w);
|
|
17970
|
+
c.length !== R.length && (R = c, ne());
|
|
17955
17971
|
}
|
|
17956
17972
|
function at(w) {
|
|
17957
17973
|
if (w === "session_rewound" || w === "session.rewound" || w === "session_messages_deleted") {
|
|
17958
|
-
if ($ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Map(),
|
|
17974
|
+
if ($ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set(), U = /* @__PURE__ */ new Map(), P = void 0, qe(), D) {
|
|
17959
17975
|
ne({ mode: "legacy", fallbackReason: "too_large" });
|
|
17960
17976
|
return;
|
|
17961
17977
|
}
|
|
@@ -17965,9 +17981,9 @@ function Ch(e = {}) {
|
|
|
17965
17981
|
(w === "turn_complete" || w === "turn_error" || w === "replay_complete" || w === "session.replay_complete") && Ae();
|
|
17966
17982
|
}
|
|
17967
17983
|
async function Ae() {
|
|
17968
|
-
if (!i || !s || r.mode === "legacy" ||
|
|
17969
|
-
if (
|
|
17970
|
-
return F = !0,
|
|
17984
|
+
if (!i || !s || r.mode === "legacy" || D) return;
|
|
17985
|
+
if (X)
|
|
17986
|
+
return F = !0, X;
|
|
17971
17987
|
const c = (async () => {
|
|
17972
17988
|
do {
|
|
17973
17989
|
F = !1;
|
|
@@ -17982,13 +17998,13 @@ function Ch(e = {}) {
|
|
|
17982
17998
|
return;
|
|
17983
17999
|
zt(C);
|
|
17984
18000
|
} catch (C) {
|
|
17985
|
-
if (p !== m || h !== g || f !== ae || !oe(d) || (me(C),
|
|
18001
|
+
if (p !== m || h !== g || f !== ae || !oe(d) || (me(C), D)) return;
|
|
17986
18002
|
}
|
|
17987
18003
|
} while (F);
|
|
17988
18004
|
})().finally(() => {
|
|
17989
|
-
|
|
18005
|
+
X === c && (X = void 0, F && Ae());
|
|
17990
18006
|
});
|
|
17991
|
-
return
|
|
18007
|
+
return X = c, X;
|
|
17992
18008
|
}
|
|
17993
18009
|
async function Tt(w, c = v) {
|
|
17994
18010
|
if (dc(w), Pn(w)) return;
|
|
@@ -18038,12 +18054,12 @@ function Ch(e = {}) {
|
|
|
18038
18054
|
if (!h || !f || r.mode === "legacy")
|
|
18039
18055
|
return p;
|
|
18040
18056
|
const C = new Set(
|
|
18041
|
-
(
|
|
18057
|
+
(P ?? []).filter(
|
|
18042
18058
|
(Fe) => Fe.kind === "user" || Fe.kind === "assistant"
|
|
18043
18059
|
)
|
|
18044
18060
|
), y = /* @__PURE__ */ new Map(), k = new Map(
|
|
18045
18061
|
[...C].map((Fe) => [Fe.id, Fe])
|
|
18046
|
-
), O = /* @__PURE__ */ new Map(),
|
|
18062
|
+
), O = /* @__PURE__ */ new Map(), L = (Fe, Qt) => {
|
|
18047
18063
|
if (Fe.kind !== "user" && Fe.kind !== "assistant") return;
|
|
18048
18064
|
const pt = Fe.promptId ?? Fe.meta?.promptId ?? Qt;
|
|
18049
18065
|
return typeof pt == "string" ? `${Fe.kind}:${pt}` : void 0;
|
|
@@ -18051,7 +18067,7 @@ function Ch(e = {}) {
|
|
|
18051
18067
|
for (const Fe of C) {
|
|
18052
18068
|
for (const pt of Fe.sourceRecordIds ?? [])
|
|
18053
18069
|
y.set(pt, [...y.get(pt) ?? [], Fe]);
|
|
18054
|
-
const Qt =
|
|
18070
|
+
const Qt = L(Fe);
|
|
18055
18071
|
!Fe.sourceRecordIds?.length && Qt && O.set(Qt, [
|
|
18056
18072
|
...O.get(Qt) ?? [],
|
|
18057
18073
|
Fe
|
|
@@ -18063,16 +18079,16 @@ function Ch(e = {}) {
|
|
|
18063
18079
|
...[...C].map(
|
|
18064
18080
|
(Fe) => Fe.kind === "user" || Fe.kind === "assistant" ? Fe.text.length : 0
|
|
18065
18081
|
)
|
|
18066
|
-
),
|
|
18082
|
+
), j = z.revision, N = () => c.isCurrent() && z.revision === j && oe(h), Z = () => {
|
|
18067
18083
|
if (!N()) throw new Error("Conversation search cancelled");
|
|
18068
18084
|
};
|
|
18069
|
-
|
|
18085
|
+
Z();
|
|
18070
18086
|
const ie = async (Fe, Qt) => {
|
|
18071
18087
|
const pt = await h.getTurnIndexPage({
|
|
18072
18088
|
limit: t,
|
|
18073
18089
|
...Fe === void 0 ? {} : { snapshot: Fe, start: Qt }
|
|
18074
18090
|
});
|
|
18075
|
-
return
|
|
18091
|
+
return Z(), Li(pt, f, Fe, t), pt;
|
|
18076
18092
|
};
|
|
18077
18093
|
let Q = await ie();
|
|
18078
18094
|
const se = Q.snapshot;
|
|
@@ -18088,14 +18104,14 @@ function Ch(e = {}) {
|
|
|
18088
18104
|
limit: qn
|
|
18089
18105
|
}), Ne, Wt, sn, Po = "", to = 0, an;
|
|
18090
18106
|
for (; ; ) {
|
|
18091
|
-
|
|
18107
|
+
Z(), fs(Et, f);
|
|
18092
18108
|
const Fe = h.materializeTranscriptEvents(
|
|
18093
18109
|
Et.events,
|
|
18094
18110
|
1,
|
|
18095
18111
|
/* @__PURE__ */ new Set()
|
|
18096
18112
|
), Qt = /* @__PURE__ */ new Map();
|
|
18097
18113
|
for (const pt of Fe.encounteredRecordIds) {
|
|
18098
|
-
if (
|
|
18114
|
+
if (Z(), ce && pt === ce.turnId) {
|
|
18099
18115
|
if (Ue = ce, re += 1, re >= Q.turns.length && Ue.ordinal + 1 < Q.totalTurns) {
|
|
18100
18116
|
if (Q = await ie(se, Ue.ordinal + 1), Q.start !== Ue.ordinal + 1 || !Q.turns.length)
|
|
18101
18117
|
throw new Error("Conversation search index did not advance");
|
|
@@ -18106,7 +18122,7 @@ function Ch(e = {}) {
|
|
|
18106
18122
|
Ue && Qt.set(pt, Ue);
|
|
18107
18123
|
}
|
|
18108
18124
|
for (const pt of Fe.blocks) {
|
|
18109
|
-
|
|
18125
|
+
Z();
|
|
18110
18126
|
const rn = pt.sourceRecordIds ?? [], gn = rn.map((qt) => Qt.get(qt)).find(Boolean);
|
|
18111
18127
|
if (pt.kind !== "user" && pt.kind !== "assistant" || !rn.length)
|
|
18112
18128
|
continue;
|
|
@@ -18118,11 +18134,11 @@ function Ch(e = {}) {
|
|
|
18118
18134
|
Bo = C.delete(jn) || Bo;
|
|
18119
18135
|
let Mn;
|
|
18120
18136
|
if (!no && !Bo && pt.kind === "user" && gn) {
|
|
18121
|
-
const qt = M.get(gn.turnId)?.blockId ??
|
|
18137
|
+
const qt = M.get(gn.turnId)?.blockId ?? R.find((ko) => ko.promptId === gn.promptId)?.blockId, jn = qt ? k.get(qt) : void 0;
|
|
18122
18138
|
jn?.kind === "user" && C.has(jn) && (Mn = jn);
|
|
18123
18139
|
}
|
|
18124
18140
|
if (!Bo && !Mn && !sn) {
|
|
18125
|
-
const qt =
|
|
18141
|
+
const qt = L(pt, gn?.promptId), jn = qt ? O.get(qt) : void 0, ko = jn?.findIndex(
|
|
18126
18142
|
(Mo) => C.has(Mo) && (Mo.kind === "user" || Mo.kind === "assistant") && Mo.text.length === to && Mo.text === Ve
|
|
18127
18143
|
);
|
|
18128
18144
|
ko !== void 0 && ko >= 0 && (Mn = jn?.splice(ko, 1)[0]);
|
|
@@ -18137,7 +18153,7 @@ function Ch(e = {}) {
|
|
|
18137
18153
|
if (ts && gn && je !== Wt && (Wt = je, p.matchCount += 1, p.hits.length < 200 ? p.hits.push({
|
|
18138
18154
|
sessionId: f,
|
|
18139
18155
|
snapshot: se,
|
|
18140
|
-
revision:
|
|
18156
|
+
revision: j,
|
|
18141
18157
|
recordId: d ?? je,
|
|
18142
18158
|
...sn ? { liveBlockId: sn } : {},
|
|
18143
18159
|
turnId: gn.turnId,
|
|
@@ -18147,7 +18163,7 @@ function Ch(e = {}) {
|
|
|
18147
18163
|
}) : p.truncated = !0, d) || c.stopAfterMessages !== void 0 && p.messageCount >= c.stopAfterMessages)
|
|
18148
18164
|
return p;
|
|
18149
18165
|
}
|
|
18150
|
-
if (c.onProgress?.({ ...p, hits: [...p.hits] }),
|
|
18166
|
+
if (c.onProgress?.({ ...p, hits: [...p.hits] }), Z(), !Et.hasMore) {
|
|
18151
18167
|
if (ce)
|
|
18152
18168
|
throw new Error(
|
|
18153
18169
|
"Conversation search transcript omitted navigation turns"
|
|
@@ -18187,7 +18203,7 @@ function Ch(e = {}) {
|
|
|
18187
18203
|
throw new Error(
|
|
18188
18204
|
"Anchored transcript response did not contain its target"
|
|
18189
18205
|
);
|
|
18190
|
-
const O =
|
|
18206
|
+
const O = P?.find(
|
|
18191
18207
|
(W) => W.sourceRecordIds?.includes(w.recordId)
|
|
18192
18208
|
);
|
|
18193
18209
|
if (O) {
|
|
@@ -18214,7 +18230,7 @@ function Ch(e = {}) {
|
|
|
18214
18230
|
(W) => W.sourceRecordIds?.includes(w.recordId)
|
|
18215
18231
|
)) {
|
|
18216
18232
|
if (d(), !C()) throw new Error("Conversation search result expired");
|
|
18217
|
-
const W =
|
|
18233
|
+
const W = H.admitAnchor(
|
|
18218
18234
|
w.turnOrdinal,
|
|
18219
18235
|
w.turnId,
|
|
18220
18236
|
f.page.snapshot,
|
|
@@ -18224,11 +18240,11 @@ function Ch(e = {}) {
|
|
|
18224
18240
|
hasOlder: !!k || y.hasOlder
|
|
18225
18241
|
},
|
|
18226
18242
|
w.recordId
|
|
18227
|
-
),
|
|
18228
|
-
(
|
|
18243
|
+
), j = H.getSnapshot().pages.get(W.pageId).blocks.find(
|
|
18244
|
+
(Z) => Z.sourceRecordIds?.includes(w.recordId)
|
|
18229
18245
|
).id, N = {
|
|
18230
18246
|
...W,
|
|
18231
|
-
blockId:
|
|
18247
|
+
blockId: j,
|
|
18232
18248
|
turnId: w.turnId,
|
|
18233
18249
|
view: "historical"
|
|
18234
18250
|
};
|
|
@@ -18272,7 +18288,7 @@ function Ch(e = {}) {
|
|
|
18272
18288
|
);
|
|
18273
18289
|
let k = y.rangeId;
|
|
18274
18290
|
for (; C(); ) {
|
|
18275
|
-
const O =
|
|
18291
|
+
const O = P?.find(
|
|
18276
18292
|
(N) => N.sourceRecordIds?.includes(w.recordId)
|
|
18277
18293
|
);
|
|
18278
18294
|
if (O)
|
|
@@ -18281,10 +18297,10 @@ function Ch(e = {}) {
|
|
|
18281
18297
|
blockId: O.id,
|
|
18282
18298
|
view: "live"
|
|
18283
18299
|
});
|
|
18284
|
-
const
|
|
18285
|
-
for (const N of
|
|
18286
|
-
for (const
|
|
18287
|
-
const ie =
|
|
18300
|
+
const L = H.getSnapshot();
|
|
18301
|
+
for (const N of L.ranges)
|
|
18302
|
+
for (const Z of N.pageIds) {
|
|
18303
|
+
const ie = L.pages.get(Z)?.blocks.find(
|
|
18288
18304
|
(Q) => Q.sourceRecordIds?.includes(w.recordId)
|
|
18289
18305
|
);
|
|
18290
18306
|
if (ie)
|
|
@@ -18293,7 +18309,7 @@ function Ch(e = {}) {
|
|
|
18293
18309
|
blockId: ie.id,
|
|
18294
18310
|
view: "historical",
|
|
18295
18311
|
rangeId: N.id,
|
|
18296
|
-
pageId:
|
|
18312
|
+
pageId: Z
|
|
18297
18313
|
};
|
|
18298
18314
|
}
|
|
18299
18315
|
if (y.view === "live") {
|
|
@@ -18303,7 +18319,7 @@ function Ch(e = {}) {
|
|
|
18303
18319
|
break;
|
|
18304
18320
|
}
|
|
18305
18321
|
if (!k) break;
|
|
18306
|
-
const W =
|
|
18322
|
+
const W = L.ranges.find((N) => N.id === k);
|
|
18307
18323
|
if (!W || W.newer.kind !== "loadable" && W.newer.kind !== "cached" && W.newer.kind !== "live" && W.newer.kind !== "loading" && !(W.newer.kind === "error" && W.newer.retryable))
|
|
18308
18324
|
break;
|
|
18309
18325
|
if (W.newer.kind === "cached") {
|
|
@@ -18318,13 +18334,13 @@ function Ch(e = {}) {
|
|
|
18318
18334
|
await N;
|
|
18319
18335
|
continue;
|
|
18320
18336
|
}
|
|
18321
|
-
const
|
|
18322
|
-
if (
|
|
18337
|
+
const j = W.pageIds.at(-1);
|
|
18338
|
+
if (j && H.select(W.id, j), await ee(
|
|
18323
18339
|
W.id,
|
|
18324
18340
|
"newer",
|
|
18325
18341
|
{ isCurrent: C },
|
|
18326
18342
|
d
|
|
18327
|
-
),
|
|
18343
|
+
), H.getSnapshot().ranges.find((N) => N.id === W.id)?.pageIds.at(-1) === j)
|
|
18328
18344
|
break;
|
|
18329
18345
|
}
|
|
18330
18346
|
throw new Error("Conversation search message is unavailable");
|
|
@@ -18342,10 +18358,10 @@ function Ch(e = {}) {
|
|
|
18342
18358
|
const f = Pn(w);
|
|
18343
18359
|
if (!f) throw new Error("Turn metadata is unavailable");
|
|
18344
18360
|
const C = r.locations.get(f.entry.turnId);
|
|
18345
|
-
if (C && (C.view !== "live" || !p ||
|
|
18346
|
-
(
|
|
18361
|
+
if (C && (C.view !== "live" || !p || P?.some(
|
|
18362
|
+
(Z) => Z.sourceRecordIds?.includes(p)
|
|
18347
18363
|
)))
|
|
18348
|
-
return C.view === "historical" && C.rangeId && C.pageId &&
|
|
18364
|
+
return C.view === "historical" && C.rangeId && C.pageId && H.select(C.rangeId, C.pageId), ne({
|
|
18349
18365
|
selected: {
|
|
18350
18366
|
ordinal: w,
|
|
18351
18367
|
turnId: f.entry.turnId,
|
|
@@ -18355,16 +18371,16 @@ function Ch(e = {}) {
|
|
|
18355
18371
|
}), C;
|
|
18356
18372
|
const y = i;
|
|
18357
18373
|
if (!y) throw new Error("Session navigation is unavailable");
|
|
18358
|
-
const k = m, O = g,
|
|
18374
|
+
const k = m, O = g, L = await y.getTranscriptPage({
|
|
18359
18375
|
atRecordId: f.entry.turnId,
|
|
18360
18376
|
snapshot: f.page.snapshot,
|
|
18361
18377
|
limit: qn
|
|
18362
18378
|
});
|
|
18363
18379
|
if (h !== v || c?.isCurrent() === !1 || k !== m || O !== g || !oe(y))
|
|
18364
18380
|
throw new Error("Selection changed");
|
|
18365
|
-
if (Md(
|
|
18381
|
+
if (Md(L, s), L.partial || L.replayError)
|
|
18366
18382
|
throw new Error(
|
|
18367
|
-
|
|
18383
|
+
L.replayError ?? "Historical transcript page was partial"
|
|
18368
18384
|
);
|
|
18369
18385
|
const W = bt(f.entry.turnId);
|
|
18370
18386
|
if (W && !p)
|
|
@@ -18378,18 +18394,18 @@ function Ch(e = {}) {
|
|
|
18378
18394
|
...r.error?.operation === "locate" ? { error: void 0 } : {}
|
|
18379
18395
|
}), W;
|
|
18380
18396
|
d?.();
|
|
18381
|
-
const
|
|
18397
|
+
const j = H.admitAnchor(
|
|
18382
18398
|
w,
|
|
18383
18399
|
f.entry.turnId,
|
|
18384
18400
|
f.page.snapshot,
|
|
18385
|
-
|
|
18401
|
+
L,
|
|
18386
18402
|
p
|
|
18387
18403
|
), N = {
|
|
18388
18404
|
turnId: f.entry.turnId,
|
|
18389
|
-
blockId:
|
|
18405
|
+
blockId: j.blockId,
|
|
18390
18406
|
view: "historical",
|
|
18391
|
-
rangeId:
|
|
18392
|
-
pageId:
|
|
18407
|
+
rangeId: j.rangeId,
|
|
18408
|
+
pageId: j.pageId
|
|
18393
18409
|
};
|
|
18394
18410
|
return ne({
|
|
18395
18411
|
selected: {
|
|
@@ -18424,21 +18440,21 @@ function Ch(e = {}) {
|
|
|
18424
18440
|
const h = i;
|
|
18425
18441
|
if (!h || d && !d.isCurrent())
|
|
18426
18442
|
return;
|
|
18427
|
-
const f =
|
|
18443
|
+
const f = H.beginBoundaryLoad(w, c);
|
|
18428
18444
|
if (!f) return;
|
|
18429
18445
|
const C = () => r.error?.operation === c && r.error.rangeId === w ? { error: void 0 } : {};
|
|
18430
18446
|
ne(C());
|
|
18431
18447
|
const y = m, k = g, O = () => {
|
|
18432
|
-
const
|
|
18433
|
-
return y === m && k === g && oe(h) &&
|
|
18448
|
+
const L = H.getSnapshot().ranges.find((W) => W.id === w)?.[c];
|
|
18449
|
+
return y === m && k === g && oe(h) && L?.kind === "loading" && L.request === f && (d?.isCurrent() ?? !0);
|
|
18434
18450
|
};
|
|
18435
18451
|
try {
|
|
18436
|
-
let
|
|
18452
|
+
let L, W;
|
|
18437
18453
|
if (f.kind === "gap") {
|
|
18438
|
-
const Q =
|
|
18454
|
+
const Q = H.getSnapshot().ranges.find((Ne) => Ne.id === w);
|
|
18439
18455
|
if (!Q) return;
|
|
18440
18456
|
const se = "beforeRecordId" in Q || f.beforeAnchor;
|
|
18441
|
-
|
|
18457
|
+
L = await h.getTranscriptPage({
|
|
18442
18458
|
...se ? { beforeRecordId: f.anchorRecordId } : { atRecordId: f.anchorRecordId },
|
|
18443
18459
|
snapshot: f.snapshot,
|
|
18444
18460
|
limit: qn
|
|
@@ -18446,10 +18462,10 @@ function Ch(e = {}) {
|
|
|
18446
18462
|
let re = !0, ce, Ue = !1, Et;
|
|
18447
18463
|
for (; ; ) {
|
|
18448
18464
|
if (!O()) return;
|
|
18449
|
-
if (fs(
|
|
18465
|
+
if (fs(L, s), re && !se && "anchorTurnId" in Q && L.targetRecordId !== f.anchorRecordId)
|
|
18450
18466
|
throw new Error("Gap recovery response did not contain its anchor");
|
|
18451
18467
|
const Ne = h.materializeTranscriptEvents(
|
|
18452
|
-
|
|
18468
|
+
L.events,
|
|
18453
18469
|
1,
|
|
18454
18470
|
/* @__PURE__ */ new Set()
|
|
18455
18471
|
).encounteredRecordIds, Wt = Ne.indexOf(f.afterRecordId);
|
|
@@ -18457,7 +18473,7 @@ function Ch(e = {}) {
|
|
|
18457
18473
|
Wt < Ne.length - 1 ? W = {
|
|
18458
18474
|
excludedRecordIds: Ne.slice(0, Wt + 1),
|
|
18459
18475
|
fromAnchor: re
|
|
18460
|
-
} : ce ? (
|
|
18476
|
+
} : ce ? (L = ce, W = {
|
|
18461
18477
|
excludedRecordIds: [],
|
|
18462
18478
|
fromAnchor: Ue
|
|
18463
18479
|
}) : W = { excludedRecordIds: Ne, fromAnchor: re };
|
|
@@ -18468,14 +18484,14 @@ function Ch(e = {}) {
|
|
|
18468
18484
|
throw new Error(
|
|
18469
18485
|
"Gap recovery did not advance to the retained record"
|
|
18470
18486
|
);
|
|
18471
|
-
Et = sn, ce =
|
|
18487
|
+
Et = sn, ce = L, Ue = re, L = await h.getTranscriptPage({
|
|
18472
18488
|
beforeRecordId: sn,
|
|
18473
18489
|
snapshot: f.snapshot,
|
|
18474
18490
|
limit: qn
|
|
18475
18491
|
}), re = !1;
|
|
18476
18492
|
}
|
|
18477
18493
|
} else
|
|
18478
|
-
|
|
18494
|
+
L = await h.getTranscriptPage(
|
|
18479
18495
|
f.kind === "older" ? {
|
|
18480
18496
|
beforeRecordId: f.beforeRecordId,
|
|
18481
18497
|
snapshot: f.snapshot,
|
|
@@ -18483,35 +18499,35 @@ function Ch(e = {}) {
|
|
|
18483
18499
|
} : { cursor: f.cursor, limit: qn }
|
|
18484
18500
|
);
|
|
18485
18501
|
if (!O()) return;
|
|
18486
|
-
const
|
|
18502
|
+
const j = H.getSnapshot(), N = j.ranges.find((Q) => Q.id === w);
|
|
18487
18503
|
if (!N || N[c].kind !== "loading") return;
|
|
18488
|
-
fs(
|
|
18489
|
-
const
|
|
18504
|
+
fs(L, s);
|
|
18505
|
+
const Z = N.pageIds[0], ie = Z ? j.pages.get(Z)?.snapshot : void 0;
|
|
18490
18506
|
if (!ie || (p?.(), !O())) return;
|
|
18491
|
-
|
|
18507
|
+
H.admitBoundary(
|
|
18492
18508
|
w,
|
|
18493
18509
|
c,
|
|
18494
18510
|
f.kind !== "cursor" ? f.snapshot : ie,
|
|
18495
|
-
|
|
18511
|
+
L,
|
|
18496
18512
|
W
|
|
18497
18513
|
), ne(C());
|
|
18498
|
-
} catch (
|
|
18514
|
+
} catch (L) {
|
|
18499
18515
|
if (!O()) return;
|
|
18500
|
-
const W =
|
|
18516
|
+
const W = H.getSnapshot().ranges.find((j) => j.id === w);
|
|
18501
18517
|
if (!W || W[c].kind !== "loading") return;
|
|
18502
|
-
if (d &&
|
|
18503
|
-
throw
|
|
18504
|
-
if (da(
|
|
18518
|
+
if (d && L instanceof fo)
|
|
18519
|
+
throw H.cancelBoundaryLoad(w, c, f), ne(C()), L;
|
|
18520
|
+
if (da(L))
|
|
18505
18521
|
ut();
|
|
18506
18522
|
else {
|
|
18507
|
-
const
|
|
18508
|
-
|
|
18509
|
-
error: ca(c,
|
|
18510
|
-
}), mn(
|
|
18523
|
+
const j = ya(L);
|
|
18524
|
+
H.failBoundaryLoad(w, c, f, j), ne({
|
|
18525
|
+
error: ca(c, L, j, w)
|
|
18526
|
+
}), mn(L) === 409 && Ae();
|
|
18511
18527
|
}
|
|
18512
|
-
throw
|
|
18528
|
+
throw L;
|
|
18513
18529
|
} finally {
|
|
18514
|
-
d && !d.isCurrent() && y === m && k === g && (
|
|
18530
|
+
d && !d.isCurrent() && y === m && k === g && (H.cancelBoundaryLoad(w, c, f), ne());
|
|
18515
18531
|
}
|
|
18516
18532
|
}
|
|
18517
18533
|
async function At(w, c) {
|
|
@@ -18526,7 +18542,7 @@ function Ch(e = {}) {
|
|
|
18526
18542
|
}), k;
|
|
18527
18543
|
for (; f(); ) {
|
|
18528
18544
|
fs(y, s);
|
|
18529
|
-
const O =
|
|
18545
|
+
const O = H.admitBefore(
|
|
18530
18546
|
w,
|
|
18531
18547
|
C.snapshot,
|
|
18532
18548
|
y
|
|
@@ -18543,7 +18559,7 @@ function Ch(e = {}) {
|
|
|
18543
18559
|
throw new Error("History view changed");
|
|
18544
18560
|
}
|
|
18545
18561
|
async function Rn(w, c) {
|
|
18546
|
-
if (await
|
|
18562
|
+
if (await X, !c()) throw new Error("History view changed");
|
|
18547
18563
|
const d = ++ae;
|
|
18548
18564
|
try {
|
|
18549
18565
|
const p = await w.getTurnIndexPage({
|
|
@@ -18557,8 +18573,8 @@ function Ch(e = {}) {
|
|
|
18557
18573
|
throw c() && d === ae && me(p), p;
|
|
18558
18574
|
}
|
|
18559
18575
|
}
|
|
18560
|
-
async function
|
|
18561
|
-
const h =
|
|
18576
|
+
async function ee(w, c, d, p) {
|
|
18577
|
+
const h = H.getSnapshot().ranges.find((L) => L.id === w);
|
|
18562
18578
|
if (!h || !d.isCurrent()) return;
|
|
18563
18579
|
if (c !== "newer" || h.newer.kind !== "live")
|
|
18564
18580
|
return Zt(w, c, d, p);
|
|
@@ -18566,7 +18582,7 @@ function Ch(e = {}) {
|
|
|
18566
18582
|
if (!C || !f?.reachable || !f.beforeRecordId || Ot(h.id) || "beforeRecordId" in h && f.beforeRecordId === h.beforeRecordId)
|
|
18567
18583
|
return;
|
|
18568
18584
|
const y = z.revision, k = () => d.isCurrent() && f.isCurrent() && z.revision === y && oe(C), O = await Rn(C, k);
|
|
18569
|
-
return
|
|
18585
|
+
return H.reopenLiveBoundary(
|
|
18570
18586
|
w,
|
|
18571
18587
|
f.beforeRecordId,
|
|
18572
18588
|
O.snapshot
|
|
@@ -18578,7 +18594,7 @@ function Ch(e = {}) {
|
|
|
18578
18594
|
);
|
|
18579
18595
|
}
|
|
18580
18596
|
function Ot(w) {
|
|
18581
|
-
const c =
|
|
18597
|
+
const c = H.getSnapshot(), d = c.ranges.find((h) => h.id === w), p = d ? c.pages.get(d.pageIds.at(-1))?.lastRecordId : void 0;
|
|
18582
18598
|
return p !== void 0 && B.has(p);
|
|
18583
18599
|
}
|
|
18584
18600
|
async function Sn() {
|
|
@@ -18594,7 +18610,7 @@ function Ch(e = {}) {
|
|
|
18594
18610
|
await yn(r.selected.ordinal);
|
|
18595
18611
|
return;
|
|
18596
18612
|
}
|
|
18597
|
-
const d = r.error?.rangeId, p =
|
|
18613
|
+
const d = r.error?.rangeId, p = H.getSnapshot().ranges;
|
|
18598
18614
|
if (c === "older" || c === "newer") {
|
|
18599
18615
|
const h = p.find(
|
|
18600
18616
|
(f) => (d === void 0 || f.id === d) && f[c].kind === "error"
|
|
@@ -18673,7 +18689,7 @@ function Ch(e = {}) {
|
|
|
18673
18689
|
view: "live"
|
|
18674
18690
|
});
|
|
18675
18691
|
}
|
|
18676
|
-
|
|
18692
|
+
R = R.filter((d) => {
|
|
18677
18693
|
const p = c.find(
|
|
18678
18694
|
(h) => h.promptId === d.promptId
|
|
18679
18695
|
);
|
|
@@ -18688,7 +18704,7 @@ function Ch(e = {}) {
|
|
|
18688
18704
|
}), dt();
|
|
18689
18705
|
}
|
|
18690
18706
|
function dt() {
|
|
18691
|
-
|
|
18707
|
+
H.setLiveRecordIds([...B, ...M.keys()]);
|
|
18692
18708
|
}
|
|
18693
18709
|
function Xt(w) {
|
|
18694
18710
|
const c = r.selected?.ordinal, d = () => [...E.values()].reduce(
|
|
@@ -18717,7 +18733,7 @@ function Ch(e = {}) {
|
|
|
18717
18733
|
});
|
|
18718
18734
|
}
|
|
18719
18735
|
function ut() {
|
|
18720
|
-
|
|
18736
|
+
D = !0, S = !1, g += 1, v += 1, E = /* @__PURE__ */ new Map(), R = [], q.clear(), M = /* @__PURE__ */ new Map(), H.reset(), ne({
|
|
18721
18737
|
mode: "legacy",
|
|
18722
18738
|
fallbackReason: "too_large",
|
|
18723
18739
|
totalTurns: 0,
|
|
@@ -18748,9 +18764,9 @@ function Ch(e = {}) {
|
|
|
18748
18764
|
},
|
|
18749
18765
|
openBeforeLive: At,
|
|
18750
18766
|
setViewportAnchor: (w, c) => {
|
|
18751
|
-
|
|
18767
|
+
H.setViewportAnchor(w, c), c && H.clearSelection();
|
|
18752
18768
|
},
|
|
18753
|
-
loadViewportBoundary:
|
|
18769
|
+
loadViewportBoundary: ee,
|
|
18754
18770
|
subscribe(w) {
|
|
18755
18771
|
return a.add(w), () => a.delete(w);
|
|
18756
18772
|
},
|
|
@@ -18910,8 +18926,8 @@ function Dh(e, t, n) {
|
|
|
18910
18926
|
o.add(U);
|
|
18911
18927
|
const a = (B) => {
|
|
18912
18928
|
if (B?.kind !== "user") return;
|
|
18913
|
-
const U = B.text ?? "",
|
|
18914
|
-
return `${U}\0img:${
|
|
18929
|
+
const U = B.text ?? "", P = B.images?.length ?? 0, V = B.files?.length ?? 0;
|
|
18930
|
+
return `${U}\0img:${P}\0file:${V}`;
|
|
18915
18931
|
}, r = e.blocks[0], s = (r?.sourceRecordIds?.length ?? 0) === 0 ? a(r) : void 0, i = o.size === 0 ? t : t.filter(
|
|
18916
18932
|
(B) => !B.sourceRecordIds?.some(
|
|
18917
18933
|
(U) => o.has(U)
|
|
@@ -18945,7 +18961,7 @@ function Dh(e, t, n) {
|
|
|
18945
18961
|
), v = g.reduce(
|
|
18946
18962
|
(B, U) => B + Ma(U),
|
|
18947
18963
|
0
|
|
18948
|
-
), I = v - e.retainedBytes, E = g.length - e.blocks.length, { droppedModLogIds:
|
|
18964
|
+
), I = v - e.retainedBytes, E = g.length - e.blocks.length, { droppedModLogIds: R, remainingBlocks: q, remainingBytes: $ } = Dd(e, g.length, v, n), M = E >= n || I >= e.maxRetainedBytes;
|
|
18949
18965
|
return q > n ? {
|
|
18950
18966
|
admitted: !1,
|
|
18951
18967
|
reason: "count",
|
|
@@ -18962,7 +18978,7 @@ function Dh(e, t, n) {
|
|
|
18962
18978
|
admitted: !0,
|
|
18963
18979
|
materialization: {
|
|
18964
18980
|
blocks: m,
|
|
18965
|
-
droppedModLogIds:
|
|
18981
|
+
droppedModLogIds: R,
|
|
18966
18982
|
nextOrdinal: u.nextOrdinal,
|
|
18967
18983
|
toolBlockByCallId: u.toolBlockByCallId,
|
|
18968
18984
|
permissionBlockByRequestId: u.permissionBlockByRequestId,
|
|
@@ -19042,9 +19058,9 @@ function En(e, t) {
|
|
|
19042
19058
|
function Lh(e) {
|
|
19043
19059
|
const t = ke(e.rawInput) ? e.rawInput : void 0, n = ke(e.rawOutput) ? e.rawOutput : void 0, o = e.toolName?.toLowerCase();
|
|
19044
19060
|
if (!(o === "agent" || o === "task" || typeof t?.subagent_type == "string" || n?.type === "task_execution")) return e;
|
|
19045
|
-
const r = ke(n?.executionSummary) ? n.executionSummary : void 0, s = En(t?.subagent_type, 120), i = En(t?.prompt, 240), l = En(t?.description, 240), u = En(t?.working_dir, 240), m = En(t?.name, 120), g = typeof t?.todo_id == "string" ? t.todo_id : void 0, v = En(n?.subagentName, 120), I = En(n?.subagentColor, 80), E = En(n?.taskDescription, 240),
|
|
19046
|
-
(
|
|
19047
|
-
) : [],
|
|
19061
|
+
const r = ke(n?.executionSummary) ? n.executionSummary : void 0, s = En(t?.subagent_type, 120), i = En(t?.prompt, 240), l = En(t?.description, 240), u = En(t?.working_dir, 240), m = En(t?.name, 120), g = typeof t?.todo_id == "string" ? t.todo_id : void 0, v = En(n?.subagentName, 120), I = En(n?.subagentColor, 80), E = En(n?.taskDescription, 240), R = En(n?.status, 80), q = R ?? e.status, $ = q === "completed" || q === "failed" || q === "cancelled", M = n?.executionMode, B = En(n?.terminateReason, 240), U = Array.isArray(n?.skills) ? n.skills.slice(0, 32).flatMap(
|
|
19062
|
+
(X) => En(X, 120) ? [En(X, 120)] : []
|
|
19063
|
+
) : [], P = t ? {
|
|
19048
19064
|
...s ? { subagent_type: s } : {},
|
|
19049
19065
|
...i ? { prompt: i } : {},
|
|
19050
19066
|
...l ? { description: l } : {},
|
|
@@ -19057,7 +19073,7 @@ function Lh(e) {
|
|
|
19057
19073
|
...v ? { subagentName: v } : {},
|
|
19058
19074
|
...I ? { subagentColor: I } : {},
|
|
19059
19075
|
...E ? { taskDescription: E } : {},
|
|
19060
|
-
...
|
|
19076
|
+
...R ? { status: R } : {},
|
|
19061
19077
|
...Ic(M) ? { executionMode: M } : {},
|
|
19062
19078
|
...typeof n.subagentSessionReady == "boolean" ? { subagentSessionReady: n.subagentSessionReady } : {},
|
|
19063
19079
|
...B ? { terminateReason: B } : {},
|
|
@@ -19073,8 +19089,8 @@ function Lh(e) {
|
|
|
19073
19089
|
"cachedTokens",
|
|
19074
19090
|
"totalTokens"
|
|
19075
19091
|
].filter(
|
|
19076
|
-
(
|
|
19077
|
-
).map((
|
|
19092
|
+
(X) => typeof r[X] == "number"
|
|
19093
|
+
).map((X) => [X, r[X]])
|
|
19078
19094
|
) : {},
|
|
19079
19095
|
...typeof r.totalToolCalls == "number" ? { totalToolCalls: r.totalToolCalls } : {},
|
|
19080
19096
|
...typeof r.totalDurationMs == "number" ? { totalDurationMs: r.totalDurationMs } : {}
|
|
@@ -19083,7 +19099,7 @@ function Lh(e) {
|
|
|
19083
19099
|
} : void 0;
|
|
19084
19100
|
return {
|
|
19085
19101
|
...e,
|
|
19086
|
-
...
|
|
19102
|
+
...P && Object.keys(P).length > 0 ? { rawInput: P } : { rawInput: void 0 },
|
|
19087
19103
|
...V && Object.keys(V).length > 0 ? { rawOutput: V } : { rawOutput: void 0 },
|
|
19088
19104
|
content: void 0,
|
|
19089
19105
|
details: void 0
|
|
@@ -19157,21 +19173,21 @@ function Cw(e) {
|
|
|
19157
19173
|
historyPageSize: v,
|
|
19158
19174
|
subagentTranscriptMode: I = "full",
|
|
19159
19175
|
suppressOwnUserEcho: E = !0,
|
|
19160
|
-
includeRawEvent:
|
|
19176
|
+
includeRawEvent: R = !1,
|
|
19161
19177
|
prefetchGitBranch: q = !0,
|
|
19162
19178
|
prefetchSkills: $ = !0,
|
|
19163
19179
|
autoConnect: M = !0,
|
|
19164
19180
|
autoReconnect: B = !0,
|
|
19165
19181
|
restartEventStreamOnPrompt: U = !1,
|
|
19166
|
-
reconnectDelayMs:
|
|
19182
|
+
reconnectDelayMs: P = 1e3,
|
|
19167
19183
|
maxReconnectDelayMs: V = 1e4,
|
|
19168
|
-
heartbeatIntervalMs:
|
|
19184
|
+
heartbeatIntervalMs: X = 3e4,
|
|
19169
19185
|
heartbeatFailureThreshold: ae = 3,
|
|
19170
19186
|
loadWarnings: et,
|
|
19171
19187
|
children: F
|
|
19172
|
-
} = e, S = Qm(),
|
|
19173
|
-
z.current =
|
|
19174
|
-
const
|
|
19188
|
+
} = e, S = Qm(), D = pr(), H = ur(), z = J(H);
|
|
19189
|
+
z.current = H;
|
|
19190
|
+
const Y = t ?? S?.baseUrl, oe = n ?? S?.token, ne = $e(() => {
|
|
19175
19191
|
try {
|
|
19176
19192
|
return {
|
|
19177
19193
|
value: Nc(
|
|
@@ -19207,7 +19223,7 @@ function Cw(e) {
|
|
|
19207
19223
|
eo.current = qe;
|
|
19208
19224
|
const At = J(Pe), Rn = J(Ie);
|
|
19209
19225
|
Ie && (Rn.current = Ie);
|
|
19210
|
-
const
|
|
19226
|
+
const ee = J(void 0), Ot = J(
|
|
19211
19227
|
/* @__PURE__ */ new WeakMap()
|
|
19212
19228
|
), Sn = J(
|
|
19213
19229
|
void 0
|
|
@@ -19230,25 +19246,25 @@ function Cw(e) {
|
|
|
19230
19246
|
retainSubagentBlocks: I === "full",
|
|
19231
19247
|
onTruncation: (A) => {
|
|
19232
19248
|
if (A.kind !== "blocks") return;
|
|
19233
|
-
const b = He.current, G =
|
|
19249
|
+
const b = He.current, G = ee.current;
|
|
19234
19250
|
if (!(!G || b.sessionId !== G.sessionId)) {
|
|
19235
19251
|
if (A.evictedOldest !== !1)
|
|
19236
19252
|
if (b.persistedReachable = !0, A.oldestRetainedRecordId !== void 0) {
|
|
19237
19253
|
if (b.beforeRecordId = A.oldestRetainedRecordId, b.cursor = void 0, b.rejectedPage) {
|
|
19238
|
-
const
|
|
19254
|
+
const te = me.getSnapshot(), Re = A.blockCount ?? te.blocks.length, ye = A.retainedBytes ?? te.retainedBytes, We = A.oldestRetainedRecordId, gt = A.replacedReplay === !0 && We !== void 0 && !te.blocks.some(
|
|
19239
19255
|
(kt) => kt.sourceRecordIds?.includes(We)
|
|
19240
19256
|
);
|
|
19241
19257
|
b.rejectedPage = gt ? void 0 : {
|
|
19242
|
-
blocks: b.rejectedPage.blocks + Math.max(0,
|
|
19258
|
+
blocks: b.rejectedPage.blocks + Math.max(0, te.blocks.length - Re),
|
|
19243
19259
|
bytes: b.rejectedPage.bytes + Math.max(
|
|
19244
19260
|
0,
|
|
19245
|
-
|
|
19261
|
+
te.retainedBytes - ye
|
|
19246
19262
|
)
|
|
19247
19263
|
};
|
|
19248
19264
|
}
|
|
19249
19265
|
if (!b.capacityReached && !b.hasMore) {
|
|
19250
|
-
const
|
|
19251
|
-
Array.isArray(
|
|
19266
|
+
const te = ze.current?.features, Re = me.getSnapshot(), ye = A.retainedBytes ?? Re.retainedBytes, We = A.maxRetainedBytes ?? Re.maxRetainedBytes;
|
|
19267
|
+
Array.isArray(te) && te.includes(vs) && ye < We && (b.hasMore = !0, $t({
|
|
19252
19268
|
hasMore: !0,
|
|
19253
19269
|
loading: !1,
|
|
19254
19270
|
capacityReached: !1,
|
|
@@ -19263,7 +19279,7 @@ function Cw(e) {
|
|
|
19263
19279
|
paginationError: b.paginationError
|
|
19264
19280
|
}));
|
|
19265
19281
|
if (A.evictedOldest !== !1 && (Xt.current += 1), b.capacityReached) {
|
|
19266
|
-
const
|
|
19282
|
+
const te = ze.current?.features, Re = Array.isArray(te) && te.includes(vs), ye = b.beforeRecordId !== void 0 || b.cursor !== void 0;
|
|
19267
19283
|
if (!Re || !ye)
|
|
19268
19284
|
return;
|
|
19269
19285
|
const We = me.getSnapshot(), gt = A.blockCount ?? We.blocks.length, kt = A.retainedBytes ?? We.retainedBytes, Ge = A.maxBlocks ?? We.maxBlocks, Je = A.maxRetainedBytes ?? We.maxRetainedBytes, Me = b.rejectedPage, io = Me ? Me.blocks + gt <= Ge && Me.bytes + kt <= Je : gt < Ge, tt = () => {
|
|
@@ -19281,7 +19297,7 @@ function Cw(e) {
|
|
|
19281
19297
|
if (!Me || A.evictedOldest !== !1) return;
|
|
19282
19298
|
const { beforeRecordId: Ft, cursor: ro } = b, ss = Xt.current;
|
|
19283
19299
|
queueMicrotask(() => {
|
|
19284
|
-
if (
|
|
19300
|
+
if (ee.current !== G || He.current !== b || Xt.current !== ss || b.rejectedPage !== Me || b.beforeRecordId !== Ft || b.cursor !== ro || !b.capacityReached || b.loading)
|
|
19285
19301
|
return;
|
|
19286
19302
|
const Bs = me.getSnapshot(), { droppedModLogIds: ue, remainingBlocks: we, remainingBytes: xt } = Dd(
|
|
19287
19303
|
Bs,
|
|
@@ -19299,11 +19315,11 @@ function Cw(e) {
|
|
|
19299
19315
|
), ut = $e(
|
|
19300
19316
|
() => Ch({
|
|
19301
19317
|
captureLiveBoundary: () => {
|
|
19302
|
-
const A = He.current, b =
|
|
19318
|
+
const A = He.current, b = ee.current, G = Xt.current, te = A.beforeRecordId, Re = O.current;
|
|
19303
19319
|
return {
|
|
19304
|
-
beforeRecordId:
|
|
19305
|
-
reachable: !!b && b.sessionId === A.sessionId && !!
|
|
19306
|
-
isCurrent: () =>
|
|
19320
|
+
beforeRecordId: te,
|
|
19321
|
+
reachable: !!b && b.sessionId === A.sessionId && !!te && !Re && !A.loading && (A.persistedReachable ?? A.hasMore),
|
|
19322
|
+
isCurrent: () => ee.current === b && He.current === A && A.beforeRecordId === te && !A.loading && Xt.current === G && O.current === Re
|
|
19307
19323
|
};
|
|
19308
19324
|
}
|
|
19309
19325
|
}),
|
|
@@ -19321,10 +19337,10 @@ function Cw(e) {
|
|
|
19321
19337
|
h.current.add(b);
|
|
19322
19338
|
const G = [...p.current];
|
|
19323
19339
|
queueMicrotask(() => {
|
|
19324
|
-
for (const
|
|
19325
|
-
if (p.current.has(
|
|
19340
|
+
for (const te of G)
|
|
19341
|
+
if (p.current.has(te))
|
|
19326
19342
|
try {
|
|
19327
|
-
|
|
19343
|
+
te(A);
|
|
19328
19344
|
} catch (Re) {
|
|
19329
19345
|
console.error(
|
|
19330
19346
|
"[DaemonSessionProvider] prompt settlement listener failed",
|
|
@@ -19338,12 +19354,12 @@ function Cw(e) {
|
|
|
19338
19354
|
void 0
|
|
19339
19355
|
), k = J(0), O = J(
|
|
19340
19356
|
void 0
|
|
19341
|
-
),
|
|
19357
|
+
), L = J(void 0), W = J(void 0), j = J(void 0), N = J(void 0), Z = J(
|
|
19342
19358
|
void 0
|
|
19343
19359
|
), ie = J(!1), Q = J({
|
|
19344
19360
|
consecutiveFailures: 0
|
|
19345
|
-
}), se = J(!1), re = J(void 0), ce = J(void 0), Ue = J(void 0), Et = J(/* @__PURE__ */ new WeakSet()), Ne = J({ suppressOwnUserEcho: E, includeRawEvent:
|
|
19346
|
-
Ne.current = { suppressOwnUserEcho: E, includeRawEvent:
|
|
19361
|
+
}), se = J(!1), re = J(void 0), ce = J(void 0), Ue = J(void 0), Et = J(/* @__PURE__ */ new WeakSet()), Ne = J({ suppressOwnUserEcho: E, includeRawEvent: R }), Wt = J({ reconnectDelayMs: P, maxReconnectDelayMs: V }), sn = J(void 0), Po = J(et), to = J(v), an = J(I), Fe = J(oa(s));
|
|
19362
|
+
Ne.current = { suppressOwnUserEcho: E, includeRawEvent: R }, Wt.current = { reconnectDelayMs: P, maxReconnectDelayMs: V }, Po.current = et, to.current = v, an.current = I;
|
|
19347
19363
|
const Qt = l?.modelServiceId, pt = l?.sessionScope, rn = J(l);
|
|
19348
19364
|
rn.current = l;
|
|
19349
19365
|
const [gn, je] = wt("idle"), no = J(gn);
|
|
@@ -19358,29 +19374,29 @@ function Cw(e) {
|
|
|
19358
19374
|
...Ie ? { workspaceCwd: Ie } : {},
|
|
19359
19375
|
...qe ? { error: qe } : {}
|
|
19360
19376
|
}), hn = hh(
|
|
19361
|
-
|
|
19377
|
+
Y,
|
|
19362
19378
|
De
|
|
19363
19379
|
), xe = J(De);
|
|
19364
19380
|
xe.current = De;
|
|
19365
19381
|
const xr = It(hc), Zd = $e(() => {
|
|
19366
|
-
const A = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), G = (
|
|
19367
|
-
for (const Re of A) Re(
|
|
19382
|
+
const A = /* @__PURE__ */ new Set(), b = /* @__PURE__ */ new Set(), G = (te) => {
|
|
19383
|
+
for (const Re of A) Re(te);
|
|
19368
19384
|
};
|
|
19369
19385
|
return {
|
|
19370
|
-
subscribeInvalidation(
|
|
19371
|
-
return A.add(
|
|
19372
|
-
A.delete(
|
|
19386
|
+
subscribeInvalidation(te) {
|
|
19387
|
+
return A.add(te), () => {
|
|
19388
|
+
A.delete(te);
|
|
19373
19389
|
};
|
|
19374
19390
|
},
|
|
19375
19391
|
invalidate: G,
|
|
19376
|
-
registerScope(
|
|
19377
|
-
return b.add(
|
|
19378
|
-
b.delete(
|
|
19392
|
+
registerScope(te) {
|
|
19393
|
+
return b.add(te), () => {
|
|
19394
|
+
b.delete(te);
|
|
19379
19395
|
};
|
|
19380
19396
|
},
|
|
19381
|
-
captureSessionDeletion(
|
|
19397
|
+
captureSessionDeletion(te, Re) {
|
|
19382
19398
|
const ye = [...b].filter(
|
|
19383
|
-
(We) => Re !== void 0 && We.workspaceCwd === Re && We.baseUrl ===
|
|
19399
|
+
(We) => Re !== void 0 && We.workspaceCwd === Re && We.baseUrl === te.baseUrl && We.token === te.token
|
|
19384
19400
|
).map((We) => We.id);
|
|
19385
19401
|
return (We) => {
|
|
19386
19402
|
for (const gt of ye)
|
|
@@ -19390,8 +19406,8 @@ function Cw(e) {
|
|
|
19390
19406
|
}
|
|
19391
19407
|
};
|
|
19392
19408
|
}, []), fn = xr?.lifecycle ?? Zd, Rr = $e(
|
|
19393
|
-
() => ({ resolvedBaseUrl:
|
|
19394
|
-
[
|
|
19409
|
+
() => ({ resolvedBaseUrl: Y, resolvedToken: oe, resolvedWorkspaceCwd: Ie }),
|
|
19410
|
+
[Y, oe, Ie]
|
|
19395
19411
|
), Os = J(Rr);
|
|
19396
19412
|
Os.current = Rr;
|
|
19397
19413
|
const Pr = J(void 0), Ua = de(() => {
|
|
@@ -19404,16 +19420,16 @@ function Cw(e) {
|
|
|
19404
19420
|
}, []), Oa = Ua()?.cwd ?? Ie ?? De.workspaceCwd, Wa = $e(
|
|
19405
19421
|
() => ({
|
|
19406
19422
|
id: String(++Uh),
|
|
19407
|
-
baseUrl:
|
|
19423
|
+
baseUrl: Y,
|
|
19408
19424
|
token: oe,
|
|
19409
19425
|
workspaceCwd: Oa
|
|
19410
19426
|
}),
|
|
19411
|
-
[Oa,
|
|
19427
|
+
[Oa, Y, oe]
|
|
19412
19428
|
), qa = xr?.scope, Mr = J(qa);
|
|
19413
19429
|
Mr.current = qa;
|
|
19414
19430
|
const Nt = gc(
|
|
19415
19431
|
[qa, Wa],
|
|
19416
|
-
|
|
19432
|
+
Y,
|
|
19417
19433
|
oe,
|
|
19418
19434
|
Oa
|
|
19419
19435
|
), Na = J(Nt);
|
|
@@ -19423,12 +19439,12 @@ function Cw(e) {
|
|
|
19423
19439
|
const b = Ua(), G = Os.current;
|
|
19424
19440
|
return gc(
|
|
19425
19441
|
[Mr.current, Na.current],
|
|
19426
|
-
|
|
19442
|
+
Y,
|
|
19427
19443
|
oe,
|
|
19428
19444
|
b && (b.requestedCwd === A || G.resolvedWorkspaceCwd === A) ? b.cwd : A
|
|
19429
19445
|
);
|
|
19430
19446
|
},
|
|
19431
|
-
[Ua,
|
|
19447
|
+
[Ua, Y, oe]
|
|
19432
19448
|
), jo = J(
|
|
19433
19449
|
/* @__PURE__ */ new WeakMap()
|
|
19434
19450
|
), _r = J(
|
|
@@ -19446,9 +19462,9 @@ function Cw(e) {
|
|
|
19446
19462
|
}, [fn, Nt, Wa]);
|
|
19447
19463
|
const ln = de(
|
|
19448
19464
|
(A, b, G = A.sessionId) => {
|
|
19449
|
-
const
|
|
19450
|
-
|
|
19451
|
-
scopeId:
|
|
19465
|
+
const te = jo.current.get(A);
|
|
19466
|
+
te && fn.invalidate({
|
|
19467
|
+
scopeId: te,
|
|
19452
19468
|
...G !== null ? { sessionId: G } : {},
|
|
19453
19469
|
reason: b
|
|
19454
19470
|
});
|
|
@@ -19475,7 +19491,7 @@ function Cw(e) {
|
|
|
19475
19491
|
createdAt: A.createdAt ?? Date.now()
|
|
19476
19492
|
};
|
|
19477
19493
|
return Fa(
|
|
19478
|
-
(G) => G.some((
|
|
19494
|
+
(G) => G.some((te) => te.id === b.id) ? G : [...G.slice(-49), b]
|
|
19479
19495
|
), b;
|
|
19480
19496
|
}, []), so = de((A) => {
|
|
19481
19497
|
Fa((b) => b.filter((G) => G.id !== A));
|
|
@@ -19503,8 +19519,8 @@ function Cw(e) {
|
|
|
19503
19519
|
}, [me, ut]);
|
|
19504
19520
|
const Lr = de(
|
|
19505
19521
|
(A, b, G) => {
|
|
19506
|
-
const
|
|
19507
|
-
if (!
|
|
19522
|
+
const te = ee.current;
|
|
19523
|
+
if (!te)
|
|
19508
19524
|
throw new Error("Session changed before transcript materialization");
|
|
19509
19525
|
const Re = bs({
|
|
19510
19526
|
nextOrdinal: b,
|
|
@@ -19527,7 +19543,7 @@ function Cw(e) {
|
|
|
19527
19543
|
Je,
|
|
19528
19544
|
pa(
|
|
19529
19545
|
Je,
|
|
19530
|
-
|
|
19546
|
+
te.clientId,
|
|
19531
19547
|
ye,
|
|
19532
19548
|
Ee,
|
|
19533
19549
|
{ updateConnection: !1, suppressLog: !0 }
|
|
@@ -19558,7 +19574,7 @@ function Cw(e) {
|
|
|
19558
19574
|
[cn, so]
|
|
19559
19575
|
), Ur = Ho?.features.includes(fh) ?? !1;
|
|
19560
19576
|
ct(() => {
|
|
19561
|
-
const A =
|
|
19577
|
+
const A = ee.current, b = De.status === "connected" && A?.sessionId === De.sessionId ? A : void 0;
|
|
19562
19578
|
ut.configure({
|
|
19563
19579
|
sessionId: De.sessionId,
|
|
19564
19580
|
supported: Ur,
|
|
@@ -19586,13 +19602,13 @@ function Cw(e) {
|
|
|
19586
19602
|
), Or = J(() => {
|
|
19587
19603
|
}), Ba = J(!1);
|
|
19588
19604
|
ct(() => (Ba.current = !0, () => {
|
|
19589
|
-
Ba.current = !1, O.current?.controller?.abort(), O.current = void 0,
|
|
19605
|
+
Ba.current = !1, O.current?.controller?.abort(), O.current = void 0, j.current = void 0;
|
|
19590
19606
|
}), []);
|
|
19591
19607
|
const ja = J(void 0), os = Mn ?? Pe;
|
|
19592
19608
|
ct(() => {
|
|
19593
19609
|
if (!M) return;
|
|
19594
19610
|
const A = JSON.stringify([
|
|
19595
|
-
|
|
19611
|
+
Y,
|
|
19596
19612
|
_t(os),
|
|
19597
19613
|
Ve,
|
|
19598
19614
|
ko,
|
|
@@ -19613,7 +19629,7 @@ function Cw(e) {
|
|
|
19613
19629
|
}));
|
|
19614
19630
|
return;
|
|
19615
19631
|
}
|
|
19616
|
-
if (os && (At.current = os), !Te.current && !
|
|
19632
|
+
if (os && (At.current = os), !Te.current && !Y) {
|
|
19617
19633
|
Ee({
|
|
19618
19634
|
status: "error",
|
|
19619
19635
|
error: "DaemonSessionProvider requires a baseUrl prop or an ancestor DaemonWorkspaceProvider."
|
|
@@ -19622,11 +19638,11 @@ function Cw(e) {
|
|
|
19622
19638
|
}
|
|
19623
19639
|
const b = new AbortController();
|
|
19624
19640
|
let G = !1;
|
|
19625
|
-
const
|
|
19626
|
-
let ye =
|
|
19641
|
+
const te = qt === "load" && Ve !== void 0 && Ve === ee.current?.sessionId && ee.current === re.current, Re = y.current;
|
|
19642
|
+
let ye = ee.current, We, gt, kt = [], Ge;
|
|
19627
19643
|
const Je = (ue = !1) => {
|
|
19628
19644
|
if (Ge = void 0, kt.length === 0) return;
|
|
19629
|
-
if (!ue && ye !== void 0 &&
|
|
19645
|
+
if (!ue && ye !== void 0 && ee.current !== ye) {
|
|
19630
19646
|
kt = [];
|
|
19631
19647
|
return;
|
|
19632
19648
|
}
|
|
@@ -19661,9 +19677,9 @@ function Cw(e) {
|
|
|
19661
19677
|
}, ss = () => {
|
|
19662
19678
|
if (G || b.signal.aborted) return;
|
|
19663
19679
|
const ue = O.current;
|
|
19664
|
-
if (!ue || ue.attempted || !ue.terminalSeen || y.current || He.current.loading ||
|
|
19680
|
+
if (!ue || ue.attempted || !ue.terminalSeen || y.current || He.current.loading || ee.current?.sessionId !== ue.sessionId || ao.current())
|
|
19665
19681
|
return;
|
|
19666
|
-
const we =
|
|
19682
|
+
const we = L.current;
|
|
19667
19683
|
if (!we) return;
|
|
19668
19684
|
ue.attempted = !0;
|
|
19669
19685
|
const xt = new AbortController();
|
|
@@ -19682,15 +19698,15 @@ function Cw(e) {
|
|
|
19682
19698
|
}
|
|
19683
19699
|
);
|
|
19684
19700
|
};
|
|
19685
|
-
return
|
|
19701
|
+
return j.current = ss, (async () => {
|
|
19686
19702
|
if (!ye && (await Promise.resolve(), G))
|
|
19687
19703
|
return;
|
|
19688
|
-
const ue = Te.current ?? Cs({ baseUrl:
|
|
19704
|
+
const ue = Te.current ?? Cs({ baseUrl: Y, token: oe });
|
|
19689
19705
|
let we, xt, it = Ve, _n = !se.current && !Ve && La > 0, Cn = 0, $n, js = !1, _o = !1, as = !1, Ja = !1, Br = () => !1;
|
|
19690
19706
|
const Hs = (lo) => {
|
|
19691
|
-
const In =
|
|
19707
|
+
const In = Z.current;
|
|
19692
19708
|
return In?.sessionId !== void 0 && lo !== void 0 && In?.workspaceCwd === lo.workspaceCwd && In.sessionId === lo.sessionId ? In.active : void 0;
|
|
19693
|
-
}, zo = (lo = we ??
|
|
19709
|
+
}, zo = (lo = we ?? ee.current ?? xe.current) => {
|
|
19694
19710
|
const In = y.current;
|
|
19695
19711
|
return In?.reconcilePromptActivity && In.sessionId === lo?.sessionId && (In.sessionContext?.kind !== "workspace" || In.sessionContext.cwd === lo?.workspaceCwd) || Br() || xe.current.backgroundTurn ? !1 : Hs(lo) === !0 ? (console.debug(
|
|
19696
19712
|
"[DaemonSessionProvider] settle skipped: daemon reports the prompt in flight"
|
|
@@ -19712,8 +19728,8 @@ function Cw(e) {
|
|
|
19712
19728
|
const Xa = () => {
|
|
19713
19729
|
if (Za?.(), Za = void 0, co && Vt.current === co) {
|
|
19714
19730
|
const Ce = Hr;
|
|
19715
|
-
Ce &&
|
|
19716
|
-
($o) =>
|
|
19731
|
+
Ce && ee.current === Ce && (hl(Ot.current, Ce), Ee(
|
|
19732
|
+
($o) => ee.current === Ce ? {
|
|
19717
19733
|
...$o,
|
|
19718
19734
|
workflowModeStatus: "syncing",
|
|
19719
19735
|
workflowModePending: !1
|
|
@@ -19724,13 +19740,13 @@ function Cw(e) {
|
|
|
19724
19740
|
try {
|
|
19725
19741
|
let Ce = !1, $o = !1, uo = !1, Gn = !1, dn, Dt, Ye, Vo;
|
|
19726
19742
|
if (!we) {
|
|
19727
|
-
const T =
|
|
19743
|
+
const T = ee.current, fe = T !== void 0 && T === ce.current && Ve === T.sessionId && _t(os) === _t(
|
|
19728
19744
|
Ue.current
|
|
19729
19745
|
);
|
|
19730
19746
|
T && (!Ve && !it && !_n || fe) && (we = T, it = T.sessionId, Pn.current = T.sessionId, Gn = !0, fe && (ce.current = void 0, Ue.current = void 0));
|
|
19731
19747
|
}
|
|
19732
19748
|
if (!we) {
|
|
19733
|
-
|
|
19749
|
+
te || Ee((pe) => ({
|
|
19734
19750
|
...pe,
|
|
19735
19751
|
status: "connecting",
|
|
19736
19752
|
error: void 0,
|
|
@@ -19880,7 +19896,7 @@ function Cw(e) {
|
|
|
19880
19896
|
return;
|
|
19881
19897
|
}
|
|
19882
19898
|
const ge = Ve ?? it, Qe = ns ? Fe.current : oa(void 0, ge), Pt = ge !== void 0 && ge === xe.current.sessionId && xe.current.clientId !== void 0 && Qe !== xe.current.clientId, tn = !!Ve && qt === "resume" && !Pt;
|
|
19883
|
-
is = !!Ve, ge && !
|
|
19899
|
+
is = !!Ve, ge && !te && Ee((pe) => ({
|
|
19884
19900
|
...pe,
|
|
19885
19901
|
sessionId: ge,
|
|
19886
19902
|
error: void 0,
|
|
@@ -19982,7 +19998,7 @@ function Cw(e) {
|
|
|
19982
19998
|
ve.sessionId
|
|
19983
19999
|
)), G || b.signal.aborted) {
|
|
19984
20000
|
kl({
|
|
19985
|
-
baseUrl:
|
|
20001
|
+
baseUrl: Y,
|
|
19986
20002
|
token: oe,
|
|
19987
20003
|
sessionId: ve.sessionId,
|
|
19988
20004
|
clientId: ve.clientId
|
|
@@ -19991,8 +20007,8 @@ function Cw(e) {
|
|
|
19991
20007
|
);
|
|
19992
20008
|
return;
|
|
19993
20009
|
}
|
|
19994
|
-
if (
|
|
19995
|
-
const pe =
|
|
20010
|
+
if (te && lt?.sessionId === ve.sessionId && (lt.signal?.aborted || y.current !== lt)) {
|
|
20011
|
+
const pe = ee.current;
|
|
19996
20012
|
if (ve !== pe && await ve.detach().catch((Mt) => {
|
|
19997
20013
|
console.warn(
|
|
19998
20014
|
"[DaemonSessionProvider] detach cancelled reload failed:",
|
|
@@ -20006,7 +20022,7 @@ function Cw(e) {
|
|
|
20006
20022
|
}
|
|
20007
20023
|
return;
|
|
20008
20024
|
}
|
|
20009
|
-
if (lt?.reconcilePromptActivity && Hs(ve) !== !1 && (
|
|
20025
|
+
if (lt?.reconcilePromptActivity && Hs(ve) !== !1 && (Z.current = void 0), lt?.replaySource === "memory") {
|
|
20010
20026
|
const pe = O.current, Mt = [
|
|
20011
20027
|
...ve.replaySnapshot.compactedReplay,
|
|
20012
20028
|
...ve.replaySnapshot.liveJournal
|
|
@@ -20015,7 +20031,7 @@ function Cw(e) {
|
|
|
20015
20031
|
pe.target.promptId
|
|
20016
20032
|
) : void 0;
|
|
20017
20033
|
if (!pe || pe.sessionId !== ve.sessionId || ve.replayDegraded === !0 || !un) {
|
|
20018
|
-
const Vn =
|
|
20034
|
+
const Vn = ee.current;
|
|
20019
20035
|
if (ve !== Vn && await ve.detach().catch((Wn) => {
|
|
20020
20036
|
console.warn(
|
|
20021
20037
|
"[DaemonSessionProvider] detach rejected repair load failed:",
|
|
@@ -20052,7 +20068,7 @@ function Cw(e) {
|
|
|
20052
20068
|
...ve.replaySnapshot.compactedReplay,
|
|
20053
20069
|
...ve.replaySnapshot.liveJournal
|
|
20054
20070
|
];
|
|
20055
|
-
dn = wp(le), Dt = vr(dn), we = ve, it = we.sessionId, _n = !1, Pn.current = we.sessionId,
|
|
20071
|
+
dn = wp(le), Dt = vr(dn), we = ve, it = we.sessionId, _n = !1, Pn.current = we.sessionId, ee.current = we;
|
|
20056
20072
|
}
|
|
20057
20073
|
const x = we, yt = va(
|
|
20058
20074
|
x.session
|
|
@@ -20077,7 +20093,7 @@ function Cw(e) {
|
|
|
20077
20093
|
const fe = Ws(
|
|
20078
20094
|
x.workspaceCwd
|
|
20079
20095
|
);
|
|
20080
|
-
G || b.signal.aborted || !Lt ||
|
|
20096
|
+
G || b.signal.aborted || !Lt || ee.current !== x || !fe || jo.current.get(x) !== fe.id || (_r.current.get(x) ?? 0) >= T || (_r.current.set(x, T), ln(x, "policy", null));
|
|
20081
20097
|
})), ye !== x && oo((T) => ({
|
|
20082
20098
|
...T,
|
|
20083
20099
|
backgroundTurn: T.sessionId === x.sessionId && T.finishedBackgroundTurnId === x.backgroundTurn?.turnId ? void 0 : x.backgroundTurn,
|
|
@@ -20312,7 +20328,7 @@ function Cw(e) {
|
|
|
20312
20328
|
);
|
|
20313
20329
|
Qe && c.current.get(Qe.sessionId)?.has(Qe.promptId) && C(Qe);
|
|
20314
20330
|
}
|
|
20315
|
-
if (
|
|
20331
|
+
if (ee.current === x)
|
|
20316
20332
|
for (const ge of ht)
|
|
20317
20333
|
hn.observe(
|
|
20318
20334
|
x,
|
|
@@ -20369,7 +20385,7 @@ function Cw(e) {
|
|
|
20369
20385
|
(T) => T.snapshot,
|
|
20370
20386
|
() => {
|
|
20371
20387
|
}
|
|
20372
|
-
).then((T) => (G || b.signal.aborted ||
|
|
20388
|
+
).then((T) => (G || b.signal.aborted || ee.current !== x || Ee((fe) => ee.current !== x || fe.sessionId !== x.sessionId || !T && Ys !== void 0 ? fe : {
|
|
20373
20389
|
...fe,
|
|
20374
20390
|
goalState: T ? zi(
|
|
20375
20391
|
fe.goalState,
|
|
@@ -20384,7 +20400,7 @@ function Cw(e) {
|
|
|
20384
20400
|
[ai, ii, ri, li],
|
|
20385
20401
|
ci
|
|
20386
20402
|
] = await Promise.all([vu, wu]);
|
|
20387
|
-
if (G || b.signal.aborted ||
|
|
20403
|
+
if (G || b.signal.aborted || ee.current !== x)
|
|
20388
20404
|
return;
|
|
20389
20405
|
const Kr = ai?.status === "fulfilled" ? ai.value : void 0, Zs = ii?.status === "fulfilled" ? ii.value : void 0, Ut = ri?.status === "fulfilled" ? ri.value : void 0, bu = li?.status === "fulfilled" ? li.value?.branch ?? void 0 : void 0, ku = ci === void 0 && Ys === void 0 ? { v: 2, goal: null, activity: "idle" } : void 0, Jr = [
|
|
20390
20406
|
ai?.status === "rejected" ? Po.current?.models : void 0,
|
|
@@ -20394,7 +20410,7 @@ function Cw(e) {
|
|
|
20394
20410
|
(T) => T.id === Xs
|
|
20395
20411
|
)?.contextWindow, Su = cs?.contextWindow ?? di.find((T) => T.id === Xs)?.contextWindow ?? yu, { commands: Tu, skills: Cu } = Gi(Zs), Xr = hr(Ut), po = hu();
|
|
20396
20412
|
if (Ee((T) => {
|
|
20397
|
-
if (b.signal.aborted ||
|
|
20413
|
+
if (b.signal.aborted || ee.current !== void 0 && ee.current !== x || T.sessionId !== x.sessionId)
|
|
20398
20414
|
return T;
|
|
20399
20415
|
const fe = Ut?.sessionId === x.sessionId && Qr !== void 0 && zt.current.get(x) === Qr, mt = po && Ut ? Ut : T.context ?? (Ut?.recovery ? {
|
|
20400
20416
|
v: Ut.v,
|
|
@@ -20489,7 +20505,7 @@ function Cw(e) {
|
|
|
20489
20505
|
const T = bt.current.get(
|
|
20490
20506
|
x.sessionId
|
|
20491
20507
|
);
|
|
20492
|
-
c.current.has(x.sessionId) && (d.current = x.sessionId), T?.controller.abort(), bt.current.delete(x.sessionId), Lo && Vs(), ft(N), je("idle"), ro(), js = !0, x.setLastEventId(0), it = x.sessionId, ea = !0, $n = "state_resync", we = void 0,
|
|
20508
|
+
c.current.has(x.sessionId) && (d.current = x.sessionId), T?.controller.abort(), bt.current.delete(x.sessionId), Lo && Vs(), ft(N), je("idle"), ro(), js = !0, x.setLastEventId(0), it = x.sessionId, ea = !0, $n = "state_resync", we = void 0, ee.current = void 0, ao.current = () => !1, yo.current = () => !1, Ee((fe) => ({
|
|
20493
20509
|
...fe,
|
|
20494
20510
|
status: "connecting",
|
|
20495
20511
|
error: void 0,
|
|
@@ -20507,7 +20523,7 @@ function Cw(e) {
|
|
|
20507
20523
|
const Au = wo(
|
|
20508
20524
|
Ot.current,
|
|
20509
20525
|
x
|
|
20510
|
-
), To = () => !G && !b.signal.aborted && !ds.signal.aborted &&
|
|
20526
|
+
), To = () => !G && !b.signal.aborted && !ds.signal.aborted && ee.current === x && Vt.current === co && Ot.current.get(x) === Au;
|
|
20511
20527
|
let ui = x.lastEventId === void 0, tl = !1;
|
|
20512
20528
|
const nl = () => {
|
|
20513
20529
|
To() && ks(
|
|
@@ -20553,7 +20569,7 @@ function Cw(e) {
|
|
|
20553
20569
|
onEpoch: () => ol(),
|
|
20554
20570
|
...al ? { sseConnectReason: al } : {}
|
|
20555
20571
|
})) {
|
|
20556
|
-
if (
|
|
20572
|
+
if (ee.current !== x)
|
|
20557
20573
|
break;
|
|
20558
20574
|
T.type === "replay_complete" && (ui = !0), ol();
|
|
20559
20575
|
const fe = mp(T);
|
|
@@ -20584,8 +20600,8 @@ function Cw(e) {
|
|
|
20584
20600
|
me,
|
|
20585
20601
|
pe.deletedGroupIds,
|
|
20586
20602
|
pe.deletedPromptIds
|
|
20587
|
-
),
|
|
20588
|
-
|
|
20603
|
+
), L.current?.(new AbortController().signal).finally(() => {
|
|
20604
|
+
ee.current?.sessionId === x.sessionId && cp(me, le);
|
|
20589
20605
|
}).catch((Mt) => {
|
|
20590
20606
|
console.warn(
|
|
20591
20607
|
"Failed to reload deleted message history",
|
|
@@ -20602,12 +20618,12 @@ function Cw(e) {
|
|
|
20602
20618
|
continue;
|
|
20603
20619
|
}
|
|
20604
20620
|
const ht = jl(T);
|
|
20605
|
-
if (ht && (Bl(ht),
|
|
20621
|
+
if (ht && (Bl(ht), ee.current !== x))
|
|
20606
20622
|
break;
|
|
20607
20623
|
if (Gl(T)) {
|
|
20608
20624
|
if (T.type === "pending_prompt_completed" && ke(T.data) && T.data.state === "removed" && typeof T.data.promptId == "string" && ut.recordPromptRemoved(
|
|
20609
20625
|
T.data.promptId
|
|
20610
|
-
), Hl(T),
|
|
20626
|
+
), Hl(T), ee.current !== x) break;
|
|
20611
20627
|
T.type === "pending_prompt_started" && (ft(N), je("waiting"));
|
|
20612
20628
|
}
|
|
20613
20629
|
const rt = xe.current.backgroundTurn !== void 0 && Eo(T) === xe.current.backgroundTurn.turnId, Dn = bt.current.get(
|
|
@@ -20617,7 +20633,7 @@ function Cw(e) {
|
|
|
20617
20633
|
x.clientId,
|
|
20618
20634
|
Ne.current,
|
|
20619
20635
|
(le) => {
|
|
20620
|
-
|
|
20636
|
+
ee.current === x && oo(le);
|
|
20621
20637
|
}
|
|
20622
20638
|
), en = ma(
|
|
20623
20639
|
T,
|
|
@@ -20625,7 +20641,7 @@ function Cw(e) {
|
|
|
20625
20641
|
cn,
|
|
20626
20642
|
so
|
|
20627
20643
|
), Ln = en.filter((le) => !Xh(le));
|
|
20628
|
-
T.type === "model_switched" && ke(T.data) && T.data.subscriptionSignedOut === !0 && Lt &&
|
|
20644
|
+
T.type === "model_switched" && ke(T.data) && T.data.subscriptionSignedOut === !0 && Lt && ee.current === x && W.current?.(void 0, { reloadProviders: !1 }).catch(
|
|
20629
20645
|
(le) => console.warn(
|
|
20630
20646
|
"Unable to read models after a model switch",
|
|
20631
20647
|
le
|
|
@@ -20636,7 +20652,7 @@ function Cw(e) {
|
|
|
20636
20652
|
zt.current,
|
|
20637
20653
|
x
|
|
20638
20654
|
), Ee(
|
|
20639
|
-
(le) =>
|
|
20655
|
+
(le) => ee.current === x && le.context?.recovery?.canContinue ? {
|
|
20640
20656
|
...le,
|
|
20641
20657
|
context: {
|
|
20642
20658
|
...le.context,
|
|
@@ -20660,7 +20676,7 @@ function Cw(e) {
|
|
|
20660
20676
|
x
|
|
20661
20677
|
) : void 0, Mt = (un, Vn = !1) => {
|
|
20662
20678
|
G || b.signal.aborted || ds.signal.aborted || Ee((Wn) => {
|
|
20663
|
-
if (Wn.sessionId !== x.sessionId || Vt.current !== co ||
|
|
20679
|
+
if (Wn.sessionId !== x.sessionId || Vt.current !== co || ee.current !== x)
|
|
20664
20680
|
return Wn;
|
|
20665
20681
|
const mo = pe?.() && To() ? un?.sessionId === x.sessionId ? Ms(
|
|
20666
20682
|
Wn,
|
|
@@ -20766,7 +20782,7 @@ function Cw(e) {
|
|
|
20766
20782
|
zo() && je("idle");
|
|
20767
20783
|
}
|
|
20768
20784
|
);
|
|
20769
|
-
if (
|
|
20785
|
+
if (ee.current === x && hn.observe(x, T, !1, () => (T.type === "permission_request" && tt(), nc(
|
|
20770
20786
|
T,
|
|
20771
20787
|
me.getSnapshot().blocks,
|
|
20772
20788
|
xe.current.sessionId === x.sessionId ? xe.current.displayName : ta(x.state)
|
|
@@ -20787,7 +20803,7 @@ function Cw(e) {
|
|
|
20787
20803
|
"[DaemonSessionProvider] event stream resync (sessionId=%s, reason=%s)",
|
|
20788
20804
|
x.sessionId,
|
|
20789
20805
|
typeof le == "string" ? le : "unknown"
|
|
20790
|
-
), ea = !0, $n = "state_resync", we = void 0,
|
|
20806
|
+
), ea = !0, $n = "state_resync", we = void 0, ee.current = void 0, ao.current = () => !1, yo.current = () => !1, Ee((pe) => ({
|
|
20791
20807
|
...pe,
|
|
20792
20808
|
status: "connecting",
|
|
20793
20809
|
error: void 0,
|
|
@@ -20808,11 +20824,11 @@ function Cw(e) {
|
|
|
20808
20824
|
x,
|
|
20809
20825
|
Gs ? "runtime-stopped" : "deleted",
|
|
20810
20826
|
Gs ? null : pe
|
|
20811
|
-
), bt.current.get(pe)?.controller.abort(), bt.current.delete(pe), we = void 0,
|
|
20827
|
+
), bt.current.get(pe)?.controller.abort(), bt.current.delete(pe), we = void 0, ee.current = void 0;
|
|
20812
20828
|
break;
|
|
20813
20829
|
}
|
|
20814
20830
|
} catch (ot) {
|
|
20815
|
-
if (
|
|
20831
|
+
if (ee.current !== x) break;
|
|
20816
20832
|
const ht = ot instanceof Error ? ot.message : String(ot);
|
|
20817
20833
|
cn({
|
|
20818
20834
|
severity: "warning",
|
|
@@ -20828,7 +20844,7 @@ function Cw(e) {
|
|
|
20828
20844
|
);
|
|
20829
20845
|
}
|
|
20830
20846
|
}
|
|
20831
|
-
if (dt.invalidate(x, "stream_closed"),
|
|
20847
|
+
if (dt.invalidate(x, "stream_closed"), ee.current !== x && !ea && !Ya) {
|
|
20832
20848
|
ro(), Xa();
|
|
20833
20849
|
return;
|
|
20834
20850
|
}
|
|
@@ -20882,10 +20898,10 @@ function Cw(e) {
|
|
|
20882
20898
|
return;
|
|
20883
20899
|
}
|
|
20884
20900
|
if (se.current) {
|
|
20885
|
-
we = void 0,
|
|
20901
|
+
we = void 0, ee.current = void 0, ao.current = () => !1, yo.current = () => !1;
|
|
20886
20902
|
return;
|
|
20887
20903
|
}
|
|
20888
|
-
!G && !b.signal.aborted && !ea && (z.current?.check(), $n = "stream_end",
|
|
20904
|
+
!G && !b.signal.aborted && !ea && (z.current?.check(), $n = "stream_end", ee.current === x && (console.debug("[DaemonSessionProvider] SSE stream ended"), ft(N), zo() && (je("idle"), Ft({
|
|
20889
20905
|
type: "assistant.done",
|
|
20890
20906
|
reason: "stream_ended"
|
|
20891
20907
|
}))), Ee((T) => ({
|
|
@@ -20900,7 +20916,7 @@ function Cw(e) {
|
|
|
20900
20916
|
} catch (Ce) {
|
|
20901
20917
|
ye && dt.invalidate(ye, "stream_error");
|
|
20902
20918
|
const $o = co?.restartRequested === !0;
|
|
20903
|
-
if (Xa(), we &&
|
|
20919
|
+
if (Xa(), we && ee.current !== we) {
|
|
20904
20920
|
ro();
|
|
20905
20921
|
return;
|
|
20906
20922
|
}
|
|
@@ -21008,7 +21024,7 @@ function Cw(e) {
|
|
|
21008
21024
|
scopeId: zs.scopeId,
|
|
21009
21025
|
...yt ? {} : { sessionId: zs.sessionId },
|
|
21010
21026
|
reason: yt ? "auth-failed" : "deleted"
|
|
21011
|
-
}), we = void 0,
|
|
21027
|
+
}), we = void 0, ee.current = void 0, yt) {
|
|
21012
21028
|
Ee((Rt) => ({
|
|
21013
21029
|
...ws(Rt),
|
|
21014
21030
|
status: "error",
|
|
@@ -21069,8 +21085,8 @@ function Cw(e) {
|
|
|
21069
21085
|
catchingUp: void 0
|
|
21070
21086
|
}));
|
|
21071
21087
|
return;
|
|
21072
|
-
} else if (
|
|
21073
|
-
we =
|
|
21088
|
+
} else if (te && we === void 0 && Dt?.sessionId === Ve && ee.current?.sessionId === Ve) {
|
|
21089
|
+
we = ee.current, it = we.sessionId, Cn = 0, _o = !0;
|
|
21074
21090
|
continue;
|
|
21075
21091
|
} else if (Kd(Ce)) {
|
|
21076
21092
|
Ee((nt) => ({
|
|
@@ -21092,7 +21108,7 @@ function Cw(e) {
|
|
|
21092
21108
|
we?.sessionId
|
|
21093
21109
|
), co && ($n = "transport_error");
|
|
21094
21110
|
if (!B) {
|
|
21095
|
-
we = void 0,
|
|
21111
|
+
we = void 0, ee.current = void 0, Ee((nt) => ({
|
|
21096
21112
|
...nt,
|
|
21097
21113
|
status: "error",
|
|
21098
21114
|
error: Gn,
|
|
@@ -21118,7 +21134,7 @@ function Cw(e) {
|
|
|
21118
21134
|
}
|
|
21119
21135
|
if (G || b.signal.aborted) return;
|
|
21120
21136
|
if (!B) {
|
|
21121
|
-
|
|
21137
|
+
ee.current = void 0, Ee((Ce) => ({
|
|
21122
21138
|
...Ce,
|
|
21123
21139
|
status: "disconnected",
|
|
21124
21140
|
loadingTranscript: void 0,
|
|
@@ -21145,23 +21161,23 @@ function Cw(e) {
|
|
|
21145
21161
|
})(), () => {
|
|
21146
21162
|
const ue = ye;
|
|
21147
21163
|
ue && dt.invalidate(ue, "stream_closed"), G = !0, gt?.(), b.abort();
|
|
21148
|
-
const we = ue !== void 0 &&
|
|
21164
|
+
const we = ue !== void 0 && ee.current === ue, xt = ue === void 0 && ee.current === void 0, it = we && (ue === re.current || eo.current !== void 0);
|
|
21149
21165
|
we && eo.current !== void 0 ? (ce.current = ue, Ue.current = At.current) : ce.current === ue && (ce.current = void 0, Ue.current = void 0);
|
|
21150
21166
|
const _n = !Ba.current;
|
|
21151
21167
|
we || xt ? ((!it || _n || !ue) && dt.clear(), tt()) : ro(), we && (!it || _n) && (ao.current = () => !1, yo.current = () => !1, je("idle"), ft(N)), Re !== void 0 && y.current === Re && (we || xt) && (!it || _n) && (y.current.timeout !== void 0 && clearTimeout(y.current.timeout), y.current.reject(
|
|
21152
21168
|
new DOMException("Session load interrupted by cleanup", "AbortError")
|
|
21153
21169
|
), y.current = void 0), we && (!it || _n) && ue.clientId && kl({
|
|
21154
|
-
baseUrl:
|
|
21170
|
+
baseUrl: Y,
|
|
21155
21171
|
token: oe,
|
|
21156
21172
|
sessionId: ue.sessionId,
|
|
21157
21173
|
clientId: ue.clientId
|
|
21158
21174
|
}).catch((Cn) => {
|
|
21159
21175
|
const $n = dr(
|
|
21160
|
-
|
|
21176
|
+
Y,
|
|
21161
21177
|
oe
|
|
21162
21178
|
)?.getSnapshot();
|
|
21163
21179
|
($n === void 0 || $n === "available") && console.warn("[DaemonSessionProvider] detach failed:", Cn);
|
|
21164
|
-
}), we && (!it || _n) && (
|
|
21180
|
+
}), we && (!it || _n) && (ee.current = void 0);
|
|
21165
21181
|
};
|
|
21166
21182
|
}, [
|
|
21167
21183
|
M,
|
|
@@ -21171,7 +21187,7 @@ function Cw(e) {
|
|
|
21171
21187
|
q,
|
|
21172
21188
|
$,
|
|
21173
21189
|
hn,
|
|
21174
|
-
|
|
21190
|
+
Y,
|
|
21175
21191
|
oe,
|
|
21176
21192
|
Ws,
|
|
21177
21193
|
os,
|
|
@@ -21198,41 +21214,41 @@ function Cw(e) {
|
|
|
21198
21214
|
C,
|
|
21199
21215
|
oo
|
|
21200
21216
|
]), ct(() => {
|
|
21201
|
-
if (
|
|
21217
|
+
if (D !== "available" || !ie.current || De.status !== "connected" || X <= 0 || ae <= 0 || !De.sessionId)
|
|
21202
21218
|
return;
|
|
21203
21219
|
let A = !1;
|
|
21204
21220
|
const b = setInterval(() => {
|
|
21205
|
-
const G =
|
|
21221
|
+
const G = ee.current;
|
|
21206
21222
|
if (!G) return;
|
|
21207
21223
|
Q.current.session !== G && (Q.current = {
|
|
21208
21224
|
session: G,
|
|
21209
21225
|
consecutiveFailures: 0
|
|
21210
21226
|
});
|
|
21211
|
-
const
|
|
21227
|
+
const te = Q.current;
|
|
21212
21228
|
G.heartbeat().then(() => {
|
|
21213
|
-
A ||
|
|
21229
|
+
A || ee.current !== G || Q.current !== te || (te.consecutiveFailures >= ae && Ee(
|
|
21214
21230
|
(Re) => Re.sessionId === G.sessionId ? {
|
|
21215
21231
|
...Re,
|
|
21216
21232
|
status: "connected",
|
|
21217
21233
|
error: void 0,
|
|
21218
21234
|
errorStatus: void 0
|
|
21219
21235
|
} : Re
|
|
21220
|
-
),
|
|
21236
|
+
), te.consecutiveFailures = 0, te.lastHttpError = void 0);
|
|
21221
21237
|
}).catch((Re) => {
|
|
21222
|
-
if (A ||
|
|
21238
|
+
if (A || ee.current !== G || Q.current !== te)
|
|
21223
21239
|
return;
|
|
21224
|
-
|
|
21240
|
+
te.consecutiveFailures += 1;
|
|
21225
21241
|
const ye = Re instanceof Error ? Re.message : "Session heartbeat failed", We = mn(Re);
|
|
21226
21242
|
if (We !== void 0) {
|
|
21227
|
-
const Me =
|
|
21228
|
-
|
|
21243
|
+
const Me = te.lastHttpError?.status;
|
|
21244
|
+
te.lastHttpError = {
|
|
21229
21245
|
status: bn(We, Me) ?? We,
|
|
21230
|
-
message: xs(Me) ?
|
|
21246
|
+
message: xs(Me) ? te.lastHttpError?.message ?? ye : ye
|
|
21231
21247
|
};
|
|
21232
21248
|
}
|
|
21233
|
-
if (
|
|
21249
|
+
if (te.consecutiveFailures < ae)
|
|
21234
21250
|
return;
|
|
21235
|
-
const gt =
|
|
21251
|
+
const gt = te.lastHttpError?.status, kt = te.lastHttpError?.message ?? ye, Ge = gt !== void 0 && Ar.has(gt), Je = xs(gt);
|
|
21236
21252
|
if (Ge || Je) {
|
|
21237
21253
|
ln(
|
|
21238
21254
|
G,
|
|
@@ -21247,7 +21263,7 @@ function Cw(e) {
|
|
|
21247
21263
|
Je ? "[DaemonSessionProvider] heartbeat detected missing session (sessionId=%s, status=%d)" : "[DaemonSessionProvider] heartbeat auth failure (sessionId=%s, status=%d)",
|
|
21248
21264
|
Me,
|
|
21249
21265
|
gt
|
|
21250
|
-
), c.current.delete(Me), bt.current.get(Me)?.controller.abort(), bt.current.delete(Me), ft(N), je("idle"),
|
|
21266
|
+
), c.current.delete(Me), bt.current.get(Me)?.controller.abort(), bt.current.delete(Me), ft(N), je("idle"), ee.current === G && (Je && (se.current = !0), ee.current = void 0);
|
|
21251
21267
|
}
|
|
21252
21268
|
Ee(
|
|
21253
21269
|
(Me) => Me.sessionId === G.sessionId ? {
|
|
@@ -21277,7 +21293,7 @@ function Cw(e) {
|
|
|
21277
21293
|
} : Me
|
|
21278
21294
|
);
|
|
21279
21295
|
});
|
|
21280
|
-
},
|
|
21296
|
+
}, X);
|
|
21281
21297
|
return () => {
|
|
21282
21298
|
A = !0, clearInterval(b);
|
|
21283
21299
|
};
|
|
@@ -21285,26 +21301,26 @@ function Cw(e) {
|
|
|
21285
21301
|
De.sessionId,
|
|
21286
21302
|
De.status,
|
|
21287
21303
|
ae,
|
|
21288
|
-
|
|
21304
|
+
X,
|
|
21289
21305
|
ln,
|
|
21290
21306
|
dt,
|
|
21291
|
-
|
|
21307
|
+
D
|
|
21292
21308
|
]);
|
|
21293
21309
|
const Ha = de(
|
|
21294
21310
|
(A, b) => {
|
|
21295
21311
|
const G = bt.current.get(A.sessionId);
|
|
21296
21312
|
if (G?.promptId !== b) return;
|
|
21297
|
-
const
|
|
21298
|
-
delete G.replayedTurnEvents,
|
|
21313
|
+
const te = G.replayedTurnEvents?.get(b);
|
|
21314
|
+
delete G.replayedTurnEvents, te && (Wi(
|
|
21299
21315
|
bt.current,
|
|
21300
21316
|
w.current,
|
|
21301
21317
|
A.sessionId,
|
|
21302
|
-
|
|
21318
|
+
te,
|
|
21303
21319
|
me,
|
|
21304
21320
|
je,
|
|
21305
21321
|
N,
|
|
21306
21322
|
{ requireBoundPromptId: !0, transcriptAlreadyApplied: !0 }
|
|
21307
|
-
), hn.observe(A,
|
|
21323
|
+
), hn.observe(A, te, !0));
|
|
21308
21324
|
},
|
|
21309
21325
|
[me, hn]
|
|
21310
21326
|
), Go = $e(
|
|
@@ -21312,7 +21328,7 @@ function Cw(e) {
|
|
|
21312
21328
|
getClient: () => Te.current,
|
|
21313
21329
|
getPromptStatus: () => no.current,
|
|
21314
21330
|
store: me,
|
|
21315
|
-
sessionRef:
|
|
21331
|
+
sessionRef: ee,
|
|
21316
21332
|
activePromptsRef: bt,
|
|
21317
21333
|
settledPromptsRef: w,
|
|
21318
21334
|
pendingSessionLoadRef: y,
|
|
@@ -21323,7 +21339,7 @@ function Cw(e) {
|
|
|
21323
21339
|
manualSessionClearRef: se,
|
|
21324
21340
|
skipNextCleanupDetachSessionRef: re,
|
|
21325
21341
|
passiveAssistantDoneTimerRef: N,
|
|
21326
|
-
daemonActivePromptRef:
|
|
21342
|
+
daemonActivePromptRef: Z,
|
|
21327
21343
|
hasSessionActivePrompt: () => ao.current(),
|
|
21328
21344
|
settleRestoredActivePrompt: () => yo.current(),
|
|
21329
21345
|
flushTranscript: () => Or.current(),
|
|
@@ -21338,21 +21354,21 @@ function Cw(e) {
|
|
|
21338
21354
|
b.restartRequested = !0, b.controller.abort();
|
|
21339
21355
|
return;
|
|
21340
21356
|
}
|
|
21341
|
-
|
|
21357
|
+
ee.current?.sessionId === A && sn.current?.abort();
|
|
21342
21358
|
},
|
|
21343
21359
|
getCreateSessionRequest: () => ({
|
|
21344
21360
|
...rn.current,
|
|
21345
21361
|
sessionScope: "thread",
|
|
21346
|
-
workspaceCwd: Rn.current ??
|
|
21362
|
+
workspaceCwd: Rn.current ?? ee.current?.workspaceCwd
|
|
21347
21363
|
}),
|
|
21348
21364
|
createDetachedSession: (A, b) => {
|
|
21349
21365
|
const G = Te.current ?? Cs({
|
|
21350
|
-
baseUrl:
|
|
21366
|
+
baseUrl: Y,
|
|
21351
21367
|
token: oe
|
|
21352
|
-
}),
|
|
21368
|
+
}), te = {
|
|
21353
21369
|
...rn.current,
|
|
21354
21370
|
sessionScope: "thread",
|
|
21355
|
-
workspaceCwd: A ?? Rn.current ??
|
|
21371
|
+
workspaceCwd: A ?? Rn.current ?? ee.current?.workspaceCwd,
|
|
21356
21372
|
...b?.approvalMode !== void 0 ? { approvalMode: b.approvalMode } : {},
|
|
21357
21373
|
...b?.sourceType !== void 0 ? { sourceType: b.sourceType } : {},
|
|
21358
21374
|
...b?.worktree !== void 0 ? { worktree: b.worktree } : {},
|
|
@@ -21361,7 +21377,7 @@ function Cw(e) {
|
|
|
21361
21377
|
}, Re = s ? Fe.current : oa(void 0);
|
|
21362
21378
|
return Kn.createOrAttach(
|
|
21363
21379
|
G,
|
|
21364
|
-
|
|
21380
|
+
te,
|
|
21365
21381
|
Re
|
|
21366
21382
|
).then(
|
|
21367
21383
|
(ye) => hn.remember(ye, {
|
|
@@ -21372,13 +21388,13 @@ function Cw(e) {
|
|
|
21372
21388
|
},
|
|
21373
21389
|
createDetachedStandaloneSession: (A) => {
|
|
21374
21390
|
const b = Te.current ?? Cs({
|
|
21375
|
-
baseUrl:
|
|
21391
|
+
baseUrl: Y,
|
|
21376
21392
|
token: oe
|
|
21377
21393
|
}), G = uc(
|
|
21378
21394
|
A?.approvalMode ?? rn.current?.approvalMode
|
|
21379
|
-
),
|
|
21395
|
+
), te = A?.modelServiceId ?? rn.current?.modelServiceId;
|
|
21380
21396
|
return Kn.createStandalone(b, {
|
|
21381
|
-
...
|
|
21397
|
+
...te !== void 0 ? { modelServiceId: te } : {},
|
|
21382
21398
|
...G !== void 0 ? { approvalMode: G } : {}
|
|
21383
21399
|
}).then(
|
|
21384
21400
|
(Re) => hn.remember(Re, { kind: "standalone" })
|
|
@@ -21410,20 +21426,20 @@ function Cw(e) {
|
|
|
21410
21426
|
c.current,
|
|
21411
21427
|
A.sessionId,
|
|
21412
21428
|
b.promptId
|
|
21413
|
-
),
|
|
21429
|
+
), ee.current === A) {
|
|
21414
21430
|
if (b.blockId) {
|
|
21415
21431
|
const G = me.getSnapshot();
|
|
21416
21432
|
me.reset({
|
|
21417
21433
|
...G,
|
|
21418
21434
|
retainedBytes: void 0,
|
|
21419
21435
|
blocks: G.blocks.map(
|
|
21420
|
-
(
|
|
21436
|
+
(te) => te.id === b.blockId && te.kind === "user" && (te.promptId === void 0 || te.promptId === b.promptId) ? { ...te, promptId: b.promptId } : te
|
|
21421
21437
|
)
|
|
21422
21438
|
});
|
|
21423
21439
|
}
|
|
21424
21440
|
hn.admit(A, b.promptId, b.label);
|
|
21425
21441
|
}
|
|
21426
|
-
|
|
21442
|
+
ee.current === A && ut.getSnapshot().sessionId === A.sessionId && ut.recordPromptAdmitted(b), Ha(A, b.promptId);
|
|
21427
21443
|
},
|
|
21428
21444
|
onContinuationAdmitted: (A, b) => {
|
|
21429
21445
|
hn.admit(A, b), Ha(A, b);
|
|
@@ -21433,14 +21449,14 @@ function Cw(e) {
|
|
|
21433
21449
|
c.current,
|
|
21434
21450
|
G ?? A.sessionId,
|
|
21435
21451
|
b
|
|
21436
|
-
), G === void 0 &&
|
|
21452
|
+
), G === void 0 && ee.current === A && hn.remove(A, b), G === void 0 && ee.current === A && ut.getSnapshot().sessionId === A.sessionId && ut.recordPromptRemoved(b);
|
|
21437
21453
|
}
|
|
21438
21454
|
}),
|
|
21439
21455
|
[
|
|
21440
21456
|
cn,
|
|
21441
21457
|
ln,
|
|
21442
21458
|
s,
|
|
21443
|
-
|
|
21459
|
+
Y,
|
|
21444
21460
|
oe,
|
|
21445
21461
|
U,
|
|
21446
21462
|
Ha,
|
|
@@ -21449,12 +21465,12 @@ function Cw(e) {
|
|
|
21449
21465
|
ut
|
|
21450
21466
|
]
|
|
21451
21467
|
);
|
|
21452
|
-
|
|
21453
|
-
gn === "idle" && queueMicrotask(() =>
|
|
21468
|
+
L.current = Go.reloadSession, W.current = Go.refreshModels, ct(() => {
|
|
21469
|
+
gn === "idle" && queueMicrotask(() => j.current?.());
|
|
21454
21470
|
}, [gn]);
|
|
21455
21471
|
const Wr = de(
|
|
21456
21472
|
async (A) => {
|
|
21457
|
-
const b = He.current, G =
|
|
21473
|
+
const b = He.current, G = ee.current;
|
|
21458
21474
|
if (b.loading || !G || G.sessionId !== b.sessionId)
|
|
21459
21475
|
return;
|
|
21460
21476
|
if (b.paginationError) {
|
|
@@ -21469,7 +21485,7 @@ function Cw(e) {
|
|
|
21469
21485
|
capacityReached: !1,
|
|
21470
21486
|
paginationError: !1
|
|
21471
21487
|
});
|
|
21472
|
-
const
|
|
21488
|
+
const te = Xt.current;
|
|
21473
21489
|
let Re = !1;
|
|
21474
21490
|
try {
|
|
21475
21491
|
const ye = await G.getTranscriptPage({
|
|
@@ -21478,9 +21494,9 @@ function Cw(e) {
|
|
|
21478
21494
|
limit: to.current ?? 100,
|
|
21479
21495
|
clientId: G.clientId
|
|
21480
21496
|
});
|
|
21481
|
-
if (
|
|
21497
|
+
if (ee.current !== G || He.current !== b)
|
|
21482
21498
|
return;
|
|
21483
|
-
if (Xt.current !==
|
|
21499
|
+
if (Xt.current !== te) {
|
|
21484
21500
|
b.loading = !1, $t({
|
|
21485
21501
|
hasMore: b.hasMore,
|
|
21486
21502
|
loading: !1,
|
|
@@ -21569,9 +21585,9 @@ function Cw(e) {
|
|
|
21569
21585
|
paginationError: !1
|
|
21570
21586
|
});
|
|
21571
21587
|
} catch (ye) {
|
|
21572
|
-
if (
|
|
21588
|
+
if (ee.current !== G || He.current !== b)
|
|
21573
21589
|
return;
|
|
21574
|
-
if (Xt.current !==
|
|
21590
|
+
if (Xt.current !== te) {
|
|
21575
21591
|
b.loading = !1, $t({
|
|
21576
21592
|
hasMore: b.hasMore,
|
|
21577
21593
|
loading: !1,
|
|
@@ -21596,12 +21612,12 @@ function Cw(e) {
|
|
|
21596
21612
|
recoverable: We
|
|
21597
21613
|
}), ye;
|
|
21598
21614
|
} finally {
|
|
21599
|
-
|
|
21615
|
+
j.current?.();
|
|
21600
21616
|
}
|
|
21601
21617
|
},
|
|
21602
21618
|
[cn, so, m, me]
|
|
21603
21619
|
), ou = $e(() => {
|
|
21604
|
-
const A = De.sessionId === He.current.sessionId &&
|
|
21620
|
+
const A = De.sessionId === He.current.sessionId && ee.current?.sessionId === He.current.sessionId;
|
|
21605
21621
|
return {
|
|
21606
21622
|
hasMore: A && Tn.hasMore,
|
|
21607
21623
|
loading: A && Tn.loading,
|
|
@@ -21626,10 +21642,10 @@ function Cw(e) {
|
|
|
21626
21642
|
const G = r ? Go.loadSession(r, {
|
|
21627
21643
|
...A !== void 0 ? { sessionContext: A } : {}
|
|
21628
21644
|
}) : b ? Go.clearSession() : void 0;
|
|
21629
|
-
G && G.catch((
|
|
21645
|
+
G && G.catch((te) => {
|
|
21630
21646
|
console.warn(
|
|
21631
21647
|
"[DaemonSessionProvider] controlled session transition failed:",
|
|
21632
|
-
|
|
21648
|
+
te
|
|
21633
21649
|
);
|
|
21634
21650
|
});
|
|
21635
21651
|
}, [
|
|
@@ -21642,16 +21658,16 @@ function Cw(e) {
|
|
|
21642
21658
|
const Qa = $e(
|
|
21643
21659
|
() => ({
|
|
21644
21660
|
capture: (A) => {
|
|
21645
|
-
const b =
|
|
21661
|
+
const b = ee.current, G = A?.includeRecovery === !0, te = b ? zt.current.get(b) : void 0;
|
|
21646
21662
|
return {
|
|
21647
|
-
isCurrent: () =>
|
|
21663
|
+
isCurrent: () => ee.current === b && (!G || b !== void 0 && zt.current.get(b) === te)
|
|
21648
21664
|
};
|
|
21649
21665
|
}
|
|
21650
21666
|
}),
|
|
21651
21667
|
[]
|
|
21652
|
-
), Oe =
|
|
21668
|
+
), Oe = ee.current, qr = Oe?.eventEpoch, Nr = De.capabilities?.features.includes("session_mod_rows") ?? !1, su = $e(() => {
|
|
21653
21669
|
if (!(!Nr || !Oe || Oe.sessionId !== De.sessionId))
|
|
21654
|
-
return new em(async (A) =>
|
|
21670
|
+
return new em(async (A) => ee.current !== Oe || Oe.eventEpoch !== qr ? { status: "unanswered" } : await Oe.askModRow(A));
|
|
21655
21671
|
}, [Oe, De.sessionId, qr, Nr]), au = $e(() => {
|
|
21656
21672
|
const A = Oe;
|
|
21657
21673
|
if (!A || !A.workspaceCwd || A.sessionId !== De.sessionId)
|
|
@@ -21660,18 +21676,18 @@ function Cw(e) {
|
|
|
21660
21676
|
return {
|
|
21661
21677
|
sessionId: A.sessionId,
|
|
21662
21678
|
navigation: ut,
|
|
21663
|
-
async readPage(G,
|
|
21664
|
-
if (
|
|
21679
|
+
async readPage(G, te) {
|
|
21680
|
+
if (ee.current !== A)
|
|
21665
21681
|
throw new Error("Hook session changed");
|
|
21666
21682
|
const ye = await (b ? A.client.workspaceByCwd(b) : A.client).getSessionTurnHooksPage(
|
|
21667
21683
|
A.sessionId,
|
|
21668
21684
|
G,
|
|
21669
21685
|
{
|
|
21670
|
-
...
|
|
21686
|
+
...te,
|
|
21671
21687
|
clientId: A.clientId
|
|
21672
21688
|
}
|
|
21673
21689
|
);
|
|
21674
|
-
if (
|
|
21690
|
+
if (ee.current !== A)
|
|
21675
21691
|
throw new Error("Hook session changed");
|
|
21676
21692
|
return ye;
|
|
21677
21693
|
}
|
|
@@ -21700,7 +21716,7 @@ function Cw(e) {
|
|
|
21700
21716
|
// this capture. Comparing with the generation seen at render as
|
|
21701
21717
|
// well rejected every attach during a turn: sending a prompt
|
|
21702
21718
|
// advances the generation without changing the capability receipt.
|
|
21703
|
-
b.isCurrent() && !se.current && Na.current === Nt &&
|
|
21719
|
+
b.isCurrent() && !se.current && Na.current === Nt && ee.current === Oe && Oe.clientId === Ns && Oe.eventEpoch === Ka && xe.current.status === "connected" && xe.current.sessionId === Oe.sessionId && Oe.session.generatedUi === Hn && Hn?.version === 1 && Hn.enabled === !0
|
|
21704
21720
|
)
|
|
21705
21721
|
};
|
|
21706
21722
|
}
|
|
@@ -21744,24 +21760,24 @@ function Cw(e) {
|
|
|
21744
21760
|
return {
|
|
21745
21761
|
sessionId: A.sessionId,
|
|
21746
21762
|
callTool: (b, G) => {
|
|
21747
|
-
if (
|
|
21763
|
+
if (ee.current !== A)
|
|
21748
21764
|
return Promise.reject(new Error("MCP App session changed"));
|
|
21749
|
-
const
|
|
21750
|
-
return
|
|
21765
|
+
const te = A.clientId;
|
|
21766
|
+
return te ? A.client.callMcpAppTool(
|
|
21751
21767
|
A.sessionId,
|
|
21752
21768
|
b,
|
|
21753
|
-
|
|
21769
|
+
te,
|
|
21754
21770
|
G
|
|
21755
21771
|
) : Promise.reject(new Error("MCP App client is not attached"));
|
|
21756
21772
|
},
|
|
21757
21773
|
...Fr ? {
|
|
21758
21774
|
viewState: {
|
|
21759
|
-
get: (b) =>
|
|
21775
|
+
get: (b) => ee.current !== A || !A.clientId ? Promise.reject(new Error("MCP App session changed")) : A.client.getGeneratedUiState(
|
|
21760
21776
|
A.sessionId,
|
|
21761
21777
|
b,
|
|
21762
21778
|
A.clientId
|
|
21763
21779
|
),
|
|
21764
|
-
set: (b, G) =>
|
|
21780
|
+
set: (b, G) => ee.current !== A || !A.clientId ? Promise.reject(new Error("MCP App session changed")) : A.client.setGeneratedUiState(
|
|
21765
21781
|
A.sessionId,
|
|
21766
21782
|
b,
|
|
21767
21783
|
G,
|
|
@@ -22213,7 +22229,7 @@ function qi(e, t) {
|
|
|
22213
22229
|
function wc(e, t, n, o = !0) {
|
|
22214
22230
|
let a = 0, r = 0, s = 0, i = 0;
|
|
22215
22231
|
const l = [], u = /* @__PURE__ */ new Set();
|
|
22216
|
-
let m = 0, g = 0, v = 0, I = 0, E,
|
|
22232
|
+
let m = 0, g = 0, v = 0, I = 0, E, R = 0, q = 0;
|
|
22217
22233
|
const $ = /* @__PURE__ */ new Map();
|
|
22218
22234
|
for (const M of e) {
|
|
22219
22235
|
if (M.type === "session.sub_session_task.changed") {
|
|
@@ -22264,7 +22280,7 @@ function wc(e, t, n, o = !0) {
|
|
|
22264
22280
|
};
|
|
22265
22281
|
break;
|
|
22266
22282
|
case "workspace.initialized":
|
|
22267
|
-
|
|
22283
|
+
R += 1;
|
|
22268
22284
|
break;
|
|
22269
22285
|
case "auth.device_flow.started":
|
|
22270
22286
|
case "auth.device_flow.throttled":
|
|
@@ -22275,35 +22291,35 @@ function wc(e, t, n, o = !0) {
|
|
|
22275
22291
|
break;
|
|
22276
22292
|
}
|
|
22277
22293
|
}
|
|
22278
|
-
a + r + s + i + m + g + v + I +
|
|
22279
|
-
const B = n ? M.skillMutationsByCwd?.[n] ?? [] : [], U = new Set(B.map((
|
|
22280
|
-
(
|
|
22294
|
+
a + r + s + i + m + g + v + I + R + q === 0 && l.length === 0 && $.size === 0 || t((M) => {
|
|
22295
|
+
const B = n ? M.skillMutationsByCwd?.[n] ?? [] : [], U = new Set(B.map((X) => X.id)), P = l.filter(
|
|
22296
|
+
(X) => !U.has(X.id)
|
|
22281
22297
|
);
|
|
22282
|
-
if (a + r + s + i + m + g + v + I +
|
|
22298
|
+
if (a + r + s + i + m + g + v + I + R + q === 0 && P.length === 0 && $.size === 0)
|
|
22283
22299
|
return M;
|
|
22284
22300
|
const V = { ...M.subSessionTaskVersions };
|
|
22285
|
-
for (const [
|
|
22286
|
-
V[
|
|
22301
|
+
for (const [X, ae] of $)
|
|
22302
|
+
V[X] = (V[X] ?? 0) + ae;
|
|
22287
22303
|
return {
|
|
22288
22304
|
memoryVersion: M.memoryVersion + a,
|
|
22289
22305
|
agentsVersion: M.agentsVersion + r,
|
|
22290
22306
|
toolsVersion: M.toolsVersion + s,
|
|
22291
22307
|
settingsVersion: M.settingsVersion + i,
|
|
22292
|
-
skillsVersion: M.skillsVersion +
|
|
22308
|
+
skillsVersion: M.skillsVersion + P.length,
|
|
22293
22309
|
mcpVersion: M.mcpVersion + m,
|
|
22294
22310
|
extensionsVersion: M.extensionsVersion + g,
|
|
22295
22311
|
artifactsVersion: M.artifactsVersion + v,
|
|
22296
22312
|
sourcesVersion: (M.sourcesVersion ?? 0) + I,
|
|
22297
|
-
...
|
|
22298
|
-
...
|
|
22313
|
+
...P.length > 0 ? { lastSkillMutation: P.at(-1) } : M.lastSkillMutation ? { lastSkillMutation: M.lastSkillMutation } : {},
|
|
22314
|
+
...P.length > 0 && n ? {
|
|
22299
22315
|
skillMutationsByCwd: {
|
|
22300
22316
|
...M.skillMutationsByCwd,
|
|
22301
|
-
[n]: [...B, ...
|
|
22317
|
+
[n]: [...B, ...P]
|
|
22302
22318
|
}
|
|
22303
22319
|
} : M.skillMutationsByCwd ? { skillMutationsByCwd: M.skillMutationsByCwd } : {},
|
|
22304
22320
|
...E ? { lastExtensionChange: E } : {},
|
|
22305
22321
|
...Object.keys(V).length > 0 ? { subSessionTaskVersions: V } : {},
|
|
22306
|
-
initVersion: M.initVersion +
|
|
22322
|
+
initVersion: M.initVersion + R,
|
|
22307
22323
|
authVersion: M.authVersion + q
|
|
22308
22324
|
};
|
|
22309
22325
|
});
|
|
@@ -22370,11 +22386,11 @@ function Yt(e, t) {
|
|
|
22370
22386
|
i((q) => ({ ...q, loading: !1 }));
|
|
22371
22387
|
return;
|
|
22372
22388
|
}
|
|
22373
|
-
const
|
|
22374
|
-
v?.(
|
|
22389
|
+
const R = E instanceof Error ? E : new Error(String(E));
|
|
22390
|
+
v?.(R), i((q) => ({
|
|
22375
22391
|
...q,
|
|
22376
22392
|
loading: !1,
|
|
22377
|
-
error:
|
|
22393
|
+
error: R
|
|
22378
22394
|
}));
|
|
22379
22395
|
return;
|
|
22380
22396
|
}
|
|
@@ -22487,77 +22503,77 @@ function Ow(e = {}) {
|
|
|
22487
22503
|
...u ? await Promise.all([
|
|
22488
22504
|
u.workspaceChannelTypes(),
|
|
22489
22505
|
u.workspaceChannels()
|
|
22490
|
-
]).then(([
|
|
22506
|
+
]).then(([H, z]) => ({ catalog: H, snapshot: z })) : await t.loadChannels(),
|
|
22491
22507
|
workspaceCwd: i
|
|
22492
22508
|
};
|
|
22493
22509
|
}, [t, u, i]), v = Yt(g, {
|
|
22494
22510
|
...s,
|
|
22495
22511
|
autoLoad: !1,
|
|
22496
22512
|
enabled: m
|
|
22497
|
-
}), I = v.reload, E = J(!1),
|
|
22513
|
+
}), I = v.reload, E = J(!1), R = J(i), q = de(async () => (E.current = !0, I()), [I]), $ = J(q);
|
|
22498
22514
|
$.current = q, ct(() => {
|
|
22499
|
-
const
|
|
22500
|
-
!m || s.autoLoad !== !0 && !(
|
|
22515
|
+
const D = R.current !== i;
|
|
22516
|
+
!m || s.autoLoad !== !0 && !(D && E.current) || (R.current = i, q());
|
|
22501
22517
|
}, [m, q, s.autoLoad, i]);
|
|
22502
22518
|
const M = de(
|
|
22503
|
-
async (
|
|
22504
|
-
const
|
|
22505
|
-
return await $.current(),
|
|
22519
|
+
async (D) => {
|
|
22520
|
+
const H = await D();
|
|
22521
|
+
return await $.current(), H;
|
|
22506
22522
|
},
|
|
22507
22523
|
[]
|
|
22508
22524
|
), B = de(
|
|
22509
|
-
(
|
|
22510
|
-
() => u ? u.upsertWorkspaceChannel(
|
|
22525
|
+
(D, H) => M(
|
|
22526
|
+
() => u ? u.upsertWorkspaceChannel(D, H) : t.upsertChannel(D, H)
|
|
22511
22527
|
),
|
|
22512
22528
|
[t, M, u]
|
|
22513
22529
|
), U = de(
|
|
22514
|
-
(
|
|
22515
|
-
() => u ? u.deleteWorkspaceChannel(
|
|
22530
|
+
(D, H) => M(
|
|
22531
|
+
() => u ? u.deleteWorkspaceChannel(D, H) : t.removeChannel(D, H)
|
|
22516
22532
|
),
|
|
22517
22533
|
[t, M, u]
|
|
22518
|
-
),
|
|
22519
|
-
(
|
|
22520
|
-
() => u ? u.setWorkspaceChannelStartup(
|
|
22534
|
+
), P = de(
|
|
22535
|
+
(D, H) => M(
|
|
22536
|
+
() => u ? u.setWorkspaceChannelStartup(D, H) : t.setChannelStartup(D, H)
|
|
22521
22537
|
),
|
|
22522
22538
|
[t, M, u]
|
|
22523
22539
|
), V = de(
|
|
22524
|
-
(
|
|
22525
|
-
() => u ? u.startWorkspaceChannel(
|
|
22540
|
+
(D) => M(
|
|
22541
|
+
() => u ? u.startWorkspaceChannel(D) : t.startChannel(D)
|
|
22526
22542
|
),
|
|
22527
22543
|
[t, M, u]
|
|
22528
|
-
),
|
|
22529
|
-
(
|
|
22530
|
-
() => u ? u.stopWorkspaceChannel(
|
|
22544
|
+
), X = de(
|
|
22545
|
+
(D) => M(
|
|
22546
|
+
() => u ? u.stopWorkspaceChannel(D) : t.stopChannel(D)
|
|
22531
22547
|
),
|
|
22532
22548
|
[t, M, u]
|
|
22533
22549
|
), ae = de(
|
|
22534
|
-
(
|
|
22535
|
-
() => u ? u.restartWorkspaceChannel(
|
|
22550
|
+
(D) => M(
|
|
22551
|
+
() => u ? u.restartWorkspaceChannel(D) : t.restartChannel(D)
|
|
22536
22552
|
),
|
|
22537
22553
|
[t, M, u]
|
|
22538
22554
|
), et = v.data?.workspaceCwd === i ? v.data : void 0, F = $e(
|
|
22539
22555
|
() => u ? {
|
|
22540
|
-
list: (
|
|
22541
|
-
approve: (
|
|
22542
|
-
approvals: (
|
|
22543
|
-
revoke: (
|
|
22544
|
-
|
|
22545
|
-
|
|
22556
|
+
list: (D) => u.workspaceChannelPairingRequests(D),
|
|
22557
|
+
approve: (D, H) => u.approveWorkspaceChannelPairing(D, { code: H }),
|
|
22558
|
+
approvals: (D) => u.workspaceChannelPairingApprovals(D),
|
|
22559
|
+
revoke: (D, H) => u.revokeWorkspaceChannelPairingApproval(
|
|
22560
|
+
D,
|
|
22561
|
+
H
|
|
22546
22562
|
)
|
|
22547
22563
|
} : t.channelPairing,
|
|
22548
22564
|
[t.channelPairing, u]
|
|
22549
22565
|
), S = $e(() => u ? {
|
|
22550
|
-
start: (
|
|
22551
|
-
state: (
|
|
22552
|
-
cancel: (
|
|
22566
|
+
start: (D) => u.startWorkspaceChannelQrLogin(D, { clientId: r }),
|
|
22567
|
+
state: (D) => u.workspaceChannelQrLogin(D, { clientId: r }),
|
|
22568
|
+
cancel: (D) => u.cancelWorkspaceChannelQrLogin(D, {
|
|
22553
22569
|
clientId: r
|
|
22554
22570
|
}),
|
|
22555
|
-
release: (
|
|
22571
|
+
release: (D) => t.channelQrLogin.release(D, r, i)
|
|
22556
22572
|
} : {
|
|
22557
|
-
start: (
|
|
22558
|
-
state: (
|
|
22559
|
-
cancel: (
|
|
22560
|
-
release: (
|
|
22573
|
+
start: (D) => t.channelQrLogin.start(D, r),
|
|
22574
|
+
state: (D) => t.channelQrLogin.state(D, r),
|
|
22575
|
+
cancel: (D) => t.channelQrLogin.cancel(D, r),
|
|
22576
|
+
release: (D) => t.channelQrLogin.release(D, r, i)
|
|
22561
22577
|
}, [t.channelQrLogin, u, r, i]);
|
|
22562
22578
|
return {
|
|
22563
22579
|
data: et ? { catalog: et.catalog, snapshot: et.snapshot } : void 0,
|
|
@@ -22569,9 +22585,9 @@ function Ow(e = {}) {
|
|
|
22569
22585
|
channels: et?.snapshot.instances ?? {},
|
|
22570
22586
|
createOrUpdate: B,
|
|
22571
22587
|
remove: U,
|
|
22572
|
-
setStartup:
|
|
22588
|
+
setStartup: P,
|
|
22573
22589
|
start: V,
|
|
22574
|
-
stop:
|
|
22590
|
+
stop: X,
|
|
22575
22591
|
restart: ae,
|
|
22576
22592
|
pairing: F,
|
|
22577
22593
|
qrLogin: S
|
|
@@ -22599,7 +22615,7 @@ function Ww(e = {}) {
|
|
|
22599
22615
|
m ?? "",
|
|
22600
22616
|
v,
|
|
22601
22617
|
g ?? ""
|
|
22602
|
-
].join("\0"),
|
|
22618
|
+
].join("\0"), R = de(async () => {
|
|
22603
22619
|
if (!s)
|
|
22604
22620
|
throw new Error("Channel events require a workspace.");
|
|
22605
22621
|
const B = {
|
|
@@ -22608,19 +22624,19 @@ function Ww(e = {}) {
|
|
|
22608
22624
|
...I ? { types: I } : {}
|
|
22609
22625
|
}, U = l ? await l.workspaceChannelEvents(B) : await t.listChannelEvents(B);
|
|
22610
22626
|
return { queryKey: E, list: U };
|
|
22611
|
-
}, [t, m, g, E, I, l, s]), q = Yt(
|
|
22627
|
+
}, [t, m, g, E, I, l, s]), q = Yt(R, {
|
|
22612
22628
|
...r,
|
|
22613
22629
|
autoLoad: !1,
|
|
22614
22630
|
enabled: u
|
|
22615
22631
|
}), { reload: $ } = q;
|
|
22616
22632
|
ct(() => {
|
|
22617
22633
|
if (!u) return;
|
|
22618
|
-
let B = !1, U = !1,
|
|
22634
|
+
let B = !1, U = !1, P = 0;
|
|
22619
22635
|
const V = () => {
|
|
22620
|
-
document.visibilityState !== "hidden" && (
|
|
22621
|
-
document.visibilityState !== "hidden" &&
|
|
22636
|
+
document.visibilityState !== "hidden" && (P = window.setTimeout(() => {
|
|
22637
|
+
document.visibilityState !== "hidden" && X();
|
|
22622
22638
|
}, cf));
|
|
22623
|
-
},
|
|
22639
|
+
}, X = async () => {
|
|
22624
22640
|
if (!U) {
|
|
22625
22641
|
U = !0;
|
|
22626
22642
|
try {
|
|
@@ -22631,10 +22647,10 @@ function Ww(e = {}) {
|
|
|
22631
22647
|
B || V();
|
|
22632
22648
|
}
|
|
22633
22649
|
}, ae = () => {
|
|
22634
|
-
document.visibilityState !== "hidden" && (window.clearTimeout(
|
|
22650
|
+
document.visibilityState !== "hidden" && (window.clearTimeout(P), X());
|
|
22635
22651
|
};
|
|
22636
|
-
return document.addEventListener("visibilitychange", ae), document.visibilityState !== "hidden" &&
|
|
22637
|
-
B = !0, window.clearTimeout(
|
|
22652
|
+
return document.addEventListener("visibilitychange", ae), document.visibilityState !== "hidden" && X(), () => {
|
|
22653
|
+
B = !0, window.clearTimeout(P), document.removeEventListener("visibilitychange", ae);
|
|
22638
22654
|
};
|
|
22639
22655
|
}, [u, $]);
|
|
22640
22656
|
const M = q.data?.queryKey === E ? q.data.list : void 0;
|
|
@@ -22726,19 +22742,19 @@ function Bw(e = {}) {
|
|
|
22726
22742
|
const I = v === "disable" ? await s.mcpConfig() : void 0, E = v === "enable" ? ["user", "workspace"] : [
|
|
22727
22743
|
Object.hasOwn(I.user, g) && !Object.hasOwn(I.workspace, g) ? "user" : "workspace"
|
|
22728
22744
|
];
|
|
22729
|
-
let
|
|
22745
|
+
let R;
|
|
22730
22746
|
for (const q of E) {
|
|
22731
22747
|
const $ = await (q === "user" ? n.setUserMcpServerEnabled(g, v === "enable") : s.setMcpServerEnabled(
|
|
22732
22748
|
g,
|
|
22733
22749
|
v === "enable"
|
|
22734
22750
|
));
|
|
22735
|
-
$.changed !== void 0 && (
|
|
22751
|
+
$.changed !== void 0 && (R = (R ?? !1) || $.changed);
|
|
22736
22752
|
}
|
|
22737
22753
|
return {
|
|
22738
22754
|
serverName: g,
|
|
22739
22755
|
action: v,
|
|
22740
22756
|
ok: !0,
|
|
22741
|
-
...
|
|
22757
|
+
...R === void 0 ? {} : { changed: R }
|
|
22742
22758
|
};
|
|
22743
22759
|
},
|
|
22744
22760
|
addServer: (g) => s ? Promise.reject(
|
|
@@ -22825,42 +22841,42 @@ function Hw(e = {}) {
|
|
|
22825
22841
|
]), g = !!l.workspaceCwd, v = Yt(m, {
|
|
22826
22842
|
...i,
|
|
22827
22843
|
enabled: (i.enabled ?? !0) && g
|
|
22828
|
-
}), I = v.reload, E = de(async () => (await I())?.sessions, [I]),
|
|
22844
|
+
}), I = v.reload, E = de(async () => (await I())?.sessions, [I]), R = v.data, q = R?.sessions ?? [], $ = de(
|
|
22829
22845
|
async (V) => {
|
|
22830
|
-
const
|
|
22831
|
-
return
|
|
22846
|
+
const X = await l.actions.deleteSession(V);
|
|
22847
|
+
return X && E(), X;
|
|
22832
22848
|
},
|
|
22833
22849
|
[l.actions, E]
|
|
22834
22850
|
), M = de(
|
|
22835
22851
|
async (V) => {
|
|
22836
|
-
const
|
|
22837
|
-
return (
|
|
22852
|
+
const X = await l.actions.deleteSessions(V);
|
|
22853
|
+
return (X.removed.length > 0 || X.notFound.length > 0) && E(), X;
|
|
22838
22854
|
},
|
|
22839
22855
|
[l.actions, E]
|
|
22840
22856
|
), B = de(
|
|
22841
|
-
(V,
|
|
22857
|
+
(V, X = "html") => l.actions.exportSession(V, X),
|
|
22842
22858
|
[l.actions]
|
|
22843
22859
|
), U = de(
|
|
22844
22860
|
async (V) => {
|
|
22845
|
-
const
|
|
22846
|
-
return
|
|
22861
|
+
const X = await l.actions.archiveSession(V);
|
|
22862
|
+
return X && E(), X;
|
|
22847
22863
|
},
|
|
22848
22864
|
[l.actions, E]
|
|
22849
|
-
),
|
|
22865
|
+
), P = de(
|
|
22850
22866
|
async (V) => {
|
|
22851
|
-
const
|
|
22852
|
-
return
|
|
22867
|
+
const X = await l.actions.unarchiveSession(V);
|
|
22868
|
+
return X && E(), X;
|
|
22853
22869
|
},
|
|
22854
22870
|
[l.actions, E]
|
|
22855
22871
|
);
|
|
22856
22872
|
return {
|
|
22857
22873
|
...v,
|
|
22858
|
-
data:
|
|
22874
|
+
data: R !== void 0 ? q : void 0,
|
|
22859
22875
|
reload: E,
|
|
22860
22876
|
sessions: q,
|
|
22861
|
-
nextCursor:
|
|
22862
|
-
liveMergeFailed:
|
|
22863
|
-
truncated:
|
|
22877
|
+
nextCursor: R?.nextCursor,
|
|
22878
|
+
liveMergeFailed: R?.liveMergeFailed === !0,
|
|
22879
|
+
truncated: R?.truncated === !0,
|
|
22864
22880
|
loadSession: u?.loadSession,
|
|
22865
22881
|
resumeSession: u?.resumeSession,
|
|
22866
22882
|
newSession: u?.newSession,
|
|
@@ -22869,7 +22885,7 @@ function Hw(e = {}) {
|
|
|
22869
22885
|
deleteSessions: M,
|
|
22870
22886
|
exportSession: B,
|
|
22871
22887
|
archiveSession: U,
|
|
22872
|
-
unarchiveSession:
|
|
22888
|
+
unarchiveSession: P
|
|
22873
22889
|
};
|
|
22874
22890
|
}
|
|
22875
22891
|
/**
|
|
@@ -22888,14 +22904,14 @@ function Gw(e = {}) {
|
|
|
22888
22904
|
const { actions: t, capabilities: n, client: o, workspaceCwd: a } = es(), r = pr() === "available", { workspaceCwd: s, ...i } = e, l = s ?? a, u = $e(
|
|
22889
22905
|
() => l ? o.workspaceByCwd(l) : void 0,
|
|
22890
22906
|
[o, l]
|
|
22891
|
-
), [m, g] = wt(!1), [v, I] = wt(), E = n?.features.includes("workspace_skills_config_runtime") === !0,
|
|
22907
|
+
), [m, g] = wt(!1), [v, I] = wt(), E = n?.features.includes("workspace_skills_config_runtime") === !0, R = s !== void 0 && s !== a, q = de(() => {
|
|
22892
22908
|
if (!E)
|
|
22893
|
-
return ha(
|
|
22909
|
+
return ha(R), t.loadSkillsStatus();
|
|
22894
22910
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
22895
22911
|
return u.workspaceConfigSkills();
|
|
22896
22912
|
}, [
|
|
22897
22913
|
t,
|
|
22898
|
-
|
|
22914
|
+
R,
|
|
22899
22915
|
E,
|
|
22900
22916
|
u
|
|
22901
22917
|
]), $ = de(() => {
|
|
@@ -22905,24 +22921,24 @@ function Gw(e = {}) {
|
|
|
22905
22921
|
...i,
|
|
22906
22922
|
autoLoad: !1,
|
|
22907
22923
|
enabled: i.enabled !== !1 && E
|
|
22908
|
-
}), U = M.reload,
|
|
22924
|
+
}), U = M.reload, P = B.reload, [V, X] = wt(), ae = de(
|
|
22909
22925
|
async (z) => {
|
|
22910
22926
|
if (!(!E || !u)) {
|
|
22911
22927
|
g(!0), I(void 0);
|
|
22912
22928
|
try {
|
|
22913
|
-
const
|
|
22914
|
-
|
|
22915
|
-
const oe =
|
|
22929
|
+
const Y = await u.ensureRuntime();
|
|
22930
|
+
X(Y);
|
|
22931
|
+
const oe = Y.capabilities?.skills?.error;
|
|
22916
22932
|
if (oe) {
|
|
22917
22933
|
const ne = new Error(oe.message);
|
|
22918
22934
|
if (z?.throwOnError) throw ne;
|
|
22919
22935
|
I(ne);
|
|
22920
22936
|
}
|
|
22921
|
-
return await
|
|
22922
|
-
} catch (
|
|
22923
|
-
if (z?.throwOnError) throw
|
|
22937
|
+
return await P();
|
|
22938
|
+
} catch (Y) {
|
|
22939
|
+
if (z?.throwOnError) throw Y;
|
|
22924
22940
|
I(
|
|
22925
|
-
|
|
22941
|
+
Y instanceof Error ? Y : new Error(String(Y))
|
|
22926
22942
|
);
|
|
22927
22943
|
return;
|
|
22928
22944
|
} finally {
|
|
@@ -22930,12 +22946,12 @@ function Gw(e = {}) {
|
|
|
22930
22946
|
}
|
|
22931
22947
|
}
|
|
22932
22948
|
},
|
|
22933
|
-
[
|
|
22949
|
+
[P, E, u]
|
|
22934
22950
|
);
|
|
22935
22951
|
ct(() => {
|
|
22936
22952
|
if (!r || !E || !u || !V)
|
|
22937
22953
|
return;
|
|
22938
|
-
let z = !1,
|
|
22954
|
+
let z = !1, Y;
|
|
22939
22955
|
const oe = async () => {
|
|
22940
22956
|
try {
|
|
22941
22957
|
const ne = await u.runtimeStatus();
|
|
@@ -22944,7 +22960,7 @@ function Gw(e = {}) {
|
|
|
22944
22960
|
if (ne.runtimeLive === V.runtimeLive && ne.runtimeEpoch === V.runtimeEpoch && qe?.state === Pe?.state && qe?.revision === Pe?.revision && qe?.runtimeEpoch === Pe?.runtimeEpoch && (qe?.state !== "ready" || B.data?.initialized === !0 && B.data.runtimeEpoch === ne.runtimeEpoch && B.error === void 0))
|
|
22945
22961
|
return;
|
|
22946
22962
|
const Ie = () => {
|
|
22947
|
-
|
|
22963
|
+
X(ne), I(
|
|
22948
22964
|
qe?.error ? new Error(qe.error.message) : void 0
|
|
22949
22965
|
);
|
|
22950
22966
|
};
|
|
@@ -22953,25 +22969,25 @@ function Gw(e = {}) {
|
|
|
22953
22969
|
else if (qe?.state === "ready" && qe.runtimeEpoch === ne.runtimeEpoch) {
|
|
22954
22970
|
const [ze, Te] = await Promise.all([
|
|
22955
22971
|
U(),
|
|
22956
|
-
|
|
22972
|
+
P()
|
|
22957
22973
|
]);
|
|
22958
22974
|
!z && ze && Te && Ie();
|
|
22959
22975
|
} else
|
|
22960
22976
|
Ie();
|
|
22961
22977
|
} catch {
|
|
22962
22978
|
} finally {
|
|
22963
|
-
z || (
|
|
22979
|
+
z || (Y = setTimeout(oe, bc));
|
|
22964
22980
|
}
|
|
22965
22981
|
};
|
|
22966
|
-
return
|
|
22967
|
-
z = !0,
|
|
22982
|
+
return Y = setTimeout(oe, bc), () => {
|
|
22983
|
+
z = !0, Y && clearTimeout(Y);
|
|
22968
22984
|
};
|
|
22969
22985
|
}, [
|
|
22970
22986
|
V,
|
|
22971
22987
|
r,
|
|
22972
22988
|
ae,
|
|
22973
22989
|
U,
|
|
22974
|
-
|
|
22990
|
+
P,
|
|
22975
22991
|
B.data?.initialized,
|
|
22976
22992
|
B.data?.runtimeEpoch,
|
|
22977
22993
|
B.error,
|
|
@@ -22981,29 +22997,29 @@ function Gw(e = {}) {
|
|
|
22981
22997
|
const et = E && V?.capabilities?.skills?.state === "ready" && V.capabilities.skills.runtimeEpoch === V.runtimeEpoch && B.data?.initialized === !0 && B.data.runtimeEpoch === V.runtimeEpoch, F = $e(() => {
|
|
22982
22998
|
const z = M.data?.skills ?? [];
|
|
22983
22999
|
if (!et) return z;
|
|
22984
|
-
const
|
|
23000
|
+
const Y = new Map(
|
|
22985
23001
|
(B.data?.skills ?? []).map((ne) => [
|
|
22986
23002
|
ne.name.toLowerCase(),
|
|
22987
23003
|
ne
|
|
22988
23004
|
])
|
|
22989
23005
|
);
|
|
22990
23006
|
return [...z.map((ne) => {
|
|
22991
|
-
const Pe =
|
|
22992
|
-
return Pe ? (
|
|
23007
|
+
const Pe = Y.get(ne.name.toLowerCase());
|
|
23008
|
+
return Pe ? (Y.delete(ne.name.toLowerCase()), {
|
|
22993
23009
|
...Pe,
|
|
22994
23010
|
...ne,
|
|
22995
23011
|
installedPath: ne.installedPath ?? Pe.installedPath
|
|
22996
23012
|
}) : ne;
|
|
22997
|
-
}), ...
|
|
23013
|
+
}), ...Y.values()];
|
|
22998
23014
|
}, [M.data?.skills, B.data?.skills, et]), S = de(async () => {
|
|
22999
23015
|
if (!E) return await U();
|
|
23000
|
-
const [z,
|
|
23016
|
+
const [z, Y] = await Promise.all([
|
|
23001
23017
|
U(),
|
|
23002
23018
|
ae()
|
|
23003
23019
|
]);
|
|
23004
|
-
return
|
|
23005
|
-
}, [ae, U, E]),
|
|
23006
|
-
return Fn(
|
|
23020
|
+
return Y ?? z;
|
|
23021
|
+
}, [ae, U, E]), D = bo(), H = D ? D.settingsVersion + D.extensionsVersion + D.skillsVersion : void 0;
|
|
23022
|
+
return Fn(H, U, M.data !== void 0), Fn(H, P, B.data !== void 0), {
|
|
23007
23023
|
data: M.data ?? B.data,
|
|
23008
23024
|
status: M.data ?? B.data,
|
|
23009
23025
|
configStatus: M.data,
|
|
@@ -23014,66 +23030,66 @@ function Gw(e = {}) {
|
|
|
23014
23030
|
error: M.error ?? (E ? v ?? B.error : void 0),
|
|
23015
23031
|
reload: S,
|
|
23016
23032
|
reloadConfig: U,
|
|
23017
|
-
reloadRuntime:
|
|
23033
|
+
reloadRuntime: P,
|
|
23018
23034
|
ensureRuntime: ae,
|
|
23019
|
-
setEnabled: async (z,
|
|
23035
|
+
setEnabled: async (z, Y, oe) => {
|
|
23020
23036
|
if (!E)
|
|
23021
|
-
return ha(
|
|
23037
|
+
return ha(R), await t.setWorkspaceSkillEnabled(z, Y);
|
|
23022
23038
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
23023
23039
|
const ne = await u.setWorkspaceConfigSkillEnabled(
|
|
23024
23040
|
z,
|
|
23025
|
-
|
|
23041
|
+
Y,
|
|
23026
23042
|
oe
|
|
23027
23043
|
);
|
|
23028
23044
|
return await ae(), ne;
|
|
23029
23045
|
},
|
|
23030
23046
|
install: async (z) => {
|
|
23031
23047
|
if (!E)
|
|
23032
|
-
return ha(
|
|
23033
|
-
let
|
|
23048
|
+
return ha(R), await t.installWorkspaceSkill(z);
|
|
23049
|
+
let Y;
|
|
23034
23050
|
if (z.scope === "global")
|
|
23035
|
-
|
|
23051
|
+
Y = await o.installWorkspaceConfigSkill({
|
|
23036
23052
|
...z,
|
|
23037
23053
|
scope: "global"
|
|
23038
23054
|
});
|
|
23039
23055
|
else {
|
|
23040
23056
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
23041
|
-
|
|
23057
|
+
Y = await u.installWorkspaceConfigSkill({
|
|
23042
23058
|
...z,
|
|
23043
23059
|
scope: "workspace"
|
|
23044
23060
|
});
|
|
23045
23061
|
}
|
|
23046
|
-
return await ae(),
|
|
23062
|
+
return await ae(), Y;
|
|
23047
23063
|
},
|
|
23048
|
-
installArchive: async (z,
|
|
23064
|
+
installArchive: async (z, Y) => {
|
|
23049
23065
|
if (!n?.features.includes("skill_archive_install"))
|
|
23050
23066
|
throw new Error("Native Skill archive installation is unavailable.");
|
|
23051
|
-
if (
|
|
23067
|
+
if (Y === "global")
|
|
23052
23068
|
return o.installWorkspaceConfigSkillArchive(z);
|
|
23053
23069
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
23054
23070
|
return u.installWorkspaceConfigSkillArchive(z);
|
|
23055
23071
|
},
|
|
23056
|
-
lookupInstallAttempt: async (z,
|
|
23072
|
+
lookupInstallAttempt: async (z, Y) => {
|
|
23057
23073
|
if (z === "global")
|
|
23058
|
-
return o.getWorkspaceSkillInstallAttempt(
|
|
23074
|
+
return o.getWorkspaceSkillInstallAttempt(Y, {
|
|
23059
23075
|
timeoutMs: 5e3
|
|
23060
23076
|
});
|
|
23061
23077
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
23062
|
-
return u.getWorkspaceSkillInstallAttempt(
|
|
23078
|
+
return u.getWorkspaceSkillInstallAttempt(Y, {
|
|
23063
23079
|
timeoutMs: 5e3
|
|
23064
23080
|
});
|
|
23065
23081
|
},
|
|
23066
|
-
remove: async (z,
|
|
23082
|
+
remove: async (z, Y) => {
|
|
23067
23083
|
if (!E)
|
|
23068
|
-
return ha(
|
|
23084
|
+
return ha(R), await t.deleteWorkspaceSkill(z, Y);
|
|
23069
23085
|
let oe;
|
|
23070
|
-
if (
|
|
23071
|
-
oe = await o.deleteWorkspaceConfigSkill(z,
|
|
23086
|
+
if (Y === "global")
|
|
23087
|
+
oe = await o.deleteWorkspaceConfigSkill(z, Y);
|
|
23072
23088
|
else {
|
|
23073
23089
|
if (!u) throw new Error("Workspace is unavailable.");
|
|
23074
23090
|
oe = await u.deleteWorkspaceConfigSkill(
|
|
23075
23091
|
z,
|
|
23076
|
-
|
|
23092
|
+
Y
|
|
23077
23093
|
);
|
|
23078
23094
|
}
|
|
23079
23095
|
return await ae(), oe;
|
|
@@ -23277,23 +23293,23 @@ function Yw(e = {}) {
|
|
|
23277
23293
|
[t]
|
|
23278
23294
|
), { setSuggestion: E } = I;
|
|
23279
23295
|
ct(() => (t || I.clear(), () => I.cleanup()), [I, t]);
|
|
23280
|
-
const
|
|
23296
|
+
const R = J(void 0), q = J(r);
|
|
23281
23297
|
ct(() => {
|
|
23282
23298
|
const U = q.current;
|
|
23283
|
-
q.current = r, U !== void 0 && r !== void 0 && U !== r && (I.clear(), ia(),
|
|
23299
|
+
q.current = r, U !== void 0 && r !== void 0 && U !== r && (I.clear(), ia(), R.current = void 0);
|
|
23284
23300
|
}, [I, r]), ct(() => {
|
|
23285
23301
|
const U = v?.promptId;
|
|
23286
|
-
U !==
|
|
23302
|
+
U !== R.current && (R.current = U, E(v?.suggestion ?? null));
|
|
23287
23303
|
}, [v, E]);
|
|
23288
23304
|
const $ = de(() => {
|
|
23289
|
-
I.clear(), Ni(a), ia(),
|
|
23305
|
+
I.clear(), Ni(a), ia(), R.current = void 0;
|
|
23290
23306
|
}, [I, a]), M = de(
|
|
23291
|
-
(U,
|
|
23292
|
-
I.accept(U,
|
|
23307
|
+
(U, P) => {
|
|
23308
|
+
I.accept(U, P), Ni(a), ia(), R.current = void 0;
|
|
23293
23309
|
},
|
|
23294
23310
|
[I, a]
|
|
23295
23311
|
), B = de(() => {
|
|
23296
|
-
I.dismiss(), Ni(a), ia(),
|
|
23312
|
+
I.dismiss(), Ni(a), ia(), R.current = void 0;
|
|
23297
23313
|
}, [I, a]);
|
|
23298
23314
|
return $e(
|
|
23299
23315
|
() => ({
|