@tangle-network/agent-app 0.61.3 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
- package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
- package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
- package/dist/VaultPane-AYW7CO33.js +8 -0
- package/dist/agent-profiles/d1.js +1 -1
- package/dist/agent-profiles/index.d.ts +0 -82
- package/dist/agent-profiles/index.js +1 -21
- package/dist/agent-profiles/self-management.d.ts +0 -55
- package/dist/alerting/index.d.ts +1 -1
- package/dist/alerting/index.js +1 -3
- package/dist/alerting/slack.d.ts +6 -79
- package/dist/app-auth/drizzle.d.ts +17 -271
- package/dist/app-auth/drizzle.js +6 -2
- package/dist/app-auth/drizzle.js.map +1 -1
- package/dist/app-auth/index.js +3 -3
- package/dist/assets/types.d.ts +2 -1
- package/dist/assistant/AssistantPanel.d.ts +1 -1
- package/dist/assistant/index.js +635 -392
- package/dist/assistant/index.js.map +1 -1
- package/dist/billing/identity-locks.d.ts +5 -0
- package/dist/billing/index.js +1 -1
- package/dist/brand-extraction/index.js.map +1 -1
- package/dist/brand-extraction/types.d.ts +2 -1
- package/dist/chat-react/index.js +6 -5
- package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
- package/dist/chat-routes/draft-persistence.d.ts +2 -14
- package/dist/chat-routes/index.d.ts +1 -0
- package/dist/chat-routes/index.js +853 -773
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
- package/dist/chat-routes/stored-attachments.d.ts +18 -0
- package/dist/chat-routes/turn-admission.d.ts +1 -1
- package/dist/chat-routes/turn-execution.d.ts +2 -2
- package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
- package/dist/chat-store/core.d.ts +19 -1
- package/dist/chat-store/index.js.map +1 -1
- package/dist/chat-store/store.d.ts +3 -29
- package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
- package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
- package/dist/chunk-52SDU43B.js.map +1 -0
- package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
- package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
- package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
- package/dist/chunk-6JEDSKFH.js.map +1 -0
- package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
- package/dist/chunk-6OG4244Y.js.map +1 -0
- package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
- package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
- package/dist/chunk-76MPX7JQ.js.map +1 -0
- package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
- package/dist/chunk-7ISHKBAD.js.map +1 -0
- package/dist/chunk-7PULOECS.js +22 -0
- package/dist/chunk-7PULOECS.js.map +1 -0
- package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
- package/dist/chunk-CPVGRQ43.js.map +1 -0
- package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
- package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
- package/dist/chunk-EFQUAWWF.js.map +1 -0
- package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
- package/dist/chunk-ELX5YITO.js.map +1 -0
- package/dist/chunk-FGAROAUF.js +19 -0
- package/dist/chunk-FGAROAUF.js.map +1 -0
- package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
- package/dist/chunk-FTNGGR37.js.map +1 -0
- package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
- package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
- package/dist/chunk-GIEUZBQQ.js.map +1 -0
- package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
- package/dist/chunk-IVBREL7A.js.map +1 -0
- package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
- package/dist/chunk-JBXNU5WD.js.map +1 -0
- package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
- package/dist/chunk-JRCZHDRG.js.map +1 -0
- package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
- package/dist/chunk-JRW6LCIA.js.map +1 -0
- package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
- package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
- package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
- package/dist/chunk-MRZP65DZ.js.map +1 -0
- package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
- package/dist/chunk-OODZCBSM.js.map +1 -0
- package/dist/chunk-P4RRC4AO.js +47 -0
- package/dist/chunk-P4RRC4AO.js.map +1 -0
- package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
- package/dist/chunk-PCAY23GS.js.map +1 -0
- package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
- package/dist/chunk-PEJ5OP5B.js.map +1 -0
- package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
- package/dist/chunk-PIPNDZ6H.js.map +1 -0
- package/dist/{chunk-DJIN3YUJ.js → chunk-TCJ4TMOW.js} +83 -47
- package/dist/{chunk-DJIN3YUJ.js.map → chunk-TCJ4TMOW.js.map} +1 -1
- package/dist/chunk-UHSUY6H6.js +79 -0
- package/dist/chunk-UHSUY6H6.js.map +1 -0
- package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
- package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
- package/dist/chunk-UW2DKTEM.js.map +1 -0
- package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
- package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
- package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
- package/dist/chunk-VYBTQK25.js.map +1 -0
- package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
- package/dist/chunk-W2BV2XOC.js.map +1 -0
- package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
- package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
- package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
- package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
- package/dist/chunk-Y3GO6SG3.js.map +1 -0
- package/dist/chunk-ZAMHLXNS.js +56 -0
- package/dist/chunk-ZAMHLXNS.js.map +1 -0
- package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
- package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
- package/dist/chunk-ZOS3D26Z.js +72 -0
- package/dist/chunk-ZOS3D26Z.js.map +1 -0
- package/dist/design-canvas/index.js +32 -32
- package/dist/design-canvas/index.js.map +1 -1
- package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
- package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
- package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
- package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
- package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
- package/dist/design-canvas-react/contracts.d.ts +2 -2
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +9 -7
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/eval/calibration.d.ts +1 -38
- package/dist/eval/index.d.ts +2 -4
- package/dist/eval/index.js +0 -84
- package/dist/eval/index.js.map +1 -1
- package/dist/harness/index.d.ts +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/harness/session-selection.d.ts +2 -2
- package/dist/hub-approvals/index.js +1 -1
- package/dist/hub-approvals/result.d.ts +1 -1
- package/dist/hub-approvals-react/index.js +4 -4
- package/dist/hub-approvals-react/index.js.map +1 -1
- package/dist/hub-approvals-react/parts.d.ts +1 -1
- package/dist/launch-invariants/cli.js +4 -4
- package/dist/launch-invariants/index.js +3 -3
- package/dist/launch-invariants/testing.js +4 -4
- package/dist/legibility/cli.js +1 -1
- package/dist/legibility/index.js +1 -1
- package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
- package/dist/mention-editor-4BKBMWIK.js.map +1 -0
- package/dist/missions/index.js +144 -137
- package/dist/missions/index.js.map +1 -1
- package/dist/operator/index.js +1 -1
- package/dist/peer-floors/check.js +1 -1
- package/dist/peer-floors/cli.js +6 -14
- package/dist/peer-floors/cli.js.map +1 -1
- package/dist/peer-floors/source-entries.d.ts +6 -0
- package/dist/platform/index.js +10 -10
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/profile/index.d.ts +0 -1
- package/dist/profile/index.js +1 -422
- package/dist/profile/index.js.map +1 -1
- package/dist/profile-editor/server.d.ts +0 -1
- package/dist/profile-editor/server.js +0 -1
- package/dist/profile-editor/server.js.map +1 -1
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +6 -6
- package/dist/record/drizzle.js +156 -148
- package/dist/record/drizzle.js.map +1 -1
- package/dist/runtime/index.js +4 -4
- package/dist/runtime/router-turn.js +3 -3
- package/dist/sandbox/box-health.d.ts +1 -1
- package/dist/sandbox/index.js +5 -5
- package/dist/sequences/drizzle.js +5 -15
- package/dist/sequences/drizzle.js.map +1 -1
- package/dist/sequences/index.d.ts +1 -0
- package/dist/sequences/index.js +18 -14
- package/dist/sequences/index.js.map +1 -1
- package/dist/sequences/row-mapping.d.ts +7 -0
- package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
- package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
- package/dist/sequences-react/components/glyphs.d.ts +12 -21
- package/dist/sequences-react/components/index.d.ts +0 -2
- package/dist/sequences-react/components/interaction-math.d.ts +3 -3
- package/dist/sequences-react/contracts.d.ts +1 -1
- package/dist/sequences-react/engine/snap.d.ts +2 -2
- package/dist/sequences-react/index.js +4 -4
- package/dist/sequences-react/index.js.map +1 -1
- package/dist/settings-react/index.js +13 -30
- package/dist/settings-react/index.js.map +1 -1
- package/dist/settings-react/timezone-picker.d.ts +0 -6
- package/dist/signoff/browser-budget.d.ts +6 -1
- package/dist/signoff/cli.d.ts +0 -7
- package/dist/signoff/cli.js +1 -2
- package/dist/signoff/cli.js.map +1 -1
- package/dist/signoff/index.js +1 -1
- package/dist/skills/index.d.ts +1 -1
- package/dist/skills/index.js +5 -25
- package/dist/skills/marketplace.d.ts +1 -75
- package/dist/skills-placement/box.js +3 -4
- package/dist/skills-placement/box.js.map +1 -1
- package/dist/skills-placement/index.js +3 -4
- package/dist/spend/cli-args.d.ts +1 -1
- package/dist/spend/cli.js +3 -3
- package/dist/spend/cli.js.map +1 -1
- package/dist/spend/index.js +1 -1
- package/dist/stories/design-canvas/fixtures.d.ts +1 -14
- package/dist/stream/index.js +17 -17
- package/dist/studio/generation.d.ts +1 -1
- package/dist/studio/index.js +1 -1
- package/dist/studio-react/index.js +353 -184
- package/dist/studio-react/index.js.map +1 -1
- package/dist/studio-react/studio-composer.d.ts +1 -5
- package/dist/studio-react/studio-history-screen.d.ts +1 -1
- package/dist/teams/invitations-api.d.ts +3 -3
- package/dist/teams/invitations-api.js +74 -72
- package/dist/teams/invitations-api.js.map +1 -1
- package/dist/teams/member-sync.d.ts +2 -0
- package/dist/teams/members-api.d.ts +2 -2
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/index.js +28 -45
- package/dist/teams-react/index.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp-arguments.d.ts +1 -1
- package/dist/trace/index.d.ts +1 -18
- package/dist/trace/index.js +1 -36
- package/dist/trace/index.js.map +1 -1
- package/dist/trace/mission-flow.d.ts +1 -59
- package/dist/turn-health/index.d.ts +1 -1
- package/dist/turn-health/index.js +2 -2
- package/dist/turn-health/sink.d.ts +2 -1
- package/dist/turn-trace/index.js +2 -4
- package/dist/turn-trace/recorder.d.ts +0 -2
- package/dist/vault/VaultPane.d.ts +0 -20
- package/dist/vault/VaultPaneOperations.d.ts +318 -0
- package/dist/vault/index.js +2 -1
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/agent-profile-editor.d.ts +1 -2
- package/dist/web-react/agent-profile-editor.js +6 -5
- package/dist/web-react/chat-composer.d.ts +1 -1
- package/dist/web-react/durable-plan-flow.d.ts +6 -1
- package/dist/web-react/editor-glyphs.d.ts +12 -0
- package/dist/web-react/focus-navigation.d.ts +12 -0
- package/dist/web-react/history-controls.d.ts +37 -0
- package/dist/web-react/index.js +36 -34
- package/dist/web-react/interaction-question-card.d.ts +1 -1
- package/dist/web-react/record-grid-writes.d.ts +31 -0
- package/dist/web-react/record-grid.d.ts +1 -48
- package/dist/web-react/session-history-panel.d.ts +1 -9
- package/dist/web-react/use-document-dark.d.ts +1 -0
- package/dist/workspace-export/engine.d.ts +1 -6
- package/dist/workspace-export/index.js +198 -185
- package/dist/workspace-export/index.js.map +1 -1
- package/dist/workspace-export/routes.d.ts +1 -1
- package/dist/workspace-react/index.js +9 -8
- package/dist/workspace-react/index.js.map +1 -1
- package/package.json +7 -17
- package/dist/VaultPane-RXL3WLA2.js +0 -7
- package/dist/agent-profiles/reaper.d.ts +0 -31
- package/dist/agent-profiles/reaper.js +0 -29
- package/dist/agent-profiles/reaper.js.map +0 -1
- package/dist/chunk-4ZSLX3LY.js.map +0 -1
- package/dist/chunk-5IM2CLYX.js.map +0 -1
- package/dist/chunk-6OSJNJA2.js +0 -251
- package/dist/chunk-6OSJNJA2.js.map +0 -1
- package/dist/chunk-6PRQ45QE.js.map +0 -1
- package/dist/chunk-6ZIC6OG5.js.map +0 -1
- package/dist/chunk-BDEBQ4WO.js +0 -38
- package/dist/chunk-BDEBQ4WO.js.map +0 -1
- package/dist/chunk-BOQ4HVVH.js.map +0 -1
- package/dist/chunk-F2VX6TTJ.js.map +0 -1
- package/dist/chunk-FPNZMIAW.js.map +0 -1
- package/dist/chunk-HN6MZ2XL.js.map +0 -1
- package/dist/chunk-J2BBYVGF.js.map +0 -1
- package/dist/chunk-KJODHPWM.js.map +0 -1
- package/dist/chunk-LTWJYNEC.js +0 -100
- package/dist/chunk-LTWJYNEC.js.map +0 -1
- package/dist/chunk-LXYQOOXU.js.map +0 -1
- package/dist/chunk-MEKOWH5E.js.map +0 -1
- package/dist/chunk-NHYRIM4I.js.map +0 -1
- package/dist/chunk-NMZUW6VJ.js.map +0 -1
- package/dist/chunk-ORQD4AUO.js.map +0 -1
- package/dist/chunk-R4X5474U.js.map +0 -1
- package/dist/chunk-RL3Z747H.js.map +0 -1
- package/dist/chunk-TXUAGSFR.js.map +0 -1
- package/dist/chunk-UCCSJX64.js.map +0 -1
- package/dist/chunk-VJBFCNAU.js.map +0 -1
- package/dist/chunk-WSEXFTN4.js.map +0 -1
- package/dist/chunk-Y43PXON2.js.map +0 -1
- package/dist/chunk-ZBB5KQ6B.js.map +0 -1
- package/dist/eval/parity.d.ts +0 -74
- package/dist/mention-editor-B23OMFT2.js.map +0 -1
- package/dist/profile/humanizer-skill.d.ts +0 -23
- package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
- package/dist/sequences-react/components/BrandMark.d.ts +0 -10
- package/dist/skills/marketplace-drizzle.d.ts +0 -121
- package/dist/skills/marketplace-drizzle.js +0 -34
- package/dist/skills/marketplace-drizzle.js.map +0 -1
- package/dist/teams-react/components/BrandMark.d.ts +0 -10
- /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
- /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
- /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
- /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
- /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
- /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
- /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
- /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
- /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
- /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
- /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
- /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
- /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useInfiniteScroll
|
|
3
|
-
} from "./chunk-BDEBQ4WO.js";
|
|
4
1
|
import {
|
|
5
2
|
PATH_CONTINUATION_CHAR,
|
|
6
3
|
WORD_CHAR,
|
|
7
4
|
charAt,
|
|
8
5
|
charBefore
|
|
9
6
|
} from "./chunk-3HUFJ5LO.js";
|
|
7
|
+
import {
|
|
8
|
+
loadHistoryPage,
|
|
9
|
+
useHistoryControls,
|
|
10
|
+
useInfiniteScroll
|
|
11
|
+
} from "./chunk-UHSUY6H6.js";
|
|
12
|
+
import {
|
|
13
|
+
BrandMark
|
|
14
|
+
} from "./chunk-7PULOECS.js";
|
|
10
15
|
import {
|
|
11
16
|
stepActivityFlowTrace
|
|
12
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-ZOS3D26Z.js";
|
|
13
18
|
import {
|
|
14
19
|
WorkProductCard,
|
|
15
20
|
workProductPartsFromMessageParts
|
|
@@ -20,7 +25,14 @@ import {
|
|
|
20
25
|
import {
|
|
21
26
|
ActionDialog,
|
|
22
27
|
ActionDialogButton
|
|
23
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6ZVSMA4T.js";
|
|
29
|
+
import {
|
|
30
|
+
UNTITLED_SESSION_LABEL,
|
|
31
|
+
filterCommandPaletteItems,
|
|
32
|
+
groupCommandPaletteItems,
|
|
33
|
+
mergeSessionPages,
|
|
34
|
+
sessionLabel
|
|
35
|
+
} from "./chunk-SJWIZT7B.js";
|
|
24
36
|
import {
|
|
25
37
|
BrainGlyph,
|
|
26
38
|
ChevronDown,
|
|
@@ -31,17 +43,10 @@ import {
|
|
|
31
43
|
useBrowserLayoutEffect,
|
|
32
44
|
usePending,
|
|
33
45
|
usePopover
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import {
|
|
36
|
-
UNTITLED_SESSION_LABEL,
|
|
37
|
-
filterCommandPaletteItems,
|
|
38
|
-
groupCommandPaletteItems,
|
|
39
|
-
mergeSessionPages,
|
|
40
|
-
sessionLabel
|
|
41
|
-
} from "./chunk-SJWIZT7B.js";
|
|
46
|
+
} from "./chunk-52SDU43B.js";
|
|
42
47
|
import {
|
|
43
48
|
ReviewFeedbackForm
|
|
44
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-2VJLLRVV.js";
|
|
45
50
|
import {
|
|
46
51
|
AsyncView
|
|
47
52
|
} from "./chunk-AVP5SNIG.js";
|
|
@@ -1122,7 +1127,7 @@ var TERMINAL_NOTES = interactionTerminalNotes("question", {
|
|
|
1122
1127
|
cancelled: "The agent withdrew this question. Answer here to send it as a new message.",
|
|
1123
1128
|
declined: "You declined this question."
|
|
1124
1129
|
});
|
|
1125
|
-
function
|
|
1130
|
+
function useInteractionQuestionCardViewState({
|
|
1126
1131
|
interaction,
|
|
1127
1132
|
canWrite,
|
|
1128
1133
|
submitAnswer,
|
|
@@ -1257,6 +1262,63 @@ function InteractionQuestionCard({
|
|
|
1257
1262
|
const showDeclineButton = declinable && canWrite && status === "pending";
|
|
1258
1263
|
const unanswered = showSubmitButton && !disabled && !answerData ? firstUnansweredRequiredField(interaction.fields, values) : null;
|
|
1259
1264
|
const missingHint = unanswered ? missingAnswerHint(unanswered, interaction.fields.length, lateAnswerable ? "send" : "submit") : null;
|
|
1265
|
+
return {
|
|
1266
|
+
className,
|
|
1267
|
+
kindLabel,
|
|
1268
|
+
answered,
|
|
1269
|
+
status,
|
|
1270
|
+
interaction,
|
|
1271
|
+
renderMarkdown,
|
|
1272
|
+
values,
|
|
1273
|
+
disabled,
|
|
1274
|
+
toggleSelected,
|
|
1275
|
+
setFieldValue,
|
|
1276
|
+
error,
|
|
1277
|
+
terminalNote,
|
|
1278
|
+
showSubmitButton,
|
|
1279
|
+
showTimeoutNote,
|
|
1280
|
+
timeoutNote,
|
|
1281
|
+
missingHint,
|
|
1282
|
+
showDeclineButton,
|
|
1283
|
+
decline,
|
|
1284
|
+
declining,
|
|
1285
|
+
submit,
|
|
1286
|
+
answerData,
|
|
1287
|
+
submitLabel,
|
|
1288
|
+
lateAnswerSent,
|
|
1289
|
+
lateAnswerOutcome
|
|
1290
|
+
};
|
|
1291
|
+
}
|
|
1292
|
+
function InteractionQuestionCard(props) {
|
|
1293
|
+
const view = useInteractionQuestionCardViewState(props);
|
|
1294
|
+
return /* @__PURE__ */ jsx5(InteractionQuestionCardView, { ...view });
|
|
1295
|
+
}
|
|
1296
|
+
function InteractionQuestionCardView({
|
|
1297
|
+
className,
|
|
1298
|
+
kindLabel,
|
|
1299
|
+
answered,
|
|
1300
|
+
status,
|
|
1301
|
+
interaction,
|
|
1302
|
+
renderMarkdown,
|
|
1303
|
+
values,
|
|
1304
|
+
disabled,
|
|
1305
|
+
toggleSelected,
|
|
1306
|
+
setFieldValue,
|
|
1307
|
+
error,
|
|
1308
|
+
terminalNote,
|
|
1309
|
+
showSubmitButton,
|
|
1310
|
+
showTimeoutNote,
|
|
1311
|
+
timeoutNote,
|
|
1312
|
+
missingHint,
|
|
1313
|
+
showDeclineButton,
|
|
1314
|
+
decline,
|
|
1315
|
+
declining,
|
|
1316
|
+
submit,
|
|
1317
|
+
answerData,
|
|
1318
|
+
submitLabel,
|
|
1319
|
+
lateAnswerSent,
|
|
1320
|
+
lateAnswerOutcome
|
|
1321
|
+
}) {
|
|
1260
1322
|
return (
|
|
1261
1323
|
// The card LANDS. This is the moment the run stopped and handed the turn
|
|
1262
1324
|
// back — a surface that blinks into place reads as chrome that was always
|
|
@@ -1275,89 +1337,17 @@ function InteractionQuestionCard({
|
|
|
1275
1337
|
] }),
|
|
1276
1338
|
interaction.title.trim() && interaction.fields.every((field) => field.label !== interaction.title) && /* @__PURE__ */ jsx5("p", { className: "mb-3 text-[15px] font-semibold leading-snug text-foreground", children: interaction.title }),
|
|
1277
1339
|
interaction.body && (renderMarkdown ? /* @__PURE__ */ jsx5("div", { className: "mb-3 text-sm leading-5 text-muted-foreground", children: renderMarkdown(interaction.body) }) : /* @__PURE__ */ jsx5("p", { className: "mb-3 text-sm leading-5 text-muted-foreground", children: interaction.body })),
|
|
1278
|
-
/* @__PURE__ */ jsx5(
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
idPrefix: `${interaction.id}-${field.name}`,
|
|
1290
|
-
options: select.options,
|
|
1291
|
-
multi: select.multi === true,
|
|
1292
|
-
selectedValues: value.selected ?? [],
|
|
1293
|
-
disabled,
|
|
1294
|
-
onToggle: (optionValue) => toggleSelected(select, optionValue),
|
|
1295
|
-
answered
|
|
1296
|
-
}
|
|
1297
|
-
),
|
|
1298
|
-
select.allowCustom === true && /* @__PURE__ */ jsx5(
|
|
1299
|
-
"input",
|
|
1300
|
-
{
|
|
1301
|
-
type: "text",
|
|
1302
|
-
value: value.custom ?? "",
|
|
1303
|
-
disabled,
|
|
1304
|
-
onChange: (event) => setFieldValue(field.name, { custom: event.target.value }),
|
|
1305
|
-
placeholder: "Other \u2014 type your own answer",
|
|
1306
|
-
"aria-label": `Custom answer for ${field.label}`,
|
|
1307
|
-
className: FIELD_INPUT_CLASSES
|
|
1308
|
-
}
|
|
1309
|
-
)
|
|
1310
|
-
] }) : field.type === "boolean" ? /* @__PURE__ */ jsx5("div", { className: "flex gap-4", children: ["true", "false"].map((boolValue) => /* @__PURE__ */ jsxs5("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-foreground", children: [
|
|
1311
|
-
/* @__PURE__ */ jsx5(
|
|
1312
|
-
"input",
|
|
1313
|
-
{
|
|
1314
|
-
type: "radio",
|
|
1315
|
-
name: `${interaction.id}-${field.name}`,
|
|
1316
|
-
value: boolValue,
|
|
1317
|
-
checked: (value.selected ?? [])[0] === boolValue,
|
|
1318
|
-
disabled,
|
|
1319
|
-
onChange: () => setFieldValue(field.name, { selected: [boolValue] }),
|
|
1320
|
-
className: "h-4 w-4 accent-primary"
|
|
1321
|
-
}
|
|
1322
|
-
),
|
|
1323
|
-
boolValue === "true" ? "Yes" : "No"
|
|
1324
|
-
] }, boolValue)) }) : field.type === "number" ? /* @__PURE__ */ jsx5(
|
|
1325
|
-
"input",
|
|
1326
|
-
{
|
|
1327
|
-
type: "number",
|
|
1328
|
-
value: value.text ?? "",
|
|
1329
|
-
disabled,
|
|
1330
|
-
"aria-label": field.label,
|
|
1331
|
-
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1332
|
-
className: FIELD_INPUT_CLASSES
|
|
1333
|
-
}
|
|
1334
|
-
) : field.type === "secret" ? /* @__PURE__ */ jsx5(
|
|
1335
|
-
"input",
|
|
1336
|
-
{
|
|
1337
|
-
type: "password",
|
|
1338
|
-
value: value.text ?? "",
|
|
1339
|
-
disabled,
|
|
1340
|
-
"aria-label": field.label,
|
|
1341
|
-
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1342
|
-
placeholder: field.placeholder,
|
|
1343
|
-
maxLength: freeText ? textFieldMaxLength(freeText) : void 0,
|
|
1344
|
-
className: FIELD_INPUT_CLASSES
|
|
1345
|
-
}
|
|
1346
|
-
) : /* @__PURE__ */ jsx5(
|
|
1347
|
-
"textarea",
|
|
1348
|
-
{
|
|
1349
|
-
value: value.text ?? "",
|
|
1350
|
-
disabled,
|
|
1351
|
-
"aria-label": field.label,
|
|
1352
|
-
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1353
|
-
rows: 3,
|
|
1354
|
-
maxLength: freeText ? textFieldMaxLength(freeText) : void 0,
|
|
1355
|
-
placeholder: field.type === "text" ? field.placeholder : void 0,
|
|
1356
|
-
className: FIELD_INPUT_CLASSES
|
|
1357
|
-
}
|
|
1358
|
-
)
|
|
1359
|
-
] }, field.name);
|
|
1360
|
-
}) }),
|
|
1340
|
+
/* @__PURE__ */ jsx5(
|
|
1341
|
+
InteractionQuestionFields,
|
|
1342
|
+
{
|
|
1343
|
+
interaction,
|
|
1344
|
+
values,
|
|
1345
|
+
disabled,
|
|
1346
|
+
toggleSelected,
|
|
1347
|
+
answered,
|
|
1348
|
+
setFieldValue
|
|
1349
|
+
}
|
|
1350
|
+
),
|
|
1361
1351
|
error && /* @__PURE__ */ jsx5("p", { role: "alert", className: "mt-3 text-sm text-destructive", children: error }),
|
|
1362
1352
|
terminalNote && /* @__PURE__ */ jsx5("p", { className: "mt-3 text-sm text-muted-foreground", children: terminalNote }),
|
|
1363
1353
|
(showSubmitButton || showTimeoutNote) && /* @__PURE__ */ jsxs5("div", { className: "mt-4 flex flex-wrap items-center justify-end gap-2", children: [
|
|
@@ -1377,6 +1367,98 @@ function InteractionQuestionCard({
|
|
|
1377
1367
|
] })
|
|
1378
1368
|
);
|
|
1379
1369
|
}
|
|
1370
|
+
function InteractionQuestionFields({
|
|
1371
|
+
interaction,
|
|
1372
|
+
values,
|
|
1373
|
+
disabled,
|
|
1374
|
+
toggleSelected,
|
|
1375
|
+
answered,
|
|
1376
|
+
setFieldValue
|
|
1377
|
+
}) {
|
|
1378
|
+
return /* @__PURE__ */ jsx5("div", { className: "space-y-4", children: interaction.fields.map((field) => {
|
|
1379
|
+
const value = values[field.name] ?? {};
|
|
1380
|
+
const select = selectField(field);
|
|
1381
|
+
const freeText = freeTextField(field);
|
|
1382
|
+
return /* @__PURE__ */ jsxs5("fieldset", { className: "space-y-2", children: [
|
|
1383
|
+
/* @__PURE__ */ jsx5("p", { className: "text-sm font-medium leading-5 text-foreground", children: field.label }),
|
|
1384
|
+
select ? /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1385
|
+
/* @__PURE__ */ jsx5(
|
|
1386
|
+
QuestionOptionList,
|
|
1387
|
+
{
|
|
1388
|
+
groupName: `${interaction.id}-${field.name}`,
|
|
1389
|
+
idPrefix: `${interaction.id}-${field.name}`,
|
|
1390
|
+
options: select.options,
|
|
1391
|
+
multi: select.multi === true,
|
|
1392
|
+
selectedValues: value.selected ?? [],
|
|
1393
|
+
disabled,
|
|
1394
|
+
onToggle: (optionValue) => toggleSelected(select, optionValue),
|
|
1395
|
+
answered
|
|
1396
|
+
}
|
|
1397
|
+
),
|
|
1398
|
+
select.allowCustom === true && /* @__PURE__ */ jsx5(
|
|
1399
|
+
"input",
|
|
1400
|
+
{
|
|
1401
|
+
type: "text",
|
|
1402
|
+
value: value.custom ?? "",
|
|
1403
|
+
disabled,
|
|
1404
|
+
onChange: (event) => setFieldValue(field.name, { custom: event.target.value }),
|
|
1405
|
+
placeholder: "Other \u2014 type your own answer",
|
|
1406
|
+
"aria-label": `Custom answer for ${field.label}`,
|
|
1407
|
+
className: FIELD_INPUT_CLASSES
|
|
1408
|
+
}
|
|
1409
|
+
)
|
|
1410
|
+
] }) : field.type === "boolean" ? /* @__PURE__ */ jsx5("div", { className: "flex gap-4", children: ["true", "false"].map((boolValue) => /* @__PURE__ */ jsxs5("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-foreground", children: [
|
|
1411
|
+
/* @__PURE__ */ jsx5(
|
|
1412
|
+
"input",
|
|
1413
|
+
{
|
|
1414
|
+
type: "radio",
|
|
1415
|
+
name: `${interaction.id}-${field.name}`,
|
|
1416
|
+
value: boolValue,
|
|
1417
|
+
checked: (value.selected ?? [])[0] === boolValue,
|
|
1418
|
+
disabled,
|
|
1419
|
+
onChange: () => setFieldValue(field.name, { selected: [boolValue] }),
|
|
1420
|
+
className: "h-4 w-4 accent-primary"
|
|
1421
|
+
}
|
|
1422
|
+
),
|
|
1423
|
+
boolValue === "true" ? "Yes" : "No"
|
|
1424
|
+
] }, boolValue)) }) : field.type === "number" ? /* @__PURE__ */ jsx5(
|
|
1425
|
+
"input",
|
|
1426
|
+
{
|
|
1427
|
+
type: "number",
|
|
1428
|
+
value: value.text ?? "",
|
|
1429
|
+
disabled,
|
|
1430
|
+
"aria-label": field.label,
|
|
1431
|
+
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1432
|
+
className: FIELD_INPUT_CLASSES
|
|
1433
|
+
}
|
|
1434
|
+
) : field.type === "secret" ? /* @__PURE__ */ jsx5(
|
|
1435
|
+
"input",
|
|
1436
|
+
{
|
|
1437
|
+
type: "password",
|
|
1438
|
+
value: value.text ?? "",
|
|
1439
|
+
disabled,
|
|
1440
|
+
"aria-label": field.label,
|
|
1441
|
+
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1442
|
+
placeholder: field.placeholder,
|
|
1443
|
+
maxLength: freeText ? textFieldMaxLength(freeText) : void 0,
|
|
1444
|
+
className: FIELD_INPUT_CLASSES
|
|
1445
|
+
}
|
|
1446
|
+
) : /* @__PURE__ */ jsx5(
|
|
1447
|
+
"textarea",
|
|
1448
|
+
{
|
|
1449
|
+
value: value.text ?? "",
|
|
1450
|
+
disabled,
|
|
1451
|
+
"aria-label": field.label,
|
|
1452
|
+
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
1453
|
+
rows: 3,
|
|
1454
|
+
maxLength: freeText ? textFieldMaxLength(freeText) : void 0,
|
|
1455
|
+
placeholder: field.type === "text" ? field.placeholder : void 0,
|
|
1456
|
+
className: FIELD_INPUT_CLASSES
|
|
1457
|
+
}
|
|
1458
|
+
)
|
|
1459
|
+
] }, field.name);
|
|
1460
|
+
}) });
|
|
1461
|
+
}
|
|
1380
1462
|
|
|
1381
1463
|
// src/web-react/interaction-plan-card.tsx
|
|
1382
1464
|
import { useLayoutEffect, useMemo as useMemo3, useRef as useRef4, useState as useState7 } from "react";
|
|
@@ -1596,7 +1678,7 @@ function InteractionPlanCard({
|
|
|
1596
1678
|
}
|
|
1597
1679
|
|
|
1598
1680
|
// src/web-react/durable-plan-flow.ts
|
|
1599
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef5, useState as useState8 } from "react";
|
|
1681
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState8 } from "react";
|
|
1600
1682
|
var DurablePlanClientError = class extends Error {
|
|
1601
1683
|
constructor(message, status, code, currentPlan) {
|
|
1602
1684
|
super(message);
|
|
@@ -1682,6 +1764,34 @@ function createDurablePlanDecisionClient(options) {
|
|
|
1682
1764
|
}
|
|
1683
1765
|
};
|
|
1684
1766
|
}
|
|
1767
|
+
var RESTORE_ATTEMPT_LIMIT = 2;
|
|
1768
|
+
var ATTACH_ERROR = "Your decision was saved, but notifying the agent about it failed. Try again.";
|
|
1769
|
+
function planDecisionKey(plan) {
|
|
1770
|
+
return `${plan.planId}:${plan.revision}:${plan.status}`;
|
|
1771
|
+
}
|
|
1772
|
+
function useAutomaticPlanRestore(args) {
|
|
1773
|
+
const { plan, enabled, restore, state, retry, advance, failed } = args;
|
|
1774
|
+
useEffect4(() => {
|
|
1775
|
+
if (!enabled || plan.status !== "approved" && plan.status !== "rejected") return;
|
|
1776
|
+
const key = planDecisionKey(plan);
|
|
1777
|
+
if (state.current.restored === key || state.current.inFlight === key) return;
|
|
1778
|
+
const attempts = state.current.attempts.get(key) ?? 0;
|
|
1779
|
+
if (attempts >= RESTORE_ATTEMPT_LIMIT) {
|
|
1780
|
+
failed(ATTACH_ERROR);
|
|
1781
|
+
return;
|
|
1782
|
+
}
|
|
1783
|
+
state.current.attempts.set(key, attempts + 1);
|
|
1784
|
+
state.current.inFlight = key;
|
|
1785
|
+
const active = state.current;
|
|
1786
|
+
void restore().then((result) => {
|
|
1787
|
+
if (state.current !== active) return;
|
|
1788
|
+
if (state.current.inFlight === key) state.current.inFlight = null;
|
|
1789
|
+
if (state.current.restored === key || result?.effectPending) return;
|
|
1790
|
+
if ((state.current.attempts.get(key) ?? 0) < RESTORE_ATTEMPT_LIMIT) advance();
|
|
1791
|
+
else failed(ATTACH_ERROR);
|
|
1792
|
+
});
|
|
1793
|
+
}, [plan.planId, plan.revision, plan.status, enabled, restore, state, retry, advance, failed]);
|
|
1794
|
+
}
|
|
1685
1795
|
function useDurablePlanFlow(options) {
|
|
1686
1796
|
const [plan, setPlan] = useState8(options.plan);
|
|
1687
1797
|
const [deciding, setDeciding] = useState8(null);
|
|
@@ -1689,22 +1799,78 @@ function useDurablePlanFlow(options) {
|
|
|
1689
1799
|
const [error, setError] = useState8(null);
|
|
1690
1800
|
const attachments = useRef5(/* @__PURE__ */ new Map());
|
|
1691
1801
|
const decisionInFlight = useRef5(false);
|
|
1802
|
+
const restoration = useRef5({ restored: null, inFlight: null, attempts: /* @__PURE__ */ new Map() });
|
|
1803
|
+
const [effectPending, setEffectPending] = useState8(false);
|
|
1804
|
+
const [attachError, setAttachError] = useState8(null);
|
|
1805
|
+
const [restoreRetry, setRestoreRetry] = useState8(0);
|
|
1806
|
+
const advanceRestore = useCallback2(() => setRestoreRetry((value) => value + 1), []);
|
|
1807
|
+
const lifetime = useRef5(null);
|
|
1808
|
+
useLayoutEffect2(() => {
|
|
1809
|
+
lifetime.current = {};
|
|
1810
|
+
restoration.current = { restored: null, inFlight: null, attempts: /* @__PURE__ */ new Map() };
|
|
1811
|
+
attachments.current = /* @__PURE__ */ new Map();
|
|
1812
|
+
decisionInFlight.current = false;
|
|
1813
|
+
setPlan(options.plan);
|
|
1814
|
+
setEffectPending(false);
|
|
1815
|
+
setAttachError(null);
|
|
1816
|
+
setError(null);
|
|
1817
|
+
setDeciding(null);
|
|
1818
|
+
setRestoring(false);
|
|
1819
|
+
return () => {
|
|
1820
|
+
lifetime.current = null;
|
|
1821
|
+
restoration.current = { restored: null, inFlight: null, attempts: /* @__PURE__ */ new Map() };
|
|
1822
|
+
};
|
|
1823
|
+
}, [options.plan.planId, options.plan.revision, options.client]);
|
|
1692
1824
|
useEffect4(() => setPlan(options.plan), [options.plan]);
|
|
1693
|
-
const apply = useCallback2(async (result) => {
|
|
1825
|
+
const apply = useCallback2(async (result, context, decision) => {
|
|
1826
|
+
const active = () => lifetime.current === context;
|
|
1827
|
+
if (!active()) return;
|
|
1694
1828
|
setPlan(result.plan);
|
|
1695
1829
|
options.onUpdated?.(result.plan);
|
|
1830
|
+
if (!active()) return;
|
|
1831
|
+
setEffectPending(result.effectPending === true);
|
|
1696
1832
|
const receipt = result.followUp;
|
|
1697
|
-
if (!receipt
|
|
1698
|
-
|
|
1833
|
+
if (!receipt) {
|
|
1834
|
+
restoration.current.restored = planDecisionKey(result.plan);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
if (!options.attachFollowUp) return;
|
|
1838
|
+
const currentAttachments = attachments.current;
|
|
1839
|
+
let pending = currentAttachments.get(receipt.receiptId);
|
|
1699
1840
|
if (!pending) {
|
|
1700
|
-
pending = Promise.resolve(
|
|
1701
|
-
|
|
1702
|
-
|
|
1841
|
+
pending = Promise.resolve().then(() => {
|
|
1842
|
+
if (active()) return options.attachFollowUp(
|
|
1843
|
+
receipt,
|
|
1844
|
+
result.plan,
|
|
1845
|
+
decision ?? (result.plan.status === "rejected" ? "rejected" : "approved")
|
|
1846
|
+
);
|
|
1847
|
+
});
|
|
1848
|
+
currentAttachments.set(receipt.receiptId, pending);
|
|
1849
|
+
const release = () => {
|
|
1850
|
+
currentAttachments.delete(receipt.receiptId);
|
|
1851
|
+
};
|
|
1852
|
+
void pending.then(release, release);
|
|
1853
|
+
}
|
|
1854
|
+
try {
|
|
1855
|
+
await pending;
|
|
1856
|
+
if (!active()) return;
|
|
1857
|
+
restoration.current.restored = planDecisionKey(result.plan);
|
|
1858
|
+
setAttachError(null);
|
|
1859
|
+
} catch (cause) {
|
|
1860
|
+
if (!active()) return;
|
|
1861
|
+
if (!options.autoRestore) throw cause;
|
|
1862
|
+
const key = planDecisionKey(result.plan);
|
|
1863
|
+
if (restoration.current.restored === key) restoration.current.restored = null;
|
|
1864
|
+
if (decision !== void 0) {
|
|
1865
|
+
restoration.current.attempts.set(key, 0);
|
|
1866
|
+
setAttachError(null);
|
|
1867
|
+
advanceRestore();
|
|
1868
|
+
}
|
|
1703
1869
|
}
|
|
1704
|
-
|
|
1705
|
-
}, [options.attachFollowUp, options.onUpdated]);
|
|
1870
|
+
}, [options.attachFollowUp, options.onUpdated, options.autoRestore, advanceRestore]);
|
|
1706
1871
|
const decide = useCallback2(async (decision, feedback) => {
|
|
1707
|
-
|
|
1872
|
+
const context = lifetime.current;
|
|
1873
|
+
if (!context || decisionInFlight.current) return null;
|
|
1708
1874
|
decisionInFlight.current = true;
|
|
1709
1875
|
setDeciding(decision);
|
|
1710
1876
|
setError(null);
|
|
@@ -1715,9 +1881,11 @@ function useDurablePlanFlow(options) {
|
|
|
1715
1881
|
decision,
|
|
1716
1882
|
...feedback?.trim() ? { feedback: feedback.trim() } : {}
|
|
1717
1883
|
});
|
|
1718
|
-
|
|
1719
|
-
|
|
1884
|
+
if (lifetime.current !== context) return null;
|
|
1885
|
+
await apply(result, context, decision);
|
|
1886
|
+
return lifetime.current === context ? result : null;
|
|
1720
1887
|
} catch (cause) {
|
|
1888
|
+
if (lifetime.current !== context) return null;
|
|
1721
1889
|
if (cause instanceof DurablePlanClientError && cause.currentPlan) {
|
|
1722
1890
|
setPlan(cause.currentPlan);
|
|
1723
1891
|
options.onUpdated?.(cause.currentPlan);
|
|
@@ -1725,29 +1893,60 @@ function useDurablePlanFlow(options) {
|
|
|
1725
1893
|
setError(cause instanceof Error ? cause.message : "Could not decide the plan.");
|
|
1726
1894
|
return null;
|
|
1727
1895
|
} finally {
|
|
1728
|
-
|
|
1729
|
-
|
|
1896
|
+
if (lifetime.current === context) {
|
|
1897
|
+
decisionInFlight.current = false;
|
|
1898
|
+
setDeciding(null);
|
|
1899
|
+
}
|
|
1730
1900
|
}
|
|
1731
1901
|
}, [apply, options.client, options.onUpdated, plan.planId, plan.revision]);
|
|
1732
1902
|
const restore = useCallback2(async () => {
|
|
1903
|
+
const context = lifetime.current;
|
|
1904
|
+
if (!context) return null;
|
|
1733
1905
|
setRestoring(true);
|
|
1734
1906
|
setError(null);
|
|
1735
1907
|
try {
|
|
1736
1908
|
const result = await options.client.current({ planId: plan.planId, revision: plan.revision });
|
|
1737
|
-
|
|
1738
|
-
|
|
1909
|
+
if (lifetime.current !== context) return null;
|
|
1910
|
+
await apply(result, context);
|
|
1911
|
+
return lifetime.current === context ? result : null;
|
|
1739
1912
|
} catch (cause) {
|
|
1913
|
+
if (lifetime.current !== context) return null;
|
|
1740
1914
|
setError(cause instanceof Error ? cause.message : "Could not restore the plan.");
|
|
1741
1915
|
return null;
|
|
1742
1916
|
} finally {
|
|
1743
|
-
setRestoring(false);
|
|
1917
|
+
if (lifetime.current === context) setRestoring(false);
|
|
1744
1918
|
}
|
|
1745
1919
|
}, [apply, options.client, plan.planId, plan.revision]);
|
|
1746
|
-
|
|
1920
|
+
const retryAttach = useCallback2(() => {
|
|
1921
|
+
restoration.current.attempts.set(planDecisionKey(plan), 0);
|
|
1922
|
+
setAttachError(null);
|
|
1923
|
+
advanceRestore();
|
|
1924
|
+
}, [plan.planId, plan.revision, plan.status, advanceRestore]);
|
|
1925
|
+
useAutomaticPlanRestore({
|
|
1926
|
+
plan,
|
|
1927
|
+
enabled: options.autoRestore === true && !!options.attachFollowUp && deciding === null && plan.planId === options.plan.planId && plan.revision === options.plan.revision,
|
|
1928
|
+
restore,
|
|
1929
|
+
state: restoration,
|
|
1930
|
+
retry: restoreRetry,
|
|
1931
|
+
advance: advanceRestore,
|
|
1932
|
+
failed: setAttachError
|
|
1933
|
+
});
|
|
1934
|
+
return {
|
|
1935
|
+
plan,
|
|
1936
|
+
deciding,
|
|
1937
|
+
restoring,
|
|
1938
|
+
error,
|
|
1939
|
+
decide,
|
|
1940
|
+
restore,
|
|
1941
|
+
clearError: () => setError(null),
|
|
1942
|
+
effectPending,
|
|
1943
|
+
attachError,
|
|
1944
|
+
retryAttach
|
|
1945
|
+
};
|
|
1747
1946
|
}
|
|
1748
1947
|
|
|
1749
1948
|
// src/web-react/durable-plan-card.tsx
|
|
1750
|
-
import { useEffect as useEffect5, useLayoutEffect as
|
|
1949
|
+
import { useEffect as useEffect5, useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState9 } from "react";
|
|
1751
1950
|
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1752
1951
|
function statusLabel(plan) {
|
|
1753
1952
|
switch (plan.status) {
|
|
@@ -1783,7 +1982,7 @@ function DurablePlanCard({
|
|
|
1783
1982
|
const disabled = !canWrite || !actionable || deciding !== null;
|
|
1784
1983
|
const bodyRef = useRef6(null);
|
|
1785
1984
|
const [overflows, setOverflows] = useState9(false);
|
|
1786
|
-
|
|
1985
|
+
useLayoutEffect3(() => {
|
|
1787
1986
|
const el = bodyRef.current;
|
|
1788
1987
|
if (el) setOverflows(el.scrollHeight > COLLAPSED_MAX_HEIGHT2);
|
|
1789
1988
|
}, [plan.body, renderMarkdown]);
|
|
@@ -3475,45 +3674,21 @@ function useSessionHistory({
|
|
|
3475
3674
|
const controller = new AbortController();
|
|
3476
3675
|
loadMoreAbortRef.current = controller;
|
|
3477
3676
|
setPhase("loadingMore");
|
|
3478
|
-
void (
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
if (seq !== seqRef.current) return;
|
|
3677
|
+
void loadHistoryPage(
|
|
3678
|
+
() => currentFetch({ q: currentQ, sort: currentSort, cursor, signal: controller.signal }),
|
|
3679
|
+
(page) => {
|
|
3482
3680
|
setItems((prev) => mergeSessionPages(prev, page.items));
|
|
3483
3681
|
setNextCursor(page.nextCursor ?? null);
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
if (seq === seqRef.current) loadingMoreRef.current = false;
|
|
3490
|
-
}
|
|
3491
|
-
})();
|
|
3492
|
-
}, []);
|
|
3493
|
-
const retry = useCallback8(() => {
|
|
3494
|
-
if (lastOpRef.current === "more") loadMore();
|
|
3495
|
-
else setReloadKey((key) => key + 1);
|
|
3496
|
-
}, [loadMore]);
|
|
3497
|
-
const reload = useCallback8(() => {
|
|
3498
|
-
setReloadKey((key) => key + 1);
|
|
3682
|
+
},
|
|
3683
|
+
{ controller, seq, seqRef, setPhase, onSettled: () => {
|
|
3684
|
+
loadingMoreRef.current = false;
|
|
3685
|
+
} }
|
|
3686
|
+
);
|
|
3499
3687
|
}, []);
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
loadMoreAbortRef.current?.abort();
|
|
3504
|
-
},
|
|
3505
|
-
[]
|
|
3688
|
+
return useHistoryControls(
|
|
3689
|
+
{ items, nextCursor, phase, loadMore },
|
|
3690
|
+
{ lastOpRef, setReloadKey, resetAbortRef, loadMoreAbortRef }
|
|
3506
3691
|
);
|
|
3507
|
-
return {
|
|
3508
|
-
items,
|
|
3509
|
-
hasMore: nextCursor !== null,
|
|
3510
|
-
isLoadingFirst: phase === "loadingFirst",
|
|
3511
|
-
isLoadingMore: phase === "loadingMore",
|
|
3512
|
-
isError: phase === "error",
|
|
3513
|
-
loadMore,
|
|
3514
|
-
retry,
|
|
3515
|
-
reload
|
|
3516
|
-
};
|
|
3517
3692
|
}
|
|
3518
3693
|
|
|
3519
3694
|
// src/web-react/use-session-actions.tsx
|
|
@@ -3684,7 +3859,7 @@ function SkeletonRows() {
|
|
|
3684
3859
|
function MessageIcon({ className }) {
|
|
3685
3860
|
return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx14("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
3686
3861
|
}
|
|
3687
|
-
function
|
|
3862
|
+
function useSessionHistoryPanelViewState({
|
|
3688
3863
|
history,
|
|
3689
3864
|
hasAnySessions,
|
|
3690
3865
|
query,
|
|
@@ -3770,6 +3945,101 @@ function SessionHistoryPanel({
|
|
|
3770
3945
|
setBulkBusy(false);
|
|
3771
3946
|
}
|
|
3772
3947
|
}, [bulkTarget, deleteLabel, history, onBulkAction]);
|
|
3948
|
+
return {
|
|
3949
|
+
className,
|
|
3950
|
+
showHeader,
|
|
3951
|
+
column,
|
|
3952
|
+
title,
|
|
3953
|
+
newSessionHref,
|
|
3954
|
+
Link,
|
|
3955
|
+
scrollRef,
|
|
3956
|
+
hasAnySessions,
|
|
3957
|
+
query,
|
|
3958
|
+
onQueryChange,
|
|
3959
|
+
sort,
|
|
3960
|
+
onSortChange,
|
|
3961
|
+
onBulkAction,
|
|
3962
|
+
setSelectedIds,
|
|
3963
|
+
history,
|
|
3964
|
+
allVisibleSelected,
|
|
3965
|
+
selectedCount,
|
|
3966
|
+
openBulkAction,
|
|
3967
|
+
selectedIds,
|
|
3968
|
+
deleteLabel,
|
|
3969
|
+
ageDays,
|
|
3970
|
+
setAgeDays,
|
|
3971
|
+
validAgeDays,
|
|
3972
|
+
parsedAgeDays,
|
|
3973
|
+
emptyTitle,
|
|
3974
|
+
emptyDescription,
|
|
3975
|
+
isSearching,
|
|
3976
|
+
searchTerm,
|
|
3977
|
+
hrefForSession,
|
|
3978
|
+
respondingSessionIds,
|
|
3979
|
+
untitledLabel,
|
|
3980
|
+
formatTimestamp,
|
|
3981
|
+
onRename,
|
|
3982
|
+
onDelete,
|
|
3983
|
+
renameLabel,
|
|
3984
|
+
extraActions,
|
|
3985
|
+
sentinelRef,
|
|
3986
|
+
bulkTarget,
|
|
3987
|
+
bulkBusy,
|
|
3988
|
+
setBulkTarget,
|
|
3989
|
+
setBulkError,
|
|
3990
|
+
bulkError,
|
|
3991
|
+
confirmBulkAction
|
|
3992
|
+
};
|
|
3993
|
+
}
|
|
3994
|
+
function SessionHistoryPanel(props) {
|
|
3995
|
+
const view = useSessionHistoryPanelViewState(props);
|
|
3996
|
+
return /* @__PURE__ */ jsx14(SessionHistoryPanelView, { ...view });
|
|
3997
|
+
}
|
|
3998
|
+
function SessionHistoryPanelView({
|
|
3999
|
+
className,
|
|
4000
|
+
showHeader,
|
|
4001
|
+
column,
|
|
4002
|
+
title,
|
|
4003
|
+
newSessionHref,
|
|
4004
|
+
Link,
|
|
4005
|
+
scrollRef,
|
|
4006
|
+
hasAnySessions,
|
|
4007
|
+
query,
|
|
4008
|
+
onQueryChange,
|
|
4009
|
+
sort,
|
|
4010
|
+
onSortChange,
|
|
4011
|
+
onBulkAction,
|
|
4012
|
+
setSelectedIds,
|
|
4013
|
+
history,
|
|
4014
|
+
allVisibleSelected,
|
|
4015
|
+
selectedCount,
|
|
4016
|
+
openBulkAction,
|
|
4017
|
+
selectedIds,
|
|
4018
|
+
deleteLabel,
|
|
4019
|
+
ageDays,
|
|
4020
|
+
setAgeDays,
|
|
4021
|
+
validAgeDays,
|
|
4022
|
+
parsedAgeDays,
|
|
4023
|
+
emptyTitle,
|
|
4024
|
+
emptyDescription,
|
|
4025
|
+
isSearching,
|
|
4026
|
+
searchTerm,
|
|
4027
|
+
hrefForSession,
|
|
4028
|
+
respondingSessionIds,
|
|
4029
|
+
untitledLabel,
|
|
4030
|
+
formatTimestamp,
|
|
4031
|
+
onRename,
|
|
4032
|
+
onDelete,
|
|
4033
|
+
renameLabel,
|
|
4034
|
+
extraActions,
|
|
4035
|
+
sentinelRef,
|
|
4036
|
+
bulkTarget,
|
|
4037
|
+
bulkBusy,
|
|
4038
|
+
setBulkTarget,
|
|
4039
|
+
setBulkError,
|
|
4040
|
+
bulkError,
|
|
4041
|
+
confirmBulkAction
|
|
4042
|
+
}) {
|
|
3773
4043
|
return /* @__PURE__ */ jsxs13("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
|
|
3774
4044
|
showHeader && /* @__PURE__ */ jsx14(ShellHeader, { as: "header", className: "bg-transparent px-4 sm:px-6", children: /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
|
|
3775
4045
|
/* @__PURE__ */ jsx14("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
|
|
@@ -4091,19 +4361,6 @@ function SessionRow({
|
|
|
4091
4361
|
] });
|
|
4092
4362
|
}
|
|
4093
4363
|
|
|
4094
|
-
// src/web-react/record-grid.tsx
|
|
4095
|
-
import {
|
|
4096
|
-
Fragment as Fragment6,
|
|
4097
|
-
isValidElement,
|
|
4098
|
-
useCallback as useCallback12,
|
|
4099
|
-
useEffect as useEffect12,
|
|
4100
|
-
useId as useId3,
|
|
4101
|
-
useMemo as useMemo8,
|
|
4102
|
-
useRef as useRef12,
|
|
4103
|
-
useState as useState19
|
|
4104
|
-
} from "react";
|
|
4105
|
-
import { Button as Button4, EmptyState, Skeleton, Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell } from "@tangle-network/ui/primitives";
|
|
4106
|
-
|
|
4107
4364
|
// src/web-react/record-grid-model.ts
|
|
4108
4365
|
function recordGridOk(value) {
|
|
4109
4366
|
return { succeeded: true, value };
|
|
@@ -4456,6 +4713,115 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
4456
4713
|
return { updates, created, removed };
|
|
4457
4714
|
}
|
|
4458
4715
|
|
|
4716
|
+
// src/web-react/record-grid-writes.ts
|
|
4717
|
+
async function writeRecordGridCell(row, column, value, {
|
|
4718
|
+
onUpdate,
|
|
4719
|
+
setOverlay,
|
|
4720
|
+
setRowError,
|
|
4721
|
+
setRowPending,
|
|
4722
|
+
locale
|
|
4723
|
+
}) {
|
|
4724
|
+
if (!onUpdate) return;
|
|
4725
|
+
const values = { ...row.values, [column.id]: value };
|
|
4726
|
+
setOverlay((current) => withRecordGridUpdate(current, row.id, column.id, value));
|
|
4727
|
+
setRowError(row.id, null);
|
|
4728
|
+
setRowPending(row.id, true);
|
|
4729
|
+
let outcome;
|
|
4730
|
+
try {
|
|
4731
|
+
outcome = await onUpdate({ row, columnId: column.id, value, values });
|
|
4732
|
+
} catch (cause) {
|
|
4733
|
+
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
4734
|
+
}
|
|
4735
|
+
setRowPending(row.id, false);
|
|
4736
|
+
if (outcome.succeeded) {
|
|
4737
|
+
const canonical = outcome.value;
|
|
4738
|
+
if (canonical) setOverlay((current) => withRecordGridServerRow(current, row.id, canonical));
|
|
4739
|
+
return;
|
|
4740
|
+
}
|
|
4741
|
+
setOverlay((current) => withoutRecordGridUpdate(current, row.id, column.id));
|
|
4742
|
+
const rejected = formatRecordGridValue(column, value, locale);
|
|
4743
|
+
setRowError(
|
|
4744
|
+
row.id,
|
|
4745
|
+
rejected === "" ? `Could not save ${column.header}: ${outcome.error}` : `Could not save ${column.header} as ${rejected}: ${outcome.error}`
|
|
4746
|
+
);
|
|
4747
|
+
}
|
|
4748
|
+
async function deleteRecordGridRow(row, {
|
|
4749
|
+
onDelete,
|
|
4750
|
+
setConfirmDelete,
|
|
4751
|
+
setRowError,
|
|
4752
|
+
setOverlay,
|
|
4753
|
+
columns
|
|
4754
|
+
}) {
|
|
4755
|
+
if (!onDelete) return;
|
|
4756
|
+
setConfirmDelete(null);
|
|
4757
|
+
setRowError(row.id, null);
|
|
4758
|
+
setOverlay((current) => withRecordGridRemoved(current, row.id));
|
|
4759
|
+
let outcome;
|
|
4760
|
+
try {
|
|
4761
|
+
outcome = await onDelete(row);
|
|
4762
|
+
} catch (cause) {
|
|
4763
|
+
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
4764
|
+
}
|
|
4765
|
+
if (outcome.succeeded) return;
|
|
4766
|
+
setOverlay((current) => withoutRecordGridRemoved(current, row.id));
|
|
4767
|
+
setRowError(row.id, `Could not delete ${recordGridRowLabel(columns, row)}: ${outcome.error}`);
|
|
4768
|
+
}
|
|
4769
|
+
async function createRecordGridRow({
|
|
4770
|
+
onCreate,
|
|
4771
|
+
columns,
|
|
4772
|
+
draft,
|
|
4773
|
+
setDraftErrors,
|
|
4774
|
+
setDraftError,
|
|
4775
|
+
draftCounter,
|
|
4776
|
+
fieldPrefix,
|
|
4777
|
+
setOverlay,
|
|
4778
|
+
setCreating,
|
|
4779
|
+
setAdding,
|
|
4780
|
+
resetDraft
|
|
4781
|
+
}) {
|
|
4782
|
+
if (!onCreate) return;
|
|
4783
|
+
const validated = validateRecordGridRow(columns, draft);
|
|
4784
|
+
if (!validated.succeeded) {
|
|
4785
|
+
setDraftErrors(validated.cellErrors);
|
|
4786
|
+
setDraftError(validated.error);
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
setDraftErrors({});
|
|
4790
|
+
setDraftError(null);
|
|
4791
|
+
draftCounter.current += 1;
|
|
4792
|
+
const draftId = `${fieldPrefix}-draft-${draftCounter.current}`;
|
|
4793
|
+
setOverlay((current) => withRecordGridCreated(current, { id: draftId, values: validated.value }));
|
|
4794
|
+
setCreating(true);
|
|
4795
|
+
let outcome;
|
|
4796
|
+
try {
|
|
4797
|
+
outcome = await onCreate(validated.value);
|
|
4798
|
+
} catch (cause) {
|
|
4799
|
+
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
4800
|
+
}
|
|
4801
|
+
setCreating(false);
|
|
4802
|
+
if (outcome.succeeded) {
|
|
4803
|
+
setOverlay((current) => withRecordGridServerRow(current, draftId, outcome.value));
|
|
4804
|
+
setAdding(false);
|
|
4805
|
+
resetDraft();
|
|
4806
|
+
return;
|
|
4807
|
+
}
|
|
4808
|
+
setOverlay((current) => withoutRecordGridCreated(current, draftId));
|
|
4809
|
+
setDraftError(outcome.error);
|
|
4810
|
+
}
|
|
4811
|
+
|
|
4812
|
+
// src/web-react/record-grid.tsx
|
|
4813
|
+
import {
|
|
4814
|
+
Fragment as Fragment6,
|
|
4815
|
+
isValidElement,
|
|
4816
|
+
useCallback as useCallback12,
|
|
4817
|
+
useEffect as useEffect12,
|
|
4818
|
+
useId as useId3,
|
|
4819
|
+
useMemo as useMemo8,
|
|
4820
|
+
useRef as useRef12,
|
|
4821
|
+
useState as useState19
|
|
4822
|
+
} from "react";
|
|
4823
|
+
import { Button as Button4, EmptyState, Skeleton, Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell } from "@tangle-network/ui/primitives";
|
|
4824
|
+
|
|
4459
4825
|
// src/web-react/record-grid-review-actions.tsx
|
|
4460
4826
|
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4461
4827
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
@@ -4848,7 +5214,7 @@ function alignmentClass(column) {
|
|
|
4848
5214
|
const align = column.align ?? (column.kind === "number" || column.kind === "currency" ? "right" : "left");
|
|
4849
5215
|
return align === "right" ? "text-right" : "text-left";
|
|
4850
5216
|
}
|
|
4851
|
-
function
|
|
5217
|
+
function useRecordGridViewState({
|
|
4852
5218
|
columns,
|
|
4853
5219
|
caption,
|
|
4854
5220
|
state,
|
|
@@ -4966,31 +5332,13 @@ function RecordGrid({
|
|
|
4966
5332
|
[setCellError, setEditing]
|
|
4967
5333
|
);
|
|
4968
5334
|
const applyCellWrite = useCallback12(
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
try {
|
|
4977
|
-
outcome = await onUpdate({ row, columnId: column.id, value, values });
|
|
4978
|
-
} catch (cause) {
|
|
4979
|
-
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
4980
|
-
}
|
|
4981
|
-
setRowPending(row.id, false);
|
|
4982
|
-
if (outcome.succeeded) {
|
|
4983
|
-
const canonical = outcome.value;
|
|
4984
|
-
if (canonical) setOverlay((current) => withRecordGridServerRow(current, row.id, canonical));
|
|
4985
|
-
return;
|
|
4986
|
-
}
|
|
4987
|
-
setOverlay((current) => withoutRecordGridUpdate(current, row.id, column.id));
|
|
4988
|
-
const rejected = formatRecordGridValue(column, value, locale);
|
|
4989
|
-
setRowError(
|
|
4990
|
-
row.id,
|
|
4991
|
-
rejected === "" ? `Could not save ${column.header}: ${outcome.error}` : `Could not save ${column.header} as ${rejected}: ${outcome.error}`
|
|
4992
|
-
);
|
|
4993
|
-
},
|
|
5335
|
+
(row, column, value) => writeRecordGridCell(row, column, value, {
|
|
5336
|
+
onUpdate,
|
|
5337
|
+
setOverlay,
|
|
5338
|
+
setRowError,
|
|
5339
|
+
setRowPending,
|
|
5340
|
+
locale
|
|
5341
|
+
}),
|
|
4994
5342
|
[locale, onUpdate, setRowError, setRowPending]
|
|
4995
5343
|
);
|
|
4996
5344
|
const commitEdit = useCallback12(
|
|
@@ -5026,21 +5374,7 @@ function RecordGrid({
|
|
|
5026
5374
|
[focusCell, setCellError, setEditing]
|
|
5027
5375
|
);
|
|
5028
5376
|
const performDelete = useCallback12(
|
|
5029
|
-
|
|
5030
|
-
if (!onDelete) return;
|
|
5031
|
-
setConfirmDelete(null);
|
|
5032
|
-
setRowError(row.id, null);
|
|
5033
|
-
setOverlay((current) => withRecordGridRemoved(current, row.id));
|
|
5034
|
-
let outcome;
|
|
5035
|
-
try {
|
|
5036
|
-
outcome = await onDelete(row);
|
|
5037
|
-
} catch (cause) {
|
|
5038
|
-
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
5039
|
-
}
|
|
5040
|
-
if (outcome.succeeded) return;
|
|
5041
|
-
setOverlay((current) => withoutRecordGridRemoved(current, row.id));
|
|
5042
|
-
setRowError(row.id, `Could not delete ${recordGridRowLabel(columns, row)}: ${outcome.error}`);
|
|
5043
|
-
},
|
|
5377
|
+
(row) => deleteRecordGridRow(row, { onDelete, setConfirmDelete, setRowError, setOverlay, columns }),
|
|
5044
5378
|
[columns, onDelete, setRowError]
|
|
5045
5379
|
);
|
|
5046
5380
|
const resetDraft = useCallback12(() => {
|
|
@@ -5052,36 +5386,19 @@ function RecordGrid({
|
|
|
5052
5386
|
resetDraft();
|
|
5053
5387
|
setAdding(true);
|
|
5054
5388
|
}, [resetDraft]);
|
|
5055
|
-
const submitDraft = useCallback12(
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
setCreating(true);
|
|
5069
|
-
let outcome;
|
|
5070
|
-
try {
|
|
5071
|
-
outcome = await onCreate(validated.value);
|
|
5072
|
-
} catch (cause) {
|
|
5073
|
-
outcome = { succeeded: false, error: cause instanceof Error ? cause.message : String(cause) };
|
|
5074
|
-
}
|
|
5075
|
-
setCreating(false);
|
|
5076
|
-
if (outcome.succeeded) {
|
|
5077
|
-
setOverlay((current) => withRecordGridServerRow(current, draftId, outcome.value));
|
|
5078
|
-
setAdding(false);
|
|
5079
|
-
resetDraft();
|
|
5080
|
-
return;
|
|
5081
|
-
}
|
|
5082
|
-
setOverlay((current) => withoutRecordGridCreated(current, draftId));
|
|
5083
|
-
setDraftError(outcome.error);
|
|
5084
|
-
}, [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
5389
|
+
const submitDraft = useCallback12(() => createRecordGridRow({
|
|
5390
|
+
onCreate,
|
|
5391
|
+
columns,
|
|
5392
|
+
draft,
|
|
5393
|
+
setDraftErrors,
|
|
5394
|
+
setDraftError,
|
|
5395
|
+
draftCounter,
|
|
5396
|
+
fieldPrefix,
|
|
5397
|
+
setOverlay,
|
|
5398
|
+
setCreating,
|
|
5399
|
+
setAdding,
|
|
5400
|
+
resetDraft
|
|
5401
|
+
}), [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
5085
5402
|
const handleGridKeyDown = useCallback12(
|
|
5086
5403
|
(event) => {
|
|
5087
5404
|
if (editing !== null) return;
|
|
@@ -5120,6 +5437,117 @@ function RecordGrid({
|
|
|
5120
5437
|
},
|
|
5121
5438
|
[beginEdit, columns, editing, focusCell, onUpdate, reviewing, visibleRows]
|
|
5122
5439
|
);
|
|
5440
|
+
return {
|
|
5441
|
+
state,
|
|
5442
|
+
className,
|
|
5443
|
+
toolbar,
|
|
5444
|
+
caption,
|
|
5445
|
+
loadingRowCount,
|
|
5446
|
+
adding,
|
|
5447
|
+
onCreate,
|
|
5448
|
+
reviewing,
|
|
5449
|
+
columns,
|
|
5450
|
+
draft,
|
|
5451
|
+
setDraft,
|
|
5452
|
+
draftErrors,
|
|
5453
|
+
draftError,
|
|
5454
|
+
creating,
|
|
5455
|
+
addLabel,
|
|
5456
|
+
fieldPrefix,
|
|
5457
|
+
submitDraft,
|
|
5458
|
+
setAdding,
|
|
5459
|
+
resetDraft,
|
|
5460
|
+
visibleRows,
|
|
5461
|
+
empty,
|
|
5462
|
+
openAdd,
|
|
5463
|
+
onDelete,
|
|
5464
|
+
diffs,
|
|
5465
|
+
addedRows,
|
|
5466
|
+
onAcceptAll,
|
|
5467
|
+
onRejectAll,
|
|
5468
|
+
handleGridKeyDown,
|
|
5469
|
+
pendingRows,
|
|
5470
|
+
rowErrors,
|
|
5471
|
+
diffByRow,
|
|
5472
|
+
onUpdate,
|
|
5473
|
+
editing,
|
|
5474
|
+
cellErrors,
|
|
5475
|
+
activeFocus,
|
|
5476
|
+
diffCellByKey,
|
|
5477
|
+
setEditing,
|
|
5478
|
+
commitEdit,
|
|
5479
|
+
cancelEdit,
|
|
5480
|
+
cellRefs,
|
|
5481
|
+
setFocus,
|
|
5482
|
+
applyCellWrite,
|
|
5483
|
+
locale,
|
|
5484
|
+
beginEdit,
|
|
5485
|
+
openSource,
|
|
5486
|
+
setOpenSource,
|
|
5487
|
+
onAcceptRow,
|
|
5488
|
+
onRejectRow,
|
|
5489
|
+
confirmDelete,
|
|
5490
|
+
performDelete,
|
|
5491
|
+
setConfirmDelete
|
|
5492
|
+
};
|
|
5493
|
+
}
|
|
5494
|
+
function RecordGrid(props) {
|
|
5495
|
+
const view = useRecordGridViewState(props);
|
|
5496
|
+
return /* @__PURE__ */ jsx18(RecordGridView, { ...view });
|
|
5497
|
+
}
|
|
5498
|
+
function RecordGridView({
|
|
5499
|
+
state,
|
|
5500
|
+
className,
|
|
5501
|
+
toolbar,
|
|
5502
|
+
caption,
|
|
5503
|
+
loadingRowCount,
|
|
5504
|
+
adding,
|
|
5505
|
+
onCreate,
|
|
5506
|
+
reviewing,
|
|
5507
|
+
columns,
|
|
5508
|
+
draft,
|
|
5509
|
+
setDraft,
|
|
5510
|
+
draftErrors,
|
|
5511
|
+
draftError,
|
|
5512
|
+
creating,
|
|
5513
|
+
addLabel,
|
|
5514
|
+
fieldPrefix,
|
|
5515
|
+
submitDraft,
|
|
5516
|
+
setAdding,
|
|
5517
|
+
resetDraft,
|
|
5518
|
+
visibleRows,
|
|
5519
|
+
empty,
|
|
5520
|
+
openAdd,
|
|
5521
|
+
onDelete,
|
|
5522
|
+
diffs,
|
|
5523
|
+
addedRows,
|
|
5524
|
+
onAcceptAll,
|
|
5525
|
+
onRejectAll,
|
|
5526
|
+
handleGridKeyDown,
|
|
5527
|
+
pendingRows,
|
|
5528
|
+
rowErrors,
|
|
5529
|
+
diffByRow,
|
|
5530
|
+
onUpdate,
|
|
5531
|
+
editing,
|
|
5532
|
+
cellErrors,
|
|
5533
|
+
activeFocus,
|
|
5534
|
+
diffCellByKey,
|
|
5535
|
+
setEditing,
|
|
5536
|
+
commitEdit,
|
|
5537
|
+
cancelEdit,
|
|
5538
|
+
cellRefs,
|
|
5539
|
+
setFocus,
|
|
5540
|
+
applyCellWrite,
|
|
5541
|
+
locale,
|
|
5542
|
+
beginEdit,
|
|
5543
|
+
openSource,
|
|
5544
|
+
setOpenSource,
|
|
5545
|
+
onAcceptRow,
|
|
5546
|
+
onRejectRow,
|
|
5547
|
+
confirmDelete,
|
|
5548
|
+
performDelete,
|
|
5549
|
+
setConfirmDelete
|
|
5550
|
+
}) {
|
|
5123
5551
|
if (state.status === "idle" || state.status === "loading") {
|
|
5124
5552
|
return /* @__PURE__ */ jsxs17("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5125
5553
|
toolbar,
|
|
@@ -5265,220 +5693,41 @@ function RecordGrid({
|
|
|
5265
5693
|
)),
|
|
5266
5694
|
showActionsColumn && /* @__PURE__ */ jsx18(TableHead, { role: "columnheader", scope: "col", className: "h-auto w-px px-3 py-2", children: /* @__PURE__ */ jsx18("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
5267
5695
|
] }) }),
|
|
5268
|
-
/* @__PURE__ */
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
invalid: cellError !== void 0,
|
|
5304
|
-
describedBy: cellError === void 0 ? void 0 : errorId,
|
|
5305
|
-
onText: (text) => setEditing({ rowId: row.id, columnId: column.id, text }),
|
|
5306
|
-
onCommit: (text) => void commitEdit(row, column, text),
|
|
5307
|
-
onCancel: () => cancelEdit(row, column)
|
|
5308
|
-
}
|
|
5309
|
-
),
|
|
5310
|
-
cellError !== void 0 && /* @__PURE__ */ jsx18("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
5311
|
-
] }, column.id);
|
|
5312
|
-
}
|
|
5313
|
-
if (column.kind === "boolean" && editable) {
|
|
5314
|
-
return /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx18(
|
|
5315
|
-
"input",
|
|
5316
|
-
{
|
|
5317
|
-
type: "checkbox",
|
|
5318
|
-
checked: value === true,
|
|
5319
|
-
"aria-label": `${column.header}, ${rowLabel}`,
|
|
5320
|
-
"data-record-grid-row": row.id,
|
|
5321
|
-
"data-record-grid-column": column.id,
|
|
5322
|
-
tabIndex: active ? 0 : -1,
|
|
5323
|
-
ref: (node) => {
|
|
5324
|
-
cellRefs.current.set(key, node);
|
|
5325
|
-
},
|
|
5326
|
-
onFocus: () => setFocus({ rowId: row.id, columnId: column.id }),
|
|
5327
|
-
onChange: (event) => void applyCellWrite(row, column, event.target.checked),
|
|
5328
|
-
className: "h-4 w-4 rounded border-border accent-primary"
|
|
5329
|
-
}
|
|
5330
|
-
) }, column.id);
|
|
5331
|
-
}
|
|
5332
|
-
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5333
|
-
return /* @__PURE__ */ jsx18(
|
|
5334
|
-
TableCell,
|
|
5335
|
-
{
|
|
5336
|
-
role: "gridcell",
|
|
5337
|
-
"aria-readonly": editable ? void 0 : true,
|
|
5338
|
-
"data-record-grid-row": row.id,
|
|
5339
|
-
"data-record-grid-column": column.id,
|
|
5340
|
-
tabIndex: active ? 0 : -1,
|
|
5341
|
-
ref: (node) => {
|
|
5342
|
-
cellRefs.current.set(key, node);
|
|
5343
|
-
},
|
|
5344
|
-
onFocus: () => setFocus({ rowId: row.id, columnId: column.id }),
|
|
5345
|
-
onClick: () => {
|
|
5346
|
-
if (editable) beginEdit(row, column);
|
|
5347
|
-
},
|
|
5348
|
-
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
5349
|
-
column
|
|
5350
|
-
)} ${editable ? "cursor-text" : ""}`,
|
|
5351
|
-
children: /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
5352
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx18("span", { className: "inline-flex shrink-0 rounded border border-destructive/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-destructive", children: "Remove" }),
|
|
5353
|
-
cellDiff ? /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
5354
|
-
/* @__PURE__ */ jsx18("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
5355
|
-
/* @__PURE__ */ jsx18("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
5356
|
-
/* @__PURE__ */ jsx18("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
5357
|
-
] }) : /* @__PURE__ */ jsx18(
|
|
5358
|
-
"span",
|
|
5359
|
-
{
|
|
5360
|
-
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
5361
|
-
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
5362
|
-
}
|
|
5363
|
-
),
|
|
5364
|
-
source && /* @__PURE__ */ jsx18(
|
|
5365
|
-
SourceMarker,
|
|
5366
|
-
{
|
|
5367
|
-
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
5368
|
-
columnHeader: column.header,
|
|
5369
|
-
rowLabel,
|
|
5370
|
-
source,
|
|
5371
|
-
open: openSource === key,
|
|
5372
|
-
onToggle: () => setOpenSource((current) => current === key ? null : key)
|
|
5373
|
-
}
|
|
5374
|
-
)
|
|
5375
|
-
] })
|
|
5376
|
-
},
|
|
5377
|
-
column.id
|
|
5378
|
-
);
|
|
5379
|
-
}),
|
|
5380
|
-
showActionsColumn && /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx18(
|
|
5381
|
-
ReviewActions,
|
|
5382
|
-
{
|
|
5383
|
-
rowId: row.id,
|
|
5384
|
-
kind: rowDiff.kind,
|
|
5385
|
-
rowLabel,
|
|
5386
|
-
onAccept: onAcceptRow,
|
|
5387
|
-
onReject: onRejectRow
|
|
5388
|
-
}
|
|
5389
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
5390
|
-
/* @__PURE__ */ jsx18(
|
|
5391
|
-
"button",
|
|
5392
|
-
{
|
|
5393
|
-
type: "button",
|
|
5394
|
-
"aria-label": `Confirm delete ${rowLabel}`,
|
|
5395
|
-
onClick: () => void performDelete(row),
|
|
5396
|
-
className: "rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition hover:bg-destructive/20",
|
|
5397
|
-
children: "Delete"
|
|
5398
|
-
}
|
|
5399
|
-
),
|
|
5400
|
-
/* @__PURE__ */ jsx18(
|
|
5401
|
-
"button",
|
|
5402
|
-
{
|
|
5403
|
-
type: "button",
|
|
5404
|
-
"aria-label": `Keep ${rowLabel}`,
|
|
5405
|
-
onClick: () => setConfirmDelete(null),
|
|
5406
|
-
className: "rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground transition hover:bg-accent",
|
|
5407
|
-
children: "Cancel"
|
|
5408
|
-
}
|
|
5409
|
-
)
|
|
5410
|
-
] }) : /* @__PURE__ */ jsx18(
|
|
5411
|
-
"button",
|
|
5412
|
-
{
|
|
5413
|
-
type: "button",
|
|
5414
|
-
"aria-label": `Delete ${rowLabel}`,
|
|
5415
|
-
onClick: () => setConfirmDelete(row.id),
|
|
5416
|
-
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
5417
|
-
children: /* @__PURE__ */ jsxs17(
|
|
5418
|
-
"svg",
|
|
5419
|
-
{
|
|
5420
|
-
viewBox: "0 0 24 24",
|
|
5421
|
-
className: "h-3.5 w-3.5",
|
|
5422
|
-
fill: "none",
|
|
5423
|
-
stroke: "currentColor",
|
|
5424
|
-
strokeWidth: "2",
|
|
5425
|
-
strokeLinecap: "round",
|
|
5426
|
-
strokeLinejoin: "round",
|
|
5427
|
-
"aria-hidden": true,
|
|
5428
|
-
children: [
|
|
5429
|
-
/* @__PURE__ */ jsx18("polyline", { points: "3 6 5 6 21 6" }),
|
|
5430
|
-
/* @__PURE__ */ jsx18("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
5431
|
-
]
|
|
5432
|
-
}
|
|
5433
|
-
)
|
|
5434
|
-
}
|
|
5435
|
-
) })
|
|
5436
|
-
]
|
|
5437
|
-
}
|
|
5438
|
-
),
|
|
5439
|
-
rowError !== void 0 && /* @__PURE__ */ jsx18(TableRow, { role: "row", children: /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx18("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
5440
|
-
] }, row.id);
|
|
5441
|
-
}),
|
|
5442
|
-
reviewing && addedRows.map((row) => {
|
|
5443
|
-
const rowLabel = recordGridRowLabel(columns, row);
|
|
5444
|
-
return /* @__PURE__ */ jsxs17(
|
|
5445
|
-
TableRow,
|
|
5446
|
-
{
|
|
5447
|
-
role: "row",
|
|
5448
|
-
"data-record-grid-diff": "added",
|
|
5449
|
-
className: "bg-success/[0.06]",
|
|
5450
|
-
children: [
|
|
5451
|
-
columns.map((column, columnIndex) => {
|
|
5452
|
-
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
5453
|
-
const value = row.values[column.id] ?? null;
|
|
5454
|
-
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5455
|
-
return /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
5456
|
-
columnIndex === 0 && /* @__PURE__ */ jsx18("span", { className: "inline-flex shrink-0 rounded border border-success/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-success", children: "New" }),
|
|
5457
|
-
/* @__PURE__ */ jsx18(
|
|
5458
|
-
"span",
|
|
5459
|
-
{
|
|
5460
|
-
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
5461
|
-
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
5462
|
-
}
|
|
5463
|
-
)
|
|
5464
|
-
] }) }, column.id);
|
|
5465
|
-
}),
|
|
5466
|
-
/* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx18(
|
|
5467
|
-
ReviewActions,
|
|
5468
|
-
{
|
|
5469
|
-
rowId: row.id,
|
|
5470
|
-
kind: "added",
|
|
5471
|
-
rowLabel,
|
|
5472
|
-
onAccept: onAcceptRow,
|
|
5473
|
-
onReject: onRejectRow
|
|
5474
|
-
}
|
|
5475
|
-
) })
|
|
5476
|
-
]
|
|
5477
|
-
},
|
|
5478
|
-
row.id
|
|
5479
|
-
);
|
|
5480
|
-
})
|
|
5481
|
-
] }),
|
|
5696
|
+
/* @__PURE__ */ jsx18(
|
|
5697
|
+
RecordGridRows,
|
|
5698
|
+
{
|
|
5699
|
+
visibleRows,
|
|
5700
|
+
columns,
|
|
5701
|
+
pendingRows,
|
|
5702
|
+
rowErrors,
|
|
5703
|
+
reviewing,
|
|
5704
|
+
diffByRow,
|
|
5705
|
+
onUpdate,
|
|
5706
|
+
editing,
|
|
5707
|
+
cellErrors,
|
|
5708
|
+
activeFocus,
|
|
5709
|
+
fieldPrefix,
|
|
5710
|
+
diffCellByKey,
|
|
5711
|
+
setEditing,
|
|
5712
|
+
commitEdit,
|
|
5713
|
+
cancelEdit,
|
|
5714
|
+
cellRefs,
|
|
5715
|
+
setFocus,
|
|
5716
|
+
applyCellWrite,
|
|
5717
|
+
locale,
|
|
5718
|
+
beginEdit,
|
|
5719
|
+
openSource,
|
|
5720
|
+
setOpenSource,
|
|
5721
|
+
showActionsColumn,
|
|
5722
|
+
onAcceptRow,
|
|
5723
|
+
onRejectRow,
|
|
5724
|
+
confirmDelete,
|
|
5725
|
+
performDelete,
|
|
5726
|
+
setConfirmDelete,
|
|
5727
|
+
columnSpan,
|
|
5728
|
+
addedRows
|
|
5729
|
+
}
|
|
5730
|
+
),
|
|
5482
5731
|
hasFooter && /* @__PURE__ */ jsx18(TableFooter, { children: /* @__PURE__ */ jsxs17(TableRow, { role: "row", className: "border-t-2 border-border", children: [
|
|
5483
5732
|
columns.map((column) => /* @__PURE__ */ jsx18(
|
|
5484
5733
|
TableCell,
|
|
@@ -5501,29 +5750,266 @@ function RecordGrid({
|
|
|
5501
5750
|
onClick: openAdd,
|
|
5502
5751
|
className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent",
|
|
5503
5752
|
children: [
|
|
5504
|
-
/* @__PURE__ */ jsxs17(
|
|
5505
|
-
"
|
|
5506
|
-
{
|
|
5507
|
-
|
|
5508
|
-
className: "h-3.5 w-3.5",
|
|
5509
|
-
fill: "none",
|
|
5510
|
-
stroke: "currentColor",
|
|
5511
|
-
strokeWidth: "2",
|
|
5512
|
-
strokeLinecap: "round",
|
|
5513
|
-
strokeLinejoin: "round",
|
|
5514
|
-
"aria-hidden": true,
|
|
5515
|
-
children: [
|
|
5516
|
-
/* @__PURE__ */ jsx18("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
5517
|
-
/* @__PURE__ */ jsx18("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
5518
|
-
]
|
|
5519
|
-
}
|
|
5520
|
-
),
|
|
5753
|
+
/* @__PURE__ */ jsxs17(RecordGridActionGlyph, { children: [
|
|
5754
|
+
/* @__PURE__ */ jsx18("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
5755
|
+
/* @__PURE__ */ jsx18("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
5756
|
+
] }),
|
|
5521
5757
|
addLabel
|
|
5522
5758
|
]
|
|
5523
5759
|
}
|
|
5524
5760
|
))
|
|
5525
5761
|
] });
|
|
5526
5762
|
}
|
|
5763
|
+
function RecordGridActionGlyph({ children }) {
|
|
5764
|
+
return /* @__PURE__ */ jsx18(
|
|
5765
|
+
"svg",
|
|
5766
|
+
{
|
|
5767
|
+
viewBox: "0 0 24 24",
|
|
5768
|
+
className: "h-3.5 w-3.5",
|
|
5769
|
+
fill: "none",
|
|
5770
|
+
stroke: "currentColor",
|
|
5771
|
+
strokeWidth: "2",
|
|
5772
|
+
strokeLinecap: "round",
|
|
5773
|
+
strokeLinejoin: "round",
|
|
5774
|
+
"aria-hidden": true,
|
|
5775
|
+
children
|
|
5776
|
+
}
|
|
5777
|
+
);
|
|
5778
|
+
}
|
|
5779
|
+
function RecordGridRows({
|
|
5780
|
+
visibleRows,
|
|
5781
|
+
columns,
|
|
5782
|
+
pendingRows,
|
|
5783
|
+
rowErrors,
|
|
5784
|
+
reviewing,
|
|
5785
|
+
diffByRow,
|
|
5786
|
+
onUpdate,
|
|
5787
|
+
editing,
|
|
5788
|
+
cellErrors,
|
|
5789
|
+
activeFocus,
|
|
5790
|
+
fieldPrefix,
|
|
5791
|
+
diffCellByKey,
|
|
5792
|
+
setEditing,
|
|
5793
|
+
commitEdit,
|
|
5794
|
+
cancelEdit,
|
|
5795
|
+
cellRefs,
|
|
5796
|
+
setFocus,
|
|
5797
|
+
applyCellWrite,
|
|
5798
|
+
locale,
|
|
5799
|
+
beginEdit,
|
|
5800
|
+
openSource,
|
|
5801
|
+
setOpenSource,
|
|
5802
|
+
showActionsColumn,
|
|
5803
|
+
onAcceptRow,
|
|
5804
|
+
onRejectRow,
|
|
5805
|
+
confirmDelete,
|
|
5806
|
+
performDelete,
|
|
5807
|
+
setConfirmDelete,
|
|
5808
|
+
columnSpan,
|
|
5809
|
+
addedRows
|
|
5810
|
+
}) {
|
|
5811
|
+
return /* @__PURE__ */ jsxs17(TableBody, { children: [
|
|
5812
|
+
visibleRows.map((row) => {
|
|
5813
|
+
const rowLabel = recordGridRowLabel(columns, row);
|
|
5814
|
+
const pending = row.id in pendingRows;
|
|
5815
|
+
const rowError = rowErrors[row.id];
|
|
5816
|
+
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
5817
|
+
const removedRow = rowDiff?.kind === "removed";
|
|
5818
|
+
return /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
5819
|
+
/* @__PURE__ */ jsxs17(
|
|
5820
|
+
TableRow,
|
|
5821
|
+
{
|
|
5822
|
+
role: "row",
|
|
5823
|
+
"aria-busy": pending,
|
|
5824
|
+
"data-record-grid-diff": rowDiff?.kind,
|
|
5825
|
+
className: `${pending ? "opacity-60" : ""} ${removedRow ? "bg-destructive/[0.06]" : ""}`,
|
|
5826
|
+
children: [
|
|
5827
|
+
columns.map((column) => {
|
|
5828
|
+
const key = cellKey(row.id, column.id);
|
|
5829
|
+
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
5830
|
+
const editable = !reviewing && onUpdate !== void 0 && column.editable !== false && row.readOnly !== true && applicable;
|
|
5831
|
+
const value = row.values[column.id] ?? null;
|
|
5832
|
+
const isEditing = editing?.rowId === row.id && editing.columnId === column.id;
|
|
5833
|
+
const cellError = cellErrors[key];
|
|
5834
|
+
const active = activeFocus === null ? row.id === visibleRows[0]?.id && column.id === columns[0]?.id : activeFocus.rowId === row.id && activeFocus.columnId === column.id;
|
|
5835
|
+
const source = row.sources?.[column.id];
|
|
5836
|
+
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
5837
|
+
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
5838
|
+
if (isEditing && editable) {
|
|
5839
|
+
return /* @__PURE__ */ jsxs17(TableCell, { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
5840
|
+
/* @__PURE__ */ jsx18(
|
|
5841
|
+
CellEditor,
|
|
5842
|
+
{
|
|
5843
|
+
column,
|
|
5844
|
+
rowLabel,
|
|
5845
|
+
text: editing.text,
|
|
5846
|
+
invalid: cellError !== void 0,
|
|
5847
|
+
describedBy: cellError === void 0 ? void 0 : errorId,
|
|
5848
|
+
onText: (text) => setEditing({ rowId: row.id, columnId: column.id, text }),
|
|
5849
|
+
onCommit: (text) => void commitEdit(row, column, text),
|
|
5850
|
+
onCancel: () => cancelEdit(row, column)
|
|
5851
|
+
}
|
|
5852
|
+
),
|
|
5853
|
+
cellError !== void 0 && /* @__PURE__ */ jsx18("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
5854
|
+
] }, column.id);
|
|
5855
|
+
}
|
|
5856
|
+
if (column.kind === "boolean" && editable) {
|
|
5857
|
+
return /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx18(
|
|
5858
|
+
"input",
|
|
5859
|
+
{
|
|
5860
|
+
type: "checkbox",
|
|
5861
|
+
checked: value === true,
|
|
5862
|
+
"aria-label": `${column.header}, ${rowLabel}`,
|
|
5863
|
+
"data-record-grid-row": row.id,
|
|
5864
|
+
"data-record-grid-column": column.id,
|
|
5865
|
+
tabIndex: active ? 0 : -1,
|
|
5866
|
+
ref: (node) => {
|
|
5867
|
+
cellRefs.current.set(key, node);
|
|
5868
|
+
},
|
|
5869
|
+
onFocus: () => setFocus({ rowId: row.id, columnId: column.id }),
|
|
5870
|
+
onChange: (event) => void applyCellWrite(row, column, event.target.checked),
|
|
5871
|
+
className: "h-4 w-4 rounded border-border accent-primary"
|
|
5872
|
+
}
|
|
5873
|
+
) }, column.id);
|
|
5874
|
+
}
|
|
5875
|
+
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5876
|
+
return /* @__PURE__ */ jsx18(
|
|
5877
|
+
TableCell,
|
|
5878
|
+
{
|
|
5879
|
+
role: "gridcell",
|
|
5880
|
+
"aria-readonly": editable ? void 0 : true,
|
|
5881
|
+
"data-record-grid-row": row.id,
|
|
5882
|
+
"data-record-grid-column": column.id,
|
|
5883
|
+
tabIndex: active ? 0 : -1,
|
|
5884
|
+
ref: (node) => {
|
|
5885
|
+
cellRefs.current.set(key, node);
|
|
5886
|
+
},
|
|
5887
|
+
onFocus: () => setFocus({ rowId: row.id, columnId: column.id }),
|
|
5888
|
+
onClick: () => {
|
|
5889
|
+
if (editable) beginEdit(row, column);
|
|
5890
|
+
},
|
|
5891
|
+
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
5892
|
+
column
|
|
5893
|
+
)} ${editable ? "cursor-text" : ""}`,
|
|
5894
|
+
children: /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
5895
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx18("span", { className: "inline-flex shrink-0 rounded border border-destructive/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-destructive", children: "Remove" }),
|
|
5896
|
+
cellDiff ? /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
5897
|
+
/* @__PURE__ */ jsx18("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
5898
|
+
/* @__PURE__ */ jsx18("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
5899
|
+
/* @__PURE__ */ jsx18("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
5900
|
+
] }) : /* @__PURE__ */ jsx18(
|
|
5901
|
+
"span",
|
|
5902
|
+
{
|
|
5903
|
+
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
5904
|
+
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
5905
|
+
}
|
|
5906
|
+
),
|
|
5907
|
+
source && /* @__PURE__ */ jsx18(
|
|
5908
|
+
SourceMarker,
|
|
5909
|
+
{
|
|
5910
|
+
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
5911
|
+
columnHeader: column.header,
|
|
5912
|
+
rowLabel,
|
|
5913
|
+
source,
|
|
5914
|
+
open: openSource === key,
|
|
5915
|
+
onToggle: () => setOpenSource((current) => current === key ? null : key)
|
|
5916
|
+
}
|
|
5917
|
+
)
|
|
5918
|
+
] })
|
|
5919
|
+
},
|
|
5920
|
+
column.id
|
|
5921
|
+
);
|
|
5922
|
+
}),
|
|
5923
|
+
showActionsColumn && /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx18(
|
|
5924
|
+
ReviewActions,
|
|
5925
|
+
{
|
|
5926
|
+
rowId: row.id,
|
|
5927
|
+
kind: rowDiff.kind,
|
|
5928
|
+
rowLabel,
|
|
5929
|
+
onAccept: onAcceptRow,
|
|
5930
|
+
onReject: onRejectRow
|
|
5931
|
+
}
|
|
5932
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
5933
|
+
/* @__PURE__ */ jsx18(
|
|
5934
|
+
"button",
|
|
5935
|
+
{
|
|
5936
|
+
type: "button",
|
|
5937
|
+
"aria-label": `Confirm delete ${rowLabel}`,
|
|
5938
|
+
onClick: () => void performDelete(row),
|
|
5939
|
+
className: "rounded-md bg-destructive/10 px-2 py-1 text-xs font-medium text-destructive transition hover:bg-destructive/20",
|
|
5940
|
+
children: "Delete"
|
|
5941
|
+
}
|
|
5942
|
+
),
|
|
5943
|
+
/* @__PURE__ */ jsx18(
|
|
5944
|
+
"button",
|
|
5945
|
+
{
|
|
5946
|
+
type: "button",
|
|
5947
|
+
"aria-label": `Keep ${rowLabel}`,
|
|
5948
|
+
onClick: () => setConfirmDelete(null),
|
|
5949
|
+
className: "rounded-md border border-border px-2 py-1 text-xs font-medium text-muted-foreground transition hover:bg-accent",
|
|
5950
|
+
children: "Cancel"
|
|
5951
|
+
}
|
|
5952
|
+
)
|
|
5953
|
+
] }) : /* @__PURE__ */ jsx18(
|
|
5954
|
+
"button",
|
|
5955
|
+
{
|
|
5956
|
+
type: "button",
|
|
5957
|
+
"aria-label": `Delete ${rowLabel}`,
|
|
5958
|
+
onClick: () => setConfirmDelete(row.id),
|
|
5959
|
+
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
5960
|
+
children: /* @__PURE__ */ jsxs17(RecordGridActionGlyph, { children: [
|
|
5961
|
+
/* @__PURE__ */ jsx18("polyline", { points: "3 6 5 6 21 6" }),
|
|
5962
|
+
/* @__PURE__ */ jsx18("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
5963
|
+
] })
|
|
5964
|
+
}
|
|
5965
|
+
) })
|
|
5966
|
+
]
|
|
5967
|
+
}
|
|
5968
|
+
),
|
|
5969
|
+
rowError !== void 0 && /* @__PURE__ */ jsx18(TableRow, { role: "row", children: /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx18("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
5970
|
+
] }, row.id);
|
|
5971
|
+
}),
|
|
5972
|
+
reviewing && addedRows.map((row) => {
|
|
5973
|
+
const rowLabel = recordGridRowLabel(columns, row);
|
|
5974
|
+
return /* @__PURE__ */ jsxs17(
|
|
5975
|
+
TableRow,
|
|
5976
|
+
{
|
|
5977
|
+
role: "row",
|
|
5978
|
+
"data-record-grid-diff": "added",
|
|
5979
|
+
className: "bg-success/[0.06]",
|
|
5980
|
+
children: [
|
|
5981
|
+
columns.map((column, columnIndex) => {
|
|
5982
|
+
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
5983
|
+
const value = row.values[column.id] ?? null;
|
|
5984
|
+
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5985
|
+
return /* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs17("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
5986
|
+
columnIndex === 0 && /* @__PURE__ */ jsx18("span", { className: "inline-flex shrink-0 rounded border border-success/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-success", children: "New" }),
|
|
5987
|
+
/* @__PURE__ */ jsx18(
|
|
5988
|
+
"span",
|
|
5989
|
+
{
|
|
5990
|
+
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
5991
|
+
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
5992
|
+
}
|
|
5993
|
+
)
|
|
5994
|
+
] }) }, column.id);
|
|
5995
|
+
}),
|
|
5996
|
+
/* @__PURE__ */ jsx18(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx18(
|
|
5997
|
+
ReviewActions,
|
|
5998
|
+
{
|
|
5999
|
+
rowId: row.id,
|
|
6000
|
+
kind: "added",
|
|
6001
|
+
rowLabel,
|
|
6002
|
+
onAccept: onAcceptRow,
|
|
6003
|
+
onReject: onRejectRow
|
|
6004
|
+
}
|
|
6005
|
+
) })
|
|
6006
|
+
]
|
|
6007
|
+
},
|
|
6008
|
+
row.id
|
|
6009
|
+
);
|
|
6010
|
+
})
|
|
6011
|
+
] });
|
|
6012
|
+
}
|
|
5527
6013
|
|
|
5528
6014
|
// src/web-react/command-palette.tsx
|
|
5529
6015
|
import {
|
|
@@ -6614,26 +7100,8 @@ function RunDrillIn({ run, onClose }) {
|
|
|
6614
7100
|
] });
|
|
6615
7101
|
}
|
|
6616
7102
|
|
|
6617
|
-
// src/web-react/brand-mark.tsx
|
|
6618
|
-
import { lazy, Suspense } from "react";
|
|
6619
|
-
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
6620
|
-
function MarkSpacer({ size = 24, className }) {
|
|
6621
|
-
return /* @__PURE__ */ jsx24("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size }, className });
|
|
6622
|
-
}
|
|
6623
|
-
var LazyKnot = lazy(async () => {
|
|
6624
|
-
try {
|
|
6625
|
-
const mod = await import("./brand/index.js");
|
|
6626
|
-
return { default: mod.TangleKnot };
|
|
6627
|
-
} catch {
|
|
6628
|
-
return { default: MarkSpacer };
|
|
6629
|
-
}
|
|
6630
|
-
});
|
|
6631
|
-
function BrandMark({ size = 24, className }) {
|
|
6632
|
-
return /* @__PURE__ */ jsx24(Suspense, { fallback: /* @__PURE__ */ jsx24(MarkSpacer, { size, className }), children: /* @__PURE__ */ jsx24(LazyKnot, { size, className }) });
|
|
6633
|
-
}
|
|
6634
|
-
|
|
6635
7103
|
// src/web-react/chat-empty-state.tsx
|
|
6636
|
-
import { jsx as
|
|
7104
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6637
7105
|
function ChatEmptyState({
|
|
6638
7106
|
productName = "Agent",
|
|
6639
7107
|
headline = "Ask the agent to do something",
|
|
@@ -6643,11 +7111,11 @@ function ChatEmptyState({
|
|
|
6643
7111
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
6644
7112
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
6645
7113
|
return /* @__PURE__ */ jsxs23("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
6646
|
-
/* @__PURE__ */
|
|
6647
|
-
/* @__PURE__ */
|
|
6648
|
-
/* @__PURE__ */
|
|
6649
|
-
subline && /* @__PURE__ */
|
|
6650
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
7114
|
+
/* @__PURE__ */ jsx24("span", { className: "mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/15", children: /* @__PURE__ */ jsx24(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
7115
|
+
/* @__PURE__ */ jsx24("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
7116
|
+
/* @__PURE__ */ jsx24("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
7117
|
+
subline && /* @__PURE__ */ jsx24("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
7118
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx24("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs23(
|
|
6651
7119
|
"button",
|
|
6652
7120
|
{
|
|
6653
7121
|
type: "button",
|
|
@@ -6658,7 +7126,7 @@ function ChatEmptyState({
|
|
|
6658
7126
|
door.icon,
|
|
6659
7127
|
door.label
|
|
6660
7128
|
] }),
|
|
6661
|
-
door.description && /* @__PURE__ */
|
|
7129
|
+
door.description && /* @__PURE__ */ jsx24("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
6662
7130
|
]
|
|
6663
7131
|
},
|
|
6664
7132
|
i
|
|
@@ -6670,7 +7138,7 @@ function ChatEmptyState({
|
|
|
6670
7138
|
import { useState as useState23 } from "react";
|
|
6671
7139
|
import { TerminalDisplay, TerminalLine } from "@tangle-network/ui/primitives";
|
|
6672
7140
|
import { InlineToolItem } from "@tangle-network/ui/run";
|
|
6673
|
-
import { Fragment as Fragment9, jsx as
|
|
7141
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6674
7142
|
function pendingApprovalOf(call) {
|
|
6675
7143
|
const outcome = call.result;
|
|
6676
7144
|
if (!outcome?.ok || outcome.result?.status !== "queued_for_approval" || !outcome.result.proposalId) return null;
|
|
@@ -6679,25 +7147,25 @@ function pendingApprovalOf(call) {
|
|
|
6679
7147
|
function ToolGlyph({ name, className }) {
|
|
6680
7148
|
if (name.startsWith("sandbox_")) {
|
|
6681
7149
|
return /* @__PURE__ */ jsxs24("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6682
|
-
/* @__PURE__ */
|
|
6683
|
-
/* @__PURE__ */
|
|
7150
|
+
/* @__PURE__ */ jsx25("polyline", { points: "4 17 10 11 4 5" }),
|
|
7151
|
+
/* @__PURE__ */ jsx25("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
6684
7152
|
] });
|
|
6685
7153
|
}
|
|
6686
7154
|
if (name === "submit_proposal") {
|
|
6687
7155
|
return /* @__PURE__ */ jsxs24("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6688
|
-
/* @__PURE__ */
|
|
6689
|
-
/* @__PURE__ */
|
|
7156
|
+
/* @__PURE__ */ jsx25("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
7157
|
+
/* @__PURE__ */ jsx25("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
6690
7158
|
] });
|
|
6691
7159
|
}
|
|
6692
7160
|
if (name === "schedule_followup") {
|
|
6693
7161
|
return /* @__PURE__ */ jsxs24("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
6694
|
-
/* @__PURE__ */
|
|
6695
|
-
/* @__PURE__ */
|
|
7162
|
+
/* @__PURE__ */ jsx25("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7163
|
+
/* @__PURE__ */ jsx25("path", { d: "M12 7v5l3 3" })
|
|
6696
7164
|
] });
|
|
6697
7165
|
}
|
|
6698
7166
|
return /* @__PURE__ */ jsxs24("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6699
|
-
/* @__PURE__ */
|
|
6700
|
-
/* @__PURE__ */
|
|
7167
|
+
/* @__PURE__ */ jsx25("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
7168
|
+
/* @__PURE__ */ jsx25("circle", { cx: "12", cy: "12", r: "4" })
|
|
6701
7169
|
] });
|
|
6702
7170
|
}
|
|
6703
7171
|
function toolOutcomeOf(call) {
|
|
@@ -6783,21 +7251,21 @@ function truncate(v, max = 240) {
|
|
|
6783
7251
|
function KvRows({ data }) {
|
|
6784
7252
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
6785
7253
|
if (!entries.length) return null;
|
|
6786
|
-
return /* @__PURE__ */
|
|
6787
|
-
/* @__PURE__ */
|
|
6788
|
-
/* @__PURE__ */
|
|
7254
|
+
return /* @__PURE__ */ jsx25("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs24("div", { className: "contents", children: [
|
|
7255
|
+
/* @__PURE__ */ jsx25("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
7256
|
+
/* @__PURE__ */ jsx25("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
6789
7257
|
] }, k)) });
|
|
6790
7258
|
}
|
|
6791
7259
|
function ShellDetail({ call }) {
|
|
6792
7260
|
const outcome = toolOutcomeOf(call);
|
|
6793
7261
|
const r = outcome?.result ?? {};
|
|
6794
7262
|
return /* @__PURE__ */ jsxs24(TerminalDisplay, { showHeader: false, autoScroll: false, maxHeight: "14rem", className: "text-xs", children: [
|
|
6795
|
-
/* @__PURE__ */
|
|
7263
|
+
/* @__PURE__ */ jsx25(TerminalLine, { type: "command", children: String(call.args?.command ?? "") }),
|
|
6796
7264
|
r.exitCode != null && /* @__PURE__ */ jsxs24(TerminalLine, { type: r.exitCode === 0 ? "success" : "error", children: [
|
|
6797
7265
|
"exit ",
|
|
6798
7266
|
r.exitCode
|
|
6799
7267
|
] }),
|
|
6800
|
-
/* @__PURE__ */
|
|
7268
|
+
/* @__PURE__ */ jsx25(TerminalLine, { type: outcome?.ok === false ? "error" : "output", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
6801
7269
|
] });
|
|
6802
7270
|
}
|
|
6803
7271
|
function DefaultToolDetail({ call }) {
|
|
@@ -6805,15 +7273,15 @@ function DefaultToolDetail({ call }) {
|
|
|
6805
7273
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
6806
7274
|
return /* @__PURE__ */ jsxs24("div", { className: "space-y-2", children: [
|
|
6807
7275
|
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs24("div", { children: [
|
|
6808
|
-
/* @__PURE__ */
|
|
6809
|
-
/* @__PURE__ */
|
|
7276
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
7277
|
+
/* @__PURE__ */ jsx25(KvRows, { data: call.args })
|
|
6810
7278
|
] }),
|
|
6811
7279
|
envelope ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
6812
|
-
/* @__PURE__ */
|
|
6813
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
7280
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
7281
|
+
envelope.ok === false ? /* @__PURE__ */ jsx25("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx25(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx25("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
6814
7282
|
] }) : result != null ? /* @__PURE__ */ jsxs24("div", { children: [
|
|
6815
|
-
/* @__PURE__ */
|
|
6816
|
-
/* @__PURE__ */
|
|
7283
|
+
/* @__PURE__ */ jsx25("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
7284
|
+
/* @__PURE__ */ jsx25("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
6817
7285
|
] }) : null
|
|
6818
7286
|
] });
|
|
6819
7287
|
}
|
|
@@ -6830,18 +7298,18 @@ function ProposalCard({
|
|
|
6830
7298
|
const { pending: deciding, run: decide } = usePending();
|
|
6831
7299
|
return /* @__PURE__ */ jsxs24("div", { className: "w-full max-w-full rounded-xl border border-warning/50 bg-warning/[0.06] text-sm shadow-sm ring-1 ring-warning/10", children: [
|
|
6832
7300
|
/* @__PURE__ */ jsxs24("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
6833
|
-
/* @__PURE__ */
|
|
7301
|
+
/* @__PURE__ */ jsx25("span", { className: "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warning/15 text-warning", children: /* @__PURE__ */ jsx25(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
6834
7302
|
/* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1", children: [
|
|
6835
|
-
/* @__PURE__ */
|
|
6836
|
-
/* @__PURE__ */
|
|
6837
|
-
summary && /* @__PURE__ */
|
|
6838
|
-
typeSlug && /* @__PURE__ */
|
|
6839
|
-
meta.length > 0 && /* @__PURE__ */
|
|
7303
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
7304
|
+
/* @__PURE__ */ jsx25("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
7305
|
+
summary && /* @__PURE__ */ jsx25("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
7306
|
+
typeSlug && /* @__PURE__ */ jsx25("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
7307
|
+
meta.length > 0 && /* @__PURE__ */ jsx25("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx25("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
6840
7308
|
] })
|
|
6841
7309
|
] }),
|
|
6842
7310
|
/* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
6843
7311
|
approval && /* @__PURE__ */ jsxs24(Fragment9, { children: [
|
|
6844
|
-
/* @__PURE__ */
|
|
7312
|
+
/* @__PURE__ */ jsx25(
|
|
6845
7313
|
"button",
|
|
6846
7314
|
{
|
|
6847
7315
|
type: "button",
|
|
@@ -6851,7 +7319,7 @@ function ProposalCard({
|
|
|
6851
7319
|
children: "Approve & run"
|
|
6852
7320
|
}
|
|
6853
7321
|
),
|
|
6854
|
-
/* @__PURE__ */
|
|
7322
|
+
/* @__PURE__ */ jsx25(
|
|
6855
7323
|
"button",
|
|
6856
7324
|
{
|
|
6857
7325
|
type: "button",
|
|
@@ -6871,12 +7339,12 @@ function ProposalCard({
|
|
|
6871
7339
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
6872
7340
|
children: [
|
|
6873
7341
|
expanded ? "Hide details" : "View details",
|
|
6874
|
-
/* @__PURE__ */
|
|
7342
|
+
/* @__PURE__ */ jsx25(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
6875
7343
|
]
|
|
6876
7344
|
}
|
|
6877
7345
|
)
|
|
6878
7346
|
] }),
|
|
6879
|
-
expanded && /* @__PURE__ */
|
|
7347
|
+
expanded && /* @__PURE__ */ jsx25("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx25(DefaultToolDetail, { call }) })
|
|
6880
7348
|
] });
|
|
6881
7349
|
}
|
|
6882
7350
|
function formatFollowupWhen(when) {
|
|
@@ -6891,14 +7359,14 @@ function FollowupCard({ call }) {
|
|
|
6891
7359
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
6892
7360
|
const failed = toolCallFailed(call);
|
|
6893
7361
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
6894
|
-
return /* @__PURE__ */
|
|
7362
|
+
return /* @__PURE__ */ jsx25("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
6895
7363
|
/* @__PURE__ */ jsxs24("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
6896
|
-
/* @__PURE__ */
|
|
6897
|
-
/* @__PURE__ */
|
|
6898
|
-
when && /* @__PURE__ */
|
|
6899
|
-
/* @__PURE__ */
|
|
7364
|
+
/* @__PURE__ */ jsx25("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-border bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx25(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
7365
|
+
/* @__PURE__ */ jsx25("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
7366
|
+
when && /* @__PURE__ */ jsx25("span", { title: when, className: "hidden min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-muted-foreground sm:inline", children: formatFollowupWhen(when) }),
|
|
7367
|
+
/* @__PURE__ */ jsx25("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx25("svg", { className: "h-3 w-3 shrink-0 animate-spin text-[var(--accent-text)]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx25("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx25("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
6900
7368
|
] }),
|
|
6901
|
-
errorText && /* @__PURE__ */
|
|
7369
|
+
errorText && /* @__PURE__ */ jsx25("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
6902
7370
|
] }) });
|
|
6903
7371
|
}
|
|
6904
7372
|
function toolRowTitle(call) {
|
|
@@ -6921,10 +7389,10 @@ function ToolCallCard({
|
|
|
6921
7389
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
6922
7390
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
6923
7391
|
const kind = blockKindOf(call);
|
|
6924
|
-
const arrive = (row) => /* @__PURE__ */
|
|
7392
|
+
const arrive = (row) => /* @__PURE__ */ jsx25("div", { className: "agent-arrive", style: arrival, children: row });
|
|
6925
7393
|
if (pending) {
|
|
6926
7394
|
return arrive(
|
|
6927
|
-
/* @__PURE__ */
|
|
7395
|
+
/* @__PURE__ */ jsx25(
|
|
6928
7396
|
ProposalCard,
|
|
6929
7397
|
{
|
|
6930
7398
|
call,
|
|
@@ -6937,18 +7405,18 @@ function ToolCallCard({
|
|
|
6937
7405
|
);
|
|
6938
7406
|
}
|
|
6939
7407
|
if (kind === "followup") {
|
|
6940
|
-
return arrive(/* @__PURE__ */
|
|
7408
|
+
return arrive(/* @__PURE__ */ jsx25(FollowupCard, { call }));
|
|
6941
7409
|
}
|
|
6942
7410
|
const custom = renderers?.[call.name]?.(call, message);
|
|
6943
7411
|
return arrive(
|
|
6944
|
-
/* @__PURE__ */
|
|
7412
|
+
/* @__PURE__ */ jsx25(
|
|
6945
7413
|
InlineToolItem,
|
|
6946
7414
|
{
|
|
6947
7415
|
part: chatToolCallPart(call),
|
|
6948
7416
|
title: toolRowTitle(call),
|
|
6949
7417
|
description: toolRowDescription(call),
|
|
6950
|
-
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
6951
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
7418
|
+
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx25(ShellDetail, { call }) : /* @__PURE__ */ jsx25(DefaultToolDetail, { call })),
|
|
7419
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx25(
|
|
6952
7420
|
"button",
|
|
6953
7421
|
{
|
|
6954
7422
|
type: "button",
|
|
@@ -6957,8 +7425,8 @@ function ToolCallCard({
|
|
|
6957
7425
|
title: "Open full transcript",
|
|
6958
7426
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
6959
7427
|
children: /* @__PURE__ */ jsxs24("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
/* @__PURE__ */
|
|
7428
|
+
/* @__PURE__ */ jsx25("path", { d: "M7 17 17 7" }),
|
|
7429
|
+
/* @__PURE__ */ jsx25("path", { d: "M7 7h10v10" })
|
|
6962
7430
|
] })
|
|
6963
7431
|
}
|
|
6964
7432
|
) : void 0
|
|
@@ -6973,9 +7441,9 @@ import { isViewerMessage, MessageAuthor, TRANSCRIPT_TEXT } from "@tangle-network
|
|
|
6973
7441
|
|
|
6974
7442
|
// src/web-react/chat-message-body.tsx
|
|
6975
7443
|
import { useMemo as useMemo10 } from "react";
|
|
6976
|
-
import { jsx as
|
|
7444
|
+
import { jsx as jsx26, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6977
7445
|
function StreamingCaret() {
|
|
6978
|
-
return /* @__PURE__ */
|
|
7446
|
+
return /* @__PURE__ */ jsx26(
|
|
6979
7447
|
"span",
|
|
6980
7448
|
{
|
|
6981
7449
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-[agent-caret_1s_step-end_infinite] rounded-sm bg-foreground/70",
|
|
@@ -7002,7 +7470,7 @@ function SegmentText({
|
|
|
7002
7470
|
// log was appended to".
|
|
7003
7471
|
/* @__PURE__ */ jsxs25("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
7004
7472
|
body,
|
|
7005
|
-
showCaret && /* @__PURE__ */
|
|
7473
|
+
showCaret && /* @__PURE__ */ jsx26(StreamingCaret, {})
|
|
7006
7474
|
] })
|
|
7007
7475
|
);
|
|
7008
7476
|
}
|
|
@@ -7027,7 +7495,7 @@ function SegmentedBody({
|
|
|
7027
7495
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
7028
7496
|
(tc) => !segmentToolIds.has(tc.id)
|
|
7029
7497
|
);
|
|
7030
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
7498
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx26(
|
|
7031
7499
|
ToolCallCard,
|
|
7032
7500
|
{
|
|
7033
7501
|
call,
|
|
@@ -7056,12 +7524,12 @@ function SegmentedBody({
|
|
|
7056
7524
|
const children = [];
|
|
7057
7525
|
for (const g of groups) {
|
|
7058
7526
|
if (g.kind === "notice") {
|
|
7059
|
-
children.push(/* @__PURE__ */
|
|
7527
|
+
children.push(/* @__PURE__ */ jsx26(SegmentNotice, { tone: g.tone, content: g.content }, `notice-${g.index}`));
|
|
7060
7528
|
continue;
|
|
7061
7529
|
}
|
|
7062
7530
|
if (g.kind === "text") {
|
|
7063
7531
|
children.push(
|
|
7064
|
-
/* @__PURE__ */
|
|
7532
|
+
/* @__PURE__ */ jsx26(
|
|
7065
7533
|
SegmentText,
|
|
7066
7534
|
{
|
|
7067
7535
|
content: g.content,
|
|
@@ -7083,7 +7551,7 @@ function SegmentedBody({
|
|
|
7083
7551
|
g.calls.length,
|
|
7084
7552
|
" steps"
|
|
7085
7553
|
] }),
|
|
7086
|
-
/* @__PURE__ */
|
|
7554
|
+
/* @__PURE__ */ jsx26("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
7087
7555
|
] }, `tools-fold-${g.index}`)
|
|
7088
7556
|
);
|
|
7089
7557
|
continue;
|
|
@@ -7092,9 +7560,9 @@ function SegmentedBody({
|
|
|
7092
7560
|
}
|
|
7093
7561
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
7094
7562
|
if (streaming && segments[lastIndex]?.kind === "tool") {
|
|
7095
|
-
children.push(/* @__PURE__ */
|
|
7563
|
+
children.push(/* @__PURE__ */ jsx26(StreamingCaret, {}, "streaming-caret"));
|
|
7096
7564
|
}
|
|
7097
|
-
return /* @__PURE__ */
|
|
7565
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex flex-col gap-2", children });
|
|
7098
7566
|
}
|
|
7099
7567
|
var NOTICE_TONE_CLASS = {
|
|
7100
7568
|
error: "border-destructive/40 bg-destructive/5 text-destructive",
|
|
@@ -7108,17 +7576,17 @@ function SegmentNotice({ tone, content }) {
|
|
|
7108
7576
|
className: `flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm ${NOTICE_TONE_CLASS[tone]}`,
|
|
7109
7577
|
children: [
|
|
7110
7578
|
/* @__PURE__ */ jsxs25("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7111
|
-
/* @__PURE__ */
|
|
7112
|
-
/* @__PURE__ */
|
|
7579
|
+
/* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7580
|
+
/* @__PURE__ */ jsx26("path", { d: "M12 8v4m0 4h.01" })
|
|
7113
7581
|
] }),
|
|
7114
|
-
/* @__PURE__ */
|
|
7582
|
+
/* @__PURE__ */ jsx26("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: content })
|
|
7115
7583
|
]
|
|
7116
7584
|
}
|
|
7117
7585
|
);
|
|
7118
7586
|
}
|
|
7119
7587
|
|
|
7120
7588
|
// src/web-react/chat-messages.tsx
|
|
7121
|
-
import { Fragment as Fragment10, jsx as
|
|
7589
|
+
import { Fragment as Fragment10, jsx as jsx27, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7122
7590
|
var QUIET_META_LANE_CLASS = "mt-1 flex h-[18px] items-center gap-2 text-xs tabular-nums text-muted-foreground opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100";
|
|
7123
7591
|
function copyTextOf(msg) {
|
|
7124
7592
|
const textRuns = msg.segments?.filter((s) => s.kind === "text") ?? [];
|
|
@@ -7147,7 +7615,7 @@ function CopyMessageButton({ text }) {
|
|
|
7147
7615
|
}
|
|
7148
7616
|
);
|
|
7149
7617
|
};
|
|
7150
|
-
return /* @__PURE__ */
|
|
7618
|
+
return /* @__PURE__ */ jsx27(
|
|
7151
7619
|
"button",
|
|
7152
7620
|
{
|
|
7153
7621
|
type: "button",
|
|
@@ -7155,9 +7623,9 @@ function CopyMessageButton({ text }) {
|
|
|
7155
7623
|
"aria-label": "Copy message",
|
|
7156
7624
|
title: "Copy message",
|
|
7157
7625
|
className: "rounded p-0.5 text-muted-foreground transition hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
7158
|
-
children: copied ? /* @__PURE__ */
|
|
7159
|
-
/* @__PURE__ */
|
|
7160
|
-
/* @__PURE__ */
|
|
7626
|
+
children: copied ? /* @__PURE__ */ jsx27("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx27("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs26("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7627
|
+
/* @__PURE__ */ jsx27("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
7628
|
+
/* @__PURE__ */ jsx27("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
7161
7629
|
] })
|
|
7162
7630
|
}
|
|
7163
7631
|
);
|
|
@@ -7184,20 +7652,20 @@ function AssistantMessageImpl({
|
|
|
7184
7652
|
const hasAnswerText = content !== "" || (segments?.some((s) => (s.kind === "text" || s.kind === "notice") && s.content.trim() !== "") ?? false);
|
|
7185
7653
|
const quiet = chrome === "quiet";
|
|
7186
7654
|
return /* @__PURE__ */ jsxs26("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7187
|
-
quiet && msg.author && /* @__PURE__ */
|
|
7655
|
+
quiet && msg.author && /* @__PURE__ */ jsx27(MessageAuthor, { author: msg.author, className: "mb-1.5" }),
|
|
7188
7656
|
!quiet && /* @__PURE__ */ jsxs26(
|
|
7189
7657
|
"div",
|
|
7190
7658
|
{
|
|
7191
7659
|
className: `mb-1 flex ${msg.author ? "items-center" : "items-baseline"} gap-2 text-xs tabular-nums text-muted-foreground`,
|
|
7192
7660
|
children: [
|
|
7193
|
-
msg.author ? /* @__PURE__ */
|
|
7194
|
-
msg.modelUsed && /* @__PURE__ */
|
|
7195
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
7196
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7661
|
+
msg.author ? /* @__PURE__ */ jsx27(MessageAuthor, { author: msg.author }) : /* @__PURE__ */ jsx27("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
7662
|
+
msg.modelUsed && /* @__PURE__ */ jsx27("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
7663
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx27("span", { children: formatTokensPerSecond(msg) }),
|
|
7664
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx27("span", { children: formatModelCost(msg, models) })
|
|
7197
7665
|
]
|
|
7198
7666
|
}
|
|
7199
7667
|
),
|
|
7200
|
-
/* @__PURE__ */
|
|
7668
|
+
/* @__PURE__ */ jsx27(
|
|
7201
7669
|
ReasoningRow,
|
|
7202
7670
|
{
|
|
7203
7671
|
className: "mb-2",
|
|
@@ -7207,7 +7675,7 @@ function AssistantMessageImpl({
|
|
|
7207
7675
|
thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
|
|
7208
7676
|
}
|
|
7209
7677
|
),
|
|
7210
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
7678
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx27(
|
|
7211
7679
|
SegmentedBody,
|
|
7212
7680
|
{
|
|
7213
7681
|
segments,
|
|
@@ -7222,9 +7690,9 @@ function AssistantMessageImpl({
|
|
|
7222
7690
|
) : /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
7223
7691
|
/* @__PURE__ */ jsxs26("div", { className: messageClassName, children: [
|
|
7224
7692
|
body,
|
|
7225
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
7693
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx27(StreamingCaret, {})
|
|
7226
7694
|
] }),
|
|
7227
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
7695
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx27("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx27(
|
|
7228
7696
|
ToolCallCard,
|
|
7229
7697
|
{
|
|
7230
7698
|
call: tc,
|
|
@@ -7237,7 +7705,7 @@ function AssistantMessageImpl({
|
|
|
7237
7705
|
tc.id
|
|
7238
7706
|
)) })
|
|
7239
7707
|
] }),
|
|
7240
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
7708
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx27(
|
|
7241
7709
|
DurableChatCards,
|
|
7242
7710
|
{
|
|
7243
7711
|
...durableCards,
|
|
@@ -7246,7 +7714,7 @@ function AssistantMessageImpl({
|
|
|
7246
7714
|
className: "mt-3"
|
|
7247
7715
|
}
|
|
7248
7716
|
),
|
|
7249
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
7717
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx27(
|
|
7250
7718
|
WorkProductCard,
|
|
7251
7719
|
{
|
|
7252
7720
|
part,
|
|
@@ -7256,7 +7724,7 @@ function AssistantMessageImpl({
|
|
|
7256
7724
|
`${part.ref.id}:${part.ref.version}`
|
|
7257
7725
|
)),
|
|
7258
7726
|
renderExtras?.(msg),
|
|
7259
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
7727
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx27("div", { className: "mt-2", children: /* @__PURE__ */ jsx27(
|
|
7260
7728
|
MessageAttachments,
|
|
7261
7729
|
{
|
|
7262
7730
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -7265,10 +7733,10 @@ function AssistantMessageImpl({
|
|
|
7265
7733
|
}
|
|
7266
7734
|
) }),
|
|
7267
7735
|
quiet && /* @__PURE__ */ jsxs26("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
7268
|
-
/* @__PURE__ */
|
|
7269
|
-
msg.modelUsed && /* @__PURE__ */
|
|
7270
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
7271
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7736
|
+
/* @__PURE__ */ jsx27(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
7737
|
+
msg.modelUsed && /* @__PURE__ */ jsx27("span", { className: "font-mono", children: msg.modelUsed }),
|
|
7738
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx27("span", { children: formatTokensPerSecond(msg) }),
|
|
7739
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx27("span", { children: formatModelCost(msg, models) })
|
|
7272
7740
|
] })
|
|
7273
7741
|
] });
|
|
7274
7742
|
}
|
|
@@ -7285,18 +7753,18 @@ function useThinkingSeconds(active) {
|
|
|
7285
7753
|
}
|
|
7286
7754
|
function ThinkingRow({ agentLabel, chrome = "labeled", phase }) {
|
|
7287
7755
|
return /* @__PURE__ */ jsxs26("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
7288
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
7289
|
-
/* @__PURE__ */
|
|
7756
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx27("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
7757
|
+
/* @__PURE__ */ jsx27(TurnProgress, { phase, pendingMessage: "Thinking\u2026", className: "text-[15px]" })
|
|
7290
7758
|
] });
|
|
7291
7759
|
}
|
|
7292
7760
|
function StreamErrorRow({ message, onRetry }) {
|
|
7293
|
-
return /* @__PURE__ */
|
|
7761
|
+
return /* @__PURE__ */ jsx27("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs26("div", { role: "alert", className: "flex items-start gap-2.5 rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2.5 text-sm text-destructive", children: [
|
|
7294
7762
|
/* @__PURE__ */ jsxs26("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7295
|
-
/* @__PURE__ */
|
|
7296
|
-
/* @__PURE__ */
|
|
7763
|
+
/* @__PURE__ */ jsx27("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7764
|
+
/* @__PURE__ */ jsx27("path", { d: "M12 8v4m0 4h.01" })
|
|
7297
7765
|
] }),
|
|
7298
|
-
/* @__PURE__ */
|
|
7299
|
-
onRetry && /* @__PURE__ */
|
|
7766
|
+
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
7767
|
+
onRetry && /* @__PURE__ */ jsx27(
|
|
7300
7768
|
"button",
|
|
7301
7769
|
{
|
|
7302
7770
|
type: "button",
|
|
@@ -7317,17 +7785,17 @@ function OtherPersonMessage({
|
|
|
7317
7785
|
const attachments = resolveAttachmentUrl ? attachmentPartsFromMessageParts(msg.parts) : [];
|
|
7318
7786
|
return /* @__PURE__ */ jsxs26("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7319
7787
|
/* @__PURE__ */ jsxs26("div", { className: `w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
7320
|
-
/* @__PURE__ */
|
|
7321
|
-
/* @__PURE__ */
|
|
7788
|
+
/* @__PURE__ */ jsx27(MessageAuthor, { author, className: "mb-1.5" }),
|
|
7789
|
+
/* @__PURE__ */ jsx27(
|
|
7322
7790
|
"div",
|
|
7323
7791
|
{
|
|
7324
7792
|
className: `w-fit max-w-full rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-4 py-2.5 text-[hsl(var(--foreground))] ${quiet ? "" : "rounded-tl-md "}${messageClassName}`,
|
|
7325
|
-
children: /* @__PURE__ */
|
|
7793
|
+
children: /* @__PURE__ */ jsx27("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
7326
7794
|
}
|
|
7327
7795
|
),
|
|
7328
|
-
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */
|
|
7796
|
+
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */ jsx27("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx27(MessageAttachments, { parts: attachments, resolveFileUrl: resolveAttachmentUrl, justify: "start" }) })
|
|
7329
7797
|
] }),
|
|
7330
|
-
quiet && /* @__PURE__ */
|
|
7798
|
+
quiet && /* @__PURE__ */ jsx27("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-start`, children: /* @__PURE__ */ jsx27(CopyMessageButton, { text: msg.content }) })
|
|
7331
7799
|
] });
|
|
7332
7800
|
}
|
|
7333
7801
|
function ChatMessages({
|
|
@@ -7357,13 +7825,13 @@ function ChatMessages({
|
|
|
7357
7825
|
const messageClassName = messageSize === "large" ? `agent-app-message-copy ${TRANSCRIPT_TEXT} [--transcript-font-size:1.0625rem]` : `agent-app-message-copy ${TRANSCRIPT_TEXT}`;
|
|
7358
7826
|
const assistantMessageClassName = `${messageClassName} bg-transparent text-[hsl(var(--foreground))]`;
|
|
7359
7827
|
const renderBody = useMemo11(
|
|
7360
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
7828
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx27("p", { className: "whitespace-pre-wrap", children: content })),
|
|
7361
7829
|
[renderMarkdown]
|
|
7362
7830
|
);
|
|
7363
7831
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
7364
7832
|
const quiet = chrome === "quiet";
|
|
7365
7833
|
if (messages.length === 0 && !loading && !error) {
|
|
7366
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
7834
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx27(ChatEmptyState, { ...emptyState });
|
|
7367
7835
|
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
7368
7836
|
header,
|
|
7369
7837
|
empty
|
|
@@ -7372,7 +7840,7 @@ function ChatMessages({
|
|
|
7372
7840
|
return /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
7373
7841
|
header,
|
|
7374
7842
|
messages.map(
|
|
7375
|
-
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */
|
|
7843
|
+
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */ jsx27(
|
|
7376
7844
|
OtherPersonMessage,
|
|
7377
7845
|
{
|
|
7378
7846
|
msg,
|
|
@@ -7384,15 +7852,15 @@ function ChatMessages({
|
|
|
7384
7852
|
msg.id
|
|
7385
7853
|
) : msg.role === "user" ? /* @__PURE__ */ jsxs26("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7386
7854
|
/* @__PURE__ */ jsxs26("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
7387
|
-
!quiet && /* @__PURE__ */
|
|
7388
|
-
/* @__PURE__ */
|
|
7855
|
+
!quiet && /* @__PURE__ */ jsx27("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
7856
|
+
/* @__PURE__ */ jsx27(
|
|
7389
7857
|
"div",
|
|
7390
7858
|
{
|
|
7391
7859
|
className: `rounded-2xl bg-[hsl(var(--foreground))] px-4 py-2.5 text-[hsl(var(--background))] ${quiet ? "" : "rounded-tr-md "}${messageClassName}`,
|
|
7392
|
-
children: /* @__PURE__ */
|
|
7860
|
+
children: /* @__PURE__ */ jsx27("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
7393
7861
|
}
|
|
7394
7862
|
),
|
|
7395
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
7863
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx27("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx27(
|
|
7396
7864
|
MessageAttachments,
|
|
7397
7865
|
{
|
|
7398
7866
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -7401,8 +7869,8 @@ function ChatMessages({
|
|
|
7401
7869
|
}
|
|
7402
7870
|
) })
|
|
7403
7871
|
] }),
|
|
7404
|
-
quiet && /* @__PURE__ */
|
|
7405
|
-
] }, msg.id) : /* @__PURE__ */
|
|
7872
|
+
quiet && /* @__PURE__ */ jsx27("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx27(CopyMessageButton, { text: msg.content }) })
|
|
7873
|
+
] }, msg.id) : /* @__PURE__ */ jsx27(
|
|
7406
7874
|
AssistantMessage,
|
|
7407
7875
|
{
|
|
7408
7876
|
msg,
|
|
@@ -7423,15 +7891,15 @@ function ChatMessages({
|
|
|
7423
7891
|
msg.id
|
|
7424
7892
|
)
|
|
7425
7893
|
),
|
|
7426
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
7427
|
-
error && !loading && /* @__PURE__ */
|
|
7894
|
+
loading && lastIsUser && /* @__PURE__ */ jsx27(ThinkingRow, { agentLabel, chrome, phase: turnPhase }),
|
|
7895
|
+
error && !loading && /* @__PURE__ */ jsx27(StreamErrorRow, { message: error, onRetry })
|
|
7428
7896
|
] });
|
|
7429
7897
|
}
|
|
7430
7898
|
|
|
7431
7899
|
// src/web-react/api-access-panel.tsx
|
|
7432
7900
|
import { useEffect as useEffect17, useRef as useRef17, useState as useState25 } from "react";
|
|
7433
7901
|
import { Button as Button6, Input as Input3, PageHeader as PageHeader2 } from "@tangle-network/ui/primitives";
|
|
7434
|
-
import { jsx as
|
|
7902
|
+
import { jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7435
7903
|
var defaultExpiryChoices = [1, 7, 30];
|
|
7436
7904
|
function pruneScopes(scopes, access) {
|
|
7437
7905
|
const offered = new Map(access.map((option) => [option.scope, option]));
|
|
@@ -7567,10 +8035,10 @@ function ApiAccessPanel({
|
|
|
7567
8035
|
setRevoking(null);
|
|
7568
8036
|
}
|
|
7569
8037
|
}
|
|
7570
|
-
return /* @__PURE__ */
|
|
8038
|
+
return /* @__PURE__ */ jsx28("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs27("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
7571
8039
|
/* @__PURE__ */ jsxs27("div", { className: "space-y-2", children: [
|
|
7572
|
-
accountHref && /* @__PURE__ */
|
|
7573
|
-
/* @__PURE__ */
|
|
8040
|
+
accountHref && /* @__PURE__ */ jsx28("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
8041
|
+
/* @__PURE__ */ jsx28(
|
|
7574
8042
|
PageHeader2,
|
|
7575
8043
|
{
|
|
7576
8044
|
className: "mb-0",
|
|
@@ -7579,14 +8047,14 @@ function ApiAccessPanel({
|
|
|
7579
8047
|
}
|
|
7580
8048
|
)
|
|
7581
8049
|
] }),
|
|
7582
|
-
error && /* @__PURE__ */
|
|
7583
|
-
notice && /* @__PURE__ */
|
|
8050
|
+
error && /* @__PURE__ */ jsx28("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
8051
|
+
notice && /* @__PURE__ */ jsx28("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
7584
8052
|
created ? /* @__PURE__ */ jsxs27("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
7585
|
-
/* @__PURE__ */
|
|
7586
|
-
/* @__PURE__ */
|
|
8053
|
+
/* @__PURE__ */ jsx28("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
8054
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: "Copy it directly into your client\u2019s secret storage. It is shown only now. Keep it out of chat messages and prompts." }),
|
|
7587
8055
|
/* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
|
|
7588
|
-
/* @__PURE__ */
|
|
7589
|
-
/* @__PURE__ */
|
|
8056
|
+
/* @__PURE__ */ jsx28(Input3, { size: "lg", "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: "min-w-0 font-mono" }),
|
|
8057
|
+
/* @__PURE__ */ jsx28(Button6, { onClick: async () => {
|
|
7590
8058
|
try {
|
|
7591
8059
|
await navigator.clipboard.writeText(created.key);
|
|
7592
8060
|
setNotice("Key copied");
|
|
@@ -7595,20 +8063,20 @@ function ApiAccessPanel({
|
|
|
7595
8063
|
}
|
|
7596
8064
|
}, children: "Copy key" })
|
|
7597
8065
|
] }),
|
|
7598
|
-
/* @__PURE__ */
|
|
8066
|
+
/* @__PURE__ */ jsx28(Button6, { variant: "outline", onClick: () => {
|
|
7599
8067
|
setCreated(null);
|
|
7600
8068
|
setNotice(null);
|
|
7601
8069
|
}, children: "I\u2019ve saved it" })
|
|
7602
8070
|
] }) : /* @__PURE__ */ jsxs27("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
7603
|
-
/* @__PURE__ */
|
|
8071
|
+
/* @__PURE__ */ jsx28("h2", { className: "font-medium", children: "Create a key" }),
|
|
7604
8072
|
/* @__PURE__ */ jsxs27("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
7605
8073
|
/* @__PURE__ */ jsxs27("div", { className: "space-y-1.5", children: [
|
|
7606
|
-
/* @__PURE__ */
|
|
7607
|
-
/* @__PURE__ */
|
|
8074
|
+
/* @__PURE__ */ jsx28("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
8075
|
+
/* @__PURE__ */ jsx28(Input3, { size: "lg", ref: nameInput, id: "key-name", value: name, onChange: (event) => setName(event.target.value), placeholder: "Client on my server", maxLength: 100, required: true, autoComplete: "off" })
|
|
7608
8076
|
] }),
|
|
7609
8077
|
/* @__PURE__ */ jsxs27("div", { className: "space-y-1.5", children: [
|
|
7610
|
-
/* @__PURE__ */
|
|
7611
|
-
/* @__PURE__ */
|
|
8078
|
+
/* @__PURE__ */ jsx28("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
8079
|
+
/* @__PURE__ */ jsx28("select", { id: "key-expiry", value: selectedDays ?? "", onChange: (event) => setDays(Number(event.target.value)), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: allowedDays.map((days2) => /* @__PURE__ */ jsxs27("option", { value: days2, children: [
|
|
7612
8080
|
days2,
|
|
7613
8081
|
" ",
|
|
7614
8082
|
days2 === 1 ? "day" : "days"
|
|
@@ -7616,7 +8084,7 @@ function ApiAccessPanel({
|
|
|
7616
8084
|
] })
|
|
7617
8085
|
] }),
|
|
7618
8086
|
workspaces && workspaces.length > 0 && /* @__PURE__ */ jsxs27("div", { className: "space-y-1.5", children: [
|
|
7619
|
-
/* @__PURE__ */
|
|
8087
|
+
/* @__PURE__ */ jsx28("label", { className: "text-sm font-medium", htmlFor: "key-reach", children: "Reaches" }),
|
|
7620
8088
|
/* @__PURE__ */ jsxs27("select", { id: "key-reach", value: selectedWorkspace, onChange: (event) => setReach(event.target.value), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: [
|
|
7621
8089
|
/* @__PURE__ */ jsxs27("option", { value: "", children: [
|
|
7622
8090
|
"All ",
|
|
@@ -7630,11 +8098,11 @@ function ApiAccessPanel({
|
|
|
7630
8098
|
] })
|
|
7631
8099
|
] }),
|
|
7632
8100
|
/* @__PURE__ */ jsxs27("fieldset", { className: "space-y-3", children: [
|
|
7633
|
-
/* @__PURE__ */
|
|
8101
|
+
/* @__PURE__ */ jsx28("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
7634
8102
|
access.map((option) => {
|
|
7635
8103
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
7636
8104
|
return /* @__PURE__ */ jsxs27("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
7637
|
-
/* @__PURE__ */
|
|
8105
|
+
/* @__PURE__ */ jsx28(
|
|
7638
8106
|
"input",
|
|
7639
8107
|
{
|
|
7640
8108
|
type: "checkbox",
|
|
@@ -7645,31 +8113,31 @@ function ApiAccessPanel({
|
|
|
7645
8113
|
}
|
|
7646
8114
|
),
|
|
7647
8115
|
/* @__PURE__ */ jsxs27("span", { className: "text-sm", children: [
|
|
7648
|
-
/* @__PURE__ */
|
|
7649
|
-
/* @__PURE__ */
|
|
7650
|
-
unavailable && /* @__PURE__ */
|
|
8116
|
+
/* @__PURE__ */ jsx28("span", { className: "block font-medium", children: option.label }),
|
|
8117
|
+
/* @__PURE__ */ jsx28("span", { className: "text-muted-foreground", children: option.description }),
|
|
8118
|
+
unavailable && /* @__PURE__ */ jsx28("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
7651
8119
|
] })
|
|
7652
8120
|
] }, option.scope);
|
|
7653
8121
|
})
|
|
7654
8122
|
] }),
|
|
7655
|
-
limitsDescription && /* @__PURE__ */
|
|
7656
|
-
/* @__PURE__ */
|
|
8123
|
+
limitsDescription && /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: limitsDescription }),
|
|
8124
|
+
/* @__PURE__ */ jsx28(Button6, { type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
7657
8125
|
] }),
|
|
7658
8126
|
/* @__PURE__ */ jsxs27("section", { "aria-labelledby": "existing-keys", className: "space-y-3", children: [
|
|
7659
|
-
/* @__PURE__ */
|
|
7660
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
8127
|
+
/* @__PURE__ */ jsx28("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
8128
|
+
keys.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx28("ul", { className: "divide-y divide-border rounded-xl border border-border bg-card", children: keys.map((key) => /* @__PURE__ */ jsxs27("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
7661
8129
|
/* @__PURE__ */ jsxs27("div", { className: "min-w-0 space-y-1", children: [
|
|
7662
|
-
/* @__PURE__ */
|
|
7663
|
-
/* @__PURE__ */
|
|
7664
|
-
/* @__PURE__ */
|
|
7665
|
-
workspaces && /* @__PURE__ */
|
|
8130
|
+
/* @__PURE__ */ jsx28("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
8131
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: key.expiresAt ? `${new Date(key.expiresAt).getTime() <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleDateString()}` : "No expiry" }),
|
|
8132
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") }),
|
|
8133
|
+
workspaces && /* @__PURE__ */ jsx28("p", { className: "text-sm text-muted-foreground", children: key.workspaceIds?.length ? `Only ${key.workspaceIds.map(workspaceName).join(", ")}` : `All ${workspaceNoun.plural}` })
|
|
7666
8134
|
] }),
|
|
7667
|
-
/* @__PURE__ */
|
|
8135
|
+
/* @__PURE__ */ jsx28(Button6, { variant: "outline", disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
7668
8136
|
] }, key.id)) })
|
|
7669
8137
|
] }),
|
|
7670
8138
|
/* @__PURE__ */ jsxs27("p", { className: "text-sm text-muted-foreground", children: [
|
|
7671
8139
|
"Use ",
|
|
7672
|
-
/* @__PURE__ */
|
|
8140
|
+
/* @__PURE__ */ jsx28("code", { className: "text-sm", children: baseUrl }),
|
|
7673
8141
|
" as the API base and send the key as a Bearer credential."
|
|
7674
8142
|
] })
|
|
7675
8143
|
] }) });
|
|
@@ -7677,7 +8145,7 @@ function ApiAccessPanel({
|
|
|
7677
8145
|
|
|
7678
8146
|
// src/web-react/agent-setup-block.tsx
|
|
7679
8147
|
import { useState as useState26 } from "react";
|
|
7680
|
-
import { jsx as
|
|
8148
|
+
import { jsx as jsx29, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7681
8149
|
function AgentSetupBlock({ productName, setupUrl, markdown, description, className }) {
|
|
7682
8150
|
const [notice, setNotice] = useState26(null);
|
|
7683
8151
|
const prompt = markdown ?? `Set up ${productName} for me. Fetch ${setupUrl} and follow every step in it.`;
|
|
@@ -7696,8 +8164,8 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
7696
8164
|
className: `space-y-3 rounded-xl border border-border bg-card p-5 ${className ?? ""}`.trim(),
|
|
7697
8165
|
children: [
|
|
7698
8166
|
/* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
7699
|
-
/* @__PURE__ */
|
|
7700
|
-
/* @__PURE__ */
|
|
8167
|
+
/* @__PURE__ */ jsx29("h2", { id: "agent-setup-heading", className: "font-medium text-foreground", children: "Hand this to your agent" }),
|
|
8168
|
+
/* @__PURE__ */ jsx29(
|
|
7701
8169
|
"button",
|
|
7702
8170
|
{
|
|
7703
8171
|
type: "button",
|
|
@@ -7707,13 +8175,13 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
7707
8175
|
}
|
|
7708
8176
|
)
|
|
7709
8177
|
] }),
|
|
7710
|
-
/* @__PURE__ */
|
|
8178
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: description ?? `Your coding agent sets up ${productName} end to end: it asks you to approve once, gets its own capped key, installs the client, and verifies a first call.` }),
|
|
7711
8179
|
/* @__PURE__ */ jsxs28("p", { className: "text-sm text-muted-foreground", children: [
|
|
7712
8180
|
"Raw prompt:",
|
|
7713
8181
|
" ",
|
|
7714
|
-
/* @__PURE__ */
|
|
8182
|
+
/* @__PURE__ */ jsx29("a", { href: setupUrl, className: "font-mono text-foreground underline", children: setupUrl })
|
|
7715
8183
|
] }),
|
|
7716
|
-
notice ? /* @__PURE__ */
|
|
8184
|
+
notice ? /* @__PURE__ */ jsx29("p", { role: "status", className: "text-sm text-foreground", children: notice }) : null
|
|
7717
8185
|
]
|
|
7718
8186
|
}
|
|
7719
8187
|
);
|
|
@@ -7721,37 +8189,37 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
7721
8189
|
|
|
7722
8190
|
// src/web-react/agent-profile-choices.tsx
|
|
7723
8191
|
import { useId as useId5 } from "react";
|
|
7724
|
-
import { jsx as
|
|
8192
|
+
import { jsx as jsx30, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7725
8193
|
function AgentProfileChoices({ value, profiles, onChange, disabled, locked, lockReason, onNewChat, label = "Agent profile" }) {
|
|
7726
8194
|
const name = useId5();
|
|
7727
8195
|
const selected = profiles.find((profile) => profile.id === value);
|
|
7728
8196
|
if (locked) {
|
|
7729
8197
|
return /* @__PURE__ */ jsxs29("div", { className: "space-y-2 rounded-lg border border-border p-3 text-sm", children: [
|
|
7730
|
-
/* @__PURE__ */
|
|
7731
|
-
/* @__PURE__ */
|
|
7732
|
-
onNewChat && !disabled && /* @__PURE__ */
|
|
8198
|
+
/* @__PURE__ */ jsx30("p", { className: "font-medium text-foreground", children: selected?.name ?? value }),
|
|
8199
|
+
/* @__PURE__ */ jsx30("p", { className: "text-muted-foreground", children: lockReason ?? "This conversation stays on its current profile." }),
|
|
8200
|
+
onNewChat && !disabled && /* @__PURE__ */ jsx30("button", { type: "button", onClick: onNewChat, className: "text-sm font-medium text-primary underline underline-offset-4", children: "New chat to switch profile" })
|
|
7733
8201
|
] });
|
|
7734
8202
|
}
|
|
7735
8203
|
return /* @__PURE__ */ jsxs29("fieldset", { disabled, className: "min-w-0 space-y-1", children: [
|
|
7736
|
-
/* @__PURE__ */
|
|
8204
|
+
/* @__PURE__ */ jsx30("legend", { className: "sr-only", children: label }),
|
|
7737
8205
|
/* @__PURE__ */ jsxs29("div", { className: "max-h-48 space-y-1 overflow-y-auto", children: [
|
|
7738
8206
|
profiles.map((profile) => /* @__PURE__ */ jsxs29("label", { className: "flex min-h-10 cursor-pointer items-start gap-2 rounded-lg border border-transparent p-2 text-sm hover:bg-muted has-[:checked]:border-border has-[:checked]:bg-muted has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60", children: [
|
|
7739
|
-
/* @__PURE__ */
|
|
8207
|
+
/* @__PURE__ */ jsx30("input", { type: "radio", name, value: profile.id, checked: profile.id === value, disabled, onChange: () => {
|
|
7740
8208
|
if (!disabled) onChange(profile.id);
|
|
7741
8209
|
}, className: "mt-1 shrink-0 accent-primary" }),
|
|
7742
8210
|
/* @__PURE__ */ jsxs29("span", { className: "min-w-0", children: [
|
|
7743
|
-
/* @__PURE__ */
|
|
7744
|
-
profile.description && /* @__PURE__ */
|
|
8211
|
+
/* @__PURE__ */ jsx30("span", { className: "block font-medium text-foreground", children: profile.name }),
|
|
8212
|
+
profile.description && /* @__PURE__ */ jsx30("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: profile.description })
|
|
7745
8213
|
] })
|
|
7746
8214
|
] }, profile.id)),
|
|
7747
|
-
profiles.length === 0 && /* @__PURE__ */
|
|
8215
|
+
profiles.length === 0 && /* @__PURE__ */ jsx30("p", { role: "status", className: "p-2 text-sm text-muted-foreground", children: "No profiles available." })
|
|
7748
8216
|
] })
|
|
7749
8217
|
] });
|
|
7750
8218
|
}
|
|
7751
8219
|
|
|
7752
8220
|
// src/web-react/composer-profile-pill.tsx
|
|
7753
8221
|
import { AgentProfilePicker } from "@tangle-network/sandbox-ui/chat";
|
|
7754
|
-
import { jsx as
|
|
8222
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
7755
8223
|
var TRIGGER = {
|
|
7756
8224
|
composer: "max-w-[180px]",
|
|
7757
8225
|
// A menu panel repoints surface-container to its own tone, which would leave
|
|
@@ -7776,7 +8244,7 @@ function ComposerProfilePill({
|
|
|
7776
8244
|
placement = "composer",
|
|
7777
8245
|
className
|
|
7778
8246
|
}) {
|
|
7779
|
-
return /* @__PURE__ */
|
|
8247
|
+
return /* @__PURE__ */ jsx31(
|
|
7780
8248
|
AgentProfilePicker,
|
|
7781
8249
|
{
|
|
7782
8250
|
value: selection.value,
|
|
@@ -7946,4 +8414,4 @@ export {
|
|
|
7946
8414
|
AgentProfileChoices,
|
|
7947
8415
|
ComposerProfilePill
|
|
7948
8416
|
};
|
|
7949
|
-
//# sourceMappingURL=chunk-
|
|
8417
|
+
//# sourceMappingURL=chunk-GIEUZBQQ.js.map
|