@tangle-network/agent-app 0.60.221 → 0.60.223

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.
Files changed (42) hide show
  1. package/dist/assistant/index.js +3 -2
  2. package/dist/assistant/index.js.map +1 -1
  3. package/dist/chat-react/index.js +2 -1
  4. package/dist/chat-routes/hybrid-producer.d.ts +93 -0
  5. package/dist/chat-routes/index.d.ts +1 -0
  6. package/dist/chat-routes/index.js +116 -3
  7. package/dist/chat-routes/index.js.map +1 -1
  8. package/dist/chat-routes/router-producer.d.ts +3 -1
  9. package/dist/{chunk-A5DGO2XT.js → chunk-2JY3SQD2.js} +2 -2
  10. package/dist/{chunk-KNTRS7OZ.js → chunk-BQILMP73.js} +70 -115
  11. package/dist/chunk-BQILMP73.js.map +1 -0
  12. package/dist/{chunk-2XUIWCRW.js → chunk-DA5XLDZR.js} +7 -2
  13. package/dist/chunk-DA5XLDZR.js.map +1 -0
  14. package/dist/{chunk-DMXEPYB5.js → chunk-HDY72UBR.js} +12 -7
  15. package/dist/chunk-HDY72UBR.js.map +1 -0
  16. package/dist/chunk-OXUBZ5SE.js +54 -0
  17. package/dist/chunk-OXUBZ5SE.js.map +1 -0
  18. package/dist/{chunk-N7WTF5P2.js → chunk-XWJDF34U.js} +10 -2
  19. package/dist/chunk-XWJDF34U.js.map +1 -0
  20. package/dist/{chunk-C7WAGXQN.js → chunk-YS2RYZQG.js} +9 -8
  21. package/dist/{chunk-C7WAGXQN.js.map → chunk-YS2RYZQG.js.map} +1 -1
  22. package/dist/public-consultation/index.d.ts +1 -1
  23. package/dist/runtime/index.js +2 -2
  24. package/dist/runtime/router-turn.d.ts +16 -4
  25. package/dist/runtime/router-turn.js +1 -1
  26. package/dist/sandbox/escalation-speculator.d.ts +15 -27
  27. package/dist/sandbox/index.js +1 -3
  28. package/dist/sandbox/sandbox-run-tool.d.ts +4 -3
  29. package/dist/signoff/cli.js +1 -1
  30. package/dist/signoff/index.js +1 -1
  31. package/dist/web-react/chat-composer.d.ts +2 -1
  32. package/dist/web-react/index.js +10 -4
  33. package/dist/web-react/workspace-prewarm.d.ts +7 -0
  34. package/dist/workspace-react/index.d.ts +9 -1
  35. package/dist/workspace-react/index.js +8 -2
  36. package/dist/workspace-react/index.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-2XUIWCRW.js.map +0 -1
  39. package/dist/chunk-DMXEPYB5.js.map +0 -1
  40. package/dist/chunk-KNTRS7OZ.js.map +0 -1
  41. package/dist/chunk-N7WTF5P2.js.map +0 -1
  42. /package/dist/{chunk-A5DGO2XT.js.map → chunk-2JY3SQD2.js.map} +0 -0
@@ -8,10 +8,12 @@
8
8
  * `stream` generator drains in order, so a slow consumer never drops a frame
9
9
  * and the engine never waits on the consumer.
10
10
  */
11
- import { type RouterTurnOptions, type RouterTurnOutcome } from '../runtime/router-turn';
11
+ import { type RouterTurnEvent, type RouterTurnOptions, type RouterTurnOutcome } from '../runtime/router-turn';
12
12
  import type { ChatTurnRouteProducer } from './turn-routes';
13
13
  export type RouterTurnProducerOptions = Omit<RouterTurnOptions, 'onEvent'> & {
14
14
  /** Observe the finished turn (placement records, metrics, billing). */
15
15
  onOutcome?: (outcome: RouterTurnOutcome) => void;
16
+ /** Observe each engine event after the producer has projected it (a box speculator, metrics). A throw is ignored. */
17
+ onEvent?: (event: RouterTurnEvent) => void;
16
18
  };
17
19
  export declare function createRouterTurnProducer(options: RouterTurnProducerOptions): ChatTurnRouteProducer;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRouterTurn
3
- } from "./chunk-DMXEPYB5.js";
3
+ } from "./chunk-HDY72UBR.js";
4
4
 
