@yeaft/webchat-agent 1.0.381 → 1.0.382

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.
@@ -1 +1 @@
1
- {"version":"1.0.381"}
1
+ {"version":"1.0.382"}
@@ -7302,7 +7302,7 @@ ${String(e||"").trim()}
7302
7302
  </div>
7303
7303
  </Teleport>
7304
7304
  `}});function Pw(e){let t=String(e||"").trim();return t?t.startsWith("[")&&t.endsWith("]")?Fh(t.slice(1,-1)).map(s=>s.trim().replace(/^["']|["']$/g,"")).map(s=>Bh(s)).filter(Boolean):Fh(t).map(s=>Bh(s.trim())).filter(Boolean):[]}function Fh(e){let t=[],s="",n=0,r="",i=!1;for(let o of String(e||"")){if(i){s+=o,i=!1;continue}if(o==="\\"&&r){s+=o,i=!0;continue}if(r){s+=o,o===r&&(r="");continue}if(o==='"'||o==="'"){r=o,s+=o;continue}if((o==="{"||o==="[")&&(n+=1),(o==="}"||o==="]")&&n>0&&(n-=1),o===","&&n===0){s.trim()&&t.push(s.trim()),s="";continue}s+=o}return s.trim()&&t.push(s.trim()),t}function Bh(e){let t=String(e||"").trim();if(!t||t==="[object Object]")return"";if(t.startsWith("{")&&t.endsWith("}"))try{let s=JSON.parse(t);return String(s.id||s.messageId||s.uuid||"").trim()}catch{return""}return t}function Rw(e){let t={},s=String(e||"").split(/\r?\n/);for(let n of s){let r=n.match(/^([A-Za-z][A-Za-z0-9_-]*):\s*(.*)$/);if(!r)continue;let i=r[1],o=r[2].trim();i==="tags"||i==="sourceMessages"?t[i]=Pw(o):t[i]=o.replace(/^["']|["']$/g,"")}return t}function _w(e){let t=String(e||"").trim();if(!t)return[];let s=[],n=/(?:^|\n)---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*?)(?=\n---\s*\n|$)/g;for(let r of t.matchAll(n)){let i=r[1].trim(),o=r[2].trim(),a=Rw(i);s.push({id:a.id||`segment-${s.length+1}`,scope:a.scope||"",kind:a.kind||"memory",tags:Array.isArray(a.tags)?a.tags:[],sourceMessages:Array.isArray(a.sourceMessages)?a.sourceMessages:[],createdAt:a.createdAt||"",updatedAt:a.updatedAt||"",content:o,preview:Pn(o,180)})}return s.length?s:[{id:"memory-1",scope:"",kind:"raw",tags:[],sourceMessages:[],createdAt:"",updatedAt:"",content:t,preview:Pn(t,180)}]}function Pn(e,t=160){let s=String(e||"").replace(/\s+/g," ").trim();return s.length<=t?s:`${s.slice(0,t).trim()}...`}function Ew(e){let t=String(e||"").trim();return t?(t.split(/\r?\n/).map(n=>n.trim()).find(Boolean)||"").replace(/^#+\s*/,"").replace(/^[-*]\s*/,"").trim():""}function Dw(e){return String(e||"").replace(/\s+/g," ").trim()}function Nh(e,t){return t?.sessionId||String(e||"").replace(/^sessions\//,"")}function Lw(e,t,s){let n=Nh(e,t);return Dw(s?.[e]||s?.[n]||t?.sessionTitle||t?.title||t?.name||Ew(t?.summaryText))||n||e}function qh(e,t){let s=String(t||"").trim().toLowerCase();return s?(Array.isArray(e)?e:[]).filter(n=>[n.title,n.scope,n.sessionId,n.status,n.summaryPreview,n.snapshot?.summaryText].map(i=>String(i||"").toLowerCase()).join(`
