@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
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
joinClasses
|
|
3
3
|
} from "./chunk-L7MB2LLM.js";
|
|
4
|
+
import {
|
|
5
|
+
useWorkspacePrewarmHandle
|
|
6
|
+
} from "./chunk-2HQP2CTA.js";
|
|
7
|
+
import {
|
|
8
|
+
filterCommandPaletteItems
|
|
9
|
+
} from "./chunk-SJWIZT7B.js";
|
|
4
10
|
import {
|
|
5
11
|
AgentSessionControls,
|
|
6
12
|
acceptRejectionReason,
|
|
7
13
|
filterAcceptedFiles,
|
|
8
14
|
isAcceptedFileType,
|
|
9
15
|
renamePastedImages
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
useWorkspacePrewarmHandle
|
|
13
|
-
} from "./chunk-2HQP2CTA.js";
|
|
16
|
+
} from "./chunk-FZ3ZFVAC.js";
|
|
14
17
|
import {
|
|
15
18
|
OVERLAY_SHADOW,
|
|
16
19
|
POPOVER_OPTION_FOCUS,
|
|
17
20
|
PopoverSurface
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import {
|
|
20
|
-
filterCommandPaletteItems
|
|
21
|
-
} from "./chunk-SJWIZT7B.js";
|
|
21
|
+
} from "./chunk-52SDU43B.js";
|
|
22
22
|
import {
|
|
23
23
|
ALLOWED_ATTACHMENT_SNIFFED_MIMES,
|
|
24
24
|
ATTACHMENT_ACCEPT,
|
|
@@ -615,14 +615,14 @@ function MicGlyph({ className }) {
|
|
|
615
615
|
// src/web-react/chat-composer.tsx
|
|
616
616
|
import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
617
617
|
function createLazyMentionEditor() {
|
|
618
|
-
return lazy2(() => import("./mention-editor-
|
|
618
|
+
return lazy2(() => import("./mention-editor-4BKBMWIK.js").then((m) => m.loadMentionEditor()));
|
|
619
619
|
}
|
|
620
620
|
var IS_APPLE_PLATFORM = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/i.test(navigator.platform);
|
|
621
621
|
var DEFAULT_MAX_HEIGHT = 168;
|
|
622
622
|
var LINE_HEIGHT = 24;
|
|
623
623
|
var TEXTAREA_PADDING_Y = 8;
|
|
624
624
|
var DEFAULT_SEND_FAILURE = "Message not sent. Your draft is still here \u2014 try again.";
|
|
625
|
-
function
|
|
625
|
+
function useChatComposerViewState({
|
|
626
626
|
onSend,
|
|
627
627
|
onSendParts,
|
|
628
628
|
onSendFailed,
|
|
@@ -795,6 +795,157 @@ function ChatComposer({
|
|
|
795
795
|
className: "w-full resize-none bg-transparent px-1.5 py-1 text-base leading-6 text-foreground placeholder:text-muted-foreground disabled:opacity-50"
|
|
796
796
|
}
|
|
797
797
|
);
|
|
798
|
+
return {
|
|
799
|
+
className,
|
|
800
|
+
focusWithin,
|
|
801
|
+
onAttach,
|
|
802
|
+
handleDragEnter,
|
|
803
|
+
handleDragLeave,
|
|
804
|
+
handleDragOver,
|
|
805
|
+
handleDrop,
|
|
806
|
+
dragOver,
|
|
807
|
+
dropTitle,
|
|
808
|
+
dropDescription,
|
|
809
|
+
showAbove,
|
|
810
|
+
controls,
|
|
811
|
+
dictateError,
|
|
812
|
+
setDictateError,
|
|
813
|
+
failedSend,
|
|
814
|
+
setFailedSend,
|
|
815
|
+
retryFailedSend,
|
|
816
|
+
sendBlockedByStream,
|
|
817
|
+
disabled,
|
|
818
|
+
selectedSkillId,
|
|
819
|
+
eligibleSkills,
|
|
820
|
+
onSelectedSkillChange,
|
|
821
|
+
contextItems,
|
|
822
|
+
pendingFiles,
|
|
823
|
+
folderChips,
|
|
824
|
+
fileChips,
|
|
825
|
+
onRetryFile,
|
|
826
|
+
onRemoveFile,
|
|
827
|
+
cardRef,
|
|
828
|
+
floating,
|
|
829
|
+
mention,
|
|
830
|
+
textareaInput,
|
|
831
|
+
MentionEditor,
|
|
832
|
+
text,
|
|
833
|
+
setText,
|
|
834
|
+
send,
|
|
835
|
+
placeholder,
|
|
836
|
+
autoFocus,
|
|
837
|
+
inputMinHeight,
|
|
838
|
+
maxHeight,
|
|
839
|
+
registerRichFocus,
|
|
840
|
+
handleSlashKeyDown,
|
|
841
|
+
setMentionSuggestionOpen,
|
|
842
|
+
slashOpen,
|
|
843
|
+
slashListId,
|
|
844
|
+
slashFiltered,
|
|
845
|
+
slashActiveIndex,
|
|
846
|
+
ingestPastedFiles,
|
|
847
|
+
fileInputRef,
|
|
848
|
+
accept,
|
|
849
|
+
handleFileChange,
|
|
850
|
+
onAttachFolder,
|
|
851
|
+
folderInputRef,
|
|
852
|
+
handleFolderChange,
|
|
853
|
+
showInline,
|
|
854
|
+
trailing,
|
|
855
|
+
onDictate,
|
|
856
|
+
dictation,
|
|
857
|
+
isStreaming,
|
|
858
|
+
sendVariant,
|
|
859
|
+
onCancel,
|
|
860
|
+
canSend,
|
|
861
|
+
sendLabel,
|
|
862
|
+
sendTone,
|
|
863
|
+
textareaRef,
|
|
864
|
+
slashPanelRef,
|
|
865
|
+
skillQuery,
|
|
866
|
+
hasSkills,
|
|
867
|
+
setSlashActive,
|
|
868
|
+
pickSlash,
|
|
869
|
+
focusShortcut
|
|
870
|
+
};
|
|
871
|
+
}
|
|
872
|
+
function ChatComposer(props) {
|
|
873
|
+
const view = useChatComposerViewState(props);
|
|
874
|
+
return /* @__PURE__ */ jsx3(ChatComposerView, { ...view });
|
|
875
|
+
}
|
|
876
|
+
function ChatComposerView({
|
|
877
|
+
className,
|
|
878
|
+
focusWithin,
|
|
879
|
+
onAttach,
|
|
880
|
+
handleDragEnter,
|
|
881
|
+
handleDragLeave,
|
|
882
|
+
handleDragOver,
|
|
883
|
+
handleDrop,
|
|
884
|
+
dragOver,
|
|
885
|
+
dropTitle,
|
|
886
|
+
dropDescription,
|
|
887
|
+
showAbove,
|
|
888
|
+
controls,
|
|
889
|
+
dictateError,
|
|
890
|
+
setDictateError,
|
|
891
|
+
failedSend,
|
|
892
|
+
setFailedSend,
|
|
893
|
+
retryFailedSend,
|
|
894
|
+
sendBlockedByStream,
|
|
895
|
+
disabled,
|
|
896
|
+
selectedSkillId,
|
|
897
|
+
eligibleSkills,
|
|
898
|
+
onSelectedSkillChange,
|
|
899
|
+
contextItems,
|
|
900
|
+
pendingFiles,
|
|
901
|
+
folderChips,
|
|
902
|
+
fileChips,
|
|
903
|
+
onRetryFile,
|
|
904
|
+
onRemoveFile,
|
|
905
|
+
cardRef,
|
|
906
|
+
floating,
|
|
907
|
+
mention,
|
|
908
|
+
textareaInput,
|
|
909
|
+
MentionEditor,
|
|
910
|
+
text,
|
|
911
|
+
setText,
|
|
912
|
+
send,
|
|
913
|
+
placeholder,
|
|
914
|
+
autoFocus,
|
|
915
|
+
inputMinHeight,
|
|
916
|
+
maxHeight,
|
|
917
|
+
registerRichFocus,
|
|
918
|
+
handleSlashKeyDown,
|
|
919
|
+
setMentionSuggestionOpen,
|
|
920
|
+
slashOpen,
|
|
921
|
+
slashListId,
|
|
922
|
+
slashFiltered,
|
|
923
|
+
slashActiveIndex,
|
|
924
|
+
ingestPastedFiles,
|
|
925
|
+
fileInputRef,
|
|
926
|
+
accept,
|
|
927
|
+
handleFileChange,
|
|
928
|
+
onAttachFolder,
|
|
929
|
+
folderInputRef,
|
|
930
|
+
handleFolderChange,
|
|
931
|
+
showInline,
|
|
932
|
+
trailing,
|
|
933
|
+
onDictate,
|
|
934
|
+
dictation,
|
|
935
|
+
isStreaming,
|
|
936
|
+
sendVariant,
|
|
937
|
+
onCancel,
|
|
938
|
+
canSend,
|
|
939
|
+
sendLabel,
|
|
940
|
+
sendTone,
|
|
941
|
+
textareaRef,
|
|
942
|
+
slashPanelRef,
|
|
943
|
+
skillQuery,
|
|
944
|
+
hasSkills,
|
|
945
|
+
setSlashActive,
|
|
946
|
+
pickSlash,
|
|
947
|
+
focusShortcut
|
|
948
|
+
}) {
|
|
798
949
|
return /* @__PURE__ */ jsxs3(
|
|
799
950
|
"div",
|
|
800
951
|
{
|
|
@@ -913,231 +1064,49 @@ function ChatComposer({
|
|
|
913
1064
|
},
|
|
914
1065
|
item.id
|
|
915
1066
|
)) }),
|
|
916
|
-
pendingFiles.length > 0 && /* @__PURE__ */ jsx3(
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
"span",
|
|
920
|
-
{
|
|
921
|
-
title: isError ? f.errorMessage : void 0,
|
|
922
|
-
className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs ${isError ? "border-destructive/40 text-destructive" : "border-border bg-secondary text-foreground"} ${f.status === "pending" ? "opacity-60" : ""}`,
|
|
923
|
-
children: [
|
|
924
|
-
f.kind !== "folder" && f.previewUrl ? /* @__PURE__ */ jsx3("img", { src: f.previewUrl, alt: "", className: "h-8 w-8 shrink-0 rounded object-cover" }) : f.kind === "folder" ? /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
925
|
-
/* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate", children: f.name }),
|
|
926
|
-
f.fileCount !== void 0 && /* @__PURE__ */ jsxs3("span", { className: "text-muted-foreground", children: [
|
|
927
|
-
"(",
|
|
928
|
-
f.fileCount,
|
|
929
|
-
")"
|
|
930
|
-
] }),
|
|
931
|
-
f.status === "uploading" && /* @__PURE__ */ jsx3("span", { className: "h-3 w-3 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
932
|
-
isError && f.errorMessage && /* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate text-destructive/80", children: f.errorMessage }),
|
|
933
|
-
isError && onRetryFile && /* @__PURE__ */ jsx3(
|
|
934
|
-
"button",
|
|
935
|
-
{
|
|
936
|
-
type: "button",
|
|
937
|
-
"aria-label": `Retry upload ${f.name}`,
|
|
938
|
-
onClick: () => onRetryFile(f.id),
|
|
939
|
-
className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
940
|
-
children: /* @__PURE__ */ jsx3(RetryGlyph, { className: "h-3 w-3" })
|
|
941
|
-
}
|
|
942
|
-
),
|
|
943
|
-
onRemoveFile && /* @__PURE__ */ jsx3(
|
|
944
|
-
"button",
|
|
945
|
-
{
|
|
946
|
-
type: "button",
|
|
947
|
-
"aria-label": `Remove ${f.name}`,
|
|
948
|
-
onClick: () => onRemoveFile(f.id),
|
|
949
|
-
className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
950
|
-
children: /* @__PURE__ */ jsx3(CloseGlyph, { className: "h-3 w-3" })
|
|
951
|
-
}
|
|
952
|
-
)
|
|
953
|
-
]
|
|
954
|
-
},
|
|
955
|
-
f.id
|
|
956
|
-
);
|
|
957
|
-
}) }),
|
|
958
|
-
/* @__PURE__ */ jsxs3(
|
|
959
|
-
"div",
|
|
1067
|
+
pendingFiles.length > 0 && /* @__PURE__ */ jsx3(ComposerPendingFileChips, { folderChips, fileChips, onRetryFile, onRemoveFile }),
|
|
1068
|
+
/* @__PURE__ */ jsx3(
|
|
1069
|
+
ComposerInputCard,
|
|
960
1070
|
{
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
// The card is the field (`focusFieldWithin`: well fill, field border,
|
|
1001
|
-
// hover glow, focus ring), so tokens.css clears the transparent
|
|
1002
|
-
// input's own outline (`[data-composer-input]:focus-visible`).
|
|
1003
|
-
textareaInput
|
|
1004
|
-
),
|
|
1005
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
1006
|
-
onAttach && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1007
|
-
/* @__PURE__ */ jsx3(
|
|
1008
|
-
"button",
|
|
1009
|
-
{
|
|
1010
|
-
type: "button",
|
|
1011
|
-
onClick: () => fileInputRef.current?.click(),
|
|
1012
|
-
disabled,
|
|
1013
|
-
"aria-label": "Attach files",
|
|
1014
|
-
title: "Attach files",
|
|
1015
|
-
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1016
|
-
children: /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-4 w-4" })
|
|
1017
|
-
}
|
|
1018
|
-
),
|
|
1019
|
-
/* @__PURE__ */ jsx3("input", { ref: fileInputRef, type: "file", multiple: true, className: "hidden", accept, onChange: handleFileChange })
|
|
1020
|
-
] }),
|
|
1021
|
-
onAttachFolder && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1022
|
-
/* @__PURE__ */ jsx3(
|
|
1023
|
-
"button",
|
|
1024
|
-
{
|
|
1025
|
-
type: "button",
|
|
1026
|
-
onClick: () => folderInputRef.current?.click(),
|
|
1027
|
-
disabled,
|
|
1028
|
-
"aria-label": "Attach folder",
|
|
1029
|
-
title: "Attach folder",
|
|
1030
|
-
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1031
|
-
children: /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-4 w-4" })
|
|
1032
|
-
}
|
|
1033
|
-
),
|
|
1034
|
-
/* @__PURE__ */ jsx3(
|
|
1035
|
-
"input",
|
|
1036
|
-
{
|
|
1037
|
-
ref: folderInputRef,
|
|
1038
|
-
type: "file",
|
|
1039
|
-
multiple: true,
|
|
1040
|
-
className: "hidden",
|
|
1041
|
-
onChange: handleFolderChange,
|
|
1042
|
-
...{ webkitdirectory: "" }
|
|
1043
|
-
}
|
|
1044
|
-
)
|
|
1045
|
-
] }),
|
|
1046
|
-
/* @__PURE__ */ jsx3(
|
|
1047
|
-
"div",
|
|
1048
|
-
{
|
|
1049
|
-
"data-testid": "composer-controls",
|
|
1050
|
-
className: "flex min-w-min flex-1 flex-wrap items-center gap-1.5",
|
|
1051
|
-
children: showInline && controls
|
|
1052
|
-
}
|
|
1053
|
-
),
|
|
1054
|
-
/* @__PURE__ */ jsxs3("div", { "data-testid": "composer-actions", className: "ml-auto flex min-w-0 max-w-full flex-wrap items-end justify-end gap-2", children: [
|
|
1055
|
-
trailing && /* @__PURE__ */ jsx3("div", { "data-testid": "composer-trailing", className: "flex min-w-0 flex-wrap items-center justify-end gap-1.5", children: trailing }),
|
|
1056
|
-
onDictate && dictation.supported ? dictation.recording ? /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
1057
|
-
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", className: "h-2 w-2 animate-pulse rounded-full bg-destructive" }),
|
|
1058
|
-
/* @__PURE__ */ jsx3(
|
|
1059
|
-
"span",
|
|
1060
|
-
{
|
|
1061
|
-
"aria-hidden": "true",
|
|
1062
|
-
"data-testid": "composer-dictate-elapsed",
|
|
1063
|
-
className: "text-xs tabular-nums text-muted-foreground",
|
|
1064
|
-
children: formatDictationElapsed(dictation.elapsedSeconds)
|
|
1065
|
-
}
|
|
1066
|
-
),
|
|
1067
|
-
/* @__PURE__ */ jsx3("span", { role: "status", className: "sr-only", children: "Recording" }),
|
|
1068
|
-
/* @__PURE__ */ jsx3(
|
|
1069
|
-
"button",
|
|
1070
|
-
{
|
|
1071
|
-
type: "button",
|
|
1072
|
-
onClick: dictation.stop,
|
|
1073
|
-
"aria-label": "Stop dictation",
|
|
1074
|
-
title: "Stop dictation",
|
|
1075
|
-
className: "shrink-0 rounded-lg p-2 text-destructive transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1076
|
-
children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-4 w-4" })
|
|
1077
|
-
}
|
|
1078
|
-
)
|
|
1079
|
-
] }) : /* @__PURE__ */ jsx3(
|
|
1080
|
-
"button",
|
|
1081
|
-
{
|
|
1082
|
-
type: "button",
|
|
1083
|
-
onClick: dictation.start,
|
|
1084
|
-
disabled,
|
|
1085
|
-
"aria-label": "Dictate message",
|
|
1086
|
-
title: "Dictate message",
|
|
1087
|
-
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1088
|
-
children: /* @__PURE__ */ jsx3(MicGlyph, { className: "h-4 w-4" })
|
|
1089
|
-
}
|
|
1090
|
-
) : null,
|
|
1091
|
-
isStreaming ? sendVariant === "icon" ? /* @__PURE__ */ jsx3(
|
|
1092
|
-
"button",
|
|
1093
|
-
{
|
|
1094
|
-
type: "button",
|
|
1095
|
-
onClick: onCancel,
|
|
1096
|
-
"aria-label": "Stop response",
|
|
1097
|
-
title: "Stop",
|
|
1098
|
-
className: "inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full border border-border bg-transparent text-foreground transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1099
|
-
children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-3 w-3" })
|
|
1100
|
-
}
|
|
1101
|
-
) : /* @__PURE__ */ jsxs3(
|
|
1102
|
-
"button",
|
|
1103
|
-
{
|
|
1104
|
-
type: "button",
|
|
1105
|
-
onClick: onCancel,
|
|
1106
|
-
"aria-label": "Stop response",
|
|
1107
|
-
className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-destructive/15 px-3.5 text-sm font-medium text-destructive transition hover:bg-destructive/25 focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
1108
|
-
children: [
|
|
1109
|
-
/* @__PURE__ */ jsx3(StopGlyph, { className: "h-3.5 w-3.5" }),
|
|
1110
|
-
/* @__PURE__ */ jsx3("span", { children: "Stop" })
|
|
1111
|
-
]
|
|
1112
|
-
}
|
|
1113
|
-
) : sendVariant === "icon" ? /* @__PURE__ */ jsx3(
|
|
1114
|
-
"button",
|
|
1115
|
-
{
|
|
1116
|
-
type: "button",
|
|
1117
|
-
onClick: send,
|
|
1118
|
-
disabled: !canSend,
|
|
1119
|
-
"aria-label": sendLabel,
|
|
1120
|
-
title: sendLabel,
|
|
1121
|
-
className: `inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full ${sendTone === "primary" ? "bg-primary text-primary-foreground" : "bg-foreground text-background"} transition ${sendTone === "primary" ? "hover:bg-primary/90" : "hover:opacity-90"} disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card`,
|
|
1122
|
-
children: /* @__PURE__ */ jsx3(ArrowUpGlyph, { className: "h-4 w-4" })
|
|
1123
|
-
}
|
|
1124
|
-
) : /* @__PURE__ */ jsxs3(
|
|
1125
|
-
"button",
|
|
1126
|
-
{
|
|
1127
|
-
type: "button",
|
|
1128
|
-
onClick: send,
|
|
1129
|
-
disabled: !canSend,
|
|
1130
|
-
"aria-label": sendLabel,
|
|
1131
|
-
className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-primary px-3.5 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card",
|
|
1132
|
-
children: [
|
|
1133
|
-
/* @__PURE__ */ jsx3(SendGlyph, { className: "h-3.5 w-3.5" }),
|
|
1134
|
-
/* @__PURE__ */ jsx3("span", { children: sendLabel })
|
|
1135
|
-
]
|
|
1136
|
-
}
|
|
1137
|
-
)
|
|
1138
|
-
] })
|
|
1139
|
-
] })
|
|
1140
|
-
]
|
|
1071
|
+
cardRef,
|
|
1072
|
+
floating,
|
|
1073
|
+
mention,
|
|
1074
|
+
textareaInput,
|
|
1075
|
+
MentionEditor,
|
|
1076
|
+
text,
|
|
1077
|
+
setText,
|
|
1078
|
+
send,
|
|
1079
|
+
placeholder,
|
|
1080
|
+
disabled,
|
|
1081
|
+
autoFocus,
|
|
1082
|
+
inputMinHeight,
|
|
1083
|
+
maxHeight,
|
|
1084
|
+
registerRichFocus,
|
|
1085
|
+
handleSlashKeyDown,
|
|
1086
|
+
setMentionSuggestionOpen,
|
|
1087
|
+
slashOpen,
|
|
1088
|
+
slashListId,
|
|
1089
|
+
slashFiltered,
|
|
1090
|
+
slashActiveIndex,
|
|
1091
|
+
onAttach,
|
|
1092
|
+
ingestPastedFiles,
|
|
1093
|
+
fileInputRef,
|
|
1094
|
+
accept,
|
|
1095
|
+
handleFileChange,
|
|
1096
|
+
onAttachFolder,
|
|
1097
|
+
folderInputRef,
|
|
1098
|
+
handleFolderChange,
|
|
1099
|
+
showInline,
|
|
1100
|
+
controls,
|
|
1101
|
+
trailing,
|
|
1102
|
+
onDictate,
|
|
1103
|
+
dictation,
|
|
1104
|
+
isStreaming,
|
|
1105
|
+
sendVariant,
|
|
1106
|
+
onCancel,
|
|
1107
|
+
canSend,
|
|
1108
|
+
sendLabel,
|
|
1109
|
+
sendTone
|
|
1141
1110
|
}
|
|
1142
1111
|
),
|
|
1143
1112
|
/* @__PURE__ */ jsx3(
|
|
@@ -1182,6 +1151,282 @@ function ChatComposer({
|
|
|
1182
1151
|
}
|
|
1183
1152
|
);
|
|
1184
1153
|
}
|
|
1154
|
+
function ComposerPendingFileChips({
|
|
1155
|
+
folderChips,
|
|
1156
|
+
fileChips,
|
|
1157
|
+
onRetryFile,
|
|
1158
|
+
onRemoveFile
|
|
1159
|
+
}) {
|
|
1160
|
+
return /* @__PURE__ */ jsx3("div", { className: "mb-2 flex flex-wrap gap-1.5", children: [...folderChips, ...fileChips].map((f) => {
|
|
1161
|
+
const isError = f.status === "error";
|
|
1162
|
+
return /* @__PURE__ */ jsxs3(
|
|
1163
|
+
"span",
|
|
1164
|
+
{
|
|
1165
|
+
title: isError ? f.errorMessage : void 0,
|
|
1166
|
+
className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs ${isError ? "border-destructive/40 text-destructive" : "border-border bg-secondary text-foreground"} ${f.status === "pending" ? "opacity-60" : ""}`,
|
|
1167
|
+
children: [
|
|
1168
|
+
f.kind !== "folder" && f.previewUrl ? /* @__PURE__ */ jsx3("img", { src: f.previewUrl, alt: "", className: "h-8 w-8 shrink-0 rounded object-cover" }) : f.kind === "folder" ? /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
1169
|
+
/* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate", children: f.name }),
|
|
1170
|
+
f.fileCount !== void 0 && /* @__PURE__ */ jsxs3("span", { className: "text-muted-foreground", children: [
|
|
1171
|
+
"(",
|
|
1172
|
+
f.fileCount,
|
|
1173
|
+
")"
|
|
1174
|
+
] }),
|
|
1175
|
+
f.status === "uploading" && /* @__PURE__ */ jsx3("span", { className: "h-3 w-3 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1176
|
+
isError && f.errorMessage && /* @__PURE__ */ jsx3("span", { className: "max-w-[150px] truncate text-destructive/80", children: f.errorMessage }),
|
|
1177
|
+
isError && onRetryFile && /* @__PURE__ */ jsx3(
|
|
1178
|
+
"button",
|
|
1179
|
+
{
|
|
1180
|
+
type: "button",
|
|
1181
|
+
"aria-label": `Retry upload ${f.name}`,
|
|
1182
|
+
onClick: () => onRetryFile(f.id),
|
|
1183
|
+
className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1184
|
+
children: /* @__PURE__ */ jsx3(RetryGlyph, { className: "h-3 w-3" })
|
|
1185
|
+
}
|
|
1186
|
+
),
|
|
1187
|
+
onRemoveFile && /* @__PURE__ */ jsx3(
|
|
1188
|
+
"button",
|
|
1189
|
+
{
|
|
1190
|
+
type: "button",
|
|
1191
|
+
"aria-label": `Remove ${f.name}`,
|
|
1192
|
+
onClick: () => onRemoveFile(f.id),
|
|
1193
|
+
className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1194
|
+
children: /* @__PURE__ */ jsx3(CloseGlyph, { className: "h-3 w-3" })
|
|
1195
|
+
}
|
|
1196
|
+
)
|
|
1197
|
+
]
|
|
1198
|
+
},
|
|
1199
|
+
f.id
|
|
1200
|
+
);
|
|
1201
|
+
}) });
|
|
1202
|
+
}
|
|
1203
|
+
function ComposerInputCard({
|
|
1204
|
+
cardRef,
|
|
1205
|
+
floating,
|
|
1206
|
+
mention,
|
|
1207
|
+
textareaInput,
|
|
1208
|
+
MentionEditor,
|
|
1209
|
+
text,
|
|
1210
|
+
setText,
|
|
1211
|
+
send,
|
|
1212
|
+
placeholder,
|
|
1213
|
+
disabled,
|
|
1214
|
+
autoFocus,
|
|
1215
|
+
inputMinHeight,
|
|
1216
|
+
maxHeight,
|
|
1217
|
+
registerRichFocus,
|
|
1218
|
+
handleSlashKeyDown,
|
|
1219
|
+
setMentionSuggestionOpen,
|
|
1220
|
+
slashOpen,
|
|
1221
|
+
slashListId,
|
|
1222
|
+
slashFiltered,
|
|
1223
|
+
slashActiveIndex,
|
|
1224
|
+
onAttach,
|
|
1225
|
+
ingestPastedFiles,
|
|
1226
|
+
fileInputRef,
|
|
1227
|
+
accept,
|
|
1228
|
+
handleFileChange,
|
|
1229
|
+
onAttachFolder,
|
|
1230
|
+
folderInputRef,
|
|
1231
|
+
handleFolderChange,
|
|
1232
|
+
showInline,
|
|
1233
|
+
controls,
|
|
1234
|
+
trailing,
|
|
1235
|
+
onDictate,
|
|
1236
|
+
dictation,
|
|
1237
|
+
isStreaming,
|
|
1238
|
+
sendVariant,
|
|
1239
|
+
onCancel,
|
|
1240
|
+
canSend,
|
|
1241
|
+
sendLabel,
|
|
1242
|
+
sendTone
|
|
1243
|
+
}) {
|
|
1244
|
+
return /* @__PURE__ */ jsxs3(
|
|
1245
|
+
"div",
|
|
1246
|
+
{
|
|
1247
|
+
ref: cardRef,
|
|
1248
|
+
"data-testid": "composer-card",
|
|
1249
|
+
className: `flex flex-col gap-1.5 rounded-2xl border bg-[var(--well,var(--color-card))] px-3 py-2.5 ${focusFieldWithin} ${floating ? "shadow-raised" : ""}`,
|
|
1250
|
+
children: [
|
|
1251
|
+
mention ? (
|
|
1252
|
+
// The basic textarea stays usable through download, initialization,
|
|
1253
|
+
// and failure.
|
|
1254
|
+
/* @__PURE__ */ jsx3(LazyLoadBoundary, { renderFailure: () => /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1255
|
+
textareaInput,
|
|
1256
|
+
/* @__PURE__ */ jsx3(
|
|
1257
|
+
"div",
|
|
1258
|
+
{
|
|
1259
|
+
role: "alert",
|
|
1260
|
+
className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",
|
|
1261
|
+
children: "Mentions are unavailable. You can still send."
|
|
1262
|
+
}
|
|
1263
|
+
)
|
|
1264
|
+
] }), children: /* @__PURE__ */ jsx3(Suspense, { fallback: textareaInput, children: /* @__PURE__ */ jsx3(
|
|
1265
|
+
MentionEditor,
|
|
1266
|
+
{
|
|
1267
|
+
value: text,
|
|
1268
|
+
onChange: setText,
|
|
1269
|
+
onSubmit: send,
|
|
1270
|
+
placeholder,
|
|
1271
|
+
disabled,
|
|
1272
|
+
autoFocus,
|
|
1273
|
+
minHeight: inputMinHeight,
|
|
1274
|
+
maxHeight,
|
|
1275
|
+
mention,
|
|
1276
|
+
fallback: textareaInput,
|
|
1277
|
+
registerFocus: registerRichFocus,
|
|
1278
|
+
onComposerKeyDown: handleSlashKeyDown,
|
|
1279
|
+
onMentionMenuOpenChange: setMentionSuggestionOpen,
|
|
1280
|
+
slashListId: slashOpen ? slashListId : void 0,
|
|
1281
|
+
slashActiveId: slashFiltered[slashActiveIndex] ? `${slashListId}-${slashActiveIndex}` : void 0,
|
|
1282
|
+
onPasteFiles: onAttach ? ingestPastedFiles : void 0
|
|
1283
|
+
}
|
|
1284
|
+
) }) })
|
|
1285
|
+
) : (
|
|
1286
|
+
// The card is the field (`focusFieldWithin`: well fill, field border,
|
|
1287
|
+
// hover glow, focus ring), so tokens.css clears the transparent
|
|
1288
|
+
// input's own outline (`[data-composer-input]:focus-visible`).
|
|
1289
|
+
textareaInput
|
|
1290
|
+
),
|
|
1291
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
1292
|
+
onAttach && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1293
|
+
/* @__PURE__ */ jsx3(
|
|
1294
|
+
"button",
|
|
1295
|
+
{
|
|
1296
|
+
type: "button",
|
|
1297
|
+
onClick: () => fileInputRef.current?.click(),
|
|
1298
|
+
disabled,
|
|
1299
|
+
"aria-label": "Attach files",
|
|
1300
|
+
title: "Attach files",
|
|
1301
|
+
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1302
|
+
children: /* @__PURE__ */ jsx3(PaperclipGlyph, { className: "h-4 w-4" })
|
|
1303
|
+
}
|
|
1304
|
+
),
|
|
1305
|
+
/* @__PURE__ */ jsx3("input", { ref: fileInputRef, type: "file", multiple: true, className: "hidden", accept, onChange: handleFileChange })
|
|
1306
|
+
] }),
|
|
1307
|
+
onAttachFolder && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1308
|
+
/* @__PURE__ */ jsx3(
|
|
1309
|
+
"button",
|
|
1310
|
+
{
|
|
1311
|
+
type: "button",
|
|
1312
|
+
onClick: () => folderInputRef.current?.click(),
|
|
1313
|
+
disabled,
|
|
1314
|
+
"aria-label": "Attach folder",
|
|
1315
|
+
title: "Attach folder",
|
|
1316
|
+
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1317
|
+
children: /* @__PURE__ */ jsx3(FolderGlyph, { className: "h-4 w-4" })
|
|
1318
|
+
}
|
|
1319
|
+
),
|
|
1320
|
+
/* @__PURE__ */ jsx3(
|
|
1321
|
+
"input",
|
|
1322
|
+
{
|
|
1323
|
+
ref: folderInputRef,
|
|
1324
|
+
type: "file",
|
|
1325
|
+
multiple: true,
|
|
1326
|
+
className: "hidden",
|
|
1327
|
+
onChange: handleFolderChange,
|
|
1328
|
+
...{ webkitdirectory: "" }
|
|
1329
|
+
}
|
|
1330
|
+
)
|
|
1331
|
+
] }),
|
|
1332
|
+
/* @__PURE__ */ jsx3(
|
|
1333
|
+
"div",
|
|
1334
|
+
{
|
|
1335
|
+
"data-testid": "composer-controls",
|
|
1336
|
+
className: "flex min-w-min flex-1 flex-wrap items-center gap-1.5",
|
|
1337
|
+
children: showInline && controls
|
|
1338
|
+
}
|
|
1339
|
+
),
|
|
1340
|
+
/* @__PURE__ */ jsxs3("div", { "data-testid": "composer-actions", className: "ml-auto flex min-w-0 max-w-full flex-wrap items-end justify-end gap-2", children: [
|
|
1341
|
+
trailing && /* @__PURE__ */ jsx3("div", { "data-testid": "composer-trailing", className: "flex min-w-0 flex-wrap items-center justify-end gap-1.5", children: trailing }),
|
|
1342
|
+
onDictate && dictation.supported ? dictation.recording ? /* @__PURE__ */ jsxs3("div", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
1343
|
+
/* @__PURE__ */ jsx3("span", { "aria-hidden": "true", className: "h-2 w-2 animate-pulse rounded-full bg-destructive" }),
|
|
1344
|
+
/* @__PURE__ */ jsx3(
|
|
1345
|
+
"span",
|
|
1346
|
+
{
|
|
1347
|
+
"aria-hidden": "true",
|
|
1348
|
+
"data-testid": "composer-dictate-elapsed",
|
|
1349
|
+
className: "text-xs tabular-nums text-muted-foreground",
|
|
1350
|
+
children: formatDictationElapsed(dictation.elapsedSeconds)
|
|
1351
|
+
}
|
|
1352
|
+
),
|
|
1353
|
+
/* @__PURE__ */ jsx3("span", { role: "status", className: "sr-only", children: "Recording" }),
|
|
1354
|
+
/* @__PURE__ */ jsx3(
|
|
1355
|
+
"button",
|
|
1356
|
+
{
|
|
1357
|
+
type: "button",
|
|
1358
|
+
onClick: dictation.stop,
|
|
1359
|
+
"aria-label": "Stop dictation",
|
|
1360
|
+
title: "Stop dictation",
|
|
1361
|
+
className: "shrink-0 rounded-lg p-2 text-destructive transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1362
|
+
children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-4 w-4" })
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1365
|
+
] }) : /* @__PURE__ */ jsx3(
|
|
1366
|
+
"button",
|
|
1367
|
+
{
|
|
1368
|
+
type: "button",
|
|
1369
|
+
onClick: dictation.start,
|
|
1370
|
+
disabled,
|
|
1371
|
+
"aria-label": "Dictate message",
|
|
1372
|
+
title: "Dictate message",
|
|
1373
|
+
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1374
|
+
children: /* @__PURE__ */ jsx3(MicGlyph, { className: "h-4 w-4" })
|
|
1375
|
+
}
|
|
1376
|
+
) : null,
|
|
1377
|
+
isStreaming ? sendVariant === "icon" ? /* @__PURE__ */ jsx3(
|
|
1378
|
+
"button",
|
|
1379
|
+
{
|
|
1380
|
+
type: "button",
|
|
1381
|
+
onClick: onCancel,
|
|
1382
|
+
"aria-label": "Stop response",
|
|
1383
|
+
title: "Stop",
|
|
1384
|
+
className: "inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full border border-border bg-transparent text-foreground transition hover:bg-accent focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1385
|
+
children: /* @__PURE__ */ jsx3(StopGlyph, { className: "h-3 w-3" })
|
|
1386
|
+
}
|
|
1387
|
+
) : /* @__PURE__ */ jsxs3(
|
|
1388
|
+
"button",
|
|
1389
|
+
{
|
|
1390
|
+
type: "button",
|
|
1391
|
+
onClick: onCancel,
|
|
1392
|
+
"aria-label": "Stop response",
|
|
1393
|
+
className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-destructive/15 px-3.5 text-sm font-medium text-destructive transition hover:bg-destructive/25 focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
1394
|
+
children: [
|
|
1395
|
+
/* @__PURE__ */ jsx3(StopGlyph, { className: "h-3.5 w-3.5" }),
|
|
1396
|
+
/* @__PURE__ */ jsx3("span", { children: "Stop" })
|
|
1397
|
+
]
|
|
1398
|
+
}
|
|
1399
|
+
) : sendVariant === "icon" ? /* @__PURE__ */ jsx3(
|
|
1400
|
+
"button",
|
|
1401
|
+
{
|
|
1402
|
+
type: "button",
|
|
1403
|
+
onClick: send,
|
|
1404
|
+
disabled: !canSend,
|
|
1405
|
+
"aria-label": sendLabel,
|
|
1406
|
+
title: sendLabel,
|
|
1407
|
+
className: `inline-flex size-[var(--control-height-sm,2rem)] shrink-0 items-center justify-center rounded-full ${sendTone === "primary" ? "bg-primary text-primary-foreground" : "bg-foreground text-background"} transition ${sendTone === "primary" ? "hover:bg-primary/90" : "hover:opacity-90"} disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card`,
|
|
1408
|
+
children: /* @__PURE__ */ jsx3(ArrowUpGlyph, { className: "h-4 w-4" })
|
|
1409
|
+
}
|
|
1410
|
+
) : /* @__PURE__ */ jsxs3(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
type: "button",
|
|
1414
|
+
onClick: send,
|
|
1415
|
+
disabled: !canSend,
|
|
1416
|
+
"aria-label": sendLabel,
|
|
1417
|
+
className: "inline-flex h-[var(--control-height-sm,2rem)] shrink-0 items-center gap-1.5 rounded-full bg-primary px-3.5 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card",
|
|
1418
|
+
children: [
|
|
1419
|
+
/* @__PURE__ */ jsx3(SendGlyph, { className: "h-3.5 w-3.5" }),
|
|
1420
|
+
/* @__PURE__ */ jsx3("span", { children: sendLabel })
|
|
1421
|
+
]
|
|
1422
|
+
}
|
|
1423
|
+
)
|
|
1424
|
+
] })
|
|
1425
|
+
] })
|
|
1426
|
+
]
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1185
1430
|
|
|
1186
1431
|
// src/web-react/use-composer-attachments.ts
|
|
1187
1432
|
import { useCallback as useCallback6, useEffect as useEffect6, useMemo as useMemo3, useRef as useRef6, useState as useState7 } from "react";
|
|
@@ -1245,73 +1490,7 @@ function useComposerAttachments(options) {
|
|
|
1245
1490
|
[]
|
|
1246
1491
|
);
|
|
1247
1492
|
const upload = useCallback6(
|
|
1248
|
-
|
|
1249
|
-
const opts = optionsRef.current;
|
|
1250
|
-
setStaged(
|
|
1251
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, status: "uploading", errorMessage: void 0 } : s)
|
|
1252
|
-
);
|
|
1253
|
-
const controller = new AbortController();
|
|
1254
|
-
controllersRef.current.set(id, controller);
|
|
1255
|
-
const form = new FormData();
|
|
1256
|
-
form.append("file", file, name);
|
|
1257
|
-
const request = opts.buildUploadRequest ? opts.buildUploadRequest({ file, name, form }) : opts.uploadUrl ? { url: opts.uploadUrl } : null;
|
|
1258
|
-
if (!request) {
|
|
1259
|
-
setStaged(
|
|
1260
|
-
(prev) => prev.map(
|
|
1261
|
-
(s) => s.id === id ? { ...s, status: "error", errorMessage: NO_UPLOAD_TARGET_MESSAGE } : s
|
|
1262
|
-
)
|
|
1263
|
-
);
|
|
1264
|
-
opts.onError?.(NO_UPLOAD_TARGET_MESSAGE);
|
|
1265
|
-
controllersRef.current.delete(id);
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
try {
|
|
1269
|
-
const res = opts.uploadBody === "raw" ? await fetch(withFilename(request.url, name), {
|
|
1270
|
-
method: "POST",
|
|
1271
|
-
credentials: "same-origin",
|
|
1272
|
-
...request.init,
|
|
1273
|
-
headers: rawUploadHeaders(request.init?.headers, file.size),
|
|
1274
|
-
body: file,
|
|
1275
|
-
signal: controller.signal
|
|
1276
|
-
}) : await fetch(request.url, {
|
|
1277
|
-
method: "POST",
|
|
1278
|
-
credentials: "same-origin",
|
|
1279
|
-
...request.init,
|
|
1280
|
-
body: form,
|
|
1281
|
-
signal: controller.signal
|
|
1282
|
-
});
|
|
1283
|
-
if (!res.ok) {
|
|
1284
|
-
const message = await parseUploadError(res);
|
|
1285
|
-
setStaged(
|
|
1286
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1287
|
-
);
|
|
1288
|
-
opts.onError?.(message);
|
|
1289
|
-
return;
|
|
1290
|
-
}
|
|
1291
|
-
const data = await res.json();
|
|
1292
|
-
const uploaded = data.files?.[0];
|
|
1293
|
-
if (!uploaded) {
|
|
1294
|
-
const message = "Upload returned no file";
|
|
1295
|
-
setStaged(
|
|
1296
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1297
|
-
);
|
|
1298
|
-
opts.onError?.(message);
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
1301
|
-
setStaged(
|
|
1302
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, status: "ready", reference: uploaded } : s)
|
|
1303
|
-
);
|
|
1304
|
-
} catch (err) {
|
|
1305
|
-
if (err.name === "AbortError") return;
|
|
1306
|
-
const message = err instanceof Error && err.message ? err.message : "Upload failed \u2014 check your connection";
|
|
1307
|
-
setStaged(
|
|
1308
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1309
|
-
);
|
|
1310
|
-
opts.onError?.(message);
|
|
1311
|
-
} finally {
|
|
1312
|
-
controllersRef.current.delete(id);
|
|
1313
|
-
}
|
|
1314
|
-
},
|
|
1493
|
+
(id, file, name) => uploadComposerAttachment(id, file, name, { optionsRef, setStaged, controllersRef }),
|
|
1315
1494
|
[setStaged]
|
|
1316
1495
|
);
|
|
1317
1496
|
const addFiles = useCallback6(
|
|
@@ -1467,6 +1646,77 @@ function useComposerAttachments(options) {
|
|
|
1467
1646
|
blockReason
|
|
1468
1647
|
};
|
|
1469
1648
|
}
|
|
1649
|
+
async function uploadComposerAttachment(id, file, name, {
|
|
1650
|
+
optionsRef,
|
|
1651
|
+
setStaged,
|
|
1652
|
+
controllersRef
|
|
1653
|
+
}) {
|
|
1654
|
+
const opts = optionsRef.current;
|
|
1655
|
+
setStaged(
|
|
1656
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, status: "uploading", errorMessage: void 0 } : s)
|
|
1657
|
+
);
|
|
1658
|
+
const controller = new AbortController();
|
|
1659
|
+
controllersRef.current.set(id, controller);
|
|
1660
|
+
const form = new FormData();
|
|
1661
|
+
form.append("file", file, name);
|
|
1662
|
+
const request = opts.buildUploadRequest ? opts.buildUploadRequest({ file, name, form }) : opts.uploadUrl ? { url: opts.uploadUrl } : null;
|
|
1663
|
+
if (!request) {
|
|
1664
|
+
setStaged(
|
|
1665
|
+
(prev) => prev.map(
|
|
1666
|
+
(s) => s.id === id ? { ...s, status: "error", errorMessage: NO_UPLOAD_TARGET_MESSAGE } : s
|
|
1667
|
+
)
|
|
1668
|
+
);
|
|
1669
|
+
opts.onError?.(NO_UPLOAD_TARGET_MESSAGE);
|
|
1670
|
+
controllersRef.current.delete(id);
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
try {
|
|
1674
|
+
const res = opts.uploadBody === "raw" ? await fetch(withFilename(request.url, name), {
|
|
1675
|
+
method: "POST",
|
|
1676
|
+
credentials: "same-origin",
|
|
1677
|
+
...request.init,
|
|
1678
|
+
headers: rawUploadHeaders(request.init?.headers, file.size),
|
|
1679
|
+
body: file,
|
|
1680
|
+
signal: controller.signal
|
|
1681
|
+
}) : await fetch(request.url, {
|
|
1682
|
+
method: "POST",
|
|
1683
|
+
credentials: "same-origin",
|
|
1684
|
+
...request.init,
|
|
1685
|
+
body: form,
|
|
1686
|
+
signal: controller.signal
|
|
1687
|
+
});
|
|
1688
|
+
if (!res.ok) {
|
|
1689
|
+
const message = await parseUploadError(res);
|
|
1690
|
+
setStaged(
|
|
1691
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1692
|
+
);
|
|
1693
|
+
opts.onError?.(message);
|
|
1694
|
+
return;
|
|
1695
|
+
}
|
|
1696
|
+
const data = await res.json();
|
|
1697
|
+
const uploaded = data.files?.[0];
|
|
1698
|
+
if (!uploaded) {
|
|
1699
|
+
const message = "Upload returned no file";
|
|
1700
|
+
setStaged(
|
|
1701
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1702
|
+
);
|
|
1703
|
+
opts.onError?.(message);
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
setStaged(
|
|
1707
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, status: "ready", reference: uploaded } : s)
|
|
1708
|
+
);
|
|
1709
|
+
} catch (err) {
|
|
1710
|
+
if (err.name === "AbortError") return;
|
|
1711
|
+
const message = err instanceof Error && err.message ? err.message : "Upload failed \u2014 check your connection";
|
|
1712
|
+
setStaged(
|
|
1713
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, status: "error", errorMessage: message } : s)
|
|
1714
|
+
);
|
|
1715
|
+
opts.onError?.(message);
|
|
1716
|
+
} finally {
|
|
1717
|
+
controllersRef.current.delete(id);
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1470
1720
|
|
|
1471
1721
|
// src/web-react/composer-mode-controls.tsx
|
|
1472
1722
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -1603,4 +1853,4 @@ export {
|
|
|
1603
1853
|
ComposerModeControls,
|
|
1604
1854
|
EntryComposer
|
|
1605
1855
|
};
|
|
1606
|
-
//# sourceMappingURL=chunk-
|
|
1856
|
+
//# sourceMappingURL=chunk-JRW6LCIA.js.map
|