5
5
  // src/runtime/protected-model.ts
6
6
  import {
@@ -219,4 +219,4 @@ export {
219
219
  createRouterProtectedModelPort,
220
220
  runProtectedRouterTurn
221
221
  };
222
- //# sourceMappingURL=chunk-A5DGO2XT.js.map
222
+ //# sourceMappingURL=chunk-2JY3SQD2.js.map
@@ -61,7 +61,7 @@ import {
61
61
  } from "./chunk-LQYIBL3G.js";
62
62
 
63
63
  // src/web-react/index.tsx
64
- import { useEffect as useEffect16, useMemo as useMemo8, useRef as useRef15, useState as useState22, memo } from "react";
64
+ import { useEffect as useEffect15, useMemo as useMemo8, useRef as useRef15, useState as useState22, memo } from "react";
65
65
  import { isViewerMessage, MessageAuthor, TRANSCRIPT_TEXT } from "@tangle-network/ui/chat";
66
66
  import { TerminalDisplay, TerminalLine } from "@tangle-network/ui/primitives";
67
67
  import { InlineToolItem } from "@tangle-network/ui/run";
@@ -1775,49 +1775,6 @@ async function streamChatTurn(opts) {
1775
1775
  }
1776
1776
  }
1777
1777
 
1778
- // src/web-react/workspace-prewarm.ts
1779
- import { useCallback as useCallback3, useEffect as useEffect7 } from "react";
1780
- var DEFAULT_MIN_INTERVAL_MS = 6e4;
1781
- var lastSent = /* @__PURE__ */ new Map();
1782
- var inFlight = /* @__PURE__ */ new Set();
1783
- function documentIsVisible() {
1784
- if (typeof document === "undefined") return false;
1785
- if (document.prerendering) return false;
1786
- return document.visibilityState === "visible";
1787
- }
1788
- function requestWorkspacePrewarm(url, options = {}) {
1789
- if (!url || !documentIsVisible() || inFlight.has(url)) return false;
1790
- const now = Date.now();
1791
- const last = lastSent.get(url);
1792
- if (last !== void 0 && now - last < (options.minIntervalMs ?? DEFAULT_MIN_INTERVAL_MS)) return false;
1793
- lastSent.set(url, now);
1794
- inFlight.add(url);
1795
- void fetch(url, {
1796
- method: "POST",
1797
- credentials: "same-origin",
1798
- headers: { "content-type": "application/json" },
1799
- body: JSON.stringify({ reason: options.reason ?? "page-open" })
1800
- }).then((response) => response.body?.cancel()).catch(() => void 0).finally(() => inFlight.delete(url));
1801
- return true;
1802
- }
1803
- function useWorkspacePrewarm(options) {
1804
- const { url, enabled = true, minIntervalMs } = options;
1805
- const active = enabled && Boolean(url);
1806
- useEffect7(() => {
1807
- if (!active || !url || typeof document === "undefined") return;
1808
- const fire = () => {
1809
- requestWorkspacePrewarm(url, { minIntervalMs });
1810
- };
1811
- fire();
1812
- document.addEventListener("visibilitychange", fire);
1813
- return () => document.removeEventListener("visibilitychange", fire);
1814
- }, [active, url, minIntervalMs]);
1815
- const reassert = useCallback3(() => {
1816
- if (active && url) requestWorkspacePrewarm(url, { minIntervalMs, reason: "composer-focus" });
1817
- }, [active, url, minIntervalMs]);
1818
- return { reassert };
1819
- }
1820
-
1821
1778
  // src/web-react/turn-funding-recovery.ts
