@jingyi0605/codingns 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/public/assets/{AdaptiveButlerPage-B8mg25ze.js → AdaptiveButlerPage-Cd8nPdO0.js} +1 -1
  2. package/dist/public/assets/{App-C2lNmeKL.js → App-CyxK-Nos.js} +3 -3
  3. package/dist/public/assets/{BootstrapPage-CAVA-a8h.js → BootstrapPage-DEwPKWR8.js} +1 -1
  4. package/dist/public/assets/ConversationPage-CxWtRhfz.js +6 -0
  5. package/dist/public/assets/{DesktopDetachPreviewPage-B37DUL15.js → DesktopDetachPreviewPage-DDOWolgB.js} +1 -1
  6. package/dist/public/assets/{DesktopWindowPage-CDA6l7lm.js → DesktopWindowPage-CtS9D8FD.js} +1 -1
  7. package/dist/public/assets/{FileContextPanel-CMGTtAB6.js → FileContextPanel-CNOjhsi5.js} +1 -1
  8. package/dist/public/assets/GitSidebar-DpC4UhFy.js +6 -0
  9. package/dist/public/assets/{MobileCreateSessionSheet-THIrIzJ3.js → MobileCreateSessionSheet-DE4pTyXj.js} +1 -1
  10. package/dist/public/assets/{MobileTopHeaderFrame-D-X7pVnV.js → MobileTopHeaderFrame-D_ZbS0qi.js} +1 -1
  11. package/dist/public/assets/{MobileWorkspaceSwitcherHeader-Cczi7RYu.js → MobileWorkspaceSwitcherHeader-Dc12IAXc.js} +1 -1
  12. package/dist/public/assets/{RelayConnectEntryPage-D417tgWj.js → RelayConnectEntryPage-D8kyZfdm.js} +1 -1
  13. package/dist/public/assets/{ServerSettingsModal-BdTxbRbU.js → ServerSettingsModal-8eRu6VXr.js} +1 -1
  14. package/dist/public/assets/{SessionIndexPage-D5iefVcc.js → SessionIndexPage-DIi0JWKP.js} +1 -1
  15. package/dist/public/assets/{SettingsPage-iCFe_DHP.js → SettingsPage-OQq3kp32.js} +1 -1
  16. package/dist/public/assets/{TerminalManagerPanel-CtldwWz8.js → TerminalManagerPanel-BEMzisSy.js} +1 -1
  17. package/dist/public/assets/{TerminalPage-DAzQTmQC.js → TerminalPage-CXLQfwjU.js} +1 -1
  18. package/dist/public/assets/{TerminalRuntimeFallbackModal-DLOhAvaq.js → TerminalRuntimeFallbackModal-BY_VUAbq.js} +1 -1
  19. package/dist/public/assets/ToolFilesPage-CYx3DgHg.js +1 -0
  20. package/dist/public/assets/ToolGitPage-fgQcvF6v.js +1 -0
  21. package/dist/public/assets/ToolProcessesPage-BL6yDDPV.js +1 -0
  22. package/dist/public/assets/{ToolsHomePage-rU3V8mmh.js → ToolsHomePage-B1n2OeVw.js} +1 -1
  23. package/dist/public/assets/{WorkbenchLandingPage-BudM2C69.js → WorkbenchLandingPage-Cu9yAWYo.js} +1 -1
  24. package/dist/public/assets/WorkbenchLayout-D6hGXWGE.js +244 -0
  25. package/dist/public/assets/{WorkbenchModal-DMQutm1x.js → WorkbenchModal-Bpb_G1-U.js} +1 -1
  26. package/dist/public/assets/WorkbenchShellRoute-BCjcGWhl.js +1 -0
  27. package/dist/public/assets/{WorkspaceDebugDetailPage-CHqo-uDf.js → WorkspaceDebugDetailPage-CZwT99iQ.js} +1 -1
  28. package/dist/public/assets/{WorkspaceDetailPage-CGkAH1W-.js → WorkspaceDetailPage-DCM-olfU.js} +1 -1
  29. package/dist/public/assets/{WorkspaceHomePage-CfuPVITd.js → WorkspaceHomePage-CsIIqIma.js} +1 -1
  30. package/dist/public/assets/{client-runtime-manager-CKbtaemV.js → client-runtime-manager-CMK7kLp8.js} +1 -1
  31. package/dist/public/assets/file-tree-icon-Bv-apgA1.js +3 -0
  32. package/dist/public/assets/index-CkkzIvxs.css +1 -0
  33. package/dist/public/assets/index-O3gOb1E0.js +42 -0
  34. package/dist/public/assets/{login-direct-candidate-resolver-DjJMbqB7.js → login-direct-candidate-resolver-Bn4I5JHh.js} +1 -1
  35. package/dist/public/assets/{model-switch-api-T55eW6D4.js → model-switch-api-ZGnyVir7.js} +1 -1
  36. package/dist/public/assets/{preferences-service-BTKBl5xM.js → preferences-service-scuqVhuA.js} +1 -1
  37. package/dist/public/assets/realtime-client-TRootbbB.js +1 -0
  38. package/dist/public/assets/{relay-entry-sdeFnTbY.js → relay-entry-eyCjVFMA.js} +1 -1
  39. package/dist/public/assets/styles-DkbkRgWw.css +1 -0
  40. package/dist/public/assets/{terminal-runtime-meta-Cvt1ID92.js → terminal-runtime-meta-BGcnzxqn.js} +1 -1
  41. package/dist/public/assets/{useRegisteredDebugTemplates-O-ymgLd9.js → useRegisteredDebugTemplates-BdgPIDVM.js} +1 -1
  42. package/dist/public/index.html +2 -2
  43. package/dist/server/modules/git/git-controller.d.ts +3 -1
  44. package/dist/server/modules/git/git-controller.js +9 -2
  45. package/dist/server/modules/git/git-controller.js.map +1 -1
  46. package/dist/server/modules/git/git-read-service.js +2 -1
  47. package/dist/server/modules/git/git-read-service.js.map +1 -1
  48. package/dist/server/modules/git/git-remote-credential-service.d.ts +1 -0
  49. package/dist/server/modules/git/git-remote-credential-service.js +4 -0
  50. package/dist/server/modules/git/git-remote-credential-service.js.map +1 -1
  51. package/dist/server/modules/git/types.d.ts +1 -0
  52. package/dist/server/modules/provider/codex-model-options.js +14 -15
  53. package/dist/server/modules/provider/codex-model-options.js.map +1 -1
  54. package/dist/server/modules/provider/provider-discovery-helper-process.js +2 -1
  55. package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
  56. package/dist/server/server/create-server.js +1 -1
  57. package/dist/server/server/create-server.js.map +1 -1
  58. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +6 -0
  59. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +398 -0
  60. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -1
  61. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +47 -4
  62. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  63. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +32 -4
  64. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  65. package/package.json +5 -1
  66. package/dist/public/assets/ConversationPage-B6BGOX4C.js +0 -6
  67. package/dist/public/assets/GitSidebar--DCqBiGL.js +0 -6
  68. package/dist/public/assets/ToolFilesPage-D7thcDEv.js +0 -1
  69. package/dist/public/assets/ToolGitPage-uPRsxdcn.js +0 -1
  70. package/dist/public/assets/ToolProcessesPage-B1uOk0Ef.js +0 -1
  71. package/dist/public/assets/WorkbenchLayout-Dybarc1V.js +0 -244
  72. package/dist/public/assets/WorkbenchShellRoute-Cy4WBbzq.js +0 -1
  73. package/dist/public/assets/file-tree-icon-Bc0KADEl.js +0 -3
  74. package/dist/public/assets/index-DNRyROOG.css +0 -1
  75. package/dist/public/assets/index-oGylLBIX.js +0 -42
  76. package/dist/public/assets/realtime-client-ww7MnbTD.js +0 -1
  77. package/dist/public/assets/styles-BjPytabP.css +0 -1
  78. package/dist/server/modules/channels/wechat-claw-client.d.ts +0 -51
  79. package/dist/server/modules/channels/wechat-claw-client.js +0 -245
  80. package/dist/server/modules/channels/wechat-claw-client.js.map +0 -1
  81. /package/dist/public/assets/{styles-lhQGDlPF.js → styles-JKFlsYFv.js} +0 -0
