llmxray 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/assets/{AITrainingPage-CD-bWVvC.js → AITrainingPage-D9Hlzoxr.js} +1 -1
  2. package/dist/assets/BenchmarkPage-C2EPgHap.js +7 -0
  3. package/dist/assets/ComparisonPage-D4uVK99S.js +5 -0
  4. package/dist/assets/DashboardPage-D29jF-v_.js +116 -0
  5. package/dist/assets/{EmbeddingsPage-DY0ClOT-.js → EmbeddingsPage-B4Q5iOnp.js} +1 -1
  6. package/dist/assets/{GoogleCallbackPage-CVk5U2In.js → GoogleCallbackPage-BTVY6nY-.js} +1 -1
  7. package/dist/assets/{JsonTreeNode-BQTLLZr8.js → JsonTreeNode-BIbYj0yY.js} +1 -1
  8. package/dist/assets/{ModelCapabilityIcons.vue_vue_type_script_setup_true_lang-CC-8ifev.js → ModelCapabilityIcons.vue_vue_type_script_setup_true_lang-C3XRXlsx.js} +1 -1
  9. package/dist/assets/{RAGPage-DrqXiDs6.js → RAGPage-DQ6Volv_.js} +1 -1
  10. package/dist/assets/SessionPage-BDEjGBVj.js +15 -0
  11. package/dist/assets/{SettingsPage-RH-JaBkt.js → SettingsPage-CnnL86xu.js} +1 -1
  12. package/dist/assets/{StatusBadge.vue_vue_type_script_setup_true_lang-BoFt8y4m.js → StatusBadge.vue_vue_type_script_setup_true_lang-KoBPscTq.js} +1 -1
  13. package/dist/assets/{StorageGauge.vue_vue_type_style_index_0_lang-Cww3ylyV.js → StorageGauge.vue_vue_type_style_index_0_lang-C02ax0mb.js} +1 -1
  14. package/dist/assets/SystemPage--sYDCQWt.js +3 -0
  15. package/dist/assets/{TabBar.vue_vue_type_script_setup_true_lang-D1bxlZ11.js → TabBar.vue_vue_type_script_setup_true_lang-B8XosH-S.js} +1 -1
  16. package/dist/assets/{TokenStreamDisplay.vue_vue_type_script_setup_true_lang-DbN5kS19.js → TokenStreamDisplay.vue_vue_type_script_setup_true_lang-DESaLQAc.js} +1 -1
  17. package/dist/assets/ToolWorkshopPage-BOfP5qNr.js +376 -0
  18. package/dist/assets/{agent-store-Bmti9EJM.js → agent-store-t6Q_sS6h.js} +1 -1
  19. package/dist/assets/download-CoUYv-Xz.js +1 -0
  20. package/dist/assets/download-WPaeALA4.js +2 -0
  21. package/dist/assets/{generate-service-BdGdFlEd.js → generate-service-BGYA7sqG.js} +1 -1
  22. package/dist/assets/{google-auth-store-9fvZi3sc.js → google-auth-store-BLsepFvT.js} +1 -1
  23. package/dist/assets/index-ByjkY7sc.js +6 -0
  24. package/dist/assets/index-CLzYyqdr.css +1 -0
  25. package/dist/assets/{index-Co0VhPSQ.js → index-Dz52x0xn.js} +1 -1
  26. package/dist/assets/{metrics-store-CcJejDWm.js → metrics-store-Cnq6K9r3.js} +1 -1
  27. package/dist/assets/{rag-store-D6-tUXow.js → rag-store-DkMe7f2k.js} +1 -1
  28. package/dist/assets/share-2-Bo0B3Izb.js +1 -0
  29. package/dist/assets/{storage-store-C2BSRTMJ.js → storage-store-BymRCrmS.js} +1 -1
  30. package/dist/assets/{stream-handler-DcWLXVUd.js → stream-handler-BpZnsrRN.js} +1 -1
  31. package/dist/assets/{tool-workshop-store-CvimeN9w.js → tool-workshop-store-DFv0eNtc.js} +1 -1
  32. package/dist/assets/{toolcall-store-DxrTJwPf.js → toolcall-store-dbKJl21c.js} +1 -1
  33. package/dist/assets/{trash-2-CKMNSCOl.js → trash-2-bP-GrgRB.js} +1 -1
  34. package/dist/index.html +2 -2
  35. package/package.json +1 -1
  36. package/dist/assets/BenchmarkPage-bp73Urv7.js +0 -2
  37. package/dist/assets/ComparisonPage-BcSW8bNz.js +0 -4
  38. package/dist/assets/DashboardPage-BikhI-WR.js +0 -101
  39. package/dist/assets/SessionPage-BClm8k5v.js +0 -14
  40. package/dist/assets/SystemPage-Dl-w53Tz.js +0 -2
  41. package/dist/assets/ToolWorkshopPage-UupUHgP6.js +0 -376
  42. package/dist/assets/index-BQSbu0e6.css +0 -1
  43. package/dist/assets/index-DVVzacEJ.js +0 -6