7305
- `).includes(s)):Array.isArray(e)?e:[]}function Wh({latest:e={},snapshots:t={},promptLoads:s={},events:n=[],sessionTitles:r={}}={}){let i=new Set([...Object.keys(e||{}),...Object.keys(t||{}),...Object.keys(s||{})]);for(let o of Array.isArray(n)?n:[])o?.scope&&i.add(o.scope);return Array.from(i).map(o=>{let a=t?.[o]||null,l=e?.[o]||null,c=a?.lastError||l?.error||null,d=l?.status||(c?"error":a?.hasOutput?"completed":"never-ran"),u=s?.[o]||null,f=(Array.isArray(n)?n:[]).filter(b=>b?.scope===o),p=f[f.length-1]||null,g=l?.finishedAt||l?.startedAt||a?.lastDreamAt||p?.at||a?.loadedAt||"",h=_w(a?.memoryText||""),y=Nh(o,a),k=Lw(o,a,r),w=c?Pn(c.message||c.error||c.raw||"",180):"",I=Pn(w||a?.summaryText||a?.memoryText||p?.detail||"",180);return{key:o,title:k,scope:o,sessionId:y,status:d,lastAt:g,latestRun:l,snapshot:a,lastError:c,promptLoad:u,events:f,segmentCount:h.length,segments:h,summaryPreview:I,subtitle:I,hasRequestResponse:f.some(b=>b?.request||b?.response||b?.systemPrompt||b?.rawRequest||b?.rawResponse)}}).sort((o,a)=>String(a.lastAt||"").localeCompare(String(o.lastAt||"")))}var jh=B(()=>{});var Uh,$w,Kh,zh=B(()=>{jh();Oa();Uh=1,$w=5,Kh={name:"YeaftDebugPanel",emits:["close"],data(){return{expandedTurns:{},expandedLoops:{},expandedSections:{},expandedToolDetails:{},copiedFlash:null,copiedFlashAt:0,_expandSnapshot:null,dreamExpanded:!1,expandedDreamEvents:{},expandedDreamSegments:{},activeDreamItemKey:null,dreamItemSearch:"",activeTab:"requests"}},watch:{turns(e,t){let s=e&&e[0];!s||!s.turnId||(t&&t[0]&&t[0].turnId)===s.turnId&&this.expandedTurns[s.turnId]||(this.expandedTurns={...this.expandedTurns,[s.turnId]:!0},this.ensureRequestDetailLoaded(s.turnId))},searchQuery(e,t){let s=!!(t&&t.trim()),n=!!(e&&e.trim());if(!s&&n){this._expandSnapshot={turns:{...this.expandedTurns},loops:{...this.expandedLoops}};let r={},i={};for(let o of this.turns)r[o.turnId]=!0,o.loops&&o.loops.length>0&&(i[`${o.turnId}#${o.loops[0].loopNumber}`]=!0);this.expandedTurns=r,this.expandedLoops=i}else if(s&&!n&&this._expandSnapshot)this.expandedTurns=this._expandSnapshot.turns,this.expandedLoops=this._expandSnapshot.loops,this._expandSnapshot=null;else if(n){let r={...this.expandedTurns};for(let i of this.turns)r[i.turnId]===void 0&&(r[i.turnId]=!0);this.expandedTurns=r}}},computed:{store(){return window.Pinia?.useChatStore?.()||null},sessionsStore(){return window.Pinia?.useSessionsStore?.()||null},turns(){let e=this.store&&this.store.yeaftDebugPanel||{},t=e.turnId?this.store&&this.store.yeaftDebugTurnsById&&this.store.yeaftDebugTurnsById[e.turnId]:null;return t?[this.decorateTurnTokenBreakdowns(t)]:[]},currentTurnId(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.turnId||""},currentTurnSessionId(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.sessionId||""},panelStatus(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.status||"idle"},panelLoading(){return this.panelStatus==="loading"},searchQuery:{get(){return this.store&&this.store.yeaftDebugSearch||""},set(e){this.store&&this.store.setYeaftDebugSearch(e)}},sessionFilter:{get(){if(!this.store)return"";let e=this.store.yeaftDebugSessionFilter;return e??""},set(e){this.store&&(e?this.store.setYeaftDebugSessionFilter(e):this.store.setYeaftDebugSessionFilter(null))}},availableSessions(){return this.store&&this.store.yeaftDebugAvailableSessions||[]},turnTotal(){return this.store&&this.store.yeaftDebugTurnTotal||0},showingMatchedHint(){return this.turnTotal>this.turns.length},requestHistoryLoading(){return!!this.store?.yeaftDebugHistoryLoading},requestHistoryError(){return this.store?.yeaftDebugHistoryError||""},toolStats(){return this.store?.yeaftToolStats||null},toolStatsLoading(){return!!this.store?.yeaftToolStatsLoading},rankedToolRows(){let e=this.toolStats?.snapshot||{},t=Object.entries(e).map(([r,i])=>({name:r,...i})),s=new Set(t.map(r=>r.name)),n=Array.isArray(this.toolStats?.registered)?this.toolStats.registered:[];for(let r of n)typeof r!="string"||!r||s.has(r)||(t.push({name:r,callCount:0,errorCount:0,errorRate:0,avgMs:0,p50Ms:0,p95Ms:0,lastCalledAt:null,lastError:null}),s.add(r));return t.sort((r,i)=>{let o=(i.callCount||0)-(r.callCount||0);return o!==0?o:r.name.localeCompare(i.name)}),t},unusedToolRows(){return Array.isArray(this.toolStats?.unused)?this.toolStats.unused:[]},toolStatsFetchedAtLabel(){let e=this.toolStats?.fetchedAt;if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return""}},dreamLatest(){return this.store&&this.store.yeaftDreamLatestForActiveSession||null},dreamLatestLabel(){let e=this.dreamLatest;if(!e)return"";if(e.status==="running")return`running \xB7 ${e.phase||"..."}`;if(e.status==="error")return`error \xB7 ${e.error||"unknown"}`;if(e.status==="skipped")return"skipped";let t=["done"];typeof e.mergedCount=="number"&&t.push(`merged ${e.mergedCount}`);let s=this.formatDreamMetrics(e);return s&&t.push(s),t.join(" \xB7 ")},dreamLatestKindLabel(){let e=this.dreamLatest;return e?e.manual?"manual":"auto":""},dreamSnapshot(){return this.store&&this.store.yeaftDreamSnapshotForActiveSession||null},dreamPromptLoad(){return this.store&&this.store.yeaftDreamPromptLoadForActiveSession||null},dreamPromptLoadSummary(){let e=this.dreamPromptLoad,t=e&&typeof e.summary=="string"?e.summary.trim():"";return t&&e.truncated?`${t}
7305
+ `).includes(s)):Array.isArray(e)?e:[]}function Wh({latest:e={},snapshots:t={},promptLoads:s={},events:n=[],sessionTitles:r={}}={}){let i=new Set([...Object.keys(e||{}),...Object.keys(t||{}),...Object.keys(s||{})]);for(let o of Array.isArray(n)?n:[])o?.scope&&i.add(o.scope);return Array.from(i).map(o=>{let a=t?.[o]||null,l=e?.[o]||null,c=a?.lastError||l?.error||null,d=l?.status||(c?"error":a?.hasOutput?"completed":"never-ran"),u=s?.[o]||null,f=(Array.isArray(n)?n:[]).filter(b=>b?.scope===o),p=f[f.length-1]||null,g=l?.finishedAt||l?.startedAt||a?.lastDreamAt||p?.at||a?.loadedAt||"",h=_w(a?.memoryText||""),y=Nh(o,a),k=Lw(o,a,r),w=c?Pn(c.message||c.error||c.raw||"",180):"",I=Pn(w||a?.summaryText||a?.memoryText||p?.detail||"",180);return{key:o,title:k,scope:o,sessionId:y,status:d,lastAt:g,latestRun:l,snapshot:a,lastError:c,promptLoad:u,events:f,segmentCount:h.length,segments:h,summaryPreview:I,subtitle:I,hasRequestResponse:f.some(b=>b?.request||b?.response||b?.systemPrompt||b?.rawRequest||b?.rawResponse)}}).sort((o,a)=>String(a.lastAt||"").localeCompare(String(o.lastAt||"")))}var jh=B(()=>{});var Uh,$w,Kh,zh=B(()=>{jh();Oa();Uh=1,$w=5,Kh={name:"YeaftDebugPanel",emits:["close"],data(){return{expandedTurns:{},expandedLoops:{},expandedSections:{},expandedToolDetails:{},copiedFlash:null,copiedFlashAt:0,_expandSnapshot:null,dreamExpanded:!1,expandedDreamEvents:{},expandedDreamSegments:{},activeDreamItemKey:null,dreamItemSearch:"",activeTab:"requests"}},watch:{turns(e,t){let s=e&&e[0];!s||!s.turnId||(t&&t[0]&&t[0].turnId)===s.turnId&&this.expandedTurns[s.turnId]||(this.expandedTurns={...this.expandedTurns,[s.turnId]:!0},this.ensureRequestDetailLoaded(s.turnId))},searchQuery(e,t){let s=!!(t&&t.trim()),n=!!(e&&e.trim());if(!s&&n){this._expandSnapshot={turns:{...this.expandedTurns},loops:{...this.expandedLoops}};let r={},i={};for(let o of this.turns)r[o.turnId]=!0,o.loops&&o.loops.length>0&&(i[`${o.turnId}#${o.loops[0].loopNumber}`]=!0);this.expandedTurns=r,this.expandedLoops=i}else if(s&&!n&&this._expandSnapshot)this.expandedTurns=this._expandSnapshot.turns,this.expandedLoops=this._expandSnapshot.loops,this._expandSnapshot=null;else if(n){let r={...this.expandedTurns};for(let i of this.turns)r[i.turnId]===void 0&&(r[i.turnId]=!0);this.expandedTurns=r}}},computed:{store(){return window.Pinia?.useChatStore?.()||null},sessionsStore(){return window.Pinia?.useSessionsStore?.()||null},turns(){let e=this.store&&this.store.yeaftDebugPanel||{},t=e.turnId?this.store&&this.store.yeaftDebugTurnsById&&this.store.yeaftDebugTurnsById[e.turnId]:null;if(!t)return[];let s=this.debugLoopsForTurn(t.turnId),n=s.length>0?s:Array.isArray(t.loops)?t.loops:[];return[this.decorateTurnTokenBreakdowns({...t,loops:n})]},currentTurnId(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.turnId||""},currentTurnSessionId(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.sessionId||""},panelStatus(){return this.store&&this.store.yeaftDebugPanel&&this.store.yeaftDebugPanel.status||"idle"},panelLoading(){return this.panelStatus==="loading"},searchQuery:{get(){return this.store&&this.store.yeaftDebugSearch||""},set(e){this.store&&this.store.setYeaftDebugSearch(e)}},sessionFilter:{get(){if(!this.store)return"";let e=this.store.yeaftDebugSessionFilter;return e??""},set(e){this.store&&(e?this.store.setYeaftDebugSessionFilter(e):this.store.setYeaftDebugSessionFilter(null))}},availableSessions(){return this.store&&this.store.yeaftDebugAvailableSessions||[]},turnTotal(){return this.store&&this.store.yeaftDebugTurnTotal||0},showingMatchedHint(){return this.turnTotal>this.turns.length},requestHistoryLoading(){return!!this.store?.yeaftDebugHistoryLoading},requestHistoryError(){return this.store?.yeaftDebugHistoryError||""},toolStats(){return this.store?.yeaftToolStats||null},toolStatsLoading(){return!!this.store?.yeaftToolStatsLoading},rankedToolRows(){let e=this.toolStats?.snapshot||{},t=Object.entries(e).map(([r,i])=>({name:r,...i})),s=new Set(t.map(r=>r.name)),n=Array.isArray(this.toolStats?.registered)?this.toolStats.registered:[];for(let r of n)typeof r!="string"||!r||s.has(r)||(t.push({name:r,callCount:0,errorCount:0,errorRate:0,avgMs:0,p50Ms:0,p95Ms:0,lastCalledAt:null,lastError:null}),s.add(r));return t.sort((r,i)=>{let o=(i.callCount||0)-(r.callCount||0);return o!==0?o:r.name.localeCompare(i.name)}),t},unusedToolRows(){return Array.isArray(this.toolStats?.unused)?this.toolStats.unused:[]},toolStatsFetchedAtLabel(){let e=this.toolStats?.fetchedAt;if(!e)return"";try{return new Date(e).toLocaleTimeString()}catch{return""}},dreamLatest(){return this.store&&this.store.yeaftDreamLatestForActiveSession||null},dreamLatestLabel(){let e=this.dreamLatest;if(!e)return"";if(e.status==="running")return`running \xB7 ${e.phase||"..."}`;if(e.status==="error")return`error \xB7 ${e.error||"unknown"}`;if(e.status==="skipped")return"skipped";let t=["done"];typeof e.mergedCount=="number"&&t.push(`merged ${e.mergedCount}`);let s=this.formatDreamMetrics(e);return s&&t.push(s),t.join(" \xB7 ")},dreamLatestKindLabel(){let e=this.dreamLatest;return e?e.manual?"manual":"auto":""},dreamSnapshot(){return this.store&&this.store.yeaftDreamSnapshotForActiveSession||null},dreamPromptLoad(){return this.store&&this.store.yeaftDreamPromptLoadForActiveSession||null},dreamPromptLoadSummary(){let e=this.dreamPromptLoad,t=e&&typeof e.summary=="string"?e.summary.trim():"";return t&&e.truncated?`${t}
7306
7306
  ... truncated`:t},dreamSnapshotSummary(){let e=this.dreamSnapshot,t=e&&typeof e.summaryText=="string"?e.summaryText.trim():"";return t&&e.summaryTruncated?`${t}
