@qwen-code/web-shell 0.25.0 → 0.25.1-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ var ic = (e, t, o) => t in e ? rc(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var so = (e, t, o) => ic(e, typeof t != "symbol" ? t + "" : t, o);
4
4
  import { createContext as xt, useContext as Lt, useMemo as nt, useRef as Y, useState as rt, useCallback as de, useEffect as ut, useSyncExternalStore as fn } from "react";
5
5
  import { jsx as Yt } from "react/jsx-runtime";
6
- import { DaemonHttpError as fo, parseDaemonBackgroundTurn as Hs, getSessionUpdatePayload as lc, isStaleBranchPointError as cc, DaemonStandaloneCreationOutcomeUnknownError as Ri, isDaemonTurnError as Rr, DaemonTransportClosedError as dc, DaemonPendingPromptLimitError as uc, asKnownDaemonEvent as pc, EXTENSION_ARCHIVE_UPLOAD_TIMEOUT_MS as mc, DaemonClient as _s, MID_TURN_MESSAGE_INJECTED_EVENT as gc, PENDING_PROMPT_ADDED_EVENT as Pi, PENDING_PROMPT_STARTED_EVENT as Ei, PENDING_PROMPT_COMPLETED_EVENT as $i, isTaskExecutionMode as Mi, estimateDaemonTranscriptBlockBytes as Va, createDaemonTranscriptStore as Vn, normalizeDaemonEvent as hc, extractServerTimestamp as fc, STANDALONE_SESSION_OPTIONS_CAPABILITY as wc, DaemonSessionClient as Ro, isUnrecognizedDiagnosticReason as Pr, DaemonCapabilityMissingError as fa, matchTurnEvent as kc, isTrimmedToolBlockId as bc, isTrimmedPermissionBlockId as vc, UNRECOGNIZED_DIAGNOSTICS_LIMIT as yc, DAEMON_APPROVAL_MODES as Sc } from "@qwen-code/sdk/daemon";
6
+ import { DaemonHttpError as fo, parseDaemonBackgroundTurn as Hs, getSessionUpdatePayload as lc, isStaleBranchPointError as cc, DaemonStandaloneCreationOutcomeUnknownError as Ai, isDaemonTurnError as Ar, DaemonTransportClosedError as dc, DaemonPendingPromptLimitError as uc, asKnownDaemonEvent as pc, EXTENSION_ARCHIVE_UPLOAD_TIMEOUT_MS as mc, DaemonClient as _s, MID_TURN_MESSAGE_INJECTED_EVENT as gc, PENDING_PROMPT_ADDED_EVENT as Pi, PENDING_PROMPT_STARTED_EVENT as Ei, PENDING_PROMPT_COMPLETED_EVENT as $i, isTaskExecutionMode as Mi, estimateDaemonTranscriptBlockBytes as Va, createDaemonTranscriptStore as Vn, normalizeDaemonEvent as hc, extractServerTimestamp as fc, STANDALONE_SESSION_OPTIONS_CAPABILITY as wc, DaemonSessionClient as Ao, isUnrecognizedDiagnosticReason as Pr, DaemonCapabilityMissingError as fa, matchTurnEvent as kc, isTrimmedToolBlockId as bc, isTrimmedPermissionBlockId as vc, UNRECOGNIZED_DIAGNOSTICS_LIMIT as yc, DAEMON_APPROVAL_MODES as Sc } from "@qwen-code/sdk/daemon";
7
7
  /**
8
8
  * @license
9
9
  * Copyright 2025 Qwen Team
@@ -348,22 +348,22 @@ function Bs(e, t) {
348
348
  goalId: e.goal.goalId,
349
349
  revision: e.goal.revision,
350
350
  updatedAt: e.goal.updatedAt
351
- }), Ac(t, o, s), t);
351
+ }), Rc(t, o, s), t);
352
352
  }
353
353
  function $r(e, t) {
354
354
  return t.revision < e.revision || t.revision === e.revision && t.updatedAt <= e.updatedAt;
355
355
  }
356
- function Ac(e, t, o) {
356
+ function Rc(e, t, o) {
357
357
  if (!t && !o) return;
358
358
  const s = new Map(t ?? []);
359
- for (e.goal && s.delete(e.goal.goalId), o && (s.delete(o.goalId), s.set(o.goalId, o)); s.size > Rc; ) {
359
+ for (e.goal && s.delete(e.goal.goalId), o && (s.delete(o.goalId), s.set(o.goalId, o)); s.size > Ac; ) {
360
360
  const n = s.keys().next();
361
361
  if (n.done) break;
362
362
  s.delete(n.value);
363
363
  }
364
364
  s.size !== 0 && Di.set(e, s);
365
365
  }
366
- const Rc = 8, ka = /* @__PURE__ */ new WeakMap(), Di = /* @__PURE__ */ new WeakMap();
366
+ const Ac = 8, ka = /* @__PURE__ */ new WeakMap(), Di = /* @__PURE__ */ new WeakMap();
367
367
  function Pc(e) {
368
368
  const t = _e(_e(e?._meta)?.goalState);
369
369
  if (It(t, "v") !== 2) return;
@@ -385,7 +385,7 @@ function Pc(e) {
385
385
  } : {}
386
386
  };
387
387
  }
388
- const s = _e(t?.goal), n = Ie(s, "goalId"), a = It(s, "revision"), r = Ie(s, "objective"), i = Ie(s, "status"), m = _e(s?.evidenceCursor)?.recordId, g = It(s, "turnCount"), h = It(s, "activeTimeMs"), v = It(s, "tokensUsed"), R = It(s, "tokenBudget"), U = It(s, "turnBudget"), A = It(s, "activeTimeBudgetMs"), O = It(s, "createdAt"), P = It(s, "updatedAt");
388
+ const s = _e(t?.goal), n = Ie(s, "goalId"), a = It(s, "revision"), r = Ie(s, "objective"), i = Ie(s, "status"), m = _e(s?.evidenceCursor)?.recordId, g = It(s, "turnCount"), h = It(s, "activeTimeMs"), v = It(s, "tokensUsed"), A = It(s, "tokenBudget"), U = It(s, "turnBudget"), R = It(s, "activeTimeBudgetMs"), O = It(s, "createdAt"), P = It(s, "updatedAt");
389
389
  if (!n || a === void 0 || !r || i !== "active" && i !== "paused" && i !== "blocked" && i !== "usage_limited" && i !== "complete" || m !== null && typeof m != "string" || g === void 0 || h === void 0 || O === void 0 || P === void 0)
390
390
  return;
391
391
  const q = Ie(s, "lastReason"), H = Ie(s, "limitKind"), J = H === "evidence_catalog" || H === "checkpoint_request" || H === "token_budget" || H === "turn_budget" || H === "time_budget" ? H : void 0;
