codesesh 1.0.4 → 1.0.5

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 (53) hide show
  1. package/README.md +4 -4
  2. package/dist/{chunk-MBZ4VV4C.js → chunk-FCYCBGEL.js} +3 -3
  3. package/dist/{chunk-W4PZHL2C.js → chunk-NBJJGH5P.js} +57 -39
  4. package/dist/chunk-NBJJGH5P.js.map +1 -0
  5. package/dist/chunk-PAP2Q3WV.js +1271 -0
  6. package/dist/chunk-PAP2Q3WV.js.map +1 -0
  7. package/dist/{chunk-BYB77UAJ.js → chunk-TS3IWH5U.js} +115 -72
  8. package/dist/chunk-TS3IWH5U.js.map +1 -0
  9. package/dist/{chunk-YCUN52HA.js → chunk-WUYSZAYR.js} +75 -114
  10. package/dist/chunk-WUYSZAYR.js.map +1 -0
  11. package/dist/{chunk-3SXCTDD6.js → chunk-XKZSX5BM.js} +4 -3
  12. package/dist/chunk-YQFEGFWD.js +89 -0
  13. package/dist/chunk-YQFEGFWD.js.map +1 -0
  14. package/dist/{discovery-K3GLISI6.js → discovery-D23RV7FY.js} +11 -5
  15. package/dist/index.js +1415 -948
  16. package/dist/index.js.map +1 -1
  17. package/dist/project-identity-worker.js +4 -4
  18. package/dist/scan-refresh-worker.js +17 -7
  19. package/dist/scan-refresh-worker.js.map +1 -1
  20. package/dist/search-index-worker.js +16 -8
  21. package/dist/search-index-worker.js.map +1 -1
  22. package/dist/session-detail-worker.js +79 -0
  23. package/dist/session-detail-worker.js.map +1 -0
  24. package/dist/smart-tag-worker.js +3 -3
  25. package/dist/web/assets/CustomTimeWindowDialog-C9XTZRm0.js +1 -0
  26. package/dist/web/assets/{InteractiveReceipt-Dk50TBsH.js → InteractiveReceipt-Sca1smpv.js} +1 -1
  27. package/dist/web/assets/OverviewScreen-Vq6BQR9_.js +1 -0
  28. package/dist/web/assets/{PrismHighlighter-B1a2dPJO.js → PrismHighlighter-LWITDffT.js} +1 -1
  29. package/dist/web/assets/Projects-CwicV3Dk.js +1 -0
  30. package/dist/web/assets/{SearchResultsPanel-DfheEwpz.js → SearchResultsPanel-DCO0Ak0c.js} +1 -1
  31. package/dist/web/assets/SessionDetail-mdmTQgo1.js +53 -0
  32. package/dist/web/assets/api-CXVT9XcZ.js +1 -0
  33. package/dist/web/assets/contract-BS78VBCV.js +2 -0
  34. package/dist/web/assets/{index-Bd-YkWkZ.css → index-C5cyw58A.css} +1 -1
  35. package/dist/web/assets/index-H2cT-6c6.js +1423 -0
  36. package/dist/web/assets/{session-indexes-BsgjUoc1.js → session-indexes-yyyWpKLf.js} +2 -2
  37. package/dist/web/index.html +6 -6
  38. package/package.json +1 -1
  39. package/dist/chunk-BYB77UAJ.js.map +0 -1
  40. package/dist/chunk-G4HRD3AR.js +0 -246
  41. package/dist/chunk-G4HRD3AR.js.map +0 -1
  42. package/dist/chunk-W4PZHL2C.js.map +0 -1
  43. package/dist/chunk-YCUN52HA.js.map +0 -1
  44. package/dist/web/assets/OverviewScreen-5hvQVp4H.js +0 -1
  45. package/dist/web/assets/Projects-Cy_v2yep.js +0 -1
  46. package/dist/web/assets/SessionDetail-DRI8R3st.js +0 -53
  47. package/dist/web/assets/api-GP9UCedC.js +0 -1
  48. package/dist/web/assets/contract-xJyW5u7a.js +0 -2
  49. package/dist/web/assets/index-DEjvzumm.js +0 -1410
  50. package/dist/web/assets/panel-ND0J63d3.js +0 -1
  51. /package/dist/{chunk-MBZ4VV4C.js.map → chunk-FCYCBGEL.js.map} +0 -0
  52. /package/dist/{chunk-3SXCTDD6.js.map → chunk-XKZSX5BM.js.map} +0 -0
  53. /package/dist/{discovery-K3GLISI6.js.map → discovery-D23RV7FY.js.map} +0 -0
