@swestash/agent-lens 0.10.0 → 0.11.0

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
- import{s as u,j as l,L as d,f,b as m,c as h,r as y}from"./index-CqWARNqS.js";function x({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12),n=(e.models??"").split(",").filter(Boolean).map(u).join(", ");return l.jsxs("li",{children:[l.jsx(d,{to:`/session/${e.id}`,children:t}),e.agent_type&&l.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&l.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),l.jsxs("span",{className:"muted",children:[" ","· ",n||"—"," · ",f(e.tokens)," tok · ",m(e.cost),e.duration_ms!=null?` · ${h(e.duration_ms)}`:""]})]})}function j({text:e,label:t,title:n="Copy to clipboard",className:a=""}){const[o,i]=y.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(e)}catch{const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch{}s.remove()}i(!0),window.setTimeout(()=>i(!1),1200)};return l.jsxs("button",{type:"button",className:"ghost small copy-btn "+a,onClick:c,"aria-label":n,title:n,children:[o?"✓ Copied":"⧉",t?" "+t:""]})}function k(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#3?9;|&#x27;/g,"'").replace(/&amp;/g,"&")}function b(e){const t=e.match(/\s*\(\s*truncated[^)]*\)\s*$/i);return!t||t.index==null?{body:e,note:null}:{body:e.slice(0,t.index).trimEnd(),note:t[0].trim()}}function w(e){try{return{value:JSON.parse(e),repaired:!1}}catch{}const t=[];let n=!1,a=!1,o=-1,i=[];for(let s=0;s<e.length;s++){const r=e[s];if(n){a?a=!1:r==="\\"?a=!0:r==='"'&&(n=!1);continue}r==='"'?n=!0:r==="{"||r==="["?t.push(r==="{"?"}":"]"):r==="}"||r==="]"?(t.pop(),o=s+1,i=[...t]):r===","&&(o=s,i=[...t])}if(o<0)return{value:void 0,repaired:!1};const c=e.slice(0,o)+i.reverse().join("");try{return{value:JSON.parse(c),repaired:!0}}catch{return{value:void 0,repaired:!1}}}function p(e){if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return p(JSON.parse(t))}catch{return e}return e}if(Array.isArray(e))return e.map(p);if(e&&typeof e=="object"){const t={};for(const[n,a]of Object.entries(e))t[n]=p(a);return t}return e}function C(e,t=2e4){try{return JSON.stringify(JSON.parse(e),null,2).slice(0,t)}catch{return e.slice(0,t)}}export{x as A,j as C,p as a,k as d,w as l,C as p,b as s};
1
+ import{s as u,j as l,L as d,f,b as m,c as h,r as y}from"./index-BxbXFMQG.js";function x({a:e}){const t=e.agent_description||e.title||e.id.slice(0,12),n=(e.models??"").split(",").filter(Boolean).map(u).join(", ");return l.jsxs("li",{children:[l.jsx(d,{to:`/session/${e.id}`,children:t}),e.agent_type&&l.jsx("span",{className:"tag subagent meta-type",children:e.agent_type}),e.spawn_depth!=null&&e.spawn_depth>1&&l.jsxs("span",{className:"tag meta-depth",title:`nested ${e.spawn_depth} levels deep`,children:["↳",e.spawn_depth]}),l.jsxs("span",{className:"muted",children:[" ","· ",n||"—"," · ",f(e.tokens)," tok · ",m(e.cost),e.duration_ms!=null?` · ${h(e.duration_ms)}`:""]})]})}function j({text:e,label:t,title:n="Copy to clipboard",className:a=""}){const[o,i]=y.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(e)}catch{const s=document.createElement("textarea");s.value=e,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();try{document.execCommand("copy")}catch{}s.remove()}i(!0),window.setTimeout(()=>i(!1),1200)};return l.jsxs("button",{type:"button",className:"ghost small copy-btn "+a,onClick:c,"aria-label":n,title:n,children:[o?"✓ Copied":"⧉",t?" "+t:""]})}function k(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#3?9;|&#x27;/g,"'").replace(/&amp;/g,"&")}function b(e){const t=e.match(/\s*\(\s*truncated[^)]*\)\s*$/i);return!t||t.index==null?{body:e,note:null}:{body:e.slice(0,t.index).trimEnd(),note:t[0].trim()}}function w(e){try{return{value:JSON.parse(e),repaired:!1}}catch{}const t=[];let n=!1,a=!1,o=-1,i=[];for(let s=0;s<e.length;s++){const r=e[s];if(n){a?a=!1:r==="\\"?a=!0:r==='"'&&(n=!1);continue}r==='"'?n=!0:r==="{"||r==="["?t.push(r==="{"?"}":"]"):r==="}"||r==="]"?(t.pop(),o=s+1,i=[...t]):r===","&&(o=s,i=[...t])}if(o<0)return{value:void 0,repaired:!1};const c=e.slice(0,o)+i.reverse().join("");try{return{value:JSON.parse(c),repaired:!0}}catch{return{value:void 0,repaired:!1}}}function p(e){if(typeof e=="string"){const t=e.trim();if(t.startsWith("{")&&t.endsWith("}")||t.startsWith("[")&&t.endsWith("]"))try{return p(JSON.parse(t))}catch{return e}return e}if(Array.isArray(e))return e.map(p);if(e&&typeof e=="object"){const t={};for(const[n,a]of Object.entries(e))t[n]=p(a);return t}return e}function C(e,t=2e4){try{return JSON.stringify(JSON.parse(e),null,2).slice(0,t)}catch{return e.slice(0,t)}}export{x as A,j as C,p as a,k as d,w as l,C as p,b as s};
@@ -1 +1 @@
1
- import{j as i}from"./index-CqWARNqS.js";const n=["critical","high","medium","low","info"];function r({severity:s,count:a}){return i.jsxs("span",{className:"tag sev sev-"+s,children:[s,a!=null?` ${a}`:""]})}export{n as S,r as a};
1
+ import{j as i}from"./index-BxbXFMQG.js";const n=["critical","high","medium","low","info"];function r({severity:s,count:a}){return i.jsxs("span",{className:"tag sev sev-"+s,children:[s,a!=null?` ${a}`:""]})}export{n as S,r as a};
package/web/index.html CHANGED
@@ -16,7 +16,7 @@
16
16
  document.documentElement.dataset.theme = "dark";
17
17
  }