@@ -401,9 +401,9 @@ function Pc(e) {
401
401
  turnCount: g,
402
402
  activeTimeMs: h,
403
403
  ...v !== void 0 ? { tokensUsed: v } : {},
404
- ...R !== void 0 ? { tokenBudget: R } : {},
404
+ ...A !== void 0 ? { tokenBudget: A } : {},
405
405
  ...U !== void 0 ? { turnBudget: U } : {},
406
- ...A !== void 0 ? { activeTimeBudgetMs: A } : {},
406
+ ...R !== void 0 ? { activeTimeBudgetMs: R } : {},
407
407
  createdAt: O,
408
408
  updatedAt: P,
409
409
  ...q ? { lastReason: q } : {},
@@ -874,9 +874,9 @@ function Kc({
874
874
  skipNextCleanupDetachSessionRef: g,
875
875
  passiveAssistantDoneTimerRef: h,
876
876
  daemonActivePromptRef: v,
877
- settleRestoredActivePrompt: R,
877
+ settleRestoredActivePrompt: A,
878
878
  flushTranscript: U,
879
- getCreateSessionRequest: A,
879
+ getCreateSessionRequest: R,
880
880
  createDetachedSession: O,
881
881
  createDetachedStandaloneSession: P,
882
882
  getDefaultSessionContext: q,
@@ -900,7 +900,7 @@ function Kc({
900
900
  onContinuationAdmitted: Le,
901
901
  onPromptRemoved: st
902
902
  }) {
903
- const Re = /* @__PURE__ */ new Set();
903
+ const Ae = /* @__PURE__ */ new Set();
904
904
  let Ht = t.current, Eo = 0, it = 0, Ye = 0, Gt, vo = !1, Vo = t.current?.client, $o = t.current?.sessionId, Je = t.current?.clientId;
905
905
  async function Pt(c) {
906
906
  const d = Xn(
@@ -1100,9 +1100,9 @@ function Kc({
1100
1100
  ...c,
1101
1101
  id: c.id ?? "stale-session-notice",
1102
1102
  createdAt: c.createdAt ?? 0
1103
- }), vt = (c) => t.current !== c ? ht : (Ht !== c && Re.clear(), Ht = c, M);
1103
+ }), vt = (c) => t.current !== c ? ht : (Ht !== c && Ae.clear(), Ht = c, M);
1104
1104
  function Xt() {
1105
- ne(), Re.clear();
1105
+ ne(), Ae.clear();
1106
1106
  for (const [, c] of o.current)
1107
1107
  c.controller.abort();
1108
1108
  o.current.clear(), s.current.clear(), V("idle"), Qe(h), n.current && (g.current?.sessionId === n.current.sessionId && (g.current = void 0), qr(n.current), n.current.reject(
@@ -1245,7 +1245,7 @@ function Kc({
1245
1245
  f.sessionId
1246
1246
  ))
1247
1247
  return;
1248
- const w = R();
1248
+ const w = A();
1249
1249
  !k && !w && !u.backgroundTurn || (U(), e.getSnapshot().activeAssistantBlockId && (e.dispatch({ type: "assistant.done", reason: "daemon_idle" }), Qe(h)), console.debug(
1250
1250
  "[DaemonSessionActions] settled turn from daemon prompt state (sessionId=%s, daemonActivePrompt=%s)",
1251
1251
  f.sessionId,
@@ -1361,7 +1361,7 @@ function Kc({
1361
1361
  N.references,
1362
1362
  N.fileReferences,
1363
1363
  F
1364
- ), d?.onAdmitted?.(), await jr(
1364
+ ), d?.onAdmitted?.({ promptId: ae.promptId }), await jr(
1365
1365
  o.current,
1366
1366
  s.current,
1367
1367
  T,
@@ -1371,7 +1371,7 @@ function Kc({
1371
1371
  } catch (f) {
1372
1372
  if (gn(f))
1373
1373
  return t.current?.sessionId === T && e.dispatch({ type: "assistant.done", reason: "cancelled" }), { stopReason: "cancelled" };
1374
- throw Rr(f) ? f : (t.current?.sessionId === T && e.dispatch({ type: "assistant.done", reason: "error" }), Se(
1374
+ throw Ar(f) ? f : (t.current?.sessionId === T && e.dispatch({ type: "assistant.done", reason: "error" }), Se(
1375
1375
  M,
1376
1376
  "Prompt failed",
1377
1377
  f,
@@ -1440,7 +1440,7 @@ function Kc({
1440
1440
  e.dispatch({ type: "assistant.done", reason: "cancelled" });
1441
1441
  return;
1442
1442
  }
1443
- throw Rr(w) ? w : (ee(d, w), Se(
1443
+ throw Ar(w) ? w : (ee(d, w), Se(
1444
1444
  M,
1445
1445
  "Continue failed",
1446
1446
  w,
@@ -1870,7 +1870,7 @@ function Kc({
1870
1870
  const re = await E(
1871
1871
  b(
1872
1872
  Q.client.createOrAttachSession({
1873
- ...A(),
1873
+ ...R(),
1874
1874
  ...d?.kind === "workspace" ? { workspaceCwd: d.cwd } : {},
1875
1875
  ..._
1876
1876
  }),
@@ -1939,7 +1939,7 @@ function Kc({
1939
1939
  missingSession: !1
1940
1940
  })), N;
1941
1941
  } catch (k) {
1942
- throw p && !T && (u = !0), f && k instanceof Ri && ke((w) => ({
1942
+ throw p && !T && (u = !0), f && k instanceof Ai && ke((w) => ({
1943
1943
  ...mn(
1944
1944
  w,
1945
1945
  w.sessionId,
@@ -2148,7 +2148,7 @@ function Kc({
2148
2148
  b,
2149
2149
  "load_context_usage",
2150
2150
  c?.silent && k ? {
2151
- dispatchedNoticeKeys: Re,
2151
+ dispatchedNoticeKeys: Ae,
2152
2152
  noticeOnceKey: ya(
2153
2153
  "load_context_usage",
2154
2154
  b
@@ -2207,8 +2207,8 @@ function Kc({
2207
2207
  "generate_session_content"
2208
2208
  ).generateContent(c, d);
2209
2209
  },
2210
- async getRewindSnapshots() {
2211
- const c = Ee(
2210
+ async getRewindSnapshots(c) {
2211
+ const d = Ee(
2212
2212
  M,
2213
2213
  t.current,
2214
2214
  "Load rewind snapshots failed",
@@ -2216,14 +2216,14 @@ function Kc({
2216
2216
  );
2217
2217
  try {
2218
2218
  return await E(
2219
- c.getRewindSnapshots(),
2219
+ d.getRewindSnapshots(),
2220
2220
  "Load rewind snapshots timed out"
2221
2221
  );
2222
- } catch (d) {
2223
- throw Se(
2222
+ } catch (p) {
2223
+ throw c?.silent ? p : Se(
2224
2224
  M,
2225
2225
  "Load rewind snapshots failed",
2226
- d,
2226
+ p,
2227
2227
  "rewind_snapshots"
2228
2228
  );
2229
2229
  }
@@ -2241,7 +2241,7 @@ function Kc({
2241
2241
  "Rewind session timed out"
2242
2242
  );
2243
2243
  } catch (T) {
2244
- throw Se(
2244
+ throw d?.silent ? T : Se(
2245
2245
  M,
2246
2246
  "Rewind session failed",
2247
2247
  T,
@@ -2427,7 +2427,7 @@ function Kc({
2427
2427
  p,
2428
2428
  "load_tasks",
2429
2429
  c?.silent ? {
2430
- dispatchedNoticeKeys: Re,
2430
+ dispatchedNoticeKeys: Ae,
2431
2431
  noticeOnceKey: ya("load_tasks", p)
2432
2432
  } : void 0
2433
2433
  );
@@ -2448,7 +2448,7 @@ function Kc({
2448
2448
  p,
2449
2449
  "load_tasks",
2450
2450
  c?.silent ? {
2451
- dispatchedNoticeKeys: Re,
2451
+ dispatchedNoticeKeys: Ae,
2452
2452
  noticeOnceKey: ya("load_tasks", p)
2453
2453
  } : void 0
2454
2454
  );
@@ -3260,6 +3260,11 @@ const ld = {
3260
3260
  "collab.run.stop": "Stop",
3261
3261
  "collab.runtime.addTitle": "Add a runtime",
3262
3262
  "collab.runtime.addDescription": "Let another computer run Qwen Code agents for this workspace.",
3263
+ "collab.runtime.replaceTitle": (e) => `Replace ${e?.name}`,
3264
+ "collab.runtime.replaceDescription": (e) => `Replace ${e?.name} with a new host using a one-time join command.`,
3265
+ "collab.runtime.replaceEffects": "After the new host registers, the old credentials are revoked and agent bindings move to the new host. Running or cancelling tasks on the old host fail; results already being finalized are preserved.",
3266
+ "collab.runtime.replaceRecovery": (e) => `Resuming replacement of ${e?.name} (${e?.id}). Link expiry does not cancel the pending replacement or undo migrated bindings. If the command expires, create a fresh command here and run it on the replacement machine.`,
3267
+ "collab.runtime.refreshReplacement": "Refresh replacement command",
3263
3268
  "collab.runtime.methodCommand": "Run one command there",
3264
3269
  "collab.runtime.methodExisting": "I have its address and token",
3265
3270
  "collab.runtime.address": "This computer’s address, as the other computer sees it",
@@ -3276,6 +3281,8 @@ const ld = {
3276
3281
  "collab.runtime.waitingFor": (e) => `${e?.seconds ?? 0}s so far. This updates by itself when it connects.`,
3277
3282
  "collab.runtime.closeKeepLink": "Close (the link keeps working)",
3278
3283
  "collab.runtime.connected": (e) => `${e?.name} is connected`,
3284
+ "collab.runtime.replaced": (e) => `${e?.oldName} was replaced by ${e?.name}`,
3285
+ "collab.runtime.replaceCompleted": "The old credentials were revoked and agent bindings were migrated. Old active runs were settled; results already being finalized were preserved.",
3279
3286
  "collab.runtime.offers": (e) => `Offers ${e?.programs}`,
3280
3287
  "collab.runtime.done": "Done",
3281
3288
  "collab.runtime.createAgentOn": (e) => `Create an agent on ${e?.name}`,
@@ -3534,6 +3541,7 @@ const ld = {
3534
3541
  "collab.runtime.hostSession": (e) => `Host session: ${e?.id}`,
3535
3542
  "collab.runtime.sessions": (e) => `Sessions: ${e?.count}`,
3536
3543
  "collab.runtime.lastSeen": (e) => `Last heartbeat: ${e?.time}`,
3544
+ "collab.runtime.replace": "Replace Host",
3537
3545
  "collab.runtime.remove": "Remove",
3538
3546
  "collab.runtime.removeConfirm": (e) => `Remove “${e?.name}”? Agents assigned only to it will move to this computer, and its active runs will stop.`
3539
3547
  }, cd = {
@@ -3565,6 +3573,11 @@ const ld = {
3565
3573
  "collab.run.stop": "停止",
3566
3574
  "collab.runtime.addTitle": "添加 Runtime",
3567
3575
  "collab.runtime.addDescription": "让另一台电脑为这个工作区运行 Qwen Code Agent。",
3576
+ "collab.runtime.replaceTitle": (e) => `替换 ${e?.name}`,
3577
+ "collab.runtime.replaceDescription": (e) => `使用一次性加入命令,用新主机替换 ${e?.name}。`,
3578
+ "collab.runtime.replaceEffects": "新主机注册后,旧凭据被撤销,Agent 绑定迁移到新主机。旧主机上正在运行或取消的任务会失败;已进入完成结算的结果会保留。",
3579
+ "collab.runtime.replaceRecovery": (e) => `正在恢复对 ${e?.name}(${e?.id})的替换。链接过期不会取消待完成的替换,也不会回滚已迁移的绑定。命令过期后,在这里生成新命令,再到替换主机上运行。`,
3580
+ "collab.runtime.refreshReplacement": "刷新替换命令",
3568
3581
  "collab.runtime.methodCommand": "在那台电脑上运行一行命令",
3569
3582
  "collab.runtime.methodExisting": "我已有地址和令牌",
3570
3583
  "collab.runtime.address": "这台电脑的地址(从那台电脑看过来)",
@@ -3581,6 +3594,8 @@ const ld = {
3581
3594
  "collab.runtime.waitingFor": (e) => `已等待 ${e?.seconds ?? 0} 秒。连上后这里会自动更新。`,
3582
3595
  "collab.runtime.closeKeepLink": "关闭(链接仍然有效)",
3583
3596
  "collab.runtime.connected": (e) => `${e?.name} 已连接`,
3597
+ "collab.runtime.replaced": (e) => `${e?.oldName} 已由 ${e?.name} 替换`,
3598
+ "collab.runtime.replaceCompleted": "旧主机凭据已撤销,Agent 绑定已迁移。旧的活动任务已结算,已进入完成结算的结果已保留。",
3584
3599
  "collab.runtime.offers": (e) => `提供 ${e?.programs}`,
3585
3600
  "collab.runtime.done": "完成",
3586
3601
  "collab.runtime.createAgentOn": (e) => `在 ${e?.name} 上新建 Agent`,
@@ -3839,6 +3854,7 @@ const ld = {
3839
3854
  "collab.runtime.hostSession": (e) => `宿主会话:${e?.id}`,
3840
3855
  "collab.runtime.sessions": (e) => `会话数:${e?.count}`,
3841
3856
  "collab.runtime.lastSeen": (e) => `最近心跳:${e?.time}`,
3857
+ "collab.runtime.replace": "替换主机",
3842
3858
  "collab.runtime.remove": "移除",
3843
3859
  "collab.runtime.removeConfirm": (e) => `确定移除“${e?.name}”吗?只绑定到它的 Agent 会切回这台电脑,正在执行的任务会停止。`
3844
3860
  };
@@ -4228,6 +4244,8 @@ const Xa = {
4228
4244
  "managed.retry": "Retry the same request",
4229
4245
  "managed.cancel": "Cancel turn",
4230
4246
  "managed.uncertain": "The request outcome is unconfirmed. Retry to check or complete the same submission.",
4247
+ "managed.discard": "Discard this request",
4248
+ "managed.discarded": "Request discarded. The draft is back in the composer.",
4231
4249
  "managed.newRequired": "Start a new task to send another message.",
4232
4250
  "managed.truncated": "[Details truncated]",
4233
4251
  "managed.approval.failed": "The approval answer could not be confirmed. Retry the same option or refresh to check its status.",
@@ -4236,6 +4254,8 @@ const Xa = {
4236
4254
  "managed.approval.retry": "Retry loading approvals",
4237
4255
  "managed.approval.forbidden": "Only the Session creator can answer this approval.",
4238
4256
  "managed.approval.argumentsUnavailable": "Tool arguments are unavailable for this approval.",
4257
+ "managed.approval.previewComplete": (e) => `Input preview: ${e?.bytes ?? 0} bytes.`,
4258
+ "managed.approval.previewTruncated": (e) => `Input preview truncated. Full input: ${e?.bytes ?? 0} bytes.`,
4239
4259
  "managed.result.range": (e) => `Bytes ${e?.start}–${e?.end} of ${e?.total}`,
4240
4260
  "managed.result.outputs": "Outputs",
4241
4261
  "managed.result.view": "View output",
@@ -7760,6 +7780,8 @@ const Xa = {
7760
7780
  "managed.retry": "重试同一请求",
7761
7781
  "managed.cancel": "取消本轮",
7762
7782
  "managed.uncertain": "请求结果尚未确认。重试会确认或完成同一次提交。",
7783
+ "managed.discard": "丢弃本次请求",
7784
+ "managed.discarded": "已丢弃本次请求。草稿已放回输入框。",
7763
7785
  "managed.newRequired": "请新建任务后发送消息。",
7764
7786
  "managed.truncated": "[详情已截断]",
7765
7787
  "managed.approval.failed": "无法确认审批回答的结果。请重试同一选项,或刷新以查看状态。",
@@ -7768,6 +7790,8 @@ const Xa = {
7768
7790
  "managed.approval.retry": "重新读取审批",
7769
7791
  "managed.approval.forbidden": "只有此会话的创建者可以回答这项审批。",
7770
7792
  "managed.approval.argumentsUnavailable": "此项审批的工具参数暂不可见。",
7793
+ "managed.approval.previewComplete": (e) => `输入预览:${e?.bytes ?? 0} 字节。`,
7794
+ "managed.approval.previewTruncated": (e) => `输入预览已截断,完整输入共 ${e?.bytes ?? 0} 字节。`,
7771
7795
  "managed.result.range": (e) => `字节 ${e?.start}–${e?.end},共 ${e?.total}`,
7772
7796
  "managed.result.outputs": "输出",
7773
7797
  "managed.result.view": "查看输出",
@@ -11648,8 +11672,8 @@ function kd({
11648
11672
  ];
11649
11673
  let h;
11650
11674
  for (const v of g) {
11651
- const R = await (v === "workspace" ? i.setMcpServerEnabled(n, a === "enable") : r.setUserMcpServerEnabled(n, a === "enable"));
11652
- R.changed !== void 0 && (h = (h ?? !1) || R.changed);
11675
+ const A = await (v === "workspace" ? i.setMcpServerEnabled(n, a === "enable") : r.setUserMcpServerEnabled(n, a === "enable"));
11676
+ A.changed !== void 0 && (h = (h ?? !1) || A.changed);
11653
11677
  }
11654
11678
  return {
11655
11679
  serverName: n,
@@ -12368,12 +12392,12 @@ function Hp({
12368
12392
  [s, e, t, n]
12369
12393
  ), i = Y(r);
12370
12394
  i.current = r;
12371
- const l = Y(void 0), m = Y(void 0), g = Y(0), h = Y(o), [v, R] = rt(void 0), [U, A] = rt(void 0), [O, P] = rt(!1), [q, H] = rt(
12395
+ const l = Y(void 0), m = Y(void 0), g = Y(0), h = Y(o), [v, A] = rt(void 0), [U, R] = rt(void 0), [O, P] = rt(!1), [q, H] = rt(
12372
12396
  s ? "connecting" : "idle"
12373
12397
  ), [J, x] = rt(void 0), [Z, te] = rt(
12374
12398
  r
12375
12399
  );
12376
- Z !== r && (te(r), A(void 0), P(!1));
12400
+ Z !== r && (te(r), R(void 0), P(!1));
12377
12401
  const M = de(() => {
12378
12402
  if (!r)
12379
12403
  return Promise.reject(new Error("Daemon workspace client unavailable"));
@@ -12389,29 +12413,29 @@ function Hp({
12389
12413
  return Promise.reject(new Error("Daemon workspace client unavailable"));
12390
12414
  l.current !== r && (l.current = r, g.current++);
12391
12415
  const se = ++g.current, Le = () => {
12392
- const Re = m.current;
12393
- return l.current === r && Re && g.current !== se ? Re : Promise.reject(
12416
+ const Ae = m.current;
12417
+ return l.current === r && Ae && g.current !== se ? Ae : Promise.reject(
12394
12418
  new Error("Capabilities refresh was superseded by a client change")
12395
12419
  );
12396
12420
  }, st = r.capabilities().then(
12397
- (Re) => l.current !== r || g.current !== se ? Le() : (R(Re), H("connected"), x(void 0), Re),
12398
- (Re) => {
12421
+ (Ae) => l.current !== r || g.current !== se ? Le() : (A(Ae), H("connected"), x(void 0), Ae),
12422
+ (Ae) => {
12399
12423
  if (l.current !== r || g.current !== se)
12400
12424
  return Le();
12401
- throw x(Re instanceof Error ? Re : new Error(String(Re))), H("error"), Re;
12425
+ throw x(Ae instanceof Error ? Ae : new Error(String(Ae))), H("error"), Ae;
12402
12426
  }
12403
12427
  );
12404
12428
  return m.current = st, st;
12405
12429
  }, [r]);
12406
12430
  ut(() => {
12407
12431
  if (!r) return;
12408
- H("connecting"), x(void 0), R(void 0), qn === r && (qn = void 0);
12432
+ H("connecting"), x(void 0), A(void 0), qn === r && (qn = void 0);
12409
12433
  let se = !1;
12410
12434
  const Le = M(), st = g.current;
12411
- return Le.then((Re) => {
12412
- !se && l.current === r && m.current === Le && (R(Re), H("connected"));
12413
- }).catch((Re) => {
12414
- !se && l.current === r && g.current === st && (x(Re instanceof Error ? Re : new Error(String(Re))), H("error"));
12435
+ return Le.then((Ae) => {
12436
+ !se && l.current === r && m.current === Le && (A(Ae), H("connected"));
12437
+ }).catch((Ae) => {
12438
+ !se && l.current === r && g.current === st && (x(Ae instanceof Error ? Ae : new Error(String(Ae))), H("error"));
12415
12439
  }), () => {
12416
12440
  se = !0, qn = r, queueMicrotask(() => {
12417
12441
  qn === r && (qn = void 0, r.dispose());
@@ -12423,11 +12447,11 @@ function Hp({
12423
12447
  ), B = de(
12424
12448
  (se, Le = !1) => {
12425
12449
  const st = ++V.current;
12426
- y.current = !0, A(void 0), P(!1), Promise.resolve().then(() => se.brand()).then((Re) => {
12427
- V.current === st && (A(Re), P(!0));
12428
- }).catch((Re) => {
12450
+ y.current = !0, R(void 0), P(!1), Promise.resolve().then(() => se.brand()).then((Ae) => {
12451
+ V.current === st && (R(Ae), P(!0));
12452
+ }).catch((Ae) => {
12429
12453
  if (V.current === st) {
12430
- if (Re instanceof fo && Re.status === 404) {
12454
+ if (Ae instanceof fo && Ae.status === 404) {
12431
12455
  P(!0);
12432
12456
  return;
12433
12457
  }
@@ -12544,7 +12568,7 @@ function xd(e) {
12544
12568
  (t) => t.kind === "permission" && t.resolved === void 0
12545
12569
  );
12546
12570
  }
12547
- function Ad(e) {
12571
+ function Rd(e) {
12548
12572
  return e.flatMap((t) => {
12549
12573
  if (t.kind !== "tool") return [];
12550
12574
  const o = Ed(t);
@@ -12564,11 +12588,11 @@ function Ad(e) {
12564
12588
  ];
12565
12589
  });
12566
12590
  }
12567
- function Rd(e) {
12568
- return Ad(e).at(-1);
12591
+ function Ad(e) {
12592
+ return Rd(e).at(-1);
12569
12593
  }
12570
12594
  function Pd(e) {
12571
- const t = Rd(e);
12595
+ const t = Ad(e);
12572
12596
  return t && $d(t.items) ? t : void 0;
12573
12597
  }
12574
12598
  function Ed(e) {
@@ -12750,7 +12774,7 @@ function ei(e) {
12750
12774
  return;
12751
12775
  const r = a, i = s.items, l = Array.isArray(i) && i.some(
12752
12776
  (v) => !!v && typeof v == "object" && Array.isArray(v.content) && v.content.some(
12753
- (R) => !!R && typeof R == "object" && (R.type === "image" || R.type === "resource" || R.type === "text" && typeof R.text == "string" && R.text.length > 0)
12777
+ (A) => !!A && typeof A == "object" && (A.type === "image" || A.type === "resource" || A.type === "text" && typeof A.text == "string" && A.text.length > 0)
12754
12778
  )
12755
12779
  );
12756
12780
  if (!r.some(Boolean) && !l) return;
@@ -12770,12 +12794,12 @@ function ei(e) {
12770
12794
  * SPDX-License-Identifier: Apache-2.0
12771
12795
  */
12772
12796
  const qa = /* @__PURE__ */ new Set(), ja = /* @__PURE__ */ new Set();
12773
- let tl = 0, An = [];
12797
+ let tl = 0, Rn = [];
12774
12798
  function Gp() {
12775
12799
  return tl;
12776
12800
  }
12777
12801
  function zp() {
12778
- return An;
12802
+ return Rn;
12779
12803
  }
12780
12804
  function Vp(e) {
12781
12805
  return qa.add(e), () => {
@@ -12806,12 +12830,12 @@ function ol() {
12806
12830
  }
12807
12831
  function Qp(e) {
12808
12832
  if (e.length === 0) return;
12809
- const t = new Set(e), o = An.filter((s) => !t.has(s));
12810
- o.length !== An.length && (An = o, ol());
12833
+ const t = new Set(e), o = Rn.filter((s) => !t.has(s));
12834
+ o.length !== Rn.length && (Rn = o, ol());
12811
12835
  }
12812
12836
  function ti(e) {
12813
12837
  const t = nl(e);
12814
- return t ? (An = [...An, t].slice(-200), ol(), (t.type === Pi || t.type === Ei || t.type === $i) && Bd(), !0) : !1;
12838
+ return t ? (Rn = [...Rn, t].slice(-200), ol(), (t.type === Pi || t.type === Ei || t.type === $i) && Bd(), !0) : !1;
12815
12839
  }
12816
12840
  function oi(e) {
12817
12841
  return nl(e) !== void 0;
@@ -12971,7 +12995,7 @@ function Yn(e) {
12971
12995
  ];
12972
12996
  });
12973
12997
  }
12974
- function Rn(e) {
12998
+ function An(e) {
12975
12999
  const t = ll(e.toolName);
12976
13000
  if (!t && e.kind !== "other")
12977
13001
  return;
@@ -13029,7 +13053,7 @@ function Kd(e) {
13029
13053
  }
13030
13054
  if (r.role === "tool_group")
13031
13055
  for (const i of r.tools) {
13032
- const l = Rn(i);
13056
+ const l = An(i);
13033
13057
  l && (t = l, o = ss(i), s = r.id, n = !1);
13034
13058
  }
13035
13059
  }
@@ -13046,7 +13070,7 @@ function nm(e) {
13046
13070
  if (o.role === "tool_group")
13047
13071
  for (const s of o.tools) {
13048
13072
  if (wo(s.rawOutput)?.sessionWorkflow !== !0) continue;
13049
- const a = Rn(s);
13073
+ const a = An(s);
13050
13074
  a && (t = {
13051
13075
  todos: a,
13052
13076
  planId: ss(s),
@@ -13063,14 +13087,14 @@ function sm(e, t) {
13063
13087
  for (const s of o.tools) {
13064
13088
  if (s.callId !== t.sourceCallId || ss(s) !== t.planId)
13065
13089
  continue;
13066
- return Rn(s) ?? [];
13090
+ return An(s) ?? [];
13067
13091
  }
13068
13092
  return [];
13069
13093
  }
13070
13094
  function am(e, t) {
13071
13095
  if (t.sourceMessageId === null) return [];
13072
13096
  const o = [], s = e.findIndex((a) => t.planId === null ? a.id === t.sourceMessageId : a.role !== "tool_group" ? !1 : a.tools.some(
13073
- (r) => Rn(r) !== void 0 && ss(r) === t.planId
13097
+ (r) => An(r) !== void 0 && ss(r) === t.planId
13074
13098
  ));
13075
13099
  if (s < 0) return [];
13076
13100
  let n = !1;
@@ -13085,7 +13109,7 @@ function am(e, t) {
13085
13109
  }
13086
13110
  if (r.role === "tool_group")
13087
13111
  for (const i of r.tools) {
13088
- const l = Rn(i);
13112
+ const l = An(i);
13089
13113
  if (l !== void 0) {
13090
13114
  if (a > s && (t.planId === null || ss(i) !== t.planId))
13091
13115
  return o;
@@ -13111,7 +13135,7 @@ function zs(e) {
13111
13135
  if (e.role === "tool_group") {
13112
13136
  const t = [];
13113
13137
  for (const o of e.tools) {
13114
- const s = Rn(o);
13138
+ const s = An(o);
13115
13139
  s && t.push({
13116
13140
  key: o.callId,
13117
13141
  todos: s,
@@ -13229,11 +13253,11 @@ function cm(e) {
13229
13253
  for (const i of e)
13230
13254
  for (const { todos: l, stats: m, timestamp: g } of zs(i))
13231
13255
  for (const h of l) {
13232
- const v = cl(h), R = o.get(v);
13233
- if (h.status === "in_progress" && R !== "in_progress")
13256
+ const v = cl(h), A = o.get(v);
13257
+ if (h.status === "in_progress" && A !== "in_progress")
13234
13258
  n.has(v) && (n.delete(v), s.delete(v), t.delete(v)), s.get(v) === void 0 && (s.set(v, m), g !== void 0 && (r(v).startTs = g));
13235
- else if (h.status === "completed" && R !== "completed" && R !== void 0) {
13236
- const U = s.get(v), A = U && m ? Xd(U, m) : void 0, O = t.get(v)?.startTs, P = O !== void 0 && g !== void 0 ? Jd(a, O, g) : void 0, q = Zd(A, P);
13259
+ else if (h.status === "completed" && A !== "completed" && A !== void 0) {
13260
+ const U = s.get(v), R = U && m ? Xd(U, m) : void 0, O = t.get(v)?.startTs, P = O !== void 0 && g !== void 0 ? Jd(a, O, g) : void 0, q = Zd(R, P);
13237
13261
  if (g !== void 0 || q) {
13238
13262
  const H = r(v);
13239
13263
  g !== void 0 && (H.endTs = g), q && (H.resources = q);
@@ -13329,18 +13353,18 @@ function su(e) {
13329
13353
  endTime: (g ? void 0 : t.get(O)?.endTime) ?? i.serverTimestamp ?? i.clientReceivedAt
13330
13354
  });
13331
13355
  }
13332
- const R = Hs(
13356
+ const A = Hs(
13333
13357
  i.backgroundTurn ?? l?.backgroundTurn
13334
13358
  );
13335
- if (!R || g || "parentToolCallId" in i && i.parentToolCallId || s.has(R.turnId))
13359
+ if (!A || g || "parentToolCallId" in i && i.parentToolCallId || s.has(A.turnId))
13336
13360
  continue;
13337
- n.set(R.taskId, r), a.add(R.taskId);
13338
- const U = o.get(R.taskId);
13339
- s.set(R.turnId, U);
13340
- const A = t.get(
13341
- R.toolUseId ?? bt(U, "toolUseId") ?? ""
13361
+ n.set(A.taskId, r), a.add(A.taskId);
13362
+ const U = o.get(A.taskId);
13363
+ s.set(A.turnId, U);
13364
+ const R = t.get(
13365
+ A.toolUseId ?? bt(U, "toolUseId") ?? ""
13342
13366
  );
13343
- A && (A.awaitingProcessing = !1);
13367
+ R && (R.awaitingProcessing = !1);
13344
13368
  }
13345
13369
  return {
13346
13370
  agentUpdates: t,
@@ -13492,7 +13516,7 @@ function um(e, t = {}) {
13492
13516
  lastConsumedTaskIndex: h,
13493
13517
  automaticTaskIds: v
13494
13518
  } = su(e);
13495
- let R = null, U = null, A = !1, O;
13519
+ let A = null, U = null, R = !1, O;
13496
13520
  const P = /* @__PURE__ */ new Set(), q = new Set(
13497
13521
  e.flatMap(
13498
13522
  (J) => J.kind === "tool" ? [J.toolCallId] : []
@@ -13504,7 +13528,7 @@ function um(e, t = {}) {
13504
13528
  ), M = Hs(
13505
13529
  x.backgroundTurn ?? te?.backgroundTurn
13506
13530
  ), ke = M?.turnId ?? x.promptId;
13507
- if (ke !== void 0 && O !== void 0 && ke !== O && (R = null, U = null, A = !0), ke !== void 0 && (O = ke), M && te?.source !== "background_task_completed" && !(x.kind === "status" && x.source === "background_task_completed") && !("parentToolCallId" in x && x.parentToolCallId) && !P.has(M.turnId) && (P.add(M.turnId), o.push({
13531
+ if (ke !== void 0 && O !== void 0 && ke !== O && (A = null, U = null, R = !0), ke !== void 0 && (O = ke), M && te?.source !== "background_task_completed" && !(x.kind === "status" && x.source === "background_task_completed") && !("parentToolCallId" in x && x.parentToolCallId) && !P.has(M.turnId) && (P.add(M.turnId), o.push({
13508
13532
  id: `background-turn:${M.turnId}`,
13509
13533
  role: "system",
13510
13534
  variant: "info",
@@ -13517,7 +13541,7 @@ function um(e, t = {}) {
13517
13541
  backgroundTurn: M,
13518
13542
  timestamp: M.startedAt,
13519
13543
  sourceBlockIds: [x.id]
13520
- }), R = null, U = null, A = !0), te?.source === "background_notification_turn_started" || x.kind === "status" && x.source === "background_notification_turn_started")
13544
+ }), A = null, U = null, R = !0), te?.source === "background_notification_turn_started" || x.kind === "status" && x.source === "background_notification_turn_started")
13521
13545
  continue;
13522
13546
  if (x.kind === "status" && x.source === "background_task_completed" || (x.kind === "assistant" || x.kind === "user") && te?.source === "background_task_completed") {
13523
13547
  const y = ze(
@@ -13539,7 +13563,7 @@ function um(e, t = {}) {
13539
13563
  },
13540
13564
  timestamp: Z,
13541
13565
  sourceBlockIds: [x.id]
13542
- }), R = null, U = null, A = !0;
13566
+ }), A = null, U = null, R = !0;
13543
13567
  continue;
13544
13568
  }
13545
13569
  const V = bt(
@@ -13551,7 +13575,7 @@ function um(e, t = {}) {
13551
13575
  case "user": {
13552
13576
  const y = x;
13553
13577
  if (ul(y)) {
13554
- R = null, U = null, A = !0, o.push({
13578
+ A = null, U = null, R = !0, o.push({
13555
13579
  id: x.id,
13556
13580
  role: "system",
13557
13581
  content: y.text,
@@ -13563,7 +13587,7 @@ function um(e, t = {}) {
13563
13587
  });
13564
13588
  break;
13565
13589
  }
13566
- R = null, U = null, A = !1;
13590
+ A = null, U = null, R = !1;
13567
13591
  const W = ze(
13568
13592
  y.meta
13569
13593
  ), B = bt(W, "source"), G = Array.isArray(W?.inputAnnotations) ? W.inputAnnotations : void 0, pe = y.images?.map((se) => ({
@@ -13587,7 +13611,7 @@ function um(e, t = {}) {
13587
13611
  timestamp: Z,
13588
13612
  ...pe && pe.length > 0 ? { images: pe } : {},
13589
13613
  ...oe && oe.length > 0 ? { files: oe } : {}
13590
- }), A = !0;
13614
+ }), R = !0;
13591
13615
  break;
13592
13616
  }
13593
13617
  const ne = {
@@ -13604,7 +13628,7 @@ function um(e, t = {}) {
13604
13628
  }
13605
13629
  case "assistant": {
13606
13630
  const y = x, W = ml(y);
13607
- if (W && (R = null, U = null, A = !0), W?.source === "background_notification") {
13631
+ if (W && (A = null, U = null, R = !0), W?.source === "background_notification") {
13608
13632
  o.push({
13609
13633
  id: x.id,
13610
13634
  role: "system",
@@ -13664,7 +13688,7 @@ function um(e, t = {}) {
13664
13688
  }
13665
13689
  const oe = G.length > 0 ? null : or(y.text);
13666
13690
  if (oe) {
13667
- let se = null, Le = !1, st = 0, Re = 0, Ht = 0, Eo = null;
13691
+ let se = null, Le = !1, st = 0, Ae = 0, Ht = 0, Eo = null;
13668
13692
  for (const it of oe)
13669
13693
  it.kind === "insight" ? it.data.type === "insight_progress" ? se = it.data : it.data.type === "insight_ready" ? (Le = !0, o.push({
13670
13694
  id: `${x.id}-ir-${st++}`,
@@ -13673,7 +13697,7 @@ function um(e, t = {}) {
13673
13697
  timestamp: Z,
13674
13698
  sourceBlockIds: [x.id]
13675
13699
  })) : it.data.type === "insight_error" && (Le = !0, o.push({
13676
- id: `${x.id}-ie-${Re++}`,
13700
+ id: `${x.id}-ie-${Ae++}`,
13677
13701
  role: "insight_error",
13678
13702
  error: it.data.error,
13679
13703
  timestamp: Z,
@@ -13684,7 +13708,7 @@ function um(e, t = {}) {
13684
13708
  content: it.text,
13685
13709
  timestamp: Z,
13686
13710
  sourceBlockIds: [x.id]
13687
- }), R = o.length - 1, Eo = R, U = null);
13711
+ }), A = o.length - 1, Eo = A, U = null);
13688
13712
  if (y.branchRecordId && Eo !== null) {
13689
13713
  const it = o[Eo];
13690
13714
  it?.role === "assistant" && (o[Eo] = {
@@ -13700,13 +13724,13 @@ function um(e, t = {}) {
13700
13724
  detail: se.detail,
13701
13725
  timestamp: Z,
13702
13726
  sourceBlockIds: [x.id]
13703
- }), A = !0;
13727
+ }), R = !0;
13704
13728
  break;
13705
13729
  }
13706
- const ne = R !== null ? o[R] : void 0;
13707
- if (ne && ne.role === "assistant" && !A && y.segmentId === void 0 && !ai(y)) {
13730
+ const ne = A !== null ? o[A] : void 0;
13731
+ if (ne && ne.role === "assistant" && !R && y.segmentId === void 0 && !ai(y)) {
13708
13732
  const se = ri(ne.usage, y.usage);
13709
- o[R] = {
13733
+ o[A] = {
13710
13734
  ...ne,
13711
13735
  content: ne.content + y.text,
13712
13736
  ...G.length ? {
@@ -13719,7 +13743,7 @@ function um(e, t = {}) {
13719
13743
  sourceBlockIds: Go(ne.sourceBlockIds, x.id),
13720
13744
  ...y.branchRecordId ? { branchRecordId: y.branchRecordId } : {},
13721
13745
  ...se ? { usage: se } : {}
13722
- }, A = !1, U = null;
13746
+ }, R = !1, U = null;
13723
13747
  } else if (!ai(y))
13724
13748
  o.push({
13725
13749
  id: x.id,
@@ -13731,10 +13755,10 @@ function um(e, t = {}) {
13731
13755
  sourceBlockIds: [x.id],
13732
13756
  ...y.branchRecordId ? { branchRecordId: y.branchRecordId } : {},
13733
13757
  ...y.usage ? { usage: y.usage } : {}
13734
- }), R = o.length - 1, U = null, A = !1;
13758
+ }), A = o.length - 1, U = null, R = !1;
13735
13759
  else if (y.usage && ne && ne.role === "assistant") {
13736
13760
  const se = ri(ne.usage, y.usage);
13737
- o[R] = {
13761
+ o[A] = {
13738
13762
  ...ne,
13739
13763
  ...y.branchRecordId ? { branchRecordId: y.branchRecordId } : {},
13740
13764
  ...se ? { usage: se } : {}
@@ -13749,19 +13773,19 @@ function um(e, t = {}) {
13749
13773
  break;
13750
13774
  }
13751
13775
  const B = U !== null ? o[U] : void 0;
13752
- B && B.role === "thinking" && !A && y.segmentId === void 0 ? (o[U] = {
13776
+ B && B.role === "thinking" && !R && y.segmentId === void 0 ? (o[U] = {
13753
13777
  ...B,
13754
13778
  content: B.content + y.text,
13755
13779
  isStreaming: y.streaming,
13756
13780
  sourceBlockIds: Go(B.sourceBlockIds, x.id)
13757
- }, A = !1) : (o.push({
13781
+ }, R = !1) : (o.push({
13758
13782
  id: x.id,
13759
13783
  role: "thinking",
13760
13784
  content: y.text,
13761
13785
  isStreaming: y.streaming,
13762
13786
  timestamp: Z,
13763
13787
  sourceBlockIds: [x.id]
13764
- }), U = o.length - 1, A = !1), R = null;
13788
+ }), U = o.length - 1, R = !1), A = null;
13765
13789
  break;
13766
13790
  }
13767
13791
  case "tool": {
@@ -13789,7 +13813,7 @@ function um(e, t = {}) {
13789
13813
  vu(pe, G), r.set(G.callId, G);
13790
13814
  break;
13791
13815
  }
13792
- Ca(o, x.id, G, Z), r.set(G.callId, G), R = null, U = null, A = !0;
13816
+ Ca(o, x.id, G, Z), r.set(G.callId, G), A = null, U = null, R = !0;
13793
13817
  break;
13794
13818
  }
13795
13819
  case "shell": {
@@ -13831,7 +13855,7 @@ function um(e, t = {}) {
13831
13855
  }
13832
13856
  ],
13833
13857
  timestamp: Z
13834
- }), A = !0;
13858
+ }), R = !0;
13835
13859
  break;
13836
13860
  }
13837
13861
  case "user_shell": {
@@ -13844,12 +13868,12 @@ function um(e, t = {}) {
13844
13868
  output: y.text,
13845
13869
  ...y.cwd ? { cwd: y.cwd } : {},
13846
13870
  timestamp: Z
13847
- }), A = !0;
13871
+ }), R = !0;
13848
13872
  break;
13849
13873
  }
13850
13874
  case "permission": {
13851
13875
  const y = x;
13852
- Au(
13876
+ Ru(
13853
13877
  y,
13854
13878
  l,
13855
13879
  n
@@ -13878,12 +13902,12 @@ function um(e, t = {}) {
13878
13902
  x.id,
13879
13903
  W,
13880
13904
  Z
13881
- ), r.set(W.callId, W), A = !0) : (W.status = n && ci(y.resolved) ? "completed" : "failed", W.endTime = y.updatedAt, Ca(
13905
+ ), r.set(W.callId, W), R = !0) : (W.status = n && ci(y.resolved) ? "completed" : "failed", W.endTime = y.updatedAt, Ca(
13882
13906
  o,
13883
13907
  x.id,
13884
13908
  W,
13885
13909
  Z
13886
- ), r.set(W.callId, W), A = !0);
13910
+ ), r.set(W.callId, W), R = !0);
13887
13911
  break;
13888
13912
  }
13889
13913
  break;
@@ -13908,7 +13932,7 @@ function um(e, t = {}) {
13908
13932
  ...y.data !== void 0 ? { data: y.data } : {},
13909
13933
  ...pe ? { images: pe } : {},
13910
13934
  ...oe ? { files: oe } : {}
13911
- }), A = !0;
13935
+ }), R = !0;
13912
13936
  break;
13913
13937
  }
13914
13938
  const W = y.source === "session_branched" ? pu(y.data) : null, B = W && t.labels?.branchSuccess ? t.labels.branchSuccess(W) : y.text;
@@ -13921,7 +13945,7 @@ function um(e, t = {}) {
13921
13945
  todos: G,
13922
13946
  timestamp: Z,
13923
13947
  sourceBlockIds: [x.id]
13924
- }), A = !0;
13948
+ }), R = !0;
13925
13949
  break;
13926
13950
  }
13927
13951
  o.push({
@@ -13933,7 +13957,7 @@ function um(e, t = {}) {
13933
13957
  sourceBlockIds: [x.id],
13934
13958
  ...y.source ? { source: y.source } : {},
13935
13959
  ...y.data !== void 0 ? { data: y.data } : {}
13936
- }), A = !0;
13960
+ }), R = !0;
13937
13961
  break;
13938
13962
  }
13939
13963
  case "error": {
@@ -13948,7 +13972,7 @@ function um(e, t = {}) {
13948
13972
  sourceBlockIds: [x.id],
13949
13973
  ...y.source ? { source: y.source } : {},
13950
13974
  ...uu(y.data, W)
13951
- }), A = !0;
13975
+ }), R = !0;
13952
13976
  break;
13953
13977
  }
13954
13978
  case "prompt_cancelled":
@@ -13961,7 +13985,7 @@ function um(e, t = {}) {
13961
13985
  ...x.elapsedMs !== void 0 ? { data: { elapsedMs: x.elapsedMs } } : {},
13962
13986
  timestamp: Z,
13963
13987
  sourceBlockIds: [x.id]
13964
- }), A = !0;
13988
+ }), R = !0;
13965
13989
  break;
13966
13990
  }
13967
13991
  }
@@ -14078,7 +14102,7 @@ function bt(e, t) {
14078
14102
  return typeof o == "string" && o.length > 0 ? o : void 0;
14079
14103
  }
14080
14104
  function Cu(e, t) {
14081
- const o = Pu(e, t), s = t ? e.background === !0 ? "background" : "foreground" : ze(o)?.executionMode, n = Ru(e, o), a = t ? void 0 : Eu(e), r = {
14105
+ const o = Pu(e, t), s = t ? e.background === !0 ? "background" : "foreground" : ze(o)?.executionMode, n = Au(e, o), a = t ? void 0 : Eu(e), r = {
14082
14106
  running: "in_progress",
14083
14107
  pending: "pending",
14084
14108
  confirming: "pending",
@@ -14131,7 +14155,7 @@ function xu(e, t) {
14131
14155
  sourceBlockIds: [e.id]
14132
14156
  };
14133
14157
  }
14134
- function Au(e, t, o) {
14158
+ function Ru(e, t, o) {
14135
14159
  const s = ze(e.toolCall), n = o ? e.toolCallId : bt(s, "toolCallId") ?? bt(s, "id");
14136
14160
  if (!n) return;
14137
14161
  const a = o ? e.title : bt(s, "title") ?? e.title, r = o ? tr(e.preview) : s ? gl(s) : void 0;
@@ -14153,7 +14177,7 @@ function di(e) {
14153
14177
  function gl(e) {
14154
14178
  return ze(e.rawInput) ?? ze(e.input) ?? ze(e.args);
14155
14179
  }
14156
- function Ru(e, t) {
14180
+ function Au(e, t) {
14157
14181
  const o = e.toolName?.toLowerCase();
14158
14182
  return o !== "agent" && o !== "task" ? !1 : e.background === !0 ? !0 : ze(t)?.status === "background";
14159
14183
  }
@@ -14453,15 +14477,15 @@ function Fu(e, t) {
14453
14477
  h && s.current?.remove(h, g);
14454
14478
  },
14455
14479
  observe(m, g, h = !1, v) {
14456
- const R = i.get(m);
14457
- R && n.current?.scope === R.scope && s.current?.observe(
14458
- R.scope,
14480
+ const A = i.get(m);
14481
+ A && n.current?.scope === A.scope && s.current?.observe(
14482
+ A.scope,
14459
14483
  m.sessionId,
14460
14484
  g,
14461
14485
  h,
14462
14486
  () => ({
14463
14487
  ...typeof v == "function" ? v() : v,
14464
- target: R.target
14488
+ target: A.target
14465
14489
  })
14466
14490
  );
14467
14491
  }
@@ -14550,7 +14574,7 @@ function gm(e) {
14550
14574
  if (!g || g.references === 0) return;
14551
14575
  const h = i.data;
14552
14576
  if (!h || typeof h != "object") return;
14553
- const v = h, R = v.promptId, U = i.sessionId;
14577
+ const v = h, A = v.promptId, U = i.sessionId;
14554
14578
  if (v.sessionId !== r || U !== void 0 && U !== r)
14555
14579
  return;
14556
14580
  if (i.type === "mid_turn_message_injected" && Array.isArray(v.messageIds)) {
@@ -14558,30 +14582,30 @@ function gm(e) {
14558
14582
  typeof O == "string" && g.pending.has(O) && n(a, O);
14559
14583
  return;
14560
14584
  }
14561
- if (typeof R != "string" || !R.trim() || i.promptId !== void 0 && i.promptId !== R)
14585
+ if (typeof A != "string" || !A.trim() || i.promptId !== void 0 && i.promptId !== A)
14562
14586
  return;
14563
14587
  if (!l && (i.type === "pending_prompt_added" || i.type === "pending_prompt_started")) {
14564
- !o.has(s(a, R)) && !g.pending.has(R) && g.pending.set(
14565
- R,
14588
+ !o.has(s(a, A)) && !g.pending.has(A) && g.pending.set(
14589
+ A,
14566
14590
  typeof v.text == "string" ? za(v.text).trim() : void 0
14567
14591
  ), g.pending.size > xa && g.pending.delete(g.pending.keys().next().value);
14568
14592
  return;
14569
14593
  }
14570
14594
  if (i.type === "pending_prompt_completed" && v.state === "removed") {
14571
- (!l || g.pending.has(R)) && n(a, R);
14595
+ (!l || g.pending.has(A)) && n(a, A);
14572
14596
  return;
14573
14597
  }
14574
- if (i.type !== "turn_complete" && i.type !== "turn_error" || l && !g.pending.has(R) || i.type === "turn_complete" && typeof v.stopReason != "string")
14598
+ if (i.type !== "turn_complete" && i.type !== "turn_error" || l && !g.pending.has(A) || i.type === "turn_complete" && typeof v.stopReason != "string")
14575
14599
  return;
14576
- const A = g.pending.get(R);
14577
- if (n(a, R))
14600
+ const R = g.pending.get(A);
14601
+ if (n(a, A))
14578
14602
  try {
14579
- const O = typeof m == "function" ? m() : m, P = O?.promptText || A, q = O?.sessionTitle || (P ? er(P)[0] : void 0);
14603
+ const O = typeof m == "function" ? m() : m, P = O?.promptText || R, q = O?.sessionTitle || (P ? er(P)[0] : void 0);
14580
14604
  e({
14581
14605
  ...O,
14582
14606
  ...q ? { sessionTitle: q } : {},
14583
14607
  ...P ? { promptText: P } : {},
14584
- key: s(a, R),
14608
+ key: s(a, A),
14585
14609
  outcome: i.type === "turn_error" ? "failed" : v.stopReason === "cancelled" ? "cancelled" : v.stopReason === "end_turn" ? "completed" : "ended"
14586
14610
  });
14587
14611
  } catch {
@@ -14702,7 +14726,7 @@ class Hu {
14702
14726
  o,
14703
14727
  s.events,
14704
14728
  this.liveRecordIds
14705
- ), r = Aa(
14729
+ ), r = Ra(
14706
14730
  a.page.blocks,
14707
14731
  this.liveRecordIds
14708
14732
  );
@@ -14728,8 +14752,8 @@ class Hu {
14728
14752
  pageIds: Object.freeze([l.id]),
14729
14753
  older: this.nextBoundary("older", o, l, s),
14730
14754
  newer: { kind: "live" }
14731
- }), h = this.snapshot, v = new Map(this.cachedBoundaryRequests), R = new Map(this.rangeAccess), U = new Map(h.pages);
14732
- let A = [...h.ranges];
14755
+ }), h = this.snapshot, v = new Map(this.cachedBoundaryRequests), A = new Map(this.rangeAccess), U = new Map(h.pages);
14756
+ let R = [...h.ranges];
14733
14757
  try {
14734
14758
  for (const O of h.ranges)
14735
14759
  if (!("anchorTurnId" in O) && O.pageIds.some(
@@ -14741,8 +14765,8 @@ class Hu {
14741
14765
  (P) => [...this.viewportPins.values()].includes(P)
14742
14766
  ))
14743
14767
  throw new jo();
14744
- A = this.restoreCachedBoundaries(
14745
- A.filter((P) => P.id !== O.id),
14768
+ R = this.restoreCachedBoundaries(
14769
+ R.filter((P) => P.id !== O.id),
14746
14770
  O.id
14747
14771
  );
14748
14772
  for (const P of O.pageIds) U.delete(P);
@@ -14754,7 +14778,7 @@ class Hu {
14754
14778
  }
14755
14779
  return U.set(l.id, l), this.snapshot = {
14756
14780
  pages: U,
14757
- ranges: Object.freeze([...A, g]),
14781
+ ranges: Object.freeze([...R, g]),
14758
14782
  retainedBytes: 0
14759
14783
  }, this.evict(m, l.id), { rangeId: m, pageId: l.id, blockId: r.at(-1).id };
14760
14784
  } catch (O) {
@@ -14762,7 +14786,7 @@ class Hu {
14762
14786
  for (const [P, q] of v)
14763
14787
  this.cachedBoundaryRequests.set(P, q);
14764
14788
  this.rangeAccess.clear();
14765
- for (const [P, q] of R)
14789
+ for (const [P, q] of A)
14766
14790
  this.rangeAccess.set(P, q);
14767
14791
  throw O;
14768
14792
  }
@@ -14779,10 +14803,10 @@ class Hu {
14779
14803
  );
14780
14804
  } catch (h) {
14781
14805
  this.snapshot = r, this.cachedBoundaryRequests.clear();
14782
- for (const [v, R] of i)
14783
- this.cachedBoundaryRequests.set(v, R);
14806
+ for (const [v, A] of i)
14807
+ this.cachedBoundaryRequests.set(v, A);
14784
14808
  this.rangeAccess.clear();
14785
- for (const [v, R] of l) this.rangeAccess.set(v, R);
14809
+ for (const [v, A] of l) this.rangeAccess.set(v, A);
14786
14810
  throw this.selectedRangeId = m, this.selectedPageId = g, h;
14787
14811
  }
14788
14812
  }
@@ -14800,17 +14824,17 @@ class Hu {
14800
14824
  i
14801
14825
  ), m = [...l.encounteredRecordIds].some(
14802
14826
  (x) => this.liveRecordIds.has(x)
14803
- ), g = Aa(
14827
+ ), g = Ra(
14804
14828
  l.page.blocks,
14805
14829
  i
14806
14830
  ), h = g.length === l.page.blocks.length ? l.page : this.pageFromBlocks(l.page.id, s, g), v = this.fitPageWithinBudget(
14807
14831
  this.withNewerRequest(h, hi(n))
14808
- ), R = v.turnBlockById.get(o) ?? (a ? v.blocks.find(
14832
+ ), A = v.turnBlockById.get(o) ?? (a ? v.blocks.find(
14809
14833
  (x) => x.sourceRecordIds?.includes(a)
14810
14834
  )?.id : void 0);
14811
- if (!R)
14835
+ if (!A)
14812
14836
  throw new Error("Anchored transcript target could not be materialized");
14813
- const U = `history-range-${this.nextRangeId++}`, A = n.hasOlder && v.firstRecordId ? {
14837
+ const U = `history-range-${this.nextRangeId++}`, R = n.hasOlder && v.firstRecordId ? {
14814
14838
  kind: "loadable",
14815
14839
  request: {
14816
14840
  kind: "older",
@@ -14825,7 +14849,7 @@ class Hu {
14825
14849
  anchorOrdinal: t,
14826
14850
  anchorTurnId: o,
14827
14851
  pageIds: Object.freeze([v.id]),
14828
- older: A,
14852
+ older: R,
14829
14853
  newer: O
14830
14854
  });
14831
14855
  if (this.measureRetainedBytes(/* @__PURE__ */ new Map([[v.id, v]]), [P]) > this.options.maxRetainedBytes)
@@ -14859,7 +14883,7 @@ class Hu {
14859
14883
  pages: q,
14860
14884
  ranges: J,
14861
14885
  retainedBytes: this.measureRetainedBytes(q, J)
14862
- }), this.select(U, v.id), this.evict(U, v.id), { rangeId: U, pageId: v.id, blockId: R };
14886
+ }), this.select(U, v.id), this.evict(U, v.id), { rangeId: U, pageId: v.id, blockId: A };
14863
14887
  }
14864
14888
  beginBoundaryLoad(t, o) {
14865
14889
  const s = this.snapshot.ranges.find((r) => r.id === t), n = s?.[o];
@@ -14894,12 +14918,12 @@ class Hu {
14894
14918
  for (const g of n.pageIds) {
14895
14919
  const h = i.get(g);
14896
14920
  if (!h.lastRecordId) continue;
14897
- const { newerRequest: v, ...R } = h;
14921
+ const { newerRequest: v, ...A } = h;
14898
14922
  i.set(
14899
14923
  g,
14900
14924
  this.withNewerRequest(
14901
14925
  {
14902
- ...R,
14926
+ ...A,
14903
14927
  retainedBytes: h.retainedBytes - Is(v)
14904
14928
  },
14905
14929
  {
@@ -14968,13 +14992,13 @@ class Hu {
14968
14992
  m.encounteredRecordIds,
14969
14993
  t,
14970
14994
  o
14971
- ), R = Aa(g.blocks, l), U = R.length === g.blocks.length ? g : this.pageFromBlocks(g.id, s, R), A = ("beforeRecordId" in r || i.kind === "gap" && i.beforeAnchor === !0) && a?.fromAnchor === !0, O = (o === "older" || a && !a.fromAnchor) && U.lastRecordId ? {
14995
+ ), A = Ra(g.blocks, l), U = A.length === g.blocks.length ? g : this.pageFromBlocks(g.id, s, A), R = ("beforeRecordId" in r || i.kind === "gap" && i.beforeAnchor === !0) && a?.fromAnchor === !0, O = (o === "older" || a && !a.fromAnchor) && U.lastRecordId ? {
14972
14996
  kind: "gap",
14973
14997
  ...i.kind === "gap" && i.beforeAnchor ? { beforeAnchor: !0 } : {},
14974
14998
  anchorRecordId: i.kind === "gap" ? i.anchorRecordId : "anchorTurnId" in r ? r.anchorTurnId : r.beforeRecordId,
14975
14999
  afterRecordId: U.lastRecordId,
14976
15000
  snapshot: "beforeRecordId" in r ? r.snapshot : s
14977
- } : A ? void 0 : hi(n), P = this.withNewerRequest(U, O);
15001
+ } : R ? void 0 : hi(n), P = this.withNewerRequest(U, O);
14978
15002
  if (P.blocks.length === 0) {
14979
15003
  if (a && !a.fromAnchor && !h && !v)
14980
15004
  throw new Error("Gap recovery did not materialize newer records");
@@ -14982,7 +15006,7 @@ class Hu {
14982
15006
  r,
14983
15007
  o,
14984
15008
  n,
14985
- h || A,
15009
+ h || R,
14986
15010
  v
14987
15011
  );
14988
15012
  const V = "beforeRecordId" in r ? t : this.selectedRangeId ?? t, y = this.snapshot.ranges.find(
@@ -14997,7 +15021,7 @@ class Hu {
14997
15021
  }
14998
15022
  const q = this.fitPageWithinBudget(P), H = new Map(this.snapshot.pages);
14999
15023
  H.set(q.id, q);
15000
- const J = o === "older" ? [q.id, ...r.pageIds] : [...r.pageIds, q.id], x = h || A ? { kind: "live" } : v ? this.cachedBoundary(
15024
+ const J = o === "older" ? [q.id, ...r.pageIds] : [...r.pageIds, q.id], x = h || R ? { kind: "live" } : v ? this.cachedBoundary(
15001
15025
  t,
15002
15026
  o,
15003
15027
  v,
@@ -15154,10 +15178,10 @@ class Hu {
15154
15178
  const g = n.indexOf(m);
15155
15179
  if (g < 0) continue;
15156
15180
  const h = /* @__PURE__ */ new Set();
15157
- for (const R of r.pageIds)
15158
- for (const U of this.snapshot.pages.get(R)?.recordIds ?? [])
15181
+ for (const A of r.pageIds)
15182
+ for (const U of this.snapshot.pages.get(A)?.recordIds ?? [])
15159
15183
  h.add(U);
15160
- if ((s === "older" ? n.slice(0, g + 1) : n.slice(g)).every((R) => h.has(R)))
15184
+ if ((s === "older" ? n.slice(0, g + 1) : n.slice(g)).every((A) => h.has(A)))
15161
15185
  return r.id;
15162
15186
  }
15163
15187
  }
@@ -15191,16 +15215,16 @@ class Hu {
15191
15215
  const r = () => n.size > this.options.maxPages || this.measureRetainedBytes(n, a) > this.options.maxRetainedBytes;
15192
15216
  for (; r(); ) {
15193
15217
  const i = a.filter(
15194
- (A) => A.id !== t && A.id !== this.selectedRangeId && !A.pageIds.some(
15218
+ (R) => R.id !== t && R.id !== this.selectedRangeId && !R.pageIds.some(
15195
15219
  (O) => [...this.viewportPins.values()].includes(O)
15196
15220
  )
15197
15221
  ).sort(
15198
- (A, O) => (this.rangeAccess.get(A.id) ?? 0) - (this.rangeAccess.get(O.id) ?? 0)
15222
+ (R, O) => (this.rangeAccess.get(R.id) ?? 0) - (this.rangeAccess.get(O.id) ?? 0)
15199
15223
  )[0];
15200
15224
  if (i) {
15201
- a = a.filter((A) => A.id !== i.id), a = this.restoreCachedBoundaries(a, i.id);
15202
- for (const A of i.pageIds)
15203
- n.delete(A);
15225
+ a = a.filter((R) => R.id !== i.id), a = this.restoreCachedBoundaries(a, i.id);
15226
+ for (const R of i.pageIds)
15227
+ n.delete(R);
15204
15228
  this.cachedBoundaryRequests.delete(
15205
15229
  this.boundaryKey(i.id, "older")
15206
15230
  ), this.cachedBoundaryRequests.delete(
@@ -15208,19 +15232,19 @@ class Hu {
15208
15232
  ), this.rangeAccess.delete(i.id);
15209
15233
  continue;
15210
15234
  }
15211
- const l = a.find((A) => A.id === t);
15235
+ const l = a.find((R) => R.id === t);
15212
15236
  if (!l || l.pageIds.length <= 1) {
15213
15237
  if (l && s)
15214
15238
  throw this.cachedBoundaryRequests.delete(
15215
15239
  this.boundaryKey(l.id, s.direction)
15216
15240
  ), a = a.map(
15217
- (A) => A.id === l.id ? Object.freeze({
15218
- ...A,
15241
+ (R) => R.id === l.id ? Object.freeze({
15242
+ ...R,
15219
15243
  [s.direction]: {
15220
15244
  kind: "loading",
15221
15245
  request: s.request
15222
15246
  }
15223
- }) : A
15247
+ }) : R
15224
15248
  ), this.snapshot = Object.freeze({
15225
15249
  pages: n,
15226
15250
  ranges: Object.freeze(a),
@@ -15230,12 +15254,12 @@ class Hu {
15230
15254
  break;
15231
15255
  }
15232
15256
  const g = (s?.direction === "older" ? [l.pageIds.at(-1), l.pageIds[0]] : [l.pageIds[0], l.pageIds.at(-1)]).find(
15233
- (A) => A !== o && A !== this.selectedPageId && A !== s?.pageId && ![...this.viewportPins.values()].includes(A)
15257
+ (R) => R !== o && R !== this.selectedPageId && R !== s?.pageId && ![...this.viewportPins.values()].includes(R)
15234
15258
  );
15235
15259
  if (!g) throw new jo();
15236
15260
  const h = g === l.pageIds[0];
15237
15261
  n.delete(g);
15238
- const v = l.pageIds.filter((A) => A !== g), R = v[0] ? n.get(v[0]) : void 0, U = n.get(v.at(-1));
15262
+ const v = l.pageIds.filter((R) => R !== g), A = v[0] ? n.get(v[0]) : void 0, U = n.get(v.at(-1));
15239
15263
  if (!h && !U?.newerRequest)
15240
15264
  throw new jo();
15241
15265
  h ? this.cachedBoundaryRequests.delete(
@@ -15243,16 +15267,16 @@ class Hu {
15243
15267
  ) : this.cachedBoundaryRequests.delete(
15244
15268
  this.boundaryKey(l.id, "newer")
15245
15269
  ), a = this.restoreCachedBoundaries(a, l.id), a = a.map(
15246
- (A) => A.id === l.id ? Object.freeze({
15247
- ...A,
15270
+ (R) => R.id === l.id ? Object.freeze({
15271
+ ...R,
15248
15272
  pageIds: Object.freeze(v),
15249
- ...h && R?.firstRecordId ? {
15273
+ ...h && A?.firstRecordId ? {
15250
15274
  older: {
15251
15275
  kind: "loadable",
15252
15276
  request: {
15253
15277
  kind: "older",
15254
- beforeRecordId: R.firstRecordId,
15255
- snapshot: R.snapshot
15278
+ beforeRecordId: A.firstRecordId,
15279
+ snapshot: A.snapshot
15256
15280
  }
15257
15281
  }
15258
15282
  } : h && s?.direction === "older" ? {
@@ -15263,7 +15287,7 @@ class Hu {
15263
15287
  } : h ? {} : {
15264
15288
  newer: fi(U?.newerRequest)
15265
15289
  }
15266
- }) : A
15290
+ }) : R
15267
15291
  );
15268
15292
  }
15269
15293
  this.snapshot = Object.freeze({
@@ -15305,7 +15329,7 @@ class Hu {
15305
15329
  return { kind: "loadable", request: r };
15306
15330
  }
15307
15331
  }
15308
- function Aa(e, t) {
15332
+ function Ra(e, t) {
15309
15333
  return e.filter(
15310
15334
  (o) => !o.sourceRecordIds?.some((s) => t.has(s))
15311
15335
  );
@@ -15360,7 +15384,7 @@ const Us = /* @__PURE__ */ new Map(), ki = Object.freeze({
15360
15384
  });
15361
15385
  function zu(e = {}) {
15362
15386
  const t = e.indexPageSize ?? mi, o = e.maxIndexPages ?? Nu, s = e.maxIndexBytes ?? Bu, n = /* @__PURE__ */ new Set();
15363
- let a = ki, r, i, l, m = !1, g = 0, h = 0, v = 0, R = 0, U = /* @__PURE__ */ new Map(), A = [];
15387
+ let a = ki, r, i, l, m = !1, g = 0, h = 0, v = 0, A = 0, U = /* @__PURE__ */ new Map(), R = [];
15364
15388
  const O = /* @__PURE__ */ new Set();
15365
15389
  let P = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Set(), J = /* @__PURE__ */ new Map(), x;
15366
15390
  const Z = /* @__PURE__ */ new Map();
@@ -15431,8 +15455,8 @@ function zu(e = {}) {
15431
15455
  Vu(ae)
15432
15456
  ])
15433
15457
  ),
15434
- provisionalTurns: Object.freeze([...A]),
15435
- effectiveTurnCount: (u.totalTurns ?? a.totalTurns) + A.length,
15458
+ provisionalTurns: Object.freeze([...R]),
15459
+ effectiveTurnCount: (u.totalTurns ?? a.totalTurns) + R.length,
15436
15460
  historicalPages: F,
15437
15461
  historicalRanges: Object.freeze(k),
15438
15462
  locations: N
@@ -15446,13 +15470,13 @@ function zu(e = {}) {
15446
15470
  for (const j of n) j();
15447
15471
  }
15448
15472
  function se(u) {
15449
- r = u, g += 1, h += 1, v += 1, i = void 0, l = void 0, m = !1, U = /* @__PURE__ */ new Map(), A = [], O.clear(), P = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Set(), x = void 0, te = void 0, V = !1, y = !1, W = !1, B = pe(), a = Object.freeze({
15473
+ r = u, g += 1, h += 1, v += 1, i = void 0, l = void 0, m = !1, U = /* @__PURE__ */ new Map(), R = [], O.clear(), P = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), H = /* @__PURE__ */ new Set(), x = void 0, te = void 0, V = !1, y = !1, W = !1, B = pe(), a = Object.freeze({
15450
15474
  ...ki,
15451
15475
  sessionId: u
15452
15476
  });
15453
15477
  }
15454
15478
  function Le() {
15455
- h += 1, v += 1, U = /* @__PURE__ */ new Map(), A = [], O.clear(), q = /* @__PURE__ */ new Map(), y = !1, B.reset(), Xt(), a = Object.freeze({
15479
+ h += 1, v += 1, U = /* @__PURE__ */ new Map(), R = [], O.clear(), q = /* @__PURE__ */ new Map(), y = !1, B.reset(), Xt(), a = Object.freeze({
15456
15480
  ...a,
15457
15481
  totalTurns: 0,
15458
15482
  effectiveTurnCount: 0,
@@ -15467,7 +15491,7 @@ function zu(e = {}) {
15467
15491
  function st(u) {
15468
15492
  const f = u.sessionId !== r;
15469
15493
  if (f && se(u.sessionId), !u.sessionId || !u.supported) {
15470
- !f && (i !== void 0 || a.mode !== "legacy" || a.fallbackReason !== "unsupported") && (g += 1, h += 1, v += 1, te = void 0, V = !1), i = void 0, l = void 0, m = !1, A = [], O.clear(), q = /* @__PURE__ */ new Map(), (a.mode !== "legacy" || a.fallbackReason !== "unsupported" || f) && (U = /* @__PURE__ */ new Map(), B.reset(), B.setLiveRecordIds(H), ne({
15494
+ !f && (i !== void 0 || a.mode !== "legacy" || a.fallbackReason !== "unsupported") && (g += 1, h += 1, v += 1, te = void 0, V = !1), i = void 0, l = void 0, m = !1, R = [], O.clear(), q = /* @__PURE__ */ new Map(), (a.mode !== "legacy" || a.fallbackReason !== "unsupported" || f) && (U = /* @__PURE__ */ new Map(), B.reset(), B.setLiveRecordIds(H), ne({
15471
15495
  mode: "legacy",
15472
15496
  fallbackReason: "unsupported",
15473
15497
  totalTurns: 0,
@@ -15505,7 +15529,7 @@ function zu(e = {}) {
15505
15529
  const k = b || !m;
15506
15530
  i = u.client, l = u.client.owner, m = !0, k && ne(), !(!k || a.fallbackReason === "too_large") && (U.size === 0 && ne({ mode: "loading", fallbackReason: void 0 }), Ye());
15507
15531
  }
15508
- function Re(u) {
15532
+ function Ae(u) {
15509
15533
  if (u === x) return;
15510
15534
  x = u;
15511
15535
  const f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Set(), k = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set();
@@ -15533,7 +15557,7 @@ function zu(e = {}) {
15533
15557
  view: "live"
15534
15558
  });
15535
15559
  }
15536
- const F = A.map((D) => {
15560
+ const F = R.map((D) => {
15537
15561
  const Q = k.get(D.promptId), X = b.has(D.blockId ?? "") ? D.blockId : Q;
15538
15562
  if (X === D.blockId) return D;
15539
15563
  const { blockId: N, ...j } = D;
@@ -15543,12 +15567,12 @@ function zu(e = {}) {
15543
15567
  });
15544
15568
  });
15545
15569
  if (!F.some(
15546
- (D, Q) => D !== A[Q]
15570
+ (D, Q) => D !== R[Q]
15547
15571
  ) && bi(P, f) && bi(q, C)) {
15548
15572
  Xt();
15549
15573
  return;
15550
15574
  }
15551
- P = f, q = C, A = F, vt(), Xt(), ne();
15575
+ P = f, q = C, R = F, vt(), Xt(), ne();
15552
15576
  }
15553
15577
  function Ht(u) {
15554
15578
  if (O.has(u.promptId)) return;
@@ -15563,15 +15587,15 @@ function zu(e = {}) {
15563
15587
  }), Xt(), ne());
15564
15588
  return;
15565
15589
  }
15566
- if (!(a.mode === "legacy" || A.some((w) => w.promptId === u.promptId) || b.some(
15590
+ if (!(a.mode === "legacy" || R.some((w) => w.promptId === u.promptId) || b.some(
15567
15591
  (w) => f !== void 0 && T(w.turnId)?.blockId === f
15568
15592
  ))) {
15569
- if (A.length >= t) {
15593
+ if (R.length >= t) {
15570
15594
  c();
15571
15595
  return;
15572
15596
  }
15573
- A = [
15574
- ...A,
15597
+ R = [
15598
+ ...R,
15575
15599
  Object.freeze({
15576
15600
  provisionalId: `live:${u.promptId}`,
15577
15601
  promptId: u.promptId,
@@ -15585,8 +15609,8 @@ function zu(e = {}) {
15585
15609
  if (a.mode === "legacy") return;
15586
15610
  for (O.add(u); O.size > mi; )
15587
15611
  O.delete(O.values().next().value);
15588
- const f = A.filter((b) => b.promptId !== u);
15589
- f.length !== A.length && (A = f, ne());
15612
+ const f = R.filter((b) => b.promptId !== u);
15613
+ f.length !== R.length && (R = f, ne());
15590
15614
  }
15591
15615
  function it(u) {
15592
15616
  if (u === "session_rewound" || u === "session.rewound") {
@@ -15651,7 +15675,7 @@ function zu(e = {}) {
15651
15675
  } catch (D) {
15652
15676
  if (w !== g || C !== h || !oe(k))
15653
15677
  return;
15654
- throw As(D) || D instanceof Jn ? c() : f === v && (ne({
15678
+ throw Rs(D) || D instanceof Jn ? c() : f === v && (ne({
15655
15679
  error: xs(
15656
15680
  "index",
15657
15681
  D,
@@ -15707,7 +15731,7 @@ function zu(e = {}) {
15707
15731
  limit: t,
15708
15732
  ...ce === void 0 ? {} : { snapshot: ce, start: to }
15709
15733
  });
15710
- return re(), Ra(Ve, C, ce, t), Ve;
15734
+ return re(), Aa(Ve, C, ce, t), Ve;
15711
15735
  };
15712
15736
  let $e = await he();
15713
15737
  const io = $e.snapshot;
@@ -15753,7 +15777,7 @@ function zu(e = {}) {
15753
15777
  an = F.delete(Be) || an;
15754
15778
  let Oo;
15755
15779
  if (!Do && !an && Ve.kind === "user" && zt) {
15756
- const Nt = q.get(zt.turnId)?.blockId ?? A.find((be) => be.promptId === zt.promptId)?.blockId, Be = Nt ? D.get(Nt) : void 0;
15780
+ const Nt = q.get(zt.turnId)?.blockId ?? R.find((be) => be.promptId === zt.promptId)?.blockId, Be = Nt ? D.get(Nt) : void 0;
15757
15781
  Be?.kind === "user" && F.has(Be) && (Oo = Be);
15758
15782
  }
15759
15783
  if (!an && !Oo && !Ut) {
@@ -16036,7 +16060,7 @@ function zu(e = {}) {
16036
16060
  ...a.error?.operation === "locate" ? { error: void 0 } : {}
16037
16061
  }), ae;
16038
16062
  } catch (C) {
16039
- throw w === v && f?.isCurrent() === !1 && ne({ selected: void 0 }), w === v && f?.isCurrent() !== !1 && (As(C) ? c() : (ne({
16063
+ throw w === v && f?.isCurrent() === !1 && ne({ selected: void 0 }), w === v && f?.isCurrent() !== !1 && (Rs(C) ? c() : (ne({
16040
16064
  selected: { ordinal: u, status: "unavailable" },
16041
16065
  error: xs("locate", C)
16042
16066
  }), (jt(C) === 409 || vl(C) === "invalid_turn_anchor") && Ye())), C;
@@ -16136,7 +16160,7 @@ function zu(e = {}) {
16136
16160
  if (!N || N[f].kind !== "loading") return;
16137
16161
  if (b && X instanceof jo)
16138
16162
  throw B.cancelBoundaryLoad(u, f, C), ne(F()), X;
16139
- if (As(X))
16163
+ if (Rs(X))
16140
16164
  c();
16141
16165
  else {
16142
16166
  const j = Ns(X);
@@ -16249,7 +16273,7 @@ function zu(e = {}) {
16249
16273
  }
16250
16274
  }
16251
16275
  function Jt(u) {
16252
- if (Ra(u, r, void 0, t), u.start + u.turns.length !== u.totalTurns)
16276
+ if (Aa(u, r, void 0, t), u.start + u.turns.length !== u.totalTurns)
16253
16277
  throw new Error("Turn-index head did not contain the newest page");
16254
16278
  const f = ht(u), b = In(U), k = new Map(
16255
16279
  [...b].map(([_, D]) => [D.turnId, _])
@@ -16272,7 +16296,7 @@ function zu(e = {}) {
16272
16296
  });
16273
16297
  }
16274
16298
  function me(u, f, b, k, w) {
16275
- Ra(u, r, f, t);
16299
+ Aa(u, r, f, t);
16276
16300
  const C = In(U), F = new Map(
16277
16301
  [...C].map(([D, Q]) => [Q.turnId, D])
16278
16302
  );
@@ -16292,7 +16316,7 @@ function zu(e = {}) {
16292
16316
  u.turns.map((b) => Object.freeze({ ...b }))
16293
16317
  ),
16294
16318
  retainedBytes: Ku(u),
16295
- accessedAt: ++R
16319
+ accessedAt: ++A
16296
16320
  };
16297
16321
  if (o < 1 || f.retainedBytes > s)
16298
16322
  throw new Jn();
@@ -16308,7 +16332,7 @@ function zu(e = {}) {
16308
16332
  view: "live"
16309
16333
  });
16310
16334
  }
16311
- A = A.filter((b) => {
16335
+ R = R.filter((b) => {
16312
16336
  const k = f.find(
16313
16337
  (w) => w.promptId === b.promptId
16314
16338
  );
@@ -16341,7 +16365,7 @@ function zu(e = {}) {
16341
16365
  throw new Jn();
16342
16366
  }
16343
16367
  function Zt(u) {
16344
- if (As(u) || u instanceof Jn) {
16368
+ if (Rs(u) || u instanceof Jn) {
16345
16369
  c();
16346
16370
  return;
16347
16371
  }
@@ -16352,7 +16376,7 @@ function zu(e = {}) {
16352
16376
  });
16353
16377
  }
16354
16378
  function c() {
16355
- W = !0, y = !1, h += 1, v += 1, U = /* @__PURE__ */ new Map(), A = [], O.clear(), q = /* @__PURE__ */ new Map(), B.reset(), ne({
16379
+ W = !0, y = !1, h += 1, v += 1, U = /* @__PURE__ */ new Map(), R = [], O.clear(), q = /* @__PURE__ */ new Map(), B.reset(), ne({
16356
16380
  mode: "legacy",
16357
16381
  fallbackReason: "too_large",
16358
16382
  totalTurns: 0,
@@ -16367,7 +16391,7 @@ function zu(e = {}) {
16367
16391
  for (const f of U.values()) {
16368
16392
  const b = f.turns.find((k) => k.ordinal === u);
16369
16393
  if (b)
16370
- return f.accessedAt = ++R, { entry: b, page: f };
16394
+ return f.accessedAt = ++A, { entry: b, page: f };
16371
16395
  }
16372
16396
  }
16373
16397
  function T(u) {
@@ -16390,7 +16414,7 @@ function zu(e = {}) {
16390
16414
  return n.add(u), () => n.delete(u);
16391
16415
  },
16392
16416
  configure: st,
16393
- observeLiveBlocks: Re,
16417
+ observeLiveBlocks: Ae,
16394
16418
  recordPromptAdmitted: Ht,
16395
16419
  recordPromptRemoved: Eo,
16396
16420
  handleSessionEvent: it,
@@ -16416,7 +16440,7 @@ function In(e) {
16416
16440
  for (const s of o.turns) t.set(s.ordinal, s);
16417
16441
  return t;
16418
16442
  }
16419
- function Ra(e, t, o, s) {
16443
+ function Aa(e, t, o, s) {
16420
16444
  if (!t || e.sessionId !== t || o !== void 0 && e.snapshot !== o || e.snapshot.length === 0 || !Number.isInteger(e.start) || e.start < 0 || !Number.isInteger(e.totalTurns) || e.totalTurns < 0 || e.start + e.turns.length > e.totalTurns || e.turns.length > s || new Set(e.turns.map((n) => n.turnId)).size !== e.turns.length || e.turns.some(
16421
16445
  (n, a) => n.ordinal !== e.start + a || n.turnId.length === 0
16422
16446
  ))
@@ -16469,7 +16493,7 @@ function Hn(e, t) {
16469
16493
  e.replayError ?? "Historical transcript page was partial"
16470
16494
  );
16471
16495
  }
16472
- function As(e) {
16496
+ function Rs(e) {
16473
16497
  return jt(e) === 413 && vl(e) === "transcript_too_large";
16474
16498
  }
16475
16499
  function vl(e) {
@@ -16525,18 +16549,18 @@ function ep(e) {
16525
16549
  }
16526
16550
  function tp(e, t, o) {
16527
16551
  const s = /* @__PURE__ */ new Set();
16528
- for (const A of e.blocks)
16529
- for (const O of A.sourceRecordIds ?? [])
16552
+ for (const R of e.blocks)
16553
+ for (const O of R.sourceRecordIds ?? [])
16530
16554
  s.add(O);
16531
- for (const A of e.unrecognizedDiagnostics)
16532
- for (const O of A.sourceRecordIds ?? [])
16555
+ for (const R of e.unrecognizedDiagnostics)
16556
+ for (const O of R.sourceRecordIds ?? [])
16533
16557
  s.add(O);
16534
- const n = (A) => {
16535
- if (A?.kind !== "user") return;
16536
- const O = A.text ?? "", P = A.images?.length ?? 0, q = A.files?.length ?? 0;
16558
+ const n = (R) => {
16559
+ if (R?.kind !== "user") return;
16560
+ const O = R.text ?? "", P = R.images?.length ?? 0, q = R.files?.length ?? 0;
16537
16561
  return `${O}\0img:${P}\0file:${q}`;
16538
16562
  }, a = e.blocks[0], r = (a?.sourceRecordIds?.length ?? 0) === 0 ? n(a) : void 0, i = s.size === 0 ? t : t.filter(
16539
- (A) => !A.sourceRecordIds?.some(
16563
+ (R) => !R.sourceRecordIds?.some(
16540
16564
  (O) => s.has(O)
16541
16565
  )
16542
16566
  ), l = Vn({
@@ -16552,12 +16576,12 @@ function tp(e, t, o) {
16552
16576
  const m = l.getSnapshot();
16553
16577
  let g = m.blocks;
16554
16578
  if (r !== void 0)
16555
- for (let A = m.blocks.length - 1; A >= 0; A -= 1) {
16556
- const O = m.blocks[A];
16579
+ for (let R = m.blocks.length - 1; R >= 0; R -= 1) {
16580
+ const O = m.blocks[R];
16557
16581
  if (O?.kind === "user") {
16558
16582
  n(O) === r && (g = [
16559
- ...m.blocks.slice(0, A),
16560
- ...m.blocks.slice(A + 1)
16583
+ ...m.blocks.slice(0, R),
16584
+ ...m.blocks.slice(R + 1)
16561
16585
  ]);
16562
16586
  break;
16563
16587
  }
@@ -16566,19 +16590,19 @@ function tp(e, t, o) {
16566
16590
  e.blocks,
16567
16591
  g
16568
16592
  ), v = h.reduce(
16569
- (A, O) => A + Va(O),
16593
+ (R, O) => R + Va(O),
16570
16594
  0
16571
- ) - e.retainedBytes, R = h.length - e.blocks.length, U = R >= o || v >= e.maxRetainedBytes;
16572
- return R + e.blocks.length > o ? {
16595
+ ) - e.retainedBytes, A = h.length - e.blocks.length, U = A >= o || v >= e.maxRetainedBytes;
16596
+ return A + e.blocks.length > o ? {
16573
16597
  admitted: !1,
16574
16598
  reason: "count",
16575
- pageBlocks: R,
16599
+ pageBlocks: A,
16576
16600
  pageBytes: v,
16577
16601
  impossible: U
16578
16602
  } : e.retainedBytes + v > e.maxRetainedBytes ? {
16579
16603
  admitted: !1,
16580
16604
  reason: "bytes",
16581
- pageBlocks: R,
16605
+ pageBlocks: A,
16582
16606
  pageBytes: v,
16583
16607
  impossible: U
16584
16608
  } : {
@@ -16661,7 +16685,7 @@ function ao(e, t) {
16661
16685
  function op(e) {
16662
16686
  const t = Te(e.rawInput) ? e.rawInput : void 0, o = Te(e.rawOutput) ? e.rawOutput : void 0, s = e.toolName?.toLowerCase();
16663
16687
  if (!(s === "agent" || s === "task" || typeof t?.subagent_type == "string" || o?.type === "task_execution")) return e;
16664
- const a = Te(o?.executionSummary) ? o.executionSummary : void 0, r = ao(t?.subagent_type, 120), i = ao(t?.prompt, 240), l = ao(t?.description, 240), m = ao(t?.working_dir, 240), g = ao(t?.name, 120), h = typeof t?.todo_id == "string" ? t.todo_id : void 0, v = ao(o?.subagentName, 120), R = ao(o?.subagentColor, 80), U = ao(o?.taskDescription, 240), A = ao(o?.status, 80), O = A ?? e.status, P = O === "completed" || O === "failed" || O === "cancelled", q = o?.executionMode, H = ao(o?.terminateReason, 240), J = Array.isArray(o?.skills) ? o.skills.slice(0, 32).flatMap(
16688
+ const a = Te(o?.executionSummary) ? o.executionSummary : void 0, r = ao(t?.subagent_type, 120), i = ao(t?.prompt, 240), l = ao(t?.description, 240), m = ao(t?.working_dir, 240), g = ao(t?.name, 120), h = typeof t?.todo_id == "string" ? t.todo_id : void 0, v = ao(o?.subagentName, 120), A = ao(o?.subagentColor, 80), U = ao(o?.taskDescription, 240), R = ao(o?.status, 80), O = R ?? e.status, P = O === "completed" || O === "failed" || O === "cancelled", q = o?.executionMode, H = ao(o?.terminateReason, 240), J = Array.isArray(o?.skills) ? o.skills.slice(0, 32).flatMap(
16665
16689
  (te) => ao(te, 120) ? [ao(te, 120)] : []
16666
16690
  ) : [], x = t ? {
16667
16691
  ...r ? { subagent_type: r } : {},
@@ -16674,9 +16698,9 @@ function op(e) {
16674
16698
  } : void 0, Z = o ? {
16675
16699
  ...o.type === "task_execution" ? { type: "task_execution" } : {},
16676
16700
  ...v ? { subagentName: v } : {},
16677
- ...R ? { subagentColor: R } : {},
16701
+ ...A ? { subagentColor: A } : {},
16678
16702
  ...U ? { taskDescription: U } : {},
16679
- ...A ? { status: A } : {},
16703
+ ...R ? { status: R } : {},
16680
16704
  ...Mi(q) ? { executionMode: q } : {},
16681
16705
  ...typeof o.subagentSessionReady == "boolean" ? { subagentSessionReady: o.subagentSessionReady } : {},
16682
16706
  ...H ? { terminateReason: H } : {},
@@ -16708,7 +16732,7 @@ function op(e) {
16708
16732
  details: void 0
16709
16733
  };
16710
16734
  }
16711
- function Rs(e) {
16735
+ function As(e) {
16712
16736
  const t = [];
16713
16737
  for (const o of e)
16714
16738
  "parentToolCallId" in o && o.parentToolCallId || t.push(
@@ -16720,9 +16744,9 @@ const Tl = xt(
16720
16744
  void 0
16721
16745
  ), Cl = xt(void 0), nr = xt(
16722
16746
  void 0
16723
- ), Il = xt(void 0), xl = xt(void 0), Al = xt(
16747
+ ), Il = xt(void 0), xl = xt(void 0), Rl = xt(
16724
16748
  void 0
16725
- ), Rl = xt(void 0), Pl = xt(void 0), El = xt(void 0), $l = xt(void 0), sr = /* @__PURE__ */ new Set([401, 403]), np = /* @__PURE__ */ new Set([
16749
+ ), Al = xt(void 0), Pl = xt(void 0), El = xt(void 0), $l = xt(void 0), sr = /* @__PURE__ */ new Set([401, 403]), np = /* @__PURE__ */ new Set([
16726
16750
  ...sr,
16727
16751
  ...sl
16728
16752
  ]), sp = 5e4, ap = 16, rp = {
@@ -16753,7 +16777,7 @@ function Ci(e, t, o) {
16753
16777
  const s = e.get(t);
16754
16778
  s?.delete(o), s?.size === 0 && e.delete(t);
16755
16779
  }
16756
- function Am(e) {
16780
+ function Rm(e) {
16757
16781
  const {
16758
16782
  baseUrl: t,
16759
16783
  token: o,
@@ -16767,9 +16791,9 @@ function Am(e) {
16767
16791
  maxBlocks: g = sp,
16768
16792
  maxRetainedBytes: h,
16769
16793
  historyPageSize: v,
16770
- subagentTranscriptMode: R = "full",
16794
+ subagentTranscriptMode: A = "full",
16771
16795
  suppressOwnUserEcho: U = !0,
16772
- includeRawEvent: A = !1,
16796
+ includeRawEvent: R = !1,
16773
16797
  prefetchGitBranch: O = !0,
16774
16798
  prefetchSkills: P = !0,
16775
16799
  autoConnect: q = !0,
@@ -16803,8 +16827,8 @@ function Am(e) {
16803
16827
  Le.current = y?.client;
16804
16828
  const st = Y(y?.capabilities);
16805
16829
  st.current = y?.capabilities;
16806
- const Re = Y(y?.getCapabilities);
16807
- Re.current = y?.getCapabilities;
16830
+ const Ae = Y(y?.getCapabilities);
16831
+ Ae.current = y?.getCapabilities;
16808
16832
  const Ht = Y(!1), it = Y(a).current, Ye = it === void 0, Gt = Y(ne);
16809
16833
  Gt.current = ne;
16810
16834
  const vo = Y(i);
@@ -16835,7 +16859,7 @@ function Am(e) {
16835
16859
  () => Vn({
16836
16860
  maxBlocks: g,
16837
16861
  ...h !== void 0 ? { maxRetainedBytes: h } : {},
16838
- retainSubagentBlocks: R === "full",
16862
+ retainSubagentBlocks: A === "full",
16839
16863
  onTruncation: ($) => {
16840
16864
  if ($.kind !== "blocks") return;
16841
16865
  const I = Ne.current, K = ee.current;
@@ -16882,7 +16906,7 @@ function Am(e) {
16882
16906
  }
16883
16907
  }
16884
16908
  }),
16885
- [g, h, R]
16909
+ [g, h, A]
16886
16910
  ), ht = nt(
16887
16911
  () => zu({
16888
16912
  captureLiveBoundary: () => {
@@ -16929,8 +16953,8 @@ function Am(e) {
16929
16953
  void 0
16930
16954
  ), Q = Y(!1), X = Y({
16931
16955
  consecutiveFailures: 0
16932
- }), N = Y(!1), j = Y(void 0), ae = Y(void 0), re = Y(void 0), he = Y(/* @__PURE__ */ new WeakSet()), $e = Y({ suppressOwnUserEcho: U, includeRawEvent: A }), io = Y({ reconnectDelayMs: x, maxReconnectDelayMs: Z }), $t = Y(void 0), yt = Y(ke), Ft = Y(v), Xe = Y(R), Mt = Y(Ss(r));
16933
- $e.current = { suppressOwnUserEcho: U, includeRawEvent: A }, io.current = { reconnectDelayMs: x, maxReconnectDelayMs: Z }, yt.current = ke, Ft.current = v, Xe.current = R;
16956
+ }), N = Y(!1), j = Y(void 0), ae = Y(void 0), re = Y(void 0), he = Y(/* @__PURE__ */ new WeakSet()), $e = Y({ suppressOwnUserEcho: U, includeRawEvent: R }), io = Y({ reconnectDelayMs: x, maxReconnectDelayMs: Z }), $t = Y(void 0), yt = Y(ke), Ft = Y(v), Xe = Y(A), Mt = Y(Ss(r));
16957
+ $e.current = { suppressOwnUserEcho: U, includeRawEvent: R }, io.current = { reconnectDelayMs: x, maxReconnectDelayMs: Z }, yt.current = ke, Ft.current = v, Xe.current = A;
16934
16958
  const eo = l?.modelServiceId, Ut = l?.sessionScope, yo = Y(l);
16935
16959
  yo.current = l;
16936
16960
  const [nn, Fe] = rt("idle"), [ce, to] = rt(
@@ -17028,7 +17052,7 @@ function Am(e) {
17028
17052
  Bt,
17029
17053
  Lo,
17030
17054
  { hideHistoryTruncation: !0, suppressSideEffects: !0 }
17031
- ), ct = Xe.current === "summary" ? Rs(ve) : ve;
17055
+ ), ct = Xe.current === "summary" ? As(ve) : ve;
17032
17056
  for (const St of ct) Wt(St);
17033
17057
  if (qe.type === "turn_complete") {
17034
17058
  const St = qe.data?.stopReason ?? "end_turn";
@@ -17214,7 +17238,7 @@ function Am(e) {
17214
17238
  Ge.errorStatus
17215
17239
  )
17216
17240
  }));
17217
- const S = Re.current, fe = st.current ?? (S ? await S() : await ue.capabilities());
17241
+ const S = Ae.current, fe = st.current ?? (S ? await S() : await ue.capabilities());
17218
17242
  if (K || I.signal.aborted) return;
17219
17243
  kt = fe, se.current = fe;
17220
17244
  const et = Array.isArray(fe.features) && fe.features.includes(Gn);
@@ -17245,17 +17269,17 @@ function Am(e) {
17245
17269
  ))
17246
17270
  try {
17247
17271
  Ct = await ue.getStandaloneSessionOptions();
17248
- } catch (Ao) {
17272
+ } catch (Ro) {
17249
17273
  console.warn(
17250
17274
  "[DaemonSessionProvider] standalone session options failed in deferred connect:",
17251
- Ao
17275
+ Ro
17252
17276
  );
17253
17277
  }
17254
17278
  if (K || I.signal.aborted) return;
17255
17279
  const Wo = Ds(Ct);
17256
17280
  be(
17257
- (Ao) => Ao.status === "error" || Ao.sessionId ? Ao : {
17258
- ...zn(Ao),
17281
+ (Ro) => Ro.status === "error" || Ro.sessionId ? Ro : {
17282
+ ...zn(Ro),
17259
17283
  status: "connected",
17260
17284
  sessionContext: dt,
17261
17285
  workspaceCwd: void 0,
@@ -17297,7 +17321,7 @@ function Am(e) {
17297
17321
  skills: ac
17298
17322
  } = wa(
17299
17323
  co.status === "fulfilled" ? co.value : void 0
17300
- ), Ar = xe.current.workspaceCwd === je && (co.status === "rejected" || N.current && xr.length === 0);
17324
+ ), Rr = xe.current.workspaceCwd === je && (co.status === "rejected" || N.current && xr.length === 0);
17301
17325
  be((Ct) => ({
17302
17326
  ...Ct,
17303
17327
  status: "connected",
@@ -17311,8 +17335,8 @@ function Am(e) {
17311
17335
  contextWindow: bs.contextWindow,
17312
17336
  providers: ks,
17313
17337
  capabilities: fe,
17314
- commands: Ar ? Ct.commands : !P || co.status === "rejected" ? void 0 : xr,
17315
- skills: Ar ? Ct.skills : !P || co.status === "rejected" ? void 0 : ac
17338
+ commands: Rr ? Ct.commands : !P || co.status === "rejected" ? void 0 : xr,
17339
+ skills: Rr ? Ct.skills : !P || co.status === "rejected" ? void 0 : ac
17316
17340
  })), P && lo ? (async () => {
17317
17341
  try {
17318
17342
  const Ct = await lo.ensureRuntime(), Wo = await Id(
@@ -17321,9 +17345,9 @@ function Am(e) {
17321
17345
  () => K || I.signal.aborted || xe.current.sessionId !== void 0
17322
17346
  );
17323
17347
  if (!Wo) return;
17324
- const { commands: Ao, skills: ha } = wa(Wo);
17348
+ const { commands: Ro, skills: ha } = wa(Wo);
17325
17349
  be(
17326
- (un) => un.sessionId ? un : { ...un, commands: Ao, skills: ha }
17350
+ (un) => un.sessionId ? un : { ...un, commands: Ro, skills: ha }
17327
17351
  );
17328
17352
  } catch (Ct) {
17329
17353
  console.warn(
@@ -17339,9 +17363,9 @@ function Am(e) {
17339
17363
  const Wo = await ue.workspaceSkills();
17340
17364
  if (K || I.signal.aborted || xe.current.sessionId)
17341
17365
  return;
17342
- const { commands: Ao, skills: ha } = wa(Wo);
17366
+ const { commands: Ro, skills: ha } = wa(Wo);
17343
17367
  be(
17344
- (un) => un.sessionId ? un : { ...un, commands: Ao, skills: ha }
17368
+ (un) => un.sessionId ? un : { ...un, commands: Ro, skills: ha }
17345
17369
  );
17346
17370
  } catch (Ct) {
17347
17371
  console.warn(
@@ -17354,7 +17378,7 @@ function Am(e) {
17354
17378
  })());
17355
17379
  return;
17356
17380
  }
17357
- const we = ce ?? Ke, De = $n ? Mt.current : Ss(void 0, we), Rt = we !== void 0 && we === xe.current.sessionId && xe.current.clientId !== void 0 && De !== xe.current.clientId, Vt = !!ce && zt === "resume" && !Rt;
17381
+ const we = ce ?? Ke, De = $n ? Mt.current : Ss(void 0, we), At = we !== void 0 && we === xe.current.sessionId && xe.current.clientId !== void 0 && De !== xe.current.clientId, Vt = !!ce && zt === "resume" && !At;
17358
17382
  To = !!ce, we && !ie && be((Ge) => ({
17359
17383
  ...Ge,
17360
17384
  sessionId: we,
@@ -17366,7 +17390,7 @@ function Am(e) {
17366
17390
  const Kt = b.current, He = Kt !== void 0 && Kt.sessionId === we && va(
17367
17391
  Kt.sessionContext,
17368
17392
  dt
17369
- ) ? Kt : void 0, Ae = {
17393
+ ) ? Kt : void 0, Re = {
17370
17394
  timeoutMs: He?.requestTimeoutMs ?? qi(kt).requestTimeoutMs,
17371
17395
  // Workspace restores only: the standalone request type omits
17372
17396
  // source attribution, and the daemon applies it solely when the
@@ -17380,50 +17404,50 @@ function Am(e) {
17380
17404
  };
17381
17405
  let ge;
17382
17406
  if (ce)
17383
- dt?.kind === "standalone" ? ge = Vt ? await Ro.resumeStandalone(
17407
+ dt?.kind === "standalone" ? ge = Vt ? await Ao.resumeStandalone(
17384
17408
  ue,
17385
17409
  ce,
17386
- Ae,
17410
+ Re,
17387
17411
  De
17388
- ) : await Ro.loadStandalone(
17412
+ ) : await Ao.loadStandalone(
17389
17413
  ue,
17390
17414
  ce,
17391
- Ae,
17415
+ Re,
17392
17416
  De
17393
- ) : ge = Vt ? await Ro.resume(
17417
+ ) : ge = Vt ? await Ao.resume(
17394
17418
  ue,
17395
17419
  ce,
17396
17420
  {
17397
- ...Ae,
17421
+ ...Re,
17398
17422
  workspaceCwd: je
17399
17423
  },
17400
17424
  De
17401
- ) : await Ro.load(
17425
+ ) : await Ao.load(
17402
17426
  ue,
17403
17427
  ce,
17404
17428
  {
17405
- ...Ae,
17429
+ ...Re,
17406
17430
  workspaceCwd: je
17407
17431
  },
17408
17432
  De
17409
17433
  );
17410
17434
  else if (Ke)
17411
- ge = dt?.kind === "standalone" ? await Ro.loadStandalone(
17435
+ ge = dt?.kind === "standalone" ? await Ao.loadStandalone(
17412
17436
  ue,
17413
17437
  Ke,
17414
- Ae,
17438
+ Re,
17415
17439
  De
17416
- ) : await Ro.load(
17440
+ ) : await Ao.load(
17417
17441
  ue,
17418
17442
  Ke,
17419
17443
  {
17420
- ...Ae,
17444
+ ...Re,
17421
17445
  workspaceCwd: je
17422
17446
  },
17423
17447
  De
17424
17448
  );
17425
17449
  else if (dt?.kind === "standalone")
17426
- On = !0, ge = await Ro.createStandalone(ue, {
17450
+ On = !0, ge = await Ao.createStandalone(ue, {
17427
17451
  ...eo !== void 0 ? { modelServiceId: eo } : {},
17428
17452
  ...yo.current?.approvalMode !== void 0 ? {
17429
17453
  approvalMode: yi(
@@ -17434,7 +17458,7 @@ function Am(e) {
17434
17458
  else {
17435
17459
  if (dt?.kind === "live")
17436
17460
  throw ea = !0, new Error("Live session context does not support create");
17437
- ge = await Ro.createOrAttach(
17461
+ ge = await Ao.createOrAttach(
17438
17462
  ue,
17439
17463
  {
17440
17464
  ...eo !== void 0 ? { modelServiceId: eo } : {},
@@ -17588,7 +17612,7 @@ function Am(e) {
17588
17612
  we.id
17589
17613
  ) && !(we.id > Ue.snapshotLastEventId && we.id <= Ue.lastObservedEventId);
17590
17614
  try {
17591
- const Rt = Ps(
17615
+ const At = Ps(
17592
17616
  we,
17593
17617
  L.clientId,
17594
17618
  S,
@@ -17599,14 +17623,14 @@ function Am(e) {
17599
17623
  }
17600
17624
  ), Vt = Es(
17601
17625
  we,
17602
- Rt,
17626
+ At,
17603
17627
  Bt,
17604
17628
  Lo,
17605
17629
  {
17606
17630
  hideHistoryTruncation: ps,
17607
17631
  suppressSideEffects: Ue !== void 0 && !De
17608
17632
  }
17609
- ), Kt = Xe.current === "summary" ? Rs(Vt) : Vt, He = [...Kt];
17633
+ ), Kt = Xe.current === "summary" ? As(Vt) : Vt, He = [...Kt];
17610
17634
  if (we.type === "turn_complete") {
17611
17635
  const le = we.data?.stopReason ?? "end_turn";
17612
17636
  He.push(
@@ -17617,15 +17641,15 @@ function Am(e) {
17617
17641
  );
17618
17642
  if (dt.push(we), je.push({
17619
17643
  transcript: He,
17620
- sideEffects: Ue === void 0 ? Kt : De ? Rt : []
17644
+ sideEffects: Ue === void 0 ? Kt : De ? At : []
17621
17645
  }), De) {
17622
17646
  const le = Jr(we);
17623
17647
  le && Yr(le);
17624
- const Ae = ei(we);
17625
- Ae && Zr(Ae), oi(we) && ti(we);
17648
+ const Re = ei(we);
17649
+ Re && Zr(Re), oi(we) && ti(we);
17626
17650
  }
17627
- } catch (Rt) {
17628
- const Vt = Rt instanceof Error ? Rt.message : String(Rt);
17651
+ } catch (At) {
17652
+ const Vt = At instanceof Error ? At.message : String(At);
17629
17653
  (Ue === void 0 || De) && (Bt({
17630
17654
  severity: "warning",
17631
17655
  category: "protocol",
@@ -17636,7 +17660,7 @@ function Am(e) {
17636
17660
  recoverable: !0
17637
17661
  }), console.warn(
17638
17662
  "[DaemonSessionProvider] skipped malformed replay event:",
17639
- Rt
17663
+ At
17640
17664
  )), je.push({ transcript: [], sideEffects: [] });
17641
17665
  }
17642
17666
  }
@@ -17647,7 +17671,7 @@ function Am(e) {
17647
17671
  if (Ue !== void 0 || et !== void 0 || Uo || me.getSnapshot().blocks.length === 0) {
17648
17672
  const we = Ue && us ? Ue.checkpoint.maxBlocks : g, De = (le) => {
17649
17673
  le.kind === "blocks" && le.evictedOldest !== !1 && (mt = !0);
17650
- }, Rt = Vn(
17674
+ }, At = Vn(
17651
17675
  Ue && us ? {
17652
17676
  ...Ue.checkpoint,
17653
17677
  maxBlocks: we,
@@ -17666,11 +17690,11 @@ function Am(e) {
17666
17690
  );
17667
17691
  let Vt;
17668
17692
  if (tt < 0 && Ue === void 0)
17669
- Rt.dispatch(no);
17693
+ At.dispatch(no);
17670
17694
  else
17671
- for (const [le, Ae] of je.entries())
17672
- le === tt && (Vt = Rt.getSnapshot()), Rt.dispatch(Ae.transcript);
17673
- const Kt = Rt.getSnapshot();
17695
+ for (const [le, Re] of je.entries())
17696
+ le === tt && (Vt = At.getSnapshot()), At.dispatch(Re.transcript);
17697
+ const Kt = At.getSnapshot();
17674
17698
  xo = mt || Kt.blocks.length >= we, xo && (No = Kt.blocks.find(
17675
17699
  (le) => (le.sourceRecordIds?.length ?? 0) > 0
17676
17700
  )?.sourceRecordIds?.[0]);
@@ -17681,8 +17705,8 @@ function Am(e) {
17681
17705
  }), et && Vt) {
17682
17706
  const le = me.getSnapshot().blocks.find(
17683
17707
  (ge) => ge.kind === "status" && ge.source === "history_truncated" && Te(ge.data) && ge.data.scope === "live_journal"
17684
- ), Ae = w.current;
17685
- w.current = Ae?.target.signature === et.signature && Ae.attempted ? Ae : {
17708
+ ), Re = w.current;
17709
+ w.current = Re?.target.signature === et.signature && Re.attempted ? Re : {
17686
17710
  sessionId: L.sessionId,
17687
17711
  target: et,
17688
17712
  checkpoint: {
@@ -17801,20 +17825,20 @@ function Am(e) {
17801
17825
  ] = await Promise.all([Vl, Kl]);
17802
17826
  if (K || I.signal.aborted || ee.current !== L)
17803
17827
  return;
17804
- const vr = ca?.status === "fulfilled" ? ca.value : void 0, gs = da?.status === "fulfilled" ? da.value : void 0, At = ua?.status === "fulfilled" ? ua.value : void 0, Ql = pa?.status === "fulfilled" ? pa.value?.branch ?? void 0 : void 0, Yl = ma === void 0 && ms === void 0 ? { v: 2, goal: null, activity: "idle" } : void 0, yr = [
17828
+ const vr = ca?.status === "fulfilled" ? ca.value : void 0, gs = da?.status === "fulfilled" ? da.value : void 0, Rt = ua?.status === "fulfilled" ? ua.value : void 0, Ql = pa?.status === "fulfilled" ? pa.value?.branch ?? void 0 : void 0, Yl = ma === void 0 && ms === void 0 ? { v: 2, goal: null, activity: "idle" } : void 0, yr = [
17805
17829
  ca?.status === "rejected" ? yt.current?.models : void 0,
17806
17830
  da?.status === "rejected" ? yt.current?.commands : void 0,
17807
17831
  ua?.status === "rejected" ? yt.current?.context : void 0
17808
- ].filter((S) => !!S), Sn = Ds(vr), Un = Ic(At), ga = Un && Un.models.length > 0 ? Un.models : Sn.models, hs = Un?.currentModel ?? Sn.currentModel, Jl = hs === Sn.currentModel ? Sn.contextWindow : Sn.models.find(
17832
+ ].filter((S) => !!S), Sn = Ds(vr), Un = Ic(Rt), ga = Un && Un.models.length > 0 ? Un.models : Sn.models, hs = Un?.currentModel ?? Sn.currentModel, Jl = hs === Sn.currentModel ? Sn.contextWindow : Sn.models.find(
17809
17833
  (S) => S.id === hs
17810
- )?.contextWindow, Xl = Un?.contextWindow ?? ga.find((S) => S.id === hs)?.contextWindow ?? Jl, { commands: Zl, skills: ec } = Oa(gs), Sr = Oi(At);
17834
+ )?.contextWindow, Xl = Un?.contextWindow ?? ga.find((S) => S.id === hs)?.contextWindow ?? Jl, { commands: Zl, skills: ec } = Oa(gs), Sr = Oi(Rt);
17811
17835
  if (be((S) => {
17812
17836
  if (I.signal.aborted || ee.current !== void 0 && ee.current !== L || S.sessionId !== L.sessionId)
17813
17837
  return S;
17814
- const fe = wr % 2 === 0 && (Mo.current.get(L) ?? 0) === wr, et = At?.sessionId === L.sessionId && br !== void 0 && Et.current.get(L) === br, tt = fe && At ? At : S.context ?? (At?.recovery ? {
17815
- v: At.v,
17816
- sessionId: At.sessionId,
17817
- workspaceCwd: At.workspaceCwd,
17838
+ const fe = wr % 2 === 0 && (Mo.current.get(L) ?? 0) === wr, et = Rt?.sessionId === L.sessionId && br !== void 0 && Et.current.get(L) === br, tt = fe && Rt ? Rt : S.context ?? (Rt?.recovery ? {
17839
+ v: Rt.v,
17840
+ sessionId: Rt.sessionId,
17841
+ workspaceCwd: Rt.workspaceCwd,
17818
17842
  state: {}
17819
17843
  } : void 0);
17820
17844
  return {
@@ -17839,15 +17863,15 @@ function Am(e) {
17839
17863
  models: ga.length > 0 ? ga : S.models,
17840
17864
  currentModel: fe ? hs ?? S.currentModel : S.currentModel,
17841
17865
  currentMode: fe ? Sr ?? S.currentMode ?? Sn.currentMode : S.currentMode,
17842
- planExecutionMode: fe && Sr !== void 0 ? Li(At) : S.planExecutionMode,
17843
- reasoning: fe && At !== void 0 ? Da(At) : S.reasoning,
17866
+ planExecutionMode: fe && Sr !== void 0 ? Li(Rt) : S.planExecutionMode,
17867
+ reasoning: fe && Rt !== void 0 ? Da(Rt) : S.reasoning,
17844
17868
  displayName: vs(L.state) ?? S.displayName,
17845
17869
  contextWindow: fe ? Xl ?? S.contextWindow : S.contextWindow,
17846
17870
  providers: _t ? fe ? vr ?? S.providers : S.providers : void 0,
17847
17871
  supportedCommands: gs ?? S.supportedCommands,
17848
17872
  context: tt ? {
17849
17873
  ...tt,
17850
- recovery: et ? At?.recovery : (S.context?.sessionId === L.sessionId ? S.context.recovery : void 0) ?? (At?.recovery ? { ...At.recovery, canContinue: !1 } : void 0)
17874
+ recovery: et ? Rt?.recovery : (S.context?.sessionId === L.sessionId ? S.context.recovery : void 0) ?? (Rt?.recovery ? { ...Rt.recovery, canContinue: !1 } : void 0)
17851
17875
  } : void 0,
17852
17876
  // Reconcile rather than reference-compare: the load response and
17853
17877
  // any frame that arrived during the load window share a revision
@@ -17962,7 +17986,7 @@ function Am(e) {
17962
17986
  Bt,
17963
17987
  Lo
17964
17988
  );
17965
- if ((At?.recovery || xe.current.context?.recovery) && (S.id === void 0 || S.id > oc) && ((S.type === "pending_prompt_started" || $s(mt) || mt.some((le) => le.type === "user.text.delta")) && (Xn(
17989
+ if ((Rt?.recovery || xe.current.context?.recovery) && (S.id === void 0 || S.id > oc) && ((S.type === "pending_prompt_started" || $s(mt) || mt.some((le) => le.type === "user.text.delta")) && (Xn(
17966
17990
  Et.current,
17967
17991
  L
17968
17992
  ), be(
@@ -17976,23 +18000,24 @@ function Am(e) {
17976
18000
  }
17977
18001
  }
17978
18002
  } : le
17979
- )), S.type === "turn_complete" || S.type === "turn_error" || mt.some((le) => le.type === "prompt.cancelled"))) {
18003
+ )), S.type === "turn_complete" || S.type === "turn_error" || // A rewind can drop the interrupted turn itself.
18004
+ S.type === "session_rewound" || mt.some((le) => le.type === "prompt.cancelled"))) {
17980
18005
  const le = Xn(
17981
18006
  Et.current,
17982
18007
  L
17983
18008
  );
17984
18009
  L.context().then(
17985
- (Ae) => {
18010
+ (Re) => {
17986
18011
  K || I.signal.aborted || ws.signal.aborted || vt.current !== Jo || ee.current !== L || le !== Et.current.get(
17987
18012
  L
17988
- ) || Ae.sessionId !== L.sessionId || be(
18013
+ ) || Re.sessionId !== L.sessionId || be(
17989
18014
  (ge) => ge.context && vt.current === Jo && ee.current === L && le === Et.current.get(
17990
18015
  L
17991
18016
  ) ? {
17992
18017
  ...ge,
17993
18018
  context: {
17994
18019
  ...ge.context,
17995
- recovery: Ae.recovery
18020
+ recovery: Re.recovery
17996
18021
  }
17997
18022
  } : ge
17998
18023
  );
@@ -18001,7 +18026,7 @@ function Am(e) {
18001
18026
  }
18002
18027
  );
18003
18028
  }
18004
- const No = Xe.current === "summary" ? Rs(mt) : mt;
18029
+ const No = Xe.current === "summary" ? As(mt) : mt;
18005
18030
  if (S.type === "state_resync_required" && (typeof S.data == "object" && S.data !== null ? S.data.reason : void 0) === "epoch_reset") {
18006
18031
  tc();
18007
18032
  break;
@@ -18013,7 +18038,7 @@ function Am(e) {
18013
18038
  ), mt.length > 0) {
18014
18039
  const le = $s(mt);
18015
18040
  Fe(
18016
- (Ae) => Ae === "waiting" || Ae === "idle" && le ? "streaming" : Ae
18041
+ (Re) => Re === "waiting" || Re === "idle" && le ? "streaming" : Re
18017
18042
  );
18018
18043
  }
18019
18044
  const Bo = w.current, lo = Bo?.sessionId === L.sessionId && (S.type === "turn_complete" || S.type === "turn_error") && en(S) === Bo.target.promptId;
@@ -18038,10 +18063,10 @@ function Am(e) {
18038
18063
  ho(S, le)
18039
18064
  ), Io() || Fe("idle");
18040
18065
  }
18041
- const Rt = mt.some(
18066
+ const At = mt.some(
18042
18067
  (le) => le.type === "debug" && !Pr(le.debugReason)
18043
18068
  );
18044
- !Io() && Rt && ve();
18069
+ !Io() && At && ve();
18045
18070
  const Kt = !Io() && me.getSnapshot().activeAssistantBlockId != null ? No.filter(
18046
18071
  (le) => le.type !== "debug" || Pr(le.debugReason)
18047
18072
  ) : No;
@@ -18051,9 +18076,9 @@ function Am(e) {
18051
18076
  ct(
18052
18077
  ho(S, "cancelled")
18053
18078
  );
18054
- const Ae = cn;
18055
- cs(), De = !0, Qe(_), Ae || at.current.delete(L.sessionId), Io() || Fe("idle");
18056
- } else le.type === "session.replay_complete" && (ve(), be((Ae) => ({ ...Ae, catchingUp: void 0 })), me.getSnapshot().awaitingResync && me.clearAwaitingResync(), Io() || (Qe(
18079
+ const Re = cn;
18080
+ cs(), De = !0, Qe(_), Re || at.current.delete(L.sessionId), Io() || Fe("idle");
18081
+ } else le.type === "session.replay_complete" && (ve(), be((Re) => ({ ...Re, catchingUp: void 0 })), me.getSnapshot().awaitingResync && me.clearAwaitingResync(), Io() || (Qe(
18057
18082
  _
18058
18083
  ), ct({
18059
18084
  type: "assistant.done",
@@ -18061,9 +18086,9 @@ function Am(e) {
18061
18086
  }), bn() && Fe("idle")));
18062
18087
  const He = !we && !De && !Io();
18063
18088
  if (He && (mt.some(
18064
- (Ae) => Ae.type === "user.text.delta"
18089
+ (Re) => Re.type === "user.text.delta"
18065
18090
  ) ? Fe("waiting") : $s(mt) && Fe(
18066
- (Ae) => Ae === "idle" ? "streaming" : Ae
18091
+ (Re) => Re === "idle" ? "streaming" : Re
18067
18092
  )), He && !no && S.type === "turn_complete") {
18068
18093
  Qe(_);
18069
18094
  const le = S.data?.stopReason ?? "end_turn";
@@ -18104,13 +18129,13 @@ function Am(e) {
18104
18129
  )), St(), me.reset(), console.warn(
18105
18130
  "[DaemonSessionProvider] ring eviction detected, reloading session (sessionId=%s)",
18106
18131
  L.sessionId
18107
- ), fs = !0, Qo = "state_resync", ye = void 0, ee.current = void 0, Fo.current = () => !1, Ko.current = () => !1, be((Ae) => ({
18108
- ...Ae,
18132
+ ), fs = !0, Qo = "state_resync", ye = void 0, ee.current = void 0, Fo.current = () => !1, Ko.current = () => !1, be((Re) => ({
18133
+ ...Re,
18109
18134
  status: "connecting",
18110
18135
  error: void 0,
18111
18136
  errorStatus: Qt(
18112
18137
  void 0,
18113
- Ae.errorStatus
18138
+ Re.errorStatus
18114
18139
  )
18115
18140
  }));
18116
18141
  break;
@@ -18119,8 +18144,8 @@ function Am(e) {
18119
18144
  oa = !0;
18120
18145
  const le = S.data;
18121
18146
  mr = le.cause === "workspace_runtime_stop", gr = le.persistenceUnconfirmed === !0;
18122
- const Ae = L.sessionId;
18123
- at.current.get(Ae)?.controller.abort(), at.current.delete(Ae), ye = void 0, ee.current = void 0;
18147
+ const Re = L.sessionId;
18148
+ at.current.get(Re)?.controller.abort(), at.current.delete(Re), ye = void 0, ee.current = void 0;
18124
18149
  break;
18125
18150
  }
18126
18151
  } catch (et) {
@@ -18226,7 +18251,7 @@ function Am(e) {
18226
18251
  }
18227
18252
  })), On) {
18228
18253
  On = !1, N.current = !0;
18229
- const We = Pe instanceof Ri;
18254
+ const We = Pe instanceof Ai;
18230
18255
  be((pt) => ({
18231
18256
  ...mn(
18232
18257
  pt,
@@ -18621,7 +18646,7 @@ function Am(e) {
18621
18646
  ...I?.worktree !== void 0 ? { worktree: I.worktree } : {},
18622
18647
  ...I?.branch !== void 0 ? { branch: I.branch } : {}
18623
18648
  }, Me = r ? Mt.current : Ss(void 0);
18624
- return Ro.createOrAttach(
18649
+ return Ao.createOrAttach(
18625
18650
  K,
18626
18651
  ie,
18627
18652
  Me
@@ -18639,7 +18664,7 @@ function Am(e) {
18639
18664
  }), K = yi(
18640
18665
  $?.approvalMode ?? yo.current?.approvalMode
18641
18666
  ), ie = $?.modelServiceId ?? yo.current?.modelServiceId;
18642
- return Ro.createStandalone(I, {
18667
+ return Ao.createStandalone(I, {
18643
18668
  ...ie !== void 0 ? { modelServiceId: ie } : {},
18644
18669
  ...K !== void 0 ? { approvalMode: K } : {}
18645
18670
  }).then(
@@ -18759,7 +18784,7 @@ function Am(e) {
18759
18784
  Lo
18760
18785
  );
18761
18786
  Wt.push(
18762
- ...Xe.current === "summary" ? Rs(St) : St
18787
+ ...Xe.current === "summary" ? As(St) : St
18763
18788
  );
18764
18789
  } catch (St) {
18765
18790
  const Dn = St instanceof Error ? St.message : String(St);
@@ -18914,7 +18939,7 @@ function Am(e) {
18914
18939
  }
18915
18940
  };
18916
18941
  }, [ur, Be.sessionId]);
18917
- return /* @__PURE__ */ Yt(ad.Provider, { value: ql, children: /* @__PURE__ */ Yt(Tl.Provider, { value: me, children: /* @__PURE__ */ Yt(xl.Provider, { value: ht, children: /* @__PURE__ */ Yt(Cl.Provider, { value: Be, children: /* @__PURE__ */ Yt(Al.Provider, { value: nn, children: /* @__PURE__ */ Yt(Pl.Provider, { value: Ul, children: /* @__PURE__ */ Yt(
18942
+ return /* @__PURE__ */ Yt(ad.Provider, { value: ql, children: /* @__PURE__ */ Yt(Tl.Provider, { value: me, children: /* @__PURE__ */ Yt(xl.Provider, { value: ht, children: /* @__PURE__ */ Yt(Cl.Provider, { value: Be, children: /* @__PURE__ */ Yt(Rl.Provider, { value: nn, children: /* @__PURE__ */ Yt(Pl.Provider, { value: Ul, children: /* @__PURE__ */ Yt(
18918
18943
  El.Provider,
18919
18944
  {
18920
18945
  value: Nl,
@@ -18927,7 +18952,7 @@ function Am(e) {
18927
18952
  {
18928
18953
  value: Bl,
18929
18954
  children: /* @__PURE__ */ Yt(
18930
- Rl.Provider,
18955
+ Al.Provider,
18931
18956
  {
18932
18957
  value: u,
18933
18958
  children: V
@@ -18945,11 +18970,13 @@ function Ii(e, t) {
18945
18970
  return;
18946
18971
  const o = en(t);
18947
18972
  if (!o) return;
18973
+ const s = t.originatorClientId ? { originatorClientId: t.originatorClientId } : {};
18948
18974
  if (t.type === "turn_error") {
18949
- const n = Te(t.data) ? t.data : {};
18975
+ const a = Te(t.data) ? t.data : {};
18950
18976
  return {
18951
18977
  sessionId: e,
18952
18978
  promptId: o,
18979
+ ...s,
18953
18980
  outcome: "failed",
18954
18981
  error: {
18955
18982
  // Same defaults `matchTurnEvent` applies when it turns this frame into
@@ -18957,17 +18984,18 @@ function Ii(e, t) {
18957
18984
  // published settlement report one failure identically. A codeless
18958
18985
  // `turn_error` is the common shape — the bridge omits `code` whenever
18959
18986
  // `extractErrorCode` finds none.
18960
- message: Po(n, "message") ?? "Prompt failed",
18961
- code: Po(n, "code") ?? "turn_error"
18987
+ message: Po(a, "message") ?? "Prompt failed",
18988
+ code: Po(a, "code") ?? "turn_error"
18962
18989
  }
18963
18990
  };
18964
18991
  }
18965
- const s = t.data?.stopReason ?? "end_turn";
18992
+ const n = t.data?.stopReason ?? "end_turn";
18966
18993
  return {
18967
18994
  sessionId: e,
18968
18995
  promptId: o,
18969
- outcome: s === "cancelled" ? "cancelled" : s === "error" ? "failed" : "completed",
18970
- stopReason: s
18996
+ ...s,
18997
+ outcome: n === "cancelled" ? "cancelled" : n === "error" ? "failed" : "completed",
18998
+ stopReason: n
18971
18999
  };
18972
19000
  }
18973
19001
  function $a(e, t, o, s, n, a, r, i = {}) {
@@ -19130,7 +19158,7 @@ function gp(e, t) {
19130
19158
  };
19131
19159
  }
19132
19160
  }
19133
- function Rm() {
19161
+ function Am() {
19134
19162
  return {
19135
19163
  store: rs(),
19136
19164
  connection: Dl(),
@@ -19227,7 +19255,7 @@ function zo() {
19227
19255
  return Lt(El);
19228
19256
  }
19229
19257
  function _l() {
19230
- const e = Lt(Al);
19258
+ const e = Lt(Rl);
19231
19259
  if (!e)
19232
19260
  throw new Error(
19233
19261
  "useDaemonPromptStatus must be used within DaemonSessionProvider"
@@ -19235,7 +19263,7 @@ function _l() {
19235
19263
  return e;
19236
19264
  }
19237
19265
  function Lm(e) {
19238
- const t = Lt(Rl), o = Y(e);
19266
+ const t = Lt(Al), o = Y(e);
19239
19267
  if (o.current = e, ut(
19240
19268
  () => t?.((s) => o.current?.(s)),
19241
19269
  [t]
@@ -19326,10 +19354,10 @@ function Ma(e, t) {
19326
19354
  function xi(e, t, o, s = !0) {
19327
19355
  let n = 0, a = 0, r = 0, i = 0;
19328
19356
  const l = [], m = /* @__PURE__ */ new Set();
19329
- let g = 0, h = 0, v = 0, R = 0, U, A = 0, O = 0;
19357
+ let g = 0, h = 0, v = 0, A = 0, U, R = 0, O = 0;
19330
19358
  for (const P of e) {
19331
19359
  if (P.type === "session.source.changed") {
19332
- s && (R += 1);
19360
+ s && (A += 1);
19333
19361
  continue;
19334
19362
  }
19335
19363
  if (P.type === "session.artifact.changed") {
@@ -19369,7 +19397,7 @@ function xi(e, t, o, s = !0) {
19369
19397
  };
19370
19398
  break;
19371
19399
  case "workspace.initialized":
19372
- A += 1;
19400
+ R += 1;
19373
19401
  break;
19374
19402
  case "auth.device_flow.started":
19375
19403
  case "auth.device_flow.throttled":
@@ -19380,11 +19408,11 @@ function xi(e, t, o, s = !0) {
19380
19408
  break;
19381
19409
  }
19382
19410
  }
19383
- n + a + r + i + g + h + v + R + A + O === 0 && l.length === 0 || t((P) => {
19411
+ n + a + r + i + g + h + v + A + R + O === 0 && l.length === 0 || t((P) => {
19384
19412
  const q = o ? P.skillMutationsByCwd?.[o] ?? [] : [], H = new Set(q.map((x) => x.id)), J = l.filter(
19385
19413
  (x) => !H.has(x.id)
19386
19414
  );
19387
- return n + a + r + i + g + h + v + R + A + O === 0 && J.length === 0 ? P : {
19415
+ return n + a + r + i + g + h + v + A + R + O === 0 && J.length === 0 ? P : {
19388
19416
  memoryVersion: P.memoryVersion + n,
19389
19417
  agentsVersion: P.agentsVersion + a,
19390
19418
  toolsVersion: P.toolsVersion + r,
@@ -19393,7 +19421,7 @@ function xi(e, t, o, s = !0) {
19393
19421
  mcpVersion: P.mcpVersion + g,
19394
19422
  extensionsVersion: P.extensionsVersion + h,
19395
19423
  artifactsVersion: P.artifactsVersion + v,
19396
- sourcesVersion: (P.sourcesVersion ?? 0) + R,
19424
+ sourcesVersion: (P.sourcesVersion ?? 0) + A,
19397
19425
  ...J.length > 0 ? { lastSkillMutation: J.at(-1) } : P.lastSkillMutation ? { lastSkillMutation: P.lastSkillMutation } : {},
19398
19426
  ...J.length > 0 && o ? {
19399
19427
  skillMutationsByCwd: {
@@ -19402,7 +19430,7 @@ function xi(e, t, o, s = !0) {
19402
19430
  }
19403
19431
  } : P.skillMutationsByCwd ? { skillMutationsByCwd: P.skillMutationsByCwd } : {},
19404
19432
  ...U ? { lastExtensionChange: U } : {},
19405
- initVersion: P.initVersion + A,
19433
+ initVersion: P.initVersion + R,
19406
19434
  authVersion: P.authVersion + O
19407
19435
  };
19408
19436
  });
@@ -19570,11 +19598,11 @@ function Bm(e = {}) {
19570
19598
  ...a,
19571
19599
  autoLoad: !1,
19572
19600
  enabled: m
19573
- }), v = h.reload, R = Y(!1), U = Y(r), A = de(async () => (R.current = !0, v()), [v]), O = Y(A);
19574
- O.current = A, ut(() => {
19601
+ }), v = h.reload, A = Y(!1), U = Y(r), R = de(async () => (A.current = !0, v()), [v]), O = Y(R);
19602
+ O.current = R, ut(() => {
19575
19603
  const V = U.current !== r;
19576
- !m || a.autoLoad !== !0 && !(V && R.current) || (U.current = r, A());
19577
- }, [m, A, a.autoLoad, r]);
19604
+ !m || a.autoLoad !== !0 && !(V && A.current) || (U.current = r, R());
19605
+ }, [m, R, a.autoLoad, r]);
19578
19606
  const P = de(
19579
19607
  async (V) => {
19580
19608
  const y = await V();
@@ -19627,7 +19655,7 @@ function Bm(e = {}) {
19627
19655
  data: M ? { catalog: M.catalog, snapshot: M.snapshot } : void 0,
19628
19656
  loading: h.loading,
19629
19657
  error: h.error,
19630
- reload: A,
19658
+ reload: R,
19631
19659
  catalog: M?.catalog ?? [],
19632
19660
  snapshot: M?.snapshot,
19633
19661
  channels: M?.snapshot.instances ?? {},
@@ -19723,22 +19751,22 @@ function Hm(e = {}) {
19723
19751
  return t.manageMcpServer(h, v);
19724
19752
  if (v !== "enable" && v !== "disable")
19725
19753
  return r.manageRuntimeMcpServer(h, v);
19726
- const R = v === "disable" ? await r.mcpConfig() : void 0, U = v === "enable" ? ["user", "workspace"] : [
19727
- Object.hasOwn(R.user, h) && !Object.hasOwn(R.workspace, h) ? "user" : "workspace"
19754
+ const A = v === "disable" ? await r.mcpConfig() : void 0, U = v === "enable" ? ["user", "workspace"] : [
19755
+ Object.hasOwn(A.user, h) && !Object.hasOwn(A.workspace, h) ? "user" : "workspace"
19728
19756
  ];
19729
- let A;
19757
+ let R;
19730
19758
  for (const O of U) {
19731
19759
  const P = await (O === "user" ? o.setUserMcpServerEnabled(h, v === "enable") : r.setMcpServerEnabled(
19732
19760
  h,
19733
19761
  v === "enable"
19734
19762
  ));
19735
- P.changed !== void 0 && (A = (A ?? !1) || P.changed);
19763
+ P.changed !== void 0 && (R = (R ?? !1) || P.changed);
19736
19764
  }
19737
19765
  return {
19738
19766
  serverName: h,
19739
19767
  action: v,
19740
19768
  ok: !0,
19741
- ...A === void 0 ? {} : { changed: A }
19769
+ ...R === void 0 ? {} : { changed: R }
19742
19770
  };
19743
19771
  },
19744
19772
  addServer: (h) => r ? Promise.reject(
@@ -19751,9 +19779,9 @@ function Hm(e = {}) {
19751
19779
  "Runtime-only MCP servers are unavailable outside the primary workspace."
19752
19780
  )
19753
19781
  ) : t.removeRuntimeMcpServer(h),
19754
- setConfigServer: (h, v, R) => v === "workspace" && r ? r.setMcpServer(h, R) : t.setMcpServer(h, v, R),
19782
+ setConfigServer: (h, v, A) => v === "workspace" && r ? r.setMcpServer(h, A) : t.setMcpServer(h, v, A),
19755
19783
  removeConfigServer: (h, v) => v === "workspace" && r ? r.removeMcpServer(h) : t.removeMcpServer(h, v),
19756
- setConfigServerEnabled: (h, v, R) => v === "workspace" && r ? r.setMcpServerEnabled(h, R) : t.setMcpServerEnabled(h, v, R)
19784
+ setConfigServerEnabled: (h, v, A) => v === "workspace" && r ? r.setMcpServerEnabled(h, A) : t.setMcpServerEnabled(h, v, A)
19757
19785
  }),
19758
19786
  [t, o, r, s]
19759
19787
  );
@@ -19825,7 +19853,7 @@ function zm(e = {}) {
19825
19853
  ]), h = !!l.workspaceCwd, v = Ot(g, {
19826
19854
  ...i,
19827
19855
  enabled: (i.enabled ?? !0) && h
19828
- }), R = v.reload, U = de(async () => (await R())?.sessions, [R]), A = v.data, O = A?.sessions ?? [], P = de(
19856
+ }), A = v.reload, U = de(async () => (await A())?.sessions, [A]), R = v.data, O = R?.sessions ?? [], P = de(
19829
19857
  async (Z) => {
19830
19858
  const te = await l.actions.deleteSession(Z);
19831
19859
  return te && U(), te;
@@ -19855,12 +19883,12 @@ function zm(e = {}) {
19855
19883
  );
19856
19884
  return {
19857
19885
  ...v,
19858
- data: A !== void 0 ? O : void 0,
19886
+ data: R !== void 0 ? O : void 0,
19859
19887
  reload: U,
19860
19888
  sessions: O,
19861
- nextCursor: A?.nextCursor,
19862
- liveMergeFailed: A?.liveMergeFailed === !0,
19863
- truncated: A?.truncated === !0,
19889
+ nextCursor: R?.nextCursor,
19890
+ liveMergeFailed: R?.liveMergeFailed === !0,
19891
+ truncated: R?.truncated === !0,
19864
19892
  loadSession: m?.loadSession,
19865
19893
  resumeSession: m?.resumeSession,
19866
19894
  newSession: m?.newSession,
@@ -19877,7 +19905,7 @@ function zm(e = {}) {
19877
19905
  * Copyright 2025 Qwen Team
19878
19906
  * SPDX-License-Identifier: Apache-2.0
19879
19907
  */
19880
- const Ai = 5e3;
19908
+ const Ri = 5e3;
19881
19909
  function Ms(e) {
19882
19910
  if (e)
19883
19911
  throw new Error(
@@ -19888,25 +19916,25 @@ function Vm(e = {}) {
19888
19916
  const { actions: t, capabilities: o, client: s, workspaceCwd: n } = as(), { workspaceCwd: a, ...r } = e, i = a ?? n, l = nt(
19889
19917
  () => i ? s.workspaceByCwd(i) : void 0,
19890
19918
  [s, i]
19891
- ), [m, g] = rt(!1), [h, v] = rt(), R = o?.features.includes("workspace_skills_config_runtime") === !0, U = a !== void 0 && a !== n, A = de(() => {
19892
- if (!R)
19919
+ ), [m, g] = rt(!1), [h, v] = rt(), A = o?.features.includes("workspace_skills_config_runtime") === !0, U = a !== void 0 && a !== n, R = de(() => {
19920
+ if (!A)
19893
19921
  return Ms(U), t.loadSkillsStatus();
19894
19922
  if (!l) throw new Error("Workspace is unavailable.");
19895
19923
  return l.workspaceConfigSkills();
19896
19924
  }, [
19897
19925
  t,
19898
19926
  U,
19899
- R,
19927
+ A,
19900
19928
  l
19901
19929
  ]), O = de(() => {
19902
19930
  if (!l) throw new Error("Workspace is unavailable.");
19903
19931
  return l.workspaceRuntimeSkills();
19904
- }, [l]), P = Ot(A, r), q = Ot(O, {
19932
+ }, [l]), P = Ot(R, r), q = Ot(O, {
19905
19933
  ...r,
19906
19934
  autoLoad: !1,
19907
- enabled: r.enabled !== !1 && R
19935
+ enabled: r.enabled !== !1 && A
19908
19936
  }), H = P.reload, J = q.reload, [x, Z] = rt(), te = de(async () => {
19909
- if (!(!R || !l)) {
19937
+ if (!(!A || !l)) {
19910
19938
  g(!0), v(void 0);
19911
19939
  try {
19912
19940
  const B = await l.ensureRuntime();
@@ -19922,9 +19950,9 @@ function Vm(e = {}) {
19922
19950
  g(!1);
19923
19951
  }
19924
19952
  }
19925
- }, [J, R, l]);
19953
+ }, [J, A, l]);
19926
19954
  ut(() => {
19927
- if (!R || !l || !x)
19955
+ if (!A || !l || !x)
19928
19956
  return;
19929
19957
  let B = !1, G;
19930
19958
  const pe = async () => {
@@ -19942,19 +19970,19 @@ function Vm(e = {}) {
19942
19970
  if (oe.runtimeLive && oe.runtimeEpoch !== x.runtimeEpoch)
19943
19971
  Le(), await te();
19944
19972
  else if (se?.state === "ready" && se.runtimeEpoch === oe.runtimeEpoch) {
19945
- const [st, Re] = await Promise.all([
19973
+ const [st, Ae] = await Promise.all([
19946
19974
  H(),
19947
19975
  J()
19948
19976
  ]);
19949
- !B && st && Re && Le();
19977
+ !B && st && Ae && Le();
19950
19978
  } else
19951
19979
  Le();
19952
19980
  } catch {
19953
19981
  } finally {
19954
- B || (G = setTimeout(pe, Ai));
19982
+ B || (G = setTimeout(pe, Ri));
19955
19983
  }
19956
19984
  };
19957
- return G = setTimeout(pe, Ai), () => {
19985
+ return G = setTimeout(pe, Ri), () => {
19958
19986
  B = !0, G && clearTimeout(G);
19959
19987
  };
19960
19988
  }, [
@@ -19965,10 +19993,10 @@ function Vm(e = {}) {
19965
19993
  q.data?.initialized,
19966
19994
  q.data?.runtimeEpoch,
19967
19995
  q.error,
19968
- R,
19996
+ A,
19969
19997
  l
19970
19998
  ]);
19971
- const M = R && x?.capabilities?.skills?.state === "ready" && x.capabilities.skills.runtimeEpoch === x.runtimeEpoch && q.data?.initialized === !0 && q.data.runtimeEpoch === x.runtimeEpoch, ke = nt(() => {
19999
+ const M = A && x?.capabilities?.skills?.state === "ready" && x.capabilities.skills.runtimeEpoch === x.runtimeEpoch && q.data?.initialized === !0 && q.data.runtimeEpoch === x.runtimeEpoch, ke = nt(() => {
19972
20000
  const B = P.data?.skills ?? [];
19973
20001
  if (!M) return B;
19974
20002
  const G = new Map(
@@ -19986,13 +20014,13 @@ function Vm(e = {}) {
19986
20014
  }) : oe;
19987
20015
  }), ...G.values()];
19988
20016
  }, [P.data?.skills, q.data?.skills, M]), V = de(async () => {
19989
- if (!R) return await H();
20017
+ if (!A) return await H();
19990
20018
  const [B, G] = await Promise.all([
19991
20019
  H(),
19992
20020
  te()
19993
20021
  ]);
19994
20022
  return G ?? B;
19995
- }, [te, H, R]), y = zo(), W = y ? y.settingsVersion + y.extensionsVersion + y.skillsVersion : void 0;
20023
+ }, [te, H, A]), y = zo(), W = y ? y.settingsVersion + y.extensionsVersion + y.skillsVersion : void 0;
19996
20024
  return ko(W, H, P.data !== void 0), ko(W, J, q.data !== void 0), {
19997
20025
  data: P.data ?? q.data,
19998
20026
  status: P.data ?? q.data,
@@ -20001,13 +20029,13 @@ function Vm(e = {}) {
20001
20029
  skills: ke,
20002
20030
  loading: P.loading || m && P.data === void 0,
20003
20031
  preparing: m,
20004
- error: P.error ?? (R ? h ?? q.error : void 0),
20032
+ error: P.error ?? (A ? h ?? q.error : void 0),
20005
20033
  reload: V,
20006
20034
  reloadConfig: H,
20007
20035
  reloadRuntime: J,
20008
20036
  ensureRuntime: te,
20009
20037
  setEnabled: async (B, G, pe) => {
20010
- if (!R)
20038
+ if (!A)
20011
20039
  return Ms(U), await t.setWorkspaceSkillEnabled(B, G);
20012
20040
  if (!l) throw new Error("Workspace is unavailable.");
20013
20041
  const oe = await l.setWorkspaceConfigSkillEnabled(
@@ -20018,7 +20046,7 @@ function Vm(e = {}) {
20018
20046
  return await te(), oe;
20019
20047
  },
20020
20048
  install: async (B) => {
20021
- if (!R)
20049
+ if (!A)
20022
20050
  return Ms(U), await t.installWorkspaceSkill(B);
20023
20051
  let G;
20024
20052
  if (B.scope === "global")
@@ -20036,7 +20064,7 @@ function Vm(e = {}) {
20036
20064
  return await te(), G;
20037
20065
  },
20038
20066
  remove: async (B, G) => {
20039
- if (!R)
20067
+ if (!A)
20040
20068
  return Ms(U), await t.deleteWorkspaceSkill(B, G);
20041
20069
  let pe;
20042
20070
  if (G === "global")
@@ -20152,7 +20180,7 @@ function Xm(e = {}) {
20152
20180
  * Copyright 2025 Qwen Team
20153
20181
  * SPDX-License-Identifier: Apache-2.0
20154
20182
  */
20155
- const Ap = 300, Rp = 100, xn = Object.freeze({
20183
+ const Rp = 300, Ap = 100, xn = Object.freeze({
20156
20184
  suggestion: null,
20157
20185
  isVisible: !1,
20158
20186
  shownAt: 0
@@ -20176,7 +20204,7 @@ function Pp(e) {
20176
20204
  }
20177
20205
  t && (r = setTimeout(() => {
20178
20206
  m({ suggestion: O, isVisible: !0, shownAt: Date.now() });
20179
- }, Ap));
20207
+ }, Rp));
20180
20208
  }, accept: (O, P) => {
20181
20209
  if (i) return;
20182
20210
  r && (clearTimeout(r), r = null), i = !0;
@@ -20203,7 +20231,7 @@ function Pp(e) {
20203
20231
  } finally {
20204
20232
  l && clearTimeout(l), l = setTimeout(() => {
20205
20233
  i = !1;
20206
- }, Rp);
20234
+ }, Ap);
20207
20235
  }
20208
20236
  });
20209
20237
  }, dismiss: () => {
@@ -20239,7 +20267,7 @@ function Zm(e = {}) {
20239
20267
  Fd,
20240
20268
  Qr,
20241
20269
  Qr
20242
- ), v = h?.sessionId === a ? h : g, R = nt(
20270
+ ), v = h?.sessionId === a ? h : g, A = nt(
20243
20271
  () => Pp({
20244
20272
  enabled: t,
20245
20273
  onStateChange: i,
@@ -20247,26 +20275,26 @@ function Zm(e = {}) {
20247
20275
  getOnOutcome: () => m.current
20248
20276
  }),
20249
20277
  [t]
20250
- ), { setSuggestion: U } = R;
20251
- ut(() => (t || R.clear(), () => R.cleanup()), [R, t]);
20252
- const A = Y(void 0), O = Y(a);
20278
+ ), { setSuggestion: U } = A;
20279
+ ut(() => (t || A.clear(), () => A.cleanup()), [A, t]);
20280
+ const R = Y(void 0), O = Y(a);
20253
20281
  ut(() => {
20254
20282
  const J = O.current;
20255
- O.current = a, J !== void 0 && a !== void 0 && J !== a && (R.clear(), Cs(), A.current = void 0);
20256
- }, [R, a]), ut(() => {
20283
+ O.current = a, J !== void 0 && a !== void 0 && J !== a && (A.clear(), Cs(), R.current = void 0);
20284
+ }, [A, a]), ut(() => {
20257
20285
  const J = v?.promptId;
20258
- J !== A.current && (A.current = J, U(v?.suggestion ?? null));
20286
+ J !== R.current && (R.current = J, U(v?.suggestion ?? null));
20259
20287
  }, [v, U]);
20260
20288
  const P = de(() => {
20261
- R.clear(), _a(n), Cs(), A.current = void 0;
20262
- }, [R, n]), q = de(
20289
+ A.clear(), _a(n), Cs(), R.current = void 0;
20290
+ }, [A, n]), q = de(
20263
20291
  (J, x) => {
20264
- R.accept(J, x), _a(n), Cs(), A.current = void 0;
20292
+ A.accept(J, x), _a(n), Cs(), R.current = void 0;
20265
20293
  },
20266
- [R, n]
20294
+ [A, n]
20267
20295
  ), H = de(() => {
20268
- R.dismiss(), _a(n), Cs(), A.current = void 0;
20269
- }, [R, n]);
20296
+ A.dismiss(), _a(n), Cs(), R.current = void 0;
20297
+ }, [A, n]);
20270
20298
  return nt(
20271
20299
  () => ({
20272
20300
  followupState: r,
@@ -20308,7 +20336,7 @@ export {
20308
20336
  Xm as B,
20309
20337
  Ot as C,
20310
20338
  sp as D,
20311
- Rm as E,
20339
+ Am as E,
20312
20340
  Fm as F,
20313
20341
  zm as G,
20314
20342
  Jm as H,
@@ -20331,7 +20359,7 @@ export {
20331
20359
  um as Y,
20332
20360
  Gu as Z,
20333
20361
  gm as _,
20334
- Am as a,
20362
+ Rm as a,
20335
20363
  Cm as a$,
20336
20364
  Lu as a0,
20337
20365
  Qi as a1,
@@ -20376,7 +20404,7 @@ export {
20376
20404
  Up as ad,
20377
20405
  ad as ae,
20378
20406
  ll as af,
20379
- Rn as ag,
20407
+ An as ag,
20380
20408
  vm as ah,
20381
20409
  Im as ai,
20382
20410
  Gd as aj,