@yuriai/web 0.2.37 → 0.2.38-beta.2
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/assets/{AgentAvatar-Dpot7DG_.js → AgentAvatar-DNVD6VCV.js} +1 -1
- package/dist/assets/{AssistantContactStatus-DBUeAOcC.js → AssistantContactStatus-C5zpVdGa.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-uMPRfRqu.js → AssistantUnreadBadge-7KpCtnd3.js} +1 -1
- package/dist/assets/AssistantView-BZU6TlwK.js +1 -0
- package/dist/assets/{DiagramView-D317a0U8.js → DiagramView-CXgsVJ3A.js} +1 -1
- package/dist/assets/{FadeInOnReveal-DlU4WRpc.js → FadeInOnReveal-CK7jBcu4.js} +1 -1
- package/dist/assets/{GuiPluginSurface-DHMppLxf.js → GuiPluginSurface-Bk01hnV6.js} +1 -1
- package/dist/assets/{GuiPluginWindow-CWP-ZcJj.js → GuiPluginWindow-BgOCEgEb.js} +1 -1
- package/dist/assets/{Icon-3udlHlix.js → Icon-DsN23fuV.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-D2CKCkHe.js → ImageLoadingPlaceholder-MfVzv_y1.js} +1 -1
- package/dist/assets/{LoadingImage-CzTb95Cn.js → LoadingImage-MAgXscGl.js} +1 -1
- package/dist/assets/MarkdownRenderer-DswMDaKf.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-Dfj5yBQH.js → MarkdownRendererImpl-ecACjpZw.js} +2 -2
- package/dist/assets/MarkstreamRendererImpl-Bqbq2VPn.js +3 -0
- package/dist/assets/{MobileDetailNavigation-D6pHFCLd.js → MobileDetailNavigation-CXcMdlRH.js} +1 -1
- package/dist/assets/{MobileResizableSheet-B9lJQT-Q.js → MobileResizableSheet-D_PnyzR0.js} +1 -1
- package/dist/assets/{MobileShareBridge-BJDkko0y.js → MobileShareBridge-DfgyncNh.js} +2 -2
- package/dist/assets/MobileTabPageHeader-Bm8nYrzH.js +2 -0
- package/dist/assets/{MultiRunWindow-C4sUyQMj.js → MultiRunWindow-CvCgKiyV.js} +1 -1
- package/dist/assets/{OnboardingScreen-tF0G9FoO.js → OnboardingScreen-BwJ3iMGY.js} +1 -1
- package/dist/assets/{OverlayScrollbar-BhUMMoCN.js → OverlayScrollbar-BLhv7Nq-.js} +1 -1
- package/dist/assets/{SettingsView-Dk2vpPHM.js → SettingsView-DGduWj3I.js} +8 -8
- package/dist/assets/{SettingsWindow-Cl_MVXqd.js → SettingsWindow-BM8abllV.js} +1 -1
- package/dist/assets/{SetupTourDialog-BGvxww7E.js → SetupTourDialog-vmNGHNXl.js} +1 -1
- package/dist/assets/{TerminalView-DCVU9yPv.js → TerminalView-BZObkK0H.js} +1 -1
- package/dist/assets/ToolOutputDialog-D_CH2A0-.js +10 -0
- package/dist/assets/{VoiceSettings-C3KZYlyP.js → VoiceSettings-Ru8tm8eq.js} +1 -1
- package/dist/assets/{YuriLogo-CMoJ3Apd.js → YuriLogo-C5K_9jSK.js} +1 -1
- package/dist/assets/{YuriWordmark-DiB7p_ho.js → YuriWordmark-CJ8qJ14A.js} +1 -1
- package/dist/assets/{appThemeRegistry-axRbeIwY.js → appThemeRegistry-CcdIpK3S.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-B7NHgRWA.js → assistant-attachment-cache-C-SlEpSB.js} +1 -1
- package/dist/assets/{bootstrap-CH0Mo2ok.js → bootstrap-BzeQds0D.js} +3 -3
- package/dist/assets/{capgoAdapter-C8QhPFlX.js → capgoAdapter-DceVw3SM.js} +1 -1
- package/dist/assets/{checkbox-C641Uk-q.js → checkbox-CJsiyoER.js} +1 -1
- package/dist/assets/{collapsible-YNp0uGvK.js → collapsible-B3zojUm2.js} +1 -1
- package/dist/assets/{context-menu-BHe5nbZ0.js → context-menu-DFRg1NJF.js} +1 -1
- package/dist/assets/{desktop-DLxQTjzu.js → desktop-Brp3xDpd.js} +1 -1
- package/dist/assets/{desktopHosts-Dk0D5ATF.js → desktopHosts-qQ2Rz26_.js} +1 -1
- package/dist/assets/{desktopRelayRestore-COTsQw8C.js → desktopRelayRestore-DifJHAur.js} +1 -1
- package/dist/assets/{device-BGox1QjM.js → device-Db_TcRdX.js} +1 -1
- package/dist/assets/{diagram-DZJvm12J.js → diagram-OTF8YAve.js} +1 -1
- package/dist/assets/{dialog-So-nuji1.js → dialog-CgtwKUKd.js} +1 -1
- package/dist/assets/{es-BC7jaA0J.js → es-CrVDn7XV.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-CcBab6jA.js → fileMentionTouchSelection-CorehkTj.js} +1 -1
- package/dist/assets/{fileQueries-BBcsALlC.js → fileQueries-BaEKb7SZ.js} +1 -1
- package/dist/assets/fileReferenceActions-D06_lyuL.js +1 -0
- package/dist/assets/{fr-BIvcfHvS.js → fr-CCwt5AOu.js} +1 -1
- package/dist/assets/{gitApi-CXUPuRTB.js → gitApi-C6rhS4rG.js} +1 -1
- package/dist/assets/{gui-CJjEj3l4.js → gui-CFdPKvfq.js} +1 -1
- package/dist/assets/{historyImportQueries-MpkoiK56.js → historyImportQueries-BrhVXQhP.js} +1 -1
- package/dist/assets/{host-CzMYcPbz.js → host-8TDDnZXo.js} +1 -1
- package/dist/assets/{image-loading-2ppAWcFZ.js → image-loading-D1DfK_bJ.js} +1 -1
- package/dist/assets/{input-BK1Dm9vD.js → input-B7-PmgcW.js} +1 -1
- package/dist/assets/{insertionBoundaries-DQRAPE-y.js → insertionBoundaries-B-ncem5c.js} +1 -1
- package/dist/assets/{ja-Dx_d9fYc.js → ja-BfwjUNPc.js} +1 -1
- package/dist/assets/{ko-CLQ_FtRR.js → ko-CZQZFkal.js} +1 -1
- package/dist/assets/{main-CM26G9n0.js → main-BMvwUUi4.js} +2 -2
- package/dist/assets/main-Chq1F31E.js +169 -0
- package/dist/assets/{markdownHeightCache-DMZ5GgoP.js → markdownHeightCache-DlRC53XG.js} +1 -1
- package/dist/assets/{mcpQueries-BFbulSUU.js → mcpQueries-BRFr-Gfm.js} +1 -1
- package/dist/assets/miniChat-C3vDY9WG.js +2 -0
- package/dist/assets/mobile-B2KYTY1c.js +2 -0
- package/dist/assets/{mobileBackNavigation-D3-dwiiY.js → mobileBackNavigation-ByUDCJde.js} +1 -1
- package/dist/assets/{multirun-CEyNjbIS.js → multirun-F1yOJb2_.js} +1 -1
- package/dist/assets/{native-config-stLNU1o7.js → native-config-C2j59qnN.js} +1 -1
- package/dist/assets/{pl-BkPum7Gu.js → pl-B6C3vXqv.js} +1 -1
- package/dist/assets/{platform-h8km2dnF.js → platform-Dids8J9D.js} +1 -1
- package/dist/assets/projectMeta-C08trpZE.js +1 -0
- package/dist/assets/{pt-BR-DfT7YLHn.js → pt-BR-BUDTNopP.js} +1 -1
- package/dist/assets/pwa-C956NPB0.js +2 -0
- package/dist/assets/{queue-abort-optimistic-BZd3gflI.js → queue-abort-optimistic-CWyeG_sJ.js} +1 -1
- package/dist/assets/{readiness-Djew2NvN.js → readiness-CUPPcONt.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-DNK4YFG8.js +2 -0
- package/dist/assets/{renderMobileApp-D4aaygxO.js → renderMobileApp-DagPx3n0.js} +4 -4
- package/dist/assets/runtime-auth-Bh3htXtG.js +1 -0
- package/dist/assets/runtime-fetch-9B8F_rKW.js +1 -0
- package/dist/assets/{runtime-file-download-Bz4NbKDi.js → runtime-file-download-D4WGSMk-.js} +1 -1
- package/dist/assets/{runtime-file-resource-Btl3euLf.js → runtime-file-resource-tDTBpJT_.js} +1 -1
- package/dist/assets/{runtime-switch-DEZ1K7qW.js → runtime-switch-ibQIZnws.js} +1 -1
- package/dist/assets/{runtimeConfig-D4pEnoIh.js → runtimeConfig-D_McrwNd.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DvSz9Dmf.js → runtimeEndpointReset-D-aHzKPN.js} +6 -6
- package/dist/assets/{scheduledTaskNavigation-BhsMoXS3.js → scheduledTaskNavigation-C8tBjNoP.js} +1 -1
- package/dist/assets/{select-IPdYq29J.js → select-DoYUmvbX.js} +1 -1
- package/dist/assets/{sessionLookup-7Ux2A4fS.js → sessionLookup-D2JIMvDo.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-pQbSLRMg.js → sortable-tabs-strip-B-W7ADKC.js} +1 -1
- package/dist/assets/{speechSettingsQueries-Cl_-LtPL.js → speechSettingsQueries-CJqxaC2Q.js} +1 -1
- package/dist/assets/src-CzDk_0Pp.css +2 -0
- package/dist/assets/{store-BKKodkCp.js → store-Myt_Fv8d.js} +2 -2
- package/dist/assets/{terminalApi-D2kNkPrJ.js → terminalApi-BXf0a2VZ.js} +1 -1
- package/dist/assets/{textarea-DSOIfiVX.js → textarea-BCTNmuPZ.js} +1 -1
- package/dist/assets/{tooltip-BuZUnYeV.js → tooltip-D5Xeh6py.js} +1 -1
- package/dist/assets/types-DXSnGXVb.js +2 -0
- package/dist/assets/{uk-DgzBKB1K.js → uk-Ct9y1Y2t.js} +1 -1
- package/dist/assets/{useAppFontEffects-Cjtcc4Sq.js → useAppFontEffects-Blo2lGTo.js} +60 -60
- package/dist/assets/{useAssistantUIStore-Jmh6rESU.js → useAssistantUIStore-CVSFSgJV.js} +1 -1
- package/dist/assets/useDesktopWindowControlsLayout-YAxhtSDl.js +1 -0
- package/dist/assets/{useDictation-BafHajO_.js → useDictation-Dp2Y3X49.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-AQOtdYdf.js → useEffectiveDirectory-Uc8I6wXt.js} +1 -1
- package/dist/assets/{useFontPreferences-OCLG7Btz.js → useFontPreferences-DqBoLHp6.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-l2L-r3RJ.js → useMobileNavigationStore-SCjA_7jP.js} +8 -8
- package/dist/assets/{usePluginsStore-DaZr5OE_.js → usePluginsStore-DfksbEZx.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-C1Dm4frL.js → useStreamingTextThrottle-BY1Ynoj1.js} +1 -1
- package/dist/assets/{useUIStore-DPo791La.js → useUIStore-BsCfUWQw.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-DhJbTxdK.js → useWorkerHighlightedLines-DAxMD3fK.js} +1 -1
- package/dist/assets/{zh-CN-DTKScxtm.js → zh-CN-BegPizz4.js} +1 -1
- package/dist/assets/{zh-TW-JOn8l2o2.js → zh-TW-4xftqQQG.js} +1 -1
- package/dist/index.html +19 -19
- package/dist/mini-chat.html +19 -19
- package/dist/mobile.html +19 -19
- package/package.json +1 -1
- package/server/lib/relay/DOCUMENTATION.md +5 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +7 -0
- package/server/lib/ui-auth/ui-auth.test.js +25 -0
- package/dist/assets/AssistantView-9v8wufOH.js +0 -1
- package/dist/assets/MarkdownRenderer-C1KveBTm.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-DBWfVjRS.js +0 -3
- package/dist/assets/MobileTabPageHeader-BdZ4z7qY.js +0 -2
- package/dist/assets/ToolOutputDialog-BSNWZM5u.js +0 -10
- package/dist/assets/fileReferenceActions-DRECILCs.js +0 -1
- package/dist/assets/main-BVl-5tBj.js +0 -169
- package/dist/assets/miniChat-CD9Pz0ZW.js +0 -2
- package/dist/assets/mobile-B3bArIND.js +0 -2
- package/dist/assets/projectMeta-2FoNc0nP.js +0 -1
- package/dist/assets/pwa-CCJwn58X.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-DdvkzG1o.js +0 -2
- package/dist/assets/runtime-auth-DBn9yahL.js +0 -1
- package/dist/assets/runtime-fetch-D0YWp3FJ.js +0 -1
- package/dist/assets/src-BHDTEDdR.css +0 -2
- package/dist/assets/types-DAssRFbW.js +0 -2
- package/dist/assets/useDesktopWindowControlsLayout-BJx2ijlY.js +0 -1
package/dist/mobile.html
CHANGED
|
@@ -64,40 +64,40 @@
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<style>.dark #mobile-startup-logo img { filter: invert(1); }</style>
|
|
67
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
67
|
+
<script type="module" crossorigin src="/assets/mobile-B2KYTY1c.js"></script>
|
|
68
68
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-
|
|
69
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-auth-Bh3htXtG.js">
|
|
70
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-switch-ibQIZnws.js">
|
|
71
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-fetch-9B8F_rKW.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="/assets/path-utils-HRmerlyU.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/desktop-
|
|
74
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-
|
|
75
|
-
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/desktop-Brp3xDpd.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopHosts-qQ2Rz26_.js">
|
|
75
|
+
<link rel="modulepreload" crossorigin href="/assets/desktopRelayRestore-DifJHAur.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/assets/vendor-base-ui-CzHs0bHY.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-vDaAPGfl.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-effect-X1Hqc7ba.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-cQ47ywrT.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-migration-Bhz6UOBJ.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/brand-storage-bootstrap-D4BW3w-M.js">
|
|
82
|
-
<link rel="modulepreload" crossorigin href="/assets/useUIStore-
|
|
82
|
+
<link rel="modulepreload" crossorigin href="/assets/useUIStore-BsCfUWQw.js">
|
|
83
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DlzBev0S.js">
|
|
84
84
|
<link rel="modulepreload" crossorigin href="/assets/vendor-pathe-vBmvQE8f.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-query-core-Y_YoRHtC.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="/assets/vendor-tanstack-react-query-B-Wpqq5J.js">
|
|
87
|
-
<link rel="modulepreload" crossorigin href="/assets/fileQueries-
|
|
87
|
+
<link rel="modulepreload" crossorigin href="/assets/fileQueries-BaEKb7SZ.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="/assets/runtime-file-store-BVRgEtI-.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="/assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js">
|
|
90
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-
|
|
91
|
-
<link rel="modulepreload" crossorigin href="/assets/platform-
|
|
90
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-resource-tDTBpJT_.js">
|
|
91
|
+
<link rel="modulepreload" crossorigin href="/assets/platform-Dids8J9D.js">
|
|
92
92
|
<link rel="modulepreload" crossorigin href="/assets/runtime-ead7P81A.js">
|
|
93
|
-
<link rel="modulepreload" crossorigin href="/assets/bootstrap-
|
|
94
|
-
<link rel="modulepreload" crossorigin href="/assets/terminalApi-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="/assets/types-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="/assets/native-config-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-
|
|
100
|
-
<link rel="stylesheet" crossorigin href="/assets/src-
|
|
93
|
+
<link rel="modulepreload" crossorigin href="/assets/bootstrap-BzeQds0D.js">
|
|
94
|
+
<link rel="modulepreload" crossorigin href="/assets/terminalApi-BXf0a2VZ.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="/assets/runtime-file-download-D4WGSMk-.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="/assets/types-DXSnGXVb.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="/assets/capgoAdapter-DceVw3SM.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="/assets/native-config-C2j59qnN.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="/assets/runtimeConfig-D_McrwNd.js">
|
|
100
|
+
<link rel="stylesheet" crossorigin href="/assets/src-CzDk_0Pp.css">
|
|
101
101
|
</head>
|
|
102
102
|
<body class="h-full bg-background text-foreground">
|
|
103
103
|
<div id="root" class="h-full">
|
package/package.json
CHANGED
|
@@ -42,6 +42,11 @@ Client side (`packages/ui/src/lib/relay/`):
|
|
|
42
42
|
- `crypto.ts`, `handshake.ts` — the E2EE primitives and handshake state machines (initiator + responder).
|
|
43
43
|
- `tunnel-codec.ts` — Layer 3 frame codec, fragmentation, and outbound frame batching.
|
|
44
44
|
- `tunnel-client.ts` — the client tunnel: exposes a `fetch()`-compatible and a WebSocket-compatible surface backed by the encrypted tunnel. Transient closures (including `4029` capacity/pending timeout and replacement) retry indefinitely at a fixed 3-second foreground cadence, or 60 seconds while hidden/offline. Online, visibility-visible and system-resume interrupt retry waits; an apparently connected tunnel is probed immediately. Authentication rejection stays terminal and later requests fail explicitly rather than waiting forever. Keepalive tracks send and receive separately: outbound requests cannot conceal a dead return path, and inbound-only SSE still sends pings so the Host idle reaper does not evict a healthy client. Reset fails every old stream; retries never replay mutation requests automatically.
|
|
45
|
+
Terminal socket authentication rejection additionally sets
|
|
46
|
+
`failureCode: 'relay_authentication_rejected'` for desktop recovery. Consumers
|
|
47
|
+
must not infer pairing revocation from that transport error or from an arbitrary
|
|
48
|
+
error string. Pairing rejection is confirmed by the Host's `/auth/session`
|
|
49
|
+
response through the active tunnel; neither condition requires a UI password.
|
|
45
50
|
- `tunnel-payloads.ts`, `runtime-tunnel.ts`, `runtime-socket.ts` — payload helpers, the active-tunnel singleton, and the shared "open a runtime WebSocket the right way" helper.
|
|
46
51
|
|
|
47
52
|
Relay is not a separate link format: it is one transport candidate inside the unified **pairing v2** payload (`packages/ui/src/lib/connectionPayload.ts`). A relay candidate is `{ type: 'relay', relayUrl, serverId, hostEncPubJwk }` — no embedded token; the client redeems the one-time pairing secret over the tunnel like any other candidate.
|
|
@@ -5,6 +5,13 @@ This module owns Yuri UI authentication for browser access, including password s
|
|
|
5
5
|
|
|
6
6
|
Trusted-device access has one durable credential model: a remote client bearer token stored by `packages/web/server/lib/client-auth/remote-clients.js`. Password, passkey, and Pairing v2 are issuance methods for that credential, not separate credential systems. Issued client tokens are returned once, stored server-side only as hashes, and are later authenticated via `Authorization: Bearer yuri_client_...`.
|
|
7
7
|
|
|
8
|
+
An expired UI session cookie does not invalidate a current client bearer. Both
|
|
9
|
+
`requireAuth` and `/auth/session` accept that client independently, including
|
|
10
|
+
SSH-issued and paired credentials. UI-session-only routes retain their separate
|
|
11
|
+
gate. Clients must recheck `/auth/session` before interpreting a feature API's
|
|
12
|
+
401/403 as a UI logout; Relay pairing admission failure and Relay socket routing
|
|
13
|
+
authentication failure are distinct from UI password expiry.
|
|
14
|
+
|
|
8
15
|
Relay admission additionally requires an active client record with `usesRelay: true`, `authMethod: 'pairing'`, and a pairing ID. `authorizeRelayRequest` enforces this before the tunnel forwards any HTTP/SSE request or WebSocket upgrade, including when the Host has no UI password. SSH/password/passkey credentials, owner cookies, and direct-only pairings do not grant Relay access. URL tokens resolve back to their issuing client and recheck current revocation/expiry and Relay permission. The only pre-credential route is `POST /api/client-auth/pairing/redeem`; its one-time secret validation also requires a Relay-enabled pairing when arriving through Relay. Direct authentication behavior is unchanged.
|
|
9
16
|
|
|
10
17
|
Pairing v2 is implemented by `packages/web/server/lib/client-auth/pairing.js`. It stores short-lived one-time pairing sessions with hashed secrets, exposes create/cancel/redeem routes under `/api/client-auth/pairing/*`, and redeems a valid pairing secret into the same remote client token used by password/passkey trusted-device flows.
|
|
@@ -69,6 +69,31 @@ describe('isUrlAuthWebSocketPath', () => {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
describe('ui auth client credential seam', () => {
|
|
72
|
+
for (const authMethod of ['password', 'pairing']) {
|
|
73
|
+
it(`an expired UI cookie does not block a valid ${authMethod} client credential`, async () => {
|
|
74
|
+
const createUiAuth = await loadCreateUiAuth();
|
|
75
|
+
let valid = true;
|
|
76
|
+
const auth = createUiAuth({ password: 'secret', clientAuthController: {
|
|
77
|
+
authenticateBearerToken: async (token) => valid && token === 'client-token'
|
|
78
|
+
? { ok: true, clientId: 'device', client: { id: 'device', authMethod } } : null,
|
|
79
|
+
} });
|
|
80
|
+
const req = { method: 'GET', path: '/api/session', headers: {
|
|
81
|
+
authorization: 'Bearer client-token', cookie: 'yuri_ui_session=expired', accept: 'application/json',
|
|
82
|
+
} };
|
|
83
|
+
try {
|
|
84
|
+
const res = createResponse();
|
|
85
|
+
let admitted = false;
|
|
86
|
+
await auth.requireAuth(req, res, () => { admitted = true; });
|
|
87
|
+
expect(admitted).toBe(true);
|
|
88
|
+
await auth.handleSessionStatus(req, res);
|
|
89
|
+
expect(res.body).toEqual({ authenticated: true, scope: 'client' });
|
|
90
|
+
valid = false;
|
|
91
|
+
const revoked = createResponse();
|
|
92
|
+
await auth.handleSessionStatus(req, revoked);
|
|
93
|
+
expect(revoked.statusCode).toBe(401);
|
|
94
|
+
} finally { auth.dispose(); }
|
|
95
|
+
});
|
|
96
|
+
}
|
|
72
97
|
for (const password of ['', 'secret']) {
|
|
73
98
|
it(`relay requires a current relay pairing grant for bearer and URL credentials (password=${Boolean(password)})`, async () => {
|
|
74
99
|
const createUiAuth = await loadCreateUiAuth();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-hePW80VL.js";import{c as n,w as r}from"./runtime-auth-DBn9yahL.js";import{c as i,i as a,t as o}from"./runtime-switch-DEZ1K7qW.js";import{n as s,y as c}from"./desktop-DLxQTjzu.js";import{ot as l,st as u}from"./vendor-base-ui-CzHs0bHY.js";import{r as d}from"./useUIStore-DPo791La.js";import{n as f}from"./vendor-react-DlzBev0S.js";import{n as p}from"./vendor-tanstack-react-query-B-Wpqq5J.js";import{r as m}from"./vendor-sonner-BEHGipm5.js";import{r as h}from"./vendor-reactuses-core-CuTmqEMK.js";import{Jn as g,Kn as _,Va as v}from"./useMobileNavigationStore-l2L-r3RJ.js";import{i as y}from"./MobileShareBridge-BJDkko0y.js";import{a as b,h as x,l as S,m as C,s as w,t as T,v as E}from"./MobileDetailNavigation-D6pHFCLd.js";import{i as D,r as O}from"./useAssistantUIStore-Jmh6rESU.js";import{n as k}from"./Icon-3udlHlix.js";import{a as A,i as ee,n as te,o as ne,r as j,t as M}from"./dialog-So-nuji1.js";import{r as re}from"./device-BGox1QjM.js";import{E as ie}from"./sessionLookup-7Ux2A4fS.js";import{a as ae,i as oe,n as se,t as ce}from"./AssistantContactStatus-DBUeAOcC.js";import{n as N,r as le}from"./AssistantUnreadBadge-uMPRfRqu.js";import{a as P,i as ue,n as de,r as F,t as I}from"./context-menu-BHe5nbZ0.js";var L=t(u(),1),R=f(),fe=()=>s()&&!r(),pe=async e=>{if(!fe())throw Error(`Assistant Mini Chat requires a direct desktop connection`);await c(`desktop_open_assistant_mini_chat_window`,{assistantID:e,apiBaseUrl:o(),clientToken:n()})},z=l();function B(e){let t=(0,R.c)(41),{assistant:n,trigger:r,onEdit:i,onDelete:o}=e,{t:s}=v(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=a(),t[0]=c):c=t[0];let l;t[1]===n.id?l=t[2]:(l=[c,`assistants`,n.id,`pin`],t[1]=n.id,t[2]=l);let u;t[3]===n?u=t[4]:(u=()=>C(n,{pinned:n.pinnedAt==null}),t[3]=n,t[4]=u);let d;t[5]===s?d=t[6]:(d=()=>m.error(s(`assistants.menu.pinError`)),t[5]=s,t[6]=d);let f;t[7]!==l||t[8]!==u||t[9]!==d?(f={mutationKey:l,mutationFn:u,onError:d},t[7]=l,t[8]=u,t[9]=d,t[10]=f):f=t[10];let h=p(f),g;t[11]===r?g=t[12]:(g=(0,z.jsx)(P,{render:r}),t[11]=r,t[12]=g);let _;t[13]!==n.pinnedAt||t[14]!==h||t[15]!==s?(_=n.pinnedAt===void 0?null:(0,z.jsxs)(F,{disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,z.jsx)(k,{name:n.pinnedAt==null?`pushpin-2`:`unpin`,className:`size-4`}),s(n.pinnedAt==null?`assistants.menu.pin`:`assistants.menu.unpin`)]}),t[13]=n.pinnedAt,t[14]=h,t[15]=s,t[16]=_):_=t[16];let y;t[17]!==n.id||t[18]!==s?(y=fe()?(0,z.jsxs)(F,{onClick:()=>{pe(n.id).catch(()=>m.error(s(`miniChat.actions.failed`)))},children:[(0,z.jsx)(k,{name:`external-link`,className:`size-4`}),s(`sessions.sidebar.session.menu.openMiniChatWindow`)]}):null,t[17]=n.id,t[18]=s,t[19]=y):y=t[19];let b;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,z.jsx)(k,{name:`edit`,className:`size-4`}),t[20]=b):b=t[20];let x;t[21]===s?x=t[22]:(x=s(`assistants.menu.edit`),t[21]=s,t[22]=x);let S;t[23]!==i||t[24]!==x?(S=(0,z.jsxs)(F,{onClick:i,children:[b,x]}),t[23]=i,t[24]=x,t[25]=S):S=t[25];let w;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,z.jsx)(ue,{}),t[26]=w):w=t[26];let T;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,z.jsx)(k,{name:`delete-bin`,className:`size-4`}),t[27]=T):T=t[27];let E;t[28]===s?E=t[29]:(E=s(`assistants.settings.delete`),t[28]=s,t[29]=E);let D;t[30]!==o||t[31]!==E?(D=(0,z.jsxs)(F,{onClick:o,className:`text-[var(--status-error)] focus:text-[var(--status-error)] data-[highlighted]:text-[var(--status-error)] [&_svg]:text-[var(--status-error)]`,children:[T,E]}),t[30]=o,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==S||t[34]!==D||t[35]!==_||t[36]!==y?(O=(0,z.jsxs)(de,{className:`min-w-[10rem]`,children:[_,y,S,w,D]}),t[33]=S,t[34]=D,t[35]=_,t[36]=y,t[37]=O):O=t[37];let A;return t[38]!==O||t[39]!==g?(A=(0,z.jsxs)(I,{children:[g,O]}),t[38]=O,t[39]=g,t[40]=A):A=t[40],A}function V(e){let t=(0,R.c)(38),{assistant:n,selected:r,onSelect:i,onEdit:a,onDelete:o}=e,s=L.useRef(null),c=ae(n.id,n.working),l;t[0]===n.name?l=t[1]:(l=y(n.name).displayName||n.name,t[0]=n.name,t[1]=l);let u=l,d;t[2]!==n.id||t[3]!==a?(d=()=>a(n.id),t[2]=n.id,t[3]=a,t[4]=d):d=t[4];let f;t[5]!==n||t[6]!==o?(f=()=>o(n),t[5]=n,t[6]=o,t[7]=f):f=t[7];let p=n.id,m;t[8]!==n.id||t[9]!==i?(m=()=>i(n.id),t[8]=n.id,t[9]=i,t[10]=m):m=t[10];let h=r?`bg-[var(--surface-muted)]`:`hover:bg-interactive-hover`,_;t[11]===h?_=t[12]:(_=g(`flex w-full min-w-0 max-w-28 flex-col items-center gap-2 rounded-2xl px-2 py-3 text-center outline-none transition-colors focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] active:bg-interactive-active motion-reduce:transition-none`,h),t[11]=h,t[12]=_);let v;t[13]!==n.avatarSeed||t[14]!==n.id||t[15]!==u||t[16]!==c?(v=(0,z.jsx)(oe,{name:n.id,avatarSeed:n.avatarSeed,size:64,label:u,working:c,hoverTarget:s}),t[13]=n.avatarSeed,t[14]=n.id,t[15]=u,t[16]=c,t[17]=v):v=t[17];let b=n.unreadCount??0,x;t[18]===b?x=t[19]:(x=(0,z.jsx)(N,{count:b,className:`absolute -right-1 -top-1`}),t[18]=b,t[19]=x);let S;t[20]!==x||t[21]!==v?(S=(0,z.jsxs)(`span`,{className:`relative`,children:[v,x]}),t[20]=x,t[21]=v,t[22]=S):S=t[22];let C;t[23]===u?C=t[24]:(C=(0,z.jsx)(`span`,{className:`w-full truncate typography-ui-label font-medium leading-5`,children:u}),t[23]=u,t[24]=C);let w;t[25]!==n.id||t[26]!==u||t[27]!==r||t[28]!==S||t[29]!==C||t[30]!==m||t[31]!==_?(w=(0,z.jsxs)(`button`,{ref:s,type:`button`,role:`option`,"aria-selected":r,title:u,"data-assistant-pinned":p,"data-mobile-press-feedback":`soft`,onClick:m,className:_,children:[S,C]}),t[25]=n.id,t[26]=u,t[27]=r,t[28]=S,t[29]=C,t[30]=m,t[31]=_,t[32]=w):w=t[32];let T;return t[33]!==n||t[34]!==w||t[35]!==d||t[36]!==f?(T=(0,z.jsx)(B,{assistant:n,onEdit:d,onDelete:f,trigger:w}),t[33]=n,t[34]=w,t[35]=d,t[36]=f,t[37]=T):T=t[37],T}function me(e){let t=(0,R.c)(16),{contacts:n,selectedAssistantID:r,onSelect:i,onEdit:a,onDelete:o}=e,{t:s}=v();if(n.length===0)return null;let c;t[0]===s?c=t[1]:(c=s(`assistants.list.pinned`),t[0]=s,t[1]=c);let l;if(t[2]!==n||t[3]!==o||t[4]!==a||t[5]!==i||t[6]!==r){let e;t[8]!==o||t[9]!==a||t[10]!==i||t[11]!==r?(e=e=>(0,z.jsx)(V,{assistant:e,selected:e.id===r,onSelect:i,onEdit:a,onDelete:o},e.id),t[8]=o,t[9]=a,t[10]=i,t[11]=r,t[12]=e):e=t[12],l=n.map(e),t[2]=n,t[3]=o,t[4]=a,t[5]=i,t[6]=r,t[7]=l}else l=t[7];let u;return t[13]!==c||t[14]!==l?(u=(0,z.jsx)(`div`,{role:`group`,"aria-label":c,className:`yuri-assistant-pinned-contacts grid grid-cols-1 justify-items-center gap-2 pb-3 pt-2`,children:l}),t[13]=c,t[14]=l,t[15]=u):u=t[15],u}function he({snapshot:e,rowClassName:t,compact:n=!1,mobile:r=!1}){let{t:i}=v(),[a,o]=L.useState(!1),s=L.useRef(!1),c=h(async()=>{if(!s.current){s.current=!0,o(!0);try{(await S(e)).failed&&m.error(i(`assistants.unread.markAllFailed`))}catch{m.error(i(`assistants.unread.markAllFailed`))}finally{s.current=!1,o(!1)}}}),l=e.assistants.some(e=>(e.unreadCount??0)>0);return!n&&!l?null:(0,z.jsx)(`div`,{className:t,style:n&&!l?{visibility:`hidden`}:void 0,children:(0,z.jsx)(_,{type:`button`,variant:r?`mobileGlass`:`ghost`,size:r?`mobileIcon`:`icon`,onClick:c,"aria-label":i(`assistants.unread.markAll`),title:i(`assistants.unread.markAll`),disabled:a||!e.assistants.some(e=>(e.unreadCount??0)>0&&e.readTip),"aria-busy":a,children:(0,z.jsx)(k,{name:`check-double`,className:r?`size-5`:`size-4`})})})}async function H(e){await b(e);let t=D.getState().defaultShareAssistant;if(t?.assistantID!==e.id)return;let n=await w();n.serverInstanceID&&t.serverInstanceID===n.serverInstanceID&&D.getState().setDefaultShareAssistant(null)}function ge({assistant:e,open:t,onOpenChange:n,onDeleted:r}){let{t:i}=v(),[a,o]=L.useState(!1),s=e?y(e.name).displayName||e.name:``,c=h(e=>{a&&!e||n(e)}),l=h(()=>{a||n(!1)}),u=h(async()=>{if(!(!e||a)){o(!0);try{await H(e),r?.(e.id),n(!1),m.success(i(`assistants.settings.toast.deleted`))}catch{m.error(i(`assistants.settings.toast.deleteFailed`))}finally{o(!1)}}});return(0,z.jsx)(M,{open:t&&e!==null,onOpenChange:c,children:(0,z.jsxs)(te,{className:`max-w-md`,children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(ne,{children:i(`assistants.settings.delete`)}),(0,z.jsx)(j,{children:i(`assistants.settings.deleteConfirm`,{name:s})})]}),(0,z.jsxs)(ee,{children:[(0,z.jsx)(_,{size:`sm`,variant:`ghost`,onClick:l,disabled:a,children:i(`settings.common.actions.cancel`)}),(0,z.jsx)(_,{size:`sm`,variant:`destructive`,onClick:u,disabled:a,children:i(`settings.common.actions.delete`)})]})]})})}var U=`block min-w-0 max-w-full truncate typography-micro text-muted-foreground`,W={image:`assistants.contact.attachment.image`,file:`assistants.contact.attachment.file`,session:`assistants.contact.card.session.untitled`,assistant:`assistants.title`,schedule:`assistants.settings.scheduledTasks.title`};function _e(e,t){return e?.text.replace(/\s+/gu,` `).trim()||t(e?.fallbackKind?W[e.fallbackKind]:`assistants.contact.empty`)}var ve=e=>e.capabilityPending?`loading`:e.capabilityError||e.supported!==!0||e.capabilityEnabled!==!0?`unavailable`:e.snapshotPending?`loading`:e.snapshotEnabled===!0?e.assistantCount===0?`onboarding`:e.hasAssistant?`ready`:e.snapshotSettled?`unavailable`:`loading`:`unavailable`,ye=e({AssistantView:()=>G}),be=e=>{let t=(0,R.c)(21),{assistant:n,onBack:r,onOpenSettings:i}=e,{t:a}=v(),o=ie(),s;t[0]===n?s=t[1]:(s=n?y(n.name):null,t[0]=n,t[1]=s);let c=s,l=n&&c?c.displayName||n.name:``,u;t[2]!==n||t[3]!==o||t[4]!==i?(u=()=>{if(n){if(i){i(n.id);return}O(n.id,o?{openMobileSettings:o.openSettings}:void 0)}},t[2]=n,t[3]=o,t[4]=i,t[5]=u):u=t[5];let d=h(u),f;t[6]!==n||t[7]!==l||t[8]!==a?(f=n?(0,z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2.5`,children:[(0,z.jsx)(oe,{name:n.id,avatarSeed:n.avatarSeed,size:40,label:l,working:!!(n.working||n.activeContactTurn),showWorkingDot:!1}),(0,z.jsxs)(`span`,{className:`min-w-0`,children:[(0,z.jsx)(`span`,{className:`block truncate font-medium leading-5 tracking-[-0.01em]`,children:l||a(`assistants.title`)}),(0,z.jsx)(ce,{assistantID:n.id,serverWorking:!!(n.working||n.activeContactTurn),lastContactAt:n.latestMessagePreview?.createdAt})]})]}):l||a(`assistants.title`),t[6]=n,t[7]=l,t[8]=a,t[9]=f):f=t[9];let p;t[10]===a?p=t[11]:(p=a(`assistants.actions.backToChat`),t[10]=a,t[11]=p);let m;t[12]!==n||t[13]!==d||t[14]!==a?(m=n?[{icon:`settings-3`,ariaLabel:a(`assistants.conversation.openSettings`),onClick:d}]:[],t[12]=n,t[13]=d,t[14]=a,t[15]=m):m=t[15];let g;return t[16]!==r||t[17]!==f||t[18]!==p||t[19]!==m?(g=(0,z.jsx)(T,{title:f,backAriaLabel:p,onBack:r,actions:m,overlay:!0}),t[16]=r,t[17]=f,t[18]=p,t[19]=m,t[20]=g):g=t[20],g},xe=e=>{let t=(0,R.c)(34),{assistant:n,avatarSeed:r,unreadCount:i,summary:a,assistantID:o,displayName:s,selected:c,onSelect:l,onEdit:u,onDelete:d,serverWorking:f}=e,p=ae(o,f!==void 0&&f),m=L.useRef(null),_;t[0]===l?_=t[1]:(_=()=>l(),t[0]=l,t[1]=_);let v=h(_),y=c?`border-border/50 bg-[var(--surface-elevated)]`:`border-transparent hover:bg-interactive-hover`,b;t[2]===y?b=t[3]:(b=g(`flex w-full min-h-11 items-center gap-3 rounded-xl border px-3 py-3 text-left outline-none transition-[background-color,border-color,opacity] duration-150 ease-out active:bg-interactive-active focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] motion-reduce:transition-none`,y),t[2]=y,t[3]=b);let x;t[4]!==o||t[5]!==r||t[6]!==s||t[7]!==p?(x=(0,z.jsx)(oe,{name:o,avatarSeed:r,size:44,label:s,working:p,hoverTarget:m}),t[4]=o,t[5]=r,t[6]=s,t[7]=p,t[8]=x):x=t[8];let S=c?`font-semibold`:`font-medium`,C;t[9]===S?C=t[10]:(C=g(`block truncate typography-ui-label leading-5`,S),t[9]=S,t[10]=C);let w;t[11]!==s||t[12]!==C?(w=(0,z.jsx)(`span`,{className:C,children:s}),t[11]=s,t[12]=C,t[13]=w):w=t[13];let T;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(T=g(U,`mt-1 text-[length:calc(var(--text-micro)*0.9)] leading-5`),t[14]=T):T=t[14];let E;t[15]===a?E=t[16]:(E=(0,z.jsx)(`span`,{className:T,children:a}),t[15]=a,t[16]=E);let D;t[17]!==E||t[18]!==w?(D=(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[w,E]}),t[17]=E,t[18]=w,t[19]=D):D=t[19];let O;t[20]===i?O=t[21]:(O=(0,z.jsx)(N,{count:i,className:`h-3.5 min-w-3.5 bg-[oklch(from_var(--primary-base)_calc(l_*_0.78)_c_h)] px-1 text-[10px] text-[var(--color-white)] shadow-none`}),t[20]=i,t[21]=O);let k;t[22]!==v||t[23]!==c||t[24]!==D||t[25]!==O||t[26]!==b||t[27]!==x?(k=(0,z.jsxs)(`button`,{ref:m,type:`button`,role:`option`,"aria-selected":c,onClick:v,className:b,children:[x,D,O]}),t[22]=v,t[23]=c,t[24]=D,t[25]=O,t[26]=b,t[27]=x,t[28]=k):k=t[28];let A;return t[29]!==n||t[30]!==d||t[31]!==u||t[32]!==k?(A=(0,z.jsx)(B,{assistant:n,onEdit:u,onDelete:d,trigger:k}),t[29]=n,t[30]=d,t[31]=u,t[32]=k,t[33]=A):A=t[33],A},G=e=>{let t=(0,R.c)(117),{activeOverride:n,onMobileBack:r,onMobileOpenSettings:o}=e,{t:s}=v(),{isMobile:c}=re(),l=ie(),u=L.useSyncExternalStore(i,a,a),f=d(Se),p=n??f,b=d(Ce),S=c||b,C=x(),w=E(),T=w.data;T?.assistants;let A;t[0]===T?.assistants?A=t[1]:(A=T?.assistants??[],t[0]=T?.assistants,t[1]=A);let ee;t[2]===A?ee=t[3]:(ee=le(A),t[2]=A,t[3]=ee);let te=ee,ne;t[4]===u?ne=t[5]:(ne=e=>e.assistantByTransport[u]??null,t[4]=u,t[5]=ne);let j=D(ne),M=D(we),ae=D(Te),N;t[6]!==j||t[7]!==T?.assistants?(N=T?.assistants.find(e=>e.id===j)??null,t[6]=j,t[7]=T?.assistants,t[8]=N):N=t[8];let P=N,ue;t[9]!==M||t[10]!==j||t[11]!==T?(ue=()=>{!j&&T?.assistants[0]&&M(T.assistants[0].id)},t[9]=M,t[10]=j,t[11]=T,t[12]=ue):ue=t[12];let de=T?.assistants,F;t[13]!==M||t[14]!==j||t[15]!==de?(F=[M,j,de],t[13]=M,t[14]=j,t[15]=de,t[16]=F):F=t[16],L.useEffect(ue,F);let I;t[17]!==P||t[18]!==M||t[19]!==j||t[20]!==T?.assistants||t[21]!==w.isSuccess?(I=()=>{w.isSuccess&&j&&!P&&M(T?.assistants[0]?.id??null)},t[17]=P,t[18]=M,t[19]=j,t[20]=T?.assistants,t[21]=w.isSuccess,t[22]=I):I=t[22];let B=T?.assistants,V;t[23]!==P||t[24]!==M||t[25]!==j||t[26]!==w.isSuccess||t[27]!==B?(V=[P,M,j,B,w.isSuccess],t[23]=P,t[24]=M,t[25]=j,t[26]=w.isSuccess,t[27]=B,t[28]=V):V=t[28],L.useEffect(I,V);let H;t[29]!==l||t[30]!==ae?(H=()=>{if(ae(),l){l.openSettings();return}let e=d.getState();e.setSettingsPage(`assistants`),e.setSettingsDialogOpen(!0)},t[29]=l,t[30]=ae,t[31]=H):H=t[31];let U=h(H),W;t[32]===l?W=t[33]:(W=e=>{O(e,l?{openMobileSettings:l.openSettings}:void 0)},t[32]=l,t[33]=W);let ye=h(W),G;t[34]!==P||t[35]!==l?(G=()=>{P&&O(P.id,l?{openMobileSettings:l.openSettings}:void 0)},t[34]=P,t[35]=l,t[36]=G):G=t[36];let De=h(G),[Oe,ke]=L.useState(null),Ae;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>{ke(e)},t[37]=Ae):Ae=t[37];let je=h(Ae),Me;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{e||ke(null)},t[38]=Me):Me=t[38];let Ne=h(Me),Pe=h(Ee),Fe;t[39]!==r||t[40]!==Pe?(Fe=()=>{if(r){r();return}Pe()},t[39]=r,t[40]=Pe,t[41]=Fe):Fe=t[41];let K=h(Fe),Ie=ve({capabilityPending:C.isPending,snapshotPending:w.isPending,capabilityError:C.isError,supported:C.data?.supported,capabilityEnabled:C.data?.enabled,snapshotEnabled:T?.enabled,snapshotSettled:w.isSuccess,assistantCount:T?.assistants.length??0,hasAssistant:!!P}),Le;t[42]!==P||t[43]!==K||t[44]!==S||t[45]!==o?(Le=(e,t,n,r)=>(0,z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):null,(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,children:[(0,z.jsx)(k,{name:e,className:`size-6 text-muted-foreground`}),(0,z.jsx)(`h1`,{className:`mt-4 typography-ui-header font-semibold`,children:t}),n?(0,z.jsx)(`p`,{className:`mt-2 max-w-md typography-ui text-muted-foreground`,children:n}):null,r?(0,z.jsx)(`div`,{className:`mt-5`,children:r}):null]})]}),t[42]=P,t[43]=K,t[44]=S,t[45]=o,t[46]=Le):Le=t[46];let q=Le;if(Ie===`loading`){let e;t[47]!==P||t[48]!==K||t[49]!==S||t[50]!==o?(e=S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):null,t[47]=P,t[48]=K,t[49]=S,t[50]=o,t[51]=e):e=t[51];let n;t[52]===s?n=t[53]:(n=s(`common.loading`),t[52]=s,t[53]=n);let r;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,z.jsx)(k,{name:`loader-4`,className:`size-6 animate-spin text-muted-foreground`}),t[54]=r):r=t[54];let i;t[55]===n?i=t[56]:(i=(0,z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 pt-[calc(max(0.25rem,var(--yuri-safe-area-top,0px))+var(--yuri-mobile-detail-navigation-height,3.5rem))] text-center`,"aria-busy":`true`,"aria-label":n,"data-assistant-workspace-loading":``,children:r}),t[55]=n,t[56]=i);let a;return t[57]!==e||t[58]!==i?(a=(0,z.jsxs)(`div`,{className:`relative flex h-full min-h-0 flex-col`,children:[e,i]}),t[57]=e,t[58]=i,t[59]=a):a=t[59],a}if(Ie===`unavailable`){let e;return t[60]!==q||t[61]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[60]=q,t[61]=s,t[62]=e):e=t[62],e}if(Ie===`onboarding`){let e;if(t[63]!==U||t[64]!==q||t[65]!==s){let n=s(`assistants.onboarding.title`),r=s(`assistants.onboarding.description`),i;t[67]===s?i=t[68]:(i=s(`assistants.onboarding.action`),t[67]=s,t[68]=i);let a;t[69]!==U||t[70]!==i?(a=(0,z.jsx)(_,{onClick:U,children:i}),t[69]=U,t[70]=i,t[71]=a):a=t[71],e=q(`ai-agent`,n,r,a),t[63]=U,t[64]=q,t[65]=s,t[66]=e}else e=t[66];return e}if(!T||!P){let e;return t[72]!==q||t[73]!==s?(e=q(`cloud-off`,s(`assistants.state.unavailable`)),t[72]=q,t[73]=s,t[74]=e):e=t[74],e}let Re;t[75]===P.name?Re=t[76]:(Re=y(P.name),t[75]=P.name,t[76]=Re);let ze=Re,Be;t[77]!==w.isError||t[78]!==s?(Be=w.isError?s(`assistants.state.staleSnapshot`):null,t[77]=w.isError,t[78]=s,t[79]=Be):Be=t[79];let Ve=Be,J;t[80]!==te||t[81]!==S||t[82]!==U||t[83]!==ye||t[84]!==je||t[85]!==M||t[86]!==j||t[87]!==T||t[88]!==s?(J=S?null:(0,z.jsxs)(`section`,{className:`flex h-full min-h-0 w-[clamp(16rem,22vw,20rem)] shrink-0 flex-col overflow-hidden`,children:[(0,z.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 px-4 pb-1 pt-4 sm:px-5`,children:[(0,z.jsx)(`h1`,{className:`min-w-0 truncate typography-ui-label font-semibold text-foreground`,children:s(`assistants.title`)}),(0,z.jsx)(he,{snapshot:T,compact:!0,rowClassName:`flex min-w-0 flex-1 justify-end`}),(0,z.jsx)(_,{type:`button`,variant:`mobileGlass`,size:`mobileIcon`,className:`size-8 min-h-0 min-w-0 !shadow-[0_0_0_0.5px_rgb(0_0_0/0.08),0_1px_2px_rgb(0_0_0/0.05)] dark:!shadow-[var(--yuri-mobile-glass-shadow)]`,"aria-label":s(`assistants.settings.create`),onClick:U,children:(0,z.jsx)(k,{name:`add`,className:`size-4`})})]}),(0,z.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 sm:px-4`,role:`listbox`,"aria-label":s(`assistants.listAria`),children:[(0,z.jsx)(me,{contacts:te.pinned,selectedAssistantID:j,onSelect:M,onEdit:ye,onDelete:je}),(0,z.jsx)(`div`,{className:`flex flex-col gap-1 pt-1`,children:te.unpinned.map(e=>{let t=e.id===j,n=y(e.name);return(0,z.jsx)(xe,{assistant:e,assistantID:e.id,avatarSeed:e.avatarSeed,unreadCount:e.unreadCount??0,summary:_e(e.latestMessagePreview,s),displayName:n.displayName,selected:t,assignedSessionIDs:e.assignedSessionIDs,serverWorking:e.working,onSelect:()=>M(e.id),onEdit:()=>ye(e.id),onDelete:()=>je(e)},e.id)})})]})]}),t[80]=te,t[81]=S,t[82]=U,t[83]=ye,t[84]=je,t[85]=M,t[86]=j,t[87]=T,t[88]=s,t[89]=J):J=t[89];let He=Oe!==null,Y;t[90]!==Oe||t[91]!==Ne||t[92]!==He?(Y=(0,z.jsx)(ge,{assistant:Oe,open:He,onOpenChange:Ne}),t[90]=Oe,t[91]=Ne,t[92]=He,t[93]=Y):Y=t[93];let Ue=!S&&`border-l border-[var(--surface-subtle)]`,X;t[94]===Ue?X=t[95]:(X=g(`relative flex min-h-0 min-w-0 flex-1 flex-col overflow-clip bg-background`,Ue),t[94]=Ue,t[95]=X);let Z;t[96]!==P||t[97]!==K||t[98]!==S||t[99]!==o||t[100]!==De||t[101]!==ze||t[102]!==s?(Z=S?(0,z.jsx)(be,{assistant:P,onBack:K,onOpenSettings:o}):(0,z.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-3.5 border-b border-[var(--surface-subtle)]/70 px-5 sm:px-7`,children:[(0,z.jsx)(oe,{name:P.id,avatarSeed:P.avatarSeed,size:40,label:ze.displayName||P.name,working:!!(P.working||P.activeContactTurn),showWorkingDot:!1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`div`,{className:`truncate typography-ui-label font-semibold leading-5 tracking-[-0.01em] text-foreground`,children:ze.displayName}),(0,z.jsx)(ce,{assistantID:P.id,serverWorking:!!(P.working||P.activeContactTurn),lastContactAt:P.latestMessagePreview?.createdAt})]}),fe()?(0,z.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`text-muted-foreground/65`,onClick:()=>{pe(P.id).catch(()=>m.error(s(`miniChat.actions.failed`)))},"aria-label":s(`sessions.sidebar.session.menu.openMiniChatWindow`),title:s(`sessions.sidebar.session.menu.openMiniChatWindow`),children:(0,z.jsx)(k,{name:`external-link`,className:`size-4`})}):null,(0,z.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 shrink-0 rounded-full text-muted-foreground/65 transition-colors hover:text-foreground`,onClick:De,"aria-label":s(`assistants.conversation.openSettings`),children:(0,z.jsx)(k,{name:`settings-3`,className:`size-4`})})]}),t[96]=P,t[97]=K,t[98]=S,t[99]=o,t[100]=De,t[101]=ze,t[102]=s,t[103]=Z):Z=t[103];let Q;t[104]!==p||t[105]!==P||t[106]!==S||t[107]!==Ve?(Q=(0,z.jsx)(se,{assistant:P,warning:Ve,active:p,overlayHeader:S}),t[104]=p,t[105]=P,t[106]=S,t[107]=Ve,t[108]=Q):Q=t[108];let $;t[109]!==X||t[110]!==Z||t[111]!==Q?($=(0,z.jsxs)(`div`,{className:X,children:[Z,Q]}),t[109]=X,t[110]=Z,t[111]=Q,t[112]=$):$=t[112];let We;return t[113]!==J||t[114]!==Y||t[115]!==$?(We=(0,z.jsxs)(`div`,{className:`relative flex h-full min-h-0 overflow-clip bg-background`,"data-presentation":`workspace`,children:[J,Y,$]}),t[113]=J,t[114]=Y,t[115]=$,t[116]=We):We=t[116],We};function Se(e){return e.activeMainTab===`assistant`}function Ce(e){return e.isMobile}function we(e){return e.selectAssistant}function Te(e){return e.requestCreate}function Ee(){d.getState().setActiveMainTab(`chat`)}export{ge as a,B as c,_e as i,ye as n,he as o,U as r,me as s,G as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkstreamRendererImpl-DBWfVjRS.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-base-ui-CzHs0bHY.js","assets/useUIStore-DPo791La.js","assets/runtime-switch-DEZ1K7qW.js","assets/runtime-auth-DBn9yahL.js","assets/vendor-zustand-vDaAPGfl.js","assets/brand-storage-bootstrap-D4BW3w-M.js","assets/brand-storage-migration-Bhz6UOBJ.js","assets/vendor-react-DlzBev0S.js","assets/fileQueries-BBcsALlC.js","assets/runtime-fetch-D0YWp3FJ.js","assets/vendor-tanstack-query-core-Y_YoRHtC.js","assets/vendor-tanstack-react-query-B-Wpqq5J.js","assets/platform-h8km2dnF.js","assets/desktop-DLxQTjzu.js","assets/path-utils-HRmerlyU.js","assets/vendor-pathe-vBmvQE8f.js","assets/vendor-markstream-react-6zxyQLCD.js","assets/vendor-aparajita-capacitor-secure-storage-xol_6BsB.js","assets/vendor-markstream-core-Cm34iPLL.js","assets/vendor-floating-ui-dom-BHhLtF5l.js","assets/vendor-floating-ui-core-Co1I1lFV.js","assets/vendor-reactuses-core-CuTmqEMK.js","assets/vendor-lodash-es-BS45jPoZ.js","assets/vendor-js-cookie-hSOiFTtX.js","assets/useMobileNavigationStore-l2L-r3RJ.js","assets/bootstrap-CH0Mo2ok.js","assets/vendor-opencode-client-cQ47ywrT.js","assets/vendor-effect-X1Hqc7ba.js","assets/runtime-file-resource-Btl3euLf.js","assets/runtime-file-store-BVRgEtI-.js","assets/runtime-ead7P81A.js","assets/vendor-sonner-BEHGipm5.js","assets/store-BKKodkCp.js","assets/tour-DDI0Zg7l.js","assets/useAssistantUIStore-Jmh6rESU.js","assets/vendor-zod-DZzbCm1s.js","assets/vendor-opencode-schema-DWT45VBX.js","assets/vendor-class-variance-authority-BLUaYARZ.js","assets/vendor-tailwind-merge-BicNWLTg.js","assets/useThemeSystem-CNzUUkFn.js","assets/vendor-framer-motion-DDMKlXiP.js","assets/tooltip-BuZUnYeV.js","assets/url-DO6Zrx1P.js","assets/useEffectiveDirectory-AQOtdYdf.js","assets/image-loading-2ppAWcFZ.js","assets/image-loading-D9Z_BASK.css","assets/LoadingImage-CzTb95Cn.js","assets/ImageLoadingPlaceholder-D2CKCkHe.js","assets/FadeInOnReveal-DlU4WRpc.js","assets/markdownHeightCache-DMZ5GgoP.js","assets/dualLimitLru-D8Sphgua.js","assets/useStreamingTextThrottle-C1Dm4frL.js","assets/MarkdownRendererImpl-Dfj5yBQH.js","assets/vendor-katex-DNVSTX6g.js","assets/themes-BgDJcxRc.js","assets/vendor-marked-S3gCOYp1.js","assets/markdownTheme-CHNl6tUv.js","assets/vendor-pierre-diffs-BFiZ3IhI.js","assets/vendor-hast-util-to-html-Bw_SgZ1t.js","assets/vendor-character-entities-legacy-Wut6vMuj.js","assets/vendor-character-entities-html4-DlN_yAFd.js","assets/vendor-ccount-CyGsA0u7.js","assets/vendor-comma-separated-tokens-B9ouxNNS.js","assets/vendor-oniguruma-to-es-CrHzjjSU.js","assets/vendor-oniguruma-parser-D2DIvhSP.js","assets/vendor-diff-Dq7CZNim.js","assets/vendor-lru_map-BMOrLc9L.js","assets/markdown-worker-oBGEB9Eg.js","assets/vendor-morphdom-BbKiNDAu.js","assets/vendor-dompurify-CeJNOzik.js","assets/vendor-pele-C1WTNWUm.js","assets/vendor-remend-C3cXc-tf.js","assets/fileReferenceActions-DRECILCs.js","assets/toolHelpers-iEHVHQ9p.js","assets/fileReferenceParser-BayaidRM.js","assets/MarkstreamRendererImpl-C6aiJnjl.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{a as t}from"./vendor-zustand-vDaAPGfl.js";import{ot as n,st as r}from"./vendor-base-ui-CzHs0bHY.js";import"./brand-storage-bootstrap-D4BW3w-M.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{o as a}from"./vendor-aparajita-capacitor-secure-storage-xol_6BsB.js";import{Jn as o}from"./useMobileNavigationStore-l2L-r3RJ.js";import{t as s}from"./useEffectiveDirectory-AQOtdYdf.js";import{i as c,n as l,t as u}from"./markdownHeightCache-DMZ5GgoP.js";var d=i(),f=e(r(),1),p=`yuri:chunk-import-reload`,m=250,h=3e4,g=[/Importing a module script failed/i,/Failed to fetch dynamically imported module/i,/error loading dynamically imported module/i,/Loading chunk \S+ failed/i,/ChunkLoadError/i];function _(e){if(e instanceof Error)return`${e.name}\n${e.message}\n${e.stack??``}`;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function v(e){let t=_(e);return g.some(e=>e.test(t))}function y(e){return`0.2.37:${_(e).slice(0,500)}`}function b(e){if(typeof window>`u`)return;let t=Date.now(),n=y(e),r=null;try{let e=window.sessionStorage.getItem(p);if(e)try{r=JSON.parse(e)}catch{r=null}}catch{return}let i=typeof r?.timestamp==`number`?r.timestamp:0;if(!(r?.signature===n&&t-i<h)){try{window.sessionStorage.setItem(p,JSON.stringify({signature:n,timestamp:t}))}catch{return}console.error(`[refresh-debug] chunk-import-reload`,{error:_(e).slice(0,1e3)}),window.setTimeout(()=>{window.location.reload()},0)}}async function x(e,t={}){let n=t.retries??1,r;for(let t=0;t<=n;t+=1)try{return await e()}catch(e){if(r=e,!v(e)||t>=n)break;await new Promise(e=>setTimeout(e,m*(t+1)))}throw v(r)&&b(r),r}var S=e=>(0,f.lazy)(()=>x(e)),C=(e,t)=>!!t?.toLowerCase().startsWith(`video/`)||/^data:video\//i.test(e)||/\.(?:mp4|m4v|webm|mov|ogv|ogg)(?:[?#]|$)/i.test(e),w=(e,t)=>{try{let n=t??(typeof localStorage>`u`?null:localStorage);return!n||n.getItem(e)!==`0`}catch{return!0}},T=(e,t)=>{try{typeof localStorage<`u`&&localStorage.setItem(e,t?`1`:`0`)}catch{}},E=`yuri:markstream-react`,D=e=>w(E,e),O=t(e=>({markstreamReactEnabled:D(),setMarkstreamReactEnabled:t=>{T(E,t),e({markstreamReactEnabled:t})}})),k=null,A=()=>(k??=a(()=>import(`./MarkstreamRendererImpl-DBWfVjRS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77])).catch(e=>{throw k=null,e}),k),j=()=>{A().catch(()=>void 0)},M=null,N=()=>(M??=a(()=>import(`./MarkdownRendererImpl-Dfj5yBQH.js`).then(e=>e.n),__vite__mapDeps([54,1,4,5,15,16,2,3,6,7,8,9,10,11,12,13,14,17,55,23,24,25,26,27,28,29,30,31,19,32,33,34,35,36,37,38,39,40,52,41,56,44,45,46,47,50,51,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76])).catch(e=>{throw M=null,e}),M),P=()=>{N().catch(()=>void 0),D()&&j()},F=class extends f.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn(`[markstream-react] falling back to the current Markdown renderer`,e)}render(){return this.state.hasError?this.props.fallback:this.props.children}},I=f.createContext(!0),L=()=>f.useContext(I),R=n(),z=S(()=>N().then(e=>({default:e.MarkdownRenderer}))),B=S(()=>A().then(e=>({default:e.MarkstreamRenderer}))),V=S(()=>N().then(e=>({default:e.SimpleMarkdownRenderer}))),H=e=>e===`tool`?`markdown-content markdown-tool`:e===`reasoning`?`markdown-content markdown-reasoning`:`markdown-content leading-relaxed`,U=e=>{let t=(0,d.c)(15),n=O(K),r=typeof e.content==`string`?e.content:``,i=typeof e.variant==`string`?e.variant:`assistant`,a;t[0]!==r||t[1]!==n||t[2]!==e.reserveMeasuredHeight||t[3]!==i?(a=e.reserveMeasuredHeight?l(u(r,n?`markstream:${i}`:i)):void 0,t[0]=r,t[1]=n,t[2]=e.reserveMeasuredHeight,t[3]=i,t[4]=a):a=t[4];let s=a,f;t[5]!==e.className||t[6]!==e.variant?(f=o(`relative break-words w-full min-w-0`,H(e.variant),typeof e.className==`string`?e.className:void 0),t[5]=e.className,t[6]=e.variant,t[7]=f):f=t[7];let p;t[8]!==r||t[9]!==e.animated||t[10]!==s?(p=(0,R.jsx)(c,{animated:e.animated,content:r,reservedHeight:s}),t[8]=r,t[9]=e.animated,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==f||t[13]!==p?(m=(0,R.jsx)(`div`,{className:f,"aria-busy":`true`,"data-markdown-hydration":`deferred`,"data-markdown-ready":`false`,children:p}),t[12]=f,t[13]=p,t[14]=m):m=t[14],m},W=e=>{let t=(0,d.c)(13),n=L(),r=O(q);if(!n&&e.isStreaming!==!0){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1,reserveMeasuredHeight:!0}),t[0]=e,t[1]=n),n}let i;t[2]===e?i=t[3]:(i=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(z,{...e})}),t[2]=e,t[3]=i);let a=i,o;t[4]!==a||t[5]!==r||t[6]!==e?(o=r?(0,R.jsx)(F,{fallback:a,children:(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e,reserveMeasuredHeight:!0}),children:(0,R.jsx)(B,{...e})})}):a,t[4]=a,t[5]=r,t[6]=e,t[7]=o):o=t[7];let c=o,l;t[8]===e?l=t[9]:(l=t=>{if(!e.onShowPopup||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;let n=t.target instanceof Element?t.target.closest(`a[href]`):null,r=n?.getAttribute(`href`);if(!r||!C(r))return;t.preventDefault(),t.stopPropagation();let i=n?.textContent?.trim()||r.split(/[/?#]/).filter(Boolean).pop()||r;e.onShowPopup({open:!0,title:i,content:``,video:{url:r,filename:i,directory:s()??``}})},t[8]=e,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,R.jsx)(`div`,{className:`contents`,onClickCapture:l,children:c}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u},G=e=>{let t=(0,d.c)(4);if(!L()){let n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(U,{...e,animated:!1}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,R.jsx)(f.Suspense,{fallback:(0,R.jsx)(U,{...e}),children:(0,R.jsx)(V,{...e})}),t[2]=e,t[3]=n),n};function K(e){return e.markstreamReactEnabled}function q(e){return e.markstreamReactEnabled}export{C as a,P as i,G as n,S as o,I as r,W as t};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{ot as t,st as n}from"./vendor-base-ui-CzHs0bHY.js";import{r}from"./useUIStore-DPo791La.js";import{n as i}from"./vendor-react-DlzBev0S.js";import{u as a}from"./fileQueries-BBcsALlC.js";import{t as o}from"./platform-h8km2dnF.js";import{a as s,i as c,n as l,o as u,r as d,t as f}from"./vendor-markstream-react-6zxyQLCD.js";import{i as p,p as m,r as h}from"./vendor-reactuses-core-CuTmqEMK.js";import{Jn as g,Rn as _}from"./useMobileNavigationStore-l2L-r3RJ.js";import{t as ee}from"./useThemeSystem-CNzUUkFn.js";import{a as v,t as y}from"./vendor-framer-motion-DDMKlXiP.js";import{i as b,n as x,t as S}from"./tooltip-BuZUnYeV.js";import{a as C,r as w}from"./url-DO6Zrx1P.js";import{n as T}from"./useEffectiveDirectory-AQOtdYdf.js";import{o as E}from"./image-loading-2ppAWcFZ.js";import{t as D}from"./LoadingImage-CzTb95Cn.js";import{r as O}from"./FadeInOnReveal-DlU4WRpc.js";import{r as k,t as te}from"./markdownHeightCache-DMZ5GgoP.js";import{t as A}from"./useStreamingTextThrottle-C1Dm4frL.js";import{r as j,t as M}from"./MarkdownRendererImpl-Dfj5yBQH.js";import{n as N}from"./fileReferenceParser-BayaidRM.js";import{a as P,c as F,f as I,h as ne,i as re,l as ie,m as L,o as R,s as ae,t as oe}from"./fileReferenceActions-DRECILCs.js";var z=e(n(),1),B=i(),V=`img:not([data-md-link-favicon="true"])`,H=e=>e.getAttribute(`data-md-image-source`)??e.getAttribute(`src`)??``,se=(e,t)=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(V);if(r instanceof HTMLImageElement&&t.onShowPopup){let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let i=Array.from(n.querySelectorAll(V)).map(e=>({url:H(e),filename:e.alt||H(e)||void 0})).filter(e=>e.url),a=H(r),o=i.findIndex(e=>e.url===a);if(!a)return;e.preventDefault(),e.stopPropagation(),t.onShowPopup({open:!0,title:r.alt||a,content:``,previewSource:r,image:{url:a,...t.effectiveDirectory?{directory:t.effectiveDirectory}:{},filename:r.alt||a,gallery:i,index:o>=0?o:0}});return}if(t.fileReference){let r=n.closest(I);if(r instanceof HTMLElement){e.preventDefault(),e.stopPropagation(),R(r,t.fileReference);return}}let i=n.closest(`a[href]`);if(!(i instanceof HTMLAnchorElement))return;let a=i.getAttribute(`href`)??``;if(ne(a)){e.preventDefault(),e.stopPropagation(),t.fileReference&&L(a)&&R(i,t.fileReference);return}if(!w(a))return;e.preventDefault(),e.stopPropagation();let o=(t.effectiveDirectory||``).trim();if(!_()&&o&&t.openInAppBrowser){t.openInAppBrowser(o,a);return}C(a)},ce=(e,t)=>{if(e.key!==`Enter`&&e.key!==` `||!t.fileReference)return;let n=e.target;if(!(n instanceof Element))return;let r=n.closest(I);!(r instanceof HTMLElement)||r.getAttribute(`data-yuri-file-link`)!==`true`||(e.preventDefault(),e.stopPropagation(),R(r,t.fileReference))},le=(e,t)=>{let n=t>=2?e.slice(t-2,t):``;return(t>=1?e.charAt(t-1):``)===`:`||n===`:/`},U=e=>{if(!e.includes(`/`)||!e.includes(`.`))return[{kind:`text`,value:e}];N.lastIndex=0;let t=[],n=0,r=N.exec(e);for(;r;){let i=r[0];if(!i||le(e,r.index)||!L(i)){r=N.exec(e);continue}r.index>n&&t.push({kind:`text`,value:e.slice(n,r.index)}),t.push({kind:`path`,value:i}),n=r.index+i.length,r=N.exec(e)}return n===0?[{kind:`text`,value:e}]:(n<e.length&&t.push({kind:`text`,value:e.slice(n)}),t)},W=z.createContext({messageId:`markstream`,isStreaming:!1,disableStreamAnimation:!1,variant:`assistant`,enableFileReferences:!0}),G=()=>z.useContext(W),K=t(),ue=24,q=4,de=new Intl.Segmenter(void 0,{granularity:`grapheme`});function fe({node:e}){let t=G(),n=y(),r=t.isStreaming&&!t.disableStreamAnimation&&!n,i=e.content??``,a=z.useRef(i),o=z.useRef(i),s=z.useRef(null),c=z.useRef(new Map);return z.useLayoutEffect(()=>{let e=s.current;if(!e)return;let t=t=>{c.current.delete(t),t.parentNode===e&&(t.replaceWith(document.createTextNode(t.textContent??``)),e.normalize())},n=()=>{for(let[e,n]of c.current)n.stop(),t(e)};if(!r||!i.startsWith(o.current)){n(),e.textContent=i,o.current=i;return}let a=i.slice(o.current.length);if(o.current=i,!a)return;let l=Array.from(de.segment(a),e=>e.segment),u=Math.max(0,l.length-96),d=[];for(let e=u;e<l.length;e+=q)d.push(l.slice(e,e+q).join(``));c.current.size+d.length>ue&&n(),u>0&&e.appendChild(document.createTextNode(l.slice(0,u).join(``))),d.forEach((n,r)=>{let i=document.createElement(`span`);i.dataset.motionStreamChunk=``,i.textContent=n,i.style.opacity=`0`,e.appendChild(i);let a=v([i],{opacity:[0,1]},{duration:.16,delay:Math.min(r*.008,.08),ease:`easeOut`});c.current.set(i,a),a.then(()=>t(i))})},[i,r]),z.useLayoutEffect(()=>{let e=c.current;return()=>{for(let t of e.values())t.stop();e.clear()}},[]),(0,K.jsx)(`span`,{ref:s,className:g(`text-node whitespace-pre-wrap break-words`,e.center&&`text-node-center`),children:a.current})}var J=z.createContext({enabled:!1,insideLink:!1,isMobileSurface:!1,effectiveDirectory:``,preferRuntimeEditor:!1,slots:{used:0,limit:0}}),pe=e=>{let t=(0,B.c)(14),{enabled:n,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,content:s,children:c}=e,l=n?s:``,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=_(),t[0]=u):u=t[0];let d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=re(),t[1]=d):d=t[1];let f;t[2]===l?f=t[3]:(f={content:l,used:0,limit:d},t[2]=l,t[3]=f);let p;t[4]!==i||t[5]!==r||t[6]!==n||t[7]!==o||t[8]!==a||t[9]!==f?(p={enabled:n,insideLink:!1,isMobileSurface:u,effectiveDirectory:r,editor:i,preferRuntimeEditor:a,onShowPopup:o,slots:f},t[4]=i,t[5]=r,t[6]=n,t[7]=o,t[8]=a,t[9]=f,t[10]=p):p=t[10];let m=p,h;return t[11]!==c||t[12]!==m?(h=(0,K.jsx)(J.Provider,{value:m,children:c}),t[11]=c,t[12]=m,t[13]=h):h=t[13],h},Y=({raw:e,referenceKind:t,children:n})=>{let r=z.useContext(J),i=P(e,r.effectiveDirectory,t),a=z.useRef(!1);r.enabled&&i&&!a.current&&r.slots.used<r.slots.limit&&(r.slots.used+=1,a.current=!0);let[o,s]=z.useState(i?ae(i.resolvedPath,r.effectiveDirectory)??null:null),c=i?.resolvedPath;if(z.useEffect(()=>{if(!r.enabled||!c||!a.current)return;let e=!1;return F(c,r.effectiveDirectory).then(t=>{e||s(t)}).catch(()=>{}),()=>{e=!0}},[r.enabled,r.effectiveDirectory,c]),!i)return n??e;let l=!!(a.current&&o&&ie(i.resolvedPath,o,r.isMobileSurface));return(0,K.jsx)(`span`,{"data-yuri-block-path-token":`true`,...l?{"data-yuri-file-link":`true`,"data-yuri-file-ref":e,"data-yuri-file-path":i.resolvedPath,"data-yuri-file-binary":String(o?.isBinary===!0),title:oe,...n?{}:{role:`button`,tabIndex:0}}:{},children:n??e})};function me(e){let t=(0,B.c)(18),n=z.useContext(J),r=G(),i;t[0]===r?i=t[1]:(i=()=>r.isStreaming&&!r.disableStreamAnimation&&r.variant!==`tool`?fe:d,t[0]=r,t[1]=i);let[a]=z.useState(i),o=e.node.content??``;if(!n.enabled||n.insideLink){let n;return t[2]!==a||t[3]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[2]=a,t[3]=e,t[4]=n):n=t[4],n}let s,c;if(t[5]!==a||t[6]!==o||t[7]!==e){c=Symbol.for(`react.early_return_sentinel`);bb0:{let n=U(o);if(n.length===1&&n[0]?.kind!==`path`){let n;t[10]!==a||t[11]!==e?(n=(0,K.jsx)(a,{...e,fade:!1}),t[10]=a,t[11]=e,t[12]=n):n=t[12],c=n;break bb0}let r;t[13]!==a||t[14]!==e?(r=(t,n)=>t.kind===`path`?(0,K.jsx)(Y,{raw:t.value},`path-${n}-${t.value}`):(0,K.jsx)(a,{...e,fade:!1,node:{...e.node,content:t.value}},`text-${n}`),t[13]=a,t[14]=e,t[15]=r):r=t[15],s=n.map(r)}t[5]=a,t[6]=o,t[7]=e,t[8]=s,t[9]=c}else s=t[8],c=t[9];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[16]===s?l=t[17]:(l=(0,K.jsx)(K.Fragment,{children:s}),t[16]=s,t[17]=l),l}function he(e){let t=(0,B.c)(7),n=z.useContext(J),r=e.node.code??``;if(!n.enabled||!L(r)){let n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(c,{...e}),t[0]=e,t[1]=n),n}let i;t[2]===r?i=t[3]:(i=(0,K.jsx)(Y,{raw:r}),t[2]=r,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,K.jsx)(c,{...e,children:i}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}function ge(e){let t=(0,B.c)(20),n=z.useContext(J),r=e.node.href??``,i;t[0]!==n.enabled||t[1]!==r?(i=n.enabled&&L(r),t[0]=n.enabled,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===e?o=t[4]:(o=(0,K.jsx)(l,{...e,showTooltip:!1}),t[3]=e,t[4]=o);let s=o,c;t[5]!==n.isMobileSurface||t[6]!==r||t[7]!==s||t[8]!==e.node.title||t[9]!==e.showTooltip?(c=n.isMobileSurface||e.showTooltip===!1?s:(0,K.jsxs)(S,{children:[(0,K.jsx)(b,{asChild:!0,children:(0,K.jsx)(`span`,{children:s})}),(0,K.jsx)(x,{children:e.node.title||r})]}),t[5]=n.isMobileSurface,t[6]=r,t[7]=s,t[8]=e.node.title,t[9]=e.showTooltip,t[10]=c):c=t[10];let u=c,d;t[11]===n?d=t[12]:(d={...n,insideLink:!0},t[11]=n,t[12]=d);let f;t[13]!==u||t[14]!==a||t[15]!==r?(f=a?(0,K.jsx)(Y,{raw:r,referenceKind:`href`,children:u}):u,t[13]=u,t[14]=a,t[15]=r,t[16]=f):f=t[16];let p;return t[17]!==d||t[18]!==f?(p=(0,K.jsx)(J.Provider,{value:d,children:f}),t[17]=d,t[18]=f,t[19]=p):p=t[19],p}var _e=/^[ \t]{0,3}(`{3,}|~{3,})/,ve=e=>{if(typeof e!=`string`||e.length===0)return!1;let t=e.split(/\r?\n/,1)[0]??``;return _e.test(t)},ye=e=>{let t=0,n=0,r=e.match(/[`~]+/g)??[];for(let e of r)e[0]==="`"?t=Math.max(t,e.length):n=Math.max(n,e.length);return t>=3?"`".repeat(Math.max(3,t+1)):n>=3&&t===0?"```":n>=3?`~`.repeat(Math.max(3,n+1)):"```"},be=e=>{let t=typeof e.raw==`string`?e.raw:``;if(ve(t))return t.endsWith(`
|
|
2
|
-
`)?t:`${t}\n`;let n=(e.language??``).trim(),r=e.code??``,i=ye(r),a=r.endsWith(`
|
|
3
|
-
`)?r:`${r}\n`;return e.loading?`${i}${n}\n${a}`:`${i}${n}\n${a}${i}\n`},xe=e=>{let t=e.partId?`part-${e.partId}`:`body`,n=e.indexKey!==void 0&&e.indexKey!==null&&String(e.indexKey).length>0?String(e.indexKey):e.language&&e.language.length>0?e.language:`code`;return`${e.messageId}:${t}:code:${n}`};function Se(e,t){let n=5381;for(let e=0;e<t.length;e+=1)n=Math.imul(n,33)^t.charCodeAt(e);return`${e}:${(n>>>0).toString(36)}:${t.length}`}function X(e){let t=(0,B.c)(7),n;if(t[0]!==e.indexKey||t[1]!==e.node.code||t[2]!==e.node.language){let r=(e.node.language??``).trim().toLowerCase()||`diagram`;n=e.indexKey??Se(r,e.node.code??``),t[0]=e.indexKey,t[1]=e.node.code,t[2]=e.node.language,t[3]=n}else n=t[3];let r=n,i;return t[4]!==r||t[5]!==e?(i=(0,K.jsx)(Z,{...e,indexKey:r}),t[4]=r,t[5]=e,t[6]=i):i=t[6],i}function Z(e){let t=(0,B.c)(21),n=G(),r=e.node.language??``,i=e.node.code??``,a=e.node.raw??``,o=e.node.loading===!0||e.loading===!0,s;t[0]!==i||t[1]!==r||t[2]!==o||t[3]!==a?(s=be({type:`code_block`,language:r,code:i,raw:a,loading:o}),t[0]=i,t[1]=r,t[2]=o,t[3]=a,t[4]=s):s=t[4];let c=s,l=n.isStreaming||e.loading===!0||e.node.loading===!0,u;t[5]!==n.messageId||t[6]!==n.partId||t[7]!==e.indexKey||t[8]!==e.node.language?(u=xe({messageId:n.messageId,partId:n.partId,indexKey:e.indexKey,language:e.node.language}),t[5]=n.messageId,t[6]=n.partId,t[7]=e.indexKey,t[8]=e.node.language,t[9]=u):u=t[9];let d=u,f=n.enableFileReferences&&!l,p;t[10]!==c||t[11]!==n.disableStreamAnimation||t[12]!==n.onShowPopup||t[13]!==n.variant||t[14]!==d||t[15]!==l||t[16]!==f?(p=(0,K.jsx)(M,{content:c,messageId:d,isAnimated:!1,skipFadeIn:!0,isStreaming:l,disableStreamAnimation:n.disableStreamAnimation,sourceIsPaced:!0,variant:n.variant,onShowPopup:n.onShowPopup,enableFileReferences:f}),t[10]=c,t[11]=n.disableStreamAnimation,t[12]=n.onShowPopup,t[13]=n.variant,t[14]=d,t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==d||t[19]!==p?(m=(0,K.jsx)(`div`,{className:`yuri-markstream-code-host min-w-0 w-full`,"data-yuri-markstream-code":`markdown-impl`,"data-yuri-markstream-code-id":d,children:p}),t[18]=d,t[19]=p,t[20]=m):m=t[20],m}function Ce(e){let t=(0,B.c)(9),{node:n}=e,r=T()??``,i=E(n.src,r),{onShowPopup:a}=G(),o=h(we),s=i.source||void 0,c=n.title??void 0,l=a?`button`:void 0,u=a?0:void 0,d=a?o:void 0,f;return t[0]!==n.alt||t[1]!==n.src||t[2]!==i.error||t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u||t[7]!==d?(f=(0,K.jsx)(D,{contentFrame:!0,src:s,resourceError:i.error,"data-md-image-source":n.src,alt:n.alt,title:c,className:`rounded-lg`,role:l,tabIndex:u,onKeyDown:d}),t[0]=n.alt,t[1]=n.src,t[2]=i.error,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f):f=t[8],f}function we(e){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.currentTarget.click())}function Q(e){let t=(0,B.c)(4);if(e.node.type===`code_block`){let n=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(Z,{...n}),t[0]=n,t[1]=r),r}let n=e,r;return t[2]===n?r=t[3]:(r=(0,K.jsx)(Ce,{...n}),t[2]=n,t[3]=r),r}var $=!1;function Te(e){return e.node?.type===`code_block`?z.createElement(Z,e):z.createElement(me,e)}var Ee=()=>{$||($=!0,s({text:Te,inline_code:he,link:ge,image:Q,code_block:u(Z,`block`),mermaid:u(X,`block`),d2:u(X,`block`),d2lang:u(X,`block`),infographic:u(X,`block`)}))},De={parseOptions:{reuseStableTopLevelNodes:!0},maxLiveNodes:0,liveNodeBuffer:0,batchRendering:!1,deferNodesUntilVisible:!1,viewportPriority:!1,smoothStreaming:!1,typewriter:!1,fade:!1};Ee();var Oe=e=>(e.inline.ruler.at(`math`,(e,t)=>{let n=e.src.slice(e.pos),r=j(n),i=n.startsWith(`\\(`)?/^\\\(([\s\S]+?)\\\)/.exec(n):null,a=r?.raw??i?.[0],o=r?.text??i?.[1];if(!a||!o)return!1;if(!t){let t=e.push(`math_inline`,`math`,0);t.content=o,t.markup=r?r.display?`$$`:`$`:`\\(\\)`}return e.pos+=a.length,!0}),e),ke=e=>e===`tool`?`markdown-content markdown-tool yuri-markstream-host`:e===`reasoning`?`markdown-content markdown-reasoning yuri-markstream-host`:`markdown-content leading-relaxed yuri-markstream-host`,Ae=z.memo(({content:e,part:t,messageId:n,className:i,isStreaming:o=!1,disableStreamAnimation:s=!1,variant:c=`assistant`,onShowPopup:l,enableFileReferences:u=!0})=>{let d=ee()?.currentTheme.metadata.variant===`dark`,{editor:_,runtime:v}=a(),y=T()??``,b=z.useRef(null),x=t?.id?`yuri-ms-${t.id}`:`yuri-ms-${n}`,S=t?.id,C=!o,w=C?te(e,`markstream:${c}`):``,E=u&&!o,D=E?{effectiveDirectory:y,editor:_,preferRuntimeEditor:v.isVSCode,onShowPopup:l}:void 0,O=z.useMemo(()=>({messageId:n,partId:S,isStreaming:o,disableStreamAnimation:s,variant:c,onShowPopup:l,enableFileReferences:u}),[n,S,o,s,c,l,u]),A=z.useRef(C);A.current=C;let j=z.useRef(w);j.current=w;let M=h(e=>{if(!A.current)return;let t=e[0];if(!t)return;let n=t.borderBoxSize?.[0],r=n?n.blockSize:t.contentRect.height,i=n?n.inlineSize:t.contentRect.width;k(j.current,r,i)});m(b,M);let N=h((e,t)=>{r.getState().openContextBrowser(e,t)}),P=h(e=>{se(e,{onShowPopup:l,fileReference:D,effectiveDirectory:y,openInAppBrowser:N})}),F=h(e=>{ce(e,{fileReference:D})});return p(`click`,P,b),p(`keydown`,F,b),(0,K.jsx)(`div`,{ref:b,className:g(`relative break-words w-full min-w-0`,ke(c),i),"data-markdown-ready":`true`,"data-markdown-hydration":`ready`,"data-yuri-markdown-engine":`markstream`,"data-yuri-markstream-virtual":`off`,"data-yuri-markstream-streaming":o?`true`:void 0,children:(0,K.jsx)(W.Provider,{value:O,children:(0,K.jsx)(pe,{enabled:E,effectiveDirectory:y,editor:_,preferRuntimeEditor:v.isVSCode,onShowPopup:l,content:e,children:(0,K.jsx)(f,{content:e,customMarkdownIt:Oe,customId:x,final:!o,isDark:d,codeBlockStream:o,...De})})})})},(e,t)=>e.content===t.content&&e.isStreaming===t.isStreaming&&e.disableStreamAnimation===t.disableStreamAnimation&&e.variant===t.variant&&e.isAnimated===t.isAnimated&&e.skipFadeIn===t.skipFadeIn&&e.className===t.className&&e.messageId===t.messageId&&e.onShowPopup===t.onShowPopup&&e.enableFileReferences===t.enableFileReferences&&e.part?.id===t.part?.id),je=e=>{let t=(0,B.c)(7),n=e.content,r=e.isStreaming===!0,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=O(o()),t[0]=i):i=t[0];let a;t[1]!==e.content||t[2]!==r?(a={text:n,isStreaming:r,throttleMs:i.markdownPaceMs},t[1]=e.content,t[2]=r,t[3]=a):a=t[3];let s=A(a),c=e.isStreaming?s:e.content,l;return t[4]!==e||t[5]!==c?(l=(0,K.jsx)(Ae,{...e,content:c}),t[4]=e,t[5]=c,t[6]=l):l=t[6],l},Me=e=>{let t=(0,B.c)(3),n=`${e.messageId}:${e.part?.id??`text`}`,r;return t[0]!==e||t[1]!==n?(r=(0,K.jsx)(je,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r};export{Me as MarkstreamRenderer};
|