18
18
  </script>
19
- <script type="module" crossorigin src="/assets/index-CqWARNqS.js"></script>
19
+ <script type="module" crossorigin src="/assets/index-BxbXFMQG.js"></script>
20
20
  <link rel="stylesheet" crossorigin href="/assets/index-CeW4iDDs.css">
21
21
  </head>
22
22
  <body>
@@ -1 +0,0 @@
1
- import{w as j,j as e,A as u}from"./index-CqWARNqS.js";const l="v0.9.6-2-gb594b92";function c(n){if(n==null)return"unknown";if(n<1e3)return`${n} B`;const s=["kB","MB","GB","TB"];let t=n/1e3,r=0;for(;t>=1e3&&r<s.length-1;)t/=1e3,r++;return`${t<10?t.toFixed(1):Math.round(t)} ${s[r]}`}function i({label:n,children:s}){return e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:n}),e.jsx("td",{children:s})]})}function a({info:n}){return e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"path",children:n.path})," ",e.jsx("span",{className:"origin-tag",title:d(n.origin),children:n.origin})]})}function d(n){switch(n){case"env":return"Set by an environment variable";case"flag":return"Set by a command-line flag";case"file":return"Set in the config file";case"fixed":return"Not independently relocatable — move the whole data dir (ADR-021)";default:return"Built-in default"}}function o({label:n,v:s,what:t,rerun:r}){const h=s.in_data.filter(x=>x<s.expected);return e.jsxs(i,{label:n,children:["v",s.expected,s.stale&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"warn-tag",children:"data is older"})]}),e.jsx("div",{className:"muted",children:s.in_data.length===0?e.jsxs(e.Fragment,{children:["No ",t," stored yet."]}):s.stale?e.jsxs(e.Fragment,{children:["Stored ",t," came from v",h.join(", v")," — re-run ",e.jsx("code",{children:r})," to relabel with v",s.expected,"."]}):e.jsxs(e.Fragment,{children:["All stored ",t," came from v",s.in_data.join(", v"),"."]})})]})}function m(){const n=j("/about");return e.jsxs("div",{className:"about",children:[e.jsx("h1",{children:"About"}),e.jsxs("p",{className:"muted",children:["Diagnostics for this install. Configuration is shown read-only — it resolves"," ",e.jsx("code",{children:"flag > env > config file > default"}),", so change it with"," ",e.jsx("code",{children:"agent-lens config"}),", an env var, or the config file."]}),e.jsx(u,{state:n,children:s=>e.jsxs(e.Fragment,{children:[e.jsxs("section",{children:[e.jsx("h2",{children:"Versions"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsxs(i,{label:"Agent Lens",children:[s.versions.app," ",e.jsx("span",{className:"origin-tag",children:s.versions.app_source}),s.versions.app_source==="unknown"&&e.jsxs("span",{className:"muted",children:[" ","— no npm metadata and no git tag reachable; this is an unreleased or archive build"]})]}),l!==s.versions.app&&e.jsxs(i,{label:"Web build",children:[l," ",e.jsx("span",{className:"warn-tag",role:"status",children:"differs from the server"}),e.jsx("div",{className:"muted",children:"The page you are looking at was built from a different revision than the server serving it — usually a service still running an older install. Restart it, or rebuild the UI."})]}),e.jsxs(i,{label:"Schema",children:[s.versions.schema??"unstamped",s.versions.schema_stale&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"warn-tag",children:"stale"}),e.jsxs("div",{className:"muted",children:["Written by an older build (this one expects ",s.versions.schema_expected,"). Run"," ",e.jsx("code",{children:"agent-lens ingest --full"}),"."]})]})]}),e.jsx(o,{label:"Detector",v:s.versions.detector,what:"security findings",rerun:"agent-lens ingest --full"}),e.jsx(o,{label:"Classifier",v:s.versions.classifier,what:"session categories",rerun:"agent-lens metrics"})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Paths"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Config file",children:s.paths.config_file?e.jsx("code",{className:"path",children:s.paths.config_file}):e.jsx("span",{className:"muted",children:"none — using built-in defaults"})}),e.jsx(i,{label:"Data dir",children:e.jsx(a,{info:s.paths.data_dir})}),e.jsx(i,{label:"Archive",children:e.jsx(a,{info:s.paths.archive})}),e.jsx(i,{label:"Database",children:e.jsx(a,{info:s.paths.db})}),e.jsx(i,{label:"Triage store",children:e.jsx(a,{info:s.paths.triage_db})})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Server"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Bound to",children:e.jsxs("code",{children:[s.server.host,":",s.server.port]})}),e.jsx(i,{label:"Network",children:s.server.loopback_only?"Loopback only — not reachable from other machines":e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"warn-tag",children:"non-loopback bind"}),e.jsx("div",{className:"muted",children:"Reachable from other machines on this network. The API is unauthenticated."})]})})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Retention"}),e.jsx("table",{className:"kv",children:e.jsx("tbody",{children:e.jsxs(i,{label:"Keep .versions",children:[s.retention.versions_keep_days," day",s.retention.versions_keep_days===1?"":"s"," ",e.jsx("span",{className:"origin-tag",title:d(s.retention.origin),children:s.retention.origin}),e.jsxs("div",{className:"muted",children:["How long superseded transcript snapshots are kept before ",e.jsx("code",{children:"scripts/prune.sh"})," ","removes them. Does not affect the database."]})]})})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Sources"}),s.sources.length===0?e.jsx("p",{className:"muted",children:"No sources configured."}):e.jsx("table",{className:"kv",children:e.jsx("tbody",{children:s.sources.map(t=>e.jsxs(i,{label:t.label,children:[e.jsx("code",{className:"path",children:t.config_dir})," ",e.jsx("span",{className:"origin-tag",children:t.agent})]},t.label))})})]}),e.jsxs("section",{children:[e.jsx("h2",{children:"Storage"}),e.jsx("table",{className:"kv",children:e.jsxs("tbody",{children:[e.jsx(i,{label:"Database",children:c(s.storage.db_bytes)}),e.jsxs(i,{label:"Ingested",children:[c(s.storage.archive_bytes)," across ",s.storage.archive_files.toLocaleString()," file",s.storage.archive_files===1?"":"s",e.jsxs("div",{className:"muted",children:["Transcript bytes read into the database",s.storage.last_ingested?`, as of the last ingest (${new Date(s.storage.last_ingested).toLocaleString()})`:"",". Excludes anything in the archive that has not been ingested, such as"," ",e.jsx("code",{children:".versions/"})," retention snapshots — so it is not the archive folder’s size on disk."]})]})]})})]})]})})]})}export{m as default};
@@ -1 +0,0 @@
1
- import{x,w as j,j as s,A as v,e as f,r as d,L as m,v as c}from"./index-CqWARNqS.js";import{M as N,r as p}from"./index-DxkiGVr3.js";function k(e){return!e||e<0?"—":e>=1024?(e/1024).toFixed(1)+" KB":e+" B"}function y(e,l){return`${e.slice(0,8)} · ${c(l)}`}function S(){const{name:e=""}=x(),l=j("/skills/"+encodeURIComponent(e),{reset:!0});return s.jsx(v,{state:l,empty:s.jsx("div",{className:"muted pad",children:"Not found."}),children:t=>s.jsx(b,{data:t})})}function b({data:e}){const{get:l,set:t}=f(),o=l("v"),n=d.useMemo(()=>e.versions.length?e.versions.find(i=>i.id===o)??e.versions[0]:null,[e,o]),a=d.useMemo(()=>n?e.sessions.filter(i=>i.version_id===n.id):[],[e,n]),h=d.useMemo(()=>e.sessions.filter(i=>!i.version_id).length,[e]);function u(i){t({v:i})}return s.jsxs("div",{className:"skill-view",children:[s.jsx(m,{to:"/skills",className:"back",children:"← all skills"}),s.jsxs("header",{className:"skill-head",children:[s.jsxs("h1",{children:["📖 ",e.name]}),s.jsxs("div",{className:"skill-head-meta muted",children:[e.call_count.toLocaleString()," firing",e.call_count===1?"":"s"," ·"," ",e.versions.length," version",e.versions.length===1?"":"s",n!=null&&n.summary?s.jsxs(s.Fragment,{children:[" · ",n.summary]}):null]})]}),e.versions.length===0?s.jsxs("div",{className:"empty",children:["This skill fired ",e.call_count.toLocaleString()," time(s) but no SKILL.md body was captured in the transcripts, so there is no version content to show."]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"skill-version-bar",children:[s.jsxs("label",{className:"ctl",children:["version"," ",s.jsx("select",{"aria-label":"Skill version",value:(n==null?void 0:n.id)??"",onChange:i=>u(i.target.value),children:e.versions.map((i,r)=>s.jsxs("option",{value:i.id,children:[y(i.id,i.last_seen)," · ",i.call_count," fire",i.call_count===1?"":"s",r===0?" (latest)":""]},i.id))})]}),n&&s.jsxs("span",{className:"muted small",children:["first seen ",c(n.first_seen)," · last seen ",c(n.last_seen)," ·"," ",k(n.body_bytes)]})]}),n&&s.jsxs("div",{className:"cards skill-cards",children:[s.jsxs("div",{className:"card skill-body-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Skill body"}),s.jsxs("span",{className:"card-hint",children:["version ",n.id.slice(0,8)]})]}),s.jsx("div",{className:"md skill-body",children:s.jsx(N,{remarkPlugins:[p],children:n.body})})]}),s.jsxs("div",{className:"card skill-sessions-card",children:[s.jsxs("div",{className:"card-head",children:[s.jsx("h3",{children:"Sessions that fired this version"}),s.jsx("span",{className:"card-hint",children:a.length})]}),a.length===0?s.jsx("div",{className:"empty",children:"No sessions fired this version."}):s.jsxs("table",{className:"sessions",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{children:"Session"}),s.jsx("th",{children:"Source"}),s.jsx("th",{children:"Project"}),s.jsx("th",{className:"num",children:"Fires"}),s.jsx("th",{children:"When"})]})}),s.jsx("tbody",{children:a.map(i=>{var r;return s.jsxs("tr",{children:[s.jsx("td",{children:s.jsx(m,{to:`/session/${i.id}`,className:"title",children:i.title||s.jsx("span",{className:"muted",children:i.id.slice(0,12)})})}),s.jsx("td",{children:i.source_id}),s.jsx("td",{className:"path",children:((r=i.project_path)==null?void 0:r.replace(/^.*\//,""))??"—"}),s.jsx("td",{className:"num",children:i.fire_count}),s.jsx("td",{children:c(i.fired_at)})]},i.id)})})]}),h>0&&s.jsxs("div",{className:"muted small pad",children:[h," firing(s) had no captured body and aren’t attributed to a version."]})]})]})]})]})}export{S as default};