7307
7307
  ... truncated`:t},dreamSnapshotMemory(){let e=this.dreamSnapshot,t=e&&typeof e.memoryText=="string"?e.memoryText.trim():"";return t&&e.memoryTruncated?`${t}
7308
7308
  ... truncated`:t},dreamEvents(){let e=this.store&&this.store.yeaftDreamEventsForActiveSession||[];return Array.isArray(e)?e:[]},dreamEventCount(){return this.dreamEvents.length},dreamSessionTitles(){let e={},t=(r,i)=>{let o=String(i||"").trim();r&&o&&(e[r]=o)},s=this.sessionsStore?.sessions||{};for(let r of Object.values(s))!r||!r.id||(t(r.id,r.name||r.title),t(`sessions/${r.id}`,r.name||r.title));let n=this.store?.yeaftActiveSessionFilter;return n&&t(n,this.store?.yeaftActiveSessionName||this.store?.currentSessionTitle),e},allDreamItems(){let e=this.store||{},t=e.yeaftDreamEvents||{},s=Object.values(t).flatMap(n=>Array.isArray(n)?n:[]);return Wh({latest:e.yeaftDreamLatest||{},snapshots:e.yeaftDreamSnapshots||{},promptLoads:e.yeaftDreamPromptLoads||{},events:s,sessionTitles:this.dreamSessionTitles})},dreamItems(){return qh(this.allDreamItems,this.dreamItemSearch)},activeDreamItem(){return this.activeDreamItemKey&&this.dreamItems.find(e=>e.key===this.activeDreamItemKey)||null},activeDreamRequestEvents(){let e=this.activeDreamItem;return e?e.events.filter(t=>t&&(t.request||t.response||t.rawRequest||t.rawResponse||t.systemPrompt||this.dreamLoopUserContent(t))):[]}},methods:{debugSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},debugDreamSessionId(e){return this.formatDebugSessionId(e&&(e.sessionId||e.groupId)||"")},formatDebugSessionId(e){let t=String(e||"");return t.startsWith("grp_")?t.slice(4):t},toggleTurn(e){let t=!this.expandedTurns[e];this.expandedTurns={...this.expandedTurns,[e]:t},t&&this.ensureRequestDetailLoaded(e)},debugLoopsForTurn(e){return(Array.isArray(this.store?.yeaftDebugLoops)?this.store.yeaftDebugLoops:[]).filter(s=>s&&s.turnId===e)},debugTurnNeedsDetailLoad(e){if(!e||!e.turnId)return!1;if(!e.detailsLoaded)return!0;let t=this.debugLoopsForTurn(e.turnId),s=Math.max(0,Number(e.loopCount||0)),n=new Set;for(let i of t){let o=Number(i?.loopNumber||0);Number.isFinite(o)&&o>0&&n.add(o)}if((n.size>0?Math.max(...n):0)>n.size||s>t.length)return!0;for(let i=1;i<=s;i++)if(!n.has(i))return!0;return!1},ensureRequestDetailLoaded(e){let t=this.store?.yeaftDebugTurnsById?.[e];!t||!this.store||typeof this.store.loadYeaftDebugHistory!="function"||this.debugTurnNeedsDetailLoad(t)&&this.store.loadYeaftDebugHistory({limit:Uh,dreamLimit:0,detailTurnId:e,groupId:t.sessionId||null})},toggleDream(){this.dreamExpanded=!this.dreamExpanded},dreamEventDetail(e){if(!e)return"";let t=e.phase||"unknown",s=[],n=!0;if(t==="start")s.push(e.manual?"manual trigger":"auto trigger");else if(t==="load-diff")this.debugDreamSessionId(e)&&s.push(`session ${this.debugDreamSessionId(e)}`);else if(t==="triage")typeof e.segments=="number"&&s.push(`${e.segments} segs`),typeof e.actions=="number"&&s.push(`${e.actions} actions`),e.status&&s.push(e.status);else if(t==="merge")typeof e.targets=="number"&&s.push(`${e.targets} targets`);else if(t==="apply")e.target&&s.push(e.target),e.status&&s.push(e.status),typeof e.mergedCount=="number"&&s.push(`merged ${e.mergedCount}`);else if(t==="done"){let r=typeof e.sessions=="number"?e.sessions:e.groups;typeof r=="number"&&s.push(`${r} sessions`),typeof e.targets=="number"&&s.push(`${e.targets} targets`),typeof e.duration=="number"&&s.push(this.formatMs(e.duration))}else t==="result"?(s.push(e.success?"success":"error"),typeof e.entriesCreated=="number"&&s.push(`entries ${e.entriesCreated}`),this.formatDreamMetrics(e)&&s.push(this.formatDreamMetrics(e)),!e.success&&e.error&&s.push(e.error),e.skipped&&s.push(`skipped: ${e.skippedReason||"unknown"}`)):n=!1;if(!n||s.length===0){let r=new Set(["type","phase","sessionId","groupId","target","ts","at"]);for(let[i,o]of Object.entries(e))r.has(i)||o!=null&&typeof o!="object"&&s.push(`${i}=${o}`)}return e.error&&!s.includes(e.error)&&s.unshift(`error: ${e.error}`),s.join(" \xB7 ")},dreamEventStatus(e){return e?e.status==="skipped"||e.skipped?"skipped":e.status==="error"||e.phase==="error"?"error":e.status==="done"||e.status==="success"||e.phase==="done"?"success":e.phase==="result"?e.success?"success":"error":"running":"running"},dreamEventTrigger(e){return e?e.trigger?e.trigger:e.source?e.source:e.manual===!0?"manual":e.manual===!1?"auto":"-":"-"},dreamEventCall(e){if(!e)return"-";let t=e.phase||"unknown",s=e.status||"";return t==="start"?"scheduler -> runDream":t==="load-diff"?"runDream -> loadSessionDiff":t==="triage"?s?`triageSessionSegments \xB7 ${s}`:"triageSessionSegments":t==="merge"?"mergeByTarget":t==="apply"?s?`applyMergedTarget \xB7 ${s}`:"applyMergedTarget":t==="done"?"runDream completed":t==="result"?"web-bridge -> yeaft_dream_result":t},dreamEventLocation(e){return e?e.target?e.target:e.scope?e.scope:this.debugDreamSessionId(e)?`session/${this.debugDreamSessionId(e)}`:e.vpId?`vp/${e.vpId}`:"-":"-"},dreamEventResult(e){if(!e)return"-";let t=[];return e.skipped&&t.push(`skipped: ${e.skippedReason||"unknown"}`),e.reason&&t.push(`reason: ${e.reason}`),typeof e.entriesCreated=="number"&&t.push(`entries ${e.entriesCreated}`),typeof e.targetsApplied=="number"&&t.push(`applied ${e.targetsApplied}`),typeof e.sessionsProcessed=="number"&&t.push(`sessions ${e.sessionsProcessed}`),typeof e.sessionsSkipped=="number"&&t.push(`skipped sessions ${e.sessionsSkipped}`),typeof e.segments=="number"&&t.push(`segments ${e.segments}`),typeof e.actions=="number"&&t.push(`actions ${e.actions}`),typeof e.targets=="number"&&t.push(`targets ${e.targets}`),typeof e.duration=="number"&&t.push(this.formatMs(e.duration)),this.formatDreamMetrics(e)&&t.push(this.formatDreamMetrics(e)),Array.isArray(e.targetErrors)&&e.targetErrors.length>0&&t.push(`errors ${e.targetErrors.length}: ${this.truncate(e.targetErrors.map(s=>s.target?`${s.target}: ${s.error}`:s.error).join("; "),160)}`),e.error&&t.push(`error: ${e.error}`),t.length>0?t.join(" \xB7 "):this.dreamEventDetail(e)},dreamEventKind(e){if(!e)return"progress";let t=e.type;return t==="loop"?"loop":t==="turn_close"||t==="dream_turn_close"?"turn_close":t==="dream_run"&&e.phase==="result"?"result":"progress"},isDreamEventExpandable(e){let t=this.dreamEventKind(e);return t==="loop"?!!(e&&(e.systemPrompt||e.response||Array.isArray(e.messages)&&e.messages.length>0)):t==="turn_close"||t==="result"?!!(e&&(e.metrics||e.passBreakdown||e.resultSummary)):t==="progress"?!!(e&&(e.memoryMdPreview||e.summaryMdPreview)):!1},dreamEventKey(e){return e?`${e.at||0}:${e.turnId||""}:${e.phase||e.type||""}`:""},toggleDreamEvent(e){let t=this.dreamEventKey(e);if(!t)return;let s=new Set(this.dreamEvents.map(r=>this.dreamEventKey(r))),n={};for(let[r,i]of Object.entries(this.expandedDreamEvents))s.has(r)&&(n[r]=i);n[t]=!n[t],this.expandedDreamEvents=n},isDreamEventExpanded(e){return!!this.expandedDreamEvents[this.dreamEventKey(e)]},dreamLoopUserContent(e){let t=Array.isArray(e?.messages)?e.messages:[];for(let s of t)if(s&&s.role==="user"){if(typeof s.content=="string")return s.content;if(s.content!=null)return JSON.stringify(s.content,null,2)}return""},formatPassBreakdown(e){if(!e||typeof e!="object")return"";let t=[];for(let[s,n]of Object.entries(e)){if(!n)continue;let r=[s+":"];n.llmCallCount&&r.push(`${n.llmCallCount} call`),n.totalTokens&&r.push(`${this.formatTokens(n.totalTokens)} tok`),n.durationMs&&r.push(this.formatMs(n.durationMs)),t.push(r.join(" "))}return t.join(" \xB7 ")},copyDreamEventAsMarkdown(e){if(!e)return;let t=this.dreamEventKind(e),s=[`# Dream event \xB7 ${t} \xB7 ${e.phase||e.type||"?"}`];if(s.push(`- at: ${this.formatTimestamp(e.at)}`),e.turnId&&s.push(`- turnId: ${e.turnId}`),this.debugDreamSessionId(e)&&s.push(`- sessionId: ${this.debugDreamSessionId(e)}`),e.target&&s.push(`- target: ${e.target}`),t==="loop"){s.push(`- pass: ${e.pass||"-"}`),s.push(`- model: ${e.model||"-"}`),s.push(`- latency: ${this.formatMs(e.latencyMs)}`);let n=e.usage||{};s.push(`- tokens: ${this.formatUsageBreakdown(n)}`),s.push("","## System prompt","```",e.systemPrompt||"","```"),s.push("","## User message","```",this.dreamLoopUserContent(e),"```"),s.push("","## Response","```",e.response||"","```")}else if(t==="turn_close"){s.push(`- loopCount: ${e.loopCount??e.metrics?.llmCallCount??0}`),s.push(`- totalTokens: ${e.totalTokens??e.metrics?.totalTokens??0}`),s.push(`- totalMs: ${e.totalMs??e.metrics?.durationMs??0}`);let n=e.passBreakdown||e.metrics?.passBreakdown;n&&s.push("","## Pass breakdown","```json",JSON.stringify(n,null,2),"```")}else t==="result"?(s.push(`- status: ${e.status||"-"}`),e.error&&s.push(`- error: ${e.error}`),e.resultSummary&&s.push("","## Result summary","```json",JSON.stringify(e.resultSummary,null,2),"```"),e.metrics&&s.push("","## Metrics","```json",JSON.stringify(e.metrics,null,2),"```")):(e.memoryMdPreview&&s.push("","## memory.md (preview)","```",e.memoryMdPreview,"```"),e.summaryMdPreview&&s.push("","## summary.md (preview)","```",e.summaryMdPreview,"```"),!e.memoryMdPreview&&!e.summaryMdPreview&&s.push("","## Raw","```json",JSON.stringify(e,null,2),"```"));this.copyText(s.join(`
Binary file
@@ -16,6 +16,6 @@
16
16
  </head>
17
17
  <body>
18
18
  <div id="app"></div>
19
- <script type="module" src="app.bundle.js?v=22a8b637"></script>
19
+ <script type="module" src="app.bundle.js?v=f856b02a"></script>
20
20
  </body>
21
21
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.381",
3
+ "version": "1.0.382",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",