@oxmumu3/dsh-project-companion 0.44.2 → 0.44.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -2514,4 +2514,4 @@ ${s}`:s)},un=async()=>{tn(!0),Uo(!0),It(""),ne({dockOpen:!0});let t=await Gn();r
2514
2514
  ${t}`:t,po=async(t,s=void 0,u=void 0)=>{if(Be.current)return;let S=t??ma,Z=s??(t===void 0?tr:st);if(!S.trim()){A("\u5148\u5199\u4E00\u53E5\u4F60\u5E0C\u671B Dot \u5E2E\u5FD9\u7684\u4E8B\u3002");return}let ae=u??Me,ie=qa(Z?.id),ct=he,Ye=ct?.sessionId??null;if(!Ye&&typeof r.sessions?.create!="function"){A("\u539F\u751F\u4F1A\u8BDD\u5165\u53E3\u5C1A\u672A\u5C31\u7EEA\uFF0C\u8BF7\u5728 Harness \u65B0\u5EFA\u4E00\u4E2A\u672C\u5730\u4F1A\u8BDD\u7EE7\u7EED\u3002\u8F93\u5165\u5DF2\u4FDD\u7559\u3002");return}B(""),A(""),we(!0),Be.current=!0;let Ct=new AbortController;ea.current.add(Ct);let sa=null;try{if(!Ye){if(Ye=await r.sessions.create({}),!Wt(Ye)||Ye.startsWith("family_"))throw new Error("\u539F\u751F\u4F1A\u8BDD\u521B\u5EFA\u672A\u5B8C\u6210\uFF0C\u8F93\u5165\u5DF2\u4FDD\u7559\u3002");let va={sessionId:Ye,revision:`native:${Ye}`};re.localConversation=va,L.current&&He(va);let xn=await i.remember(Ye);L.current&&!xn&&A("\u672C\u6B21\u4F1A\u8BDD\u5DF2\u521B\u5EFA\uFF1B\u5165\u53E3\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u4ECE\u539F\u751F\u5386\u53F2\u7EE7\u7EED\u3002")}let Rt=i.getSnapshot();if(Rt.owner===null)sa=Symbol("main-draft-handoff"),await i.acquire(sa,{sessionId:Ye,revision:ct?.revision??`native:${Ye}`});else if(Rt.sessionId!==Ye)throw new Error("\u539F\u751F\u5BF9\u8BDD\u6B63\u5728\u5207\u6362\uFF0C\u8F93\u5165\u4ECD\u5DF2\u4FDD\u7559\u3002");let Ua=await $e(r,Ye,nr(S,Z),Ct.signal,async()=>{let va=await pa(te);if(!L.current||ie.binding!==$t(va)||ct&&re.localConversation?.sessionId!==Ye||Z&&!va.projects?.some(xn=>xn.id===Z.id))throw new Error("\u539F\u5FAE\u4FE1\u7ED1\u5B9A\u6216\u9879\u76EE\u8303\u56F4\u5DF2\u53D8\u5316\uFF0C\u672A\u653E\u5165\u539F\u751F\u8349\u7A3F\u3002\u8BF7\u5237\u65B0\u540E\u91CD\u65B0\u6838\u5BF9\uFF1B\u8F93\u5165\u4ECD\u4FDD\u7559\u3002")},()=>{if(!(t!==void 0&&u===void 0||re.draft!==S||re.selected!==ae||re.binding!==ie.binding))return re.draft="",L.current&&ka(""),()=>{re.draft===""&&re.selected===ae&&re.binding===ie.binding&&(re.draft=S,L.current&&ka(S))}},typeof x.SessionProvider=="function"&&typeof x.renderSlot=="function");L.current&&ie.binding===$t(Dt.current)&&Ua.status==="preserved"&&A("Dot \u4F1A\u8BDD\u91CC\u5DF2\u6709\u8349\u7A3F\uFF0C\u5DF2\u4E3A\u4F60\u4FDD\u7559\u3002\u8BF7\u5148\u6253\u5F00\u4F1A\u8BDD\u5904\u7406\uFF1B\u8FD9\u91CC\u7684\u65B0\u95EE\u9898\u4E5F\u4FDD\u7559\u7740\u3002")}catch(Rt){L.current&&B(Rt.message||"\u539F\u751F\u8349\u7A3F\u672A\u80FD\u51C6\u5907\uFF0C\u8BF7\u6253\u5F00 Dot \u4F1A\u8BDD\u6838\u5BF9\u3002")}finally{sa&&i.release(sa),Be.current=!1,ea.current.delete(Ct),L.current&&we(!1)}},aa=(t,s=Me)=>{if(!Be.current){if(ma.trim()&&ma!==t){A("\u5DF2\u4FDD\u7559\u4F60\u5C1A\u672A\u53D1\u9001\u7684\u8349\u7A3F\u3002\u8BF7\u5148\u5904\u7406\u5F53\u524D\u5185\u5BB9\u3002");return}if(mn){ba(()=>{jo(t),so(s??""),Ze("home"),po(t,St.find(u=>u.id===s),s??"").then(()=>{ye.current?.scrollIntoView?.({block:"nearest"});let u=re.localConversation;u&&i.focus(u)})});return}ba(()=>{jo(t),so(s??""),Ze("home"),A("\u95EE\u9898\u5DF2\u653E\u5165\u8349\u7A3F\u3002\u70B9\u51FB\u201C\u5F00\u59CB\u5BF9\u8BDD\u201D\u5E26\u5165\u539F\u751F\u4F1A\u8BDD\u540E\uFF0C\u7531\u4F60\u53D1\u9001\u3002")})}},sr=[["\u7ED3\u5408\u8D44\u6599\u6392\u4E0B\u4E00\u6B65","\u8BF7\u7ED3\u5408\u6211\u6307\u5B9A\u7684\u4E2A\u4EBA\u8D44\u6599\u548C\u8FD9\u4E2A\u9879\u76EE\uFF0C\u6574\u7406\u4E00\u4EFD\u5E26\u6765\u6E90\u7684\u7B80\u62A5\uFF0C\u5217\u51FA\u503C\u5F97\u63A8\u8FDB\u7684\u51E0\u4EF6\u4E8B\u3002\u6839\u636E\u6211\u5DF2\u6709\u7684\u8BF4\u660E\u786E\u5B9A\u8303\u56F4\uFF1B\u786E\u5B9E\u7F3A\u5C11\u76EE\u6807\u6216\u8D44\u6599\u8303\u56F4\u65F6\uFF0C\u53EA\u95EE\u7F3A\u5C11\u7684\u90E8\u5206\u3002\u6682\u4E0D\u4EA4\u529E\u3001\u4E0D\u8BBE\u7F6E\u8DDF\u8FDB\u3002"],["\u770B\u770B\u9879\u76EE\u8FDB\u5C55","\u8BF7\u53EA\u8BFB\u770B\u770B\u8FD9\u4E2A\u9879\u76EE\u7684\u6700\u65B0\u8FDB\u5C55\u3001\u963B\u585E\u548C\u4E0B\u4E00\u6B65\u3002"],["\u4EA4\u4EE3\u4E00\u4EF6\u4E8B","\u8BF7\u5E2E\u6211\u5904\u7406\u8FD9\u4E2A\u9879\u76EE\u7684\u4E00\u4EF6\u4E8B\uFF1A"],["\u5B89\u6392\u4E00\u4E2A\u63D0\u9192","\u8BF7\u63D0\u9192\u6211\uFF1A"]],uo=async(t=st,s=!1)=>{if(!t||Be.current)return;if(Eo&&!s){ba(()=>{uo(t,!0)});return}$o();let u=qa(t.id),S=++vt.current;ta.current=u,D(t.id),fa(null),Xa(!1),Et("follow"),Xe(!1),Qt.current=!1;let Z=re.follow.get(Ba(u)),ae=Z??{mode:"once",time:"",cadence:60};Cn(ae.mode),An(ae.time),In(ae.cadence),rn.current=JSON.stringify({mode:"once",time:"",cadence:60});let ie=await Ga({action:"followup_status",projectId:t.id},u,S);ie&&vt.current===S&&ie.projectId===t.id&&fa(ie)},rr=async()=>{let t=ta.current,s=vt.current;if(!t?.projectId||!ia||!Bo||Be.current)return;let u;if(la==="repeat")u={action:"followup_configure",projectId:t.projectId,everyMinutes:Number(Ya),userRequested:!0};else{let ie=new Date(Na);if(!Na||!Number.isFinite(ie.getTime())||ie<=new Date||ie.getTime()>Date.now()+7*864e5){B("\u8BF7\u9009\u62E9\u672A\u6765\u4E03\u5929\u5185\u7684\u68C0\u67E5\u65F6\u95F4\u3002");return}u={action:"check_once",projectId:t.projectId,dueAt:ie.toISOString(),userRequested:!0}}Qt.current=!0;let S=await Ga(u,t,s);Qt.current=!1;let Z=S?.[la==="repeat"?"followup":"once"];S?.projectId===t.projectId&&Z?.enabled===!0&&(la==="repeat"?Z.everyMinutes===Number(Ya):Z.status==="queued"&&Date.parse(Z.nextDueAt)===Date.parse(u.dueAt))?(re.follow.delete(Ba(t)),vt.current===s&&(fa(ie=>({...ie,...S})),Xa(!1),rn.current=JSON.stringify(fn())),A(`\u5DF2\u4E3A\u300C${t.projectLabel}\u300D\u4FDD\u5B58\u8DDF\u8FDB\u5B89\u6392\u3002\u6CA1\u6709\u5B9E\u8D28\u53D8\u5316\u65F6\u4FDD\u6301\u5B89\u9759\uFF1B\u7535\u8111\u4E0E Harness \u9700\u5728\u7EBF\u3002`),Vt()):S&&(A(`\u300C${t.projectLabel}\u300D\u7684\u5B89\u6392\u7ED3\u679C\u9700\u6838\u5BF9\uFF0C\u5C1A\u672A\u786E\u8BA4\u4FDD\u5B58\u3002\u8BF7\u67E5\u770B\u5F53\u524D\u5B89\u6392\uFF1B\u6CA1\u6709\u81EA\u52A8\u91CD\u8BD5\u3002`),vt.current===s&&Xa(!1),Vt())},ir=async t=>{let s=ta.current,u=vt.current;if(!s?.projectId||Be.current)return;Qt.current=!0;let S=await Ga({action:t==="once"?"cancel_once":"followup_cancel",projectId:s.projectId,userRequested:!0},s,u);Qt.current=!1,S&&S.projectId===s.projectId&&S[t==="once"?"once":"followup"]?.enabled===!1?(vt.current===u&&fa(Z=>({...Z,...S})),A(`\u5DF2\u5173\u95ED\u300C${s.projectLabel}\u300D\u7684\u8FD9\u9879\u8DDF\u8FDB\u3002`),Vt()):S&&(A(`\u300C${s.projectLabel}\u300D\u7684\u5173\u95ED\u7ED3\u679C\u9700\u6838\u5BF9\uFF0C\u8BF7\u67E5\u8BE2\u5F53\u524D\u5B89\u6392\uFF1B\u6CA1\u6709\u81EA\u52A8\u91CD\u8BD5\u3002`),Vt())},lr=async t=>{if(Be.current)return;$o();let s=++vt.current,u=qa(void 0,t.id);ta.current=u,Dn(null),Et("task"),Xe(!1);let S=await Ga({action:"task_detail",id:t.id},u,s);S&&vt.current===s&&Array.isArray(S.jobs)&&S.jobs.every(Z=>Z.id===t.id)&&Dn(S)},Un=t=>{if(t.source.kind==="file")return t.source.reference;let s=t.source.reference.startsWith("session:")?t.source.reference.slice(8).split("#")[0]:null,u=s&&J?.[s]?.displayTitle;return typeof u=="string"&&u.trim()?`\u6765\u6E90\u4F1A\u8BDD\uFF1A${u.slice(0,120)}`:"\u6765\u6E90\uFF1A\u9879\u76EE\u4F1A\u8BDD\u8BB0\u5F55"},hn=t=>t?.overview?.available===!0&&["goals","blockers","nextSteps","recent"].every(s=>Array.isArray(t.overview[s])&&t.overview[s].length<=4&&t.overview[s].every(u=>u&&Wt(u.id)&&typeof u.text=="string"&&u.source&&["user","assistant","file"].includes(u.source.kind)&&typeof u.source.reference=="string"&&u.verified===!1)),cr=t=>hn(t)?[...new Map([...t.overview.goals,...t.overview.blockers,...t.overview.nextSteps,...t.overview.recent].map(s=>[s.id,s])).values()]:[],bn=st?.overview,Qn=hn(st),Zn=cr(st),Jn=async(t,s=st,u=!1)=>{if(!s||Be.current)return;if(Eo&&!u){ba(()=>{Jn(t,s,!0)});return}$o();let S=++vt.current,Z=qa(s.id,t.id);ta.current=Z,D(s.id),Go(null),xo(""),eo(null),wo(!1),Xe(!1),Et("memory"),Qt.current=!1;let ae=await Ga({action:"memory_detail",projectId:s.id,id:t.id},Z,S);if(!ae||vt.current!==S)return;if(ae.editable===!1||ae.redacted===!0){B("\u8FD9\u6761\u8BB0\u5FC6\u542B\u6709\u9690\u85CF\u5185\u5BB9\uFF0C\u8BF7\u5728 Dot \u4F1A\u8BDD\u4E2D\u6309\u539F\u59CB\u5185\u5BB9\u7EA0\u6B63\u6216\u5FD8\u8BB0\uFF1B\u672A\u5C06\u9690\u85CF\u540E\u7684\u526F\u672C\u4F5C\u4E3A\u7F16\u8F91\u539F\u6587\u3002");return}let ie=ae.record;if(ae.projectId!==s.id||!ie||ie.id!==t.id||typeof ie.text!="string"||!ie.text.trim()||Array.from(ie.text).length>2e3||!ie.source||!["user","assistant","file"].includes(ie.source.kind)||typeof ie.source.reference!="string"){B("\u5B8C\u6574\u8BB0\u5FC6\u6682\u4E0D\u53EF\u7528\uFF0C\u672A\u52A0\u8F7D\u9884\u89C8\u7247\u6BB5\u4F5C\u4E3A\u7F16\u8F91\u5185\u5BB9\u3002");return}let ct=re.memory.get(Ba(Z));Go(ie),xo(ct?.original===ie.text?ct.text:ie.text),ct&&ct.original!==ie.text&&(eo(ct.text),A("\u8FD9\u6761\u8BB0\u5FC6\u7684\u539F\u6587\u5DF2\u53D8\u5316\uFF0C\u65E7\u8349\u7A3F\u672A\u5957\u7528\u3002\u4F60\u53EF\u4EE5\u5C55\u5F00\u4FDD\u7559\u7684\u8349\u7A3F\uFF0C\u4E0E\u5F53\u524D\u539F\u6587\u6838\u5BF9\u540E\u7EE7\u7EED\u4FEE\u6539\u3002"))},Yn=(t,s=st)=>a("div",{className:"pc_dot_source",key:t.id},a("p",{className:"pc_dot_excerpt"},t.text),a("p",{className:"pc_dot_muted"},`${t.source.kind==="user"?"\u7528\u6237\u8BB0\u5F55":t.source.kind==="assistant"?"\u52A9\u624B\u8BB0\u5F55 \xB7 AI \u5F52\u7EB3":"\u6587\u4EF6\u8BB0\u5F55"} \xB7 ${ht(t.at)} \xB7 \u672A\u72EC\u7ACB\u6838\u9A8C`),a("small",{className:"pc_dot_muted"},Un(t)),a("div",{className:"pc_dot_actions"},mt?null:ce("\u7EA0\u6B63\u6216\u5FD8\u8BB0",()=>Jn(t,s),{disabled:Ee||!ha}),ce("\u67E5\u770B\u6765\u6E90",()=>co(s.id,"sources")))),yn=(t,s,u)=>Tt(t,s?.length?s.map(S=>Yn(S)):a("p",{className:"pc_dot_muted"},u)),Xn=async t=>{let s=ta.current,u=vt.current;if(!s?.projectId||!Yt||s.id!==Yt.id||Be.current)return;Qt.current=!0;let S=await Ga({action:t?"memory_forget":"memory_update",projectId:s.projectId,id:s.id,...t?{}:{text:Sa.trim()},userRequested:!0},s,u);Qt.current=!1,S&&S.projectId===s.projectId&&S.id===s.id&&(t?S.forgotten===!0:S.updated===!0)?(re.memory.delete(Ba(s)),vt.current===u&&(Et("project"),wa("memory"),Xe(!1)),A(t?`\u5DF2\u5FD8\u8BB0\u300C${s.projectLabel}\u300D\u7684\u8FD9\u6761\u9879\u76EE\u8BB0\u5FC6\u3002`:`\u5DF2\u8BB0\u4F4F\u4F60\u5BF9\u300C${s.projectLabel}\u300D\u7684\u7EA0\u6B63\u3002`),await Vt()):S&&vt.current===u&&B("\u4FDD\u5B58\u56DE\u6267\u4E0E\u8FD9\u6761\u8BB0\u5FC6\u4E0D\u4E00\u81F4\uFF0C\u672A\u786E\u8BA4\u6210\u529F\u3002\u8BF7\u5237\u65B0\u72B6\u6001\u6838\u5BF9\uFF0C\u672A\u81EA\u52A8\u91CD\u8BD5\u3002")},dr=t=>t.sessionIds.map((s,u)=>{let S=J?.[s],Z=typeof S?.displayTitle=="string"&&S.displayTitle.trim()?S.displayTitle.slice(0,120):`\u4F1A\u8BDD ${u+1}`;return ce(a("span",null,Z,a("small",{style:{display:"block"},className:"pc_dot_muted"},S?.displayTitle?S.running===!0?"\u6B63\u5728\u8FD0\u884C":S.running===!1?"\u5F53\u524D\u65E0\u8FD0\u884C\u4EFB\u52A1":"\u8FD0\u884C\u72B6\u6001\u5F85\u786E\u8BA4":"\u6807\u9898\u5C1A\u672A\u52A0\u8F7D \xB7 \u72B6\u6001\u5F85\u786E\u8BA4")),()=>Pt(s),{key:s})}),pr=()=>st?a("article",{"data-dot-project":st.id},a("div",{className:"pc_dot_drawer_tabs"},...[["summary","\u6982\u51B5"],["memory","\u8BB0\u4F4F\u7684\u4E8B"],["sources","\u6765\u6E90\u4E0E\u8BB0\u5F55"]].map(([t,s])=>ce(s,()=>wa(t),{"aria-pressed":Ra===t,className:Ra===t?"active":""}))),Ra==="summary"?a("div",null,Qn?a("div",{"data-dot-overview":!0},yn("\u9879\u76EE\u76EE\u6807",bn.goals,"\u5C1A\u672A\u8BB0\u5F55\u9879\u76EE\u76EE\u6807\u3002\u53EF\u4EE5\u5728 Dot \u4F1A\u8BDD\u91CC\u544A\u8BC9\u6211\u4F60\u60F3\u8FBE\u6210\u4EC0\u4E48\u3002"),yn("\u5DF2\u8BB0\u5F55\u7684\u963B\u585E",bn.blockers,"\u5C1A\u672A\u8BB0\u5F55\u963B\u585E\uFF1B\u8FD9\u4E0D\u4EE3\u8868\u5F53\u524D\u6CA1\u6709\u963B\u585E\u3002"),yn("\u5DF2\u8BB0\u5F55\u7684\u4E0B\u4E00\u6B65",bn.nextSteps,"\u5C1A\u672A\u8BB0\u5F55\u4E0B\u4E00\u6B65\u3002")):Tt("\u9879\u76EE\u8BB0\u5FC6",a("p",{className:"pc_dot_muted"},"\u9879\u76EE\u8BB0\u5FC6\u6682\u4E0D\u53EF\u7528\u3002\u53EF\u5728\u6765\u6E90\u4E2D\u6838\u5BF9\u539F\u59CB\u8D44\u6599\u3002")),Tt("\u63A5\u4E0B\u6765\u53EF\u4EE5\u505A\u4EC0\u4E48",a("div",{className:"pc_dot_actions"},mt?a("p",{className:"pc_dot_muted"},"\u5728\u539F\u5FAE\u4FE1\u7EE7\u7EED\u4EA4\u4EE3\uFF0C\u8FD9\u91CC\u4FDD\u7559\u9879\u76EE\u80CC\u666F\u3001\u7ED3\u679C\u548C\u540E\u7EED\u5B89\u6392\u3002"):ce("\u548C Dot \u804A\u8FD9\u4E2A\u9879\u76EE",()=>po("\u8BF7\u7ED3\u5408\u8FD9\u4E2A\u9879\u76EE\u7684\u6700\u65B0\u8D44\u6599\uFF0C\u544A\u8BC9\u6211\u4E0B\u4E00\u6B65\u5148\u505A\u4EC0\u4E48\u3002"),{className:"pc_dot_primary"}),ce("\u67E5\u770B\u6216\u5B89\u6392\u8DDF\u8FDB",()=>uo(st)))),Tt("\u9879\u76EE\u4F1A\u8BDD",st.sessionIds.length===1?ce("\u6253\u5F00\u9879\u76EE\u4F1A\u8BDD",()=>Pt(st.sessionIds[0])):st.sessionIds.length?a("div",null,a("p",null,"\u9009\u62E9\u4F1A\u8BDD"),a("div",{className:"pc_dot_actions"},dr(st))):a("p",{className:"pc_dot_muted"},"\u6682\u65E0\u53EF\u6253\u5F00\u7684\u9879\u76EE\u4F1A\u8BDD\u3002"))):Ra==="memory"?a("div",null,Tt("\u4F60\u544A\u8BC9 Dot \u7684\u4E8B",Qn?Zn.length?Zn.map(t=>Yn(t)):a("p",{className:"pc_dot_muted"},"\u5C1A\u672A\u8BB0\u5F55\u9879\u76EE\u8BB0\u5FC6\u3002"):a("p",{className:"pc_dot_muted"},"\u9879\u76EE\u8BB0\u5FC6\u6682\u4E0D\u53EF\u7528\u3002")),mt?a("p",{className:"pc_dot_muted"},"\u5171\u4EAB\u5FAE\u4FE1\u5165\u53E3\u7684\u8BB0\u5FC6\u53EF\u67E5\u770B\uFF1B\u672C\u89C6\u56FE\u6682\u4E0D\u5F00\u653E\u8BB0\u5FC6\u589E\u6539\u3002"):ce("\u544A\u8BC9 Dot \u8981\u8BB0\u4F4F\u4EC0\u4E48",()=>po("\u8BF7\u8BB0\u4F4F\u8FD9\u4E2A\u9879\u76EE\u7684\u4E00\u70B9\u80CC\u666F\uFF1A"))):a("details",{className:"pc_dot_section",open:!0},a("summary",null,"\u539F\u59CB\u8D44\u6599\u4E0E\u5BF9\u8BDD"),Tt("\u9879\u76EE\u8D44\u6599",st.sources.length?st.sources.map(t=>a("div",{className:"pc_dot_source",key:t.name},a("strong",null,t.name),a("p",{className:"pc_dot_muted"},t.status==="ok"?ht(t.updatedAt??t.modifiedAt):t.status==="missing"?"\u5C1A\u672A\u63D0\u4F9B":"\u6682\u4E0D\u53EF\u8BFB\u53D6"),t.status==="ok"?a("pre",null,t.text):null,t.truncated?a("p",{className:"pc_dot_muted"},"\u6765\u6E90\u5185\u5BB9\u8F83\u957F\uFF0C\u5DF2\u622A\u53D6\uFF1B\u6B64\u5904\u672A\u5C55\u793A\u5B8C\u6574\u6587\u4EF6\u3002"):null)):a("p",null,"\u6682\u65E0\u9879\u76EE\u8D44\u6599\u3002")),Tt("\u6700\u8FD1\u5BF9\u8BDD",st.events.length?st.events.slice().reverse().map((t,s)=>a("div",{className:"pc_dot_source",key:s},a("p",{className:"pc_dot_muted"},`${st.label} \xB7 ${t.kind==="user"?"\u7528\u6237\u4EA4\u4EE3":t.kind==="assistant"?"\u52A9\u624B\u56DE\u590D":"\u8FD0\u884C\u8BB0\u5F55"} \xB7 ${ht(t.at)}`),a("p",{className:"pc_dot_excerpt"},t.text),t.truncated?a("p",{className:"pc_dot_muted"},"\u5BF9\u8BDD\u7247\u6BB5\u5DF2\u622A\u53D6\uFF0C\u8BF7\u6253\u5F00\u539F\u59CB\u9879\u76EE\u4F1A\u8BDD\u67E5\u770B\u5B8C\u6574\u5185\u5BB9\u3002"):null)):a("p",null,"\u542F\u7528\u540E\u5C1A\u672A\u89C2\u5BDF\u5230\u65B0\u5BF9\u8BDD\u3002")))):null,ur=()=>a("div",null,a("p",{className:"pc_dot_muted"},`\u53EA\u8BFB\u68C0\u67E5\u300C${st?.label??"\u6240\u9009\u9879\u76EE"}\u300D\uFF0C\u6709\u5B9E\u8D28\u53D8\u5316\u624D\u901A\u8FC7\u539F\u5FAE\u4FE1\u4F1A\u8BDD\u544A\u8BC9\u4F60\u3002\u7535\u8111\u4E0E Harness \u9700\u5728\u7EBF\u3002`),ia?a("div",null,...[["followup","\u6301\u7EED\u8DDF\u8FDB"],["once","\u5355\u6B21\u68C0\u67E5"]].map(([t,s])=>{let u=ia[t];return a("div",{className:"pc_dot_source",key:t},a("strong",null,s),a("p",null,u?.enabled?`${t==="followup"?Bn(u):"\u53EA\u68C0\u67E5\u4E00\u6B21"} \xB7 ${u.nextDueAt?`\u4E0B\u6B21 ${ht(u.nextDueAt)}`:"\u4E0B\u6B21\u65F6\u95F4\u5F85\u6838\u5BF9"}`:"\u5F53\u524D\u672A\u5F00\u542F"),u?.blocked?a("p",{className:"pc_dot_muted"},"\u5F53\u524D\u672A\u8FD0\u884C\uFF0C\u8BF7\u6838\u5BF9\u539F\u5FAE\u4FE1\u8FDE\u63A5\u3002"):u?.enabled&&u.running===!1?a("p",{className:"pc_dot_muted"},t==="once"?"\u7B49\u5F85\u5230\u671F\u68C0\u67E5\u3002":"\u5B89\u6392\u5DF2\u4FDD\u5B58\uFF0C\u8FD0\u884C\u5668\u672A\u542F\u52A8\uFF1B\u8BF7\u6838\u5BF9 Harness \u4E2D\u7684\u8DDF\u8FDB\u72B6\u6001\u3002"):null,u?.enabled&&!mt?ce("\u5173\u95ED\u8FD9\u9879\u8DDF\u8FDB",()=>ir(t)):null)}),mt?a("p",{className:"pc_dot_muted"},"\u8BF7\u5728\u539F\u5FAE\u4FE1\u5B89\u6392\u3001\u8C03\u6574\u6216\u53D6\u6D88\u8DDF\u8FDB\uFF1B\u8FD9\u91CC\u67E5\u770B\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\u3002"):a("div",{className:"pc_dot_source"},a("h3",null,Bo?"\u6838\u5BF9\u8FD9\u6B21\u5B89\u6392":"\u5B89\u6392\u4E0B\u4E00\u6B21"),Bo?a("div",null,a("p",null,`\u9879\u76EE\uFF1A${st?.label}`),a("p",null,la==="repeat"?`\u9891\u7387\uFF1A\u6BCF ${Ya} \u5206\u949F\uFF0C\u53EA\u8BFB\u68C0\u67E5`:`\u65F6\u95F4\uFF1A${Na.replace("T"," ")}\uFF08\u672C\u673A\u6D4F\u89C8\u5668\u65F6\u533A\uFF1A${Intl.DateTimeFormat().resolvedOptions().timeZone}\uFF09`),a("p",null,"\u901A\u77E5\uFF1A\u539F\u5FAE\u4FE1\u4F1A\u8BDD\uFF1B\u6CA1\u6709\u5B9E\u8D28\u53D8\u5316\u65F6\u4FDD\u6301\u5B89\u9759\u3002"),a("div",{className:"pc_dot_actions"},ce("\u786E\u8BA4\u8DDF\u8FDB",rr,{className:"pc_dot_primary",disabled:Ee||!ha}),ce("\u8FD4\u56DE\u4FEE\u6539",()=>Xa(!1)))):a("div",null,a("label",null,"\u65B9\u5F0F",a("select",{value:la,disabled:Ee,onChange:t=>{Be.current||Cn(t.target.value)}},a("option",{value:"once"},"\u5728\u6307\u5B9A\u65F6\u95F4\u770B\u4E00\u6B21"),a("option",{value:"repeat"},"\u6309\u95F4\u9694\u6301\u7EED\u8DDF\u8FDB"))),la==="once"?a("label",null,"\u68C0\u67E5\u65F6\u95F4",a("input",{type:"datetime-local",value:Na,disabled:Ee,onChange:t=>{Be.current||An(t.target.value)}})):a("label",null,"\u6BCF\u9694",a("select",{value:Ya,disabled:Ee,onChange:t=>{Be.current||In(Number(t.target.value))}},...[30,60,180,360,1440].map(t=>a("option",{value:t,key:t},t===1440?"\u4E00\u5929":`${t} \u5206\u949F`)))),a("p",{className:"pc_dot_muted"},"\u5355\u6B21\u53EF\u5B89\u6392\u672A\u6765\u4E03\u5929\u5185\u7684\u68C0\u67E5\u3002\u5468\u671F\u8DDF\u8FDB\u9075\u5B88\u514D\u6253\u6270\u65F6\u6BB5\u548C\u6D88\u606F\u9884\u7B97\uFF1B\u63D0\u4EA4\u4F1A\u66F4\u65B0\u8FD9\u4E2A\u9879\u76EE\u540C\u7C7B\u578B\u7684\u5B89\u6392\u3002"),ce("\u6838\u5BF9\u5B89\u6392",()=>{if(la==="once"&&!Na){B("\u8BF7\u9009\u62E9\u68C0\u67E5\u65F6\u95F4\u3002");return}if(la==="once"){let t=new Date(Na);if(!Number.isFinite(t.getTime())||t<=new Date||t.getTime()>Date.now()+7*864e5){B("\u8BF7\u9009\u62E9\u672A\u6765\u4E03\u5929\u5185\u7684\u68C0\u67E5\u65F6\u95F4\u3002");return}}B(""),Xa(!0)},{className:"pc_dot_primary",disabled:Ee||!ha})))):a("p",{role:"status"},ke?"\u5F53\u524D\u5B89\u6392\u5C1A\u672A\u786E\u8BA4\uFF1B\u8BF7\u91CD\u65B0\u67E5\u8BE2\u3002":"\u6B63\u5728\u67E5\u8BE2\u5F53\u524D\u5B89\u6392\u2026"),ce("\u5237\u65B0\u5B89\u6392",()=>uo(st))),mr=()=>{let t=Array.isArray(qo?.jobs)?qo.jobs:[];return a("div",null,qo?t.length?t.map(s=>a("article",{key:s.id},a("h3",null,s.projectLabel),a("p",null,s.task),a("p",{className:"pc_dot_muted"},`\u6267\u884C\uFF1A${Wn[s.status]??"\u72B6\u6001\u5F85\u786E\u8BA4"} \xB7 ${ht(s.finishedAt??s.createdAt)}`),a("p",{className:"pc_dot_muted"},`\u56DE\u4F20\uFF1A${Vn[s.delivery?.status]??"\u5C1A\u65E0\u53D1\u9001\u56DE\u6267"}`),a("pre",null,s.reply??s.text??"\u672C\u8F6E\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u6587\u672C\u56DE\u590D\u3002"),s.replyTruncated?a("p",{className:"pc_dot_muted"},"\u672C\u6B21\u56DE\u590D\u5DF2\u622A\u53D6\uFF0C\u8BF7\u6253\u5F00\u4F1A\u8BDD\u770B\u5B8C\u6574\u5185\u5BB9\u3002"):null,a("p",{className:"pc_dot_muted"},"\u6765\u6E90\uFF1A\u8FD9\u6B21\u4EA4\u529E\u7684\u539F\u59CB\u56DE\u590D\uFF1B\u4ECD\u9700\u6838\u5BF9\u5185\u5BB9\u4E0E\u5B9E\u9645\u6210\u679C\u3002"),ce("\u6253\u5F00 Dot \u4F1A\u8BDD",()=>Pt(ge?.connection.sessionId)))):a("p",null,"\u6CA1\u6709\u8FD9\u6B21\u4EA4\u529E\u7684\u53EF\u7528\u8BE6\u60C5\u3002"):a("p",{role:"status"},ke?"\u6267\u884C\u56DE\u590D\u6682\u4E0D\u53EF\u7528\u3002":"\u6B63\u5728\u8BFB\u53D6\u672C\u6B21\u56DE\u590D\u2026"))},fr=()=>Yt?a("div",null,a("p",{className:"pc_dot_muted"},`\u53EA\u4FEE\u6539\u300C${st?.label}\u300D\u7684\u8FD9\u6761\u9879\u76EE\u8BB0\u5FC6\u3002\u7EA0\u6B63\u4F1A\u8BB0\u5F55\u4E3A\u4F60\u7684\u672C\u6B21\u8BF4\u660E\uFF0C\u5E76\u4FDD\u7559\u539F\u6765\u6E90\u8EAB\u4EFD\u3002`),a("p",{className:"pc_dot_muted"},`${Un(Yt)} \xB7 ${ht(Yt.at)} \xB7 \u672A\u72EC\u7ACB\u6838\u9A8C`),Ps?a("div",null,a("p",null,"\u786E\u8BA4\u8BA9 Dot \u5FD8\u8BB0\u8FD9\u6761\u8BB0\u5FC6\uFF1F\u539F\u59CB\u9879\u76EE\u6587\u4EF6\u4E0D\u4F1A\u88AB\u4FEE\u6539\u3002"),a("div",{className:"pc_dot_actions"},ce("\u786E\u8BA4\u5FD8\u8BB0",()=>Xn(!0),{className:"pc_dot_primary"}),ce("\u8FD4\u56DE",()=>wo(!1)))):a("div",null,a("label",null,"\u8BB0\u5FC6\u5185\u5BB9",a("textarea",{"aria-label":"\u7EA0\u6B63\u9879\u76EE\u8BB0\u5FC6",maxLength:4e3,value:Sa,disabled:Ee,onChange:t=>{Be.current||xo(t.target.value)}})),a("div",{className:"pc_dot_actions"},ce("\u4FDD\u5B58\u7EA0\u6B63",()=>Xn(!1),{className:"pc_dot_primary",disabled:Ee||!Sa.trim()||Sa===Yt.text||Array.from(Sa.trim()).length>2e3}),ce("\u5FD8\u8BB0\u8FD9\u6761",()=>wo(!0))),a("p",{className:"pc_dot_muted"},"\u4E0D\u4F1A\u6539\u5199\u539F\u59CB\u5BF9\u8BDD\u3001\u9879\u76EE\u6587\u4EF6\u6216\u5176\u4ED6\u9879\u76EE\u7684\u8BB0\u5FC6\u3002"),Ho?a("details",{"data-dot-conflict-draft":!0},a("summary",null,"\u67E5\u770B\u4FDD\u7559\u7684\u65E7\u8349\u7A3F"),a("p",{className:"pc_dot_muted"},"\u5F53\u524D\u539F\u6587\u5DF2\u6709\u66F4\u65B0\u3002\u4F7F\u7528\u8349\u7A3F\u53EA\u4F1A\u653E\u5165\u7F16\u8F91\u5668\uFF0C\u8BF7\u7ED3\u5408\u4E0A\u65B9\u539F\u6587\u6838\u5BF9\u540E\u518D\u4FDD\u5B58\u3002"),a("pre",null,Ho),ce("\u4F7F\u7528\u4FDD\u7559\u8349\u7A3F\u7EE7\u7EED\u4FEE\u6539",()=>{xo(Ho),eo(null)}),ce("\u653E\u5F03\u8FD9\u4EFD\u65E7\u8349\u7A3F",()=>{re.memory.delete(Ba(ta.current)),eo(null)})):null)):a("p",{role:"status"},ke?"\u5B8C\u6574\u8BB0\u5FC6\u5C1A\u672A\u8BFB\u53D6\uFF0C\u672A\u5F00\u653E\u7F16\u8F91\u3002":"\u6B63\u5728\u8BFB\u53D6\u5B8C\u6574\u8BB0\u5FC6\u2026"),gr=t=>{let s=St.filter(u=>u.label===t.projectLabel);if(s.length!==1){A("\u8FD9\u6B21\u4EA4\u529E\u7684\u9879\u76EE\u8303\u56F4\u9700\u8981\u4F60\u6838\u5BF9\uFF0C\u8BF7\u5148\u5728\u5173\u6CE8\u7684\u9879\u76EE\u4E2D\u9009\u62E9\u5BF9\u5E94\u9879\u76EE\u3002"),lo("projects");return}aa(`\u5173\u4E8E\u300C${t.projectLabel}\u300D\u8FD9\u6B21\u4EA4\u529E\uFF1A${t.task}
2515
2515
  \u4EA4\u529E\u8BB0\u5F55 ID\uFF1A${t.id}\u3002\u8BF7\u5148\u8BFB\u53D6\u8FD9\u6B21\u5DF2\u6709\u4EA4\u529E\u7ED3\u679C\uFF0C\u4E0D\u91CD\u65B0\u63D0\u4EA4\u6216\u91CD\u505A\u4EFB\u52A1\uFF0C\u518D\u89E3\u91CA\u672C\u6B21\u7ED3\u679C\u548C\u8FD8\u9700\u8981\u6211\u51B3\u5B9A\u7684\u4E8B\u3002`,s[0].id)},vn=[...Hn].reverse().sort((t,s)=>Date.parse(s.createdAt)-Date.parse(t.createdAt)),Ce=ge?.personalReview?.available===!0?ge.personalReview:null,oa=Ce?.review?.schedule,Wa=Ce?.review?.health,hr=async()=>{if(!L.current||Be.current||!Ce?.deliverySupported||!oa)return;let t=Ce.bindingRevision;Be.current=!0,we(!0),B("");try{let s=await pa("/api/project_companion/review/attention",{enabled:Ce.review.attention?.enabled!==!0,expectedBindingRevision:t});L.current&&ro(Dt.current)===t&&A(s.text)}catch{L.current&&B("\u4E3B\u52A8\u5173\u6CE8\u8BBE\u7F6E\u672A\u66F4\u6539\u6216\u7ED3\u679C\u5F85\u6838\u5BF9\uFF0C\u8BF7\u5237\u65B0\u540E\u68C0\u67E5\u3002")}finally{Be.current=!1,L.current&&(we(!1),await Vt())}},br="\u6BCF\u592909:00\u3001\u6BCF\u5468\u4E0009:00\uFF0C\u4F7F\u7528\u6211\u5728\u7535\u8111\u542F\u7528\u7684\u8D44\u6599\u548C\u5DF2\u5173\u6CE8\u9879\u76EE\u505A\u4E2A\u4EBA\u56DE\u987E\uFF0C\u4E3B\u52A8\u53D1\u73B0\u98CE\u9669\u3001\u622A\u6B62\u4E8B\u9879\u548C\u9879\u76EE\u8FDB\u5C55\uFF1B\u65E0\u53D8\u5316\u65F6\u4FDD\u6301\u5B89\u9759\u3002",yr=Tt("\u6BCF\u5929\u5C11\u6F0F\u4E00\u4EF6\u91CD\u8981\u7684\u4E8B",a("p",{className:"pc_dot_muted"},"\u628A\u8FD1\u671F\u90AE\u4EF6\u3001\u65E5\u7A0B\u3001\u7B14\u8BB0\u3001\u5F85\u529E\u548C\u9879\u76EE\u53D8\u5316\u653E\u5728\u4E00\u8D77\uFF0C\u770B\u6E05\u9700\u8981\u5904\u7406\u7684\u98CE\u9669\u4E0E\u622A\u6B62\u4E8B\u9879\u3002\u6BCF\u5929\u63D0\u9192\u91CD\u70B9\uFF0C\u6BCF\u5468\u56DE\u770B\u8FDB\u5C55\u3002"),Ce?.deliverySupported===!1?a("p",{className:"pc_dot_muted"},Ce.deliveryNote??"\u5F53\u524D\u901A\u9053\u53EA\u652F\u6301\u4E2A\u4EBA\u56DE\u987E\u9884\u89C8\uFF0C\u6682\u4E0D\u80FD\u5F00\u542F\u63A8\u9001\u3002"):null,a("p",null,Ce?Ce.review?.status==="enabled"?"\u4E2A\u4EBA\u56DE\u987E\u5DF2\u5F00\u542F":Ce.review?.status==="paused"?"\u4E2A\u4EBA\u56DE\u987E\u5DF2\u6682\u505C":"\u4E2A\u4EBA\u56DE\u987E\u672A\u5F00\u542F":"\u4E2A\u4EBA\u56DE\u987E\u72B6\u6001\u6682\u65E0\u6CD5\u786E\u8BA4\u3002"),Ce?.review?.status!=="off"&&oa?a("p",{className:"pc_dot_muted"},[oa.dailyTime?`\u6BCF\u5929 ${oa.dailyTime}`:"",Number.isInteger(oa.weeklyDay)&&oa.weeklyTime?`\u6BCF\u5468${["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"][oa.weeklyDay]} ${oa.weeklyTime}`:"",oa.timeZone].filter(Boolean).join(" \xB7 ")):null,Ce?.review?.attention?a("p",{className:"pc_dot_muted"},Ce.review.status==="paused"?"\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8\u5DF2\u6682\u505C\u3002":Ce.review.attention.enabled===!0?["\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8\u5DF2\u5F00\u542F",Ce.review.attention.quiet?"\u5F53\u524D\u5B89\u9759\u65F6\u6BB5":"",Ce.review.attention.nextRun?`\u4E0B\u6B21\u68C0\u67E5 ${ht(Ce.review.attention.nextRun)}`:"",Number.isInteger(Ce.review.attention.remaining)?`\u4ECA\u5929\u8FD8\u53EF\u63D0\u9192 ${Ce.review.attention.remaining} \u6B21`:""].filter(Boolean).join(" \xB7 "):Ce.review.attention.enabled===!1?"\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8\u672A\u5F00\u542F\u3002":"\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8\u72B6\u6001\u5F85\u786E\u8BA4\u3002"):null,Ce?.deliverySupported&&oa?ce(Ce.review.attention?.enabled?"\u5173\u95ED\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8":"\u5F00\u542F\u5DE5\u4F5C\u65F6\u6BB5\u4E3B\u52A8\u5173\u6CE8",hr,{disabled:Ee||Ce.review.status==="paused"}):null,a("p",{className:"pc_dot_muted"},"\u5DE5\u4F5C\u65F6\u6BB5\uFF1A09:00\u201319:00\uFF0C\u6BCF\u4E24\u5C0F\u65F6\u68C0\u67E5\uFF1B\u91CD\u8981\u65B0\u98CE\u9669\u6216\u4E34\u671F\u4E8B\u9879\u624D\u63D0\u9192\uFF0C\u6BCF\u5929\u6700\u591A\u989D\u5916\u4E24\u6761\u3002\u6CBF\u7528\u73B0\u6709\u8D44\u6599\u8303\u56F4\u3002"),Ce?.review?.sources?.length||Ce?.review?.projects?.length?a("p",{className:"pc_dot_muted"},`\u8303\u56F4\uFF1A${Ce.review.sources?.length??0} \u4E2A\u8D44\u6599\u6765\u6E90\uFF0C${Ce.review.projects?.length??0} \u4E2A\u9879\u76EE\u3002\u53EA\u8BFB\u5DF2\u786E\u8BA4\u8303\u56F4\uFF0C\u53EF\u968F\u65F6\u6682\u505C\u6216\u53D6\u6D88\u3002`):null,Ce?.review?.jobs?.length?a("p",{className:"pc_dot_muted"},`\u6700\u8FD1\u4E00\u8F6E\uFF1A${ht(Ce.review.jobs.at(-1).createdAt)} \xB7 ${Ce.review.jobs.at(-1).detail??"\u72B6\u6001\u5F85\u6838\u5BF9"}`):null,Array.isArray(Ce?.review?.goals)&&Ce.review.goals.length?a("div",null,a("h3",null,"\u6B63\u5728\u8DDF\u8FDB\u7684\u76EE\u6807"),...Ce.review.goals.map((t,s)=>a("p",{key:s,className:"pc_dot_muted"},`${t.title} \xB7 ${{active:"\u8DDF\u8FDB\u4E2D",paused:"\u5DF2\u6682\u505C",completed:"\u5DF2\u5B8C\u6210"}[t.status]??"\u72B6\u6001\u5F85\u786E\u8BA4"}${t.meetingTitle?` \xB7 ${t.meetingTitle}`:""}`))):null,a("div",{className:"pc_dot_actions"},...mt?[]:[ce("\u5148\u770B\u4E00\u4EFD\u4E2A\u4EBA\u56DE\u987E",()=>aa("\u9884\u89C8\u4E00\u4EFD\u4E2A\u4EBA\u56DE\u987E\uFF0C\u4F7F\u7528\u6211\u5728\u7535\u8111\u542F\u7528\u7684\u8D44\u6599\u548C\u5DF2\u5173\u6CE8\u9879\u76EE\uFF0C\u4E0D\u5EFA\u7ACB\u8BA1\u5212\u3002",""),{disabled:Ee||!ha}),Ce?.deliverySupported===!1?null:ce(Ce?.review?.status==="enabled"?"\u8C03\u6574\u4E2A\u4EBA\u56DE\u987E":"\u5F00\u542F\u6BCF\u65E5\u4E0E\u6BCF\u5468\u56DE\u987E",()=>aa(br,""),{disabled:Ee||!ha})]),mt?a("p",{className:"pc_dot_muted"},"\u5728\u539F\u5FAE\u4FE1\u544A\u8BC9\u6211\u300C\u6BCF\u592909:00\u3001\u6BCF\u5468\u4E0009:00\uFF0C\u4F7F\u7528\u6211\u5728\u7535\u8111\u542F\u7528\u7684\u8D44\u6599\u548C\u5DF2\u5173\u6CE8\u9879\u76EE\u505A\u4E2A\u4EBA\u56DE\u987E\u300D\u5373\u53EF\u5F00\u542F\uFF1B\u4E5F\u53EF\u4EE5\u8BF4\u300C\u6682\u505C\u4E2A\u4EBA\u56DE\u987E\u300D\u3002"):a("p",{className:"pc_dot_muted"},"\u5148\u51C6\u5907\u4E00\u53E5\u8BDD\uFF0C\u7531\u4F60\u53D1\u9001\u540E\u542F\u7528\u3002\u6253\u5F00\u9875\u9762\u4E0D\u4F1A\u626B\u63CF\u8D44\u6599\u6216\u81EA\u52A8\u5EFA\u8BA1\u5212\u3002"),a("h3",null,"AI \u65E5\u62A5\uFF0C\u56F4\u7ED5\u4F60\u7684\u5173\u6CE8\u70B9"),a("p",{className:"pc_dot_muted"},!Ce?.news||Ce.news.topicSource==="unavailable"?"\u8D44\u8BAF\u5173\u6CE8\u70B9\u6682\u65E0\u6CD5\u786E\u8BA4\uFF0C\u8BF7\u5237\u65B0\u540E\u6838\u5BF9\u3002":Ce.news.topicSource==="explicit"&&Array.isArray(Ce.news.topics)?Ce.news.topics.join(" \xB7 "):"\u5C1A\u672A\u8BBE\u7F6E\u4E13\u5C5E\u5173\u6CE8\u70B9\uFF0C\u6CBF\u7528\u516C\u5F00 AI \u8D44\u8BAF\u4E3B\u9898\u3002"),mt?a("p",{className:"pc_dot_muted"},"\u5728\u5FAE\u4FE1\u8BF4\u300CAI \u65E5\u62A5\u5173\u6CE8\uFF1AAgent \u4EA7\u54C1\u3001\u63D2\u4EF6\u751F\u6001\u2026\u2026\u300D\u5373\u53EF\u4FDD\u5B58\u3002\u8D44\u8BAF\u53EA\u4F7F\u7528\u516C\u5F00\u6765\u6E90\uFF0C\u4E0D\u4F1A\u5E26\u5165\u79C1\u4EBA\u90AE\u4EF6\u3002"):ce("\u8C03\u6574\u8D44\u8BAF\u5173\u6CE8\u70B9",()=>aa("AI \u65E5\u62A5\u5173\u6CE8\uFF1A",""),{disabled:Ee||!ha}),a("p",{className:"pc_dot_muted"},"\u7535\u8111\u4E0E Harness \u9700\u4FDD\u6301\u5728\u7EBF\uFF1B\u6765\u6E90\u9650\u91CF\u8BFB\u53D6\uFF0C\u4E0D\u4EE3\u8868\u5168\u8D26\u53F7\u8986\u76D6\u3002")),es=St.flatMap(t=>t.followup?.available===!0?[["followup",t.followup.followup],["once",t.followup.once]].filter(([,s])=>s?.enabled===!0).map(([s,u])=>({project:t,kind:s,plan:u})):[]).sort((t,s)=>(Date.parse(t.plan.nextDueAt)||1/0)-(Date.parse(s.plan.nextDueAt)||1/0)),ts=St.flatMap(t=>t.followup?.available===!0?[["followup",t.followup.followup],["once",t.followup.once]].filter(([,s])=>s&&typeof s.lastReviewedAt=="string"&&Number.isFinite(Date.parse(s.lastReviewedAt))).map(([s,u])=>({project:t,kind:s,plan:u})):[]).sort((t,s)=>Date.parse(s.plan.lastReviewedAt)-Date.parse(t.plan.lastReviewedAt)).slice(0,5),vr=Tt("\u4E0A\u6B21\u5DF2\u6838\u9A8C\u68C0\u67E5",ts.length?ts.map(({project:t,kind:s,plan:u})=>a("div",{className:"pc_dot_row",key:`checked:${t.id}:${s}`},a("div",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},`${s==="once"?"\u5355\u6B21\u68C0\u67E5":"\u6301\u7EED\u8DDF\u8FDB"} \xB7 ${ht(u.lastReviewedAt)}`),a("p",{className:"pc_dot_muted"},u.lastCheckOutcome==="quiet"?"\u672C\u6B21\u53EF\u89C1\u8303\u56F4\u65E0\u65B0\u53D8\u5316\uFF0C\u5DF2\u9759\u9ED8\uFF1B\u4E0D\u4EE3\u8868\u5168\u8D26\u53F7\u65E0\u53D8\u5316\u3002":u.lastCheckOutcome==="partial"?"\u90E8\u5206\u6765\u6E90\u4ECD\u65E0\u6CD5\u786E\u8BA4\uFF1B\u8FD9\u662F\u68C0\u67E5\u8BB0\u5F55\uFF0C\u4E0D\u4EE3\u8868\u8D44\u6599\u5DF2\u5B8C\u6574\u8BFB\u53D6\u3002":"\u5DF2\u5B8C\u6210\u68C0\u67E5\u6D41\u7A0B\uFF1B\u5177\u4F53\u8D44\u6599\u4E0E\u7ED3\u679C\u89C1\u539F\u4F1A\u8BDD\u3002"),["failed","blocked","cancelled"].includes(u.status)?a("p",{className:"pc_dot_muted"},`\u5F53\u524D${u.status==="failed"?"\u68C0\u67E5\u5931\u8D25":u.status==="blocked"?"\u53D7\u963B":"\u5DF2\u53D6\u6D88"}\uFF0C\u4E0A\u65B9\u4E3A\u6B64\u524D\u5DF2\u6838\u9A8C\u8BB0\u5F55\u3002`):null),ce("\u67E5\u770B\u5B89\u6392",()=>uo(t)))):a("p",{className:"pc_dot_muted"},St.some(t=>t.followup?.available===!0)?"\u5C1A\u65E0\u5DF2\u6838\u9A8C\u68C0\u67E5\u8BB0\u5F55\u3002":"\u68C0\u67E5\u8BB0\u5F55\u6682\u65E0\u6CD5\u786E\u8BA4\uFF1B\u4E0D\u636E\u6B64\u5224\u65AD\u672A\u6267\u884C\u3002")),_r=Tt("\u4E0B\u4E00\u6B21\u8DDF\u8FDB",es.length?es.map(({project:t,kind:s,plan:u})=>a("div",{className:"pc_dot_row",key:`${t.id}:${s}`},a("div",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},s==="once"?"\u5355\u6B21\u68C0\u67E5":Bn(u),u.blocked?" \xB7 \u5F53\u524D\u53D7\u963B":u.running===!1?s==="once"?" \xB7 \u7B49\u5F85\u5230\u671F":" \xB7 \u5DF2\u4FDD\u5B58\uFF0C\u8FD0\u884C\u5668\u672A\u542F\u52A8":"",u.loopId?" \xB7 \u542B\u5DF2\u9009\u4E2A\u4EBA\u8D44\u6599":""," \xB7 \u539F\u5FAE\u4FE1\u4F1A\u8BDD"),a("small",{className:"pc_dot_muted"},`\u4E0B\u6B21 ${ht(u.nextDueAt)}`)),ce("\u67E5\u770B\u5B89\u6392",()=>uo(t)))):St.some(t=>t.followup?.available===!1||!t.followup)?a("p",{className:"pc_dot_muted"},"\u9879\u76EE\u8DDF\u8FDB\u72B6\u6001\u5C1A\u672A\u786E\u8BA4\uFF0C\u53EF\u5728\u9879\u76EE\u8BE6\u60C5\u4E2D\u67E5\u8BE2\u3002"):a("p",{className:"pc_dot_muted"},"\u8FD8\u6CA1\u6709\u5F00\u542F\u9879\u76EE\u8DDF\u8FDB\u3002\u5148\u4EA4\u4EE3\u76EE\u6807\uFF0C\u518D\u51B3\u5B9A\u4EC0\u4E48\u65F6\u5019\u56DE\u6765\u770B\u770B\u3002"),Ta.plans?a("div",null,...To.map(t=>a("div",{className:"pc_dot_row",key:t.id},a("div",null,a("strong",null,t.title),a("small",{className:"pc_dot_muted"},"\u660E\u786E\u63D0\u9192 \xB7 \u539F\u5FAE\u4FE1\u4F1A\u8BDD")),a("span",{className:"pc_dot_muted"},ht(t.dueAt)))),!mt&&!To.length?a("p",{className:"pc_dot_muted"},"\u6682\u65E0\u5F85\u89E6\u53D1\u7684\u660E\u786E\u63D0\u9192\u3002"):null,ge?.counts?.activeReminders>To.length?a("p",{className:"pc_dot_muted"},`\u4EC5\u663E\u793A ${To.length} \u6761\u6D3B\u52A8\u63D0\u9192\uFF0C\u5176\u4F59\u8BF7\u5728 Dot \u4F1A\u8BDD\u4E2D\u67E5\u8BE2\u3002`):null,mt?null:a("p",{className:"pc_dot_muted"},ge?.daily?.enabled?`\u9879\u76EE\u8D44\u6599\u65E5\u62A5\uFF1A\u6BCF\u5929 ${ge.daily.time}\uFF08${ge.daily.timeZone}\uFF09`:"\u9879\u76EE\u8D44\u6599\u65E5\u62A5\u672A\u5F00\u542F\u3002"),a("div",{className:"pc_dot_actions"},mt?null:ce("\u5B89\u6392\u63D0\u9192",()=>aa("\u8BF7\u63D0\u9192\u6211\uFF1A","")),mt?null:ce("\u8BBE\u7F6E\u65E5\u62A5",()=>aa("\u8BF7\u5E2E\u6211\u8BBE\u7F6E\u9879\u76EE\u8D44\u6599\u65E5\u62A5\u3002\u5148\u548C\u6211\u786E\u8BA4\u6BCF\u5929\u7684\u53D1\u9001\u65F6\u95F4\u3001\u65F6\u533A\u548C\u5173\u6CE8\u9879\u76EE\uFF0C\u518D\u5F00\u542F\u3002","")))):a("p",{className:"pc_dot_muted"},mt?"\u5171\u4EAB\u5FAE\u4FE1\u7684\u63D0\u9192\u4E0E\u65E5\u62A5\uFF0C\u8BF7\u5728\u539F\u5FAE\u4FE1\u67E5\u8BE2\u6216\u5B89\u6392\uFF1B\u8FD9\u91CC\u4E0D\u6DF7\u5165\u72EC\u7ACB Dot \u4F1A\u8BDD\u7684\u65E7\u8BA1\u5212\u3002":"\u63D0\u9192\u4E0E\u65E5\u62A5\u72B6\u6001\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002")),xi=vn[0],Va=Qa(ge?.connection),na=ge?.personalReview?.attentionItems,Ka=ge?.personalReview?.schedules,mo=na?.available===!0&&Array.isArray(na.items)?na.items.slice(0,5):null,fo=Array.isArray(Ka?.items)?Ka.items.slice(0,12):null,as=[Ta.projects?null:"\u5173\u6CE8\u9879\u76EE",Ta.jobs?null:"\u4EA4\u529E\u8BB0\u5F55",!mt&&!Ta.plans?"\u5DF2\u6709\u5B89\u6392":null,mo?na.coverage==="unconfirmed"?"\u90E8\u5206\u4E8B\u9879\u8986\u76D6":null:"\u5F53\u524D\u4E8B\u9879",Ka?.available!==!0?"\u4E0B\u4E00\u6B21\u5B89\u6392":null,["unknown","failed"].includes(ge?.connection?.state)?"\u5FAE\u4FE1\u8FDE\u63A5":null].filter(Boolean),xr=!Va&&as.length?a("div",{className:"pc_dot_statusline",role:"status","data-dot-recovery":!0},a("span",null,`${as.join("\u3001")}\u8FD8\u5728\u6838\u5BF9\uFF1B\u4E0D\u5F71\u54CD\u4F60\u73B0\u5728\u5BF9\u8BDD\uFF0C\u539F\u6765\u7684\u5B89\u6392\u90FD\u4FDD\u7559\u3002`),ce("\u91CD\u8BD5\u72B6\u6001",Vt,{className:"pc_dot_text_button"}),ce("\u67E5\u770B\u8FDE\u63A5",()=>lo("settings"),{className:"pc_dot_text_button"})):null,wr=t=>a("article",{className:"pc_dot_update",key:t.id,"data-dot-job":t.id},a("p",{className:"pc_dot_muted"},`${t.projectLabel} \xB7 ${Wn[t.status]??"\u72B6\u6001\u5F85\u6838\u5BF9"}`),a("h3",null,t.task),t.result?.available===!0&&typeof t.result.text=="string"?a("p",{className:"pc_dot_excerpt"},t.result.text):null,t.result?.truncated?a("p",{className:"pc_dot_muted"},"\u539F\u56DE\u590D\u8F83\u957F\uFF0C\u6B64\u5904\u4E3A\u6458\u5F55\u3002"):null,t.delivery?a("p",{className:"pc_dot_muted"},Vn[t.delivery.status]??"\u56DE\u4F20\u72B6\u6001\u5F85\u6838\u5BF9"):null,a("div",{className:"pc_dot_actions"},ce("\u770B\u770B\u8FD9\u6B21\u7ED3\u679C",()=>lr(t)),mt?null:ce("\u548C Dot \u63A5\u7740\u804A",()=>gr(t)))),kr=()=>{Fe.current?.focus?.(),Fe.current?.scrollIntoView?.({block:"nearest"})},Nr=async()=>{if(!(!nt||Be.current)){Be.current=!0,we(!0);try{let t=await i.resolve(nt);if(!t)throw Error("candidate unavailable");let s=await i.remember(t.sessionId);L.current&&(re.localConversation=t,He(t),Nt(null),A(s?"\u5DF2\u9009\u62E9\u4E0A\u6B21\u5BF9\u8BDD\uFF0C\u6CBF\u7528\u539F\u8349\u7A3F\u3002":"\u672C\u6B21\u53EF\u7EE7\u7EED\u4E0A\u6B21\u5BF9\u8BDD\uFF1B\u5165\u53E3\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u4ECE\u539F\u751F\u5386\u53F2\u627E\u56DE\u3002"))}catch{L.current&&B("\u4E0A\u6B21\u5BF9\u8BDD\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u4ECE\u539F\u751F\u5386\u53F2\u6838\u5BF9\uFF1B\u5F53\u524D\u8349\u7A3F\u4ECD\u4FDD\u7559\u3002")}finally{Be.current=!1,L.current&&we(!1)}}},Sr=async()=>{if(Be.current||!_t)return;Be.current=!0,we(!0);let t=new AbortController;ea.current.add(t);try{let s=await Bt(_t,t.signal);L.current&&(ka(re.draft),A(s.status==="applied"?"\u4FDD\u7559\u8349\u7A3F\u5DF2\u653E\u5165\u5F53\u524D\u539F\u751F\u4F1A\u8BDD\uFF0C\u7531\u4F60\u53D1\u9001\u3002":"\u539F\u751F\u4F1A\u8BDD\u5DF2\u6709\u8349\u7A3F\uFF0C\u7535\u8111\u539F\u6587\u7EE7\u7EED\u5B8C\u6574\u4FDD\u7559\u3002"))}catch{L.current&&B("\u8349\u7A3F\u672A\u80FD\u5E26\u5165\uFF1A\u539F\u5BF9\u8BDD\u6216\u8349\u7A3F\u8303\u56F4\u6682\u672A\u786E\u8BA4\u3002\u539F\u6587\u4ECD\u5B8C\u6574\u4FDD\u7559\uFF0C\u53EF\u590D\u5236\u540E\u7EE7\u7EED\u3002")}finally{ea.current.delete(t),Be.current=!1,L.current&&we(!1)}},go=tt?.state,Cr={missing:"\u5FAE\u4FE1\u6865\u63A5\u5C1A\u672A\u5C31\u7EEA\u3002\u5148\u5728\u7535\u8111\u4E0A\u804A\uFF0C\u4E5F\u53EF\u5230\u8FDE\u63A5\u9875\u67E5\u770B\u5FAE\u4FE1\u8BBE\u7F6E\u3002",unknown:"\u5FAE\u4FE1\u8FDE\u63A5\u72B6\u6001\u6682\u672A\u786E\u8BA4\uFF0C\u4FDD\u7559\u539F\u8FDE\u63A5\uFF1B\u5148\u5728\u7535\u8111\u4E0A\u7EE7\u7EED\u3002","waiting-qr":"\u5FAE\u4FE1\u626B\u4E00\u626B \xB7 \u7B49\u5F85\u626B\u7801",scanned:"\u5DF2\u626B\u7801\uFF0C\u8BF7\u5728\u624B\u673A\u4E0A\u786E\u8BA4\u3002","awaiting-message":"\u5DF2\u786E\u8BA4\u626B\u7801\u8D26\u53F7\u3002\u7528\u8FD9\u4E2A\u5FAE\u4FE1\u7ED9\u5C0F\u52A9\u624B\u53D1\u9001\u201C\u4F60\u597D\u201D\uFF0C\u5F00\u59CB\u804A\u5929\u3002",bound:"\u5FAE\u4FE1\u5DF2\u8FDE\u63A5\uFF0C\u6CBF\u7528\u5DF2\u6709\u5165\u53E3\u3002",failed:"\u5FAE\u4FE1\u8FDE\u63A5\u6682\u65F6\u53D7\u963B\u3002\u5148\u67E5\u770B\u5DF2\u6709\u8FDE\u63A5\u72B6\u6001\uFF0C\u4E0D\u4F1A\u91CD\u7F6E\u7ED1\u5B9A\u3002"},Ar=Va?a("section",{className:"pc_dot_inline_wechat","data-dot-inline-wechat":!0,"aria-label":"\u8FDE\u63A5\u5FAE\u4FE1"},a("div",{className:"pc_dot_pair_copy"},a("h2",null,go==="bound"?"\u5FAE\u4FE1\u5DF2\u8FDE\u63A5":"\u628A Dot \u5E26\u5230\u5FAE\u4FE1\u91CC"),a("p",null,"\u5728\u624B\u673A\u4E0A\u4EA4\u4EE3\u4EFB\u52A1\u3001\u6536\u7ED3\u679C\uFF0C\u4E5F\u80FD\u6536\u5230\u4F60\u5DF2\u5F00\u542F\u7684\u63D0\u9192\u3002"),ce("\u5148\u5728\u7535\u8111\u4E0A\u8BD5\u8BD5",kr,{className:"pc_dot_text_button"}),a("p",{className:"pc_dot_muted"},"\u7535\u8111\u548C Harness \u9700\u4FDD\u6301\u5728\u7EBF\u3002\u626B\u7801\u4E0D\u4F1A\u81EA\u52A8\u5F00\u542F\u63A8\u9001\u3002")),a("div",{className:"pc_dot_inline_code"},a("p",{role:"status"},At||(ua?"\u4E8C\u7EF4\u7801\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u5237\u65B0\u8FDE\u63A5\u72B6\u6001\u3002":Cr[go]??"\u6B63\u5728\u8BFB\u53D6\u73B0\u6709\u5FAE\u4FE1\u8FDE\u63A5\u2026")),go==="waiting-qr"&&tt?.qrAvailable===!0&&!ua?a("img",{src:"/wechat/api/qr-image"+(/^[a-f0-9]{16}$/.test(tt.qrRevision??"")?`?v=${tt.qrRevision}`:""),alt:"\u7528\u5FAE\u4FE1\u626B\u63CF\uFF0C\u8FDE\u63A5 Dot",onError:()=>xa(!0)}):null,ce("\u5237\u65B0\u8FDE\u63A5\u72B6\u6001",dn),go==="missing"||go==="failed"?ce("\u67E5\u770B\u5FAE\u4FE1\u8BBE\u7F6E",()=>lo("settings")):null)):null,Ir=mn?a("section",{className:"pc_dot_hero","aria-label":"\u548C Dot \u7EE7\u7EED\u5BF9\u8BDD"},a("h1",null,"\u4ECA\u5929\u60F3\u505A\u4EC0\u4E48\uFF1F"),a("p",{className:"pc_dot_muted"},"\u8BF4\u4E00\u53E5\u8981\u505A\u7684\u4E8B\uFF0C\u6216\u8005\u63A5\u7740\u4E0A\u6B21\u804A\uFF1B\u9700\u8981\u8D44\u6599\u65F6\u518D\u8FDE\u3002"),_a(_t,{busy:Ee,onApply:Sr,onCopy:()=>Pa(A)}),a("div",{ref:ye,"data-dot-home-conversation":!0},Ae||me?a("div",{"data-dot-native-placeholder":!0,style:{height:Se.current},"aria-hidden":!0}):Gt?a("p",{className:"pc_dot_notice",role:"status"},"\u6B63\u5728\u5207\u6362\u5B8C\u6574\u5BF9\u8BDD\uFF0C\u539F\u8349\u7A3F\u4F1A\u4FDD\u7559\u3002"):a(I,{target:_t,SessionProvider:x.SessionProvider,renderSlot:x.renderSlot,onOpenHistory:()=>Pt(_t.sessionId),onReady:zt}))):a("section",{className:"pc_dot_hero"},a("h1",null,Va?"\u5148\u628A\u4E00\u4EF6\u4E8B\u4EA4\u7ED9 Dot\u3002":"\u4ECA\u5929\u60F3\u505A\u4EC0\u4E48\uFF1F"),a("p",{className:"pc_dot_muted"},"\u8BF4\u8BF4\u80CC\u666F\u548C\u76EE\u6807\uFF0C\u9700\u8981\u8D44\u6599\u65F6\u518D\u6309\u9700\u8FDE\u63A5\u3002"),a("div",{className:"pc_dot_composer"},a("textarea",{ref:Fe,"aria-label":"\u4EA4\u4EE3\u7ED9 Dot \u7684\u4E8B\u60C5",placeholder:"\u628A\u80CC\u666F\u3001\u60F3\u505A\u7684\u4E8B\uFF0C\u6216\u521A\u521A\u53D8\u5316\u7684\u60C5\u51B5\u544A\u8BC9\u6211\u2026",maxLength:3500,value:ma,disabled:Ee,onChange:t=>{Be.current||jo(t.target.value)},onKeyDown:t=>{(t.metaKey||t.ctrlKey)&&t.key==="Enter"&&!t.isComposing&&t.keyCode!==229&&!t.nativeEvent?.isComposing&&(t.preventDefault(),po())}}),a("div",{className:"pc_dot_compose_bottom"},a("select",{"aria-label":"\u8FD9\u53E5\u8BDD\u5173\u8054\u7684\u9879\u76EE",value:Me??"",disabled:Ee,onChange:t=>{Be.current||so(t.target.value)}},a("option",{value:""},"\u4E0D\u5173\u8054\u9879\u76EE"),...St.map(t=>a("option",{value:t.id,key:t.id},t.label))),a("span",{className:"pc_dot_keyboard"},"\u2318 / Ctrl + Enter"),ce("\u5F00\u59CB\u5BF9\u8BDD",()=>po(),{className:"pc_dot_primary"}))),a("p",{className:"pc_dot_muted"},"\u5E26\u5165\u539F\u751F Dot \u4F1A\u8BDD\u540E\uFF0C\u7531\u4F60\u53D1\u9001\uFF1B\u5DF2\u6709\u4F1A\u8BDD\u8349\u7A3F\u4F1A\u4FDD\u7559\u3002"),nt?ce("\u7EE7\u7EED\u4E0A\u6B21\u5BF9\u8BDD",Nr,{className:"pc_dot_text_button"}):null,a("div",{className:"pc_dot_actions pc_dot_shortcuts"},...sr.slice(0,3).map(([t,s])=>ce(t,()=>aa(s),{key:t})))),Dr=t=>a("div",{className:"pc_dot_item_source",key:`${t.source??""}:${t.title??""}`},a("strong",null,t.label||t.title||t.source||"\u6765\u6E90"),a("span",null,[t.source,t.at?ht(t.at):null,["metadata_only","metadata-only"].includes(t.contentState)?"\u4EC5\u6765\u6E90\u4FE1\u606F":null,t.contentState==="unread"?"\u6B63\u6587\u672A\u8BFB":null,t.contentState==="unavailable"?"\u5185\u5BB9\u5C1A\u672A\u786E\u8BA4":null,t.contentState==="actual_empty"?"\u8FD4\u56DE\u5185\u5BB9\u4E3A\u7A7A":null,t.truncated?"\u5185\u5BB9\u5DF2\u622A\u65AD":null].filter(Boolean).join(" \xB7 "))),jr=t=>a("article",{className:"pc_dot_attention_item",key:t.id,"data-dot-attention-item":t.id},a("div",{className:"pc_dot_item_kicker"},a("span",null,{deadline:"\u622A\u6B62\u4E8B\u9879",risk:"\u9700\u8981\u7559\u610F",invitation:"\u5F85\u786E\u8BA4\u9080\u8BF7",reply:"\u5F85\u56DE\u590D",change:"\u8FD1\u671F\u53D8\u5316",progress:"\u9879\u76EE\u8FDB\u5C55",event:"\u8FD1\u671F\u5B89\u6392"}[t.kind]??"\u5F53\u524D\u4E8B\u9879"),a("span",null,t.dueAt?`${t.dueAtBasis==="relative"?"\u4F30\u7B97\u671F\u9650":"\u622A\u6B62"} ${ht(t.dueAt)}`:t.eventStartAt?`\u5F00\u59CB ${ht(t.eventStartAt)}`:t.time?ht(t.time):"")),a("h3",null,t.title),typeof t.summary=="string"&&t.summary?a("p",{className:"pc_dot_item_summary"},t.summary):null,typeof t.why=="string"&&t.why?a("p",{className:"pc_dot_item_why"},t.why):null,typeof t.action=="string"&&t.action?a("p",{className:"pc_dot_item_next"},t.action):null,typeof t.unknown=="string"&&t.unknown?a("p",{className:"pc_dot_item_unknown"},`\u5F85\u786E\u8BA4\uFF1A${t.unknown}`):null,t.execution?a("p",{className:"pc_dot_muted","data-dot-item-execution":!0},{in_progress:"\u6B63\u5728\u6267\u884C",ready_for_review:"\u5DF2\u6709\u7ED3\u679C\uFF0C\u5F85\u4F60\u9A8C\u6536",blocked:"\u6267\u884C\u5F53\u524D\u53D7\u963B",unknown:"\u6267\u884C\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4"}[t.execution.status]??"\u6267\u884C\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4",t.execution.outdated===!0?" \xB7 \u4F9D\u636E\u5DF2\u6709\u66F4\u65B0\uFF0C\u6267\u884C\u7ED3\u679C\u57FA\u4E8E\u65E7\u7248\u8D44\u6599\uFF0C\u9700\u91CD\u65B0\u6838\u5BF9\u3002":null):null,t.confidence==="inferred"?a("p",{className:"pc_dot_muted"},"\u8FD9\u662F\u57FA\u4E8E\u5DF2\u4FDD\u5B58\u8D44\u6599\u7684\u5224\u65AD\uFF0C\u4ECD\u9700\u6838\u5BF9\u3002"):null,a("div",{className:"pc_dot_actions"},ce("\u548C Dot \u63A5\u7740\u804A",()=>aa(`\u8BF7\u51C6\u5907\u4E2A\u4EBA\u56DE\u987E\u300C${t.title}\u300D\u7684\u4E0B\u4E00\u6B65
2516
2516
  \u4E8B\u9879 ID\uFF1A${t.id}
2517
- \u8BF7\u5148\u6838\u5BF9\u539F\u4E8B\u9879\u53CA\u5DF2\u6388\u6743\u6765\u6E90\uFF0C\u518D\u5E2E\u6211\u68B3\u7406\u4E0B\u4E00\u6B65\uFF1B\u4E0D\u8981\u81EA\u52A8\u91CD\u505A\u65E7\u4EFB\u52A1\u6216\u6269\u5927\u8BFB\u53D6\u8303\u56F4\u3002`,"")),Array.isArray(t.sources)&&t.sources.length?a("details",null,a("summary",null,"\u67E5\u770B\u4F9D\u636E"),...t.sources.slice(0,5).map(Dr)):null)),$r=mo?Tt("\u503C\u5F97\u4F60\u7559\u610F",mo?mo.length?mo.map(jr):a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u5DF2\u6838\u5BF9\u7684\u8303\u56F4\u5185\uFF0C\u6CA1\u6709\u5F85\u5904\u7406\u4E8B\u9879\u3002\u6709\u4E8B\u53EF\u4EE5\u76F4\u63A5\u544A\u8BC9 Dot\u3002"):a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u4E8B\u9879\u5C1A\u672A\u6838\u5BF9\uFF0C\u6062\u590D\u5165\u53E3\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),typeof na?.note=="string"&&na.note?a("p",{className:"pc_dot_muted"},na.note):null,na?.truncated?a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u53EA\u5C55\u793A\u6700\u8FD1 5 \u6761\u4E8B\u9879\uFF0C\u5176\u4ED6\u5185\u5BB9\u8BF7\u5728\u539F\u4F1A\u8BDD\u6838\u5BF9\u3002"):null):a("p",{className:"pc_dot_muted pc_dot_inline_note"},["\u5F53\u524D\u4E8B\u9879\u8FD8\u6CA1\u6838\u5BF9\u3002",typeof na?.note=="string"?na.note:null].filter(Boolean).join(" ")),Tr=t=>t.nextDueAt?ht(t.nextDueAt):[t.dailyTime?`\u6BCF\u5929 ${t.dailyTime}`:"",Number.isInteger(t.weeklyDay)&&t.weeklyTime?`\u6BCF\u5468${["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"][t.weeklyDay]} ${t.weeklyTime}`:"",Number.isInteger(t.everyMinutes)?`\u6BCF ${t.everyMinutes} \u5206\u949F`:""].filter(Boolean).join(" \xB7 ")||"\u4E0B\u6B21\u65F6\u95F4\u5F85\u786E\u8BA4",zr=a("section",{className:"pc_dot_section pc_dot_schedule","data-dot-schedule-rail":!0},a("h3",null,"\u4E0B\u4E00\u6B21\u5B89\u6392"),typeof Wa?.label=="string"&&Wa.label?a("p",{className:"pc_dot_muted","data-dot-review-health":!0},`\u6700\u8FD1\u8FD0\u884C\uFF1A${Wa.label}${Wa.at?" \xB7 "+ht(Wa.at):""}\u3002\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002`):null,fo?fo.length?fo.map(t=>a("div",{className:"pc_dot_schedule_item",key:t.id},a("strong",null,t.title),a("span",{className:"pc_dot_plan_status"},{stored:"\u5DF2\u4FDD\u5B58",paused:"\u5DF2\u6682\u505C",blocked:"\u5F53\u524D\u53D7\u963B"}[t.status]??"\u72B6\u6001\u5F85\u6838\u5BF9"),a("p",null,Tr(t)),a("p",{className:"pc_dot_muted"},t.timeZone||"\u65F6\u533A\u5F85\u6838\u5BF9"),a("p",{className:"pc_dot_muted"},{"personal-review":"\u4E2A\u4EBA\u56DE\u987E",news:"AI \u65E5\u62A5","project-followup":"\u9879\u76EE\u8DDF\u8FDB"}[t.source]??"\u539F\u5B89\u6392"))):Ka?.available===!0?a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u8303\u56F4\u6CA1\u6709\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\u3002\u60F3\u8DDF\u8FDB\u4E00\u4EF6\u4E8B\uFF0C\u53EF\u4EE5\u76F4\u63A5\u544A\u8BC9 Dot\u3002"):a("p",{className:"pc_dot_empty"},"\u5B89\u6392\u72B6\u6001\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"):a("p",{className:"pc_dot_empty"},"\u5B89\u6392\u72B6\u6001\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),Ka?.available!==!0&&fo?.length?a("p",{className:"pc_dot_muted"},"\u90E8\u5206\u5B89\u6392\u5C1A\u672A\u786E\u8BA4\uFF1B\u8FD9\u91CC\u4FDD\u7559\u5DF2\u6838\u5BF9\u7684\u5B89\u6392\u3002"):null,fo?.length?a("p",{className:"pc_dot_rail_note"},Wa?"\u8FD9\u91CC\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\uFF1B\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002":"\u8FD9\u91CC\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\uFF1B\u8FD0\u884C\u5C1A\u672A\u6838\u9A8C\uFF0C\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002"):null,Ka?.truncated?a("p",{className:"pc_dot_muted"},"\u6B64\u5904\u4E3A\u6709\u9650\u5B89\u6392\uFF0C\u5176\u4F59\u8BF7\u5728\u539F\u5165\u53E3\u6838\u5BF9\u3002"):null),Er=Ta.jobs?a("details",{className:"pc_dot_history","data-dot-history":!0},a("summary",null,`\u627E\u5230\u4E4B\u524D\u804A\u8FC7\u7684\u4E8B\uFF08${Hn.length}\uFF09`),vn.length?vn.map(wr):a("p",{className:"pc_dot_muted"},"\u8FD9\u4E2A\u7A97\u53E3\u91CC\u8FD8\u6CA1\u6709\u4EA4\u529E\u8BB0\u5F55\u3002"),a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u5C55\u793A\u6700\u8FD1\u7684\u6709\u9650\u8BB0\u5F55\uFF1B\u66F4\u65E9\u7684\u539F\u59CB\u5185\u5BB9\u5728 Dot \u4F1A\u8BDD\u4E2D\u3002"),_t?ce("\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u5386\u53F2",()=>Pt(_t.sessionId)):ha&&!mt?ce("\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u5386\u53F2",()=>Pt(ge.connection.sessionId)):null):null,Pr=Va&&!St.length?a("section",{className:"pc_dot_sample","data-dot-sample":!0,"aria-label":"\u793A\u4F8B\u7B80\u62A5"},a("div",{className:"pc_dot_sample_head"},a("span",{className:"pc_dot_badge"},"\u793A\u4F8B"),a("strong",null,"Dot \u4F1A\u628A\u4E00\u4EF6\u4E8B\u63A5\u6210\u8FD9\u6837\u7684\u7B80\u62A5")),a("ol",null,a("li",null,a("b",null,"\u8FDB\u5C55"),"\u4E09\u7BC7\u9605\u8BFB\u6750\u6599\u5DF2\u7ECF\u6574\u7406\u597D\uFF0C\u8BD5\u8BFB\u8BF4\u660E\u8FD8\u5DEE\u4E00\u7248\u3002"),a("li",null,a("b",null,"\u5361\u70B9"),"\u4F5C\u8005\u5E0C\u671B\u628A\u201C\u8BFB\u5B8C\u6709\u4EC0\u4E48\u6536\u83B7\u201D\u8BF4\u5F97\u66F4\u5177\u4F53\u3002"),a("li",null,a("b",null,"\u4E0B\u4E00\u6B65"),"\u5148\u627E 5 \u4F4D\u8BFB\u8005\u8BD5\u8BFB\u4E00\u5468\uFF0C\u518D\u51B3\u5B9A\u662F\u5426\u6269\u5927\u3002")),a("p",{className:"pc_dot_muted"},"\u8FD9\u662F\u793A\u4F8B\uFF0C\u4E0D\u662F\u4F60\u7684\u8D44\u6599\u3002\u8FDE\u4E0A\u9879\u76EE\u6216\u5FAE\u4FE1\u540E\uFF0CDot \u4F1A\u6309\u4F60\u7684\u6765\u6E90\u6574\u7406\u3002"),a("div",{className:"pc_dot_actions"},ce("\u7528\u8FD9\u4E2A\u4F8B\u5B50\u804A\u804A",()=>aa("\u8BF7\u53C2\u8003\u793A\u4F8B\u7B80\u62A5\u7684\u7ED3\u6784\uFF0C\u5E2E\u6211\u6574\u7406\u4E00\u4EF6\u6B63\u5728\u63A8\u8FDB\u7684\u4E8B\uFF1A\u5148\u53EA\u95EE\u6211\u7F3A\u7684\u76EE\u6807\u548C\u8303\u56F4\uFF0C\u518D\u7ED9\u6211\u8FDB\u5C55\u3001\u5361\u70B9\u548C\u4E0B\u4E00\u6B65\u3002"),{className:"pc_dot_text_button"}))):null,wi=a("div",null,xr,a("div",{className:"pc_dot_home_grid pc_dot_home_single"},a("div",{className:"pc_dot_column"},Ar,Ir,a(m,{controller:V,organizer:k,onOrganize:async()=>{await k.organize(V.getSnapshot().summary?.revision)&&lo("projects")}}),Pr,Va?a("p",{className:"pc_dot_intro"},"\u4E0D\u7528\u5148\u628A\u6240\u6709\u4E1C\u897F\u914D\u597D\u3002\u5148\u804A\u624B\u4E0A\u7684\u4EFB\u52A1\uFF0C\u7528\u5230\u90AE\u4EF6\u3001\u65E5\u7A0B\u6216\u9879\u76EE\u65F6\uFF0C\u518D\u8FDE\u63A5\u9700\u8981\u7684\u8D44\u6599\u3002"):$r,Er,a("details",{className:"pc_dot_legacy_details"},a("summary",null,"\u66F4\u591A\u539F\u4F1A\u8BDD\u5B89\u6392\u4E0E\u68C0\u67E5"),_r,vr)),a("details",{className:"pc_dot_more","aria-label":"\u5B89\u6392\u4E0E\u5173\u6CE8"},a("summary",null,"\u5B89\u6392\u4E0E\u5173\u6CE8"),Va?Tt("\u4ECE\u4F60\u624B\u4E0A\u7684\u4E8B\u5F00\u59CB",a("p",{className:"pc_dot_muted"},"\u5148\u4EA4\u4EE3\u4E00\u4E2A\u76EE\u6807\uFF0CDot \u4F1A\u63A5\u7740\u6574\u7406\u4E0B\u4E00\u6B65\u3002\u7528\u5230\u8D44\u6599\u65F6\u518D\u8FDE\u63A5\uFF1B\u60F3\u5B9A\u65F6\u8DDF\u8FDB\u65F6\u518D\u5B89\u6392\u3002")):zr,Tt("\u6B63\u5728\u5173\u6CE8",Ta.projects?St.length?St.map(t=>ce(a("span",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},zo(t)?`\u8D44\u6599\u66F4\u65B0 ${ht(zo(t))}`:"\u5C1A\u65E0\u8FD1\u671F\u8D44\u6599")),()=>co(t.id),{key:t.id,className:"pc_dot_project_mini"})):a("p",{className:"pc_dot_muted"},"\u5148\u4ECE\u624B\u5934\u7684\u4E00\u4EF6\u4E8B\u5F00\u59CB\uFF0C\u9700\u8981\u65F6\u518D\u5173\u6CE8\u9879\u76EE\u3002"):a("p",{className:"pc_dot_muted"},"\u5173\u6CE8\u8303\u56F4\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),mt?null:ce("\u9009\u62E9\u5173\u6CE8\u9879\u76EE",()=>Ut(!0))),Ce?a("details",{className:"pc_dot_review_details"},a("summary",null,"\u4E2A\u4EBA\u56DE\u987E\u4E0E\u8D44\u8BAF\u8BBE\u7F6E"),yr):null))),Rr=Tt(`\u5168\u90E8\u9879\u76EE${rt?` \xB7 ${rt.total}`:""}`,a("p",{className:"pc_dot_muted"},"\u6309\u540D\u79F0\u627E\u5230 Harness \u5DF2\u767B\u8BB0\u7684\u9879\u76EE\uFF0C\u5355\u6B21\u67E5\u770B\u4E0D\u5360\u6301\u7EED\u5173\u6CE8\u540D\u989D\u3002\u5217\u76EE\u5F55\u4E0D\u4F1A\u8BFB\u53D6\u9879\u76EE\u5185\u5BB9\u3002"),ha?a("div",null,a("form",{"aria-label":"\u641C\u7D22\u5168\u90E8\u9879\u76EE",className:"pc_dot_actions",onSubmit:t=>{t.preventDefault(),io({query:Wo})}},a("input",{"aria-label":"\u641C\u7D22\u5168\u90E8\u9879\u76EE",placeholder:"\u8F93\u5165\u9879\u76EE\u540D\u79F0",maxLength:80,value:Wo,disabled:Ca,onChange:t=>jn(t.target.value)}),a("button",{type:"submit",disabled:Ca},"\u641C\u7D22"),ce("\u5237\u65B0\u9879\u76EE\u76EE\u5F55",()=>io({query:Wo}),{disabled:Ca})),Ca?a("p",{role:"status",className:"pc_dot_muted"},"\u6B63\u5728\u8BFB\u53D6\u6240\u9009\u5185\u5BB9\u2026"):null,Vo?a("p",{role:"alert",className:"pc_dot_error"},Vo):null,rt?a("div",null,a("p",{className:"pc_dot_muted"},`\u672C\u6B21\u5339\u914D ${rt.matchedTotal} \u4E2A${rt.items.length?` \xB7 \u663E\u793A ${rt.offset+1}\u2013${rt.offset+rt.items.length}`:""}`),rt.items.length?rt.items.map(t=>a("div",{className:"pc_dot_row",key:t.id,"data-catalog-project":t.id},a("div",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},t.disambiguator?`${t.disambiguator} \xB7 `:"",t.watched?"\u6B63\u5728\u6301\u7EED\u5173\u6CE8":"\u6309\u9700\u67E5\u770B")),ce("\u5355\u6B21\u67E5\u770B",()=>Zs(t),{disabled:Ca||ge?.paused===!0,"aria-label":`\u5355\u6B21\u67E5\u770B ${t.label}${t.disambiguator?` ${t.disambiguator}`:""}`}))):a("p",{className:"pc_dot_empty"},rt.total?"\u6CA1\u6709\u5339\u914D\u7684\u9879\u76EE\uFF0C\u8BD5\u8BD5\u5176\u4ED6\u540D\u79F0\u3002":"Harness \u4E2D\u8FD8\u6CA1\u6709\u5DF2\u767B\u8BB0\u9879\u76EE\u3002"),a("div",{className:"pc_dot_actions"},ce("\u4E0A\u4E00\u9875",()=>io({query:rt.query,offset:Math.max(0,rt.offset-rt.limit),expectedRevision:rt.revision}),{disabled:Ca||rt.offset===0}),ce("\u4E0B\u4E00\u9875",()=>io({query:rt.query,offset:rt.nextOffset,expectedRevision:rt.revision}),{disabled:Ca||!rt.hasMore}))):null,Ko?a("section",{className:"pc_dot_result","aria-label":"\u5355\u6B21\u9879\u76EE\u8D44\u6599"},a("div",{className:"pc_dot_header"},a("h3",null,Ko.project.label),ce("\u6536\u8D77\u8D44\u6599",()=>oo(null))),a("p",{className:"pc_dot_muted"},"\u672C\u6B21\u53EA\u8BFB\u9879\u76EE\u56FA\u5B9A\u8BF4\u660E\uFF1B\u4E0D\u4F1A\u52A0\u5165\u6301\u7EED\u5173\u6CE8\u3001\u8BFB\u53D6\u804A\u5929\u5386\u53F2\u6216\u521B\u5EFA\u8BA1\u5212\u3002"),...Ko.sources.map(t=>a("div",{className:"pc_dot_source",key:t.path},a("strong",null,t.path),a("p",{className:"pc_dot_muted"},t.modifiedAt?`\u66F4\u65B0 ${ht(t.modifiedAt)}`:"",t.truncated?" \xB7 \u5DF2\u622A\u65AD\uFF0C\u5F53\u524D\u9884\u89C8\u4E0D\u662F\u5B8C\u6574\u6587\u4EF6":""),t.status==="ok"?a("pre",null,t.text):a("p",{className:"pc_dot_muted"},t.status==="missing"?"\u8FD9\u4E2A\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1B\u4E0D\u80FD\u636E\u6B64\u5224\u65AD\u9879\u76EE\u8FDB\u5C55\u3002":"\u8FD9\u4E2A\u6587\u4EF6\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6\u3002")))):null):a("p",{className:"pc_dot_empty"},"\u5148\u786E\u8BA4\u5FAE\u4FE1\u8FDE\u63A5\uFF0C\u518D\u67E5\u770B\u4F60\u7684\u9879\u76EE\u76EE\u5F55\u3002")),Or=a("div",null,a("div",{className:"pc_dot_header"},a("div",null,a("h1",null,"\u9879\u76EE"),a("p",{className:"pc_dot_muted"},"\u6240\u6709\u9879\u76EE\u90FD\u80FD\u6309\u9700\u67E5\u770B\uFF0C\u91CD\u8981\u7684\u4E8B\u518D\u6301\u7EED\u5173\u6CE8\u3002")),mt?null:ce("\u9009\u62E9\u5173\u6CE8\u9879\u76EE",()=>Ut(!0))),Rr,Tt(`\u6301\u7EED\u5173\u6CE8 \xB7 ${St.length}/5`,a("p",{className:"pc_dot_muted"},"\u80CC\u666F\u3001\u7ED3\u679C\u548C\u540E\u7EED\u5B89\u6392\uFF0C\u4ECE\u8FD9\u91CC\u63A5\u7740\u8D70\u3002\u5173\u6CE8\u540D\u989D\u53EA\u9650\u5236\u540E\u53F0\u8DDF\u8FDB\u3002"),Ta.projects?St.length?a("div",{className:"pc_dot_project_cards"},St.map(t=>a("article",{className:"pc_dot_project_card",key:t.id},a("p",{className:"pc_dot_eyebrow"},"\u9879\u76EE"),a("h2",null,t.label),a("p",{className:"pc_dot_muted"},zo(t)?`\u4E0A\u6B21\u8D44\u6599\u66F4\u65B0 ${ht(zo(t))}`:"\u5C1A\u65E0\u8FD1\u671F\u8D44\u6599"),a("p",{className:"pc_dot_excerpt"},hn(t)&&t.overview.nextSteps[0]?t.overview.nextSteps[0].text:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u4E0B\u4E00\u6B65\u3002\u76F4\u63A5\u8BF4\u8BF4\u4F60\u60F3\u63A8\u8FDB\u4EC0\u4E48\u3002"),a("div",{className:"pc_dot_actions"},ce("\u67E5\u770B\u9879\u76EE",()=>co(t.id)),mt?null:ce("\u7EE7\u7EED\u804A",()=>aa(`\u8BF7\u770B\u770B\u300C${t.label}\u300D\u7684\u6700\u65B0\u8FDB\u5C55\u3002`,t.id)),ce("\u6765\u6E90\u4E0E\u8BB0\u5F55",()=>co(t.id,"sources")))))):a("p",{className:"pc_dot_empty"},"\u8FD8\u6CA1\u6709\u5173\u6CE8\u9879\u76EE\u3002\u53EF\u4EE5\u5148\u8FDE\u63A5\u5FAE\u4FE1\uFF0C\u518D\u9009\u4E00\u4E2A\u9879\u76EE\u5F00\u59CB\u3002"):a("p",{className:"pc_dot_empty"},"\u5173\u6CE8\u5217\u8868\u6682\u4E0D\u53EF\u7528\u3002"))),ki=a("div",null,a(K,{controller:k,workspaceController:V}),a("details",{className:"pc_goal_legacy"},a("summary",null,"\u5DE5\u4F5C\u533A\u76EE\u5F55\u4E0E\u539F\u6709\u5173\u6CE8\u8BB0\u5F55"),a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u4FDD\u7559\u65E7\u5173\u6CE8\u3001\u56FA\u5B9A\u8BF4\u660E\u548C\u5B89\u6392\u3002\u5DE5\u4F5C\u533A\u662F\u8D44\u6599\u5165\u53E3\uFF0C\u76EE\u6807\u9879\u76EE\u5728\u4E0A\u65B9\u7EC4\u7EC7\u3002"),Or)),Ni=yo(Io&&!nn?Mo():lt,{sample:Io&&!nn,loading:Fa.phase==="loading"}),Mr=async(t,s={})=>{let u=s.cardId?`${s.projectId}:${s.cardId}`:"";u&&["approve","retry"].includes(t)&&En(S=>new Set(S).add(u));try{let S=await Ea("/api/project_companion/item",{action:t,...s});S?.openSession&&Wt(S.sessionId)?(A(S.text||"\u5DF2\u6253\u5F00\u8FD9\u4E2A\u4F1A\u8BDD\u3002"),await Pt(S.sessionId)):S?.fallback==="open_session"&&Wt(S.sessionId)?(A(S.text||M.today.toast.approveUnsupported),await Pt(S.sessionId)):S?.ok?(A(S.text||M.today.toast.handled),zn(typeof S.undoId=="string"?S.undoId:"")):B(S?.revoked?"\u8FD9\u4E2A\u9879\u76EE\u7684\u6388\u6743\u5DF2\u7ECF\u6536\u56DE\uFF1B\u6CA1\u6709\u6267\u884C\u4EFB\u4F55\u52A8\u4F5C\u3002":S?.stale?"\u8FD9\u5F20\u5361\u7247\u5DF2\u7ECF\u8FC7\u671F\uFF0C\u4ECA\u5929\u9875\u5DF2\u5237\u65B0\uFF1B\u6CA1\u6709\u6267\u884C\u3002":S?.error||"\u64CD\u4F5C\u7ED3\u679C\u5F85\u6838\u5BF9\uFF1B\u672A\u81EA\u52A8\u91CD\u8BD5\u3002"),await wt.current.refreshNow()}catch(S){B(`${S?.message||"\u64CD\u4F5C\u7ED3\u679C\u5F85\u6838\u5BF9\u3002"} \u672A\u81EA\u52A8\u91CD\u8BD5\u3002`)}finally{u&&En(S=>{let Z=new Set(S);return Z.delete(u),Z})}},Lr=async()=>{if(Zo)try{let t=await Ea("/api/project_companion/item",{action:"undo",undoId:Zo});t?.ok?(A(t.text||"\u5DF2\u7ECF\u64A4\u9500\u3002"),zn("")):B(t?.error||"\u8FD9\u6B21\u64A4\u9500\u6CA1\u6709\u5B8C\u6210\u3002"),await wt.current.refreshNow()}catch(t){B(t?.message||"\u8FD9\u6B21\u64A4\u9500\u6CA1\u6709\u5B8C\u6210\u3002")}},Fr=async t=>{tn(!0),Uo(!0),It(""),ne({dockOpen:!0});let s=await Gn();try{let u=await Ea("/api/project_companion/say",{text:t});if(u?.fallback==="stage_draft"){if(pn(t),u.foregroundChanged===!0){It("\u524D\u53F0\u4F1A\u8BDD\u5DF2\u7ECF\u5207\u6362\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u6CA1\u6709\u6295\u5230\u65E7\u4F1A\u8BDD\u3002");return}if(!s){It("\u8FD8\u6CA1\u6709\u53EF\u7528\u7684\u539F\u751F\u4F1A\u8BDD\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u4E0D\u4F1A\u4E22\u3002");return}try{(await $e(r,s.sessionId,t,AbortSignal.timeout(15e3),null,void 0,!0))?.status==="applied"?(It("\u5DF2\u653E\u8FDB\u539F\u751F\u8F93\u5165\u6846\uFF0C\u6309\u56DE\u8F66\u7531\u4F60\u53D1\u9001\uFF1B\u539F\u8BDD\u4E5F\u4FDD\u7559\u5728\u4E0B\u65B9\u3002"),i.focus(s)):It("\u539F\u751F\u5BF9\u8BDD\u5DF2\u6709\u8349\u7A3F\uFF0C\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF1B\u6CA1\u6709\u8986\u76D6\u3002")}catch{It("\u539F\u751F\u8F93\u5165\u6846\u6682\u4E0D\u53EF\u7528\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u53EF\u4EE5\u590D\u5236\u540E\u7EE7\u7EED\u3002")}return}if(!u?.ok)throw new Error(u?.error||M.today.toast.sayFailed);A(u.text||"\u6536\u5230\uFF0C\u6211\u53BB\u529E\u3002"),It(u.mode==="steer"?"\u524D\u53F0\u6B63\u5728\u8DD1\uFF0C\u8FD9\u53E5\u8BDD\u6309\u63D2\u8BDD\u6295\u9012\u4E86\u3002":"\u5DF2\u6295\u7ED9\u524D\u53F0\u4F1A\u8BDD\uFF1B\u7B49\u5B83\u63A5\u5230\u540E\u7684\u8D26\u672C\u56DE\u6267\u3002"),await wt.current.refreshNow()}catch(u){pn(t),B(u?.message||M.today.toast.sayFailed)}},Po=(t="")=>{typeof t=="string"&&t&&Xo(t),setTimeout(()=>{try{document.querySelector("[data-muse-capsule-input]")?.focus?.()}catch{}},0)},Br=t=>{Xo(s=>s.trim()?`${s.trim()} ${t}`:t),un(),Po()},ya=async(t={})=>{if(!L.current)return null;Oa.current++,B(""),we(!0);try{let s=await Ea("/api/project_companion/muse",t);if(L.current&&s&&typeof s=="object"&&(Oa.current++,Pn(u=>$s(u,s))),!s?.ok)return L.current&&B(s?.error||"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002"),s;if(L.current){if(s.undoToken){let u=t.action==="dossier_act";So({token:s.undoToken,kind:u?"dossier":"profile",message:s.text||(u?"\u5DF2\u529E\u59A5\u3002":"\u521A\u624D\u90A3\u6761\u8BB0\u5FC6\u5DF2\u7ECF\u66F4\u65B0\u3002"),expiresAt:s.undoExpiresAt})}else(t.action==="profile_undo"||t.action==="dossier_undo")&&So(null);s.text&&A(s.text)}return["superagent_pending","rhythm_configure","routine_toggle","workspace_brief_refresh","promise_draft_save","promise_draft_reset","dossier_act","dossier_undo","connector_toggle"].includes(t.action)&&await wt.current.refreshNow(),s}catch(s){return L.current&&B(s?.message||"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002"),null}finally{L.current&&we(!1)}},ho=()=>{Ia.current&&(clearInterval(Ia.current),Ia.current=null)},qr=async t=>{if(!L.current)return;if(t==="wechat"){Ut(!0);return}let s={google_suite:{authAction:"google_suite_authorize",authKey:"googleSuiteAuth",target:["https://accounts.google.com","/o/oauth2/v2/auth"],sources:["gmail","calendar","drive"],label:"Google"},flomo:{authAction:"flomo_authorize",authKey:"flomoAuth",target:["https://flomoapp.com","/integration/grant"],sources:["flomo"],label:"flomo"},dida:{authAction:"dida_authorize",authKey:"didaAuth",target:["https://dida365.com","/oauth/authorize"],sources:["dida"],label:"\u6EF4\u7B54\u6E05\u5355"}}[t];if(!s)return;ho(),B(""),ca({id:t,phase:"starting",message:"\u6B63\u5728\u6253\u5F00\u6388\u6743\u9875\u2026"});let u=async Z=>{let ae=await fetch("/api/project_companion/context",{method:Z===void 0?"GET":"POST",credentials:"same-origin",redirect:"error",cache:"no-store",...Z!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)}:{}}),ie={};try{ie=await ae.json()}catch{}if(!ae.ok)throw Object.assign(new Error(ie?.error||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),{code:ie?.code});return ie},S=async(Z,ae)=>{let ie=typeof Z?.bindingRevision=="string"?Z.bindingRevision:null;for(let ct of ae){let Ye=Z?.sources?.find(Ct=>Ct.id===ct);Ye?.configured===!0&&Ye.enabled!==!0&&await u({action:"connect",source:ct,...ie?{expectedBindingRevision:ie}:{}})}};try{let Z=await u();if(!L.current)return;if(t==="google_suite"?Z.googleSuiteAuth?.refreshConfigured===!0&&(Z.googleSuiteAuth.grantedSources||[]).length>0:!!Z.sources?.some(sa=>s.sources.includes(sa.id)&&sa.configured===!0)){if(await S(Z,t==="google_suite"?Z.googleSuiteAuth.grantedSources:s.sources),!L.current)return;await ga({includeContext:!0}),await wt.current.refreshNow(),L.current&&ca(null);return}let ie=typeof Z?.bindingRevision=="string"?Z.bindingRevision:null,ct=await u({action:s.authAction,...ie?{expectedBindingRevision:ie}:{}});if(!L.current)return;let Ye=new URL(ct?.url);if(Ye.origin!==s.target[0]||Ye.pathname!==s.target[1]||Ye.username||Ye.password||Ye.hash||typeof ct?.expiresAt!="string"||!Number.isFinite(Date.parse(ct.expiresAt))||Date.parse(ct.expiresAt)<=Date.now())throw new Error("\u6388\u6743\u94FE\u63A5\u65E0\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");try{window.open?.(Ye.toString(),"_blank","noopener,noreferrer")}catch{}let Ct=Math.min(Date.parse(ct.expiresAt),Date.now()+3e5);ca({id:t,phase:"waiting",url:Ye.toString(),deadline:Ct,remaining:Math.max(0,Math.ceil((Ct-Date.now())/1e3)),label:s.label}),Ia.current=setInterval(async()=>{if(!L.current){ho();return}let sa=Math.max(0,Math.ceil((Ct-Date.now())/1e3));if(ca(Rt=>Rt&&Rt.id===t&&Rt.phase==="waiting"?{...Rt,remaining:sa}:Rt),sa<=0){ho(),ca({id:t,phase:"error",message:"\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u70B9\u53F3\u4FA7\u6309\u94AE\u5373\u53EF\u91CD\u65B0\u6253\u5F00\u3002"});return}try{let Rt=await u();if(!L.current)return;let Ua=Rt?.[s.authKey];if(!Ua?.authInProgress)if(ho(),Ua?.lastAttempt?.status==="failed")ca({id:t,phase:"error",message:"\u672C\u6B21\u6388\u6743\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002"});else if(Ua?.refreshConfigured===!0||Rt?.sources?.some(va=>s.sources.includes(va.id)&&va.configured===!0)){if(await S(Rt,t==="google_suite"&&Ua?.grantedSources||s.sources),!L.current)return;await ga({includeContext:!0}),await wt.current.refreshNow(),L.current&&ca(null)}else ca({id:t,phase:"error",message:"\u5C1A\u672A\u786E\u8BA4\u4FDD\u5B58\u6388\u6743\uFF0C\u8BF7\u91CD\u8BD5\u3002"})}catch{}},2e3)}catch(Z){if(ho(),L.current){let ae=Z?.code==="GOOGLE_CONNECTION_UNAVAILABLE"?"\u6682\u65F6\u8FDE\u4E0D\u5230 Google \u6388\u6743\u63A5\u53E3\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC/\u4EE3\u7406\u540E\u518D\u70B9\u4E00\u6B21\u3002":Z?.message||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";ca({id:t,phase:"error",message:ae})}}},bo=()=>{Da.current&&(clearInterval(Da.current),Da.current=null)},za=async t=>{let s=await fetch("/api/project_companion/context",{method:t===void 0?"GET":"POST",credentials:"same-origin",redirect:"error",cache:"no-store",...t!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:{}}),u={};try{u=await s.json()}catch{}if(!s.ok)throw Object.assign(new Error(u?.error||"\u64CD\u4F5C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),{code:u?.code});return u},os=t=>(t?.googleWorkspaceMcp?.accounts||[]).map(s=>`${s.id}:${s.authorizedAt}:${(s.grantedServices||[]).join(",")}`).join("|"),Gr=async({loginHint:t="",addAccount:s=!1}={})=>{if(L.current){bo(),B(""),Xt({phase:"starting",message:"\u6B63\u5728\u6253\u5F00 Google \u6388\u6743\u9875\u2026"});try{let u=await za();if(!L.current)return;no(u);let S=os(u),Z=typeof u?.bindingRevision=="string"?u.bindingRevision:null,ae=await za({action:"google_mcp_authorize",...t?{loginHint:t}:{},...s?{addAccount:!0}:{},...Z?{expectedBindingRevision:Z}:{}});if(!L.current)return;let ie=new URL(ae?.url);if(ie.origin!=="https://accounts.google.com"||ie.pathname!=="/o/oauth2/v2/auth"||ie.username||ie.password||ie.hash||typeof ae?.expiresAt!="string"||!Number.isFinite(Date.parse(ae.expiresAt))||Date.parse(ae.expiresAt)<=Date.now())throw new Error("\u6388\u6743\u94FE\u63A5\u65E0\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");try{window.open?.(ie.toString(),"_blank","noopener,noreferrer")}catch{}let ct=Math.min(Date.parse(ae.expiresAt),Date.now()+3e5);Xt({phase:"waiting",url:ie.toString(),deadline:ct,remaining:Math.max(0,Math.ceil((ct-Date.now())/1e3)),loginHint:t}),Da.current=setInterval(async()=>{if(!L.current){bo();return}let Ye=Math.max(0,Math.ceil((ct-Date.now())/1e3));if(Xt(Ct=>Ct&&Ct.phase==="waiting"?{...Ct,remaining:Ye}:Ct),Ye<=0){bo(),Xt({phase:"error",message:"\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u8FDE\u63A5 Google \u8D26\u53F7\u3002"});return}try{let Ct=await za();if(!L.current)return;os(Ct)!==S&&(bo(),no(Ct),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow())}catch{}},2e3)}catch(u){if(bo(),L.current){let S=u?.code==="GOOGLE_CONNECTION_UNAVAILABLE"?"\u6682\u65F6\u8FDE\u4E0D\u5230 Google \u6388\u6743\u63A5\u53E3\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u7F51\u7EDC\u6216\u4EE3\u7406\u540E\u91CD\u8BD5\u3002":u?.message||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00 Google \u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";Xt({phase:"error",message:S})}}}},Hr=async(t,s,u)=>{if(!(!L.current||an)){Co(!0);try{let S=Ma??await za(),Z=typeof S?.bindingRevision=="string"?S.bindingRevision:null,ae=await za({action:"google_mcp_toggle_service",accountId:t,service:s,enabled:u,...Z?{expectedBindingRevision:Z}:{}});if(!L.current)return;no(ae),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow()}catch(S){L.current&&Xt({phase:"error",message:S?.message||"\u5207\u6362\u670D\u52A1\u5F00\u5173\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u91CD\u8BD5\u3002"})}finally{L.current&&Co(!1)}}},Wr=async t=>{if(!(!L.current||an)){Co(!0);try{let s=Ma??await za(),u=typeof s?.bindingRevision=="string"?s.bindingRevision:null,S=await za({action:"google_mcp_disconnect",accountId:t,...u?{expectedBindingRevision:u}:{}});if(!L.current)return;no(S),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow()}catch(s){L.current&&Xt({phase:"error",message:s?.message||"\u65AD\u5F00\u8D26\u53F7\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u91CD\u8BD5\u3002"})}finally{L.current&&Co(!1)}}},Vr=async(t,s="")=>{if(t){B(""),we(!0);try{let u=await Ea("/api/project_companion/promise",{promiseId:t,...typeof s=="string"&&s.trim()?{draftText:s.trim()}:{}});if(!u?.ok){L.current&&B(u?.error||"\u8FD9\u4EF6\u4E8B\u6682\u65F6\u6CA1\u80FD\u63A8\u51FA\u53BB\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002");return}L.current&&(A(u.text||"\u5DF2\u63A8\u7ED9\u524D\u53F0\u4F1A\u8BDD\u8DDF\u8FDB\u3002"),Rn(null)),await wt.current.refreshNow(),ga()}catch(u){L.current&&B(u?.message||"\u8FD9\u4EF6\u4E8B\u6682\u65F6\u6CA1\u80FD\u63A8\u51FA\u53BB\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002")}finally{L.current&&we(!1)}}},Kr=t=>{t&&(t.type==="today_act"?Mr(t.act,{projectId:t.projectId,cardId:t.cardId}):t.type==="dispatch_promise"?Vr(t.promiseId,t.draftText):t.type==="ask"?Po(t.prompt||""):t.type==="focus_capsule"?Po(t.prefill||""):t.type==="queue_pending"?ya({action:"superagent_pending",text:t.text,title:t.title,workspacePath:t.workspacePath}):t.type==="refresh_workspace_brief"?ya({action:"workspace_brief_refresh"}):t.type==="open_brief"?On(!0):t.type==="open_workspace_picker"&&V.open())},Ur=t=>{if(!t){V.open();return}if(St.some(u=>u.id===t)){co(t);return}if(k.getSnapshot().status?.projects?.some(u=>u.id===t)){k.open(t);return}let s=(lt?.dots||[]).find(u=>u.projectId===t&&Wt(u.sessionId));s?Pt(s.sessionId):V.open()},Qr=Io&&!nn&&(lt?.access?.count??0)===0&&!Aa?.dossiers?.length&&!lt?.workspaceBrief?.workspaces?.length&&!Aa?.workspaceBrief?.workspaces?.length&&!lt?.digest?.lastDigest?.text&&!lt?.superagent?.milestones?.length?{...Mo(),sample:!0,superagent:lt?.superagent??Aa?.superagent,profile:lt?.profile??Aa?.profile,digest:lt?.digest??Aa?.digest,workspaceBrief:null,events:Array.isArray(lt?.events)?lt.events:[],connection:lt?.connection??Mo().connection}:lt,Zr=Ds({activity:Qr,muse:Aa,workbench:ge,contextSnapshot:Ma,now:new Date,loading:Fa.phase==="loading"&&!lt,pinnedKey:Rs}),_n=!it.skipped&&(lt?.access?.count??0)===0&&(Aa?.mountedWorkspaces?.length??0)===0&&(V.getSnapshot().summary?.selectedCount??0)===0,Ro=e.useCallback(async(t="",s)=>{if(L.current){Ft(u=>({...u,loading:!0,error:""}));try{let u=await $("/api/project_companion/workspaces",{action:"list",query:t,offset:0,limit:50,...s?{pickedWorkspaceId:s}:{}});if(!L.current)return;let S=Array.isArray(u?.items)?u.items:[];Ft(Z=>{let ae=s&&u?.pickedId?[...new Set([...Z.selectedIds,u.pickedId])]:Z.items===null&&Array.isArray(u?.selectedIds)?u.selectedIds:Z.selectedIds;return{...Z,items:S,meta:{revision:u?.revision,catalogRevision:u?.catalogRevision},selectedIds:ae,loading:!1,pickerOpen:!1}})}catch(u){L.current&&Ft(S=>({...S,loading:!1,error:u?.message||"\u5DE5\u4F5C\u533A\u5217\u8868\u6682\u65F6\u4E0D\u53EF\u7528\u3002"}))}}},[]);e.useEffect(()=>{_n&&it.items===null&&!it.loading&&Ro("")},[_n,it.items,it.loading,Ro]);let ns=e.useCallback(async t=>{let s=t!==!1;if(Fs(s),!!s){No(!0);try{let u=await ya({action:"mobile_pair_info"});L.current&&u?.ok&&u.pair&&Mn(u.pair)}finally{L.current&&No(!1)}}},[]),ss=!!(E(r.slots)&&typeof x.renderFactorySlot=="function"),Jr={needed:_n,skipped:it.skipped,items:it.items||[],selectedIds:it.selectedIds,query:it.query,expanded:it.expanded,loading:it.loading,saving:it.saving,error:it.error,canPick:ss,pickerOpen:it.pickerOpen,pickerBtnRef:Ln,onTogglePicker:()=>Ft(t=>({...t,pickerOpen:!t.pickerOpen})),renderFolderPicker:()=>ss?x.renderFactorySlot("workspace.picker",{open:it.pickerOpen,anchorRef:Ln,selectedId:void 0,onPick:t=>{Ro("",t)},onClose:()=>Ft(t=>({...t,pickerOpen:!1}))}):null,onQueryChange:t=>Ft(s=>({...s,query:t})),onSearch:t=>{Ro(t)},onToggle:t=>Ft(s=>({...s,selectedIds:s.selectedIds.includes(t)?s.selectedIds.filter(u=>u!==t):[...s.selectedIds,t]})),onSelectAll:()=>Ft(t=>{let s=(t.items||[]).map(u=>u.id);return{...t,selectedIds:t.selectedIds.length>=s.length?[]:s}}),onExpandAll:()=>Ft(t=>({...t,expanded:!0})),onSkip:()=>{Ft(t=>({...t,skipped:!0})),ns(!0)},onConfirm:async()=>{if(!(!it.meta?.revision||!it.meta?.catalogRevision||it.selectedIds.length===0||it.saving)){Ft(t=>({...t,saving:!0,error:""}));try{await $("/api/project_companion/workspaces",{action:"save",expectedRevision:it.meta.revision,expectedCatalogRevision:it.meta.catalogRevision,workspaceIds:it.selectedIds});try{globalThis.localStorage?.setItem("dot.sample.cleared","1")}catch{}L.current&&(Fn(!0),Ft(t=>({...t,saving:!1,skipped:!0}))),await V.refresh(),await ya({action:"workspace_brief_refresh"}),await wt.current.refreshNow(),await Vt()}catch(t){L.current&&Ft(s=>({...s,saving:!1,error:t?.message||"\u4FDD\u5B58\u5DE5\u4F5C\u533A\u6388\u6743\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002"}))}}}},Yr=De?a("div",{className:"pc_dot_draft_review",role:"group","aria-label":"\u672A\u4FDD\u5B58\u7684\u4FEE\u6539"},a("h3",null,"\u8FD9\u6B21\u4FEE\u6539\u8FD8\u6CA1\u4FDD\u5B58"),a("p",null,"\u4FDD\u7559\u8349\u7A3F\u540E\uFF0C\u4E0B\u6B21\u6253\u5F00\u540C\u4E00\u9879\u76EE\u7684\u8FD9\u9879\u5185\u5BB9\u53EF\u7EE7\u7EED\u3002\u5173\u95ED\u4E0D\u4F1A\u4FDD\u5B58\u6B63\u5F0F\u8BB0\u5F55\u3002"),a("div",{className:"pc_dot_actions"},ce("\u7EE7\u7EED\u7F16\u8F91",()=>gn("continue"),{className:"pc_dot_primary",disabled:!1,autoFocus:!0}),ce("\u4FDD\u7559\u8349\u7A3F\u5E76\u79BB\u5F00",()=>gn("keep"),{disabled:!1}),ce("\u653E\u5F03\u4FEE\u6539\u5E76\u79BB\u5F00",()=>gn("discard"),{disabled:!1}))):null;return a("div",{className:"pc_dot_muse_shell",ref:pe,"data-dot-workbench":!0,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,width:"100%",position:"relative"}},a(W,{model:Zr,tab:Jo,onTab:t=>{Yo(t),t==="connections"&&gt(!0)},busy:Ee,feedback:ke?{kind:"error",text:ke}:U?{kind:"info",text:U,actionLabel:Zo?"\u64A4\u9500":void 0,onAction:Lr}:null,undoBanner:La,onDismissUndo:()=>So(null),onAction:Kr,onSaveDraft:(t,s)=>ya({action:"promise_draft_save",promiseId:t.promiseId,text:s,what:t.title}),onMuseAct:ya,onPinFocus:t=>Rn(t),onAsk:t=>Po(t),onOpenProject:Ur,onOpenSession:t=>{Pt(t)},onOpenWorkspacePicker:()=>{V.open()},onOpenSettings:()=>Ut(!0),capsuleDraft:Os,onCapsuleDraft:Xo,onCarryInsight:Br,conversationOpen:en,onToggleConversation:t=>{t?un():Ys()},onSendChat:Fr,briefOpen:Ms,onBriefOpen:On,mobilePairOpen:Ls,mobilePairData:Bs,mobilePairLoading:qs,onOpenMobilePair:ns,workspaceOnboarding:Jr,mobileHeroDismissed:Gs,onDismissMobileHero:()=>{try{globalThis.localStorage?.setItem("dot.mobile.hero.dismissed","1")}catch{}Hs(!0)},contextHintDismissed:Ws,onDismissContextHint:()=>{try{globalThis.localStorage?.setItem("dot.context.hint.dismissed","1")}catch{}Vs(!0)},onRotateMobilePair:async()=>{No(!0);try{let t=await ya({action:"mobile_pair_rotate"});L.current&&t?.ok&&t.pair&&Mn(t.pair)}finally{L.current&&No(!1)}},renderConversation:()=>a("div",{style:{display:"flex",flexDirection:"column",gap:10,height:"100%",minHeight:0}},$n?a("p",{className:"muse-notice-line",role:"status",style:{margin:0}},$n):null,Qo?a("div",{className:"muse-notice-line info",style:{margin:0,justifyContent:"space-between",gap:8}},a("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},`\u4FDD\u7559\u8349\u7A3F\uFF1A${Qo}`),a("div",{className:"muse-hairline-actions"},a("button",{type:"button",className:"muse-btn-link",onClick:()=>{try{navigator.clipboard?.writeText?.(Qo)}catch{}}},"\u590D\u5236"),a("button",{type:"button",className:"muse-btn-link",onClick:()=>Tn("")},"\u6E05\u7A7A"))):null,_t&&mn&&!Gt?a(I,{target:_t,owner:"dock",SessionProvider:x.SessionProvider,renderSlot:x.renderSlot,slotName:"dot.desktop.conversation",onOpenHistory:()=>Pt(_t.sessionId)}):a("p",{className:"muse-rail-empty",style:{padding:16}},_t?"\u539F\u751F\u5BF9\u8BDD\u8981\u5728\u5B8C\u6574 Harness \u7A97\u53E3\u4E2D\u6253\u5F00\uFF1B\u539F\u8BDD\u548C\u8349\u7A3F\u4ECD\u4FDD\u7559\u3002":"\u8FD8\u6CA1\u6709\u53EF\u7528\u7684\u539F\u751F\u5BF9\u8BDD\u3002\u8BF4\u4E00\u53E5\uFF0CDot \u4F1A\u5148\u5EFA\u4E00\u4E2A\u684C\u9762\u4F1A\u8BDD\u3002")),renderConnectionsHost:()=>a("div",{style:{paddingTop:12,display:"flex",flexDirection:"column",gap:14}},a(P,{controller:V}),mt?null:a("div",null,a("button",{type:"button",className:"muse-btn-outline",onClick:()=>Ut(!0)},"\u7BA1\u7406\u5FAE\u4FE1\u626B\u7801\u4E0E\u65E7\u7248\u5173\u6CE8\u9879\u76EE"))),connectorAuth:Ks,onStartConnectorAuth:qr,googleMcp:Ma?.googleWorkspaceMcp??null,legacyGoogleConfigured:!!(Ma?.googleSuiteAuth?.refreshConfigured||Ma?.googleCalendarAuth?.refreshConfigured),googleMcpAuth:Us,googleMcpBusy:an,onStartGoogleMcpAuth:Gr,onToggleGoogleMcpService:Hr,onDisconnectGoogleMcpAccount:Wr}),a(Q,{controller:V,onOrganized:()=>{try{globalThis.localStorage?.setItem("dot.sample.cleared","1")}catch{}Fn(!0),Yo("today"),ya({action:"workspace_brief_refresh"}),Vt(),wt.current.refreshNow()},renderFactorySlot:x.renderFactorySlot,slots:r.slots}),a(N,{controller:k,renderConversation:({projectId:t,target:s})=>!Gt&&typeof x.SessionProvider=="function"&&typeof x.renderSlot=="function"?a(I,{target:s,projectId:t,owner:"project",SessionProvider:x.SessionProvider,renderSlot:x.renderSlot,slotName:"dot.project.conversation",onOpenHistory:()=>Pt(s.sessionId)}):a("p",{role:"status"},"\u539F\u751F\u5BF9\u8BDD\u7EC4\u4EF6\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u6062\u590D Harness \u5DE5\u4F5C\u53F0\u540E\u91CD\u65B0\u6253\u5F00\uFF1B\u5DF2\u6709\u8349\u7A3F\u4ECD\u4FDD\u7559\u3002")}),Je?a(q,{open:!0,closeLabel:"\u5173\u95ED",title:Je==="project"?st?.label??"\u9879\u76EE\u8BE6\u60C5":Je==="follow"?"\u540E\u7EED\u600E\u4E48\u8DDF\u8FDB":Je==="memory"?"\u7EA0\u6B63\u9879\u76EE\u8BB0\u5FC6":"\u672C\u6B21\u6267\u884C\u56DE\u590D",className:"pc_dot_modal",onClose:or},a("div",{className:"pc_dot_drawer"},ke?a("p",{className:"pc_dot_error",role:"alert"},ke):null,De?Yr:Je==="project"?pr():Je==="follow"?ur():Je==="memory"?fr():mr())):null,Ja&&!mt?a(q,{open:!0,closeLabel:"\u5173\u95ED",title:"\u8FDE\u63A5\u5FAE\u4FE1\u4E0E\u9009\u62E9\u9879\u76EE",className:"pc_setup_modal",onClose:()=>{Ut(!1),Vt()}},a(zs,{renderFactorySlot:x.renderFactorySlot,close:()=>{Ut(!1),Vt()}})):null)}typeof r.layout?.selectPanel=="function"&&(r.effect(()=>{if(typeof document>"u")return;let x=document.createElement("style");return x.dataset.pluginCss="dsh-project-companion/workbench",x.textContent=be+Re+kn,document.head.appendChild(x),()=>x.remove()}),r.effect(()=>r.slots.inject("main",()=>r.slots.register({name:"main",key:R,children:{"dot.desktop.conversation":{kind:"single",scope:"session"},"dot.project.conversation":{kind:"single",scope:"session"}}},Ts))),r.effect(()=>r.slots.inject("dot.project.conversation",()=>r.slots.register({name:"dot.project.conversation"},p))),r.effect(()=>r.slots.inject("dot.desktop.conversation",()=>r.slots.register({name:"dot.desktop.conversation"},p))),r.effect(()=>r.slots.inject("dot.overlay.conversation",()=>r.slots.register({name:"dot.overlay.conversation"},p))),y(r,vo),r.effect(()=>r.slots.inject("sidebar.panellist",()=>r.slots.register({name:"sidebar.panellist",id:R,order:5,label:"DSH Dot"},ra))));let zs=x=>de(x,!1),Es=x=>a("div",null,de(x,!1),a(b),a(Y));r.effect(()=>r.slots.inject("settings.section",()=>r.slots.register({name:"settings.section",id:"project-companion",order:39,label:"DSH Dot"},Es))),(typeof r.get=="function"?r.get("configForms",!1):r.configForms)&&r.effect(()=>r.slots.inject("plugins.row.config",()=>r.slots.register({name:"plugins.row.config",key:"@oxmumu3/dsh-project-companion#project-companion"},x=>x.view==="summary"?"DeepSeek Dot \u7684\u4E2A\u4EBA\u8D44\u6599\u6765\u6E90\u4E0E\u539F\u751F\u51ED\u636E\u914D\u7F6E":a("div",{className:"pc_setup"},a("h3",null,"\u8FDE\u63A5\u51ED\u636E"),a(f)))))}return{inject:Ge,apply:g,createDotAppearance:dt,prepareDotDraft:$e,createDesktopConversationController:Ue,desktopConversationCanEmbed:et}}var mi="6e4f3aa";window.__ModuleLoader__.load({id:"@oxmumu3/dsh-project-companion",factory:d=>(console.log("dot client build "+mi),Sn(d))});
2517
+ \u8BF7\u5148\u6838\u5BF9\u539F\u4E8B\u9879\u53CA\u5DF2\u6388\u6743\u6765\u6E90\uFF0C\u518D\u5E2E\u6211\u68B3\u7406\u4E0B\u4E00\u6B65\uFF1B\u4E0D\u8981\u81EA\u52A8\u91CD\u505A\u65E7\u4EFB\u52A1\u6216\u6269\u5927\u8BFB\u53D6\u8303\u56F4\u3002`,"")),Array.isArray(t.sources)&&t.sources.length?a("details",null,a("summary",null,"\u67E5\u770B\u4F9D\u636E"),...t.sources.slice(0,5).map(Dr)):null)),$r=mo?Tt("\u503C\u5F97\u4F60\u7559\u610F",mo?mo.length?mo.map(jr):a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u5DF2\u6838\u5BF9\u7684\u8303\u56F4\u5185\uFF0C\u6CA1\u6709\u5F85\u5904\u7406\u4E8B\u9879\u3002\u6709\u4E8B\u53EF\u4EE5\u76F4\u63A5\u544A\u8BC9 Dot\u3002"):a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u4E8B\u9879\u5C1A\u672A\u6838\u5BF9\uFF0C\u6062\u590D\u5165\u53E3\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),typeof na?.note=="string"&&na.note?a("p",{className:"pc_dot_muted"},na.note):null,na?.truncated?a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u53EA\u5C55\u793A\u6700\u8FD1 5 \u6761\u4E8B\u9879\uFF0C\u5176\u4ED6\u5185\u5BB9\u8BF7\u5728\u539F\u4F1A\u8BDD\u6838\u5BF9\u3002"):null):a("p",{className:"pc_dot_muted pc_dot_inline_note"},["\u5F53\u524D\u4E8B\u9879\u8FD8\u6CA1\u6838\u5BF9\u3002",typeof na?.note=="string"?na.note:null].filter(Boolean).join(" ")),Tr=t=>t.nextDueAt?ht(t.nextDueAt):[t.dailyTime?`\u6BCF\u5929 ${t.dailyTime}`:"",Number.isInteger(t.weeklyDay)&&t.weeklyTime?`\u6BCF\u5468${["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"][t.weeklyDay]} ${t.weeklyTime}`:"",Number.isInteger(t.everyMinutes)?`\u6BCF ${t.everyMinutes} \u5206\u949F`:""].filter(Boolean).join(" \xB7 ")||"\u4E0B\u6B21\u65F6\u95F4\u5F85\u786E\u8BA4",zr=a("section",{className:"pc_dot_section pc_dot_schedule","data-dot-schedule-rail":!0},a("h3",null,"\u4E0B\u4E00\u6B21\u5B89\u6392"),typeof Wa?.label=="string"&&Wa.label?a("p",{className:"pc_dot_muted","data-dot-review-health":!0},`\u6700\u8FD1\u8FD0\u884C\uFF1A${Wa.label}${Wa.at?" \xB7 "+ht(Wa.at):""}\u3002\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002`):null,fo?fo.length?fo.map(t=>a("div",{className:"pc_dot_schedule_item",key:t.id},a("strong",null,t.title),a("span",{className:"pc_dot_plan_status"},{stored:"\u5DF2\u4FDD\u5B58",paused:"\u5DF2\u6682\u505C",blocked:"\u5F53\u524D\u53D7\u963B"}[t.status]??"\u72B6\u6001\u5F85\u6838\u5BF9"),a("p",null,Tr(t)),a("p",{className:"pc_dot_muted"},t.timeZone||"\u65F6\u533A\u5F85\u6838\u5BF9"),a("p",{className:"pc_dot_muted"},{"personal-review":"\u4E2A\u4EBA\u56DE\u987E",news:"AI \u65E5\u62A5","project-followup":"\u9879\u76EE\u8DDF\u8FDB"}[t.source]??"\u539F\u5B89\u6392"))):Ka?.available===!0?a("p",{className:"pc_dot_empty"},"\u5F53\u524D\u8303\u56F4\u6CA1\u6709\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\u3002\u60F3\u8DDF\u8FDB\u4E00\u4EF6\u4E8B\uFF0C\u53EF\u4EE5\u76F4\u63A5\u544A\u8BC9 Dot\u3002"):a("p",{className:"pc_dot_empty"},"\u5B89\u6392\u72B6\u6001\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"):a("p",{className:"pc_dot_empty"},"\u5B89\u6392\u72B6\u6001\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),Ka?.available!==!0&&fo?.length?a("p",{className:"pc_dot_muted"},"\u90E8\u5206\u5B89\u6392\u5C1A\u672A\u786E\u8BA4\uFF1B\u8FD9\u91CC\u4FDD\u7559\u5DF2\u6838\u5BF9\u7684\u5B89\u6392\u3002"):null,fo?.length?a("p",{className:"pc_dot_rail_note"},Wa?"\u8FD9\u91CC\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\uFF1B\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002":"\u8FD9\u91CC\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u5B89\u6392\uFF1B\u8FD0\u884C\u5C1A\u672A\u6838\u9A8C\uFF0C\u624B\u673A\u6536\u5230\u4ECD\u672A\u786E\u8BA4\u3002"):null,Ka?.truncated?a("p",{className:"pc_dot_muted"},"\u6B64\u5904\u4E3A\u6709\u9650\u5B89\u6392\uFF0C\u5176\u4F59\u8BF7\u5728\u539F\u5165\u53E3\u6838\u5BF9\u3002"):null),Er=Ta.jobs?a("details",{className:"pc_dot_history","data-dot-history":!0},a("summary",null,`\u627E\u5230\u4E4B\u524D\u804A\u8FC7\u7684\u4E8B\uFF08${Hn.length}\uFF09`),vn.length?vn.map(wr):a("p",{className:"pc_dot_muted"},"\u8FD9\u4E2A\u7A97\u53E3\u91CC\u8FD8\u6CA1\u6709\u4EA4\u529E\u8BB0\u5F55\u3002"),a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u5C55\u793A\u6700\u8FD1\u7684\u6709\u9650\u8BB0\u5F55\uFF1B\u66F4\u65E9\u7684\u539F\u59CB\u5185\u5BB9\u5728 Dot \u4F1A\u8BDD\u4E2D\u3002"),_t?ce("\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u5386\u53F2",()=>Pt(_t.sessionId)):ha&&!mt?ce("\u6253\u5F00\u5B8C\u6574\u4F1A\u8BDD\u5386\u53F2",()=>Pt(ge.connection.sessionId)):null):null,Pr=Va&&!St.length?a("section",{className:"pc_dot_sample","data-dot-sample":!0,"aria-label":"\u793A\u4F8B\u7B80\u62A5"},a("div",{className:"pc_dot_sample_head"},a("span",{className:"pc_dot_badge"},"\u793A\u4F8B"),a("strong",null,"Dot \u4F1A\u628A\u4E00\u4EF6\u4E8B\u63A5\u6210\u8FD9\u6837\u7684\u7B80\u62A5")),a("ol",null,a("li",null,a("b",null,"\u8FDB\u5C55"),"\u4E09\u7BC7\u9605\u8BFB\u6750\u6599\u5DF2\u7ECF\u6574\u7406\u597D\uFF0C\u8BD5\u8BFB\u8BF4\u660E\u8FD8\u5DEE\u4E00\u7248\u3002"),a("li",null,a("b",null,"\u5361\u70B9"),"\u4F5C\u8005\u5E0C\u671B\u628A\u201C\u8BFB\u5B8C\u6709\u4EC0\u4E48\u6536\u83B7\u201D\u8BF4\u5F97\u66F4\u5177\u4F53\u3002"),a("li",null,a("b",null,"\u4E0B\u4E00\u6B65"),"\u5148\u627E 5 \u4F4D\u8BFB\u8005\u8BD5\u8BFB\u4E00\u5468\uFF0C\u518D\u51B3\u5B9A\u662F\u5426\u6269\u5927\u3002")),a("p",{className:"pc_dot_muted"},"\u8FD9\u662F\u793A\u4F8B\uFF0C\u4E0D\u662F\u4F60\u7684\u8D44\u6599\u3002\u8FDE\u4E0A\u9879\u76EE\u6216\u5FAE\u4FE1\u540E\uFF0CDot \u4F1A\u6309\u4F60\u7684\u6765\u6E90\u6574\u7406\u3002"),a("div",{className:"pc_dot_actions"},ce("\u7528\u8FD9\u4E2A\u4F8B\u5B50\u804A\u804A",()=>aa("\u8BF7\u53C2\u8003\u793A\u4F8B\u7B80\u62A5\u7684\u7ED3\u6784\uFF0C\u5E2E\u6211\u6574\u7406\u4E00\u4EF6\u6B63\u5728\u63A8\u8FDB\u7684\u4E8B\uFF1A\u5148\u53EA\u95EE\u6211\u7F3A\u7684\u76EE\u6807\u548C\u8303\u56F4\uFF0C\u518D\u7ED9\u6211\u8FDB\u5C55\u3001\u5361\u70B9\u548C\u4E0B\u4E00\u6B65\u3002"),{className:"pc_dot_text_button"}))):null,wi=a("div",null,xr,a("div",{className:"pc_dot_home_grid pc_dot_home_single"},a("div",{className:"pc_dot_column"},Ar,Ir,a(m,{controller:V,organizer:k,onOrganize:async()=>{await k.organize(V.getSnapshot().summary?.revision)&&lo("projects")}}),Pr,Va?a("p",{className:"pc_dot_intro"},"\u4E0D\u7528\u5148\u628A\u6240\u6709\u4E1C\u897F\u914D\u597D\u3002\u5148\u804A\u624B\u4E0A\u7684\u4EFB\u52A1\uFF0C\u7528\u5230\u90AE\u4EF6\u3001\u65E5\u7A0B\u6216\u9879\u76EE\u65F6\uFF0C\u518D\u8FDE\u63A5\u9700\u8981\u7684\u8D44\u6599\u3002"):$r,Er,a("details",{className:"pc_dot_legacy_details"},a("summary",null,"\u66F4\u591A\u539F\u4F1A\u8BDD\u5B89\u6392\u4E0E\u68C0\u67E5"),_r,vr)),a("details",{className:"pc_dot_more","aria-label":"\u5B89\u6392\u4E0E\u5173\u6CE8"},a("summary",null,"\u5B89\u6392\u4E0E\u5173\u6CE8"),Va?Tt("\u4ECE\u4F60\u624B\u4E0A\u7684\u4E8B\u5F00\u59CB",a("p",{className:"pc_dot_muted"},"\u5148\u4EA4\u4EE3\u4E00\u4E2A\u76EE\u6807\uFF0CDot \u4F1A\u63A5\u7740\u6574\u7406\u4E0B\u4E00\u6B65\u3002\u7528\u5230\u8D44\u6599\u65F6\u518D\u8FDE\u63A5\uFF1B\u60F3\u5B9A\u65F6\u8DDF\u8FDB\u65F6\u518D\u5B89\u6392\u3002")):zr,Tt("\u6B63\u5728\u5173\u6CE8",Ta.projects?St.length?St.map(t=>ce(a("span",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},zo(t)?`\u8D44\u6599\u66F4\u65B0 ${ht(zo(t))}`:"\u5C1A\u65E0\u8FD1\u671F\u8D44\u6599")),()=>co(t.id),{key:t.id,className:"pc_dot_project_mini"})):a("p",{className:"pc_dot_muted"},"\u5148\u4ECE\u624B\u5934\u7684\u4E00\u4EF6\u4E8B\u5F00\u59CB\uFF0C\u9700\u8981\u65F6\u518D\u5173\u6CE8\u9879\u76EE\u3002"):a("p",{className:"pc_dot_muted"},"\u5173\u6CE8\u8303\u56F4\u89C1\u4E0A\u65B9\u63D0\u793A\u3002"),mt?null:ce("\u9009\u62E9\u5173\u6CE8\u9879\u76EE",()=>Ut(!0))),Ce?a("details",{className:"pc_dot_review_details"},a("summary",null,"\u4E2A\u4EBA\u56DE\u987E\u4E0E\u8D44\u8BAF\u8BBE\u7F6E"),yr):null))),Rr=Tt(`\u5168\u90E8\u9879\u76EE${rt?` \xB7 ${rt.total}`:""}`,a("p",{className:"pc_dot_muted"},"\u6309\u540D\u79F0\u627E\u5230 Harness \u5DF2\u767B\u8BB0\u7684\u9879\u76EE\uFF0C\u5355\u6B21\u67E5\u770B\u4E0D\u5360\u6301\u7EED\u5173\u6CE8\u540D\u989D\u3002\u5217\u76EE\u5F55\u4E0D\u4F1A\u8BFB\u53D6\u9879\u76EE\u5185\u5BB9\u3002"),ha?a("div",null,a("form",{"aria-label":"\u641C\u7D22\u5168\u90E8\u9879\u76EE",className:"pc_dot_actions",onSubmit:t=>{t.preventDefault(),io({query:Wo})}},a("input",{"aria-label":"\u641C\u7D22\u5168\u90E8\u9879\u76EE",placeholder:"\u8F93\u5165\u9879\u76EE\u540D\u79F0",maxLength:80,value:Wo,disabled:Ca,onChange:t=>jn(t.target.value)}),a("button",{type:"submit",disabled:Ca},"\u641C\u7D22"),ce("\u5237\u65B0\u9879\u76EE\u76EE\u5F55",()=>io({query:Wo}),{disabled:Ca})),Ca?a("p",{role:"status",className:"pc_dot_muted"},"\u6B63\u5728\u8BFB\u53D6\u6240\u9009\u5185\u5BB9\u2026"):null,Vo?a("p",{role:"alert",className:"pc_dot_error"},Vo):null,rt?a("div",null,a("p",{className:"pc_dot_muted"},`\u672C\u6B21\u5339\u914D ${rt.matchedTotal} \u4E2A${rt.items.length?` \xB7 \u663E\u793A ${rt.offset+1}\u2013${rt.offset+rt.items.length}`:""}`),rt.items.length?rt.items.map(t=>a("div",{className:"pc_dot_row",key:t.id,"data-catalog-project":t.id},a("div",null,a("strong",null,t.label),a("small",{className:"pc_dot_muted"},t.disambiguator?`${t.disambiguator} \xB7 `:"",t.watched?"\u6B63\u5728\u6301\u7EED\u5173\u6CE8":"\u6309\u9700\u67E5\u770B")),ce("\u5355\u6B21\u67E5\u770B",()=>Zs(t),{disabled:Ca||ge?.paused===!0,"aria-label":`\u5355\u6B21\u67E5\u770B ${t.label}${t.disambiguator?` ${t.disambiguator}`:""}`}))):a("p",{className:"pc_dot_empty"},rt.total?"\u6CA1\u6709\u5339\u914D\u7684\u9879\u76EE\uFF0C\u8BD5\u8BD5\u5176\u4ED6\u540D\u79F0\u3002":"Harness \u4E2D\u8FD8\u6CA1\u6709\u5DF2\u767B\u8BB0\u9879\u76EE\u3002"),a("div",{className:"pc_dot_actions"},ce("\u4E0A\u4E00\u9875",()=>io({query:rt.query,offset:Math.max(0,rt.offset-rt.limit),expectedRevision:rt.revision}),{disabled:Ca||rt.offset===0}),ce("\u4E0B\u4E00\u9875",()=>io({query:rt.query,offset:rt.nextOffset,expectedRevision:rt.revision}),{disabled:Ca||!rt.hasMore}))):null,Ko?a("section",{className:"pc_dot_result","aria-label":"\u5355\u6B21\u9879\u76EE\u8D44\u6599"},a("div",{className:"pc_dot_header"},a("h3",null,Ko.project.label),ce("\u6536\u8D77\u8D44\u6599",()=>oo(null))),a("p",{className:"pc_dot_muted"},"\u672C\u6B21\u53EA\u8BFB\u9879\u76EE\u56FA\u5B9A\u8BF4\u660E\uFF1B\u4E0D\u4F1A\u52A0\u5165\u6301\u7EED\u5173\u6CE8\u3001\u8BFB\u53D6\u804A\u5929\u5386\u53F2\u6216\u521B\u5EFA\u8BA1\u5212\u3002"),...Ko.sources.map(t=>a("div",{className:"pc_dot_source",key:t.path},a("strong",null,t.path),a("p",{className:"pc_dot_muted"},t.modifiedAt?`\u66F4\u65B0 ${ht(t.modifiedAt)}`:"",t.truncated?" \xB7 \u5DF2\u622A\u65AD\uFF0C\u5F53\u524D\u9884\u89C8\u4E0D\u662F\u5B8C\u6574\u6587\u4EF6":""),t.status==="ok"?a("pre",null,t.text):a("p",{className:"pc_dot_muted"},t.status==="missing"?"\u8FD9\u4E2A\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1B\u4E0D\u80FD\u636E\u6B64\u5224\u65AD\u9879\u76EE\u8FDB\u5C55\u3002":"\u8FD9\u4E2A\u6587\u4EF6\u5F53\u524D\u65E0\u6CD5\u8BFB\u53D6\u3002")))):null):a("p",{className:"pc_dot_empty"},"\u5148\u786E\u8BA4\u5FAE\u4FE1\u8FDE\u63A5\uFF0C\u518D\u67E5\u770B\u4F60\u7684\u9879\u76EE\u76EE\u5F55\u3002")),Or=a("div",null,a("div",{className:"pc_dot_header"},a("div",null,a("h1",null,"\u9879\u76EE"),a("p",{className:"pc_dot_muted"},"\u6240\u6709\u9879\u76EE\u90FD\u80FD\u6309\u9700\u67E5\u770B\uFF0C\u91CD\u8981\u7684\u4E8B\u518D\u6301\u7EED\u5173\u6CE8\u3002")),mt?null:ce("\u9009\u62E9\u5173\u6CE8\u9879\u76EE",()=>Ut(!0))),Rr,Tt(`\u6301\u7EED\u5173\u6CE8 \xB7 ${St.length}/5`,a("p",{className:"pc_dot_muted"},"\u80CC\u666F\u3001\u7ED3\u679C\u548C\u540E\u7EED\u5B89\u6392\uFF0C\u4ECE\u8FD9\u91CC\u63A5\u7740\u8D70\u3002\u5173\u6CE8\u540D\u989D\u53EA\u9650\u5236\u540E\u53F0\u8DDF\u8FDB\u3002"),Ta.projects?St.length?a("div",{className:"pc_dot_project_cards"},St.map(t=>a("article",{className:"pc_dot_project_card",key:t.id},a("p",{className:"pc_dot_eyebrow"},"\u9879\u76EE"),a("h2",null,t.label),a("p",{className:"pc_dot_muted"},zo(t)?`\u4E0A\u6B21\u8D44\u6599\u66F4\u65B0 ${ht(zo(t))}`:"\u5C1A\u65E0\u8FD1\u671F\u8D44\u6599"),a("p",{className:"pc_dot_excerpt"},hn(t)&&t.overview.nextSteps[0]?t.overview.nextSteps[0].text:"\u8FD8\u6CA1\u6709\u8BB0\u5F55\u4E0B\u4E00\u6B65\u3002\u76F4\u63A5\u8BF4\u8BF4\u4F60\u60F3\u63A8\u8FDB\u4EC0\u4E48\u3002"),a("div",{className:"pc_dot_actions"},ce("\u67E5\u770B\u9879\u76EE",()=>co(t.id)),mt?null:ce("\u7EE7\u7EED\u804A",()=>aa(`\u8BF7\u770B\u770B\u300C${t.label}\u300D\u7684\u6700\u65B0\u8FDB\u5C55\u3002`,t.id)),ce("\u6765\u6E90\u4E0E\u8BB0\u5F55",()=>co(t.id,"sources")))))):a("p",{className:"pc_dot_empty"},"\u8FD8\u6CA1\u6709\u5173\u6CE8\u9879\u76EE\u3002\u53EF\u4EE5\u5148\u8FDE\u63A5\u5FAE\u4FE1\uFF0C\u518D\u9009\u4E00\u4E2A\u9879\u76EE\u5F00\u59CB\u3002"):a("p",{className:"pc_dot_empty"},"\u5173\u6CE8\u5217\u8868\u6682\u4E0D\u53EF\u7528\u3002"))),ki=a("div",null,a(K,{controller:k,workspaceController:V}),a("details",{className:"pc_goal_legacy"},a("summary",null,"\u5DE5\u4F5C\u533A\u76EE\u5F55\u4E0E\u539F\u6709\u5173\u6CE8\u8BB0\u5F55"),a("p",{className:"pc_dot_muted"},"\u8FD9\u91CC\u4FDD\u7559\u65E7\u5173\u6CE8\u3001\u56FA\u5B9A\u8BF4\u660E\u548C\u5B89\u6392\u3002\u5DE5\u4F5C\u533A\u662F\u8D44\u6599\u5165\u53E3\uFF0C\u76EE\u6807\u9879\u76EE\u5728\u4E0A\u65B9\u7EC4\u7EC7\u3002"),Or)),Ni=yo(Io&&!nn?Mo():lt,{sample:Io&&!nn,loading:Fa.phase==="loading"}),Mr=async(t,s={})=>{let u=s.cardId?`${s.projectId}:${s.cardId}`:"";u&&["approve","retry"].includes(t)&&En(S=>new Set(S).add(u));try{let S=await Ea("/api/project_companion/item",{action:t,...s});S?.openSession&&Wt(S.sessionId)?(A(S.text||"\u5DF2\u6253\u5F00\u8FD9\u4E2A\u4F1A\u8BDD\u3002"),await Pt(S.sessionId)):S?.fallback==="open_session"&&Wt(S.sessionId)?(A(S.text||M.today.toast.approveUnsupported),await Pt(S.sessionId)):S?.ok?(A(S.text||M.today.toast.handled),zn(typeof S.undoId=="string"?S.undoId:"")):B(S?.revoked?"\u8FD9\u4E2A\u9879\u76EE\u7684\u6388\u6743\u5DF2\u7ECF\u6536\u56DE\uFF1B\u6CA1\u6709\u6267\u884C\u4EFB\u4F55\u52A8\u4F5C\u3002":S?.stale?"\u8FD9\u5F20\u5361\u7247\u5DF2\u7ECF\u8FC7\u671F\uFF0C\u4ECA\u5929\u9875\u5DF2\u5237\u65B0\uFF1B\u6CA1\u6709\u6267\u884C\u3002":S?.error||"\u64CD\u4F5C\u7ED3\u679C\u5F85\u6838\u5BF9\uFF1B\u672A\u81EA\u52A8\u91CD\u8BD5\u3002"),await wt.current.refreshNow()}catch(S){B(`${S?.message||"\u64CD\u4F5C\u7ED3\u679C\u5F85\u6838\u5BF9\u3002"} \u672A\u81EA\u52A8\u91CD\u8BD5\u3002`)}finally{u&&En(S=>{let Z=new Set(S);return Z.delete(u),Z})}},Lr=async()=>{if(Zo)try{let t=await Ea("/api/project_companion/item",{action:"undo",undoId:Zo});t?.ok?(A(t.text||"\u5DF2\u7ECF\u64A4\u9500\u3002"),zn("")):B(t?.error||"\u8FD9\u6B21\u64A4\u9500\u6CA1\u6709\u5B8C\u6210\u3002"),await wt.current.refreshNow()}catch(t){B(t?.message||"\u8FD9\u6B21\u64A4\u9500\u6CA1\u6709\u5B8C\u6210\u3002")}},Fr=async t=>{tn(!0),Uo(!0),It(""),ne({dockOpen:!0});let s=await Gn();try{let u=await Ea("/api/project_companion/say",{text:t});if(u?.fallback==="stage_draft"){if(pn(t),u.foregroundChanged===!0){It("\u524D\u53F0\u4F1A\u8BDD\u5DF2\u7ECF\u5207\u6362\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u6CA1\u6709\u6295\u5230\u65E7\u4F1A\u8BDD\u3002");return}if(!s){It("\u8FD8\u6CA1\u6709\u53EF\u7528\u7684\u539F\u751F\u4F1A\u8BDD\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u4E0D\u4F1A\u4E22\u3002");return}try{(await $e(r,s.sessionId,t,AbortSignal.timeout(15e3),null,void 0,!0))?.status==="applied"?(It("\u5DF2\u653E\u8FDB\u539F\u751F\u8F93\u5165\u6846\uFF0C\u6309\u56DE\u8F66\u7531\u4F60\u53D1\u9001\uFF1B\u539F\u8BDD\u4E5F\u4FDD\u7559\u5728\u4E0B\u65B9\u3002"),i.focus(s)):It("\u539F\u751F\u5BF9\u8BDD\u5DF2\u6709\u8349\u7A3F\uFF0C\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF1B\u6CA1\u6709\u8986\u76D6\u3002")}catch{It("\u539F\u751F\u8F93\u5165\u6846\u6682\u4E0D\u53EF\u7528\uFF1B\u539F\u8BDD\u4FDD\u7559\u5728\u4E0B\u65B9\uFF0C\u53EF\u4EE5\u590D\u5236\u540E\u7EE7\u7EED\u3002")}return}if(!u?.ok)throw new Error(u?.error||M.today.toast.sayFailed);A(u.text||"\u6536\u5230\uFF0C\u6211\u53BB\u529E\u3002"),It(u.mode==="steer"?"\u524D\u53F0\u6B63\u5728\u8DD1\uFF0C\u8FD9\u53E5\u8BDD\u6309\u63D2\u8BDD\u6295\u9012\u4E86\u3002":"\u5DF2\u6295\u7ED9\u524D\u53F0\u4F1A\u8BDD\uFF1B\u7B49\u5B83\u63A5\u5230\u540E\u7684\u8D26\u672C\u56DE\u6267\u3002"),await wt.current.refreshNow()}catch(u){pn(t),B(u?.message||M.today.toast.sayFailed)}},Po=(t="")=>{typeof t=="string"&&t&&Xo(t),setTimeout(()=>{try{document.querySelector("[data-muse-capsule-input]")?.focus?.()}catch{}},0)},Br=t=>{Xo(s=>s.trim()?`${s.trim()} ${t}`:t),un(),Po()},ya=async(t={})=>{if(!L.current)return null;Oa.current++,B(""),we(!0);try{let s=await Ea("/api/project_companion/muse",t);if(L.current&&s&&typeof s=="object"&&(Oa.current++,Pn(u=>$s(u,s))),!s?.ok)return L.current&&B(s?.error||"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002"),s;if(L.current){if(s.undoToken){let u=t.action==="dossier_act";So({token:s.undoToken,kind:u?"dossier":"profile",message:s.text||(u?"\u5DF2\u529E\u59A5\u3002":"\u521A\u624D\u90A3\u6761\u8BB0\u5FC6\u5DF2\u7ECF\u66F4\u65B0\u3002"),expiresAt:s.undoExpiresAt})}else(t.action==="profile_undo"||t.action==="dossier_undo")&&So(null);s.text&&A(s.text)}return["superagent_pending","rhythm_configure","routine_toggle","workspace_brief_refresh","promise_draft_save","promise_draft_reset","dossier_act","dossier_undo","connector_toggle"].includes(t.action)&&await wt.current.refreshNow(),s}catch(s){return L.current&&B(s?.message||"\u64CD\u4F5C\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002"),null}finally{L.current&&we(!1)}},ho=()=>{Ia.current&&(clearInterval(Ia.current),Ia.current=null)},qr=async t=>{if(!L.current)return;if(t==="wechat"){Ut(!0);return}let s={google_suite:{authAction:"google_suite_authorize",authKey:"googleSuiteAuth",target:["https://accounts.google.com","/o/oauth2/v2/auth"],sources:["gmail","calendar","drive"],label:"Google"},flomo:{authAction:"flomo_authorize",authKey:"flomoAuth",target:["https://flomoapp.com","/integration/grant"],sources:["flomo"],label:"flomo"},dida:{authAction:"dida_authorize",authKey:"didaAuth",target:["https://dida365.com","/oauth/authorize"],sources:["dida"],label:"\u6EF4\u7B54\u6E05\u5355"}}[t];if(!s)return;ho(),B(""),ca({id:t,phase:"starting",message:"\u6B63\u5728\u6253\u5F00\u6388\u6743\u9875\u2026"});let u=async Z=>{let ae=await fetch("/api/project_companion/context",{method:Z===void 0?"GET":"POST",credentials:"same-origin",redirect:"error",cache:"no-store",...Z!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(Z)}:{}}),ie={};try{ie=await ae.json()}catch{}if(!ae.ok)throw Object.assign(new Error(ie?.error||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),{code:ie?.code});return ie},S=async(Z,ae)=>{let ie=typeof Z?.bindingRevision=="string"?Z.bindingRevision:null;for(let ct of ae){let Ye=Z?.sources?.find(Ct=>Ct.id===ct);Ye?.configured===!0&&Ye.enabled!==!0&&await u({action:"connect",source:ct,...ie?{expectedBindingRevision:ie}:{}})}};try{let Z=await u();if(!L.current)return;if(t==="google_suite"?Z.googleSuiteAuth?.refreshConfigured===!0&&(Z.googleSuiteAuth.grantedSources||[]).length>0:!!Z.sources?.some(sa=>s.sources.includes(sa.id)&&sa.configured===!0)){if(await S(Z,t==="google_suite"?Z.googleSuiteAuth.grantedSources:s.sources),!L.current)return;await ga({includeContext:!0}),await wt.current.refreshNow(),L.current&&ca(null);return}let ie=typeof Z?.bindingRevision=="string"?Z.bindingRevision:null,ct=await u({action:s.authAction,...ie?{expectedBindingRevision:ie}:{}});if(!L.current)return;let Ye=new URL(ct?.url);if(Ye.origin!==s.target[0]||Ye.pathname!==s.target[1]||Ye.username||Ye.password||Ye.hash||typeof ct?.expiresAt!="string"||!Number.isFinite(Date.parse(ct.expiresAt))||Date.parse(ct.expiresAt)<=Date.now())throw new Error("\u6388\u6743\u94FE\u63A5\u65E0\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");try{window.open?.(Ye.toString(),"_blank","noopener,noreferrer")}catch{}let Ct=Math.min(Date.parse(ct.expiresAt),Date.now()+3e5);ca({id:t,phase:"waiting",url:Ye.toString(),deadline:Ct,remaining:Math.max(0,Math.ceil((Ct-Date.now())/1e3)),label:s.label}),Ia.current=setInterval(async()=>{if(!L.current){ho();return}let sa=Math.max(0,Math.ceil((Ct-Date.now())/1e3));if(ca(Rt=>Rt&&Rt.id===t&&Rt.phase==="waiting"?{...Rt,remaining:sa}:Rt),sa<=0){ho(),ca({id:t,phase:"error",message:"\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u70B9\u53F3\u4FA7\u6309\u94AE\u5373\u53EF\u91CD\u65B0\u6253\u5F00\u3002"});return}try{let Rt=await u();if(!L.current)return;let Ua=Rt?.[s.authKey];if(!Ua?.authInProgress)if(ho(),Ua?.lastAttempt?.status==="failed")ca({id:t,phase:"error",message:"\u672C\u6B21\u6388\u6743\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\u3002"});else if(Ua?.refreshConfigured===!0||Rt?.sources?.some(va=>s.sources.includes(va.id)&&va.configured===!0)){if(await S(Rt,t==="google_suite"&&Ua?.grantedSources||s.sources),!L.current)return;await ga({includeContext:!0}),await wt.current.refreshNow(),L.current&&ca(null)}else ca({id:t,phase:"error",message:"\u5C1A\u672A\u786E\u8BA4\u4FDD\u5B58\u6388\u6743\uFF0C\u8BF7\u91CD\u8BD5\u3002"})}catch{}},2e3)}catch(Z){if(ho(),L.current){let ae=Z?.code==="GOOGLE_CONNECTION_UNAVAILABLE"?"\u6682\u65F6\u8FDE\u4E0D\u5230 Google \u6388\u6743\u63A5\u53E3\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC/\u4EE3\u7406\u540E\u518D\u70B9\u4E00\u6B21\u3002":Z?.message||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00\u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";ca({id:t,phase:"error",message:ae})}}},bo=()=>{Da.current&&(clearInterval(Da.current),Da.current=null)},za=async t=>{let s=await fetch("/api/project_companion/context",{method:t===void 0?"GET":"POST",credentials:"same-origin",redirect:"error",cache:"no-store",...t!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}:{}}),u={};try{u=await s.json()}catch{}if(!s.ok)throw Object.assign(new Error(u?.error||"\u64CD\u4F5C\u5C1A\u672A\u751F\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"),{code:u?.code});return u},os=t=>(t?.googleWorkspaceMcp?.accounts||[]).map(s=>`${s.id}:${s.authorizedAt}:${(s.grantedServices||[]).join(",")}`).join("|"),Gr=async({loginHint:t="",addAccount:s=!1}={})=>{if(L.current){bo(),B(""),Xt({phase:"starting",message:"\u6B63\u5728\u6253\u5F00 Google \u6388\u6743\u9875\u2026"});try{let u=await za();if(!L.current)return;no(u);let S=os(u),Z=typeof u?.bindingRevision=="string"?u.bindingRevision:null,ae=await za({action:"google_mcp_authorize",...t?{loginHint:t}:{},...s?{addAccount:!0}:{},...Z?{expectedBindingRevision:Z}:{}});if(!L.current)return;let ie=new URL(ae?.url);if(ie.origin!=="https://accounts.google.com"||ie.pathname!=="/o/oauth2/v2/auth"||ie.username||ie.password||ie.hash||typeof ae?.expiresAt!="string"||!Number.isFinite(Date.parse(ae.expiresAt))||Date.parse(ae.expiresAt)<=Date.now())throw new Error("\u6388\u6743\u94FE\u63A5\u65E0\u6548\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");try{window.open?.(ie.toString(),"_blank","noopener,noreferrer")}catch{}let ct=Math.min(Date.parse(ae.expiresAt),Date.now()+3e5);Xt({phase:"waiting",url:ie.toString(),deadline:ct,remaining:Math.max(0,Math.ceil((ct-Date.now())/1e3)),loginHint:t}),Da.current=setInterval(async()=>{if(!L.current){bo();return}let Ye=Math.max(0,Math.ceil((ct-Date.now())/1e3));if(Xt(Ct=>Ct&&Ct.phase==="waiting"?{...Ct,remaining:Ye}:Ct),Ye<=0){bo(),Xt({phase:"error",message:"\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u8FDE\u63A5 Google \u8D26\u53F7\u3002"});return}try{let Ct=await za();if(!L.current)return;os(Ct)!==S&&(bo(),no(Ct),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow())}catch{}},2e3)}catch(u){if(bo(),L.current){let S=u?.code==="GOOGLE_CONNECTION_UNAVAILABLE"?"\u6682\u65F6\u8FDE\u4E0D\u5230 Google \u6388\u6743\u63A5\u53E3\uFF0C\u8BF7\u68C0\u67E5\u672C\u673A\u7F51\u7EDC\u6216\u4EE3\u7406\u540E\u91CD\u8BD5\u3002":u?.message||"\u6682\u65F6\u65E0\u6CD5\u6253\u5F00 Google \u6388\u6743\u9875\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002";Xt({phase:"error",message:S})}}}},Hr=async(t,s,u)=>{if(!(!L.current||an)){Co(!0);try{let S=Ma??await za(),Z=typeof S?.bindingRevision=="string"?S.bindingRevision:null,ae=await za({action:"google_mcp_toggle_service",accountId:t,service:s,enabled:u,...Z?{expectedBindingRevision:Z}:{}});if(!L.current)return;no(ae),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow()}catch(S){L.current&&Xt({phase:"error",message:S?.message||"\u5207\u6362\u670D\u52A1\u5F00\u5173\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u91CD\u8BD5\u3002"})}finally{L.current&&Co(!1)}}},Wr=async t=>{if(!(!L.current||an)){Co(!0);try{let s=Ma??await za(),u=typeof s?.bindingRevision=="string"?s.bindingRevision:null,S=await za({action:"google_mcp_disconnect",accountId:t,...u?{expectedBindingRevision:u}:{}});if(!L.current)return;no(S),Xt(null),await ga({includeContext:!1}),await wt.current.refreshNow()}catch(s){L.current&&Xt({phase:"error",message:s?.message||"\u65AD\u5F00\u8D26\u53F7\u5931\u8D25\uFF0C\u8BF7\u5237\u65B0\u91CD\u8BD5\u3002"})}finally{L.current&&Co(!1)}}},Vr=async(t,s="")=>{if(t){B(""),we(!0);try{let u=await Ea("/api/project_companion/promise",{promiseId:t,...typeof s=="string"&&s.trim()?{draftText:s.trim()}:{}});if(!u?.ok){L.current&&B(u?.error||"\u8FD9\u4EF6\u4E8B\u6682\u65F6\u6CA1\u80FD\u63A8\u51FA\u53BB\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002");return}L.current&&(A(u.text||"\u5DF2\u63A8\u7ED9\u524D\u53F0\u4F1A\u8BDD\u8DDF\u8FDB\u3002"),Rn(null)),await wt.current.refreshNow(),ga()}catch(u){L.current&&B(u?.message||"\u8FD9\u4EF6\u4E8B\u6682\u65F6\u6CA1\u80FD\u63A8\u51FA\u53BB\uFF0C\u8BF7\u5237\u65B0\u6838\u5BF9\u3002")}finally{L.current&&we(!1)}}},Kr=t=>{t&&(t.type==="today_act"?Mr(t.act,{projectId:t.projectId,cardId:t.cardId}):t.type==="dispatch_promise"?Vr(t.promiseId,t.draftText):t.type==="ask"?Po(t.prompt||""):t.type==="focus_capsule"?Po(t.prefill||""):t.type==="queue_pending"?ya({action:"superagent_pending",text:t.text,title:t.title,workspacePath:t.workspacePath}):t.type==="refresh_workspace_brief"?ya({action:"workspace_brief_refresh"}):t.type==="open_brief"?On(!0):t.type==="open_workspace_picker"&&V.open())},Ur=t=>{if(!t){V.open();return}if(St.some(u=>u.id===t)){co(t);return}if(k.getSnapshot().status?.projects?.some(u=>u.id===t)){k.open(t);return}let s=(lt?.dots||[]).find(u=>u.projectId===t&&Wt(u.sessionId));s?Pt(s.sessionId):V.open()},Qr=Io&&!nn&&(lt?.access?.count??0)===0&&!Aa?.dossiers?.length&&!lt?.workspaceBrief?.workspaces?.length&&!Aa?.workspaceBrief?.workspaces?.length&&!lt?.digest?.lastDigest?.text&&!lt?.superagent?.milestones?.length?{...Mo(),sample:!0,superagent:lt?.superagent??Aa?.superagent,profile:lt?.profile??Aa?.profile,digest:lt?.digest??Aa?.digest,workspaceBrief:null,events:Array.isArray(lt?.events)?lt.events:[],connection:lt?.connection??Mo().connection}:lt,Zr=Ds({activity:Qr,muse:Aa,workbench:ge,contextSnapshot:Ma,now:new Date,loading:Fa.phase==="loading"&&!lt,pinnedKey:Rs}),_n=!it.skipped&&(lt?.access?.count??0)===0&&(Aa?.mountedWorkspaces?.length??0)===0&&(V.getSnapshot().summary?.selectedCount??0)===0,Ro=e.useCallback(async(t="",s)=>{if(L.current){Ft(u=>({...u,loading:!0,error:""}));try{let u=await $("/api/project_companion/workspaces",{action:"list",query:t,offset:0,limit:50,...s?{pickedWorkspaceId:s}:{}});if(!L.current)return;let S=Array.isArray(u?.items)?u.items:[];Ft(Z=>{let ae=s&&u?.pickedId?[...new Set([...Z.selectedIds,u.pickedId])]:Z.items===null&&Array.isArray(u?.selectedIds)?u.selectedIds:Z.selectedIds;return{...Z,items:S,meta:{revision:u?.revision,catalogRevision:u?.catalogRevision},selectedIds:ae,loading:!1,pickerOpen:!1}})}catch(u){L.current&&Ft(S=>({...S,loading:!1,error:u?.message||"\u5DE5\u4F5C\u533A\u5217\u8868\u6682\u65F6\u4E0D\u53EF\u7528\u3002"}))}}},[]);e.useEffect(()=>{_n&&it.items===null&&!it.loading&&Ro("")},[_n,it.items,it.loading,Ro]);let ns=e.useCallback(async t=>{let s=t!==!1;if(Fs(s),!!s){No(!0);try{let u=await ya({action:"mobile_pair_info"});L.current&&u?.ok&&u.pair&&Mn(u.pair)}finally{L.current&&No(!1)}}},[]),ss=!!(E(r.slots)&&typeof x.renderFactorySlot=="function"),Jr={needed:_n,skipped:it.skipped,items:it.items||[],selectedIds:it.selectedIds,query:it.query,expanded:it.expanded,loading:it.loading,saving:it.saving,error:it.error,canPick:ss,pickerOpen:it.pickerOpen,pickerBtnRef:Ln,onTogglePicker:()=>Ft(t=>({...t,pickerOpen:!t.pickerOpen})),renderFolderPicker:()=>ss?x.renderFactorySlot("workspace.picker",{open:it.pickerOpen,anchorRef:Ln,selectedId:void 0,onPick:t=>{Ro("",t)},onClose:()=>Ft(t=>({...t,pickerOpen:!1}))}):null,onQueryChange:t=>Ft(s=>({...s,query:t})),onSearch:t=>{Ro(t)},onToggle:t=>Ft(s=>({...s,selectedIds:s.selectedIds.includes(t)?s.selectedIds.filter(u=>u!==t):[...s.selectedIds,t]})),onSelectAll:()=>Ft(t=>{let s=(t.items||[]).map(u=>u.id);return{...t,selectedIds:t.selectedIds.length>=s.length?[]:s}}),onExpandAll:()=>Ft(t=>({...t,expanded:!0})),onSkip:()=>{Ft(t=>({...t,skipped:!0})),ns(!0)},onConfirm:async()=>{if(!(!it.meta?.revision||!it.meta?.catalogRevision||it.selectedIds.length===0||it.saving)){Ft(t=>({...t,saving:!0,error:""}));try{await $("/api/project_companion/workspaces",{action:"save",expectedRevision:it.meta.revision,expectedCatalogRevision:it.meta.catalogRevision,workspaceIds:it.selectedIds});try{globalThis.localStorage?.setItem("dot.sample.cleared","1")}catch{}L.current&&(Fn(!0),Ft(t=>({...t,saving:!1,skipped:!0}))),await V.refresh(),await ya({action:"workspace_brief_refresh"}),await wt.current.refreshNow(),await Vt()}catch(t){L.current&&Ft(s=>({...s,saving:!1,error:t?.message||"\u4FDD\u5B58\u5DE5\u4F5C\u533A\u6388\u6743\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002"}))}}}},Yr=De?a("div",{className:"pc_dot_draft_review",role:"group","aria-label":"\u672A\u4FDD\u5B58\u7684\u4FEE\u6539"},a("h3",null,"\u8FD9\u6B21\u4FEE\u6539\u8FD8\u6CA1\u4FDD\u5B58"),a("p",null,"\u4FDD\u7559\u8349\u7A3F\u540E\uFF0C\u4E0B\u6B21\u6253\u5F00\u540C\u4E00\u9879\u76EE\u7684\u8FD9\u9879\u5185\u5BB9\u53EF\u7EE7\u7EED\u3002\u5173\u95ED\u4E0D\u4F1A\u4FDD\u5B58\u6B63\u5F0F\u8BB0\u5F55\u3002"),a("div",{className:"pc_dot_actions"},ce("\u7EE7\u7EED\u7F16\u8F91",()=>gn("continue"),{className:"pc_dot_primary",disabled:!1,autoFocus:!0}),ce("\u4FDD\u7559\u8349\u7A3F\u5E76\u79BB\u5F00",()=>gn("keep"),{disabled:!1}),ce("\u653E\u5F03\u4FEE\u6539\u5E76\u79BB\u5F00",()=>gn("discard"),{disabled:!1}))):null;return a("div",{className:"pc_dot_muse_shell",ref:pe,"data-dot-workbench":!0,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,width:"100%",position:"relative"}},a(W,{model:Zr,tab:Jo,onTab:t=>{Yo(t),t==="connections"&&gt(!0)},busy:Ee,feedback:ke?{kind:"error",text:ke}:U?{kind:"info",text:U,actionLabel:Zo?"\u64A4\u9500":void 0,onAction:Lr}:null,undoBanner:La,onDismissUndo:()=>So(null),onAction:Kr,onSaveDraft:(t,s)=>ya({action:"promise_draft_save",promiseId:t.promiseId,text:s,what:t.title}),onMuseAct:ya,onPinFocus:t=>Rn(t),onAsk:t=>Po(t),onOpenProject:Ur,onOpenSession:t=>{Pt(t)},onOpenWorkspacePicker:()=>{V.open()},onOpenSettings:()=>Ut(!0),capsuleDraft:Os,onCapsuleDraft:Xo,onCarryInsight:Br,conversationOpen:en,onToggleConversation:t=>{t?un():Ys()},onSendChat:Fr,briefOpen:Ms,onBriefOpen:On,mobilePairOpen:Ls,mobilePairData:Bs,mobilePairLoading:qs,onOpenMobilePair:ns,workspaceOnboarding:Jr,mobileHeroDismissed:Gs,onDismissMobileHero:()=>{try{globalThis.localStorage?.setItem("dot.mobile.hero.dismissed","1")}catch{}Hs(!0)},contextHintDismissed:Ws,onDismissContextHint:()=>{try{globalThis.localStorage?.setItem("dot.context.hint.dismissed","1")}catch{}Vs(!0)},onRotateMobilePair:async()=>{No(!0);try{let t=await ya({action:"mobile_pair_rotate"});L.current&&t?.ok&&t.pair&&Mn(t.pair)}finally{L.current&&No(!1)}},renderConversation:()=>a("div",{style:{display:"flex",flexDirection:"column",gap:10,height:"100%",minHeight:0}},$n?a("p",{className:"muse-notice-line",role:"status",style:{margin:0}},$n):null,Qo?a("div",{className:"muse-notice-line info",style:{margin:0,justifyContent:"space-between",gap:8}},a("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},`\u4FDD\u7559\u8349\u7A3F\uFF1A${Qo}`),a("div",{className:"muse-hairline-actions"},a("button",{type:"button",className:"muse-btn-link",onClick:()=>{try{navigator.clipboard?.writeText?.(Qo)}catch{}}},"\u590D\u5236"),a("button",{type:"button",className:"muse-btn-link",onClick:()=>Tn("")},"\u6E05\u7A7A"))):null,_t&&mn&&!Gt?a(I,{target:_t,owner:"dock",SessionProvider:x.SessionProvider,renderSlot:x.renderSlot,slotName:"dot.desktop.conversation",onOpenHistory:()=>Pt(_t.sessionId)}):a("p",{className:"muse-rail-empty",style:{padding:16}},_t?"\u539F\u751F\u5BF9\u8BDD\u8981\u5728\u5B8C\u6574 Harness \u7A97\u53E3\u4E2D\u6253\u5F00\uFF1B\u539F\u8BDD\u548C\u8349\u7A3F\u4ECD\u4FDD\u7559\u3002":"\u8FD8\u6CA1\u6709\u53EF\u7528\u7684\u539F\u751F\u5BF9\u8BDD\u3002\u8BF4\u4E00\u53E5\uFF0CDot \u4F1A\u5148\u5EFA\u4E00\u4E2A\u684C\u9762\u4F1A\u8BDD\u3002")),renderConnectionsHost:()=>a("div",{style:{paddingTop:12,display:"flex",flexDirection:"column",gap:14}},a(P,{controller:V}),mt?null:a("div",null,a("button",{type:"button",className:"muse-btn-outline",onClick:()=>Ut(!0)},"\u7BA1\u7406\u5FAE\u4FE1\u626B\u7801\u4E0E\u65E7\u7248\u5173\u6CE8\u9879\u76EE"))),connectorAuth:Ks,onStartConnectorAuth:qr,googleMcp:Ma?.googleWorkspaceMcp??null,legacyGoogleConfigured:!!(Ma?.googleSuiteAuth?.refreshConfigured||Ma?.googleCalendarAuth?.refreshConfigured),googleMcpAuth:Us,googleMcpBusy:an,onStartGoogleMcpAuth:Gr,onToggleGoogleMcpService:Hr,onDisconnectGoogleMcpAccount:Wr}),a(Q,{controller:V,onOrganized:()=>{try{globalThis.localStorage?.setItem("dot.sample.cleared","1")}catch{}Fn(!0),Yo("today"),ya({action:"workspace_brief_refresh"}),Vt(),wt.current.refreshNow()},renderFactorySlot:x.renderFactorySlot,slots:r.slots}),a(N,{controller:k,renderConversation:({projectId:t,target:s})=>!Gt&&typeof x.SessionProvider=="function"&&typeof x.renderSlot=="function"?a(I,{target:s,projectId:t,owner:"project",SessionProvider:x.SessionProvider,renderSlot:x.renderSlot,slotName:"dot.project.conversation",onOpenHistory:()=>Pt(s.sessionId)}):a("p",{role:"status"},"\u539F\u751F\u5BF9\u8BDD\u7EC4\u4EF6\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u6062\u590D Harness \u5DE5\u4F5C\u53F0\u540E\u91CD\u65B0\u6253\u5F00\uFF1B\u5DF2\u6709\u8349\u7A3F\u4ECD\u4FDD\u7559\u3002")}),Je?a(q,{open:!0,closeLabel:"\u5173\u95ED",title:Je==="project"?st?.label??"\u9879\u76EE\u8BE6\u60C5":Je==="follow"?"\u540E\u7EED\u600E\u4E48\u8DDF\u8FDB":Je==="memory"?"\u7EA0\u6B63\u9879\u76EE\u8BB0\u5FC6":"\u672C\u6B21\u6267\u884C\u56DE\u590D",className:"pc_dot_modal",onClose:or},a("div",{className:"pc_dot_drawer"},ke?a("p",{className:"pc_dot_error",role:"alert"},ke):null,De?Yr:Je==="project"?pr():Je==="follow"?ur():Je==="memory"?fr():mr())):null,Ja&&!mt?a(q,{open:!0,closeLabel:"\u5173\u95ED",title:"\u8FDE\u63A5\u5FAE\u4FE1\u4E0E\u9009\u62E9\u9879\u76EE",className:"pc_setup_modal",onClose:()=>{Ut(!1),Vt()}},a(zs,{renderFactorySlot:x.renderFactorySlot,close:()=>{Ut(!1),Vt()}})):null)}typeof r.layout?.selectPanel=="function"&&(r.effect(()=>{if(typeof document>"u")return;let x=document.createElement("style");return x.dataset.pluginCss="dsh-project-companion/workbench",x.textContent=be+Re+kn,document.head.appendChild(x),()=>x.remove()}),r.effect(()=>r.slots.inject("main",()=>r.slots.register({name:"main",key:R,children:{"dot.desktop.conversation":{kind:"single",scope:"session"},"dot.project.conversation":{kind:"single",scope:"session"}}},Ts))),r.effect(()=>r.slots.inject("dot.project.conversation",()=>r.slots.register({name:"dot.project.conversation"},p))),r.effect(()=>r.slots.inject("dot.desktop.conversation",()=>r.slots.register({name:"dot.desktop.conversation"},p))),r.effect(()=>r.slots.inject("dot.overlay.conversation",()=>r.slots.register({name:"dot.overlay.conversation"},p))),y(r,vo),r.effect(()=>r.slots.inject("sidebar.panellist",()=>r.slots.register({name:"sidebar.panellist",id:R,order:5,label:"DSH Dot"},ra))));let zs=x=>de(x,!1),Es=x=>a("div",null,de(x,!1),a(b),a(Y));r.effect(()=>r.slots.inject("settings.section",()=>r.slots.register({name:"settings.section",id:"project-companion",order:39,label:"DSH Dot"},Es))),(typeof r.get=="function"?r.get("configForms",!1):r.configForms)&&r.effect(()=>r.slots.inject("plugins.row.config",()=>r.slots.register({name:"plugins.row.config",key:"@oxmumu3/dsh-project-companion#project-companion"},x=>x.view==="summary"?"DeepSeek Dot \u7684\u4E2A\u4EBA\u8D44\u6599\u6765\u6E90\u4E0E\u539F\u751F\u51ED\u636E\u914D\u7F6E":a("div",{className:"pc_setup"},a("h3",null,"\u8FDE\u63A5\u51ED\u636E"),a(f)))))}return{inject:Ge,apply:g,createDotAppearance:dt,prepareDotDraft:$e,createDesktopConversationController:Ue,desktopConversationCanEmbed:et}}var mi="b62ea4d";window.__ModuleLoader__.load({id:"@oxmumu3/dsh-project-companion",factory:d=>(console.log("dot client build "+mi),Sn(d))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxmumu3/dsh-project-companion",
3
- "version": "0.44.2",
3
+ "version": "0.44.3",
4
4
  "description": "DSH Dot: WeChat personal agent, project memory and proactive follow-up for DeepSeek Harness",
5
5
  "author": "牛村木木山",
6
6
  "license": "MIT",
@@ -0,0 +1,529 @@
1
+ /**
2
+ * Cross-Agent Read-Only Activity Projection (`dot-memory/handoffs/*.jsonl` -> Mobile / Desktop UI).
3
+ * Aggregates raw per-turn handoff entries from external coding/desktop agents (Antigravity, Codex,
4
+ * Claude Code, Hermes, WorkBuddy, Cursor) into workspace-grouped session threads and curated
5
+ * active tasks without ever mutating external agent logs or breaking local privacy fences.
6
+ */
7
+
8
+ import fs from 'node:fs';
9
+ import path from 'node:path';
10
+
11
+ export const CROSS_AGENT_LABELS = Object.freeze({
12
+ antigravity: 'Antigravity',
13
+ codex: 'Codex',
14
+ 'claude-code': 'Claude Code',
15
+ hermes: 'Hermes',
16
+ workbuddy: 'WorkBuddy',
17
+ cursor: 'Cursor',
18
+ custom: '外部工具',
19
+ });
20
+
21
+ const PENDING_CUE_RE = /WAITING_FOR_REVIEW|等待审核|待拍板|待确认|待定|待复核|待过一遍|待终定|需补齐|准备在|卡住|阻塞|blocked|待处理|下一步|待验收/iu;
22
+ const CONCLUDED_CUE_RE = /彻底治好了|已全部落地并实时生效|已全部渲染验收完毕|已按原定.*全部落盘|已正式发布|独立复核.*都已生效|已全部完成并验真|已提交.*并完成验收|搞定了/iu;
23
+ const ACTIVE_STATUSES = new Set(['blocked', 'error', 'waiting']);
24
+
25
+ function stripLocalPathTokens(text) {
26
+ return String(text || '')
27
+ // Full markdown links [label](file:///...), [label](</path/with spaces>), or [label](https://...) -> label
28
+ .replace(/\[([^\]]+)\]\(<?(?:file:\/\/\/|https?:\/\/|\/)[^>)]*>?\)/gu, '$1')
29
+ // Truncated dangling markdown links at end of summary: [label](file:///... or [label](</Users/...
30
+ .replace(/\[([^\]]+)\]\(<?(?:file:\/\/\/|https?:\/\/|\/)[^)\s>]*$/gu, '$1')
31
+ // Bare file:// URIs -> basename
32
+ .replace(/file:\/\/\/[^\s)\]>]+/gu, (match) => {
33
+ try {
34
+ const decoded = decodeURIComponent(match.replace(/^file:\/\//u, '').split('#')[0]);
35
+ return path.basename(decoded) || '本地文件';
36
+ } catch {
37
+ return '本地文件';
38
+ }
39
+ })
40
+ // Bare macOS/Linux home paths -> basename
41
+ .replace(/(?:\/Users|\/home)\/[^\s"'`)\],;,。;>]+/gu, (match) => {
42
+ const cleaned = match.replace(/[.,:;!?]+$/u, '');
43
+ const base = path.basename(cleaned);
44
+ return base && base.length <= 64 ? base : '本地路径';
45
+ });
46
+ }
47
+
48
+ export function sanitizeCrossAgentText(raw, fallback = '', maxLen = 280) {
49
+ const cleaned = stripLocalPathTokens(raw)
50
+ .replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/gu, '')
51
+ .replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}]/gu, '')
52
+ .replace(/\*\*([^*]+)\*\*/gu, '$1')
53
+ .replace(/`([^`]+)`/gu, '$1')
54
+ .replace(/\s+/gu, ' ')
55
+ .trim();
56
+ if (!cleaned) return fallback;
57
+ if (cleaned.length <= maxLen) return cleaned;
58
+ return `${cleaned.slice(0, Math.max(1, maxLen - 1)).trimEnd()}…`;
59
+ }
60
+
61
+ export function formatCrossAgentTime(tsIso, nowMs = Date.now()) {
62
+ const ms = Date.parse(String(tsIso || ''));
63
+ if (!Number.isFinite(ms)) return '';
64
+ const diffSec = Math.max(0, Math.round((nowMs - ms) / 1000));
65
+ if (diffSec < 60) return '刚刚';
66
+ if (diffSec < 3600) return `${Math.floor(diffSec / 60)} 分钟前`;
67
+ const d = new Date(ms);
68
+ const now = new Date(nowMs);
69
+ const pad = (n) => String(n).padStart(2, '0');
70
+ const hhmm = `${pad(d.getHours())}:${pad(d.getMinutes())}`;
71
+ if (d.getFullYear() === now.getFullYear() && d.getMonth() === now.getMonth() && d.getDate() === now.getDate()) {
72
+ return hhmm;
73
+ }
74
+ return `${pad(d.getMonth() + 1)}/${pad(d.getDate())} ${hhmm}`;
75
+ }
76
+
77
+ function resolveAgentLabel(agent) {
78
+ const key = String(agent || 'custom').trim().toLowerCase();
79
+ return CROSS_AGENT_LABELS[key] || '外部工具';
80
+ }
81
+
82
+ function deriveThreadTitle(turns, fallbackWorkspace) {
83
+ // Prefer earliest substantive non-trivial prompt/title so follow-up "1" or "OK" doesn't clobber the topic.
84
+ for (const turn of turns) {
85
+ const candidate = sanitizeCrossAgentText(turn.title || '', '', 72)
86
+ .replace(/^(?:OK[,,。\s]*|好的[,,。\s]*|可以[,,。\s]*|嗯[,,。\s]*|诶[,,。\s]*|哈喽[,,。\s]*)/iu, '')
87
+ .trim();
88
+ if (candidate.length >= 6) {
89
+ return candidate.length > 48 ? `${candidate.slice(0, 47).trimEnd()}…` : candidate;
90
+ }
91
+ }
92
+ const latest = turns[turns.length - 1];
93
+ const fromSummary = sanitizeCrossAgentText(latest?.summary || latest?.title || '', '', 48);
94
+ return fromSummary || `${fallbackWorkspace || '工作区'}跨端会话`;
95
+ }
96
+
97
+ function classifyActiveTask({
98
+ status,
99
+ lastTsMs,
100
+ nowMs,
101
+ turnCount,
102
+ mutatedTotal,
103
+ toolsTotal,
104
+ latestSummary,
105
+ nextSteps,
106
+ isDismissed,
107
+ isHandedOff,
108
+ }) {
109
+ if (isDismissed || isHandedOff) return false;
110
+ const ageMs = Math.max(0, nowMs - lastTsMs);
111
+ if (ACTIVE_STATUSES.has(status)) {
112
+ return ageMs <= 7 * 86_400_000;
113
+ }
114
+ if (ageMs > 48 * 3_600_000) return false;
115
+
116
+ const hasNextSteps = Array.isArray(nextSteps) && nextSteps.length > 0;
117
+ const hasPendingCue = hasNextSteps || PENDING_CUE_RE.test(latestSummary);
118
+ if (hasPendingCue) return true;
119
+
120
+ const hasConcludedCue = CONCLUDED_CUE_RE.test(latestSummary);
121
+ if (hasConcludedCue) return false;
122
+
123
+ const isPureQa = mutatedTotal === 0 && turnCount <= 2 && toolsTotal <= 16;
124
+ if (isPureQa) return false;
125
+
126
+ return mutatedTotal >= 1 || turnCount >= 3;
127
+ }
128
+
129
+ const CODEX_MUTATING_TOOL_RE = /write|edit|replace|apply_patch|run_command|shell|exec|bash/iu;
130
+ const CODEX_PREAMBLE_RE = /^\s*(?:#\s*AGENTS\.md\s+instructions\s+for\b|<(?:app-context|environment_context|permissions\s+instructions|collaboration_mode|codex_apps_client_time_context|multi_agent_role|multi_agent_mode|tools)\b)/iu;
131
+
132
+ function extractCodexText(content) {
133
+ if (typeof content === 'string') return content.trim();
134
+ if (!Array.isArray(content)) return '';
135
+ const parts = [];
136
+ for (const part of content) {
137
+ if (typeof part === 'string' && part.trim()) {
138
+ parts.push(part.trim());
139
+ } else if (part && typeof part === 'object' && typeof part.text === 'string' && part.text.trim()) {
140
+ parts.push(part.text.trim());
141
+ }
142
+ }
143
+ return parts.join('\n').trim();
144
+ }
145
+
146
+ function collectCodexDateDirs(sessionsRoot, sinceDays, nowMs) {
147
+ const dirs = [];
148
+ const seen = new Set();
149
+ const days = Math.max(1, Number(sinceDays) || 7) + 1;
150
+ const pad = (n) => String(n).padStart(2, '0');
151
+ for (let i = 0; i <= days; i += 1) {
152
+ const d = new Date(nowMs - i * 86_400_000);
153
+ const variants = [
154
+ path.join(sessionsRoot, String(d.getFullYear()), pad(d.getMonth() + 1), pad(d.getDate())),
155
+ path.join(sessionsRoot, String(d.getUTCFullYear()), pad(d.getUTCMonth() + 1), pad(d.getUTCDate())),
156
+ ];
157
+ for (const dir of variants) {
158
+ if (seen.has(dir)) continue;
159
+ seen.add(dir);
160
+ try {
161
+ if (fs.statSync(dir).isDirectory()) dirs.push(dir);
162
+ } catch {}
163
+ }
164
+ }
165
+ return dirs;
166
+ }
167
+
168
+ function parseCodexRolloutFile(filePath, st) {
169
+ const headBytes = Math.min(65_536, st.size);
170
+ const tailStart = Math.max(0, st.size - 131_072);
171
+ const tailBytes = st.size - tailStart;
172
+ if (headBytes <= 0 || tailBytes <= 0) return null;
173
+
174
+ const fd = fs.openSync(filePath, 'r');
175
+ let headRaw = '';
176
+ let tailRaw = '';
177
+ try {
178
+ const headBuf = Buffer.alloc(headBytes);
179
+ fs.readSync(fd, headBuf, 0, headBytes, 0);
180
+ headRaw = headBuf.toString('utf8');
181
+ if (tailStart === 0 && tailBytes === headBytes) {
182
+ tailRaw = headRaw;
183
+ } else {
184
+ const tailBuf = Buffer.alloc(tailBytes);
185
+ fs.readSync(fd, tailBuf, 0, tailBytes, tailStart);
186
+ tailRaw = tailBuf.toString('utf8');
187
+ }
188
+ } finally {
189
+ fs.closeSync(fd);
190
+ }
191
+
192
+ const headLines = headRaw.split('\n').filter((l) => l.trim());
193
+ const tailAllLines = tailRaw.split('\n');
194
+ const tailLines = (tailStart > 0 ? tailAllLines.slice(1) : tailAllLines).filter((l) => l.trim());
195
+
196
+ let sessionId = '';
197
+ let cwd = '';
198
+ let isSubagent = false;
199
+ let initialPrompt = '';
200
+ let metaSnapshot = '';
201
+
202
+ for (const line of headLines) {
203
+ try {
204
+ const row = JSON.parse(line);
205
+ const rType = String(row?.type || '').toLowerCase();
206
+ const pl = row?.payload && typeof row.payload === 'object' ? row.payload : null;
207
+ if (rType === 'session_meta' && pl) {
208
+ if (!sessionId && (pl.id || pl.session_id)) {
209
+ sessionId = String(pl.id || pl.session_id).trim();
210
+ }
211
+ if (typeof pl.cwd === 'string' && pl.cwd.trim()) {
212
+ cwd = pl.cwd.trim();
213
+ }
214
+ if (pl.source && typeof pl.source === 'object' && pl.source.subagent) {
215
+ isSubagent = true;
216
+ }
217
+ metaSnapshot += ` ${String(pl.cwd || '')} ${String(pl.originator || '')}`;
218
+ } else if (!initialPrompt) {
219
+ if (rType === 'event_msg' && pl && pl.type === 'user_message' && typeof pl.message === 'string' && pl.message.trim()) {
220
+ if (!CODEX_PREAMBLE_RE.test(pl.message)) initialPrompt = pl.message.trim();
221
+ } else if (rType === 'response_item' && pl && pl.type === 'message' && String(pl.role || '').toLowerCase() === 'user') {
222
+ const t = extractCodexText(pl.content);
223
+ if (t && !CODEX_PREAMBLE_RE.test(t)) initialPrompt = t;
224
+ }
225
+ }
226
+ } catch {}
227
+ }
228
+
229
+ if (isSubagent) return null;
230
+
231
+ let turnTrigger = '';
232
+ let lastUserPrompt = '';
233
+ let lastAssistantReply = '';
234
+ let lastTs = '';
235
+ let toolCalls = 0;
236
+ let mutatedFiles = 0;
237
+ let aborted = false;
238
+
239
+ for (const line of tailLines) {
240
+ try {
241
+ const row = JSON.parse(line);
242
+ if (typeof row?.timestamp === 'string' && row.timestamp.trim()) {
243
+ lastTs = row.timestamp.trim();
244
+ }
245
+ const rType = String(row?.type || '').toLowerCase();
246
+ const pl = row?.payload && typeof row.payload === 'object' ? row.payload : null;
247
+ if (!pl) continue;
248
+
249
+ if (rType === 'turn_context' && typeof pl.cwd === 'string' && pl.cwd.trim()) {
250
+ cwd = pl.cwd.trim();
251
+ } else if (rType === 'event_msg') {
252
+ const eType = String(pl.type || '').toLowerCase();
253
+ if (eType === 'task_started' && pl.turn_attribution?.turn_trigger) {
254
+ turnTrigger = String(pl.turn_attribution.turn_trigger);
255
+ } else if (eType === 'user_message' && typeof pl.message === 'string' && pl.message.trim()) {
256
+ if (!CODEX_PREAMBLE_RE.test(pl.message)) {
257
+ if (!initialPrompt) initialPrompt = pl.message.trim();
258
+ lastUserPrompt = pl.message.trim();
259
+ }
260
+ aborted = false;
261
+ } else if (eType === 'task_complete' || eType === 'agent_message') {
262
+ const msg = pl.last_agent_message || pl.message || '';
263
+ if (typeof msg === 'string' && msg.trim()) {
264
+ lastAssistantReply = msg.trim();
265
+ aborted = false;
266
+ }
267
+ } else if (eType === 'turn_aborted') {
268
+ aborted = true;
269
+ }
270
+ } else if (rType === 'response_item') {
271
+ const pType = String(pl.type || '').toLowerCase();
272
+ if (pType === 'message') {
273
+ const role = String(pl.role || '').toLowerCase();
274
+ const t = extractCodexText(pl.content);
275
+ if (role === 'user' && t && !CODEX_PREAMBLE_RE.test(t)) {
276
+ if (!initialPrompt) initialPrompt = t;
277
+ lastUserPrompt = t;
278
+ aborted = false;
279
+ } else if (role === 'assistant' && t) {
280
+ lastAssistantReply = t;
281
+ aborted = false;
282
+ }
283
+ } else if (pType === 'function_call' || pType === 'custom_tool_call') {
284
+ toolCalls += 1;
285
+ if (CODEX_MUTATING_TOOL_RE.test(String(pl.name || ''))) mutatedFiles += 1;
286
+ }
287
+ }
288
+ } catch {}
289
+ }
290
+
291
+ if (turnTrigger === 'automation_heartbeat_scheduled' && !initialPrompt && !lastUserPrompt) {
292
+ return null;
293
+ }
294
+ if (!lastAssistantReply && !lastUserPrompt && !initialPrompt) {
295
+ return null;
296
+ }
297
+ if (/google_isolated/iu.test(`${cwd} ${metaSnapshot}`)) {
298
+ return null;
299
+ }
300
+
301
+ if (!sessionId) {
302
+ const m = path.basename(filePath).match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})/iu);
303
+ sessionId = m ? m[1] : path.basename(filePath, '.jsonl');
304
+ }
305
+
306
+ return {
307
+ id: `codex-rollout:${sessionId}`,
308
+ agent: 'codex',
309
+ sessionId,
310
+ workspace: path.basename(cwd || '') || 'Codex',
311
+ workspacePath: cwd || '',
312
+ ts: lastTs || new Date(st.mtimeMs).toISOString(),
313
+ status: aborted ? 'blocked' : 'done',
314
+ title: initialPrompt || lastUserPrompt || lastAssistantReply.slice(0, 80),
315
+ summary: lastAssistantReply || lastUserPrompt || initialPrompt,
316
+ toolCalls,
317
+ mutatedFiles,
318
+ nextSteps: [],
319
+ };
320
+ }
321
+
322
+ /**
323
+ * Read-only scan of recent Codex session rollouts (`~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl`).
324
+ * Keeps external trust boundaries intact (never modifies `~/.codex/config.toml`) while still
325
+ * surfacing active and recent Codex sessions in read-only cross-agent projection.
326
+ */
327
+ export function readCodexDirectSessions({
328
+ codexHome,
329
+ sinceDays = 7,
330
+ maxFiles = 40,
331
+ nowMs = Date.now(),
332
+ cache = null,
333
+ } = {}) {
334
+ if (!codexHome) return [];
335
+ const sessionsRoot = path.join(path.resolve(codexHome), 'sessions');
336
+ try {
337
+ if (!fs.statSync(sessionsRoot).isDirectory()) return [];
338
+ } catch {
339
+ return [];
340
+ }
341
+
342
+ const cutoffMs = nowMs - Math.max(1, Number(sinceDays) || 7) * 86_400_000;
343
+ const dirs = collectCodexDateDirs(sessionsRoot, sinceDays, nowMs);
344
+ const candidates = [];
345
+ for (const dir of dirs) {
346
+ try {
347
+ for (const name of fs.readdirSync(dir)) {
348
+ if (!name.startsWith('rollout-') || !name.endsWith('.jsonl')) continue;
349
+ const filePath = path.join(dir, name);
350
+ try {
351
+ const st = fs.statSync(filePath);
352
+ if (!st.isFile() || st.size <= 0 || st.mtimeMs < cutoffMs) continue;
353
+ candidates.push({ filePath, st });
354
+ } catch {}
355
+ }
356
+ } catch {}
357
+ }
358
+
359
+ candidates.sort((a, b) => b.st.mtimeMs - a.st.mtimeMs);
360
+ const out = [];
361
+ for (const { filePath, st } of candidates.slice(0, Math.max(1, Number(maxFiles) || 40))) {
362
+ const cached = cache instanceof Map ? cache.get(filePath) : null;
363
+ if (cached && cached.mtimeMs === st.mtimeMs && cached.size === st.size) {
364
+ if (cached.entry) out.push(cached.entry);
365
+ continue;
366
+ }
367
+ let entry = null;
368
+ try {
369
+ entry = parseCodexRolloutFile(filePath, st);
370
+ } catch {
371
+ entry = null;
372
+ }
373
+ if (cache instanceof Map) {
374
+ cache.set(filePath, { mtimeMs: st.mtimeMs, size: st.size, entry });
375
+ if (cache.size > 200) {
376
+ const firstKey = cache.keys().next().value;
377
+ if (firstKey) cache.delete(firstKey);
378
+ }
379
+ }
380
+ if (entry) out.push(entry);
381
+ }
382
+ return out;
383
+ }
384
+
385
+ export function mergeDirectCodexSessions(handoffs = [], directCodexHandoffs = []) {
386
+ const existing = Array.isArray(handoffs) ? handoffs : [];
387
+ const direct = Array.isArray(directCodexHandoffs) ? directCodexHandoffs : [];
388
+ if (direct.length === 0) return existing;
389
+
390
+ const latestCodexTsBySession = new Map();
391
+ for (const item of existing) {
392
+ if (!item || String(item.agent || '').trim().toLowerCase() !== 'codex') continue;
393
+ const sid = String(item.sessionId || '').trim();
394
+ const ms = Date.parse(item.ts || 0) || 0;
395
+ if (!sid) continue;
396
+ const prev = latestCodexTsBySession.get(sid) || 0;
397
+ if (ms > prev) latestCodexTsBySession.set(sid, ms);
398
+ }
399
+
400
+ const merged = [...existing];
401
+ for (const entry of direct) {
402
+ if (!entry || !entry.sessionId) continue;
403
+ const existingMs = latestCodexTsBySession.get(entry.sessionId) || 0;
404
+ const directMs = Date.parse(entry.ts || 0) || 0;
405
+ if (existingMs > 0 && existingMs >= directMs - 5_000) continue;
406
+ merged.push(entry);
407
+ }
408
+ return merged;
409
+ }
410
+
411
+ export function buildCrossAgentActivity({
412
+ handoffs = [],
413
+ dismissedIds = [],
414
+ handedOffMap = {},
415
+ nowMs = Date.now(),
416
+ maxSessions = 60,
417
+ maxActiveTasks = 12,
418
+ } = {}) {
419
+ const dismissedSet = new Set(Array.isArray(dismissedIds) ? dismissedIds.map((id) => String(id || '').trim()).filter(Boolean) : []);
420
+ const handoffLookup = handedOffMap && typeof handedOffMap === 'object' ? handedOffMap : {};
421
+
422
+ const groups = new Map();
423
+ let totalRawTurns = 0;
424
+
425
+ for (const raw of Array.isArray(handoffs) ? handoffs : []) {
426
+ if (!raw || typeof raw !== 'object') continue;
427
+ const agent = String(raw.agent || 'custom').trim().toLowerCase();
428
+ if (!agent || agent === 'dsh') continue;
429
+ if (raw.privacyScope === 'google_isolated') continue;
430
+
431
+ const sessionId = String(raw.sessionId || raw.id || 'unknown').trim().slice(0, 120);
432
+ const threadId = `ext:${agent}:${sessionId}`;
433
+ totalRawTurns += 1;
434
+
435
+ if (!groups.has(threadId)) {
436
+ groups.set(threadId, []);
437
+ }
438
+ groups.get(threadId).push(raw);
439
+ }
440
+
441
+ const allThreads = [];
442
+ for (const [id, rawTurns] of groups.entries()) {
443
+ const sortedTurns = [...rawTurns].sort((a, b) => (Date.parse(a.ts || 0) || 0) - (Date.parse(b.ts || 0) || 0));
444
+ const latest = sortedTurns[sortedTurns.length - 1];
445
+ const agent = String(latest.agent || 'custom').trim().toLowerCase();
446
+ const workspace = sanitizeCrossAgentText(latest.workspace || 'Agent', 'Agent', 60);
447
+ const lastTs = typeof latest.ts === 'string' && latest.ts ? latest.ts : new Date(nowMs).toISOString();
448
+ const lastTsMs = Date.parse(lastTs) || nowMs;
449
+ const rawStatus = String(latest.status || 'done').trim().toLowerCase();
450
+ const status = ACTIVE_STATUSES.has(rawStatus) ? rawStatus : 'done';
451
+ const mutatedTotal = sortedTurns.reduce((sum, item) => sum + (Number(item.mutatedFiles) || 0), 0);
452
+ const toolsTotal = sortedTurns.reduce((sum, item) => sum + (Number(item.toolCalls) || 0), 0);
453
+ const title = deriveThreadTitle(sortedTurns, workspace);
454
+ const summary = sanitizeCrossAgentText(latest.summary || latest.title || '', title, 280);
455
+ const nextSteps = Array.isArray(latest.nextSteps)
456
+ ? latest.nextSteps.map((s) => sanitizeCrossAgentText(s, '', 140)).filter(Boolean).slice(0, 6)
457
+ : [];
458
+
459
+ const isDismissed = dismissedSet.has(id);
460
+ const handedOffSessionId = typeof handoffLookup[id] === 'string' && handoffLookup[id].trim()
461
+ ? handoffLookup[id].trim()
462
+ : null;
463
+ const isHandedOff = Boolean(handedOffSessionId);
464
+
465
+ const isActiveTask = classifyActiveTask({
466
+ status,
467
+ lastTsMs,
468
+ nowMs,
469
+ turnCount: sortedTurns.length,
470
+ mutatedTotal,
471
+ toolsTotal,
472
+ latestSummary: summary,
473
+ nextSteps,
474
+ isDismissed,
475
+ isHandedOff,
476
+ });
477
+
478
+ const recentTurns = sortedTurns.slice(-5).map((turn) => ({
479
+ ts: typeof turn.ts === 'string' ? turn.ts : lastTs,
480
+ relativeTime: formatCrossAgentTime(turn.ts || lastTs, nowMs),
481
+ prompt: sanitizeCrossAgentText(turn.title || '', '工作记录', 120),
482
+ summary: sanitizeCrossAgentText(turn.summary || turn.title || '', '', 220),
483
+ status: String(turn.status || 'done').trim().toLowerCase(),
484
+ }));
485
+
486
+ allThreads.push({
487
+ id,
488
+ agent,
489
+ agentLabel: resolveAgentLabel(agent),
490
+ sessionId: String(latest.sessionId || latest.id || 'unknown').trim().slice(0, 120),
491
+ workspace,
492
+ title,
493
+ summary,
494
+ status,
495
+ isActiveTask,
496
+ isDismissed,
497
+ isHandedOff,
498
+ handedOffSessionId,
499
+ turnCount: sortedTurns.length,
500
+ mutatedTotal,
501
+ toolsTotal,
502
+ nextSteps,
503
+ lastTs,
504
+ relativeTime: formatCrossAgentTime(lastTs, nowMs),
505
+ turns: recentTurns,
506
+ });
507
+ }
508
+
509
+ allThreads.sort((a, b) => {
510
+ const aBlocked = ACTIVE_STATUSES.has(a.status) ? 1 : 0;
511
+ const bBlocked = ACTIVE_STATUSES.has(b.status) ? 1 : 0;
512
+ if (bBlocked !== aBlocked) return bBlocked - aBlocked;
513
+ if (Number(b.isActiveTask) !== Number(a.isActiveTask)) return Number(b.isActiveTask) - Number(a.isActiveTask);
514
+ return (Date.parse(b.lastTs) || 0) - (Date.parse(a.lastTs) || 0);
515
+ });
516
+
517
+ const visibleSessions = allThreads.filter((item) => !item.isDismissed).slice(0, maxSessions);
518
+ const dismissedSessions = allThreads.filter((item) => item.isDismissed).slice(0, maxSessions);
519
+ const activeTasks = visibleSessions.filter((item) => item.isActiveTask).slice(0, maxActiveTasks);
520
+
521
+ return {
522
+ activeTasks,
523
+ sessions: visibleSessions,
524
+ dismissedSessions,
525
+ dismissedCount: dismissedSessions.length,
526
+ totalCount: visibleSessions.length,
527
+ totalRawTurns,
528
+ };
529
+ }
@@ -40,6 +40,11 @@ import { createBackgroundHealthTracker } from './background-health.mjs';
40
40
  import { createDecisionGate } from './decision-gate.mjs';
41
41
  import { verifyAndRenderBrief } from './evidence-verifier.mjs';
42
42
  import { reduceToolOutput } from './tool-output-reducer.mjs';
43
+ import {
44
+ buildCrossAgentActivity,
45
+ mergeDirectCodexSessions,
46
+ readCodexDirectSessions,
47
+ } from './cross-agent-activity.mjs';
43
48
  import {
44
49
  hasRetrospectiveRecallIntent,
45
50
  renderTriggeredWikiBlock,
@@ -523,6 +528,8 @@ function loadState(statePath) {
523
528
  liveInsight: stored.liveInsight || null,
524
529
  memoryObservations: list(stored.memoryObservations),
525
530
  dismissedPrebakeIds: list(stored.dismissedPrebakeIds),
531
+ crossAgentDismissedIds: list(stored.crossAgentDismissedIds),
532
+ crossAgentHandedOffMap: object(stored.crossAgentHandedOffMap),
526
533
  lastChatActivityAt: stored.lastChatActivityAt || null,
527
534
  latestProactivePing: stored.latestProactivePing || null,
528
535
  butlerSessionId: typeof stored.butlerSessionId === 'string' && stored.butlerSessionId.startsWith('dot-butler-')
@@ -584,6 +591,7 @@ export class DotBridgeStore extends EventEmitter {
584
591
  hasActiveMobileClients = () => true,
585
592
  wechatAuthRoot = null,
586
593
  dotMemoryHome = undefined,
594
+ codexHome = undefined,
587
595
  deviceToolHub = null,
588
596
  } = {}) {
589
597
  super();
@@ -600,6 +608,10 @@ export class DotBridgeStore extends EventEmitter {
600
608
  this.dotMemoryHome = dotMemoryHome !== undefined
601
609
  ? dotMemoryHome
602
610
  : (isRealHostPath ? (process.env.DOT_MEMORY_HOME || path.join(os.homedir(), '.local', 'share', 'dot-memory')) : null);
611
+ this.codexHome = codexHome !== undefined
612
+ ? codexHome
613
+ : (isRealHostPath ? (process.env.CODEX_HOME || path.join(os.homedir(), '.codex')) : null);
614
+ this.#codexRolloutCache = new Map();
603
615
  this.#lastWikiSyncMs = 0;
604
616
  ensureSecureDir(stateDir);
605
617
  this.statePath = path.join(stateDir, 'state.json');
@@ -770,6 +782,89 @@ export class DotBridgeStore extends EventEmitter {
770
782
  return out.sort((a, b) => Date.parse(b.ts || 0) - Date.parse(a.ts || 0)).slice(0, limit);
771
783
  }
772
784
 
785
+ listCrossAgentSessions({ includeDismissed = false, sinceDays = 7 } = {}) {
786
+ const rawHandoffs = this.#readLocalHandoffs({ limit: 300, sinceDays });
787
+ const directCodex = readCodexDirectSessions({
788
+ codexHome: this.codexHome,
789
+ sinceDays,
790
+ cache: this.#codexRolloutCache,
791
+ });
792
+ const mergedHandoffs = mergeDirectCodexSessions(rawHandoffs, directCodex);
793
+ const built = buildCrossAgentActivity({
794
+ handoffs: mergedHandoffs,
795
+ dismissedIds: this.state.crossAgentDismissedIds,
796
+ handedOffMap: this.state.crossAgentHandedOffMap,
797
+ nowMs: Date.now(),
798
+ });
799
+ return cleanPublicValue({
800
+ ok: true,
801
+ activeTasks: built.activeTasks,
802
+ sessions: includeDismissed ? [...built.sessions, ...built.dismissedSessions] : built.sessions,
803
+ dismissedSessions: built.dismissedSessions,
804
+ dismissedCount: built.dismissedCount,
805
+ totalCount: built.totalCount,
806
+ totalRawTurns: built.totalRawTurns,
807
+ });
808
+ }
809
+
810
+ setCrossAgentDismissed(threadId, dismissed = true) {
811
+ const id = String(threadId || '').trim();
812
+ if (!id) return { ok: false, error: '缺少跨端会话编号' };
813
+ const next = new Set(list(this.state.crossAgentDismissedIds));
814
+ if (dismissed) next.add(id);
815
+ else next.delete(id);
816
+ this.state.crossAgentDismissedIds = [...next].slice(-300);
817
+ this.#saveState();
818
+ this.#emitChange();
819
+ return {
820
+ ok: true,
821
+ id,
822
+ dismissed: Boolean(dismissed),
823
+ snapshot: this.getSnapshot(),
824
+ crossAgent: this.listCrossAgentSessions({ includeDismissed: false }),
825
+ };
826
+ }
827
+
828
+ async handoffCrossAgentSession(threadId, { prompt = null, workspaceTitle = null } = {}) {
829
+ const id = String(threadId || '').trim();
830
+ if (!id) return { ok: false, error: '缺少跨端会话编号' };
831
+ const all = this.listCrossAgentSessions({ includeDismissed: true });
832
+ const target = [...all.sessions, ...(all.dismissedSessions || [])].find((item) => item.id === id);
833
+ if (!target) {
834
+ return { ok: false, error: '未找到对应的跨端会话记录' };
835
+ }
836
+ const targetWorkspace = sanitizeForMobileText(workspaceTitle || target.workspace || '', '') || null;
837
+ const defaultPrompt = [
838
+ `请接手刚才 ${target.agentLabel} 在「${target.workspace}」工作区的进展(${target.title}):`,
839
+ target.summary,
840
+ ...(Array.isArray(target.turns) && target.turns.length > 0
841
+ ? ['', '最近停靠记录:', ...target.turns.slice(-3).map((t) => `- ${t.relativeTime} ${t.prompt}:${t.summary}`)]
842
+ : []),
843
+ '',
844
+ '请先核对工作区当前改动并继续完成下一步。',
845
+ ].join('\n');
846
+ const finalPrompt = normalizeUserInput(prompt, '') || defaultPrompt;
847
+ const created = await this.createDirectSession({
848
+ workspaceTitle: targetWorkspace,
849
+ prompt: finalPrompt,
850
+ title: `接力:${target.title}`.slice(0, 48),
851
+ });
852
+ if (!created.ok) return created;
853
+ this.state.crossAgentHandedOffMap = {
854
+ ...object(this.state.crossAgentHandedOffMap),
855
+ [id]: created.sessionId || created.dossierId || 'handed_off',
856
+ };
857
+ this.state.crossAgentDismissedIds = list(this.state.crossAgentDismissedIds).filter((x) => x !== id);
858
+ this.#saveState();
859
+ this.#emitChange();
860
+ return {
861
+ ...created,
862
+ crossAgentId: id,
863
+ snapshot: this.getSnapshot(),
864
+ crossAgent: this.listCrossAgentSessions({ includeDismissed: false }),
865
+ };
866
+ }
867
+
773
868
  #collectWorkspaceProgress() {
774
869
  const workspaces = this.connectorLedger.authorizedWorkspaces().slice(0, 12);
775
870
  const out = [];
@@ -926,6 +1021,7 @@ export class DotBridgeStore extends EventEmitter {
926
1021
  #routineRuns = new Map();
927
1022
  #pulseTickInFlight = null;
928
1023
  #lastWikiSyncMs = 0;
1024
+ #codexRolloutCache = new Map();
929
1025
  #operations = new OperationIdLedger();
930
1026
  #stage4Undos = {};
931
1027
  #backgroundWorkers = new Map();
@@ -2370,6 +2466,7 @@ export class DotBridgeStore extends EventEmitter {
2370
2466
  const authorizedWorkspaces = this.connectorLedger.authorizedWorkspaces()
2371
2467
  .filter((ws) => ws && typeof ws.root === 'string' && !/\/output\/[^/]*fixtures\//i.test(ws.root));
2372
2468
  const allSessionsRes = this.listAllSessions();
2469
+ const crossAgent = this.listCrossAgentSessions({ includeDismissed: false });
2373
2470
  const wikiPages = this.entityWiki.listPages();
2374
2471
  const recentOutputs = buildOutputArchive({
2375
2472
  dossiers: allSessionsRes.sessions,
@@ -2438,6 +2535,8 @@ export class DotBridgeStore extends EventEmitter {
2438
2535
  proactiveSettings: { ...proactiveSettings, ...this.#bridgePrefs() },
2439
2536
  pendingInputs: this.desktopPendingInputs,
2440
2537
  allSessionsCount: allSessionsRes.totalCount,
2538
+ crossAgentTasks: crossAgent.activeTasks,
2539
+ crossAgentSessionCount: crossAgent.totalCount,
2441
2540
  butlerSessionId: this.state.butlerSessionId || null,
2442
2541
  workstreams,
2443
2542
  recentOutputs,
@@ -165,6 +165,8 @@ export function createDotMobileServer({
165
165
  dshRunner,
166
166
  proactive,
167
167
  wechatAuthRoot = null,
168
+ dotMemoryHome = undefined,
169
+ codexHome = undefined,
168
170
  streamKeepaliveMs = 15_000,
169
171
  } = {}) {
170
172
  const loaded = loadOrCreateBridgeConfig(stateDir);
@@ -208,6 +210,8 @@ export function createDotMobileServer({
208
210
  getBearerToken: () => config.bearerToken,
209
211
  hasActiveMobileClients: () => sseClients.size > 0,
210
212
  wechatAuthRoot,
213
+ dotMemoryHome,
214
+ codexHome,
211
215
  deviceToolHub,
212
216
  });
213
217
  store.startWatchingDsh();
@@ -671,6 +675,32 @@ export function createDotMobileServer({
671
675
  return;
672
676
  }
673
677
 
678
+ if (req.method === 'GET' && pathname === '/api/cross-agent/sessions') {
679
+ const includeDismissed = urlObj.searchParams.get('includeDismissed') === '1';
680
+ const sinceDays = Number(urlObj.searchParams.get('sinceDays') || 7);
681
+ sendJson(res, 200, store.listCrossAgentSessions({ includeDismissed, sinceDays }));
682
+ return;
683
+ }
684
+
685
+ const crossAgentActionMatch = pathname.match(/^\/api\/cross-agent\/sessions\/([^/]+)\/(dismiss|handoff)$/);
686
+ if (req.method === 'POST' && crossAgentActionMatch) {
687
+ try {
688
+ const threadId = decodeURIComponent(crossAgentActionMatch[1]);
689
+ const act = crossAgentActionMatch[2];
690
+ const body = await readJsonBody(req);
691
+ const out = act === 'dismiss'
692
+ ? store.setCrossAgentDismissed(threadId, body?.dismissed !== false)
693
+ : await store.handoffCrossAgentSession(threadId, {
694
+ prompt: body?.prompt ?? null,
695
+ workspaceTitle: body?.workspaceTitle ?? body?.workspace ?? null,
696
+ });
697
+ sendJson(res, out.ok ? 200 : 400, out);
698
+ } catch (err) {
699
+ sendJson(res, 400, { ok: false, error: sanitizeForMobileText(err?.message, '跨端会话操作失败') });
700
+ }
701
+ return;
702
+ }
703
+
674
704
  if (req.method === 'GET' && pathname === '/api/onboarding/proposals') {
675
705
  sendJson(res, 200, { ok: true, proposals: store.getOnboardingProposals() });
676
706
  return;