1822
1779
  function getChatFundingRecovery(failure) {
1823
1780
  const code = typeof failure === "object" && failure ? failure.code : void 0;
@@ -2101,7 +2058,7 @@ function AgentProfileViewer({ profile, className = "", showFullProfile = false,
2101
2058
  }
2102
2059
 
2103
2060
  // src/web-react/durable-plan-flow.ts
2104
- import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef7, useState as useState11 } from "react";
2061
+ import { useCallback as useCallback3, useEffect as useEffect7, useRef as useRef7, useState as useState11 } from "react";
2105
2062
  var DurablePlanClientError = class extends Error {
2106
2063
  constructor(message, status, code, currentPlan) {
2107
2064
  super(message);
@@ -2194,8 +2151,8 @@ function useDurablePlanFlow(options) {
2194
2151
  const [error, setError] = useState11(null);
2195
2152
  const attachments = useRef7(/* @__PURE__ */ new Map());
2196
2153
  const decisionInFlight = useRef7(false);
2197
- useEffect8(() => setPlan(options.plan), [options.plan]);
2198
- const apply = useCallback4(async (result) => {
2154
+ useEffect7(() => setPlan(options.plan), [options.plan]);
2155
+ const apply = useCallback3(async (result) => {
2199
2156
  setPlan(result.plan);
2200
2157
  options.onUpdated?.(result.plan);
2201
2158
  const receipt = result.followUp;
@@ -2208,7 +2165,7 @@ function useDurablePlanFlow(options) {
2208
2165
  }
2209
2166
  await pending;
2210
2167
  }, [options.attachFollowUp, options.onUpdated]);
2211
- const decide = useCallback4(async (decision, feedback) => {
2168
+ const decide = useCallback3(async (decision, feedback) => {
2212
2169
  if (decisionInFlight.current) return null;
2213
2170
  decisionInFlight.current = true;
2214
2171
  setDeciding(decision);
@@ -2234,7 +2191,7 @@ function useDurablePlanFlow(options) {
2234
2191
  setDeciding(null);
2235
2192
  }
2236
2193
  }, [apply, options.client, options.onUpdated, plan.planId, plan.revision]);
2237
- const restore = useCallback4(async () => {
2194
+ const restore = useCallback3(async () => {
2238
2195
  setRestoring(true);
2239
2196
  setError(null);
2240
2197
  try {
@@ -2363,7 +2320,7 @@ function createDurableInteractionAnswerSubmitter(options) {
2363
2320
  }
2364
2321
 
2365
2322
  // src/web-react/use-chat-interactions.ts
2366
- import { useCallback as useCallback5, useMemo as useMemo4, useState as useState12 } from "react";
2323
+ import { useCallback as useCallback4, useMemo as useMemo4, useState as useState12 } from "react";
2367
2324
  function hasPendingContentDuplicate(list, interaction) {
2368
2325
  if (interaction.status !== "pending") return false;
2369
2326
  const signature = questionInteractionContentSignature(interaction);
@@ -2443,33 +2400,33 @@ function hydrateChatInteractions(list, persisted) {
2443
2400
  }
2444
2401
  function useChatInteractions(options = {}) {
2445
2402
  const [interactions, setInteractions] = useState12([]);
2446
- const upsert = useCallback5((interaction) => {
2403
+ const upsert = useCallback4((interaction) => {
2447
2404
  setInteractions((prev) => upsertChatInteraction(prev, interaction));
2448
2405
  }, []);
2449
- const applyCancel = useCallback5((cancel) => {
2406
+ const applyCancel = useCallback4((cancel) => {
2450
2407
  setInteractions((prev) => cancelChatInteraction(prev, cancel));
2451
2408
  }, []);
2452
- const markResolved = useCallback5((id, status, answers) => {
2409
+ const markResolved = useCallback4((id, status, answers) => {
2453
2410
  setInteractions((prev) => resolveChatInteraction(prev, id, status, answers));
2454
2411
  }, []);
2455
- const restore = useCallback5((outstanding, restoreOptions) => {
2412
+ const restore = useCallback4((outstanding, restoreOptions) => {
2456
2413
  setInteractions((prev) => restoreChatInteractions(prev, outstanding, {
2457
2414
  mode: restoreOptions?.mode ?? options.mode
2458
2415
  }));
2459
2416
  }, [options.mode]);
2460
- const hydrate = useCallback5((persisted) => {
2417
+ const hydrate = useCallback4((persisted) => {
2461
2418
  setInteractions((prev) => hydrateChatInteractions(prev, persisted));
2462
2419
  }, []);
2463
- const terminalizePending = useCallback5((status) => {
2420
+ const terminalizePending = useCallback4((status) => {
2464
2421
  setInteractions((prev) => terminalizePendingChatInteractions(prev, status));
2465
2422
  }, []);
2466
- const reset = useCallback5(() => setInteractions([]), []);
2423
+ const reset = useCallback4(() => setInteractions([]), []);
2467
2424
  const pending = useMemo4(() => interactions.filter((item) => item.status === "pending"), [interactions]);
2468
2425
  return { interactions, pending, upsert, applyCancel, markResolved, restore, hydrate, terminalizePending, reset };
2469
2426
  }
2470
2427
 
2471
2428
  // src/web-react/use-file-mentions.ts
2472
- import { useCallback as useCallback6, useMemo as useMemo5, useRef as useRef8, useState as useState13 } from "react";
2429
+ import { useCallback as useCallback5, useMemo as useMemo5, useRef as useRef8, useState as useState13 } from "react";
2473
2430
  var FILE_MENTION_KIND = "file";
2474
2431
  function toMentionItem(file) {
2475
2432
  return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
@@ -2532,7 +2489,7 @@ function useFileMentions(options) {
2532
2489
  stateRef.current = state;
2533
2490
  const inFlightRef = useRef8(null);
2534
2491
  const [mentions, setMentions] = useState13([]);
2535
- const load = useCallback6(() => {
2492
+ const load = useCallback5(() => {
2536
2493
  if (inFlightRef.current) return inFlightRef.current;
2537
2494
  if (stateRef.current.kind === "idle") {
2538
2495
  stateRef.current = { kind: "loading" };
@@ -2564,10 +2521,10 @@ function useFileMentions(options) {
2564
2521
  inFlightRef.current = attempt;
2565
2522
  return attempt;
2566
2523
  }, [fetchImpl, indexUrl]);
2567
- const refresh = useCallback6(async () => {
2524
+ const refresh = useCallback5(async () => {
2568
2525
  await load();
2569
2526
  }, [load]);
2570
- const fetchItems = useCallback6(
2527
+ const fetchItems = useCallback5(
2571
2528
  async (query) => {
2572
2529
  let current = stateRef.current;
2573
2530
  if (current.kind === "idle" || current.kind === "loading") {
@@ -2582,10 +2539,10 @@ function useFileMentions(options) {
2582
2539
  },
2583
2540
  [load, limit, refreshAfterMs]
2584
2541
  );
2585
- const onMentionsChange = useCallback6((items) => {
2542
+ const onMentionsChange = useCallback5((items) => {
2586
2543
  setMentions(items.filter((item) => item.kind === void 0 || item.kind === FILE_MENTION_KIND).map(toFileMention));
2587
2544
  }, []);
2588
- const clearMentions = useCallback6(() => setMentions([]), []);
2545
+ const clearMentions = useCallback5(() => setMentions([]), []);
2589
2546
  const mention = useMemo5(
2590
2547
  () => ({
2591
2548
  fetchItems,
@@ -2638,7 +2595,7 @@ function segmentMentionContent(content, parts) {
2638
2595
  }
2639
2596
 
2640
2597
  // src/web-react/mission-activity.tsx
2641
- import { useCallback as useCallback7, useEffect as useEffect9, useState as useState14 } from "react";
2598
+ import { useCallback as useCallback6, useEffect as useEffect8, useState as useState14 } from "react";
2642
2599
  import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2643
2600
  var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
2644
2601
  var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
@@ -2699,7 +2656,7 @@ function CopyGlyph({ className }) {
2699
2656
  }
2700
2657
  function TraceIdCopy({ traceId }) {
2701
2658
  const [copied, setCopied] = useState14(false);
2702
- const copy = useCallback7(() => {
2659
+ const copy = useCallback6(() => {
2703
2660
  void navigator.clipboard?.writeText(traceId).then(
2704
2661
  () => {
2705
2662
  setCopied(true);
@@ -2868,7 +2825,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
2868
2825
  const [cursor, setCursor] = useState14(void 0);
2869
2826
  const [status, setStatus] = useState14("loading");
2870
2827
  const [error, setError] = useState14(null);
2871
- const load = useCallback7(
2828
+ const load = useCallback6(
2872
2829
  async (from) => {
2873
2830
  setStatus("loading");
2874
2831
  setError(null);
@@ -2884,7 +2841,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
2884
2841
  },
2885
2842
  [fetchActivity]
2886
2843
  );
2887
- useEffect9(() => {
2844
+ useEffect8(() => {
2888
2845
  void load();
2889
2846
  }, [load]);
2890
2847
  const loading = status === "loading";
@@ -2921,7 +2878,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
2921
2878
  }
2922
2879
 
2923
2880
  // src/web-react/provenance.tsx
2924
- import { useCallback as useCallback8, useEffect as useEffect10, useId, useRef as useRef9, useState as useState15 } from "react";
2881
+ import { useCallback as useCallback7, useEffect as useEffect9, useId, useRef as useRef9, useState as useState15 } from "react";
2925
2882
 
2926
2883
  // src/web-react/provenance-model.ts
2927
2884
  var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
@@ -3227,7 +3184,7 @@ function ProvenanceValue({
3227
3184
  const sources = record.sources ?? [];
3228
3185
  const inputs = record.inputs ?? [];
3229
3186
  const hasValue = record.display.trim() !== "";
3230
- const onKeyDown = useCallback8(
3187
+ const onKeyDown = useCallback7(
3231
3188
  (event) => {
3232
3189
  if (event.key !== "Escape" || !open) return;
3233
3190
  event.stopPropagation();
@@ -3236,11 +3193,11 @@ function ProvenanceValue({
3236
3193
  },
3237
3194
  [open]
3238
3195
  );
3239
- const onToggle = useCallback8(() => {
3196
+ const onToggle = useCallback7(() => {
3240
3197
  if (!open) closeTrailsOutside(rootRef.current);
3241
3198
  setOpen(!open);
3242
3199
  }, [open]);
3243
- useEffect10(() => {
3200
+ useEffect9(() => {
3244
3201
  const root = rootRef.current;
3245
3202
  if (!open || root === null) return;
3246
3203
  const entry = { root, close: () => setOpen(false) };
@@ -3498,8 +3455,8 @@ function SeatPaywall({
3498
3455
  import {
3499
3456
  Fragment as Fragment4,
3500
3457
  isValidElement,
3501
- useCallback as useCallback9,
3502
- useEffect as useEffect11,
3458
+ useCallback as useCallback8,
3459
+ useEffect as useEffect10,
3503
3460
  useId as useId2,
3504
3461
  useMemo as useMemo6,
3505
3462
  useRef as useRef10,
@@ -3937,12 +3894,12 @@ function RecordGrid({
3937
3894
  const settling = useRef10(false);
3938
3895
  const draftCounter = useRef10(0);
3939
3896
  const editingRef = useRef10(null);
3940
- const setEditing = useCallback9((next) => {
3897
+ const setEditing = useCallback8((next) => {
3941
3898
  editingRef.current = next;
3942
3899
  setEditingState(next);
3943
3900
  }, []);
3944
3901
  const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
3945
- useEffect11(() => {
3902
+ useEffect10(() => {
3946
3903
  setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
3947
3904
  }, [callerRows]);
3948
3905
  const visibleRows = useMemo6(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
@@ -3969,7 +3926,7 @@ function RecordGrid({
3969
3926
  if (!columns.some((column) => column.id === focus.columnId)) return null;
3970
3927
  return focus;
3971
3928
  }, [columns, focus, visibleRows]);
3972
- const setCellError = useCallback9((key, message) => {
3929
+ const setCellError = useCallback8((key, message) => {
3973
3930
  setCellErrors((current) => {
3974
3931
  if (message === null) {
3975
3932
  if (!(key in current)) return current;
@@ -3981,7 +3938,7 @@ function RecordGrid({
3981
3938
  return { ...current, [key]: message };
3982
3939
  });
3983
3940
  }, []);
3984
- const setRowError = useCallback9((rowId, message) => {
3941
+ const setRowError = useCallback8((rowId, message) => {
3985
3942
  setRowErrors((current) => {
3986
3943
  if (message === null) {
3987
3944
  if (!(rowId in current)) return current;
@@ -3992,7 +3949,7 @@ function RecordGrid({
3992
3949
  return { ...current, [rowId]: message };
3993
3950
  });
3994
3951
  }, []);
3995
- const setRowPending = useCallback9((rowId, pending) => {
3952
+ const setRowPending = useCallback8((rowId, pending) => {
3996
3953
  setPendingRows((current) => {
3997
3954
  if (pending) return rowId in current ? current : { ...current, [rowId]: true };
3998
3955
  if (!(rowId in current)) return current;
@@ -4001,11 +3958,11 @@ function RecordGrid({
4001
3958
  return next;
4002
3959
  });
4003
3960
  }, []);
4004
- const focusCell = useCallback9((rowId, columnId) => {
3961
+ const focusCell = useCallback8((rowId, columnId) => {
4005
3962
  setFocus({ rowId, columnId });
4006
3963
  cellRefs.current.get(cellKey(rowId, columnId))?.focus();
4007
3964
  }, []);
4008
- const beginEdit = useCallback9(
3965
+ const beginEdit = useCallback8(
4009
3966
  (row, column) => {
4010
3967
  setCellError(cellKey(row.id, column.id), null);
4011
3968
  setEditing({
@@ -4016,7 +3973,7 @@ function RecordGrid({
4016
3973
  },
4017
3974
  [setCellError, setEditing]
4018
3975
  );
4019
- const applyCellWrite = useCallback9(
3976
+ const applyCellWrite = useCallback8(
4020
3977
  async (row, column, value) => {
4021
3978
  if (!onUpdate) return;
4022
3979
  const values = { ...row.values, [column.id]: value };
@@ -4044,7 +4001,7 @@ function RecordGrid({
4044
4001
  },
4045
4002
  [locale, onUpdate, setRowError, setRowPending]
4046
4003
  );
4047
- const commitEdit = useCallback9(
4004
+ const commitEdit = useCallback8(
4048
4005
  async (row, column, text) => {
4049
4006
  const open = editingRef.current;
4050
4007
  if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
@@ -4068,7 +4025,7 @@ function RecordGrid({
4068
4025
  },
4069
4026
  [applyCellWrite, setCellError, setEditing]
4070
4027
  );
4071
- const cancelEdit = useCallback9(
4028
+ const cancelEdit = useCallback8(
4072
4029
  (row, column) => {
4073
4030
  setCellError(cellKey(row.id, column.id), null);
4074
4031
  setEditing(null);
@@ -4076,7 +4033,7 @@ function RecordGrid({
4076
4033
  },
4077
4034
  [focusCell, setCellError, setEditing]
4078
4035
  );
4079
- const performDelete = useCallback9(
4036
+ const performDelete = useCallback8(
4080
4037
  async (row) => {
4081
4038
  if (!onDelete) return;
4082
4039
  setConfirmDelete(null);
@@ -4094,16 +4051,16 @@ function RecordGrid({
4094
4051
  },
4095
4052
  [columns, onDelete, setRowError]
4096
4053
  );
4097
- const resetDraft = useCallback9(() => {
4054
+ const resetDraft = useCallback8(() => {
4098
4055
  setDraft({ ...newRowDefaults ?? {} });
4099
4056
  setDraftErrors({});
4100
4057
  setDraftError(null);
4101
4058
  }, [newRowDefaults]);
4102
- const openAdd = useCallback9(() => {
4059
+ const openAdd = useCallback8(() => {
4103
4060
  resetDraft();
4104
4061
  setAdding(true);
4105
4062
  }, [resetDraft]);
4106
- const submitDraft = useCallback9(async () => {
4063
+ const submitDraft = useCallback8(async () => {
4107
4064
  if (!onCreate) return;
4108
4065
  const validated = validateRecordGridRow(columns, draft);
4109
4066
  if (!validated.succeeded) {
@@ -4133,7 +4090,7 @@ function RecordGrid({
4133
4090
  setOverlay((current) => withoutRecordGridCreated(current, draftId));
4134
4091
  setDraftError(outcome.error);
4135
4092
  }, [columns, draft, fieldPrefix, onCreate, resetDraft]);
4136
- const handleGridKeyDown = useCallback9(
4093
+ const handleGridKeyDown = useCallback8(
4137
4094
  (event) => {
4138
4095
  if (editing !== null) return;
4139
4096
  const target = event.target;
@@ -4672,7 +4629,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4672
4629
  }
4673
4630
  function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
4674
4631
  const basis = source.basis ?? "asserted";
4675
- const setOpen = useCallback9(
4632
+ const setOpen = useCallback8(
4676
4633
  (next) => {
4677
4634
  if (!next) onToggle();
4678
4635
  },
@@ -4919,8 +4876,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4919
4876
 
4920
4877
  // src/web-react/command-palette.tsx
4921
4878
  import {
4922
- useCallback as useCallback10,
4923
- useEffect as useEffect12,
4879
+ useCallback as useCallback9,
4880
+ useEffect as useEffect11,
4924
4881
  useId as useId3,
4925
4882
  useMemo as useMemo7,
4926
4883
  useRef as useRef11,
@@ -4950,7 +4907,7 @@ function CommandPalette({
4950
4907
  }) {
4951
4908
  const [internalOpen, setInternalOpen] = useState17(false);
4952
4909
  const open = controlledOpen ?? internalOpen;
4953
- const setOpen = useCallback10(
4910
+ const setOpen = useCallback9(
4954
4911
  (next) => {
4955
4912
  if (controlledOpen === void 0) setInternalOpen(next);
4956
4913
  onOpenChange?.(next);
@@ -4966,7 +4923,7 @@ function CommandPalette({
4966
4923
  const sections = useMemo7(() => groupCommandPaletteItems(flat), [flat]);
4967
4924
  const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
4968
4925
  const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
4969
- useEffect12(() => {
4926
+ useEffect11(() => {
4970
4927
  if (!hotkey) return;
4971
4928
  function onKeyDown(e) {
4972
4929
  if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
@@ -4978,17 +4935,17 @@ function CommandPalette({
4978
4935
  return () => document.removeEventListener("keydown", onKeyDown);
4979
4936
  }, [hotkey, open, setOpen]);
4980
4937
  const restoreFocusRef = useRef11(null);
4981
- useEffect12(() => {
4938
+ useEffect11(() => {
4982
4939
  if (open) return;
4983
4940
  setQuery(initialQuery ?? "");
4984
4941
  onQueryChange?.(initialQuery ?? "");
4985
4942
  setActive(0);
4986
4943
  }, [open]);
4987
- useEffect12(() => {
4944
+ useEffect11(() => {
4988
4945
  if (!open || !activeId) return;
4989
4946
  document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
4990
4947
  }, [open, activeId]);
4991
- const choose = useCallback10(
4948
+ const choose = useCallback9(
4992
4949
  (item) => {
4993
4950
  onSelect(item);
4994
4951
  setOpen(false);
@@ -5262,8 +5219,8 @@ function Sparkline({
5262
5219
  // src/web-react/insight-card.tsx
5263
5220
  import {
5264
5221
  isValidElement as isValidElement2,
5265
- useCallback as useCallback11,
5266
- useEffect as useEffect13,
5222
+ useCallback as useCallback10,
5223
+ useEffect as useEffect12,
5267
5224
  useRef as useRef12,
5268
5225
  useState as useState18
5269
5226
  } from "react";
@@ -5438,7 +5395,7 @@ function InsightDeck({
5438
5395
  const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
5439
5396
  const refreshing = shown !== state;
5440
5397
  const reported = useRef12(0);
5441
- const settlePage = useCallback11(
5398
+ const settlePage = useCallback10(
5442
5399
  (next) => {
5443
5400
  if (reported.current === next) return;
5444
5401
  reported.current = next;
@@ -5524,15 +5481,15 @@ function InsightPages({
5524
5481
  const sectionRef = useRef12(null);
5525
5482
  const listRef = useRef12(null);
5526
5483
  const recoverFocus = useRef12(false);
5527
- useEffect13(() => {
5484
+ useEffect12(() => {
5528
5485
  onPageSettled(current);
5529
5486
  }, [current, onPageSettled]);
5530
- useEffect13(() => {
5487
+ useEffect12(() => {
5531
5488
  if (!recoverFocus.current) return;
5532
5489
  recoverFocus.current = false;
5533
5490
  sectionRef.current?.focus();
5534
5491
  }, [current]);
5535
- const goTo = useCallback11(
5492
+ const goTo = useCallback10(
5536
5493
  (next) => {
5537
5494
  const clamped = Math.min(Math.max(next, 0), pageCount - 1);
5538
5495
  if (clamped === current) return false;
@@ -5675,7 +5632,7 @@ function PagerButton({
5675
5632
  }
5676
5633
 
5677
5634
  // src/web-react/review-inbox.tsx
5678
- import { useEffect as useEffect14, useRef as useRef13, useState as useState19 } from "react";
5635
+ import { useEffect as useEffect13, useRef as useRef13, useState as useState19 } from "react";
5679
5636
  import { Button as Button4, PageHeader } from "@tangle-network/ui/primitives";
5680
5637
  import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
5681
5638
  var revisionKey = (item) => JSON.stringify([item.id, item.revision]);
@@ -5710,7 +5667,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, onVerdict, onFeedba
5710
5667
  const canReview = !!active && available && active.canReview;
5711
5668
  const rank = currentId ? round2.indexOf(currentId) + 1 : round2.length;
5712
5669
  const reviewed = round2.length - unanswered.length;
5713
- useEffect14(() => {
5670
+ useEffect13(() => {
5714
5671
  if (loading || !restart && (round2.length > 0 || items.length === 0)) return;
5715
5672
  const next = ordered(items).map((item) => item.id);
5716
5673
  setRound(next);
@@ -5719,7 +5676,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, onVerdict, onFeedba
5719
5676
  setResolvedElsewhere(/* @__PURE__ */ new Set());
5720
5677
  setRestart(false);
5721
5678
  }, [items, loading, restart, round2.length, initialSelectedId]);
5722
- useEffect14(() => {
5679
+ useEffect13(() => {
5723
5680
  if (loading || error || busy || refreshing) return;
5724
5681
  const present = new Set(items.map((item) => item.id));
5725
5682
  setResolvedElsewhere((previous) => {
@@ -5727,7 +5684,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, onVerdict, onFeedba
5727
5684
  return next.size === previous.size && [...next].every((id) => previous.has(id)) ? previous : next;
5728
5685
  });
5729
5686
  }, [items, loading, error, busy, refreshing, round2]);
5730
- useEffect14(() => {
5687
+ useEffect13(() => {
5731
5688
  setActiveId(currentId ?? null);
5732
5689
  section.current?.focus({ preventScroll: true });
5733
5690
  }, [currentKey]);
@@ -5781,7 +5738,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, onVerdict, onFeedba
5781
5738
  setRefreshing(false);
5782
5739
  }
5783
5740
  }
5784
- useEffect14(() => {
5741
+ useEffect13(() => {
5785
5742
  function shortcut(event) {
5786
5743
  if (event.defaultPrevented || event.repeat || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
5787
5744
  const target = event.target instanceof Element ? event.target : null;
@@ -5877,7 +5834,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, onVerdict, onFeedba
5877
5834
  }
5878
5835
 
5879
5836
  // src/web-react/api-access-panel.tsx
5880
- import { useEffect as useEffect15, useRef as useRef14, useState as useState20 } from "react";
5837
+ import { useEffect as useEffect14, useRef as useRef14, useState as useState20 } from "react";
5881
5838
  import { Button as Button5, Input, PageHeader as PageHeader2 } from "@tangle-network/ui/primitives";
5882
5839
  import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
5883
5840
  var defaultExpiryChoices = [1, 7, 30];
@@ -5948,13 +5905,13 @@ function ApiAccessPanel({
5948
5905
  const nameInput = useRef14(null);
5949
5906
  const keyWasShown = useRef14(false);
5950
5907
  const selectedScopes = pruneScopes(scopes, access);
5951
- useEffect15(() => {
5908
+ useEffect14(() => {
5952
5909
  setScopes((current) => {
5953
5910
  const next = pruneScopes(current, access);
5954
5911
  return next.length === current.length ? current : next;
5955
5912
  });
5956
5913
  }, [access]);
5957
- useEffect15(() => {
5914
+ useEffect14(() => {
5958
5915
  if (created) {
5959
5916
  keyHeading.current?.focus();
5960
5917
  keyWasShown.current = true;
@@ -6741,7 +6698,7 @@ function copyTextOf(msg) {
6741
6698
  function CopyMessageButton({ text }) {
6742
6699
  const [copied, setCopied] = useState22(false);
6743
6700
  const timerRef = useRef15(null);
6744
- useEffect16(
6701
+ useEffect15(
6745
6702
  () => () => {
6746
6703
  if (timerRef.current !== null) clearTimeout(timerRef.current);
6747
6704
  },
@@ -6888,7 +6845,7 @@ function AssistantMessageImpl({
6888
6845
  var AssistantMessage = memo(AssistantMessageImpl);
6889
6846
  function useThinkingSeconds(active) {
6890
6847
  const [seconds, setSeconds] = useState22(0);
6891
- useEffect16(() => {
6848
+ useEffect15(() => {
6892
6849
  if (!active) return;
6893
6850
  setSeconds(0);
6894
6851
  const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
@@ -7099,8 +7056,6 @@ export {
7099
7056
  dispatchChatStreamLine,
7100
7057
  consumeChatStream,
7101
7058
  streamChatTurn,
7102
- requestWorkspacePrewarm,
7103
- useWorkspacePrewarm,
7104
7059
  getChatFundingRecovery,
7105
7060
  AgentProfileViewer,
7106
7061
  DurablePlanClientError,
@@ -7207,4 +7162,4 @@ export {
7207
7162
  useThinkingSeconds,
7208
7163
  ChatMessages
7209
7164
  };
7210
- //# sourceMappingURL=chunk-KNTRS7OZ.js.map
7165
+ //# sourceMappingURL=chunk-BQILMP73.js.map