@tangle-network/agent-app 0.61.4 → 0.62.1
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-4LBCTFBP.js → chunk-4MD5PS4F.js} +5 -1
- package/dist/{chunk-4LBCTFBP.js.map → chunk-4MD5PS4F.js.map} +1 -1
- 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-L7LQRJGD.js → chunk-MVKMDROU.js} +48 -48
- package/dist/{chunk-L7LQRJGD.js.map → chunk-MVKMDROU.js.map} +1 -1
- 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-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 +2 -2
- 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/index.js +8 -6
- package/dist/sandbox/transient-failure.d.ts +2 -0
- 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 +1 -11
- 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
package/dist/assistant/index.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReasoningRow,
|
|
3
3
|
chatToolCallPart
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-BDEBQ4WO.js";
|
|
4
|
+
} from "../chunk-GIEUZBQQ.js";
|
|
6
5
|
import "../chunk-3HUFJ5LO.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-UHSUY6H6.js";
|
|
7
|
+
import "../chunk-7PULOECS.js";
|
|
8
|
+
import "../chunk-ZOS3D26Z.js";
|
|
9
9
|
import "../chunk-Y6PRDUFJ.js";
|
|
10
|
-
import "../chunk-GEYACSFW.js";
|
|
11
10
|
import {
|
|
12
11
|
ChatComposer
|
|
13
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-JRW6LCIA.js";
|
|
14
13
|
import "../chunk-L7MB2LLM.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-ZDPUC6CM.js";
|
|
14
|
+
import "../chunk-6ZVSMA4T.js";
|
|
17
15
|
import "../chunk-2HQP2CTA.js";
|
|
18
|
-
import "../chunk-FUZETA6Z.js";
|
|
19
|
-
import {
|
|
20
|
-
ModelPicker
|
|
21
|
-
} from "../chunk-R4X5474U.js";
|
|
22
16
|
import "../chunk-E4AY62T2.js";
|
|
23
17
|
import "../chunk-SJWIZT7B.js";
|
|
24
|
-
import "../chunk-
|
|
25
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-FTNGGR37.js";
|
|
19
|
+
import "../chunk-FZ3ZFVAC.js";
|
|
20
|
+
import "../chunk-X6SZGQTK.js";
|
|
21
|
+
import {
|
|
22
|
+
ModelPicker
|
|
23
|
+
} from "../chunk-52SDU43B.js";
|
|
24
|
+
import "../chunk-ZAMHLXNS.js";
|
|
25
|
+
import "../chunk-GEYACSFW.js";
|
|
26
|
+
import "../chunk-2VJLLRVV.js";
|
|
27
|
+
import "../chunk-JBXNU5WD.js";
|
|
28
|
+
import "../chunk-RASGKEAL.js";
|
|
26
29
|
import {
|
|
27
30
|
AsyncView
|
|
28
31
|
} from "../chunk-AVP5SNIG.js";
|
|
29
|
-
import "../chunk-RASGKEAL.js";
|
|
30
32
|
import "../chunk-FQYAJYPW.js";
|
|
31
33
|
import "../chunk-IUVDR3KJ.js";
|
|
32
34
|
import "../chunk-B7CL7ENS.js";
|
|
@@ -36,7 +38,7 @@ import "../chunk-ZVEEWGDK.js";
|
|
|
36
38
|
import "../chunk-G7M2C72Q.js";
|
|
37
39
|
import "../chunk-VUBJZEZB.js";
|
|
38
40
|
import "../chunk-6VQCFJWP.js";
|
|
39
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-ELX5YITO.js";
|
|
40
42
|
import "../chunk-PV33JZKV.js";
|
|
41
43
|
import "../chunk-TXD5HXLE.js";
|
|
42
44
|
import "../chunk-WL7PZK7Q.js";
|
|
@@ -1209,69 +1211,36 @@ function useAssistantChat(userId, options) {
|
|
|
1209
1211
|
abortRef.current = null;
|
|
1210
1212
|
}, []);
|
|
1211
1213
|
const startChatStream = useCallback(
|
|
1212
|
-
(text, deliveryMode, model, threadId) =>
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
const seq = ++streamSeqRef.current;
|
|
1220
|
-
const ac = new AbortController();
|
|
1221
|
-
abortRef.current = ac;
|
|
1222
|
-
sendingRef.current = true;
|
|
1223
|
-
clientRef.current.streamChat(
|
|
1224
|
-
{
|
|
1225
|
-
message: text,
|
|
1226
|
-
deliveryMode,
|
|
1227
|
-
// null → omit, so the server applies its default model.
|
|
1228
|
-
model,
|
|
1229
|
-
threadId,
|
|
1230
|
-
turnKey: uuid(),
|
|
1231
|
-
...contextRef.current ? { context: contextRef.current } : {}
|
|
1232
|
-
},
|
|
1233
|
-
(event) => {
|
|
1234
|
-
if (streamSeqRef.current === seq) dispatch({ type: "stream", event });
|
|
1235
|
-
},
|
|
1236
|
-
ac.signal
|
|
1237
|
-
).catch((err) => {
|
|
1238
|
-
if (ac.signal.aborted || streamSeqRef.current !== seq) return;
|
|
1239
|
-
dispatch({
|
|
1240
|
-
type: "stream_failed",
|
|
1241
|
-
error: {
|
|
1242
|
-
code: err instanceof AssistantClientInputError ? err.code : "NETWORK",
|
|
1243
|
-
message: err instanceof Error ? err.message : "The connection failed"
|
|
1244
|
-
}
|
|
1245
|
-
});
|
|
1246
|
-
}).finally(() => {
|
|
1247
|
-
if (streamSeqRef.current === seq) sendingRef.current = false;
|
|
1248
|
-
if (abortRef.current === ac) abortRef.current = null;
|
|
1249
|
-
});
|
|
1250
|
-
},
|
|
1214
|
+
(text, deliveryMode, model, threadId) => startAssistantChatStream(
|
|
1215
|
+
text,
|
|
1216
|
+
deliveryMode,
|
|
1217
|
+
model,
|
|
1218
|
+
threadId,
|
|
1219
|
+
{ dispatch, streamSeqRef, abortRef, sendingRef, clientRef, contextRef }
|
|
1220
|
+
),
|
|
1251
1221
|
[]
|
|
1252
1222
|
);
|
|
1253
|
-
useEffect(() => {
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}, [userId, abortActiveStream, clearPendingQueuedSend, setRestoringBoth]);
|
|
1223
|
+
useEffect(() => hydrateAssistantChatOwner({
|
|
1224
|
+
hydratedUserRef,
|
|
1225
|
+
userId,
|
|
1226
|
+
streamSeqRef,
|
|
1227
|
+
confirmSeqRef,
|
|
1228
|
+
abortActiveStream,
|
|
1229
|
+
clearPendingQueuedSend,
|
|
1230
|
+
historyAbortRef,
|
|
1231
|
+
setRestoringBoth,
|
|
1232
|
+
sendingRef,
|
|
1233
|
+
confirmingRef,
|
|
1234
|
+
setConfirmingIds,
|
|
1235
|
+
selectedModelRef,
|
|
1236
|
+
setSelectedModel,
|
|
1237
|
+
dispatch
|
|
1238
|
+
}), [
|
|
1239
|
+
userId,
|
|
1240
|
+
abortActiveStream,
|
|
1241
|
+
clearPendingQueuedSend,
|
|
1242
|
+
setRestoringBoth
|
|
1243
|
+
]);
|
|
1275
1244
|
useEffect(() => {
|
|
1276
1245
|
const pending = pendingQueuedSendRef.current;
|
|
1277
1246
|
if (!pending || state.status === "streaming") return;
|
|
@@ -1292,67 +1261,25 @@ function useAssistantChat(userId, options) {
|
|
|
1292
1261
|
const ac = new AbortController();
|
|
1293
1262
|
historyAbortRef.current?.abort();
|
|
1294
1263
|
historyAbortRef.current = ac;
|
|
1295
|
-
|
|
1296
|
-
if (ac.signal.aborted) return;
|
|
1297
|
-
if (result.status === "ok") {
|
|
1298
|
-
if (result.messages.length > 0 || result.proposals.length > 0) {
|
|
1299
|
-
dispatch({
|
|
1300
|
-
type: "restore_history",
|
|
1301
|
-
ownerId: userId,
|
|
1302
|
-
threadId,
|
|
1303
|
-
messages: result.messages,
|
|
1304
|
-
proposals: result.proposals
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
} else if (result.status === "gone") {
|
|
1308
|
-
dispatch({ type: "thread_gone", ownerId: userId, threadId });
|
|
1309
|
-
}
|
|
1310
|
-
}).catch(() => {
|
|
1311
|
-
});
|
|
1264
|
+
restoreAssistantThreadHistory(clientRef.current, userId, threadId, ac, dispatch);
|
|
1312
1265
|
return () => ac.abort();
|
|
1313
1266
|
}, [userId]);
|
|
1314
|
-
useEffect(() => {
|
|
1315
|
-
if (state.status === "streaming") return;
|
|
1316
|
-
if (state.ownerId !== userIdRef.current) return;
|
|
1317
|
-
saveThread(state.ownerId, {
|
|
1318
|
-
threadId: state.threadId,
|
|
1319
|
-
model: selectedModelRef.current
|
|
1320
|
-
});
|
|
1321
|
-
}, [state.ownerId, state.threadId, state.status]);
|
|
1267
|
+
useEffect(() => persistAssistantChatSelection({ state, userIdRef, selectedModelRef }), [state.ownerId, state.threadId, state.status]);
|
|
1322
1268
|
useEffect(() => {
|
|
1323
1269
|
return () => {
|
|
1324
1270
|
abortActiveStream();
|
|
1325
1271
|
clearPendingQueuedSend();
|
|
1326
1272
|
};
|
|
1327
1273
|
}, [abortActiveStream, clearPendingQueuedSend]);
|
|
1328
|
-
const send = useCallback((message, options2) => {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
if (restoringRef.current) return;
|
|
1338
|
-
if (!text) return;
|
|
1339
|
-
if (current.pendingProposals.length > 0) return;
|
|
1340
|
-
if (current.status === "streaming") {
|
|
1341
|
-
if (!shouldQueue) return;
|
|
1342
|
-
pendingQueuedSendRef.current = {
|
|
1343
|
-
ownerId: current.ownerId,
|
|
1344
|
-
text,
|
|
1345
|
-
model: selectedModelRef.current ?? void 0
|
|
1346
|
-
};
|
|
1347
|
-
return;
|
|
1348
|
-
}
|
|
1349
|
-
startChatStream(
|
|
1350
|
-
text,
|
|
1351
|
-
deliveryMode,
|
|
1352
|
-
selectedModelRef.current ?? void 0,
|
|
1353
|
-
current.threadId ?? void 0
|
|
1354
|
-
);
|
|
1355
|
-
}, [startChatStream]);
|
|
1274
|
+
const send = useCallback((message, options2) => sendAssistantChatMessage(message, options2, {
|
|
1275
|
+
sendingRef,
|
|
1276
|
+
pendingQueuedSendRef,
|
|
1277
|
+
stateRef,
|
|
1278
|
+
userIdRef,
|
|
1279
|
+
restoringRef,
|
|
1280
|
+
selectedModelRef,
|
|
1281
|
+
startChatStream
|
|
1282
|
+
}), [startChatStream]);
|
|
1356
1283
|
const stop = useCallback(() => {
|
|
1357
1284
|
streamSeqRef.current += 1;
|
|
1358
1285
|
abortActiveStream();
|
|
@@ -1360,184 +1287,51 @@ function useAssistantChat(userId, options) {
|
|
|
1360
1287
|
sendingRef.current = false;
|
|
1361
1288
|
dispatch({ type: "stopped" });
|
|
1362
1289
|
}, [abortActiveStream, clearPendingQueuedSend]);
|
|
1363
|
-
const confirm = useCallback(
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
callId: proposal.callId,
|
|
1369
|
-
status: null,
|
|
1370
|
-
error: {
|
|
1371
|
-
code: "TOOL_FAILED",
|
|
1372
|
-
message: "This action can no longer be confirmed."
|
|
1373
|
-
}
|
|
1374
|
-
});
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
if (confirmingRef.current.has(pid)) return;
|
|
1378
|
-
confirmingRef.current.add(pid);
|
|
1379
|
-
setConfirmingIds(new Set(confirmingRef.current));
|
|
1380
|
-
const seq = confirmSeqRef.current;
|
|
1381
|
-
try {
|
|
1382
|
-
const result = await clientRef.current.confirmProposal(pid);
|
|
1383
|
-
if (confirmSeqRef.current !== seq) return;
|
|
1384
|
-
if (result.ok && result.retryable) {
|
|
1385
|
-
const { error: error2 } = resolveConfirmation(proposal.name, result);
|
|
1386
|
-
dispatch({
|
|
1387
|
-
type: "proposal_retry_failed",
|
|
1388
|
-
callId: proposal.callId,
|
|
1389
|
-
message: error2?.message ?? "Connect the required integration, then confirm again."
|
|
1390
|
-
});
|
|
1391
|
-
return;
|
|
1392
|
-
}
|
|
1393
|
-
const { statusText, error } = resolveConfirmation(proposal.name, result);
|
|
1394
|
-
const status = statusText ? statusMessage(statusText) : null;
|
|
1395
|
-
if (status && result.ok && !error) {
|
|
1396
|
-
const confirmed = {
|
|
1397
|
-
name: proposal.name,
|
|
1398
|
-
output: result.output,
|
|
1399
|
-
args: proposal.args
|
|
1400
|
-
};
|
|
1401
|
-
status.result = confirmed;
|
|
1402
|
-
}
|
|
1403
|
-
dispatch({
|
|
1404
|
-
type: "proposal_resolved",
|
|
1405
|
-
callId: proposal.callId,
|
|
1406
|
-
status,
|
|
1407
|
-
error
|
|
1408
|
-
});
|
|
1409
|
-
if (!error && WORKFLOW_MUTATING_TOOLS.has(proposal.name)) {
|
|
1410
|
-
onWorkflowMutationRef.current?.();
|
|
1411
|
-
}
|
|
1412
|
-
} catch (err) {
|
|
1413
|
-
if (confirmSeqRef.current !== seq) return;
|
|
1414
|
-
dispatch({
|
|
1415
|
-
type: "proposal_resolved",
|
|
1416
|
-
callId: proposal.callId,
|
|
1417
|
-
status: null,
|
|
1418
|
-
error: {
|
|
1419
|
-
code: "TOOL_FAILED",
|
|
1420
|
-
message: err instanceof Error ? err.message : "The action could not be completed"
|
|
1421
|
-
}
|
|
1422
|
-
});
|
|
1423
|
-
} finally {
|
|
1424
|
-
if (confirmSeqRef.current === seq) {
|
|
1425
|
-
confirmingRef.current.delete(pid);
|
|
1426
|
-
setConfirmingIds(new Set(confirmingRef.current));
|
|
1427
|
-
}
|
|
1428
|
-
}
|
|
1429
|
-
}, []);
|
|
1430
|
-
const cancel = useCallback((proposal) => {
|
|
1431
|
-
if (proposal.proposalId && confirmingRef.current.has(proposal.proposalId)) {
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
dispatch({
|
|
1435
|
-
type: "proposal_resolved",
|
|
1436
|
-
callId: proposal.callId,
|
|
1437
|
-
status: statusMessage("Action cancelled."),
|
|
1438
|
-
error: null
|
|
1439
|
-
});
|
|
1440
|
-
}, []);
|
|
1290
|
+
const confirm = useCallback((proposal) => confirmAssistantChatProposal(
|
|
1291
|
+
proposal,
|
|
1292
|
+
{ dispatch, confirmingRef, setConfirmingIds, confirmSeqRef, clientRef, onWorkflowMutationRef }
|
|
1293
|
+
), []);
|
|
1294
|
+
const cancel = useCallback((proposal) => cancelAssistantChatProposal(proposal, { confirmingRef, dispatch }), []);
|
|
1441
1295
|
const connectRequirement = useCallback(
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
try {
|
|
1448
|
-
result = await handler(requirement);
|
|
1449
|
-
} catch {
|
|
1450
|
-
return;
|
|
1451
|
-
}
|
|
1452
|
-
if (confirmSeqRef.current !== seq) return;
|
|
1453
|
-
if (result?.connected) {
|
|
1454
|
-
dispatch({
|
|
1455
|
-
type: "requirement_connected",
|
|
1456
|
-
callId: proposal.callId,
|
|
1457
|
-
provider: requirement.provider,
|
|
1458
|
-
kind: requirement.kind
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
},
|
|
1296
|
+
(proposal, requirement) => connectAssistantChatRequirement(
|
|
1297
|
+
proposal,
|
|
1298
|
+
requirement,
|
|
1299
|
+
{ onConnectRequirementRef, confirmSeqRef, dispatch }
|
|
1300
|
+
),
|
|
1462
1301
|
[]
|
|
1463
1302
|
);
|
|
1464
|
-
const reset = useCallback(() => {
|
|
1465
|
-
streamSeqRef
|
|
1466
|
-
confirmSeqRef
|
|
1467
|
-
abortActiveStream
|
|
1468
|
-
clearPendingQueuedSend
|
|
1469
|
-
historyAbortRef
|
|
1470
|
-
setRestoringBoth
|
|
1471
|
-
sendingRef
|
|
1472
|
-
confirmingRef
|
|
1473
|
-
setConfirmingIds
|
|
1474
|
-
dispatch
|
|
1475
|
-
}, [abortActiveStream, clearPendingQueuedSend, setRestoringBoth]);
|
|
1303
|
+
const reset = useCallback(() => resetAssistantChat({
|
|
1304
|
+
streamSeqRef,
|
|
1305
|
+
confirmSeqRef,
|
|
1306
|
+
abortActiveStream,
|
|
1307
|
+
clearPendingQueuedSend,
|
|
1308
|
+
historyAbortRef,
|
|
1309
|
+
setRestoringBoth,
|
|
1310
|
+
sendingRef,
|
|
1311
|
+
confirmingRef,
|
|
1312
|
+
setConfirmingIds,
|
|
1313
|
+
dispatch
|
|
1314
|
+
}), [abortActiveStream, clearPendingQueuedSend, setRestoringBoth]);
|
|
1476
1315
|
const switchThread = useCallback(
|
|
1477
|
-
(threadId) => {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
setRestoringBoth(true);
|
|
1494
|
-
saveThread(uid, { threadId, model: selectedModelRef.current });
|
|
1495
|
-
const ac = new AbortController();
|
|
1496
|
-
historyAbortRef.current?.abort();
|
|
1497
|
-
historyAbortRef.current = ac;
|
|
1498
|
-
void clientRef.current.fetchThreadHistory(threadId, ac.signal).then((result) => {
|
|
1499
|
-
if (ac.signal.aborted) return;
|
|
1500
|
-
if (result.status === "ok") {
|
|
1501
|
-
if (result.messages.length > 0 || result.proposals.length > 0) {
|
|
1502
|
-
dispatch({
|
|
1503
|
-
type: "restore_history",
|
|
1504
|
-
ownerId: uid,
|
|
1505
|
-
threadId,
|
|
1506
|
-
messages: result.messages,
|
|
1507
|
-
proposals: result.proposals
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
} else if (result.status === "gone") {
|
|
1511
|
-
dispatch({ type: "thread_gone", ownerId: uid, threadId });
|
|
1512
|
-
} else {
|
|
1513
|
-
dispatch({
|
|
1514
|
-
type: "history_failed",
|
|
1515
|
-
ownerId: uid,
|
|
1516
|
-
threadId,
|
|
1517
|
-
error: {
|
|
1518
|
-
code: "HISTORY_LOAD_FAILED",
|
|
1519
|
-
message: "Couldn't load that conversation. You're in a new chat \u2014 reopen it from history to try again."
|
|
1520
|
-
}
|
|
1521
|
-
});
|
|
1522
|
-
}
|
|
1523
|
-
setRestoringBoth(false);
|
|
1524
|
-
}).catch(() => {
|
|
1525
|
-
if (!ac.signal.aborted) setRestoringBoth(false);
|
|
1526
|
-
});
|
|
1527
|
-
},
|
|
1316
|
+
(threadId) => switchAssistantChatThread(threadId, {
|
|
1317
|
+
stateRef,
|
|
1318
|
+
userIdRef,
|
|
1319
|
+
streamSeqRef,
|
|
1320
|
+
confirmSeqRef,
|
|
1321
|
+
abortActiveStream,
|
|
1322
|
+
clearPendingQueuedSend,
|
|
1323
|
+
sendingRef,
|
|
1324
|
+
confirmingRef,
|
|
1325
|
+
setConfirmingIds,
|
|
1326
|
+
dispatch,
|
|
1327
|
+
setRestoringBoth,
|
|
1328
|
+
selectedModelRef,
|
|
1329
|
+
historyAbortRef,
|
|
1330
|
+
clientRef
|
|
1331
|
+
}),
|
|
1528
1332
|
[abortActiveStream, clearPendingQueuedSend, setRestoringBoth]
|
|
1529
1333
|
);
|
|
1530
|
-
const setModel = useCallback((model) => {
|
|
1531
|
-
selectedModelRef.current = model;
|
|
1532
|
-
setSelectedModel(model);
|
|
1533
|
-
const currentUserId = userIdRef.current;
|
|
1534
|
-
if (stateRef.current.ownerId === currentUserId) {
|
|
1535
|
-
saveThread(currentUserId, {
|
|
1536
|
-
threadId: stateRef.current.threadId,
|
|
1537
|
-
model
|
|
1538
|
-
});
|
|
1539
|
-
}
|
|
1540
|
-
}, []);
|
|
1334
|
+
const setModel = useCallback((model) => selectAssistantChatModel(model, { selectedModelRef, setSelectedModel, userIdRef, stateRef }), []);
|
|
1541
1335
|
useEffect(() => {
|
|
1542
1336
|
if (state.error?.code === "MODEL_NOT_ALLOWED" && state.ownerId === userIdRef.current && selectedModelRef.current !== null) {
|
|
1543
1337
|
setModel(null);
|
|
@@ -1560,6 +1354,350 @@ function useAssistantChat(userId, options) {
|
|
|
1560
1354
|
restoring
|
|
1561
1355
|
};
|
|
1562
1356
|
}
|
|
1357
|
+
function startAssistantChatStream(text, deliveryMode, model, threadId, {
|
|
1358
|
+
dispatch,
|
|
1359
|
+
streamSeqRef,
|
|
1360
|
+
abortRef,
|
|
1361
|
+
sendingRef,
|
|
1362
|
+
clientRef,
|
|
1363
|
+
contextRef
|
|
1364
|
+
}) {
|
|
1365
|
+
dispatch({
|
|
1366
|
+
type: "send",
|
|
1367
|
+
messageId: uuid(),
|
|
1368
|
+
assistantId: uuid(),
|
|
1369
|
+
text
|
|
1370
|
+
});
|
|
1371
|
+
const seq = ++streamSeqRef.current;
|
|
1372
|
+
const ac = new AbortController();
|
|
1373
|
+
abortRef.current = ac;
|
|
1374
|
+
sendingRef.current = true;
|
|
1375
|
+
clientRef.current.streamChat(
|
|
1376
|
+
{
|
|
1377
|
+
message: text,
|
|
1378
|
+
deliveryMode,
|
|
1379
|
+
// null → omit, so the server applies its default model.
|
|
1380
|
+
model,
|
|
1381
|
+
threadId,
|
|
1382
|
+
turnKey: uuid(),
|
|
1383
|
+
...contextRef.current ? { context: contextRef.current } : {}
|
|
1384
|
+
},
|
|
1385
|
+
(event) => {
|
|
1386
|
+
if (streamSeqRef.current === seq) dispatch({ type: "stream", event });
|
|
1387
|
+
},
|
|
1388
|
+
ac.signal
|
|
1389
|
+
).catch((err) => {
|
|
1390
|
+
if (ac.signal.aborted || streamSeqRef.current !== seq) return;
|
|
1391
|
+
dispatch({
|
|
1392
|
+
type: "stream_failed",
|
|
1393
|
+
error: {
|
|
1394
|
+
code: err instanceof AssistantClientInputError ? err.code : "NETWORK",
|
|
1395
|
+
message: err instanceof Error ? err.message : "The connection failed"
|
|
1396
|
+
}
|
|
1397
|
+
});
|
|
1398
|
+
}).finally(() => {
|
|
1399
|
+
if (streamSeqRef.current === seq) sendingRef.current = false;
|
|
1400
|
+
if (abortRef.current === ac) abortRef.current = null;
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
async function confirmAssistantChatProposal(proposal, {
|
|
1404
|
+
dispatch,
|
|
1405
|
+
confirmingRef,
|
|
1406
|
+
setConfirmingIds,
|
|
1407
|
+
confirmSeqRef,
|
|
1408
|
+
clientRef,
|
|
1409
|
+
onWorkflowMutationRef
|
|
1410
|
+
}) {
|
|
1411
|
+
const pid = proposal.proposalId;
|
|
1412
|
+
if (!pid) {
|
|
1413
|
+
dispatch({
|
|
1414
|
+
type: "proposal_resolved",
|
|
1415
|
+
callId: proposal.callId,
|
|
1416
|
+
status: null,
|
|
1417
|
+
error: {
|
|
1418
|
+
code: "TOOL_FAILED",
|
|
1419
|
+
message: "This action can no longer be confirmed."
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
return;
|
|
1423
|
+
}
|
|
1424
|
+
if (confirmingRef.current.has(pid)) return;
|
|
1425
|
+
confirmingRef.current.add(pid);
|
|
1426
|
+
setConfirmingIds(new Set(confirmingRef.current));
|
|
1427
|
+
const seq = confirmSeqRef.current;
|
|
1428
|
+
try {
|
|
1429
|
+
const result = await clientRef.current.confirmProposal(pid);
|
|
1430
|
+
if (confirmSeqRef.current !== seq) return;
|
|
1431
|
+
if (result.ok && result.retryable) {
|
|
1432
|
+
const { error: error2 } = resolveConfirmation(proposal.name, result);
|
|
1433
|
+
dispatch({
|
|
1434
|
+
type: "proposal_retry_failed",
|
|
1435
|
+
callId: proposal.callId,
|
|
1436
|
+
message: error2?.message ?? "Connect the required integration, then confirm again."
|
|
1437
|
+
});
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
const { statusText, error } = resolveConfirmation(proposal.name, result);
|
|
1441
|
+
const status = statusText ? statusMessage(statusText) : null;
|
|
1442
|
+
if (status && result.ok && !error) {
|
|
1443
|
+
const confirmed = {
|
|
1444
|
+
name: proposal.name,
|
|
1445
|
+
output: result.output,
|
|
1446
|
+
args: proposal.args
|
|
1447
|
+
};
|
|
1448
|
+
status.result = confirmed;
|
|
1449
|
+
}
|
|
1450
|
+
dispatch({
|
|
1451
|
+
type: "proposal_resolved",
|
|
1452
|
+
callId: proposal.callId,
|
|
1453
|
+
status,
|
|
1454
|
+
error
|
|
1455
|
+
});
|
|
1456
|
+
if (!error && WORKFLOW_MUTATING_TOOLS.has(proposal.name)) {
|
|
1457
|
+
onWorkflowMutationRef.current?.();
|
|
1458
|
+
}
|
|
1459
|
+
} catch (err) {
|
|
1460
|
+
if (confirmSeqRef.current !== seq) return;
|
|
1461
|
+
dispatch({
|
|
1462
|
+
type: "proposal_resolved",
|
|
1463
|
+
callId: proposal.callId,
|
|
1464
|
+
status: null,
|
|
1465
|
+
error: {
|
|
1466
|
+
code: "TOOL_FAILED",
|
|
1467
|
+
message: err instanceof Error ? err.message : "The action could not be completed"
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
} finally {
|
|
1471
|
+
if (confirmSeqRef.current === seq) {
|
|
1472
|
+
confirmingRef.current.delete(pid);
|
|
1473
|
+
setConfirmingIds(new Set(confirmingRef.current));
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
async function connectAssistantChatRequirement(proposal, requirement, {
|
|
1478
|
+
onConnectRequirementRef,
|
|
1479
|
+
confirmSeqRef,
|
|
1480
|
+
dispatch
|
|
1481
|
+
}) {
|
|
1482
|
+
const handler = onConnectRequirementRef.current;
|
|
1483
|
+
if (!handler) return;
|
|
1484
|
+
const seq = confirmSeqRef.current;
|
|
1485
|
+
let result;
|
|
1486
|
+
try {
|
|
1487
|
+
result = await handler(requirement);
|
|
1488
|
+
} catch {
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
if (confirmSeqRef.current !== seq) return;
|
|
1492
|
+
if (result?.connected) {
|
|
1493
|
+
dispatch({
|
|
1494
|
+
type: "requirement_connected",
|
|
1495
|
+
callId: proposal.callId,
|
|
1496
|
+
provider: requirement.provider,
|
|
1497
|
+
kind: requirement.kind
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
function switchAssistantChatThread(threadId, {
|
|
1502
|
+
stateRef,
|
|
1503
|
+
userIdRef,
|
|
1504
|
+
streamSeqRef,
|
|
1505
|
+
confirmSeqRef,
|
|
1506
|
+
abortActiveStream,
|
|
1507
|
+
clearPendingQueuedSend,
|
|
1508
|
+
sendingRef,
|
|
1509
|
+
confirmingRef,
|
|
1510
|
+
setConfirmingIds,
|
|
1511
|
+
dispatch,
|
|
1512
|
+
setRestoringBoth,
|
|
1513
|
+
selectedModelRef,
|
|
1514
|
+
historyAbortRef,
|
|
1515
|
+
clientRef
|
|
1516
|
+
}) {
|
|
1517
|
+
const current = stateRef.current;
|
|
1518
|
+
const uid = userIdRef.current;
|
|
1519
|
+
if (current.ownerId !== uid) return;
|
|
1520
|
+
if (threadId === current.threadId) return;
|
|
1521
|
+
if (current.status === "streaming" || current.pendingProposals.length > 0) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
streamSeqRef.current += 1;
|
|
1525
|
+
confirmSeqRef.current += 1;
|
|
1526
|
+
abortActiveStream();
|
|
1527
|
+
clearPendingQueuedSend();
|
|
1528
|
+
sendingRef.current = false;
|
|
1529
|
+
confirmingRef.current.clear();
|
|
1530
|
+
setConfirmingIds(EMPTY_IDS);
|
|
1531
|
+
dispatch({ type: "switch_thread", threadId });
|
|
1532
|
+
setRestoringBoth(true);
|
|
1533
|
+
saveThread(uid, { threadId, model: selectedModelRef.current });
|
|
1534
|
+
const ac = new AbortController();
|
|
1535
|
+
historyAbortRef.current?.abort();
|
|
1536
|
+
historyAbortRef.current = ac;
|
|
1537
|
+
restoreAssistantThreadHistory(clientRef.current, uid, threadId, ac, dispatch, () => {
|
|
1538
|
+
dispatch({
|
|
1539
|
+
type: "history_failed",
|
|
1540
|
+
ownerId: uid,
|
|
1541
|
+
threadId,
|
|
1542
|
+
error: { code: "HISTORY_LOAD_FAILED", message: "Couldn't load that conversation. You're in a new chat \u2014 reopen it from history to try again." }
|
|
1543
|
+
});
|
|
1544
|
+
}, () => setRestoringBoth(false));
|
|
1545
|
+
}
|
|
1546
|
+
function sendAssistantChatMessage(message, options, {
|
|
1547
|
+
sendingRef,
|
|
1548
|
+
pendingQueuedSendRef,
|
|
1549
|
+
stateRef,
|
|
1550
|
+
userIdRef,
|
|
1551
|
+
restoringRef,
|
|
1552
|
+
selectedModelRef,
|
|
1553
|
+
startChatStream
|
|
1554
|
+
}) {
|
|
1555
|
+
const deliveryMode = options?.deliveryMode;
|
|
1556
|
+
const shouldQueue = deliveryMode === "queue";
|
|
1557
|
+
if (sendingRef.current && !shouldQueue) return;
|
|
1558
|
+
if (!shouldQueue && pendingQueuedSendRef.current) return;
|
|
1559
|
+
if (shouldQueue && pendingQueuedSendRef.current) return;
|
|
1560
|
+
const text = message.trim();
|
|
1561
|
+
const current = stateRef.current;
|
|
1562
|
+
if (current.ownerId !== userIdRef.current) return;
|
|
1563
|
+
if (restoringRef.current) return;
|
|
1564
|
+
if (!text) return;
|
|
1565
|
+
if (current.pendingProposals.length > 0) return;
|
|
1566
|
+
if (current.status === "streaming") {
|
|
1567
|
+
if (!shouldQueue) return;
|
|
1568
|
+
pendingQueuedSendRef.current = {
|
|
1569
|
+
ownerId: current.ownerId,
|
|
1570
|
+
text,
|
|
1571
|
+
model: selectedModelRef.current ?? void 0
|
|
1572
|
+
};
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
startChatStream(
|
|
1576
|
+
text,
|
|
1577
|
+
deliveryMode,
|
|
1578
|
+
selectedModelRef.current ?? void 0,
|
|
1579
|
+
current.threadId ?? void 0
|
|
1580
|
+
);
|
|
1581
|
+
}
|
|
1582
|
+
function restoreAssistantThreadHistory(client, ownerId, threadId, ac, dispatch, onLoadError, onSettled) {
|
|
1583
|
+
void client.fetchThreadHistory(threadId, ac.signal).then((result) => {
|
|
1584
|
+
if (ac.signal.aborted) return;
|
|
1585
|
+
if (result.status === "ok") {
|
|
1586
|
+
if (result.messages.length > 0 || result.proposals.length > 0) {
|
|
1587
|
+
dispatch({ type: "restore_history", ownerId, threadId, messages: result.messages, proposals: result.proposals });
|
|
1588
|
+
}
|
|
1589
|
+
} else if (result.status === "gone") {
|
|
1590
|
+
dispatch({ type: "thread_gone", ownerId, threadId });
|
|
1591
|
+
} else {
|
|
1592
|
+
onLoadError?.();
|
|
1593
|
+
}
|
|
1594
|
+
onSettled?.();
|
|
1595
|
+
}).catch(() => {
|
|
1596
|
+
if (!ac.signal.aborted) onSettled?.();
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function resetAssistantChat({
|
|
1600
|
+
streamSeqRef,
|
|
1601
|
+
confirmSeqRef,
|
|
1602
|
+
abortActiveStream,
|
|
1603
|
+
clearPendingQueuedSend,
|
|
1604
|
+
historyAbortRef,
|
|
1605
|
+
setRestoringBoth,
|
|
1606
|
+
sendingRef,
|
|
1607
|
+
confirmingRef,
|
|
1608
|
+
setConfirmingIds,
|
|
1609
|
+
dispatch
|
|
1610
|
+
}) {
|
|
1611
|
+
streamSeqRef.current += 1;
|
|
1612
|
+
confirmSeqRef.current += 1;
|
|
1613
|
+
abortActiveStream();
|
|
1614
|
+
clearPendingQueuedSend();
|
|
1615
|
+
historyAbortRef.current?.abort();
|
|
1616
|
+
setRestoringBoth(false);
|
|
1617
|
+
sendingRef.current = false;
|
|
1618
|
+
confirmingRef.current.clear();
|
|
1619
|
+
setConfirmingIds(EMPTY_IDS);
|
|
1620
|
+
dispatch({ type: "reset" });
|
|
1621
|
+
}
|
|
1622
|
+
function selectAssistantChatModel(model, {
|
|
1623
|
+
selectedModelRef,
|
|
1624
|
+
setSelectedModel,
|
|
1625
|
+
userIdRef,
|
|
1626
|
+
stateRef
|
|
1627
|
+
}) {
|
|
1628
|
+
selectedModelRef.current = model;
|
|
1629
|
+
setSelectedModel(model);
|
|
1630
|
+
const currentUserId = userIdRef.current;
|
|
1631
|
+
if (stateRef.current.ownerId === currentUserId) {
|
|
1632
|
+
saveThread(currentUserId, {
|
|
1633
|
+
threadId: stateRef.current.threadId,
|
|
1634
|
+
model
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
function hydrateAssistantChatOwner({
|
|
1639
|
+
hydratedUserRef,
|
|
1640
|
+
userId,
|
|
1641
|
+
streamSeqRef,
|
|
1642
|
+
confirmSeqRef,
|
|
1643
|
+
abortActiveStream,
|
|
1644
|
+
clearPendingQueuedSend,
|
|
1645
|
+
historyAbortRef,
|
|
1646
|
+
setRestoringBoth,
|
|
1647
|
+
sendingRef,
|
|
1648
|
+
confirmingRef,
|
|
1649
|
+
setConfirmingIds,
|
|
1650
|
+
selectedModelRef,
|
|
1651
|
+
setSelectedModel,
|
|
1652
|
+
dispatch
|
|
1653
|
+
}) {
|
|
1654
|
+
if (hydratedUserRef.current === userId) return;
|
|
1655
|
+
streamSeqRef.current += 1;
|
|
1656
|
+
confirmSeqRef.current += 1;
|
|
1657
|
+
abortActiveStream();
|
|
1658
|
+
clearPendingQueuedSend();
|
|
1659
|
+
historyAbortRef.current?.abort();
|
|
1660
|
+
setRestoringBoth(false);
|
|
1661
|
+
sendingRef.current = false;
|
|
1662
|
+
confirmingRef.current.clear();
|
|
1663
|
+
setConfirmingIds(EMPTY_IDS);
|
|
1664
|
+
hydratedUserRef.current = userId;
|
|
1665
|
+
const nextModel = loadThread(userId).model;
|
|
1666
|
+
selectedModelRef.current = nextModel;
|
|
1667
|
+
setSelectedModel(nextModel);
|
|
1668
|
+
dispatch({
|
|
1669
|
+
type: "hydrate",
|
|
1670
|
+
ownerId: userId,
|
|
1671
|
+
threadId: loadThread(userId).threadId,
|
|
1672
|
+
messages: []
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
function persistAssistantChatSelection({
|
|
1676
|
+
state,
|
|
1677
|
+
userIdRef,
|
|
1678
|
+
selectedModelRef
|
|
1679
|
+
}) {
|
|
1680
|
+
if (state.status === "streaming") return;
|
|
1681
|
+
if (state.ownerId !== userIdRef.current) return;
|
|
1682
|
+
saveThread(state.ownerId, {
|
|
1683
|
+
threadId: state.threadId,
|
|
1684
|
+
model: selectedModelRef.current
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
function cancelAssistantChatProposal(proposal, {
|
|
1688
|
+
confirmingRef,
|
|
1689
|
+
dispatch
|
|
1690
|
+
}) {
|
|
1691
|
+
if (proposal.proposalId && confirmingRef.current.has(proposal.proposalId)) {
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
dispatch({
|
|
1695
|
+
type: "proposal_resolved",
|
|
1696
|
+
callId: proposal.callId,
|
|
1697
|
+
status: statusMessage("Action cancelled."),
|
|
1698
|
+
error: null
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1563
1701
|
|
|
1564
1702
|
// src/assistant/useAssistantModels.ts
|
|
1565
1703
|
import { useEffect as useEffect2, useReducer as useReducer2 } from "react";
|
|
@@ -2100,24 +2238,7 @@ function AssistantLauncherProvider({
|
|
|
2100
2238
|
setOpen(true);
|
|
2101
2239
|
}
|
|
2102
2240
|
}, [userId, storedOpen, docked]);
|
|
2103
|
-
const
|
|
2104
|
-
(next) => {
|
|
2105
|
-
if (next != null) setSeed(next);
|
|
2106
|
-
setOpenedOnLoad(false);
|
|
2107
|
-
setOpen(true);
|
|
2108
|
-
persistOpen(true);
|
|
2109
|
-
},
|
|
2110
|
-
[persistOpen]
|
|
2111
|
-
);
|
|
2112
|
-
const closeAssistant = useCallback4(() => {
|
|
2113
|
-
setOpen(false);
|
|
2114
|
-
persistOpen(false);
|
|
2115
|
-
}, [persistOpen]);
|
|
2116
|
-
const toggleAssistant = useCallback4(() => {
|
|
2117
|
-
setOpenedOnLoad(false);
|
|
2118
|
-
setOpen(!open);
|
|
2119
|
-
persistOpen(!open);
|
|
2120
|
-
}, [open, persistOpen]);
|
|
2241
|
+
const actions = useAssistantVisibilityActions({ setSeed, setOpenedOnLoad, setOpen, persistOpen, open });
|
|
2121
2242
|
const clearSeed = useCallback4(() => setSeed(null), []);
|
|
2122
2243
|
const setPageLabel = useCallback4(
|
|
2123
2244
|
(update) => setPageLabelState(update),
|
|
@@ -2133,9 +2254,7 @@ function AssistantLauncherProvider({
|
|
|
2133
2254
|
() => ({
|
|
2134
2255
|
open,
|
|
2135
2256
|
seed,
|
|
2136
|
-
|
|
2137
|
-
closeAssistant,
|
|
2138
|
-
toggleAssistant,
|
|
2257
|
+
...actions,
|
|
2139
2258
|
clearSeed,
|
|
2140
2259
|
layout,
|
|
2141
2260
|
openedOnLoad,
|
|
@@ -2147,9 +2266,7 @@ function AssistantLauncherProvider({
|
|
|
2147
2266
|
[
|
|
2148
2267
|
open,
|
|
2149
2268
|
seed,
|
|
2150
|
-
|
|
2151
|
-
closeAssistant,
|
|
2152
|
-
toggleAssistant,
|
|
2269
|
+
actions,
|
|
2153
2270
|
clearSeed,
|
|
2154
2271
|
layout,
|
|
2155
2272
|
openedOnLoad,
|
|
@@ -2182,6 +2299,27 @@ function useAssistantPageLabel(label) {
|
|
|
2182
2299
|
return () => setPageLabel((current) => current === trimmed ? null : current);
|
|
2183
2300
|
}, [setPageLabel, trimmed]);
|
|
2184
2301
|
}
|
|
2302
|
+
function useAssistantVisibilityActions({ setSeed, setOpenedOnLoad, setOpen, persistOpen, open }) {
|
|
2303
|
+
const openAssistant = useCallback4(
|
|
2304
|
+
(next) => {
|
|
2305
|
+
if (next != null) setSeed(next);
|
|
2306
|
+
setOpenedOnLoad(false);
|
|
2307
|
+
setOpen(true);
|
|
2308
|
+
persistOpen(true);
|
|
2309
|
+
},
|
|
2310
|
+
[persistOpen]
|
|
2311
|
+
);
|
|
2312
|
+
const closeAssistant = useCallback4(() => {
|
|
2313
|
+
setOpen(false);
|
|
2314
|
+
persistOpen(false);
|
|
2315
|
+
}, [persistOpen]);
|
|
2316
|
+
const toggleAssistant = useCallback4(() => {
|
|
2317
|
+
setOpenedOnLoad(false);
|
|
2318
|
+
setOpen(!open);
|
|
2319
|
+
persistOpen(!open);
|
|
2320
|
+
}, [open, persistOpen]);
|
|
2321
|
+
return useMemo2(() => ({ openAssistant, closeAssistant, toggleAssistant }), [openAssistant, closeAssistant, toggleAssistant]);
|
|
2322
|
+
}
|
|
2185
2323
|
|
|
2186
2324
|
// src/assistant/panel-toggle.tsx
|
|
2187
2325
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -2765,7 +2903,7 @@ function nextModelSelection(id, defaultSlug) {
|
|
|
2765
2903
|
if (defaultSlug != null && id === defaultSlug) return null;
|
|
2766
2904
|
return id || null;
|
|
2767
2905
|
}
|
|
2768
|
-
function
|
|
2906
|
+
function useAssistantPanelViewState({
|
|
2769
2907
|
chat,
|
|
2770
2908
|
userId,
|
|
2771
2909
|
onClose,
|
|
@@ -2893,72 +3031,98 @@ function AssistantPanel({
|
|
|
2893
3031
|
chatRef.current.reset();
|
|
2894
3032
|
}
|
|
2895
3033
|
};
|
|
3034
|
+
return {
|
|
3035
|
+
layout,
|
|
3036
|
+
onClose,
|
|
3037
|
+
toggleRef,
|
|
3038
|
+
effectiveBalance,
|
|
3039
|
+
formatMoney,
|
|
3040
|
+
context,
|
|
3041
|
+
chat,
|
|
3042
|
+
setView,
|
|
3043
|
+
historyButtonRef,
|
|
3044
|
+
toggleHistory,
|
|
3045
|
+
view,
|
|
3046
|
+
logRef,
|
|
3047
|
+
handleConversationScroll,
|
|
3048
|
+
threads,
|
|
3049
|
+
state,
|
|
3050
|
+
deleteThread,
|
|
3051
|
+
transcriptView,
|
|
3052
|
+
toolRenderers,
|
|
3053
|
+
renderConfirmedResult,
|
|
3054
|
+
setStarterSeed,
|
|
3055
|
+
errorView,
|
|
3056
|
+
navigate,
|
|
3057
|
+
low,
|
|
3058
|
+
showContinue,
|
|
3059
|
+
onComposerSend,
|
|
3060
|
+
streaming,
|
|
3061
|
+
starterSeed,
|
|
3062
|
+
composerSeed,
|
|
3063
|
+
onComposerSeedApplied,
|
|
3064
|
+
composerAttachments,
|
|
3065
|
+
pickerModels,
|
|
3066
|
+
pickerValue,
|
|
3067
|
+
models
|
|
3068
|
+
};
|
|
3069
|
+
}
|
|
3070
|
+
function AssistantPanel(props) {
|
|
3071
|
+
const view = useAssistantPanelViewState(props);
|
|
3072
|
+
return /* @__PURE__ */ jsx7(AssistantPanelView, { ...view });
|
|
3073
|
+
}
|
|
3074
|
+
function AssistantPanelView({
|
|
3075
|
+
layout,
|
|
3076
|
+
onClose,
|
|
3077
|
+
toggleRef,
|
|
3078
|
+
effectiveBalance,
|
|
3079
|
+
formatMoney,
|
|
3080
|
+
context,
|
|
3081
|
+
chat,
|
|
3082
|
+
setView,
|
|
3083
|
+
historyButtonRef,
|
|
3084
|
+
toggleHistory,
|
|
3085
|
+
view,
|
|
3086
|
+
logRef,
|
|
3087
|
+
handleConversationScroll,
|
|
3088
|
+
threads,
|
|
3089
|
+
state,
|
|
3090
|
+
deleteThread,
|
|
3091
|
+
transcriptView,
|
|
3092
|
+
toolRenderers,
|
|
3093
|
+
renderConfirmedResult,
|
|
3094
|
+
setStarterSeed,
|
|
3095
|
+
errorView,
|
|
3096
|
+
navigate,
|
|
3097
|
+
low,
|
|
3098
|
+
showContinue,
|
|
3099
|
+
onComposerSend,
|
|
3100
|
+
streaming,
|
|
3101
|
+
starterSeed,
|
|
3102
|
+
composerSeed,
|
|
3103
|
+
onComposerSeedApplied,
|
|
3104
|
+
composerAttachments,
|
|
3105
|
+
pickerModels,
|
|
3106
|
+
pickerValue,
|
|
3107
|
+
models
|
|
3108
|
+
}) {
|
|
2896
3109
|
return /* @__PURE__ */ jsxs4("div", { className: "relative flex h-full min-h-0 flex-col bg-card", children: [
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
{
|
|
2914
|
-
className: "truncate text-muted-foreground text-xs leading-snug",
|
|
2915
|
-
title: `The assistant sees ${context.path}`,
|
|
2916
|
-
children: [
|
|
2917
|
-
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Looking at " }),
|
|
2918
|
-
context.label
|
|
2919
|
-
]
|
|
2920
|
-
}
|
|
2921
|
-
)
|
|
2922
|
-
] }),
|
|
2923
|
-
/* @__PURE__ */ jsx7(
|
|
2924
|
-
"button",
|
|
2925
|
-
{
|
|
2926
|
-
type: "button",
|
|
2927
|
-
onClick: () => {
|
|
2928
|
-
chat.reset();
|
|
2929
|
-
setView("chat");
|
|
2930
|
-
},
|
|
2931
|
-
"aria-label": "New chat",
|
|
2932
|
-
title: "New chat",
|
|
2933
|
-
className: HEADER_BUTTON,
|
|
2934
|
-
children: /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
2935
|
-
}
|
|
2936
|
-
),
|
|
2937
|
-
/* @__PURE__ */ jsx7(
|
|
2938
|
-
"button",
|
|
2939
|
-
{
|
|
2940
|
-
ref: historyButtonRef,
|
|
2941
|
-
type: "button",
|
|
2942
|
-
onClick: toggleHistory,
|
|
2943
|
-
"aria-label": "Chat history",
|
|
2944
|
-
"aria-pressed": view === "history",
|
|
2945
|
-
title: "Chat history",
|
|
2946
|
-
className: `${HEADER_BUTTON} ${view === "history" ? "bg-[var(--accent-surface-soft)] text-foreground" : ""}`,
|
|
2947
|
-
children: /* @__PURE__ */ jsx7(History, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
2948
|
-
}
|
|
2949
|
-
),
|
|
2950
|
-
layout === "sheet" && /* @__PURE__ */ jsx7(
|
|
2951
|
-
"button",
|
|
2952
|
-
{
|
|
2953
|
-
type: "button",
|
|
2954
|
-
onClick: onClose,
|
|
2955
|
-
"aria-label": "Close assistant",
|
|
2956
|
-
title: "Close assistant",
|
|
2957
|
-
className: HEADER_BUTTON,
|
|
2958
|
-
children: /* @__PURE__ */ jsx7(X, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
2959
|
-
}
|
|
2960
|
-
)
|
|
2961
|
-
] }),
|
|
3110
|
+
/* @__PURE__ */ jsx7(
|
|
3111
|
+
AssistantPanelHeader,
|
|
3112
|
+
{
|
|
3113
|
+
layout,
|
|
3114
|
+
onClose,
|
|
3115
|
+
toggleRef,
|
|
3116
|
+
effectiveBalance,
|
|
3117
|
+
formatMoney,
|
|
3118
|
+
context,
|
|
3119
|
+
chat,
|
|
3120
|
+
setView,
|
|
3121
|
+
historyButtonRef,
|
|
3122
|
+
toggleHistory,
|
|
3123
|
+
view
|
|
3124
|
+
}
|
|
3125
|
+
),
|
|
2962
3126
|
/* @__PURE__ */ jsx7(
|
|
2963
3127
|
"div",
|
|
2964
3128
|
{
|
|
@@ -3067,6 +3231,85 @@ function AssistantPanel({
|
|
|
3067
3231
|
] })
|
|
3068
3232
|
] });
|
|
3069
3233
|
}
|
|
3234
|
+
function AssistantPanelHeader({
|
|
3235
|
+
layout,
|
|
3236
|
+
onClose,
|
|
3237
|
+
toggleRef,
|
|
3238
|
+
effectiveBalance,
|
|
3239
|
+
formatMoney,
|
|
3240
|
+
context,
|
|
3241
|
+
chat,
|
|
3242
|
+
setView,
|
|
3243
|
+
historyButtonRef,
|
|
3244
|
+
toggleHistory,
|
|
3245
|
+
view
|
|
3246
|
+
}) {
|
|
3247
|
+
return /* @__PURE__ */ jsxs4(ShellHeader, { as: "header", className: "gap-2 bg-transparent", children: [
|
|
3248
|
+
layout === "docked" && /* @__PURE__ */ jsx7(AssistantPanelToggle, { open: true, onToggle: onClose, buttonRef: toggleRef }),
|
|
3249
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col justify-center", children: [
|
|
3250
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
3251
|
+
/* @__PURE__ */ jsx7("h2", { className: "truncate font-semibold text-[length:var(--font-size-base)] text-foreground leading-tight", children: "Assistant" }),
|
|
3252
|
+
effectiveBalance != null && /* @__PURE__ */ jsx7(
|
|
3253
|
+
"span",
|
|
3254
|
+
{
|
|
3255
|
+
"aria-label": "Your credit balance",
|
|
3256
|
+
className: "shrink-0 text-muted-foreground text-xs tabular-nums",
|
|
3257
|
+
children: formatMoney(effectiveBalance)
|
|
3258
|
+
}
|
|
3259
|
+
)
|
|
3260
|
+
] }),
|
|
3261
|
+
context && /* @__PURE__ */ jsxs4(
|
|
3262
|
+
"p",
|
|
3263
|
+
{
|
|
3264
|
+
className: "truncate text-muted-foreground text-xs leading-snug",
|
|
3265
|
+
title: `The assistant sees ${context.path}`,
|
|
3266
|
+
children: [
|
|
3267
|
+
/* @__PURE__ */ jsx7("span", { className: "sr-only", children: "Looking at " }),
|
|
3268
|
+
context.label
|
|
3269
|
+
]
|
|
3270
|
+
}
|
|
3271
|
+
)
|
|
3272
|
+
] }),
|
|
3273
|
+
/* @__PURE__ */ jsx7(
|
|
3274
|
+
"button",
|
|
3275
|
+
{
|
|
3276
|
+
type: "button",
|
|
3277
|
+
onClick: () => {
|
|
3278
|
+
chat.reset();
|
|
3279
|
+
setView("chat");
|
|
3280
|
+
},
|
|
3281
|
+
"aria-label": "New chat",
|
|
3282
|
+
title: "New chat",
|
|
3283
|
+
className: HEADER_BUTTON,
|
|
3284
|
+
children: /* @__PURE__ */ jsx7(MessageSquarePlus, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
3285
|
+
}
|
|
3286
|
+
),
|
|
3287
|
+
/* @__PURE__ */ jsx7(
|
|
3288
|
+
"button",
|
|
3289
|
+
{
|
|
3290
|
+
ref: historyButtonRef,
|
|
3291
|
+
type: "button",
|
|
3292
|
+
onClick: toggleHistory,
|
|
3293
|
+
"aria-label": "Chat history",
|
|
3294
|
+
"aria-pressed": view === "history",
|
|
3295
|
+
title: "Chat history",
|
|
3296
|
+
className: `${HEADER_BUTTON} ${view === "history" ? "bg-[var(--accent-surface-soft)] text-foreground" : ""}`,
|
|
3297
|
+
children: /* @__PURE__ */ jsx7(History, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
3298
|
+
}
|
|
3299
|
+
),
|
|
3300
|
+
layout === "sheet" && /* @__PURE__ */ jsx7(
|
|
3301
|
+
"button",
|
|
3302
|
+
{
|
|
3303
|
+
type: "button",
|
|
3304
|
+
onClick: onClose,
|
|
3305
|
+
"aria-label": "Close assistant",
|
|
3306
|
+
title: "Close assistant",
|
|
3307
|
+
className: HEADER_BUTTON,
|
|
3308
|
+
children: /* @__PURE__ */ jsx7(X, { "aria-hidden": "true", className: "h-[18px] w-[18px]" })
|
|
3309
|
+
}
|
|
3310
|
+
)
|
|
3311
|
+
] });
|
|
3312
|
+
}
|
|
3070
3313
|
|
|
3071
3314
|
// src/assistant/ResizeHandle.tsx
|
|
3072
3315
|
import { useRef as useRef8 } from "react";
|