@@ -1 +0,0 @@
1
- var wn=Object.defineProperty;var kn=(t,r,l)=>r in t?wn(t,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[r]=l;var A=(t,r,l)=>kn(t,typeof r!="symbol"?r+"":r,l);import{t as n,b as o,j as e,u as Cn,E as Us,a as jt,m as wt,H as Mn,J as Sn,F as Pn}from"./index-oGylLBIX.js";import{e as Nn,f as Rn,g as At}from"./App-C2lNmeKL.js";import{e as En,W as Ln,q as kt,s as Ct,X as qn,Y as In,n as Tn,p as Bs,a as Ot,P as An,Z as On,_ as Fn,$ as Un,a0 as Bn,t as _n,M as $n,i as zn,j as Mt,a1 as Dn}from"./model-switch-api-T55eW6D4.js";import{W as ps}from"./WorkbenchModal-DMQutm1x.js";import{b9 as Kn,ba as Wn,bb as Hn,Q as Ie,S as ae,U as St,V as le,X as ms,T as Pt,R as fs,bc as hs,Y as Nt,aJ as Qn,ac as Te}from"./WorkbenchLayout-Dybarc1V.js";function _s(t,r){if(!t)return{allowed:!1,hidden:!1,reason:n("conversation.capabilityDenied")};switch(r){case"send_message":return t.canSendMessage===!1?{allowed:!1,hidden:!1,reason:n("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return t.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:n("conversation.capabilityAttachmentDisabled")};case"interrupt":return t.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:n("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:n("conversation.capabilityDenied")}}}const Rt={in_progress:0,failed:1,pending:2,completed:3,cancelled:4};function Vn({provider:t,messages:r,variant:l="header"}){const[u,p]=o.useState(!1),f=o.useMemo(()=>Kn(r,t),[r,t]);if(!f||f.items.length===0)return null;const d=Wn(f.items),i=d.in_progress||d.pending,k=i>0?i:f.items.length,v=[...f.items].sort((C,K)=>{const P=Rt[C.status]-Rt[K.status];return P!==0?P:C.updatedAt.localeCompare(K.updatedAt)}),h=l==="composer"?"conversation-task-progress-button composer-task-progress-button":"conversation-header-ai-button conversation-task-progress-button";return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:h,"data-variant":l,"aria-label":n("conversation.taskProgressButton",{count:f.items.length}),title:n("conversation.taskProgressButton",{count:f.items.length}),onClick:()=>{p(!0)},children:[e.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:e.jsx(Hn,{})}),e.jsx("span",{className:"conversation-task-progress-badge",children:k})]}),e.jsx(ps,{open:u,title:n("conversation.taskProgressModalTitle"),description:n("conversation.taskProgressModalDescription",{count:f.items.length}),className:"conversation-task-progress-modal",onClose:()=>{p(!1)},children:e.jsxs("div",{className:"conversation-task-progress-modal-body",children:[e.jsxs("div",{className:"conversation-task-progress-summary",children:[e.jsx(Ae,{label:n("conversation.taskProgressSummaryTotal"),value:f.items.length}),e.jsx(Ae,{label:n("conversation.taskProgressStatusInProgress"),value:d.in_progress}),e.jsx(Ae,{label:n("conversation.taskProgressStatusPending"),value:d.pending}),e.jsx(Ae,{label:n("conversation.taskProgressStatusCompleted"),value:d.completed}),d.failed>0?e.jsx(Ae,{label:n("conversation.taskProgressStatusFailed"),value:d.failed}):null]}),f.explanation?e.jsxs("div",{className:"conversation-task-progress-explanation",children:[e.jsx("strong",{children:n("conversation.taskProgressExplanationTitle")}),e.jsx("p",{children:f.explanation})]}):null,e.jsx("ol",{className:"conversation-task-progress-list",children:v.map(C=>e.jsxs("li",{className:"conversation-task-progress-item","data-status":C.status,children:[e.jsx("span",{className:"conversation-task-progress-item-indicator","data-status":C.status,"aria-hidden":"true"}),e.jsxs("div",{className:"conversation-task-progress-item-body",children:[e.jsxs("div",{className:"conversation-task-progress-item-header",children:[e.jsx("strong",{children:C.title}),e.jsx("span",{className:"conversation-task-progress-item-status",children:Jn(C.status)})]}),C.detail?e.jsx("p",{className:"conversation-task-progress-item-detail",children:C.detail}):null]})]},C.id))})]})})]})}function Ae({label:t,value:r}){return e.jsxs("div",{className:"conversation-task-progress-summary-card",children:[e.jsx("span",{children:t}),e.jsx("strong",{children:r})]})}function Jn(t){switch(t){case"in_progress":return n("conversation.taskProgressStatusInProgress");case"completed":return n("conversation.taskProgressStatusCompleted");case"failed":return n("conversation.taskProgressStatusFailed");case"cancelled":return n("conversation.taskProgressStatusCancelled");case"pending":default:return n("conversation.taskProgressStatusPending")}}const Gn="codingns.conversation.composer-draft:",Yn=1,Zn=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function Ks(){return typeof window<"u"&&typeof window.localStorage<"u"}function Xn(t){if(!t||typeof t!="object")return null;const r="id"in t?t.id:null,l="fileName"in t?t.fileName:null,u="mimeType"in t?t.mimeType:null,p="fileSize"in t?t.fileSize:null,f="lastModified"in t?t.lastModified:null,d="contentBase64"in t?t.contentBase64:null;if(typeof r!="string"||typeof l!="string"||typeof u!="string"||typeof p!="number"||typeof f!="number"||typeof d!="string")return null;const i=r.trim(),k=l.trim(),v=u.trim(),h=d.trim();return!i||!k||!v||p<0||f<0||!h?null:{id:i,fileName:k,mimeType:v,fileSize:p,lastModified:f,contentBase64:h}}function eo(t){if(!t||typeof t!="object")return null;const r="content"in t?t.content:null,l="attachments"in t?t.attachments:null;if(typeof r!="string"||!Array.isArray(l))return null;const u=l.map(p=>Xn(p)).filter(p=>p!==null);return u.length!==l.length||r.length===0&&u.length===0?null:{content:r,attachments:u}}function Oe(t){return`${Gn}${t}`}function so(t){var r,l;return{id:((l=(r=globalThis.crypto)==null?void 0:r.randomUUID)==null?void 0:l.call(r))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:t.trim()}}function to(t){if(!Ks())return null;const r=t.trim();if(!r)return null;const l=window.localStorage.getItem(Oe(r));if(!l)return null;try{const u=JSON.parse(l),p=u&&typeof u=="object"&&"draft"in u&&u.draft&&typeof u.draft=="object"?u.draft:u,f=eo(p);return f||(window.localStorage.removeItem(Oe(r)),null)}catch{return window.localStorage.removeItem(Oe(r)),null}}function no(t,r){if(!Ks())return!1;const l=t.trim();if(!l)return!1;if(r.content.length===0&&r.attachments.length===0)return Ft(l),!0;try{return window.localStorage.setItem(Oe(l),JSON.stringify({schemaVersion:Yn,draft:r})),!0}catch{return!1}}function Ft(t){if(!Ks())return;const r=t.trim();r&&window.localStorage.removeItem(Oe(r))}const Et="workbench:focus-composer",oo=["codex","claude-code","opencode","gemini","kimi"],ro=new Set(["codex","claude-code","opencode"]),io=new Set(["codex","claude-code","opencode"]),Lt={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0},ge=new Map;function ao(t){return[{id:fs,name:n("conversation.modelUseCliDefault"),provider:t,usesProviderDefault:!0}]}function qt(t){return ao(t)}function lo(){var t,r;return((r=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:r.call(t))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function It(t){if(t){t.value="";try{const r=t.showPicker;if(typeof r=="function"){r.call(t);return}}catch{}t.click()}}function co(t,r,l,u){const p=globalThis.atob(l),f=Uint8Array.from(p,d=>d.charCodeAt(0));return new File([f],t,{type:r,lastModified:u})}function uo(t){return t.trim().toLowerCase().startsWith("image/")}function Fe(t){const r=t.type.trim().toLowerCase();return r.length>0?r:"application/octet-stream"}function Ut(t){return uo(Fe(t))?"image":"file"}function Bt(t,r=lo()){const l=Ut(t);return{id:r,file:t,kind:l,previewUrl:l==="image"?URL.createObjectURL(t):null}}function mo(t){const r=co(t.fileName,t.mimeType,t.contentBase64,t.lastModified);return Bt(r,t.id)}function ho(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function po(t){const r=t.trim().replace(/\s+/g," ");return r.length===0?n("conversation.forkDraftEmpty"):r.length>140?`${r.slice(0,140)}…`:r}function fo(t,r){return r===t?io.has(r)?null:n("conversation.forkProviderNativeUnsupported"):ro.has(r)?null:n("conversation.forkProviderReconstructedUnsupported")}function _t(t){return(t==null?void 0:t.canStartSession)===!1}function vo(t){return _t(t)?(t==null?void 0:t.limitations[0])??n("conversation.capabilityDenied"):null}function go(t,r){return{id:r,kind:Ut(t),fileName:t.name,mimeType:Fe(t),fileSize:t.size}}function Tt(t){return new Promise((r,l)=>{const u=new FileReader;u.onerror=()=>{l(u.error??new Error("FILE_READ_FAILED"))},u.onload=()=>{const p=typeof u.result=="string"?u.result:"",f=p.includes(",")?p.split(",").at(-1)??"":p;r(f)},u.readAsDataURL(t)})}function bo(t){t.forEach(r=>{r.previewUrl&&URL.revokeObjectURL(r.previewUrl)})}function xo(t,r){const l=new Set(t.map(p=>`${p.file.name}:${p.file.size}:${p.file.lastModified}`)),u=[...t];return r.forEach(p=>{const f=`${p.name}:${p.size}:${p.lastModified}`;l.has(f)||(l.add(f),u.push(Bt(p)))}),u}function yo(t,r,l){const u=t.nativeEvent;return u.isComposing||u.keyCode===229||r||l}function _o({capabilities:t,placeholder:r,draftStorageId:l,initialModel:u=null,workspaceId:p=null,initialProviderConfigMode:f="global-default",initialProviderPresetId:d=null,forkDraft:i=null,onClearForkDraft:k,onForkDraftChange:v,panelRef:h,portalContainer:C=null,hasActiveRun:K=null,canInterrupt:P=null,contextUsage:b=null,taskProvider:y=null,taskMessages:O=[],hasPendingQueuedMessages:U=!1,isSubmitting:M,isRunning:Y=!1,onInterrupt:Z,onQueueSend:be,onSend:Ue}){const q=Nn(),xe=o.useId(),$t=o.useId(),[H,ce]=o.useState(""),[B,ye]=o.useState(""),[de,Be]=o.useState("medium"),[Q,je]=o.useState([]),[zt,ue]=o.useState(!1),[_e,$e]=o.useState(!1),[N,ze]=o.useState(Zn),[Dt,De]=o.useState(!1),[Kt,me]=o.useState(!1),[Ke,Ws]=o.useState(""),[we,Hs]=o.useState(!1),[Wt,_]=o.useState(!1),[Qs,Vs]=o.useState(!1),[vs,Js]=o.useState(!1),[X,We]=o.useState(null),[Ht,gs]=o.useState(!1),[bs,xs]=o.useState(null),[Gs,ys]=o.useState(!1),Ys=o.useMemo(()=>Ie(f,d),[f,d]),[I,ke]=o.useState(Ys.providerConfigMode),[$,He]=o.useState(Ys.providerPresetId),ee=o.useMemo(()=>Ie(I,$),[I,$]),[js,Ce]=o.useState(null),[ws,Qe]=o.useState(!1),[se,Me]=o.useState(null),[Qt,Ve]=o.useState(!1),[Je,z]=o.useState("global-default"),[Se,W]=o.useState(null),[Ge,ks]=o.useState({}),[Ye,Ze]=o.useState(null),Pe=o.useRef(null),Cs=o.useRef(null),Zs=o.useRef(null),Ms=o.useRef(!1),Ss=o.useRef(!1),Xe=o.useRef(!1),Ne=o.useRef(null),V=o.useRef(new Set),te=o.useRef(new Map),Ps=o.useRef(0),es=o.useRef(null),{showToast:Re}=Rn(),ss=En(),Ns=o.useCallback(()=>{Ne.current!==null&&(globalThis.clearTimeout(Ne.current),Ne.current=null),Xe.current=!1},[]);o.useEffect(()=>Ns,[Ns]);const x=(t==null?void 0:t.provider)??y??Ln(t),he=ae(x),pe=Cn(s=>Us(x)?s.profile.providers[x]:null),Ee=(pe==null?void 0:pe.defaultModel)??null,Le=(pe==null?void 0:pe.defaultReasoningLevel)??null;o.useEffect(()=>{const s=Ie(f,d);ke(s.providerConfigMode),He(s.providerPresetId)},[l,f,d,x]),o.useEffect(()=>{if(!i){z("global-default"),W(null);return}if(ae(i.targetProvider)){const s=Ie(i.targetProviderConfigMode,i.targetProviderPresetId);z(s.providerConfigMode),W(s.providerPresetId);return}z("global-default"),W(null)},[i]),o.useEffect(()=>{if(!he){We(null),gs(!1);return}const s=ge.get(he)??null;s&&We(s);let a=!1;return gs(!s),kt().then(c=>{c.items.forEach(m=>{ge.set(m.app,m)}),a||We(ge.get(he)??null)}).catch(()=>{!a&&!s&&We(null)}).finally(()=>{a||gs(!1)}),()=>{a=!0}},[he]),o.useEffect(()=>{const s=i?ae(i.targetProvider):null;if(!s){Me(null),Ve(!1);return}const a=ge.get(s)??null;a&&Me(a);let c=!1;return Ve(!a),kt().then(m=>{m.items.forEach(g=>{ge.set(g.app,g)}),c||Me(ge.get(s)??null)}).catch(()=>{!c&&!a&&Me(null)}).finally(()=>{c||Ve(!1)}),()=>{c=!0}},[i]),o.useEffect(()=>{if(I==="cc-switch-preset"){if(!$){ke("global-default");return}X&&!X.options.some(s=>s.id===$)&&(ke("global-default"),He(null))}},[X,I,$]),o.useEffect(()=>{if(I!=="cc-switch-preset"||!$||!(p!=null&&p.trim())){xs(null),ys(!1);return}let s=!1;return ys(!0),Ct(x,p,{providerConfigMode:"cc-switch-preset",providerPresetId:$}).then(a=>{s||xs(a)}).catch(()=>{s||xs(null)}).finally(()=>{s||ys(!1)}),()=>{s=!0}},[x,I,$,p]),o.useEffect(()=>{if(!(!i||Je!=="cc-switch-preset")){if(!Se){z("global-default");return}se&&!se.options.some(s=>s.id===Se)&&(z("global-default"),W(null))}},[se,i,Je,Se]);const Rs=o.useMemo(()=>_s(t,"send_message"),[t]),Xs=o.useMemo(()=>_s(t,"interrupt"),[t]),R=o.useMemo(()=>_s(t,"attachments"),[t]),fe=o.useMemo(()=>I!=="cc-switch-preset"?t:bs??t,[t,bs,I]),F=o.useMemo(()=>{var a;const s=(a=fe==null?void 0:fe.modelOptions)==null?void 0:a.map(c=>{var m;return{...c,provider:x,supportedReasoningEfforts:(m=c.supportedReasoningEfforts)==null?void 0:m.filter(g=>g==="low"||g==="medium"||g==="high"||g==="xhigh")}});return s!=null&&s.length?s:qt(x)},[fe==null?void 0:fe.modelOptions,x]),ts=o.useMemo(()=>St(X),[X]),Es=I==="cc-switch-preset"?$??le:le,ne=o.useMemo(()=>ts.find(s=>s.value===Es)??ts[0]??null,[ts,Es]),E=o.useMemo(()=>F.find(s=>s.id===B)??null,[F,B]),ns=qn(t),Vt=In(t),Ls=o.useMemo(()=>[{value:"low",label:n("conversation.reasoningLow")},{value:"medium",label:n("conversation.reasoningMedium")},{value:"high",label:n("conversation.reasoningHigh")},{value:"xhigh",label:n("conversation.reasoningMaximum")}],[]),D=o.useMemo(()=>{if(!ns)return[];const s=E==null?void 0:E.supportedReasoningEfforts;return!s||s.length===0?Ls:Ls.filter(a=>s.includes(a.value))},[ns,Ls,E==null?void 0:E.supportedReasoningEfforts]),et=o.useMemo(()=>F.map(s=>({value:s.id,label:ms(s)?n("conversation.modelUseCliDefault"):s.name})),[F]),qs=o.useMemo(()=>Pt(X),[X]),Jt=o.useMemo(()=>{const s=E?ms(E)?n("conversation.modelUseCliDefault"):E.name:n("conversation.modelUseCliDefault");return qs?`${(ne==null?void 0:ne.label)??n("conversation.deploymentDefaultPreset")} · ${s}`:s},[E,ne,qs]),Gt=o.useMemo(()=>D.map(s=>({value:s.value,label:s.label})),[D]),Yt=o.useMemo(()=>[{command:"/plan",label:n("conversation.slashCommandPlan")},{command:"/review",label:n("conversation.slashCommandReview")},{command:"/explain",label:n("conversation.slashCommandExplain")}],[]),st=(t==null?void 0:t.inRunInputMode)??"none",T=!!i,{visibleProviders:os}=Tn(oo,T),tt=(i==null?void 0:i.targetProvider)??null,Zt=ae(tt),L=o.useMemo(()=>Ie(Je,Se),[Je,Se]),rs=!!i&&(t==null?void 0:t.provider)===tt&&ee.providerConfigMode===L.providerConfigMode&&ee.providerPresetId===L.providerPresetId,J=o.useMemo(()=>i?rs?t:js??Bs(i.targetProvider):null,[t,js,i,rs]),G=o.useMemo(()=>{var a;if(!i)return[];const s=(a=J==null?void 0:J.modelOptions)==null?void 0:a.map(c=>{var m;return{...c,provider:i.targetProvider,supportedReasoningEfforts:(m=c.supportedReasoningEfforts)==null?void 0:m.filter(g=>g==="low"||g==="medium"||g==="high"||g==="xhigh")}});return s!=null&&s.length?s:qt(i.targetProvider)},[J==null?void 0:J.modelOptions,i]),nt=o.useMemo(()=>G.map(s=>({value:s.id,label:ms(s)?n("conversation.modelUseCliDefault"):s.name})),[G]),is=o.useMemo(()=>!i||!i.targetModel?fs:G.some(s=>s.id===i.targetModel)?i.targetModel:fs,[G,i]),as=o.useMemo(()=>St(se),[se]),Is=L.providerConfigMode==="cc-switch-preset"?L.providerPresetId??le:le,oe=o.useMemo(()=>as.find(s=>s.value===Is)??as[0]??null,[as,Is]),ls=o.useMemo(()=>G.find(s=>s.id===is)??null,[G,is]),Ts=o.useMemo(()=>Pt(se),[se]),Xt=o.useMemo(()=>{const s=ls?ms(ls)?n("conversation.modelUseCliDefault"):ls.name:n("conversation.modelUseCliDefault");return Ts?`${(oe==null?void 0:oe.label)??n("conversation.deploymentDefaultPreset")} · ${s}`:s},[ls,oe,Ts]),re=o.useMemo(()=>i?os.filter(s=>fo(i.sourceProvider,s)!==null?!1:!_t(Ge[s]??null)):[],[i,Ge,os]),ot=o.useMemo(()=>i?re.length>0?re:[i.targetProvider]:[],[i,re]),en=o.useMemo(()=>ot.map(s=>({value:s,label:Ot(s,"full")})),[ot]),cs=o.useMemo(()=>i?vo(Ge[i.targetProvider]??J??null):null,[J,i,Ge]),ds=K??null,ie=Y||ds===!0,sn=ie&&st==="streaming_guidance"&&ds===!1&&!An(t),rt=!T&&ie&&st==="streaming_guidance"&&!sn,As=!T&&ie&&typeof be=="function"&&On(t,ds),S=!T&&ie&&!rt&&!As,Os=T&&!!cs,it=H.trim().length>0||Q.length>0,at=P===!1&&ds===!0?Xs.allowed:P??Xs.allowed,Fs=ie&&at&&!!Z&&!Qs,tn=!it&&(vs||M||ie||U),lt=Fs?n("conversation.capabilityInterrupt"):n("conversation.runtimeRunning"),ct=ie?As?n("conversation.queueGuidanceButton"):rt?n("conversation.sendGuidanceButton"):n("conversation.sendButton"):n("conversation.sendButton"),dt=o.useCallback(s=>{ye(s),Us(x)&&jt({providers:{[x]:{defaultModel:s}}}).catch(()=>{})},[x]),nn=o.useCallback(s=>{if(s==="__global_default__"){ke("global-default"),He(null);return}ke("cc-switch-preset"),He(s)},[]),on=o.useCallback(s=>{Be(s),Us(x)&&jt({providers:{[x]:{defaultReasoningLevel:s}}}).catch(()=>{})},[x]),us=o.useCallback(s=>{V.current.forEach(a=>{URL.revokeObjectURL(a)}),V.current.clear(),s.forEach(a=>{a.previewUrl&&V.current.add(a.previewUrl)}),je(s)},[]),qe=o.useCallback(s=>{s.length!==0&&je(a=>{const c=xo(a,s);return c.forEach(m=>{m.previewUrl&&V.current.add(m.previewUrl)}),c})},[]),rn=o.useCallback(s=>{te.current.delete(s),je(a=>{const c=a.find(m=>m.id===s);return c!=null&&c.previewUrl&&(V.current.delete(c.previewUrl),URL.revokeObjectURL(c.previewUrl)),a.filter(m=>m.id!==s)})},[]),ut=o.useCallback(s=>{const a=Array.from(s.target.files??[]);a.length>0&&qe(a),s.target.value=""},[qe]),an=o.useCallback(s=>{var c;q.isMobile||!R.allowed||S||!((((c=s.dataTransfer.files)==null?void 0:c.length)??0)>0||Array.from(s.dataTransfer.items??[]).some(m=>m.kind==="file"))||(s.preventDefault(),s.dataTransfer.dropEffect="copy",_e||$e(!0),_(!1))},[R.allowed,_e,S,q.isMobile]),ln=o.useCallback(s=>{const a=s.relatedTarget;a instanceof Node&&s.currentTarget.contains(a)||$e(!1)},[]),cn=o.useCallback(s=>{if(q.isMobile||!R.allowed||S)return;const a=Array.from(s.dataTransfer.files??[]);a.length!==0&&(s.preventDefault(),$e(!1),qe(a))},[R.allowed,S,qe,q.isMobile]),mt=o.useCallback(s=>{if(!R.allowed||S)return;const a=s==="camera"?Zs.current:Cs.current;It(a),ue(!1)},[R.allowed,S]),dn=o.useCallback(()=>{if(!(!R.allowed||S)){if(_(!1),q.isNativeMobile){ss.trigger("selection"),ue(!0);return}It(Cs.current)}},[R.allowed,ss,S,q.isNativeMobile]),un=o.useCallback(()=>{_(s=>!s)},[]),mn=o.useCallback(s=>{var a;ce(c=>c.trimStart().startsWith(s)?c:c.trim()?`${s} ${c.trim()}`:`${s} `),_(!1),(a=Pe.current)==null||a.focus()},[]),ve=o.useCallback(async s=>{const a=N;Ps.current+=1,ze(s),Hs(!0);try{const c=await Fn(s.map(m=>({id:m.id,text:m.text})));return ze(c.items.map(m=>({id:m.id,text:m.text}))),!0}catch(c){return ze(a),Re({title:c instanceof Error?c.message:n("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{Hs(!1)}},[N,Re]),hn=o.useCallback(async()=>{const s=Ke.trim();!s||!await ve([...N,so(s)])||(Ws(""),me(!1))},[ve,Ke,N]),pn=o.useCallback(s=>{ve(N.filter(a=>a.id!==s))},[ve,N]),ht=o.useCallback((s,a)=>{const c=N.findIndex(w=>w.id===s);if(c<0)return;const m=c+a;if(m<0||m>=N.length)return;const g=[...N],[j]=g.splice(c,1);g.splice(m,0,j),ve(g)},[ve,N]),fn=o.useCallback(s=>{var a;ce(s),De(!1),(a=Pe.current)==null||a.focus()},[]),pt=o.useCallback(s=>{const a=s?to(s):null,c=(a==null?void 0:a.attachments.map(m=>mo(m)))??[];te.current=new Map(((a==null?void 0:a.attachments)??[]).map(m=>[m.id,m])),us(c),ce((a==null?void 0:a.content)??""),_(!1)},[us]);o.useEffect(()=>{if(!F.length)return;const s=(u==null?void 0:u.trim())||null,a=`${l??"default"}:${x}:${s??""}`;if(!!(s&&F.some(g=>g.id===s))){if(es.current!==a){es.current=a,B!==s&&ye(s);return}if(F.some(g=>g.id===B))return;ye(s);return}if(!s&&es.current!==a&&(es.current=a),Ee&&F.some(g=>g.id===Ee)){B!==Ee&&ye(Ee);return}if(F.some(g=>g.id===B))return;const m=F[0].id;ye(m)},[F,l,x,B,Ee,u]),o.useEffect(()=>{if(!Un(x)||D.length===0)return;if(Le&&D.some(c=>c.value===Le)){de!==Le&&Be(Le);return}const s=t==null?void 0:t.defaultReasoningLevel;if(s&&D.some(c=>c.value===s)){de!==s&&Be(s);return}if(D.some(c=>c.value===de))return;const a=D[0].value;Be(a)},[D,t==null?void 0:t.defaultReasoningLevel,x,de,Le]),o.useEffect(()=>{let s=!1;const a=Ps.current;return Bn().then(c=>{s||Ps.current!==a||ze(c.items.map(m=>({id:m.id,text:m.text})))}).catch(()=>{}),()=>{s=!0}},[]),o.useEffect(()=>{pt(l)},[l,pt]),o.useEffect(()=>{if(!l)return;const s=l,a=new Set(Q.map(g=>g.id));te.current.forEach((g,j)=>{a.has(j)||te.current.delete(j)});let c=!1;async function m(){if(H.length===0&&Q.length===0){Ft(s);return}const g=await Promise.all(Q.map(async j=>{const w=te.current.get(j.id);return w&&w.fileName===j.file.name&&w.fileSize===j.file.size&&w.lastModified===j.file.lastModified&&w.mimeType===Fe(j.file)?w:{id:j.id,fileName:j.file.name,mimeType:Fe(j.file),fileSize:j.file.size,lastModified:j.file.lastModified,contentBase64:await Tt(j.file)}}));c||(te.current=new Map(g.map(j=>[j.id,j])),no(s,{content:H,attachments:g}))}return m(),()=>{c=!0}},[Q,H,l]),o.useEffect(()=>{const s=Pe.current;s&&(s.style.height="0px",s.style.height=`${Math.min(s.scrollHeight,120)}px`)},[H]),o.useEffect(()=>{R.allowed||(te.current.clear(),ue(!1),us([]))},[R.allowed,us]),o.useEffect(()=>{q.isMobile||ue(!1)},[q.isMobile]),o.useEffect(()=>()=>{V.current.forEach(s=>{URL.revokeObjectURL(s)}),V.current.clear()},[]),o.useEffect(()=>{function s(){var a;(a=Pe.current)==null||a.focus()}return window.addEventListener(Et,s),()=>{window.removeEventListener(Et,s)}},[]),o.useEffect(()=>{if(!i){Ce(null),Qe(!1),Me(null),Ve(!1),ks({}),Ze(null);return}if(rs){Ce(null),Qe(!1);return}let s=!1;return Ce(Bs(i.targetProvider)),Qe(!0),Ct(i.targetProvider,i.workspaceId,{providerConfigMode:L.providerConfigMode,providerPresetId:L.providerConfigMode==="cc-switch-preset"?L.providerPresetId:null}).then(a=>{s||Ce(a)}).catch(()=>{s||Ce(Bs(i.targetProvider))}).finally(()=>{s||Qe(!1)}),()=>{s=!0}},[i,L.providerConfigMode,L.providerPresetId,rs]),o.useEffect(()=>{if(!i){ks({});return}let s=!1;return _n(os,i.workspaceId).then(a=>{s||ks(a)}),()=>{s=!0}},[i==null?void 0:i.workspaceId,os]),o.useEffect(()=>{!i||!v||re.length!==0&&(re.includes(i.targetProvider)||v({...i,targetProvider:re[0]??i.targetProvider,targetModel:null,targetProviderConfigMode:"global-default",targetProviderPresetId:null}))},[i,v,re]),o.useEffect(()=>{!i||!i.targetModel||!v||G.some(s=>s.id===i.targetModel)||v({...i,targetModel:null})},[G,i,v]);const vn=o.useCallback(s=>{if(!(!i||!v||s===i.targetProvider)){if(s!==i.sourceProvider&&i.targetProvider===i.sourceProvider){Ze(s);return}s===x&&ae(s)?(z(ee.providerConfigMode),W(ee.providerPresetId)):(z("global-default"),W(null)),v({...i,targetProvider:s,targetModel:null,targetProviderConfigMode:s===x&&ae(s)?ee.providerConfigMode:"global-default",targetProviderPresetId:s===x&&ae(s)?ee.providerPresetId:null})}},[ee,i,v,x]),ft=o.useCallback(s=>{!i||!v||v({...i,targetModel:s===fs?null:s})},[i,v]),gn=o.useCallback(s=>{!i||!v||(s===le?(z("global-default"),W(null)):(z("cc-switch-preset"),W(s)),v({...i,targetModel:null,targetProviderConfigMode:s===le?"global-default":"cc-switch-preset",targetProviderPresetId:s===le?null:s}))},[i,v]),bn=o.useCallback(()=>{!i||!Ye||!v||(z("global-default"),W(null),v({...i,targetProvider:Ye,targetModel:null,targetProviderConfigMode:"global-default",targetProviderPresetId:null}),Ze(null))},[i,v,Ye]),vt=o.useCallback(()=>{Ze(null)},[]);async function xn(s){if(Ms.current)return;const a=H.trim(),c=Q;if(a.length===0&&c.length===0||!Rs.allowed||S||Os){Re({title:S?n("conversation.runtimeRunning"):cs??Rs.reason??n("conversation.capabilityDenied"),tone:"error"});return}Ms.current=!0,ss.trigger(s==="queue"?"selection":"action"),Js(!0),ce(""),je([]),ue(!1),$e(!1),De(!1),me(!1),_(!1);try{const m=await Promise.all(c.map(async w=>({kind:w.kind,fileName:w.file.name,mimeType:Fe(w.file),fileSize:w.file.size,contentBase64:await Tt(w.file)}))),g=c.map(w=>go(w.file,w.id));await(s==="queue"&&be?be:Ue)(a,{model:T||E!=null&&E.usesProviderDefault?void 0:B||void 0,reasoningLevel:T?void 0:ns&&D.length>0?de:void 0,providerConfigMode:T?L.providerConfigMode:I,providerPresetId:T?L.providerConfigMode==="cc-switch-preset"?L.providerPresetId:null:I==="cc-switch-preset"?$:null,attachments:m,attachmentMeta:g}),bo(c),c.forEach(w=>{w.previewUrl&&V.current.delete(w.previewUrl)})}catch(m){ce(a),je(c),Re({title:m instanceof Error&&m.message==="FILE_READ_FAILED"?n("conversation.attachmentReadFailed"):m instanceof Error?m.message:n("conversation.capabilityDenied"),tone:"error"})}finally{Js(!1),Ms.current=!1}}async function gt(s){s.preventDefault(),await xn(As?"queue":"send")}async function yn(){if(!(!at||!Z||Qs))try{Vs(!0),ss.trigger("action"),await Z()}catch(s){Re({title:s instanceof Error?s.message:n("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{Vs(!1)}}const bt=vs||M||S||Os||!Rs.allowed||!it,xt=vs||M||S||!R.allowed,jn=H.length===0&&!S,yt=e.jsxs("section",{ref:h,className:"composer-panel",children:[e.jsxs("form",{className:"composer-form",onSubmit:gt,children:[e.jsx("input",{id:xe,ref:Cs,type:"file",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:Lt,onChange:ut}),e.jsx("input",{id:$t,ref:Zs,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:Lt,onChange:ut}),e.jsxs("div",{className:"composer-input-container","data-drag-active":_e?"true":void 0,onDragOver:an,onDragLeave:ln,onDrop:cn,children:[i?e.jsxs("div",{className:"composer-fork-draft",children:[e.jsxs("div",{className:"composer-fork-draft-main",children:[e.jsxs("div",{className:"composer-fork-draft-copy",children:[e.jsx("span",{className:"composer-fork-draft-label",children:n("conversation.forkDraftLabel")}),e.jsx("span",{className:"composer-fork-draft-text",children:po(i.content)})]}),e.jsxs("div",{className:"composer-fork-config",children:[e.jsxs("div",{className:"composer-fork-config-grid",children:[e.jsxs("div",{className:"composer-fork-field",children:[e.jsx("span",{className:"composer-fork-model-label",children:n("conversation.forkTargetProviderLabel")}),e.jsx(hs,{ariaLabel:n("conversation.forkTargetProviderLabel"),value:i.targetProvider,options:en,onChange:s=>vn(s),compact:!0})]}),e.jsxs("div",{className:"composer-fork-field",children:[e.jsx("span",{className:"composer-fork-model-label",children:n("conversation.forkTargetModelLabel")}),Zt?e.jsx(Nt,{ariaLabel:n("conversation.forkTargetModelLabel"),triggerLabel:Xt,presetOptions:as,selectedPresetValue:Is,selectedPresetSummary:(oe==null?void 0:oe.summary)??null,onSelectPreset:gn,modelOptions:nt,selectedModelValue:is,onSelectModel:ft,loadingPresets:Qt,loadingModels:ws,modelColumnDisabled:L.providerConfigMode==="cc-switch-preset"&&ws&&js===null,showPresetColumn:Ts,modelEmptyText:n("conversation.deploymentModelEmpty")}):e.jsx(hs,{ariaLabel:n("conversation.forkTargetModelLabel"),value:is,options:nt,onChange:ft,disabled:ws||Os,compact:!0})]})]}),cs?e.jsx("p",{className:"composer-capability-hint",children:cs}):null]})]}),k?e.jsx("button",{type:"button",className:"composer-fork-draft-clear","aria-label":n("conversation.forkDraftClear"),title:n("conversation.forkDraftClear"),onClick:k,children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):null]}):null,Q.length>0?e.jsx("div",{className:"composer-attachments",children:Q.map(s=>e.jsxs("div",{className:"composer-attachment-card",children:[s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:n("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}):e.jsx("div",{className:"composer-attachment-file","aria-hidden":"true",children:e.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M14 2H7a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7z"}),e.jsx("path",{d:"M14 2v5h5"}),e.jsx("path",{d:"M9 13h6"}),e.jsx("path",{d:"M9 17h6"})]})}),e.jsxs("div",{className:"composer-attachment-meta",children:[e.jsx("span",{className:"attachment-name",title:s.file.name,children:s.file.name}),e.jsx("span",{className:"attachment-size",children:ho(s.file.size)})]}),e.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>rn(s.id),"aria-label":n("conversation.removeAttachment"),children:e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},s.id))}):null,_e?e.jsx("div",{className:"composer-drop-hint",children:n("conversation.attachmentDropHint")}):null,e.jsxs("div",{className:"composer-input-wrapper",children:[e.jsx("textarea",{ref:Pe,className:"composer-input",value:H,placeholder:r??n("conversation.composerPlaceholder"),readOnly:S,"aria-readonly":S,onChange:s=>ce(s.target.value),rows:1,onFocus:()=>_(!1),onCompositionStart:()=>{Ns(),Ss.current=!0},onCompositionEnd:()=>{Ss.current=!1,Xe.current=!0,Ne.current=globalThis.setTimeout(()=>{Xe.current=!1,Ne.current=null},0)},onPaste:s=>{if(S||!R.allowed)return;const a=Array.from(s.clipboardData.items).filter(c=>c.kind==="file").map(c=>c.getAsFile()).filter(c=>!!c);a.length!==0&&(s.preventDefault(),qe(a))},onKeyDown:s=>{if(s.key==="Escape"&&_(!1),s.key==="Enter"&&!s.shiftKey){if(yo(s,Ss.current,Xe.current))return;s.preventDefault(),bt||gt(s)}}}),e.jsx("div",{className:"composer-input-actions",children:tn?e.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!Fs,onClick:()=>{Fs&&yn()},"aria-label":lt,title:lt,children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):e.jsx("button",{className:"composer-send",type:"submit",disabled:bt,"aria-label":ct,title:ct,children:e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]}),Wt?e.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":n("conversation.slashMenuTitle"),children:Yt.map(s=>e.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>mn(s.command),children:[e.jsx("span",{className:"composer-slash-command",children:s.command}),e.jsx("span",{className:"composer-slash-label",children:s.label})]},s.command))}):null,e.jsxs("div",{className:"composer-controls",children:[e.jsxs("div",{className:"composer-controls-left",children:[R.allowed?q.isNativeMobile?e.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":n("conversation.attachFiles"),title:n("conversation.attachFiles"),disabled:xt,onClick:dn,children:e.jsx($s,{})}):xt?e.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":n("conversation.attachFiles"),title:n("conversation.attachFiles"),disabled:!0,children:e.jsx($s,{})}):e.jsx("label",{htmlFor:xe,className:"composer-attach-btn","aria-label":n("conversation.attachFiles"),title:n("conversation.attachFiles"),onClick:()=>{_(!1)},children:e.jsx($s,{})}):null,!T&&he?e.jsx(Nt,{ariaLabel:n("conversation.modelSelectorLabel"),triggerLabel:Jt,presetOptions:ts,selectedPresetValue:Es,selectedPresetSummary:(ne==null?void 0:ne.summary)??null,onSelectPreset:nn,modelOptions:et,selectedModelValue:B,onSelectModel:dt,loadingPresets:Ht,loadingModels:Gs,modelColumnDisabled:I==="cc-switch-preset"&&Gs&&bs===null,showPresetColumn:qs,modelEmptyText:n("conversation.deploymentModelEmpty")}):null,!T&&!he?e.jsx(hs,{ariaLabel:n("conversation.modelSelectorLabel"),value:B,options:et,onChange:dt}):null,!T&&ns&&D.length>0?e.jsx(hs,{ariaLabel:n("conversation.reasoningSelectorLabel"),value:de,options:Gt,onChange:s=>on(s),compact:!0}):null,Vt?e.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:un,title:n("conversation.slashMenu"),children:[e.jsx("span",{className:"slash-icon",children:"/"}),e.jsx("span",{children:n("conversation.slashMenu")})]}):null,e.jsx(Po,{contextUsage:b}),e.jsx(Vn,{provider:y,messages:O,variant:"composer"})]}),jn?e.jsx("div",{className:"composer-quick-phrase-group",children:e.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":n("conversation.quickPhraseTrigger"),title:n("conversation.quickPhraseTrigger"),onClick:()=>{De(!0),_(!1)},children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M7 8h10"}),e.jsx("path",{d:"M7 12h8"}),e.jsx("path",{d:"M7 16h5"}),e.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})})}):null]})]})]}),e.jsx(ps,{open:Dt,title:n("conversation.quickPhraseModalTitle"),description:n("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{De(!1),me(!1)},children:e.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[e.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[e.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:e.jsx("span",{children:n("conversation.quickPhraseListLabel")})}),e.jsx("button",{type:"button",className:"primary-button",disabled:we,onClick:()=>me(!0),children:n("conversation.quickPhraseOpenCreateAction")})]}),e.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":n("conversation.quickPhraseListLabel"),children:N.length===0?e.jsx("div",{className:"composer-quick-phrase-empty",children:n("conversation.quickPhraseEmpty")}):N.map((s,a)=>e.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[e.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>fn(s.text),children:[e.jsx("span",{className:"composer-quick-phrase-order",children:n("conversation.quickPhraseOrderLabel",{index:a+1})}),e.jsx("span",{className:"composer-quick-phrase-text",children:s.text})]}),e.jsxs("div",{className:"composer-quick-phrase-actions",children:[e.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:we||a===0,"aria-label":n("conversation.quickPhraseMoveUp"),title:n("conversation.quickPhraseMoveUp"),onClick:()=>ht(s.id,-1),children:"↑"}),e.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:we||a===N.length-1,"aria-label":n("conversation.quickPhraseMoveDown"),title:n("conversation.quickPhraseMoveDown"),onClick:()=>ht(s.id,1),children:"↓"}),e.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:we,"aria-label":n("conversation.quickPhraseDelete"),title:n("conversation.quickPhraseDelete"),onClick:()=>pn(s.id),children:"×"})]})]},s.id))})]})}),e.jsx(ps,{open:Kt,title:n("conversation.quickPhraseCreateModalTitle"),description:n("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>me(!1),children:e.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[e.jsxs("label",{className:"workbench-modal-field",children:[e.jsx("span",{children:n("conversation.quickPhraseCreateLabel")}),e.jsx("textarea",{className:"composer-quick-phrase-textarea",value:Ke,placeholder:n("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:s=>Ws(s.target.value)})]}),e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:()=>me(!1),children:n("common.cancel")}),e.jsx("button",{type:"button",className:"primary-button",disabled:we||Ke.trim().length===0,onClick:()=>{hn()},children:n("conversation.quickPhraseCreateAction")})]})]})}),e.jsx(ps,{open:Ye!==null,title:n("conversation.forkSwitchConfirmTitle"),description:n("conversation.forkSwitchConfirmDescription"),className:"composer-fork-confirm-modal",onClose:vt,children:e.jsxs("div",{className:"composer-fork-confirm-body",children:[e.jsxs("div",{className:"composer-fork-confirm-list",children:[e.jsxs("div",{className:"composer-fork-confirm-item",children:[e.jsx("span",{className:"composer-fork-confirm-icon is-keep","aria-hidden":"true",children:e.jsx(Co,{})}),e.jsxs("div",{className:"composer-fork-confirm-copy",children:[e.jsx("strong",{children:n("conversation.forkSwitchConfirmKeepTitle")}),e.jsx("p",{children:n("conversation.forkSwitchConfirmKeepBody")})]})]}),e.jsxs("div",{className:"composer-fork-confirm-item",children:[e.jsx("span",{className:"composer-fork-confirm-icon is-convert","aria-hidden":"true",children:e.jsx(Mo,{})}),e.jsxs("div",{className:"composer-fork-confirm-copy",children:[e.jsx("strong",{children:n("conversation.forkSwitchConfirmConvertTitle")}),e.jsx("p",{children:n("conversation.forkSwitchConfirmConvertBody")})]})]}),e.jsxs("div",{className:"composer-fork-confirm-item",children:[e.jsx("span",{className:"composer-fork-confirm-icon is-drop","aria-hidden":"true",children:e.jsx(So,{})}),e.jsxs("div",{className:"composer-fork-confirm-copy",children:[e.jsx("strong",{children:n("conversation.forkSwitchConfirmDropTitle")}),e.jsx("p",{children:n("conversation.forkSwitchConfirmDropBody")})]})]})]}),e.jsxs("div",{className:"workbench-modal-actions",children:[e.jsx("button",{type:"button",className:"secondary-button",onClick:vt,children:n("conversation.forkSwitchKeepNative")}),e.jsx("button",{type:"button",className:"primary-button",onClick:bn,children:n("conversation.forkSwitchConfirmAction")})]})]})}),e.jsx(jo,{open:zt&&q.isNativeMobile,onClose:()=>ue(!1),onSelectCamera:()=>mt("camera"),onSelectLibrary:()=>mt("library")})]});return C?At.createPortal(yt,C):yt}function jo({open:t,onClose:r,onSelectCamera:l,onSelectLibrary:u}){return e.jsx($n,{open:t,title:n("conversation.attachmentSourceSheetTitle"),description:n("conversation.attachmentSourceSheetDescription"),kind:"action",height:"auto",className:"composer-attachment-sheet",cardClassName:"composer-attachment-sheet-card",bodyClassName:"composer-attachment-sheet-body",showHandle:!0,onClose:r,children:e.jsxs(zn,{className:"composer-attachment-sheet-actions",children:[e.jsx(Mt,{as:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":n("conversation.attachmentTakePhoto"),label:n("conversation.attachmentTakePhoto"),description:n("conversation.attachmentTakePhotoHint"),trailing:e.jsx(wo,{}),onClick:l}),e.jsx(Mt,{as:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":n("conversation.attachmentChooseFromLibrary"),label:n("conversation.attachmentChooseFromLibrary"),description:n("conversation.attachmentChooseFromLibraryHint"),trailing:e.jsx(ko,{}),onClick:u})]})})}function wo(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.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"}),e.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function $s(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),e.jsx("path",{d:"M8 12h8M12 8v8"})]})}function ko(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),e.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),e.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function Co(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[e.jsx("path",{d:"M12 3 4 7v5c0 5 3.5 8 8 9 4.5-1 8-4 8-9V7l-8-4Z"}),e.jsx("path",{d:"m9.5 12 1.8 1.8L15 10.2"})]})}function Mo(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[e.jsx("path",{d:"M4 7h9"}),e.jsx("path",{d:"m10 3 4 4-4 4"}),e.jsx("path",{d:"M20 17h-9"}),e.jsx("path",{d:"m14 13-4 4 4 4"})]})}function So(){return e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[e.jsx("path",{d:"m7 7 10 10"}),e.jsx("path",{d:"M17 7 7 17"}),e.jsx("path",{d:"M12 3v2"}),e.jsx("path",{d:"M12 19v2"})]})}function Po({contextUsage:t}){const[r,l]=o.useState(!1),u=o.useRef(null),p=o.useRef(null),[f,d]=o.useState(null),i=o.useId(),k=t?Math.round(t.usageRatio*100):null,v=t?Math.max(0,Math.min(t.usageRatio,1)):0,h=No(v),C=t?Ro(t.contextWindowSource):null,K=t?`${n("conversation.contextUsageTitle")} ${k}%`:n("conversation.contextUsageUnavailable"),P=o.useCallback(()=>{const b=u.current;if(!b||typeof window>"u")return;const y=b.getBoundingClientRect(),O=window.innerWidth,U=window.innerHeight,M=12,Y=10,Z=Math.min(240,Math.max(188,O-M*2)),be=Math.min(Math.max(M,y.left+y.width/2-Z/2),Math.max(M,O-Z-M)),Ue=y.top-M,q=U-y.bottom-M,xe=Ue>=140||Ue>=q;d({position:"fixed",left:be,width:Z,maxWidth:O-M*2,top:xe?void 0:y.bottom+Y,bottom:xe?U-y.top+Y:void 0})},[]);return o.useEffect(()=>{if(!r)return;function b(O){var M,Y;const U=O.target;!((M=u.current)!=null&&M.contains(U))&&!((Y=p.current)!=null&&Y.contains(U))&&l(!1)}function y(O){O.key==="Escape"&&l(!1)}return window.addEventListener("pointerdown",b),window.addEventListener("keydown",y),window.addEventListener("resize",P),window.addEventListener("scroll",P,!0),P(),()=>{window.removeEventListener("pointerdown",b),window.removeEventListener("keydown",y),window.removeEventListener("resize",P),window.removeEventListener("scroll",P,!0)}},[r,P]),e.jsxs(e.Fragment,{children:[e.jsx("button",{ref:u,type:"button",className:`composer-context-ring ${h}`,style:{"--context-usage-progress":`${v}`},"aria-label":K,"aria-expanded":r,"aria-describedby":r?i:void 0,onClick:()=>l(b=>!b),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),children:e.jsx("span",{className:"composer-context-ring-value",children:k===null?"--":e.jsxs(e.Fragment,{children:[e.jsx("span",{children:k}),e.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),r&&f&&typeof document<"u"?At.createPortal(e.jsx("div",{ref:p,id:i,className:"composer-context-tooltip",style:f,role:"tooltip",children:t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"composer-context-tooltip-title",children:n("conversation.contextUsageTitle")}),e.jsxs("div",{className:"composer-context-tooltip-line",children:[k,"% · ",zs(t.promptTokens)," /"," ",zs(t.contextWindow)," tokens"]}),t.cachedInputTokens>0?e.jsx("div",{className:"composer-context-tooltip-line",children:n("conversation.contextUsageCachedTokens").replace("{count}",zs(t.cachedInputTokens))}):null,C?e.jsx("div",{className:"composer-context-tooltip-meta",children:C}):null,t.isEstimated?e.jsx("div",{className:"composer-context-tooltip-meta",children:n("conversation.contextUsageEstimated")}):null]}):e.jsx("div",{className:"composer-context-tooltip-line",children:n("conversation.contextUsageUnavailable")})}),document.body):null]})}function No(t){return t>=.95?"is-critical":t>=.8?"is-warning":"is-normal"}function Ro(t){switch(t){case"provider-log":return n("conversation.contextUsageSourceProviderLog");case"provider-runtime":return n("conversation.contextUsageSourceProviderRuntime");case"provider-config":return n("conversation.contextUsageSourceProviderConfig");case"model-map":return n("conversation.contextUsageSourceModelMap");default:return""}}function zs(t){return new Intl.NumberFormat().format(t)}function $o({requests:t,replyingRequestId:r,onReply:l}){const[u,p]=o.useState({}),f=o.useMemo(()=>t.filter(d=>d.status==="pending"),[t]);return f.length===0?null:e.jsxs("section",{className:"permission-request-list",children:[e.jsxs("div",{className:"permission-request-list-header",children:[e.jsxs("div",{children:[e.jsx("strong",{children:n("conversation.permissionRequestSectionTitle")}),e.jsx("p",{children:n("conversation.permissionRequestSectionDescription")})]}),e.jsx("span",{className:"permission-request-count",children:f.length})]}),e.jsx("div",{className:"permission-request-stack",children:f.map(d=>{var K,P;const i=u[d.id]??{},k=d.paths.filter(Boolean),v=d.kind==="command"&&!!((K=d.command)!=null&&K.trim()),h=d.questions.length===0&&k.length===0&&!v&&!!((P=d.summary)!=null&&P.trim()),C=d.kind==="user_input"&&d.questions.some(b=>{var y;return(((y=i[b.id])==null?void 0:y.filter(Boolean).length)??0)===0});return e.jsxs("article",{className:"permission-request-card",children:[e.jsxs("header",{className:"permission-request-card-header",children:[e.jsxs("div",{className:"permission-request-provider",children:[e.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:e.jsx("img",{src:Dn(d.provider),alt:"",loading:"lazy"})}),e.jsxs("div",{className:"permission-request-provider-copy",children:[e.jsx("strong",{children:d.title}),e.jsx("span",{children:Ot(d.provider,"full")})]})]}),e.jsx("span",{className:"permission-request-kind",children:Lo(d.kind)})]}),e.jsxs("div",{className:"permission-request-card-body",children:[k.length>0?e.jsx("div",{className:"permission-request-block",children:e.jsx("ul",{className:"permission-request-target-list",children:k.map(b=>e.jsxs("li",{className:"permission-request-target-item",children:[e.jsx("strong",{children:qo(b)}),e.jsx("span",{children:b})]},`${d.id}:${b}`))})}):null,v?e.jsxs("div",{className:"permission-request-block",children:[e.jsx("div",{className:"permission-request-block-label",children:n("conversation.permissionRequestCommandLabel")}),e.jsx("pre",{children:d.command})]}):null,h?e.jsx("p",{className:"permission-request-summary",children:d.summary}):null,d.questions.length>0?e.jsxs("div",{className:"permission-request-block",children:[e.jsx("div",{className:"permission-request-block-label",children:n("conversation.permissionRequestQuestionsLabel")}),e.jsx("div",{className:"permission-request-question-list",children:d.questions.map(b=>e.jsxs("div",{className:"permission-request-question",children:[e.jsx("div",{className:"permission-request-question-header",children:b.header}),e.jsx("p",{children:b.question}),e.jsx("div",{className:"permission-request-question-options",children:b.options.map(y=>{var U;const O=((U=i[b.id])==null?void 0:U.includes(y.label))??!1;return e.jsxs("label",{className:"permission-request-question-option",children:[e.jsx("input",{type:"radio",name:`${d.id}:${b.id}`,checked:O,onChange:()=>{p(M=>({...M,[d.id]:{...M[d.id]??{},[b.id]:[y.label]}}))}}),e.jsxs("span",{children:[e.jsx("strong",{children:y.label}),y.description?e.jsx("small",{children:y.description}):null]})]},`${b.id}:${y.label}`)})})]},b.id))})]}):null]}),e.jsx("footer",{className:"permission-request-card-footer",children:d.actions.map(b=>e.jsx("button",{type:"button",className:Eo(b.tone),disabled:r===d.id||b.value==="submit"&&C,onClick:()=>void l(d.id,{action:b.value,answers:Object.keys(i).length>0?i:void 0}),children:r===d.id?n("conversation.permissionRequestSubmitting"):b.label},`${d.id}:${b.value}`))})]},d.id)})})]})}function Eo(t){return t==="danger"?"workbench-danger-button permission-request-action":t==="primary"?"primary-button permission-request-action":"secondary-button permission-request-action"}function Lo(t){return t==="command"?n("conversation.permissionRequestKindCommand"):t==="file_change"?n("conversation.permissionRequestKindFileChange"):t==="permissions"?n("conversation.permissionRequestKindPermissions"):t==="user_input"?n("conversation.permissionRequestKindUserInput"):n("conversation.permissionRequestKindToolCall")}function qo(t){return t.split(/[/\\]+/).filter(Boolean).at(-1)??t}class zo{constructor(r){A(this,"socket",null);A(this,"disposed",!1);A(this,"authRecoveryInFlight",!1);A(this,"latestCursor");A(this,"subscribed",!1);A(this,"pendingOlderRequest",null);A(this,"inFlightOlderRequest",null);A(this,"subscribeStartedAtMs",null);A(this,"firstBackfillLogged",!1);A(this,"olderRequestStartedAtMs",null);A(this,"connectionManager");this.options=r,this.latestCursor=r.cursor,this.connectionManager=new Qn({onReconnect:l=>{this.connect(l)},onStateChange:r.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(r){this.latestCursor=r}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(r,l){return Io(this.socket)?this.subscribed?(this.sendOlderMessagesRequest(r,l),!0):(this.pendingOlderRequest={cursor:r,limit:l},!0):!1}close(){var r;this.disposed=!0,this.subscribed=!1,this.pendingOlderRequest=null,this.inFlightOlderRequest=null,this.connectionManager.close(),(r=this.socket)==null||r.close(),this.socket=null}connect(r){var k;if(this.disposed)return;r&&this.socket&&(this.socket.close(),this.socket=null);const l=(k=wt.getState().session)==null?void 0:k.accessToken;if(!l){this.options.onUnauthorized();return}const u=Mn(),p=Sn(u),f=p.baseUrl,d=`${Pn("/ws",f)}?access_token=${encodeURIComponent(l)}`,i=p.transport.createWebSocket({path:"/ws",baseUrl:f,url:d});this.subscribed=!1,this.firstBackfillLogged=!1,this.socket=i,i.addEventListener("open",()=>{this.subscribeStartedAtMs=performance.now(),i.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit})),Te("session.subscribe.sent",{sessionId:this.options.sessionId,hasCursor:this.latestCursor!==null,limit:this.options.limit,baseUrl:f})}),i.addEventListener("message",v=>{if(!(v instanceof MessageEvent)||typeof v.data!="string")return;const h=JSON.parse(v.data);if(h.type==="system.connected"){this.connectionManager.markConnected();return}if(h.type==="session.subscribed"){this.subscribed=!0,Te("session.subscribe.ack",{sessionId:h.sessionId,durationMs:Ds(this.subscribeStartedAtMs)}),this.options.onSubscribed(),this.flushPendingOlderRequest();return}if(h.type==="session.error"){if(this.clearOlderMessagesRequest(),h.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(h);return}if(h.type==="session.runtime_status"){this.options.onRuntimeStatus(h);return}if(h.type==="session.activity"){this.options.onActivity(h);return}if(h.type==="session.history_older"){Te("session.history_older.received",{sessionId:h.sessionId,messageCount:h.messages.length,olderCursor:h.olderCursor,durationMs:Ds(this.olderRequestStartedAtMs)}),this.olderRequestStartedAtMs=null,this.clearOlderMessagesRequest(),this.options.onOlderHistory(h);return}if(h.type==="session.runtime_message"){this.options.onRuntimeMessage(h);return}if(h.type==="session.runtime_error"){this.options.onRuntimeError(h);return}if(h.type==="session.interrupted"){this.options.onInterrupted(h);return}if(h.type==="session.permission_request"){this.options.onPermissionRequest(h);return}if(h.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(h);return}this.latestCursor=h.cursor,this.firstBackfillLogged||(this.firstBackfillLogged=!0,Te("session.initial_messages.received",{sessionId:h.sessionId,eventType:h.type,messageCount:h.messages.length,olderCursor:h.olderCursor??null,durationMs:Ds(this.subscribeStartedAtMs)})),this.options.onEnvelope(h)}),i.addEventListener("close",()=>{this.disposed||this.socket!==i||(this.subscribed=!1,this.requeueInFlightOlderRequest(),this.connectionManager.markDisconnected())}),i.addEventListener("error",()=>{this.disposed||this.socket!==i||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0,this.subscribed=!1,this.requeueInFlightOlderRequest();const r=this.socket;this.socket=null,r==null||r.close(),wt.refresh().then(l=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(l.status==="refreshed"){this.connectionManager.reconnectNow();return}if(l.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendOlderMessagesRequest(r,l){var u;this.inFlightOlderRequest={cursor:r,limit:l},this.olderRequestStartedAtMs=performance.now(),(u=this.socket)==null||u.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:r,limit:l})),Te("session.load_older.sent",{sessionId:this.options.sessionId,hasCursor:r!==null,limit:l})}flushPendingOlderRequest(){if(!this.pendingOlderRequest)return;const r=this.pendingOlderRequest;this.pendingOlderRequest=null,this.sendOlderMessagesRequest(r.cursor,r.limit)}clearOlderMessagesRequest(){this.pendingOlderRequest=null,this.inFlightOlderRequest=null}requeueInFlightOlderRequest(){this.inFlightOlderRequest&&(this.pendingOlderRequest=this.inFlightOlderRequest,this.inFlightOlderRequest=null,this.olderRequestStartedAtMs=null)}}function Ds(t){return t===null||typeof performance>"u"?null:Math.round(performance.now()-t)}function Io(t){return t!==null&&t.readyState===1}export{_o as C,$o as P,zo as R};
@@ -1 +0,0 @@
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-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}.session-list-item[data-parallel-group=true]{border-color:color-mix(in srgb,var(--parallel-group-accent, var(--accent)) 22%,var(--border-primary));background:linear-gradient(90deg,color-mix(in srgb,var(--parallel-group-surface, transparent) 84%,transparent),transparent 52%),var(--bg-surface)}.session-list-title-row{display:flex;align-items:center;flex-wrap:wrap;gap:6px}.session-list-parallel-badge,.session-list-parallel-role-badge,.session-list-isolated-workspace-badge{display:inline-flex;align-items:center;min-height:20px;padding:0 8px;border-radius:999px;font-size:10px;font-weight:700}.session-list-parallel-badge,.session-list-parallel-role-badge{border:1px solid color-mix(in srgb,var(--parallel-group-accent, var(--accent)) 24%,var(--border-primary));background:color-mix(in srgb,var(--parallel-group-surface, var(--bg-hover)) 86%,transparent);color:color-mix(in srgb,var(--parallel-group-accent, var(--accent)) 74%,var(--text-primary))}.session-list-isolated-workspace-badge{border:1px solid color-mix(in srgb,var(--warning, #d97706) 24%,var(--border-primary));background:color-mix(in srgb,var(--warning, #d97706) 12%,var(--bg-surface));color:color-mix(in srgb,var(--warning, #d97706) 72%,var(--text-primary))}
@@ -1,51 +0,0 @@
1
- export type WechatClawLoginStatus = "not_logged_in" | "waiting_scan" | "scan_confirmed" | "active" | "expired";
2
- export interface WechatClawStartLoginResult {
3
- sessionKey: string;
4
- qrcode: string;
5
- qrcodeUrl: string | null;
6
- status: WechatClawLoginStatus;
7
- }
8
- export interface WechatClawPollLoginResult {
9
- status: WechatClawLoginStatus;
10
- botToken: string | null;
11
- baseUrl: string | null;
12
- remoteBotId: string | null;
13
- boundUserId: string | null;
14
- redirectHost: string | null;
15
- }
16
- export interface WechatClawPollMessagesResult {
17
- nextCursor: string | null;
18
- longPollingTimeoutMs: number | null;
19
- messages: WechatClawInboundMessage[];
20
- }
21
- export interface WechatClawInboundMessage {
22
- messageId: string;
23
- fromUserId: string | null;
24
- toUserId: string | null;
25
- text: string | null;
26
- timestamp: string | null;
27
- contextToken: string | null;
28
- rawPayload: Record<string, unknown>;
29
- }
30
- export interface WechatClawSendTextResult {
31
- messageRef: string | null;
32
- }
33
- export declare function startWechatClawLogin(): Promise<WechatClawStartLoginResult>;
34
- export declare function pollWechatClawLoginStatus(options: {
35
- qrcode: string;
36
- authBaseUrl?: string | null;
37
- }): Promise<WechatClawPollLoginResult>;
38
- export declare function pollWechatClawMessages(options: {
39
- baseUrl?: string | null;
40
- botToken: string;
41
- cursor?: string | null;
42
- timeoutMs?: number;
43
- }): Promise<WechatClawPollMessagesResult>;
44
- export declare function sendWechatClawText(options: {
45
- baseUrl?: string | null;
46
- botToken: string;
47
- toUserId: string;
48
- contextToken: string;
49
- text: string;
50
- }): Promise<WechatClawSendTextResult>;
51
- export declare function normalizeWechatClawBaseUrl(value?: string | null): string;
@@ -1,245 +0,0 @@
1
- import { randomInt } from "node:crypto";
2
- import { AppError } from "../../shared/errors/app-error.js";
3
- const WECHAT_CLAW_FIXED_BASE_URL = "https://ilinkai.weixin.qq.com";
4
- const WECHAT_CLAW_BOT_TYPE = "3";
5
- const WECHAT_CLAW_APP_ID = "bot";
6
- const WECHAT_CLAW_APP_CLIENT_VERSION = String(0x00020107);
7
- export async function startWechatClawLogin() {
8
- const payload = await fetchWechatClawJson(`${WECHAT_CLAW_FIXED_BASE_URL}/ilink/bot/get_bot_qrcode?bot_type=${encodeURIComponent(WECHAT_CLAW_BOT_TYPE)}`);
9
- const qrcode = readBodyText(payload, "qrcode");
10
- if (!qrcode) {
11
- throw platformRequestFailed("微信 claw 登录二维码响应缺少 qrcode");
12
- }
13
- return {
14
- sessionKey: qrcode,
15
- qrcode,
16
- qrcodeUrl: readBodyText(payload, "qrcode_img_content"),
17
- status: "waiting_scan"
18
- };
19
- }
20
- export async function pollWechatClawLoginStatus(options) {
21
- const payload = await fetchWechatClawJson(`${normalizeWechatClawBaseUrl(options.authBaseUrl)}/ilink/bot/get_qrcode_status?qrcode=${encodeURIComponent(options.qrcode)}`);
22
- const rawStatus = readBodyText(payload, "status");
23
- switch (rawStatus) {
24
- case "wait":
25
- return createWechatClawPollLoginResult("waiting_scan");
26
- case "scaned":
27
- return createWechatClawPollLoginResult("scan_confirmed");
28
- case "expired":
29
- return createWechatClawPollLoginResult("expired");
30
- case "scaned_but_redirect":
31
- return {
32
- ...createWechatClawPollLoginResult("scan_confirmed"),
33
- redirectHost: readBodyText(payload, "redirect_host")
34
- };
35
- case "confirmed":
36
- return {
37
- status: "active",
38
- botToken: readBodyText(payload, "bot_token"),
39
- baseUrl: readBodyText(payload, "baseurl") ?? normalizeWechatClawBaseUrl(options.authBaseUrl),
40
- remoteBotId: readBodyText(payload, "ilink_bot_id"),
41
- boundUserId: readBodyText(payload, "ilink_user_id"),
42
- redirectHost: null
43
- };
44
- default:
45
- throw platformRequestFailed(`微信 claw 登录状态无法识别:${rawStatus ?? "unknown"}`);
46
- }
47
- }
48
- export async function pollWechatClawMessages(options) {
49
- const payload = ensurePlainObject(await fetchJson(`${normalizeWechatClawBaseUrl(options.baseUrl)}/ilink/bot/getupdates`, {
50
- method: "POST",
51
- headers: buildWechatClawHeaders(options.botToken),
52
- body: JSON.stringify({
53
- base_info: {
54
- channel_version: "2.0.0"
55
- },
56
- get_updates_buf: options.cursor ?? "",
57
- timeout: Math.max(options.timeoutMs ?? 0, 0),
58
- max_items: 50
59
- })
60
- }), "wechat claw getupdates response");
61
- const errorCode = readBodyInteger(payload, "errcode");
62
- if (errorCode === -14) {
63
- throw platformLoginExpired("个人微信(claw)登录已失效,请重新扫码绑定");
64
- }
65
- if (typeof errorCode === "number" && errorCode !== 0) {
66
- throw platformRequestFailed(`微信 claw 拉取消息失败:${readBodyText(payload, "errmsg") ?? `errcode=${errorCode}`}`);
67
- }
68
- const cursor = readBodyText(payload, "get_updates_buf")
69
- ?? readBodyText(payload, "next_cursor")
70
- ?? readBodyText(payload, "sync_buf");
71
- const items = Array.isArray(payload.msgs)
72
- ? payload.msgs
73
- : Array.isArray(payload.messages)
74
- ? payload.messages
75
- : Array.isArray(payload.msg_list)
76
- ? payload.msg_list
77
- : [];
78
- return {
79
- nextCursor: cursor,
80
- longPollingTimeoutMs: readBodyInteger(payload, "longpolling_timeout_ms"),
81
- messages: items
82
- .map((item) => parseWechatClawInboundMessage(item))
83
- .filter((item) => item !== null)
84
- };
85
- }
86
- export async function sendWechatClawText(options) {
87
- const payload = ensurePlainObject(await fetchJson(`${normalizeWechatClawBaseUrl(options.baseUrl)}/ilink/bot/sendmessage`, {
88
- method: "POST",
89
- headers: buildWechatClawHeaders(options.botToken),
90
- body: JSON.stringify({
91
- to_user_id: options.toUserId,
92
- context_token: options.contextToken,
93
- item_list: [
94
- {
95
- type: "text",
96
- text_item: {
97
- text: options.text
98
- }
99
- }
100
- ]
101
- })
102
- }), "wechat claw sendmessage response");
103
- return {
104
- messageRef: readBodyText(payload, "message_id") ?? readBodyText(payload, "msg_id")
105
- };
106
- }
107
- export function normalizeWechatClawBaseUrl(value) {
108
- const normalized = value?.trim();
109
- return normalized && normalized.length > 0 ? normalized : WECHAT_CLAW_FIXED_BASE_URL;
110
- }
111
- function createWechatClawPollLoginResult(status) {
112
- return {
113
- status,
114
- botToken: null,
115
- baseUrl: null,
116
- remoteBotId: null,
117
- boundUserId: null,
118
- redirectHost: null
119
- };
120
- }
121
- function buildWechatClawHeaders(botToken) {
122
- return {
123
- authorization: `Bearer ${botToken}`,
124
- authorizationtype: "ilink_bot_token",
125
- "content-type": "application/json",
126
- "ilink-app-id": WECHAT_CLAW_APP_ID,
127
- "ilink-app-clientversion": WECHAT_CLAW_APP_CLIENT_VERSION,
128
- "x-wechat-uin": Buffer.from(String(randomInt(1, 0xffffffff))).toString("base64")
129
- };
130
- }
131
- function parseWechatClawInboundMessage(value) {
132
- const payload = ensurePlainObject(value, "wechat claw message");
133
- const text = extractWechatClawText(payload);
134
- const fromUserId = readBodyText(payload, "from_user_id");
135
- if (!text || !fromUserId) {
136
- return null;
137
- }
138
- return {
139
- messageId: readBodyText(payload, "message_id")
140
- ?? readBodyText(payload, "msg_id")
141
- ?? `wechat-claw:${Date.now()}:${Math.random().toString(16).slice(2, 10)}`,
142
- fromUserId,
143
- toUserId: readBodyText(payload, "to_user_id"),
144
- text,
145
- timestamp: readBodyText(payload, "timestamp"),
146
- contextToken: readBodyText(payload, "context_token"),
147
- rawPayload: payload
148
- };
149
- }
150
- function extractWechatClawText(payload) {
151
- const itemList = payload.item_list;
152
- if (!Array.isArray(itemList)) {
153
- return null;
154
- }
155
- for (const item of itemList) {
156
- if (!item || typeof item !== "object" || Array.isArray(item)) {
157
- continue;
158
- }
159
- const entry = item;
160
- if (readBodyText(entry, "type") !== "text") {
161
- continue;
162
- }
163
- const textItem = ensurePlainObject(entry.text_item ?? {}, "wechat claw text_item");
164
- const text = readBodyText(textItem, "text");
165
- if (text) {
166
- return text;
167
- }
168
- }
169
- return null;
170
- }
171
- async function fetchWechatClawJson(url) {
172
- return ensurePlainObject(await fetchJson(url), "wechat claw response");
173
- }
174
- async function fetchJson(url, init) {
175
- const response = await fetch(url, init);
176
- const text = await response.text();
177
- const payload = text ? safeJsonParse(text) : null;
178
- if (!response.ok) {
179
- throw new AppError({
180
- statusCode: 502,
181
- errorCode: "CHANNEL_PLATFORM_REQUEST_FAILED",
182
- detail: `请求 ${url} 失败:${response.status} ${response.statusText}`
183
- });
184
- }
185
- return payload;
186
- }
187
- function safeJsonParse(text) {
188
- try {
189
- return JSON.parse(text);
190
- }
191
- catch {
192
- return {
193
- raw: text
194
- };
195
- }
196
- }
197
- function ensurePlainObject(value, field) {
198
- if (!value || typeof value !== "object" || Array.isArray(value)) {
199
- throw platformRequestFailed(`${field} 必须是对象`);
200
- }
201
- return value;
202
- }
203
- function readBodyText(source, key) {
204
- if (!source || typeof source !== "object" || Array.isArray(source)) {
205
- return null;
206
- }
207
- const value = source[key];
208
- if (typeof value === "string") {
209
- const normalized = value.trim();
210
- return normalized.length > 0 ? normalized : null;
211
- }
212
- if (typeof value === "number" && Number.isFinite(value)) {
213
- return String(value);
214
- }
215
- return null;
216
- }
217
- function readBodyInteger(source, key) {
218
- if (!source || typeof source !== "object" || Array.isArray(source)) {
219
- return null;
220
- }
221
- const value = source[key];
222
- if (typeof value === "number" && Number.isFinite(value)) {
223
- return Math.trunc(value);
224
- }
225
- if (typeof value === "string") {
226
- const parsed = Number.parseInt(value.trim(), 10);
227
- return Number.isFinite(parsed) ? parsed : null;
228
- }
229
- return null;
230
- }
231
- function platformRequestFailed(detail) {
232
- return new AppError({
233
- statusCode: 502,
234
- errorCode: "CHANNEL_PLATFORM_REQUEST_FAILED",
235
- detail
236
- });
237
- }
238
- function platformLoginExpired(detail) {
239
- return new AppError({
240
- statusCode: 401,
241
- errorCode: "CHANNEL_PLATFORM_LOGIN_EXPIRED",
242
- detail
243
- });
244
- }
245
- //# sourceMappingURL=wechat-claw-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wechat-claw-client.js","sourceRoot":"","sources":["../../../../src/modules/channels/wechat-claw-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AA6C5D,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AACnE,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,MAAM,8BAA8B,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,MAAM,OAAO,GAAG,MAAM,mBAAmB,CACvC,GAAG,0BAA0B,sCAAsC,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