@erdium/sara 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{agent-N2VIMKVQ.js → agent-L5DZJ4OD.js} +2 -2
- package/dist/chunks/{agent-headless-KG5QBOFB.js → agent-headless-IL3AUXBD.js} +2 -2
- package/dist/chunks/{chunk-JN2X4XJ3.js → chunk-AGCNWJTP.js} +25 -25
- package/dist/chunks/{chunk-HO7BAF67.js → chunk-JSAXY3DF.js} +5 -5
- package/dist/chunks/{chunk-VOUMQBOI.js → chunk-KEQV5QMN.js} +3 -3
- package/dist/chunks/{chunk-N6TRMZSD.js → chunk-OXHLH6AG.js} +1 -1
- package/dist/chunks/{chunk-6K66KN4D.js → chunk-YLUAI6AQ.js} +3 -3
- package/dist/chunks/{chunk-W4IMBTEU.js → chunk-Z3P47TGF.js} +1 -1
- package/dist/chunks/{computer-use-AOFVZSZS.js → computer-use-EPJKKTKH.js} +2 -2
- package/dist/chunks/{contextCommand-NZPQLCMH.js → contextCommand-WW5M7CEA.js} +4 -4
- package/dist/chunks/{edit-NGCBK4JI.js → edit-24MNPBD6.js} +2 -2
- package/dist/chunks/{enter-worktree-IUPWAJU3.js → enter-worktree-WKOZRF6S.js} +2 -2
- package/dist/chunks/{enterPlanMode-UI4ZTMQU.js → enterPlanMode-6AIL4MMV.js} +2 -2
- package/dist/chunks/{exit-worktree-QFSPS642.js → exit-worktree-UHB4UCZZ.js} +2 -2
- package/dist/chunks/{exitPlanMode-J7VRLRTC.js → exitPlanMode-EPXW7CQJ.js} +2 -2
- package/dist/chunks/{geminiContentGenerator-XLTEAJ6C.js → geminiContentGenerator-LFUSO2YW.js} +1 -1
- package/dist/chunks/{glob-NL5V3B76.js → glob-4LYF5KUO.js} +2 -2
- package/dist/chunks/{grep-5EWLD3J4.js → grep-MRRHQYPP.js} +2 -2
- package/dist/chunks/{monitor-3K4TD4F2.js → monitor-KZVPLWFX.js} +2 -2
- package/dist/chunks/{notebook-edit-Q4ER6ZID.js → notebook-edit-XRRF4DFC.js} +2 -2
- package/dist/chunks/{openaiContentGenerator-4O2ON66O.js → openaiContentGenerator-CSEDXFUV.js} +2 -2
- package/dist/chunks/{qwenContentGenerator-SKMLM2C3.js → qwenContentGenerator-GY2KR2YZ.js} +3 -3
- package/dist/chunks/{read-file-LIYKYBIZ.js → read-file-S7YCZXGL.js} +1 -1
- package/dist/chunks/{ripGrep-AEXU5Z33.js → ripGrep-77ZLOF6T.js} +2 -2
- package/dist/chunks/{scheduler-XLAAXG7U.js → scheduler-N2ZZP6JD.js} +2 -2
- package/dist/chunks/{serve-O7Z3E6YR.js → serve-HC6HNDF5.js} +4 -4
- package/dist/chunks/{shell-GICTWRGM.js → shell-YVJ7I2YU.js} +2 -2
- package/dist/chunks/{skill-GMGL7ILV.js → skill-HQD2JXSX.js} +1 -1
- package/dist/chunks/{src-RD7ZJHPI.js → src-JFDNDOLD.js} +2 -2
- package/dist/chunks/{team-create-IVEFILXJ.js → team-create-KAZIUY2U.js} +2 -2
- package/dist/chunks/{tool-search-SR7DJ4GX.js → tool-search-PYGAC7E7.js} +1 -1
- package/dist/chunks/{workflow-E2U3EDAS.js → workflow-U23Q42AT.js} +1 -1
- package/dist/chunks/{write-file-CKSAPRZM.js → write-file-O3736Q3I.js} +2 -2
- package/dist/cli.js +271 -197
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
updateOutputLanguageFile,
|
|
86
86
|
validateCustomTheme,
|
|
87
87
|
writeOutputLanguageAndRegisterPath
|
|
88
|
-
} from "./chunks/chunk-
|
|
88
|
+
} from "./chunks/chunk-JSAXY3DF.js";
|
|
89
89
|
import {
|
|
90
90
|
AgentSideConnection,
|
|
91
91
|
PROTOCOL_VERSION,
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
formatContextUsageText,
|
|
99
99
|
isTerminalGoalStatusKind,
|
|
100
100
|
require_react
|
|
101
|
-
} from "./chunks/chunk-
|
|
101
|
+
} from "./chunks/chunk-YLUAI6AQ.js";
|
|
102
102
|
import {
|
|
103
103
|
SUPPORTED_LANGUAGES,
|
|
104
104
|
clearScreen,
|
|
@@ -111,7 +111,7 @@ import {
|
|
|
111
111
|
ta,
|
|
112
112
|
writeStderrLine,
|
|
113
113
|
writeStdoutLine
|
|
114
|
-
} from "./chunks/chunk-
|
|
114
|
+
} from "./chunks/chunk-Z3P47TGF.js";
|
|
115
115
|
import {
|
|
116
116
|
ALL_PROVIDERS,
|
|
117
117
|
APPROVAL_MODES,
|
|
@@ -321,7 +321,7 @@ import {
|
|
|
321
321
|
writeRuntimeStatus,
|
|
322
322
|
writeWorktreeSession,
|
|
323
323
|
writeWorktreeSessionMarker
|
|
324
|
-
} from "./chunks/chunk-
|
|
324
|
+
} from "./chunks/chunk-AGCNWJTP.js";
|
|
325
325
|
import {
|
|
326
326
|
external_exports
|
|
327
327
|
} from "./chunks/chunk-BJ2YD3KR.js";
|
|
@@ -398,7 +398,7 @@ import {
|
|
|
398
398
|
stripRuntimeSnapshotPrefix,
|
|
399
399
|
uiTelemetryService,
|
|
400
400
|
withInteractionSpan
|
|
401
|
-
} from "./chunks/chunk-
|
|
401
|
+
} from "./chunks/chunk-KEQV5QMN.js";
|
|
402
402
|
import "./chunks/chunk-7YEYWLRS.js";
|
|
403
403
|
import "./chunks/chunk-ESO7Q65W.js";
|
|
404
404
|
import {
|
|
@@ -34991,7 +34991,7 @@ var serveCommand = {
|
|
|
34991
34991
|
process.exit(1);
|
|
34992
34992
|
}
|
|
34993
34993
|
}
|
|
34994
|
-
const { runQwenServe } = await import("./chunks/serve-
|
|
34994
|
+
const { runQwenServe } = await import("./chunks/serve-HC6HNDF5.js");
|
|
34995
34995
|
try {
|
|
34996
34996
|
await runQwenServe({
|
|
34997
34997
|
port: argv.port,
|
|
@@ -39665,7 +39665,7 @@ var aboutCommand = {
|
|
|
39665
39665
|
const systemInfo = await getExtendedSystemInfo(context);
|
|
39666
39666
|
if (context.executionMode !== "interactive") {
|
|
39667
39667
|
const lines = [
|
|
39668
|
-
`Sara v${systemInfo.cliVersion}`,
|
|
39668
|
+
`Erdium Sara v${systemInfo.cliVersion}`,
|
|
39669
39669
|
`Model: ${systemInfo.modelVersion}`,
|
|
39670
39670
|
`Fast Model: ${systemInfo.fastModel ?? "not set"}`,
|
|
39671
39671
|
`Auth: ${systemInfo.selectedAuthType}`,
|
|
@@ -42553,7 +42553,7 @@ init_esbuild_shims();
|
|
|
42553
42553
|
init_esbuild_shims();
|
|
42554
42554
|
function getSystemInfoFields(info) {
|
|
42555
42555
|
const fields = [];
|
|
42556
|
-
addField(fields, t("Sara"), formatCliVersion(info));
|
|
42556
|
+
addField(fields, t("Erdium Sara"), formatCliVersion(info));
|
|
42557
42557
|
addField(fields, t("Runtime"), formatRuntime(info));
|
|
42558
42558
|
addField(fields, t("IDE Client"), info.ideClient);
|
|
42559
42559
|
addField(fields, "LSP", info.lspStatus ?? "");
|
|
@@ -46740,7 +46740,7 @@ async function extractMetadata(conversation, config) {
|
|
|
46740
46740
|
const gitBranch = firstRecord?.gitBranch;
|
|
46741
46741
|
let gitRepo;
|
|
46742
46742
|
if (cwd5) {
|
|
46743
|
-
const { getGitRepoName } = await import("./chunks/src-
|
|
46743
|
+
const { getGitRepoName } = await import("./chunks/src-JFDNDOLD.js");
|
|
46744
46744
|
gitRepo = getGitRepoName(cwd5);
|
|
46745
46745
|
}
|
|
46746
46746
|
let model;
|
|
@@ -47435,12 +47435,12 @@ init_esbuild_shims();
|
|
|
47435
47435
|
|
|
47436
47436
|
// packages/web-templates/src/generated/insightTemplate.ts
|
|
47437
47437
|
init_esbuild_shims();
|
|
47438
|
-
var INSIGHT_JS = '(function(e,B){"use strict";function U({data:t}){const{totalMessages:n=0,totalLinesAdded:l=0,totalLinesRemoved:s=0,totalFiles:r=0}=t,a=Object.keys(t.heatmap||{});let o=0;if(a.length>0){const c=a.map(x=>new Date(x)).map(x=>x.getTime()),d=new Date(Math.min(...c)),g=new Date(Math.max(...c)),E=Math.abs(g.getTime()-d.getTime());o=Math.ceil(E/(1e3*60*60*24))+1}const i=o>0?Math.round(n/o):0;return e.createElement("div",{className:"stats-row"},e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},n),e.createElement("div",{className:"stat-label"},"Messages")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},"+",l,"/-",s),e.createElement("div",{className:"stat-label"},"Lines")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},r),e.createElement("div",{className:"stat-label"},"Files")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},o),e.createElement("div",{className:"stat-label"},"Days")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},i),e.createElement("div",{className:"stat-label"},"Msgs/Day")))}function K({insights:t}){return e.createElement("div",{className:"grid gap-4 md:grid-cols-2 md:gap-6"},e.createElement(J,{activeHours:t.activeHours,cardClass:"glass-card p-6",sectionTitleClass:"text-lg font-semibold tracking-tight text-slate-900"}))}function J({activeHours:t,cardClass:n,sectionTitleClass:l}){const r=[{label:"Morning",time:"06:00 - 12:00",hours:[6,7,8,9,10,11],color:"#fbbf24"},{label:"Afternoon",time:"12:00 - 18:00",hours:[12,13,14,15,16,17],color:"#0ea5e9"},{label:"Evening",time:"18:00 - 22:00",hours:[18,19,20,21],color:"#6366f1"},{label:"Night",time:"22:00 - 06:00",hours:[22,23,0,1,2,3,4,5],color:"#475569"}].map(o=>{const i=o.hours.reduce((m,c)=>m+(t[c]||0),0);return{...o,total:i}}),a=Math.max(...r.map(o=>o.total));return e.createElement("div",{className:`${n} h-full flex flex-col min-h-[320px]`},e.createElement("div",{className:"flex items-center justify-between mb-4"},e.createElement("h3",{className:l},"Active Hours")),e.createElement("div",{className:"flex-1 flex flex-col justify-center gap-4"},r.map(o=>e.createElement("div",{key:o.label,className:"space-y-2"},e.createElement("div",{className:"flex justify-between items-center text-sm"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("span",{className:"rounded-full",style:{width:"12px",height:"12px",backgroundColor:o.color}}),e.createElement("span",{className:"font-medium text-slate-700"},o.label),e.createElement("span",{className:"text-xs text-slate-400 hidden xl:inline"},o.time)),e.createElement("span",{className:"font-semibold text-slate-900"},o.total)),e.createElement("div",{className:"w-full rounded-full overflow-hidden",style:{height:"12px",backgroundColor:"#e2e8f0"}},e.createElement("div",{className:"h-full rounded-full",style:{width:`${a>0?o.total/a*100:0}%`,backgroundColor:o.color}}))))))}function V({heatmap:t}){return e.createElement("div",{className:"glass-card p-6 mt-4 md:mt-6"},e.createElement("div",{className:"mb-3"},e.createElement("h3",{className:"text-lg font-semibold tracking-tight text-slate-900"},"Activity Heatmap"),e.createElement("p",{className:"text-xs text-slate-500"},"Showing past year of activity")),e.createElement("div",{className:"heatmap-container"},e.createElement("div",{className:"min-w-[720px] rounded-xl bg-white/70"},e.createElement(X,{heatmapData:t}))),e.createElement(Z,null))}function X({heatmapData:t}){const a=new Date,o=new Date(a);o.setFullYear(a.getFullYear()-1);const i=[],m=new Date(o);for(;m<=a;)i.push(new Date(m)),m.setDate(m.getDate()+1);const c=[0,2,4,10,20],d=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"];function g(u){if(u===0)return d[0];for(let f=c.length-1;f>=1;f--)if(u>=c[f])return d[f];return d[1]}const E=50,x=20,A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=o.getDay(),W=[];let h=-1,T=-100;return i.forEach((u,f)=>{const C=f+w,_=Math.floor(C/7),v=E+_*16,N=u.getMonth();N!==h&&(v-T>30&&(W.push({x:v,text:A[N]}),T=v),h=N)}),e.createElement("svg",{className:"heatmap-svg",width:1e3,height:130,viewBox:"0 0 1000 130"},i.map((u,f)=>{const C=f+w,_=Math.floor(C/7),v=u.getDay(),N=E+_*16,j=x+v*16,k=u.toISOString().split("T")[0],S=t[k]||0,L=g(S);return e.createElement("rect",{key:k,className:"heatmap-day",x:N,y:j,width:14,height:14,rx:"2",fill:L,"data-date":k,"data-count":S},e.createElement("title",null,k,": ",S," activities"))}),W.map((u,f)=>e.createElement("text",{key:f,x:u.x,y:"15",fontSize:"12",fill:"#64748b"},u.text)))}function Z(){const t=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"];return e.createElement("div",{className:"flex items-center gap-2 mt-4"},e.createElement("span",{className:"text-xs text-slate-500"},"Less"),t.map((n,l)=>e.createElement("span",{key:l,className:"inline-block rounded",style:{width:"10px",height:"10px",backgroundColor:n}})),e.createElement("span",{className:"text-xs text-slate-500"},"More"))}function p({children:t}){if(!t||typeof t!="string")return t;const n=t.split(/(\\*\\*.*?\\*\\*)/g);return e.createElement(e.Fragment,null,n.map((l,s)=>l.startsWith("**")&&l.endsWith("**")&&l.length>=4?e.createElement("strong",{key:s},l.slice(2,-2)):l))}function F({text:t,label:n="Copy"}){const[l,s]=e.useState(!1),r=()=>{navigator.clipboard.writeText(t).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})};return e.createElement("button",{className:"copy-btn",onClick:r},l?"Copied!":n)}function R(t){return typeof t=="string"&&t.trim().length>0}function ee({qualitative:t,targetSections:n}){const{atAGlance:l}=t;if(!l)return null;const s=[{key:"wins",label:"What\'s working:",body:l.whats_working,href:"#section-wins",link:"Impressive Things You Did \u2192",showLink:n.wins},{key:"friction",label:"What\'s hindering you:",body:l.whats_hindering,href:"#section-friction",link:"Where Things Go Wrong \u2192",showLink:n.friction},{key:"features",label:"Quick wins to try:",body:l.quick_wins,href:"#section-features",link:"Features to Try \u2192",showLink:n.features},{key:"horizon",label:"Ambitious workflows:",body:l.ambitious_workflows,href:"#section-horizon",link:"On the Horizon \u2192",showLink:n.horizon}].filter(r=>R(r.body));return s.length===0?null:e.createElement("div",{className:"at-a-glance"},e.createElement("div",{className:"glance-title"},"At a Glance"),e.createElement("div",{className:"glance-sections"},s.map(r=>e.createElement("div",{key:r.key,className:"glance-section"},e.createElement("strong",null,r.label)," ",e.createElement(p,null,r.body),r.showLink&&e.createElement("a",{href:r.href,className:"see-more"},r.link)))))}function te({sections:t}){return t.length===0?null:e.createElement("nav",{className:"nav-toc"},t.map(n=>e.createElement("a",{key:n.href,href:n.href},n.label)))}function ne({qualitative:t,topGoals:n,topTools:l}){const{projectAreas:s}=t,r=Array.isArray(l)?Object.fromEntries(l):l;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-work",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"What You Work On"),Array.isArray(s==null?void 0:s.areas)&&s.areas.length>0&&e.createElement("div",{className:"project-areas mb-6"},s.areas.map((a,o)=>e.createElement("div",{key:o,className:"project-area"},e.createElement("div",{className:"area-header"},e.createElement("span",{className:"area-name"},a.name),e.createElement("span",{className:"area-count"},"~",a.session_count," sessions")),e.createElement("div",{className:"area-desc"},e.createElement(p,null,a.description))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginBottom:"24px"}},n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"What You Wanted",color:"#0ea5e9"}),r&&Object.keys(r).length>0&&e.createElement(D,{data:r,title:"Top Tools Used",color:"#6366f1"})))}function le({qualitative:t,insights:n}){const{interactionStyle:l}=t;return l?e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-usage",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"How You Use Qwen Code"),e.createElement("div",{className:"narrative"},e.createElement("p",null,e.createElement(p,null,l.narrative)),l.key_pattern&&e.createElement("div",{className:"key-insight"},e.createElement("strong",null,"Key pattern:")," ",e.createElement(p,null,l.key_pattern))),e.createElement(K,{insights:n}),e.createElement(V,{heatmap:n.heatmap})):null}function re({qualitative:t,primarySuccess:n,outcomes:l}){const s=t==null?void 0:t.impressiveWorkflows;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-wins",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Impressive Things You Did"),(s==null?void 0:s.intro)&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,s.intro)),s&&e.createElement("div",{className:"big-wins"},Array.isArray(s.impressive_workflows)&&s.impressive_workflows.map((r,a)=>e.createElement("div",{key:a,className:"big-win"},e.createElement("div",{className:"big-win-title"},r.title),e.createElement("div",{className:"big-win-desc"},e.createElement(p,null,r.description))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginTop:"24px",marginBottom:"24px"}},n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"What Helped Most (Qwen\'s Capabilities)",color:"#3b82f6",allowedKeys:["fast_accurate_search","correct_code_edits","good_explanations","proactive_help","multi_file_changes","good_debugging"]}),l&&Object.keys(l).length>0&&e.createElement(D,{data:l,title:"Outcomes",color:"#8b5cf6",allowedKeys:["fully_achieved","mostly_achieved","partially_achieved","not_achieved","unclear_from_transcript"]})))}function se(t){return t==="unclear_from_transcript"?"Unclear":t.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function D({data:t,title:n,color:l="#3b82f6",allowedKeys:s=null}){if(!t||Object.keys(t).length===0)return null;let r=Object.entries(t).filter(([,o])=>Number.isFinite(o)&&o!==0);if(s&&(r=r.filter(([o])=>s.includes(o))),r.sort((o,i)=>i[1]-o[1]),r=r.slice(0,10),r.length===0)return null;const a=Math.max(...r.map(([,o])=>o));return e.createElement("div",{className:"bar-chart-card",style:{flex:1,minWidth:0,backgroundColor:"#ffffff",borderRadius:"12px",padding:"20px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.08)",border:"1px solid #e2e8f0"}},e.createElement("h3",{style:{fontSize:"13px",fontWeight:700,color:"#64748b",marginTop:0,marginBottom:"16px",textTransform:"uppercase",letterSpacing:"0.5px"}},n),e.createElement("div",{className:"bar-chart",style:{display:"flex",flexDirection:"column",gap:"10px"}},r.map(([o,i])=>{const m=a>0?i/a*100:0;return e.createElement("div",{key:o,className:"bar-row",style:{display:"flex",alignItems:"center",gap:"12px"}},e.createElement("div",{className:"bar-label",style:{width:"130px",fontSize:"13px",color:"#475569",textAlign:"left",flexShrink:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},se(o)),e.createElement("div",{className:"bar-wrapper",style:{flex:1,display:"flex",alignItems:"center",gap:"10px",minWidth:0}},e.createElement("div",{className:"bar-bg",style:{flex:1,height:"8px",backgroundColor:"#f1f5f9",borderRadius:"4px",overflow:"hidden"}},e.createElement("div",{className:"bar-fill",style:{width:`${m}%`,height:"100%",backgroundColor:l,borderRadius:"4px",transition:"width 0.3s ease"}})),e.createElement("span",{className:"bar-value",style:{fontSize:"13px",fontWeight:600,color:"#475569",minWidth:"24px",textAlign:"right"}},i)))})))}function ae({qualitative:t,satisfaction:n,friction:l}){const s=t==null?void 0:t.frictionPoints;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-friction",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Where Things Go Wrong"),(s==null?void 0:s.intro)&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,s.intro)),s&&e.createElement("div",{className:"friction-categories"},Array.isArray(s.categories)&&s.categories.map((r,a)=>e.createElement("div",{key:a,className:"friction-category"},e.createElement("div",{className:"friction-title"},r.category),e.createElement("div",{className:"friction-desc"},e.createElement(p,null,r.description)),Array.isArray(r.examples)&&r.examples.length>0&&e.createElement("ul",{className:"friction-examples"},r.examples.map((o,i)=>e.createElement("li",{key:i},e.createElement(p,null,o))))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginTop:"24px",marginBottom:"24px"}},l&&Object.keys(l).length>0&&e.createElement(D,{data:l,title:"Primary Friction Types",color:"#ef4444",allowedKeys:["misunderstood_request","wrong_approach","buggy_code","user_rejected_action","excessive_changes"]}),n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"Inferred Satisfaction (model-estimated)",color:"#10b981",allowedKeys:["happy","satisfied","likely_satisfied","dissatisfied","frustrated"]})))}function oe({additions:t}){const[n,l]=e.useState(new Array(t.length).fill(!0)),[s,r]=e.useState(!1),a=m=>{const c=n.map((d,g)=>g===m?!d:d);l(c)},o=()=>{const m=t.filter((c,d)=>n[d]).map(c=>c.addition).join(`\n\n`);m&&navigator.clipboard.writeText(m).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},i=n.filter(Boolean).length;return e.createElement("div",{className:"sara-md-section"},e.createElement("h3",null,"Suggested QWEN.md Additions"),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code to add it to your QWEN.md."),e.createElement("div",{className:"sara-md-actions",style:{marginBottom:"12px"}},e.createElement("button",{className:`copy-all-btn ${s?"copied":""}`,onClick:o,disabled:i===0},s?"Copied All!":`Copy All Checked (${i})`)),t.map((m,c)=>e.createElement("div",{key:c,className:"sara-md-item"},e.createElement("input",{type:"checkbox",checked:n[c],onChange:()=>a(c),className:"cmd-checkbox"}),e.createElement("div",{style:{flex:1}},e.createElement("code",{className:"cmd-code"},m.addition),e.createElement("div",{className:"cmd-why"},e.createElement(p,null,m.why))),e.createElement(F,{text:m.addition}))))}function ie({qualitative:t}){const{improvements:n}=t;if(!n)return null;const l=Array.isArray(n.Qwen_md_additions)&&n.Qwen_md_additions.length>0||Array.isArray(n.features_to_try)&&n.features_to_try.length>0,s=Array.isArray(n.usage_patterns)&&n.usage_patterns.length>0;return!l&&!s?null:e.createElement(e.Fragment,null,l&&e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-features",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Existing Qwen Code Features to Try"),Array.isArray(n.Qwen_md_additions)&&n.Qwen_md_additions.length>0&&e.createElement(oe,{additions:n.Qwen_md_additions}),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code and it\'ll set it up for you."),e.createElement("div",{className:"features-section"},Array.isArray(n.features_to_try)&&n.features_to_try.map((r,a)=>e.createElement("div",{key:a,className:"feature-card"},e.createElement("div",{className:"feature-title"},r.feature),e.createElement("div",{className:"feature-oneliner"},e.createElement(p,null,r.one_liner)),e.createElement("div",{className:"feature-why"},e.createElement("strong",null,"Why for you:")," ",e.createElement(p,null,r.why_for_you)),e.createElement("div",{className:"feature-examples"},e.createElement("div",{className:"feature-example"},e.createElement("div",{className:"example-code-row"},e.createElement("code",{className:"example-code"},r.example_code),e.createElement(F,{text:r.example_code})))))))),s&&e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-patterns",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"New Ways to Use Qwen Code"),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code and it\'ll walk you through it."),e.createElement("div",{className:"patterns-section"},Array.isArray(n.usage_patterns)&&n.usage_patterns.map((r,a)=>e.createElement("div",{key:a,className:"pattern-card"},e.createElement("div",{className:"pattern-title"},r.title),e.createElement("div",{className:"pattern-summary"},e.createElement(p,null,r.suggestion)),e.createElement("div",{className:"pattern-detail"},e.createElement(p,null,r.detail)),e.createElement("div",{className:"copyable-prompt-section"},e.createElement("div",{className:"prompt-label"},"Paste into Qwen Code:"),e.createElement("div",{className:"copyable-prompt-row"},e.createElement("code",{className:"copyable-prompt"},r.copyable_prompt),e.createElement(F,{text:r.copyable_prompt}))))))))}function me({qualitative:t}){const{futureOpportunities:n}=t;return n?e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-horizon",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"On the Horizon"),n.intro&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,n.intro)),e.createElement("div",{className:"horizon-section"},Array.isArray(n.opportunities)&&n.opportunities.map((l,s)=>e.createElement("div",{key:s,className:"horizon-card"},e.createElement("div",{className:"horizon-title"},l.title),e.createElement("div",{className:"horizon-possible"},e.createElement(p,null,l.whats_possible)),e.createElement("div",{className:"horizon-tip"},e.createElement("strong",null,"Getting started:")," ",e.createElement(p,null,l.how_to_try)),e.createElement("div",{className:"pattern-prompt"},e.createElement("div",{className:"prompt-label"},"Paste into Qwen Code:"),e.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px"}},e.createElement("code",{style:{flex:1}},l.copyable_prompt),e.createElement(F,{text:l.copyable_prompt}))))))):null}function ce({qualitative:t}){const{memorableMoment:n}=t;return n?e.createElement("div",{className:"fun-ending"},e.createElement("div",{className:"fun-headline"},\'"\',n.headline,\'"\'),e.createElement("div",{className:"fun-detail"},e.createElement(p,null,n.detail))):null}const de={light:{background:"linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)",textPrimary:"#0f172a",textSecondary:"#475569",textMuted:"#64748b",cardBackground:"rgba(255,255,255,0.7)",cardBackgroundSecondary:"rgba(255,255,255,0.5)",borderColor:"#e2e8f0",heatmapColors:["#9be9a8","#40c463","#30a14e","#216e39"],heatmapEmpty:"#ebedf0"},dark:{background:"linear-gradient(135deg, #0f172a 0%, #1e293b 100%)",textPrimary:"#f8fafc",textSecondary:"#e2e8f0",textMuted:"#94a3b8",cardBackground:"rgba(255,255,255,0.05)",cardBackgroundSecondary:"rgba(255,255,255,0.04)",borderColor:"rgba(255,255,255,0.08)",heatmapColors:["#0e4429","#006d32","#26a641","#39d353"],heatmapEmpty:"#2d333b"}};function pe({data:t,theme:n="light"}){var h,T,u,f,C,_;const l=de[n],{totalMessages:s=0,totalSessions:r=0,totalLinesAdded:a=0,totalLinesRemoved:o=0,totalFiles:i=0,currentStreak:m=0,longestStreak:c=0,activeHours:d={}}=t,g=Object.keys(t.heatmap||{});let E=0,x="";if(g.length>0){E=g.length;const v=g.map(S=>new Date(S).getTime()),N=new Date(Math.min(...v)),j=new Date(Math.max(...v)),k=S=>S.toISOString().split("T")[0];x=`${k(N)} \u2014 ${k(j)}`}const A=(u=(T=(h=t.qualitative)==null?void 0:h.interactionStyle)==null?void 0:T.key_pattern)!=null?u:null,w=(_=(C=(f=t.qualitative)==null?void 0:f.memorableMoment)==null?void 0:C.headline)!=null?_:null,W=fe(t.heatmap||{},l);return e.createElement("div",{id:"share-card",style:{width:"1200px",background:l.background,color:l.textPrimary,fontFamily:\'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"\',display:"flex",flexDirection:"column",padding:"48px 56px",position:"absolute",left:"-9999px",top:"-9999px",overflow:"hidden",boxSizing:"border-box"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"32px"}},e.createElement("div",null,e.createElement("div",{style:{fontSize:"32px",fontWeight:700,letterSpacing:"-0.02em",lineHeight:1.2}},"Qwen Code Insights"),e.createElement("div",{style:{fontSize:"14px",color:l.textMuted,marginTop:"6px"}},x)),e.createElement("div",{style:{fontSize:"11px",color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.15em",paddingTop:"8px"}},"sara.ai")),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"16px",marginBottom:"32px"}},e.createElement(M,{value:String(s),label:"Messages",theme:l}),e.createElement(M,{value:String(r),label:"Sessions",theme:l}),e.createElement(M,{value:`+${a}/-${o}`,label:"Lines Changed",small:!0,theme:l}),e.createElement(M,{value:String(i),label:"Files",theme:l}),e.createElement(M,{value:`${m}d`,label:"Streak",theme:l}),e.createElement(M,{value:`${c}d`,label:"Best Streak",theme:l})),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"24px",marginBottom:"16px"}},e.createElement("div",{style:{background:l.cardBackground,borderRadius:"12px",padding:"20px",display:"flex",flexDirection:"column"}},e.createElement("div",{style:{fontSize:"12px",fontWeight:600,color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"12px"}},"Activity \xB7 ",E," active days"),e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(ge,{cells:W})),e.createElement(ye,{theme:l})),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.createElement("div",{style:{background:l.cardBackground,borderRadius:"12px",padding:"20px",display:"flex",flexDirection:"column"}},e.createElement("div",{style:{fontSize:"12px",fontWeight:600,color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"12px"}},"Active Hours"),e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",gap:"10px"}},e.createElement(ue,{activeHours:d,theme:l}))),e.createElement("div",{style:{background:l.cardBackgroundSecondary,borderRadius:"12px",padding:"16px 16px",position:"relative"}},e.createElement("div",{style:{position:"absolute",left:"12px",fontSize:"64px",fontWeight:700,color:n==="light"?"rgba(99,102,241,0.15)":"rgba(99,102,241,0.2)",lineHeight:1,fontFamily:\'Georgia, "Times New Roman", serif\',userSelect:"none",pointerEvents:"none"}},"\u201C"),e.createElement("div",{style:{paddingLeft:"40px",position:"relative"}},A&&e.createElement("div",{style:{fontSize:"13px",color:l.textSecondary,lineHeight:1.6,marginBottom:w?"8px":0}},A),w&&e.createElement("div",{style:{fontSize:"12px",color:l.textMuted,lineHeight:1.5,fontStyle:"italic"}},w))))),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto",paddingTop:"24px",borderTop:`1px solid ${l.borderColor}`,flexShrink:0}},e.createElement("div",{style:{fontSize:"12px",color:l.textMuted}},"Generated by Qwen Code \xB7 ",new Date().toISOString().split("T")[0]),e.createElement("div",{style:{fontSize:"12px",color:l.textMuted}},"github.com/QwenLM/qwen-code")))}function M({value:t,label:n,small:l,theme:s}){return e.createElement("div",{style:{textAlign:"center"}},e.createElement("div",{style:{fontSize:l?"18px":"28px",fontWeight:700,color:s.textPrimary,lineHeight:1.2}},t),e.createElement("div",{style:{fontSize:"11px",color:s.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginTop:"4px"}},n))}function ue({activeHours:t,theme:n}){const s=[{label:"Morning",time:"06\u201312",hours:[6,7,8,9,10,11],color:"#fbbf24"},{label:"Afternoon",time:"12\u201318",hours:[12,13,14,15,16,17],color:"#0ea5e9"},{label:"Evening",time:"18\u201322",hours:[18,19,20,21],color:"#6366f1"},{label:"Night",time:"22\u201306",hours:[22,23,0,1,2,3,4,5],color:"#475569"}].map(a=>({...a,total:a.hours.reduce((o,i)=>o+(t[i]||0),0)})),r=Math.max(...s.map(a=>a.total),1);return e.createElement(e.Fragment,null,s.map(a=>{const o=r>0?a.total/r*100:0;return e.createElement("div",{key:a.label},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",marginBottom:"4px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},e.createElement("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:a.color,display:"inline-block",flexShrink:0}}),e.createElement("span",{style:{color:n.textSecondary,fontWeight:500}},a.label),e.createElement("span",{style:{color:n.textMuted,fontSize:"11px"}},a.time)),e.createElement("span",{style:{color:n.textMuted,fontWeight:600}},a.total)),e.createElement("div",{style:{height:"6px",background:n.borderColor,borderRadius:"3px",overflow:"hidden"}},e.createElement("div",{style:{width:`${o}%`,height:"100%",backgroundColor:a.color,borderRadius:"3px"}})))}))}function fe(t,n){const l=new Date,r=26*7,a=new Date(l);a.setDate(a.getDate()-r+1),a.setDate(a.getDate()-a.getDay());const o=[],i=new Date(l);i.setDate(i.getDate()+(6-i.getDay()));const m=new Date(a);for(;m<=i;){const c=m.toISOString().split("T")[0],d=t[c]||0;o.push({color:he(d,n)}),m.setDate(m.getDate()+1)}return o}function he(t,n){return t===0?n.heatmapEmpty:t<2?n.heatmapColors[0]:t<4?n.heatmapColors[1]:t<10?n.heatmapColors[2]:n.heatmapColors[3]}function ge({cells:t}){const l=Math.ceil(t.length/7),s=14,r=3,a=l*(s+r),o=7*(s+r);return e.createElement("svg",{width:a,height:o,viewBox:`0 0 ${a} ${o}`},t.map((i,m)=>{const c=Math.floor(m/7),d=m%7;return e.createElement("rect",{key:m,x:c*(s+r),y:d*(s+r),width:s,height:s,rx:2,fill:i.color})}))}function ye({theme:t}){return e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"12px"}},e.createElement("span",{style:{fontSize:"11px",color:t.textMuted}},"Less"),[t.heatmapEmpty,t.heatmapColors[0],t.heatmapColors[1],t.heatmapColors[2],t.heatmapColors[3]].map((n,l)=>e.createElement("span",{key:l,style:{width:"10px",height:"10px",borderRadius:"2px",backgroundColor:n,display:"inline-block"}})),e.createElement("span",{style:{fontSize:"11px",color:t.textMuted}},"More"))}function b(t){return typeof t=="string"?t.trim().length>0:typeof t=="number"?Number.isFinite(t)&&t!==0:typeof t=="boolean"?t:Array.isArray(t)?t.some(n=>b(n)):t&&typeof t=="object"?Object.values(t).some(n=>b(n)):!1}function z(t){return Array.isArray(t)?t.some(([,n])=>Number.isFinite(n)&&n!==0):!!t&&Object.values(t).some(n=>Number.isFinite(n)&&n!==0)}function H(t){return Array.isArray(t)&&t.some(n=>b(n))}function xe({data:t}){var u,f,C,_,v,N,j,k,S,L,G,Y;const[n,l]=e.useState("dark"),s=e.useRef(!1),r=async()=>{const q=document.getElementById("share-card");if(!q||!window.html2canvas){alert("Export functionality is not available.");return}try{const y=q.cloneNode(!0);y.style.position="fixed",y.style.left="-9999px",y.style.top="0",y.style.pointerEvents="none",document.body.appendChild(y);const Q=await window.html2canvas(y,{scale:2,useCORS:!0,logging:!1,width:1200,height:y.scrollHeight});document.body.removeChild(y);const P=Q.toDataURL("image/png"),I=document.createElement("a");I.href=P,I.download=`sara-insights-card-${new Date().toISOString().slice(0,10)}.png`,I.click()}catch(y){console.error("Export card error:",y),alert("Failed to export card. Please try again.")}};e.useEffect(()=>{s.current&&(s.current=!1,r())},[n]);const a=q=>{q===n?r():(s.current=!0,l(q))};if(!t)return e.createElement("div",{className:"text-center text-slate-600"},"No insight data available");const o=Object.keys(t.heatmap||{});let i="";if(o.length>0){const y=o.map(O=>new Date(O)).map(O=>O.getTime()),Q=new Date(Math.min(...y)),P=new Date(Math.max(...y)),I=O=>O.toISOString().split("T")[0];i=`${I(Q)} to ${I(P)}`}const m=b((u=t.qualitative)==null?void 0:u.atAGlance),c=!!t.qualitative&&(b(t.qualitative.projectAreas)||z(t.topGoals)||z(t.topTools)),d=b((f=t.qualitative)==null?void 0:f.interactionStyle),g=!!t.qualitative&&(b(t.qualitative.impressiveWorkflows)||z(t.primarySuccess)||z(t.outcomes)),E=!!t.qualitative&&(b(t.qualitative.frictionPoints)||z(t.satisfaction)||z(t.friction)),x=!!t.qualitative&&(H((C=t.qualitative.improvements)==null?void 0:C.Qwen_md_additions)||H((_=t.qualitative.improvements)==null?void 0:_.features_to_try)),A=!!t.qualitative&&H((v=t.qualitative.improvements)==null?void 0:v.usage_patterns),w=b((N=t.qualitative)==null?void 0:N.futureOpportunities),W=b((j=t.qualitative)==null?void 0:j.memorableMoment),h=[];c&&h.push({href:"#section-work",label:"What You Work On"}),d&&h.push({href:"#section-usage",label:"How You Use Qwen Code"}),g&&h.push({href:"#section-wins",label:"Impressive Things"}),E&&h.push({href:"#section-friction",label:"Where Things Go Wrong"}),x&&h.push({href:"#section-features",label:"Features to Try"}),A&&h.push({href:"#section-patterns",label:"New Usage Patterns"}),w&&h.push({href:"#section-horizon",label:"On the Horizon"});const T={wins:g,friction:E,features:x,horizon:w};return e.createElement("div",null,e.createElement("header",{className:"insights-header"},e.createElement("div",{className:"header-content"},e.createElement("div",{className:"header-title-section"},e.createElement("h1",{className:"header-title"},"Qwen Code Insights"),e.createElement("p",{className:"header-subtitle"},t.totalMessages?`${t.totalMessages.toLocaleString()} messages across ${(k=t.totalSessions)==null?void 0:k.toLocaleString()} sessions`:"Your personalized coding journey and patterns",i&&` \xB7 ${i}`)),e.createElement(Ee,{onExport:a}))),m&&t.qualitative&&e.createElement(ee,{qualitative:t.qualitative,targetSections:T}),h.length>0&&e.createElement(te,{sections:h}),e.createElement(U,{data:t}),c&&t.qualitative&&e.createElement(ne,{qualitative:t.qualitative,topGoals:t.topGoals,topTools:t.topTools}),d&&t.qualitative&&e.createElement(le,{qualitative:t.qualitative,insights:t}),g&&e.createElement(re,{qualitative:t.qualitative,primarySuccess:(S=t.primarySuccess)!=null?S:{},outcomes:(L=t.outcomes)!=null?L:{}}),E&&e.createElement(ae,{qualitative:t.qualitative,satisfaction:(G=t.satisfaction)!=null?G:{},friction:(Y=t.friction)!=null?Y:{}}),(x||A)&&t.qualitative&&e.createElement(ie,{qualitative:t.qualitative}),w&&t.qualitative&&e.createElement(me,{qualitative:t.qualitative}),W&&t.qualitative&&e.createElement(ce,{qualitative:t.qualitative}),e.createElement(pe,{data:t,theme:n}))}function Ee({onExport:t}){const[n,l]=e.useState(!1),s=e.useRef(null);e.useEffect(()=>{if(!n)return;const a=o=>{s.current&&!s.current.contains(o.target)&&l(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[n]);const r=a=>{l(!1),t(a)};return e.createElement("div",{className:"export-dropdown-wrapper",ref:s},e.createElement("button",{className:"export-card-btn",onClick:()=>l(!n)},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),e.createElement("polyline",{points:"16 6 12 2 8 6"}),e.createElement("line",{x1:"12",y1:"2",x2:"12",y2:"15"})),e.createElement("span",null,"Export Card"),e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`export-chevron ${n?"open":""}`},e.createElement("polyline",{points:"6 9 12 15 18 9"}))),n&&e.createElement("div",{className:"export-dropdown"},e.createElement("button",{className:"export-dropdown-item",onClick:()=>r("light")},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"5"}),e.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.createElement("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.createElement("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.createElement("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.createElement("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.createElement("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.createElement("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.createElement("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})),e.createElement("span",null,"Light Theme")),e.createElement("button",{className:"export-dropdown-item",onClick:()=>r("dark")},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})),e.createElement("span",null,"Dark Theme"))))}const $=document.getElementById("react-root");$&&window.INSIGHT_DATA&&B?B.createRoot($).render(e.createElement(xe,{data:window.INSIGHT_DATA})):console.error("Failed to mount React app:",{container:!!$,data:!!window.INSIGHT_DATA,ReactDOM:!!B})})(React,ReactDOM);';
|
|
47438
|
+
var INSIGHT_JS = '(function(e,B){"use strict";function U({data:t}){const{totalMessages:n=0,totalLinesAdded:l=0,totalLinesRemoved:a=0,totalFiles:r=0}=t,s=Object.keys(t.heatmap||{});let o=0;if(s.length>0){const c=s.map(x=>new Date(x)).map(x=>x.getTime()),d=new Date(Math.min(...c)),g=new Date(Math.max(...c)),E=Math.abs(g.getTime()-d.getTime());o=Math.ceil(E/(1e3*60*60*24))+1}const i=o>0?Math.round(n/o):0;return e.createElement("div",{className:"stats-row"},e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},n),e.createElement("div",{className:"stat-label"},"Messages")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},"+",l,"/-",a),e.createElement("div",{className:"stat-label"},"Lines")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},r),e.createElement("div",{className:"stat-label"},"Files")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},o),e.createElement("div",{className:"stat-label"},"Days")),e.createElement("div",{className:"stat"},e.createElement("div",{className:"stat-value"},i),e.createElement("div",{className:"stat-label"},"Msgs/Day")))}function K({insights:t}){return e.createElement("div",{className:"grid gap-4 md:grid-cols-2 md:gap-6"},e.createElement(J,{activeHours:t.activeHours,cardClass:"glass-card p-6",sectionTitleClass:"text-lg font-semibold tracking-tight text-slate-900"}))}function J({activeHours:t,cardClass:n,sectionTitleClass:l}){const r=[{label:"Morning",time:"06:00 - 12:00",hours:[6,7,8,9,10,11],color:"#fbbf24"},{label:"Afternoon",time:"12:00 - 18:00",hours:[12,13,14,15,16,17],color:"#0ea5e9"},{label:"Evening",time:"18:00 - 22:00",hours:[18,19,20,21],color:"#6366f1"},{label:"Night",time:"22:00 - 06:00",hours:[22,23,0,1,2,3,4,5],color:"#475569"}].map(o=>{const i=o.hours.reduce((m,c)=>m+(t[c]||0),0);return{...o,total:i}}),s=Math.max(...r.map(o=>o.total));return e.createElement("div",{className:`${n} h-full flex flex-col min-h-[320px]`},e.createElement("div",{className:"flex items-center justify-between mb-4"},e.createElement("h3",{className:l},"Active Hours")),e.createElement("div",{className:"flex-1 flex flex-col justify-center gap-4"},r.map(o=>e.createElement("div",{key:o.label,className:"space-y-2"},e.createElement("div",{className:"flex justify-between items-center text-sm"},e.createElement("div",{className:"flex items-center gap-2"},e.createElement("span",{className:"rounded-full",style:{width:"12px",height:"12px",backgroundColor:o.color}}),e.createElement("span",{className:"font-medium text-slate-700"},o.label),e.createElement("span",{className:"text-xs text-slate-400 hidden xl:inline"},o.time)),e.createElement("span",{className:"font-semibold text-slate-900"},o.total)),e.createElement("div",{className:"w-full rounded-full overflow-hidden",style:{height:"12px",backgroundColor:"#e2e8f0"}},e.createElement("div",{className:"h-full rounded-full",style:{width:`${s>0?o.total/s*100:0}%`,backgroundColor:o.color}}))))))}function V({heatmap:t}){return e.createElement("div",{className:"glass-card p-6 mt-4 md:mt-6"},e.createElement("div",{className:"mb-3"},e.createElement("h3",{className:"text-lg font-semibold tracking-tight text-slate-900"},"Activity Heatmap"),e.createElement("p",{className:"text-xs text-slate-500"},"Showing past year of activity")),e.createElement("div",{className:"heatmap-container"},e.createElement("div",{className:"min-w-[720px] rounded-xl bg-white/70"},e.createElement(X,{heatmapData:t}))),e.createElement(Z,null))}function X({heatmapData:t}){const s=new Date,o=new Date(s);o.setFullYear(s.getFullYear()-1);const i=[],m=new Date(o);for(;m<=s;)i.push(new Date(m)),m.setDate(m.getDate()+1);const c=[0,2,4,10,20],d=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"];function g(u){if(u===0)return d[0];for(let f=c.length-1;f>=1;f--)if(u>=c[f])return d[f];return d[1]}const E=50,x=20,A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],w=o.getDay(),W=[];let h=-1,T=-100;return i.forEach((u,f)=>{const C=f+w,_=Math.floor(C/7),v=E+_*16,N=u.getMonth();N!==h&&(v-T>30&&(W.push({x:v,text:A[N]}),T=v),h=N)}),e.createElement("svg",{className:"heatmap-svg",width:1e3,height:130,viewBox:"0 0 1000 130"},i.map((u,f)=>{const C=f+w,_=Math.floor(C/7),v=u.getDay(),N=E+_*16,j=x+v*16,k=u.toISOString().split("T")[0],S=t[k]||0,L=g(S);return e.createElement("rect",{key:k,className:"heatmap-day",x:N,y:j,width:14,height:14,rx:"2",fill:L,"data-date":k,"data-count":S},e.createElement("title",null,k,": ",S," activities"))}),W.map((u,f)=>e.createElement("text",{key:f,x:u.x,y:"15",fontSize:"12",fill:"#64748b"},u.text)))}function Z(){const t=["#ebedf0","#9be9a8","#40c463","#30a14e","#216e39"];return e.createElement("div",{className:"flex items-center gap-2 mt-4"},e.createElement("span",{className:"text-xs text-slate-500"},"Less"),t.map((n,l)=>e.createElement("span",{key:l,className:"inline-block rounded",style:{width:"10px",height:"10px",backgroundColor:n}})),e.createElement("span",{className:"text-xs text-slate-500"},"More"))}function p({children:t}){if(!t||typeof t!="string")return t;const n=t.split(/(\\*\\*.*?\\*\\*)/g);return e.createElement(e.Fragment,null,n.map((l,a)=>l.startsWith("**")&&l.endsWith("**")&&l.length>=4?e.createElement("strong",{key:a},l.slice(2,-2)):l))}function q({text:t,label:n="Copy"}){const[l,a]=e.useState(!1),r=()=>{navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),2e3)})};return e.createElement("button",{className:"copy-btn",onClick:r},l?"Copied!":n)}function R(t){return typeof t=="string"&&t.trim().length>0}function ee({qualitative:t,targetSections:n}){const{atAGlance:l}=t;if(!l)return null;const a=[{key:"wins",label:"What\'s working:",body:l.whats_working,href:"#section-wins",link:"Impressive Things You Did \u2192",showLink:n.wins},{key:"friction",label:"What\'s hindering you:",body:l.whats_hindering,href:"#section-friction",link:"Where Things Go Wrong \u2192",showLink:n.friction},{key:"features",label:"Quick wins to try:",body:l.quick_wins,href:"#section-features",link:"Features to Try \u2192",showLink:n.features},{key:"horizon",label:"Ambitious workflows:",body:l.ambitious_workflows,href:"#section-horizon",link:"On the Horizon \u2192",showLink:n.horizon}].filter(r=>R(r.body));return a.length===0?null:e.createElement("div",{className:"at-a-glance"},e.createElement("div",{className:"glance-title"},"At a Glance"),e.createElement("div",{className:"glance-sections"},a.map(r=>e.createElement("div",{key:r.key,className:"glance-section"},e.createElement("strong",null,r.label)," ",e.createElement(p,null,r.body),r.showLink&&e.createElement("a",{href:r.href,className:"see-more"},r.link)))))}function te({sections:t}){return t.length===0?null:e.createElement("nav",{className:"nav-toc"},t.map(n=>e.createElement("a",{key:n.href,href:n.href},n.label)))}function ne({qualitative:t,topGoals:n,topTools:l}){const{projectAreas:a}=t,r=Array.isArray(l)?Object.fromEntries(l):l;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-work",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"What You Work On"),Array.isArray(a==null?void 0:a.areas)&&a.areas.length>0&&e.createElement("div",{className:"project-areas mb-6"},a.areas.map((s,o)=>e.createElement("div",{key:o,className:"project-area"},e.createElement("div",{className:"area-header"},e.createElement("span",{className:"area-name"},s.name),e.createElement("span",{className:"area-count"},"~",s.session_count," sessions")),e.createElement("div",{className:"area-desc"},e.createElement(p,null,s.description))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginBottom:"24px"}},n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"What You Wanted",color:"#0ea5e9"}),r&&Object.keys(r).length>0&&e.createElement(D,{data:r,title:"Top Tools Used",color:"#6366f1"})))}function le({qualitative:t,insights:n}){const{interactionStyle:l}=t;return l?e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-usage",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"How You Use Qwen Code"),e.createElement("div",{className:"narrative"},e.createElement("p",null,e.createElement(p,null,l.narrative)),l.key_pattern&&e.createElement("div",{className:"key-insight"},e.createElement("strong",null,"Key pattern:")," ",e.createElement(p,null,l.key_pattern))),e.createElement(K,{insights:n}),e.createElement(V,{heatmap:n.heatmap})):null}function re({qualitative:t,primarySuccess:n,outcomes:l}){const a=t==null?void 0:t.impressiveWorkflows;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-wins",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Impressive Things You Did"),(a==null?void 0:a.intro)&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,a.intro)),a&&e.createElement("div",{className:"big-wins"},Array.isArray(a.impressive_workflows)&&a.impressive_workflows.map((r,s)=>e.createElement("div",{key:s,className:"big-win"},e.createElement("div",{className:"big-win-title"},r.title),e.createElement("div",{className:"big-win-desc"},e.createElement(p,null,r.description))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginTop:"24px",marginBottom:"24px"}},n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"What Helped Most (Qwen\'s Capabilities)",color:"#3b82f6",allowedKeys:["fast_accurate_search","correct_code_edits","good_explanations","proactive_help","multi_file_changes","good_debugging"]}),l&&Object.keys(l).length>0&&e.createElement(D,{data:l,title:"Outcomes",color:"#8b5cf6",allowedKeys:["fully_achieved","mostly_achieved","partially_achieved","not_achieved","unclear_from_transcript"]})))}function ae(t){return t==="unclear_from_transcript"?"Unclear":t.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function D({data:t,title:n,color:l="#3b82f6",allowedKeys:a=null}){if(!t||Object.keys(t).length===0)return null;let r=Object.entries(t).filter(([,o])=>Number.isFinite(o)&&o!==0);if(a&&(r=r.filter(([o])=>a.includes(o))),r.sort((o,i)=>i[1]-o[1]),r=r.slice(0,10),r.length===0)return null;const s=Math.max(...r.map(([,o])=>o));return e.createElement("div",{className:"bar-chart-card",style:{flex:1,minWidth:0,backgroundColor:"#ffffff",borderRadius:"12px",padding:"20px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.08)",border:"1px solid #e2e8f0"}},e.createElement("h3",{style:{fontSize:"13px",fontWeight:700,color:"#64748b",marginTop:0,marginBottom:"16px",textTransform:"uppercase",letterSpacing:"0.5px"}},n),e.createElement("div",{className:"bar-chart",style:{display:"flex",flexDirection:"column",gap:"10px"}},r.map(([o,i])=>{const m=s>0?i/s*100:0;return e.createElement("div",{key:o,className:"bar-row",style:{display:"flex",alignItems:"center",gap:"12px"}},e.createElement("div",{className:"bar-label",style:{width:"130px",fontSize:"13px",color:"#475569",textAlign:"left",flexShrink:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},ae(o)),e.createElement("div",{className:"bar-wrapper",style:{flex:1,display:"flex",alignItems:"center",gap:"10px",minWidth:0}},e.createElement("div",{className:"bar-bg",style:{flex:1,height:"8px",backgroundColor:"#f1f5f9",borderRadius:"4px",overflow:"hidden"}},e.createElement("div",{className:"bar-fill",style:{width:`${m}%`,height:"100%",backgroundColor:l,borderRadius:"4px",transition:"width 0.3s ease"}})),e.createElement("span",{className:"bar-value",style:{fontSize:"13px",fontWeight:600,color:"#475569",minWidth:"24px",textAlign:"right"}},i)))})))}function se({qualitative:t,satisfaction:n,friction:l}){const a=t==null?void 0:t.frictionPoints;return e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-friction",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Where Things Go Wrong"),(a==null?void 0:a.intro)&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,a.intro)),a&&e.createElement("div",{className:"friction-categories"},Array.isArray(a.categories)&&a.categories.map((r,s)=>e.createElement("div",{key:s,className:"friction-category"},e.createElement("div",{className:"friction-title"},r.category),e.createElement("div",{className:"friction-desc"},e.createElement(p,null,r.description)),Array.isArray(r.examples)&&r.examples.length>0&&e.createElement("ul",{className:"friction-examples"},r.examples.map((o,i)=>e.createElement("li",{key:i},e.createElement(p,null,o))))))),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"24px",marginTop:"24px",marginBottom:"24px"}},l&&Object.keys(l).length>0&&e.createElement(D,{data:l,title:"Primary Friction Types",color:"#ef4444",allowedKeys:["misunderstood_request","wrong_approach","buggy_code","user_rejected_action","excessive_changes"]}),n&&Object.keys(n).length>0&&e.createElement(D,{data:n,title:"Inferred Satisfaction (model-estimated)",color:"#10b981",allowedKeys:["happy","satisfied","likely_satisfied","dissatisfied","frustrated"]})))}function oe({additions:t}){const[n,l]=e.useState(new Array(t.length).fill(!0)),[a,r]=e.useState(!1),s=m=>{const c=n.map((d,g)=>g===m?!d:d);l(c)},o=()=>{const m=t.filter((c,d)=>n[d]).map(c=>c.addition).join(`\n\n`);m&&navigator.clipboard.writeText(m).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},i=n.filter(Boolean).length;return e.createElement("div",{className:"sara-md-section"},e.createElement("h3",null,"Suggested QWEN.md Additions"),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code to add it to your QWEN.md."),e.createElement("div",{className:"sara-md-actions",style:{marginBottom:"12px"}},e.createElement("button",{className:`copy-all-btn ${a?"copied":""}`,onClick:o,disabled:i===0},a?"Copied All!":`Copy All Checked (${i})`)),t.map((m,c)=>e.createElement("div",{key:c,className:"sara-md-item"},e.createElement("input",{type:"checkbox",checked:n[c],onChange:()=>s(c),className:"cmd-checkbox"}),e.createElement("div",{style:{flex:1}},e.createElement("code",{className:"cmd-code"},m.addition),e.createElement("div",{className:"cmd-why"},e.createElement(p,null,m.why))),e.createElement(q,{text:m.addition}))))}function ie({qualitative:t}){const{improvements:n}=t;if(!n)return null;const l=Array.isArray(n.Qwen_md_additions)&&n.Qwen_md_additions.length>0||Array.isArray(n.features_to_try)&&n.features_to_try.length>0,a=Array.isArray(n.usage_patterns)&&n.usage_patterns.length>0;return!l&&!a?null:e.createElement(e.Fragment,null,l&&e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-features",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"Existing Qwen Code Features to Try"),Array.isArray(n.Qwen_md_additions)&&n.Qwen_md_additions.length>0&&e.createElement(oe,{additions:n.Qwen_md_additions}),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code and it\'ll set it up for you."),e.createElement("div",{className:"features-section"},Array.isArray(n.features_to_try)&&n.features_to_try.map((r,s)=>e.createElement("div",{key:s,className:"feature-card"},e.createElement("div",{className:"feature-title"},r.feature),e.createElement("div",{className:"feature-oneliner"},e.createElement(p,null,r.one_liner)),e.createElement("div",{className:"feature-why"},e.createElement("strong",null,"Why for you:")," ",e.createElement(p,null,r.why_for_you)),e.createElement("div",{className:"feature-examples"},e.createElement("div",{className:"feature-example"},e.createElement("div",{className:"example-code-row"},e.createElement("code",{className:"example-code"},r.example_code),e.createElement(q,{text:r.example_code})))))))),a&&e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-patterns",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"New Ways to Use Qwen Code"),e.createElement("p",{className:"text-xs text-slate-500 mb-3"},"Just copy this into Qwen Code and it\'ll walk you through it."),e.createElement("div",{className:"patterns-section"},Array.isArray(n.usage_patterns)&&n.usage_patterns.map((r,s)=>e.createElement("div",{key:s,className:"pattern-card"},e.createElement("div",{className:"pattern-title"},r.title),e.createElement("div",{className:"pattern-summary"},e.createElement(p,null,r.suggestion)),e.createElement("div",{className:"pattern-detail"},e.createElement(p,null,r.detail)),e.createElement("div",{className:"copyable-prompt-section"},e.createElement("div",{className:"prompt-label"},"Paste into Qwen Code:"),e.createElement("div",{className:"copyable-prompt-row"},e.createElement("code",{className:"copyable-prompt"},r.copyable_prompt),e.createElement(q,{text:r.copyable_prompt}))))))))}function me({qualitative:t}){const{futureOpportunities:n}=t;return n?e.createElement(e.Fragment,null,e.createElement("h2",{id:"section-horizon",className:"text-xl font-semibold text-slate-900 mt-8 mb-4"},"On the Horizon"),n.intro&&e.createElement("p",{className:"section-intro"},e.createElement(p,null,n.intro)),e.createElement("div",{className:"horizon-section"},Array.isArray(n.opportunities)&&n.opportunities.map((l,a)=>e.createElement("div",{key:a,className:"horizon-card"},e.createElement("div",{className:"horizon-title"},l.title),e.createElement("div",{className:"horizon-possible"},e.createElement(p,null,l.whats_possible)),e.createElement("div",{className:"horizon-tip"},e.createElement("strong",null,"Getting started:")," ",e.createElement(p,null,l.how_to_try)),e.createElement("div",{className:"pattern-prompt"},e.createElement("div",{className:"prompt-label"},"Paste into Qwen Code:"),e.createElement("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px"}},e.createElement("code",{style:{flex:1}},l.copyable_prompt),e.createElement(q,{text:l.copyable_prompt}))))))):null}function ce({qualitative:t}){const{memorableMoment:n}=t;return n?e.createElement("div",{className:"fun-ending"},e.createElement("div",{className:"fun-headline"},\'"\',n.headline,\'"\'),e.createElement("div",{className:"fun-detail"},e.createElement(p,null,n.detail))):null}const de={light:{background:"linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)",textPrimary:"#0f172a",textSecondary:"#475569",textMuted:"#64748b",cardBackground:"rgba(255,255,255,0.7)",cardBackgroundSecondary:"rgba(255,255,255,0.5)",borderColor:"#e2e8f0",heatmapColors:["#9be9a8","#40c463","#30a14e","#216e39"],heatmapEmpty:"#ebedf0"},dark:{background:"linear-gradient(135deg, #0f172a 0%, #1e293b 100%)",textPrimary:"#f8fafc",textSecondary:"#e2e8f0",textMuted:"#94a3b8",cardBackground:"rgba(255,255,255,0.05)",cardBackgroundSecondary:"rgba(255,255,255,0.04)",borderColor:"rgba(255,255,255,0.08)",heatmapColors:["#0e4429","#006d32","#26a641","#39d353"],heatmapEmpty:"#2d333b"}};function pe({data:t,theme:n="light"}){var h,T,u,f,C,_;const l=de[n],{totalMessages:a=0,totalSessions:r=0,totalLinesAdded:s=0,totalLinesRemoved:o=0,totalFiles:i=0,currentStreak:m=0,longestStreak:c=0,activeHours:d={}}=t,g=Object.keys(t.heatmap||{});let E=0,x="";if(g.length>0){E=g.length;const v=g.map(S=>new Date(S).getTime()),N=new Date(Math.min(...v)),j=new Date(Math.max(...v)),k=S=>S.toISOString().split("T")[0];x=`${k(N)} \u2014 ${k(j)}`}const A=(u=(T=(h=t.qualitative)==null?void 0:h.interactionStyle)==null?void 0:T.key_pattern)!=null?u:null,w=(_=(C=(f=t.qualitative)==null?void 0:f.memorableMoment)==null?void 0:C.headline)!=null?_:null,W=fe(t.heatmap||{},l);return e.createElement("div",{id:"share-card",style:{width:"1200px",background:l.background,color:l.textPrimary,fontFamily:\'ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"\',display:"flex",flexDirection:"column",padding:"48px 56px",position:"absolute",left:"-9999px",top:"-9999px",overflow:"hidden",boxSizing:"border-box"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"32px"}},e.createElement("div",null,e.createElement("div",{style:{fontSize:"32px",fontWeight:700,letterSpacing:"-0.02em",lineHeight:1.2}},"Qwen Code Insights"),e.createElement("div",{style:{fontSize:"14px",color:l.textMuted,marginTop:"6px"}},x)),e.createElement("div",{style:{fontSize:"11px",color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.15em",paddingTop:"8px"}},"sara.ai")),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"16px",marginBottom:"32px"}},e.createElement(M,{value:String(a),label:"Messages",theme:l}),e.createElement(M,{value:String(r),label:"Sessions",theme:l}),e.createElement(M,{value:`+${s}/-${o}`,label:"Lines Changed",small:!0,theme:l}),e.createElement(M,{value:String(i),label:"Files",theme:l}),e.createElement(M,{value:`${m}d`,label:"Streak",theme:l}),e.createElement(M,{value:`${c}d`,label:"Best Streak",theme:l})),e.createElement("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"24px",marginBottom:"16px"}},e.createElement("div",{style:{background:l.cardBackground,borderRadius:"12px",padding:"20px",display:"flex",flexDirection:"column"}},e.createElement("div",{style:{fontSize:"12px",fontWeight:600,color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"12px"}},"Activity \xB7 ",E," active days"),e.createElement("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"}},e.createElement(ge,{cells:W})),e.createElement(ye,{theme:l})),e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},e.createElement("div",{style:{background:l.cardBackground,borderRadius:"12px",padding:"20px",display:"flex",flexDirection:"column"}},e.createElement("div",{style:{fontSize:"12px",fontWeight:600,color:l.textMuted,textTransform:"uppercase",letterSpacing:"0.08em",marginBottom:"12px"}},"Active Hours"),e.createElement("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",gap:"10px"}},e.createElement(ue,{activeHours:d,theme:l}))),e.createElement("div",{style:{background:l.cardBackgroundSecondary,borderRadius:"12px",padding:"16px 16px",position:"relative"}},e.createElement("div",{style:{position:"absolute",left:"12px",fontSize:"64px",fontWeight:700,color:n==="light"?"rgba(99,102,241,0.15)":"rgba(99,102,241,0.2)",lineHeight:1,fontFamily:\'Georgia, "Times New Roman", serif\',userSelect:"none",pointerEvents:"none"}},"\u201C"),e.createElement("div",{style:{paddingLeft:"40px",position:"relative"}},A&&e.createElement("div",{style:{fontSize:"13px",color:l.textSecondary,lineHeight:1.6,marginBottom:w?"8px":0}},A),w&&e.createElement("div",{style:{fontSize:"12px",color:l.textMuted,lineHeight:1.5,fontStyle:"italic"}},w))))),e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto",paddingTop:"24px",borderTop:`1px solid ${l.borderColor}`,flexShrink:0}},e.createElement("div",{style:{fontSize:"12px",color:l.textMuted}},"Generated by Qwen Code \xB7 ",new Date().toISOString().split("T")[0]),e.createElement("div",{style:{fontSize:"12px",color:l.textMuted}},"github.com/QwenLM/qwen-code")))}function M({value:t,label:n,small:l,theme:a}){return e.createElement("div",{style:{textAlign:"center"}},e.createElement("div",{style:{fontSize:l?"18px":"28px",fontWeight:700,color:a.textPrimary,lineHeight:1.2}},t),e.createElement("div",{style:{fontSize:"11px",color:a.textMuted,textTransform:"uppercase",letterSpacing:"0.05em",marginTop:"4px"}},n))}function ue({activeHours:t,theme:n}){const a=[{label:"Morning",time:"06\u201312",hours:[6,7,8,9,10,11],color:"#fbbf24"},{label:"Afternoon",time:"12\u201318",hours:[12,13,14,15,16,17],color:"#0ea5e9"},{label:"Evening",time:"18\u201322",hours:[18,19,20,21],color:"#6366f1"},{label:"Night",time:"22\u201306",hours:[22,23,0,1,2,3,4,5],color:"#475569"}].map(s=>({...s,total:s.hours.reduce((o,i)=>o+(t[i]||0),0)})),r=Math.max(...a.map(s=>s.total),1);return e.createElement(e.Fragment,null,a.map(s=>{const o=r>0?s.total/r*100:0;return e.createElement("div",{key:s.label},e.createElement("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",marginBottom:"4px"}},e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"6px"}},e.createElement("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:s.color,display:"inline-block",flexShrink:0}}),e.createElement("span",{style:{color:n.textSecondary,fontWeight:500}},s.label),e.createElement("span",{style:{color:n.textMuted,fontSize:"11px"}},s.time)),e.createElement("span",{style:{color:n.textMuted,fontWeight:600}},s.total)),e.createElement("div",{style:{height:"6px",background:n.borderColor,borderRadius:"3px",overflow:"hidden"}},e.createElement("div",{style:{width:`${o}%`,height:"100%",backgroundColor:s.color,borderRadius:"3px"}})))}))}function fe(t,n){const l=new Date,r=26*7,s=new Date(l);s.setDate(s.getDate()-r+1),s.setDate(s.getDate()-s.getDay());const o=[],i=new Date(l);i.setDate(i.getDate()+(6-i.getDay()));const m=new Date(s);for(;m<=i;){const c=m.toISOString().split("T")[0],d=t[c]||0;o.push({color:he(d,n)}),m.setDate(m.getDate()+1)}return o}function he(t,n){return t===0?n.heatmapEmpty:t<2?n.heatmapColors[0]:t<4?n.heatmapColors[1]:t<10?n.heatmapColors[2]:n.heatmapColors[3]}function ge({cells:t}){const l=Math.ceil(t.length/7),a=14,r=3,s=l*(a+r),o=7*(a+r);return e.createElement("svg",{width:s,height:o,viewBox:`0 0 ${s} ${o}`},t.map((i,m)=>{const c=Math.floor(m/7),d=m%7;return e.createElement("rect",{key:m,x:c*(a+r),y:d*(a+r),width:a,height:a,rx:2,fill:i.color})}))}function ye({theme:t}){return e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginTop:"12px"}},e.createElement("span",{style:{fontSize:"11px",color:t.textMuted}},"Less"),[t.heatmapEmpty,t.heatmapColors[0],t.heatmapColors[1],t.heatmapColors[2],t.heatmapColors[3]].map((n,l)=>e.createElement("span",{key:l,style:{width:"10px",height:"10px",borderRadius:"2px",backgroundColor:n,display:"inline-block"}})),e.createElement("span",{style:{fontSize:"11px",color:t.textMuted}},"More"))}function b(t){return typeof t=="string"?t.trim().length>0:typeof t=="number"?Number.isFinite(t)&&t!==0:typeof t=="boolean"?t:Array.isArray(t)?t.some(n=>b(n)):t&&typeof t=="object"?Object.values(t).some(n=>b(n)):!1}function z(t){return Array.isArray(t)?t.some(([,n])=>Number.isFinite(n)&&n!==0):!!t&&Object.values(t).some(n=>Number.isFinite(n)&&n!==0)}function H(t){return Array.isArray(t)&&t.some(n=>b(n))}function xe({data:t}){var u,f,C,_,v,N,j,k,S,L,G,Y;const[n,l]=e.useState("dark"),a=e.useRef(!1),r=async()=>{const I=document.getElementById("share-card");if(!I||!window.html2canvas){alert("Export functionality is not available.");return}try{const y=I.cloneNode(!0);y.style.position="fixed",y.style.left="-9999px",y.style.top="0",y.style.pointerEvents="none",document.body.appendChild(y);const Q=await window.html2canvas(y,{scale:2,useCORS:!0,logging:!1,width:1200,height:y.scrollHeight});document.body.removeChild(y);const P=Q.toDataURL("image/png"),O=document.createElement("a");O.href=P,O.download=`sara-insights-card-${new Date().toISOString().slice(0,10)}.png`,O.click()}catch(y){console.error("Export card error:",y),alert("Failed to export card. Please try again.")}};e.useEffect(()=>{a.current&&(a.current=!1,r())},[n]);const s=I=>{I===n?r():(a.current=!0,l(I))};if(!t)return e.createElement("div",{className:"text-center text-slate-600"},"No insight data available");const o=Object.keys(t.heatmap||{});let i="";if(o.length>0){const y=o.map(F=>new Date(F)).map(F=>F.getTime()),Q=new Date(Math.min(...y)),P=new Date(Math.max(...y)),O=F=>F.toISOString().split("T")[0];i=`${O(Q)} to ${O(P)}`}const m=b((u=t.qualitative)==null?void 0:u.atAGlance),c=!!t.qualitative&&(b(t.qualitative.projectAreas)||z(t.topGoals)||z(t.topTools)),d=b((f=t.qualitative)==null?void 0:f.interactionStyle),g=!!t.qualitative&&(b(t.qualitative.impressiveWorkflows)||z(t.primarySuccess)||z(t.outcomes)),E=!!t.qualitative&&(b(t.qualitative.frictionPoints)||z(t.satisfaction)||z(t.friction)),x=!!t.qualitative&&(H((C=t.qualitative.improvements)==null?void 0:C.Qwen_md_additions)||H((_=t.qualitative.improvements)==null?void 0:_.features_to_try)),A=!!t.qualitative&&H((v=t.qualitative.improvements)==null?void 0:v.usage_patterns),w=b((N=t.qualitative)==null?void 0:N.futureOpportunities),W=b((j=t.qualitative)==null?void 0:j.memorableMoment),h=[];c&&h.push({href:"#section-work",label:"What You Work On"}),d&&h.push({href:"#section-usage",label:"How You Use Qwen Code"}),g&&h.push({href:"#section-wins",label:"Impressive Things"}),E&&h.push({href:"#section-friction",label:"Where Things Go Wrong"}),x&&h.push({href:"#section-features",label:"Features to Try"}),A&&h.push({href:"#section-patterns",label:"New Usage Patterns"}),w&&h.push({href:"#section-horizon",label:"On the Horizon"});const T={wins:g,friction:E,features:x,horizon:w};return e.createElement("div",null,e.createElement("header",{className:"insights-header"},e.createElement("div",{className:"header-content"},e.createElement("div",{className:"header-title-section"},e.createElement("h1",{className:"header-title"},"Qwen Code Insights"),e.createElement("p",{className:"header-subtitle"},t.totalMessages?`${t.totalMessages.toLocaleString()} messages across ${(k=t.totalSessions)==null?void 0:k.toLocaleString()} sessions`:"Your personalized coding journey and patterns",i&&` \xB7 ${i}`)),e.createElement(Ee,{onExport:s}))),m&&t.qualitative&&e.createElement(ee,{qualitative:t.qualitative,targetSections:T}),h.length>0&&e.createElement(te,{sections:h}),e.createElement(U,{data:t}),c&&t.qualitative&&e.createElement(ne,{qualitative:t.qualitative,topGoals:t.topGoals,topTools:t.topTools}),d&&t.qualitative&&e.createElement(le,{qualitative:t.qualitative,insights:t}),g&&e.createElement(re,{qualitative:t.qualitative,primarySuccess:(S=t.primarySuccess)!=null?S:{},outcomes:(L=t.outcomes)!=null?L:{}}),E&&e.createElement(se,{qualitative:t.qualitative,satisfaction:(G=t.satisfaction)!=null?G:{},friction:(Y=t.friction)!=null?Y:{}}),(x||A)&&t.qualitative&&e.createElement(ie,{qualitative:t.qualitative}),w&&t.qualitative&&e.createElement(me,{qualitative:t.qualitative}),W&&t.qualitative&&e.createElement(ce,{qualitative:t.qualitative}),e.createElement(pe,{data:t,theme:n}))}function Ee({onExport:t}){const[n,l]=e.useState(!1),a=e.useRef(null);e.useEffect(()=>{if(!n)return;const s=o=>{a.current&&!a.current.contains(o.target)&&l(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[n]);const r=s=>{l(!1),t(s)};return e.createElement("div",{className:"export-dropdown-wrapper",ref:a},e.createElement("button",{className:"export-card-btn",onClick:()=>l(!n)},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8"}),e.createElement("polyline",{points:"16 6 12 2 8 6"}),e.createElement("line",{x1:"12",y1:"2",x2:"12",y2:"15"})),e.createElement("span",null,"Export Card"),e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:`export-chevron ${n?"open":""}`},e.createElement("polyline",{points:"6 9 12 15 18 9"}))),n&&e.createElement("div",{className:"export-dropdown"},e.createElement("button",{className:"export-dropdown-item",onClick:()=>r("light")},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"5"}),e.createElement("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),e.createElement("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),e.createElement("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),e.createElement("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),e.createElement("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),e.createElement("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),e.createElement("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),e.createElement("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})),e.createElement("span",null,"Light Theme")),e.createElement("button",{className:"export-dropdown-item",onClick:()=>r("dark")},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})),e.createElement("span",null,"Dark Theme"))))}const $=document.getElementById("react-root");$&&window.INSIGHT_DATA&&B?B.createRoot($).render(e.createElement(xe,{data:window.INSIGHT_DATA})):console.error("Failed to mount React app:",{container:!!$,data:!!window.INSIGHT_DATA,ReactDOM:!!B})})(React,ReactDOM);';
|
|
47439
47439
|
var INSIGHT_CSS = '*,:before,:after,::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #3b82f680;--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content: ""}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";line-height:1.5}body{line-height:inherit;margin:0;background-image:linear-gradient(to bottom right,var(--tw-gradient-stops));--tw-gradient-from: #f8fafc var(--tw-gradient-from-position);--tw-gradient-to: #f1f5f9 var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #fff var(--tw-gradient-via-position), var(--tw-gradient-to);--tw-text-opacity: 1;min-height:100vh;color:rgb(15 23 42 / var(--tw-text-opacity, 1));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glass-card{--tw-border-opacity: 1;border-width:1px;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1));--tw-shadow: 0 10px 40px #0f172a14;--tw-shadow-colored: 0 10px 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(8px);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:#fff9;border-radius:1rem}.col-span-2{grid-column:span 2 / span 2}.mx-auto{margin-left:auto;margin-right:auto}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.h-56{height:14rem}.h-full{height:100%}.min-h-screen{min-height:100vh}.w-full{width:100%}.min-w-\\[720px\\]{min-width:720px}.max-w-6xl{max-width:72rem}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-slate-200>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(226 232 240 / var(--tw-divide-opacity, 1))}.overflow-x-auto{overflow-x:auto}.rounded-full{border-radius:9999px}.rounded-xl{border-radius:1.25rem}.border{border-width:1px}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.bg-emerald-50{--tw-bg-opacity: 1;background-color:rgb(236 253 245 / var(--tw-bg-opacity, 1))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-white\\/70{background-color:#ffffff73}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-slate-50{--tw-gradient-from: #f8fafc var(--tw-gradient-from-position);--tw-gradient-to: #f8fafc00 var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-white{--tw-gradient-to: #ffffff00 var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #ffffff var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-slate-100{--tw-gradient-to: #f1f5f9 var(--tw-gradient-to-position)}.p-4{padding:1rem}.p-6{padding:1.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-10{padding-top:2.5rem;padding-bottom:2.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tracking-\\[0\\.2em\\]{letter-spacing:.2em}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-emerald-700{--tw-text-opacity: 1;color:rgb(4 120 87 / var(--tw-text-opacity, 1))}.text-rose-700{--tw-text-opacity: 1;color:rgb(190 18 60 / var(--tw-text-opacity, 1))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity, 1))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 #0000000d;--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-soft{--tw-shadow: 0 10px 40px #0f172a14;--tw-shadow-colored: 0 10px 40px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-slate-100{--tw-shadow-color: #f1f5f9;--tw-shadow: var(--tw-shadow-colored)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.hover\\:-translate-y-\\[1px\\]:hover{--tw-translate-y: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus-visible\\:outline:focus-visible{outline-style:solid}.focus-visible\\:outline-2:focus-visible{outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-slate-400:focus-visible{outline-color:#94a3b8}.active\\:translate-y-\\[1px\\]:active{--tw-translate-y: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\\:translate-x-0\\.5{--tw-translate-x: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@media (min-width: 768px){.md\\:mt-6{margin-top:1.5rem}.md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\\:gap-6{gap:1.5rem}.md\\:py-12{padding-top:3rem;padding-bottom:3rem}.md\\:text-4xl{font-size:2.25rem;line-height:2.5rem}}.heatmap-container{width:100%;overflow-x:auto}.heatmap-svg{min-width:720px}.heatmap-day{cursor:pointer}.heatmap-day:hover{stroke:#00000024;stroke-width:1px}.heatmap-legend{display:flex;align-items:center;gap:4px;font-size:12px;color:#64748b;margin-top:8px}.heatmap-legend-item{width:10px;height:10px;border-radius:2px}.nav-toc{display:flex;flex-wrap:wrap;gap:8px;margin:24px 0 32px;padding:16px;background:#fff;border-radius:8px;border:1px solid #e2e8f0}.nav-toc a{font-size:12px;color:#64748b;text-decoration:none;padding:6px 12px;border-radius:6px;background:#f1f5f9;transition:all .15s}.nav-toc a:hover{background:#e2e8f0;color:#334155}.at-a-glance{background:linear-gradient(135deg,#fef3c7,#fde68a);border:1px solid #f59e0b;border-radius:12px;padding:20px 24px;margin-bottom:32px}.glance-title{font-size:16px;font-weight:700;color:#92400e;margin-bottom:16px}.glance-sections{display:flex;flex-direction:column;gap:12px}.glance-section{font-size:14px;color:#78350f;line-height:1.6}.glance-section strong{color:#92400e;font-weight:700}.see-more{color:#b45309;text-decoration:none;font-size:13px;white-space:nowrap;margin-left:4px}.see-more:hover{text-decoration:underline}.project-areas{display:flex;flex-direction:column;gap:12px;margin-bottom:32px}.project-area{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:16px}.area-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.area-name{font-weight:600;font-size:15px;color:#0f172a}.area-count{font-size:12px;color:#64748b;background:#f1f5f9;padding:2px 8px;border-radius:4px}.area-desc{font-size:14px;color:#475569;line-height:1.5}.narrative{background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:20px;margin-bottom:24px}.narrative p{margin-top:0;margin-bottom:12px;font-size:14px;color:#475569;line-height:1.7}.key-insight{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:12px 16px;margin-top:12px;font-size:14px;color:#166534}.section-intro{font-size:14px;color:#64748b;margin-bottom:16px}.big-wins{display:flex;flex-direction:column;gap:12px;margin-bottom:24px}.big-win{background:#f0fdf4;border:1px solid #bbf7d0;border-radius:8px;padding:16px}.big-win-title{font-weight:600;font-size:15px;color:#166534;margin-bottom:8px}.big-win-desc{font-size:14px;color:#15803d;line-height:1.5}.friction-categories{display:flex;flex-direction:column;gap:16px;margin-bottom:24px}.friction-category{background:#fef2f2;border:1px solid #fca5a5;border-radius:8px;padding:16px}.friction-title{font-weight:600;font-size:15px;color:#991b1b;margin-bottom:6px}.friction-desc{font-size:13px;color:#7f1d1d;margin-bottom:10px}.friction-examples{margin:0 0 0 10px;padding:0;font-size:13px;color:#334155;list-style-type:disc}.friction-examples li{margin-bottom:4px}.qwen-md-section{background:#eff6ff;border:1px solid #bfdbfe;border-radius:8px;padding:12px;margin-bottom:20px}.qwen-md-section h3{font-size:13px;font-weight:600;color:#1e40af;margin:0 0 8px}.qwen-md-actions{margin-bottom:8px;padding-bottom:8px;border-bottom:1px solid #dbeafe}.copy-all-btn{background:#2563eb;color:#fff;border:none;border-radius:4px;padding:4px 10px;font-size:11px;cursor:pointer;font-weight:500;transition:all .2s}.copy-all-btn:hover{background:#1d4ed8}.copy-all-btn.copied{background:#16a34a}.qwen-md-item{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px;padding:8px 0;border-bottom:1px solid #dbeafe}.qwen-md-item:last-child{border-bottom:none}.cmd-checkbox{margin-top:2px}.cmd-code{background:#fff;padding:6px 10px;border-radius:4px;font-size:11px;color:#1e40af;border:1px solid #bfdbfe;font-family:monospace;display:block;white-space:pre-wrap;word-break:break-word;flex:1}.cmd-why{font-size:11px;color:#64748b;width:100%;padding-left:20px;margin-top:4px}.features-section,.patterns-section{display:flex;flex-direction:column;gap:12px;margin:16px 0}.feature-card{background:#f0fdf4;border:1px solid #86efac;border-radius:8px;padding:16px}.pattern-card{background:#f0f9ff;border:1px solid #7dd3fc;border-radius:8px;padding:16px}.feature-title,.pattern-title{font-weight:600;font-size:15px;color:#0f172a;margin-bottom:6px}.feature-oneliner,.pattern-summary{font-size:14px;color:#475569;margin-bottom:8px}.feature-why,.pattern-detail{font-size:13px;color:#334155;line-height:1.5}.feature-examples{margin-top:12px}.feature-example{padding:8px 0;border-top:1px solid #d1fae5}.feature-example:first-child{border-top:none}.example-code-row,.copyable-prompt-row{display:flex;align-items:flex-start;gap:8px}.example-code{flex:1;background:#f1f5f9;padding:8px 12px;border-radius:4px;font-family:monospace;font-size:12px;color:#334155;overflow-x:auto;white-space:pre-wrap}.copyable-prompt-section{margin-top:12px;padding-top:12px;border-top:1px solid #e2e8f0}.copyable-prompt{flex:1;background:#f8fafc;padding:10px 12px;border-radius:4px;font-family:monospace;font-size:12px;color:#334155;border:1px solid #e2e8f0;white-space:pre-wrap;line-height:1.5}.prompt-label{font-size:11px;font-weight:600;text-transform:uppercase;color:#64748b;margin-bottom:6px}.copy-btn{background:#e2e8f0;border:none;border-radius:4px;padding:4px 8px;font-size:11px;cursor:pointer;color:#475569;flex-shrink:0;transition:all .2s}.copy-btn:hover{background:#cbd5e1}.horizon-section{display:flex;flex-direction:column;gap:16px}.horizon-card{background:linear-gradient(135deg,#faf5ff,#f5f3ff);border:1px solid #c4b5fd;border-radius:8px;padding:16px}.horizon-title{font-weight:600;font-size:15px;color:#5b21b6;margin-bottom:8px}.horizon-possible{font-size:14px;color:#334155;margin-bottom:10px;line-height:1.5}.horizon-tip{font-size:13px;color:#6b21a8;background:#fff9;padding:8px 12px;border-radius:4px}.pattern-prompt{background:#f8fafc;padding:12px;border-radius:6px;margin-top:12px;border:1px solid #e2e8f0;display:flex;flex-direction:column;gap:8px}.pattern-prompt code{font-family:monospace;font-size:12px;color:#334155;display:block;white-space:pre-wrap}.fun-ending{background:linear-gradient(135deg,#fef3c7,#fde68a);border:1px solid #fbbf24;border-radius:12px;padding:24px;margin-top:40px;text-align:center}.fun-headline{font-size:18px;font-weight:600;color:#78350f;margin-bottom:8px}.fun-detail{font-size:14px;color:#92400e}.stats-row{display:flex;gap:24px;margin-bottom:40px;padding:20px 0;border-top:1px solid #e2e8f0;border-bottom:1px solid #e2e8f0;flex-wrap:wrap}.stat{text-align:center}.stat-value{font-size:24px;font-weight:700;color:#0f172a}.stat-label{font-size:11px;color:#64748b;text-transform:uppercase}@media (max-width: 640px){.stats-row{justify-content:center}}.header-with-action{position:relative}.insights-header{margin-bottom:2rem;padding:1.5rem 0;border-bottom:1px solid #e2e8f0}.header-content{display:flex;justify-content:space-between;align-items:center;gap:1.5rem;flex-wrap:wrap}.header-title-section{flex:1;min-width:0}.header-title{font-size:1.75rem;font-weight:700;color:#0f172a;letter-spacing:-.02em;margin:0 0 .375rem;line-height:1.2}.header-subtitle{font-size:.875rem;color:#64748b;margin:0;font-weight:400}.export-dropdown-wrapper{position:relative}.export-card-btn{display:inline-flex;align-items:center;gap:.5rem;height:36px;padding:0 .875rem;border:1px solid #e2e8f0;border-radius:8px;background:#fff;color:#334155;font-size:.8125rem;font-weight:500;cursor:pointer;transition:all .15s ease}.export-card-btn:hover{background:#f8fafc;border-color:#cbd5e1}.export-card-btn:active{background:#f1f5f9}.export-chevron{transition:transform .15s ease;opacity:.5}.export-chevron.open{transform:rotate(180deg)}.export-dropdown{position:absolute;top:calc(100% + 4px);right:0;min-width:160px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 4px 16px #00000014;padding:4px;z-index:50}.export-dropdown-item{display:flex;align-items:center;gap:.5rem;width:100%;padding:.5rem .75rem;border:none;border-radius:6px;background:none;color:#334155;font-size:.8125rem;font-weight:400;cursor:pointer;transition:background .1s ease}.export-dropdown-item:hover{background:#f1f5f9}.export-dropdown-item:active{background:#e2e8f0}@media (max-width: 640px){.header-content{flex-direction:column;align-items:flex-start;gap:1rem}.header-title{font-size:1.5rem}}';
|
|
47440
47440
|
|
|
47441
47441
|
// packages/web-templates/src/generated/exportHtmlTemplate.ts
|
|
47442
47442
|
init_esbuild_shims();
|
|
47443
|
-
var HTML_TEMPLATE = '<!doctype html>\n<html lang="en" class="dark">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <link\n rel="icon"\n type="image/svg+xml"\n href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20141.38%20140%22%3E%0A%20%20%3Cpath%0A%20%20%20%20fill%3D%22%23000000%22%0A%20%20%20%20d%3D%22m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z%22%0A%20%20%2F%3E%0A%3C%2Fsvg%3E"\n />\n <script\n crossorigin\n src="https://unpkg.com/react@18.2.0/umd/react.production.min.js"\n ></script>\n <script\n crossorigin\n src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"\n ></script>\n <script>\n const withKey = (props, key) =>\n key == null ? props : Object.assign({}, props, { key });\n const jsx = (type, props, key) =>\n React.createElement(type, withKey(props, key));\n const jsxRuntime = {\n Fragment: React.Fragment,\n jsx,\n jsxs: jsx,\n jsxDEV: jsx,\n };\n window.ReactJSXRuntime = jsxRuntime;\n window[\'react/jsx-runtime\'] = jsxRuntime;\n window[\'react/jsx-dev-runtime\'] = jsxRuntime;\n </script>\n <script src="https://unpkg.com/@qwen-code/webui@latest/dist/index.umd.js"></script>\n <link\n rel="stylesheet"\n href="https://unpkg.com/@qwen-code/webui@latest/dist/styles.css"\n />\n <title>Qwen Code Chat Export</title>\n <script>\n // Pre-hydrate FOUC guard: must run before <style> below applies layout.\n // The storage key \'sara-export-theme\' is duplicated here verbatim and\n // MUST stay in sync with EXPORT_THEME_STORAGE_KEY in\n // src/components/useExportTheme.ts.\n (function () {\n try {\n var stored = window.localStorage.getItem(\'sara-export-theme\');\n var theme = stored === \'light\' || stored === \'dark\' ? stored : \'dark\';\n var root = document.documentElement;\n // Toggle-style writes mirror the React hook\'s effect, so the two\n // code paths converge on identical class state.\n root.classList.toggle(\'light\', theme === \'light\');\n root.classList.toggle(\'dark\', theme === \'dark\');\n } catch (e) {\n // localStorage may be unavailable (private mode, file:// sandbox);\n // the static class="dark" attribute on <html> remains the default.\n }\n })();\n </script>\n <style>\n @font-face {\n font-family: "Press Start 2P";\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url("data:font/woff2;base64,d09GMgABAAAAAALQAAwAAAAABfwAAAKBAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCgGYABUEQgKgkSCDAsOAAE2AiQDDgQgBYRKByAb4QTIBB76Oev9JKW02x5ClpELSxHm1M0JQ+OBJAtDpAAVUQ7i///V+A/YgLVswlGo/7a+lmW3sfnUvoBFcUKzUFEnKo08S0F2T8TiAAJQieDvSGUVdW3smBv2LuCGjSpG3jQTD/m9OI5lTDomdQG1hkoMkCJu1ZYsmL42dEu7W8q5gUan/J6yyO+FX5NO5qQPxaqGnEINZ2q7kDf0+i4UigAXdiQUNMppoJnOzcxnDMwX5lXzinnJPDtkzhQFwjTx0DGrx1zkoNhIYr5LTKHjclcs+z3Frrh2ue3Kvk6bxzoRJLsIQpWcQhW27bgJwoUHYXNi2WWnVRUWaVNS0XMJ1eIUHlSX0l3l7BZOOos1ySk7NUWl6+eobG3Nfpj96g8EvukB3Qjouo4+O6svG9/0b8ZyKmfoZj9gzBqq8I2MS7Pf2JquL9vZwHJ51djyD01vbVHRDxSslvFBZwMHjQvexMxIvz3oyftul2+k9yBS+xGM+l+d+Pvo/zH5fVXMRvsHhG4u9/dRsgQyF67l9+jYgZuy+Ath2O6EUzU7E6BxF41nQk2cgkN8IIlOPKecMgWccSrE4XdaOECf00oUaeTm34EpvHhZIodEEllllBWmWcJLyQmsPjNHAousMEkijVRQR5OgNc4qq7TiZZg89pJCE/G0MM4kPuYqqIOKrQw3WmQBjVQSSLLm1H1NiGmCN21uwK/JpZRuWignd/klmbWXFEtZZIn1o8cmkaDqX5JIJgWNNqYYR9s0GsRFZhhntKJSjI+KTaFDZ+MoRllkjHWK2ADCxilLQGTkJZo4NAJMDwhAiK0CJD+jjKFRwWBapYFh5rdzfogQC/m1XLplXiEFEwAA") format("woff2");\n }\n :root{--bg-primary: #18181b;--bg-secondary: #27272a;--text-primary: #f4f4f5;--text-secondary: #a1a1aa;--border-color: #3f3f46;--accent-color: #3b82f6;--header-bg: rgba(24, 24, 27, .95);--scrollbar-thumb-hover: #52525b}:root.light{--bg-primary: #ffffff;--bg-secondary: #f3f4f6;--text-primary: #1f2937;--text-secondary: #6b7280;--border-color: #e5e7eb;--accent-color: #2563eb;--header-bg: rgba(249, 250, 251, .95);--scrollbar-thumb-hover: #d1d5db;--app-primary-foreground: #1f2937;--app-secondary-foreground: #6b7280;--app-background: #ffffff;--app-primary-background: #ffffff;--app-background-secondary: #f3f4f6;--app-background-tertiary: #e5e7eb;--app-foreground: #1f2937;--app-foreground-secondary: #6b7280;--app-foreground-muted: #9ca3af;--app-border: #e5e7eb;--app-primary-border-color: #e5e7eb;--app-input-background: #ffffff;--app-input-border: #d1d5db;--app-input-placeholder-foreground: #9ca3af;--app-ghost-button-hover-background: rgba(0, 0, 0, .05);--app-header-background: #f9fafb;--app-list-hover-background: rgba(0, 0, 0, .05);--app-list-active-background: #3b82f6;--app-menu-background: #ffffff;--app-menu-border: #e5e7eb;--app-menu-foreground: #1f2937;--app-tool-background: #ffffff;--app-code-background: #f3f4f6;--app-secondary-background: #f3f4f6;--app-input-secondary-background: #f3f4f6;--app-input-foreground: #1f2937;--app-button-background: #e5e7eb;--app-button-secondary-background: #f3f4f6;--app-button-foreground: #1f2937;--app-transparent-inner-border: rgba(0, 0, 0, .1);--app-warning-foreground: #b45309}body{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;margin:0;padding:0;background-color:var(--bg-primary);color:var(--text-primary);line-height:1.6;-webkit-font-smoothing:antialiased}.page-wrapper{min-height:100vh;display:flex;flex-direction:column;align-items:center}.header{width:100%;padding:16px 24px;border-bottom:1px solid var(--border-color);background-color:var(--header-bg);backdrop-filter:blur(8px);position:sticky;top:0;z-index:100;display:flex;justify-content:space-between;align-items:center;box-sizing:border-box}.header-left{display:flex;align-items:center;gap:12px}.header-right{display:flex;align-items:center;gap:8px}.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;background:transparent;border:1px solid var(--border-color);border-radius:999px;color:var(--text-secondary);cursor:pointer;transition:background-color .15s ease,color .15s ease,border-color .15s ease}.theme-toggle:hover{background-color:var(--bg-secondary);color:var(--text-primary)}.theme-toggle:focus-visible{outline:2px solid var(--accent-color);outline-offset:2px}.theme-toggle:active{transform:scale(.95)}.logo-icon{width:24px;height:24px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.logo-icon svg{width:100%;height:100%}.logo{display:flex;flex-direction:column;line-height:1}.logo-text{font-family:"Press Start 2P",cursive;font-weight:400;font-size:24px;letter-spacing:-.05em;position:relative;color:#fff}.logo-text-inner{background:linear-gradient(to right,#60a5fa,#a855f7);-webkit-background-clip:text;-webkit-text-fill-color:transparent;position:relative;z-index:2}.logo-text:before,.logo-text:after{content:attr(data-text);position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background:none;-webkit-text-fill-color:transparent;-webkit-text-stroke:1px rgba(96,165,250,.3)}.logo-text:before{transform:translate(2px,2px);-webkit-text-stroke:1px rgba(168,85,247,.3)}.logo-text:after{transform:translate(4px,4px);opacity:.4}.logo-sub{font-size:11px;font-weight:600;color:var(--text-secondary);letter-spacing:.05em;text-transform:uppercase;margin-top:4px}.badge{font-size:11px;padding:2px 8px;border-radius:999px;background-color:var(--bg-secondary);color:var(--text-secondary);border:1px solid var(--border-color);font-weight:500}.meta{display:flex;gap:24px;font-size:13px;color:var(--text-secondary)}.meta-item{display:flex;align-items:center;gap:8px}.meta-label{color:var(--text-secondary)}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:var(--bg-primary)}::-webkit-scrollbar-thumb{background:var(--bg-secondary);border-radius:5px;border:2px solid var(--bg-primary)}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}@media(max-width:768px){.chat-container{max-width:100%;padding:20px 16px}.header{padding:12px 16px}.meta{width:100%;flex-direction:column;gap:6px}}@media(max-width:480px){.chat-container{padding:16px 12px}}.content-wrapper{display:flex;width:100%;max-width:1600px;height:calc(100vh - 73px)}.chat-container{flex:1;min-width:0;overflow-y:auto;padding:24px;box-sizing:border-box}.metadata-sidebar{width:320px;min-width:320px;padding:12px;border-right:1px solid var(--border-color);background-color:var(--bg-secondary);display:flex;flex-direction:column;gap:12px;overflow-y:auto;height:100%;box-sizing:border-box}.metadata-section{display:flex;flex-direction:column;gap:8px}.metadata-section-title{font-size:10px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.05em;margin:0;padding-bottom:4px;border-bottom:1px solid var(--border-color)}.metadata-section-small{margin-top:auto;padding-top:12px;border-top:1px solid var(--border-color)}.metadata-item{display:flex;flex-direction:column;gap:2px}.metadata-item-empty{font-size:12px;color:var(--text-secondary);margin:0;padding:4px 0}.metadata-content{display:flex;flex-direction:column;gap:2px;min-width:0}.metadata-content .metadata-label{font-size:10px;color:var(--text-secondary)}.metadata-content .metadata-value{font-size:12px;color:var(--text-primary);word-break:break-all;line-height:1.3;cursor:pointer}.metadata-content .metadata-value.multiline{white-space:pre-wrap}.metadata-content .metadata-value.text-green{color:#22c55e}.metadata-content .metadata-value.text-red{color:#ef4444}.metadata-value-with-copy{display:flex;align-items:center;gap:8px}.metadata-value-with-copy .metadata-value{flex:1;min-width:0}.copy-button{display:inline-flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:1px solid var(--border-color, #3f3f46);border-radius:4px;color:var(--text-secondary, #a1a1aa);cursor:pointer;transition:all .15s ease;flex-shrink:0}.copy-button:hover{background:var(--bg-hover, #27272a);color:var(--text-primary, #f4f4f5);border-color:var(--border-hover, #52525b)}.copy-button:active{transform:scale(.95)}@media(max-width:1024px){.metadata-sidebar{width:320px;min-width:320px;padding:10px}}@media(max-width:768px){.content-wrapper{flex-direction:column;height:auto}.chat-container{height:auto;min-height:50vh}.metadata-sidebar{width:100%;min-width:100%;height:auto;max-height:none;border-right:none;border-top:1px solid var(--border-color);padding:12px;gap:12px}.metadata-section{flex-direction:row;flex-wrap:wrap;gap:12px}.metadata-section-title{width:100%;border-bottom:none;padding-bottom:0}.metadata-item{flex:1;min-width:140px}.metadata-section-small{margin-top:0;padding-top:0;border-top:none}}.modal-overlay{position:fixed;inset:0;z-index:1000;background-color:#0009;display:flex;align-items:center;justify-content:center;padding:24px}.modal-container{background-color:var(--bg-secondary);border:1px solid var(--border-color);border-radius:12px;width:100%;max-width:800px;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 25px 50px -12px #00000080}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border-color);flex-shrink:0}.modal-title{font-size:13px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal-close{background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:16px;padding:4px 8px;border-radius:6px;line-height:1;transition:background-color .15s,color .15s}.modal-close:hover{background-color:var(--border-color);color:var(--text-primary)}.modal-content{margin:0;padding:16px;overflow:auto;font-size:13px;line-height:1.6;color:var(--text-primary);white-space:pre-wrap;word-break:break-word}\n </style>\n </head>\n <body>\n <div id="app"></div>\n\n <script id="chat-data" type="application/json"></script>\n <script>\n (()=>{var f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 141.38 140">\n <path\n fill="#000000"\n d="m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"\n />\n</svg>\n`;var l=window.React,h=({state:e,onClose:t})=>(l.useEffect(()=>{if(e.visible){let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o}}},[e.visible]),e.visible?l.createElement("div",{className:"modal-overlay",onClick:t},l.createElement("div",{className:"modal-container",onClick:o=>o.stopPropagation()},l.createElement("div",{className:"modal-header"},l.createElement("span",{className:"modal-title font-mono"},e.fileName),l.createElement("button",{className:"modal-close",onClick:t,"aria-label":"Close"},"\\u2715")),l.createElement("pre",{className:"modal-content"},e.content))):null),x=()=>{let[e,t]=l.useState({visible:!1,content:"",fileName:""}),o=l.useCallback((n,p="temp")=>{t({visible:!0,content:n,fileName:p})},[]),i=l.useCallback(()=>{t(n=>({...n,visible:!1}))},[]);return{modalState:e,openModal:o,closeModal:i}};var z=window.React,b=()=>{let{modalState:e,openModal:t,closeModal:o}=x();return{platformContext:z.useMemo(()=>({platform:"web",postMessage:n=>{console.log("Posted message:",n)},onMessage:n=>(window.addEventListener("message",n),()=>window.removeEventListener("message",n)),openFile:n=>{console.log("Opening file:",n)},openTempFile:t,getResourceUrl:()=>{},features:{canOpenFile:!1,canOpenTempFile:!0,canCopy:!0}}),[t]),modalState:e,closeModal:o}};var a=({label:e,value:t,valueClass:o})=>t==null||t===""?null:React.createElement("div",{className:"metadata-item"},React.createElement("div",{className:"metadata-content"},React.createElement("span",{className:"metadata-label"},e),React.createElement("span",{className:`metadata-value ${o||""}`,title:typeof t=="string"?t:void 0},t)));var v=e=>!!e&&typeof e=="object",w=()=>{let e=document.getElementById("chat-data");if(!(e!=null&&e.textContent))return{};try{let t=JSON.parse(e.textContent);return t&&typeof t=="object"?t:{}}catch(t){return console.error("Failed to parse chat data.",t),{}}};var y=e=>{if(!e)return"-";try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}},k=e=>{if(!e)return"-";try{let o=new Date(e).getTime();if(Number.isNaN(o))return"-";let n=Math.max(0,new Date().getTime()-o),p=Math.floor(n/1e3),c=Math.floor(p/60),d=Math.floor(c/60),s=Math.floor(d/24),m=Math.floor(s/7),g=Math.floor(s/30),u=Math.floor(s/365);return p<60?"just now":c<60?`${c} minute${c===1?"":"s"} ago`:d<24?`${d} hour${d===1?"":"s"} ago`:s<7?`${s} day${s===1?"":"s"} ago`:m<4?`${m} week${m===1?"":"s"} ago`:g<12?`${g} month${g===1?"":"s"} ago`:`${u} year${u===1?"":"s"} ago`}catch(t){return"-"}};var M=e=>{if(e!=null)return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}k`:e.toString()};var T=({metadata:e})=>React.createElement("aside",{className:"metadata-sidebar"},React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"Session Info"),React.createElement(a,{label:"Session created",value:k(e.startTime)}),React.createElement(a,{label:"Project",value:e.cwd,valueClass:"multiline"}),e.gitRepo&&React.createElement(a,{label:"Repository",value:e.gitRepo}),e.gitBranch&&React.createElement(a,{label:"Branch",value:e.gitBranch}),e.model&&React.createElement(a,{label:"Model",value:e.model}),e.channel&&React.createElement(a,{label:"Channel",value:e.channel})),React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"Statistics"),React.createElement(a,{label:"Prompts",value:e.promptCount}),e.contextUsagePercent!==void 0&&e.contextWindowSize!==void 0&&React.createElement(a,{label:"Context",value:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}% of ${M(e.contextWindowSize)}`,valueClass:e.contextUsagePercent>100?"text-red":void 0}),e.totalTokens!==void 0&&React.createElement(a,{label:"Tokens",value:e.totalTokens.toLocaleString()})),React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"File Operations"),e.filesWritten!==void 0&&e.filesWritten>0&&React.createElement(a,{label:"Files modified",value:e.filesWritten}),e.linesAdded!==void 0&&e.linesAdded>0&&React.createElement(a,{label:"Added",value:`+${e.linesAdded}`,valueClass:"text-green"}),e.linesRemoved!==void 0&&e.linesRemoved>0&&React.createElement(a,{label:"Removed",value:`-${e.linesRemoved}`,valueClass:"text-red"}),(e.filesWritten===void 0||e.filesWritten===0)&&(e.linesAdded===void 0||e.linesAdded===0)&&(e.linesRemoved===void 0||e.linesRemoved===0)&&React.createElement("p",{className:"metadata-item metadata-item-empty"},"No file changes")),React.createElement("div",{className:"metadata-section metadata-section-small"},React.createElement(a,{label:"Session ID",value:e.sessionId,valueClass:"font-mono"}),React.createElement(a,{label:"Export Time",value:y(e.exportTime)})));var $=()=>React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},React.createElement("circle",{cx:"12",cy:"12",r:"4"}),React.createElement("path",{d:"M12 2v2"}),React.createElement("path",{d:"M12 20v2"}),React.createElement("path",{d:"m4.93 4.93 1.41 1.41"}),React.createElement("path",{d:"m17.66 17.66 1.41 1.41"}),React.createElement("path",{d:"M2 12h2"}),React.createElement("path",{d:"M20 12h2"}),React.createElement("path",{d:"m6.34 17.66-1.41 1.41"}),React.createElement("path",{d:"m19.07 4.93-1.41 1.41"})),D=()=>React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},React.createElement("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})),C=({theme:e,onToggle:t})=>{let o=e==="light",i=o?"Switch to dark theme":"Switch to light theme";return React.createElement("button",{type:"button",className:"theme-toggle","aria-label":i,"aria-pressed":o,title:i,onClick:t},React.createElement(o?D:$,null))};var L=window.React,{useCallback:j,useEffect:I,useState:W}=L,N="sara-export-theme",R=e=>e==="light"||e==="dark",F=()=>{try{let e=window.localStorage.getItem(N);if(R(e))return e}catch(e){}return"dark"},O=e=>{let t=document.documentElement;t.classList.toggle("light",e==="light"),t.classList.toggle("dark",e==="dark")},S=()=>{let[e,t]=W(F);I(()=>{O(e);try{window.localStorage.setItem(N,e)}catch(i){}},[e]);let o=j(()=>{t(i=>i==="light"?"dark":"light")},[]);return{theme:e,toggleTheme:o}};var A=window.ReactDOM,r=window.React,{ChatViewer:U,PlatformProvider:V}=QwenCodeWebUI,B=f?f.replace(/<svg([^>]*)>/,\'<svg$1><defs><linearGradient id="sara-logo-gradient" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" stop-color="#60a5fa" /><stop offset="100%" stop-color="#a855f7" /></linearGradient></defs>\').replace(/fill="[^"]*"/,\'fill="url(#qwen-logo-gradient)"\'):f,H=()=>{let e=w(),o=(Array.isArray(e.messages)?e.messages:[]).filter(v).filter(m=>m.type!=="system"),i=e.metadata,{platformContext:n,modalState:p,closeModal:c}=b(),{theme:d,toggleTheme:s}=S();return r.createElement("div",{className:"page-wrapper"},r.createElement("header",{className:"header"},r.createElement("div",{className:"header-left"},r.createElement("div",{className:"logo-icon","aria-hidden":"true",dangerouslySetInnerHTML:{__html:B}}),r.createElement("div",{className:"logo"},r.createElement("div",{className:"logo-text","data-text":"QWEN"},r.createElement("span",{className:"logo-text-inner"},"QWEN")))),r.createElement("div",{className:"header-right"},r.createElement(C,{theme:d,onToggle:s}))),r.createElement("div",{className:"content-wrapper"},r.createElement("div",{className:"chat-container"},r.createElement(V,{value:n},r.createElement(U,{messages:o,autoScroll:!1,theme:d}))),i&&r.createElement(T,{metadata:i})),r.createElement(h,{state:p,onClose:c}))},E=document.getElementById("app");E?A.createRoot(E).render(r.createElement(H,null)):console.error("App container not found.");})();;\n </script>\n </body>\n</html>\n';
|
|
47443
|
+
var HTML_TEMPLATE = '<!doctype html>\n<html lang="en" class="dark">\n <head>\n <meta charset="UTF-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1.0" />\n <link\n rel="icon"\n type="image/svg+xml"\n href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20141.38%20140%22%3E%0A%20%20%3Cpath%0A%20%20%20%20fill%3D%22%23000000%22%0A%20%20%20%20d%3D%22m140.93%2085-16.35-28.33-1.93-3.34%208.66-15a3.323%203.323%200%200%200%200-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33%203.33%200%200%200-2.89-1.67H51.43c-.59%200-1.17.16-1.66.45-.5.29-.92.71-1.22%201.22L32.19%2029.98l-1.92%203.33H12.96c-.59%200-1.17.16-1.66.45-.5.29-.93.71-1.22%201.22L.45%2051.66a3.323%203.323%200%200%200%200%203.34l18.28%2031.67-8.66%2015a3.32%203.32%200%200%200%200%203.34l9.62%2016.67c.3.51.72.93%201.22%201.22s1.07.45%201.67.45h36.56l8.66%2015a3.35%203.35%200%200%200%202.89%201.67h19.25a3.34%203.34%200%200%200%202.89-1.67l18.28-31.67h17.32c.6%200%201.17-.16%201.67-.45s.92-.71%201.22-1.22l9.62-16.67a3.323%203.323%200%200%200%200-3.34ZM51.44%203.33%2061.07%2020l-9.63%2016.66h76.98l-9.62%2016.66H45.67l-11.54-20zM57.21%20120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62%2016.67L68.78%20100l-11.55%2020Zm61.59-33.34-9.62-16.67-38.49%2066.67-9.63-16.67%209.63-16.66%2026.94-46.67h23.1l17.32%2030z%22%0A%20%20%2F%3E%0A%3C%2Fsvg%3E"\n />\n <script\n crossorigin\n src="https://unpkg.com/react@18.2.0/umd/react.production.min.js"\n ></script>\n <script\n crossorigin\n src="https://unpkg.com/react-dom@18.2.0/umd/react-dom.production.min.js"\n ></script>\n <script>\n const withKey = (props, key) =>\n key == null ? props : Object.assign({}, props, { key });\n const jsx = (type, props, key) =>\n React.createElement(type, withKey(props, key));\n const jsxRuntime = {\n Fragment: React.Fragment,\n jsx,\n jsxs: jsx,\n jsxDEV: jsx,\n };\n window.ReactJSXRuntime = jsxRuntime;\n window[\'react/jsx-runtime\'] = jsxRuntime;\n window[\'react/jsx-dev-runtime\'] = jsxRuntime;\n </script>\n <script src="https://unpkg.com/@qwen-code/webui@latest/dist/index.umd.js"></script>\n <link\n rel="stylesheet"\n href="https://unpkg.com/@qwen-code/webui@latest/dist/styles.css"\n />\n <title>Qwen Code Chat Export</title>\n <script>\n // Pre-hydrate FOUC guard: must run before <style> below applies layout.\n // The storage key \'qwen-export-theme\' is duplicated here verbatim and\n // MUST stay in sync with EXPORT_THEME_STORAGE_KEY in\n // src/components/useExportTheme.ts.\n (function () {\n try {\n var stored = window.localStorage.getItem(\'qwen-export-theme\');\n var theme = stored === \'light\' || stored === \'dark\' ? stored : \'dark\';\n var root = document.documentElement;\n // Toggle-style writes mirror the React hook\'s effect, so the two\n // code paths converge on identical class state.\n root.classList.toggle(\'light\', theme === \'light\');\n root.classList.toggle(\'dark\', theme === \'dark\');\n } catch (e) {\n // localStorage may be unavailable (private mode, file:// sandbox);\n // the static class="dark" attribute on <html> remains the default.\n }\n })();\n </script>\n <style>\n @font-face {\n font-family: "Press Start 2P";\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url("data:font/woff2;base64,d09GMgABAAAAAALQAAwAAAAABfwAAAKBAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHCgGYABUEQgKgkSCDAsOAAE2AiQDDgQgBYRKByAb4QTIBB76Oev9JKW02x5ClpELSxHm1M0JQ+OBJAtDpAAVUQ7i///V+A/YgLVswlGo/7a+lmW3sfnUvoBFcUKzUFEnKo08S0F2T8TiAAJQieDvSGUVdW3smBv2LuCGjSpG3jQTD/m9OI5lTDomdQG1hkoMkCJu1ZYsmL42dEu7W8q5gUan/J6yyO+FX5NO5qQPxaqGnEINZ2q7kDf0+i4UigAXdiQUNMppoJnOzcxnDMwX5lXzinnJPDtkzhQFwjTx0DGrx1zkoNhIYr5LTKHjclcs+z3Frrh2ue3Kvk6bxzoRJLsIQpWcQhW27bgJwoUHYXNi2WWnVRUWaVNS0XMJ1eIUHlSX0l3l7BZOOos1ySk7NUWl6+eobG3Nfpj96g8EvukB3Qjouo4+O6svG9/0b8ZyKmfoZj9gzBqq8I2MS7Pf2JquL9vZwHJ51djyD01vbVHRDxSslvFBZwMHjQvexMxIvz3oyftul2+k9yBS+xGM+l+d+Pvo/zH5fVXMRvsHhG4u9/dRsgQyF67l9+jYgZuy+Ath2O6EUzU7E6BxF41nQk2cgkN8IIlOPKecMgWccSrE4XdaOECf00oUaeTm34EpvHhZIodEEllllBWmWcJLyQmsPjNHAousMEkijVRQR5OgNc4qq7TiZZg89pJCE/G0MM4kPuYqqIOKrQw3WmQBjVQSSLLm1H1NiGmCN21uwK/JpZRuWignd/klmbWXFEtZZIn1o8cmkaDqX5JIJgWNNqYYR9s0GsRFZhhntKJSjI+KTaFDZ+MoRllkjHWK2ADCxilLQGTkJZo4NAJMDwhAiK0CJD+jjKFRwWBapYFh5rdzfogQC/m1XLplXiEFEwAA") format("woff2");\n }\n :root{--bg-primary: #18181b;--bg-secondary: #27272a;--text-primary: #f4f4f5;--text-secondary: #a1a1aa;--border-color: #3f3f46;--accent-color: #3b82f6;--header-bg: rgba(24, 24, 27, .95);--scrollbar-thumb-hover: #52525b}:root.light{--bg-primary: #ffffff;--bg-secondary: #f3f4f6;--text-primary: #1f2937;--text-secondary: #6b7280;--border-color: #e5e7eb;--accent-color: #2563eb;--header-bg: rgba(249, 250, 251, .95);--scrollbar-thumb-hover: #d1d5db;--app-primary-foreground: #1f2937;--app-secondary-foreground: #6b7280;--app-background: #ffffff;--app-primary-background: #ffffff;--app-background-secondary: #f3f4f6;--app-background-tertiary: #e5e7eb;--app-foreground: #1f2937;--app-foreground-secondary: #6b7280;--app-foreground-muted: #9ca3af;--app-border: #e5e7eb;--app-primary-border-color: #e5e7eb;--app-input-background: #ffffff;--app-input-border: #d1d5db;--app-input-placeholder-foreground: #9ca3af;--app-ghost-button-hover-background: rgba(0, 0, 0, .05);--app-header-background: #f9fafb;--app-list-hover-background: rgba(0, 0, 0, .05);--app-list-active-background: #3b82f6;--app-menu-background: #ffffff;--app-menu-border: #e5e7eb;--app-menu-foreground: #1f2937;--app-tool-background: #ffffff;--app-code-background: #f3f4f6;--app-secondary-background: #f3f4f6;--app-input-secondary-background: #f3f4f6;--app-input-foreground: #1f2937;--app-button-background: #e5e7eb;--app-button-secondary-background: #f3f4f6;--app-button-foreground: #1f2937;--app-transparent-inner-border: rgba(0, 0, 0, .1);--app-warning-foreground: #b45309}body{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;margin:0;padding:0;background-color:var(--bg-primary);color:var(--text-primary);line-height:1.6;-webkit-font-smoothing:antialiased}.page-wrapper{min-height:100vh;display:flex;flex-direction:column;align-items:center}.header{width:100%;padding:16px 24px;border-bottom:1px solid var(--border-color);background-color:var(--header-bg);backdrop-filter:blur(8px);position:sticky;top:0;z-index:100;display:flex;justify-content:space-between;align-items:center;box-sizing:border-box}.header-left{display:flex;align-items:center;gap:12px}.header-right{display:flex;align-items:center;gap:8px}.theme-toggle{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;background:transparent;border:1px solid var(--border-color);border-radius:999px;color:var(--text-secondary);cursor:pointer;transition:background-color .15s ease,color .15s ease,border-color .15s ease}.theme-toggle:hover{background-color:var(--bg-secondary);color:var(--text-primary)}.theme-toggle:focus-visible{outline:2px solid var(--accent-color);outline-offset:2px}.theme-toggle:active{transform:scale(.95)}.logo-icon{width:24px;height:24px;flex-shrink:0;display:flex;align-items:center;justify-content:center}.logo-icon svg{width:100%;height:100%}.logo{display:flex;flex-direction:column;line-height:1}.logo-text{font-family:"Press Start 2P",cursive;font-weight:400;font-size:24px;letter-spacing:-.05em;position:relative;color:#fff}.logo-text-inner{background:linear-gradient(to right,#60a5fa,#a855f7);-webkit-background-clip:text;-webkit-text-fill-color:transparent;position:relative;z-index:2}.logo-text:before,.logo-text:after{content:attr(data-text);position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;background:none;-webkit-text-fill-color:transparent;-webkit-text-stroke:1px rgba(96,165,250,.3)}.logo-text:before{transform:translate(2px,2px);-webkit-text-stroke:1px rgba(168,85,247,.3)}.logo-text:after{transform:translate(4px,4px);opacity:.4}.logo-sub{font-size:11px;font-weight:600;color:var(--text-secondary);letter-spacing:.05em;text-transform:uppercase;margin-top:4px}.badge{font-size:11px;padding:2px 8px;border-radius:999px;background-color:var(--bg-secondary);color:var(--text-secondary);border:1px solid var(--border-color);font-weight:500}.meta{display:flex;gap:24px;font-size:13px;color:var(--text-secondary)}.meta-item{display:flex;align-items:center;gap:8px}.meta-label{color:var(--text-secondary)}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:var(--bg-primary)}::-webkit-scrollbar-thumb{background:var(--bg-secondary);border-radius:5px;border:2px solid var(--bg-primary)}::-webkit-scrollbar-thumb:hover{background:var(--scrollbar-thumb-hover)}@media(max-width:768px){.chat-container{max-width:100%;padding:20px 16px}.header{padding:12px 16px}.meta{width:100%;flex-direction:column;gap:6px}}@media(max-width:480px){.chat-container{padding:16px 12px}}.content-wrapper{display:flex;width:100%;max-width:1600px;height:calc(100vh - 73px)}.chat-container{flex:1;min-width:0;overflow-y:auto;padding:24px;box-sizing:border-box}.metadata-sidebar{width:320px;min-width:320px;padding:12px;border-right:1px solid var(--border-color);background-color:var(--bg-secondary);display:flex;flex-direction:column;gap:12px;overflow-y:auto;height:100%;box-sizing:border-box}.metadata-section{display:flex;flex-direction:column;gap:8px}.metadata-section-title{font-size:10px;font-weight:600;color:var(--text-secondary);text-transform:uppercase;letter-spacing:.05em;margin:0;padding-bottom:4px;border-bottom:1px solid var(--border-color)}.metadata-section-small{margin-top:auto;padding-top:12px;border-top:1px solid var(--border-color)}.metadata-item{display:flex;flex-direction:column;gap:2px}.metadata-item-empty{font-size:12px;color:var(--text-secondary);margin:0;padding:4px 0}.metadata-content{display:flex;flex-direction:column;gap:2px;min-width:0}.metadata-content .metadata-label{font-size:10px;color:var(--text-secondary)}.metadata-content .metadata-value{font-size:12px;color:var(--text-primary);word-break:break-all;line-height:1.3;cursor:pointer}.metadata-content .metadata-value.multiline{white-space:pre-wrap}.metadata-content .metadata-value.text-green{color:#22c55e}.metadata-content .metadata-value.text-red{color:#ef4444}.metadata-value-with-copy{display:flex;align-items:center;gap:8px}.metadata-value-with-copy .metadata-value{flex:1;min-width:0}.copy-button{display:inline-flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:1px solid var(--border-color, #3f3f46);border-radius:4px;color:var(--text-secondary, #a1a1aa);cursor:pointer;transition:all .15s ease;flex-shrink:0}.copy-button:hover{background:var(--bg-hover, #27272a);color:var(--text-primary, #f4f4f5);border-color:var(--border-hover, #52525b)}.copy-button:active{transform:scale(.95)}@media(max-width:1024px){.metadata-sidebar{width:320px;min-width:320px;padding:10px}}@media(max-width:768px){.content-wrapper{flex-direction:column;height:auto}.chat-container{height:auto;min-height:50vh}.metadata-sidebar{width:100%;min-width:100%;height:auto;max-height:none;border-right:none;border-top:1px solid var(--border-color);padding:12px;gap:12px}.metadata-section{flex-direction:row;flex-wrap:wrap;gap:12px}.metadata-section-title{width:100%;border-bottom:none;padding-bottom:0}.metadata-item{flex:1;min-width:140px}.metadata-section-small{margin-top:0;padding-top:0;border-top:none}}.modal-overlay{position:fixed;inset:0;z-index:1000;background-color:#0009;display:flex;align-items:center;justify-content:center;padding:24px}.modal-container{background-color:var(--bg-secondary);border:1px solid var(--border-color);border-radius:12px;width:100%;max-width:800px;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 25px 50px -12px #00000080}.modal-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--border-color);flex-shrink:0}.modal-title{font-size:13px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.modal-close{background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:16px;padding:4px 8px;border-radius:6px;line-height:1;transition:background-color .15s,color .15s}.modal-close:hover{background-color:var(--border-color);color:var(--text-primary)}.modal-content{margin:0;padding:16px;overflow:auto;font-size:13px;line-height:1.6;color:var(--text-primary);white-space:pre-wrap;word-break:break-word}\n </style>\n </head>\n <body>\n <div id="app"></div>\n\n <script id="chat-data" type="application/json"></script>\n <script>\n (()=>{var f=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 141.38 140">\n <path\n fill="#000000"\n d="m140.93 85-16.35-28.33-1.93-3.34 8.66-15a3.323 3.323 0 0 0 0-3.34l-9.62-16.67c-.3-.51-.72-.93-1.22-1.22s-1.07-.45-1.67-.45H82.23l-8.66-15a3.33 3.33 0 0 0-2.89-1.67H51.43c-.59 0-1.17.16-1.66.45-.5.29-.92.71-1.22 1.22L32.19 29.98l-1.92 3.33H12.96c-.59 0-1.17.16-1.66.45-.5.29-.93.71-1.22 1.22L.45 51.66a3.323 3.323 0 0 0 0 3.34l18.28 31.67-8.66 15a3.32 3.32 0 0 0 0 3.34l9.62 16.67c.3.51.72.93 1.22 1.22s1.07.45 1.67.45h36.56l8.66 15a3.35 3.35 0 0 0 2.89 1.67h19.25a3.34 3.34 0 0 0 2.89-1.67l18.28-31.67h17.32c.6 0 1.17-.16 1.67-.45s.92-.71 1.22-1.22l9.62-16.67a3.323 3.323 0 0 0 0-3.34ZM51.44 3.33 61.07 20l-9.63 16.66h76.98l-9.62 16.66H45.67l-11.54-20zM57.21 120H22.58l9.63-16.67h19.25l-38.5-66.67h19.25l9.62 16.67L68.78 100l-11.55 20Zm61.59-33.34-9.62-16.67-38.49 66.67-9.63-16.67 9.63-16.66 26.94-46.67h23.1l17.32 30z"\n />\n</svg>\n`;var l=window.React,h=({state:e,onClose:t})=>(l.useEffect(()=>{if(e.visible){let o=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=o}}},[e.visible]),e.visible?l.createElement("div",{className:"modal-overlay",onClick:t},l.createElement("div",{className:"modal-container",onClick:o=>o.stopPropagation()},l.createElement("div",{className:"modal-header"},l.createElement("span",{className:"modal-title font-mono"},e.fileName),l.createElement("button",{className:"modal-close",onClick:t,"aria-label":"Close"},"\\u2715")),l.createElement("pre",{className:"modal-content"},e.content))):null),x=()=>{let[e,t]=l.useState({visible:!1,content:"",fileName:""}),o=l.useCallback((n,p="temp")=>{t({visible:!0,content:n,fileName:p})},[]),i=l.useCallback(()=>{t(n=>({...n,visible:!1}))},[]);return{modalState:e,openModal:o,closeModal:i}};var z=window.React,b=()=>{let{modalState:e,openModal:t,closeModal:o}=x();return{platformContext:z.useMemo(()=>({platform:"web",postMessage:n=>{console.log("Posted message:",n)},onMessage:n=>(window.addEventListener("message",n),()=>window.removeEventListener("message",n)),openFile:n=>{console.log("Opening file:",n)},openTempFile:t,getResourceUrl:()=>{},features:{canOpenFile:!1,canOpenTempFile:!0,canCopy:!0}}),[t]),modalState:e,closeModal:o}};var a=({label:e,value:t,valueClass:o})=>t==null||t===""?null:React.createElement("div",{className:"metadata-item"},React.createElement("div",{className:"metadata-content"},React.createElement("span",{className:"metadata-label"},e),React.createElement("span",{className:`metadata-value ${o||""}`,title:typeof t=="string"?t:void 0},t)));var v=e=>!!e&&typeof e=="object",w=()=>{let e=document.getElementById("chat-data");if(!(e!=null&&e.textContent))return{};try{let t=JSON.parse(e.textContent);return t&&typeof t=="object"?t:{}}catch(t){return console.error("Failed to parse chat data.",t),{}}};var y=e=>{if(!e)return"-";try{return new Date(e).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}},k=e=>{if(!e)return"-";try{let o=new Date(e).getTime();if(Number.isNaN(o))return"-";let n=Math.max(0,new Date().getTime()-o),p=Math.floor(n/1e3),c=Math.floor(p/60),d=Math.floor(c/60),s=Math.floor(d/24),m=Math.floor(s/7),g=Math.floor(s/30),u=Math.floor(s/365);return p<60?"just now":c<60?`${c} minute${c===1?"":"s"} ago`:d<24?`${d} hour${d===1?"":"s"} ago`:s<7?`${s} day${s===1?"":"s"} ago`:m<4?`${m} week${m===1?"":"s"} ago`:g<12?`${g} month${g===1?"":"s"} ago`:`${u} year${u===1?"":"s"} ago`}catch(t){return"-"}};var M=e=>{if(e!=null)return e>=1e6?`${(e/1e6).toFixed(e%1e6===0?0:1)}m`:e>=1e3?`${(e/1e3).toFixed(e%1e3===0?0:1)}k`:e.toString()};var T=({metadata:e})=>React.createElement("aside",{className:"metadata-sidebar"},React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"Session Info"),React.createElement(a,{label:"Session created",value:k(e.startTime)}),React.createElement(a,{label:"Project",value:e.cwd,valueClass:"multiline"}),e.gitRepo&&React.createElement(a,{label:"Repository",value:e.gitRepo}),e.gitBranch&&React.createElement(a,{label:"Branch",value:e.gitBranch}),e.model&&React.createElement(a,{label:"Model",value:e.model}),e.channel&&React.createElement(a,{label:"Channel",value:e.channel})),React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"Statistics"),React.createElement(a,{label:"Prompts",value:e.promptCount}),e.contextUsagePercent!==void 0&&e.contextWindowSize!==void 0&&React.createElement(a,{label:"Context",value:`${e.contextUsagePercent>100?">100":e.contextUsagePercent}% of ${M(e.contextWindowSize)}`,valueClass:e.contextUsagePercent>100?"text-red":void 0}),e.totalTokens!==void 0&&React.createElement(a,{label:"Tokens",value:e.totalTokens.toLocaleString()})),React.createElement("div",{className:"metadata-section"},React.createElement("h3",{className:"metadata-section-title"},"File Operations"),e.filesWritten!==void 0&&e.filesWritten>0&&React.createElement(a,{label:"Files modified",value:e.filesWritten}),e.linesAdded!==void 0&&e.linesAdded>0&&React.createElement(a,{label:"Added",value:`+${e.linesAdded}`,valueClass:"text-green"}),e.linesRemoved!==void 0&&e.linesRemoved>0&&React.createElement(a,{label:"Removed",value:`-${e.linesRemoved}`,valueClass:"text-red"}),(e.filesWritten===void 0||e.filesWritten===0)&&(e.linesAdded===void 0||e.linesAdded===0)&&(e.linesRemoved===void 0||e.linesRemoved===0)&&React.createElement("p",{className:"metadata-item metadata-item-empty"},"No file changes")),React.createElement("div",{className:"metadata-section metadata-section-small"},React.createElement(a,{label:"Session ID",value:e.sessionId,valueClass:"font-mono"}),React.createElement(a,{label:"Export Time",value:y(e.exportTime)})));var $=()=>React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},React.createElement("circle",{cx:"12",cy:"12",r:"4"}),React.createElement("path",{d:"M12 2v2"}),React.createElement("path",{d:"M12 20v2"}),React.createElement("path",{d:"m4.93 4.93 1.41 1.41"}),React.createElement("path",{d:"m17.66 17.66 1.41 1.41"}),React.createElement("path",{d:"M2 12h2"}),React.createElement("path",{d:"M20 12h2"}),React.createElement("path",{d:"m6.34 17.66-1.41 1.41"}),React.createElement("path",{d:"m19.07 4.93-1.41 1.41"})),D=()=>React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},React.createElement("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})),C=({theme:e,onToggle:t})=>{let o=e==="light",i=o?"Switch to dark theme":"Switch to light theme";return React.createElement("button",{type:"button",className:"theme-toggle","aria-label":i,"aria-pressed":o,title:i,onClick:t},React.createElement(o?D:$,null))};var L=window.React,{useCallback:j,useEffect:I,useState:W}=L,N="sara-export-theme",R=e=>e==="light"||e==="dark",F=()=>{try{let e=window.localStorage.getItem(N);if(R(e))return e}catch(e){}return"dark"},O=e=>{let t=document.documentElement;t.classList.toggle("light",e==="light"),t.classList.toggle("dark",e==="dark")},S=()=>{let[e,t]=W(F);I(()=>{O(e);try{window.localStorage.setItem(N,e)}catch(i){}},[e]);let o=j(()=>{t(i=>i==="light"?"dark":"light")},[]);return{theme:e,toggleTheme:o}};var A=window.ReactDOM,r=window.React,{ChatViewer:U,PlatformProvider:V}=QwenCodeWebUI,B=f?f.replace(/<svg([^>]*)>/,\'<svg$1><defs><linearGradient id="sara-logo-gradient" x1="0%" y1="0%" x2="100%" y2="0%"><stop offset="0%" stop-color="#60a5fa" /><stop offset="100%" stop-color="#a855f7" /></linearGradient></defs>\').replace(/fill="[^"]*"/,\'fill="url(#qwen-logo-gradient)"\'):f,H=()=>{let e=w(),o=(Array.isArray(e.messages)?e.messages:[]).filter(v).filter(m=>m.type!=="system"),i=e.metadata,{platformContext:n,modalState:p,closeModal:c}=b(),{theme:d,toggleTheme:s}=S();return r.createElement("div",{className:"page-wrapper"},r.createElement("header",{className:"header"},r.createElement("div",{className:"header-left"},r.createElement("div",{className:"logo-icon","aria-hidden":"true",dangerouslySetInnerHTML:{__html:B}}),r.createElement("div",{className:"logo"},r.createElement("div",{className:"logo-text","data-text":"QWEN"},r.createElement("span",{className:"logo-text-inner"},"QWEN")))),r.createElement("div",{className:"header-right"},r.createElement(C,{theme:d,onToggle:s}))),r.createElement("div",{className:"content-wrapper"},r.createElement("div",{className:"chat-container"},r.createElement(V,{value:n},r.createElement(U,{messages:o,autoScroll:!1,theme:d}))),i&&r.createElement(T,{metadata:i})),r.createElement(h,{state:p,onClose:c}))},E=document.getElementById("app");E?A.createRoot(E).render(r.createElement(H,null)):console.error("App container not found.");})();;\n </script>\n </body>\n</html>\n';
|
|
47444
47444
|
|
|
47445
47445
|
// packages/cli/src/ui/utils/export/formatters/html.ts
|
|
47446
47446
|
function escapeJsonForHtml(json) {
|
|
@@ -58259,7 +58259,7 @@ var SystemController = class extends BaseController {
|
|
|
58259
58259
|
throw new Error("Request aborted");
|
|
58260
58260
|
}
|
|
58261
58261
|
try {
|
|
58262
|
-
const mod = await import("./chunks/contextCommand-
|
|
58262
|
+
const mod = await import("./chunks/contextCommand-WW5M7CEA.js");
|
|
58263
58263
|
if (signal.aborted) {
|
|
58264
58264
|
throw new Error("Request aborted");
|
|
58265
58265
|
}
|
|
@@ -61473,7 +61473,7 @@ function useProviderUpdates(settings, config, addItem) {
|
|
|
61473
61473
|
},
|
|
61474
61474
|
[settings, config, addItem]
|
|
61475
61475
|
);
|
|
61476
|
-
const
|
|
61476
|
+
const checkForUpdates2 = (0, import_react47.useCallback)(() => {
|
|
61477
61477
|
if (!migrated.current) {
|
|
61478
61478
|
migrated.current = true;
|
|
61479
61479
|
migrateProviderMetadata(settings);
|
|
@@ -61507,8 +61507,8 @@ function useProviderUpdates(settings, config, addItem) {
|
|
|
61507
61507
|
});
|
|
61508
61508
|
}, [settings, config, executeUpdate]);
|
|
61509
61509
|
(0, import_react47.useEffect)(() => {
|
|
61510
|
-
|
|
61511
|
-
}, [
|
|
61510
|
+
checkForUpdates2();
|
|
61511
|
+
}, [checkForUpdates2]);
|
|
61512
61512
|
const dismissProviderUpdate = (0, import_react47.useCallback)(() => {
|
|
61513
61513
|
setUpdateRequest(void 0);
|
|
61514
61514
|
}, []);
|
|
@@ -75615,7 +75615,7 @@ var Header = /* @__PURE__ */ __name(({
|
|
|
75615
75615
|
width: showLogo ? availableInfoPanelWidth : void 0,
|
|
75616
75616
|
children: [
|
|
75617
75617
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { children: [
|
|
75618
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { bold: true, color: theme.text.accent, children: customBannerTitle ? customBannerTitle : ">_ Sara" }),
|
|
75618
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { bold: true, color: theme.text.accent, children: customBannerTitle ? customBannerTitle : ">_ Erdium Sara" }),
|
|
75619
75619
|
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { color: theme.text.secondary, children: [
|
|
75620
75620
|
" (v",
|
|
75621
75621
|
version,
|
|
@@ -107789,7 +107789,7 @@ var import_react226 = __toESM(require_react(), 1);
|
|
|
107789
107789
|
// packages/cli/src/services/notificationService.ts
|
|
107790
107790
|
init_esbuild_shims();
|
|
107791
107791
|
var debugLogger68 = createDebugLogger("NOTIFICATION_SERVICE");
|
|
107792
|
-
var DEFAULT_TITLE = "Sara";
|
|
107792
|
+
var DEFAULT_TITLE = "Erdium Sara";
|
|
107793
107793
|
function sendNotification(opts, terminal, enabled2) {
|
|
107794
107794
|
if (!enabled2) {
|
|
107795
107795
|
return "disabled";
|
|
@@ -107824,7 +107824,7 @@ __name(sendNotification, "sendNotification");
|
|
|
107824
107824
|
|
|
107825
107825
|
// packages/cli/src/ui/hooks/useAttentionNotifications.ts
|
|
107826
107826
|
var LONG_TASK_NOTIFICATION_THRESHOLD_SECONDS = 20;
|
|
107827
|
-
var NOTIFICATION_TITLE = "Sara";
|
|
107827
|
+
var NOTIFICATION_TITLE = "Erdium Sara";
|
|
107828
107828
|
var useAttentionNotifications = /* @__PURE__ */ __name(({
|
|
107829
107829
|
isFocused,
|
|
107830
107830
|
streamingState,
|
|
@@ -108075,6 +108075,66 @@ function useContextualTips({
|
|
|
108075
108075
|
}
|
|
108076
108076
|
__name(useContextualTips, "useContextualTips");
|
|
108077
108077
|
|
|
108078
|
+
// packages/cli/src/ui/utils/updateCheck.ts
|
|
108079
|
+
init_esbuild_shims();
|
|
108080
|
+
var NPM_REGISTRY = "https://registry.npmjs.org/@erdium/sara/latest";
|
|
108081
|
+
var FETCH_TIMEOUT_MS = 5e3;
|
|
108082
|
+
var debugLogger69 = createDebugLogger("UPDATE_CHECK");
|
|
108083
|
+
var cachedUpdate = null;
|
|
108084
|
+
var lastFetchTime = 0;
|
|
108085
|
+
var CACHE_TTL_MS = 60 * 60 * 1e3;
|
|
108086
|
+
async function checkForUpdates() {
|
|
108087
|
+
if (cachedUpdate && Date.now() - lastFetchTime < CACHE_TTL_MS) {
|
|
108088
|
+
return cachedUpdate;
|
|
108089
|
+
}
|
|
108090
|
+
try {
|
|
108091
|
+
const currentVersion = await getCliVersion();
|
|
108092
|
+
if (currentVersion.includes("-")) {
|
|
108093
|
+
return null;
|
|
108094
|
+
}
|
|
108095
|
+
const response = await fetch(NPM_REGISTRY, {
|
|
108096
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
|
108097
|
+
});
|
|
108098
|
+
if (!response.ok) {
|
|
108099
|
+
debugLogger69.debug(`npm registry returned ${response.status}`);
|
|
108100
|
+
return null;
|
|
108101
|
+
}
|
|
108102
|
+
const data = await response.json();
|
|
108103
|
+
const latestVersion = data.version;
|
|
108104
|
+
if (!latestVersion) {
|
|
108105
|
+
return null;
|
|
108106
|
+
}
|
|
108107
|
+
if (latestVersion === currentVersion) {
|
|
108108
|
+
cachedUpdate = null;
|
|
108109
|
+
lastFetchTime = Date.now();
|
|
108110
|
+
return null;
|
|
108111
|
+
}
|
|
108112
|
+
const currentParts = currentVersion.split(".").map(Number);
|
|
108113
|
+
const latestParts = latestVersion.split(".").map(Number);
|
|
108114
|
+
for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
|
|
108115
|
+
const cur = currentParts[i] ?? 0;
|
|
108116
|
+
const lat = latestParts[i] ?? 0;
|
|
108117
|
+
if (lat > cur) {
|
|
108118
|
+
cachedUpdate = { latestVersion, currentVersion };
|
|
108119
|
+
lastFetchTime = Date.now();
|
|
108120
|
+
return cachedUpdate;
|
|
108121
|
+
}
|
|
108122
|
+
if (cur > lat) {
|
|
108123
|
+
cachedUpdate = null;
|
|
108124
|
+
lastFetchTime = Date.now();
|
|
108125
|
+
return null;
|
|
108126
|
+
}
|
|
108127
|
+
}
|
|
108128
|
+
cachedUpdate = null;
|
|
108129
|
+
lastFetchTime = Date.now();
|
|
108130
|
+
return null;
|
|
108131
|
+
} catch (err) {
|
|
108132
|
+
debugLogger69.debug(`Update check failed: ${err}`);
|
|
108133
|
+
return null;
|
|
108134
|
+
}
|
|
108135
|
+
}
|
|
108136
|
+
__name(checkForUpdates, "checkForUpdates");
|
|
108137
|
+
|
|
108078
108138
|
// packages/cli/src/remoteInput/RemoteInputContext.tsx
|
|
108079
108139
|
init_esbuild_shims();
|
|
108080
108140
|
var import_react228 = __toESM(require_react(), 1);
|
|
@@ -108174,7 +108234,7 @@ var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1);
|
|
|
108174
108234
|
var MCP_BATCH_FLUSH_MS = 16;
|
|
108175
108235
|
var STARTUP_PROFILE_FINALIZE_CAP_MS = 35e3;
|
|
108176
108236
|
var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
|
|
108177
|
-
var
|
|
108237
|
+
var debugLogger70 = createDebugLogger("APP_CONTAINER");
|
|
108178
108238
|
function isRenderModeToggleKey(key) {
|
|
108179
108239
|
return keyMatchers["toggleRenderMode" /* TOGGLE_RENDER_MODE */](key) || key.name === "m" && key.meta && !key.ctrl && !key.paste;
|
|
108180
108240
|
}
|
|
@@ -108358,7 +108418,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108358
108418
|
const staticExtraHeight = 3;
|
|
108359
108419
|
(0, import_react229.useEffect)(() => {
|
|
108360
108420
|
void loadLowlight().catch((err) => {
|
|
108361
|
-
|
|
108421
|
+
debugLogger70.warn(
|
|
108362
108422
|
`Failed to load lowlight chunk; code blocks will render as plain text: ${err instanceof Error ? err.message : String(err)}`
|
|
108363
108423
|
);
|
|
108364
108424
|
});
|
|
@@ -108436,9 +108496,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108436
108496
|
registerCleanup(async () => {
|
|
108437
108497
|
try {
|
|
108438
108498
|
await config.getHookSystem()?.fireSessionEndEvent("prompt_input_exit" /* PromptInputExit */);
|
|
108439
|
-
|
|
108499
|
+
debugLogger70.debug("SessionEnd event completed successfully!!!");
|
|
108440
108500
|
} catch (err) {
|
|
108441
|
-
|
|
108501
|
+
debugLogger70.error(`SessionEnd hook failed: ${err}`);
|
|
108442
108502
|
}
|
|
108443
108503
|
});
|
|
108444
108504
|
registerCleanup(async () => {
|
|
@@ -108464,7 +108524,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108464
108524
|
flushTimer = null;
|
|
108465
108525
|
}
|
|
108466
108526
|
return geminiClient2.setTools().catch((err) => {
|
|
108467
|
-
|
|
108527
|
+
debugLogger70.error(
|
|
108468
108528
|
`setTools() batch-flush failed: ${err instanceof Error ? err.message : String(err)}`
|
|
108469
108529
|
);
|
|
108470
108530
|
});
|
|
@@ -108482,7 +108542,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108482
108542
|
failureSurfaced = true;
|
|
108483
108543
|
const failedNames = typeof config.getFailedMcpServerNames === "function" ? config.getFailedMcpServerNames() : [];
|
|
108484
108544
|
if (failedNames.length > 0) {
|
|
108485
|
-
|
|
108545
|
+
debugLogger70.warn(
|
|
108486
108546
|
`MCP server(s) failed to start: ${failedNames.join(", ")}. Continuing with built-in tools and any servers that did connect.`
|
|
108487
108547
|
);
|
|
108488
108548
|
}
|
|
@@ -108910,7 +108970,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108910
108970
|
},
|
|
108911
108971
|
Date.now()
|
|
108912
108972
|
);
|
|
108913
|
-
|
|
108973
|
+
debugLogger70.debug(
|
|
108914
108974
|
`[DEBUG] Refreshed memory content in config: ${memoryContent.substring(
|
|
108915
108975
|
0,
|
|
108916
108976
|
200
|
|
@@ -108925,7 +108985,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108925
108985
|
},
|
|
108926
108986
|
Date.now()
|
|
108927
108987
|
);
|
|
108928
|
-
|
|
108988
|
+
debugLogger70.error("Error refreshing memory:", error);
|
|
108929
108989
|
}
|
|
108930
108990
|
}, [config, historyManager, settings.merged]);
|
|
108931
108991
|
const cancelHandlerRef = (0, import_react229.useRef)(() => {
|
|
@@ -108972,6 +109032,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
108972
109032
|
if (streamingState === "idle" /* Idle */) {
|
|
108973
109033
|
}
|
|
108974
109034
|
}, [streamingState]);
|
|
109035
|
+
(0, import_react229.useEffect)(() => {
|
|
109036
|
+
if (!isConfigInitialized) return;
|
|
109037
|
+
checkForUpdates().then((update) => {
|
|
109038
|
+
if (update) {
|
|
109039
|
+
historyManager.addItem(
|
|
109040
|
+
{
|
|
109041
|
+
type: "info" /* INFO */,
|
|
109042
|
+
text: `Update available: v${update.currentVersion} \u2192 v${update.latestVersion}. Run \`npm update -g @erdium/sara\` to upgrade.`
|
|
109043
|
+
},
|
|
109044
|
+
Date.now()
|
|
109045
|
+
);
|
|
109046
|
+
}
|
|
109047
|
+
});
|
|
109048
|
+
}, [isConfigInitialized]);
|
|
108975
109049
|
const tipsDisabled = !!(settings.merged.ui?.hideTips || config.getScreenReader());
|
|
108976
109050
|
const tipHistory = (0, import_react229.useMemo)(
|
|
108977
109051
|
() => tipsDisabled ? null : getTipHistory(),
|
|
@@ -109270,30 +109344,30 @@ ${worktreeNotice}
|
|
|
109270
109344
|
${currentText}` : popped);
|
|
109271
109345
|
}
|
|
109272
109346
|
if (!draftWasEmpty) {
|
|
109273
|
-
|
|
109347
|
+
debugLogger70.debug("auto-restore bail: buffer was non-empty");
|
|
109274
109348
|
return;
|
|
109275
109349
|
}
|
|
109276
109350
|
if (popped !== null) {
|
|
109277
|
-
|
|
109351
|
+
debugLogger70.debug(
|
|
109278
109352
|
"auto-restore bail: queue had items (drained to buffer)"
|
|
109279
109353
|
);
|
|
109280
109354
|
return;
|
|
109281
109355
|
}
|
|
109282
109356
|
if (pendingHistoryItems2.some((item) => !isSyntheticHistoryItem(item))) {
|
|
109283
|
-
|
|
109357
|
+
debugLogger70.debug(
|
|
109284
109358
|
"auto-restore bail: pending stream item has meaningful content"
|
|
109285
109359
|
);
|
|
109286
109360
|
return;
|
|
109287
109361
|
}
|
|
109288
109362
|
if (info?.turnProducedMeaningfulContent) {
|
|
109289
|
-
|
|
109363
|
+
debugLogger70.debug(
|
|
109290
109364
|
"auto-restore bail: turn produced meaningful content during stream/flush"
|
|
109291
109365
|
);
|
|
109292
109366
|
return;
|
|
109293
109367
|
}
|
|
109294
109368
|
const cancelledTurnUserItem = info?.lastTurnUserItem;
|
|
109295
109369
|
if (cancelledTurnUserItem == null) {
|
|
109296
|
-
|
|
109370
|
+
debugLogger70.debug(
|
|
109297
109371
|
"auto-restore bail: cancelled turn did not add a user history item"
|
|
109298
109372
|
);
|
|
109299
109373
|
return;
|
|
@@ -109301,29 +109375,29 @@ ${currentText}` : popped);
|
|
|
109301
109375
|
const history = historyRef.current;
|
|
109302
109376
|
const lastUserIdx = findLastUserItemIndex(history);
|
|
109303
109377
|
if (lastUserIdx === -1) {
|
|
109304
|
-
|
|
109378
|
+
debugLogger70.debug("auto-restore bail: no user item in history");
|
|
109305
109379
|
return;
|
|
109306
109380
|
}
|
|
109307
109381
|
if (!itemsAfterAreOnlySynthetic(history, lastUserIdx)) {
|
|
109308
|
-
|
|
109382
|
+
debugLogger70.debug(
|
|
109309
109383
|
"auto-restore bail: meaningful content committed after last user item"
|
|
109310
109384
|
);
|
|
109311
109385
|
return;
|
|
109312
109386
|
}
|
|
109313
109387
|
const lastUserItem = history[lastUserIdx];
|
|
109314
109388
|
if (lastUserItem.type !== "user") {
|
|
109315
|
-
|
|
109389
|
+
debugLogger70.debug(
|
|
109316
109390
|
"auto-restore bail: lastUserItem type narrowing failed (unexpected)"
|
|
109317
109391
|
);
|
|
109318
109392
|
return;
|
|
109319
109393
|
}
|
|
109320
109394
|
if (lastUserItem.id !== cancelledTurnUserItem.id || lastUserItem.text !== cancelledTurnUserItem.text) {
|
|
109321
|
-
|
|
109395
|
+
debugLogger70.debug(
|
|
109322
109396
|
"auto-restore bail: lastUserItem identity does not match cancelled-turn user item"
|
|
109323
109397
|
);
|
|
109324
109398
|
return;
|
|
109325
109399
|
}
|
|
109326
|
-
|
|
109400
|
+
debugLogger70.debug(
|
|
109327
109401
|
"auto-restore: rewinding cancelled turn and restoring prompt"
|
|
109328
109402
|
);
|
|
109329
109403
|
historyManager.truncateToItem(lastUserItem.id);
|
|
@@ -109331,7 +109405,7 @@ ${currentText}` : popped);
|
|
|
109331
109405
|
buffer.setText(lastUserItem.text);
|
|
109332
109406
|
geminiClient?.stripOrphanedUserEntriesFromHistory?.();
|
|
109333
109407
|
void logger3?.removeLastUserMessage().catch((err) => {
|
|
109334
|
-
|
|
109408
|
+
debugLogger70.debug("Failed to undo cancelled prompt from log:", err);
|
|
109335
109409
|
});
|
|
109336
109410
|
},
|
|
109337
109411
|
[
|
|
@@ -109972,7 +110046,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
|
|
|
109972
110046
|
const handleGlobalKeypress = (0, import_react229.useCallback)(
|
|
109973
110047
|
(key) => {
|
|
109974
110048
|
if (settings.merged.general?.debugKeystrokeLogging) {
|
|
109975
|
-
|
|
110049
|
+
debugLogger70.debug("[DEBUG] Keystroke:", JSON.stringify(key));
|
|
109976
110050
|
}
|
|
109977
110051
|
if (keyMatchers["quit" /* QUIT */](key)) {
|
|
109978
110052
|
if (isAuthenticating) {
|
|
@@ -110091,7 +110165,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
|
|
|
110091
110165
|
tc.request.name === ToolNames.SHELL && tc.promoteAbortController !== void 0
|
|
110092
110166
|
);
|
|
110093
110167
|
if (executingShell?.promoteAbortController) {
|
|
110094
|
-
|
|
110168
|
+
debugLogger70.debug(
|
|
110095
110169
|
`Ctrl+B promote: matched executing shell tool call ${executingShell.request.callId}`
|
|
110096
110170
|
);
|
|
110097
110171
|
executingShell.promoteAbortController.abort({
|
|
@@ -110099,7 +110173,7 @@ ${migrationResult.failedFiles.map((f) => ` \u2022 ${f.file}: ${f.error}`).join(
|
|
|
110099
110173
|
});
|
|
110100
110174
|
return;
|
|
110101
110175
|
}
|
|
110102
|
-
|
|
110176
|
+
debugLogger70.debug(
|
|
110103
110177
|
`Ctrl+B promote: no executing shell tool call; falling through (streamingState=${streamingState}, pendingToolCalls=${pendingToolCallsRef.current.length})`
|
|
110104
110178
|
);
|
|
110105
110179
|
}
|
|
@@ -111648,7 +111722,7 @@ __name(initializeWarningHandler, "initializeWarningHandler");
|
|
|
111648
111722
|
|
|
111649
111723
|
// packages/cli/src/utils/earlyInputCapture.ts
|
|
111650
111724
|
init_esbuild_shims();
|
|
111651
|
-
var
|
|
111725
|
+
var debugLogger71 = createDebugLogger("EARLY_INPUT");
|
|
111652
111726
|
var MAX_BUFFER_SIZE = 64 * 1024;
|
|
111653
111727
|
var inputBuffer = {
|
|
111654
111728
|
chunks: [],
|
|
@@ -111781,12 +111855,12 @@ __name(shouldReplayPendingAtStop, "shouldReplayPendingAtStop");
|
|
|
111781
111855
|
function startEarlyInputCapture() {
|
|
111782
111856
|
if (isCapturing || !process.stdin.isTTY) {
|
|
111783
111857
|
if (!process.stdin.isTTY) {
|
|
111784
|
-
|
|
111858
|
+
debugLogger71.debug("Early input capture skipped: stdin is not a TTY");
|
|
111785
111859
|
}
|
|
111786
111860
|
return;
|
|
111787
111861
|
}
|
|
111788
111862
|
if (process.env["SARA_CODE_DISABLE_EARLY_CAPTURE"] === "1") {
|
|
111789
|
-
|
|
111863
|
+
debugLogger71.debug("Early input capture disabled by environment variable");
|
|
111790
111864
|
return;
|
|
111791
111865
|
}
|
|
111792
111866
|
isCapturing = true;
|
|
@@ -111796,13 +111870,13 @@ function startEarlyInputCapture() {
|
|
|
111796
111870
|
captured: false
|
|
111797
111871
|
};
|
|
111798
111872
|
pendingTerminalResponse = Buffer.alloc(0);
|
|
111799
|
-
|
|
111873
|
+
debugLogger71.debug("Starting early input capture");
|
|
111800
111874
|
captureHandler = /* @__PURE__ */ __name((data) => {
|
|
111801
111875
|
if (inputBuffer.captured) {
|
|
111802
111876
|
return;
|
|
111803
111877
|
}
|
|
111804
111878
|
if (inputBuffer.totalBytes >= MAX_BUFFER_SIZE) {
|
|
111805
|
-
|
|
111879
|
+
debugLogger71.warn(
|
|
111806
111880
|
`Early input capture buffer full (${MAX_BUFFER_SIZE} bytes). Stopping capture; additional keystrokes during startup will be lost.`
|
|
111807
111881
|
);
|
|
111808
111882
|
stopEarlyInputCapture();
|
|
@@ -111823,11 +111897,11 @@ function startEarlyInputCapture() {
|
|
|
111823
111897
|
);
|
|
111824
111898
|
inputBuffer.chunks.push(Buffer.from(truncated));
|
|
111825
111899
|
inputBuffer.totalBytes += truncated.length;
|
|
111826
|
-
|
|
111900
|
+
debugLogger71.debug(`Buffer truncated at ${MAX_BUFFER_SIZE} bytes`);
|
|
111827
111901
|
} else {
|
|
111828
111902
|
inputBuffer.chunks.push(Buffer.from(filtered));
|
|
111829
111903
|
inputBuffer.totalBytes += filtered.length;
|
|
111830
|
-
|
|
111904
|
+
debugLogger71.debug(
|
|
111831
111905
|
`Captured ${filtered.length} bytes (total: ${inputBuffer.totalBytes})`
|
|
111832
111906
|
);
|
|
111833
111907
|
}
|
|
@@ -111846,7 +111920,7 @@ function stopEarlyInputCapture() {
|
|
|
111846
111920
|
captureHandler = null;
|
|
111847
111921
|
isCapturing = false;
|
|
111848
111922
|
inputBuffer.captured = true;
|
|
111849
|
-
|
|
111923
|
+
debugLogger71.debug(
|
|
111850
111924
|
`Stopped early input capture: ${inputBuffer.totalBytes} bytes`
|
|
111851
111925
|
);
|
|
111852
111926
|
}
|
|
@@ -111872,7 +111946,7 @@ __name(stopAndGetCapturedInput, "stopAndGetCapturedInput");
|
|
|
111872
111946
|
// packages/cli/src/utils/apiPreconnect.ts
|
|
111873
111947
|
init_esbuild_shims();
|
|
111874
111948
|
var import_undici5 = __toESM(require_undici(), 1);
|
|
111875
|
-
var
|
|
111949
|
+
var debugLogger72 = createDebugLogger("PRECONNECT");
|
|
111876
111950
|
var preconnectFired = false;
|
|
111877
111951
|
var DEFAULT_BASE_URLS = {
|
|
111878
111952
|
openai: "https://api.openai.com",
|
|
@@ -111886,7 +111960,7 @@ var ALL_DEFAULT_URLS = [
|
|
|
111886
111960
|
];
|
|
111887
111961
|
function shouldSkipPreconnect() {
|
|
111888
111962
|
if (process.env["NODE_EXTRA_CA_CERTS"]) {
|
|
111889
|
-
|
|
111963
|
+
debugLogger72.debug("Skipping preconnect: custom CA certificate configured");
|
|
111890
111964
|
return true;
|
|
111891
111965
|
}
|
|
111892
111966
|
return false;
|
|
@@ -111909,7 +111983,7 @@ function getPreconnectTargetUrl(authType, resolvedBaseUrl) {
|
|
|
111909
111983
|
if (isDefaultBaseUrl(resolvedBaseUrl)) {
|
|
111910
111984
|
return resolvedBaseUrl;
|
|
111911
111985
|
}
|
|
111912
|
-
|
|
111986
|
+
debugLogger72.debug(
|
|
111913
111987
|
"Skipping preconnect: resolved baseUrl is not a default URL"
|
|
111914
111988
|
);
|
|
111915
111989
|
return void 0;
|
|
@@ -111925,12 +111999,12 @@ function preconnectApi(authType, options = {}) {
|
|
|
111925
111999
|
return;
|
|
111926
112000
|
}
|
|
111927
112001
|
if (process.env["SARA_CODE_DISABLE_PRECONNECT"] === "1") {
|
|
111928
|
-
|
|
112002
|
+
debugLogger72.debug("Preconnect disabled by environment variable");
|
|
111929
112003
|
preconnectFired = true;
|
|
111930
112004
|
return;
|
|
111931
112005
|
}
|
|
111932
112006
|
if (isInSandboxMode()) {
|
|
111933
|
-
|
|
112007
|
+
debugLogger72.debug("Skipping preconnect: sandbox mode detected");
|
|
111934
112008
|
preconnectFired = true;
|
|
111935
112009
|
return;
|
|
111936
112010
|
}
|
|
@@ -111939,22 +112013,22 @@ function preconnectApi(authType, options = {}) {
|
|
|
111939
112013
|
return;
|
|
111940
112014
|
}
|
|
111941
112015
|
if (detectRuntime() !== "node") {
|
|
111942
|
-
|
|
112016
|
+
debugLogger72.debug("Skipping preconnect: unsupported runtime");
|
|
111943
112017
|
preconnectFired = true;
|
|
111944
112018
|
return;
|
|
111945
112019
|
}
|
|
111946
112020
|
if (!options.proxy) {
|
|
111947
|
-
|
|
112021
|
+
debugLogger72.debug("Skipping preconnect dispatcher: no proxy configured");
|
|
111948
112022
|
return;
|
|
111949
112023
|
}
|
|
111950
112024
|
const proxy = options.proxy;
|
|
111951
112025
|
const targetUrl = getPreconnectTargetUrl(authType, options.resolvedBaseUrl);
|
|
111952
112026
|
if (!targetUrl) {
|
|
111953
|
-
|
|
112027
|
+
debugLogger72.debug("No target URL for preconnect");
|
|
111954
112028
|
return;
|
|
111955
112029
|
}
|
|
111956
112030
|
preconnectFired = true;
|
|
111957
|
-
|
|
112031
|
+
debugLogger72.debug(`Preconnecting to: ${targetUrl}`);
|
|
111958
112032
|
try {
|
|
111959
112033
|
const dispatcher = getOrCreateSharedDispatcher(proxy);
|
|
111960
112034
|
(0, import_undici5.fetch)(targetUrl, {
|
|
@@ -111965,14 +112039,14 @@ function preconnectApi(authType, options = {}) {
|
|
|
111965
112039
|
},
|
|
111966
112040
|
dispatcher
|
|
111967
112041
|
}).then(() => {
|
|
111968
|
-
|
|
112042
|
+
debugLogger72.debug("Preconnect completed");
|
|
111969
112043
|
}).catch((error) => {
|
|
111970
112044
|
const redactedError = redactProxyCredentials(String(error));
|
|
111971
|
-
|
|
112045
|
+
debugLogger72.debug(`Preconnect failed (ignored): ${redactedError}`);
|
|
111972
112046
|
});
|
|
111973
112047
|
} catch (error) {
|
|
111974
112048
|
const redactedError = redactProxyCredentials(String(error));
|
|
111975
|
-
|
|
112049
|
+
debugLogger72.debug(`Preconnect failed (ignored): ${redactedError}`);
|
|
111976
112050
|
}
|
|
111977
112051
|
}
|
|
111978
112052
|
__name(preconnectApi, "preconnectApi");
|
|
@@ -112150,7 +112224,7 @@ import {
|
|
|
112150
112224
|
init_esbuild_shims();
|
|
112151
112225
|
|
|
112152
112226
|
// packages/cli/src/dualOutput/DualOutputBridge.ts
|
|
112153
|
-
var
|
|
112227
|
+
var debugLogger73 = createDebugLogger("DUAL_OUTPUT");
|
|
112154
112228
|
var SUPPORTED_EVENTS = [
|
|
112155
112229
|
"system",
|
|
112156
112230
|
"user",
|
|
@@ -112205,9 +112279,9 @@ var DualOutputBridge = class {
|
|
|
112205
112279
|
this.stream.on("error", (err) => {
|
|
112206
112280
|
const code = err.code;
|
|
112207
112281
|
if (code === "EPIPE" || code === "ERR_STREAM_DESTROYED") {
|
|
112208
|
-
|
|
112282
|
+
debugLogger73.warn("DualOutput: consumer disconnected, disabling");
|
|
112209
112283
|
} else {
|
|
112210
|
-
|
|
112284
|
+
debugLogger73.error("DualOutput stream error:", err);
|
|
112211
112285
|
}
|
|
112212
112286
|
this.active = false;
|
|
112213
112287
|
});
|
|
@@ -112226,7 +112300,7 @@ var DualOutputBridge = class {
|
|
|
112226
112300
|
supported_events: [...SUPPORTED_EVENTS]
|
|
112227
112301
|
});
|
|
112228
112302
|
} catch (err) {
|
|
112229
|
-
|
|
112303
|
+
debugLogger73.error("DualOutput session_start error:", err);
|
|
112230
112304
|
this.active = false;
|
|
112231
112305
|
}
|
|
112232
112306
|
}
|
|
@@ -112235,7 +112309,7 @@ var DualOutputBridge = class {
|
|
|
112235
112309
|
try {
|
|
112236
112310
|
this.adapter.processEvent(event);
|
|
112237
112311
|
} catch (err) {
|
|
112238
|
-
|
|
112312
|
+
debugLogger73.error("DualOutput processEvent error:", err);
|
|
112239
112313
|
this.active = false;
|
|
112240
112314
|
}
|
|
112241
112315
|
}
|
|
@@ -112244,7 +112318,7 @@ var DualOutputBridge = class {
|
|
|
112244
112318
|
try {
|
|
112245
112319
|
this.adapter.startAssistantMessage();
|
|
112246
112320
|
} catch (err) {
|
|
112247
|
-
|
|
112321
|
+
debugLogger73.error("DualOutput startAssistantMessage error:", err);
|
|
112248
112322
|
this.active = false;
|
|
112249
112323
|
}
|
|
112250
112324
|
}
|
|
@@ -112253,7 +112327,7 @@ var DualOutputBridge = class {
|
|
|
112253
112327
|
try {
|
|
112254
112328
|
this.adapter.finalizeAssistantMessage();
|
|
112255
112329
|
} catch (err) {
|
|
112256
|
-
|
|
112330
|
+
debugLogger73.error("DualOutput finalizeAssistantMessage error:", err);
|
|
112257
112331
|
this.active = false;
|
|
112258
112332
|
}
|
|
112259
112333
|
}
|
|
@@ -112262,7 +112336,7 @@ var DualOutputBridge = class {
|
|
|
112262
112336
|
try {
|
|
112263
112337
|
this.adapter.emitUserMessage(parts);
|
|
112264
112338
|
} catch (err) {
|
|
112265
|
-
|
|
112339
|
+
debugLogger73.error("DualOutput emitUserMessage error:", err);
|
|
112266
112340
|
this.active = false;
|
|
112267
112341
|
}
|
|
112268
112342
|
}
|
|
@@ -112271,7 +112345,7 @@ var DualOutputBridge = class {
|
|
|
112271
112345
|
try {
|
|
112272
112346
|
this.adapter.emitToolResult(request, response);
|
|
112273
112347
|
} catch (err) {
|
|
112274
|
-
|
|
112348
|
+
debugLogger73.error("DualOutput emitToolResult error:", err);
|
|
112275
112349
|
this.active = false;
|
|
112276
112350
|
}
|
|
112277
112351
|
}
|
|
@@ -112294,7 +112368,7 @@ var DualOutputBridge = class {
|
|
|
112294
112368
|
blockedPath
|
|
112295
112369
|
);
|
|
112296
112370
|
} catch (err) {
|
|
112297
|
-
|
|
112371
|
+
debugLogger73.error("DualOutput emitPermissionRequest error:", err);
|
|
112298
112372
|
this.active = false;
|
|
112299
112373
|
}
|
|
112300
112374
|
}
|
|
@@ -112307,7 +112381,7 @@ var DualOutputBridge = class {
|
|
|
112307
112381
|
try {
|
|
112308
112382
|
this.adapter.emitControlResponse(requestId, allowed);
|
|
112309
112383
|
} catch (err) {
|
|
112310
|
-
|
|
112384
|
+
debugLogger73.error("DualOutput emitControlResponse error:", err);
|
|
112311
112385
|
this.active = false;
|
|
112312
112386
|
}
|
|
112313
112387
|
}
|
|
@@ -112322,7 +112396,7 @@ var DualOutputBridge = class {
|
|
|
112322
112396
|
try {
|
|
112323
112397
|
this.adapter.emitControlError(requestId, message);
|
|
112324
112398
|
} catch (err) {
|
|
112325
|
-
|
|
112399
|
+
debugLogger73.error("DualOutput emitControlError error:", err);
|
|
112326
112400
|
this.active = false;
|
|
112327
112401
|
}
|
|
112328
112402
|
}
|
|
@@ -112332,7 +112406,7 @@ var DualOutputBridge = class {
|
|
|
112332
112406
|
try {
|
|
112333
112407
|
this.adapter.emitSystemMessage(subtype, data);
|
|
112334
112408
|
} catch (err) {
|
|
112335
|
-
|
|
112409
|
+
debugLogger73.error("DualOutput emitSystemMessage error:", err);
|
|
112336
112410
|
this.active = false;
|
|
112337
112411
|
}
|
|
112338
112412
|
}
|
|
@@ -112361,7 +112435,7 @@ var DualOutputBridge = class {
|
|
|
112361
112435
|
resolve21();
|
|
112362
112436
|
}, "onClose");
|
|
112363
112437
|
const onError = /* @__PURE__ */ __name((err) => {
|
|
112364
|
-
|
|
112438
|
+
debugLogger73.debug("DualOutput: stream error during shutdown:", err);
|
|
112365
112439
|
}, "onError");
|
|
112366
112440
|
this.stream.once("close", onClose);
|
|
112367
112441
|
this.stream.once("error", onError);
|
|
@@ -112369,7 +112443,7 @@ var DualOutputBridge = class {
|
|
|
112369
112443
|
this.stream.end();
|
|
112370
112444
|
} catch (err) {
|
|
112371
112445
|
cleanup();
|
|
112372
|
-
|
|
112446
|
+
debugLogger73.debug("DualOutput: stream end error during shutdown:", err);
|
|
112373
112447
|
resolve21();
|
|
112374
112448
|
}
|
|
112375
112449
|
});
|
|
@@ -112381,7 +112455,7 @@ var DualOutputBridge = class {
|
|
|
112381
112455
|
init_esbuild_shims();
|
|
112382
112456
|
import { createReadStream, watchFile, unwatchFile, statSync as statSync6 } from "node:fs";
|
|
112383
112457
|
import { createInterface as createInterface2 } from "node:readline";
|
|
112384
|
-
var
|
|
112458
|
+
var debugLogger74 = createDebugLogger("REMOTE_INPUT");
|
|
112385
112459
|
var RemoteInputWatcher = class {
|
|
112386
112460
|
static {
|
|
112387
112461
|
__name(this, "RemoteInputWatcher");
|
|
@@ -112438,7 +112512,7 @@ var RemoteInputWatcher = class {
|
|
|
112438
112512
|
if (!this.active) return;
|
|
112439
112513
|
this.readNewLines();
|
|
112440
112514
|
});
|
|
112441
|
-
|
|
112515
|
+
debugLogger74.debug(`RemoteInput: watching ${this.filePath}`);
|
|
112442
112516
|
}
|
|
112443
112517
|
/**
|
|
112444
112518
|
* Manually trigger a check for new input. Returns a promise that resolves
|
|
@@ -112471,24 +112545,24 @@ var RemoteInputWatcher = class {
|
|
|
112471
112545
|
try {
|
|
112472
112546
|
const cmd = JSON.parse(trimmed);
|
|
112473
112547
|
if (cmd && cmd.type === "confirmation_response" && typeof cmd.request_id === "string" && typeof cmd.allowed === "boolean") {
|
|
112474
|
-
|
|
112548
|
+
debugLogger74.debug(
|
|
112475
112549
|
`RemoteInput: confirmation_response for ${cmd.request_id} (allowed=${cmd.allowed})`
|
|
112476
112550
|
);
|
|
112477
112551
|
this.confirmationHandler?.(cmd.request_id, cmd.allowed);
|
|
112478
112552
|
} else if (cmd && cmd.type === "submit" && typeof cmd.text === "string") {
|
|
112479
|
-
|
|
112553
|
+
debugLogger74.debug(
|
|
112480
112554
|
`RemoteInput: queued command: ${cmd.text.slice(0, 50)}...`
|
|
112481
112555
|
);
|
|
112482
112556
|
this.queue.push(
|
|
112483
112557
|
cmd
|
|
112484
112558
|
);
|
|
112485
112559
|
} else {
|
|
112486
|
-
|
|
112560
|
+
debugLogger74.warn(
|
|
112487
112561
|
`RemoteInput: unknown command type: ${String(cmd?.type)}`
|
|
112488
112562
|
);
|
|
112489
112563
|
}
|
|
112490
112564
|
} catch (_err) {
|
|
112491
|
-
|
|
112565
|
+
debugLogger74.warn(`RemoteInput: failed to parse line: ${trimmed}`);
|
|
112492
112566
|
}
|
|
112493
112567
|
});
|
|
112494
112568
|
return new Promise((resolve21) => {
|
|
@@ -112511,19 +112585,19 @@ var RemoteInputWatcher = class {
|
|
|
112511
112585
|
while (this.queue.length > 0 && this.active) {
|
|
112512
112586
|
if (!this.submitFn) break;
|
|
112513
112587
|
const cmd = this.queue[0];
|
|
112514
|
-
|
|
112588
|
+
debugLogger74.debug(
|
|
112515
112589
|
`RemoteInput: submitting: ${cmd.text.slice(0, 50)}...`
|
|
112516
112590
|
);
|
|
112517
112591
|
try {
|
|
112518
112592
|
const result = await this.submitFn(cmd.text);
|
|
112519
112593
|
if (result === false) {
|
|
112520
|
-
|
|
112594
|
+
debugLogger74.debug("RemoteInput: TUI busy, will retry on idle");
|
|
112521
112595
|
this.scheduleRetry();
|
|
112522
112596
|
break;
|
|
112523
112597
|
}
|
|
112524
112598
|
this.queue.shift();
|
|
112525
112599
|
} catch (err) {
|
|
112526
|
-
|
|
112600
|
+
debugLogger74.error("RemoteInput: submit failed:", err);
|
|
112527
112601
|
this.queue.shift();
|
|
112528
112602
|
}
|
|
112529
112603
|
if (this.queue.length > 0) {
|
|
@@ -112548,7 +112622,7 @@ var RemoteInputWatcher = class {
|
|
|
112548
112622
|
unwatchFile(this.filePath);
|
|
112549
112623
|
if (this.retryTimer) clearTimeout(this.retryTimer);
|
|
112550
112624
|
this.queue.length = 0;
|
|
112551
|
-
|
|
112625
|
+
debugLogger74.debug("RemoteInput: shut down");
|
|
112552
112626
|
}
|
|
112553
112627
|
};
|
|
112554
112628
|
|
|
@@ -113026,7 +113100,7 @@ function toPermissionOptions(confirmation, forceHideAlwaysAllow = false) {
|
|
|
113026
113100
|
__name(toPermissionOptions, "toPermissionOptions");
|
|
113027
113101
|
|
|
113028
113102
|
// packages/cli/src/acp-integration/session/SubAgentTracker.ts
|
|
113029
|
-
var
|
|
113103
|
+
var debugLogger75 = createDebugLogger("ACP_SUBAGENT_TRACKER");
|
|
113030
113104
|
var SubAgentTracker = class {
|
|
113031
113105
|
constructor(ctx, client, parentToolCallId, subagentType) {
|
|
113032
113106
|
this.ctx = ctx;
|
|
@@ -113085,7 +113159,7 @@ var SubAgentTracker = class {
|
|
|
113085
113159
|
try {
|
|
113086
113160
|
invocation = tool.build(event.args);
|
|
113087
113161
|
} catch (e) {
|
|
113088
|
-
|
|
113162
|
+
debugLogger75.warn(`Failed to build subagent tool ${event.name}:`, e);
|
|
113089
113163
|
}
|
|
113090
113164
|
}
|
|
113091
113165
|
this.toolStates.set(event.callId, {
|
|
@@ -113155,7 +113229,7 @@ var SubAgentTracker = class {
|
|
|
113155
113229
|
answers: "answers" in output ? output.answers : void 0
|
|
113156
113230
|
});
|
|
113157
113231
|
} catch (error) {
|
|
113158
|
-
|
|
113232
|
+
debugLogger75.error(
|
|
113159
113233
|
`Permission request failed for subagent tool ${event.name}:`,
|
|
113160
113234
|
error
|
|
113161
113235
|
);
|
|
@@ -113254,7 +113328,7 @@ var TurnBuffer = class {
|
|
|
113254
113328
|
init_esbuild_shims();
|
|
113255
113329
|
import { readFileSync as readFileSync17, existsSync as existsSync16 } from "node:fs";
|
|
113256
113330
|
import { resolve as resolve19 } from "node:path";
|
|
113257
|
-
var
|
|
113331
|
+
var debugLogger76 = createDebugLogger("MESSAGE_REWRITER");
|
|
113258
113332
|
var DEFAULT_REWRITE_PROMPT = `You are an assistant that rewrites raw coding-agent output into concise, user-friendly progress updates.
|
|
113259
113333
|
|
|
113260
113334
|
The agent is a software engineering assistant that reads files, writes code, runs commands, and uses tools. Its raw output mixes internal reasoning with user-facing information. Your job: extract what the user cares about, drop what they don't.
|
|
@@ -113283,11 +113357,11 @@ var LlmRewriter = class {
|
|
|
113283
113357
|
const filePath = resolve19(rewriteConfig.promptFile);
|
|
113284
113358
|
if (existsSync16(filePath)) {
|
|
113285
113359
|
this.prompt = readFileSync17(filePath, "utf-8").trim();
|
|
113286
|
-
|
|
113360
|
+
debugLogger76.info(
|
|
113287
113361
|
`Loaded rewrite prompt from file: ${filePath} (${this.prompt.length} chars)`
|
|
113288
113362
|
);
|
|
113289
113363
|
} else {
|
|
113290
|
-
|
|
113364
|
+
debugLogger76.warn(
|
|
113291
113365
|
`Rewrite prompt file not found: ${filePath}, using default`
|
|
113292
113366
|
);
|
|
113293
113367
|
this.prompt = DEFAULT_REWRITE_PROMPT;
|
|
@@ -113324,7 +113398,7 @@ var LlmRewriter = class {
|
|
|
113324
113398
|
const inputText = inputParts.join("\n\n");
|
|
113325
113399
|
if (!inputText.trim()) return null;
|
|
113326
113400
|
if (inputText.length < 10) return null;
|
|
113327
|
-
|
|
113401
|
+
debugLogger76.info(
|
|
113328
113402
|
`[REWRITE INPUT] system_prompt_len=${this.prompt.length} input_len=${inputText.length} context_turns=${this.outputHistory.length}
|
|
113329
113403
|
--- INPUT TEXT ---
|
|
113330
113404
|
${inputText}
|
|
@@ -113353,10 +113427,10 @@ ${inputText}
|
|
|
113353
113427
|
});
|
|
113354
113428
|
const rewritten = result.text;
|
|
113355
113429
|
if (!rewritten || rewritten.length < 5) {
|
|
113356
|
-
|
|
113430
|
+
debugLogger76.info(`[REWRITE OUTPUT] empty or too short, skipping`);
|
|
113357
113431
|
return null;
|
|
113358
113432
|
}
|
|
113359
|
-
|
|
113433
|
+
debugLogger76.info(
|
|
113360
113434
|
`[REWRITE OUTPUT] len=${rewritten.length}
|
|
113361
113435
|
--- OUTPUT ---
|
|
113362
113436
|
${rewritten}
|
|
@@ -113365,7 +113439,7 @@ ${rewritten}
|
|
|
113365
113439
|
this.outputHistory.push(rewritten);
|
|
113366
113440
|
return rewritten;
|
|
113367
113441
|
} catch (error) {
|
|
113368
|
-
|
|
113442
|
+
debugLogger76.warn(
|
|
113369
113443
|
`LLM rewrite failed, skipping: ${error instanceof Error ? error.message : String(error)}`
|
|
113370
113444
|
);
|
|
113371
113445
|
return null;
|
|
@@ -113374,7 +113448,7 @@ ${rewritten}
|
|
|
113374
113448
|
};
|
|
113375
113449
|
|
|
113376
113450
|
// packages/cli/src/acp-integration/session/rewrite/MessageRewriteMiddleware.ts
|
|
113377
|
-
var
|
|
113451
|
+
var debugLogger77 = createDebugLogger("MESSAGE_REWRITE");
|
|
113378
113452
|
var DEFAULT_REWRITE_TIMEOUT_MS = 3e4;
|
|
113379
113453
|
var REWRITE_META_EXCLUDED_KEYS = /* @__PURE__ */ new Set([]);
|
|
113380
113454
|
var MessageRewriteMiddleware = class {
|
|
@@ -113454,10 +113528,10 @@ var MessageRewriteMiddleware = class {
|
|
|
113454
113528
|
try {
|
|
113455
113529
|
const rewritten = await this.rewriter.rewrite(content, rewriteSignal);
|
|
113456
113530
|
if (!rewritten) {
|
|
113457
|
-
|
|
113531
|
+
debugLogger77.info(`Turn ${turnIdx}: no rewrite output`);
|
|
113458
113532
|
return;
|
|
113459
113533
|
}
|
|
113460
|
-
|
|
113534
|
+
debugLogger77.info(
|
|
113461
113535
|
`Turn ${turnIdx}: rewritten ${rewritten.length} chars`
|
|
113462
113536
|
);
|
|
113463
113537
|
await this.sendUpdate({
|
|
@@ -113470,7 +113544,7 @@ var MessageRewriteMiddleware = class {
|
|
|
113470
113544
|
}
|
|
113471
113545
|
});
|
|
113472
113546
|
} catch (error) {
|
|
113473
|
-
|
|
113547
|
+
debugLogger77.warn(
|
|
113474
113548
|
`Turn ${turnIdx}: rewrite failed: ${error instanceof Error ? error.message : String(error)}`
|
|
113475
113549
|
);
|
|
113476
113550
|
}
|
|
@@ -113515,7 +113589,7 @@ function loadRewriteConfig(settings) {
|
|
|
113515
113589
|
__name(loadRewriteConfig, "loadRewriteConfig");
|
|
113516
113590
|
|
|
113517
113591
|
// packages/cli/src/acp-integration/session/Session.ts
|
|
113518
|
-
var
|
|
113592
|
+
var debugLogger78 = createDebugLogger("SESSION");
|
|
113519
113593
|
function maskApiKeyForDisplay(apiKey) {
|
|
113520
113594
|
const trimmed = apiKey?.trim() ?? "";
|
|
113521
113595
|
if (trimmed.length === 0) return "(not set)";
|
|
@@ -113570,7 +113644,7 @@ async function fireSessionPermissionDeniedForAutoMode(config, decision, outcome,
|
|
|
113570
113644
|
signal
|
|
113571
113645
|
);
|
|
113572
113646
|
} catch (hookError) {
|
|
113573
|
-
|
|
113647
|
+
debugLogger78.warn(
|
|
113574
113648
|
`PermissionDenied hook failed for tool ${callId}: ${hookError instanceof Error ? hookError.message : String(hookError)}`
|
|
113575
113649
|
);
|
|
113576
113650
|
}
|
|
@@ -113648,7 +113722,7 @@ async function buildAvailableCommandsSnapshot(config, abortSignal = AbortSignal.
|
|
|
113648
113722
|
}
|
|
113649
113723
|
}
|
|
113650
113724
|
} catch (error) {
|
|
113651
|
-
|
|
113725
|
+
debugLogger78.error("Error loading available skills:", error);
|
|
113652
113726
|
}
|
|
113653
113727
|
for (const command2 of slashCommands) {
|
|
113654
113728
|
if (command2.kind !== "skill" /* SKILL */ || !command2.skillDetail) {
|
|
@@ -113793,7 +113867,7 @@ var Session2 = class {
|
|
|
113793
113867
|
installRewriter() {
|
|
113794
113868
|
const rewriteConfig = loadRewriteConfig(this.settings);
|
|
113795
113869
|
if (rewriteConfig?.enabled) {
|
|
113796
|
-
|
|
113870
|
+
debugLogger78.info("Message rewrite middleware enabled");
|
|
113797
113871
|
this.messageRewriter = new MessageRewriteMiddleware(
|
|
113798
113872
|
this.config,
|
|
113799
113873
|
rewriteConfig,
|
|
@@ -113804,7 +113878,7 @@ var Session2 = class {
|
|
|
113804
113878
|
#installGoalTerminalObserver() {
|
|
113805
113879
|
setGoalTerminalObserver(this.sessionId, (event) => {
|
|
113806
113880
|
void this.messageEmitter.emitGoalTerminal(event).catch((error) => {
|
|
113807
|
-
|
|
113881
|
+
debugLogger78.warn(
|
|
113808
113882
|
`Failed to emit goal terminal update: ${this.#formatError(error)}`
|
|
113809
113883
|
);
|
|
113810
113884
|
});
|
|
@@ -114029,7 +114103,7 @@ var Session2 = class {
|
|
|
114029
114103
|
const fullHistory = chat.getHistory(true);
|
|
114030
114104
|
const lastEntry = fullHistory[fullHistory.length - 1];
|
|
114031
114105
|
if (!lastEntry || lastEntry.role !== "model") {
|
|
114032
|
-
|
|
114106
|
+
debugLogger78.debug(
|
|
114033
114107
|
"Skipping followup suggestion: last history entry is not model"
|
|
114034
114108
|
);
|
|
114035
114109
|
return;
|
|
@@ -114065,9 +114139,9 @@ var Session2 = class {
|
|
|
114065
114139
|
}
|
|
114066
114140
|
} catch (error) {
|
|
114067
114141
|
if (ac.signal.aborted) {
|
|
114068
|
-
|
|
114142
|
+
debugLogger78.debug("Follow-up suggestion generation aborted");
|
|
114069
114143
|
} else {
|
|
114070
|
-
|
|
114144
|
+
debugLogger78.warn("Follow-up suggestion generation failed", error);
|
|
114071
114145
|
}
|
|
114072
114146
|
} finally {
|
|
114073
114147
|
if (this.followupAbort === ac) {
|
|
@@ -114171,10 +114245,10 @@ var Session2 = class {
|
|
|
114171
114245
|
this.config.getChatRecordingService()?.recordFileHistorySnapshot(latestSnapshot);
|
|
114172
114246
|
}
|
|
114173
114247
|
} catch (e) {
|
|
114174
|
-
|
|
114248
|
+
debugLogger78.error(`FileHistory: recordSnapshot failed: ${e}`);
|
|
114175
114249
|
}
|
|
114176
114250
|
} catch (e) {
|
|
114177
|
-
|
|
114251
|
+
debugLogger78.error(`FileHistory: makeSnapshot failed: ${e}`);
|
|
114178
114252
|
}
|
|
114179
114253
|
const systemReminders = await this.#buildInitialSystemReminders();
|
|
114180
114254
|
if (systemReminders.length > 0) {
|
|
@@ -114255,7 +114329,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114255
114329
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
114256
114330
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
114257
114331
|
hookSystem.fireStopFailureEvent(errorType, errorMessage2).catch((err) => {
|
|
114258
|
-
|
|
114332
|
+
debugLogger78.warn(`StopFailure hook failed: ${err}`);
|
|
114259
114333
|
});
|
|
114260
114334
|
}
|
|
114261
114335
|
if (errorStatus === 429) {
|
|
@@ -114373,7 +114447,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114373
114447
|
warning
|
|
114374
114448
|
);
|
|
114375
114449
|
await this.messageEmitter.emitAgentMessage(warning);
|
|
114376
|
-
|
|
114450
|
+
debugLogger78.warn(warning);
|
|
114377
114451
|
return { stopReason: "end_turn" };
|
|
114378
114452
|
}
|
|
114379
114453
|
if (stopHookIterationCount > 1) {
|
|
@@ -114444,7 +114518,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114444
114518
|
const hooksEnabledForStopFailure = !this.config.getDisableAllHooks?.();
|
|
114445
114519
|
if (hooksEnabledForStopFailure && hookSystem && this.config.hasHooksForEvent?.("StopFailure")) {
|
|
114446
114520
|
hookSystem.fireStopFailureEvent(errorType, errorMessage2).catch((err) => {
|
|
114447
|
-
|
|
114521
|
+
debugLogger78.warn(`StopFailure hook failed: ${err}`);
|
|
114448
114522
|
});
|
|
114449
114523
|
}
|
|
114450
114524
|
if (errorStatus === 429) {
|
|
@@ -114522,16 +114596,16 @@ ${this.pendingWorktreeNotice}
|
|
|
114522
114596
|
}
|
|
114523
114597
|
} catch (compressionError) {
|
|
114524
114598
|
if (abortSignal.aborted || this.#isAbortError(compressionError)) {
|
|
114525
|
-
|
|
114599
|
+
debugLogger78.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
114526
114600
|
return { responseStream: null, stopReason: "cancelled" };
|
|
114527
114601
|
}
|
|
114528
|
-
|
|
114602
|
+
debugLogger78.warn(
|
|
114529
114603
|
`Auto-compression failed for prompt ${promptId}; proceeding without compression: ` + this.#formatError(compressionError)
|
|
114530
114604
|
);
|
|
114531
114605
|
}
|
|
114532
114606
|
}
|
|
114533
114607
|
if (abortSignal.aborted) {
|
|
114534
|
-
|
|
114608
|
+
debugLogger78.debug(`Auto-compression aborted for prompt ${promptId}`);
|
|
114535
114609
|
return { responseStream: null, stopReason: "cancelled" };
|
|
114536
114610
|
}
|
|
114537
114611
|
if (!compressionInfo) {
|
|
@@ -114541,7 +114615,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114541
114615
|
if (sessionTokenLimit > 0) {
|
|
114542
114616
|
const lastPromptTokenCount = this.#getPostCompressionTokenCount(compressionInfo);
|
|
114543
114617
|
if (lastPromptTokenCount > sessionTokenLimit) {
|
|
114544
|
-
|
|
114618
|
+
debugLogger78.warn(
|
|
114545
114619
|
`Session token limit exceeded for prompt ${promptId}: ${lastPromptTokenCount} > ${sessionTokenLimit}. Send dropped.`
|
|
114546
114620
|
);
|
|
114547
114621
|
await this.#emitAgentDiagnosticMessageSafely(
|
|
@@ -114558,7 +114632,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114558
114632
|
);
|
|
114559
114633
|
}
|
|
114560
114634
|
if (abortSignal.aborted) {
|
|
114561
|
-
|
|
114635
|
+
debugLogger78.debug(
|
|
114562
114636
|
`Send aborted after compression diagnostic for prompt ${promptId}`
|
|
114563
114637
|
);
|
|
114564
114638
|
return { responseStream: null, stopReason: "cancelled" };
|
|
@@ -114586,7 +114660,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114586
114660
|
) ?? [];
|
|
114587
114661
|
const droppedParts = (message.parts?.length ?? 0) - functionResponseParts.length;
|
|
114588
114662
|
if (droppedParts > 0) {
|
|
114589
|
-
|
|
114663
|
+
debugLogger78.debug(
|
|
114590
114664
|
`Dropping ${droppedParts} non-functionResponse part(s) from unsent ACP message after send was skipped.`
|
|
114591
114665
|
);
|
|
114592
114666
|
}
|
|
@@ -114664,7 +114738,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114664
114738
|
try {
|
|
114665
114739
|
await this.#emitAgentDiagnosticMessage(text);
|
|
114666
114740
|
} catch (notifyError) {
|
|
114667
|
-
|
|
114741
|
+
debugLogger78.warn(`${failureContext}: ${this.#formatError(notifyError)}`);
|
|
114668
114742
|
}
|
|
114669
114743
|
}
|
|
114670
114744
|
async #emitAgentDiagnosticMessage(text) {
|
|
@@ -114718,7 +114792,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114718
114792
|
if (isPermanentError) {
|
|
114719
114793
|
this.midTurnDrainUnavailable = true;
|
|
114720
114794
|
}
|
|
114721
|
-
|
|
114795
|
+
debugLogger78.warn(
|
|
114722
114796
|
`Mid-turn queue drain ${isPermanentError ? "permanently " : ""}unavailable [session ${this.sessionId}]: ${errorMessage2}`
|
|
114723
114797
|
);
|
|
114724
114798
|
return [];
|
|
@@ -114884,7 +114958,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114884
114958
|
} catch (error) {
|
|
114885
114959
|
if (ac.signal.aborted) return;
|
|
114886
114960
|
cronHadError = true;
|
|
114887
|
-
|
|
114961
|
+
debugLogger78.error("Error processing cron prompt:", error);
|
|
114888
114962
|
const msg = error instanceof Error ? error.message : String(error);
|
|
114889
114963
|
await this.messageEmitter.emitAgentMessage(`[cron error] ${msg}`);
|
|
114890
114964
|
} finally {
|
|
@@ -114966,7 +115040,7 @@ ${this.pendingWorktreeNotice}
|
|
|
114966
115040
|
#enqueueBackgroundNotification(item) {
|
|
114967
115041
|
while (this.notificationQueue.length >= MAX_NOTIFICATION_QUEUE) {
|
|
114968
115042
|
const evicted = this.notificationQueue.shift();
|
|
114969
|
-
|
|
115043
|
+
debugLogger78.warn(
|
|
114970
115044
|
`Notification queue overflow: evicting task=${evicted.taskId} kind=${evicted.kind}`
|
|
114971
115045
|
);
|
|
114972
115046
|
}
|
|
@@ -115122,14 +115196,14 @@ ${this.pendingWorktreeNotice}
|
|
|
115122
115196
|
await this.#emitBackgroundNotificationEndTurn("cancelled");
|
|
115123
115197
|
return;
|
|
115124
115198
|
}
|
|
115125
|
-
|
|
115199
|
+
debugLogger78.error("Error processing background notification:", error);
|
|
115126
115200
|
const msg = error instanceof Error ? error.message : String(error);
|
|
115127
115201
|
try {
|
|
115128
115202
|
await this.messageEmitter.emitAgentMessage(
|
|
115129
115203
|
`[notification error] ${msg}`
|
|
115130
115204
|
);
|
|
115131
115205
|
} catch (emitError) {
|
|
115132
|
-
|
|
115206
|
+
debugLogger78.error(
|
|
115133
115207
|
"Failed to emit background notification error:",
|
|
115134
115208
|
emitError
|
|
115135
115209
|
);
|
|
@@ -115189,7 +115263,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115189
115263
|
source: "background_notification"
|
|
115190
115264
|
});
|
|
115191
115265
|
} catch (error) {
|
|
115192
|
-
|
|
115266
|
+
debugLogger78.debug(
|
|
115193
115267
|
`Background notification end-turn extNotification dropped: ${this.#formatError(error)}`
|
|
115194
115268
|
);
|
|
115195
115269
|
}
|
|
@@ -115209,7 +115283,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115209
115283
|
};
|
|
115210
115284
|
await this.sendUpdate(update);
|
|
115211
115285
|
} catch (error) {
|
|
115212
|
-
|
|
115286
|
+
debugLogger78.error("Error sending available commands update:", error);
|
|
115213
115287
|
}
|
|
115214
115288
|
}
|
|
115215
115289
|
/**
|
|
@@ -115244,7 +115318,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115244
115318
|
sessionId: this.sessionId,
|
|
115245
115319
|
currentModeId: params.modeId
|
|
115246
115320
|
}).catch((error) => {
|
|
115247
|
-
|
|
115321
|
+
debugLogger78.debug("mode-update extNotification failed", error);
|
|
115248
115322
|
});
|
|
115249
115323
|
}
|
|
115250
115324
|
/**
|
|
@@ -115278,7 +115352,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115278
115352
|
sessionId: this.sessionId,
|
|
115279
115353
|
currentModelId: effectiveModelId
|
|
115280
115354
|
}).catch((error) => {
|
|
115281
|
-
|
|
115355
|
+
debugLogger78.debug("model-update extNotification failed", error);
|
|
115282
115356
|
});
|
|
115283
115357
|
if (options.persistDefault ?? true) {
|
|
115284
115358
|
const persistScope = getPersistScopeForModelSelection(this.settings);
|
|
@@ -115330,7 +115404,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115330
115404
|
currentModeId: newModeId,
|
|
115331
115405
|
legacyFrameSent: true
|
|
115332
115406
|
}).catch((error) => {
|
|
115333
|
-
|
|
115407
|
+
debugLogger78.debug("mode-update extNotification failed", error);
|
|
115334
115408
|
});
|
|
115335
115409
|
}
|
|
115336
115410
|
/**
|
|
@@ -115541,7 +115615,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115541
115615
|
forceAutoReviewForAllow
|
|
115542
115616
|
);
|
|
115543
115617
|
if (finalPermission === "allow" && forceAutoReviewForAllow) {
|
|
115544
|
-
|
|
115618
|
+
debugLogger78.info(
|
|
115545
115619
|
`Auto mode: L4 allow overridden by protected-write guard for ${toolName}`
|
|
115546
115620
|
);
|
|
115547
115621
|
}
|
|
@@ -115584,7 +115658,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115584
115658
|
autoModeAllowed = true;
|
|
115585
115659
|
break;
|
|
115586
115660
|
case "blocked":
|
|
115587
|
-
|
|
115661
|
+
debugLogger78.warn(
|
|
115588
115662
|
`Auto mode blocked (${outcome.reason}): tool=${toolName}, ` + formatDenialStateLog(denialState)
|
|
115589
115663
|
);
|
|
115590
115664
|
return earlyErrorResponse(
|
|
@@ -115596,7 +115670,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115596
115670
|
outcome.reason
|
|
115597
115671
|
);
|
|
115598
115672
|
if (wasAutoModeDenialFallback) {
|
|
115599
|
-
|
|
115673
|
+
debugLogger78.warn(
|
|
115600
115674
|
`Auto mode fallback to manual approval (${outcome.reason}): ` + formatDenialStateLog(denialState)
|
|
115601
115675
|
);
|
|
115602
115676
|
}
|
|
@@ -115614,12 +115688,12 @@ ${this.pendingWorktreeNotice}
|
|
|
115614
115688
|
const before = this.config.getAutoModeDenialState();
|
|
115615
115689
|
const after = recordFallbackApprove(before);
|
|
115616
115690
|
if (after === before) {
|
|
115617
|
-
|
|
115691
|
+
debugLogger78.warn(
|
|
115618
115692
|
`Auto mode denial counters already clear after fallback approval: ` + formatDenialStateLog(before)
|
|
115619
115693
|
);
|
|
115620
115694
|
return;
|
|
115621
115695
|
}
|
|
115622
|
-
|
|
115696
|
+
debugLogger78.warn(
|
|
115623
115697
|
`Auto mode denial counters reset after fallback approval: ${formatDenialStateLog(before)} -> ${formatDenialStateLog(after)}`
|
|
115624
115698
|
);
|
|
115625
115699
|
this.config.setAutoModeDenialState(after);
|
|
@@ -115778,7 +115852,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115778
115852
|
return earlyErrorResponse(new Error(blockReason), toolName);
|
|
115779
115853
|
}
|
|
115780
115854
|
if (preHookResult.additionalContext) {
|
|
115781
|
-
|
|
115855
|
+
debugLogger78.debug(
|
|
115782
115856
|
`PreToolUse hook additional context for ${toolName}: ${preHookResult.additionalContext}`
|
|
115783
115857
|
);
|
|
115784
115858
|
}
|
|
@@ -115837,7 +115911,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115837
115911
|
);
|
|
115838
115912
|
if (postHookResult.shouldStop) {
|
|
115839
115913
|
const stopMessage = postHookResult.stopReason || "Execution stopped by PostToolUse hook";
|
|
115840
|
-
|
|
115914
|
+
debugLogger78.info(
|
|
115841
115915
|
`PostToolUse hook requested stop for ${toolName}: ${stopMessage}`
|
|
115842
115916
|
);
|
|
115843
115917
|
return earlyErrorResponse(new Error(stopMessage), toolName);
|
|
@@ -115859,7 +115933,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115859
115933
|
abortSignal
|
|
115860
115934
|
);
|
|
115861
115935
|
if (failureHookResult.additionalContext) {
|
|
115862
|
-
|
|
115936
|
+
debugLogger78.debug(
|
|
115863
115937
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
115864
115938
|
);
|
|
115865
115939
|
}
|
|
@@ -115934,7 +116008,7 @@ ${this.pendingWorktreeNotice}
|
|
|
115934
116008
|
abortSignal
|
|
115935
116009
|
);
|
|
115936
116010
|
if (failureHookResult.additionalContext) {
|
|
115937
|
-
|
|
116011
|
+
debugLogger78.debug(
|
|
115938
116012
|
`PostToolUseFailure hook additional context for ${toolName}: ${failureHookResult.additionalContext}`
|
|
115939
116013
|
);
|
|
115940
116014
|
}
|
|
@@ -116136,7 +116210,7 @@ ${contextPart.text}`
|
|
|
116136
116210
|
}
|
|
116137
116211
|
debug(msg) {
|
|
116138
116212
|
if (this.config.getDebugMode()) {
|
|
116139
|
-
|
|
116213
|
+
debugLogger78.warn(msg);
|
|
116140
116214
|
}
|
|
116141
116215
|
}
|
|
116142
116216
|
/**
|
|
@@ -116156,7 +116230,7 @@ ${contextPart.text}`
|
|
|
116156
116230
|
}
|
|
116157
116231
|
);
|
|
116158
116232
|
}).catch((err) => {
|
|
116159
|
-
|
|
116233
|
+
debugLogger78.debug(
|
|
116160
116234
|
`ACP terminalSequence notification dropped (session=${this.sessionId}): ${err instanceof Error ? err.message : String(err)}`
|
|
116161
116235
|
);
|
|
116162
116236
|
});
|
|
@@ -116267,7 +116341,7 @@ function runWithAcpRuntimeOutputDir(settings, cwd5, fn) {
|
|
|
116267
116341
|
__name(runWithAcpRuntimeOutputDir, "runWithAcpRuntimeOutputDir");
|
|
116268
116342
|
|
|
116269
116343
|
// packages/cli/src/acp-integration/acpAgent.ts
|
|
116270
|
-
var
|
|
116344
|
+
var debugLogger79 = createDebugLogger("ACP_AGENT");
|
|
116271
116345
|
var BTW_CHILD_TIMEOUT_MS = 55e3;
|
|
116272
116346
|
function sanitizeProviderBaseUrl(baseUrl) {
|
|
116273
116347
|
const scheme = baseUrl.match(/^[A-Za-z][A-Za-z\d+.-]*:\/\//);
|
|
@@ -116924,7 +116998,7 @@ async function downloadGitHubSkillDirectory(githubUrl, directoryPath) {
|
|
|
116924
116998
|
githubUrl,
|
|
116925
116999
|
directoryPath
|
|
116926
117000
|
).catch((error) => {
|
|
116927
|
-
|
|
117001
|
+
debugLogger79.warn(
|
|
116928
117002
|
"GitHub API directory listing failed, falling back to archive download:",
|
|
116929
117003
|
error
|
|
116930
117004
|
);
|
|
@@ -117543,7 +117617,7 @@ function readMcpServers(source, scope) {
|
|
|
117543
117617
|
const server = toMcpServerConfig(value);
|
|
117544
117618
|
return server ? { name, scope, server: redactMcpServerSecrets(server) } : void 0;
|
|
117545
117619
|
} catch (error) {
|
|
117546
|
-
|
|
117620
|
+
debugLogger79.warn(
|
|
117547
117621
|
`Skipping malformed MCP server config [${scope}:${name}]:`,
|
|
117548
117622
|
error
|
|
117549
117623
|
);
|
|
@@ -117639,7 +117713,7 @@ function readHooks(source, scope, extensionName) {
|
|
|
117639
117713
|
extensionName
|
|
117640
117714
|
});
|
|
117641
117715
|
} catch (error) {
|
|
117642
|
-
|
|
117716
|
+
debugLogger79.warn(
|
|
117643
117717
|
`Skipping malformed hook entry [${scope}:${event}:${index}]:`,
|
|
117644
117718
|
error
|
|
117645
117719
|
);
|
|
@@ -117716,7 +117790,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
117716
117790
|
try {
|
|
117717
117791
|
await agentInstance.shutdownMcpPool(8e3);
|
|
117718
117792
|
} catch (err) {
|
|
117719
|
-
|
|
117793
|
+
debugLogger79.error(`[ACP] MCP pool drain (${label}) error:`, err);
|
|
117720
117794
|
}
|
|
117721
117795
|
}, "drainPoolBeforeExit");
|
|
117722
117796
|
let shuttingDown = false;
|
|
@@ -117743,7 +117817,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
117743
117817
|
try {
|
|
117744
117818
|
await hookSystem.fireSessionEndEvent(reason);
|
|
117745
117819
|
} catch (err) {
|
|
117746
|
-
|
|
117820
|
+
debugLogger79.warn(
|
|
117747
117821
|
`SessionEnd hook failed: ${err instanceof Error ? err.message : String(err)}`
|
|
117748
117822
|
);
|
|
117749
117823
|
}
|
|
@@ -117752,7 +117826,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
117752
117826
|
const shutdownHandler = /* @__PURE__ */ __name(async () => {
|
|
117753
117827
|
if (shuttingDown) return;
|
|
117754
117828
|
shuttingDown = true;
|
|
117755
|
-
|
|
117829
|
+
debugLogger79.debug("[ACP] Shutdown signal received, closing streams");
|
|
117756
117830
|
await fireSessionEndOnce("other" /* Other */);
|
|
117757
117831
|
agentInstance?.disposeSessions();
|
|
117758
117832
|
try {
|
|
@@ -117765,7 +117839,7 @@ async function runAcpAgent(config, settings, argv) {
|
|
|
117765
117839
|
}
|
|
117766
117840
|
await drainPoolBeforeExit("signal");
|
|
117767
117841
|
runExitCleanup().catch((err) => {
|
|
117768
|
-
|
|
117842
|
+
debugLogger79.error("[ACP] Cleanup error:", err);
|
|
117769
117843
|
}).finally(() => {
|
|
117770
117844
|
process.exit(0);
|
|
117771
117845
|
});
|
|
@@ -117918,12 +117992,12 @@ var QwenAgent = class {
|
|
|
117918
117992
|
try {
|
|
117919
117993
|
const result = await this.mcpPool.drainAll({ force: true, timeoutMs });
|
|
117920
117994
|
if (result.forced > 0 || result.errors.length > 0) {
|
|
117921
|
-
|
|
117995
|
+
debugLogger79.warn(
|
|
117922
117996
|
`MCP pool drain: ${result.drained} clean, ${result.forced} timed out, ${result.errors.length} errors`
|
|
117923
117997
|
);
|
|
117924
117998
|
}
|
|
117925
117999
|
} catch (err) {
|
|
117926
|
-
|
|
118000
|
+
debugLogger79.error(
|
|
117927
118001
|
`MCP pool drainAll failed: ${err instanceof Error ? err.message : String(err)}`
|
|
117928
118002
|
);
|
|
117929
118003
|
}
|
|
@@ -117937,14 +118011,14 @@ var QwenAgent = class {
|
|
|
117937
118011
|
try {
|
|
117938
118012
|
await session2.cancelPendingPrompt();
|
|
117939
118013
|
} catch (err) {
|
|
117940
|
-
|
|
118014
|
+
debugLogger79.debug(
|
|
117941
118015
|
`Session ${sessionId} cancel during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
117942
118016
|
);
|
|
117943
118017
|
}
|
|
117944
118018
|
try {
|
|
117945
118019
|
await session2.getConfig().getToolRegistry()?.stop();
|
|
117946
118020
|
} catch (err) {
|
|
117947
|
-
|
|
118021
|
+
debugLogger79.debug(
|
|
117948
118022
|
`Session ${sessionId} tool registry stop during close failed: ${err instanceof Error ? err.message : String(err)}`
|
|
117949
118023
|
);
|
|
117950
118024
|
}
|
|
@@ -117978,7 +118052,7 @@ var QwenAgent = class {
|
|
|
117978
118052
|
scope: "workspace",
|
|
117979
118053
|
...event
|
|
117980
118054
|
}).catch((err) => {
|
|
117981
|
-
|
|
118055
|
+
debugLogger79.debug(
|
|
117982
118056
|
`MCP workspace budget event delivery to session ${sid} failed (kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
117983
118057
|
);
|
|
117984
118058
|
});
|
|
@@ -117987,12 +118061,12 @@ var QwenAgent = class {
|
|
|
117987
118061
|
async initialize(args) {
|
|
117988
118062
|
this.clientCapabilities = args.clientCapabilities;
|
|
117989
118063
|
const authMethods = buildAuthMethods();
|
|
117990
|
-
const version = "0.1.
|
|
118064
|
+
const version = "0.1.1";
|
|
117991
118065
|
return {
|
|
117992
118066
|
protocolVersion: PROTOCOL_VERSION,
|
|
117993
118067
|
agentInfo: {
|
|
117994
|
-
name: "
|
|
117995
|
-
title: "Sara",
|
|
118068
|
+
name: "erdium-sara",
|
|
118069
|
+
title: "Erdium Sara",
|
|
117996
118070
|
version
|
|
117997
118071
|
},
|
|
117998
118072
|
authMethods,
|
|
@@ -118142,7 +118216,7 @@ var QwenAgent = class {
|
|
|
118142
118216
|
session2.pendingWorktreeNotice = restored.contextMessage;
|
|
118143
118217
|
}
|
|
118144
118218
|
} catch (error) {
|
|
118145
|
-
|
|
118219
|
+
debugLogger79.warn(`ACP worktree restore failed: ${error}`);
|
|
118146
118220
|
}
|
|
118147
118221
|
}
|
|
118148
118222
|
async unstable_listSessions(params) {
|
|
@@ -118277,7 +118351,7 @@ var QwenAgent = class {
|
|
|
118277
118351
|
await extensionManager.refreshCache();
|
|
118278
118352
|
extensions = extensionManager.getLoadedExtensions();
|
|
118279
118353
|
} catch (error) {
|
|
118280
|
-
|
|
118354
|
+
debugLogger79.warn(
|
|
118281
118355
|
"Extension loading failed, continuing without extensions:",
|
|
118282
118356
|
error
|
|
118283
118357
|
);
|
|
@@ -118395,7 +118469,7 @@ var QwenAgent = class {
|
|
|
118395
118469
|
pm.addPersistentRule(rule, ruleType);
|
|
118396
118470
|
}
|
|
118397
118471
|
} catch (error) {
|
|
118398
|
-
|
|
118472
|
+
debugLogger79.warn(
|
|
118399
118473
|
`Failed to sync permission rules to a live session: ${error instanceof Error ? error.message : String(error)}`
|
|
118400
118474
|
);
|
|
118401
118475
|
}
|
|
@@ -120264,7 +120338,7 @@ var QwenAgent = class {
|
|
|
120264
120338
|
try {
|
|
120265
120339
|
await setLanguageAsync(language);
|
|
120266
120340
|
} catch (err) {
|
|
120267
|
-
|
|
120341
|
+
debugLogger79.warn("setLanguageAsync failed:", err);
|
|
120268
120342
|
throw new RequestError(
|
|
120269
120343
|
-32603,
|
|
120270
120344
|
`Failed to switch UI language: ${err instanceof Error ? err.message : String(err)}`
|
|
@@ -120278,7 +120352,7 @@ var QwenAgent = class {
|
|
|
120278
120352
|
language
|
|
120279
120353
|
);
|
|
120280
120354
|
} catch (err) {
|
|
120281
|
-
|
|
120355
|
+
debugLogger79.warn("Failed to persist UI language setting:", err);
|
|
120282
120356
|
}
|
|
120283
120357
|
let outputLanguage = null;
|
|
120284
120358
|
let refreshed = false;
|
|
@@ -120293,7 +120367,7 @@ var QwenAgent = class {
|
|
|
120293
120367
|
);
|
|
120294
120368
|
fileWriteOk = true;
|
|
120295
120369
|
} catch (err) {
|
|
120296
|
-
|
|
120370
|
+
debugLogger79.warn("Failed to write output-language.md:", err);
|
|
120297
120371
|
}
|
|
120298
120372
|
if (fileWriteOk) {
|
|
120299
120373
|
try {
|
|
@@ -120303,7 +120377,7 @@ var QwenAgent = class {
|
|
|
120303
120377
|
settingValue
|
|
120304
120378
|
);
|
|
120305
120379
|
} catch (err) {
|
|
120306
|
-
|
|
120380
|
+
debugLogger79.warn(
|
|
120307
120381
|
"Failed to persist output language setting:",
|
|
120308
120382
|
err
|
|
120309
120383
|
);
|
|
@@ -120323,7 +120397,7 @@ var QwenAgent = class {
|
|
|
120323
120397
|
writeOutputLanguageAndRegisterPath(settingValue, cfg);
|
|
120324
120398
|
}
|
|
120325
120399
|
} catch (err) {
|
|
120326
|
-
|
|
120400
|
+
debugLogger79.warn(
|
|
120327
120401
|
`Failed to write output-language.md for session ${s.getId()} (path=${sessionPath ?? "global-default"}):`,
|
|
120328
120402
|
err
|
|
120329
120403
|
);
|
|
@@ -120336,7 +120410,7 @@ var QwenAgent = class {
|
|
|
120336
120410
|
(r) => r.status === "rejected"
|
|
120337
120411
|
).length;
|
|
120338
120412
|
if (failedCount > 0) {
|
|
120339
|
-
|
|
120413
|
+
debugLogger79.warn(
|
|
120340
120414
|
`Language refresh failed for ${failedCount}/${results.length} session(s)`
|
|
120341
120415
|
);
|
|
120342
120416
|
}
|
|
@@ -120354,14 +120428,14 @@ var QwenAgent = class {
|
|
|
120354
120428
|
"Invalid or missing sessionId"
|
|
120355
120429
|
);
|
|
120356
120430
|
}
|
|
120357
|
-
|
|
120431
|
+
debugLogger79.debug(`recap ext-method received for session=${sessionId}`);
|
|
120358
120432
|
const session2 = this.sessionOrThrow(sessionId);
|
|
120359
120433
|
const config = session2.getConfig();
|
|
120360
120434
|
const recap = await generateSessionRecap(
|
|
120361
120435
|
config,
|
|
120362
120436
|
new AbortController().signal
|
|
120363
120437
|
);
|
|
120364
|
-
|
|
120438
|
+
debugLogger79.debug(
|
|
120365
120439
|
`recap ext-method completed for session=${sessionId} result=${recap ? `len=${recap.length}` : "null"}`
|
|
120366
120440
|
);
|
|
120367
120441
|
return { sessionId, recap };
|
|
@@ -120385,7 +120459,7 @@ var QwenAgent = class {
|
|
|
120385
120459
|
const config = session2.getConfig();
|
|
120386
120460
|
const cacheSafeParams = buildBtwCacheSafeParams(config);
|
|
120387
120461
|
if (!cacheSafeParams) {
|
|
120388
|
-
|
|
120462
|
+
debugLogger79.debug(`btw: no cacheSafeParams for session=${sessionId}`);
|
|
120389
120463
|
return { sessionId, answer: null };
|
|
120390
120464
|
}
|
|
120391
120465
|
const childSignal = AbortSignal.timeout(BTW_CHILD_TIMEOUT_MS);
|
|
@@ -120467,7 +120541,7 @@ ${outputText}
|
|
|
120467
120541
|
'taskKind must be "agent", "shell", or "monitor"'
|
|
120468
120542
|
);
|
|
120469
120543
|
}
|
|
120470
|
-
|
|
120544
|
+
debugLogger79.info(
|
|
120471
120545
|
`sessionTaskCancel requested sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind}`
|
|
120472
120546
|
);
|
|
120473
120547
|
const session2 = this.sessionOrThrow(sessionId);
|
|
@@ -120477,7 +120551,7 @@ ${outputText}
|
|
|
120477
120551
|
const task = config.getBackgroundTaskRegistry().get(taskId2);
|
|
120478
120552
|
if (!task || task.status !== "running" && task.status !== "paused") {
|
|
120479
120553
|
const reason = task ? "not_running" : "not_found";
|
|
120480
|
-
|
|
120554
|
+
debugLogger79.info(
|
|
120481
120555
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
120482
120556
|
);
|
|
120483
120557
|
return { cancelled: false, reason, status: task?.status };
|
|
@@ -120487,7 +120561,7 @@ ${outputText}
|
|
|
120487
120561
|
} else {
|
|
120488
120562
|
config.getBackgroundTaskRegistry().cancel(taskId2);
|
|
120489
120563
|
}
|
|
120490
|
-
|
|
120564
|
+
debugLogger79.info(
|
|
120491
120565
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} status=${task.status}`
|
|
120492
120566
|
);
|
|
120493
120567
|
return { cancelled: true, status: task.status };
|
|
@@ -120496,13 +120570,13 @@ ${outputText}
|
|
|
120496
120570
|
const task = config.getBackgroundShellRegistry().get(taskId2);
|
|
120497
120571
|
if (!task || task.status !== "running") {
|
|
120498
120572
|
const reason = task ? "not_running" : "not_found";
|
|
120499
|
-
|
|
120573
|
+
debugLogger79.info(
|
|
120500
120574
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
120501
120575
|
);
|
|
120502
120576
|
return { cancelled: false, reason, status: task?.status };
|
|
120503
120577
|
}
|
|
120504
120578
|
config.getBackgroundShellRegistry().requestCancel(taskId2);
|
|
120505
|
-
|
|
120579
|
+
debugLogger79.info(
|
|
120506
120580
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} status=${task.status}`
|
|
120507
120581
|
);
|
|
120508
120582
|
return { cancelled: true, status: task.status };
|
|
@@ -120511,13 +120585,13 @@ ${outputText}
|
|
|
120511
120585
|
const task = config.getMonitorRegistry().get(taskId2);
|
|
120512
120586
|
if (!task || task.status !== "running") {
|
|
120513
120587
|
const reason = task ? "not_running" : "not_found";
|
|
120514
|
-
|
|
120588
|
+
debugLogger79.info(
|
|
120515
120589
|
`sessionTaskCancel skipped sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} reason=${reason} status=${task?.status ?? "missing"}`
|
|
120516
120590
|
);
|
|
120517
120591
|
return { cancelled: false, reason, status: task?.status };
|
|
120518
120592
|
}
|
|
120519
120593
|
config.getMonitorRegistry().cancel(taskId2);
|
|
120520
|
-
|
|
120594
|
+
debugLogger79.info(
|
|
120521
120595
|
`sessionTaskCancel completed sessionId=${sessionId} taskId=${taskId2} taskKind=${taskKind} status=${task.status}`
|
|
120522
120596
|
);
|
|
120523
120597
|
return { cancelled: true, status: task.status };
|
|
@@ -120539,7 +120613,7 @@ ${outputText}
|
|
|
120539
120613
|
const session2 = this.sessionOrThrow(sessionId);
|
|
120540
120614
|
const config = session2.getConfig();
|
|
120541
120615
|
const cleared = unregisterGoalHook(config, sessionId);
|
|
120542
|
-
|
|
120616
|
+
debugLogger79.info(
|
|
120543
120617
|
`sessionGoalClear sessionId=${sessionId} cleared=${!!cleared} condition=${cleared?.condition ?? "(none)"}`
|
|
120544
120618
|
);
|
|
120545
120619
|
return {
|
|
@@ -120798,7 +120872,7 @@ ${outputText}
|
|
|
120798
120872
|
filesFailed = fileResult.filesFailed;
|
|
120799
120873
|
} catch (err) {
|
|
120800
120874
|
const reason = err instanceof Error ? err.message : String(err);
|
|
120801
|
-
|
|
120875
|
+
debugLogger79.error(
|
|
120802
120876
|
`[ACP] File-history rewind failed for session=${sessionId} promptId=${promptId}: ${reason}`
|
|
120803
120877
|
);
|
|
120804
120878
|
filesFailed = [`file-history-rewind: ${reason}`];
|
|
@@ -120846,7 +120920,7 @@ ${outputText}
|
|
|
120846
120920
|
);
|
|
120847
120921
|
} catch (error) {
|
|
120848
120922
|
replayError = error instanceof Error ? error.message : String(error);
|
|
120849
|
-
|
|
120923
|
+
debugLogger79.warn(
|
|
120850
120924
|
"[loadUpdates] History replay failed for session %s (partial updates: %d):",
|
|
120851
120925
|
sessionId,
|
|
120852
120926
|
updates.length,
|
|
@@ -121186,7 +121260,7 @@ ${outputText}
|
|
|
121186
121260
|
try {
|
|
121187
121261
|
config.reloadModelProvidersConfig(newMerged.modelProviders);
|
|
121188
121262
|
} catch (err) {
|
|
121189
|
-
|
|
121263
|
+
debugLogger79.warn(
|
|
121190
121264
|
`reload: reloadModelProvidersConfig failed for session ${id}: ${err}`
|
|
121191
121265
|
);
|
|
121192
121266
|
}
|
|
@@ -121196,7 +121270,7 @@ ${outputText}
|
|
|
121196
121270
|
try {
|
|
121197
121271
|
await config.switchModel(authType, newModelName);
|
|
121198
121272
|
} catch (err) {
|
|
121199
|
-
|
|
121273
|
+
debugLogger79.warn(
|
|
121200
121274
|
`reload: switchModel failed for session ${id}: ${err}`
|
|
121201
121275
|
);
|
|
121202
121276
|
}
|
|
@@ -121204,7 +121278,7 @@ ${outputText}
|
|
|
121204
121278
|
try {
|
|
121205
121279
|
await config.refreshAuth(authType);
|
|
121206
121280
|
} catch (err) {
|
|
121207
|
-
|
|
121281
|
+
debugLogger79.warn(
|
|
121208
121282
|
`reload: refreshAuth failed for session ${id}: ${err}`
|
|
121209
121283
|
);
|
|
121210
121284
|
}
|
|
@@ -121219,7 +121293,7 @@ ${outputText}
|
|
|
121219
121293
|
try {
|
|
121220
121294
|
config.setApprovalMode(newMode);
|
|
121221
121295
|
} catch (err) {
|
|
121222
|
-
|
|
121296
|
+
debugLogger79.warn(
|
|
121223
121297
|
`reload: setApprovalMode failed for session ${id}: ${err}`
|
|
121224
121298
|
);
|
|
121225
121299
|
}
|
|
@@ -121228,14 +121302,14 @@ ${outputText}
|
|
|
121228
121302
|
try {
|
|
121229
121303
|
await config.refreshHierarchicalMemory();
|
|
121230
121304
|
} catch (err) {
|
|
121231
|
-
|
|
121305
|
+
debugLogger79.warn(
|
|
121232
121306
|
`reload: refreshHierarchicalMemory failed for session ${id}: ${err}`
|
|
121233
121307
|
);
|
|
121234
121308
|
}
|
|
121235
121309
|
try {
|
|
121236
121310
|
await config.getGeminiClient()?.refreshSystemInstruction();
|
|
121237
121311
|
} catch (err) {
|
|
121238
|
-
|
|
121312
|
+
debugLogger79.warn(
|
|
121239
121313
|
`reload: refreshSystemInstruction failed for session ${id}: ${err}`
|
|
121240
121314
|
);
|
|
121241
121315
|
}
|
|
@@ -121245,7 +121319,7 @@ ${outputText}
|
|
|
121245
121319
|
for (let i = 0; i < results.length; i++) {
|
|
121246
121320
|
if (results[i].status === "rejected") {
|
|
121247
121321
|
const reason = results[i].reason;
|
|
121248
|
-
|
|
121322
|
+
debugLogger79.warn(
|
|
121249
121323
|
`Session ${sessions[i][0]} reload failed: ${reason}`
|
|
121250
121324
|
);
|
|
121251
121325
|
skipped.push(sessions[i][0]);
|
|
@@ -121356,7 +121430,7 @@ ${outputText}
|
|
|
121356
121430
|
sessionId: sid,
|
|
121357
121431
|
...event
|
|
121358
121432
|
}).catch((err) => {
|
|
121359
|
-
|
|
121433
|
+
debugLogger79.debug(
|
|
121360
121434
|
`MCP budget extNotification dropped (session=${sid}, kind=${event.kind}): ${err instanceof Error ? err.message : String(err)}`
|
|
121361
121435
|
);
|
|
121362
121436
|
});
|
|
@@ -121384,7 +121458,7 @@ ${outputText}
|
|
|
121384
121458
|
try {
|
|
121385
121459
|
await config.refreshAuth(selectedType, true);
|
|
121386
121460
|
} catch (e) {
|
|
121387
|
-
|
|
121461
|
+
debugLogger79.error(`Authentication failed: ${e}`);
|
|
121388
121462
|
throw RequestError.authRequired(
|
|
121389
121463
|
{
|
|
121390
121464
|
authMethods: pickAuthMethodsForAuthRequired(selectedType)
|
|
@@ -121529,7 +121603,7 @@ __name(diffSettingsKeys, "diffSettingsKeys");
|
|
|
121529
121603
|
|
|
121530
121604
|
// packages/cli/src/gemini.tsx
|
|
121531
121605
|
var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1);
|
|
121532
|
-
var
|
|
121606
|
+
var debugLogger80 = createDebugLogger("STARTUP");
|
|
121533
121607
|
function clearCorruptionEnvVars() {
|
|
121534
121608
|
delete process.env[ENV_CORRUPTED_PATH];
|
|
121535
121609
|
delete process.env[ENV_WAS_RECOVERED];
|
|
@@ -121608,7 +121682,7 @@ function installInteractiveSignalHandlers(wasRaw) {
|
|
|
121608
121682
|
}
|
|
121609
121683
|
cleanupStarted = true;
|
|
121610
121684
|
void runExitCleanup().catch((error) => {
|
|
121611
|
-
|
|
121685
|
+
debugLogger80.error(`Error during ${signal} cleanup:`, error);
|
|
121612
121686
|
}).finally(() => {
|
|
121613
121687
|
process.exit(getSignalExitCode(signal));
|
|
121614
121688
|
});
|
|
@@ -121663,7 +121737,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
121663
121737
|
);
|
|
121664
121738
|
}
|
|
121665
121739
|
} catch (err) {
|
|
121666
|
-
|
|
121740
|
+
debugLogger80.error("Failed to initialize dual output bridge:", err);
|
|
121667
121741
|
writeStderrLine(
|
|
121668
121742
|
`Warning: dual output disabled \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
121669
121743
|
);
|
|
@@ -121674,7 +121748,7 @@ async function startInteractiveUI(config, settings, startupWarnings, workspaceRo
|
|
|
121674
121748
|
try {
|
|
121675
121749
|
remoteInputWatcher = new RemoteInputWatcher(inputFile);
|
|
121676
121750
|
} catch (err) {
|
|
121677
|
-
|
|
121751
|
+
debugLogger80.error("Failed to initialize remote input watcher:", err);
|
|
121678
121752
|
writeStderrLine(
|
|
121679
121753
|
`Warning: remote input disabled \u2014 ${err instanceof Error ? err.message : String(err)}`
|
|
121680
121754
|
);
|
|
@@ -121984,7 +122058,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
121984
122058
|
)
|
|
121985
122059
|
);
|
|
121986
122060
|
} catch (error) {
|
|
121987
|
-
|
|
122061
|
+
debugLogger80.warn(
|
|
121988
122062
|
`--worktree sidecar persist failed (non-fatal, notice preserved): ${error instanceof Error ? error.message : String(error)}`
|
|
121989
122063
|
);
|
|
121990
122064
|
}
|
|
@@ -122014,7 +122088,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
122014
122088
|
const proxy = config.getProxy();
|
|
122015
122089
|
preconnectApi(authType, { resolvedBaseUrl, proxy });
|
|
122016
122090
|
} catch (error) {
|
|
122017
|
-
|
|
122091
|
+
debugLogger80.debug(
|
|
122018
122092
|
`Preconnect skipped due to error getting authType: ${error}`
|
|
122019
122093
|
);
|
|
122020
122094
|
}
|
|
@@ -122031,7 +122105,7 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
122031
122105
|
kittyProtocolDetectionComplete = detectAndEnableKittyProtocol();
|
|
122032
122106
|
if (!configuredTheme || configuredTheme === AUTO_THEME_NAME) {
|
|
122033
122107
|
themeAutoDetectionComplete = themeManager.resolveAutoThemeAsync().catch((err) => {
|
|
122034
|
-
|
|
122108
|
+
debugLogger80.warn("Async theme auto-detection failed:", err);
|
|
122035
122109
|
});
|
|
122036
122110
|
}
|
|
122037
122111
|
}
|
|
@@ -122045,8 +122119,8 @@ ${finalArgs[promptIndex + 1]}`;
|
|
|
122045
122119
|
process.exit(0);
|
|
122046
122120
|
}
|
|
122047
122121
|
if (config.isInteractive()) {
|
|
122048
|
-
void import("./chunks/scheduler-
|
|
122049
|
-
|
|
122122
|
+
void import("./chunks/scheduler-N2ZZP6JD.js").then((m) => m.startBackgroundHousekeeping(config, settings)).catch((err) => {
|
|
122123
|
+
debugLogger80.warn("failed to start background housekeeping:", err);
|
|
122050
122124
|
});
|
|
122051
122125
|
}
|
|
122052
122126
|
let input = config.getQuestion();
|
|
@@ -122157,7 +122231,7 @@ ${input}`;
|
|
|
122157
122231
|
auth_type: config.getContentGeneratorConfig()?.authType,
|
|
122158
122232
|
prompt_length: input.length
|
|
122159
122233
|
});
|
|
122160
|
-
|
|
122234
|
+
debugLogger80.debug(`Session ID: ${config.getSessionId()}`);
|
|
122161
122235
|
const exitCode = await runNonInteractive(
|
|
122162
122236
|
nonInteractiveConfig,
|
|
122163
122237
|
settings,
|