@tangle-network/agent-app 0.60.60 → 0.60.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assistant/index.js +2 -2
- package/dist/brand-extraction/index.js +89 -2
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/chat-react/index.js +1 -1
- package/dist/chat-routes/index.js +1 -1
- package/dist/{chunk-6LPQRKH7.js → chunk-4WJREKXX.js} +222 -190
- package/dist/chunk-4WJREKXX.js.map +1 -0
- package/dist/{chunk-EQ6CGOZK.js → chunk-GNA5I5NM.js} +3 -1
- package/dist/chunk-GNA5I5NM.js.map +1 -0
- package/dist/{chunk-WMCROSA4.js → chunk-TZD35SBQ.js} +82 -1
- package/dist/chunk-TZD35SBQ.js.map +1 -0
- package/dist/platform/index.d.ts +1 -0
- package/dist/platform/index.js +155 -5
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/sso-identity-store.d.ts +69 -0
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/index.js +5 -1
- package/dist/sandbox/prewarm-route.d.ts +100 -0
- package/dist/web-react/chat-composer.d.ts +5 -1
- package/dist/web-react/command-palette.d.ts +6 -3
- package/dist/web-react/index.d.ts +1 -0
- package/dist/web-react/index.js +6 -2
- package/dist/web-react/workspace-prewarm.d.ts +36 -0
- package/package.json +1 -1
- package/dist/chunk-6LPQRKH7.js.map +0 -1
- package/dist/chunk-EQ6CGOZK.js.map +0 -1
- package/dist/chunk-WMCROSA4.js.map +0 -1
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
HarnessPicker,
|
|
16
16
|
filterAcceptedFiles
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-GNA5I5NM.js";
|
|
18
18
|
import {
|
|
19
19
|
joinClasses
|
|
20
20
|
} from "./chunk-L7MB2LLM.js";
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
} from "./chunk-LQYIBL3G.js";
|
|
73
73
|
|
|
74
74
|
// src/web-react/index.tsx
|
|
75
|
-
import { useEffect as
|
|
75
|
+
import { useEffect as useEffect18, useMemo as useMemo10, useRef as useRef17, useState as useState26, memo } from "react";
|
|
76
76
|
import { isViewerMessage, MessageAuthor } from "@tangle-network/ui/chat";
|
|
77
77
|
import { InlineToolItem, RunRowShell } from "@tangle-network/ui/run";
|
|
78
78
|
|
|
@@ -1504,6 +1504,49 @@ async function streamChatTurn(opts) {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
1506
|
|
|
1507
|
+
// src/web-react/workspace-prewarm.ts
|
|
1508
|
+
import { useCallback as useCallback2, useEffect as useEffect6 } from "react";
|
|
1509
|
+
var DEFAULT_MIN_INTERVAL_MS = 6e4;
|
|
1510
|
+
var lastSent = /* @__PURE__ */ new Map();
|
|
1511
|
+
var inFlight = /* @__PURE__ */ new Set();
|
|
1512
|
+
function documentIsVisible() {
|
|
1513
|
+
if (typeof document === "undefined") return false;
|
|
1514
|
+
if (document.prerendering) return false;
|
|
1515
|
+
return document.visibilityState === "visible";
|
|
1516
|
+
}
|
|
1517
|
+
function requestWorkspacePrewarm(url, options = {}) {
|
|
1518
|
+
if (!url || !documentIsVisible() || inFlight.has(url)) return false;
|
|
1519
|
+
const now = Date.now();
|
|
1520
|
+
const last = lastSent.get(url);
|
|
1521
|
+
if (last !== void 0 && now - last < (options.minIntervalMs ?? DEFAULT_MIN_INTERVAL_MS)) return false;
|
|
1522
|
+
lastSent.set(url, now);
|
|
1523
|
+
inFlight.add(url);
|
|
1524
|
+
void fetch(url, {
|
|
1525
|
+
method: "POST",
|
|
1526
|
+
credentials: "same-origin",
|
|
1527
|
+
headers: { "content-type": "application/json" },
|
|
1528
|
+
body: "{}"
|
|
1529
|
+
}).then((response) => response.body?.cancel()).catch(() => void 0).finally(() => inFlight.delete(url));
|
|
1530
|
+
return true;
|
|
1531
|
+
}
|
|
1532
|
+
function useWorkspacePrewarm(options) {
|
|
1533
|
+
const { url, enabled = true, minIntervalMs } = options;
|
|
1534
|
+
const active = enabled && Boolean(url);
|
|
1535
|
+
useEffect6(() => {
|
|
1536
|
+
if (!active || !url || typeof document === "undefined") return;
|
|
1537
|
+
const fire = () => {
|
|
1538
|
+
requestWorkspacePrewarm(url, { minIntervalMs });
|
|
1539
|
+
};
|
|
1540
|
+
fire();
|
|
1541
|
+
document.addEventListener("visibilitychange", fire);
|
|
1542
|
+
return () => document.removeEventListener("visibilitychange", fire);
|
|
1543
|
+
}, [active, url, minIntervalMs]);
|
|
1544
|
+
const reassert = useCallback2(() => {
|
|
1545
|
+
if (active && url) requestWorkspacePrewarm(url, { minIntervalMs });
|
|
1546
|
+
}, [active, url, minIntervalMs]);
|
|
1547
|
+
return { reassert };
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1507
1550
|
// src/web-react/turn-funding-recovery.ts
|
|
1508
1551
|
function getChatFundingRecovery(failure) {
|
|
1509
1552
|
const code = typeof failure === "object" && failure ? failure.code : void 0;
|
|
@@ -1524,7 +1567,7 @@ function getChatFundingRecovery(failure) {
|
|
|
1524
1567
|
}
|
|
1525
1568
|
|
|
1526
1569
|
// src/web-react/agent-profile-editor.tsx
|
|
1527
|
-
import { useEffect as
|
|
1570
|
+
import { useEffect as useEffect10, useId as useId5, useMemo as useMemo5, useState as useState14 } from "react";
|
|
1528
1571
|
import { REASONING_EFFORTS } from "@tangle-network/agent-interface/profile";
|
|
1529
1572
|
import { reasoningEffortsFor } from "@tangle-network/agent-interface/harness-capabilities";
|
|
1530
1573
|
import { agentProfileSchema } from "@tangle-network/agent-interface/profile-schema";
|
|
@@ -1878,12 +1921,12 @@ var noAutofill = {
|
|
|
1878
1921
|
};
|
|
1879
1922
|
|
|
1880
1923
|
// src/web-react/agent-profile-github-source.tsx
|
|
1881
|
-
import { useEffect as
|
|
1924
|
+
import { useEffect as useEffect8, useId as useId3, useMemo as useMemo3, useRef as useRef7, useState as useState11 } from "react";
|
|
1882
1925
|
import { Button as Button2, Input as Input3 } from "@tangle-network/sandbox-ui/primitives";
|
|
1883
1926
|
import { SegmentedControl } from "@tangle-network/ui/primitives";
|
|
1884
1927
|
|
|
1885
1928
|
// src/web-react/agent-profile-suggest-input.tsx
|
|
1886
|
-
import { useEffect as
|
|
1929
|
+
import { useEffect as useEffect7, useId as useId2, useRef as useRef6, useState as useState10 } from "react";
|
|
1887
1930
|
import { Input as Input2 } from "@tangle-network/sandbox-ui/primitives";
|
|
1888
1931
|
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1889
1932
|
function SuggestInput({
|
|
@@ -1908,10 +1951,10 @@ function SuggestInput({
|
|
|
1908
1951
|
const listId = useId2();
|
|
1909
1952
|
const optionId = (index) => `${listId}-option-${index}`;
|
|
1910
1953
|
const showList = open && !disabled && (loading || suggestions.length > 0 || Boolean(emptyText && value.trim()));
|
|
1911
|
-
|
|
1954
|
+
useEffect7(() => {
|
|
1912
1955
|
setActive(-1);
|
|
1913
1956
|
}, [suggestions]);
|
|
1914
|
-
|
|
1957
|
+
useEffect7(() => {
|
|
1915
1958
|
if (disabled) setOpen(false);
|
|
1916
1959
|
}, [disabled]);
|
|
1917
1960
|
function commit(next) {
|
|
@@ -2022,7 +2065,7 @@ function useLookup(key, run, delayMs = 0) {
|
|
|
2022
2065
|
const [load, setLoad] = useState11({ state: "idle" });
|
|
2023
2066
|
const runRef = useRef7(run);
|
|
2024
2067
|
runRef.current = run;
|
|
2025
|
-
|
|
2068
|
+
useEffect8(() => {
|
|
2026
2069
|
if (key === null) {
|
|
2027
2070
|
setLoad({ state: "idle" });
|
|
2028
2071
|
return;
|
|
@@ -2239,7 +2282,7 @@ function GitHubSourcePicker({ port, purpose, disabled = false, connectHref, onCh
|
|
|
2239
2282
|
}
|
|
2240
2283
|
|
|
2241
2284
|
// src/web-react/agent-profile-mcp-servers.tsx
|
|
2242
|
-
import { useEffect as
|
|
2285
|
+
import { useEffect as useEffect9, useId as useId4, useMemo as useMemo4, useRef as useRef8, useState as useState12 } from "react";
|
|
2243
2286
|
import { Button as Button3, Input as Input4, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Switch } from "@tangle-network/sandbox-ui/primitives";
|
|
2244
2287
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2245
2288
|
var NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
@@ -2395,7 +2438,7 @@ function McpServersEditor({ servers, onChange, port, disabled, lockReason, publi
|
|
|
2395
2438
|
const controllers = useRef8(/* @__PURE__ */ new Map());
|
|
2396
2439
|
const locked = lockReason !== void 0;
|
|
2397
2440
|
const entries = useMemo4(() => Object.entries(servers), [servers]);
|
|
2398
|
-
|
|
2441
|
+
useEffect9(() => {
|
|
2399
2442
|
if (!port) return;
|
|
2400
2443
|
for (const [name, server] of entries) {
|
|
2401
2444
|
if (server.enabled === false || "command" in server && server.command) continue;
|
|
@@ -2414,11 +2457,11 @@ function McpServersEditor({ servers, onChange, port, disabled, lockReason, publi
|
|
|
2414
2457
|
});
|
|
2415
2458
|
}
|
|
2416
2459
|
}, [entries, port, recheck, health]);
|
|
2417
|
-
|
|
2460
|
+
useEffect9(() => () => {
|
|
2418
2461
|
for (const controller of controllers.current.values()) controller.abort();
|
|
2419
2462
|
}, []);
|
|
2420
2463
|
const pending = editing !== null || adding !== null;
|
|
2421
|
-
|
|
2464
|
+
useEffect9(() => {
|
|
2422
2465
|
onPendingChange?.(pending);
|
|
2423
2466
|
}, [pending, onPendingChange]);
|
|
2424
2467
|
function setServer(name, server) {
|
|
@@ -2808,7 +2851,7 @@ function AgentProfileEditor({
|
|
|
2808
2851
|
const [modelNotice, setModelNotice] = useState14(null);
|
|
2809
2852
|
const [json, setJson] = useState14(() => JSON.stringify(value, null, 2));
|
|
2810
2853
|
const [jsonDirty, setJsonDirty] = useState14(false);
|
|
2811
|
-
|
|
2854
|
+
useEffect10(() => {
|
|
2812
2855
|
if (!jsonDirty) setJson(JSON.stringify(value, null, 2));
|
|
2813
2856
|
}, [value, jsonDirty]);
|
|
2814
2857
|
const editingDisabled = disabled || jsonDirty;
|
|
@@ -2853,10 +2896,10 @@ function AgentProfileEditor({
|
|
|
2853
2896
|
const invalidMcpCount = publicHttpsMcpOnly ? Object.values(value.mcp ?? {}).filter((server) => server.enabled !== false && (!("url" in server) || !server.url || publicHttpsUrlProblem(server.url) !== null)).length : 0;
|
|
2854
2897
|
const pending = jsonDirty || panel !== null || mcpPending || Boolean(newTool.trim());
|
|
2855
2898
|
const invalid = Boolean(error || unsupportedResources.length || constrainedEntryCount || invalidMcpCount);
|
|
2856
|
-
|
|
2899
|
+
useEffect10(() => {
|
|
2857
2900
|
onSaveStateChange?.({ pending, invalid });
|
|
2858
2901
|
}, [onSaveStateChange, pending, invalid]);
|
|
2859
|
-
|
|
2902
|
+
useEffect10(() => () => {
|
|
2860
2903
|
onSaveStateChange?.({ pending: false, invalid: false });
|
|
2861
2904
|
}, [onSaveStateChange]);
|
|
2862
2905
|
function emit(next) {
|
|
@@ -3677,7 +3720,7 @@ function AgentProfileEditor({
|
|
|
3677
3720
|
}
|
|
3678
3721
|
function GitHubFilePath({ check, id, value, prefix, disabled, onChange, issue }) {
|
|
3679
3722
|
const suggested = check ? prefix + basename(check.path) : "";
|
|
3680
|
-
|
|
3723
|
+
useEffect10(() => {
|
|
3681
3724
|
if (suggested && !value) onChange(suggested);
|
|
3682
3725
|
}, [suggested]);
|
|
3683
3726
|
return /* @__PURE__ */ jsx14(Field, { label: "Workspace path", htmlFor: id, error: issue, hint: !issue && prefix ? `Files go under ${prefix}` : void 0, children: /* @__PURE__ */ jsx14(
|
|
@@ -3960,7 +4003,7 @@ function AgentProfileViewer({ profile, className = "", showFullProfile = false,
|
|
|
3960
4003
|
}
|
|
3961
4004
|
|
|
3962
4005
|
// src/web-react/durable-plan-flow.ts
|
|
3963
|
-
import { useCallback as
|
|
4006
|
+
import { useCallback as useCallback3, useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
|
|
3964
4007
|
var DurablePlanClientError = class extends Error {
|
|
3965
4008
|
constructor(message, status, code, currentPlan) {
|
|
3966
4009
|
super(message);
|
|
@@ -4053,8 +4096,8 @@ function useDurablePlanFlow(options) {
|
|
|
4053
4096
|
const [error, setError] = useState16(null);
|
|
4054
4097
|
const attachments = useRef10(/* @__PURE__ */ new Map());
|
|
4055
4098
|
const decisionInFlight = useRef10(false);
|
|
4056
|
-
|
|
4057
|
-
const apply =
|
|
4099
|
+
useEffect11(() => setPlan(options.plan), [options.plan]);
|
|
4100
|
+
const apply = useCallback3(async (result) => {
|
|
4058
4101
|
setPlan(result.plan);
|
|
4059
4102
|
options.onUpdated?.(result.plan);
|
|
4060
4103
|
const receipt = result.followUp;
|
|
@@ -4067,7 +4110,7 @@ function useDurablePlanFlow(options) {
|
|
|
4067
4110
|
}
|
|
4068
4111
|
await pending;
|
|
4069
4112
|
}, [options.attachFollowUp, options.onUpdated]);
|
|
4070
|
-
const decide =
|
|
4113
|
+
const decide = useCallback3(async (decision, feedback) => {
|
|
4071
4114
|
if (decisionInFlight.current) return null;
|
|
4072
4115
|
decisionInFlight.current = true;
|
|
4073
4116
|
setDeciding(decision);
|
|
@@ -4093,7 +4136,7 @@ function useDurablePlanFlow(options) {
|
|
|
4093
4136
|
setDeciding(null);
|
|
4094
4137
|
}
|
|
4095
4138
|
}, [apply, options.client, options.onUpdated, plan.planId, plan.revision]);
|
|
4096
|
-
const restore =
|
|
4139
|
+
const restore = useCallback3(async () => {
|
|
4097
4140
|
setRestoring(true);
|
|
4098
4141
|
setError(null);
|
|
4099
4142
|
try {
|
|
@@ -4222,7 +4265,7 @@ function createDurableInteractionAnswerSubmitter(options) {
|
|
|
4222
4265
|
}
|
|
4223
4266
|
|
|
4224
4267
|
// src/web-react/use-chat-interactions.ts
|
|
4225
|
-
import { useCallback as
|
|
4268
|
+
import { useCallback as useCallback4, useMemo as useMemo6, useState as useState17 } from "react";
|
|
4226
4269
|
function hasPendingContentDuplicate(list, interaction) {
|
|
4227
4270
|
if (interaction.status !== "pending") return false;
|
|
4228
4271
|
const signature = questionInteractionContentSignature(interaction);
|
|
@@ -4302,33 +4345,33 @@ function hydrateChatInteractions(list, persisted) {
|
|
|
4302
4345
|
}
|
|
4303
4346
|
function useChatInteractions(options = {}) {
|
|
4304
4347
|
const [interactions, setInteractions] = useState17([]);
|
|
4305
|
-
const upsert =
|
|
4348
|
+
const upsert = useCallback4((interaction) => {
|
|
4306
4349
|
setInteractions((prev) => upsertChatInteraction(prev, interaction));
|
|
4307
4350
|
}, []);
|
|
4308
|
-
const applyCancel =
|
|
4351
|
+
const applyCancel = useCallback4((cancel) => {
|
|
4309
4352
|
setInteractions((prev) => cancelChatInteraction(prev, cancel));
|
|
4310
4353
|
}, []);
|
|
4311
|
-
const markResolved =
|
|
4354
|
+
const markResolved = useCallback4((id, status, answers) => {
|
|
4312
4355
|
setInteractions((prev) => resolveChatInteraction(prev, id, status, answers));
|
|
4313
4356
|
}, []);
|
|
4314
|
-
const restore =
|
|
4357
|
+
const restore = useCallback4((outstanding, restoreOptions) => {
|
|
4315
4358
|
setInteractions((prev) => restoreChatInteractions(prev, outstanding, {
|
|
4316
4359
|
mode: restoreOptions?.mode ?? options.mode
|
|
4317
4360
|
}));
|
|
4318
4361
|
}, [options.mode]);
|
|
4319
|
-
const hydrate =
|
|
4362
|
+
const hydrate = useCallback4((persisted) => {
|
|
4320
4363
|
setInteractions((prev) => hydrateChatInteractions(prev, persisted));
|
|
4321
4364
|
}, []);
|
|
4322
|
-
const terminalizePending =
|
|
4365
|
+
const terminalizePending = useCallback4((status) => {
|
|
4323
4366
|
setInteractions((prev) => terminalizePendingChatInteractions(prev, status));
|
|
4324
4367
|
}, []);
|
|
4325
|
-
const reset =
|
|
4368
|
+
const reset = useCallback4(() => setInteractions([]), []);
|
|
4326
4369
|
const pending = useMemo6(() => interactions.filter((item) => item.status === "pending"), [interactions]);
|
|
4327
4370
|
return { interactions, pending, upsert, applyCancel, markResolved, restore, hydrate, terminalizePending, reset };
|
|
4328
4371
|
}
|
|
4329
4372
|
|
|
4330
4373
|
// src/web-react/use-file-mentions.ts
|
|
4331
|
-
import { useCallback as
|
|
4374
|
+
import { useCallback as useCallback5, useMemo as useMemo7, useRef as useRef11, useState as useState18 } from "react";
|
|
4332
4375
|
var FILE_MENTION_KIND = "file";
|
|
4333
4376
|
function toMentionItem(file) {
|
|
4334
4377
|
return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
|
|
@@ -4391,7 +4434,7 @@ function useFileMentions(options) {
|
|
|
4391
4434
|
stateRef.current = state;
|
|
4392
4435
|
const inFlightRef = useRef11(null);
|
|
4393
4436
|
const [mentions, setMentions] = useState18([]);
|
|
4394
|
-
const load =
|
|
4437
|
+
const load = useCallback5(() => {
|
|
4395
4438
|
if (inFlightRef.current) return inFlightRef.current;
|
|
4396
4439
|
if (stateRef.current.kind === "idle") {
|
|
4397
4440
|
stateRef.current = { kind: "loading" };
|
|
@@ -4423,10 +4466,10 @@ function useFileMentions(options) {
|
|
|
4423
4466
|
inFlightRef.current = attempt;
|
|
4424
4467
|
return attempt;
|
|
4425
4468
|
}, [fetchImpl, indexUrl]);
|
|
4426
|
-
const refresh =
|
|
4469
|
+
const refresh = useCallback5(async () => {
|
|
4427
4470
|
await load();
|
|
4428
4471
|
}, [load]);
|
|
4429
|
-
const fetchItems =
|
|
4472
|
+
const fetchItems = useCallback5(
|
|
4430
4473
|
async (query) => {
|
|
4431
4474
|
let current = stateRef.current;
|
|
4432
4475
|
if (current.kind === "idle" || current.kind === "loading") {
|
|
@@ -4441,10 +4484,10 @@ function useFileMentions(options) {
|
|
|
4441
4484
|
},
|
|
4442
4485
|
[load, limit, refreshAfterMs]
|
|
4443
4486
|
);
|
|
4444
|
-
const onMentionsChange =
|
|
4487
|
+
const onMentionsChange = useCallback5((items) => {
|
|
4445
4488
|
setMentions(items.filter((item) => item.kind === void 0 || item.kind === FILE_MENTION_KIND).map(toFileMention));
|
|
4446
4489
|
}, []);
|
|
4447
|
-
const clearMentions =
|
|
4490
|
+
const clearMentions = useCallback5(() => setMentions([]), []);
|
|
4448
4491
|
const mention = useMemo7(
|
|
4449
4492
|
() => ({
|
|
4450
4493
|
fetchItems,
|
|
@@ -4497,7 +4540,7 @@ function segmentMentionContent(content, parts) {
|
|
|
4497
4540
|
}
|
|
4498
4541
|
|
|
4499
4542
|
// src/web-react/mission-activity.tsx
|
|
4500
|
-
import { useCallback as
|
|
4543
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useState as useState19 } from "react";
|
|
4501
4544
|
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4502
4545
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
4503
4546
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
@@ -4558,7 +4601,7 @@ function CopyGlyph({ className }) {
|
|
|
4558
4601
|
}
|
|
4559
4602
|
function TraceIdCopy({ traceId }) {
|
|
4560
4603
|
const [copied, setCopied] = useState19(false);
|
|
4561
|
-
const copy =
|
|
4604
|
+
const copy = useCallback6(() => {
|
|
4562
4605
|
void navigator.clipboard?.writeText(traceId).then(
|
|
4563
4606
|
() => {
|
|
4564
4607
|
setCopied(true);
|
|
@@ -4727,7 +4770,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
4727
4770
|
const [cursor, setCursor] = useState19(void 0);
|
|
4728
4771
|
const [status, setStatus] = useState19("loading");
|
|
4729
4772
|
const [error, setError] = useState19(null);
|
|
4730
|
-
const load =
|
|
4773
|
+
const load = useCallback6(
|
|
4731
4774
|
async (from) => {
|
|
4732
4775
|
setStatus("loading");
|
|
4733
4776
|
setError(null);
|
|
@@ -4743,7 +4786,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
4743
4786
|
},
|
|
4744
4787
|
[fetchActivity]
|
|
4745
4788
|
);
|
|
4746
|
-
|
|
4789
|
+
useEffect12(() => {
|
|
4747
4790
|
void load();
|
|
4748
4791
|
}, [load]);
|
|
4749
4792
|
const loading = status === "loading";
|
|
@@ -4780,7 +4823,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
4780
4823
|
}
|
|
4781
4824
|
|
|
4782
4825
|
// src/web-react/provenance.tsx
|
|
4783
|
-
import { useCallback as
|
|
4826
|
+
import { useCallback as useCallback7, useEffect as useEffect13, useId as useId6, useRef as useRef12, useState as useState20 } from "react";
|
|
4784
4827
|
|
|
4785
4828
|
// src/web-react/provenance-model.ts
|
|
4786
4829
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -5086,7 +5129,7 @@ function ProvenanceValue({
|
|
|
5086
5129
|
const sources = record.sources ?? [];
|
|
5087
5130
|
const inputs = record.inputs ?? [];
|
|
5088
5131
|
const hasValue = record.display.trim() !== "";
|
|
5089
|
-
const onKeyDown =
|
|
5132
|
+
const onKeyDown = useCallback7(
|
|
5090
5133
|
(event) => {
|
|
5091
5134
|
if (event.key !== "Escape" || !open) return;
|
|
5092
5135
|
event.stopPropagation();
|
|
@@ -5095,11 +5138,11 @@ function ProvenanceValue({
|
|
|
5095
5138
|
},
|
|
5096
5139
|
[open]
|
|
5097
5140
|
);
|
|
5098
|
-
const onToggle =
|
|
5141
|
+
const onToggle = useCallback7(() => {
|
|
5099
5142
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
5100
5143
|
setOpen(!open);
|
|
5101
5144
|
}, [open]);
|
|
5102
|
-
|
|
5145
|
+
useEffect13(() => {
|
|
5103
5146
|
const root = rootRef.current;
|
|
5104
5147
|
if (!open || root === null) return;
|
|
5105
5148
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -5357,8 +5400,8 @@ function SeatPaywall({
|
|
|
5357
5400
|
import {
|
|
5358
5401
|
Fragment as Fragment7,
|
|
5359
5402
|
isValidElement,
|
|
5360
|
-
useCallback as
|
|
5361
|
-
useEffect as
|
|
5403
|
+
useCallback as useCallback8,
|
|
5404
|
+
useEffect as useEffect14,
|
|
5362
5405
|
useId as useId7,
|
|
5363
5406
|
useMemo as useMemo8,
|
|
5364
5407
|
useRef as useRef13,
|
|
@@ -5795,12 +5838,12 @@ function RecordGrid({
|
|
|
5795
5838
|
const settling = useRef13(false);
|
|
5796
5839
|
const draftCounter = useRef13(0);
|
|
5797
5840
|
const editingRef = useRef13(null);
|
|
5798
|
-
const setEditing =
|
|
5841
|
+
const setEditing = useCallback8((next) => {
|
|
5799
5842
|
editingRef.current = next;
|
|
5800
5843
|
setEditingState(next);
|
|
5801
5844
|
}, []);
|
|
5802
5845
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
5803
|
-
|
|
5846
|
+
useEffect14(() => {
|
|
5804
5847
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
5805
5848
|
}, [callerRows]);
|
|
5806
5849
|
const visibleRows = useMemo8(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
@@ -5827,7 +5870,7 @@ function RecordGrid({
|
|
|
5827
5870
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
5828
5871
|
return focus;
|
|
5829
5872
|
}, [columns, focus, visibleRows]);
|
|
5830
|
-
const setCellError =
|
|
5873
|
+
const setCellError = useCallback8((key, message) => {
|
|
5831
5874
|
setCellErrors((current) => {
|
|
5832
5875
|
if (message === null) {
|
|
5833
5876
|
if (!(key in current)) return current;
|
|
@@ -5839,7 +5882,7 @@ function RecordGrid({
|
|
|
5839
5882
|
return { ...current, [key]: message };
|
|
5840
5883
|
});
|
|
5841
5884
|
}, []);
|
|
5842
|
-
const setRowError =
|
|
5885
|
+
const setRowError = useCallback8((rowId, message) => {
|
|
5843
5886
|
setRowErrors((current) => {
|
|
5844
5887
|
if (message === null) {
|
|
5845
5888
|
if (!(rowId in current)) return current;
|
|
@@ -5850,7 +5893,7 @@ function RecordGrid({
|
|
|
5850
5893
|
return { ...current, [rowId]: message };
|
|
5851
5894
|
});
|
|
5852
5895
|
}, []);
|
|
5853
|
-
const setRowPending =
|
|
5896
|
+
const setRowPending = useCallback8((rowId, pending) => {
|
|
5854
5897
|
setPendingRows((current) => {
|
|
5855
5898
|
if (pending) return rowId in current ? current : { ...current, [rowId]: true };
|
|
5856
5899
|
if (!(rowId in current)) return current;
|
|
@@ -5859,11 +5902,11 @@ function RecordGrid({
|
|
|
5859
5902
|
return next;
|
|
5860
5903
|
});
|
|
5861
5904
|
}, []);
|
|
5862
|
-
const focusCell =
|
|
5905
|
+
const focusCell = useCallback8((rowId, columnId) => {
|
|
5863
5906
|
setFocus({ rowId, columnId });
|
|
5864
5907
|
cellRefs.current.get(cellKey(rowId, columnId))?.focus();
|
|
5865
5908
|
}, []);
|
|
5866
|
-
const beginEdit =
|
|
5909
|
+
const beginEdit = useCallback8(
|
|
5867
5910
|
(row, column) => {
|
|
5868
5911
|
setCellError(cellKey(row.id, column.id), null);
|
|
5869
5912
|
setEditing({
|
|
@@ -5874,7 +5917,7 @@ function RecordGrid({
|
|
|
5874
5917
|
},
|
|
5875
5918
|
[setCellError, setEditing]
|
|
5876
5919
|
);
|
|
5877
|
-
const applyCellWrite =
|
|
5920
|
+
const applyCellWrite = useCallback8(
|
|
5878
5921
|
async (row, column, value) => {
|
|
5879
5922
|
if (!onUpdate) return;
|
|
5880
5923
|
const values = { ...row.values, [column.id]: value };
|
|
@@ -5902,7 +5945,7 @@ function RecordGrid({
|
|
|
5902
5945
|
},
|
|
5903
5946
|
[locale, onUpdate, setRowError, setRowPending]
|
|
5904
5947
|
);
|
|
5905
|
-
const commitEdit =
|
|
5948
|
+
const commitEdit = useCallback8(
|
|
5906
5949
|
async (row, column, text) => {
|
|
5907
5950
|
const open = editingRef.current;
|
|
5908
5951
|
if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
|
|
@@ -5926,7 +5969,7 @@ function RecordGrid({
|
|
|
5926
5969
|
},
|
|
5927
5970
|
[applyCellWrite, setCellError, setEditing]
|
|
5928
5971
|
);
|
|
5929
|
-
const cancelEdit =
|
|
5972
|
+
const cancelEdit = useCallback8(
|
|
5930
5973
|
(row, column) => {
|
|
5931
5974
|
setCellError(cellKey(row.id, column.id), null);
|
|
5932
5975
|
setEditing(null);
|
|
@@ -5934,7 +5977,7 @@ function RecordGrid({
|
|
|
5934
5977
|
},
|
|
5935
5978
|
[focusCell, setCellError, setEditing]
|
|
5936
5979
|
);
|
|
5937
|
-
const performDelete =
|
|
5980
|
+
const performDelete = useCallback8(
|
|
5938
5981
|
async (row) => {
|
|
5939
5982
|
if (!onDelete) return;
|
|
5940
5983
|
setConfirmDelete(null);
|
|
@@ -5952,16 +5995,16 @@ function RecordGrid({
|
|
|
5952
5995
|
},
|
|
5953
5996
|
[columns, onDelete, setRowError]
|
|
5954
5997
|
);
|
|
5955
|
-
const resetDraft =
|
|
5998
|
+
const resetDraft = useCallback8(() => {
|
|
5956
5999
|
setDraft({ ...newRowDefaults ?? {} });
|
|
5957
6000
|
setDraftErrors({});
|
|
5958
6001
|
setDraftError(null);
|
|
5959
6002
|
}, [newRowDefaults]);
|
|
5960
|
-
const openAdd =
|
|
6003
|
+
const openAdd = useCallback8(() => {
|
|
5961
6004
|
resetDraft();
|
|
5962
6005
|
setAdding(true);
|
|
5963
6006
|
}, [resetDraft]);
|
|
5964
|
-
const submitDraft =
|
|
6007
|
+
const submitDraft = useCallback8(async () => {
|
|
5965
6008
|
if (!onCreate) return;
|
|
5966
6009
|
const validated = validateRecordGridRow(columns, draft);
|
|
5967
6010
|
if (!validated.succeeded) {
|
|
@@ -5991,7 +6034,7 @@ function RecordGrid({
|
|
|
5991
6034
|
setOverlay((current) => withoutRecordGridCreated(current, draftId));
|
|
5992
6035
|
setDraftError(outcome.error);
|
|
5993
6036
|
}, [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
5994
|
-
const handleGridKeyDown =
|
|
6037
|
+
const handleGridKeyDown = useCallback8(
|
|
5995
6038
|
(event) => {
|
|
5996
6039
|
if (editing !== null) return;
|
|
5997
6040
|
const target = event.target;
|
|
@@ -6541,7 +6584,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
6541
6584
|
}
|
|
6542
6585
|
function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
|
|
6543
6586
|
const basis = source.basis ?? "asserted";
|
|
6544
|
-
const setOpen =
|
|
6587
|
+
const setOpen = useCallback8(
|
|
6545
6588
|
(next) => {
|
|
6546
6589
|
if (!next) onToggle();
|
|
6547
6590
|
},
|
|
@@ -6788,15 +6831,15 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
6788
6831
|
|
|
6789
6832
|
// src/web-react/command-palette.tsx
|
|
6790
6833
|
import {
|
|
6791
|
-
useCallback as
|
|
6792
|
-
useEffect as
|
|
6834
|
+
useCallback as useCallback9,
|
|
6835
|
+
useEffect as useEffect15,
|
|
6793
6836
|
useId as useId8,
|
|
6794
6837
|
useMemo as useMemo9,
|
|
6795
6838
|
useRef as useRef14,
|
|
6796
6839
|
useState as useState22
|
|
6797
6840
|
} from "react";
|
|
6798
|
-
import {
|
|
6799
|
-
import {
|
|
6841
|
+
import { Dialog, DialogContent, DialogTitle } from "@tangle-network/ui/primitives";
|
|
6842
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6800
6843
|
function SearchGlyph({ className }) {
|
|
6801
6844
|
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6802
6845
|
/* @__PURE__ */ jsx21("circle", { cx: "11", cy: "11", r: "8" }),
|
|
@@ -6809,6 +6852,7 @@ function CommandPalette({
|
|
|
6809
6852
|
open: controlledOpen,
|
|
6810
6853
|
onOpenChange,
|
|
6811
6854
|
hotkey = true,
|
|
6855
|
+
returnFocusTo,
|
|
6812
6856
|
loading = false,
|
|
6813
6857
|
initialQuery,
|
|
6814
6858
|
onQueryChange,
|
|
@@ -6818,7 +6862,7 @@ function CommandPalette({
|
|
|
6818
6862
|
}) {
|
|
6819
6863
|
const [internalOpen, setInternalOpen] = useState22(false);
|
|
6820
6864
|
const open = controlledOpen ?? internalOpen;
|
|
6821
|
-
const setOpen =
|
|
6865
|
+
const setOpen = useCallback9(
|
|
6822
6866
|
(next) => {
|
|
6823
6867
|
if (controlledOpen === void 0) setInternalOpen(next);
|
|
6824
6868
|
onOpenChange?.(next);
|
|
@@ -6834,7 +6878,7 @@ function CommandPalette({
|
|
|
6834
6878
|
const sections = useMemo9(() => groupCommandPaletteItems(flat), [flat]);
|
|
6835
6879
|
const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
|
|
6836
6880
|
const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
|
|
6837
|
-
|
|
6881
|
+
useEffect15(() => {
|
|
6838
6882
|
if (!hotkey) return;
|
|
6839
6883
|
function onKeyDown(e) {
|
|
6840
6884
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
@@ -6846,24 +6890,17 @@ function CommandPalette({
|
|
|
6846
6890
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
6847
6891
|
}, [hotkey, open, setOpen]);
|
|
6848
6892
|
const restoreFocusRef = useRef14(null);
|
|
6849
|
-
|
|
6850
|
-
if (open)
|
|
6851
|
-
restoreFocusRef.current = document.activeElement;
|
|
6852
|
-
inputRef.current?.focus();
|
|
6853
|
-
return;
|
|
6854
|
-
}
|
|
6893
|
+
useEffect15(() => {
|
|
6894
|
+
if (open) return;
|
|
6855
6895
|
setQuery(initialQuery ?? "");
|
|
6856
6896
|
onQueryChange?.(initialQuery ?? "");
|
|
6857
6897
|
setActive(0);
|
|
6858
|
-
const restore = restoreFocusRef.current;
|
|
6859
|
-
restoreFocusRef.current = null;
|
|
6860
|
-
if (restore instanceof HTMLElement) restore.focus();
|
|
6861
6898
|
}, [open]);
|
|
6862
|
-
|
|
6899
|
+
useEffect15(() => {
|
|
6863
6900
|
if (!open || !activeId) return;
|
|
6864
6901
|
document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
6865
6902
|
}, [open, activeId]);
|
|
6866
|
-
const choose =
|
|
6903
|
+
const choose = useCallback9(
|
|
6867
6904
|
(item) => {
|
|
6868
6905
|
onSelect(item);
|
|
6869
6906
|
setOpen(false);
|
|
@@ -6881,102 +6918,95 @@ function CommandPalette({
|
|
|
6881
6918
|
e.preventDefault();
|
|
6882
6919
|
const item = flat[activeIndex];
|
|
6883
6920
|
if (item) choose(item);
|
|
6884
|
-
} else if (e.key === "Escape") {
|
|
6885
|
-
e.preventDefault();
|
|
6886
|
-
setOpen(false);
|
|
6887
6921
|
}
|
|
6888
6922
|
};
|
|
6889
|
-
if (!open || typeof document === "undefined") return null;
|
|
6890
6923
|
let rowIndex = -1;
|
|
6891
|
-
return
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
)
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6924
|
+
return /* @__PURE__ */ jsx21(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs19(
|
|
6925
|
+
DialogContent,
|
|
6926
|
+
{
|
|
6927
|
+
hideCloseButton: true,
|
|
6928
|
+
"aria-describedby": void 0,
|
|
6929
|
+
onOpenAutoFocus: (event) => {
|
|
6930
|
+
event.preventDefault();
|
|
6931
|
+
restoreFocusRef.current = document.activeElement;
|
|
6932
|
+
inputRef.current?.focus();
|
|
6933
|
+
},
|
|
6934
|
+
onCloseAutoFocus: (event) => {
|
|
6935
|
+
event.preventDefault();
|
|
6936
|
+
const restore = returnFocusTo?.() ?? restoreFocusRef.current;
|
|
6937
|
+
restoreFocusRef.current = null;
|
|
6938
|
+
if (restore instanceof HTMLElement && restore.isConnected) restore.focus();
|
|
6939
|
+
},
|
|
6940
|
+
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
6941
|
+
className: `top-[15%] z-[1000] flex max-h-[70vh] w-[560px] max-w-[calc(100vw-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl border-card-edge bg-popover p-0 ${OVERLAY_SHADOW}`,
|
|
6942
|
+
children: [
|
|
6943
|
+
/* @__PURE__ */ jsx21(DialogTitle, { className: "sr-only", children: label }),
|
|
6944
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
6945
|
+
/* @__PURE__ */ jsx21(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
6946
|
+
/* @__PURE__ */ jsx21(
|
|
6947
|
+
"input",
|
|
6948
|
+
{
|
|
6949
|
+
ref: inputRef,
|
|
6950
|
+
type: "text",
|
|
6951
|
+
role: "combobox",
|
|
6952
|
+
"aria-expanded": true,
|
|
6953
|
+
"aria-controls": listId,
|
|
6954
|
+
"aria-activedescendant": activeId,
|
|
6955
|
+
"aria-label": label,
|
|
6956
|
+
value: query,
|
|
6957
|
+
onChange: (e) => {
|
|
6958
|
+
setQuery(e.target.value);
|
|
6959
|
+
onQueryChange?.(e.target.value);
|
|
6960
|
+
setActive(0);
|
|
6961
|
+
},
|
|
6962
|
+
onKeyDown: handleKeyDown,
|
|
6963
|
+
placeholder,
|
|
6964
|
+
className: "flex-1 bg-transparent text-sm text-foreground placeholder:text-muted-foreground"
|
|
6965
|
+
}
|
|
6966
|
+
)
|
|
6967
|
+
] }),
|
|
6968
|
+
/* @__PURE__ */ jsxs19("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
6969
|
+
loading && /* @__PURE__ */ jsx21("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
6970
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx21("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: emptyMessage ?? (query.trim() ? `No results for \u201C${query.trim()}\u201D` : "Nothing here yet") }),
|
|
6971
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs19("div", { children: [
|
|
6972
|
+
/* @__PURE__ */ jsx21("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
6973
|
+
section.items.map((item) => {
|
|
6974
|
+
rowIndex += 1;
|
|
6975
|
+
const index = rowIndex;
|
|
6976
|
+
return /* @__PURE__ */ jsxs19(
|
|
6977
|
+
"div",
|
|
6915
6978
|
{
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
"
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
role: "option",
|
|
6948
|
-
"aria-selected": index === activeIndex,
|
|
6949
|
-
onMouseMove: () => setActive(index),
|
|
6950
|
-
onClick: () => choose(item),
|
|
6951
|
-
className: `flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm ${index === activeIndex ? "bg-accent" : ""}`,
|
|
6952
|
-
children: [
|
|
6953
|
-
/* @__PURE__ */ jsx21("span", { className: "truncate text-foreground", children: item.label }),
|
|
6954
|
-
item.description && /* @__PURE__ */ jsx21("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
6955
|
-
item.hint && /* @__PURE__ */ jsx21("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
6956
|
-
]
|
|
6957
|
-
},
|
|
6958
|
-
item.id
|
|
6959
|
-
);
|
|
6960
|
-
})
|
|
6961
|
-
] }, section.group))
|
|
6962
|
-
] }),
|
|
6963
|
-
/* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
6964
|
-
/* @__PURE__ */ jsx21("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
6965
|
-
/* @__PURE__ */ jsxs19("span", { className: "flex items-center gap-1.5", children: [
|
|
6966
|
-
/* @__PURE__ */ jsx21("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
6967
|
-
/* @__PURE__ */ jsx21("span", { children: "navigate" }),
|
|
6968
|
-
/* @__PURE__ */ jsx21("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
6969
|
-
/* @__PURE__ */ jsx21("span", { children: "select" }),
|
|
6970
|
-
/* @__PURE__ */ jsx21("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
6971
|
-
/* @__PURE__ */ jsx21("span", { children: "close" })
|
|
6972
|
-
] })
|
|
6973
|
-
] })
|
|
6974
|
-
]
|
|
6975
|
-
}
|
|
6976
|
-
) })
|
|
6977
|
-
] }),
|
|
6978
|
-
document.body
|
|
6979
|
-
);
|
|
6979
|
+
id: `${listId}-${index}`,
|
|
6980
|
+
role: "option",
|
|
6981
|
+
"aria-selected": index === activeIndex,
|
|
6982
|
+
onMouseMove: () => setActive(index),
|
|
6983
|
+
onClick: () => choose(item),
|
|
6984
|
+
className: `flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm ${index === activeIndex ? "bg-accent" : ""}`,
|
|
6985
|
+
children: [
|
|
6986
|
+
/* @__PURE__ */ jsx21("span", { className: "truncate text-foreground", children: item.label }),
|
|
6987
|
+
item.description && /* @__PURE__ */ jsx21("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
6988
|
+
item.hint && /* @__PURE__ */ jsx21("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
6989
|
+
]
|
|
6990
|
+
},
|
|
6991
|
+
item.id
|
|
6992
|
+
);
|
|
6993
|
+
})
|
|
6994
|
+
] }, section.group))
|
|
6995
|
+
] }),
|
|
6996
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
6997
|
+
/* @__PURE__ */ jsx21("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
6998
|
+
/* @__PURE__ */ jsxs19("span", { className: "flex items-center gap-1.5", children: [
|
|
6999
|
+
/* @__PURE__ */ jsx21("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
7000
|
+
/* @__PURE__ */ jsx21("span", { children: "navigate" }),
|
|
7001
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
7002
|
+
/* @__PURE__ */ jsx21("span", { children: "select" }),
|
|
7003
|
+
/* @__PURE__ */ jsx21("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
7004
|
+
/* @__PURE__ */ jsx21("span", { children: "close" })
|
|
7005
|
+
] })
|
|
7006
|
+
] })
|
|
7007
|
+
]
|
|
7008
|
+
}
|
|
7009
|
+
) });
|
|
6980
7010
|
}
|
|
6981
7011
|
|
|
6982
7012
|
// src/web-react/sparkline.tsx
|
|
@@ -7144,12 +7174,12 @@ function Sparkline({
|
|
|
7144
7174
|
// src/web-react/insight-card.tsx
|
|
7145
7175
|
import {
|
|
7146
7176
|
isValidElement as isValidElement2,
|
|
7147
|
-
useCallback as
|
|
7148
|
-
useEffect as
|
|
7177
|
+
useCallback as useCallback10,
|
|
7178
|
+
useEffect as useEffect16,
|
|
7149
7179
|
useRef as useRef15,
|
|
7150
7180
|
useState as useState23
|
|
7151
7181
|
} from "react";
|
|
7152
|
-
import { Fragment as
|
|
7182
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7153
7183
|
function insightDelta(value, previous) {
|
|
7154
7184
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
7155
7185
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -7223,7 +7253,7 @@ function InsightCard({
|
|
|
7223
7253
|
/* @__PURE__ */ jsx23("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs21("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
7224
7254
|
/* @__PURE__ */ jsx23("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
7225
7255
|
/* @__PURE__ */ jsx23("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
7226
|
-
] }) : /* @__PURE__ */ jsxs21(
|
|
7256
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
7227
7257
|
/* @__PURE__ */ jsx23("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
7228
7258
|
unit ? /* @__PURE__ */ jsx23("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
7229
7259
|
] }) }),
|
|
@@ -7320,7 +7350,7 @@ function InsightDeck({
|
|
|
7320
7350
|
const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
|
|
7321
7351
|
const refreshing = shown !== state;
|
|
7322
7352
|
const reported = useRef15(0);
|
|
7323
|
-
const settlePage =
|
|
7353
|
+
const settlePage = useCallback10(
|
|
7324
7354
|
(next) => {
|
|
7325
7355
|
if (reported.current === next) return;
|
|
7326
7356
|
reported.current = next;
|
|
@@ -7406,15 +7436,15 @@ function InsightPages({
|
|
|
7406
7436
|
const sectionRef = useRef15(null);
|
|
7407
7437
|
const listRef = useRef15(null);
|
|
7408
7438
|
const recoverFocus = useRef15(false);
|
|
7409
|
-
|
|
7439
|
+
useEffect16(() => {
|
|
7410
7440
|
onPageSettled(current);
|
|
7411
7441
|
}, [current, onPageSettled]);
|
|
7412
|
-
|
|
7442
|
+
useEffect16(() => {
|
|
7413
7443
|
if (!recoverFocus.current) return;
|
|
7414
7444
|
recoverFocus.current = false;
|
|
7415
7445
|
sectionRef.current?.focus();
|
|
7416
7446
|
}, [current]);
|
|
7417
|
-
const goTo =
|
|
7447
|
+
const goTo = useCallback10(
|
|
7418
7448
|
(next) => {
|
|
7419
7449
|
const clamped = Math.min(Math.max(next, 0), pageCount - 1);
|
|
7420
7450
|
if (clamped === current) return false;
|
|
@@ -7557,7 +7587,7 @@ function PagerButton({
|
|
|
7557
7587
|
}
|
|
7558
7588
|
|
|
7559
7589
|
// src/web-react/api-access-panel.tsx
|
|
7560
|
-
import { useEffect as
|
|
7590
|
+
import { useEffect as useEffect17, useRef as useRef16, useState as useState24 } from "react";
|
|
7561
7591
|
import { PageHeader } from "@tangle-network/ui/primitives";
|
|
7562
7592
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7563
7593
|
var defaultExpiryChoices = [1, 7, 30];
|
|
@@ -7631,13 +7661,13 @@ function ApiAccessPanel({
|
|
|
7631
7661
|
const nameInput = useRef16(null);
|
|
7632
7662
|
const keyWasShown = useRef16(false);
|
|
7633
7663
|
const selectedScopes = pruneScopes(scopes, access);
|
|
7634
|
-
|
|
7664
|
+
useEffect17(() => {
|
|
7635
7665
|
setScopes((current) => {
|
|
7636
7666
|
const next = pruneScopes(current, access);
|
|
7637
7667
|
return next.length === current.length ? current : next;
|
|
7638
7668
|
});
|
|
7639
7669
|
}, [access]);
|
|
7640
|
-
|
|
7670
|
+
useEffect17(() => {
|
|
7641
7671
|
if (created) {
|
|
7642
7672
|
keyHeading.current?.focus();
|
|
7643
7673
|
keyWasShown.current = true;
|
|
@@ -7916,7 +7946,7 @@ function ComposerProfilePill({
|
|
|
7916
7946
|
}
|
|
7917
7947
|
|
|
7918
7948
|
// src/web-react/index.tsx
|
|
7919
|
-
import { Fragment as
|
|
7949
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7920
7950
|
function formatModelCost(msg, models) {
|
|
7921
7951
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
7922
7952
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -8175,7 +8205,7 @@ function ProposalCard({
|
|
|
8175
8205
|
] })
|
|
8176
8206
|
] }),
|
|
8177
8207
|
/* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
8178
|
-
approval && /* @__PURE__ */ jsxs25(
|
|
8208
|
+
approval && /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
8179
8209
|
/* @__PURE__ */ jsx28(
|
|
8180
8210
|
"button",
|
|
8181
8211
|
{
|
|
@@ -8432,7 +8462,7 @@ function copyTextOf(msg) {
|
|
|
8432
8462
|
function CopyMessageButton({ text }) {
|
|
8433
8463
|
const [copied, setCopied] = useState26(false);
|
|
8434
8464
|
const timerRef = useRef17(null);
|
|
8435
|
-
|
|
8465
|
+
useEffect18(
|
|
8436
8466
|
() => () => {
|
|
8437
8467
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
8438
8468
|
},
|
|
@@ -8496,7 +8526,7 @@ function AssistantMessageImpl({
|
|
|
8496
8526
|
if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
|
|
8497
8527
|
thinkMsRef.current = performance.now() - thinkStartRef.current;
|
|
8498
8528
|
}
|
|
8499
|
-
|
|
8529
|
+
useEffect18(() => {
|
|
8500
8530
|
const el = reasoningScrollRef.current;
|
|
8501
8531
|
if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
|
|
8502
8532
|
}, [reasoning, streaming, hasAnswerText]);
|
|
@@ -8570,7 +8600,7 @@ function AssistantMessageImpl({
|
|
|
8570
8600
|
toolRenderers,
|
|
8571
8601
|
messageClassName
|
|
8572
8602
|
}
|
|
8573
|
-
) : /* @__PURE__ */ jsxs25(
|
|
8603
|
+
) : /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
8574
8604
|
/* @__PURE__ */ jsxs25("div", { className: messageClassName, children: [
|
|
8575
8605
|
body,
|
|
8576
8606
|
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx28(StreamingCaret, {})
|
|
@@ -8626,7 +8656,7 @@ function AssistantMessageImpl({
|
|
|
8626
8656
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
8627
8657
|
function useThinkingSeconds(active) {
|
|
8628
8658
|
const [seconds, setSeconds] = useState26(0);
|
|
8629
|
-
|
|
8659
|
+
useEffect18(() => {
|
|
8630
8660
|
if (!active) return;
|
|
8631
8661
|
setSeconds(0);
|
|
8632
8662
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -8735,12 +8765,12 @@ function ChatMessages({
|
|
|
8735
8765
|
const quiet = chrome === "quiet";
|
|
8736
8766
|
if (messages.length === 0 && !loading && !error) {
|
|
8737
8767
|
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx28(ChatEmptyState, { ...emptyState });
|
|
8738
|
-
return /* @__PURE__ */ jsxs25(
|
|
8768
|
+
return /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
8739
8769
|
header,
|
|
8740
8770
|
empty
|
|
8741
8771
|
] });
|
|
8742
8772
|
}
|
|
8743
|
-
return /* @__PURE__ */ jsxs25(
|
|
8773
|
+
return /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
8744
8774
|
header,
|
|
8745
8775
|
messages.map(
|
|
8746
8776
|
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */ jsx28(
|
|
@@ -8831,6 +8861,8 @@ export {
|
|
|
8831
8861
|
dispatchChatStreamLine,
|
|
8832
8862
|
consumeChatStream,
|
|
8833
8863
|
streamChatTurn,
|
|
8864
|
+
requestWorkspacePrewarm,
|
|
8865
|
+
useWorkspacePrewarm,
|
|
8834
8866
|
getChatFundingRecovery,
|
|
8835
8867
|
AgentProfileRegistryError,
|
|
8836
8868
|
AGENT_PROFILE_EDITOR_SECTIONS,
|
|
@@ -8939,4 +8971,4 @@ export {
|
|
|
8939
8971
|
useThinkingSeconds,
|
|
8940
8972
|
ChatMessages
|
|
8941
8973
|
};
|
|
8942
|
-
//# sourceMappingURL=chunk-
|
|
8974
|
+
//# sourceMappingURL=chunk-4WJREKXX.js.map
|