@@ -1 +1 @@
1
- import{d as T,r as i,a as f}from"./index-DVVzacEJ.js";const M=T("metrics",()=>{const s=i(new Map),a=i({totalSessions:0,avgTtftMs:0,avgTps:0,avgTotalDurationMs:0,totalTokensGenerated:0,totalPromptsEvaluated:0,modelsUsed:[]}),d=f(()=>[...s.value.values()].sort((t,e)=>t.startedAt-e.startedAt));function g(t){return s.value.get(t)??null}function m(t,e){s.value.set(t,e)}function v(){const t=[...s.value.values()];if(t.length===0)return;const e=new Set;let n=0,l=0,r=0,u=0,c=0;for(const o of t)e.add(o.model),n+=o.ttftMs,l+=o.tokensPerSecond,r+=o.totalDurationMs,u+=o.completionTokenCount,c+=o.promptTokenCount;a.value={totalSessions:t.length,avgTtftMs:n/t.length,avgTps:l/t.length,avgTotalDurationMs:r/t.length,totalTokensGenerated:u,totalPromptsEvaluated:c,modelsUsed:[...e]}}return{metricsBySession:s,aggregate:a,metricsHistory:d,getMetrics:g,recordMetrics:m,recalculateAggregate:v}});export{M as u};
1
+ import{d as T,r as i,a as f}from"./index-ByjkY7sc.js";const M=T("metrics",()=>{const s=i(new Map),a=i({totalSessions:0,avgTtftMs:0,avgTps:0,avgTotalDurationMs:0,totalTokensGenerated:0,totalPromptsEvaluated:0,modelsUsed:[]}),d=f(()=>[...s.value.values()].sort((t,e)=>t.startedAt-e.startedAt));function g(t){return s.value.get(t)??null}function m(t,e){s.value.set(t,e)}function v(){const t=[...s.value.values()];if(t.length===0)return;const e=new Set;let n=0,l=0,r=0,u=0,c=0;for(const o of t)e.add(o.model),n+=o.ttftMs,l+=o.tokensPerSecond,r+=o.totalDurationMs,u+=o.completionTokenCount,c+=o.promptTokenCount;a.value={totalSessions:t.length,avgTtftMs:n/t.length,avgTps:l/t.length,avgTotalDurationMs:r/t.length,totalTokensGenerated:u,totalPromptsEvaluated:c,modelsUsed:[...e]}}return{metricsBySession:s,aggregate:a,metricsHistory:d,getMetrics:g,recordMetrics:m,recalculateAggregate:v}});export{M as u};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DoAHVxX6.js","assets/_commonjsHelpers-DsqdWQfm.js","assets/papaparse.min-3s4OkBbM.js"])))=>i.map(i=>d[i]);
2
- import{_ as y,n as x,o as _,d as $,r as f,a as b}from"./index-DVVzacEJ.js";import{vectorDB as w}from"./vector-db-ChAzHl5A.js";async function I(e,o){switch(o){case"pdf":return O(e);case"docx":return j(e);case"csv":return R(e);case"txt":case"md":return e.text();default:throw new Error(`Unsupported format: ${o}`)}}async function O(e){const o=await y(()=>import("./pdf-vkbVaD7t.js"),[]);o.GlobalWorkerOptions.workerSrc=new URL("/assets/pdf.worker-CliDBb4N.mjs",import.meta.url).toString();const c=await e.arrayBuffer(),n=await o.getDocument({data:c}).promise,r=[];for(let a=1;a<=n.numPages;a++){const l=(await(await n.getPage(a)).getTextContent()).items.map(s=>"str"in s?s.str:"").join(" ");r.push(l)}return r.join(`
2
+ import{_ as y,n as x,o as _,d as $,r as f,a as b}from"./index-ByjkY7sc.js";import{vectorDB as w}from"./vector-db-ChAzHl5A.js";async function I(e,o){switch(o){case"pdf":return O(e);case"docx":return j(e);case"csv":return R(e);case"txt":case"md":return e.text();default:throw new Error(`Unsupported format: ${o}`)}}async function O(e){const o=await y(()=>import("./pdf-vkbVaD7t.js"),[]);o.GlobalWorkerOptions.workerSrc=new URL("/assets/pdf.worker-CliDBb4N.mjs",import.meta.url).toString();const c=await e.arrayBuffer(),n=await o.getDocument({data:c}).promise,r=[];for(let a=1;a<=n.numPages;a++){const l=(await(await n.getPage(a)).getTextContent()).items.map(s=>"str"in s?s.str:"").join(" ");r.push(l)}return r.join(`
3
3
 
4
4
  `)}async function j(e){const o=await y(()=>import("./index-DoAHVxX6.js").then(r=>r.i),__vite__mapDeps([0,1])),c=await e.arrayBuffer();return(await o.extractRawText({arrayBuffer:c})).value}async function R(e){const o=await y(()=>import("./papaparse.min-3s4OkBbM.js").then(n=>n.p),__vite__mapDeps([2,1])),c=await e.text();return new Promise((n,r)=>{o.default.parse(c,{header:!0,complete(a){const t=a.data.filter(u=>Object.values(u).some(l=>l!==""&&l!=null)).map((u,l)=>{const s=Object.entries(u).map(([d,m])=>`${d}: ${m}`).join(", ");return`Row ${l+1}: ${s}`});n(t.join(`
5
5
  `))},error(a){r(a)}})})}function T(e){switch(e.split(".").pop()?.toLowerCase()){case"pdf":return"pdf";case"docx":return"docx";case"txt":return"txt";case"md":return"md";case"csv":return"csv";default:return null}}const z={chunkSize:1e3,chunkOverlap:200,separator:`
@@ -0,0 +1 @@
1
+ import{c}from"./index-ByjkY7sc.js";const y=c("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);export{y as S};
@@ -1 +1 @@
1
- import{d as g,r as d,a as f}from"./index-DVVzacEJ.js";const b=[{id:"rag",dbName:"llmxray-rag",label:"Knowledge Base",icon:"📚",stores:["chunks","documents"]},{id:"conversations",dbName:"llmxray-conversations",label:"Conversations",icon:"💬",stores:["conversations","messages","sessions","tokens"]},{id:"benchmarks",dbName:"llmxray-benchmarks",label:"Benchmarks",icon:"⏱",stores:["results","custom-suites"]},{id:"message-memory",dbName:"llmxray-message-memory",label:"Message Memory",icon:"🧠",stores:["messages"]},{id:"canvas-ai",dbName:"llmxray-canvas-ai",label:"AI Training",icon:"🎨",stores:["training-pairs"]}];async function p(){if(!navigator.storage?.estimate)return{usage:0,quota:0,persisted:!1};const s=await navigator.storage.estimate(),e=await navigator.storage.persisted?.()??!1;return{usage:s.usage??0,quota:s.quota??0,persisted:e}}function y(s){if(s==null)return 0;if(typeof s!="object")return String(s).length*2;const e=s;let t=0;for(const a of Object.keys(e)){t+=a.length*2;const n=e[a];Array.isArray(n)&&n.length>0&&typeof n[0]=="number"?t+=n.length*8:typeof n=="string"?t+=n.length*2:typeof n=="number"?t+=8:typeof n=="boolean"?t+=4:n!=null&&typeof n=="object"&&(t+=y(n))}return t}function v(s){return new Promise(e=>{const t=indexedDB.open(s);t.onupgradeneeded=()=>{t.transaction?.abort(),e(null)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)})}function h(s,e){return new Promise(t=>{if(!s.objectStoreNames.contains(e)){t({name:e,bytes:0,count:0});return}const n=s.transaction(e,"readonly").objectStore(e);let c=0,r=0;const i=n.openCursor();i.onsuccess=()=>{const l=i.result;l?(c+=y(l.value),r++,l.continue()):t({name:e,bytes:c,count:r})},i.onerror=()=>t({name:e,bytes:0,count:0})})}async function w(s,e){const t=await v(s);if(!t)return{totalBytes:0,recordCount:0,stores:e.map(a=>({name:a,bytes:0,count:0}))};try{const a=[];for(const r of e)a.push(await h(t,r));const n=a.reduce((r,i)=>r+i.bytes,0),c=a.reduce((r,i)=>r+i.count,0);return{totalBytes:n,recordCount:c,stores:a}}finally{t.close()}}async function S(){const s=[];for(const e of b){const{totalBytes:t,recordCount:a,stores:n}=await w(e.dbName,e.stores);s.push({id:e.id,label:e.label,icon:e.icon,type:"indexeddb",totalBytes:t,recordCount:a,stores:n})}return s}const B=g("storage",()=>{const s=d(null),e=d([]),t=d(!1),a=d(null),n=f(()=>e.value.reduce((o,u)=>o+u.totalBytes,0)),c=f(()=>!s.value||s.value.quota===0?0:Math.round(s.value.usage/s.value.quota*100)),r=f(()=>e.value.reduce((o,u)=>o+u.recordCount,0));function i(o){return e.value.find(u=>u.id===o)}async function l(){t.value=!0;try{const[o,u]=await Promise.all([p(),S()]);s.value=o,e.value=u,a.value=Date.now()}catch(o){console.error("Failed to estimate storage:",o)}finally{t.value=!1}}async function m(o=3e4){(!a.value||Date.now()-a.value>o)&&await l()}return{origin:s,databases:e,loading:t,lastUpdated:a,totalUsedBytes:n,usedPercent:c,totalRecordCount:r,getDatabaseById:i,refresh:l,refreshIfStale:m}});export{B as u};
1
+ import{d as g,r as d,a as f}from"./index-ByjkY7sc.js";const b=[{id:"rag",dbName:"llmxray-rag",label:"Knowledge Base",icon:"📚",stores:["chunks","documents"]},{id:"conversations",dbName:"llmxray-conversations",label:"Conversations",icon:"💬",stores:["conversations","messages","sessions","tokens"]},{id:"benchmarks",dbName:"llmxray-benchmarks",label:"Benchmarks",icon:"⏱",stores:["results","custom-suites"]},{id:"message-memory",dbName:"llmxray-message-memory",label:"Message Memory",icon:"🧠",stores:["messages"]},{id:"canvas-ai",dbName:"llmxray-canvas-ai",label:"AI Training",icon:"🎨",stores:["training-pairs"]}];async function p(){if(!navigator.storage?.estimate)return{usage:0,quota:0,persisted:!1};const s=await navigator.storage.estimate(),e=await navigator.storage.persisted?.()??!1;return{usage:s.usage??0,quota:s.quota??0,persisted:e}}function y(s){if(s==null)return 0;if(typeof s!="object")return String(s).length*2;const e=s;let t=0;for(const a of Object.keys(e)){t+=a.length*2;const n=e[a];Array.isArray(n)&&n.length>0&&typeof n[0]=="number"?t+=n.length*8:typeof n=="string"?t+=n.length*2:typeof n=="number"?t+=8:typeof n=="boolean"?t+=4:n!=null&&typeof n=="object"&&(t+=y(n))}return t}function v(s){return new Promise(e=>{const t=indexedDB.open(s);t.onupgradeneeded=()=>{t.transaction?.abort(),e(null)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)})}function h(s,e){return new Promise(t=>{if(!s.objectStoreNames.contains(e)){t({name:e,bytes:0,count:0});return}const n=s.transaction(e,"readonly").objectStore(e);let c=0,r=0;const i=n.openCursor();i.onsuccess=()=>{const l=i.result;l?(c+=y(l.value),r++,l.continue()):t({name:e,bytes:c,count:r})},i.onerror=()=>t({name:e,bytes:0,count:0})})}async function w(s,e){const t=await v(s);if(!t)return{totalBytes:0,recordCount:0,stores:e.map(a=>({name:a,bytes:0,count:0}))};try{const a=[];for(const r of e)a.push(await h(t,r));const n=a.reduce((r,i)=>r+i.bytes,0),c=a.reduce((r,i)=>r+i.count,0);return{totalBytes:n,recordCount:c,stores:a}}finally{t.close()}}async function S(){const s=[];for(const e of b){const{totalBytes:t,recordCount:a,stores:n}=await w(e.dbName,e.stores);s.push({id:e.id,label:e.label,icon:e.icon,type:"indexeddb",totalBytes:t,recordCount:a,stores:n})}return s}const B=g("storage",()=>{const s=d(null),e=d([]),t=d(!1),a=d(null),n=f(()=>e.value.reduce((o,u)=>o+u.totalBytes,0)),c=f(()=>!s.value||s.value.quota===0?0:Math.round(s.value.usage/s.value.quota*100)),r=f(()=>e.value.reduce((o,u)=>o+u.recordCount,0));function i(o){return e.value.find(u=>u.id===o)}async function l(){t.value=!0;try{const[o,u]=await Promise.all([p(),S()]);s.value=o,e.value=u,a.value=Date.now()}catch(o){console.error("Failed to estimate storage:",o)}finally{t.value=!1}}async function m(o=3e4){(!a.value||Date.now()-a.value>o)&&await l()}return{origin:s,databases:e,loading:t,lastUpdated:a,totalUsedBytes:n,usedPercent:c,totalRecordCount:r,getDatabaseById:i,refresh:l,refreshIfStale:m}});export{B as u};
@@ -1,4 +1,4 @@
1
- import{n as u,A as z}from"./index-DVVzacEJ.js";import{u as G,a as q}from"./toolcall-store-DxrTJwPf.js";import{a as R,b as E,u as J}from"./agent-store-Bmti9EJM.js";import{u as $}from"./metrics-store-CcJejDWm.js";const B=1e6;function F(t,n,a,e,c){const s=(e.total_duration??0)/B,o=(e.load_duration??0)/B,i=(e.prompt_eval_duration??0)/B,l=(e.eval_duration??0)/B,p=e.prompt_eval_count??0,r=e.eval_count??0,h=l>0?r/l*1e3:0,f=i>0?p/i*1e3:0,d=c.length>0?c[0]:0;return{sessionId:t,model:n,startedAt:a,completedAt:Date.now(),ttftMs:d,totalDurationMs:s,loadDurationMs:o,promptEvalDurationMs:i,evalDurationMs:l,tokensPerSecond:h,promptTokensPerSecond:f,promptTokenCount:p,completionTokenCount:r,totalTokenCount:p+r,tokenLatencies:c}}class V{constructor(n){this.stepIndex=0,this.activeStep=null,this.inThinkBlock=!1,this.completedSteps=[],this.lastProcessedLineIndex=-1,this.thinkBlockProcessed=!1,this.enablePatternDetection=n?.patternDetection??!0}get isThinking(){return this.inThinkBlock}get thinkingContent(){return this.inThinkBlock&&this.activeStep?this.activeStep.content:""}processToken(n,a){if(!this.inThinkBlock&&!this.thinkBlockProcessed&&a.includes("<think>")){this.inThinkBlock=!0;const i=a.split("<think>").pop()??"";return this.activeStep={type:"thought",content:i,startTokenIndex:n.index,startTimestamp:n.timestamp},null}if(this.inThinkBlock&&a.includes("</think>")){if(this.inThinkBlock=!1,this.thinkBlockProcessed=!0,this.activeStep){const i=a.match(/<think>([\s\S]*?)<\/think>/);if(i?this.activeStep.content=i[1]?.trim()??this.activeStep.content.trim():this.activeStep.content=this.activeStep.content.replace(/<\/think>[\s\S]*$/,"").trim(),this.activeStep.content)return this.finalizeStep(n);this.activeStep=null}return null}if(this.inThinkBlock&&this.activeStep)return this.activeStep.content+=n.text,null;if(!this.enablePatternDetection)return null;const e=a.split(`
1
+ import{n as u,A as z}from"./index-ByjkY7sc.js";import{u as G,a as q}from"./toolcall-store-dbKJl21c.js";import{a as R,b as E,u as J}from"./agent-store-t6Q_sS6h.js";import{u as $}from"./metrics-store-Cnq6K9r3.js";const B=1e6;function F(t,n,a,e,c){const s=(e.total_duration??0)/B,o=(e.load_duration??0)/B,i=(e.prompt_eval_duration??0)/B,l=(e.eval_duration??0)/B,p=e.prompt_eval_count??0,r=e.eval_count??0,h=l>0?r/l*1e3:0,f=i>0?p/i*1e3:0,d=c.length>0?c[0]:0;return{sessionId:t,model:n,startedAt:a,completedAt:Date.now(),ttftMs:d,totalDurationMs:s,loadDurationMs:o,promptEvalDurationMs:i,evalDurationMs:l,tokensPerSecond:h,promptTokensPerSecond:f,promptTokenCount:p,completionTokenCount:r,totalTokenCount:p+r,tokenLatencies:c}}class V{constructor(n){this.stepIndex=0,this.activeStep=null,this.inThinkBlock=!1,this.completedSteps=[],this.lastProcessedLineIndex=-1,this.thinkBlockProcessed=!1,this.enablePatternDetection=n?.patternDetection??!0}get isThinking(){return this.inThinkBlock}get thinkingContent(){return this.inThinkBlock&&this.activeStep?this.activeStep.content:""}processToken(n,a){if(!this.inThinkBlock&&!this.thinkBlockProcessed&&a.includes("<think>")){this.inThinkBlock=!0;const i=a.split("<think>").pop()??"";return this.activeStep={type:"thought",content:i,startTokenIndex:n.index,startTimestamp:n.timestamp},null}if(this.inThinkBlock&&a.includes("</think>")){if(this.inThinkBlock=!1,this.thinkBlockProcessed=!0,this.activeStep){const i=a.match(/<think>([\s\S]*?)<\/think>/);if(i?this.activeStep.content=i[1]?.trim()??this.activeStep.content.trim():this.activeStep.content=this.activeStep.content.replace(/<\/think>[\s\S]*$/,"").trim(),this.activeStep.content)return this.finalizeStep(n);this.activeStep=null}return null}if(this.inThinkBlock&&this.activeStep)return this.activeStep.content+=n.text,null;if(!this.enablePatternDetection)return null;const e=a.split(`
2
2
  `);if(e.length<2)return null;const c=e.length-2;if(c<=this.lastProcessedLineIndex)return null;this.lastProcessedLineIndex=c;const s=e[c]?.trim()??"";if(!s)return null;const o=K(s);if(o){let i=null;return this.activeStep&&(i=this.finalizeStep(n)),this.activeStep={type:o.type,content:o.content,startTokenIndex:n.index,startTimestamp:n.timestamp},i}return this.activeStep&&(this.activeStep.content+=n.text),null}finalize(){if(this.activeStep){const n={id:u(),index:this.stepIndex++,type:this.activeStep.type,content:this.activeStep.content.trim(),startTokenIndex:this.activeStep.startTokenIndex,endTokenIndex:this.activeStep.startTokenIndex,timestamp:this.activeStep.startTimestamp,durationMs:Date.now()-this.activeStep.startTimestamp};if(this.activeStep=null,n.content)return this.completedSteps.push(n),n}return null}finalizeStep(n){const a={id:u(),index:this.stepIndex++,type:this.activeStep.type,content:this.activeStep.content.trim(),startTokenIndex:this.activeStep.startTokenIndex,endTokenIndex:n.index,timestamp:this.activeStep.startTimestamp,durationMs:n.timestamp-this.activeStep.startTimestamp};return this.completedSteps.push(a),this.activeStep=null,a}}const H=[{regex:/^(?:Step\s+\d+[:.]\s*)(.+)/i,type:"thought"},{regex:/^(?:Thought[:.]\s*)(.+)/i,type:"thought"},{regex:/^(?:Observation[:.]\s*)(.+)/i,type:"observation"},{regex:/^(?:Action[:.]\s*)(.+)/i,type:"action"},{regex:/^(?:Conclusion[:.]\s*)(.+)/i,type:"conclusion"},{regex:/^(?:Therefore[,:.]\s*)(.+)/i,type:"conclusion"}];function K(t){const n=t.trim();for(const{regex:a,type:e}of H){const c=n.match(a);if(c)return{type:e,content:c[1]??n}}return null}async function Z(t,n,a){const e=t.getReader(),c=new TextDecoder;let s="";try{for(;!a?.aborted;){const{done:o,value:i}=await e.read();if(o)break;s+=c.decode(i,{stream:!0});const l=s.split(`
3
3
  `);s=l.pop()??"";for(const p of l){const r=p.trim();if(!r||!r.startsWith("data: "))continue;const h=r.slice(6);if(h==="[DONE]")return;try{const f=JSON.parse(h);n(f)}catch{}}}}finally{e.releaseLock()}}async function W(t,n,a){const e=t.getReader(),c=new TextDecoder;let s="";try{for(;!a?.aborted;){const{done:o,value:i}=await e.read();if(o)break;s+=c.decode(i,{stream:!0});const l=s.split(`
4
4
  `);s=l.pop()??"";for(const p of l){const r=p.trim();if(r)try{const h=JSON.parse(r);n(h)}catch{}}}if(s.trim())try{const o=JSON.parse(s.trim());n(o)}catch{}}finally{e.releaseLock()}}async function I(t,n,a){const e=G(),c=R(),s=$(),o=E(),i=J(),l=Date.now();let p=0,r=l,h="";const f=[],d=z(),b=e.sessionById(t),y=b?d.isThinkingModel(b.model):!1,x=new V({patternDetection:y});i.initGraph(t),i.addNode(t,{id:u(),type:"start",label:"Generation Start",sessionId:t,stepIndex:0,state:{},timestamp:l}),e.updateSessionStatus(t,"streaming"),await W(n,g=>{const M=Date.now(),D=M-r;h+=g.response;const C=j(D,f),v={id:u(),index:p++,text:g.response,timestamp:M,confidence:C,cumulativeText:h,interTokenLatencyMs:D};c.pushToken(t,v),e.appendOutput(t,g.response),f.push(D),r=M;const k=x.processToken(v,h);if(o.setThinking(t,x.isThinking,x.thinkingContent),k&&(o.addStep(t,k),i.addNode(t,{id:u(),type:"decision",label:`${k.type}: ${k.content.slice(0,40)}...`,sessionId:t,stepIndex:k.index,state:{reasoning:k.type},timestamp:k.timestamp})),g.done){x.finalize(),o.setThinking(t,!1,""),g.done_reason&&e.setDoneReason(t,g.done_reason);const m=e.sessionById(t);if(m){const T=F(t,m.model,l,g,f);s.recordMetrics(t,T),e.finalizeSession(t,T),s.recalculateAggregate()}i.addNode(t,{id:u(),type:"output",label:"Generation Complete",sessionId:t,stepIndex:p,state:{tokenCount:p},timestamp:Date.now()})}},a)}async function tt(t,n,a){const e=G(),c=R(),s=$(),o=E(),i=q(),l=J(),p=Date.now();let r=0,h=p,f="",d="",b="",y=!1;const x=[],g=[],M=z(),D=e.sessionById(t),C=D?M.isThinkingModel(D.model):!1,v=new V({patternDetection:C});l.initGraph(t);const k=l.getGraph(t);return(!k||k.nodes.length===0)&&l.addNode(t,{id:u(),type:"start",label:"Chat Start",sessionId:t,stepIndex:0,state:{},timestamp:p}),e.updateSessionStatus(t,"streaming"),await W(n,m=>{const T=Date.now(),w=T-h,A=m.message.thinking;if(A){y=!0,d+=A,o.setThinking(t,!0,d),x.push(w),h=T;return}y&&d&&!m.done&&(o.setThinking(t,!1,d),d.trim()&&o.addStep(t,{id:u(),index:0,type:"thought",content:d.trim(),startTokenIndex:0,endTokenIndex:r,timestamp:T,durationMs:T-p}),b=d,d="");const N=m.message.content;f+=N;let P,L;m.logprobs&&m.logprobs.length>0?(L=m.logprobs[0].logprob,P=Math.exp(L)):P=j(w,x);const O={id:u(),index:r++,text:N,timestamp:T,confidence:P,logprob:L,cumulativeText:f,interTokenLatencyMs:w};if(c.pushToken(t,O),e.appendOutput(t,N),x.push(w),h=T,!y){const S=v.processToken(O,f);o.setThinking(t,v.isThinking,v.thinkingContent),S&&o.addStep(t,S)}if(m.message.tool_calls)for(const S of m.message.tool_calls){g.push(S);const _={id:u(),sessionId:t,index:i.getToolCalls(t).length,functionName:S.function.name,arguments:S.function.arguments,status:"pending",startedAt:T,tokenIndexStart:r};i.addToolCall(t,_),l.addNode(t,{id:u(),type:"tool_call",label:`Tool: ${S.function.name}`,sessionId:t,stepIndex:r,state:{tool:S.function.name,args:S.function.arguments},timestamp:T})}if(m.done&&(y&&d.trim()&&(b=d,o.addStep(t,{id:u(),index:0,type:"thought",content:d.trim(),startTokenIndex:0,endTokenIndex:r,timestamp:Date.now(),durationMs:Date.now()-p})),v.finalize(),o.setThinking(t,!1,y?b:""),m.done_reason&&e.setDoneReason(t,m.done_reason),g.length===0)){const S=e.sessionById(t);if(S){const _=F(t,S.model,p,m,x);s.recordMetrics(t,_),e.finalizeSession(t,_),s.recalculateAggregate()}l.addNode(t,{id:u(),type:"output",label:"Chat Complete",sessionId:t,stepIndex:r,state:{tokenCount:r},timestamp:Date.now()})}},a),{toolCalls:g}}function j(t,n){if(n.length<2)return .5;const a=[...n].sort((o,i)=>o-i),e=a[Math.floor(a.length/2)];if(e<=0)return .5;const c=t/e,s=Math.max(0,Math.min(1,1-(c-.5)/2));return Math.round(s*100)/100}export{I as a,tt as e,Z as r};
@@ -1 +1 @@
1
- import{d as k,r as f,a as u,n as x}from"./index-DVVzacEJ.js";function m(){return{mode:"code",blocks:[],code:""}}const v="llmxray-workshop-tools",D="llmxray-tool-definitions",_=k("tool-workshop",()=>{const n=f({}),a=f(null);function p(){try{const e=localStorage.getItem(v);if(e){const t=JSON.parse(e),o={};for(const l of t)o[l.id]=l;n.value=o;return}g()}catch{}}function g(){try{const e=localStorage.getItem(D);if(!e)return;const t=JSON.parse(e),o={};for(const l of t){const d={id:l.id,definition:l.definition,implementation:m(),enabled:l.enabled,category:"custom",createdAt:l.createdAt,updatedAt:l.updatedAt,lastTestedAt:null,testResult:null};o[d.id]=d}n.value=o,i()}catch{}}function i(){const e=Object.values(n.value);localStorage.setItem(v,JSON.stringify(e))}p();const c=u(()=>Object.values(n.value)),r=u(()=>c.value.filter(e=>e.enabled)),y=u(()=>r.value.map(e=>e.definition)),b=u(()=>{const e={};for(const t of c.value){const o=t.category||"custom";e[o]||(e[o]=[]),e[o].push(t)}return e}),S=u(()=>a.value?n.value[a.value]??null:null);function s(e){const t=x(),o=Date.now(),l={id:t,definition:e.definition,implementation:e.implementation??m(),enabled:e.enabled??!1,category:e.category??"custom",createdAt:o,updatedAt:o,lastTestedAt:null,testResult:null};return n.value[t]=l,i(),t}function O(e,t){const o=n.value[e];o&&(n.value[e]={...o,...t,updatedAt:Date.now()},i())}function T(e){delete n.value[e],a.value===e&&(a.value=null),i()}function A(){n.value={},a.value=null,i()}function w(e){const t=n.value[e];if(!t)return null;const o=JSON.parse(JSON.stringify(t.definition));return o.function.name=`${o.function.name}_copy`,s({definition:o,implementation:JSON.parse(JSON.stringify(t.implementation)),category:t.category})}function N(e){const t=n.value[e];t&&(n.value[e]={...t,enabled:!t.enabled},i())}function J(){for(const e of Object.keys(n.value))n.value[e]={...n.value[e],enabled:!1};i()}function h(e){a.value=e}function E(e){return n.value[e]}function I(e){return c.value.find(t=>t.definition.function.name===e)}return{tools:n,selectedToolId:a,allTools:c,enabledTools:r,enabledDefinitions:y,toolsByCategory:b,selectedTool:S,addTool:s,updateTool:O,removeTool:T,clearAll:A,duplicateTool:w,toggleEnabled:N,disableAll:J,selectTool:h,getById:E,findByFunctionName:I}});export{_ as u};
1
+ import{d as k,r as f,a as u,n as x}from"./index-ByjkY7sc.js";function m(){return{mode:"code",blocks:[],code:""}}const v="llmxray-workshop-tools",D="llmxray-tool-definitions",_=k("tool-workshop",()=>{const n=f({}),a=f(null);function p(){try{const e=localStorage.getItem(v);if(e){const t=JSON.parse(e),o={};for(const l of t)o[l.id]=l;n.value=o;return}g()}catch{}}function g(){try{const e=localStorage.getItem(D);if(!e)return;const t=JSON.parse(e),o={};for(const l of t){const d={id:l.id,definition:l.definition,implementation:m(),enabled:l.enabled,category:"custom",createdAt:l.createdAt,updatedAt:l.updatedAt,lastTestedAt:null,testResult:null};o[d.id]=d}n.value=o,i()}catch{}}function i(){const e=Object.values(n.value);localStorage.setItem(v,JSON.stringify(e))}p();const c=u(()=>Object.values(n.value)),r=u(()=>c.value.filter(e=>e.enabled)),y=u(()=>r.value.map(e=>e.definition)),b=u(()=>{const e={};for(const t of c.value){const o=t.category||"custom";e[o]||(e[o]=[]),e[o].push(t)}return e}),S=u(()=>a.value?n.value[a.value]??null:null);function s(e){const t=x(),o=Date.now(),l={id:t,definition:e.definition,implementation:e.implementation??m(),enabled:e.enabled??!1,category:e.category??"custom",createdAt:o,updatedAt:o,lastTestedAt:null,testResult:null};return n.value[t]=l,i(),t}function O(e,t){const o=n.value[e];o&&(n.value[e]={...o,...t,updatedAt:Date.now()},i())}function T(e){delete n.value[e],a.value===e&&(a.value=null),i()}function A(){n.value={},a.value=null,i()}function w(e){const t=n.value[e];if(!t)return null;const o=JSON.parse(JSON.stringify(t.definition));return o.function.name=`${o.function.name}_copy`,s({definition:o,implementation:JSON.parse(JSON.stringify(t.implementation)),category:t.category})}function N(e){const t=n.value[e];t&&(n.value[e]={...t,enabled:!t.enabled},i())}function J(){for(const e of Object.keys(n.value))n.value[e]={...n.value[e],enabled:!1};i()}function h(e){a.value=e}function E(e){return n.value[e]}function I(e){return c.value.find(t=>t.definition.function.name===e)}return{tools:n,selectedToolId:a,allTools:c,enabledTools:r,enabledDefinitions:y,toolsByCategory:b,selectedTool:S,addTool:s,updateTool:O,removeTool:T,clearAll:A,duplicateTool:w,toggleEnabled:N,disableAll:J,selectTool:h,getById:E,findByFunctionName:I}});export{_ as u};
@@ -1 +1 @@
1
- import{d as m,r as f,a as S,n as M,J as x}from"./index-DVVzacEJ.js";const B=m("sessions",()=>{const n=f(new Map),u=f(null),l=f(new Map),v=S(()=>u.value?n.value.get(u.value)??null:null),d=S(()=>[...n.value.values()].sort((e,s)=>s.createdAt-e.createdAt));function o(e){return n.value.get(e)}function a(e){const s=M(),t={id:s,mode:e.mode,model:e.model,status:"idle",createdAt:Date.now(),prompt:e.prompt,messages:e.messages??[],options:e.options??{},outputText:"",metrics:null};return n.value.set(s,t),s}function i(e,s){l.value.set(e,s)}function c(e,s){const t=n.value.get(e);t&&(t.status=s)}function r(e,s){const t=n.value.get(e);t&&(t.outputText+=s)}function g(e,s){const t=n.value.get(e);if(t){t.status="completed",t.metrics=s;const p=l.value.get(e);p&&x.saveSession(t,p).catch(console.error)}}function C(e,s){const t=n.value.get(e);t&&(t.status="error",t.error=s)}function T(e){const s=n.value.get(e);s&&(s.status="cancelled")}function w(e,s){const t=n.value.get(e);t&&(t.doneReason=s)}function A(e){u.value=e}return{sessions:n,activeSessionId:u,activeSession:v,recentSessions:d,sessionConversationMap:l,sessionById:o,createSession:a,linkSessionToConversation:i,updateSessionStatus:c,appendOutput:r,finalizeSession:g,setSessionError:C,cancelSession:T,setDoneReason:w,setActiveSession:A}}),D=m("toolcalls",()=>{const n=f(new Map);function u(o){return n.value.get(o)??[]}function l(o){return u(o).filter(a=>a.status==="pending")}function v(o,a){let i=n.value.get(o);i||(i=[],n.value.set(o,i)),i.push(a)}function d(o,a,i){const c=n.value.get(o);if(!c)return;const r=c.find(g=>g.id===a);r&&Object.assign(r,i)}return{callsBySession:n,getToolCalls:u,getPendingCalls:l,addToolCall:v,updateToolCall:d}});export{D as a,B as u};
1
+ import{d as m,r as f,a as S,n as M,J as x}from"./index-ByjkY7sc.js";const B=m("sessions",()=>{const n=f(new Map),u=f(null),l=f(new Map),v=S(()=>u.value?n.value.get(u.value)??null:null),d=S(()=>[...n.value.values()].sort((e,s)=>s.createdAt-e.createdAt));function o(e){return n.value.get(e)}function a(e){const s=M(),t={id:s,mode:e.mode,model:e.model,status:"idle",createdAt:Date.now(),prompt:e.prompt,messages:e.messages??[],options:e.options??{},outputText:"",metrics:null};return n.value.set(s,t),s}function i(e,s){l.value.set(e,s)}function c(e,s){const t=n.value.get(e);t&&(t.status=s)}function r(e,s){const t=n.value.get(e);t&&(t.outputText+=s)}function g(e,s){const t=n.value.get(e);if(t){t.status="completed",t.metrics=s;const p=l.value.get(e);p&&x.saveSession(t,p).catch(console.error)}}function C(e,s){const t=n.value.get(e);t&&(t.status="error",t.error=s)}function T(e){const s=n.value.get(e);s&&(s.status="cancelled")}function w(e,s){const t=n.value.get(e);t&&(t.doneReason=s)}function A(e){u.value=e}return{sessions:n,activeSessionId:u,activeSession:v,recentSessions:d,sessionConversationMap:l,sessionById:o,createSession:a,linkSessionToConversation:i,updateSessionStatus:c,appendOutput:r,finalizeSession:g,setSessionError:C,cancelSession:T,setDoneReason:w,setActiveSession:A}}),D=m("toolcalls",()=>{const n=f(new Map);function u(o){return n.value.get(o)??[]}function l(o){return u(o).filter(a=>a.status==="pending")}function v(o,a){let i=n.value.get(o);i||(i=[],n.value.set(o,i)),i.push(a)}function d(o,a,i){const c=n.value.get(o);if(!c)return;const r=c.find(g=>g.id===a);r&&Object.assign(r,i)}return{callsBySession:n,getToolCalls:u,getPendingCalls:l,addToolCall:v,updateToolCall:d}});export{D as a,B as u};
@@ -1 +1 @@
1
- import{c as a}from"./index-DVVzacEJ.js";const e=a("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);export{e as T};
1
+ import{c as a}from"./index-ByjkY7sc.js";const e=a("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);export{e as T};
package/dist/index.html CHANGED
@@ -5,8 +5,8 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>LLMxRay — Local LLM Observatory</title>
8
- <script type="module" crossorigin src="/assets/index-DVVzacEJ.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-BQSbu0e6.css">
8
+ <script type="module" crossorigin src="/assets/index-ByjkY7sc.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-CLzYyqdr.css">
10
10
  </head>
11
11
  <body>
12
12
  <script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmxray",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "Local LLM Observatory — See what your AI is actually doing, token by token.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",