@@ -1 +0,0 @@
1
- import{S as e}from"./contract-xJyW5u7a.js";var t=`access_token`,n=`codesesh:remote-access-token`,r=null;function i(){if(typeof window>`u`)return;let e=new URL(window.location.href),i=e.searchParams.get(t);if(i){r=i;try{window.sessionStorage.setItem(n,i)}catch{}e.searchParams.delete(t),window.history.replaceState(window.history.state,``,`${e.pathname}${e.search}${e.hash}`);return}try{r=window.sessionStorage.getItem(n)}catch{r=null}}function a(e={}){if(!r)return e;let t=new Headers(e.headers);return t.set(`Authorization`,`Bearer ${r}`),{...e,headers:t}}function o(e){if(!r)return e;let n=new URL(e,window.location.origin);return n.searchParams.set(t,r),`${n.pathname}${n.search}`}var s=250,c=2;async function l(e,t){let n=await fetch(e,a(t));if(!n.ok)throw new u(`${t?.method??`GET`} ${e} failed: ${n.status} ${n.statusText}`,n.status);return n.json()}var u=class extends Error{status;constructor(e,t){super(e),this.status=t}};async function d(e){return l(`/api/config`,e)}async function f(){return l(`/api/status`)}function p(e,t){t?.from!=null&&e.set(`from`,new Date(t.from).toISOString()),t?.to!=null&&e.set(`to`,new Date(t.to).toISOString())}async function m(e,t){let n=new URLSearchParams;return p(n,e),l(`/api/agents?${n}`,t)}async function h(e,t){let n=new URLSearchParams;return p(n,e),n.set(`limit`,t?.project?`1`:`100`),t?.cursor&&n.set(`cursor`,t.cursor),t?.project&&(n.set(`projectKind`,t.project.kind),n.set(`projectKey`,t.project.key)),l(`/api/projects?${n}`,t?.signal?{signal:t.signal}:void 0)}async function g(e,t,n){return(await h(e,{...n,project:t})).projects[0]??null}async function _(e={},t,n){let r=new URLSearchParams;e.agent&&r.set(`agent`,e.agent),e.projectKind&&r.set(`projectKind`,e.projectKind),e.projectKey&&r.set(`projectKey`,e.projectKey),p(r,e);let i=0;for(;;)try{let e=[],i;do{let a=new URLSearchParams(r);a.set(`limit`,String(s)),i&&a.set(`cursor`,i);let o=await l(`/api/sessions?${a}`,t);e.push(...o.sessions),i||n?.onFirstPage?.([...e]),i=o.nextCursor}while(i);return{sessions:e}}catch(e){if(!(e instanceof u)||e.status!==409||i>=c)throw e;i+=1}}async function v(t,n,r){let i=`/api/sessions${e({agentName:t,sessionId:n})}`,a=r?{signal:r.signal}:void 0;return r?.messageCursor?l(`${i}?${new URLSearchParams({messageCursor:r.messageCursor})}`,a):l(i,a)}async function y(e,t,n){let r=new URLSearchParams;e?.days!==0&&p(r,e),e?.days!=null&&r.set(`days`,String(e.days)),t.project&&(r.set(`projectKind`,t.project.kind),r.set(`projectKey`,t.project.key)),t.agent&&r.set(`agent`,t.agent);let i=r.toString();return l(i?`/api/dashboard?${i}`:`/api/dashboard`,n)}async function b(e,t={},n){let r=new URLSearchParams;return r.set(`q`,e),t.agent&&r.set(`agent`,t.agent),t.projectKind&&r.set(`projectKind`,t.projectKind),t.projectKey&&r.set(`projectKey`,t.projectKey),t.tag&&r.set(`tag`,t.tag),t.tool&&r.set(`tool`,t.tool),t.fileKind&&r.set(`fileActivity`,t.fileKind),t.costMin!=null&&r.set(`costMin`,String(t.costMin)),t.costMax!=null&&r.set(`costMax`,String(t.costMax)),p(r,t),l(`/api/search?${r}`,n)}async function x(e){return l(`/api/bookmarks`,e)}async function S(e){return l(`/api/bookmarks`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({reference:e})})}async function C(e){return l(`/api/bookmarks/import`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}async function w(t){await l(`/api/bookmarks${e(t)}`,{method:`DELETE`})}async function T(t,n,r){await l(`/api/session-aliases${e({agentName:t,sessionId:n})}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({alias:r})})}async function E(t,n){await l(`/api/session-aliases${e({agentName:t,sessionId:n})}`,{method:`DELETE`})}function D(e,t={}){let n=JSON.stringify({event:e,data:t});try{if(!r&&typeof navigator<`u`&&navigator.sendBeacon){let e=new Blob([n],{type:`application/json`});if(navigator.sendBeacon(`/api/logs`,e))return}}catch{}fetch(`/api/logs`,a({method:`POST`,headers:{"Content-Type":`application/json`},body:n,keepalive:!0})).catch(()=>{})}var O=1e3,k=3e4,A=5e3;function j(e){let t=e*.2;return e+(Math.random()*2-1)*t}function M(e,t,n,r){let i=!1,a,s,c=O,l=!1,u=!1,d,f=()=>{s!==void 0&&(clearTimeout(s),s=void 0)},p=()=>{u||(u=!0,r?.())},m=()=>{let r=new EventSource(o(`/api/events`));d=r,r.addEventListener(`sessions-updated`,t=>{try{e(JSON.parse(t.data))}catch(e){console.error(`Failed to parse session update event:`,e)}}),r.addEventListener(`scan-status`,e=>{if(t)try{t(JSON.parse(e.data))}catch(e){console.error(`Failed to parse scan status event:`,e)}}),r.onopen=()=>{f(),c=O;let e=u;u=!1,(l||e)&&n?.(),l=!0},r.onerror=()=>{if(r.readyState!==EventSource.CLOSED){s??=setTimeout(()=>{s=void 0,!i&&d===r&&p()},A);return}if(f(),r.close(),i)return;p();let e=j(c);c=Math.min(c*2,k),a=setTimeout(m,e)}};return m(),()=>{i=!0,a!==void 0&&clearTimeout(a),f(),d?.close()}}export{M as _,x as a,g as c,b as d,v as f,D as g,i as h,m as i,h as l,C as m,w as n,d as o,_ as p,E as r,y as s,u as t,f as u,S as v,T as y};
@@ -1,2 +0,0 @@
1
- function e(e){return{agentName:e.agentName.trim().toLowerCase(),sessionId:e.sessionId}}function t(t){let n=e(t);return`${n.agentName}/${n.sessionId}`}function n(e){return t(e)}function r(t,n){let r=e(t.reference),i=n?.trim().toLowerCase();if(t.reference.agentName!==r.agentName)throw Error(`Session reference is not normalized`);if(i!=null&&r.agentName!==i)throw Error(`Session reference agent "${r.agentName}" does not match "${i}"`)}function i(t){return e(t.reference).agentName}function a(e){return`/${encodeURIComponent(e.trim().toLowerCase())}`}function o(t){let n=e(t);return`${a(n.agentName)}/${encodeURIComponent(n.sessionId)}`}function s(e){return o(e.reference)}var c={read:`read`,read_file:`read`,read_file_v2:`read`,read_text_file:`read`,readfile:`read`,view_image:`read`,apply_patch:`edit`,edit:`edit`,edit_file:`edit`,edit_file_v2:`edit`,editfile:`edit`,multiedit:`edit`,notebookedit:`edit`,patch:`edit`,search_replace:`edit`,str_replace:`edit`,create_file:`write`,write:`write`,write_file:`write`,writefile:`write`,delete:`delete`,delete_file:`delete`},l={edit_file:`edit`,update_file:`edit`,write_file:`write`,delete_file:`delete`,move_file:`edit`};function u(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function d(e){let t=e.trim();return!t||t.length>300||t.includes(`
2
- `)||/^[a-z]+:\/\//i.test(t)||/[<>{}]/.test(t)?!1:t.startsWith(`/`)||t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`~/`)||t.includes(`/`)||t.includes(`\\`)?!0:/^[A-Za-z0-9_.@-]+\.[A-Za-z0-9_-]+$/.test(t)}function f(e){let t=e.trim().toLowerCase();return!t||t.includes(`command`)||t.includes(`content`)||t.includes(`text`)||t.includes(`prompt`)||t.includes(`url`)||t.includes(`body`)||t.includes(`title`)||t.includes(`description`)||t===`cwd`||t===`workdir`||t===`directory`?!1:t.includes(`file`)||t.includes(`path`)}function p(e,t,n,r=0){if(!(e==null||r>4)){if(typeof e==`string`){f(t)&&d(e)&&n.add(e.trim());return}if(Array.isArray(e)){for(let i of e)p(i,t,n,r+1);return}if(typeof e==`object`)for(let[t,i]of Object.entries(e))p(i,t,n,r+1)}}function m(e){let t=u(e);return(Array.isArray(e)?e:Array.isArray(t.content)?t.content:[]).flatMap(e=>{let t=u(e),n=typeof t.type==`string`?l[t.type]:void 0,r=t.path||t.old_path,i=typeof r==`string`?r.trim():``;return n&&i?[{kind:n,path:i}]:[]})}function h(e){return c[e.tool.trim().toLowerCase()]??null}function g(e){let t=m(e.state.input);if(t.length>0)return t;let n=h(e);if(!n)return[];let r=new Set;return p(e.state.input,``,r),[...r].map(e=>({kind:n,path:e}))}function _(e,t){let n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=(e,t)=>`${e}\0${t}`,c=e=>{let t=s(e.reference.agentName,e.reference.sessionId);o.delete(t),r.delete(t),n.set(t,e)},l=e=>{let t=s(e.reference.agentName,e.reference.sessionId);n.has(t)||o.has(t)||r.set(t,e)},u=e=>{let t=s(e.agentName,e.sessionId);o.delete(t),a.set(t,e)},d=e=>{let t=s(e.agentName,e.sessionId);i.delete(t),i.set(t,e)},f=e=>{let t=s(e.agentName,e.sessionId);n.delete(t),r.delete(t),i.delete(t),a.delete(t),o.set(t,e)};for(let t of e.newSessionRefs)u(t);for(let t of e.projectionRelatedSessionHeads??[])l(t);for(let t of e.projectionSessionOrder??[])d(t);for(let t of e.changedSessionHeads)c(t);for(let t of e.removedSessionRefs)f(t);for(let e of t.newSessionRefs)u(e);for(let e of t.projectionRelatedSessionHeads??[])l(e);for(let e of t.projectionSessionOrder??[])d(e);for(let e of t.changedSessionHeads)c(e);for(let e of t.removedSessionRefs)f(e);return{type:`sessions-updated`,changedAgents:Array.from(new Set([...e.changedAgents,...t.changedAgents])),newSessionRefs:[...a.values()],totalSessions:t.totalSessions,timestamp:t.timestamp,changedSessionHeads:[...n.values()],projectionRelatedSessionHeads:[...r.values()],projectionSessionOrder:[...i.values()],removedSessionRefs:[...o.values()]}}function v(e){let t=new Date(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function y(e,t){let n=new Date(e);return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t).getTime()}function b(e){let t=new Date(e);return`${String(t.getFullYear()).padStart(4,`0`)}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}var x=new Set([`git_remote`,`git_common_dir`,`manifest_path`,`synthetic`,`path`,`loose`]);function S(e){return x.has(e)}function C(e){return`${e.kind}:${e.key}`}function w(e,t){return`${e}\0${t.toLowerCase()}`}function T(e,t){return(t.time_updated??t.time_created)-(e.time_updated??e.time_created)}function E(e){for(let t=1;t<e.length;t+=1)if(T(e[t-1],e[t])>0)return[...e].sort(T);return[...e]}function D(e,t){return n({agentName:e,sessionId:t})}function O(e,t,n){let r=e.get(t);r?r.push(n):e.set(t,[n])}function k(e){let t=new Map,r=new Map,i=new Map,a=new Map,o=new Map;for(let i of e){let e=n(i.reference);t.has(e)||t.set(e,i),i.parent_reference&&O(r,n(i.parent_reference),i)}let s=E(e);for(let e of s){let{agentName:t}=e.reference;O(i,t,e);let n=e.project_identity;if(!n?.key)continue;let r=C(n);O(a,r,e),O(o,w(r,t),e)}return{sourceSessions:e,sessionsByActivity:s,byRouteKey:t,childrenByParentRouteKey:r,byAgent:i,byProjectIdentityKey:a,byProjectAgentKey:o}}function A(e,t,r){let i=new Map;for(let t of e)i.set(n(t.reference),t);for(let e of r)i.delete(n(e));for(let e of t)i.set(n(e.reference),e.session);return E([...i.values()])}function j(e){return n(e.reference)}function M(e){return e.parent_reference?n(e.parent_reference):null}function N(e){return e.time_updated??e.time_created}function P(e,t,n){let r=N(e);return(t==null||r>=t)&&(n==null||r<=n)}function F(e){let t=e.stats,n=t.total_cost??0;return{messageCount:t.message_count,inputTokens:t.total_input_tokens,outputTokens:t.total_output_tokens,cacheReadTokens:t.total_cache_read_tokens??0,cacheCreateTokens:t.total_cache_create_tokens??0,totalTokens:t.total_tokens??t.total_input_tokens+t.total_output_tokens,cost:n,costSource:n>0?t.cost_source??`recorded`:void 0}}function I(e,t){e.messageCount+=t.messageCount,e.inputTokens+=t.inputTokens,e.outputTokens+=t.outputTokens,e.cacheReadTokens+=t.cacheReadTokens,e.cacheCreateTokens+=t.cacheCreateTokens,e.totalTokens+=t.totalTokens,e.cost+=t.cost,t.costSource===`estimated`&&(e.costSource=`estimated`)}function L(e){let t=[],n=[e];for(;n.length>0;){let e=n.pop();t.push(e);for(let t of e.children)n.push(t)}for(let e=t.length-1;e>=0;--e){let n=t[e],r=n.inclusiveStats,i=0;for(let e of n.children)i+=1+e.descendantCount,I(r,e.inclusiveStats);r.cost>0&&r.costSource==null&&(r.costSource=`recorded`),n.descendantCount=i}}function R(e){let t=new Map;for(let n of e){let e=j(n);t.has(e)||t.set(e,{session:n,children:[],descendantCount:0,inclusiveStats:F(n)})}let n=[...t.values()],r=new Map;function i(e){let n=[],i=new Set,a=e,o=!0;for(;a!=null;){let e=r.get(a);if(e!=null){o=e;break}if(i.has(a)){o=!1;break}i.add(a),n.push(a);let s=M(t.get(a).session);a=s!=null&&t.has(s)?s:null}for(let e of n)r.set(e,o);return o}let a=new Map,o=[],s=[],c=[];for(let e of n){let n=j(e.session),r=M(e.session),l=r==null?`root`:t.has(r)&&i(n)?`mounted-child`:`orphan`;if(a.set(n,l),l===`mounted-child`){t.get(r).children.push(e);continue}(l===`root`?o:s).push(e),c.push(e)}for(let e of c)L(e);return{roots:o,orphans:s,entries:c,byRouteKey:t,mountStateOf(e){return a.get(j(e))??(e.parent_reference?`orphan`:`root`)}}}function z(e){let t=new Map;for(let n of e){let e=N(n.session),r=b(e),i=t.get(r);i||(i={dayKey:r,dayStart:v(e),nodes:[],mainCount:0,subCount:0},t.set(r,i)),i.nodes.push(n)}let n=[...t.values()];for(let e of n)e.nodes.sort((e,t)=>T(e.session,t.session)),e.mainCount=e.nodes.length,e.subCount=e.nodes.reduce((e,t)=>e+t.descendantCount,0);return n.sort((e,t)=>t.dayStart-e.dayStart)}function B(e,t,n,r=R(e)){if(t==null&&n==null)return e;let i=V(r,t,n),a=new Set;for(;i.length>0;){let e=i.pop(),t=j(e.session);if(!a.has(t)){a.add(t);for(let t of e.children)i.push(t)}}return e.filter(e=>a.has(j(e)))}function V(e,t,n){return t==null&&n==null?e.entries:e.entries.filter(e=>P(e.session,t,n))}function H(e,t){let r=new Set(e.map(j)),i=[...t.projectionRelatedSessionHeads??[],...t.changedSessionHeads],a=new Map(i.map(e=>[n(e.reference),e])),o=new Map(e.map(e=>[j(e),e])),s=[],c=[];for(let e of t.projectionSessionOrder??[]){let t=n(e),r=a.get(t),i=r?.session??o.get(t);i&&(s.push(r??{reference:e,session:i}),c.push(e),a.delete(t))}s.push(...a.values());let l=B(A(e,s,[...t.removedSessionRefs,...c]),t.from,t.to),u=new Set(l.map(j)),d=0,f=0;for(let e of u)r.has(e)||(d+=1);for(let e of r)u.has(e)||(f+=1);return{sessions:l,visibleAddedSessions:d,visibleRemovedSessions:f}}export{o as S,t as _,k as a,s as b,C as c,S as d,_ as f,r as g,a as h,h as i,D as l,b as m,H as n,g as o,v as p,R as r,w as s,y as t,z as u,i as v,e as x,n as y};