@jingyi0605/codingns 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codingns.mjs +425 -1
- package/dist/public/assets/AdaptiveButlerPage-B153lk5H.css +1 -0
- package/dist/public/assets/AdaptiveButlerPage-R-XZw7pd.js +3 -0
- package/dist/public/assets/App-DUAg5urj.css +1 -0
- package/dist/public/assets/App-DkvE5EyM.js +30 -0
- package/dist/public/assets/BootstrapPage-Vu5oEJ8z.js +1 -0
- package/dist/public/assets/ConversationPage-Cjpg6g0J.js +2 -0
- package/dist/public/assets/DesktopDetachPreviewPage-BgeEqbc5.js +1 -0
- package/dist/public/assets/DesktopWindowPage-1WelvxdH.js +2 -0
- package/dist/public/assets/FileContextPanel-D_ghXJuW.js +1 -0
- package/dist/public/assets/GitSidebar-D9f9Jxwr.js +6 -0
- package/dist/public/assets/MobileCreateSessionSheet-DLq5qPkx.js +1 -0
- package/dist/public/assets/MobileSheet-DLg-gX1t.js +1 -0
- package/dist/public/assets/MobileTopHeaderFrame-DArgZI7L.js +1 -0
- package/dist/public/assets/MobileWorkspaceSwitcherHeader-0ywJKfBQ.js +1 -0
- package/dist/public/assets/ServerSettingsModal-izoYMx9U.js +1 -0
- package/dist/public/assets/SessionIndexPage-C5aG8FIv.js +1 -0
- package/dist/public/assets/SettingsPage-HJIC-P-4.js +1 -0
- package/dist/public/assets/TerminalManagerPanel-DpyUTo9k.js +1 -0
- package/dist/public/assets/{TerminalPage-6jHZV9Mh.js → TerminalPage-CtKXIU0h.js} +19 -19
- package/dist/public/assets/TerminalRuntimeFallbackModal-CRhOQOsT.js +1 -0
- package/dist/public/assets/ToolFilesPage-DcYPsS-e.js +1 -0
- package/dist/public/assets/ToolGitPage-CsPl89ty.js +1 -0
- package/dist/public/assets/ToolProcessesPage-D0dvR8xK.js +1 -0
- package/dist/public/assets/ToolsHomePage-4fP-KRiv.js +1 -0
- package/dist/public/assets/WorkbenchLandingPage-kvlfyxRo.js +1 -0
- package/dist/public/assets/WorkbenchLayout-ByFw4eeu.js +3 -0
- package/dist/public/assets/WorkbenchModal-Ctob14VR.js +1 -0
- package/dist/public/assets/WorkbenchShellRoute-BUITtdAg.css +1 -0
- package/dist/public/assets/WorkbenchShellRoute-Kw7JEZI3.js +1 -0
- package/dist/public/assets/WorkspaceDebugDetailPage-Com5kEXJ.js +1 -0
- package/dist/public/assets/WorkspaceDetailPage-D0Lrx4Uz.js +1 -0
- package/dist/public/assets/WorkspaceHomePage-wR8d3aP9.js +1 -0
- package/dist/public/assets/butler-records-events-DgWCG364.js +1 -0
- package/dist/public/assets/default-session-permission-mode-CcGwR4Kk.js +1 -0
- package/dist/public/assets/event-DvH9tcej.js +1 -0
- package/dist/public/assets/file-tree-icon-UFVoVzhM.js +31 -0
- package/dist/public/assets/index-Byp9hJ0c.js +42 -0
- package/dist/public/assets/index-_52jxu4a.css +1 -0
- package/dist/public/assets/preferences-service-KIYeE2gk.js +1 -0
- package/dist/public/assets/session-runtime-machine-0KNSSPp5.js +17 -0
- package/dist/public/assets/styles-BWPBZvze.css +1 -0
- package/dist/public/assets/styles-CSUx5LGe.js +1 -0
- package/dist/public/assets/terminal-runtime-meta-AWXJpN4r.js +1 -0
- package/dist/public/assets/useRegisteredDebugTemplates-DBDRdptr.js +1 -0
- package/dist/public/assets/window-BWqRixxq.js +1 -0
- package/dist/public/index.html +2 -2
- package/dist/server/middlewares/auth-guard.d.ts +4 -0
- package/dist/server/middlewares/auth-guard.js +42 -4
- package/dist/server/middlewares/auth-guard.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +62 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +58 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +66 -3
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +173 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/auth/auth-controller.d.ts +11 -1
- package/dist/server/modules/auth/auth-controller.js +61 -2
- package/dist/server/modules/auth/auth-controller.js.map +1 -1
- package/dist/server/modules/auth/auth-device-display-name.d.ts +10 -0
- package/dist/server/modules/auth/auth-device-display-name.js +190 -0
- package/dist/server/modules/auth/auth-device-display-name.js.map +1 -0
- package/dist/server/modules/auth/auth-service.d.ts +80 -5
- package/dist/server/modules/auth/auth-service.js +333 -23
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/butler/assistant-automation-service.d.ts +2 -0
- package/dist/server/modules/butler/assistant-automation-service.js +46 -0
- package/dist/server/modules/butler/assistant-automation-service.js.map +1 -1
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.d.ts +32 -0
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js +93 -0
- package/dist/server/modules/butler/assistant-sandbox-cleanup-scheduler.js.map +1 -0
- package/dist/server/modules/butler/assistant-sandbox-service.d.ts +16 -2
- package/dist/server/modules/butler/assistant-sandbox-service.js +137 -4
- package/dist/server/modules/butler/assistant-sandbox-service.js.map +1 -1
- package/dist/server/modules/butler/butler-auth-service.js +7 -2
- package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-control-session-service.d.ts +4 -1
- package/dist/server/modules/butler/butler-control-session-service.js +20 -1
- package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.d.ts +2 -1
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js +27 -25
- package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-service.d.ts +32 -4
- package/dist/server/modules/butler/butler-follow-up-service.js +436 -331
- package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +1 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-service.js +1 -0
- package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-service.d.ts +3 -1
- package/dist/server/modules/butler/butler-session-service.js +15 -1
- package/dist/server/modules/butler/butler-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.d.ts +1 -1
- package/dist/server/modules/butler/butler-workspace-context.js +54 -28
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
- package/dist/server/modules/provider/provider-controller.d.ts +1 -1
- package/dist/server/modules/provider/provider-controller.js.map +1 -1
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.d.ts +10 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js +48 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-identity-service.js.map +1 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.d.ts +48 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js +11 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-packets.js.map +1 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.d.ts +74 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js +302 -0
- package/dist/server/modules/relay-tunnel/crypto/relay-tunnel-protocol.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.d.ts +33 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js +57 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-controller.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.d.ts +9 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js +25 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-edge-proof.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.d.ts +18 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +230 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.d.ts +41 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js +443 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-runtime-adapter.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.d.ts +111 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +771 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -0
- package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +2 -1
- package/dist/server/modules/sessions/codex-app-server-helper-client.js +78 -0
- package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +84 -2
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/provider-session-delete-cli.d.ts +15 -0
- package/dist/server/modules/sessions/provider-session-delete-cli.js +148 -0
- package/dist/server/modules/sessions/provider-session-delete-cli.js.map +1 -0
- package/dist/server/modules/sessions/session-controller.d.ts +4 -1
- package/dist/server/modules/sessions/session-controller.js +4 -0
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +17 -0
- package/dist/server/modules/sessions/session-history-service.js +150 -1
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-router-service.d.ts +25 -0
- package/dist/server/modules/sessions/session-live-runtime-router-service.js +42 -0
- package/dist/server/modules/sessions/session-live-runtime-router-service.js.map +1 -0
- package/dist/server/modules/sessions/session-live-runtime-service.js +34 -18
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-message-attachment-service.d.ts +1 -0
- package/dist/server/modules/sessions/session-message-attachment-service.js +22 -0
- package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
- package/dist/server/modules/sessions/session-permission-request-service.d.ts +1 -0
- package/dist/server/modules/sessions/session-permission-request-service.js +200 -5
- package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-error-mapper.js +32 -0
- package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-usage-guard-service.d.ts +37 -0
- package/dist/server/modules/sessions/session-provider-usage-guard-service.js +179 -0
- package/dist/server/modules/sessions/session-provider-usage-guard-service.js.map +1 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.d.ts +17 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.js +465 -0
- package/dist/server/modules/sessions/session-provider-usage-limit.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.d.ts +8 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +26 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.d.ts +9 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js +55 -0
- package/dist/server/modules/skills/assistant-runtime-skill-cleanup.js.map +1 -0
- package/dist/server/modules/skills/builtin-skill-service.js +1 -6
- package/dist/server/modules/skills/builtin-skill-service.js.map +1 -1
- package/dist/server/modules/skills/skill-controller.d.ts +2 -2
- package/dist/server/modules/skills/skill-controller.js +9 -1
- package/dist/server/modules/skills/skill-controller.js.map +1 -1
- package/dist/server/modules/skills/skill-manager-service.d.ts +26 -1
- package/dist/server/modules/skills/skill-manager-service.js +346 -90
- package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
- package/dist/server/modules/skills/skill-name-policy.d.ts +2 -0
- package/dist/server/modules/skills/skill-name-policy.js +10 -0
- package/dist/server/modules/skills/skill-name-policy.js.map +1 -0
- package/dist/server/modules/tailscale/tailscale-service.d.ts +2 -0
- package/dist/server/modules/tailscale/tailscale-service.js +21 -8
- package/dist/server/modules/tailscale/tailscale-service.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +3 -0
- package/dist/server/modules/tasks/task-types.js +3 -0
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/template-reverse-proxy-service.js +71 -3
- package/dist/server/modules/terminal/template-reverse-proxy-service.js.map +1 -1
- package/dist/server/routes/assistant.js +30 -0
- package/dist/server/routes/assistant.js.map +1 -1
- package/dist/server/routes/auth.js +4 -0
- package/dist/server/routes/auth.js.map +1 -1
- package/dist/server/routes/sessions.js +1 -0
- package/dist/server/routes/sessions.js.map +1 -1
- package/dist/server/routes/system.d.ts +2 -1
- package/dist/server/routes/system.js +13 -1
- package/dist/server/routes/system.js.map +1 -1
- package/dist/server/server/create-server.d.ts +10 -0
- package/dist/server/server/create-server.js +82 -12
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/utils/tokens.d.ts +3 -1
- package/dist/server/shared/utils/tokens.js +9 -2
- package/dist/server/shared/utils/tokens.js.map +1 -1
- package/dist/server/storage/repositories/assistant-automation-task-repository.d.ts +2 -0
- package/dist/server/storage/repositories/assistant-automation-task-repository.js +8 -2
- package/dist/server/storage/repositories/assistant-automation-task-repository.js.map +1 -1
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.d.ts +1 -0
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js +27 -0
- package/dist/server/storage/repositories/assistant-sandbox-workspace-repository.js.map +1 -1
- package/dist/server/storage/repositories/auth-device-repository.d.ts +22 -0
- package/dist/server/storage/repositories/auth-device-repository.js +97 -0
- package/dist/server/storage/repositories/auth-device-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-device-session-repository.d.ts +17 -0
- package/dist/server/storage/repositories/auth-device-session-repository.js +82 -0
- package/dist/server/storage/repositories/auth-device-session-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-login-event-repository.d.ts +9 -0
- package/dist/server/storage/repositories/auth-login-event-repository.js +53 -0
- package/dist/server/storage/repositories/auth-login-event-repository.js.map +1 -0
- package/dist/server/storage/repositories/auth-token-repository.d.ts +4 -0
- package/dist/server/storage/repositories/auth-token-repository.js +58 -5
- package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
- package/dist/server/storage/repositories/butler-follow-up-task-repository.js +21 -3
- package/dist/server/storage/repositories/butler-follow-up-task-repository.js.map +1 -1
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.d.ts +8 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js +52 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-identity-repository.js.map +1 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.d.ts +10 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.js +153 -0
- package/dist/server/storage/repositories/instance-relay-tunnel-repository.js.map +1 -0
- package/dist/server/storage/repositories/instance-tailscale-repository.js +6 -3
- package/dist/server/storage/repositories/instance-tailscale-repository.js.map +1 -1
- package/dist/server/storage/repositories/managed-skill-repository.d.ts +2 -1
- package/dist/server/storage/repositories/managed-skill-repository.js +14 -4
- package/dist/server/storage/repositories/managed-skill-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js +24 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +297 -2
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +122 -4
- package/dist/server/types/domain.d.ts +82 -1
- package/dist/server/ws/workbench-ws-hub.js +99 -75
- package/dist/server/ws/workbench-ws-hub.js.map +1 -1
- package/dist/server/ws/ws-auth-guard.js +1 -4
- package/dist/server/ws/ws-auth-guard.js.map +1 -1
- package/dist/server/ws/ws-server.d.ts +1 -1
- package/dist/server/ws/ws-server.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +80 -0
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +11 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +11 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +132 -21
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +2 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +53 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +10 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +30 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +5 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +145 -58
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/services.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/services.js +7 -0
- package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/scripts/postinstall.mjs +0 -33
- package/dist/public/assets/index-CSVhg7I8.js +0 -123
- package/dist/public/assets/index-Ce1VX19m.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as e}from"./index-Byp9hJ0c.js";const r="/api/preferences/profile";async function f(){return e.request(r)}async function o(t){return e.request(r,{method:"PUT",body:JSON.stringify(t)})}export{f as fetchPreferencesProfile,o as updatePreferencesProfile};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var kr=Object.defineProperty;var Cr=(e,t,n)=>t in e?kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var de=(e,t,n)=>Cr(e,typeof t!="symbol"?t+"":t,n);import{t as i,j as s,b as u,u as jr,C as Ht,a as Ln,m as Pn,D as wr,B as Nr,E as Sr}from"./index-Byp9hJ0c.js";import{d as gt,e as vt,f as on}from"./App-DkvE5EyM.js";import{e as Tr,O as Rr,P as Mr,Q as Ar,l as Kt,a as os,J as Lr,R as Pr,T as Ir,U as Er,V as Br,m as Or,n as _r,M as qr,i as Wr,j as In,W as Fr,X as Ur,Y as zr}from"./MobileSheet-DLg-gX1t.js";import{W as Mt,D as ls}from"./WorkbenchModal-Ctob14VR.js";import{u as cs,ad as Dr,a1 as $r}from"./WorkbenchLayout-ByFw4eeu.js";import{M as Hr,r as Kr}from"./file-tree-icon-UFVoVzhM.js";function Vt(e,t){if(!e)return{allowed:!1,hidden:!1,reason:i("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:i("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:i("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:i("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:i("conversation.capabilityDenied")}}}const Vr=new Set(["updateplan"]),us=new Set(["todowrite"]),tn=new Set(["todoread"]),ds=new Set(["taskcreate","taskupdate","taskget","tasklist","taskdelete","taskremove"]);function Gr(e,t){const n=Zr(e,t);return n||Jr(e,t)}function ms(e){return e.reduce((t,n)=>(t[n.status]+=1,t),{pending:0,in_progress:0,completed:0,failed:0,cancelled:0})}function Qr(e,t,n){if(!e)return null;if(nn(e.name)){const l=Ve(e);if(!l||!qt(l.value))return null;const d=ps(l.value,n);return!d||d.items.length===0?null:{provider:t,source:"plan",explanation:d.explanation,items:d.items,updatedAt:n}}const r=_t(e.name);if(!us.has(r)&&!tn.has(r)&&!ds.has(r))return null;const a=Ve(e,(tn.has(r),"prefer-output"));if(!a)return null;if(r==="taskdelete"||r==="taskremove"){const l=fs(a.value);return l.length>0?{provider:t,source:"todo",explanation:null,items:l.map((d,m)=>({id:d,title:`Task ${m+1}`,status:"cancelled",detail:d,updatedAt:n})),updatedAt:n}:null}const o=rt(a.value,n);return o.length===0?null:{provider:t,source:nn(e.name)?"plan":"todo",explanation:null,items:o,updatedAt:n}}function Zr(e,t){let n=null;for(const r of e){const a=r.toolCall;if(!a||_t(a.name)===""||!nn(a.name))continue;const o=Ve(a);if(!o||typeof o.value!="object"||o.value===null)continue;const l=ps(o.value,r.timestamp);!l||l.items.length===0||(n={provider:t,source:"plan",explanation:l.explanation,items:l.items,updatedAt:r.timestamp})}return n}function Jr(e,t){const n=new Map;let r=null;for(const o of e){const l=o.toolCall;if(!l)continue;const d=_t(l.name);if(us.has(d)){const v=Ve(l),x=v?rt(v.value,o.timestamp):[];x.length>0&&(Gt(n,x),r=o.timestamp);continue}if(tn.has(d)){const v=Ve(l,"prefer-output"),x=v?rt(v.value,o.timestamp):[];x.length>0&&(Gt(n,x),r=o.timestamp);continue}if(!ds.has(d))continue;const m=Ve(l,"prefer-output");if(!m)continue;if(d==="tasklist"||d==="taskget"){const v=rt(m.value,o.timestamp);v.length>0&&(Gt(n,v),r=o.timestamp);continue}if(d==="taskdelete"||d==="taskremove"){const v=fs(m.value);if(v.length>0){for(const x of v)n.delete(x);r=o.timestamp}continue}const k=rt(m.value,o.timestamp);if(k.length!==0){for(const v of k)Xr(n,v);r=o.timestamp}}const a=Array.from(n.values()).sort((o,l)=>o.updatedAt.localeCompare(l.updatedAt)).map(o=>({...o}));return a.length===0||!r?null:{provider:t,source:"todo",explanation:null,items:a,updatedAt:r}}function nn(e){return Vr.has(_t(e))}function ps(e,t){const n=Array.isArray(e.plan)?e.plan:null;if(!n||n.length===0)return null;const r=n.map((a,o)=>hs(a,{fallbackIdPrefix:"plan",fallbackTitle:`Step ${o+1}`,fallbackStatus:"pending",updatedAt:t})).filter(a=>a!==null);return r.length===0?null:{items:r,explanation:O(e.explanation)}}function Ve(e,t="prefer-input"){const n=t==="prefer-output"?[{text:e.output,source:"output"},{text:e.input,source:"input"}]:[{text:e.input,source:"input"},{text:e.output,source:"output"}];for(const r of n){const a=Yr(r.text);if(a!==null)return{value:a,source:r.source}}return null}function Yr(e){const t=(e==null?void 0:e.trim())??"";if(!t)return null;const n=Nt(t);if(n!==null)return n;const r=t.match(/```(?:json)?\s*([\s\S]+?)```/i);if(r!=null&&r[1]){const m=Nt(r[1].trim());if(m!==null)return m}const a=t.indexOf("{"),o=t.lastIndexOf("}");if(a>=0&&o>a){const m=Nt(t.slice(a,o+1));if(m!==null)return m}const l=t.indexOf("["),d=t.lastIndexOf("]");return l>=0&&d>l?Nt(t.slice(l,d+1)):null}function Nt(e){try{return JSON.parse(e)}catch{return null}}function rt(e,t){return at(e).map((r,a)=>hs(r,{fallbackIdPrefix:"task",fallbackTitle:`Task ${a+1}`,fallbackStatus:"pending",updatedAt:t})).filter(r=>r!==null)}function at(e){if(Array.isArray(e))return e.flatMap(n=>at(n));if(!qt(e))return[];if(si(e))return[e];const t=["tasks","todos","items","entries","results","data"];for(const n of t){if(!(n in e))continue;const r=at(e[n]);if(r.length>0)return r}return Object.values(e).flatMap(n=>at(n))}function fs(e){const n=at(e).map(a=>sn(a)).filter(a=>a!==null);if(n.length>0)return n;if(!qt(e))return[];const r=sn(e);return r?[r]:[]}function hs(e,t){if(!qt(e))return null;const n=O(e.step)??O(e.title)??O(e.content)??O(e.task)??O(e.text)??O(e.name)??O(e.subject)??O(e.description)??t.fallbackTitle,r=sn(e)??ni(t.fallbackIdPrefix,n),a=ti(e,n);return{id:r,title:n,status:ei(e.status,t.fallbackStatus),detail:a,updatedAt:t.updatedAt}}function Xr(e,t){const n=e.get(t.id);if(!n){e.set(t.id,{...t});return}e.set(t.id,{id:n.id,title:t.title||n.title,status:t.status,detail:t.detail??n.detail,updatedAt:t.updatedAt})}function Gt(e,t){e.clear();for(const n of t)e.set(n.id,{...n})}function ei(e,t){var r;const n=(r=O(e))==null?void 0:r.toLowerCase().replace(/[\s-]+/g,"_");return n?["pending","todo","open","queued","not_started","created"].includes(n)?"pending":["in_progress","progress","active","doing","running","started"].includes(n)?"in_progress":["completed","complete","done","success","succeeded","finished","closed"].includes(n)?"completed":["failed","error","errored"].includes(n)?"failed":["cancelled","canceled","aborted","skipped"].includes(n)?"cancelled":t:t}function ti(e,t){const n=[O(e.detail),O(e.details),O(e.description),O(e.reason),O(e.summary),O(e.note),O(e.priority)].filter(r=>r!==null);for(const r of n)if(r!==t)return r;return null}function sn(e){return O(e.id)??O(e.taskId)??O(e.task_id)??O(e.uuid)??O(e.key)}function ni(e,t){return`${e}:${t.trim().toLowerCase()}`}function si(e){return[e.step,e.title,e.content,e.task,e.text,e.subject,e.name,e.description].some(t=>O(t)!==null)}function _t(e){return e.trim().toLowerCase().replace(/[\s_.-]+/g,"")}function qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function O(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function ri(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[s.jsx("rect",{x:"7",y:"5",width:"9",height:"11",rx:"2.5"}),s.jsx("path",{d:"M5.5 12.5H5A2 2 0 0 1 3 10.5V5a2 2 0 0 1 2-2h5.5"})]})}function ii(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[s.jsx("circle",{cx:"6",cy:"5",r:"2.25"}),s.jsx("circle",{cx:"14",cy:"6",r:"2.25"}),s.jsx("circle",{cx:"14",cy:"14",r:"2.25"}),s.jsx("path",{d:"M8.4 5.7h2.2a2.7 2.7 0 0 1 2.7 2.7v1.2"}),s.jsx("path",{d:"M8.1 5.9l4.1 6.2"})]})}function tl(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[s.jsx("path",{d:"M10 2.8l1.6 3.4 3.8.5-2.8 2.6.7 3.9-3.3-1.8-3.3 1.8.7-3.9-2.8-2.6 3.8-.5L10 2.8z"}),s.jsx("path",{d:"M15.8 13.3l.7 1.5 1.7.2-1.2 1.1.3 1.8-1.5-.8-1.5.8.3-1.8-1.2-1.1 1.7-.2.7-1.5z"})]})}function nl(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[s.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),s.jsx("circle",{cx:"14",cy:"5",r:"2.2"}),s.jsx("circle",{cx:"10",cy:"14",r:"2.2"}),s.jsx("path",{d:"M8.2 5h3.6"}),s.jsx("path",{d:"M10 7.2v4.6"}),s.jsx("path",{d:"M7.3 6.8l1.7 4"}),s.jsx("path",{d:"M12.7 6.8l-1.7 4"})]})}function sl(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"currentColor",className:"conversation-action-icon",children:[s.jsx("circle",{cx:"4.5",cy:"10",r:"1.5"}),s.jsx("circle",{cx:"10",cy:"10",r:"1.5"}),s.jsx("circle",{cx:"15.5",cy:"10",r:"1.5"})]})}function ai(){return s.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[s.jsx("path",{d:"M4.5 5.5h1.2"}),s.jsx("path",{d:"M8 5.5h7.5"}),s.jsx("path",{d:"M4.5 10h1.2"}),s.jsx("path",{d:"M8 10h7.5"}),s.jsx("path",{d:"M4.5 14.5h1.2"}),s.jsx("path",{d:"M8 14.5h7.5"}),s.jsx("path",{d:"M5.1 5.5l.5.5 1-1"}),s.jsx("circle",{cx:"5.1",cy:"10",r:".8",fill:"currentColor",stroke:"none"}),s.jsx("path",{d:"M5.1 14.5l.5.5 1-1"})]})}const En={in_progress:0,failed:1,pending:2,completed:3,cancelled:4};function oi({provider:e,messages:t,variant:n="header"}){const[r,a]=u.useState(!1),o=u.useMemo(()=>Gr(t,e),[t,e]);if(!o||o.items.length===0)return null;const l=ms(o.items),d=l.in_progress||l.pending,m=d>0?d:o.items.length,k=[...o.items].sort((x,g)=>{const j=En[x.status]-En[g.status];return j!==0?j:x.updatedAt.localeCompare(g.updatedAt)}),v=n==="composer"?"conversation-task-progress-button composer-task-progress-button":"conversation-header-ai-button conversation-task-progress-button";return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:v,"data-variant":n,"aria-label":i("conversation.taskProgressButton",{count:o.items.length}),title:i("conversation.taskProgressButton",{count:o.items.length}),onClick:()=>{a(!0)},children:[s.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:s.jsx(ai,{})}),s.jsx("span",{className:"conversation-task-progress-badge",children:m})]}),s.jsx(Mt,{open:r,title:i("conversation.taskProgressModalTitle"),description:i("conversation.taskProgressModalDescription",{count:o.items.length}),className:"conversation-task-progress-modal",onClose:()=>{a(!1)},children:s.jsxs("div",{className:"conversation-task-progress-modal-body",children:[s.jsxs("div",{className:"conversation-task-progress-summary",children:[s.jsx(st,{label:i("conversation.taskProgressSummaryTotal"),value:o.items.length}),s.jsx(st,{label:i("conversation.taskProgressStatusInProgress"),value:l.in_progress}),s.jsx(st,{label:i("conversation.taskProgressStatusPending"),value:l.pending}),s.jsx(st,{label:i("conversation.taskProgressStatusCompleted"),value:l.completed}),l.failed>0?s.jsx(st,{label:i("conversation.taskProgressStatusFailed"),value:l.failed}):null]}),o.explanation?s.jsxs("div",{className:"conversation-task-progress-explanation",children:[s.jsx("strong",{children:i("conversation.taskProgressExplanationTitle")}),s.jsx("p",{children:o.explanation})]}):null,s.jsx("ol",{className:"conversation-task-progress-list",children:k.map(x=>s.jsxs("li",{className:"conversation-task-progress-item","data-status":x.status,children:[s.jsx("span",{className:"conversation-task-progress-item-indicator","data-status":x.status,"aria-hidden":"true"}),s.jsxs("div",{className:"conversation-task-progress-item-body",children:[s.jsxs("div",{className:"conversation-task-progress-item-header",children:[s.jsx("strong",{children:x.title}),s.jsx("span",{className:"conversation-task-progress-item-status",children:li(x.status)})]}),x.detail?s.jsx("p",{className:"conversation-task-progress-item-detail",children:x.detail}):null]})]},x.id))})]})})]})}function st({label:e,value:t}){return s.jsxs("div",{className:"conversation-task-progress-summary-card",children:[s.jsx("span",{children:e}),s.jsx("strong",{children:t})]})}function li(e){switch(e){case"in_progress":return i("conversation.taskProgressStatusInProgress");case"completed":return i("conversation.taskProgressStatusCompleted");case"failed":return i("conversation.taskProgressStatusFailed");case"cancelled":return i("conversation.taskProgressStatusCancelled");case"pending":default:return i("conversation.taskProgressStatusPending")}}const ci="codingns.conversation.composer-draft:",ui=1,di=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function ln(){return typeof window<"u"&&typeof window.localStorage<"u"}function mi(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,n="fileName"in e?e.fileName:null,r="mimeType"in e?e.mimeType:null,a="fileSize"in e?e.fileSize:null,o="lastModified"in e?e.lastModified:null,l="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof n!="string"||typeof r!="string"||typeof a!="number"||typeof o!="number"||typeof l!="string")return null;const d=t.trim(),m=n.trim(),k=r.trim(),v=l.trim();return!d||!m||!k||a<0||o<0||!v?null:{id:d,fileName:m,mimeType:k,fileSize:a,lastModified:o,contentBase64:v}}function pi(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,n="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(n))return null;const r=n.map(a=>mi(a)).filter(a=>a!==null);return r.length!==n.length||t.length===0&&r.length===0?null:{content:t,attachments:r}}function ot(e){return`${ci}${e}`}function fi(e){var t,n;return{id:((n=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:n.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function hi(e){if(!ln())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(ot(t));if(!n)return null;try{const r=JSON.parse(n),a=r&&typeof r=="object"&&"draft"in r&&r.draft&&typeof r.draft=="object"?r.draft:r,o=pi(a);return o||(window.localStorage.removeItem(ot(t)),null)}catch{return window.localStorage.removeItem(ot(t)),null}}function gi(e,t){if(!ln())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return gs(n),!0;try{return window.localStorage.setItem(ot(n),JSON.stringify({schemaVersion:ui,draft:t})),!0}catch{return!1}}function gs(e){if(!ln())return;const t=e.trim();t&&window.localStorage.removeItem(ot(t))}const Bn="workbench:focus-composer",lt="provider-default",On=["codex","claude-code","opencode","gemini","kimi"],vi=new Set(["codex","claude-code","opencode"]),xi=new Set(["codex","claude-code","opencode"]),_n={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function bi(e){return[{id:lt,name:i("conversation.modelUseCliDefault"),provider:e,usesProviderDefault:!0}]}function qn(e){return bi(e)}function Wn(e){return e.usesProviderDefault===!0||e.id===lt}function yi(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function Fn(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function ki(e,t,n,r){const a=globalThis.atob(n),o=Uint8Array.from(a,l=>l.charCodeAt(0));return new File([o],e,{type:t,lastModified:r})}function Ci(e){return e.trim().toLowerCase().startsWith("image/")}function ct(e){const t=e.type.trim().toLowerCase();return t.length>0?t:"application/octet-stream"}function vs(e){return Ci(ct(e))?"image":"file"}function xs(e,t=yi()){const n=vs(e);return{id:t,file:e,kind:n,previewUrl:n==="image"?URL.createObjectURL(e):null}}function ji(e){const t=ki(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return xs(t,e.id)}function wi(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ni(e){const t=e.trim().replace(/\s+/g," ");return t.length===0?i("conversation.forkDraftEmpty"):t.length>140?`${t.slice(0,140)}…`:t}function Si(e,t){return t===e?xi.has(t)?null:i("conversation.forkProviderNativeUnsupported"):vi.has(t)?null:i("conversation.forkProviderReconstructedUnsupported")}function bs(e){return(e==null?void 0:e.canStartSession)===!1}function Ti(e){return bs(e)?(e==null?void 0:e.limitations[0])??i("conversation.capabilityDenied"):null}function Ri(e,t){return{id:t,kind:vs(e),fileName:e.name,mimeType:ct(e),fileSize:e.size}}function Un(e){return new Promise((t,n)=>{const r=new FileReader;r.onerror=()=>{n(r.error??new Error("FILE_READ_FAILED"))},r.onload=()=>{const a=typeof r.result=="string"?r.result:"",o=a.includes(",")?a.split(",").at(-1)??"":a;t(o)},r.readAsDataURL(e)})}function Mi(e){e.forEach(t=>{t.previewUrl&&URL.revokeObjectURL(t.previewUrl)})}function Ai(e,t){const n=new Set(e.map(a=>`${a.file.name}:${a.file.size}:${a.file.lastModified}`)),r=[...e];return t.forEach(a=>{const o=`${a.name}:${a.size}:${a.lastModified}`;n.has(o)||(n.add(o),r.push(xs(a)))}),r}function Li(e,t,n){const r=e.nativeEvent;return r.isComposing||r.keyCode===229||t||n}function rl({capabilities:e,placeholder:t,draftStorageId:n,forkDraft:r=null,onClearForkDraft:a,onForkDraftChange:o,panelRef:l,portalContainer:d=null,hasActiveRun:m=null,canInterrupt:k=null,contextUsage:v=null,taskProvider:x=null,taskMessages:g=[],hasPendingQueuedMessages:j=!1,isSubmitting:b,isRunning:f=!1,onInterrupt:C,onQueueSend:T,onSend:M}){const R=gt(),I=u.useId(),D=u.useId(),[A,F]=u.useState(""),[L,$]=u.useState(""),[H,X]=u.useState("medium"),[U,K]=u.useState([]),[Ee,se]=u.useState(!1),[Be,me]=u.useState(!1),[G,ae]=u.useState(di),[re,ke]=u.useState(!1),[xt,pe]=u.useState(!1),[Oe,bt]=u.useState(""),[Ce,fe]=u.useState(!1),[he,ee]=u.useState(!1),[Qe,Ze]=u.useState(!1),[Je,je]=u.useState(!1),[Ye,Q]=u.useState(null),[_e,we]=u.useState(!1),[Ne,oe]=u.useState({}),[ge,qe]=u.useState(null),Se=u.useRef(null),Xe=u.useRef(null),yt=u.useRef(null),We=u.useRef(!1),Fe=u.useRef(!1),p=u.useRef(!1),N=u.useRef(null),E=u.useRef(new Set),Z=u.useRef(new Map),V=u.useRef(0),{showToast:Te}=vt(),Re=Tr(),Ue=u.useCallback(()=>{N.current!==null&&(globalThis.clearTimeout(N.current),N.current=null),p.current=!1},[]);u.useEffect(()=>Ue,[Ue]);const Y=Rr(e),le=jr(c=>Ht(Y)?c.profile.providers[Y]:null),et=(le==null?void 0:le.defaultModel)??null,tt=(le==null?void 0:le.defaultReasoningLevel)??null,Wt=u.useMemo(()=>Vt(e,"send_message"),[e]),fn=u.useMemo(()=>Vt(e,"interrupt"),[e]),te=u.useMemo(()=>Vt(e,"attachments"),[e]),ce=u.useMemo(()=>{var h;const c=(h=e==null?void 0:e.modelOptions)==null?void 0:h.map(y=>{var w;return{...y,provider:Y,supportedReasoningEfforts:(w=y.supportedReasoningEfforts)==null?void 0:w.filter(_=>_==="low"||_==="medium"||_==="high"||_==="xhigh")}});return c!=null&&c.length?c:qn(Y)},[e==null?void 0:e.modelOptions,Y]),ue=u.useMemo(()=>ce.find(c=>c.id===L)??null,[ce,L]),kt=Mr(e),Vs=Ar(e),Ft=u.useMemo(()=>[{value:"low",label:i("conversation.reasoningLow")},{value:"medium",label:i("conversation.reasoningMedium")},{value:"high",label:i("conversation.reasoningHigh")},{value:"xhigh",label:i("conversation.reasoningMaximum")}],[]),ie=u.useMemo(()=>{if(!kt)return[];const c=ue==null?void 0:ue.supportedReasoningEfforts;return!c||c.length===0?Ft:Ft.filter(h=>c.includes(h.value))},[kt,Ft,ue==null?void 0:ue.supportedReasoningEfforts]),Gs=u.useMemo(()=>ce.map(c=>({value:c.id,label:Wn(c)?i("conversation.modelUseCliDefault"):c.name})),[ce]),Qs=u.useMemo(()=>ie.map(c=>({value:c.value,label:c.label})),[ie]),Zs=u.useMemo(()=>[{command:"/plan",label:i("conversation.slashCommandPlan")},{command:"/review",label:i("conversation.slashCommandReview")},{command:"/explain",label:i("conversation.slashCommandExplain")}],[]),hn=(e==null?void 0:e.inRunInputMode)??"none",ve=!!r,Js=(r==null?void 0:r.targetProvider)??null,Ct=!!r&&(e==null?void 0:e.provider)===Js,xe=u.useMemo(()=>r?Ct?e:Ye??Kt(r.targetProvider):null,[e,Ye,r,Ct]),ze=u.useMemo(()=>{var h;if(!r)return[];const c=(h=xe==null?void 0:xe.modelOptions)==null?void 0:h.map(y=>{var w;return{...y,provider:r.targetProvider,supportedReasoningEfforts:(w=y.supportedReasoningEfforts)==null?void 0:w.filter(_=>_==="low"||_==="medium"||_==="high"||_==="xhigh")}});return c!=null&&c.length?c:qn(r.targetProvider)},[xe==null?void 0:xe.modelOptions,r]),Ys=u.useMemo(()=>ze.map(c=>({value:c.id,label:Wn(c)?i("conversation.modelUseCliDefault"):c.name})),[ze]),Xs=u.useMemo(()=>!r||!r.targetModel?lt:ze.some(c=>c.id===r.targetModel)?r.targetModel:lt,[ze,r]),Me=u.useMemo(()=>r?On.filter(c=>Si(r.sourceProvider,c)!==null?!1:!bs(Ne[c]??null)):[],[r,Ne]),gn=u.useMemo(()=>r?Me.length>0?Me:[r.targetProvider]:[],[r,Me]),er=u.useMemo(()=>gn.map(c=>({value:c,label:os(c,"full")})),[gn]),jt=u.useMemo(()=>r?Ti(Ne[r.targetProvider]??xe??null):null,[xe,r,Ne]),Ut=m??null,be=f||Ut===!0,tr=be&&hn==="streaming_guidance"&&Ut===!1&&!Lr(e),vn=!ve&&be&&hn==="streaming_guidance"&&!tr,zt=!ve&&be&&typeof T=="function"&&Pr(e,Ut),J=!ve&&be&&!vn&&!zt,Dt=ve&&!!jt,xn=A.trim().length>0||U.length>0,bn=k===!1&&be?fn.allowed:k??fn.allowed,$t=be&&bn&&!!C&&!Qe,nr=!xn&&(Je||b||be||j),yn=$t?i("conversation.capabilityInterrupt"):i("conversation.runtimeRunning"),kn=be?zt?i("conversation.queueGuidanceButton"):vn?i("conversation.sendGuidanceButton"):i("conversation.sendButton"):i("conversation.sendButton"),sr=u.useCallback(c=>{$(c),Ht(Y)&&Ln({providers:{[Y]:{defaultModel:c}}}).catch(()=>{})},[Y]),rr=u.useCallback(c=>{X(c),Ht(Y)&&Ln({providers:{[Y]:{defaultReasoningLevel:c}}}).catch(()=>{})},[Y]),wt=u.useCallback(c=>{E.current.forEach(h=>{URL.revokeObjectURL(h)}),E.current.clear(),c.forEach(h=>{h.previewUrl&&E.current.add(h.previewUrl)}),K(c)},[]),nt=u.useCallback(c=>{c.length!==0&&K(h=>{const y=Ai(h,c);return y.forEach(w=>{w.previewUrl&&E.current.add(w.previewUrl)}),y})},[]),ir=u.useCallback(c=>{Z.current.delete(c),K(h=>{const y=h.find(w=>w.id===c);return y!=null&&y.previewUrl&&(E.current.delete(y.previewUrl),URL.revokeObjectURL(y.previewUrl)),h.filter(w=>w.id!==c)})},[]),Cn=u.useCallback(c=>{const h=Array.from(c.target.files??[]);h.length>0&&nt(h),c.target.value=""},[nt]),ar=u.useCallback(c=>{var y;R.isMobile||!te.allowed||J||!((((y=c.dataTransfer.files)==null?void 0:y.length)??0)>0||Array.from(c.dataTransfer.items??[]).some(w=>w.kind==="file"))||(c.preventDefault(),c.dataTransfer.dropEffect="copy",Be||me(!0),ee(!1))},[te.allowed,Be,J,R.isMobile]),or=u.useCallback(c=>{const h=c.relatedTarget;h instanceof Node&&c.currentTarget.contains(h)||me(!1)},[]),lr=u.useCallback(c=>{if(R.isMobile||!te.allowed||J)return;const h=Array.from(c.dataTransfer.files??[]);h.length!==0&&(c.preventDefault(),me(!1),nt(h))},[te.allowed,J,nt,R.isMobile]),jn=u.useCallback(c=>{if(!te.allowed||J)return;const h=c==="camera"?yt.current:Xe.current;Fn(h),se(!1)},[te.allowed,J]),cr=u.useCallback(()=>{if(!(!te.allowed||J)){if(ee(!1),R.isNativeMobile){Re.trigger("selection"),se(!0);return}Fn(Xe.current)}},[te.allowed,Re,J,R.isNativeMobile]),ur=u.useCallback(()=>{ee(c=>!c)},[]),dr=u.useCallback(c=>{var h;F(y=>y.trimStart().startsWith(c)?y:y.trim()?`${c} ${y.trim()}`:`${c} `),ee(!1),(h=Se.current)==null||h.focus()},[]),De=u.useCallback(async c=>{const h=G;V.current+=1,ae(c),fe(!0);try{const y=await Ir(c.map(w=>({id:w.id,text:w.text})));return ae(y.items.map(w=>({id:w.id,text:w.text}))),!0}catch(y){return ae(h),Te({title:y instanceof Error?y.message:i("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{fe(!1)}},[G,Te]),mr=u.useCallback(async()=>{const c=Oe.trim();!c||!await De([...G,fi(c)])||(bt(""),pe(!1))},[De,Oe,G]),pr=u.useCallback(c=>{De(G.filter(h=>h.id!==c))},[De,G]),wn=u.useCallback((c,h)=>{const y=G.findIndex(W=>W.id===c);if(y<0)return;const w=y+h;if(w<0||w>=G.length)return;const _=[...G],[q]=_.splice(y,1);_.splice(w,0,q),De(_)},[De,G]),fr=u.useCallback(c=>{var h;F(c),ke(!1),(h=Se.current)==null||h.focus()},[]),Nn=u.useCallback(c=>{const h=c?hi(c):null,y=(h==null?void 0:h.attachments.map(w=>ji(w)))??[];Z.current=new Map(((h==null?void 0:h.attachments)??[]).map(w=>[w.id,w])),wt(y),F((h==null?void 0:h.content)??""),ee(!1)},[wt]);u.useEffect(()=>{if(!ce.length)return;if(et&&ce.some(h=>h.id===et)){L!==et&&$(et);return}if(ce.some(h=>h.id===L))return;const c=ce[0].id;$(c)},[ce,Y,L,et]),u.useEffect(()=>{if(!Er(Y)||ie.length===0)return;if(tt&&ie.some(y=>y.value===tt)){H!==tt&&X(tt);return}const c=e==null?void 0:e.defaultReasoningLevel;if(c&&ie.some(y=>y.value===c)){H!==c&&X(c);return}if(ie.some(y=>y.value===H))return;const h=ie[0].value;X(h)},[ie,e==null?void 0:e.defaultReasoningLevel,Y,H,tt]),u.useEffect(()=>{let c=!1;const h=V.current;return Br().then(y=>{c||V.current!==h||ae(y.items.map(w=>({id:w.id,text:w.text})))}).catch(()=>{}),()=>{c=!0}},[]),u.useEffect(()=>{Nn(n)},[n,Nn]),u.useEffect(()=>{if(!n)return;const c=n,h=new Set(U.map(_=>_.id));Z.current.forEach((_,q)=>{h.has(q)||Z.current.delete(q)});let y=!1;async function w(){if(A.length===0&&U.length===0){gs(c);return}const _=await Promise.all(U.map(async q=>{const W=Z.current.get(q.id);return W&&W.fileName===q.file.name&&W.fileSize===q.file.size&&W.lastModified===q.file.lastModified&&W.mimeType===ct(q.file)?W:{id:q.id,fileName:q.file.name,mimeType:ct(q.file),fileSize:q.file.size,lastModified:q.file.lastModified,contentBase64:await Un(q.file)}}));y||(Z.current=new Map(_.map(q=>[q.id,q])),gi(c,{content:A,attachments:_}))}return w(),()=>{y=!0}},[U,A,n]),u.useEffect(()=>{const c=Se.current;c&&(c.style.height="0px",c.style.height=`${Math.min(c.scrollHeight,120)}px`)},[A]),u.useEffect(()=>{te.allowed||(Z.current.clear(),se(!1),wt([]))},[te.allowed,wt]),u.useEffect(()=>{R.isMobile||se(!1)},[R.isMobile]),u.useEffect(()=>()=>{E.current.forEach(c=>{URL.revokeObjectURL(c)}),E.current.clear()},[]),u.useEffect(()=>{function c(){var h;(h=Se.current)==null||h.focus()}return window.addEventListener(Bn,c),()=>{window.removeEventListener(Bn,c)}},[]),u.useEffect(()=>{if(!r){Q(null),we(!1),oe({}),qe(null);return}if(Ct){Q(null),we(!1);return}let c=!1;return Q(Kt(r.targetProvider)),we(!0),Or(r.targetProvider,r.workspaceId).then(h=>{c||Q(h)}).catch(()=>{c||Q(Kt(r.targetProvider))}).finally(()=>{c||we(!1)}),()=>{c=!0}},[r==null?void 0:r.targetProvider,r==null?void 0:r.workspaceId,Ct]),u.useEffect(()=>{if(!r){oe({});return}let c=!1;return _r(On,r.workspaceId).then(h=>{c||oe(h)}),()=>{c=!0}},[r==null?void 0:r.workspaceId]),u.useEffect(()=>{!r||!o||Me.length!==0&&(Me.includes(r.targetProvider)||o({...r,targetProvider:Me[0]??r.targetProvider,targetModel:null}))},[r,o,Me]),u.useEffect(()=>{!r||!r.targetModel||!o||ze.some(c=>c.id===r.targetModel)||o({...r,targetModel:null})},[ze,r,o]);const hr=u.useCallback(c=>{if(!(!r||!o||c===r.targetProvider)){if(c!==r.sourceProvider&&r.targetProvider===r.sourceProvider){qe(c);return}o({...r,targetProvider:c,targetModel:null})}},[r,o]),gr=u.useCallback(c=>{!r||!o||o({...r,targetModel:c===lt?null:c})},[r,o]),vr=u.useCallback(()=>{!r||!ge||!o||(o({...r,targetProvider:ge,targetModel:null}),qe(null))},[r,o,ge]),Sn=u.useCallback(()=>{qe(null)},[]);async function xr(c){if(We.current)return;const h=A.trim(),y=U;if(h.length===0&&y.length===0||!Wt.allowed||J||Dt){Te({title:J?i("conversation.runtimeRunning"):jt??Wt.reason??i("conversation.capabilityDenied"),tone:"error"});return}We.current=!0,Re.trigger(c==="queue"?"selection":"action"),je(!0),F(""),K([]),se(!1),me(!1),ke(!1),pe(!1),ee(!1);try{const w=await Promise.all(y.map(async W=>({kind:W.kind,fileName:W.file.name,mimeType:ct(W.file),fileSize:W.file.size,contentBase64:await Un(W.file)}))),_=y.map(W=>Ri(W.file,W.id));await(c==="queue"&&T?T:M)(h,{model:ve||ue!=null&&ue.usesProviderDefault?void 0:L||void 0,reasoningLevel:ve?void 0:kt&&ie.length>0?H:void 0,attachments:w,attachmentMeta:_}),Mi(y),y.forEach(W=>{W.previewUrl&&E.current.delete(W.previewUrl)})}catch(w){F(h),K(y),Te({title:w instanceof Error&&w.message==="FILE_READ_FAILED"?i("conversation.attachmentReadFailed"):w instanceof Error?w.message:i("conversation.capabilityDenied"),tone:"error"})}finally{je(!1),We.current=!1}}async function Tn(c){c.preventDefault(),await xr(zt?"queue":"send")}async function br(){if(!(!bn||!C||Qe))try{Ze(!0),Re.trigger("action"),await C()}catch(c){Te({title:c instanceof Error?c.message:i("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{Ze(!1)}}const Rn=Je||b||J||Dt||!Wt.allowed||!xn,Mn=Je||b||J||!te.allowed,yr=A.length===0&&!J,An=s.jsxs("section",{ref:l,className:"composer-panel",children:[s.jsxs("form",{className:"composer-form",onSubmit:Tn,children:[s.jsx("input",{id:I,ref:Xe,type:"file",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:_n,onChange:Cn}),s.jsx("input",{id:D,ref:yt,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:_n,onChange:Cn}),s.jsxs("div",{className:"composer-input-container","data-drag-active":Be?"true":void 0,onDragOver:ar,onDragLeave:or,onDrop:lr,children:[r?s.jsxs("div",{className:"composer-fork-draft",children:[s.jsxs("div",{className:"composer-fork-draft-main",children:[s.jsxs("div",{className:"composer-fork-draft-copy",children:[s.jsx("span",{className:"composer-fork-draft-label",children:i("conversation.forkDraftLabel")}),s.jsx("span",{className:"composer-fork-draft-text",children:Ni(r.content)})]}),s.jsxs("div",{className:"composer-fork-config",children:[s.jsxs("div",{className:"composer-fork-config-grid",children:[s.jsxs("div",{className:"composer-fork-field",children:[s.jsx("span",{className:"composer-fork-model-label",children:i("conversation.forkTargetProviderLabel")}),s.jsx(St,{ariaLabel:i("conversation.forkTargetProviderLabel"),value:r.targetProvider,options:er,onChange:c=>hr(c),compact:!0})]}),s.jsxs("div",{className:"composer-fork-field",children:[s.jsx("span",{className:"composer-fork-model-label",children:i("conversation.forkTargetModelLabel")}),s.jsx(St,{ariaLabel:i("conversation.forkTargetModelLabel"),value:Xs,options:Ys,onChange:gr,disabled:_e||Dt,compact:!0})]})]}),jt?s.jsx("p",{className:"composer-capability-hint",children:jt}):null]})]}),a?s.jsx("button",{type:"button",className:"composer-fork-draft-clear","aria-label":i("conversation.forkDraftClear"),title:i("conversation.forkDraftClear"),onClick:a,children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):null]}):null,U.length>0?s.jsx("div",{className:"composer-attachments",children:U.map(c=>s.jsxs("div",{className:"composer-attachment-card",children:[c.previewUrl?s.jsx("img",{src:c.previewUrl,alt:i("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}):s.jsx("div",{className:"composer-attachment-file","aria-hidden":"true",children:s.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[s.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),s.jsx("path",{d:"M14 2v5h5"}),s.jsx("path",{d:"M9 13h6"}),s.jsx("path",{d:"M9 17h6"})]})}),s.jsxs("div",{className:"composer-attachment-meta",children:[s.jsx("span",{className:"attachment-name",title:c.file.name,children:c.file.name}),s.jsx("span",{className:"attachment-size",children:wi(c.file.size)})]}),s.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>ir(c.id),"aria-label":i("conversation.removeAttachment"),children:s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},c.id))}):null,Be?s.jsx("div",{className:"composer-drop-hint",children:i("conversation.attachmentDropHint")}):null,s.jsxs("div",{className:"composer-input-wrapper",children:[s.jsx("textarea",{ref:Se,className:"composer-input",value:A,placeholder:t??i("conversation.composerPlaceholder"),readOnly:J,"aria-readonly":J,onChange:c=>F(c.target.value),rows:1,onFocus:()=>ee(!1),onCompositionStart:()=>{Ue(),Fe.current=!0},onCompositionEnd:()=>{Fe.current=!1,p.current=!0,N.current=globalThis.setTimeout(()=>{p.current=!1,N.current=null},0)},onPaste:c=>{if(J||!te.allowed)return;const h=Array.from(c.clipboardData.items).filter(y=>y.kind==="file").map(y=>y.getAsFile()).filter(y=>!!y);h.length!==0&&(c.preventDefault(),nt(h))},onKeyDown:c=>{if(c.key==="Escape"&&ee(!1),c.key==="Enter"&&!c.shiftKey){if(Li(c,Fe.current,p.current))return;c.preventDefault(),Rn||Tn(c)}}}),s.jsx("div",{className:"composer-input-actions",children:nr?s.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!$t,onClick:()=>{$t&&br()},"aria-label":yn,title:yn,children:s.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:s.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):s.jsx("button",{className:"composer-send",type:"submit",disabled:Rn,"aria-label":kn,title:kn,children:s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[s.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),s.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]}),he?s.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":i("conversation.slashMenuTitle"),children:Zs.map(c=>s.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>dr(c.command),children:[s.jsx("span",{className:"composer-slash-command",children:c.command}),s.jsx("span",{className:"composer-slash-label",children:c.label})]},c.command))}):null,s.jsxs("div",{className:"composer-controls",children:[s.jsxs("div",{className:"composer-controls-left",children:[te.allowed?R.isNativeMobile?s.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":i("conversation.attachFiles"),title:i("conversation.attachFiles"),disabled:Mn,onClick:cr,children:s.jsx(Qt,{})}):Mn?s.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":i("conversation.attachFiles"),title:i("conversation.attachFiles"),disabled:!0,children:s.jsx(Qt,{})}):s.jsx("label",{htmlFor:I,className:"composer-attach-btn","aria-label":i("conversation.attachFiles"),title:i("conversation.attachFiles"),onClick:()=>{ee(!1)},children:s.jsx(Qt,{})}):null,ve?null:s.jsx(St,{ariaLabel:i("conversation.modelSelectorLabel"),value:L,options:Gs,onChange:sr}),!ve&&kt&&ie.length>0?s.jsx(St,{ariaLabel:i("conversation.reasoningSelectorLabel"),value:H,options:Qs,onChange:c=>rr(c),compact:!0}):null,Vs?s.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:ur,title:i("conversation.slashMenu"),children:[s.jsx("span",{className:"slash-icon",children:"/"}),s.jsx("span",{children:i("conversation.slashMenu")})]}):null,s.jsx(qi,{contextUsage:v}),s.jsx(oi,{provider:x,messages:g,variant:"composer"})]}),yr?s.jsx("div",{className:"composer-quick-phrase-group",children:s.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":i("conversation.quickPhraseTrigger"),title:i("conversation.quickPhraseTrigger"),onClick:()=>{ke(!0),ee(!1)},children:s.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("path",{d:"M7 8h10"}),s.jsx("path",{d:"M7 12h8"}),s.jsx("path",{d:"M7 16h5"}),s.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})})}):null]})]})]}),s.jsx(Mt,{open:re,title:i("conversation.quickPhraseModalTitle"),description:i("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{ke(!1),pe(!1)},children:s.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[s.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[s.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:s.jsx("span",{children:i("conversation.quickPhraseListLabel")})}),s.jsx("button",{type:"button",className:"primary-button",disabled:Ce,onClick:()=>pe(!0),children:i("conversation.quickPhraseOpenCreateAction")})]}),s.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":i("conversation.quickPhraseListLabel"),children:G.length===0?s.jsx("div",{className:"composer-quick-phrase-empty",children:i("conversation.quickPhraseEmpty")}):G.map((c,h)=>s.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[s.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>fr(c.text),children:[s.jsx("span",{className:"composer-quick-phrase-order",children:i("conversation.quickPhraseOrderLabel",{index:h+1})}),s.jsx("span",{className:"composer-quick-phrase-text",children:c.text})]}),s.jsxs("div",{className:"composer-quick-phrase-actions",children:[s.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:Ce||h===0,"aria-label":i("conversation.quickPhraseMoveUp"),title:i("conversation.quickPhraseMoveUp"),onClick:()=>wn(c.id,-1),children:"↑"}),s.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:Ce||h===G.length-1,"aria-label":i("conversation.quickPhraseMoveDown"),title:i("conversation.quickPhraseMoveDown"),onClick:()=>wn(c.id,1),children:"↓"}),s.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:Ce,"aria-label":i("conversation.quickPhraseDelete"),title:i("conversation.quickPhraseDelete"),onClick:()=>pr(c.id),children:"×"})]})]},c.id))})]})}),s.jsx(Mt,{open:xt,title:i("conversation.quickPhraseCreateModalTitle"),description:i("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>pe(!1),children:s.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[s.jsxs("label",{className:"workbench-modal-field",children:[s.jsx("span",{children:i("conversation.quickPhraseCreateLabel")}),s.jsx("textarea",{className:"composer-quick-phrase-textarea",value:Oe,placeholder:i("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:c=>bt(c.target.value)})]}),s.jsxs("div",{className:"workbench-modal-actions",children:[s.jsx("button",{type:"button",className:"secondary-button",onClick:()=>pe(!1),children:i("common.cancel")}),s.jsx("button",{type:"button",className:"primary-button",disabled:Ce||Oe.trim().length===0,onClick:()=>{mr()},children:i("conversation.quickPhraseCreateAction")})]})]})}),s.jsx(Mt,{open:ge!==null,title:i("conversation.forkSwitchConfirmTitle"),description:i("conversation.forkSwitchConfirmDescription"),className:"composer-fork-confirm-modal",onClose:Sn,children:s.jsxs("div",{className:"composer-fork-confirm-body",children:[s.jsxs("div",{className:"composer-fork-confirm-list",children:[s.jsxs("div",{className:"composer-fork-confirm-item",children:[s.jsx("span",{className:"composer-fork-confirm-icon is-keep","aria-hidden":"true",children:s.jsx(Bi,{})}),s.jsxs("div",{className:"composer-fork-confirm-copy",children:[s.jsx("strong",{children:i("conversation.forkSwitchConfirmKeepTitle")}),s.jsx("p",{children:i("conversation.forkSwitchConfirmKeepBody")})]})]}),s.jsxs("div",{className:"composer-fork-confirm-item",children:[s.jsx("span",{className:"composer-fork-confirm-icon is-convert","aria-hidden":"true",children:s.jsx(Oi,{})}),s.jsxs("div",{className:"composer-fork-confirm-copy",children:[s.jsx("strong",{children:i("conversation.forkSwitchConfirmConvertTitle")}),s.jsx("p",{children:i("conversation.forkSwitchConfirmConvertBody")})]})]}),s.jsxs("div",{className:"composer-fork-confirm-item",children:[s.jsx("span",{className:"composer-fork-confirm-icon is-drop","aria-hidden":"true",children:s.jsx(_i,{})}),s.jsxs("div",{className:"composer-fork-confirm-copy",children:[s.jsx("strong",{children:i("conversation.forkSwitchConfirmDropTitle")}),s.jsx("p",{children:i("conversation.forkSwitchConfirmDropBody")})]})]})]}),s.jsxs("div",{className:"workbench-modal-actions",children:[s.jsx("button",{type:"button",className:"secondary-button",onClick:Sn,children:i("conversation.forkSwitchKeepNative")}),s.jsx("button",{type:"button",className:"primary-button",onClick:vr,children:i("conversation.forkSwitchConfirmAction")})]})]})}),s.jsx(Pi,{open:Ee&&R.isNativeMobile,onClose:()=>se(!1),onSelectCamera:()=>jn("camera"),onSelectLibrary:()=>jn("library")})]});return d?on.createPortal(An,d):An}function Pi({open:e,onClose:t,onSelectCamera:n,onSelectLibrary:r}){return s.jsx(qr,{open:e,title:i("conversation.attachmentSourceSheetTitle"),description:i("conversation.attachmentSourceSheetDescription"),kind:"action",height:"auto",className:"composer-attachment-sheet",cardClassName:"composer-attachment-sheet-card",bodyClassName:"composer-attachment-sheet-body",showHandle:!0,onClose:t,children:s.jsxs(Wr,{className:"composer-attachment-sheet-actions",children:[s.jsx(In,{as:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":i("conversation.attachmentTakePhoto"),label:i("conversation.attachmentTakePhoto"),description:i("conversation.attachmentTakePhotoHint"),trailing:s.jsx(Ii,{}),onClick:n}),s.jsx(In,{as:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":i("conversation.attachmentChooseFromLibrary"),label:i("conversation.attachmentChooseFromLibrary"),description:i("conversation.attachmentChooseFromLibraryHint"),trailing:s.jsx(Ei,{}),onClick:r})]})})}function Ii(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[s.jsx("path",{d:"M4 8h3l1.5-2h7L17 8h3a1 1 0 0 1 1 1v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a1 1 0 0 1 1-1Z"}),s.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function Qt(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),s.jsx("path",{d:"M8 12h8M12 8v8"})]})}function Ei(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[s.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),s.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),s.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function Bi(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[s.jsx("path",{d:"M12 3 4 7v5c0 5 3.5 8 8 9 4.5-1 8-4 8-9V7l-8-4Z"}),s.jsx("path",{d:"m9.5 12 1.8 1.8L15 10.2"})]})}function Oi(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[s.jsx("path",{d:"M4 7h9"}),s.jsx("path",{d:"m10 3 4 4-4 4"}),s.jsx("path",{d:"M20 17h-9"}),s.jsx("path",{d:"m14 13-4 4 4 4"})]})}function _i(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[s.jsx("path",{d:"m7 7 10 10"}),s.jsx("path",{d:"M17 7 7 17"}),s.jsx("path",{d:"M12 3v2"}),s.jsx("path",{d:"M12 19v2"})]})}function St({ariaLabel:e,value:t,options:n,onChange:r,disabled:a=!1,compact:o=!1}){const[l,d]=u.useState(!1),m=u.useRef(null),k=u.useRef(null),v=u.useRef(null),[x,g]=u.useState(null),j=u.useId(),b=n.find(C=>C.value===t)??n[0]??null,f=u.useCallback(()=>{const C=k.current;if(!C||typeof window>"u")return;const T=C.getBoundingClientRect(),M=window.innerWidth,R=window.innerHeight,I=12,D=10,A=Math.max(160,M-I*2),F=o?140:220,L=Math.min(A,Math.max(T.width,F)),$=Math.min(Math.max(I,T.left),Math.max(I,M-L-I)),H=T.top-I,X=R-T.bottom-I,U=H>=180||H>=X;g({position:"fixed",left:$,width:L,maxWidth:A,top:U?void 0:T.bottom+D,bottom:U?R-T.top+D:void 0})},[o]);return u.useEffect(()=>{if(!l)return;function C(M){var I,D;const R=M.target;!((I=m.current)!=null&&I.contains(R))&&!((D=v.current)!=null&&D.contains(R))&&d(!1)}function T(M){M.key==="Escape"&&d(!1)}return window.addEventListener("pointerdown",C),window.addEventListener("keydown",T),window.addEventListener("resize",f),window.addEventListener("scroll",f,!0),f(),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",T),window.removeEventListener("resize",f),window.removeEventListener("scroll",f,!0)}},[l,f]),b?s.jsxs("div",{ref:m,className:`composer-mac-select ${o?"is-compact":""}`,"data-open":l?"true":"false",children:[s.jsxs("button",{ref:k,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":l,"aria-controls":j,disabled:a,onClick:()=>d(C=>!C),children:[s.jsx("span",{className:"composer-mac-select-label",children:b.label}),s.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),l&&x&&typeof document<"u"?on.createPortal(s.jsx("div",{ref:v,className:"composer-mac-select-popover",style:x,role:"presentation",children:s.jsx("div",{id:j,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:n.map(C=>{const T=C.value===t;return s.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`composer-mac-select-option ${T?"is-selected":""}`,onClick:()=>{r(C.value),d(!1)},children:[s.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:T?"✓":""}),s.jsx("span",{className:"composer-mac-select-option-label",children:C.label})]},C.value)})})}),document.body):null]}):null}function qi({contextUsage:e}){const[t,n]=u.useState(!1),r=u.useRef(null),a=u.useRef(null),[o,l]=u.useState(null),d=u.useId(),m=e?Math.round(e.usageRatio*100):null,k=e?Math.max(0,Math.min(e.usageRatio,1)):0,v=Wi(k),x=e?Fi(e.contextWindowSource):null,g=e?`${i("conversation.contextUsageTitle")} ${m}%`:i("conversation.contextUsageUnavailable"),j=u.useCallback(()=>{const b=r.current;if(!b||typeof window>"u")return;const f=b.getBoundingClientRect(),C=window.innerWidth,T=window.innerHeight,M=12,R=10,I=Math.min(240,Math.max(188,C-M*2)),D=Math.min(Math.max(M,f.left+f.width/2-I/2),Math.max(M,C-I-M)),A=f.top-M,F=T-f.bottom-M,L=A>=140||A>=F;l({position:"fixed",left:D,width:I,maxWidth:C-M*2,top:L?void 0:f.bottom+R,bottom:L?T-f.top+R:void 0})},[]);return u.useEffect(()=>{if(!t)return;function b(C){var M,R;const T=C.target;!((M=r.current)!=null&&M.contains(T))&&!((R=a.current)!=null&&R.contains(T))&&n(!1)}function f(C){C.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",b),window.addEventListener("keydown",f),window.addEventListener("resize",j),window.addEventListener("scroll",j,!0),j(),()=>{window.removeEventListener("pointerdown",b),window.removeEventListener("keydown",f),window.removeEventListener("resize",j),window.removeEventListener("scroll",j,!0)}},[t,j]),s.jsxs(s.Fragment,{children:[s.jsx("button",{ref:r,type:"button",className:`composer-context-ring ${v}`,style:{"--context-usage-progress":`${k}`},"aria-label":g,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>n(b=>!b),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:s.jsx("span",{className:"composer-context-ring-value",children:m===null?"--":s.jsxs(s.Fragment,{children:[s.jsx("span",{children:m}),s.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&o&&typeof document<"u"?on.createPortal(s.jsx("div",{ref:a,id:d,className:"composer-context-tooltip",style:o,role:"tooltip",children:e?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"composer-context-tooltip-title",children:i("conversation.contextUsageTitle")}),s.jsxs("div",{className:"composer-context-tooltip-line",children:[m,"% · ",Zt(e.promptTokens)," /"," ",Zt(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?s.jsx("div",{className:"composer-context-tooltip-line",children:i("conversation.contextUsageCachedTokens").replace("{count}",Zt(e.cachedInputTokens))}):null,x?s.jsx("div",{className:"composer-context-tooltip-meta",children:x}):null,e.isEstimated?s.jsx("div",{className:"composer-context-tooltip-meta",children:i("conversation.contextUsageEstimated")}):null]}):s.jsx("div",{className:"composer-context-tooltip-line",children:i("conversation.contextUsageUnavailable")})}),document.body):null]})}function Wi(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function Fi(e){switch(e){case"provider-log":return i("conversation.contextUsageSourceProviderLog");case"provider-runtime":return i("conversation.contextUsageSourceProviderRuntime");case"provider-config":return i("conversation.contextUsageSourceProviderConfig");case"model-map":return i("conversation.contextUsageSourceModelMap");default:return""}}function Zt(e){return new Intl.NumberFormat().format(e)}const Lt="*** Begin Patch",Pt="*** End Patch";function zn(e){const t=e.replace(/\r\n/g,`
|
|
2
|
+
`);if(!t.includes(Lt)||!t.includes(Pt))return null;const n=t.split(`
|
|
3
|
+
`),r=[];let a=null,o=null;for(const l of n){if(l===Lt||l===Pt)continue;if(l.startsWith("*** Update File: ")){a=Jt("update",l.slice(17)),r.push(a),o=null;continue}if(l.startsWith("*** Add File: ")){a=Jt("add",l.slice(14)),r.push(a),o={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){a=Jt("delete",l.slice(17)),r.push(a),o=null;continue}if(!a)continue;if(l.startsWith("*** Move to: ")){a.nextPath=l.slice(13),a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("@@")){o=$i(l)??{oldLineNumber:0,newLineNumber:0},a.lines.push({kind:"hunk",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l==="*** End of File"){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(a.action==="add"&&l.startsWith("+")){a.additions+=1,a.statsKnown=!0,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:(o==null?void 0:o.newLineNumber)??a.additions}),o&&(o.newLineNumber+=1);continue}if(!o){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("+")){a.additions+=1,a.statsKnown=!0,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:o.newLineNumber}),o.newLineNumber+=1;continue}if(l.startsWith("-")){a.deletions+=1,a.statsKnown=!0,a.lines.push({kind:"remove",text:l,oldLineNumber:o.oldLineNumber,newLineNumber:null}),o.oldLineNumber+=1;continue}if(l.startsWith(" ")||l.length===0){a.lines.push({kind:"context",text:l,oldLineNumber:o.oldLineNumber,newLineNumber:o.newLineNumber}),o.oldLineNumber+=1,o.newLineNumber+=1;continue}a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null})}return r.length===0?null:{files:r,totalAdditions:r.reduce((l,d)=>l+d.additions,0),totalDeletions:r.reduce((l,d)=>l+d.deletions,0)}}function Ui(e,t=[]){const n=e.replace(/\r\n/g,`
|
|
4
|
+
`).trim();if(!n)return null;if(n.includes(Lt)&&n.includes(Pt))return n;const r=[...new Set(t.map(a=>a.trim()).filter(a=>a.length>0))];return r.length!==1||!Hi(n)?null:[Lt,`*** Update File: ${r[0]}`,n,Pt].join(`
|
|
5
|
+
`)}function zi(e){const t=Ki(e);if(!t)return[];const n=t.replace(/\r\n/g,`
|
|
6
|
+
`).split(`
|
|
7
|
+
`),r=[];let a=!1;for(const o of n){const l=o.trim();if(!a){/^Success\.\s+Updated the following files:/i.test(l)&&(a=!0);continue}if(!l){if(r.length>0)break;continue}const d=l.match(/^[A-Z?]\s+(.+)$/),m=((d==null?void 0:d[1])??l).trim();if(!m)break;r.push(m)}return[...new Set(r)]}function Di(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Jt(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,statsKnown:!1,lines:[]}}function $i(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}function Hi(e){return e.startsWith("@@")||e.startsWith("*** Update File: ")||e.startsWith("*** Add File: ")||e.startsWith("*** Delete File: ")||e.includes(`
|
|
8
|
+
@@`)||e.startsWith("+")||e.startsWith("-")}function Ki(e){const t=e.trim();if(!t)return"";if(!t.startsWith("{"))return t;try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return t;const r=n;if(typeof r.output=="string"&&r.output.trim().length>0)return r.output;if(typeof r.result=="string"&&r.result.trim().length>0)return r.result;if(typeof r.message=="string"&&r.message.trim().length>0)return r.message}catch{return t}return t}const Vi=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,Gi=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,Qi=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,Zi=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi,Ji=/\[\[CODINGNS_IMAGE_ATTACHMENTS\]\][\s\S]*?\[\[\/CODINGNS_IMAGE_ATTACHMENTS\]\]/g;function ut(e){const t=Yi(e),n=Xi(t);return n||ys(t)}function Yi(e){return e.replace(Ji,"")}function Xi(e){const t=e.trim();if(!ea(t))return null;try{const n=JSON.parse(t),r=ta(n);return r.text||r.inlineImages.length>0?r:null}catch{return null}}function ea(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function ta(e){const t=[],n=[];return At(e,t,n),{text:Cs(t.join(`
|
|
9
|
+
|
|
10
|
+
`)),inlineImages:ks(n)}}function At(e,t,n){if(typeof e=="string"){const l=ys(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>At(l,t,n));return}if(typeof e!="object")return;const r=e,a=new Set,o=na(r);o&&(n.push(o),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(l=>{l in r&&a.add(l)}));for(const l of["image_url","url","src","source"]){const d=r[l];typeof d!="string"||!js(d)||(n.push(Pe(d,ne(r.alt))),a.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in r&&(a.add(l),At(r[l],t,n));a.size>0||Object.values(r).forEach(l=>{At(l,t,n)})}function ys(e){const t=[];let n=e;return n=n.replace(Zi,(r,a,o)=>{const l=oa(a,"name"),d=aa(o);return d!=null&&d.url&&t.push(Pe(d.url,d.altText||l)),""}),n=n.replace(Gi,(r,a,o)=>(t.push(Pe(o,a)),"")),n=n.replace(Qi,(r,a)=>(t.push(Pe(a,null)),"")),n=n.replace(Vi,(r,a,o)=>(t.push(Pe(r,null,`image/${a}`,It(o))),"")),{text:Cs(n),inlineImages:ks(t)}}function Pe(e,t,n,r){const a=n??sa(e)??"image/png";return{url:e,mimeType:a,altText:dt(t),estimatedBytes:r??ra(e)}}function na(e){const t=ia(e.source);if(t){const a=ne(t.type).trim().toLowerCase(),o=$n(t.media_type??t.mime_type??t.mimeType),l=Dn(t.data);if(a==="base64"&&o&&l)return Pe(`data:${o};base64,${l}`,dt(ne(t.alt)||ne(t.name)||ne(e.alt)||ne(e.name)),o,It(l))}const n=$n(e.media_type??e.mime_type??e.mimeType),r=Dn(e.data);return n&&r?Pe(`data:${n};base64,${r}`,dt(ne(e.alt)||ne(e.name)),n,It(r)):null}function ks(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function Cs(e){return e.replace(/\r\n/g,`
|
|
11
|
+
`).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
|
|
12
|
+
`).replace(/\n{3,}/g,`
|
|
13
|
+
|
|
14
|
+
`).trim()}function js(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function sa(e){var n;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())??null}function ra(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?It(t[1]):null}function It(e){const t=e.trim(),n=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-n)}function dt(e){const t=ne(e).trim();return t.length>0?t:null}function Dn(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function $n(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function ne(e){return typeof e=="string"?e:""}function ia(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function aa(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),r=ne(n.image_url??n.imageUrl).trim(),a=dt(ne(n.name)||ne(n.alt));return{url:js(r)?r:null,altText:a}}catch{const n=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return n?{url:n[1],altText:null}:null}}function oa(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return dt((r==null?void 0:r[1])??(r==null?void 0:r[2])??(r==null?void 0:r[3])??(r==null?void 0:r[4])??"")}const ws="codingns.user-app.conversation-scroll",$e=1,la=200,ca=1e7;function Ns(){return typeof window<"u"&&typeof window.localStorage<"u"}function Ss(e){return e.trim()}function Ts(e){return!Number.isFinite(e)||e<=0?0:Math.min(Math.round(e),ca)}function Rs(e){return!e||typeof e!="object"?null:{scrollTop:Ts(e.scrollTop),stickToBottom:e.stickToBottom===!0,lastMessageSignature:typeof e.lastMessageSignature=="string"?e.lastMessageSignature:null,updatedAt:Number.isFinite(e.updatedAt)?e.updatedAt:0}}function Ms(){if(!Ns())return{schemaVersion:$e,bySessionId:{}};const e=window.localStorage.getItem(ws);if(!e)return{schemaVersion:$e,bySessionId:{}};try{const t=JSON.parse(e);if(!t||typeof t!="object"||t.schemaVersion!==$e||!t.bySessionId||typeof t.bySessionId!="object"||Array.isArray(t.bySessionId))return{schemaVersion:$e,bySessionId:{}};const n=Object.fromEntries(Object.entries(t.bySessionId).map(([r,a])=>{const o=Rs(a);return o?[r,o]:null}).filter(r=>!!r));return{schemaVersion:$e,bySessionId:n}}catch{return{schemaVersion:$e,bySessionId:{}}}}function ua(e){if(Ns())try{window.localStorage.setItem(ws,JSON.stringify(e))}catch{}}function Tt(e){const t=Ss(e);if(!t)return null;const n=Ms().bySessionId[t],r=Rs(n);return r?{scrollTop:r.scrollTop,stickToBottom:r.stickToBottom,lastMessageSignature:r.lastMessageSignature}:null}function Hn(e,t){const n=Ss(e);if(!n)return;const r=Ms();r.bySessionId[n]={scrollTop:Ts(t.scrollTop),stickToBottom:t.stickToBottom,lastMessageSignature:t.lastMessageSignature,updatedAt:Date.now()};const a=Object.entries(r.bySessionId).sort((o,l)=>l[1].updatedAt-o[1].updatedAt).slice(0,la);r.bySessionId=Object.fromEntries(a),ua(r)}function da(e){return e.replace(/(\.{3,}|…+)$/,"").trimEnd()}function As(e){var r;const t=e.match(/^\s*<turn_aborted>([\s\S]*?)<\/turn_aborted>\s*$/i);if(!t)return null;const n=((r=t[1])==null?void 0:r.trim())??"";return!n||/^previous turn aborted$/i.test(n)?{detail:null}:{detail:n}}function ma(e){return e==="user"?i("conversation.turnAbortedUser"):e==="runtime"?i("conversation.turnAbortedUnexpected"):i("conversation.turnAbortedGeneric")}const pa=480,Kn=80,Vn=240,fa=120,ha=18,ga=50,va=3500,Ls=u.createContext(!1);function rn(e){return e.replace(/\\/g,"/")}function Et(e){return/^[a-zA-Z]:\//.test(e)}function xa(e){return e.startsWith("/")||e.startsWith("//")||Et(e)}function ba(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!Et(e)}function Gn(e){return e.replace(/\/+$/,"")}function ya(e){const t=e.indexOf("#"),n=t>=0?e.slice(0,t):e,r=n.indexOf("?");return(r>=0?n.slice(0,r):n).replace(/:(\d+)(?::(\d+))?$/,"")}function ka(e){const t=[];for(const n of rn(e).split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function cn(e){try{return decodeURIComponent(e)}catch{return e}}function Ca(e,t){const n=cn(e).trim();if(!n||n.startsWith("#"))return null;let r=n;if(/^file:\/\//i.test(r))try{r=decodeURIComponent(new URL(r).pathname),/^\/[a-zA-Z]:\//.test(r)&&(r=r.slice(1))}catch{return null}else if(ba(r))return null;if(r=rn(ya(r.trim())),!r)return null;const a=Gn(rn(t.trim()));if(!a)return null;if(xa(r)){const o=Gn(r),l=Et(a)?a.toLowerCase():a,d=Et(o)?o.toLowerCase():o;if(d===l)return null;const m=`${l}/`;return d.startsWith(m)?o.slice(a.length+1):null}return ka(r)}function Bt(e){return e.kind==="tool_call"||e.kind==="tool_result"}function Ps(e){return e.toolCall?e.toolCall:Bt(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function ja(e){return e==="shell_command"||e==="tool"?i("conversation.roleTool"):e}function un(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function Ae(e,t){const n=e[t];return typeof n=="string"?n:""}function mt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function z(e,t){if(!e)return null;const n=e[t];return mt(n)?n:null}function Yt(e,t){if(!e)return null;const n=e[t];return Array.isArray(n)?n:null}function P(e,t){if(!e)return null;const n=e[t];if(typeof n=="string"){const r=n.trim();return r||null}return typeof n=="number"||typeof n=="boolean"?String(n):null}function wa(e){const t=[e.output,e.input];for(const n of t){const r=Is(n,0);if(r)return r}return null}function Is(e,t){if(!(e!=null&&e.trim())||t>2)return null;try{return Es(JSON.parse(e),t)}catch{return null}}function Es(e,t){if(!mt(e))return null;if(Na(e))return{ok:!0,capability:P(e,"capability")??"",auditId:P(e,"auditId")??"",timestamp:P(e,"timestamp")??"",targetRef:{kind:P(z(e,"targetRef"),"kind")??"none",id:P(z(e,"targetRef"),"id")},payload:z(e,"payload")??{}};const n=["output","result","data","payload"];for(const r of n){const a=e[r];if(typeof a=="string"){const o=Is(a,t+1);if(o)return o}if(mt(a)){const o=Es(a,t+1);if(o)return o}}return null}function Na(e){return e.ok===!0&&typeof e.capability=="string"&&typeof e.auditId=="string"&&typeof e.timestamp=="string"&&mt(e.targetRef)&&mt(e.payload)}function Sa(e){const t=new Map,n=new Map,r=new Map;return e.forEach(a=>{t.set(a.workspace.id,a.workspace.name),a.sessions.forEach(o=>{const l=typeof o.title=="string"&&o.title.trim()?o.title.trim():o.sessionId;n.set(o.sessionId,l),r.set(o.sessionId,a.workspace.id)})}),{workspaceNamesById:t,sessionNamesById:n,sessionWorkspaceIdsById:r}}function Ta(e,t){const n=wa(e);return n?{...Os(n.capability),rows:_a(n,t)}:null}function Ra(e,t){const n=Ma(e);if(!n)return null;const r=Aa(n);return r?{...Ia(r),rows:Oa(r,t)}:null}function Ma(e){const t=un(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(!n)return null;const r=n.indexOf("codingns assistant");return r<0?null:n.slice(r).trim()}function Aa(e){const t=La(e),n=t.findIndex((v,x)=>v==="codingns"&&t[x+1]==="assistant");if(n<0)return null;const r=t.slice(n+2);if(r.length===0||r[0]==="--help"||r[0]==="-h")return{group:null,action:null,mode:"help",options:{},positionals:[]};if(r[0]==="help")return{group:r[1]??null,action:r[2]??null,mode:"help",options:{},positionals:[]};const a=r[0]??null,o=r[1],l=o&&!o.startsWith("-")?o:null,d=r.slice(l?2:1),{options:m,positionals:k}=Pa(d);return!l&&m["--help"]?{group:a,action:null,mode:"help",options:m,positionals:k}:{group:a,action:l,mode:"execute",options:m,positionals:k}}function La(e){const t=[],n=/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|`([^`\\]|\\.)*`|\S+/g;for(const r of e.matchAll(n)){const a=r[0]??"";if(!a)continue;const o=a[0];if((o==='"'||o==="'"||o==="`")&&a[a.length-1]===o){t.push(a.slice(1,-1));continue}t.push(a)}return t}function Pa(e){const t={},n=[];for(let r=0;r<e.length;r+=1){const a=e[r]??"";if(!a.startsWith("--")){n.push(a);continue}const o=e[r+1];if(!o||o.startsWith("--")){t[a]=!0;continue}t[a]=o,r+=1}return{options:t,positionals:n}}function Ia(e){if(e.mode==="help")return Ea(e.group,e.action);const t=Ba(e.group,e.action);return t?Os(t):{kind:dn(e.group),badge:Bs(e.group),title:i("conversation.assistantCapabilityQueryTitle"),summary:i("conversation.assistantCliSummaryCommand")}}function Ea(e,t){return e?e==="sessions"?{kind:"session",badge:i("conversation.assistantCapabilityBadgeSession"),title:t?i("conversation.assistantCliHelpSessionActionTitle",{action:t}):i("conversation.assistantCliHelpSessionsTitle"),summary:i("conversation.assistantCliSummaryHelp")}:e==="timers"?{kind:"automation",badge:i("conversation.assistantCapabilityBadgeAutomation"),title:i("conversation.assistantCliHelpTimersTitle"),summary:i("conversation.assistantCliSummaryHelp")}:e==="terminals"?{kind:"terminal",badge:i("conversation.assistantCapabilityBadgeTerminal"),title:i("conversation.assistantCliHelpTerminalsTitle"),summary:i("conversation.assistantCliSummaryHelp")}:e==="workspaces"||e==="worktrees"?{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCliHelpWorkspacesTitle"),summary:i("conversation.assistantCliSummaryHelp")}:{kind:dn(e),badge:Bs(e),title:i("conversation.assistantCliHelpGenericTitle",{group:e}),summary:i("conversation.assistantCliSummaryHelp")}:{kind:"query",badge:i("conversation.assistantCapabilityBadgeQuery"),title:i("conversation.assistantCliHelpRootTitle"),summary:i("conversation.assistantCliSummaryHelp")}}function Ba(e,t){const n=e==null?void 0:e.trim(),r=t==null?void 0:t.trim();return n?n==="capabilities"&&r==="list"?"capabilities.list":n==="projects"&&r==="list"?"projects.list":n==="projects"&&r==="get"?"projects.get":n==="sessions"&&r==="list"?"projects.sessions.list":n==="sessions"&&r==="get"?"sessions.get":n==="sessions"&&r==="messages"?"sessions.messages.list":n==="sessions"&&r==="runtime"?"sessions.runtime.get":n==="sessions"&&r==="start"?"projects.sessions.start":n==="sessions"&&r==="send"?"sessions.message.send":n==="sessions"&&r==="fork"?"sessions.fork":n==="timers"&&r==="create"?"timers.create":n==="timers"&&r==="cancel"?"timers.cancel":n==="timers"&&r==="list"?"timers.list":n==="terminals"&&r==="send"?"terminals.input.send":n==="terminals"&&r==="close"?"terminals.close":n==="terminals"&&r==="history"?"terminals.history.read":n==="terminals"&&r==="list"?"terminals.list":n==="workspaces"&&r==="list"?"workspaces.list":n==="workspaces"&&r==="clone"?"workspaces.clone":n==="workspaces"&&r==="import"?"workspaces.import":n==="workspaces"&&r==="management"?"workspaces.management.get":n==="worktrees"&&r==="tree"?"worktrees.tree":n==="worktrees"&&r==="create"?"worktrees.create":null:null}function dn(e){switch(e){case"sessions":case"projects":return"session";case"timers":return"automation";case"terminals":return"terminal";case"workspaces":case"worktrees":return"workspace";case"debug-targets":case"debug-runtimes":return"debug";default:return"query"}}function Bs(e){switch(dn(e)){case"session":return i("conversation.assistantCapabilityBadgeSession");case"automation":return i("conversation.assistantCapabilityBadgeAutomation");case"terminal":return i("conversation.assistantCapabilityBadgeTerminal");case"workspace":return i("conversation.assistantCapabilityBadgeWorkspace");case"debug":return i("conversation.assistantCapabilityBadgeDebug");case"query":default:return i("conversation.assistantCapabilityBadgeQuery")}}function Oa(e,t){const n=[],r=He(e,"--session-id")??e.positionals[0]??null,a=He(e,"--project")??He(e,"--project-id");return e.mode==="help"?(S(n,i("conversation.assistantCliLabelScope"),e.group??i("conversation.assistantCliScopeRoot")),S(n,i("conversation.assistantCliLabelAction"),e.action),n):(e.group==="sessions"&&S(n,i("conversation.assistantCapabilityLabelSession"),Ie(r,null,t)),e.group==="timers"&&(S(n,i("conversation.assistantCapabilityLabelSession"),Ie(r,null,t)),S(n,i("conversation.assistantCliLabelDelay"),He(e,"--after-seconds"))),e.group==="terminals"&&S(n,i("conversation.assistantCapabilityLabelTerminal"),e.positionals[0]??null),(e.group==="workspaces"||e.group==="worktrees")&&S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(e.positionals[0]??null,null,t)),S(n,i("conversation.assistantCliLabelProject"),a),S(n,i("conversation.assistantCliLabelMessage"),He(e,"--message")),S(n,i("conversation.assistantCliLabelInput"),He(e,"--input")),n.slice(0,4))}function He(e,t){const n=e.options[t];return typeof n=="string"?n:null}function Os(e){switch(e){case"projects.sessions.start":return{kind:"session",badge:i("conversation.assistantCapabilityBadgeSession"),title:i("conversation.assistantCapabilityProjectSessionStartTitle"),summary:i("conversation.assistantCapabilitySummarySessionStart")};case"sessions.message.send":return{kind:"session",badge:i("conversation.assistantCapabilityBadgeSession"),title:i("conversation.assistantCapabilitySessionSendTitle"),summary:i("conversation.assistantCapabilitySummarySessionSend")};case"sessions.fork":return{kind:"session",badge:i("conversation.assistantCapabilityBadgeSession"),title:i("conversation.assistantCapabilitySessionForkTitle"),summary:i("conversation.assistantCapabilitySummarySessionFork")};case"timers.create":return{kind:"automation",badge:i("conversation.assistantCapabilityBadgeAutomation"),title:i("conversation.assistantCapabilityTimerCreateTitle"),summary:i("conversation.assistantCapabilitySummaryTimerCreate")};case"timers.cancel":return{kind:"automation",badge:i("conversation.assistantCapabilityBadgeAutomation"),title:i("conversation.assistantCapabilityTimerCancelTitle"),summary:i("conversation.assistantCapabilitySummaryTimerCancel")};case"terminals.input.send":return{kind:"terminal",badge:i("conversation.assistantCapabilityBadgeTerminal"),title:i("conversation.assistantCapabilityTerminalInputTitle"),summary:i("conversation.assistantCapabilitySummaryTerminalInput")};case"terminals.close":return{kind:"terminal",badge:i("conversation.assistantCapabilityBadgeTerminal"),title:i("conversation.assistantCapabilityTerminalCloseTitle"),summary:i("conversation.assistantCapabilitySummaryTerminalClose")};case"workspaces.directory.create":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceDirectoryCreateTitle"),summary:i("conversation.assistantCapabilitySummaryWorkspace")};case"workspaces.import":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceImportTitle"),summary:i("conversation.assistantCapabilitySummaryWorkspace")};case"workspaces.clone":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceCloneTitle"),summary:i("conversation.assistantCapabilitySummaryWorkspace")};case"workspaces.navigation-state.update":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceNavigationUpdateTitle"),summary:i("conversation.assistantCapabilitySummaryWorkspace")};case"workspaces.remove":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceRemoveTitle"),summary:i("conversation.assistantCapabilitySummaryWorkspace")};case"worktrees.create":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorktreeCreateTitle"),summary:i("conversation.assistantCapabilitySummaryWorktree")};case"worktrees.merge-into-parent":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorktreeMergeTitle"),summary:i("conversation.assistantCapabilitySummaryWorktree")};case"worktrees.cleanup":return{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorktreeCleanupTitle"),summary:i("conversation.assistantCapabilitySummaryWorktree")};case"debug-targets.run":return{kind:"debug",badge:i("conversation.assistantCapabilityBadgeDebug"),title:i("conversation.assistantCapabilityDebugRunTitle"),summary:i("conversation.assistantCapabilitySummaryDebug")};default:return e.startsWith("sessions.")||e.startsWith("projects.")?{kind:"session",badge:i("conversation.assistantCapabilityBadgeSession"),title:i("conversation.assistantCapabilitySessionReadTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}:e.startsWith("timers.")?{kind:"automation",badge:i("conversation.assistantCapabilityBadgeAutomation"),title:i("conversation.assistantCapabilityAutomationReadTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}:e.startsWith("terminals.")?{kind:"terminal",badge:i("conversation.assistantCapabilityBadgeTerminal"),title:i("conversation.assistantCapabilityTerminalReadTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}:e.startsWith("workspaces.")||e.startsWith("worktrees.")?{kind:"workspace",badge:i("conversation.assistantCapabilityBadgeWorkspace"),title:i("conversation.assistantCapabilityWorkspaceReadTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}:e.startsWith("debug-targets.")||e.startsWith("debug-runtimes.")?{kind:"debug",badge:i("conversation.assistantCapabilityBadgeDebug"),title:i("conversation.assistantCapabilityDebugReadTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}:{kind:"query",badge:i("conversation.assistantCapabilityBadgeQuery"),title:i("conversation.assistantCapabilityQueryTitle"),summary:i("conversation.assistantCapabilitySummaryRead")}}}function _a(e,t){const n=[],r=e.payload;switch(e.capability){case"projects.sessions.start":{const a=z(r,"session");S(n,i("conversation.assistantCapabilityLabelSession"),Ie(P(a,"sessionId"),P(a,"title"),t)),S(n,i("conversation.assistantCapabilityLabelProvider"),P(a,"provider"));break}case"sessions.message.send":{const a=z(r,"result");S(n,i("conversation.assistantCapabilityLabelSession"),Ie(e.targetRef.id,null,t)),S(n,i("conversation.assistantCapabilityLabelWorkspace"),_s(e.targetRef.id,t)),S(n,i("conversation.assistantCapabilityLabelStatus"),i("conversation.assistantCapabilityStatusCompleted")),S(n,i("conversation.assistantCapabilityLabelDueAt"),Qn(P(a,"acceptedAt")??e.timestamp));break}case"sessions.fork":{const a=z(r,"session");S(n,i("conversation.assistantCapabilityLabelSession"),Ie(P(a,"sessionId"),P(a,"title"),t)),S(n,i("conversation.assistantCapabilityLabelProvider"),P(a,"provider"));break}case"timers.create":case"timers.cancel":{const a=z(r,"timer"),o=z(a,"controlSession"),l=z(o,"session");S(n,i("conversation.assistantCapabilityLabelTimer"),P(a,"title")),S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(P(l,"workspaceId"),null,t)),S(n,i("conversation.assistantCapabilityLabelSession"),Ie(P(a,"targetSessionId"),null,t)),S(n,i("conversation.assistantCapabilityLabelDueAt"),Qn(P(a,"dueAt"))),S(n,i("conversation.assistantCapabilityLabelStatus"),Fa(P(a,"status")));break}case"terminals.input.send":case"terminals.close":S(n,i("conversation.assistantCapabilityLabelTerminal"),e.targetRef.id);break;case"workspaces.directory.create":{const a=z(r,"result");S(n,i("conversation.assistantCapabilityLabelPath"),P(a,"path"));break}case"workspaces.import":case"workspaces.clone":case"workspaces.remove":{const a=z(r,"workspace");S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(P(a,"id")??e.targetRef.id,P(a,"name"),t)),S(n,i("conversation.assistantCapabilityLabelPath"),P(a,"path"));break}case"workspaces.navigation-state.update":{const a=z(r,"state");S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(P(a,"workspaceId")??e.targetRef.id,null,t)),S(n,i("conversation.assistantCapabilityLabelStatus"),P(a,"collapsed")==="true"?i("conversation.assistantCapabilityNavigationCollapsed"):i("conversation.assistantCapabilityNavigationExpanded"));break}case"worktrees.create":{const a=z(r,"result"),o=z(a,"workspace");S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(P(o,"id")??e.targetRef.id,P(o,"name"),t)),S(n,i("conversation.assistantCapabilityLabelBranch"),P(a,"branchName"));break}case"worktrees.merge-into-parent":case"worktrees.cleanup":{const a=z(r,"result");S(n,i("conversation.assistantCapabilityLabelWorkspace"),ye(e.targetRef.id,null,t)),S(n,i("conversation.assistantCapabilityLabelStatus"),P(a,"status"));break}case"debug-targets.run":{const a=z(r,"result");S(n,i("conversation.assistantCapabilityLabelDebugTarget"),e.targetRef.id),S(n,i("conversation.assistantCapabilityLabelRuntime"),P(a,"runtimeId"));break}}return qa(n,e,t),n.slice(0,4)}function qa(e,t,n){t.targetRef.kind==="session"&&(S(e,i("conversation.assistantCapabilityLabelSession"),Ie(t.targetRef.id,null,n)),S(e,i("conversation.assistantCapabilityLabelWorkspace"),_s(t.targetRef.id,n))),(t.targetRef.kind==="workspace"||t.targetRef.kind==="worktree")&&S(e,i("conversation.assistantCapabilityLabelWorkspace"),ye(t.targetRef.id,null,n)),t.targetRef.kind==="terminal"&&S(e,i("conversation.assistantCapabilityLabelTerminal"),t.targetRef.id),t.targetRef.kind==="timer"&&S(e,i("conversation.assistantCapabilityLabelTimer"),t.targetRef.id);const r=Wa(t.payload);r!==null&&S(e,i("conversation.assistantCapabilityLabelCount"),String(r))}function S(e,t,n){const r=n==null?void 0:n.trim();r&&(e.some(a=>a.label===t)||e.push({label:t,value:r}))}function Ie(e,t,n){const r=t==null?void 0:t.trim();if(r)return r;const a=e==null?void 0:e.trim();return a?n.sessionNamesById.get(a)??a:null}function ye(e,t,n){const r=t==null?void 0:t.trim();if(r)return r;const a=e==null?void 0:e.trim();return a?n.workspaceNamesById.get(a)??a:null}function _s(e,t){const n=e==null?void 0:e.trim();return n?ye(t.sessionWorkspaceIdsById.get(n)??null,null,t):null}function Wa(e){const t=Yt(e,"items");if(t)return t.length;const n=z(e,"page"),r=Yt(n,"items");if(r)return r.length;const a=z(e,"history"),o=Yt(a,"items");return o?o.length:null}function Qn(e){const t=e==null?void 0:e.trim();if(!t)return null;const n=Date.parse(t);return Number.isFinite(n)?new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(n)):t}function Fa(e){switch(e){case"active":return i("conversation.assistantCapabilityStatusActive");case"completed":return i("conversation.assistantCapabilityStatusCompleted");case"cancelled":return i("conversation.assistantCapabilityStatusCancelled");case"failed":return i("conversation.assistantCapabilityStatusFailed");default:return e}}function Ua({kind:e}){switch(e){case"session":return s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:s.jsx("path",{d:"M5 7.5A2.5 2.5 0 0 1 7.5 5h9A2.5 2.5 0 0 1 19 7.5v5A2.5 2.5 0 0 1 16.5 15H11l-4 4v-4H7.5A2.5 2.5 0 0 1 5 12.5z"})});case"automation":return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[s.jsx("circle",{cx:"12",cy:"12",r:"7.5"}),s.jsx("path",{d:"M12 8.5v4.2l2.8 1.8"})]});case"terminal":return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[s.jsx("path",{d:"m7 8 3.5 3.5L7 15"}),s.jsx("path",{d:"M13 15h4"}),s.jsx("rect",{x:"4.5",y:"5.5",width:"15",height:"13",rx:"2.5"})]});case"workspace":return s.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:s.jsx("path",{d:"M4.5 8.5A2.5 2.5 0 0 1 7 6h3l1.5 1.5H17A2.5 2.5 0 0 1 19.5 10v6A2.5 2.5 0 0 1 17 18.5H7A2.5 2.5 0 0 1 4.5 16z"})});case"debug":return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[s.jsx("path",{d:"M9 4.5h6"}),s.jsx("path",{d:"M10 8h4a4 4 0 0 1 4 4v1a6 6 0 0 1-12 0v-1a4 4 0 0 1 4-4Z"}),s.jsx("path",{d:"M4.5 11h3M16.5 11h3M5.5 7.5l2 1.5M18.5 7.5l-2 1.5"})]});case"query":default:return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[s.jsx("circle",{cx:"11",cy:"11",r:"5.5"}),s.jsx("path",{d:"m16 16 3.5 3.5"})]})}}function za(e){if(e.name==="apply_patch"){const o=zn(e.input);if(o)return o;const l=zi(e.output||e.error||""),d=Ui(e.input,l);return d?zn(d):null}if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=un(e.input);if(!t)return null;const n=Ae(t,"file_path")||Ae(t,"path");if(!n)return null;if(e.name==="Write"){const o=Ae(t,"content"),l=o.length>0?o.split(/\r?\n/):[];return{files:[{path:n,nextPath:null,action:"add",additions:l.length,deletions:0,statsKnown:!0,lines:l.map((d,m)=>({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}],totalAdditions:l.length,totalDeletions:0}}if(e.name==="Edit"){const o=Ae(t,"old_string").split(/\r?\n/),l=Ae(t,"new_string").split(/\r?\n/);return Zn(n,[{oldLines:o,newLines:l}])}const a=(Array.isArray(t.edits)?t.edits:[]).map(o=>{if(!o||typeof o!="object"||Array.isArray(o))return null;const l=o;return{oldLines:Ae(l,"old_string").split(/\r?\n/),newLines:Ae(l,"new_string").split(/\r?\n/)}}).filter(o=>!!o);return a.length>0?Zn(n,a):null}function Zn(e,t){const n=[];let r=0,a=0;return t.forEach((o,l)=>{n.push({kind:"hunk",text:`@@ -1,${o.oldLines.length} +1,${o.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),o.oldLines.forEach((d,m)=>{d.length===0&&o.oldLines.length===1&&o.newLines.length>0||(a+=1,n.push({kind:"remove",text:`-${d}`,oldLineNumber:m+1,newLineNumber:null}))}),o.newLines.forEach((d,m)=>{d.length===0&&o.newLines.length===1&&o.oldLines.length>0||(r+=1,n.push({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}),l<t.length-1&&n.push({kind:"meta",text:"***",oldLineNumber:null,newLineNumber:null})}),{files:[{path:e,nextPath:null,action:"update",additions:r,deletions:a,statsKnown:!0,lines:n}],totalAdditions:r,totalDeletions:a}}function Da(e){const t=un(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(n)return`${i("conversation.toolPreviewCommand")}:${n}`;if(e.name==="read_thread_terminal")return i("conversation.toolPreviewTerminal");const r=e.input||e.error||e.output||i("conversation.toolResultEmpty");return r.length>60?`${r.slice(0,60)}...`:r}function $a(e){var o;const t=e.map(l=>({message:l,tool:Ps(l)})).filter(l=>!!l.tool);if(t.length===0)return null;const n={...t[0].tool};let r=!1,a=!1;for(const{message:l,tool:d}of t)l.kind==="tool_call"&&(r=!0,!n.input&&d.input&&(n.input=d.input)),l.kind==="tool_result"&&(a=!0,n.output=d.output,n.error=d.error,n.status=d.status,!n.input&&d.input&&(n.input=d.input)),!n.name&&d.name&&(n.name=d.name);return{key:t.map(({message:l})=>l.id).join(":"),tool:n,hasRequest:r,hasResult:a,updatedAt:((o=t.at(-1))==null?void 0:o.message.timestamp)??t[0].message.timestamp}}function Ha(e){const t=new Map;for(const n of e){const r=Ps(n);if(!r)continue;const a=t.get(r.callId);if(a){a.messages.push(n);continue}t.set(r.callId,{messages:[n],firstSequence:n.sequence})}return Array.from(t.values()).sort((n,r)=>n.firstSequence-r.firstSequence).map(n=>$a(n.messages)).filter(n=>!!n)}function Ka(e){const t=[];for(let n=0;n<e.length;n+=1){const r=e[n];if(Va(e,n))continue;if(!Bt(r)){t.push({type:"message",key:r.id,message:r});continue}const a=[r];let o=n+1;for(;o<e.length;){const d=e[o];if(!Bt(d))break;a.push(d),o+=1}const l=Ha(a);if(l.length===0){t.push({type:"message",key:r.id,message:r}),n=o-1;continue}l.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),n=o-1}return t}function Va(e,t){const n=e[t];if(!n||As(n.content)===null)return!1;for(let r=t-1;r>=0;r-=1){const a=e[r];if(!(!a||Bt(a)))return a.role==="user"}return!1}function Ga(e,t){if(!Fr(null,e))return!1;const n=t.trim();return/AGENTS\.md instructions for/i.test(n)&&/<INSTRUCTIONS>/i.test(n)&&/<\/INSTRUCTIONS>/i.test(n)}function Qa(e,t){if(e!=="claude-code")return!1;const n=t.trim();return/Base directory for this skill:/i.test(n)&&/^#\s+.+/im.test(n)&&/\bARGUMENTS:/i.test(n)}function Za(e,t){if(e==="skill_context"){const r=t.split(/\r?\n/).map(a=>a.trim()).find(a=>/^#\s+/.test(a));if(r)return r.replace(/^#+\s*/,"")}const n=t.split(/\r?\n/).map(r=>r.trim()).find(Boolean);return n?n.replace(/^#+\s*/,""):i("conversation.rulesMessageTitle")}function Ja(e,t){const n=new Set;if(t!=="kimi")return n;for(const r of e){if(r.role==="system"&&r.kind==="text"){n.add(r.id);continue}break}return n}function pt(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>pt(n)).join(""):e&&typeof e=="object"&&"props"in e?pt(((t=e.props)==null?void 0:t.children)??""):""}function Ya(e){const t=Array.isArray(e)?e[0]:e;if(!u.isValidElement(t))return null;const n=t.props,r=typeof n.className=="string"?n.className:"",a=/language-([^\s]+)/.exec(r);return{content:pt(n.children).replace(/\n$/,""),codeClassName:r||void 0,language:(a==null?void 0:a[1])??null}}function Xa(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function mn(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!Xa(e))throw new Error(i("conversation.copyContentFailed"))}}function eo({className:e,children:t,onCopy:n}){const r=u.useContext(Ls),a=pt(t).trim();if(r||!a)return s.jsx("code",{className:e||void 0,children:t});function o(l){l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),n(a))}return s.jsx("code",{className:[e,"markdown-inline-copy"].filter(Boolean).join(" "),role:"button",tabIndex:0,"aria-label":i("conversation.copyAction"),onClick:()=>n(a),onKeyDown:o,children:t})}function to({href:e,children:t,className:n,onInteract:r}){const a=pt(t).trim()||(e?cn(e).trim():"");return s.jsx(Ls.Provider,{value:!0,children:s.jsx("a",{href:e,className:[n,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:o=>{o.preventDefault(),r(e,a)},children:t})})}function qs({language:e,codeClassName:t,content:n}){const{showToast:r}=vt(),a=gt(),o=(e==null?void 0:e.trim().toLowerCase())??null,l=o==="text",d=o||"code";async function m(){try{await mn(n,a),r({title:i("conversation.copyContentSuccess"),tone:"success"})}catch(k){r({title:k instanceof Error?k.message:i("conversation.copyContentFailed"),tone:"error"})}}return s.jsxs("div",{className:`code-block${l?" text-code-block":""}`,children:[s.jsxs("div",{className:"code-header",children:[s.jsx("span",{className:"code-header-label",children:d}),s.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void m(),children:i("conversation.copyAction")})]}),s.jsx("pre",{className:t,children:s.jsx("code",{children:n})})]})}function it({content:e,className:t}){const{showToast:n}=vt(),r=gt(),{navigationGroups:a,currentWorkspaceId:o,revealWorkspaceFile:l}=cs(),d=u.useMemo(()=>{var v;return((v=a.find(x=>x.workspace.id===o))==null?void 0:v.workspace)??null},[o,a]);async function m(v){if(v.trim())try{await mn(v,r),n({title:i("conversation.copyContentSuccess"),tone:"success"})}catch(x){n({title:x instanceof Error?x.message:i("conversation.copyContentFailed"),tone:"error"})}}function k(v,x){const g=v&&(d!=null&&d.path)?Ca(v,d.path):null;g&&l({workspaceId:(d==null?void 0:d.id)??o,filePath:g,openViewer:!1})||m(x||(v?cn(v).trim():""))}return s.jsx("div",{className:t,children:s.jsx(Hr,{remarkPlugins:[Kr],components:{p:({node:v,...x})=>s.jsx("p",{...x}),a(v){return s.jsx(to,{href:typeof v.href=="string"?v.href:void 0,className:typeof v.className=="string"?v.className:void 0,onInteract:k,children:v.children})},pre(v){const x=Ya(v.children);return x?s.jsx(qs,{language:x.language,codeClassName:x.codeClassName,content:x.content}):s.jsx("pre",{children:v.children})},code(v){const x=typeof v.className=="string"?v.className:"";return s.jsx(eo,{className:x||void 0,onCopy:g=>{m(g)},children:v.children})}},children:e})})}function Jn(e,t){return e.kind!=="image"||!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function no(e){return typeof e!="number"||!Number.isFinite(e)||e<0?null:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Rt({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:r=[]}){return s.jsx(so,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:r})}function so({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:r=[]}){const[a,o]=u.useState({}),[l,d]=u.useState(null),m=u.useMemo(()=>n.map((g,j)=>{const b=Jn(g,t==null?void 0:t[j]);if(b)return{id:g.id,kind:g.kind,fileName:g.fileName,fileSize:g.fileSize,url:b,status:"ready"};const f=a[g.id];return{id:g.id,kind:g.kind,fileName:g.fileName,fileSize:g.fileSize,url:(f==null?void 0:f.url)??null,status:(f==null?void 0:f.status)??(e?"loading":"error")}}),[t,n,a,e]),k=u.useMemo(()=>r.map((g,j)=>({id:`inline-image-${j}`,kind:"image",fileName:g.altText||`${i("conversation.imageAttachmentLabel")} ${j+1}`,fileSize:g.estimatedBytes,url:g.url,status:"ready"})),[r]),v=u.useMemo(()=>[...k,...m],[m,k]),x=v.find(g=>g.id===l)??null;return u.useEffect(()=>{if(!l)return;function g(j){j.key==="Escape"&&d(null)}return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[l]),u.useEffect(()=>{const g=n.filter((f,C)=>!Jn(f,t==null?void 0:t[C]));if(!e||g.length===0){o({});return}let j=!1;const b=[];return o(Object.fromEntries(g.map(f=>[f.id,{id:f.id,kind:f.kind,fileName:f.fileName,fileSize:f.fileSize,url:null,status:"loading"}]))),Promise.all(g.map(async f=>{try{const C=await Ur(e,f.id),T=URL.createObjectURL(C);return b.push(T),{id:f.id,kind:f.kind,fileName:f.fileName,fileSize:f.fileSize,url:T,status:"ready"}}catch{return{id:f.id,kind:f.kind,fileName:f.fileName,fileSize:f.fileSize,url:null,status:"error"}}})).then(f=>{if(j){b.forEach(C=>URL.revokeObjectURL(C));return}o(Object.fromEntries(f.map(C=>[C.id,C])))}),()=>{j=!0,b.forEach(f=>URL.revokeObjectURL(f))}},[t,n,e]),v.length===0?null:s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"message-attachments",children:v.map(g=>{const j=g.kind==="image",b=g.status==="loading"?i("conversation.attachmentPreviewLoading"):g.status==="error"?i("conversation.attachmentPreviewUnavailable"):j?i("conversation.attachmentPreviewOpen"):i("conversation.attachmentDownload"),f=no(g.fileSize),C=s.jsx("div",{className:"message-attachment-card",children:j?g.url?s.jsx("img",{className:"message-attachment-thumbnail",src:g.url,alt:g.fileName||i("conversation.attachmentPreviewAlt"),loading:"lazy"}):s.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:g.status==="loading"?i("conversation.attachmentPreviewLoading"):i("conversation.attachmentPreviewUnavailable")}):s.jsxs("div",{className:"message-attachment-file-card",children:[s.jsx("div",{className:"message-attachment-file-icon","aria-hidden":"true",children:s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[s.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),s.jsx("path",{d:"M14 2v5h5"}),s.jsx("path",{d:"M9 13h6"}),s.jsx("path",{d:"M9 17h6"})]})}),s.jsxs("div",{className:"message-attachment-file-meta",children:[s.jsx("strong",{title:g.fileName,children:g.fileName}),s.jsx("span",{children:f??i("conversation.fileAttachmentLabel")})]})]})});return!j&&g.url?s.jsx("a",{className:"message-attachment-button",href:g.url,download:g.fileName,"aria-label":`${g.fileName} - ${b}`,title:b,children:C},g.id):s.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>j&&g.url&&d(g.id),disabled:!g.url,"aria-label":`${g.fileName} - ${b}`,title:b,children:C},g.id)})}),s.jsx(ls,{open:!!(x!=null&&x.url),title:i("conversation.imagePreviewTitle"),description:x==null?void 0:x.fileName,size:"xwide",layout:"viewer",className:"message-image-modal",bodyClassName:"message-image-modal-body",onClose:()=>d(null),children:x!=null&&x.url?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"message-image-modal-stage",children:s.jsx("img",{className:"message-image-modal-image",src:x.url,alt:x.fileName||i("conversation.attachmentPreviewAlt")})}),s.jsx("p",{className:"message-image-modal-hint",children:i("conversation.imagePreviewHint")})]}):null})]})}function ro(){return s.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:3},(e,t)=>s.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[s.jsx("div",{className:"timeline-skeleton-avatar"}),s.jsxs("div",{className:"timeline-skeleton-bubble",children:[s.jsx("span",{className:"timeline-skeleton-line long"}),s.jsx("span",{className:"timeline-skeleton-line medium"}),s.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function io({tool:e,preview:t}){const[n,r]=u.useState(null),a=n===null?null:t.files[n]??null;return u.useEffect(()=>{if(n===null)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((o,l)=>s.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>r(l),children:[s.jsx("span",{className:"apply-patch-summary-label",children:Xn(o.action)}),s.jsx("span",{className:"apply-patch-summary-file",title:Xt(o),children:Di(o.nextPath??o.path)}),ts(o)]},es(o,l)))}),s.jsx(ls,{open:a!==null,title:i("conversation.applyPatchDialogTitle"),description:i("conversation.applyPatchDialogDescription"),size:"full",layout:"viewer",className:"apply-patch-modal",bodyClassName:"apply-patch-modal-body",onClose:()=>r(null),children:a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"apply-patch-modal-totals",children:mo(a)}),s.jsxs("section",{className:"apply-patch-file-panel",children:[s.jsxs("div",{className:"apply-patch-file-panel-header",children:[s.jsxs("div",{className:"apply-patch-file-panel-title",children:[s.jsx("span",{className:"apply-patch-summary-label",children:Xn(a.action)}),s.jsx("strong",{children:Xt(a)})]}),ts(a)]}),s.jsx("div",{className:"apply-patch-diff-view",children:s.jsx("div",{className:"apply-patch-diff-scroll",children:a.lines.map((o,l)=>s.jsxs("div",{className:`apply-patch-diff-line ${po(o.kind)}`,children:[s.jsx("span",{className:"apply-patch-line-number",children:ns(o.oldLineNumber)}),s.jsx("span",{className:"apply-patch-line-number",children:ns(o.newLineNumber)}),s.jsx("span",{className:"apply-patch-line-content",children:o.text||" "})]},`${Xt(a)}:${l}`))})})]},es(a,n??0)),e.error?s.jsxs("section",{className:"apply-patch-error-panel",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolResultLabel")}),s.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]}):null})]})}function ao({group:e}){const[t,n]=u.useState(!1),{navigationGroups:r}=cs(),{tool:a,hasRequest:o,hasResult:l}=e,d=ja(a.name),m=u.useMemo(()=>Sa(r),[r]),k=u.useMemo(()=>Ta(a,m),[m,a]),v=u.useMemo(()=>Ra(a,m),[m,a]),x=u.useMemo(()=>Qr(a,null,e.updatedAt),[e.updatedAt,a]),g=u.useMemo(()=>za(a),[a.input,a.name]);if(g)return s.jsx(io,{tool:a,preview:g});if(k)return s.jsx(Yn,{tool:a,snapshot:k,expanded:t,hasRequest:o,hasResult:l,onToggleExpanded:()=>{n(f=>!f)}});if(v)return s.jsx(Yn,{tool:a,snapshot:v,expanded:t,hasRequest:o,hasResult:l,onToggleExpanded:()=>{n(f=>!f)}});if(x)return s.jsx(oo,{tool:a,snapshot:x,expanded:t,hasRequest:o,hasResult:l,onToggleExpanded:()=>{n(f=>!f)}});const j=Da(a),b=!!(a.input||a.output||a.error);return s.jsxs("div",{className:`tool-call-item ${l?"tool-result":""}`,children:[s.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>b&&n(f=>!f),children:[s.jsxs("div",{className:"tool-call-info",children:[s.jsx("span",{className:"tool-call-name",children:d}),s.jsx("span",{className:"tool-call-input-preview",children:j})]}),s.jsx("div",{className:"tool-call-meta",children:b&&s.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:s.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:s.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&b&&s.jsxs("div",{className:"tool-call-output",children:[o&&a.input&&s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolInputLabel")}),s.jsx("pre",{children:a.input})]}),(l||a.error||a.output)&&s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolResultLabel")}),s.jsx("pre",{className:a.error?"tool-call-error":void 0,children:a.error||a.output||i("conversation.toolResultEmpty")})]})]})]})}function Yn({tool:e,snapshot:t,expanded:n,hasRequest:r,hasResult:a,onToggleExpanded:o}){const l=n?i("conversation.assistantCapabilityRawCollapse"):i("conversation.assistantCapabilityRawExpand");return s.jsxs("div",{className:"tool-call-item assistant-capability-item","data-kind":t.kind,children:[s.jsxs("div",{className:"assistant-capability-header",children:[s.jsxs("div",{className:"assistant-capability-heading",children:[s.jsx("span",{className:"assistant-capability-icon",children:s.jsx(Ua,{kind:t.kind})}),s.jsxs("div",{className:"assistant-capability-heading-main",children:[s.jsx("span",{className:"assistant-capability-badge",children:t.badge}),s.jsx("strong",{children:t.title}),s.jsx("span",{className:"assistant-capability-summary",children:t.summary})]})]}),s.jsx("button",{type:"button",className:"task-tool-raw-toggle",onClick:o,children:l})]}),t.rows.length>0?s.jsx("div",{className:"assistant-capability-list",children:t.rows.map(d=>s.jsxs("div",{className:"assistant-capability-row",children:[s.jsx("span",{className:"assistant-capability-row-label",children:d.label}),s.jsx("span",{className:"assistant-capability-row-value",children:d.value})]},d.label))}):null,n?s.jsxs("div",{className:"tool-call-output",children:[r&&e.input?s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolInputLabel")}),s.jsx("pre",{children:e.input})]}):null,a||e.error||e.output?s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolResultLabel")}),s.jsx("pre",{className:e.error?"tool-call-error":void 0,children:e.error||e.output||i("conversation.toolResultEmpty")})]}):null]}):null]})}function oo({tool:e,snapshot:t,expanded:n,hasRequest:r,hasResult:a,onToggleExpanded:o}){const l=ms(t.items),d=n?i("conversation.taskCardRawCollapse"):i("conversation.taskCardRawExpand");return s.jsxs("div",{className:"tool-call-item task-tool-item",children:[s.jsxs("div",{className:"task-tool-header",children:[s.jsxs("div",{className:"task-tool-heading",children:[s.jsx("span",{className:"task-tool-badge",children:t.source==="plan"?i("conversation.taskCardPlanTitle"):i("conversation.taskCardTodoTitle")}),s.jsxs("div",{className:"task-tool-heading-main",children:[s.jsx("strong",{children:lo(t,e.name)}),s.jsx("span",{className:"task-tool-summary-text",children:co(t.items,l)})]})]}),s.jsx("button",{type:"button",className:"task-tool-raw-toggle",onClick:o,children:d})]}),s.jsx("ol",{className:"task-tool-list",children:t.items.map(m=>s.jsxs("li",{className:"task-tool-list-item","data-status":m.status,children:[s.jsx("span",{className:"task-tool-item-indicator","data-status":m.status,"aria-hidden":"true"}),s.jsx("strong",{className:"task-tool-item-title",children:m.title}),m.detail?s.jsx("span",{className:"task-tool-item-detail",children:m.detail}):null,s.jsx("span",{className:"task-tool-item-status",children:uo(m.status)})]},m.id))}),n?s.jsxs("div",{className:"tool-call-output",children:[r&&e.input?s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolInputLabel")}),s.jsx("pre",{children:e.input})]}):null,a||e.error||e.output?s.jsxs("div",{className:"tool-call-section",children:[s.jsx("div",{className:"tool-call-section-label",children:i("conversation.toolResultLabel")}),s.jsx("pre",{className:e.error?"tool-call-error":void 0,children:e.error||e.output||i("conversation.toolResultEmpty")})]}):null]}):null]})}function lo(e,t){if(e.source==="plan")return i("conversation.taskCardPlanUpdated");const n=t.trim().toLowerCase();return n==="taskcreate"||n==="todowrite"||n==="todoread"?i("conversation.taskCardTodoUpdated"):n.startsWith("task")?i("conversation.taskCardTodoUpdated"):i("conversation.taskCardTodoUpdated")}function co(e,t){const n=[i("conversation.taskCardSummaryTotal",{count:e.length})];return t.in_progress>0&&n.push(i("conversation.taskCardSummaryInProgress",{count:t.in_progress})),t.pending>0&&n.push(i("conversation.taskCardSummaryPending",{count:t.pending})),t.completed>0&&n.push(i("conversation.taskCardSummaryCompleted",{count:t.completed})),t.failed>0&&n.push(i("conversation.taskCardSummaryFailed",{count:t.failed})),n.join(" / ")}function uo(e){switch(e){case"in_progress":return i("conversation.taskProgressStatusInProgress");case"completed":return i("conversation.taskProgressStatusCompleted");case"failed":return i("conversation.taskProgressStatusFailed");case"cancelled":return i("conversation.taskProgressStatusCancelled");case"pending":default:return i("conversation.taskProgressStatusPending")}}function Xn(e){return e==="add"?i("conversation.applyPatchAddedLabel"):e==="delete"?i("conversation.applyPatchDeletedLabel"):i("conversation.applyPatchEditedLabel")}function Xt(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function es(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function ts(e){return e.statsKnown?s.jsxs("span",{className:"apply-patch-summary-stats",children:[s.jsxs("span",{className:"apply-patch-summary-added",children:["+",e.additions]}),s.jsxs("span",{className:"apply-patch-summary-removed",children:["-",e.deletions]})]}):s.jsx("span",{className:"apply-patch-summary-stats",children:s.jsx("span",{className:"apply-patch-summary-edited",children:i("conversation.applyPatchEditedStat")})})}function mo(e){return e.statsKnown?s.jsxs(s.Fragment,{children:[s.jsxs("span",{className:"apply-patch-stat-pill positive",children:[i("conversation.applyPatchAddedStat")," +",e.additions]}),s.jsxs("span",{className:"apply-patch-stat-pill negative",children:[i("conversation.applyPatchRemovedStat")," -",e.deletions]})]}):s.jsx("span",{className:"apply-patch-stat-pill neutral",children:i("conversation.applyPatchEditedStat")})}function po(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function ns(e){return e===null||e<=0?"":String(e)}function fo(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Ws({timestamp:e,leading:t,children:n}){return s.jsxs("div",{className:"user-message-footer",children:[s.jsx("div",{className:"user-message-footer-leading",children:t}),s.jsxs("div",{className:"user-message-footer-trailing",children:[s.jsx("time",{className:"message-time",dateTime:e,children:fo(e)}),n]})]})}function Le({text:e,canCopy:t=!0,canFork:n=!1,compact:r=!1,onFork:a}){const{showToast:o}=vt(),l=gt(),[d,m]=u.useState(!1),[k,v]=u.useState(!1),x=e.trim().length>0,g=t&&x;async function j(){if(!(!g||d)){m(!0);try{await mn(e,l),o({title:i("conversation.copyContentSuccess"),tone:"success"})}catch(f){o({title:f instanceof Error?f.message:i("conversation.copyContentFailed"),tone:"error"})}finally{m(!1)}}}async function b(){if(!(!a||k)){v(!0);try{await a()}finally{v(!1)}}}return!g&&!n?null:s.jsxs("div",{className:r?"message-metadata-bar compact":"message-metadata-bar",children:[g?s.jsx("button",{type:"button",className:"message-metadata-action","aria-label":i("conversation.copyAction"),title:i("conversation.copyAction"),onClick:()=>{j()},disabled:d,children:s.jsx(ri,{})}):null,n?s.jsx("button",{type:"button",className:"message-metadata-action","aria-label":k?i("conversation.forkingAction"):i("conversation.forkFromHereAction"),title:k?i("conversation.forkingAction"):i("conversation.forkFromHereAction"),onClick:()=>{b()},disabled:k,children:s.jsx(ii,{})}):null]})}function ho({message:e,kind:t,tone:n,actionState:r,onRetry:a,onForkMessage:o}){const[l,d]=u.useState(!1),m=Za(t,e.content),k=n==="user-message",v=t==="system_prompt"?i("conversation.systemPromptTitle"):t==="skill_context"?i("conversation.skillContextTitle"):i("conversation.rulesMessageTitle"),x=t==="system_prompt"?i("conversation.systemPromptHint"):t==="skill_context"?i("conversation.skillContextHint"):i("conversation.rulesMessageHint"),g=l?t==="system_prompt"?i("conversation.systemPromptCollapse"):t==="skill_context"?i("conversation.skillContextCollapse"):i("conversation.rulesMessageCollapse"):t==="system_prompt"?i("conversation.systemPromptExpand"):t==="skill_context"?i("conversation.skillContextExpand"):i("conversation.rulesMessageExpand");return s.jsx("article",{className:`message-item ${n} rules-message-row`,"data-message-id":e.id,children:s.jsxs("div",{className:"message-content-wrapper",children:[s.jsxs("div",{className:"rules-message-card",children:[s.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":l,onClick:()=>d(j=>!j),children:[s.jsxs("div",{className:"rules-message-heading",children:[s.jsx("span",{className:"rules-message-badge",children:v}),s.jsx("span",{className:"rules-message-summary",children:m})]}),s.jsx("span",{className:"rules-message-action",children:g})]}),s.jsx("p",{className:"rules-message-hint",children:x}),l&&s.jsx("div",{className:"rules-message-body",children:s.jsx(it,{content:e.content,className:"message-text message-content markdown-content"})}),k?s.jsx(Ws,{timestamp:e.timestamp,children:s.jsx(Le,{text:e.content,canCopy:r.canCopy,canFork:r.canFork&&!!(o&&e.deliveryState==="sent"),compact:!0,onFork:o?()=>o(e):null})}):s.jsx(Le,{text:e.content,canCopy:r.canCopy,canFork:r.canFork&&!!(o&&e.deliveryState==="sent"),onFork:o?()=>o(e):null})]}),e.deliveryState==="failed"&&e.clientRequestId&&s.jsx("button",{className:"retry-button",type:"button",onClick:()=>a(e.clientRequestId),children:i("conversation.resendButton")})]})})}function go({message:e,provider:t,interruptedSource:n=null,foldedPromptKind:r=null,actionState:a,onRetry:o,onForkMessage:l,assistantAvatar:d}){const m=e.role==="user",k=e.kind==="thinking",v=e.role==="assistant"&&e.kind==="text",x=t==="codex"&&e.kind==="text"?As(e.content):null,g=r??(Ga(t,e.content)?"rules":Qa(t,e.content)?"skill_context":null),j=u.useMemo(()=>ut(e.content),[e.content]),b=j.text,f=j.inlineImages,[C,T]=u.useState(!1),[M,R]=u.useState(!1),[I,D]=u.useState(null),[A,F]=u.useState(null);if(g){const L=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return s.jsx(ho,{message:e,kind:g,tone:L,actionState:a,onRetry:o,onForkMessage:l})}if(x){const L=ma(n),$=x.detail?`${L}
|
|
15
|
+
|
|
16
|
+
${x.detail}`:L;return s.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[s.jsx("div",{className:"message-avatar",children:d??s.jsx(en,{})}),s.jsxs("div",{className:"message-content-wrapper",children:[s.jsx(it,{content:$,className:"message-text message-content markdown-content"}),s.jsx(Le,{text:$,canCopy:a.canCopy,canFork:!1,onFork:null})]})]})}if(m){const L=e.origin==="butler_proxy"||vo(e.clientRequestId),$=e.origin==="butler_proxy"&&typeof e.originRef=="string"&&e.originRef.trim().length>0;async function H(){if(!$)return;const U=!C;if(T(U),!(!U||A||M)){R(!0),D(null);try{const K=await Dr(e.originRef);F(K.task)}catch(K){D(K instanceof Error?K.message:i("conversation.butlerOriginDetailLoadFailed"))}finally{R(!1)}}}const X=L?$?s.jsxs("div",{className:"message-origin-detail-anchor",children:[s.jsx("button",{type:"button",className:"message-origin-badge message-origin-badge-button","aria-expanded":C,onClick:()=>{H()},children:i("conversation.butlerProxyMessageBadge")}),C?s.jsxs("div",{className:"message-origin-detail-popover",role:"dialog","aria-live":"polite",children:[s.jsx("strong",{children:i("conversation.butlerOriginDetailTitle")}),M?s.jsx("p",{children:i("conversation.butlerOriginDetailLoading")}):I?s.jsx("p",{children:I}):A?s.jsxs(s.Fragment,{children:[s.jsxs("p",{children:[i("conversation.butlerOriginDetailObjectiveLabel"),":",A.objective]}),s.jsxs("p",{children:[i("conversation.butlerOriginDetailStatusLabel"),":",xo(A.status)]}),s.jsxs("p",{children:[i("conversation.butlerOriginDetailSummaryLabel"),":",A.lastAutomationSummary||i("conversation.butlerAnalysisEmpty")]}),A.waitingReason?s.jsxs("p",{children:[i("conversation.butlerOriginDetailWaitingReasonLabel"),":",A.waitingReason]}):null]}):s.jsx("p",{children:i("conversation.butlerAnalysisEmpty")})]}):null]}):s.jsx("span",{className:"message-origin-badge",children:i("conversation.butlerProxyMessageBadge")}):null;return s.jsx("article",{className:"message-item user-message","data-message-id":e.id,children:s.jsxs("div",{className:"message-content-wrapper",children:[s.jsx(Rt,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:f}),b?s.jsx(it,{content:b,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&s.jsx("button",{className:"retry-button",type:"button",onClick:()=>o(e.clientRequestId),children:i("conversation.resendButton")}),s.jsx(Ws,{timestamp:e.timestamp,leading:X,children:s.jsx(Le,{text:b,canCopy:a.canCopy,canFork:a.canFork&&!!(l&&e.deliveryState==="sent"),compact:!0,onFork:l?()=>l(e):null})})]})})}return k?s.jsxs("article",{className:"message-item assistant-message thinking-message-row","data-message-id":e.id,children:[s.jsx("div",{className:"message-avatar",children:d??s.jsx(en,{})}),s.jsxs("div",{className:"thinking-message-content",children:[s.jsx("div",{className:"thinking-message-label",children:i("conversation.thinkingLabel")}),s.jsx(Rt,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:f}),b&&s.jsx(it,{content:b,className:"message-text message-content markdown-content thinking-message-text"}),s.jsx(Le,{text:b,canCopy:a.canCopy,canFork:a.canFork&&!!(l&&e.deliveryState==="sent"),onFork:l?()=>l(e):null})]})]}):v?s.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[s.jsx("div",{className:"message-avatar",children:d??s.jsx(en,{})}),s.jsxs("div",{className:"message-content-wrapper",children:[s.jsx(Rt,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:f}),b&&s.jsx(it,{content:b,className:"message-text message-content markdown-content"}),s.jsx(Le,{text:b,canCopy:a.canCopy,canFork:a.canFork&&!!(l&&e.deliveryState==="sent"),onFork:l?()=>l(e):null})]})]}):s.jsx("article",{className:"message-item system-message","data-message-id":e.id,children:s.jsxs("div",{className:"message-content-wrapper",children:[s.jsx(Rt,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:f}),b?s.jsx("div",{className:"message-text message-content",children:s.jsx(qs,{language:"text",content:b})}):null,s.jsx(Le,{text:b,canCopy:a.canCopy,canFork:a.canFork&&!!(l&&e.deliveryState==="sent"),onFork:l?()=>l(e):null})]})})}function en(){return s.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[s.jsx("circle",{cx:"12",cy:"12",r:"10"}),s.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}function vo(e){return typeof e=="string"&&e.startsWith("butler-follow-up:")}function xo(e){switch(e){case"waiting_user":return i("shell.butlerAutomationStatusWaitingUser");case"completed":return i("shell.butlerAutomationStatusCompleted");case"failed":return i("shell.butlerAutomationStatusFailed");case"cancelled":return i("shell.butlerAutomationStatusCancelled");case"active":default:return i("shell.butlerAutomationStatusActive")}}function il({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:r=!1,hasOlderMessages:a=!1,onLoadOlderMessages:o=()=>{},onRetryMessage:l,onForkMessage:d,provider:m,interruptedSource:k=null,runtimeThinkingPlaceholder:v=null,assistantAvatar:x}){var Fe;const{showToast:g}=vt(),j=gt(),b=u.useRef(null),f=u.useRef(e),C=u.useRef(0),T=u.useRef(null),M=u.useRef(!0),R=u.useRef(null),I=u.useRef(null),D=u.useRef(!1),A=u.useRef(Tt(e)),F=u.useRef(((Fe=Tt(e))==null?void 0:Fe.lastMessageSignature)??null),L=u.useRef(Tt(e)),$=u.useRef(null),H=u.useRef(null),X=u.useRef(null),U=u.useRef(0),K=u.useRef(!1),Ee=u.useRef(null),se=u.useRef(null),[Be,me]=u.useState(!1),[G,ae]=u.useState(!1),re=u.useRef(!1),ke=Ka(t),xt=j.isMobile?0:va,pe=u.useMemo(()=>Ja(t,m),[t,m]),Oe=u.useMemo(()=>bo(t),[t]),bt=n==="loading"&&t.length===0;function Ce(p){const E=p.scrollHeight-p.clientHeight-p.scrollTop<=Kn;return{scrollTop:p.scrollTop,stickToBottom:E,lastMessageSignature:re.current&&!E?F.current:Ke(t.at(-1)??null)}}function fe(p){return L.current=Ce(p),L.current}function he(p){const N=p.scrollHeight-p.clientHeight-p.scrollTop,E=N<=Kn;M.current=E,E&&re.current&&(Q(),re.current=!1,F.current=Ke(t.at(-1)??null),ae(!1)),me(t.length>0&&(N>Vn||re.current)),fe(p)}function ee(p=b.current){p&&fe(p),L.current&&Hn(e,L.current)}function Qe(p){L.current&&Hn(p,L.current)}function Ze(){$.current!==null&&(window.clearTimeout($.current),$.current=null)}function Je(){Ze(),$.current=window.setTimeout(()=>{$.current=null,ee()},fa)}function je(p){p.scrollTop=p.scrollHeight}function Ye(){H.current!==null&&(window.clearTimeout(H.current),H.current=null)}function Q(){Ye(),K.current=!1,X.current=null,U.current=0,Ee.current=null}function _e(p,N){const E=Math.max(0,p.scrollHeight-p.clientHeight),Z=Math.max(0,Math.min(N,E));Ee.current=Z,p.scrollTop=Z,M.current=!1,me(t.length>0&&(E-Z>Vn||re.current))}function we(){Ye(),K.current&&(H.current=window.setTimeout(()=>{H.current=null;const p=b.current,N=X.current;if(!p||N===null){Q();return}if(_e(p,N),Date.now()<U.current){we();return}Q(),he(p)},ga))}function Ne(p,N){if(xt<=0){_e(N,p),Q();return}K.current=!0,X.current=p,U.current=Date.now()+xt,_e(N,p),we()}function oe(){K.current&&Q()}function ge(p){return D.current||!a||r||n!=="ready"||p.scrollTop>pa?!1:(D.current=!0,R.current=p.scrollHeight-p.scrollTop,I.current=Ke(t[0]??null),o(),!0)}u.useEffect(()=>{n==="error"&&g({title:i("conversation.historyLoadFailed"),tone:"error"})},[n,g]),u.useLayoutEffect(()=>{var p,N;f.current!==e&&(Qe(f.current),f.current=e,C.current=0,T.current=null,A.current=Tt(e),F.current=((p=A.current)==null?void 0:p.lastMessageSignature)??null,L.current=A.current,M.current=((N=A.current)==null?void 0:N.stickToBottom)??!0,R.current=null,I.current=null,Q(),re.current=!1,ae(!1),me(!1))},[e]),u.useLayoutEffect(()=>()=>{Ze(),Q(),Qe(f.current)},[e]),u.useLayoutEffect(()=>{const p=b.current,N=Ke(t.at(-1)??null);if(!p){C.current=t.length,T.current=N;return}const E=C.current,Z=T.current,V=A.current;if(V&&n==="ready"){const le=!V.stickToBottom&&V.lastMessageSignature!==null&&N!==null&&V.lastMessageSignature!==N;V.stickToBottom?(Q(),je(p)):Ne(V.scrollTop,p),re.current=le,F.current=V.lastMessageSignature,ae(le),A.current=null,he(p),C.current=t.length,T.current=N,fe(p);return}if(V&&n==="error"){V.stickToBottom?(Q(),je(p)):Ne(V.scrollTop,p),A.current=null,he(p),C.current=t.length,T.current=N,fe(p);return}if(K.current){_e(p,X.current??p.scrollTop),C.current=t.length,T.current=N,fe(p);return}const Te=Ke(t[0]??null),Re=R.current,Ue=I.current;Re!==null&&!r&&Ue!==null&&Ue!==Te&&t.length>=E?(p.scrollTop=Math.max(0,p.scrollHeight-Re),R.current=null,I.current=null):R.current!==null&&!r?(R.current=null,I.current=null):M.current&&(E===0||t.length!==E||N!==Z)&&je(p),he(p),C.current=t.length,T.current=N},[n,r,t,e]),u.useEffect(()=>{if(!a){D.current=!1;return}!r&&R.current===null&&(D.current=!1)},[a,r,t.length]);function qe(){const p=b.current;if(p){if(K.current){const N=Ee.current;N!==null&&Math.abs(p.scrollTop-N)<=1?Ee.current=null:oe()}he(p),Je(),ge(p)}}function Se(p){if(p.deltaY!==0&&oe(),p.deltaY>=0)return;const N=b.current;N&&ge(N)}function Xe(p){var N;oe(),se.current=((N=p.touches[0])==null?void 0:N.clientY)??null}function yt(p){var V;const N=se.current,E=((V=p.touches[0])==null?void 0:V.clientY)??null;if(N===null||E===null||E-N<ha)return;oe();const Z=b.current;Z&&ge(Z)}function We(){se.current=null}return s.jsxs("section",{className:"message-timeline",children:[n==="loading"&&s.jsx("div",{className:"timeline-status",children:s.jsx("span",{className:"status-text",children:i("conversation.historyLoading")})}),s.jsxs("div",{ref:b,className:"message-list",onScroll:qe,onPointerDown:oe,onWheel:Se,onTouchStart:Xe,onTouchMove:yt,onTouchEnd:We,onTouchCancel:We,children:[bt?s.jsx(ro,{}):null,r?s.jsx("div",{className:"timeline-status timeline-status-inline",children:s.jsx("span",{className:"status-text",children:i("conversation.historyLoadingOlder")})}):null,ke.length===0&&n==="ready"&&s.jsx("div",{className:"timeline-empty",children:s.jsx("p",{className:"status-text",children:i("conversation.timelineEmpty")})}),ke.map(p=>p.type==="tool_group"?s.jsx("article",{className:"message-item tool-message-row",children:s.jsx(ao,{group:p.group})},p.key):s.jsx(go,{message:p.message,provider:m,foldedPromptKind:pe.has(p.message.id)?"system_prompt":null,actionState:Oe.get(p.message.id)??{canCopy:p.message.role==="user",canFork:!1},onRetry:l,onForkMessage:d,interruptedSource:k,assistantAvatar:x},p.key)),v?s.jsx("div",{className:"timeline-status timeline-status-inline thinking-status-inline",children:s.jsxs("span",{className:"status-text thinking-status-text","aria-label":v,children:[s.jsx("span",{children:da(v)||v}),s.jsx("span",{className:"thinking-status-dots","aria-hidden":"true",children:"..."})]})}):null]}),Be?s.jsxs("button",{type:"button",className:"conversation-scroll-to-bottom-button","data-has-new":G?"true":"false","aria-label":i("conversation.scrollToBottomAction"),title:i("conversation.scrollToBottomAction"),onClick:()=>{const p=b.current;p&&(Q(),je(p),re.current=!1,F.current=Ke(t.at(-1)??null),ae(!1),he(p),ee(p))},children:[G?s.jsx("span",{className:"conversation-scroll-to-bottom-button-badge",children:"NEW"}):null,s.jsx("svg",{className:"conversation-scroll-to-bottom-button-icon",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:s.jsx("path",{d:"M10 4.25a.75.75 0 0 1 .75.75v7.19l2.72-2.72a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06l2.72 2.72V5a.75.75 0 0 1 .75-.75Zm-4 11a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 0 1.5H6Z",fill:"currentColor"})})]}):null]})}function Ke(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function bo(e){const t=new Map;let n=0;function r(a){let o=null;for(let l=a-1;l>=n;l-=1){const d=e[l];if(!(!d||!yo(d))){o=d.id;break}}for(let l=n;l<a;l+=1){const d=e[l];if(d){if(d.role==="user"){t.set(d.id,{canCopy:!0,canFork:!1});continue}t.set(d.id,{canCopy:d.id===o,canFork:d.id===o})}}}for(let a=0;a<e.length;a+=1){const o=e[a];o&&o.role==="user"&&a>n&&(r(a),n=a)}return r(e.length),t}function yo(e){return e.role==="user"?!1:e.kind!=="tool_call"&&e.kind!=="tool_result"}function al({requests:e,replyingRequestId:t,onReply:n}){const[r,a]=u.useState({}),o=u.useMemo(()=>e.filter(l=>l.status==="pending"),[e]);return o.length===0?null:s.jsxs("section",{className:"permission-request-list",children:[s.jsxs("div",{className:"permission-request-list-header",children:[s.jsx("div",{children:s.jsx("strong",{children:i("conversation.permissionRequestSectionTitle")})}),s.jsx("span",{className:"permission-request-count",children:o.length})]}),s.jsx("div",{className:"permission-request-stack",children:o.map(l=>{var g,j;const d=r[l.id]??{},m=l.paths.filter(Boolean),k=l.kind==="command"&&!!((g=l.command)!=null&&g.trim()),v=l.questions.length===0&&m.length===0&&!k&&!!((j=l.summary)!=null&&j.trim()),x=l.kind==="user_input"&&l.questions.some(b=>{var f;return(((f=d[b.id])==null?void 0:f.filter(Boolean).length)??0)===0});return s.jsxs("article",{className:"permission-request-card",children:[s.jsxs("header",{className:"permission-request-card-header",children:[s.jsxs("div",{className:"permission-request-provider",children:[s.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:s.jsx("img",{src:zr(l.provider),alt:"",loading:"lazy"})}),s.jsxs("div",{className:"permission-request-provider-copy",children:[s.jsx("strong",{children:l.title}),s.jsx("span",{children:os(l.provider,"full")})]})]}),s.jsx("span",{className:"permission-request-kind",children:ko(l.kind)})]}),s.jsxs("div",{className:"permission-request-card-body",children:[m.length>0?s.jsx("div",{className:"permission-request-block",children:s.jsx("ul",{className:"permission-request-target-list",children:m.map(b=>s.jsxs("li",{className:"permission-request-target-item",children:[s.jsx("strong",{children:Co(b)}),s.jsx("span",{children:b})]},`${l.id}:${b}`))})}):null,k?s.jsxs("div",{className:"permission-request-block",children:[s.jsx("div",{className:"permission-request-block-label",children:i("conversation.permissionRequestCommandLabel")}),s.jsx("pre",{children:l.command})]}):null,v?s.jsx("p",{className:"permission-request-summary",children:l.summary}):null,l.questions.length>0?s.jsxs("div",{className:"permission-request-block",children:[s.jsx("div",{className:"permission-request-block-label",children:i("conversation.permissionRequestQuestionsLabel")}),s.jsx("div",{className:"permission-request-question-list",children:l.questions.map(b=>s.jsxs("div",{className:"permission-request-question",children:[s.jsx("div",{className:"permission-request-question-header",children:b.header}),s.jsx("p",{children:b.question}),s.jsx("div",{className:"permission-request-question-options",children:b.options.map(f=>{var T;const C=((T=d[b.id])==null?void 0:T.includes(f.label))??!1;return s.jsxs("label",{className:"permission-request-question-option",children:[s.jsx("input",{type:"radio",name:`${l.id}:${b.id}`,checked:C,onChange:()=>{a(M=>({...M,[l.id]:{...M[l.id]??{},[b.id]:[f.label]}}))}}),s.jsxs("span",{children:[s.jsx("strong",{children:f.label}),f.description?s.jsx("small",{children:f.description}):null]})]},`${b.id}:${f.label}`)})})]},b.id))})]}):null]}),s.jsx("footer",{className:"permission-request-card-footer",children:l.actions.map(b=>s.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${b.tone}`,disabled:t===l.id||b.value==="submit"&&x,onClick:()=>void n(l.id,{action:b.value,answers:Object.keys(d).length>0?d:void 0}),children:t===l.id?i("conversation.permissionRequestSubmitting"):b.label},`${l.id}:${b.value}`))})]},l.id)})})]})}function ko(e){return e==="command"?i("conversation.permissionRequestKindCommand"):e==="file_change"?i("conversation.permissionRequestKindFileChange"):e==="permissions"?i("conversation.permissionRequestKindPermissions"):e==="user_input"?i("conversation.permissionRequestKindUserInput"):i("conversation.permissionRequestKindToolCall")}function Co(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}class ol{constructor(t){de(this,"socket",null);de(this,"disposed",!1);de(this,"authRecoveryInFlight",!1);de(this,"latestCursor");de(this,"subscribed",!1);de(this,"pendingOlderRequest",null);de(this,"inFlightOlderRequest",null);de(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new $r({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,n){return jo(this.socket)?this.subscribed?(this.sendOlderMessagesRequest(t,n),!0):(this.pendingOlderRequest={cursor:t,limit:n},!0):!1}close(){var t;this.disposed=!0,this.subscribed=!1,this.pendingOlderRequest=null,this.inFlightOlderRequest=null,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var l;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(l=Pn.getState().session)==null?void 0:l.accessToken;if(!n){this.options.onUnauthorized();return}const r=wr(),a=`${Nr("/ws",r)}?access_token=${encodeURIComponent(n)}`,o=Sr(r).createWebSocket({path:"/ws",baseUrl:r,url:a});this.subscribed=!1,this.socket=o,o.addEventListener("open",()=>{o.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),o.addEventListener("message",d=>{if(!(d instanceof MessageEvent)||typeof d.data!="string")return;const m=JSON.parse(d.data);if(m.type==="system.connected"){this.connectionManager.markConnected();return}if(m.type==="session.subscribed"){this.subscribed=!0,this.options.onSubscribed(),this.flushPendingOlderRequest();return}if(m.type==="session.error"){if(this.clearOlderMessagesRequest(),m.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(m);return}if(m.type==="session.runtime_status"){this.options.onRuntimeStatus(m);return}if(m.type==="session.activity"){this.options.onActivity(m);return}if(m.type==="session.history_older"){this.clearOlderMessagesRequest(),this.options.onOlderHistory(m);return}if(m.type==="session.runtime_message"){this.options.onRuntimeMessage(m);return}if(m.type==="session.runtime_error"){this.options.onRuntimeError(m);return}if(m.type==="session.interrupted"){this.options.onInterrupted(m);return}if(m.type==="session.permission_request"){this.options.onPermissionRequest(m);return}if(m.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(m);return}this.latestCursor=m.cursor,this.options.onEnvelope(m)}),o.addEventListener("close",()=>{this.disposed||this.socket!==o||(this.subscribed=!1,this.requeueInFlightOlderRequest(),this.connectionManager.markDisconnected())}),o.addEventListener("error",()=>{this.disposed||this.socket!==o||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0,this.subscribed=!1,this.requeueInFlightOlderRequest();const t=this.socket;this.socket=null,t==null||t.close(),Pn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendOlderMessagesRequest(t,n){var r;this.inFlightOlderRequest={cursor:t,limit:n},(r=this.socket)==null||r.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:n}))}flushPendingOlderRequest(){if(!this.pendingOlderRequest)return;const t=this.pendingOlderRequest;this.pendingOlderRequest=null,this.sendOlderMessagesRequest(t.cursor,t.limit)}clearOlderMessagesRequest(){this.pendingOlderRequest=null,this.inFlightOlderRequest=null}requeueInFlightOlderRequest(){this.inFlightOlderRequest&&(this.pendingOlderRequest=this.inFlightOlderRequest,this.inFlightOlderRequest=null)}}function jo(e){return e!==null&&e.readyState===1}const wo=3*1e3;function ll(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],permissionRequests:(e==null?void 0:e.permissionRequests)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:(e==null?void 0:e.olderCursor)??null,hasOlderMessages:(e==null?void 0:e.hasOlderMessages)??!1,connectionState:"closed",lastCursor:(e==null?void 0:e.lastCursor)??null,pagesLoaded:(e==null?void 0:e.pagesLoaded)??0,interruptSource:(e==null?void 0:e.interruptSource)??null,errorCode:null,errorDetail:null}}function Fs(e,t,n="sent",r=null){const a=t.kind??(t.role==="tool"?"tool_result":"text"),o=t.toolCall??(a==="tool_call"||a==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:a==="tool_call"?t.content:"",output:a==="tool_result"&&t.content?t.content:null,error:null,status:a==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:a,content:t.content,toolCall:o,attachments:t.attachments??[],attachmentPayloads:null,origin:t.origin??null,originRef:t.originRef??null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:n,clientRequestId:r}}function cl(e,t,n,r=[],a=[],o=Number.MAX_SAFE_INTEGER){return{id:`pending-${n}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:r,attachmentPayloads:a,origin:null,originRef:null,timestamp:new Date().toISOString(),sequence:o,rawRef:`pending://${n}`,deliveryState:"sending",clientRequestId:n}}function ul(e,t,n){const r=new Map;for(const a of e)r.set(a.id,a);for(const a of n){const o=Fs(t,a),l=Vo(r,o);if(l&&l!==o.id)continue;const d=Ko(r,o);d&&d!==o.id&&r.delete(d);const m=r.get(a.messageId)??null;r.set(a.messageId,m?Po(m,o):o)}return Us(Array.from(r.values()))}function dl(e,t,n,r){const a=r===null?null:e.find(m=>m.clientRequestId===r)??null,o=e.filter(m=>m.clientRequestId!==r),l=Fs(t,n,"sent",r),d=Lo(l,a);return Us([...o.filter(m=>m.id!==d.id),d])}function ml(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function No(e){const t=[];for(const n of e){const r=t.at(-1);if(!r||!Io(r,n)){t.push(n);continue}t[t.length-1]=Oo(r,n)}return t}function So(e){const t=[];let n=null,r=!1;for(const a of e)if(!Eo(n,a,r)){if(t.push(a),ft(a)){n=a,r=!1;continue}n&&an(a)&&(r=!0)}return t}function To(e){const t=[];for(const n of e){const r=t.at(-1);if(!r||!zs(r,n)){t.push(n);continue}t[t.length-1]=Ds(r,n)}return t}function Ro(e){const t=[];for(const n of e){if(t.push(n),t.length<4)continue;const r=t[t.length-4],a=t[t.length-3],o=t[t.length-2],l=t[t.length-1];Bo(r,a,o,l)&&t.splice(t.length-3,3,Ds(a,l))}return t}function Mo(e){const t=[];for(const n of e){const r=t.at(-1);if(!r||!_o(r,n)){t.push(n);continue}t[t.length-1]=Wo(r,n)}return t}function Ao(e){const t=[];for(const n of e){const r=t.findIndex(a=>qo(a,n));if(r===-1){t.push(n);continue}t[r]=Fo(t[r],n)}return t}function Us(e){const t=[...e].sort((n,r)=>n.sequence!==r.sequence?n.sequence-r.sequence:n.timestamp.localeCompare(r.timestamp));return Ao(Mo(So(Ro(To(No(t))))))}function Lo(e,t){if(!t)return e;const n=e.attachments??[];return{...e,attachments:n.length>0?n:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function Po(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return ht(e,t);const n=Uo(e.toolCall,t.toolCall),r=Do(e.content,t.content,e.timestamp,t.timestamp),a=$o(e.attachments,t.attachments);return{...ht(e,t),content:r,toolCall:n,attachments:a,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function Io(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const n=ut(e.content),r=ut(t.content);return Ge(e.timestamp,t.timestamp,wo)&&B(n.text)===B(r.text)&&Ho(n.inlineImages,r.inlineImages)}function Eo(e,t,n){return!e||n||!ft(e)||!ft(t)?!1:Ge(e.timestamp,t.timestamp,120*1e3)&&B(e.content)===B(t.content)}function ft(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function an(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function zs(e,t){return an(e)&&an(t)&&Ge(e.timestamp,t.timestamp,120*1e3)&&B(e.content)===B(t.content)}function Bo(e,t,n,r){return!e||!t||!n||!r||!ft(e)||!ft(n)?!1:zs(t,r)&&Ge(e.timestamp,n.timestamp,120*1e3)&&B(e.content)===B(n.content)}function Ds(e,t){var l,d;const n=((l=e.attachments)==null?void 0:l.length)??0,r=((d=t.attachments)==null?void 0:d.length)??0;if(n!==r)return n>r?e:t;const a=B(e.content).length,o=B(t.content).length;return a!==o?a>o?e:t:ht(e,t)}function Oo(e,t){var m,k;const n=((m=e.attachments)==null?void 0:m.length)??0,r=((k=t.attachments)==null?void 0:k.length)??0;if(n!==r)return n>r?e:t;const a=ut(e.content).inlineImages.length,o=ut(t.content).inlineImages.length;if(a!==o)return a>o?e:t;const l=e.content!==B(e.content),d=t.content!==B(t.content);return l!==d?l?t:e:t}function _o(e,t){return!ss(e)||!ss(t)?!1:e.role===t.role&&Ge(e.timestamp,t.timestamp,120*1e3)&&B(e.content)===B(t.content)}function qo(e,t){return!rs(e)||!rs(t)?!1:e.role===t.role&&Ge(e.timestamp,t.timestamp,120*1e3)&&B(e.content)===B(t.content)}function ss(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("gemini://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function rs(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("kimi://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function Wo(e,t){var m,k;const n=((m=e.attachments)==null?void 0:m.length)??0,r=((k=t.attachments)==null?void 0:k.length)??0;if(n!==r)return n>r?e:t;const a=B(e.content).length,o=B(t.content).length;if(a!==o)return a>o?e:t;const l=e.rawRef.includes("#file="),d=t.rawRef.includes("#file=");return l!==d?l?e:t:ht(e,t)}function Fo(e,t){var m,k;const n=((m=e.attachments)==null?void 0:m.length)??0,r=((k=t.attachments)==null?void 0:k.length)??0;if(n!==r)return n>r?e:t;const a=B(e.content).length,o=B(t.content).length;if(a!==o)return a>o?e:t;const l=e.rawRef.includes("/context#"),d=t.rawRef.includes("/context#");return l!==d?l?e:t:ht(e,t)}function Uo(e,t){return e?t?{...zo(e,t),input:$s(e.input,t.input),output:as(e.output,t.output),error:as(e.error,t.error)}:e:t}function zo(e,t){const n=is(e.status),r=is(t.status);return r!==n?r>n?t:e:t}function is(e){return e==="running"?0:1}function Do(e,t,n,r){const a=B(e),o=B(t);return a===o?e.length>=t.length?e:t:a.length>o.length&&a.includes(o)?e:o.length>a.length&&o.includes(a)||r.localeCompare(n)>=0?t:e}function $o(e,t){const n=(e==null?void 0:e.length)??0,r=(t==null?void 0:t.length)??0;return r!==n?r>n?t:e:t??e}function $s(e,t){return t.length>e.length?t:e}function as(e,t){return e===null?t:t===null?e:$s(e,t)}function ht(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function B(e){return e.replace(/\r\n/g,`
|
|
17
|
+
`).trimEnd()}function Ho(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((n,r)=>{var a;return n.url===((a=t[r])==null?void 0:a.url)})}function Ko(e,t){return Ks(t)?Hs(e,t,"optimistic"):null}function Vo(e,t){return pn(t)?Hs(e,t,"authoritative"):null}function Hs(e,t,n){const r=Ot(t.timestamp),a=B(t.content);let o=null,l=Number.POSITIVE_INFINITY;for(const[d,m]of e.entries()){if(!(n==="optimistic"?pn(m):Ks(m))||B(m.content)!==a)continue;const v=Ot(m.timestamp),x=Math.abs(v-r);x>300*1e3||x<l&&(o=d,l=x)}return o}function pn(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function Ks(e){return e.role==="user"&&e.kind==="text"&&!pn(e)}function Ot(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function pl(e){return e.reduce((n,r)=>Number.isFinite(r.sequence)&&r.sequence>n?r.sequence:n,0)+1}function Ge(e,t,n){return Math.abs(Ot(e)-Ot(t))<=n}export{tl as B,rl as C,sl as M,al as P,ol as R,cl as a,ml as b,ll as c,il as d,nl as e,pl as g,ul as m,dl as r,Fs as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.session-index-page{display:flex;flex-direction:column;gap:0}.session-section{padding:0}.session-index-archive-actions{padding:0 0 .85rem}.session-index-archive-button{display:flex;align-items:center;width:100%;border-radius:1rem;position:relative}.session-index-archive-count{display:inline-flex;align-items:center;justify-content:center;min-width:1.75rem;min-height:1.75rem;padding:0 .5rem;border-radius:999px;background:color-mix(in srgb,white 76%,transparent);color:color-mix(in srgb,var(--accent) 78%,var(--text-primary));font-size:.8rem;font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,white 30%,transparent);position:absolute;top:50%;right:14px;transform:translateY(-50%);pointer-events:none}.session-section-sheet{background:transparent;border:0;padding-top:0}.session-section-heading{display:flex;justify-content:space-between;align-items:baseline;gap:1rem;margin-bottom:.75rem;padding:0 .95rem}.session-section-description{margin:.25rem 0 0;color:var(--text-muted);font-size:.85rem}.session-section-count{font-size:.75rem;color:var(--text-muted)}.session-section-list{display:flex;flex-direction:column;gap:.75rem}.session-current-workspace-list{overflow:hidden;border:1px solid color-mix(in srgb,var(--border-primary) 84%,transparent);border-radius:1.2rem;background:linear-gradient(180deg,color-mix(in srgb,var(--bg-surface) 98%,transparent),var(--bg-surface)),var(--bg-surface);box-shadow:0 0 0 .5px color-mix(in srgb,rgba(255,255,255,.74) 54%,transparent),0 12px 28px #0f172a0d}.session-list-tree-node{display:flex;flex-direction:column}.session-list-tree-row{display:flex;align-items:stretch;min-width:0;position:relative;--session-tree-line-color: color-mix(in srgb, var(--text-secondary) 54%, var(--bg-primary));--session-tree-indicator-size: 10px;--session-tree-link-gap: .55rem;--session-tree-link-padding-left: .4rem;--session-tree-toggle-left: .95rem;--session-tree-indicator-center-x: calc( var(--session-tree-toggle-left) + (var(--session-tree-indicator-size) / 2) );--session-tree-indicator-center-y: calc(.95rem + .35rem + 5px);--session-tree-indent-step: 1.35rem;--session-tree-gap: 4px;--session-tree-gap-half: calc(var(--session-tree-gap) / 2);padding-left:calc(var(--session-tree-depth, 0) * var(--session-tree-indent-step))}.session-list-tree-row>.session-list-item{flex:1 1 auto;min-width:0;position:relative;z-index:1}.session-current-workspace-list>.session-list-tree-node{border-bottom:1px solid color-mix(in srgb,var(--border-primary) 82%,transparent)}.session-current-workspace-list>.session-list-tree-node:last-child{border-bottom:0}.session-list-children{display:flex;flex-direction:column;margin-left:0;padding-left:0}.session-tree-guides{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none}.session-tree-guide-column,.session-tree-guide-branch{position:absolute;top:0;right:0;bottom:0;left:0}.session-tree-guide-column:before{content:"";position:absolute;top:calc(-1 * var(--session-tree-gap-half));bottom:calc(-1 * var(--session-tree-gap-half));left:calc(((var(--session-tree-level) - 1) * var(--session-tree-indent-step)) + var(--session-tree-indicator-center-x) - .5px);width:1px;background:var(--session-tree-line-color)}.session-tree-guide-branch:before{content:"";position:absolute;top:calc(-1 * var(--session-tree-gap-half));left:calc(((var(--session-tree-level) - 1) * var(--session-tree-indent-step)) + var(--session-tree-indicator-center-x) - .5px);width:1px;height:calc(var(--session-tree-indicator-center-y) + var(--session-tree-gap-half));background:var(--session-tree-line-color)}.session-tree-guide-branch[data-first=true]:before{top:calc(-1 * (var(--session-tree-indicator-center-y) + var(--session-tree-gap-half)));height:calc((var(--session-tree-indicator-center-y) * 2) + var(--session-tree-gap-half))}.session-tree-guide-branch[data-continue=true]:after{content:"";position:absolute;top:var(--session-tree-indicator-center-y);bottom:calc(-1 * var(--session-tree-gap-half));left:calc(((var(--session-tree-level) - 1) * var(--session-tree-indent-step)) + var(--session-tree-indicator-center-x) - .5px);width:1px;background:var(--session-tree-line-color)}.session-tree-guide-branch-horizontal{position:absolute;top:var(--session-tree-indicator-center-y);left:calc(((var(--session-tree-level) - 1) * var(--session-tree-indent-step)) + var(--session-tree-indicator-center-x));width:var(--session-tree-indent-step);height:1px;background:var(--session-tree-line-color);transform:translateY(-.5px)}.session-section-empty{margin:0;color:var(--text-muted)}.session-list-item{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.75rem;border-radius:10px;background:var(--surface-press);border:1px solid transparent;position:relative}.session-list-item[data-active=true]{border-color:color-mix(in srgb,var(--accent) 22%,transparent);background:color-mix(in srgb,var(--accent) 8%,var(--surface-press))}.session-list-item[data-variant=mobile]{gap:.35rem;padding:0;border:0;border-radius:0;background:transparent}.session-list-item[data-variant=mobile]:not([data-depth="0"]):before{content:none}.session-list-item[data-variant=mobile][data-active=true]{border-color:transparent;background:color-mix(in srgb,var(--accent) 8%,var(--bg-surface))}.session-list-item[data-depth="1"]{background:color-mix(in srgb,var(--surface-press) 84%,transparent)}.session-list-item[data-variant=mobile][data-depth="1"]{background:color-mix(in srgb,var(--bg-tertiary) 80%,transparent)}.session-list-item[data-depth="2"],.session-list-item[data-depth="3"]{background:color-mix(in srgb,var(--surface-press) 72%,transparent)}.session-list-item[data-variant=mobile][data-depth="2"],.session-list-item[data-variant=mobile][data-depth="3"]{background:color-mix(in srgb,var(--bg-tertiary) 68%,transparent)}.session-list-item[data-variant=mobile][data-workspace-tone=worktree] .session-list-title{color:color-mix(in srgb,var(--text-primary) 78%,var(--success) 22%)}.session-list-item[data-variant=mobile][data-workspace-tone=worktree] .session-list-meta{color:color-mix(in srgb,var(--text-secondary) 76%,var(--success) 24%)}.session-list-item[data-variant=mobile][data-workspace-tone=worktree][data-active=true]{background:linear-gradient(135deg,color-mix(in srgb,var(--success) 12%,var(--bg-surface)),color-mix(in srgb,var(--accent) 10%,var(--bg-surface)))}.session-list-link{flex:1;display:flex;align-items:flex-start;gap:.7rem;text-align:left;border:none;background:transparent;padding:0}.session-list-link:hover{text-decoration:underline}.session-list-item[data-variant=mobile] .session-list-link{gap:var(--session-tree-link-gap);padding:.95rem .95rem .95rem .35rem}.session-list-item[data-variant=mobile] .session-list-link:hover{text-decoration:none}.session-list-title{margin:0;font-weight:600}.session-list-copy{min-width:0;flex:1}.session-list-meta{margin:.25rem 0 0;font-size:.85rem;color:var(--text-muted)}.session-list-item[data-variant=mobile] .session-list-title{font-size:.98rem;font-weight:600}.session-list-item[data-variant=mobile] .session-list-meta{font-size:.78rem}.session-list-indicator{width:var(--session-tree-indicator-size, 10px);height:var(--session-tree-indicator-size, 10px);margin-top:.35rem;border-radius:999px;flex-shrink:0;box-sizing:border-box;position:relative;z-index:1;isolation:isolate}.session-list-indicator:before{content:"";position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px;border-radius:999px;background:var(--bg-surface);z-index:-1}.session-list-indicator:after{content:"";position:absolute;top:50%;left:50%;width:7px;height:7px;border-radius:999px;background:transparent;box-sizing:border-box;transform:translate(-50%,-50%)}.session-list-item[data-variant=mobile]>.session-list-indicator{align-self:flex-start;margin:1.3rem 0 0 var(--session-tree-toggle-left)}.session-list-subsession-toggle{display:inline-flex;align-items:flex-start;justify-content:center;align-self:stretch;margin:.95rem 0 .95rem var(--session-tree-toggle-left);padding:0;border:0;background:transparent;color:var(--text-secondary);position:relative;z-index:1}.session-list-subsession-toggle .session-list-indicator{margin-top:.35rem}.session-list-indicator.is-idle{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-idle:after{border:2px solid color-mix(in srgb,var(--text-secondary) 42%,var(--border-primary))}.session-list-indicator.is-unread{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-unread:after{background:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent)}.session-list-indicator.is-subagent{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-subagent:after{background:var(--success);box-shadow:0 0 0 3px color-mix(in srgb,var(--success) 18%,transparent)}.session-list-indicator.is-subagent-unread{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-subagent-unread:after{background:var(--success);box-shadow:0 0 0 4px color-mix(in srgb,var(--success) 22%,transparent)}.session-list-indicator.is-running{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-running:after{border:2px solid color-mix(in srgb,var(--accent) 22%,transparent);border-top-color:var(--accent);animation:session-running-spin .8s linear infinite}.session-list-indicator.is-running-inferred{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-running-inferred:after{border:2px solid color-mix(in srgb,var(--warning) 28%,transparent);border-top-color:var(--warning);animation:session-running-spin .8s linear infinite}.session-list-indicator.is-stale{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-stale:after{border:2px solid color-mix(in srgb,var(--warning) 34%,transparent);border-top-color:color-mix(in srgb,var(--warning) 70%,#8a4b00);animation:session-running-spin 1.4s linear infinite}.session-list-indicator.is-unknown{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-unknown:after{border:2px dashed color-mix(in srgb,var(--text-muted) 46%,transparent);background:color-mix(in srgb,var(--surface-muted) 82%,transparent)}.session-list-indicator.is-subagent-running{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-subagent-running:after{border:2px solid color-mix(in srgb,var(--success) 24%,transparent);border-top-color:var(--success);animation:session-running-spin .8s linear infinite}.session-list-indicator.is-error{border:none;background:transparent;box-shadow:none;animation:none}.session-list-indicator.is-error:after{background:#ff3b30;box-shadow:0 0 0 3px #ff3b3024}.session-list-error{margin-top:.3rem;color:#c9342d;font-size:.76rem;line-height:1.35;word-break:break-word}.session-list-activity-badge{display:inline-flex;align-items:center;padding:.08rem .38rem;border-radius:999px;font-size:.68rem;line-height:1.35}.session-list-activity-badge.is-stale{background:color-mix(in srgb,var(--warning) 14%,transparent);color:color-mix(in srgb,var(--warning) 74%,#704100)}.session-list-activity-badge.is-unknown{background:color-mix(in srgb,var(--surface-muted) 76%,transparent);color:var(--text-muted)}.session-list-actions{position:relative;display:flex;gap:.4rem}.session-list-actions .ghost-button{padding:.35rem .6rem;font-size:.75rem}.session-list-item[data-variant=mobile] .session-list-actions{align-self:stretch;align-items:center;padding-right:.75rem}.session-list-item[data-variant=mobile] .session-list-actions .ghost-button{min-height:2rem;padding:.25rem .5rem;color:var(--text-secondary)}.session-action-menu{position:fixed;z-index:3200;min-width:9rem;display:flex;flex-direction:column;padding:.35rem;border:1px solid var(--border-primary);border-radius:12px;background:color-mix(in srgb,var(--bg-surface) 96%,transparent);box-shadow:var(--shadow-lg);overflow-y:auto;overscroll-behavior:contain}.session-action-menu-item{width:100%;border:none;background:transparent;text-align:left;padding:.55rem .65rem;border-radius:8px;color:var(--text-primary)}.session-action-menu-item:hover{background:var(--surface-press)}.mobile-conversation-page[data-mobile-shell=true]{--mobile-conversation-preview-default-width: 48vw;--mobile-conversation-preview-max-width: 48vw;--mobile-conversation-preview-width: 0px;--mobile-conversation-preview-gap: 4px;--mobile-conversation-preview-progress: 0;--mobile-conversation-preview-offset: calc( var(--mobile-conversation-preview-width) + var(--mobile-conversation-preview-gap) );background:linear-gradient(180deg,color-mix(in srgb,var(--bg-surface) 28%,transparent),transparent 18%),var(--bg-primary);width:100%;max-width:100%;min-width:0;height:100%;overflow:hidden;box-sizing:border-box;gap:0;padding:0;position:relative}.mobile-conversation-header{position:sticky;top:0;z-index:12;display:flex;align-items:center;gap:.6rem;width:100%;max-width:100%;min-width:0;min-height:48px;box-sizing:border-box;flex-shrink:0;overflow:hidden;padding:.7rem max(1rem,env(safe-area-inset-right,0px)) .65rem max(1rem,env(safe-area-inset-left,0px));border-bottom:1px solid color-mix(in srgb,var(--border-primary) 78%,transparent);background:color-mix(in srgb,var(--bg-surface) 96%,transparent);-webkit-backdrop-filter:blur(16px);backdrop-filter:blur(16px);transition:transform .22s ease;will-change:transform}.mobile-conversation-header:not(.mobile-conversation-header-embedded),.mobile-conversation-stage{width:100%;max-width:100%;box-sizing:border-box;transform:translate(0);will-change:transform,width}.mobile-conversation-page-header{width:100%;max-width:100%;box-sizing:border-box;transform:none}.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .mobile-conversation-header:not(.mobile-conversation-header-embedded),.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .mobile-conversation-stage{width:calc(100% - var(--mobile-conversation-preview-offset));max-width:calc(100% - var(--mobile-conversation-preview-offset));transform:translate(var(--mobile-conversation-preview-offset))}.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message .message-content-wrapper,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message .message-content,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message .code-block,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message .text-code-block,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .tool-message-row .tool-call-item{width:100%;max-width:100%;min-width:0}.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message .message-content-wrapper{flex:1 1 auto}.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message pre,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .system-message code,.mobile-conversation-page[data-mobile-shell=true][data-preview-mode=preview] .tool-call-output pre{overflow-wrap:anywhere;word-break:break-word}.mobile-conversation-page[data-mobile-shell=true][data-preview-dragging=true] .mobile-conversation-header,.mobile-conversation-page[data-mobile-shell=true][data-preview-dragging=true] .mobile-conversation-page-header,.mobile-conversation-page[data-mobile-shell=true][data-preview-dragging=true] .mobile-conversation-stage,.mobile-conversation-page[data-mobile-shell=true][data-preview-dragging=true] .mobile-conversation-main,.mobile-conversation-page[data-mobile-shell=true][data-preview-dragging=true] .mobile-conversation-preview-rail{transition:none}.mobile-conversation-page-header .mobile-workspace-home-toolbar-top{align-items:center}.mobile-conversation-page-header .mobile-workspace-home-switcher{flex:0 0 auto;min-width:max-content;max-width:none}.mobile-conversation-page-header .mobile-workspace-home-switcher-label{overflow:visible;text-overflow:clip;white-space:nowrap}.mobile-conversation-page-header .mobile-workspace-home-toolbar-actions{display:flex;flex:1 1 0;min-width:0;justify-content:flex-start;margin-left:0}.mobile-conversation-page[data-workspace-tone=worktree] .mobile-conversation-page-header{border-bottom-color:color-mix(in srgb,var(--success) 18%,var(--border-primary));background:linear-gradient(180deg,color-mix(in srgb,var(--success) 4%,var(--bg-surface)),color-mix(in srgb,var(--accent) 4%,var(--bg-surface)))}.mobile-conversation-page[data-workspace-tone=worktree] .mobile-conversation-stage{background:radial-gradient(circle at top right,color-mix(in srgb,var(--success) 8%,transparent),transparent 34%),radial-gradient(circle at top left,color-mix(in srgb,var(--accent) 7%,transparent),transparent 36%)}.mobile-conversation-toolbar-main{display:flex;align-items:flex-start;gap:.65rem;width:100%;min-width:0}.mobile-conversation-session-actions{display:flex;flex:0 0 auto;flex-direction:column;align-items:stretch;gap:.45rem}.mobile-conversation-toolbar-main .mobile-conversation-session-actions,.mobile-conversation-toolbar-main .conversation-butler-entry{flex:0 0 auto}.mobile-conversation-toolbar-main .mobile-conversation-session-actions .conversation-header-ai-button{min-width:2.45rem;height:2rem;padding:0 .8rem;border-radius:999px;border-color:var(--app-button-border);background:var(--app-button-bg);box-shadow:none;color:var(--app-button-color)}.mobile-conversation-toolbar-main .mobile-conversation-session-actions .mobile-conversation-more-button{padding:0}.mobile-conversation-action-menu{min-width:12rem;padding:.45rem;border-radius:14px}.mobile-conversation-action-menu-item{min-height:3rem;padding:.8rem .95rem;border-radius:10px;font-size:1rem;font-weight:500}.mobile-conversation-toolbar-title{display:-webkit-box;flex:1 1 auto;width:100%;min-width:0;max-width:100%;overflow:hidden;color:var(--text-primary);font-size:.95rem;font-weight:600;line-height:1.2;text-align:left;text-overflow:ellipsis;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}.mobile-conversation-header-toggle{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:1px solid color-mix(in srgb,var(--border-primary) 82%,transparent);border-radius:999px;background:color-mix(in srgb,var(--bg-primary) 82%,transparent);color:var(--text-secondary);flex:0 0 auto;transition:border-radius .22s ease,width .22s ease,height .22s ease,margin .22s ease}.mobile-conversation-header-toggle[data-preview-mode=preview]{color:var(--accent);border-color:color-mix(in srgb,var(--border-primary) 86%,transparent);background:color-mix(in srgb,var(--bg-surface) 94%,transparent);align-self:stretch;width:2.35rem;height:auto;margin:-.7rem 0 -.65rem;border-top:0;border-bottom:0;border-left:0;border-radius:0}.mobile-conversation-header-embedded{position:static;top:auto;z-index:auto;min-height:0;padding:0;border:0;background:transparent;-webkit-backdrop-filter:none;backdrop-filter:none;transition:none}.mobile-conversation-header-embedded .mobile-conversation-header-toggle[data-preview-mode=preview]{align-self:center;width:2rem;height:2rem;margin:0;border:1px solid color-mix(in srgb,var(--border-primary) 82%,transparent);border-radius:999px}.mobile-conversation-header-embedded .mobile-conversation-header-copy h1{font-size:1rem}.mobile-conversation-header-copy{display:flex;flex:1 1 auto;max-width:100%;min-width:0;flex-direction:column;overflow:hidden}.mobile-conversation-header h1{margin:0;max-width:100%;overflow:hidden;font-size:1rem;font-weight:700;line-height:1.3;text-overflow:ellipsis;white-space:nowrap}.mobile-conversation-page-header{transition:transform .22s ease}.mobile-conversation-stage{position:relative;display:flex;flex:1 1 auto;width:100%;max-width:100%;min-height:0;min-width:0;overflow:hidden;box-sizing:border-box;gap:0;touch-action:pan-y;transition:transform .22s ease}.mobile-conversation-main{display:flex;flex:1 1 auto;width:100%;max-width:100%;min-width:0;min-height:0;flex-direction:column;overflow:hidden;box-sizing:border-box;box-shadow:calc(-14px * var(--mobile-conversation-preview-progress)) 0 32px rgba(15,23,42,calc(.03 + var(--mobile-conversation-preview-progress) * .08));transition:box-shadow .22s ease}.mobile-conversation-tool-panel{position:absolute;top:0;right:0;bottom:0;left:0;z-index:18;display:flex;flex-direction:column;min-width:0;min-height:0;background:linear-gradient(180deg,color-mix(in srgb,var(--bg-surface) 98%,transparent),var(--bg-primary));box-shadow:-18px 0 40px color-mix(in srgb,#000 16%,transparent)}.mobile-conversation-tool-panel-header{display:flex;align-items:center;gap:.75rem;padding:max(.85rem,env(safe-area-inset-top,0px)) max(.95rem,env(safe-area-inset-right,0px)) .75rem max(.95rem,env(safe-area-inset-left,0px));border-bottom:1px solid color-mix(in srgb,var(--border-primary) 78%,transparent);background:color-mix(in srgb,var(--bg-surface) 96%,transparent);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}.mobile-conversation-tool-panel-back{display:inline-flex;align-items:center;justify-content:center;width:2.4rem;height:2.4rem;padding:0;border:1px solid color-mix(in srgb,var(--border-primary) 78%,transparent);border-radius:999px;background:color-mix(in srgb,var(--bg-primary) 88%,transparent);color:var(--text-primary);font-size:1.35rem;line-height:1}.mobile-conversation-tool-panel-tabs{display:grid;flex:1 1 auto;grid-template-columns:repeat(3,minmax(0,1fr));gap:.35rem;padding:.24rem;border-radius:999px;background:color-mix(in srgb,var(--bg-primary) 86%,transparent)}.mobile-conversation-tool-panel-tab{min-height:2.35rem;border:0;border-radius:999px;background:transparent;color:var(--text-secondary);font-size:.92rem;font-weight:700;transition:background var(--transition-fast),color var(--transition-fast),box-shadow var(--transition-fast)}.mobile-conversation-tool-panel-tab[aria-selected=true]{background:color-mix(in srgb,var(--bg-surface) 96%,transparent);color:var(--text-primary);box-shadow:inset 0 1px #ffffffb8,0 10px 22px #0f172a14}.mobile-conversation-tool-panel-body{display:flex;flex:1 1 auto;min-width:0;min-height:0;padding:.75rem max(.75rem,env(safe-area-inset-right,0px)) max(.75rem,env(safe-area-inset-bottom,0px)) max(.75rem,env(safe-area-inset-left,0px));overflow:hidden}.mobile-conversation-tool-panel-body>.mobile-conversation-tool-surface,.mobile-conversation-tool-surface.conversation-panel,.mobile-conversation-tool-panel-body>.terminal-manager-panel.mobile-conversation-tool-surface{flex:1 1 auto;min-width:0;min-height:0;height:100%;max-height:100%;border-radius:1.2rem!important;overflow:hidden}.mobile-conversation-page[data-mobile-shell=true] .mobile-conversation-preview-rail.surface-card,.mobile-conversation-preview-rail{position:absolute;top:calc(var(--mobile-conversation-page-header-height, 0px) + var(--mobile-conversation-preview-gap));left:var(--mobile-conversation-preview-gap);bottom:calc(var(--mobile-conversation-composer-height, 0px) + var(--mobile-conversation-preview-gap));z-index:11;display:flex;width:var(--mobile-conversation-preview-width);max-width:min(var(--mobile-conversation-preview-width),var(--mobile-conversation-preview-max-width));min-height:0;min-width:0;flex-direction:column;gap:.7rem;padding:1rem .8rem .8rem;border:0;border-right:1px solid color-mix(in srgb,var(--border-primary) 86%,transparent);border-radius:16px!important;background:color-mix(in srgb,var(--bg-surface) 94%,transparent);box-shadow:12px 0 34px color-mix(in srgb,#000 14%,transparent);backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);overflow:hidden;will-change:transform;transition:width .22s ease,max-width .22s ease,box-shadow .22s ease}.mobile-conversation-preview-rail[data-dragging=true]{transition:none}.mobile-conversation-preview-rail[data-dragging=true] button{pointer-events:none}.mobile-conversation-preview-topbar{display:flex;flex:0 0 auto;padding-top:.2rem}.mobile-conversation-preview-create-button,.mobile-conversation-preview-archive-button{width:100%}.mobile-conversation-preview-list{display:flex;min-height:0;flex:1 1 auto;flex-direction:column;gap:.45rem;overflow-y:auto;overscroll-behavior:contain}.mobile-conversation-preview-list-static{flex:0 0 auto;overflow:visible}.mobile-conversation-preview-list-favorites{flex:0 0 auto;min-height:auto;padding-bottom:0;margin-bottom:0;border-bottom:0}.mobile-conversation-preview-group{display:flex;flex-direction:column;gap:.5rem}.mobile-conversation-preview-group-workspace,.mobile-conversation-preview-group-archive{padding-top:0;border-top:0}.mobile-conversation-preview-group-workspace{flex:1 1 auto;min-height:0;overflow:hidden}.mobile-conversation-preview-body{display:flex;flex:1 1 auto;min-height:0;flex-direction:column;gap:.75rem}.mobile-conversation-preview-actions{display:flex;flex-direction:column;gap:.45rem}.mobile-conversation-preview-group-heading{padding:0 .5rem}.mobile-conversation-preview-empty{margin:0;color:var(--text-muted);font-size:.78rem;line-height:1.45}.mobile-conversation-preview-entry{position:relative;display:flex;align-items:stretch;gap:.35rem;min-width:0;z-index:1}.mobile-conversation-preview-item{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:.45rem;width:100%;min-width:0;min-height:0;flex:1 1 auto;padding:7px 10px 7px 4px;border-radius:10px;border:1px solid color-mix(in srgb,var(--border-primary) 78%,transparent);background:color-mix(in srgb,var(--bg-primary) 88%,transparent);color:inherit;text-align:left;overflow:hidden;box-sizing:border-box}.mobile-conversation-preview-item.terminal-mobile-session-primary{flex-direction:row;align-items:center;flex:1 1 auto;min-height:0;padding:7px 10px 7px 4px;border-radius:10px;gap:.45rem}.mobile-conversation-preview-item-body{display:flex;flex:1 1 auto;min-width:0;flex-direction:column;gap:1px}.mobile-conversation-preview-entry[data-active=true] .mobile-conversation-preview-item{border-color:color-mix(in srgb,var(--accent) 34%,transparent);background:color-mix(in srgb,var(--accent) 10%,var(--bg-primary))}.mobile-conversation-preview-indicator{width:8px;height:8px;border-radius:999px;flex-shrink:0;position:relative;z-index:1;isolation:isolate}.mobile-conversation-preview-indicator:before{content:"";position:absolute;top:-3px;right:-3px;bottom:-3px;left:-3px;border-radius:999px;background:color-mix(in srgb,var(--bg-primary) 92%,transparent);z-index:-1}.mobile-conversation-preview-indicator:after{content:"";position:absolute;top:50%;left:50%;width:7px;height:7px;border-radius:999px;background:transparent;box-sizing:border-box;transform:translate(-50%,-50%)}.mobile-conversation-preview-entry>.mobile-conversation-preview-indicator{align-self:flex-start;margin:.67rem 0 0 .65rem}.mobile-conversation-preview-toggle{display:inline-flex;align-items:flex-start;justify-content:center;align-self:stretch;margin:.45rem 0 .45rem .65rem;padding:0;border:0;background:transparent;color:var(--text-secondary);position:relative;z-index:1}.mobile-conversation-preview-toggle .mobile-conversation-preview-indicator{margin-top:.22rem}.mobile-conversation-preview-tree-node{display:flex;flex-direction:column}.mobile-conversation-preview-tree-row{position:relative;display:flex;align-items:stretch;min-width:0;--mobile-preview-tree-line-color: color-mix(in srgb, var(--text-secondary) 54%, var(--bg-primary));--mobile-preview-tree-indent-step: 1.15rem;--mobile-preview-tree-gap: 4px;--mobile-preview-tree-gap-half: calc(var(--mobile-preview-tree-gap) / 2);--mobile-preview-tree-indicator-center-x: calc(.65rem + 4px) ;--mobile-preview-tree-indicator-center-y: 1.11rem;padding-left:calc(var(--mobile-preview-tree-depth, 0) * var(--mobile-preview-tree-indent-step))}.mobile-conversation-preview-guides{position:absolute;top:0;right:0;bottom:0;left:0;z-index:0;pointer-events:none}.mobile-conversation-preview-guide-column,.mobile-conversation-preview-guide-branch{position:absolute;top:0;right:0;bottom:0;left:0}.mobile-conversation-preview-guide-column:before{content:"";position:absolute;top:calc(-1 * var(--mobile-preview-tree-gap-half));bottom:calc(-1 * var(--mobile-preview-tree-gap-half));left:calc(((var(--mobile-preview-tree-level) - 1) * var(--mobile-preview-tree-indent-step)) + var(--mobile-preview-tree-indicator-center-x) - .5px);width:1px;background:var(--mobile-preview-tree-line-color)}.mobile-conversation-preview-guide-branch:before{content:"";position:absolute;top:calc(-1 * var(--mobile-preview-tree-gap-half));left:calc(((var(--mobile-preview-tree-level) - 1) * var(--mobile-preview-tree-indent-step)) + var(--mobile-preview-tree-indicator-center-x) - .5px);width:1px;height:calc(var(--mobile-preview-tree-indicator-center-y) + var(--mobile-preview-tree-gap-half));background:var(--mobile-preview-tree-line-color)}.mobile-conversation-preview-guide-branch[data-first=true]:before{top:calc(-1 * (var(--mobile-preview-tree-indicator-center-y) + var(--mobile-preview-tree-gap-half)));height:calc((var(--mobile-preview-tree-indicator-center-y) * 2) + var(--mobile-preview-tree-gap-half))}.mobile-conversation-preview-guide-branch[data-continue=true]:after{content:"";position:absolute;top:var(--mobile-preview-tree-indicator-center-y);bottom:calc(-1 * var(--mobile-preview-tree-gap-half));left:calc(((var(--mobile-preview-tree-level) - 1) * var(--mobile-preview-tree-indent-step)) + var(--mobile-preview-tree-indicator-center-x) - .5px);width:1px;background:var(--mobile-preview-tree-line-color)}.mobile-conversation-preview-guide-branch-horizontal{position:absolute;top:var(--mobile-preview-tree-indicator-center-y);left:calc(((var(--mobile-preview-tree-level) - 1) * var(--mobile-preview-tree-indent-step)) + var(--mobile-preview-tree-indicator-center-x));width:var(--mobile-preview-tree-indent-step);height:1px;background:var(--mobile-preview-tree-line-color);transform:translateY(-.5px)}.mobile-conversation-preview-children{display:flex;flex-direction:column}.mobile-conversation-preview-indicator.is-idle{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-idle:after{border:2px solid color-mix(in srgb,var(--text-secondary) 40%,var(--border-primary))}.mobile-conversation-preview-indicator.is-active{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-active:after{background:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent)}.mobile-conversation-preview-indicator.is-subagent{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-subagent:after{background:#34c759;box-shadow:0 0 0 3px color-mix(in srgb,#34c759 18%,transparent)}.mobile-conversation-preview-indicator.is-subagent-unread{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-subagent-unread:after{background:#34c759;box-shadow:0 0 0 4px color-mix(in srgb,#34c759 22%,transparent)}.mobile-conversation-preview-indicator.is-running{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-running:after{border:2px solid color-mix(in srgb,var(--accent) 22%,transparent);border-top-color:var(--accent);animation:session-running-spin .8s linear infinite}.mobile-conversation-preview-indicator.is-running-inferred{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-running-inferred:after{border:2px solid color-mix(in srgb,var(--warning) 28%,transparent);border-top-color:var(--warning);animation:session-running-spin .8s linear infinite}.mobile-conversation-preview-indicator.is-subagent-running{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-subagent-running:after{border:2px solid color-mix(in srgb,#34c759 26%,transparent);border-top-color:#34c759;animation:session-running-spin .8s linear infinite}.mobile-conversation-preview-indicator.is-stale{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-stale:after{border:2px solid color-mix(in srgb,var(--warning) 34%,transparent);border-top-color:color-mix(in srgb,var(--warning) 70%,#8a4b00);animation:session-running-spin 1.4s linear infinite}.mobile-conversation-preview-indicator.is-unknown{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-unknown:after{border:2px dashed color-mix(in srgb,var(--text-muted) 46%,transparent);background:color-mix(in srgb,var(--surface-muted) 82%,transparent)}.mobile-conversation-preview-indicator.is-error{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-error:after{background:#ff3b30;box-shadow:0 0 0 3px #ff3b3029}.mobile-conversation-preview-indicator.is-unread{background:transparent;box-shadow:none;animation:none}.mobile-conversation-preview-indicator.is-unread:after{background:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent)}.mobile-conversation-preview-item-title,.mobile-conversation-preview-item-meta{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mobile-conversation-preview-item-title{flex:0 0 auto;min-width:0;font-size:.86rem;font-weight:600;color:var(--text-primary);line-height:1.25}.mobile-conversation-preview-item .terminal-mobile-session-title,.terminal-mobile-session-primary .mobile-conversation-preview-item-title{flex:0 0 auto;font-size:.86rem;font-weight:600;line-height:1.25}.mobile-conversation-preview-item-meta{flex:0 0 auto;min-width:0;color:var(--text-tertiary);font-size:.7rem;line-height:1.2;white-space:nowrap}.mobile-conversation-preview-item .terminal-mobile-session-path,.terminal-mobile-session-primary .mobile-conversation-preview-item-meta{flex:0 0 auto;font-size:.7rem;white-space:nowrap}.mobile-conversation-preview-archive-button{flex:0 0 auto}@media(max-width:420px){.mobile-conversation-page[data-mobile-shell=true]{--mobile-conversation-preview-default-width: 60vw}.mobile-conversation-preview-rail{padding:.9rem .65rem calc(.9rem + env(safe-area-inset-bottom,0px))}.mobile-conversation-preview-item,.mobile-conversation-preview-item.terminal-mobile-session-primary{padding:5px 8px}.mobile-conversation-preview-item-title{font-size:.82rem}.mobile-conversation-preview-item-meta{font-size:.65rem}}.mobile-conversation-page[data-mobile-shell=true] .message-timeline,.mobile-conversation-page[data-mobile-shell=true] .message-list,.mobile-conversation-page[data-mobile-shell=true] .message-item,.mobile-conversation-page[data-mobile-shell=true] .message-content-wrapper,.mobile-conversation-bottom-layer-composer-slot .composer-panel,.mobile-conversation-bottom-layer-composer-slot .composer-form,.mobile-conversation-bottom-layer-composer-slot .composer-input-wrapper,.mobile-conversation-page[data-mobile-shell=true] .composer-panel,.mobile-conversation-page[data-mobile-shell=true] .composer-form,.mobile-conversation-page[data-mobile-shell=true] .composer-input-wrapper,.mobile-conversation-page[data-mobile-shell=true] .queued-message-list,.mobile-conversation-page[data-mobile-shell=true] .queued-message-item{min-width:0;max-width:100%;box-sizing:border-box}.mobile-conversation-page[data-mobile-shell=true] .tool-message-row .tool-call-item,.mobile-conversation-page[data-mobile-shell=true] .user-message{width:100%;max-width:100%;min-width:0}.mobile-conversation-page[data-mobile-shell=true] .user-message .message-content-wrapper{width:auto;max-width:100%;min-width:0}.mobile-conversation-page[data-mobile-shell=true] .message-text,.mobile-conversation-page[data-mobile-shell=true] .markdown-content{min-width:0;max-width:100%;overflow-wrap:anywhere;word-break:break-word}.mobile-conversation-page[data-mobile-shell=true] .assistant-message,.mobile-conversation-page[data-mobile-shell=true] .system-message{display:flex;align-items:flex-start;gap:0}.mobile-conversation-page[data-mobile-shell=true] .assistant-message .message-avatar{display:none}.mobile-conversation-page[data-mobile-shell=true] .assistant-message .message-content-wrapper,.mobile-conversation-page[data-mobile-shell=true] .system-message .message-content-wrapper,.mobile-conversation-page[data-mobile-shell=true] .rules-message-row .message-content-wrapper{flex:1 1 auto;width:100%;min-width:0}.mobile-conversation-page[data-mobile-shell=true] .markdown-content,.mobile-conversation-page[data-mobile-shell=true] .markdown-content p,.mobile-conversation-page[data-mobile-shell=true] .markdown-content li,.mobile-conversation-page[data-mobile-shell=true] .markdown-content blockquote,.mobile-conversation-page[data-mobile-shell=true] .system-message .message-text{overflow-wrap:anywhere;word-break:break-word}.mobile-conversation-page[data-mobile-shell=true] .tool-call-header,.mobile-conversation-page[data-mobile-shell=true] .tool-call-info{min-width:0;max-width:100%}.mobile-conversation-page[data-mobile-shell=true] .tool-call-info{flex-wrap:nowrap;align-items:center}.mobile-conversation-page[data-mobile-shell=true] .tool-call-input-preview{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}.mobile-conversation-page[data-mobile-shell=true] .tool-call-name,.mobile-conversation-page[data-mobile-shell=true] .tool-call-meta{flex:0 0 auto}.mobile-conversation-page[data-mobile-shell=true] .tool-call-name{flex:0 0 auto;min-width:auto;max-width:none;white-space:nowrap}.mobile-conversation-page[data-mobile-shell=true] .tool-call-input-preview{display:block;flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}.mobile-conversation-page[data-mobile-shell=true] .apply-patch-summary-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;flex-wrap:nowrap;align-items:center;min-width:0}.mobile-conversation-page[data-mobile-shell=true] .apply-patch-summary-file{flex:1 1 auto;min-width:0;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}.mobile-conversation-page[data-mobile-shell=true] .apply-patch-summary-stats{width:auto;min-width:0;flex:0 0 auto;justify-content:flex-end;white-space:nowrap}.mobile-conversation-page[data-mobile-shell=true] .markdown-content code{white-space:break-spaces;overflow-wrap:anywhere;word-break:break-word}.mobile-conversation-page[data-mobile-shell=true] .markdown-content table{display:block;max-width:100%;overflow-x:auto}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o="mobile.conversation.preview.mode",n="mobile.conversation.tool.panel";function t(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(o)==="immersive"?"immersive":"preview"}catch{return"preview"}}function i(e){if(!(typeof window>"u"))try{window.localStorage.setItem(o,e)}catch{}}function r(){if(typeof window>"u")return"files";try{const e=window.localStorage.getItem(n);return e==="git"||e==="processes"?e:"files"}catch{return"files"}}function a(e){if(!(typeof window>"u"))try{window.localStorage.setItem(n,e)}catch{}}export{r as a,a as b,t as r,i as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as n,t}from"./index-Byp9hJ0c.js";function o(){return n.request("/api/terminals/shells")}function m(e){return n.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function l(e){return n.request(`/api/terminals/templates/runtime-status?workspaceId=${encodeURIComponent(e)}`)}function u(e){return n.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function p(e){return n.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function c(e){return n.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function d(e){return n.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function f(e,r={}){const i=new URLSearchParams;typeof r.beforeSeq=="number"&&i.set("beforeSeq",String(r.beforeSeq)),typeof r.limit=="number"&&i.set("limit",String(r.limit));const a=i.toString();return n.request(`/api/terminals/${encodeURIComponent(e)}/history${a?`?${a}`:""}`)}function b(e){return n.request(`/api/terminals/templates?workspaceId=${encodeURIComponent(e)}`)}function h(e){return n.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function S(e,r){return n.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(r)})}function T(e){return n.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function q(e,r){return n.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(r)})}function w(e){return[{value:"",label:t("terminal.runtimeAutoOption"),description:t("terminal.runtimeAutoDescription")},{value:"tmux",label:e==="windows"?t("terminal.runtimePersistentLabel"):"tmux",description:e==="windows"?t("terminal.runtimeWindowsPersistentDescription"):t("terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:t("terminal.runtimeEmbeddedDescription")}]}function R(e,r){return e?e==="conpty-powershell"?t("terminal.runtimeConptyPowerShellLabel"):e==="conpty-cmd"?t("terminal.runtimeConptyCmdLabel"):e==="conpty-git-bash"?t("terminal.runtimeConptyGitBashLabel"):e==="tmux"&&r==="windows"?t("terminal.runtimePersistentLabel"):e:t("terminal.runtimeAutoOption")}function C(e,r){return e?e==="embedded-pty"?"pty":e==="conpty-powershell"||e==="conpty-cmd"||e==="conpty-git-bash"||e==="tmux"&&r==="windows"?t("terminal.runtimePersistentShortLabel"):e:t("terminal.runtimeAutoShortLabel")}export{l as a,w as b,m as c,o as d,C as e,c as f,R as g,f as h,p as i,d as j,h as k,b as l,T as m,q as r,u as s,S as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as l,t as s,b as u}from"./index-Byp9hJ0c.js";import{b as x,d as k}from"./MobileSheet-DLg-gX1t.js";import{l as j,a as p}from"./terminal-runtime-meta-AWXJpN4r.js";function O({workspace:e,state:r,variant:t}){return e?t==="mobile"?l.jsx(v,{workspace:e,state:r}):l.jsx(P,{workspace:e,state:r}):l.jsx("p",{className:"workbench-section-empty",children:s("shell.workspaceDetailMissingBody")})}function v({workspace:e,state:r}){const t=r.primaryAnalysis,o=r.analyses.length;return l.jsx(l.Fragment,{children:l.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[l.jsx("div",{className:"mobile-feature-section-header",children:l.jsx("div",{children:l.jsx("h2",{children:s("shell.workspaceDetailRegisteredDebugAnalysisTitle")})})}),r.loading&&t===null?l.jsx("p",{children:s("common.loading")}):null,r.error?l.jsx("p",{className:"status-text","data-tone":"error",children:r.error}):null,t?l.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[l.jsxs("div",{className:"mobile-detail-metric",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugFrameworkLabel")}),l.jsx("strong",{children:t.primaryFramework??s("common.unknown")})]}),l.jsxs("div",{className:"mobile-detail-metric",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugConfidenceLabel")}),l.jsx("strong",{children:y(t.confidence)})]}),l.jsxs("div",{className:"mobile-detail-metric",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugSummaryServiceCountLabel")}),l.jsx("strong",{children:o})]}),l.jsxs("div",{className:"mobile-detail-metric",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugCompatibilityLabel")}),l.jsx("strong",{children:D(t.compatibilityLevel)})]}),l.jsxs("div",{className:"mobile-detail-metric",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugLastAnalyzedAtLabel")}),l.jsx("strong",{children:r.lastAnalyzedAt??s("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),l.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[l.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),l.jsx("strong",{children:e.path})]})]}):null]})})}function P({workspace:e,state:r}){const t=r.primaryAnalysis,o=r.analyses.length;return l.jsxs("section",{className:"debug-readiness-section surface-card",children:[l.jsx("div",{className:"debug-readiness-section-header",children:l.jsxs("div",{children:[l.jsx("h3",{children:s("shell.workspaceDetailRegisteredDebugAnalysisTitle")}),l.jsx("p",{children:s("shell.workspaceDetailRegisteredDebugAnalysisDescription")})]})}),r.loading&&t===null?l.jsx("p",{className:"workbench-section-empty",children:s("common.loading")}):null,r.error?l.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:r.error}):null,t?l.jsxs("div",{className:"debug-readiness-summary-grid",children:[l.jsxs("article",{className:"debug-readiness-summary-card",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugFrameworkLabel")}),l.jsx("strong",{children:t.primaryFramework??s("common.unknown")})]}),l.jsxs("article",{className:"debug-readiness-summary-card",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugConfidenceLabel")}),l.jsx("strong",{children:y(t.confidence)}),l.jsx("small",{children:r.lastAnalyzedAt??s("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),l.jsxs("article",{className:"debug-readiness-summary-card",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugSummaryServiceCountLabel")}),l.jsx("strong",{children:o})]}),l.jsxs("article",{className:"debug-readiness-summary-card",children:[l.jsx("span",{children:s("shell.workspaceDetailDebugCompatibilityLabel")}),l.jsx("strong",{children:D(t.compatibilityLevel)})]}),l.jsxs("article",{className:"debug-readiness-summary-card",children:[l.jsx("span",{children:s("shell.manageWorkspacePathLabel")}),l.jsx("strong",{title:e.path,children:e.path})]})]}):null]})}function D(e){switch(e){case"supported":return s("shell.workspaceDetailDebugCompatibilitySupported");case"conditional":return s("shell.workspaceDetailDebugCompatibilityConditional");case"unsupported":return s("shell.workspaceDetailDebugCompatibilityUnsupported");default:return s("shell.workspaceDetailDebugCompatibilityUnknown")}}function y(e){switch(e){case"high":return s("shell.workspaceDetailDebugConfidenceHigh");case"medium":return s("shell.workspaceDetailDebugConfidenceMedium");case"low":return s("shell.workspaceDetailDebugConfidenceLow");default:return s("common.unknown")}}function F(e,r,t){const o=new Map(r.map(i=>[i.templateId,i])),c=new Map(((t==null?void 0:t.services)??[]).map(i=>[i.serviceId,i])),a=new Map;for(const i of e)i.port!==null&&a.set(i.port,(a.get(i.port)??0)+1);const n=e.map(i=>{const g=o.get(i.id)??null,m=c.get(i.id)??null;if(m){const w=m.autoStartAllowed?m.leasedPort!==null&&m.leasedPort!==i.port?"orchestrated":"runnable":"blocked";return{template:i,runtimeStatus:g,planItem:m,decision:w,assignedPort:m.leasedPort,reason:A(i,m)}}return i.port===null?{template:i,runtimeStatus:g,planItem:null,decision:"blocked",assignedPort:null,reason:s("shell.workspaceDetailRegisteredDebugPlanReasonPortMissing")}:(a.get(i.port)??0)>1||g!=null&&g.occupied?{template:i,runtimeStatus:g,planItem:null,decision:"orchestrated",assignedPort:i.port,reason:(a.get(i.port)??0)>1?s("shell.workspaceDetailRegisteredDebugPlanReasonDuplicatePortWillOrchestrate"):s("shell.workspaceDetailRegisteredDebugPlanReasonPortOccupiedWillOrchestrate")}:{template:i,runtimeStatus:g,planItem:null,decision:"runnable",assignedPort:i.port,reason:s("shell.workspaceDetailRegisteredDebugPlanReasonRunnable")}}),h=n.filter(i=>i.decision==="runnable").length,b=n.filter(i=>i.decision==="orchestrated").length,d=n.filter(i=>i.decision==="blocked").length;return{generatedAt:(t==null?void 0:t.runtimeSession.createdAt)??new Date().toISOString(),autoStartAllowed:(t==null?void 0:t.autoStartAllowed)??(n.length>0&&d===0),runnableCount:h,orchestratedCount:b,blockedCount:d,items:n}}function R(e){return e.autoStartAllowed&&e.blockedCount===0}function E(e,r){return r===0?"danger":R(e)?"success":"warn"}function z(e,r){return r===0?s("shell.workspaceDetailRegisteredDebugOverallStatusEmpty"):R(e)?s("shell.workspaceDetailRegisteredDebugOverallStatusReady"):s("shell.workspaceDetailRegisteredDebugOverallStatusPartial")}function W(e,r){return r===0?s("shell.workspaceDetailRegisteredDebugTemplatesEmpty"):s("shell.workspaceDetailRegisteredDebugOverallSummary",{runnable:e.runnableCount,orchestrated:e.orchestratedCount,blocked:e.blockedCount})}function $(e){const r=e.args.join(" ").trim();return r?`${e.command} ${r}`:e.command}function B(e,r){const t=r.replace(/[\\/]+$/,"");return e===t?".":e.startsWith(`${t}/`)||e.startsWith(`${t}\\`)?e.slice(t.length+1):e}function V(e){return e===null?s("shell.workspaceDetailRegisteredDebugTemplatePortMissing"):String(e)}function U(e){if(!e)return s("shell.workspaceDetailDebugPortEmpty");const r=new Date(e);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(r)}function q(e,r){if(e.port!==null)return r!=null&&r.occupied?"warn":"success"}function H(e,r){return e.port===null?s("shell.workspaceDetailRegisteredDebugTemplateStatusUntracked"):r!=null&&r.occupied?s("shell.workspaceDetailRegisteredDebugTemplateStatusOccupied"):s("shell.workspaceDetailRegisteredDebugTemplateStatusIdle")}function _(e){return e!=null&&e.occupied?e.processId&&e.processName?`PID ${e.processId} · ${e.processName}`:e.processId?`PID ${e.processId}`:e.processName??s("shell.workspaceDetailRegisteredDebugRuntimeUnknown"):s("shell.workspaceDetailRegisteredDebugRuntimeIdle")}function G(e,r){return e.port===null?s("shell.workspaceDetailRegisteredDebugPlanReasonPortMissing"):r!=null&&r.occupied?s("shell.workspaceDetailRegisteredDebugPlanReasonPortOccupiedWillOrchestrate"):s("shell.workspaceDetailRegisteredDebugPlanReasonRunnable")}function J(e){switch(e){case"runnable":return s("shell.workspaceDetailRegisteredDebugPlanActionStart");case"orchestrated":return s("shell.workspaceDetailRegisteredDebugPlanActionOrchestrated");default:return s("shell.workspaceDetailRegisteredDebugPlanActionBlocked")}}function A(e,r){var t;return r.missingRequirements.length>0?r.missingRequirements.map(o=>C(o)).join(";"):(t=r.aiFallback)!=null&&t.eligible?r.aiFallback.reason:r.leasedPort!==null&&r.leasedPort!==e.port?s("shell.workspaceDetailRegisteredDebugPlanReasonPortOrchestrated",{port:r.leasedPort}):Object.keys(r.envPatch).length>0?s("shell.workspaceDetailRegisteredDebugPlanReasonServiceDiscoveryInjected"):s("shell.workspaceDetailRegisteredDebugPlanReasonRunnable")}function C(e){switch(e){case"analysis":return s("shell.workspaceDetailRegisteredDebugPlanReasonAnalysisMissing");case"service_discovery":return s("shell.workspaceDetailRegisteredDebugPlanReasonServiceDiscoveryMissing");case"callback":return s("shell.workspaceDetailRegisteredDebugPlanReasonCallbackMissing");case"port":return s("shell.workspaceDetailRegisteredDebugPlanReasonPortMissing");default:return e}}function K(e){const[r,t]=u.useState({loading:!1,error:null,targetId:null,targetSourceType:null,services:[],analyses:[],matrixItems:[]}),[o,c]=u.useState(0),a=u.useCallback(()=>{c(d=>d+1)},[]);u.useEffect(()=>{if(!(e!=null&&e.id)||!e.path){t({loading:!1,error:null,targetId:null,targetSourceType:null,services:[],analyses:[],matrixItems:[]});return}let d=!1;return t(i=>({...i,loading:!0,error:null})),(async()=>{try{const[i,g]=await Promise.all([x({workspaceId:e.id,rootPath:e.path}),k()]);if(d)return;t({loading:!1,error:null,targetId:i.target.id,targetSourceType:i.target.sourceType,services:i.services,analyses:i.analyses,matrixItems:g.items})}catch(i){if(d)return;t({loading:!1,error:i instanceof Error?i.message:s("shell.workspaceDetailDebugAnalyzeFailed"),targetId:null,targetSourceType:null,services:[],analyses:[],matrixItems:[]})}})(),()=>{d=!0}},[o,e==null?void 0:e.id,e==null?void 0:e.path]);const n=u.useMemo(()=>N(r.services,r.analyses),[r.analyses,r.services]),h=u.useMemo(()=>r.matrixItems.find(d=>d.framework===((n==null?void 0:n.primaryFramework)??"unknown"))??null,[n==null?void 0:n.primaryFramework,r.matrixItems]),b=u.useMemo(()=>{var d;return((d=r.analyses[0])==null?void 0:d.createdAt)??null},[r.analyses]);return{...r,primaryAnalysis:n,currentCompatibilityItem:h,lastAnalyzedAt:b,refresh:a}}function N(e,r){if(r.length===0)return null;const t=new Map(r.filter(c=>c.serviceId).map(c=>[c.serviceId,c]));return[...e].sort((c,a)=>I(c,a)).map(c=>t.get(c.id)??null).find(c=>c!==null)??r[0]??null}function I(e,r){const t=f(e.role)-f(r.role);return t!==0?t:e.name.localeCompare(r.name)}function f(e){switch(e){case"frontend":return 0;case"backend":return 1;case"worker":return 2;case"mock":return 3;default:return 4}}function Q(e){const[r,t]=u.useState({loading:!1,error:null,templates:[],runtimeStatuses:[],lastRefreshedAt:null}),o=u.useCallback(async()=>{if(!(e!=null&&e.id)){t({loading:!1,error:null,templates:[],runtimeStatuses:[],lastRefreshedAt:null});return}t(a=>({...a,loading:!0,error:null}));try{const[a,n]=await Promise.all([j(e.id),p(e.id)]);t({loading:!1,error:null,templates:T(a.items),runtimeStatuses:n.items,lastRefreshedAt:new Date().toISOString()})}catch(a){throw t(n=>({...n,loading:!1,error:a instanceof Error?a.message:s("shell.workspaceDetailRegisteredDebugLoadFailed")})),a}},[e==null?void 0:e.id]),c=u.useCallback(async()=>{if(e!=null&&e.id){t(a=>({...a,loading:!0,error:null}));try{const a=await p(e.id);t(n=>({...n,loading:!1,error:null,runtimeStatuses:a.items,lastRefreshedAt:new Date().toISOString()}))}catch(a){throw t(n=>({...n,loading:!1,error:a instanceof Error?a.message:s("shell.workspaceDetailRegisteredDebugActionRefreshFailed")})),a}}},[e==null?void 0:e.id]);return u.useEffect(()=>{o().catch(()=>{})},[o]),{...r,refreshAll:o,refreshRuntime:c}}function T(e){return[...e].sort((r,t)=>{const o=r.cwd.localeCompare(t.cwd);return o!==0?o:r.name.localeCompare(t.name)})}export{O as D,U as a,F as b,H as c,B as d,V as e,z as f,_ as g,$ as h,G as i,Q as j,W as k,J as l,q as m,E as r,K as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{S as r,R as k,i,l as L,o as A,e as T,b as I,T as u}from"./event-DvH9tcej.js";class z{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.width=e[0].Logical.width,this.height=e[0].Logical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toPhysical(e){return new h(this.width*e,this.height*e)}[r](){return{width:this.width,height:this.height}}toJSON(){return this[r]()}}class h{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.width=e[0].Physical.width,this.height=e[0].Physical.height):(this.width=e[0].width,this.height=e[0].height):(this.width=e[0],this.height=e[1])}toLogical(e){return new z(this.width/e,this.height/e)}[r](){return{width:this.width,height:this.height}}toJSON(){return this[r]()}}class c{constructor(e){this.size=e}toLogical(e){return this.size instanceof z?this.size:this.size.toLogical(e)}toPhysical(e){return this.size instanceof h?this.size:this.size.toPhysical(e)}[r](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[r]()}}class x{constructor(...e){this.type="Logical",e.length===1?"Logical"in e[0]?(this.x=e[0].Logical.x,this.y=e[0].Logical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toPhysical(e){return new a(this.x*e,this.y*e)}[r](){return{x:this.x,y:this.y}}toJSON(){return this[r]()}}class a{constructor(...e){this.type="Physical",e.length===1?"Physical"in e[0]?(this.x=e[0].Physical.x,this.y=e[0].Physical.y):(this.x=e[0].x,this.y=e[0].y):(this.x=e[0],this.y=e[1])}toLogical(e){return new x(this.x/e,this.y/e)}[r](){return{x:this.x,y:this.y}}toJSON(){return this[r]()}}class d{constructor(e){this.position=e}toLogical(e){return this.position instanceof x?this.position:this.position.toLogical(e)}toPhysical(e){return this.position instanceof a?this.position:this.position.toPhysical(e)}[r](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[r]()}}class w extends k{constructor(e){super(e)}static async new(e,n,l){return i("plugin:image|new",{rgba:y(e),width:n,height:l}).then(o=>new w(o))}static async fromBytes(e){return i("plugin:image|from_bytes",{bytes:y(e)}).then(n=>new w(n))}static async fromPath(e){return i("plugin:image|from_path",{path:e}).then(n=>new w(n))}async rgba(){return i("plugin:image|rgba",{rid:this.rid}).then(e=>new Uint8Array(e))}async size(){return i("plugin:image|size",{rid:this.rid})}}function y(t){return t==null?null:typeof t=="string"?t:t instanceof w?t.rid:t}var p;(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(p||(p={}));class O{constructor(e){this._preventDefault=!1,this.event=e.event,this.id=e.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var m;(function(t){t.None="none",t.Normal="normal",t.Indeterminate="indeterminate",t.Paused="paused",t.Error="error"})(m||(m={}));function W(){return new D(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function b(){return i("plugin:window|get_all_windows").then(t=>t.map(e=>new D(e,{skip:!0})))}const _=["tauri://created","tauri://error"];class D{constructor(e,n={}){var l;this.label=e,this.listeners=Object.create(null),n!=null&&n.skip||i("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(l=n.parent)===null||l===void 0?void 0:l.label,label:e}}).then(async()=>this.emit("tauri://created")).catch(async o=>this.emit("tauri://error",o))}static async getByLabel(e){var n;return(n=(await b()).find(l=>l.label===e))!==null&&n!==void 0?n:null}static getCurrent(){return W()}static async getAll(){return b()}static async getFocusedWindow(){for(const e of await b())if(await e.isFocused())return e;return null}async listen(e,n){return this._handleTauriEvent(e,n)?()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}:L(e,n,{target:{kind:"Window",label:this.label}})}async once(e,n){return this._handleTauriEvent(e,n)?()=>{const l=this.listeners[e];l.splice(l.indexOf(n),1)}:A(e,n,{target:{kind:"Window",label:this.label}})}async emit(e,n){if(_.includes(e)){for(const l of this.listeners[e]||[])l({event:e,id:-1,payload:n});return}return T(e,n)}async emitTo(e,n,l){if(_.includes(n)){for(const o of this.listeners[n]||[])o({event:n,id:-1,payload:l});return}return I(e,n,l)}_handleTauriEvent(e,n){return _.includes(e)?(e in this.listeners?this.listeners[e].push(n):this.listeners[e]=[n],!0):!1}async scaleFactor(){return i("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return i("plugin:window|inner_position",{label:this.label}).then(e=>new a(e))}async outerPosition(){return i("plugin:window|outer_position",{label:this.label}).then(e=>new a(e))}async innerSize(){return i("plugin:window|inner_size",{label:this.label}).then(e=>new h(e))}async outerSize(){return i("plugin:window|outer_size",{label:this.label}).then(e=>new h(e))}async isFullscreen(){return i("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return i("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return i("plugin:window|is_maximized",{label:this.label})}async isFocused(){return i("plugin:window|is_focused",{label:this.label})}async isDecorated(){return i("plugin:window|is_decorated",{label:this.label})}async isResizable(){return i("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return i("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return i("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return i("plugin:window|is_closable",{label:this.label})}async isVisible(){return i("plugin:window|is_visible",{label:this.label})}async title(){return i("plugin:window|title",{label:this.label})}async theme(){return i("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return i("plugin:window|is_always_on_top",{label:this.label})}async center(){return i("plugin:window|center",{label:this.label})}async requestUserAttention(e){let n=null;return e&&(e===p.Critical?n={type:"Critical"}:n={type:"Informational"}),i("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(e){return i("plugin:window|set_resizable",{label:this.label,value:e})}async setEnabled(e){return i("plugin:window|set_enabled",{label:this.label,value:e})}async isEnabled(){return i("plugin:window|is_enabled",{label:this.label})}async setMaximizable(e){return i("plugin:window|set_maximizable",{label:this.label,value:e})}async setMinimizable(e){return i("plugin:window|set_minimizable",{label:this.label,value:e})}async setClosable(e){return i("plugin:window|set_closable",{label:this.label,value:e})}async setTitle(e){return i("plugin:window|set_title",{label:this.label,value:e})}async maximize(){return i("plugin:window|maximize",{label:this.label})}async unmaximize(){return i("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return i("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return i("plugin:window|minimize",{label:this.label})}async unminimize(){return i("plugin:window|unminimize",{label:this.label})}async show(){return i("plugin:window|show",{label:this.label})}async hide(){return i("plugin:window|hide",{label:this.label})}async close(){return i("plugin:window|close",{label:this.label})}async destroy(){return i("plugin:window|destroy",{label:this.label})}async setDecorations(e){return i("plugin:window|set_decorations",{label:this.label,value:e})}async setShadow(e){return i("plugin:window|set_shadow",{label:this.label,value:e})}async setEffects(e){return i("plugin:window|set_effects",{label:this.label,value:e})}async clearEffects(){return i("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(e){return i("plugin:window|set_always_on_top",{label:this.label,value:e})}async setAlwaysOnBottom(e){return i("plugin:window|set_always_on_bottom",{label:this.label,value:e})}async setContentProtected(e){return i("plugin:window|set_content_protected",{label:this.label,value:e})}async setSize(e){return i("plugin:window|set_size",{label:this.label,value:e instanceof c?e:new c(e)})}async setMinSize(e){return i("plugin:window|set_min_size",{label:this.label,value:e instanceof c?e:e?new c(e):null})}async setMaxSize(e){return i("plugin:window|set_max_size",{label:this.label,value:e instanceof c?e:e?new c(e):null})}async setSizeConstraints(e){function n(l){return l?{Logical:l}:null}return i("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(e==null?void 0:e.minWidth),minHeight:n(e==null?void 0:e.minHeight),maxWidth:n(e==null?void 0:e.maxWidth),maxHeight:n(e==null?void 0:e.maxHeight)}})}async setPosition(e){return i("plugin:window|set_position",{label:this.label,value:e instanceof d?e:new d(e)})}async setFullscreen(e){return i("plugin:window|set_fullscreen",{label:this.label,value:e})}async setSimpleFullscreen(e){return i("plugin:window|set_simple_fullscreen",{label:this.label,value:e})}async setFocus(){return i("plugin:window|set_focus",{label:this.label})}async setFocusable(e){return i("plugin:window|set_focusable",{label:this.label,value:e})}async setIcon(e){return i("plugin:window|set_icon",{label:this.label,value:y(e)})}async setSkipTaskbar(e){return i("plugin:window|set_skip_taskbar",{label:this.label,value:e})}async setCursorGrab(e){return i("plugin:window|set_cursor_grab",{label:this.label,value:e})}async setCursorVisible(e){return i("plugin:window|set_cursor_visible",{label:this.label,value:e})}async setCursorIcon(e){return i("plugin:window|set_cursor_icon",{label:this.label,value:e})}async setBackgroundColor(e){return i("plugin:window|set_background_color",{color:e})}async setCursorPosition(e){return i("plugin:window|set_cursor_position",{label:this.label,value:e instanceof d?e:new d(e)})}async setIgnoreCursorEvents(e){return i("plugin:window|set_ignore_cursor_events",{label:this.label,value:e})}async startDragging(){return i("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(e){return i("plugin:window|start_resize_dragging",{label:this.label,value:e})}async setBadgeCount(e){return i("plugin:window|set_badge_count",{label:this.label,value:e})}async setBadgeLabel(e){return i("plugin:window|set_badge_label",{label:this.label,value:e})}async setOverlayIcon(e){return i("plugin:window|set_overlay_icon",{label:this.label,value:e?y(e):void 0})}async setProgressBar(e){return i("plugin:window|set_progress_bar",{label:this.label,value:e})}async setVisibleOnAllWorkspaces(e){return i("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:e})}async setTitleBarStyle(e){return i("plugin:window|set_title_bar_style",{label:this.label,value:e})}async setTheme(e){return i("plugin:window|set_theme",{label:this.label,value:e})}async onResized(e){return this.listen(u.WINDOW_RESIZED,n=>{n.payload=new h(n.payload),e(n)})}async onMoved(e){return this.listen(u.WINDOW_MOVED,n=>{n.payload=new a(n.payload),e(n)})}async onCloseRequested(e){return this.listen(u.WINDOW_CLOSE_REQUESTED,async n=>{const l=new O(n);await e(l),l.isPreventDefault()||await this.destroy()})}async onDragDropEvent(e){const n=await this.listen(u.DRAG_ENTER,s=>{e({...s,payload:{type:"enter",paths:s.payload.paths,position:new a(s.payload.position)}})}),l=await this.listen(u.DRAG_OVER,s=>{e({...s,payload:{type:"over",position:new a(s.payload.position)}})}),o=await this.listen(u.DRAG_DROP,s=>{e({...s,payload:{type:"drop",paths:s.payload.paths,position:new a(s.payload.position)}})}),C=await this.listen(u.DRAG_LEAVE,s=>{e({...s,payload:{type:"leave"}})});return()=>{n(),o(),l(),C()}}async onFocusChanged(e){const n=await this.listen(u.WINDOW_FOCUS,o=>{e({...o,payload:!0})}),l=await this.listen(u.WINDOW_BLUR,o=>{e({...o,payload:!1})});return()=>{n(),l()}}async onScaleChanged(e){return this.listen(u.WINDOW_SCALE_FACTOR_CHANGED,e)}async onThemeChanged(e){return this.listen(u.WINDOW_THEME_CHANGED,e)}}var S;(function(t){t.Disabled="disabled",t.Throttle="throttle",t.Suspend="suspend"})(S||(S={}));var P;(function(t){t.Default="default",t.FluentOverlay="fluentOverlay"})(P||(P={}));var v;(function(t){t.AppearanceBased="appearanceBased",t.Light="light",t.Dark="dark",t.MediumLight="mediumLight",t.UltraDark="ultraDark",t.Titlebar="titlebar",t.Selection="selection",t.Menu="menu",t.Popover="popover",t.Sidebar="sidebar",t.HeaderView="headerView",t.Sheet="sheet",t.WindowBackground="windowBackground",t.HudWindow="hudWindow",t.FullScreenUI="fullScreenUI",t.Tooltip="tooltip",t.ContentBackground="contentBackground",t.UnderWindowBackground="underWindowBackground",t.UnderPageBackground="underPageBackground",t.Mica="mica",t.Blur="blur",t.Acrylic="acrylic",t.Tabbed="tabbed",t.TabbedDark="tabbedDark",t.TabbedLight="tabbedLight"})(v||(v={}));var f;(function(t){t.FollowsWindowActiveState="followsWindowActiveState",t.Active="active",t.Inactive="inactive"})(f||(f={}));function g(t){return t===null?null:{name:t.name,scaleFactor:t.scaleFactor,position:new a(t.position),size:new h(t.size),workArea:{position:new a(t.workArea.position),size:new h(t.workArea.size)}}}async function R(){return i("plugin:window|current_monitor").then(g)}async function N(){return i("plugin:window|primary_monitor").then(g)}async function M(t,e){return i("plugin:window|monitor_from_point",{x:t,y:e}).then(g)}async function B(){return i("plugin:window|available_monitors").then(t=>t.map(g))}async function F(){return i("plugin:window|cursor_position").then(t=>new a(t))}const U=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:O,get Effect(){return v},get EffectState(){return f},LogicalPosition:x,LogicalSize:z,PhysicalPosition:a,PhysicalSize:h,get ProgressBarStatus(){return m},get UserAttentionType(){return p},Window:D,availableMonitors:B,currentMonitor:R,cursorPosition:F,getAllWindows:b,getCurrentWindow:W,monitorFromPoint:M,primaryMonitor:N},Symbol.toStringTag,{value:"Module"}));export{d as P,W as g,y as t,U as w};
|
package/dist/public/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
|
6
6
|
<title>CodingNS</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Byp9hJ0c.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-_52jxu4a.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|