@rho-workspace/rho 0.5.5 → 0.5.6

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 (106) hide show
  1. package/dist/agent-connect.d.ts +8 -0
  2. package/dist/agent-connect.js +15 -0
  3. package/dist/browser-access.js +1 -1
  4. package/dist/cli.js +38 -8
  5. package/dist/contract.generated.d.ts +148 -5
  6. package/dist/contract.generated.js +1 -1
  7. package/dist/contracts/owners.generated.js +107 -12
  8. package/dist/conversations.d.ts +157 -4
  9. package/dist/conversations.js +69 -6
  10. package/dist/discovery.js +1 -1
  11. package/dist/protocol.d.ts +1 -0
  12. package/dist/protocol.js +12 -5
  13. package/dist/server.d.ts +2 -10
  14. package/dist/server.js +71 -8
  15. package/dist/web/.vite/manifest.json +61 -61
  16. package/dist/web/assets/{choices-b0XhrGQV.js → choices-D-YfnFP6.js} +1 -1
  17. package/dist/web/assets/{console-BSjLGe0T.js → console-Trqc0swD.js} +1 -1
  18. package/dist/web/assets/{dist-Buk0lwzI.js → dist-DZmszrjG.js} +1 -1
  19. package/dist/web/assets/{dist-Cw8hRIlT.js → dist-DpIHRk3B.js} +1 -1
  20. package/dist/web/assets/{dist-foH9IKc6.js → dist-eMx6b8N1.js} +1 -1
  21. package/dist/web/assets/{dist-Tzoe_zm-.js → dist-pF902jHA.js} +1 -1
  22. package/dist/web/assets/{explore-in-BVUy3ZW_.js → explore-in-BCHqjJ7B.js} +1 -1
  23. package/dist/web/assets/{graph-1OdIJ9l7.js → graph-lENgfQNH.js} +1 -1
  24. package/dist/web/assets/index-B3_OVy91.css +1 -0
  25. package/dist/web/assets/{index-CxmItXqa.js → index-BpL_Kl_s.js} +84 -83
  26. package/dist/web/assets/{notes-meaning-pVbbQUGP.js → notes-meaning-DcVGUBBY.js} +1 -1
  27. package/dist/web/assets/{overview-B9UtVJ32.js → overview-CDnVKlOt.js} +3 -3
  28. package/dist/web/assets/{preview-CksD_5KS.js → preview-BEC1E9MK.js} +1 -1
  29. package/dist/web/assets/{review-CMxQlQ-C.js → review-DYP0aCXb.js} +1 -1
  30. package/dist/web/assets/{skills-BFNSyrnD.js → skills-1ec0Z-jx.js} +1 -1
  31. package/dist/web/assets/{skills-work-BGPSnF_I.js → skills-work-DNexV4OJ.js} +1 -1
  32. package/dist/web/assets/{studio-process-CsRoTHOh.js → studio-process-EYQgikxq.js} +1 -1
  33. package/dist/web/assets/{timeline-events-BbuuFWHV.js → timeline-events-Chj2Gbx7.js} +1 -1
  34. package/dist/web/assets/{work-turns-BvJlIMmA.js → work-turns-CT9RVcWY.js} +1 -1
  35. package/dist/web/assets/{workspace-CWlkjLNx.js → workspace-COmCbGV3.js} +1 -1
  36. package/dist/web/composition.json +58 -58
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/renderer.json +1 -1
  39. package/docs/FRONTEND.md +26 -18
  40. package/docs/HEADLESS.md +37 -27
  41. package/node_modules/@rho-workspace/plugin-agent/README.md +29 -0
  42. package/node_modules/@rho-workspace/plugin-agent/dist/acp-command.d.ts +1 -0
  43. package/node_modules/@rho-workspace/plugin-agent/dist/acp-command.js +9 -1
  44. package/node_modules/@rho-workspace/plugin-agent/dist/acp-conversation.d.ts +1 -0
  45. package/node_modules/@rho-workspace/plugin-agent/dist/acp-conversation.js +10 -0
  46. package/node_modules/@rho-workspace/plugin-agent/dist/external-session-contract.js +10 -5
  47. package/node_modules/@rho-workspace/plugin-agent/dist/external-session.d.ts +12 -1
  48. package/node_modules/@rho-workspace/plugin-agent/dist/native-sessions.d.ts +70 -0
  49. package/node_modules/@rho-workspace/plugin-agent/dist/native-sessions.js +538 -0
  50. package/node_modules/@rho-workspace/plugin-agent/package.json +2 -1
  51. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
  52. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
  53. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
  54. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
  55. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +1 -1
  56. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +2 -1
  57. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +5 -3
  58. package/node_modules/hono/dist/cjs/jsx/base.js +49 -30
  59. package/node_modules/hono/dist/cjs/jsx/components.js +2 -2
  60. package/node_modules/hono/dist/cjs/jsx/constants.js +2 -0
  61. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +13 -17
  62. package/node_modules/hono/dist/cjs/middleware/etag/index.js +3 -1
  63. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +1 -0
  64. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +4 -3
  65. package/node_modules/hono/dist/cjs/utils/cookie.js +2 -2
  66. package/node_modules/hono/dist/cjs/utils/mime.js +1 -1
  67. package/node_modules/hono/dist/cjs/utils/url.js +1 -1
  68. package/node_modules/hono/dist/client/fetch-result-please.js +1 -1
  69. package/node_modules/hono/dist/helper/accepts/accepts.js +2 -1
  70. package/node_modules/hono/dist/helper/ssg/ssg.js +5 -3
  71. package/node_modules/hono/dist/jsx/base.js +49 -32
  72. package/node_modules/hono/dist/jsx/components.js +2 -2
  73. package/node_modules/hono/dist/jsx/constants.js +2 -1
  74. package/node_modules/hono/dist/jsx/jsx-runtime.js +15 -19
  75. package/node_modules/hono/dist/middleware/etag/index.js +3 -1
  76. package/node_modules/hono/dist/middleware/language/language.js +1 -1
  77. package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -0
  78. package/node_modules/hono/dist/middleware/timing/timing.js +4 -3
  79. package/node_modules/hono/dist/utils/cookie.js +2 -2
  80. package/node_modules/hono/dist/utils/mime.js +1 -1
  81. package/node_modules/hono/dist/utils/url.js +1 -1
  82. package/node_modules/hono/package.json +1 -1
  83. package/package.json +2 -2
  84. package/protocol/index.json +39 -33
  85. package/protocol/operations/agent.sessions.list.json +49 -3
  86. package/protocol/operations/agent.sessions.read.json +53 -4
  87. package/protocol/operations/conversation.configure.json +29 -0
  88. package/protocol/operations/conversation.decide.json +29 -0
  89. package/protocol/operations/conversation.list.json +29 -0
  90. package/protocol/operations/conversation.permission.json +29 -0
  91. package/protocol/operations/conversation.read.json +29 -0
  92. package/protocol/operations/conversation.restore.json +29 -0
  93. package/protocol/operations/conversation.send.json +29 -0
  94. package/protocol/operations/conversation.settings.check.json +92 -0
  95. package/protocol/operations/conversation.settings.read.json +92 -0
  96. package/protocol/operations/conversation.settings.update.json +92 -0
  97. package/protocol/operations/conversation.start.json +46 -1
  98. package/protocol/operations/conversation.stop.json +29 -0
  99. package/protocol/operations/conversation.trash.json +29 -0
  100. package/protocol/operations/observation.snapshot.json +29 -0
  101. package/protocol/operations/session.instructions.json +43 -0
  102. package/vendor/composition.json +74 -74
  103. package/vendor/rho-workspace-plugin-agent-0.4.30.tgz +0 -0
  104. package/web/theme.css +12 -0
  105. package/dist/web/assets/index-CsC3sTRq.css +0 -1
  106. package/vendor/rho-workspace-plugin-agent-0.4.29.tgz +0 -0
@@ -1,4 +1,4 @@
1
- import{q as e}from"./index-CxmItXqa.js";var t=[[`question`,/^(questions?|aims?|问题|研究问题)$/i],[`method`,/^(data\s*(&|and)\s*methods?|data|methods?|数据与方法|数据和方法|方法)$/i],[`finding`,/^(key\s+results?|results?|findings?|关键结果|主要结果|结果)$/i],[`choice`,/^((analysis\s+)?choices?|decisions?|选择|分析选择)$/i],[`file`,/^(files?|outputs?|文件|输出)$/i],[`todo`,/^(to\s*-?\s*dos?|next\s+steps?|待办(事项)?)$/i]],n=e=>t.find(([,t])=>t.test(e.replace(/[*_`::]/g,``).trim()))?.[0]??null;function r(e){let t=e.trim().replace(/^<|>$/g,``);if(!t||t.startsWith(`#`)||/^[a-z][a-z0-9+.-]*:/i.test(t)||(t=t.replace(/[?#].*$/,``),t.endsWith(`/`)))return null;try{t=decodeURIComponent(t)}catch{}return t=t.replace(/^\.?\//,``).replace(/\/+$/,``),!t||t.split(`/`).some(e=>e===`..`||e===`.git`||e===`.rho`)?null:t}var i=/(!?)\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(?:\s+"[^"]*")?\s*\)/g,a=/`([\w@.\/-]+\.[A-Za-z0-9]{1,6})`/g,o=/\.(csv|tsv|txt|json|jsonl|ya?ml|toml|md|qmd|rmd|ipynb|html?|pdf|png|jpe?g|gif|svg|webp|tiff?|py|r|jl|sh|js|mjs|ts|sql|xlsx?|parquet|feather|rds|rdata|h5|h5ad|hdf5|npy|npz|pkl|log|gz|zip|bam|sam|vcf|bed|gtf|gff3?|fasta|fa|fastq|fq|mtx|nc)$/i;function s(e){let t=[],n=e=>{let n=r(e);n&&!t.includes(n)&&t.push(n)};for(let t of e.matchAll(i))n(t[3]);for(let t of e.replace(i,` `).matchAll(a))(t[1].includes(`/`)||o.test(t[1]))&&n(t[1]);return t}function c(e){let t=e.replace(i,(e,t,n)=>n).replace(/^\s*(?:[-*+]|\d+[.)])\s+(\[[ xX]\]\s+)?/gm,``),n=[];return t.replace(/`([^`]*)`/g,(e,t)=>`\0`+(n.push(t)-1)+`\0`).replace(/(\*{1,3})(?=\S)([^*]+?)(?<=\S)\1/g,`$2`).replace(/(^|[^\w])(_{1,3})(?=\S)([^_]+?)(?<=\S)\2(?![\w])/g,`$1$3`).replace(/\u0000(\d+)\u0000/g,(e,t)=>n[Number(t)]).replace(/\s+/g,` `).trim()}var l=e=>e.charAt(0).toUpperCase()+e.slice(1);function u(e){let t=/^(.{2,48}?)\s*(?:=|:)\s+(\S[\s\S]*)$/.exec(e);return!t||t[1].split(/\s+/).length>6||/[.!?]\s/.test(t[1])?{topic:null,rest:e}:{topic:t[1],rest:l(t[2])}}function d(e,t){let n=e.trim(),r=``,i=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);for(let e=!0;e;){e=!1;for(let a of t){let t=RegExp(`[\\s,;]*\\(?`+i(a)+`\\)?([.;]?)$`).exec(n);t&&(n=n.slice(0,t.index),r||=t[1],e=!0)}}return n=n.replace(/[\s,;]+$/,``),r&&!/[.!?;:]$/.test(n)?n+r:n}var f=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,p=/^\s*!\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(?:\s+"[^"]*")?\s*\)\s*$/,m=/^(alternatives?|instead|other(wise)?|或者|备选|替代)\b\s*[::-]?\s*/i,h=/(?<=[.;!?)\]—])\s+(?=(?:\*\*|__)?(?:alternatives?|instead|otherwise|备选|替代)(?:\*\*|__)?\s*[::])/i;function g(t){let i=t.split(`
1
+ import{q as e}from"./index-BpL_Kl_s.js";var t=[[`question`,/^(questions?|aims?|问题|研究问题)$/i],[`method`,/^(data\s*(&|and)\s*methods?|data|methods?|数据与方法|数据和方法|方法)$/i],[`finding`,/^(key\s+results?|results?|findings?|关键结果|主要结果|结果)$/i],[`choice`,/^((analysis\s+)?choices?|decisions?|选择|分析选择)$/i],[`file`,/^(files?|outputs?|文件|输出)$/i],[`todo`,/^(to\s*-?\s*dos?|next\s+steps?|待办(事项)?)$/i]],n=e=>t.find(([,t])=>t.test(e.replace(/[*_`::]/g,``).trim()))?.[0]??null;function r(e){let t=e.trim().replace(/^<|>$/g,``);if(!t||t.startsWith(`#`)||/^[a-z][a-z0-9+.-]*:/i.test(t)||(t=t.replace(/[?#].*$/,``),t.endsWith(`/`)))return null;try{t=decodeURIComponent(t)}catch{}return t=t.replace(/^\.?\//,``).replace(/\/+$/,``),!t||t.split(`/`).some(e=>e===`..`||e===`.git`||e===`.rho`)?null:t}var i=/(!?)\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(?:\s+"[^"]*")?\s*\)/g,a=/`([\w@.\/-]+\.[A-Za-z0-9]{1,6})`/g,o=/\.(csv|tsv|txt|json|jsonl|ya?ml|toml|md|qmd|rmd|ipynb|html?|pdf|png|jpe?g|gif|svg|webp|tiff?|py|r|jl|sh|js|mjs|ts|sql|xlsx?|parquet|feather|rds|rdata|h5|h5ad|hdf5|npy|npz|pkl|log|gz|zip|bam|sam|vcf|bed|gtf|gff3?|fasta|fa|fastq|fq|mtx|nc)$/i;function s(e){let t=[],n=e=>{let n=r(e);n&&!t.includes(n)&&t.push(n)};for(let t of e.matchAll(i))n(t[3]);for(let t of e.replace(i,` `).matchAll(a))(t[1].includes(`/`)||o.test(t[1]))&&n(t[1]);return t}function c(e){let t=e.replace(i,(e,t,n)=>n).replace(/^\s*(?:[-*+]|\d+[.)])\s+(\[[ xX]\]\s+)?/gm,``),n=[];return t.replace(/`([^`]*)`/g,(e,t)=>`\0`+(n.push(t)-1)+`\0`).replace(/(\*{1,3})(?=\S)([^*]+?)(?<=\S)\1/g,`$2`).replace(/(^|[^\w])(_{1,3})(?=\S)([^_]+?)(?<=\S)\2(?![\w])/g,`$1$3`).replace(/\u0000(\d+)\u0000/g,(e,t)=>n[Number(t)]).replace(/\s+/g,` `).trim()}var l=e=>e.charAt(0).toUpperCase()+e.slice(1);function u(e){let t=/^(.{2,48}?)\s*(?:=|:)\s+(\S[\s\S]*)$/.exec(e);return!t||t[1].split(/\s+/).length>6||/[.!?]\s/.test(t[1])?{topic:null,rest:e}:{topic:t[1],rest:l(t[2])}}function d(e,t){let n=e.trim(),r=``,i=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);for(let e=!0;e;){e=!1;for(let a of t){let t=RegExp(`[\\s,;]*\\(?`+i(a)+`\\)?([.;]?)$`).exec(n);t&&(n=n.slice(0,t.index),r||=t[1],e=!0)}}return n=n.replace(/[\s,;]+$/,``),r&&!/[.!?;:]$/.test(n)?n+r:n}var f=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/,p=/^\s*!\[([^\]]*)\]\(\s*(<[^>]+>|[^)\s]+)(?:\s+"[^"]*")?\s*\)\s*$/,m=/^(alternatives?|instead|other(wise)?|或者|备选|替代)\b\s*[::-]?\s*/i,h=/(?<=[.;!?)\]—])\s+(?=(?:\*\*|__)?(?:alternatives?|instead|otherwise|备选|替代)(?:\*\*|__)?\s*[::])/i;function g(t){let i=t.split(`
2
2
  `),a=e(t);return a.map((e,t)=>{let o=t+1<a.length?a[t+1].line:_(i,e.line),l=[],u=null,d=null,g=null,v=``,y=()=>{let e=d;if(d=null,!e)return;if(e.kind===`choice`&&!e.alternatives.length){let[t,...n]=v.split(h);n.length&&(v=t,e.alternatives=n.map(e=>({text:``,source:e,links:[]})))}let t=e.kind===`choice`?v:e.source;e.text=c(t),e.links=s(t);for(let t of e.alternatives??[])t.text=c(t.source.replace(/^\s*(?:[-*+]|\d+[.)])\s+/,``)).replace(m,``),t.links=s(t.source);if(e.text||e.links.length)return l.push(e),l.length-1};for(let t=e.line+1;t<o;t++){let e=i[t],a=/^\s*(`{3,}|~{3,})/.exec(e);if(a){y(),g=g===null?a[1][0]:g===a[1][0]?null:g;continue}if(g!==null)continue;let o=/^#{3,6}\s+(.+?)\s*#*\s*$/.exec(e);if(o){y(),u=n(o[1]);continue}if(!u||/^\s*<!--.*-->\s*$/.test(e))continue;if(!e.trim()){d&&!f.test(i[t+1]??``)&&!/^\s+\S/.test(i[t+1]??``)&&y();continue}let s=p.exec(e);if(s){let n=d?.kind===`finding`,i=y(),a=r(s[2]);a&&l.push({kind:`figure`,text:s[1].trim(),source:e.trim(),line:t,links:[a],...n&&i!==void 0?{of:i}:{}});continue}let c=f.exec(e);if(c&&c[1].length<=1){y();let n=/^\[([ xX])\]\s+/.exec(c[3]);d={kind:u===`todo`||n&&u!==`choice`?`todo`:u,text:``,source:e.trim(),line:t,links:[],...n?{done:n[1]!==` `}:{}},d.kind===`choice`&&(d.alternatives=[],v=e.trim())}else if(d&&d.kind===`choice`){let t=d.alternatives;c?t.push({text:``,source:e.trim(),links:[]}):t.length?t.at(-1).source+=`
3
3
  `+e.trim():v+=`
4
4
  `+e.trim(),d.source+=`
@@ -1,6 +1,6 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-1OdIJ9l7.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-Dss-ouuy.js","assets/markdown-0ngRuTpW.js","assets/canvas-D8rDdfDz.js","assets/home-CCbP6kS-.js","assets/index-CxmItXqa.js","assets/index-CsC3sTRq.css","assets/work-turns-BvJlIMmA.js","assets/snapshot-CAxBYPvV.js","assets/timeline-events-BbuuFWHV.js","assets/choices-b0XhrGQV.js","assets/notes-meaning-pVbbQUGP.js","assets/choices-DLah50GC.css","assets/graph-BYKN84J3.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{a as r,n as i,r as a,s as o}from"./home-CCbP6kS-.js";import{r as s}from"./markdown-0ngRuTpW.js";import{C as c,L as l,N as u,n as d,s as f}from"./canvas-D8rDdfDz.js";import{At as p,Ct as m,Dt as h,Et as g,Lt as _,Nt as ee,Ot as te,Pt as ne,Q as v,Rt as y,St as b,Tt as re,Ut as ie,Vt as ae,X as oe,Y as x,Z as S,bt as C,gt as w,i as T,jt as se,kt as ce,qt as le,ut as E,vt as D,wt as O,xt as ue,y as k,yt as A}from"./index-CxmItXqa.js";import{c as de,d as fe,f as pe,l as me,t as he,u as ge}from"./facts-BMO6V3-3.js";import{t as _e}from"./work-turns-BvJlIMmA.js";import{n as j,t as ve}from"./choices-b0XhrGQV.js";import{t as M,u as N}from"./skills-work-BGPSnF_I.js";import{t as P}from"./explore-in-BVUy3ZW_.js";import{n as ye,r as F}from"./answer-board-CBkGbSLD.js";var I=e(n(),1),L=t(),R={running:`Answering`,completed:`Last message answered`,failed:`Last message failed`,stopped:`Stopped`,unknown:`Outcome unknown`,retained:`Retained native activity`,idle:`No messages`};function z(e,t,n,r){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(!n)return;let i=!0,o=!1,c=!1,f=new AbortController,p=async()=>{if(o)c=!0;else{o=!0,l(!0);try{let n=await e.call(`project.work.read`,{projectId:t.project.id},f.signal);i&&(a(n),s(``),r(n.sessions.length>0))}catch(e){i&&s(e instanceof Error?e.message:`Could not read project work.`)}finally{o=!1,i&&(l(!1),c&&(c=!1,m()))}}},m=()=>{u.current||=setTimeout(()=>{u.current=null,p()},750)};d.current=m,p();let h=setInterval(()=>{document.hidden||m()},1500);return()=>{clearInterval(h),i=!1,f.abort(),u.current&&clearTimeout(u.current),u.current=null,d.current=null}},[e,t.project.id,n]),(0,I.useEffect)(()=>{d.current?.()},[t.cursor]),{work:i,problem:o,reading:c,refresh:()=>d.current?.()}}function be({state:e,openConversation:t,openActivity:n,boarded:r=!1}){let{work:i,problem:a,reading:o,refresh:s}=e,c=i?.sessions.filter(e=>!e.conversationId||(e.pendingPermissions??0)>0||!r&&e.state===`running`)??[];return!c.length&&!a?null:(0,L.jsxs)(`section`,{className:`project-section project-work`,"aria-label":`Project work`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Work progress`}),(0,L.jsx)(`button`,{className:`text-button`,disabled:o,onClick:s,children:o?`Reading…`:`Refresh`})]}),a&&(0,L.jsxs)(`p`,{role:`alert`,children:[a,` Retained observations remain below.`]}),c.length>0&&(0,L.jsx)(`div`,{className:`work-sessions`,children:c.map(e=>(0,L.jsxs)(`article`,{className:`work-session`,children:[(0,L.jsxs)(`header`,{children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:e.title}),(0,L.jsxs)(`p`,{children:[R[e.state]??e.state,` · `,e.source===`acp`?e.agent===`codex`?`Codex · ACP`:`Claude Code · ACP`:e.source===`external-acp`?`External ACP`:e.source===`native-transcript`?`Native transcript`:e.source===`external-session`?`DeepSeek Harness · Outside Rho`:`Claude CLI`]})]}),e.conversationId?(0,L.jsx)(`button`,{onClick:()=>t(e.conversationId),children:`Continue conversation`}):e.source===`external-acp`?(0,L.jsx)(`span`,{className:`muted`,children:`Input stays in the original client`}):(0,L.jsx)(`button`,{onClick:n,children:e.source===`external-session`?`View conversation`:`View activity`})]}),e.observation?(0,L.jsx)(h,{observation:e.observation}):e.source===`native-transcript`?(0,L.jsxs)(`p`,{className:`muted`,children:[`Input stays in the original window. Retained through cursor `,e.cursor,`; `,e.droppedEvents??0,` events dropped.`]}):e.source===`external-session`?(0,L.jsx)(`p`,{className:`muted`,children:`Conversation, operations and results are retained on the Agent page. Input stays in DeepSeek Harness.`}):(0,L.jsx)(`p`,{className:`muted`,children:`No session projection retained yet.`}),e.source===`external-acp`&&(0,L.jsxs)(L.Fragment,{children:[(e.pendingPermissions??0)>0&&(0,L.jsx)(`p`,{role:`status`,children:`Waiting for a permission choice in the original client.`}),e.lastMessage&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:`Latest reply · read only`}),(0,L.jsx)(`p`,{className:`external-reply`,children:e.lastMessage}),(e.omittedMessageChars??0)>0&&(0,L.jsx)(`small`,{children:`Later reply text was not retained.`})]})]})]},e.id))})]})}var B=e=>/\.(png|jpe?g|svg|gif|pdf|tiff?|webp)$/i.test(e)?`image`:/\.(csv|tsv|xlsx?|parquet|rds|rda|feather)$/i.test(e)?`table`:/\.(R|r|py|sh|sql|js|ts|jl|Rmd|qmd)$/.test(e)?`code`:/\.(md|txt)$/i.test(e)?`document`:`file`;function xe({work:e,openFile:t,openActivity:n}){if(!e||!e.files.length&&!e.omitted.fileReferences)return null;let r=[...e.files].sort((e,t)=>t.references.length-e.references.length),i=Math.max(1,...r.map(e=>e.references.length)),a=e.omitted.fileReferences;return(0,L.jsxs)(`section`,{className:`project-section touched-files`,"aria-labelledby":`touched-title`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{id:`touched-title`,children:`Files the Agent used`}),(0,L.jsx)(`span`,{className:`touched-unit`,children:`Tool calls`})]}),(0,L.jsx)(`ul`,{className:`touched-list`,children:r.map((n,r)=>{let a=n.path.split(`/`),o=a.pop(),c=a.join(`/`),l=n.state===`observed`,u=[...new Set(n.references.map(t=>e.sessions.find(e=>e.id===t.session)?.title??t.session))];return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`touched-row`+(r===0?` top`:``),"aria-label":n.path,title:`${n.path}\nNamed in ${u.join(`, `)}`,disabled:!l,onClick:()=>t(n.path),children:[(0,L.jsx)(s,{name:B(o),size:16,stroke:1.6}),(0,L.jsxs)(`span`,{className:`touched-name`,children:[(0,L.jsx)(`strong`,{children:o}),(0,L.jsx)(`small`,{children:l?c||`Project folder`:n.state.replaceAll(`-`,` `)}),(0,L.jsx)(`i`,{"aria-hidden":`true`,style:{width:`${Math.max(4,n.references.length/i*100)}%`}})]}),(0,L.jsx)(`span`,{className:`touched-count`,children:n.references.length})]})},n.path)})}),a>0&&(0,L.jsxs)(`p`,{className:`touched-more`,children:[a,` more outside the project or past the limit`]}),e.native.state===`available`&&(0,L.jsxs)(`button`,{className:`text-button touched-native`,onClick:n,children:[`View native activity `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})}function Se({work:e,openFile:t}){let n=e?.notes.path??`project-notes.md`;return(0,L.jsxs)(`button`,{className:`notes-card`,"aria-label":`Open shared notes`,onClick:()=>t(n),children:[(0,L.jsxs)(`span`,{className:`notes-sheet`,"aria-hidden":`true`,children:[(0,L.jsx)(`i`,{}),(0,L.jsx)(`i`,{}),(0,L.jsx)(`i`,{})]}),(0,L.jsxs)(`span`,{className:`notes-name`,children:[(0,L.jsx)(`strong`,{children:`Shared notes`}),(0,L.jsx)(`small`,{children:n})]}),(0,L.jsx)(s,{name:`chevron`,size:14})]})}var V=e=>({path:e.path,bytes:e.bytes,modifiedAt:e.modifiedAt,resource:e.resource?{...e.resource,kind:/\.(csv|tsv)$/i.test(e.path)?`table`:`file`}:void 0}),H={completed:`Answered`,failed:`Failed`,stopped:`Stopped`,running:`Working`,unknown:`Outcome unknown`};function U(e){let t=typeof e==`number`?e:typeof e==`string`&&/^-?\d+\.\d+(?:e[-+]?\d+)?$/i.test(e.trim())?Number(e):NaN;return Number.isFinite(t)?String(Number.isInteger(t)?t:Math.abs(t)>=1e5?Math.round(t):Number(t.toPrecision(4))):e==null?``:String(e)}function W({client:e,snapshot:t,node:n}){let[r,i]=(0,I.useState)(null),a=n.path+`@`+(n.resource?.version??n.modifiedAt);return(0,I.useEffect)(()=>{let r=!0;return D(e,t,V(n)).then(e=>{r&&i(e)}),()=>{r=!1}},[a]),r?r.kind===`image`?(0,L.jsx)(`img`,{className:`board-figure`,src:r.url,alt:n.title}):(0,L.jsx)(`span`,{className:`board-figure none`,children:r.kind===`none`?r.note:``}):(0,L.jsx)(`span`,{className:`board-figure loading`,"aria-hidden":`true`})}function G({client:e,snapshot:t,node:n,rows:r}){let[i,a]=(0,I.useState)(void 0),o=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,I.useEffect)(()=>{let i=!0;return A(e,t,V(n),r).then(e=>{i&&a(e)}),()=>{i=!1}},[o,r]),i===void 0)return(0,L.jsx)(`span`,{className:`board-table loading`,"aria-hidden":`true`});if(!i)return(0,L.jsx)(`p`,{className:`board-note`,children:`This table could not be read.`});let s=i.rows.slice(0,r);return(0,L.jsxs)(`div`,{className:`board-table-wrap`,children:[(0,L.jsxs)(`table`,{className:`board-table`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsx)(`tr`,{children:i.columns.map(e=>(0,L.jsx)(`th`,{title:e,children:e},e))})}),(0,L.jsx)(`tbody`,{children:s.map((e,t)=>(0,L.jsx)(`tr`,{children:i.columns.map(t=>(0,L.jsx)(`td`,{title:e[t]===null||e[t]===void 0?``:String(e[t]),children:U(e[t])},t))},t))})]}),(0,L.jsxs)(`small`,{children:[i.total>s.length?`First ${s.length} of ${i.total.toLocaleString()} rows`:`${i.total.toLocaleString()} ${i.total===1?`row`:`rows`}`,i.width>i.columns.length?` · ${i.columns.length} of ${i.width} columns`:``]})]})}function Ce(e,t){let n=e.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-lENgfQNH.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-Dss-ouuy.js","assets/markdown-0ngRuTpW.js","assets/canvas-D8rDdfDz.js","assets/home-CCbP6kS-.js","assets/index-BpL_Kl_s.js","assets/index-B3_OVy91.css","assets/work-turns-CT9RVcWY.js","assets/snapshot-CAxBYPvV.js","assets/timeline-events-Chj2Gbx7.js","assets/choices-D-YfnFP6.js","assets/notes-meaning-DcVGUBBY.js","assets/choices-DLah50GC.css","assets/graph-BYKN84J3.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{a as r,n as i,r as a,s as o}from"./home-CCbP6kS-.js";import{r as s}from"./markdown-0ngRuTpW.js";import{C as c,L as l,N as u,n as d,s as f}from"./canvas-D8rDdfDz.js";import{At as p,Ct as m,Dt as h,Et as g,Lt as _,Nt as ee,Ot as te,Pt as ne,Q as v,Rt as y,St as b,Tt as re,Ut as ie,Vt as ae,X as oe,Y as x,Z as S,bt as C,gt as w,i as T,jt as se,kt as ce,qt as le,ut as E,vt as D,wt as O,xt as ue,y as k,yt as A}from"./index-BpL_Kl_s.js";import{c as de,d as fe,f as pe,l as me,t as he,u as ge}from"./facts-BMO6V3-3.js";import{t as _e}from"./work-turns-CT9RVcWY.js";import{n as j,t as ve}from"./choices-D-YfnFP6.js";import{t as M,u as N}from"./skills-work-DNexV4OJ.js";import{t as P}from"./explore-in-BCHqjJ7B.js";import{n as ye,r as F}from"./answer-board-CBkGbSLD.js";var I=e(n(),1),L=t(),R={running:`Answering`,completed:`Last message answered`,failed:`Last message failed`,stopped:`Stopped`,unknown:`Outcome unknown`,retained:`Retained native activity`,idle:`No messages`};function z(e,t,n,r){let[i,a]=(0,I.useState)(null),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(!1),u=(0,I.useRef)(null),d=(0,I.useRef)(null);return(0,I.useEffect)(()=>{if(!n)return;let i=!0,o=!1,c=!1,f=new AbortController,p=async()=>{if(o)c=!0;else{o=!0,l(!0);try{let n=await e.call(`project.work.read`,{projectId:t.project.id},f.signal);i&&(a(n),s(``),r(n.sessions.length>0))}catch(e){i&&s(e instanceof Error?e.message:`Could not read project work.`)}finally{o=!1,i&&(l(!1),c&&(c=!1,m()))}}},m=()=>{u.current||=setTimeout(()=>{u.current=null,p()},750)};d.current=m,p();let h=setInterval(()=>{document.hidden||m()},1500);return()=>{clearInterval(h),i=!1,f.abort(),u.current&&clearTimeout(u.current),u.current=null,d.current=null}},[e,t.project.id,n]),(0,I.useEffect)(()=>{d.current?.()},[t.cursor]),{work:i,problem:o,reading:c,refresh:()=>d.current?.()}}function be({state:e,openConversation:t,openActivity:n,boarded:r=!1}){let{work:i,problem:a,reading:o,refresh:s}=e,c=i?.sessions.filter(e=>!e.conversationId||(e.pendingPermissions??0)>0||!r&&e.state===`running`)??[];return!c.length&&!a?null:(0,L.jsxs)(`section`,{className:`project-section project-work`,"aria-label":`Project work`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Work progress`}),(0,L.jsx)(`button`,{className:`text-button`,disabled:o,onClick:s,children:o?`Reading…`:`Refresh`})]}),a&&(0,L.jsxs)(`p`,{role:`alert`,children:[a,` Retained observations remain below.`]}),c.length>0&&(0,L.jsx)(`div`,{className:`work-sessions`,children:c.map(e=>(0,L.jsxs)(`article`,{className:`work-session`,children:[(0,L.jsxs)(`header`,{children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:e.title}),(0,L.jsxs)(`p`,{children:[R[e.state]??e.state,` · `,e.source===`acp`?e.agent===`codex`?`Codex · ACP`:`Claude Code · ACP`:e.source===`external-acp`?`External ACP`:e.source===`native-transcript`?`Native transcript`:e.source===`external-session`?`DeepSeek Harness · Outside Rho`:`Claude CLI`]})]}),e.conversationId?(0,L.jsx)(`button`,{onClick:()=>t(e.conversationId),children:`Continue conversation`}):e.source===`external-acp`?(0,L.jsx)(`span`,{className:`muted`,children:`Input stays in the original client`}):(0,L.jsx)(`button`,{onClick:n,children:e.source===`external-session`?`View conversation`:`View activity`})]}),e.observation?(0,L.jsx)(h,{observation:e.observation}):e.source===`native-transcript`?(0,L.jsxs)(`p`,{className:`muted`,children:[`Input stays in the original window. Retained through cursor `,e.cursor,`; `,e.droppedEvents??0,` events dropped.`]}):e.source===`external-session`?(0,L.jsx)(`p`,{className:`muted`,children:`Conversation, operations and results are retained on the Agent page. Input stays in DeepSeek Harness.`}):(0,L.jsx)(`p`,{className:`muted`,children:`No session projection retained yet.`}),e.source===`external-acp`&&(0,L.jsxs)(L.Fragment,{children:[(e.pendingPermissions??0)>0&&(0,L.jsx)(`p`,{role:`status`,children:`Waiting for a permission choice in the original client.`}),e.lastMessage&&(0,L.jsxs)(`details`,{children:[(0,L.jsx)(`summary`,{children:`Latest reply · read only`}),(0,L.jsx)(`p`,{className:`external-reply`,children:e.lastMessage}),(e.omittedMessageChars??0)>0&&(0,L.jsx)(`small`,{children:`Later reply text was not retained.`})]})]})]},e.id))})]})}var B=e=>/\.(png|jpe?g|svg|gif|pdf|tiff?|webp)$/i.test(e)?`image`:/\.(csv|tsv|xlsx?|parquet|rds|rda|feather)$/i.test(e)?`table`:/\.(R|r|py|sh|sql|js|ts|jl|Rmd|qmd)$/.test(e)?`code`:/\.(md|txt)$/i.test(e)?`document`:`file`;function xe({work:e,openFile:t,openActivity:n}){if(!e||!e.files.length&&!e.omitted.fileReferences)return null;let r=[...e.files].sort((e,t)=>t.references.length-e.references.length),i=Math.max(1,...r.map(e=>e.references.length)),a=e.omitted.fileReferences;return(0,L.jsxs)(`section`,{className:`project-section touched-files`,"aria-labelledby":`touched-title`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{id:`touched-title`,children:`Files the Agent used`}),(0,L.jsx)(`span`,{className:`touched-unit`,children:`Tool calls`})]}),(0,L.jsx)(`ul`,{className:`touched-list`,children:r.map((n,r)=>{let a=n.path.split(`/`),o=a.pop(),c=a.join(`/`),l=n.state===`observed`,u=[...new Set(n.references.map(t=>e.sessions.find(e=>e.id===t.session)?.title??t.session))];return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`touched-row`+(r===0?` top`:``),"aria-label":n.path,title:`${n.path}\nNamed in ${u.join(`, `)}`,disabled:!l,onClick:()=>t(n.path),children:[(0,L.jsx)(s,{name:B(o),size:16,stroke:1.6}),(0,L.jsxs)(`span`,{className:`touched-name`,children:[(0,L.jsx)(`strong`,{children:o}),(0,L.jsx)(`small`,{children:l?c||`Project folder`:n.state.replaceAll(`-`,` `)}),(0,L.jsx)(`i`,{"aria-hidden":`true`,style:{width:`${Math.max(4,n.references.length/i*100)}%`}})]}),(0,L.jsx)(`span`,{className:`touched-count`,children:n.references.length})]})},n.path)})}),a>0&&(0,L.jsxs)(`p`,{className:`touched-more`,children:[a,` more outside the project or past the limit`]}),e.native.state===`available`&&(0,L.jsxs)(`button`,{className:`text-button touched-native`,onClick:n,children:[`View native activity `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})}function Se({work:e,openFile:t}){let n=e?.notes.path??`project-notes.md`;return(0,L.jsxs)(`button`,{className:`notes-card`,"aria-label":`Open shared notes`,onClick:()=>t(n),children:[(0,L.jsxs)(`span`,{className:`notes-sheet`,"aria-hidden":`true`,children:[(0,L.jsx)(`i`,{}),(0,L.jsx)(`i`,{}),(0,L.jsx)(`i`,{})]}),(0,L.jsxs)(`span`,{className:`notes-name`,children:[(0,L.jsx)(`strong`,{children:`Shared notes`}),(0,L.jsx)(`small`,{children:n})]}),(0,L.jsx)(s,{name:`chevron`,size:14})]})}var V=e=>({path:e.path,bytes:e.bytes,modifiedAt:e.modifiedAt,resource:e.resource?{...e.resource,kind:/\.(csv|tsv)$/i.test(e.path)?`table`:`file`}:void 0}),H={completed:`Answered`,failed:`Failed`,stopped:`Stopped`,running:`Working`,unknown:`Outcome unknown`};function U(e){let t=typeof e==`number`?e:typeof e==`string`&&/^-?\d+\.\d+(?:e[-+]?\d+)?$/i.test(e.trim())?Number(e):NaN;return Number.isFinite(t)?String(Number.isInteger(t)?t:Math.abs(t)>=1e5?Math.round(t):Number(t.toPrecision(4))):e==null?``:String(e)}function W({client:e,snapshot:t,node:n}){let[r,i]=(0,I.useState)(null),a=n.path+`@`+(n.resource?.version??n.modifiedAt);return(0,I.useEffect)(()=>{let r=!0;return D(e,t,V(n)).then(e=>{r&&i(e)}),()=>{r=!1}},[a]),r?r.kind===`image`?(0,L.jsx)(`img`,{className:`board-figure`,src:r.url,alt:n.title}):(0,L.jsx)(`span`,{className:`board-figure none`,children:r.kind===`none`?r.note:``}):(0,L.jsx)(`span`,{className:`board-figure loading`,"aria-hidden":`true`})}function G({client:e,snapshot:t,node:n,rows:r}){let[i,a]=(0,I.useState)(void 0),o=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,I.useEffect)(()=>{let i=!0;return A(e,t,V(n),r).then(e=>{i&&a(e)}),()=>{i=!1}},[o,r]),i===void 0)return(0,L.jsx)(`span`,{className:`board-table loading`,"aria-hidden":`true`});if(!i)return(0,L.jsx)(`p`,{className:`board-note`,children:`This table could not be read.`});let s=i.rows.slice(0,r);return(0,L.jsxs)(`div`,{className:`board-table-wrap`,children:[(0,L.jsxs)(`table`,{className:`board-table`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsx)(`tr`,{children:i.columns.map(e=>(0,L.jsx)(`th`,{title:e,children:e},e))})}),(0,L.jsx)(`tbody`,{children:s.map((e,t)=>(0,L.jsx)(`tr`,{children:i.columns.map(t=>(0,L.jsx)(`td`,{title:e[t]===null||e[t]===void 0?``:String(e[t]),children:U(e[t])},t))},t))})]}),(0,L.jsxs)(`small`,{children:[i.total>s.length?`First ${s.length} of ${i.total.toLocaleString()} rows`:`${i.total.toLocaleString()} ${i.total===1?`row`:`rows`}`,i.width>i.columns.length?` · ${i.columns.length} of ${i.width} columns`:``]})]})}function Ce(e,t){let n=e.split(`
3
3
  `),r=[],i=/\.py$/i.test(t),a=/\.[rR]$/.test(t);return n.forEach((e,t)=>{let n=/^#{1,3}\s*[-=#*]*\s*([A-Za-z0-9].{2,80}?)\s*[-=#*]*\s*$/.exec(e);i&&/^(?:async\s+)?(?:def|class)\s+\w+/.test(e)?r.push({line:t+1,text:e.replace(/\s*:\s*$/,``).replace(/^async\s+/,``)}):a&&/^[\w.]+\s*(?:<-|=)\s*function\s*\(/.test(e)?r.push({line:t+1,text:e.replace(/\s*\{\s*$/,``)}):n&&!/^#!/.test(e)&&!/^#\s*(?:TODO|NOTE|FIXME)\b/i.test(e)&&r.push({line:t+1,text:n[1]})}),{lines:n.length-+(n.at(-1)===``),marks:r}}function K({client:e,snapshot:t,node:n}){let[r,i]=(0,I.useState)(void 0),a=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,I.useEffect)(()=>{let r=!0;return C(e,t,V(n)).then(e=>{r&&i(e)}),()=>{r=!1}},[a]),r===void 0)return(0,L.jsx)(`span`,{className:`board-outline loading`,"aria-hidden":`true`});if(!r)return null;let{lines:o,marks:s}=Ce(r.text,n.path);return(0,L.jsxs)(`div`,{className:`board-outline`,children:[s.length>0&&(0,L.jsx)(`ol`,{children:s.slice(0,12).map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{children:e.line}),(0,L.jsx)(`code`,{children:e.text})]},e.line))}),(0,L.jsxs)(`small`,{children:[o.toLocaleString(),` lines`,r.cut?` (more than Rho read)`:``,s.length>12?` · ${s.length-12} more sections`:``]})]})}function q({client:e,snapshot:t,node:n,lines:r}){let[i,a]=(0,I.useState)(void 0),o=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,I.useEffect)(()=>{let r=!0;return C(e,t,V(n)).then(e=>{r&&a(e)}),()=>{r=!1}},[o]),i===void 0)return(0,L.jsx)(`span`,{className:`board-text loading`,"aria-hidden":`true`});if(!i)return null;let s=i.text;if(/\.json$/i.test(n.path)&&!i.cut)try{s=JSON.stringify(JSON.parse(s),null,2)}catch{}let c=s.replace(/\n$/,``).split(`
4
4
  `);return(0,L.jsxs)(`div`,{className:`board-text`,children:[(0,L.jsx)(`pre`,{children:c.slice(0,r).join(`
5
5
  `)}),(c.length>r||i.cut)&&(0,L.jsxs)(`small`,{children:[`First `,Math.min(r,c.length),` of `,i.cut?`more than `+c.length:c.length.toLocaleString(),` lines`]})]})}function J({node:e}){let t=e.outcome===`returned`&&(!e.end||/^exit 0\b/i.test(e.end));return(0,L.jsxs)(`details`,{className:`board-run`,children:[(0,L.jsxs)(`summary`,{children:[(0,L.jsxs)(`code`,{title:e.ran??e.command,children:[`$ `,F(e.ran??e.command??``)]}),(0,L.jsxs)(`span`,{className:`board-run-end`+(t?``:` problem`),children:[e.end??(e.outcome===`requested`?`Running`:`Returned`),e.durationMs?` · `+ie(e.durationMs):``]})]}),(0,L.jsx)(`pre`,{className:`board-run-full`,children:e.ran??e.command}),e.output?.text?(0,L.jsx)(`pre`,{ref:e=>{e&&(e.scrollTop=e.scrollHeight)},children:e.output.text}):(0,L.jsx)(`p`,{className:`board-note`,children:`The Agent reported no output for this command.`})]})}var we=(e,t)=>e.length>t?e.slice(0,t-1).trimEnd()+`…`:e,Y=e=>e instanceof Error?e.message:`The message could not be sent.`;function Te({about:e,onSend:t,onCancel:n}){let[r,i]=(0,I.useState)(``),[a,o]=(0,I.useState)(!1),[s,c]=(0,I.useState)(``),l=(0,I.useRef)(null);(0,I.useEffect)(()=>{l.current?.focus()},[]);async function u(){if(r.trim()&&!a){o(!0),c(``);try{await t(r)}catch(e){c(Y(e))}finally{o(!1)}}}return(0,L.jsxs)(`form`,{className:`board-ask-box`,onSubmit:e=>{e.preventDefault(),u()},onKeyDown:e=>{e.key===`Escape`&&n()},children:[e.kind===`passage`?(0,L.jsx)(`blockquote`,{children:e.text}):e.kind===`file`?(0,L.jsxs)(`p`,{className:`board-ask-about`,children:[`About `,(0,L.jsx)(`strong`,{children:e.title}),e.resource?` as this message left it`:``]}):(0,L.jsxs)(`p`,{className:`board-ask-about`,children:[(0,L.jsx)(`strong`,{children:`What needs to change?`}),` The Agent receives your words.`]}),(0,L.jsx)(`textarea`,{ref:l,rows:2,value:r,"aria-label":e.kind===`changes`?`What needs to change`:`Your question`,placeholder:e.kind===`changes`?`Say what is wrong or missing`:`What do you want to know or change?`,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),u())}}),s&&(0,L.jsx)(`p`,{className:`inline-error`,role:`alert`,children:s}),(0,L.jsxs)(`div`,{className:`board-ask-actions`,children:[(0,L.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,L.jsx)(`button`,{type:`submit`,className:`primary`,disabled:a||!r.trim(),children:a?`Sending…`:e.kind===`changes`?`Send to the Agent`:`Ask the Agent`})]})]})}function Ee({text:e}){return(0,L.jsx)(L.Fragment,{children:e.split("`").map((e,t)=>t%2?(0,L.jsx)(`code`,{children:e},t):e)})}function X({client:e,snapshot:t,item:n,onPath:r,onExplore:i,said:a,span:o,ask:c,holds:l}){let{node:u,role:d}=n,f=u.category===`figures`,m=/\.(csv|tsv)$/i.test(u.path??``),h=d===`run`?null:f?(0,L.jsx)(W,{client:e,snapshot:t,node:u}):m&&(d===`primary`||d===`supporting`)?(0,L.jsx)(G,{client:e,snapshot:t,node:u,rows:d===`primary`?12:5}):d===`method`?(0,L.jsx)(K,{client:e,snapshot:t,node:u}):(d===`primary`||d===`supporting`)&&/\.(json|txt|md|ya?ml|log)$/i.test(u.path??``)?(0,L.jsx)(q,{client:e,snapshot:t,node:u,lines:d===`primary`?16:8}):null;return d===`run`?(0,L.jsxs)(`div`,{className:`board-item role-run`,children:[(0,L.jsx)(J,{node:u}),(0,L.jsx)(`small`,{className:`board-why`,children:(0,L.jsx)(Ee,{text:n.why})})]}):(0,L.jsxs)(`article`,{className:`board-item role-`+d+(o?` span-`+o:``)+(c?.open?` asking`:``),children:[(0,L.jsxs)(`header`,{children:[(0,L.jsxs)(`div`,{className:`board-item-title`,children:[(0,L.jsxs)(`button`,{className:`board-name`,title:`Show `+u.path,onClick:()=>r(u.path),children:[(0,L.jsx)(s,{name:p(u.path),size:15,stroke:1.7}),(0,L.jsx)(`strong`,{children:u.title})]}),(0,L.jsxs)(`span`,{className:`board-item-actions`,children:[c&&(0,L.jsx)(`button`,{className:`text-button board-ask-button`,"aria-expanded":c.open,onClick:c.toggle,children:`Ask`}),i&&S(u.path)&&T(t)&&(0,L.jsx)(P,{languages:[`r`,`python`],title:e=>`Open ${u.title} in Studio with the Notebook beside it, loaded into the ${v[e]} session as a new value`,onExplore:e=>i(u.path,e)})]})]}),l&&(0,L.jsx)(E,{className:`board-holds`,holds:l}),n.why!==a&&(0,L.jsx)(`small`,{className:`board-why`,children:(0,L.jsx)(Ee,{text:n.why})})]}),c?.open&&c.box,h]})}function De({record:e,graph:t,shown:n,onDecide:r,onNeedsChanges:i}){let a=e.decisions?.at(-1),[o,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)(``);if((0,I.useEffect)(()=>{c(!1),u(!1),m(``)},[e.id,a?.changeId]),e.state===`running`||ae(e)&&!a)return null;let h=a?a.results.filter(e=>{let n=t.nodes.find(t=>t.kind===`file`&&t.path===e.path);return!!n?.modifiedAt&&Date.parse(n.modifiedAt)>Date.parse(a.at)+1e3}):[],g=a?n.filter(e=>!a.results.some(t=>t.path===e)):[];async function _(){f(!0),m(``);try{await r()}catch(e){m(Y(e))}finally{f(!1)}}return l?(0,L.jsx)(`div`,{className:`board-verdict`,children:(0,L.jsx)(Te,{about:{kind:`changes`},onSend:i,onCancel:()=>u(!1)})}):(0,L.jsxs)(`div`,{className:`board-verdict`+(a&&!o?` `+a.decision:``),children:[a&&!o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{children:[(0,L.jsx)(s,{name:a.decision===`accepted`?`check`:`pencil`,size:14,stroke:2}),` `,(0,L.jsx)(`strong`,{children:a.decision===`accepted`?`You chose to use this answer`:`You said this needs changes`}),(0,L.jsxs)(`span`,{className:`board-meta`,children:[` · `,ce(a.at),` · for the `,a.results.length,` `,a.results.length===1?`file version`:`file versions`,` this message kept`]})]}),a.note&&(0,L.jsx)(`blockquote`,{children:a.note}),g.length>0&&(0,L.jsxs)(`p`,{className:`board-meta`,children:[`Not covered: no version was kept of `,g.map(e=>e.split(`/`).at(-1)).join(`, `),`.`]}),h.length>0&&(0,L.jsxs)(`p`,{className:`board-verdict-since`,children:[`Changed since: `,h.map(e=>e.path.split(`/`).at(-1)).join(`, `),`. The decision does not cover the new `,h.length===1?`version`:`versions`,`.`]}),(0,L.jsx)(`button`,{className:`text-button`,onClick:()=>c(!0),children:`Change`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`board-meta`,children:`Will you use this answer?`}),(0,L.jsxs)(`div`,{className:`board-verdict-actions`,children:[(0,L.jsx)(`button`,{className:`primary`,disabled:d,onClick:()=>void _(),children:d?`Saving…`:`Use this answer`}),(0,L.jsx)(`button`,{disabled:d,onClick:()=>u(!0),children:`Needs changes`}),o&&(0,L.jsx)(`button`,{className:`text-button`,onClick:()=>c(!1),children:`Cancel`})]})]}),p&&(0,L.jsx)(`p`,{className:`inline-error`,role:`alert`,children:p})]})}function Oe({id:e,node:t,running:n,at:r,onOpen:i}){if(!t)return null;let{about:a,quote:o,question:c}=y(t.text??``);return(0,L.jsxs)(`li`,{className:`board-follow-up`,id:`board-follow-`+e,children:[(0,L.jsxs)(`div`,{className:`board-follow-ask`,children:[(a||o)&&(0,L.jsx)(`span`,{className:`board-follow-about`,title:o??a??``,children:a?`About `+(a.split(`/`).at(-1)??a):`“`+we(o,60)+`”`}),(0,L.jsx)(`p`,{children:c}),(0,L.jsxs)(`button`,{className:`text-button`,onClick:i,children:[n?`Answering…`:new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),` `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]}),t.answer?(0,L.jsx)(te,{text:t.answer,streaming:n}):n?(0,L.jsx)(`p`,{className:`board-note`,role:`status`,children:`The Agent is working on this.`}):null]})}function ke({client:e,snapshot:t,files:n,notesText:r=``,onConversation:i,onPath:a,onExplore:o,onConsole:c,onGraph:l,onAsked:d}){let{turns:f,loading:m}=_e(e,t),h=(0,I.useMemo)(()=>n.files.map(e=>({path:e.path,bytes:e.bytes,modifiedAt:e.modifiedAt,category:e.category})),[n.files]),g=(0,I.useMemo)(()=>ne(ee({turns:f,files:h,project:t.project,kindOf:u,now:Date.now()})),[f,h,t.project]),v=j(e,t,g,h,r,f),b=(0,I.useMemo)(()=>ye(g),[g]),[re,ie]=(0,I.useState)(null),oe=re&&b.find(e=>e.turn.id===re)||b[0],x=oe?.turn,S=oe?.board,C=oe?.followUps??[],[w,T]=(0,I.useState)(null),[le,E]=(0,I.useState)(null),D=(0,I.useRef)(null),O=(0,I.useRef)(null),ue=(0,I.useRef)(null);if((0,I.useEffect)(()=>{T(null),E(null)},[x?.id]),m||!S||!x)return null;let k=x.conversationId,A=t.conversations?.find(e=>e.conversationId===k)?.state===`running`;async function de(n,r){let a=_(n,r);D.current?.text!==a&&(D.current={text:a,changeId:`ask-`+crypto.randomUUID()}),await e.call(`conversation.send`,{projectId:t.project.id,conversationId:k,changeId:D.current.changeId,text:a}),D.current=null,T(null),(d??i)(k)}async function fe(n,r){let i=x.id+`:`+n+`:`+(r??``);O.current?.key!==i&&(O.current={key:i,changeId:`decide-`+crypto.randomUUID()}),await e.call(`conversation.decide`,{projectId:t.project.id,conversationId:k,turnId:N.id,changeId:O.current.changeId,decision:n,...r?{note:r}:{}}),O.current=null}async function pe(n){await fe(`needs-changes`,n.trim());let r=`Needs changes: `+n.trim();D.current?.text!==r&&(D.current={text:r,changeId:`ask-`+crypto.randomUUID()}),await e.call(`conversation.send`,{projectId:t.project.id,conversationId:k,changeId:D.current.changeId,text:r}),D.current=null,(d??i)(k)}let me=(e,t)=>w?.key===e?(0,L.jsx)(Te,{about:w.about,onSend:e=>de(w.about,e),onCancel:()=>T(null)}):null,he=e=>{let t=`file:`+e.node.path;return{open:w?.key===t,toggle:()=>T(w?.key===t?null:{key:t,about:{kind:`file`,path:e.node.path,title:e.node.title,resource:e.node.resource??null}}),box:me(t,{kind:`file`,path:e.node.path,title:e.node.title})}};function ge(){let e=getSelection(),t=e?.toString().trim()??``,n=ue.current;if(!e||!t||!n||!e.rangeCount||!n.contains(e.anchorNode)||!n.contains(e.focusNode)){E(null);return}let r=e.getRangeAt(0).getBoundingClientRect(),i=n.getBoundingClientRect();E({text:t.slice(0,2e3),top:r.bottom-i.top+6,left:Math.max(0,Math.min(r.left-i.left,i.width-140))})}let{question:M}=S,N=f.find(e=>e.conversationId+`/`+e.turn.id===x.id)?.turn,P=e=>S.items.filter(t=>t.role===e),R=P(`primary`)[0],z=P(`supporting`),be=P(`method`),B=P(`run`),xe=P(`input`),Se=P(`report`),V=e=>S.omitted[e]?(0,L.jsxs)(`small`,{className:`board-more`,children:[S.omitted[e],` more in Files`]}):null,U=x.running?g.live:null,W=U&&g.nodes.find(e=>e.id===U.node),G=U&&W&&W.kind!==`question`?U.label+` `+(W.kind===`run`&&W.ran?F(W.ran):W.title):U?.waiting?U.label:null,Ce=C.find(e=>e.running),K=Ce?{id:Ce.id,title:we(y(g.nodes.find(e=>e.id===`q:`+Ce.id)?.text??``).question.split(`
6
- `)[0],60)}:null,q=[R,...z].filter(Boolean),J=e=>e.node.path?v.holds(e.node.path):void 0,Y=v.meanings.find(e=>e.conversationId===k)?.statements.filter(e=>e.kind===`choice`)??[],ke=q.length>1&&q.every(e=>e.why===q[0].why)?q[0].why:void 0,Ae=(R?Math.max(0,z.length-2):z.length)%3;return(0,L.jsxs)(`section`,{className:`project-section answer-board`,"aria-labelledby":`board-title`,children:[(0,L.jsxs)(`header`,{className:`board-head`,children:[(0,L.jsxs)(`div`,{className:`board-ask`,children:[(0,L.jsx)(`h2`,{id:`board-title`,title:M.text,children:M.title}),(0,L.jsxs)(`p`,{className:`board-meta`,children:[(0,L.jsx)(`span`,{className:`work-state `+(M.state??``),children:N&&ae(N)?`Turn limit reached`:H[M.state??``]??M.state}),N&&(0,L.jsxs)(L.Fragment,{children:[` · `,ce(N.endedAt??N.sentAt),N.endedAt&&se(N.startedAt??N.sentAt,N.endedAt)?` · took `+se(N.startedAt??N.sentAt,N.endedAt):``]}),G&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`span`,{className:`board-live`+(U?.waiting?` waiting`:``),title:G,children:G})]}),K&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsxs)(`button`,{className:`text-button board-live`,onClick:()=>document.getElementById(`board-follow-`+K.id)?.scrollIntoView({block:`center`,behavior:`smooth`}),children:[`Answering “`,K.title,`”`]})]})]})]}),(0,L.jsxs)(`div`,{className:`board-actions`,children:[b.length>1&&(0,L.jsx)(`select`,{"aria-label":`Answer to show`,value:x.id,onChange:e=>ie(e.target.value),children:b.map(({turn:e})=>(0,L.jsxs)(`option`,{value:e.id,children:[new Date(e.start).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),` · `,g.nodes.find(t=>t.id===`q:`+e.id)?.title??`A message`]},e.id))}),(0,L.jsxs)(`button`,{className:`text-button`,onClick:()=>i(x.conversationId),children:[`Conversation `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})]}),M.answer?(0,L.jsxs)(`div`,{className:`board-answer`,ref:ue,onMouseUp:ge,onKeyUp:ge,children:[(0,L.jsx)(te,{text:M.answer,streaming:!!x.running}),le&&!x.running&&(0,L.jsx)(`button`,{className:`board-select-ask`,style:{top:le.top,left:le.left},onMouseDown:e=>e.preventDefault(),onClick:()=>{T({key:`passage`,about:{kind:`passage`,text:le.text}}),E(null),getSelection()?.removeAllRanges()},children:`Ask about this`})]}):x.running?(0,L.jsx)(`p`,{className:`board-note`,role:`status`,children:`The Agent is working on this message.`}):null,w?.key===`passage`&&me(`passage`,w.about),A&&w&&(0,L.jsx)(`p`,{className:`board-note`,children:`The Agent is still answering. Your question can be sent when it has finished.`}),(R||z.length>0)&&(0,L.jsxs)(`div`,{className:`board-results-block`,children:[(0,L.jsxs)(`p`,{className:`board-results-why`,children:[(0,L.jsx)(`strong`,{children:`Results`}),ke&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(Ee,{text:ke})]})]}),(0,L.jsxs)(`div`,{className:`board-results beside-`+Math.min(z.length,2),children:[R&&(0,L.jsx)(X,{client:e,snapshot:t,item:R,onPath:a,onExplore:o,said:ke,holds:J(R),ask:x.running?void 0:he(R)}),z.map((n,r)=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a,onExplore:o,said:ke,holds:J(n),span:r>=z.length-Ae?6/Ae:void 0,ask:x.running?void 0:he(n)},n.node.id))]}),V(`supporting`)]}),(be.length>0||B.length>0||xe.length>0||Se.length>0||S.otherCommands>0)&&(0,L.jsxs)(`div`,{className:`board-how`,children:[be.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Method`}),(0,L.jsx)(`div`,{className:`board-cells`,children:be.map(n=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a,holds:J(n),ask:x.running?void 0:he(n)},n.node.id))})]}),(B.length>0||S.otherCommands>0)&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Ran`}),(0,L.jsxs)(`div`,{className:`board-cells`,children:[B.map(n=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a},n.node.id)),S.otherCommands>0&&(0,L.jsxs)(`button`,{className:`text-button board-console`,onClick:()=>c(x.id),children:[B.length?S.otherCommands+` other `+(S.otherCommands===1?`command`:`commands`):S.otherCommands+(S.otherCommands===1?` command`:` commands`),` in the Console `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})]}),xe.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`From`}),(0,L.jsxs)(`div`,{className:`board-chips`,children:[xe.map(e=>(0,L.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,L.jsx)(s,{name:p(e.node.path),size:14,stroke:1.7}),(0,L.jsx)(`span`,{children:e.node.title})]},e.node.id)),V(`input`)]})]}),Se.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Report`}),(0,L.jsx)(`div`,{className:`board-chips`,children:Se.map(e=>(0,L.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,L.jsx)(s,{name:`document`,size:14,stroke:1.7}),(0,L.jsx)(`span`,{children:e.node.title})]},e.node.id))})]})]}),Y.length>0&&(0,L.jsxs)(`div`,{className:`board-choices`,children:[(0,L.jsxs)(`p`,{className:`board-results-why`,children:[(0,L.jsx)(`strong`,{children:`Choices`}),` · what the Agent went with`,Y.some(e=>e.alternatives?.length)?`, and the other option where the notes name one`:``]}),Y.map(n=>(0,L.jsx)(ve,{statement:n,trace:v.traces.get(n),conversationId:k,client:e,projectId:t.project.id,onPath:a,onSent:e=>(d??i)(e)},n.line))]}),C.length>0&&(0,L.jsxs)(`div`,{className:`board-follow`,children:[(0,L.jsx)(`p`,{className:`board-results-why`,children:(0,L.jsx)(`strong`,{children:`Asked since`})}),(0,L.jsx)(`ol`,{children:C.map(e=>(0,L.jsx)(Oe,{id:e.id,node:g.nodes.find(t=>t.id===`q:`+e.id),running:!!e.running,at:e.start,onOpen:()=>i(e.conversationId)},e.id))})]}),N&&(0,L.jsx)(De,{record:N,graph:g,shown:[R,...z,...Se].filter(e=>!!e).map(e=>e.node.path),onDecide:()=>fe(`accepted`),onNeedsChanges:pe}),(0,L.jsx)(`footer`,{className:`board-foot`,children:(0,L.jsxs)(`button`,{className:`text-button`,onClick:l,children:[`How each file connects, in the Graph `,(0,L.jsx)(s,{name:`chevron`,size:12})]})})]})}var Ae=(0,I.lazy)(()=>k(()=>import(`./graph-1OdIJ9l7.js`).then(e=>({default:e.WorkStrip})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),je=e=>e>=6?6:e>=3?3:e,Me=(e,t)=>/table/.test(e)?`table`:/media|image/.test(e)?`image`:/\.(R|r|py|sh|sql|js|ts)$/.test(t)?`code`:/document|editor|note/.test(e)?`document`:`file`;function Ne({client:e,snapshot:t,item:n,modifiedAt:r}){let i=/\.(png|jpe?g|svg|csv)$/i.test(n.path),[a,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!i)return;let a=!0;return D(e,t,{path:n.path,bytes:n.bytes,modifiedAt:r,resource:n.resource}).then(e=>{a&&o(e)}),()=>{a=!1}},[n.path,n.bytes,r,n.resource?.version]),i&&!a?(0,L.jsx)(`span`,{className:`figure-thumb loading`,"aria-hidden":`true`}):a?.kind===`image`?(0,L.jsx)(`span`,{className:`figure-thumb image`,children:(0,L.jsx)(`img`,{src:a.url,alt:``})}):a?.kind===`table`?(0,L.jsx)(`span`,{className:`figure-thumb table`,"aria-hidden":`true`,children:(0,L.jsxs)(`span`,{style:{gridTemplateColumns:`repeat(${a.columns.length}, minmax(0, 1fr))`},children:[a.columns.map(e=>(0,L.jsx)(`b`,{children:e},`h`+e)),a.rows.map((e,t)=>a.columns.map(n=>(0,L.jsx)(`i`,{children:e[n]===null||e[n]===void 0?``:String(e[n])},t+n)))]})}):(0,L.jsx)(`span`,{className:`figure-thumb kind`,"aria-hidden":`true`,children:(0,L.jsx)(s,{name:b(n),size:26,stroke:1.4})})}function Pe({composition:e}){let t=c(e),n=new Map(e.views.map(e=>[e.id,e]));if(!t)return(0,L.jsx)(`span`,{className:`mini-layout empty`,children:`Empty workspace`});let r=e=>{if(e.kind===`split`)return(0,L.jsx)(`span`,{className:`mini-split `+e.axis,children:e.children.map((t,n)=>(0,L.jsx)(`span`,{style:{flexGrow:e.weights[n]??1},children:r(t)},t.id))});let t=e.views.flatMap(e=>n.get(e)??[]),i=t[0],a=i?String(i.props.title??i.id):``;return(0,L.jsxs)(`span`,{className:`mini-pane`,children:[(0,L.jsx)(`span`,{className:`mini-tabs`,children:t.slice(0,5).map((e,t)=>(0,L.jsx)(`i`,{className:t===0?`on`:void 0},e.id))}),i&&(0,L.jsxs)(`span`,{className:`mini-face`,children:[(0,L.jsx)(s,{name:Me(String(i.component),a),size:13}),(0,L.jsx)(`span`,{children:a})]}),t.length>1&&(0,L.jsxs)(`small`,{children:[`+`,t.length-1]})]})};return(0,L.jsx)(`span`,{className:`mini-layout`,"aria-hidden":`true`,children:r(t)})}function Fe(e){return e.provenance?.originalPath??e.path}function Ie(e,t){if(!e)return r(t);let[n,...i]=e.split(`/`),a=n.startsWith(`@`)?t.sources?.find(e=>`@`+e.id===n):void 0;return[a?a.name:n,...i].join(`/`)}function Z({project:e,snapshot:t,client:n,section:c,notesText:l=``,workspace:u,onExplore:p,onSection:h,onAgent:_,onLayout:ee,onProjectChanged:te,onOpened:ne,category:v,files:y,sources:b,onFile:ie,linked:ae=!1,onPath:S,onNewConversation:C,onConsole:T}){let[se,ce]=(0,I.useState)(!1),{runs:E,problem:D,readAgain:k}=de(n,e.id,t.cursor),[A,_e]=(0,I.useState)(null),[j,ve]=(0,I.useState)(null),[P,ye]=(0,I.useState)(!1),[F,R]=(0,I.useState)(``),[B,V]=(0,I.useState)(``),[H,U]=(0,I.useState)(``),[W,G]=(0,I.useState)(!1),[Ce,K]=(0,I.useState)(``),[q,J]=(0,I.useState)(``),[we,Y]=(0,I.useState)(null),[Te,Ee]=(0,I.useState)(!1),[X,De]=(0,I.useState)(null),[Oe,Me]=(0,I.useState)(!1),Z=t.catalog.operations.some(e=>e.method===`project.work.read`&&e.authorized),Q=z(n,t,c===`overview`&&Z,Me),Re=t.catalog.operations.some(e=>e.method===`kernel.read`&&e.state===`available`&&e.authorized),ze=oe(n,e.id,t.cursor,c===`overview`&&Re),Be=!Re||ze.read!==null||!!ze.problem,Ve=t.catalog.operations.some(e=>e.method===`skills.list`&&e.state===`available`&&e.authorized),He=N(n,e.id,t.cursor,c===`overview`&&Ve),Ue=!!He.problem||[...He.list?.skills??[],...He.list?.removed??[]].some(e=>e.last),We=(0,I.useRef)(0),Ge=(0,I.useRef)(null),Ke=c===`files`||c===`documents`,qe=new Map,Je=new Map;for(let e of t.compositions)for(let t of e.views)for(let n of Object.values(t.bindings??{}))`id`in n&&`version`in n&&qe.set(n.id+`@`+n.version,{compositionId:e.compositionId,viewId:t.id}),`documentId`in n&&`kind`in n&&n.kind===`live-document`&&Je.set(String(n.documentId),{compositionId:e.compositionId,viewId:t.id});let Ye=fe(t.resources.filter(e=>e.provenance?.source!==`current-filesystem-observation`),E??[]),Xe=[...E??[]].sort((e,t)=>t.acceptedAt.localeCompare(e.acceptedAt)),Ze=new Map((y?.files??[]).map(e=>[e.path,e.modifiedAt])),$=[...b?.results??[]].sort((e,t)=>(Ze.get(t.path)??``).localeCompare(Ze.get(e.path)??``)),Qe=a(e),$e=!t.compositions.length&&!Ye.length&&!t.taskMap?.question&&!t.taskMap?.items.length&&!t.conversations?.length&&!Oe&&!ze.cells&&!ze.problem,et=!$e||(E!==null||!!D)&&X!==null&&Be,tt=c===`overview`&&$e&&E!==null&&E.length===0&&X!==null&&Be,nt=!!D||(E?.length??0)>0,rt=!!Q.work&&(Q.work.files.length>0||Q.work.omitted.fileReferences>0),it=nt||rt||Z||t.compositions.length>0||Ue,at=je($.length),ot=!!y&&!!t.conversations?.length,st=(X??0)>0,ct=[{key:`files`,label:`Browse files`,icon:`folder`,run:()=>h(`files`),primary:st},{key:`agent`,label:`Work with Agent`,icon:`prompt`,run:()=>_(),primary:!st}].sort((e,t)=>Number(t.primary)-Number(e.primary));async function lt(t=``){let r=++We.current;ye(!0),V(``);try{let i=await n.call(`project.entries`,{projectId:e.id,...t?{path:t}:{}});r===We.current&&(ve(i),U(``))}catch(e){r===We.current&&V(e instanceof Error?e.message:`Could not read this folder. Try again.`)}finally{r===We.current&&ye(!1)}}(0,I.useEffect)(()=>{Ke&&!j&&!P&&lt()},[Ke]),(0,I.useEffect)(()=>{if(c!==`overview`||!$e)return;let t=!0;return n.call(`project.entries`,{projectId:e.id}).then(e=>{t&&De(e.entries.length)},()=>{t&&De(-1)}),()=>{t=!1}},[n,e.id,c,$e]),(0,I.useEffect)(()=>()=>{We.current++},[]),(0,I.useEffect)(()=>{A&&!Ge.current?.open&&Ge.current?.showModal()},[A]);async function ut(r){if(!F){R(r.path),V(``);try{let i=u(),a=t.compositions.find(e=>e.compositionId===i),o=await n.call(`project.openFile`,{projectId:e.id,path:r.path,compositionId:i,expectedVersion:a?.version??0,changeId:`open-`+crypto.randomUUID()});ne(o.composition.compositionId,o.viewId)}catch(e){V(e instanceof Error?e.message:`Could not open this file. Try again.`)}finally{R(``)}}}async function dt(){G(!0),K(``);try{let t=await n.call(`project.source.add`,{projectId:e.id},new AbortController().signal);t.project&&te(t.project)}catch(e){K(e instanceof Error?e.message:`Could not add the folder. Try again.`)}finally{G(!1)}}async function ft(){Ee(!0),J(``);try{Y((await n.call(`project.doctor`,{projectId:e.id},new AbortController().signal)).checks)}catch(e){J(e instanceof Error?e.message:`Could not check this project. Try again.`)}finally{Ee(!1)}}let pt=e=>(0,L.jsxs)(`button`,{className:`activity-row`,onClick:()=>_e(e.operationId),children:[(0,L.jsx)(`span`,{className:`activity-symbol `+e.execution,children:(0,L.jsx)(s,{name:`run`,size:16})}),(0,L.jsxs)(`span`,{className:`activity-name`,children:[(0,L.jsx)(`strong`,{children:e.operationId}),(0,L.jsxs)(`small`,{children:[e.author,` · `,o(e.acceptedAt).text]})]}),(0,L.jsx)(`span`,{className:`state `+e.execution,children:me(e.execution)}),(0,L.jsx)(s,{name:`chevron`,size:13})]},e.operationId),mt=(e,t)=>e&&(0,L.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,L.jsx)(`p`,{children:e}),(0,L.jsx)(`button`,{onClick:t,children:`Try again`})]}),ht=(0,L.jsx)(`ul`,{className:`result-list`,children:Ye.map(({resource:e,run:t,earlier:n})=>{let r=qe.get(e.id+`@`+e.version),i=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`file-symbol`,children:(0,L.jsx)(s,{name:m(e.kind),size:19,stroke:1.6})}),(0,L.jsxs)(`span`,{className:`result-name`,children:[(0,L.jsx)(`strong`,{title:Fe(e),children:pe(Fe(e))}),(0,L.jsxs)(`small`,{children:[e.kind,n?` · ${n} earlier version${n===1?``:`s`}`:``,t?` · `+t.operationId:``]})]}),(0,L.jsx)(`span`,{className:`result-state`,children:t?ge(t.integrity):ue(e)}),r&&(0,L.jsx)(s,{name:`chevron`,size:14})]});return(0,L.jsx)(`li`,{children:r?(0,L.jsx)(`button`,{className:`result-row`,onClick:()=>ee(r.compositionId,r.viewId),children:i}):(0,L.jsxs)(`div`,{className:`result-row`,children:[i,(0,L.jsx)(`small`,{children:`No open view`})]})},e.id+e.version)})}),gt=j?.entries.filter(e=>!H||e.name.toLocaleLowerCase().includes(H.toLocaleLowerCase()))??[],_t=re[v??`data`],vt=Ke?`Files`:c===`agent`?`Agent`:c===`settings`?`Project settings`:c===`sources`?_t:r(e);return(0,L.jsxs)(`section`,{className:`project-page overview`+(Ke?` files-page`:``),"aria-labelledby":`overview-title`,children:[(0,L.jsxs)(`header`,{className:`page-heading`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{id:`overview-title`,children:vt}),c===`overview`&&(0,L.jsx)(`p`,{title:Qe.full,children:Qe.text})]}),Ke&&(0,L.jsxs)(`button`,{onClick:()=>void lt(j?.path),disabled:P,children:[(0,L.jsx)(s,{name:`refresh`,size:15}),`Refresh`]}),c===`sources`&&y&&(0,L.jsxs)(`button`,{onClick:y.refresh,disabled:y.reading,children:[(0,L.jsx)(s,{name:`refresh`,size:15}),`Refresh`]})]}),c===`sources`&&y&&ie&&(0,L.jsx)(Le,{category:v??`data`,files:y,items:b?.[v??`data`]??null,artifacts:Ye,onFile:ie}),c===`overview`&&Z&&(0,L.jsx)(be,{state:Q,boarded:!!y&&!!t.conversations?.length,openConversation:_,openActivity:()=>h(`agent`)}),c===`overview`&&B&&(0,L.jsx)(`p`,{role:`alert`,children:B}),tt&&(0,L.jsxs)(`div`,{className:`empty-project`,children:[(0,L.jsx)(`span`,{className:`empty-symbol`,children:(0,L.jsx)(s,{name:`grid`,size:26,stroke:1.5})}),(0,L.jsx)(`h2`,{children:`No work yet`}),(0,L.jsx)(`div`,{className:`empty-actions`,children:ct.map(e=>(0,L.jsxs)(`button`,{className:e.primary?`primary`:void 0,onClick:e.run,children:[(0,L.jsx)(s,{name:e.icon,size:17,stroke:1.6}),(0,L.jsx)(`span`,{children:e.label})]},e.key))})]}),c===`overview`&&!tt&&et&&(0,L.jsxs)(L.Fragment,{children:[t.taskMap?.question&&(0,L.jsxs)(`div`,{className:`project-question`,children:[(0,L.jsx)(s,{name:`prompt`,size:18}),(0,L.jsx)(`h2`,{children:t.taskMap.question})]}),y&&!!t.conversations?.length&&(0,L.jsx)(ke,{client:n,snapshot:t,files:y,notesText:l,onConversation:e=>_(e),onPath:e=>S?.(e),onExplore:p,onConsole:e=>T?T(e):h(`console`),onGraph:()=>h(`graph`)}),(0,L.jsxs)(`div`,{className:`project-columns`+(it?``:` single`),children:[(0,L.jsxs)(`div`,{className:`project-primary`,children:[y&&(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(Ae,{client:n,snapshot:t,files:y,onOpen:()=>h(`graph`),onConversations:()=>h(`agent`)})}),(!ot||!$.length&&Ye.length>0)&&(0,L.jsxs)(`section`,{className:`project-section figures-section`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsxs)(`h2`,{children:[`Results & figures`,$.length>0&&(0,L.jsx)(`span`,{className:`section-count`,children:$.length})]}),(0,L.jsxs)(`button`,{className:`text-button`,onClick:()=>h(`files`),children:[`All files `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]}),$.length?(0,L.jsx)(`ul`,{className:`figure-grid count-`+at+(at>=3?` featured`:``),children:$.slice(0,at).map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`figure-card`,onClick:()=>ie?.(`results`,e),title:e.path,children:[(0,L.jsx)(Ne,{client:n,snapshot:t,item:e,modifiedAt:Ze.get(e.path)}),(0,L.jsxs)(`span`,{className:`figure-name`,children:[(0,L.jsx)(`strong`,{children:e.name}),(0,L.jsxs)(`small`,{children:[e.resource&&e.path.startsWith(`.rho/`)?`Run output`:e.folder,Ze.get(e.path)?` · `+o(Ze.get(e.path)).text:``]})]})]})},e.key))}):Ye.length?ht:(0,L.jsx)(`p`,{className:`quiet-empty`,children:`No results or figures yet.`}),$.length>at&&(0,L.jsxs)(`button`,{className:`text-button figures-more`,onClick:()=>h(`files`),children:[$.length-at,` more in Files `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]}),(0,L.jsx)(x,{work:ze,snapshot:t,onOpen:()=>h(`notebook`)}),t.taskMap?.items.length?(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`From your Agent`})}),(0,L.jsx)(`ul`,{className:`agent-notes`,children:t.taskMap.items.map(e=>(0,L.jsxs)(`li`,{"data-fact":`agent`,children:[(0,L.jsx)(`strong`,{children:e.title}),e.summary&&(0,L.jsx)(`p`,{children:e.summary}),(0,L.jsx)(`small`,{children:t.taskMap.vocabulary.states[e.state]?.label??e.state})]},e.id))})]}):null]}),it&&(0,L.jsxs)(`aside`,{className:`project-side`,children:[(t.compositions.length>0||Z)&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Continue working`})}),(0,L.jsxs)(`div`,{className:`workspace-grid`,children:[t.compositions.filter(e=>!f(e.compositionId)).map(e=>(0,L.jsxs)(`button`,{className:`workspace-card`,onClick:()=>ee(e.compositionId),children:[(0,L.jsxs)(`span`,{className:`workspace-card-head`,children:[(0,L.jsx)(`strong`,{children:d(e.compositionId)}),(0,L.jsxs)(`small`,{children:[e.views.length,` `,e.views.length===1?`view`:`views`]}),(0,L.jsx)(s,{name:`chevron`,size:14})]}),(0,L.jsx)(Pe,{composition:e})]},e.compositionId)),Z&&(0,L.jsx)(Se,{work:Q.work,openFile:e=>void ut({path:e})})]})]}),(0,L.jsx)(M,{list:He.list,problem:He.problem,snapshot:t,onOpen:()=>h(`skills`)}),(0,L.jsx)(xe,{work:Q.work,openFile:e=>void ut({path:e}),openActivity:()=>h(`agent`)}),nt&&(0,L.jsxs)(`section`,{className:`project-section project-recent`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Recent activity`}),(0,L.jsx)(`button`,{className:`text-button`,onClick:()=>h(`agent`),children:`View all`})]}),mt(D,k),Xe.length?(0,L.jsx)(`div`,{className:`activity-list`,children:Xe.slice(0,5).map(pt)}):(0,L.jsx)(`p`,{className:`quiet-empty`,children:`No runs yet.`})]})]})]})]}),Ke&&(0,L.jsxs)(L.Fragment,{children:[t.documents.length>0&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Open documents`})}),(0,L.jsx)(`div`,{className:`document-list`,children:t.documents.map(e=>{let t=Je.get(e.id);return(0,L.jsxs)(`button`,{className:`document-link`,disabled:!!F,onClick:()=>t?ee(t.compositionId,t.viewId):void ut(e),children:[(0,L.jsx)(s,{name:`document`,size:18}),(0,L.jsx)(`span`,{children:pe(e.path)}),e.dirty&&(0,L.jsx)(`span`,{className:`unsaved-dot`,title:`Unsaved changes`,"aria-label":`Unsaved changes`})]},e.id)})})]}),(0,L.jsxs)(`section`,{className:`project-section`,"aria-label":`Project files`,children:[(0,L.jsxs)(`div`,{className:`file-toolbar`,children:[(0,L.jsxs)(`div`,{className:`folder-location`,children:[j?.path&&(0,L.jsx)(`button`,{className:`icon-button`,"aria-label":`Up one folder`,onClick:()=>void lt(j.path.split(`/`).slice(0,-1).join(`/`)),children:(0,L.jsx)(s,{name:`chevron`,size:16})}),(0,L.jsx)(`strong`,{children:Ie(j?.path??``,e)})]}),(0,L.jsxs)(`div`,{className:`search-field`,children:[(0,L.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,L.jsx)(`input`,{"aria-label":`Filter files`,placeholder:`Filter files…`,value:H,onChange:e=>U(e.target.value)})]})]}),mt(B,()=>void lt(j?.path)),P&&(0,L.jsx)(`p`,{className:`loading-inline`,role:`status`,children:`Reading folder…`}),j&&(gt.length?(0,L.jsxs)(`div`,{className:`file-table-wrap`,"aria-busy":P,children:[(0,L.jsxs)(`table`,{className:`file-table`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Name`}),(0,L.jsx)(`th`,{children:`Type`}),(0,L.jsx)(`th`,{children:`Size`})]})}),(0,L.jsx)(`tbody`,{children:gt.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsxs)(`button`,{className:`file-open`,disabled:!!F||P,onClick:()=>void(e.kind===`folder`?lt(e.path):ut(e)),children:[(0,L.jsx)(s,{name:e.kind===`folder`?`folder`:`file`,size:19,stroke:1.6}),e.name,F===e.path&&(0,L.jsx)(`span`,{role:`status`,children:`Opening…`})]})}),(0,L.jsx)(`td`,{children:e.kind===`folder`?`Folder`:e.name.split(`.`).at(-1)?.toUpperCase()||`File`}),(0,L.jsx)(`td`,{children:e.kind===`folder`?`—`:O(e.bytes)})]},e.path))})]}),j.truncated&&(0,L.jsxs)(`p`,{className:`muted`,children:[`Showing `,j.entries.length,` of `,j.total,` entries.`]})]}):(0,L.jsxs)(`div`,{className:`empty-state compact`,children:[(0,L.jsx)(`p`,{children:H?`No files match your search.`:`This folder is empty.`}),H&&(0,L.jsx)(`button`,{onClick:()=>U(``),children:`Clear search`})]}))]}),t.resources.length>0&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Registered results`})}),ht]})]}),c===`agent`&&(()=>{let r=(0,L.jsxs)(L.Fragment,{children:[(Xe.length>0||D)&&(0,L.jsxs)(`section`,{className:`project-section agent-runs`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Runs`})}),mt(D,k),(0,L.jsx)(`div`,{className:`activity-list`,children:Xe.map(pt)})]}),ae&&(0,L.jsxs)(`details`,{className:`agent-outside`,open:se,onToggle:e=>ce(e.currentTarget.open),children:[(0,L.jsx)(`summary`,{children:`Agent sessions with access`}),se&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(le,{snapshot:t}),(0,L.jsx)(g,{client:n,projectId:e.id,root:e.root,onOpened:ne})]})]})]});return ae?r:(0,L.jsx)(w,{client:n,snapshot:t,exists:e=>!!y?.files.some(t=>t.path===e),onContinue:e=>_(e),onPath:e=>S?.(e),onNew:()=>C?.(),onOpened:ne,extra:r})})(),c===`settings`&&(0,L.jsxs)(`div`,{className:`settings-sections`,children:[(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`h2`,{children:`Source folders`}),(0,L.jsx)(i,{folders:e.sources??[{id:e.id,root:e.root,name:r(e)}],busy:W,onAdd:()=>void dt()}),mt(Ce,()=>void dt())]}),(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Project health`}),(0,L.jsx)(`button`,{disabled:Te,onClick:()=>void ft(),children:Te?`Checking…`:`Check project`})]}),we?(0,L.jsx)(`ul`,{className:`health-list`,children:we.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`state `+e.state,children:e.state===`ok`?`Ready`:e.state===`fail`?`Blocked`:`Check`}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{children:e.detail}),e.remedy&&(0,L.jsx)(`small`,{children:e.remedy})]})]},e.id))}):(0,L.jsx)(`p`,{className:`muted`,children:`Check the tools and capabilities available to this project.`}),mt(q,()=>void ft())]})]}),A&&(0,L.jsxs)(`dialog`,{ref:Ge,className:`run-dialog`,"aria-label":A,onClose:()=>_e(null),onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},children:[(0,L.jsx)(`button`,{className:`icon-button run-dialog-close`,"aria-label":`Close`,onClick:()=>Ge.current?.close(),children:(0,L.jsx)(s,{name:`close`,size:18})}),(0,L.jsx)(he,{snapshot:t,client:n,operationId:A,runs:E,readRuns:k,onOpenRun:_e,opener:e=>{let t=qe.get(e.id+`@`+e.version);return t?()=>ee(t.compositionId,t.viewId):null}},A)]})]})}var Q={data:`No data files in this project yet.`,code:`No scripts in this project yet.`,results:`No results or figures yet.`,notes:`No notes in this project yet.`,workflows:`No workflow files in this project now.`,reports:`No reports in this project now.`,references:`No references in this project now.`,environment:`No environment files in this project now.`};function Le({category:e,files:t,items:n,artifacts:r,onFile:i}){let[a,o]=(0,I.useState)(``),c=new Map(r.map(e=>[e.resource.id+`@`+e.resource.version,e])),u=n??[],d=u.length,f=u.filter(e=>!a||e.path.toLocaleLowerCase().includes(a.toLocaleLowerCase()));return(0,L.jsxs)(`section`,{className:`project-section source-list`,"aria-label":e,children:[(0,L.jsxs)(`div`,{className:`file-toolbar`,children:[(0,L.jsxs)(`p`,{className:`source-summary`,children:[t.readAt===0&&t.reading?`Reading the project folders…`:`${d}${t.truncated?`+`:``} ${d===1?`file`:`files`}`,t.truncated&&(0,L.jsx)(`span`,{title:`Rho reads at most ${l.maxFolders} folders, ${l.maxDepth} levels deep.`,children:` · deeper folders were not read`})]}),(0,L.jsxs)(`div`,{className:`search-field`,children:[(0,L.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,L.jsx)(`input`,{"aria-label":`Filter these files`,placeholder:`Filter…`,value:a,onChange:e=>o(e.target.value)})]})]}),t.problem&&(0,L.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,L.jsx)(`p`,{children:t.problem}),(0,L.jsx)(`button`,{onClick:t.refresh,children:`Try again`})]}),d===0&&t.readAt>0?(0,L.jsx)(`div`,{className:`empty-state compact`,children:(0,L.jsx)(`p`,{children:Q[e]})}):f.length>0?(0,L.jsx)(`ul`,{className:`source-rows`,children:f.map(t=>{let n=t.resource?c.get(t.resource.id+`@`+t.resource.version):void 0;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`source-row`,onClick:()=>i(e,t),children:[(0,L.jsx)(`span`,{className:`file-symbol`,children:(0,L.jsx)(s,{name:b(t),size:18,stroke:1.6})}),(0,L.jsxs)(`span`,{className:`source-name`,children:[(0,L.jsx)(`strong`,{children:t.name}),(0,L.jsxs)(`small`,{children:[t.folder,n?.run?` · from `+n.run.operationId:``]})]}),(0,L.jsx)(`span`,{className:`source-meta`,children:t.resource?n?.run?ge(n.run.integrity):`Result`:t.bytes===null?``:O(t.bytes)})]})},t.key)})}):d>0?(0,L.jsxs)(`div`,{className:`empty-state compact`,children:[(0,L.jsx)(`p`,{children:`No files match your filter.`}),(0,L.jsx)(`button`,{onClick:()=>o(``),children:`Clear filter`})]}):null]})}export{Z as ProjectOverview};
6
+ `)[0],60)}:null,q=[R,...z].filter(Boolean),J=e=>e.node.path?v.holds(e.node.path):void 0,Y=v.meanings.find(e=>e.conversationId===k)?.statements.filter(e=>e.kind===`choice`)??[],ke=q.length>1&&q.every(e=>e.why===q[0].why)?q[0].why:void 0,Ae=(R?Math.max(0,z.length-2):z.length)%3;return(0,L.jsxs)(`section`,{className:`project-section answer-board`,"aria-labelledby":`board-title`,children:[(0,L.jsxs)(`header`,{className:`board-head`,children:[(0,L.jsxs)(`div`,{className:`board-ask`,children:[(0,L.jsx)(`h2`,{id:`board-title`,title:M.text,children:M.title}),(0,L.jsxs)(`p`,{className:`board-meta`,children:[(0,L.jsx)(`span`,{className:`work-state `+(M.state??``),children:N&&ae(N)?`Turn limit reached`:H[M.state??``]??M.state}),N&&(0,L.jsxs)(L.Fragment,{children:[` · `,ce(N.endedAt??N.sentAt),N.endedAt&&se(N.startedAt??N.sentAt,N.endedAt)?` · took `+se(N.startedAt??N.sentAt,N.endedAt):``]}),G&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(`span`,{className:`board-live`+(U?.waiting?` waiting`:``),title:G,children:G})]}),K&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsxs)(`button`,{className:`text-button board-live`,onClick:()=>document.getElementById(`board-follow-`+K.id)?.scrollIntoView({block:`center`,behavior:`smooth`}),children:[`Answering “`,K.title,`”`]})]})]})]}),(0,L.jsxs)(`div`,{className:`board-actions`,children:[b.length>1&&(0,L.jsx)(`select`,{"aria-label":`Answer to show`,value:x.id,onChange:e=>ie(e.target.value),children:b.map(({turn:e})=>(0,L.jsxs)(`option`,{value:e.id,children:[new Date(e.start).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),` · `,g.nodes.find(t=>t.id===`q:`+e.id)?.title??`A message`]},e.id))}),(0,L.jsxs)(`button`,{className:`text-button`,onClick:()=>i(x.conversationId),children:[`Conversation `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})]}),M.answer?(0,L.jsxs)(`div`,{className:`board-answer`,ref:ue,onMouseUp:ge,onKeyUp:ge,children:[(0,L.jsx)(te,{text:M.answer,streaming:!!x.running}),le&&!x.running&&(0,L.jsx)(`button`,{className:`board-select-ask`,style:{top:le.top,left:le.left},onMouseDown:e=>e.preventDefault(),onClick:()=>{T({key:`passage`,about:{kind:`passage`,text:le.text}}),E(null),getSelection()?.removeAllRanges()},children:`Ask about this`})]}):x.running?(0,L.jsx)(`p`,{className:`board-note`,role:`status`,children:`The Agent is working on this message.`}):null,w?.key===`passage`&&me(`passage`,w.about),A&&w&&(0,L.jsx)(`p`,{className:`board-note`,children:`The Agent is still answering. Your question can be sent when it has finished.`}),(R||z.length>0)&&(0,L.jsxs)(`div`,{className:`board-results-block`,children:[(0,L.jsxs)(`p`,{className:`board-results-why`,children:[(0,L.jsx)(`strong`,{children:`Results`}),ke&&(0,L.jsxs)(L.Fragment,{children:[` · `,(0,L.jsx)(Ee,{text:ke})]})]}),(0,L.jsxs)(`div`,{className:`board-results beside-`+Math.min(z.length,2),children:[R&&(0,L.jsx)(X,{client:e,snapshot:t,item:R,onPath:a,onExplore:o,said:ke,holds:J(R),ask:x.running?void 0:he(R)}),z.map((n,r)=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a,onExplore:o,said:ke,holds:J(n),span:r>=z.length-Ae?6/Ae:void 0,ask:x.running?void 0:he(n)},n.node.id))]}),V(`supporting`)]}),(be.length>0||B.length>0||xe.length>0||Se.length>0||S.otherCommands>0)&&(0,L.jsxs)(`div`,{className:`board-how`,children:[be.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Method`}),(0,L.jsx)(`div`,{className:`board-cells`,children:be.map(n=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a,holds:J(n),ask:x.running?void 0:he(n)},n.node.id))})]}),(B.length>0||S.otherCommands>0)&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Ran`}),(0,L.jsxs)(`div`,{className:`board-cells`,children:[B.map(n=>(0,L.jsx)(X,{client:e,snapshot:t,item:n,onPath:a},n.node.id)),S.otherCommands>0&&(0,L.jsxs)(`button`,{className:`text-button board-console`,onClick:()=>c(x.id),children:[B.length?S.otherCommands+` other `+(S.otherCommands===1?`command`:`commands`):S.otherCommands+(S.otherCommands===1?` command`:` commands`),` in the Console `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]})]}),xe.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`From`}),(0,L.jsxs)(`div`,{className:`board-chips`,children:[xe.map(e=>(0,L.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,L.jsx)(s,{name:p(e.node.path),size:14,stroke:1.7}),(0,L.jsx)(`span`,{children:e.node.title})]},e.node.id)),V(`input`)]})]}),Se.length>0&&(0,L.jsxs)(`div`,{className:`board-row`,children:[(0,L.jsx)(`span`,{className:`board-label`,children:`Report`}),(0,L.jsx)(`div`,{className:`board-chips`,children:Se.map(e=>(0,L.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,L.jsx)(s,{name:`document`,size:14,stroke:1.7}),(0,L.jsx)(`span`,{children:e.node.title})]},e.node.id))})]})]}),Y.length>0&&(0,L.jsxs)(`div`,{className:`board-choices`,children:[(0,L.jsxs)(`p`,{className:`board-results-why`,children:[(0,L.jsx)(`strong`,{children:`Choices`}),` · what the Agent went with`,Y.some(e=>e.alternatives?.length)?`, and the other option where the notes name one`:``]}),Y.map(n=>(0,L.jsx)(ve,{statement:n,trace:v.traces.get(n),conversationId:k,client:e,projectId:t.project.id,onPath:a,onSent:e=>(d??i)(e)},n.line))]}),C.length>0&&(0,L.jsxs)(`div`,{className:`board-follow`,children:[(0,L.jsx)(`p`,{className:`board-results-why`,children:(0,L.jsx)(`strong`,{children:`Asked since`})}),(0,L.jsx)(`ol`,{children:C.map(e=>(0,L.jsx)(Oe,{id:e.id,node:g.nodes.find(t=>t.id===`q:`+e.id),running:!!e.running,at:e.start,onOpen:()=>i(e.conversationId)},e.id))})]}),N&&(0,L.jsx)(De,{record:N,graph:g,shown:[R,...z,...Se].filter(e=>!!e).map(e=>e.node.path),onDecide:()=>fe(`accepted`),onNeedsChanges:pe}),(0,L.jsx)(`footer`,{className:`board-foot`,children:(0,L.jsxs)(`button`,{className:`text-button`,onClick:l,children:[`How each file connects, in the Graph `,(0,L.jsx)(s,{name:`chevron`,size:12})]})})]})}var Ae=(0,I.lazy)(()=>k(()=>import(`./graph-lENgfQNH.js`).then(e=>({default:e.WorkStrip})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),je=e=>e>=6?6:e>=3?3:e,Me=(e,t)=>/table/.test(e)?`table`:/media|image/.test(e)?`image`:/\.(R|r|py|sh|sql|js|ts)$/.test(t)?`code`:/document|editor|note/.test(e)?`document`:`file`;function Ne({client:e,snapshot:t,item:n,modifiedAt:r}){let i=/\.(png|jpe?g|svg|csv)$/i.test(n.path),[a,o]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!i)return;let a=!0;return D(e,t,{path:n.path,bytes:n.bytes,modifiedAt:r,resource:n.resource}).then(e=>{a&&o(e)}),()=>{a=!1}},[n.path,n.bytes,r,n.resource?.version]),i&&!a?(0,L.jsx)(`span`,{className:`figure-thumb loading`,"aria-hidden":`true`}):a?.kind===`image`?(0,L.jsx)(`span`,{className:`figure-thumb image`,children:(0,L.jsx)(`img`,{src:a.url,alt:``})}):a?.kind===`table`?(0,L.jsx)(`span`,{className:`figure-thumb table`,"aria-hidden":`true`,children:(0,L.jsxs)(`span`,{style:{gridTemplateColumns:`repeat(${a.columns.length}, minmax(0, 1fr))`},children:[a.columns.map(e=>(0,L.jsx)(`b`,{children:e},`h`+e)),a.rows.map((e,t)=>a.columns.map(n=>(0,L.jsx)(`i`,{children:e[n]===null||e[n]===void 0?``:String(e[n])},t+n)))]})}):(0,L.jsx)(`span`,{className:`figure-thumb kind`,"aria-hidden":`true`,children:(0,L.jsx)(s,{name:b(n),size:26,stroke:1.4})})}function Pe({composition:e}){let t=c(e),n=new Map(e.views.map(e=>[e.id,e]));if(!t)return(0,L.jsx)(`span`,{className:`mini-layout empty`,children:`Empty workspace`});let r=e=>{if(e.kind===`split`)return(0,L.jsx)(`span`,{className:`mini-split `+e.axis,children:e.children.map((t,n)=>(0,L.jsx)(`span`,{style:{flexGrow:e.weights[n]??1},children:r(t)},t.id))});let t=e.views.flatMap(e=>n.get(e)??[]),i=t[0],a=i?String(i.props.title??i.id):``;return(0,L.jsxs)(`span`,{className:`mini-pane`,children:[(0,L.jsx)(`span`,{className:`mini-tabs`,children:t.slice(0,5).map((e,t)=>(0,L.jsx)(`i`,{className:t===0?`on`:void 0},e.id))}),i&&(0,L.jsxs)(`span`,{className:`mini-face`,children:[(0,L.jsx)(s,{name:Me(String(i.component),a),size:13}),(0,L.jsx)(`span`,{children:a})]}),t.length>1&&(0,L.jsxs)(`small`,{children:[`+`,t.length-1]})]})};return(0,L.jsx)(`span`,{className:`mini-layout`,"aria-hidden":`true`,children:r(t)})}function Fe(e){return e.provenance?.originalPath??e.path}function Ie(e,t){if(!e)return r(t);let[n,...i]=e.split(`/`),a=n.startsWith(`@`)?t.sources?.find(e=>`@`+e.id===n):void 0;return[a?a.name:n,...i].join(`/`)}function Z({project:e,snapshot:t,client:n,section:c,notesText:l=``,workspace:u,onExplore:p,onSection:h,onAgent:_,onLayout:ee,onProjectChanged:te,onOpened:ne,category:v,files:y,sources:b,onFile:ie,linked:ae=!1,onPath:S,onNewConversation:C,onConsole:T}){let[se,ce]=(0,I.useState)(!1),{runs:E,problem:D,readAgain:k}=de(n,e.id,t.cursor),[A,_e]=(0,I.useState)(null),[j,ve]=(0,I.useState)(null),[P,ye]=(0,I.useState)(!1),[F,R]=(0,I.useState)(``),[B,V]=(0,I.useState)(``),[H,U]=(0,I.useState)(``),[W,G]=(0,I.useState)(!1),[Ce,K]=(0,I.useState)(``),[q,J]=(0,I.useState)(``),[we,Y]=(0,I.useState)(null),[Te,Ee]=(0,I.useState)(!1),[X,De]=(0,I.useState)(null),[Oe,Me]=(0,I.useState)(!1),Z=t.catalog.operations.some(e=>e.method===`project.work.read`&&e.authorized),Q=z(n,t,c===`overview`&&Z,Me),Re=t.catalog.operations.some(e=>e.method===`kernel.read`&&e.state===`available`&&e.authorized),ze=oe(n,e.id,t.cursor,c===`overview`&&Re),Be=!Re||ze.read!==null||!!ze.problem,Ve=t.catalog.operations.some(e=>e.method===`skills.list`&&e.state===`available`&&e.authorized),He=N(n,e.id,t.cursor,c===`overview`&&Ve),Ue=!!He.problem||[...He.list?.skills??[],...He.list?.removed??[]].some(e=>e.last),We=(0,I.useRef)(0),Ge=(0,I.useRef)(null),Ke=c===`files`||c===`documents`,qe=new Map,Je=new Map;for(let e of t.compositions)for(let t of e.views)for(let n of Object.values(t.bindings??{}))`id`in n&&`version`in n&&qe.set(n.id+`@`+n.version,{compositionId:e.compositionId,viewId:t.id}),`documentId`in n&&`kind`in n&&n.kind===`live-document`&&Je.set(String(n.documentId),{compositionId:e.compositionId,viewId:t.id});let Ye=fe(t.resources.filter(e=>e.provenance?.source!==`current-filesystem-observation`),E??[]),Xe=[...E??[]].sort((e,t)=>t.acceptedAt.localeCompare(e.acceptedAt)),Ze=new Map((y?.files??[]).map(e=>[e.path,e.modifiedAt])),$=[...b?.results??[]].sort((e,t)=>(Ze.get(t.path)??``).localeCompare(Ze.get(e.path)??``)),Qe=a(e),$e=!t.compositions.length&&!Ye.length&&!t.taskMap?.question&&!t.taskMap?.items.length&&!t.conversations?.length&&!Oe&&!ze.cells&&!ze.problem,et=!$e||(E!==null||!!D)&&X!==null&&Be,tt=c===`overview`&&$e&&E!==null&&E.length===0&&X!==null&&Be,nt=!!D||(E?.length??0)>0,rt=!!Q.work&&(Q.work.files.length>0||Q.work.omitted.fileReferences>0),it=nt||rt||Z||t.compositions.length>0||Ue,at=je($.length),ot=!!y&&!!t.conversations?.length,st=(X??0)>0,ct=[{key:`files`,label:`Browse files`,icon:`folder`,run:()=>h(`files`),primary:st},{key:`agent`,label:`Work with Agent`,icon:`prompt`,run:()=>_(),primary:!st}].sort((e,t)=>Number(t.primary)-Number(e.primary));async function lt(t=``){let r=++We.current;ye(!0),V(``);try{let i=await n.call(`project.entries`,{projectId:e.id,...t?{path:t}:{}});r===We.current&&(ve(i),U(``))}catch(e){r===We.current&&V(e instanceof Error?e.message:`Could not read this folder. Try again.`)}finally{r===We.current&&ye(!1)}}(0,I.useEffect)(()=>{Ke&&!j&&!P&&lt()},[Ke]),(0,I.useEffect)(()=>{if(c!==`overview`||!$e)return;let t=!0;return n.call(`project.entries`,{projectId:e.id}).then(e=>{t&&De(e.entries.length)},()=>{t&&De(-1)}),()=>{t=!1}},[n,e.id,c,$e]),(0,I.useEffect)(()=>()=>{We.current++},[]),(0,I.useEffect)(()=>{A&&!Ge.current?.open&&Ge.current?.showModal()},[A]);async function ut(r){if(!F){R(r.path),V(``);try{let i=u(),a=t.compositions.find(e=>e.compositionId===i),o=await n.call(`project.openFile`,{projectId:e.id,path:r.path,compositionId:i,expectedVersion:a?.version??0,changeId:`open-`+crypto.randomUUID()});ne(o.composition.compositionId,o.viewId)}catch(e){V(e instanceof Error?e.message:`Could not open this file. Try again.`)}finally{R(``)}}}async function dt(){G(!0),K(``);try{let t=await n.call(`project.source.add`,{projectId:e.id},new AbortController().signal);t.project&&te(t.project)}catch(e){K(e instanceof Error?e.message:`Could not add the folder. Try again.`)}finally{G(!1)}}async function ft(){Ee(!0),J(``);try{Y((await n.call(`project.doctor`,{projectId:e.id},new AbortController().signal)).checks)}catch(e){J(e instanceof Error?e.message:`Could not check this project. Try again.`)}finally{Ee(!1)}}let pt=e=>(0,L.jsxs)(`button`,{className:`activity-row`,onClick:()=>_e(e.operationId),children:[(0,L.jsx)(`span`,{className:`activity-symbol `+e.execution,children:(0,L.jsx)(s,{name:`run`,size:16})}),(0,L.jsxs)(`span`,{className:`activity-name`,children:[(0,L.jsx)(`strong`,{children:e.operationId}),(0,L.jsxs)(`small`,{children:[e.author,` · `,o(e.acceptedAt).text]})]}),(0,L.jsx)(`span`,{className:`state `+e.execution,children:me(e.execution)}),(0,L.jsx)(s,{name:`chevron`,size:13})]},e.operationId),mt=(e,t)=>e&&(0,L.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,L.jsx)(`p`,{children:e}),(0,L.jsx)(`button`,{onClick:t,children:`Try again`})]}),ht=(0,L.jsx)(`ul`,{className:`result-list`,children:Ye.map(({resource:e,run:t,earlier:n})=>{let r=qe.get(e.id+`@`+e.version),i=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`span`,{className:`file-symbol`,children:(0,L.jsx)(s,{name:m(e.kind),size:19,stroke:1.6})}),(0,L.jsxs)(`span`,{className:`result-name`,children:[(0,L.jsx)(`strong`,{title:Fe(e),children:pe(Fe(e))}),(0,L.jsxs)(`small`,{children:[e.kind,n?` · ${n} earlier version${n===1?``:`s`}`:``,t?` · `+t.operationId:``]})]}),(0,L.jsx)(`span`,{className:`result-state`,children:t?ge(t.integrity):ue(e)}),r&&(0,L.jsx)(s,{name:`chevron`,size:14})]});return(0,L.jsx)(`li`,{children:r?(0,L.jsx)(`button`,{className:`result-row`,onClick:()=>ee(r.compositionId,r.viewId),children:i}):(0,L.jsxs)(`div`,{className:`result-row`,children:[i,(0,L.jsx)(`small`,{children:`No open view`})]})},e.id+e.version)})}),gt=j?.entries.filter(e=>!H||e.name.toLocaleLowerCase().includes(H.toLocaleLowerCase()))??[],_t=re[v??`data`],vt=Ke?`Files`:c===`agent`?`Agent`:c===`settings`?`Project settings`:c===`sources`?_t:r(e);return(0,L.jsxs)(`section`,{className:`project-page overview`+(Ke?` files-page`:``),"aria-labelledby":`overview-title`,children:[(0,L.jsxs)(`header`,{className:`page-heading`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h1`,{id:`overview-title`,children:vt}),c===`overview`&&(0,L.jsx)(`p`,{title:Qe.full,children:Qe.text})]}),Ke&&(0,L.jsxs)(`button`,{onClick:()=>void lt(j?.path),disabled:P,children:[(0,L.jsx)(s,{name:`refresh`,size:15}),`Refresh`]}),c===`sources`&&y&&(0,L.jsxs)(`button`,{onClick:y.refresh,disabled:y.reading,children:[(0,L.jsx)(s,{name:`refresh`,size:15}),`Refresh`]})]}),c===`sources`&&y&&ie&&(0,L.jsx)(Le,{category:v??`data`,files:y,items:b?.[v??`data`]??null,artifacts:Ye,onFile:ie}),c===`overview`&&Z&&(0,L.jsx)(be,{state:Q,boarded:!!y&&!!t.conversations?.length,openConversation:_,openActivity:()=>h(`agent`)}),c===`overview`&&B&&(0,L.jsx)(`p`,{role:`alert`,children:B}),tt&&(0,L.jsxs)(`div`,{className:`empty-project`,children:[(0,L.jsx)(`span`,{className:`empty-symbol`,children:(0,L.jsx)(s,{name:`grid`,size:26,stroke:1.5})}),(0,L.jsx)(`h2`,{children:`No work yet`}),(0,L.jsx)(`div`,{className:`empty-actions`,children:ct.map(e=>(0,L.jsxs)(`button`,{className:e.primary?`primary`:void 0,onClick:e.run,children:[(0,L.jsx)(s,{name:e.icon,size:17,stroke:1.6}),(0,L.jsx)(`span`,{children:e.label})]},e.key))})]}),c===`overview`&&!tt&&et&&(0,L.jsxs)(L.Fragment,{children:[t.taskMap?.question&&(0,L.jsxs)(`div`,{className:`project-question`,children:[(0,L.jsx)(s,{name:`prompt`,size:18}),(0,L.jsx)(`h2`,{children:t.taskMap.question})]}),y&&!!t.conversations?.length&&(0,L.jsx)(ke,{client:n,snapshot:t,files:y,notesText:l,onConversation:e=>_(e),onPath:e=>S?.(e),onExplore:p,onConsole:e=>T?T(e):h(`console`),onGraph:()=>h(`graph`)}),(0,L.jsxs)(`div`,{className:`project-columns`+(it?``:` single`),children:[(0,L.jsxs)(`div`,{className:`project-primary`,children:[y&&(0,L.jsx)(I.Suspense,{fallback:null,children:(0,L.jsx)(Ae,{client:n,snapshot:t,files:y,onOpen:()=>h(`graph`),onConversations:()=>h(`agent`)})}),(!ot||!$.length&&Ye.length>0)&&(0,L.jsxs)(`section`,{className:`project-section figures-section`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsxs)(`h2`,{children:[`Results & figures`,$.length>0&&(0,L.jsx)(`span`,{className:`section-count`,children:$.length})]}),(0,L.jsxs)(`button`,{className:`text-button`,onClick:()=>h(`files`),children:[`All files `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]}),$.length?(0,L.jsx)(`ul`,{className:`figure-grid count-`+at+(at>=3?` featured`:``),children:$.slice(0,at).map(e=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`figure-card`,onClick:()=>ie?.(`results`,e),title:e.path,children:[(0,L.jsx)(Ne,{client:n,snapshot:t,item:e,modifiedAt:Ze.get(e.path)}),(0,L.jsxs)(`span`,{className:`figure-name`,children:[(0,L.jsx)(`strong`,{children:e.name}),(0,L.jsxs)(`small`,{children:[e.resource&&e.path.startsWith(`.rho/`)?`Run output`:e.folder,Ze.get(e.path)?` · `+o(Ze.get(e.path)).text:``]})]})]})},e.key))}):Ye.length?ht:(0,L.jsx)(`p`,{className:`quiet-empty`,children:`No results or figures yet.`}),$.length>at&&(0,L.jsxs)(`button`,{className:`text-button figures-more`,onClick:()=>h(`files`),children:[$.length-at,` more in Files `,(0,L.jsx)(s,{name:`chevron`,size:12})]})]}),(0,L.jsx)(x,{work:ze,snapshot:t,onOpen:()=>h(`notebook`)}),t.taskMap?.items.length?(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`From your Agent`})}),(0,L.jsx)(`ul`,{className:`agent-notes`,children:t.taskMap.items.map(e=>(0,L.jsxs)(`li`,{"data-fact":`agent`,children:[(0,L.jsx)(`strong`,{children:e.title}),e.summary&&(0,L.jsx)(`p`,{children:e.summary}),(0,L.jsx)(`small`,{children:t.taskMap.vocabulary.states[e.state]?.label??e.state})]},e.id))})]}):null]}),it&&(0,L.jsxs)(`aside`,{className:`project-side`,children:[(t.compositions.length>0||Z)&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Continue working`})}),(0,L.jsxs)(`div`,{className:`workspace-grid`,children:[t.compositions.filter(e=>!f(e.compositionId)).map(e=>(0,L.jsxs)(`button`,{className:`workspace-card`,onClick:()=>ee(e.compositionId),children:[(0,L.jsxs)(`span`,{className:`workspace-card-head`,children:[(0,L.jsx)(`strong`,{children:d(e.compositionId)}),(0,L.jsxs)(`small`,{children:[e.views.length,` `,e.views.length===1?`view`:`views`]}),(0,L.jsx)(s,{name:`chevron`,size:14})]}),(0,L.jsx)(Pe,{composition:e})]},e.compositionId)),Z&&(0,L.jsx)(Se,{work:Q.work,openFile:e=>void ut({path:e})})]})]}),(0,L.jsx)(M,{list:He.list,problem:He.problem,snapshot:t,onOpen:()=>h(`skills`)}),(0,L.jsx)(xe,{work:Q.work,openFile:e=>void ut({path:e}),openActivity:()=>h(`agent`)}),nt&&(0,L.jsxs)(`section`,{className:`project-section project-recent`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Recent activity`}),(0,L.jsx)(`button`,{className:`text-button`,onClick:()=>h(`agent`),children:`View all`})]}),mt(D,k),Xe.length?(0,L.jsx)(`div`,{className:`activity-list`,children:Xe.slice(0,5).map(pt)}):(0,L.jsx)(`p`,{className:`quiet-empty`,children:`No runs yet.`})]})]})]})]}),Ke&&(0,L.jsxs)(L.Fragment,{children:[t.documents.length>0&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Open documents`})}),(0,L.jsx)(`div`,{className:`document-list`,children:t.documents.map(e=>{let t=Je.get(e.id);return(0,L.jsxs)(`button`,{className:`document-link`,disabled:!!F,onClick:()=>t?ee(t.compositionId,t.viewId):void ut(e),children:[(0,L.jsx)(s,{name:`document`,size:18}),(0,L.jsx)(`span`,{children:pe(e.path)}),e.dirty&&(0,L.jsx)(`span`,{className:`unsaved-dot`,title:`Unsaved changes`,"aria-label":`Unsaved changes`})]},e.id)})})]}),(0,L.jsxs)(`section`,{className:`project-section`,"aria-label":`Project files`,children:[(0,L.jsxs)(`div`,{className:`file-toolbar`,children:[(0,L.jsxs)(`div`,{className:`folder-location`,children:[j?.path&&(0,L.jsx)(`button`,{className:`icon-button`,"aria-label":`Up one folder`,onClick:()=>void lt(j.path.split(`/`).slice(0,-1).join(`/`)),children:(0,L.jsx)(s,{name:`chevron`,size:16})}),(0,L.jsx)(`strong`,{children:Ie(j?.path??``,e)})]}),(0,L.jsxs)(`div`,{className:`search-field`,children:[(0,L.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,L.jsx)(`input`,{"aria-label":`Filter files`,placeholder:`Filter files…`,value:H,onChange:e=>U(e.target.value)})]})]}),mt(B,()=>void lt(j?.path)),P&&(0,L.jsx)(`p`,{className:`loading-inline`,role:`status`,children:`Reading folder…`}),j&&(gt.length?(0,L.jsxs)(`div`,{className:`file-table-wrap`,"aria-busy":P,children:[(0,L.jsxs)(`table`,{className:`file-table`,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Name`}),(0,L.jsx)(`th`,{children:`Type`}),(0,L.jsx)(`th`,{children:`Size`})]})}),(0,L.jsx)(`tbody`,{children:gt.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsxs)(`button`,{className:`file-open`,disabled:!!F||P,onClick:()=>void(e.kind===`folder`?lt(e.path):ut(e)),children:[(0,L.jsx)(s,{name:e.kind===`folder`?`folder`:`file`,size:19,stroke:1.6}),e.name,F===e.path&&(0,L.jsx)(`span`,{role:`status`,children:`Opening…`})]})}),(0,L.jsx)(`td`,{children:e.kind===`folder`?`Folder`:e.name.split(`.`).at(-1)?.toUpperCase()||`File`}),(0,L.jsx)(`td`,{children:e.kind===`folder`?`—`:O(e.bytes)})]},e.path))})]}),j.truncated&&(0,L.jsxs)(`p`,{className:`muted`,children:[`Showing `,j.entries.length,` of `,j.total,` entries.`]})]}):(0,L.jsxs)(`div`,{className:`empty-state compact`,children:[(0,L.jsx)(`p`,{children:H?`No files match your search.`:`This folder is empty.`}),H&&(0,L.jsx)(`button`,{onClick:()=>U(``),children:`Clear search`})]}))]}),t.resources.length>0&&(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Registered results`})}),ht]})]}),c===`agent`&&(()=>{let r=(0,L.jsxs)(L.Fragment,{children:[(Xe.length>0||D)&&(0,L.jsxs)(`section`,{className:`project-section agent-runs`,children:[(0,L.jsx)(`div`,{className:`section-heading`,children:(0,L.jsx)(`h2`,{children:`Runs`})}),mt(D,k),(0,L.jsx)(`div`,{className:`activity-list`,children:Xe.map(pt)})]}),ae&&(0,L.jsxs)(`details`,{className:`agent-outside`,open:se,onToggle:e=>ce(e.currentTarget.open),children:[(0,L.jsx)(`summary`,{children:`Agent sessions with access`}),se&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(le,{snapshot:t}),(0,L.jsx)(g,{client:n,projectId:e.id,root:e.root,onOpened:ne})]})]})]});return ae?r:(0,L.jsx)(w,{client:n,snapshot:t,exists:e=>!!y?.files.some(t=>t.path===e),onContinue:e=>_(e),onPath:e=>S?.(e),onNew:()=>C?.(),onOpened:ne,extra:r})})(),c===`settings`&&(0,L.jsxs)(`div`,{className:`settings-sections`,children:[(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsx)(`h2`,{children:`Source folders`}),(0,L.jsx)(i,{folders:e.sources??[{id:e.id,root:e.root,name:r(e)}],busy:W,onAdd:()=>void dt()}),mt(Ce,()=>void dt())]}),(0,L.jsxs)(`section`,{className:`project-section`,children:[(0,L.jsxs)(`div`,{className:`section-heading`,children:[(0,L.jsx)(`h2`,{children:`Project health`}),(0,L.jsx)(`button`,{disabled:Te,onClick:()=>void ft(),children:Te?`Checking…`:`Check project`})]}),we?(0,L.jsx)(`ul`,{className:`health-list`,children:we.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`state `+e.state,children:e.state===`ok`?`Ready`:e.state===`fail`?`Blocked`:`Check`}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{children:e.detail}),e.remedy&&(0,L.jsx)(`small`,{children:e.remedy})]})]},e.id))}):(0,L.jsx)(`p`,{className:`muted`,children:`Check the tools and capabilities available to this project.`}),mt(q,()=>void ft())]})]}),A&&(0,L.jsxs)(`dialog`,{ref:Ge,className:`run-dialog`,"aria-label":A,onClose:()=>_e(null),onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},children:[(0,L.jsx)(`button`,{className:`icon-button run-dialog-close`,"aria-label":`Close`,onClick:()=>Ge.current?.close(),children:(0,L.jsx)(s,{name:`close`,size:18})}),(0,L.jsx)(he,{snapshot:t,client:n,operationId:A,runs:E,readRuns:k,onOpenRun:_e,opener:e=>{let t=qe.get(e.id+`@`+e.version);return t?()=>ee(t.compositionId,t.viewId):null}},A)]})]})}var Q={data:`No data files in this project yet.`,code:`No scripts in this project yet.`,results:`No results or figures yet.`,notes:`No notes in this project yet.`,workflows:`No workflow files in this project now.`,reports:`No reports in this project now.`,references:`No references in this project now.`,environment:`No environment files in this project now.`};function Le({category:e,files:t,items:n,artifacts:r,onFile:i}){let[a,o]=(0,I.useState)(``),c=new Map(r.map(e=>[e.resource.id+`@`+e.resource.version,e])),u=n??[],d=u.length,f=u.filter(e=>!a||e.path.toLocaleLowerCase().includes(a.toLocaleLowerCase()));return(0,L.jsxs)(`section`,{className:`project-section source-list`,"aria-label":e,children:[(0,L.jsxs)(`div`,{className:`file-toolbar`,children:[(0,L.jsxs)(`p`,{className:`source-summary`,children:[t.readAt===0&&t.reading?`Reading the project folders…`:`${d}${t.truncated?`+`:``} ${d===1?`file`:`files`}`,t.truncated&&(0,L.jsx)(`span`,{title:`Rho reads at most ${l.maxFolders} folders, ${l.maxDepth} levels deep.`,children:` · deeper folders were not read`})]}),(0,L.jsxs)(`div`,{className:`search-field`,children:[(0,L.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,L.jsx)(`input`,{"aria-label":`Filter these files`,placeholder:`Filter…`,value:a,onChange:e=>o(e.target.value)})]})]}),t.problem&&(0,L.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,L.jsx)(`p`,{children:t.problem}),(0,L.jsx)(`button`,{onClick:t.refresh,children:`Try again`})]}),d===0&&t.readAt>0?(0,L.jsx)(`div`,{className:`empty-state compact`,children:(0,L.jsx)(`p`,{children:Q[e]})}):f.length>0?(0,L.jsx)(`ul`,{className:`source-rows`,children:f.map(t=>{let n=t.resource?c.get(t.resource.id+`@`+t.resource.version):void 0;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{className:`source-row`,onClick:()=>i(e,t),children:[(0,L.jsx)(`span`,{className:`file-symbol`,children:(0,L.jsx)(s,{name:b(t),size:18,stroke:1.6})}),(0,L.jsxs)(`span`,{className:`source-name`,children:[(0,L.jsx)(`strong`,{children:t.name}),(0,L.jsxs)(`small`,{children:[t.folder,n?.run?` · from `+n.run.operationId:``]})]}),(0,L.jsx)(`span`,{className:`source-meta`,children:t.resource?n?.run?ge(n.run.integrity):`Result`:t.bytes===null?``:O(t.bytes)})]})},t.key)})}):d>0?(0,L.jsxs)(`div`,{className:`empty-state compact`,children:[(0,L.jsx)(`p`,{children:`No files match your filter.`}),(0,L.jsx)(`button`,{onClick:()=>o(``),children:`Clear filter`})]}):null]})}export{Z as ProjectOverview};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{r}from"./markdown-0ngRuTpW.js";import{a as i,l as a}from"./canvas-D8rDdfDz.js";import{Q as o,St as s,Z as c,et as l,u,wt as d}from"./index-CxmItXqa.js";import{t as f}from"./explore-in-BVUy3ZW_.js";var p=e(n(),1),m=t();async function h(e,t,n){let r=await a(e,t,n.resource??n.path);return r&&{id:r.node.id,component:String(r.node.component),version:String(r.node.version),props:r.node.props??{},bindings:r.node.bindings}}function g(e){return!!(e instanceof HTMLElement?e:null)?.closest(`input, textarea, select, [contenteditable=""], [contenteditable=true], [data-owner-body], [role=tablist], [role=menu], dialog[open]`)}function _({client:e,snapshot:t,item:n,items:a,kind:_,principalId:v,workspace:y,onExplore:b,onMove:x,onStudio:S,onList:C,onAbout:w}){let[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),[j,M]=(0,p.useState)(``),N=a.findIndex(e=>e.key===n.key),P=N>0?a[N-1]:void 0,F=N>=0?a[N+1]:void 0,I=t.catalog.components.length>0;(0,p.useEffect)(()=>{if(!I)return;let r=!0;E(e=>e&&`view`in e?e:null);let i=n.key;return h(e,t,n).then(e=>{r&&E(e?{key:i,view:e}:{key:i,problem:`Rho has no viewer for this kind of file yet. It stays in the project folder.`})},e=>{r&&E({key:i,problem:e instanceof Error?e.message:`This file could not be opened.`})}),()=>{r=!1}},[e,t.project.id,I,n.key,n.bytes,n.resource?.version]),(0,p.useEffect)(()=>{M(``)},[n.key]),(0,p.useEffect)(()=>{function e(e){if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||g(e.target))return;let t=e.key===`ArrowLeft`?P:e.key===`ArrowRight`?F:void 0;t&&(e.preventDefault(),x(t))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P?.key,F?.key,x]);async function L(){A(!0),M(``);try{let r=await i(e,t,y(),n.resource??n.path);r?S(r.compositionId,r.viewId):M(`Rho has no viewer for this kind of file yet.`)}catch(e){M(e instanceof Error?e.message:`It could not be opened in Studio.`)}finally{A(!1)}}let R=T&&`view`in T?T.view:null,z=T?.key===n.key;return(0,m.jsxs)(`section`,{className:`file-preview`,"aria-labelledby":`preview-title`,children:[(0,m.jsxs)(`header`,{className:`preview-bar`,children:[(0,m.jsx)(`span`,{className:`file-symbol`,children:(0,m.jsx)(r,{name:s(n),size:18,stroke:1.6})}),(0,m.jsxs)(`div`,{className:`preview-name`,children:[(0,m.jsx)(`h1`,{id:`preview-title`,title:n.path,children:n.name}),(0,m.jsxs)(`small`,{children:[n.folder,n.bytes===null?``:` · `+d(n.bytes)]})]}),(0,m.jsx)(`div`,{ref:O,className:`preview-owner-header`}),(0,m.jsxs)(`div`,{className:`preview-nav`,role:`group`,"aria-label":`Browse `+_,children:[(0,m.jsx)(`button`,{className:`icon-button`,"aria-label":P?`Previous: `+P.name:`Previous file`,title:`Previous (←)`,"aria-keyshortcuts":`ArrowLeft`,disabled:!P,onClick:()=>P&&x(P),children:(0,m.jsx)(r,{name:`back`,size:16})}),(0,m.jsx)(`button`,{className:`preview-position`,title:`All `+_.toLowerCase(),onClick:C,children:N>=0?`${N+1} of ${a.length}`:a.length+` files`}),(0,m.jsx)(`button`,{className:`icon-button`,"aria-label":F?`Next: `+F.name:`Next file`,title:`Next (→)`,"aria-keyshortcuts":`ArrowRight`,disabled:!F,onClick:()=>F&&x(F),children:(0,m.jsx)(r,{name:`chevron`,size:16})})]}),b&&(c(n.path)||l(n.path))&&(0,m.jsx)(f,{languages:c(n.path)?[`r`,`python`]:[l(n.path)],title:e=>c(n.path)?`Open ${n.name} in Studio with the Notebook beside it, loaded into the ${o[e]} session as a new value`:`Open ${n.name} in Studio with the Notebook beside it, and a line that runs it waiting there for you`,onExplore:e=>b(n.path,e)}),(0,m.jsxs)(`button`,{className:`preview-studio`,"aria-label":k?`Opening in Studio`:`Open in Studio`,title:`Open in Studio`,disabled:k,onClick:()=>void L(),children:[(0,m.jsx)(r,{name:`layout`,size:15}),(0,m.jsx)(`span`,{children:k?`Opening…`:`Open in Studio`})]})]}),j&&(0,m.jsx)(`p`,{className:`canvas-note`,role:`alert`,children:j}),(0,m.jsx)(`div`,{className:`preview-body`+(R&&!z?` switching`:``),"aria-busy":!z,children:R?(0,m.jsx)(u,{active:!0,params:{view:R,snapshot:t,client:e,principalId:v,compositionId:`preview`,compositionVersion:0,contextTarget:null,headerTarget:z?D:null,renderAllowed:!0,onAbout:w}},R.id):T&&`problem`in T&&z?(0,m.jsxs)(`div`,{className:`studio-empty`,children:[(0,m.jsx)(`span`,{className:`empty-symbol`,children:(0,m.jsx)(r,{name:`file`,size:26,stroke:1.5})}),(0,m.jsx)(`h2`,{children:n.name}),(0,m.jsx)(`p`,{children:T.problem})]}):(0,m.jsxs)(`div`,{className:`loading-state`,role:`status`,children:[(0,m.jsx)(`span`,{className:`loading-dot`}),(0,m.jsxs)(`span`,{children:[`Opening `,n.name,`…`]})]})})]})}export{_ as FilePreview};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{r}from"./markdown-0ngRuTpW.js";import{a as i,l as a}from"./canvas-D8rDdfDz.js";import{Q as o,St as s,Z as c,et as l,u,wt as d}from"./index-BpL_Kl_s.js";import{t as f}from"./explore-in-BCHqjJ7B.js";var p=e(n(),1),m=t();async function h(e,t,n){let r=await a(e,t,n.resource??n.path);return r&&{id:r.node.id,component:String(r.node.component),version:String(r.node.version),props:r.node.props??{},bindings:r.node.bindings}}function g(e){return!!(e instanceof HTMLElement?e:null)?.closest(`input, textarea, select, [contenteditable=""], [contenteditable=true], [data-owner-body], [role=tablist], [role=menu], dialog[open]`)}function _({client:e,snapshot:t,item:n,items:a,kind:_,principalId:v,workspace:y,onExplore:b,onMove:x,onStudio:S,onList:C,onAbout:w}){let[T,E]=(0,p.useState)(null),[D,O]=(0,p.useState)(null),[k,A]=(0,p.useState)(!1),[j,M]=(0,p.useState)(``),N=a.findIndex(e=>e.key===n.key),P=N>0?a[N-1]:void 0,F=N>=0?a[N+1]:void 0,I=t.catalog.components.length>0;(0,p.useEffect)(()=>{if(!I)return;let r=!0;E(e=>e&&`view`in e?e:null);let i=n.key;return h(e,t,n).then(e=>{r&&E(e?{key:i,view:e}:{key:i,problem:`Rho has no viewer for this kind of file yet. It stays in the project folder.`})},e=>{r&&E({key:i,problem:e instanceof Error?e.message:`This file could not be opened.`})}),()=>{r=!1}},[e,t.project.id,I,n.key,n.bytes,n.resource?.version]),(0,p.useEffect)(()=>{M(``)},[n.key]),(0,p.useEffect)(()=>{function e(e){if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||g(e.target))return;let t=e.key===`ArrowLeft`?P:e.key===`ArrowRight`?F:void 0;t&&(e.preventDefault(),x(t))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P?.key,F?.key,x]);async function L(){A(!0),M(``);try{let r=await i(e,t,y(),n.resource??n.path);r?S(r.compositionId,r.viewId):M(`Rho has no viewer for this kind of file yet.`)}catch(e){M(e instanceof Error?e.message:`It could not be opened in Studio.`)}finally{A(!1)}}let R=T&&`view`in T?T.view:null,z=T?.key===n.key;return(0,m.jsxs)(`section`,{className:`file-preview`,"aria-labelledby":`preview-title`,children:[(0,m.jsxs)(`header`,{className:`preview-bar`,children:[(0,m.jsx)(`span`,{className:`file-symbol`,children:(0,m.jsx)(r,{name:s(n),size:18,stroke:1.6})}),(0,m.jsxs)(`div`,{className:`preview-name`,children:[(0,m.jsx)(`h1`,{id:`preview-title`,title:n.path,children:n.name}),(0,m.jsxs)(`small`,{children:[n.folder,n.bytes===null?``:` · `+d(n.bytes)]})]}),(0,m.jsx)(`div`,{ref:O,className:`preview-owner-header`}),(0,m.jsxs)(`div`,{className:`preview-nav`,role:`group`,"aria-label":`Browse `+_,children:[(0,m.jsx)(`button`,{className:`icon-button`,"aria-label":P?`Previous: `+P.name:`Previous file`,title:`Previous (←)`,"aria-keyshortcuts":`ArrowLeft`,disabled:!P,onClick:()=>P&&x(P),children:(0,m.jsx)(r,{name:`back`,size:16})}),(0,m.jsx)(`button`,{className:`preview-position`,title:`All `+_.toLowerCase(),onClick:C,children:N>=0?`${N+1} of ${a.length}`:a.length+` files`}),(0,m.jsx)(`button`,{className:`icon-button`,"aria-label":F?`Next: `+F.name:`Next file`,title:`Next (→)`,"aria-keyshortcuts":`ArrowRight`,disabled:!F,onClick:()=>F&&x(F),children:(0,m.jsx)(r,{name:`chevron`,size:16})})]}),b&&(c(n.path)||l(n.path))&&(0,m.jsx)(f,{languages:c(n.path)?[`r`,`python`]:[l(n.path)],title:e=>c(n.path)?`Open ${n.name} in Studio with the Notebook beside it, loaded into the ${o[e]} session as a new value`:`Open ${n.name} in Studio with the Notebook beside it, and a line that runs it waiting there for you`,onExplore:e=>b(n.path,e)}),(0,m.jsxs)(`button`,{className:`preview-studio`,"aria-label":k?`Opening in Studio`:`Open in Studio`,title:`Open in Studio`,disabled:k,onClick:()=>void L(),children:[(0,m.jsx)(r,{name:`layout`,size:15}),(0,m.jsx)(`span`,{children:k?`Opening…`:`Open in Studio`})]})]}),j&&(0,m.jsx)(`p`,{className:`canvas-note`,role:`alert`,children:j}),(0,m.jsx)(`div`,{className:`preview-body`+(R&&!z?` switching`:``),"aria-busy":!z,children:R?(0,m.jsx)(u,{active:!0,params:{view:R,snapshot:t,client:e,principalId:v,compositionId:`preview`,compositionVersion:0,contextTarget:null,headerTarget:z?D:null,renderAllowed:!0,onAbout:w}},R.id):T&&`problem`in T&&z?(0,m.jsxs)(`div`,{className:`studio-empty`,children:[(0,m.jsx)(`span`,{className:`empty-symbol`,children:(0,m.jsx)(r,{name:`file`,size:26,stroke:1.5})}),(0,m.jsx)(`h2`,{children:n.name}),(0,m.jsx)(`p`,{children:T.problem})]}):(0,m.jsxs)(`div`,{className:`loading-state`,role:`status`,children:[(0,m.jsx)(`span`,{className:`loading-dot`}),(0,m.jsxs)(`span`,{children:[`Opening `,n.name,`…`]})]})})]})}export{_ as FilePreview};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{t as r}from"./markdown-0ngRuTpW.js";import{_ as i,b as a,g as o}from"./index-CxmItXqa.js";import{t as s}from"./snapshot-CAxBYPvV.js";var c=e(n(),1),l=t();function u({client:e,snapshot:t,principalId:n,annotationId:a,initialAnchor:u,onSent:m,onGraph:h}){let[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(``);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o,{client:e,projectId:t.project.id,principalId:n,annotationId:a,initialAnchor:u,threads:t.annotations,resources:t.resources,conversations:t.conversations??[],contexts:t.contexts,onSent:m,onOpenResource:_,onGraphResource:h,renderText:e=>(0,l.jsx)(r,{text:e,streaming:!1}),renderCodeChanges:n=>(0,l.jsx)(f,{client:e,projectId:t.project.id,annotationId:n,cursor:t.cursor}),renderComparison:(n,r)=>(0,l.jsx)(i,{client:e,projectId:t.project.id,left:n,right:r},n.id+r.id),onExport:y}),g&&(0,l.jsxs)(p,{label:`Captured result`,onClose:()=>_(null),children:[(0,l.jsx)(`button`,{onClick:()=>_(null),children:`Close captured result`}),(0,l.jsx)(s,{client:e,projectId:t.project.id,resource:g})]}),v&&(0,l.jsx)(d,{client:e,projectId:t.project.id,annotationId:v,onClose:()=>y(``)})]})}function d({client:e,projectId:t,annotationId:n,onClose:i}){let[a,o]=(0,c.useState)(null),[u,d]=(0,c.useState)(null),[f,m]=(0,c.useState)(null),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(!1);async function y(){v(!0);try{d(await e.call(`evidence.preview`,{projectId:t,annotationId:n}))}catch(e){g(e.message)}finally{v(!1)}}async function b(){v(!0);try{let r,i=`rho.evidence.export:`+t+`:`+n;try{r=JSON.parse(sessionStorage.getItem(i)??`null`)}catch{}r||(r={projectId:t,annotationId:n,expectedDigest:u.digest,exportId:`evidence-`+crypto.randomUUID()},sessionStorage.setItem(i,JSON.stringify(r))),m(await e.call(`evidence.export`,r)),sessionStorage.removeItem(i)}catch(e){g(e.message)}finally{v(!1)}}return(0,l.jsxs)(p,{label:`Export evidence`,onClose:i,children:[(0,l.jsx)(`button`,{onClick:i,children:`Close export`}),(0,l.jsx)(`h2`,{children:`Export read-only evidence`}),(0,l.jsx)(`p`,{children:`Only this question, its replies, decisions and explicitly linked captured files are included. Completeness of the analysis evidence is not established.`}),h&&(0,l.jsx)(`p`,{role:`alert`,children:h}),(0,l.jsx)(`button`,{disabled:_,onClick:()=>void y(),children:`Preview included evidence`}),u&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`h3`,{children:`Question and replies`}),u.thread.messages.map(e=>(0,l.jsx)(`div`,{children:(0,l.jsx)(r,{text:e.draft.text,streaming:!1})},e.id)),(0,l.jsx)(`h3`,{children:`Human decisions`}),(u.thread.decisions??[]).map(e=>(0,l.jsxs)(`p`,{children:[e.status,` · `,e.reason]},e.id)),(0,l.jsx)(`h3`,{children:`Selected files`}),(0,l.jsxs)(`p`,{children:[u.files.length,` files · `,u.bytes,` bytes`]}),(0,l.jsx)(`ul`,{children:u.files.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`button`,{onClick:()=>o(e.resource),children:e.provenance?.transform?.fields?`Table differences`:e.path}),` `,`· `,e.bytes,` bytes · `,e.resource.version.slice(0,12)]},e.resource.id))}),a&&(0,l.jsx)(s,{client:e,projectId:t,resource:a}),(0,l.jsx)(`h3`,{children:`Evidence gaps`}),(0,l.jsx)(`ul`,{children:u.gaps.map((e,t)=>(0,l.jsx)(`li`,{children:e},t))}),(0,l.jsx)(`button`,{disabled:_||!!f,onClick:()=>void b(),children:`Export this selection`})]}),f&&(0,l.jsxs)(`p`,{role:`status`,children:[`Saved to `,f.destination,`. Open index.html to read it offline.`]})]})}function f({client:e,projectId:t,annotationId:n,cursor:r}){let[i,o]=(0,c.useState)([]),[s,u]=(0,c.useState)(``);(0,c.useEffect)(()=>{let r=!0;return e.call(`evidence.preview`,{projectId:t,annotationId:n}).then(e=>{r&&o(e.files.map(e=>({...e,sourceKind:e.provenance?.observation?.kind??`disk`})).filter(e=>/\.(R|r|py|qmd|Rmd|sh|sql)$/.test(e.path)))},e=>r&&u(e.message)),()=>{r=!1}},[n,r]);let d=[...new Set(i.map(e=>e.path+` · `+e.sourceKind))];return(0,l.jsxs)(`section`,{children:[(0,l.jsx)(`h2`,{children:`Code observations`}),s&&(0,l.jsx)(`p`,{role:`alert`,children:s}),!d.length&&(0,l.jsx)(`p`,{children:`No code versions were explicitly retained for this review.`}),d.map(n=>{let r=i.filter(e=>e.path+` · `+e.sourceKind===n);return(0,l.jsxs)(`article`,{children:[(0,l.jsx)(`h3`,{children:n}),r.length>1?(0,l.jsx)(a,{client:e,projectId:t,before:r[0].resource,after:r.at(-1).resource}):(0,l.jsx)(`p`,{children:`Only one captured version is available. An earlier code version was not retained.`})]},n)})]})}function p({label:e,onClose:t,children:n}){let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=document.activeElement;return r.current?.showModal(),()=>{r.current?.close(),e?.focus()}},[]),(0,l.jsx)(`dialog`,{className:`review-overlay`,ref:r,"aria-label":e,onCancel:e=>{e.preventDefault(),t()},children:n})}export{u as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{t as r}from"./markdown-0ngRuTpW.js";import{_ as i,b as a,g as o}from"./index-BpL_Kl_s.js";import{t as s}from"./snapshot-CAxBYPvV.js";var c=e(n(),1),l=t();function u({client:e,snapshot:t,principalId:n,annotationId:a,initialAnchor:u,onSent:m,onGraph:h}){let[g,_]=(0,c.useState)(null),[v,y]=(0,c.useState)(``);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o,{client:e,projectId:t.project.id,principalId:n,annotationId:a,initialAnchor:u,threads:t.annotations,resources:t.resources,conversations:t.conversations??[],contexts:t.contexts,onSent:m,onOpenResource:_,onGraphResource:h,renderText:e=>(0,l.jsx)(r,{text:e,streaming:!1}),renderCodeChanges:n=>(0,l.jsx)(f,{client:e,projectId:t.project.id,annotationId:n,cursor:t.cursor}),renderComparison:(n,r)=>(0,l.jsx)(i,{client:e,projectId:t.project.id,left:n,right:r},n.id+r.id),onExport:y}),g&&(0,l.jsxs)(p,{label:`Captured result`,onClose:()=>_(null),children:[(0,l.jsx)(`button`,{onClick:()=>_(null),children:`Close captured result`}),(0,l.jsx)(s,{client:e,projectId:t.project.id,resource:g})]}),v&&(0,l.jsx)(d,{client:e,projectId:t.project.id,annotationId:v,onClose:()=>y(``)})]})}function d({client:e,projectId:t,annotationId:n,onClose:i}){let[a,o]=(0,c.useState)(null),[u,d]=(0,c.useState)(null),[f,m]=(0,c.useState)(null),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(!1);async function y(){v(!0);try{d(await e.call(`evidence.preview`,{projectId:t,annotationId:n}))}catch(e){g(e.message)}finally{v(!1)}}async function b(){v(!0);try{let r,i=`rho.evidence.export:`+t+`:`+n;try{r=JSON.parse(sessionStorage.getItem(i)??`null`)}catch{}r||(r={projectId:t,annotationId:n,expectedDigest:u.digest,exportId:`evidence-`+crypto.randomUUID()},sessionStorage.setItem(i,JSON.stringify(r))),m(await e.call(`evidence.export`,r)),sessionStorage.removeItem(i)}catch(e){g(e.message)}finally{v(!1)}}return(0,l.jsxs)(p,{label:`Export evidence`,onClose:i,children:[(0,l.jsx)(`button`,{onClick:i,children:`Close export`}),(0,l.jsx)(`h2`,{children:`Export read-only evidence`}),(0,l.jsx)(`p`,{children:`Only this question, its replies, decisions and explicitly linked captured files are included. Completeness of the analysis evidence is not established.`}),h&&(0,l.jsx)(`p`,{role:`alert`,children:h}),(0,l.jsx)(`button`,{disabled:_,onClick:()=>void y(),children:`Preview included evidence`}),u&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`h3`,{children:`Question and replies`}),u.thread.messages.map(e=>(0,l.jsx)(`div`,{children:(0,l.jsx)(r,{text:e.draft.text,streaming:!1})},e.id)),(0,l.jsx)(`h3`,{children:`Human decisions`}),(u.thread.decisions??[]).map(e=>(0,l.jsxs)(`p`,{children:[e.status,` · `,e.reason]},e.id)),(0,l.jsx)(`h3`,{children:`Selected files`}),(0,l.jsxs)(`p`,{children:[u.files.length,` files · `,u.bytes,` bytes`]}),(0,l.jsx)(`ul`,{children:u.files.map(e=>(0,l.jsxs)(`li`,{children:[(0,l.jsx)(`button`,{onClick:()=>o(e.resource),children:e.provenance?.transform?.fields?`Table differences`:e.path}),` `,`· `,e.bytes,` bytes · `,e.resource.version.slice(0,12)]},e.resource.id))}),a&&(0,l.jsx)(s,{client:e,projectId:t,resource:a}),(0,l.jsx)(`h3`,{children:`Evidence gaps`}),(0,l.jsx)(`ul`,{children:u.gaps.map((e,t)=>(0,l.jsx)(`li`,{children:e},t))}),(0,l.jsx)(`button`,{disabled:_||!!f,onClick:()=>void b(),children:`Export this selection`})]}),f&&(0,l.jsxs)(`p`,{role:`status`,children:[`Saved to `,f.destination,`. Open index.html to read it offline.`]})]})}function f({client:e,projectId:t,annotationId:n,cursor:r}){let[i,o]=(0,c.useState)([]),[s,u]=(0,c.useState)(``);(0,c.useEffect)(()=>{let r=!0;return e.call(`evidence.preview`,{projectId:t,annotationId:n}).then(e=>{r&&o(e.files.map(e=>({...e,sourceKind:e.provenance?.observation?.kind??`disk`})).filter(e=>/\.(R|r|py|qmd|Rmd|sh|sql)$/.test(e.path)))},e=>r&&u(e.message)),()=>{r=!1}},[n,r]);let d=[...new Set(i.map(e=>e.path+` · `+e.sourceKind))];return(0,l.jsxs)(`section`,{children:[(0,l.jsx)(`h2`,{children:`Code observations`}),s&&(0,l.jsx)(`p`,{role:`alert`,children:s}),!d.length&&(0,l.jsx)(`p`,{children:`No code versions were explicitly retained for this review.`}),d.map(n=>{let r=i.filter(e=>e.path+` · `+e.sourceKind===n);return(0,l.jsxs)(`article`,{children:[(0,l.jsx)(`h3`,{children:n}),r.length>1?(0,l.jsx)(a,{client:e,projectId:t,before:r[0].resource,after:r.at(-1).resource}):(0,l.jsx)(`p`,{children:`Only one captured version is available. An earlier code version was not retained.`})]},n)})]})}function p({label:e,onClose:t,children:n}){let r=(0,c.useRef)(null);return(0,c.useEffect)(()=>{let e=document.activeElement;return r.current?.showModal(),()=>{r.current?.close(),e?.focus()}},[]),(0,l.jsx)(`dialog`,{className:`review-overlay`,ref:r,"aria-label":e,onCancel:e=>{e.preventDefault(),t()},children:n})}export{u as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{s as r}from"./home-CCbP6kS-.js";import{r as i,t as a}from"./markdown-0ngRuTpW.js";import{tt as o}from"./index-CxmItXqa.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,u as h}from"./skills-work-BGPSnF_I.js";var g=e(n(),1),_=t(),v={changes:20},y={recorded:`changed`,removed:`removed`,undone:`undid a change to`,outside:`changed`};function b({client:e,snapshot:t,onPath:n,onConversation:i,onNotebook:a}){let o=t.project.id,{list:s,problem:l,again:f}=h(e,o,t.cursor),m=u(t),[v,b]=(0,g.useState)(p),[w,T]=(0,g.useState)(v!==null);(0,g.useEffect)(d,[]);let E=s?.skills??[],D=s?.removed??[],O=[...E,...D].filter(e=>e.last).sort((e,t)=>t.last.at.localeCompare(e.last.at))[0]??E[0]??null,k=v&&[...E,...D].some(e=>e.name===v)?v:O?.name??null,j=e=>{b(e),T(!0)},M=O?.last;return(0,_.jsxs)(`section`,{className:`project-page skills-page`,"aria-labelledby":`skills-title`,children:[(0,_.jsx)(`header`,{className:`page-heading`,children:(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{id:`skills-title`,children:`Skills`}),s&&E.length===0&&(0,_.jsx)(`p`,{children:`How work is done in this project, read by every Agent here`}),s&&E.length>0&&(0,_.jsxs)(`p`,{children:[E.length,` `,E.length===1?`skill`:`skills`,` every Agent here reads`,M?` · ${M.kind===`outside`?c(O.name)+` was changed outside Rho`:m(M.by).name+` `+y[M.kind]+` `+c(O.name)} ${r(M.at).text.toLowerCase()}`:``]})]})}),l&&(0,_.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,_.jsxs)(`p`,{children:[`The skills could not be read. `,l]}),(0,_.jsx)(`button`,{onClick:()=>void f(),children:`Try again`})]}),!s&&!l?(0,_.jsx)(`p`,{className:`quiet-empty`,role:`status`,children:`Reading the skills…`}):s&&(0,_.jsxs)(`div`,{className:`skills-layout`+(w&&k?` showing`:``)+(k?``:` none-yet`),children:[(0,_.jsxs)(`nav`,{className:`skills-index`,"aria-label":`Skills`,children:[E.length>0?(0,_.jsx)(`ul`,{className:`skills-list`,children:E.map(e=>(0,_.jsx)(`li`,{children:(0,_.jsx)(x,{skill:e,current:e.name===k,author:m,onChoose:()=>j(e.name)})},e.name))}):(0,_.jsxs)(`div`,{className:`skills-empty`,children:[(0,_.jsx)(`h2`,{children:`No project skills yet`}),(0,_.jsx)(`p`,{children:`When you correct how your Agent works, or it finds why something failed, it records that here, and the next conversation starts from it. You can also tell it directly:`}),(0,_.jsx)(`ul`,{children:[`For this project we report proportions as percentages.`,`Remember how we filter the cells, so the next analysis does the same.`].map(e=>(0,_.jsxs)(`li`,{children:[`“`,e,`”`]},e))}),(0,_.jsx)(`small`,{children:`Skills are kept as SKILL.md files in .claude/skills in the project folder. Claude Code reads them by itself; other Agents read them through Rho.`})]}),D.length>0&&(0,_.jsxs)(`details`,{className:`skills-removed`,open:D.some(e=>e.name===k),children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),`Removed `,(0,_.jsx)(`span`,{className:`section-count`,children:D.length})]}),(0,_.jsx)(`ul`,{className:`skills-list`,children:D.map(e=>(0,_.jsx)(`li`,{children:(0,_.jsx)(x,{skill:e,current:e.name===k,author:m,onChoose:()=>j(e.name)})},e.name))})]}),(0,_.jsx)(A,{client:e,snapshot:t})]}),k&&(0,_.jsx)(S,{client:e,snapshot:t,name:k,summary:[...E,...D].find(e=>e.name===k),author:m,onBack:()=>T(!1),onPath:n,onConversation:i,onNotebook:a,onChanged:()=>void f()},k)]})]})}function x({skill:e,current:t,author:n,onChoose:i}){let a=e.last;return(0,_.jsxs)(`button`,{className:`skills-row`,"aria-current":t?`true`:void 0,onClick:i,title:m(e.name),children:[(0,_.jsx)(`strong`,{children:c(e.name)}),e.description&&(0,_.jsx)(`span`,{className:`skills-row-desc`,children:e.description}),(0,_.jsx)(`small`,{children:e.problem?(0,_.jsx)(`span`,{className:`skills-row-problem`,children:e.problem}):a?e.outside?`Changed outside Rho`:`${a.kind===`outside`?`Changed outside Rho`:l(a,n(a.by).name)} · ${r(a.at).text}`:`Written outside Rho`})]})}function S({client:e,snapshot:t,name:n,summary:o,author:u,onBack:d,onPath:p,onConversation:h,onNotebook:y,onChanged:b}){let x=t.project.id,[S,w]=(0,g.useState)(null),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(``),I=()=>e.call(`skills.read`,{projectId:x,name:n,limit:v.changes}).then(e=>{w(e),j(``)},e=>j(s(e)));(0,g.useEffect)(()=>{I()},[e,x,n,t.cursor]);let[L,...R]=S?.changes??[],z=!!L&&L.kind!==`outside`&&!L.undoneBy&&!S?.outside;async function B(t){N(!0),F(``);try{await e.call(`skills.undo`,{projectId:x,name:n,change:t.id,changeId:`undo-`+t.id+`-`+Date.now().toString(36)}),b(),await I()}catch(e){F(s(e))}finally{N(!1)}}let V=e=>{let t=u(e.by),n=l(e,t.name);return t.conversationId?(0,_.jsx)(`button`,{className:`text-button skills-who`,onClick:()=>h(t.conversationId),title:`Open the conversation`,children:n}):n},H=new Set((t.conversations??[]).map(e=>e.conversationId)),U=e=>(0,_.jsx)(k,{evidence:e,known:H.has(e.ref),onPath:p,onConversation:h,onNotebook:y},e.kind+e.ref);return(0,_.jsxs)(`article`,{className:`skills-detail`,"aria-labelledby":`skill-title`,children:[(0,_.jsxs)(`button`,{className:`text-button skills-back`,onClick:d,children:[(0,_.jsx)(i,{name:`back`,size:14}),`All skills`]}),(0,_.jsxs)(`header`,{className:`skills-detail-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{id:`skill-title`,children:c(n)}),(S?.skill?.description??o.description)&&(0,_.jsx)(`p`,{children:S?.skill?.description??o.description})]}),S?.skill&&(0,_.jsxs)(`button`,{onClick:()=>p(m(n)),title:m(n),children:[(0,_.jsx)(i,{name:`document`,size:15}),`Edit the file`]})]}),A&&(0,_.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,_.jsx)(`p`,{children:A}),(0,_.jsx)(`button`,{onClick:()=>void I(),children:`Try again`})]}),!S&&!A&&(0,_.jsxs)(`p`,{className:`quiet-empty`,role:`status`,children:[`Reading `,c(n),`…`]}),o.problem&&(0,_.jsx)(`p`,{className:`skills-note`,role:`status`,children:o.problem}),S?.outside&&(S.outside.since===null&&!L?(0,_.jsx)(`p`,{className:`skills-note`,role:`status`,children:`Written outside Rho. Agents read it as it is; Rho records its changes from the first one made here.`}):(0,_.jsxs)(`section`,{className:`skills-change outside`,"aria-label":`Changed outside Rho`,children:[(0,_.jsx)(`p`,{className:`skills-change-reason`,children:`Changed outside Rho since the last recorded change`}),(0,_.jsxs)(`p`,{className:`skills-change-meta`,children:[(0,_.jsx)(E,{added:S.outside.added,removed:S.outside.removed}),` · Agents read it as it is now; the next change recorded here starts from it`]}),(0,_.jsx)(O,{diff:S.outside.diff})]})),L&&(0,_.jsxs)(`section`,{className:`skills-change newest`+(L.undoneBy?` undone`:``),"aria-label":`Newest change`,children:[(0,_.jsx)(`p`,{className:`skills-change-reason`,children:f(L)}),(0,_.jsxs)(`p`,{className:`skills-change-meta`,children:[V(L),` · `,r(L.at).text,` · `,(0,_.jsx)(E,{added:L.added,removed:L.removed})]}),L.evidence.length>0&&(0,_.jsx)(`div`,{className:`skills-evidence`,children:L.evidence.map(U)}),(0,_.jsx)(D,{change:L}),(z||P)&&(0,_.jsxs)(`div`,{className:`skills-change-actions`,children:[z&&(0,_.jsx)(`button`,{onClick:()=>void B(L),disabled:M,children:M?`Undoing…`:L.kind===`removed`?`Bring it back`:L.kind===`undone`?`Put the change back`:`Undo this change`}),P&&(0,_.jsx)(`p`,{role:`alert`,children:P})]})]}),S?.skill?(0,_.jsxs)(`section`,{className:`skills-text`,"aria-labelledby":`skills-text-title`,children:[(0,_.jsx)(`h3`,{id:`skills-text-title`,children:`What Agents read`}),(0,_.jsx)(a,{text:T(S.skill.body,n),streaming:!1})]}):S&&(0,_.jsx)(`p`,{className:`skills-note`,children:`This skill was removed. Its changes are kept below.`}),R.length>0&&(0,_.jsxs)(`section`,{className:`skills-history`,"aria-labelledby":`skills-history-title`,children:[(0,_.jsx)(`h3`,{id:`skills-history-title`,children:`Earlier changes`}),(0,_.jsx)(`ol`,{children:R.map(e=>(0,_.jsx)(`li`,{className:e.undoneBy?`undone`:void 0,children:(0,_.jsxs)(`details`,{children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),(0,_.jsx)(`span`,{className:`skills-history-reason`,children:f(e)}),(0,_.jsxs)(`small`,{children:[l(e,u(e.by).name),` · `,r(e.at).text,e.undoneBy?` · undone`:``]}),(0,_.jsx)(E,{added:e.added,removed:e.removed})]}),e.evidence.length>0&&(0,_.jsx)(`div`,{className:`skills-evidence`,children:e.evidence.map(U)}),(0,_.jsx)(D,{change:e})]})},e.id))}),(S?.omitted??0)>0&&(0,_.jsxs)(`p`,{className:`quiet-empty`,children:[S.omitted,` older `,S.omitted===1?`change`:`changes`,` kept`]})]})]})}var C=()=>(0,_.jsx)(`span`,{className:`skills-twisty`,"aria-hidden":`true`,children:(0,_.jsx)(i,{name:`chevron`,size:11,stroke:2})}),w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim(),T=(e,t)=>e.replace(/^\s*# (.+)\n+/,(e,n)=>w(n)===w(t)?``:e),E=({added:e,removed:t})=>(0,_.jsxs)(`span`,{className:`skills-counts`,"aria-label":`${e} lines added, ${t} removed`,children:[(0,_.jsxs)(`span`,{className:`added`,children:[`+`,e]}),` `,(0,_.jsxs)(`span`,{className:`removed`,children:[`−`,t]})]});function D({change:e}){return e.before!==null&&e.after!==null?(0,_.jsx)(O,{diff:e.diff}):(0,_.jsxs)(`details`,{className:`skills-removed-text`,children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),e.after===null?`The text it removed`:`The text it wrote`]}),(0,_.jsx)(O,{diff:e.diff})]})}function O({diff:e}){return e.lines.length?(0,_.jsxs)(`div`,{className:`skills-diff`,role:`group`,"aria-label":`What changed`,children:[e.lines.map((e,t)=>e.op===`…`?(0,_.jsxs)(`div`,{className:`fold`,children:[e.text,` unchanged `,e.text===`1`?`line`:`lines`]},t):(0,_.jsxs)(`div`,{className:e.op===`+`?`add`:e.op===`-`?`del`:`keep`,children:[(0,_.jsx)(`span`,{"aria-hidden":`true`,children:e.op}),e.text||` `]},t)),e.cut&&(0,_.jsx)(`div`,{className:`fold`,children:`The rest is not shown`})]}):null}function k({evidence:e,known:t,onPath:n,onConversation:r,onNotebook:a}){let s=e.label||e.ref;return e.kind===`cell`?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>{o(e.ref),a()},title:`Open the cell in the Notebook`,children:[(0,_.jsx)(i,{name:`code`,size:13}),s]}):e.kind===`file`?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>n(e.ref),title:e.ref,children:[(0,_.jsx)(i,{name:`file`,size:13}),s]}):e.kind===`conversation`&&t?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>r(e.ref),children:[(0,_.jsx)(i,{name:`prompt`,size:13}),e.label||`The conversation`]}):(0,_.jsx)(`span`,{className:`skills-chip quiet`,title:e.kind===`note`?void 0:e.ref,children:e.kind===`note`?`“`+s.trim().replace(/^["“'‘]+|["”'’]+$/g,``)+`”`:s})}function A({client:e,snapshot:t}){let n=t.project.id,r=t.catalog.operations.some(e=>e.method===`kernel.servers`&&e.state===`available`&&e.authorized),[o,c]=(0,g.useState)(null),[l,u]=(0,g.useState)({});(0,g.useEffect)(()=>{if(!r)return;let t=!0;return e.call(`kernel.places`,{projectId:n}).then(async r=>{if(!r.places.some(e=>e.via===`serverctl`)){t&&c({places:r,servers:null});return}let i=await e.call(`kernel.servers`,{projectId:n});t&&c({places:r,servers:i})},()=>{}),()=>{t=!1}},[e,n,r]);let d=(o?.places.places??[]).filter(e=>e.via===`serverctl`).flatMap(e=>(o.servers?.servers.find(t=>t.server===e.destination)?.skills??[]).map(t=>({place:e,skill:t}))),f=d.filter((e,t)=>d.findIndex(t=>t.place.destination===e.place.destination&&t.skill.name===e.skill.name)===t);if(!f.length)return null;let p=(t,r)=>{let i=t+`/`+r;l[i]===void 0&&(u(e=>({...e,[i]:``})),e.call(`kernel.server.skill`,{projectId:n,server:t,name:r}).then(e=>u(t=>({...t,[i]:e.text??``})),e=>u(t=>({...t,[i]:s(e)}))))};return(0,_.jsxs)(`section`,{className:`skills-servers`,"aria-labelledby":`skills-servers-title`,children:[(0,_.jsx)(`h2`,{id:`skills-servers-title`,children:`From your servers`}),(0,_.jsx)(`ul`,{children:f.map(({place:e,skill:t})=>{let n=e.destination+`/`+t.name;return(0,_.jsx)(`li`,{children:(0,_.jsxs)(`details`,{onToggle:n=>{n.currentTarget.open&&p(e.destination,t.name)},children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(i,{name:`server`,size:14}),(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:t.name}),(0,_.jsxs)(`small`,{children:[e.destination,` · through serverctl`]})]})]}),t.description&&(0,_.jsx)(`p`,{className:`skills-servers-desc`,children:t.description}),l[n]===``?(0,_.jsx)(`p`,{className:`quiet-empty`,role:`status`,children:`Reading…`}):l[n]?(0,_.jsx)(`div`,{className:`skills-servers-text`,children:(0,_.jsx)(a,{text:l[n].replace(/^---[\s\S]*?\n---\n/,``),streaming:!1})}):null]})},n)})})]})}export{b as SkillsPage};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{s as r}from"./home-CCbP6kS-.js";import{r as i,t as a}from"./markdown-0ngRuTpW.js";import{tt as o}from"./index-BpL_Kl_s.js";import{a as s,c,i as l,l as u,n as d,o as f,r as p,s as m,u as h}from"./skills-work-DNexV4OJ.js";var g=e(n(),1),_=t(),v={changes:20},y={recorded:`changed`,removed:`removed`,undone:`undid a change to`,outside:`changed`};function b({client:e,snapshot:t,onPath:n,onConversation:i,onNotebook:a}){let o=t.project.id,{list:s,problem:l,again:f}=h(e,o,t.cursor),m=u(t),[v,b]=(0,g.useState)(p),[w,T]=(0,g.useState)(v!==null);(0,g.useEffect)(d,[]);let E=s?.skills??[],D=s?.removed??[],O=[...E,...D].filter(e=>e.last).sort((e,t)=>t.last.at.localeCompare(e.last.at))[0]??E[0]??null,k=v&&[...E,...D].some(e=>e.name===v)?v:O?.name??null,j=e=>{b(e),T(!0)},M=O?.last;return(0,_.jsxs)(`section`,{className:`project-page skills-page`,"aria-labelledby":`skills-title`,children:[(0,_.jsx)(`header`,{className:`page-heading`,children:(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h1`,{id:`skills-title`,children:`Skills`}),s&&E.length===0&&(0,_.jsx)(`p`,{children:`How work is done in this project, read by every Agent here`}),s&&E.length>0&&(0,_.jsxs)(`p`,{children:[E.length,` `,E.length===1?`skill`:`skills`,` every Agent here reads`,M?` · ${M.kind===`outside`?c(O.name)+` was changed outside Rho`:m(M.by).name+` `+y[M.kind]+` `+c(O.name)} ${r(M.at).text.toLowerCase()}`:``]})]})}),l&&(0,_.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,_.jsxs)(`p`,{children:[`The skills could not be read. `,l]}),(0,_.jsx)(`button`,{onClick:()=>void f(),children:`Try again`})]}),!s&&!l?(0,_.jsx)(`p`,{className:`quiet-empty`,role:`status`,children:`Reading the skills…`}):s&&(0,_.jsxs)(`div`,{className:`skills-layout`+(w&&k?` showing`:``)+(k?``:` none-yet`),children:[(0,_.jsxs)(`nav`,{className:`skills-index`,"aria-label":`Skills`,children:[E.length>0?(0,_.jsx)(`ul`,{className:`skills-list`,children:E.map(e=>(0,_.jsx)(`li`,{children:(0,_.jsx)(x,{skill:e,current:e.name===k,author:m,onChoose:()=>j(e.name)})},e.name))}):(0,_.jsxs)(`div`,{className:`skills-empty`,children:[(0,_.jsx)(`h2`,{children:`No project skills yet`}),(0,_.jsx)(`p`,{children:`When you correct how your Agent works, or it finds why something failed, it records that here, and the next conversation starts from it. You can also tell it directly:`}),(0,_.jsx)(`ul`,{children:[`For this project we report proportions as percentages.`,`Remember how we filter the cells, so the next analysis does the same.`].map(e=>(0,_.jsxs)(`li`,{children:[`“`,e,`”`]},e))}),(0,_.jsx)(`small`,{children:`Skills are kept as SKILL.md files in .claude/skills in the project folder. Claude Code reads them by itself; other Agents read them through Rho.`})]}),D.length>0&&(0,_.jsxs)(`details`,{className:`skills-removed`,open:D.some(e=>e.name===k),children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),`Removed `,(0,_.jsx)(`span`,{className:`section-count`,children:D.length})]}),(0,_.jsx)(`ul`,{className:`skills-list`,children:D.map(e=>(0,_.jsx)(`li`,{children:(0,_.jsx)(x,{skill:e,current:e.name===k,author:m,onChoose:()=>j(e.name)})},e.name))})]}),(0,_.jsx)(A,{client:e,snapshot:t})]}),k&&(0,_.jsx)(S,{client:e,snapshot:t,name:k,summary:[...E,...D].find(e=>e.name===k),author:m,onBack:()=>T(!1),onPath:n,onConversation:i,onNotebook:a,onChanged:()=>void f()},k)]})]})}function x({skill:e,current:t,author:n,onChoose:i}){let a=e.last;return(0,_.jsxs)(`button`,{className:`skills-row`,"aria-current":t?`true`:void 0,onClick:i,title:m(e.name),children:[(0,_.jsx)(`strong`,{children:c(e.name)}),e.description&&(0,_.jsx)(`span`,{className:`skills-row-desc`,children:e.description}),(0,_.jsx)(`small`,{children:e.problem?(0,_.jsx)(`span`,{className:`skills-row-problem`,children:e.problem}):a?e.outside?`Changed outside Rho`:`${a.kind===`outside`?`Changed outside Rho`:l(a,n(a.by).name)} · ${r(a.at).text}`:`Written outside Rho`})]})}function S({client:e,snapshot:t,name:n,summary:o,author:u,onBack:d,onPath:p,onConversation:h,onNotebook:y,onChanged:b}){let x=t.project.id,[S,w]=(0,g.useState)(null),[A,j]=(0,g.useState)(``),[M,N]=(0,g.useState)(!1),[P,F]=(0,g.useState)(``),I=()=>e.call(`skills.read`,{projectId:x,name:n,limit:v.changes}).then(e=>{w(e),j(``)},e=>j(s(e)));(0,g.useEffect)(()=>{I()},[e,x,n,t.cursor]);let[L,...R]=S?.changes??[],z=!!L&&L.kind!==`outside`&&!L.undoneBy&&!S?.outside;async function B(t){N(!0),F(``);try{await e.call(`skills.undo`,{projectId:x,name:n,change:t.id,changeId:`undo-`+t.id+`-`+Date.now().toString(36)}),b(),await I()}catch(e){F(s(e))}finally{N(!1)}}let V=e=>{let t=u(e.by),n=l(e,t.name);return t.conversationId?(0,_.jsx)(`button`,{className:`text-button skills-who`,onClick:()=>h(t.conversationId),title:`Open the conversation`,children:n}):n},H=new Set((t.conversations??[]).map(e=>e.conversationId)),U=e=>(0,_.jsx)(k,{evidence:e,known:H.has(e.ref),onPath:p,onConversation:h,onNotebook:y},e.kind+e.ref);return(0,_.jsxs)(`article`,{className:`skills-detail`,"aria-labelledby":`skill-title`,children:[(0,_.jsxs)(`button`,{className:`text-button skills-back`,onClick:d,children:[(0,_.jsx)(i,{name:`back`,size:14}),`All skills`]}),(0,_.jsxs)(`header`,{className:`skills-detail-head`,children:[(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`h2`,{id:`skill-title`,children:c(n)}),(S?.skill?.description??o.description)&&(0,_.jsx)(`p`,{children:S?.skill?.description??o.description})]}),S?.skill&&(0,_.jsxs)(`button`,{onClick:()=>p(m(n)),title:m(n),children:[(0,_.jsx)(i,{name:`document`,size:15}),`Edit the file`]})]}),A&&(0,_.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,_.jsx)(`p`,{children:A}),(0,_.jsx)(`button`,{onClick:()=>void I(),children:`Try again`})]}),!S&&!A&&(0,_.jsxs)(`p`,{className:`quiet-empty`,role:`status`,children:[`Reading `,c(n),`…`]}),o.problem&&(0,_.jsx)(`p`,{className:`skills-note`,role:`status`,children:o.problem}),S?.outside&&(S.outside.since===null&&!L?(0,_.jsx)(`p`,{className:`skills-note`,role:`status`,children:`Written outside Rho. Agents read it as it is; Rho records its changes from the first one made here.`}):(0,_.jsxs)(`section`,{className:`skills-change outside`,"aria-label":`Changed outside Rho`,children:[(0,_.jsx)(`p`,{className:`skills-change-reason`,children:`Changed outside Rho since the last recorded change`}),(0,_.jsxs)(`p`,{className:`skills-change-meta`,children:[(0,_.jsx)(E,{added:S.outside.added,removed:S.outside.removed}),` · Agents read it as it is now; the next change recorded here starts from it`]}),(0,_.jsx)(O,{diff:S.outside.diff})]})),L&&(0,_.jsxs)(`section`,{className:`skills-change newest`+(L.undoneBy?` undone`:``),"aria-label":`Newest change`,children:[(0,_.jsx)(`p`,{className:`skills-change-reason`,children:f(L)}),(0,_.jsxs)(`p`,{className:`skills-change-meta`,children:[V(L),` · `,r(L.at).text,` · `,(0,_.jsx)(E,{added:L.added,removed:L.removed})]}),L.evidence.length>0&&(0,_.jsx)(`div`,{className:`skills-evidence`,children:L.evidence.map(U)}),(0,_.jsx)(D,{change:L}),(z||P)&&(0,_.jsxs)(`div`,{className:`skills-change-actions`,children:[z&&(0,_.jsx)(`button`,{onClick:()=>void B(L),disabled:M,children:M?`Undoing…`:L.kind===`removed`?`Bring it back`:L.kind===`undone`?`Put the change back`:`Undo this change`}),P&&(0,_.jsx)(`p`,{role:`alert`,children:P})]})]}),S?.skill?(0,_.jsxs)(`section`,{className:`skills-text`,"aria-labelledby":`skills-text-title`,children:[(0,_.jsx)(`h3`,{id:`skills-text-title`,children:`What Agents read`}),(0,_.jsx)(a,{text:T(S.skill.body,n),streaming:!1})]}):S&&(0,_.jsx)(`p`,{className:`skills-note`,children:`This skill was removed. Its changes are kept below.`}),R.length>0&&(0,_.jsxs)(`section`,{className:`skills-history`,"aria-labelledby":`skills-history-title`,children:[(0,_.jsx)(`h3`,{id:`skills-history-title`,children:`Earlier changes`}),(0,_.jsx)(`ol`,{children:R.map(e=>(0,_.jsx)(`li`,{className:e.undoneBy?`undone`:void 0,children:(0,_.jsxs)(`details`,{children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),(0,_.jsx)(`span`,{className:`skills-history-reason`,children:f(e)}),(0,_.jsxs)(`small`,{children:[l(e,u(e.by).name),` · `,r(e.at).text,e.undoneBy?` · undone`:``]}),(0,_.jsx)(E,{added:e.added,removed:e.removed})]}),e.evidence.length>0&&(0,_.jsx)(`div`,{className:`skills-evidence`,children:e.evidence.map(U)}),(0,_.jsx)(D,{change:e})]})},e.id))}),(S?.omitted??0)>0&&(0,_.jsxs)(`p`,{className:`quiet-empty`,children:[S.omitted,` older `,S.omitted===1?`change`:`changes`,` kept`]})]})]})}var C=()=>(0,_.jsx)(`span`,{className:`skills-twisty`,"aria-hidden":`true`,children:(0,_.jsx)(i,{name:`chevron`,size:11,stroke:2})}),w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim(),T=(e,t)=>e.replace(/^\s*# (.+)\n+/,(e,n)=>w(n)===w(t)?``:e),E=({added:e,removed:t})=>(0,_.jsxs)(`span`,{className:`skills-counts`,"aria-label":`${e} lines added, ${t} removed`,children:[(0,_.jsxs)(`span`,{className:`added`,children:[`+`,e]}),` `,(0,_.jsxs)(`span`,{className:`removed`,children:[`−`,t]})]});function D({change:e}){return e.before!==null&&e.after!==null?(0,_.jsx)(O,{diff:e.diff}):(0,_.jsxs)(`details`,{className:`skills-removed-text`,children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(C,{}),e.after===null?`The text it removed`:`The text it wrote`]}),(0,_.jsx)(O,{diff:e.diff})]})}function O({diff:e}){return e.lines.length?(0,_.jsxs)(`div`,{className:`skills-diff`,role:`group`,"aria-label":`What changed`,children:[e.lines.map((e,t)=>e.op===`…`?(0,_.jsxs)(`div`,{className:`fold`,children:[e.text,` unchanged `,e.text===`1`?`line`:`lines`]},t):(0,_.jsxs)(`div`,{className:e.op===`+`?`add`:e.op===`-`?`del`:`keep`,children:[(0,_.jsx)(`span`,{"aria-hidden":`true`,children:e.op}),e.text||` `]},t)),e.cut&&(0,_.jsx)(`div`,{className:`fold`,children:`The rest is not shown`})]}):null}function k({evidence:e,known:t,onPath:n,onConversation:r,onNotebook:a}){let s=e.label||e.ref;return e.kind===`cell`?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>{o(e.ref),a()},title:`Open the cell in the Notebook`,children:[(0,_.jsx)(i,{name:`code`,size:13}),s]}):e.kind===`file`?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>n(e.ref),title:e.ref,children:[(0,_.jsx)(i,{name:`file`,size:13}),s]}):e.kind===`conversation`&&t?(0,_.jsxs)(`button`,{className:`skills-chip`,onClick:()=>r(e.ref),children:[(0,_.jsx)(i,{name:`prompt`,size:13}),e.label||`The conversation`]}):(0,_.jsx)(`span`,{className:`skills-chip quiet`,title:e.kind===`note`?void 0:e.ref,children:e.kind===`note`?`“`+s.trim().replace(/^["“'‘]+|["”'’]+$/g,``)+`”`:s})}function A({client:e,snapshot:t}){let n=t.project.id,r=t.catalog.operations.some(e=>e.method===`kernel.servers`&&e.state===`available`&&e.authorized),[o,c]=(0,g.useState)(null),[l,u]=(0,g.useState)({});(0,g.useEffect)(()=>{if(!r)return;let t=!0;return e.call(`kernel.places`,{projectId:n}).then(async r=>{if(!r.places.some(e=>e.via===`serverctl`)){t&&c({places:r,servers:null});return}let i=await e.call(`kernel.servers`,{projectId:n});t&&c({places:r,servers:i})},()=>{}),()=>{t=!1}},[e,n,r]);let d=(o?.places.places??[]).filter(e=>e.via===`serverctl`).flatMap(e=>(o.servers?.servers.find(t=>t.server===e.destination)?.skills??[]).map(t=>({place:e,skill:t}))),f=d.filter((e,t)=>d.findIndex(t=>t.place.destination===e.place.destination&&t.skill.name===e.skill.name)===t);if(!f.length)return null;let p=(t,r)=>{let i=t+`/`+r;l[i]===void 0&&(u(e=>({...e,[i]:``})),e.call(`kernel.server.skill`,{projectId:n,server:t,name:r}).then(e=>u(t=>({...t,[i]:e.text??``})),e=>u(t=>({...t,[i]:s(e)}))))};return(0,_.jsxs)(`section`,{className:`skills-servers`,"aria-labelledby":`skills-servers-title`,children:[(0,_.jsx)(`h2`,{id:`skills-servers-title`,children:`From your servers`}),(0,_.jsx)(`ul`,{children:f.map(({place:e,skill:t})=>{let n=e.destination+`/`+t.name;return(0,_.jsx)(`li`,{children:(0,_.jsxs)(`details`,{onToggle:n=>{n.currentTarget.open&&p(e.destination,t.name)},children:[(0,_.jsxs)(`summary`,{children:[(0,_.jsx)(i,{name:`server`,size:14}),(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`strong`,{children:t.name}),(0,_.jsxs)(`small`,{children:[e.destination,` · through serverctl`]})]})]}),t.description&&(0,_.jsx)(`p`,{className:`skills-servers-desc`,children:t.description}),l[n]===``?(0,_.jsx)(`p`,{className:`quiet-empty`,role:`status`,children:`Reading…`}):l[n]?(0,_.jsx)(`div`,{className:`skills-servers-text`,children:(0,_.jsx)(a,{text:l[n].replace(/^---[\s\S]*?\n---\n/,``),streaming:!1})}):null]})},n)})})]})}export{b as SkillsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{s as r}from"./home-CCbP6kS-.js";import{r as i}from"./markdown-0ngRuTpW.js";import{Mt as a}from"./index-CxmItXqa.js";var o=e(n(),1),s=t(),c={changes:3},l=`browser:local`,u=e=>e instanceof Error?e.message:`It could not be read.`,d=e=>{let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>`.claude/skills/${e}/SKILL.md`;function p(e){return(0,o.useMemo)(()=>{let t=new Map((e.conversations??[]).filter(e=>e.principal).map(e=>[e.principal,{name:a(e.client),conversationId:e.conversationId}]));return e=>e===l?{name:`You`}:e===`outside`?{name:`Outside Rho`}:t.get(e)??{name:`An Agent`}},[e.conversations])}var m=e=>e.kind===`undone`?`Undid: `+e.reason:e.reason,h=(e,t)=>e.kind===`removed`?`${t} removed the skill`:e.kind===`undone`?`${t} undid a change`:e.kind===`outside`?`Noticed by Rho`:t;function g(e,t,n,r=!0){let[i,a]=(0,o.useState)({list:null,problem:``}),s=()=>e.call(`skills.list`,{projectId:t}).then(e=>a({list:e,problem:``}),e=>a(t=>({...t,problem:u(e)})));return(0,o.useEffect)(()=>{r&&s()},[e,t,n,r]),{...i,again:s}}var _=null,v=e=>{_=e},y=()=>_,b=()=>{_=null};function x({list:e,problem:t,snapshot:n,onOpen:a}){let o=p(n),l=[...e?.skills??[],...e?.removed??[]].filter(e=>e.last).sort((e,t)=>t.last.at.localeCompare(e.last.at));if(!l.length&&!t)return null;let u=e?.skills.length??0;return(0,s.jsxs)(`section`,{className:`project-section skills-work`,"aria-labelledby":`skills-work-title`,children:[(0,s.jsxs)(`div`,{className:`section-heading`,children:[(0,s.jsxs)(`h2`,{id:`skills-work-title`,children:[`Skills`,u>0&&(0,s.jsx)(`span`,{className:`section-count`,children:u})]}),(0,s.jsx)(`button`,{className:`text-button`,onClick:a,children:`View all`})]}),t&&(0,s.jsxs)(`p`,{role:`alert`,children:[`The skills could not be read. `,t]}),(0,s.jsx)(`div`,{className:`activity-list`,children:l.slice(0,c.changes).map(e=>{let t=e.last;return(0,s.jsxs)(`button`,{className:`activity-row`,onClick:()=>{v(e.name),a()},children:[(0,s.jsx)(`span`,{className:`activity-symbol`,children:(0,s.jsx)(i,{name:`book`,size:16})}),(0,s.jsxs)(`span`,{className:`activity-name`,children:[(0,s.jsx)(`strong`,{children:t.kind===`outside`?`Changed outside Rho`:m(t)}),(0,s.jsxs)(`small`,{children:[d(e.name),` · `,t.kind===`outside`?``:h(t,o(t.by).name)+` · `,r(t.at).text]})]}),(0,s.jsx)(i,{name:`chevron`,size:13})]},e.name)})})]})}export{u as a,d as c,h as i,p as l,b as n,m as o,y as r,f as s,x as t,g as u};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{s as r}from"./home-CCbP6kS-.js";import{r as i}from"./markdown-0ngRuTpW.js";import{Mt as a}from"./index-BpL_Kl_s.js";var o=e(n(),1),s=t(),c={changes:3},l=`browser:local`,u=e=>e instanceof Error?e.message:`It could not be read.`,d=e=>{let t=e.replace(/-/g,` `);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>`.claude/skills/${e}/SKILL.md`;function p(e){return(0,o.useMemo)(()=>{let t=new Map((e.conversations??[]).filter(e=>e.principal).map(e=>[e.principal,{name:a(e.client),conversationId:e.conversationId}]));return e=>e===l?{name:`You`}:e===`outside`?{name:`Outside Rho`}:t.get(e)??{name:`An Agent`}},[e.conversations])}var m=e=>e.kind===`undone`?`Undid: `+e.reason:e.reason,h=(e,t)=>e.kind===`removed`?`${t} removed the skill`:e.kind===`undone`?`${t} undid a change`:e.kind===`outside`?`Noticed by Rho`:t;function g(e,t,n,r=!0){let[i,a]=(0,o.useState)({list:null,problem:``}),s=()=>e.call(`skills.list`,{projectId:t}).then(e=>a({list:e,problem:``}),e=>a(t=>({...t,problem:u(e)})));return(0,o.useEffect)(()=>{r&&s()},[e,t,n,r]),{...i,again:s}}var _=null,v=e=>{_=e},y=()=>_,b=()=>{_=null};function x({list:e,problem:t,snapshot:n,onOpen:a}){let o=p(n),l=[...e?.skills??[],...e?.removed??[]].filter(e=>e.last).sort((e,t)=>t.last.at.localeCompare(e.last.at));if(!l.length&&!t)return null;let u=e?.skills.length??0;return(0,s.jsxs)(`section`,{className:`project-section skills-work`,"aria-labelledby":`skills-work-title`,children:[(0,s.jsxs)(`div`,{className:`section-heading`,children:[(0,s.jsxs)(`h2`,{id:`skills-work-title`,children:[`Skills`,u>0&&(0,s.jsx)(`span`,{className:`section-count`,children:u})]}),(0,s.jsx)(`button`,{className:`text-button`,onClick:a,children:`View all`})]}),t&&(0,s.jsxs)(`p`,{role:`alert`,children:[`The skills could not be read. `,t]}),(0,s.jsx)(`div`,{className:`activity-list`,children:l.slice(0,c.changes).map(e=>{let t=e.last;return(0,s.jsxs)(`button`,{className:`activity-row`,onClick:()=>{v(e.name),a()},children:[(0,s.jsx)(`span`,{className:`activity-symbol`,children:(0,s.jsx)(i,{name:`book`,size:16})}),(0,s.jsxs)(`span`,{className:`activity-name`,children:[(0,s.jsx)(`strong`,{children:t.kind===`outside`?`Changed outside Rho`:m(t)}),(0,s.jsxs)(`small`,{children:[d(e.name),` · `,t.kind===`outside`?``:h(t,o(t.by).name)+` · `,r(t.at).text]})]}),(0,s.jsx)(i,{name:`chevron`,size:13})]},e.name)})})]})}export{u as a,d as c,h as i,p as l,b as n,m as o,y as r,f as s,x as t,g as u};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{r}from"./markdown-0ngRuTpW.js";import{M as i,N as a,f as o,o as s}from"./canvas-D8rDdfDz.js";import{Jt as c,Kt as l,Mt as u,Nt as d,Rt as f,at as p,it as m,lt as h,mt as g,ot as _,pt as v,rt as y,st as ee}from"./index-CxmItXqa.js";import{i as b,r as x}from"./console-BSjLGe0T.js";import{n as te,r as ne,t as re}from"./timeline-events-BbuuFWHV.js";import{n as S,r as ie}from"./notes-meaning-pVbbQUGP.js";import{t as C}from"./answer-board-CBkGbSLD.js";import{Workspace as w}from"./workspace-CWlkjLNx.js";var T=e(n(),1),ae=e(c(),1),E={titleChars:90,files:6},D=e=>/^\s*(API Error|Error:|Request failed|Overloaded)/i.test(e),O=e=>e?Date.parse(e):NaN,k=e=>{let t=e.replace(/\s+/g,` `).trim(),n=(/^(.+?[.!?。!?])(\s|$)/.exec(t)?.[1]??t).replace(/[::]$/,``);return n.length>E.titleChars?n.slice(0,E.titleChars-1).trimEnd()+`…`:n},A=e=>{let t=[...new Set(e.map(e=>e.split(`/`).at(-1)))];return t.length>2?t.slice(0,2).join(`, `)+` and `+(t.length-2)+` more`:t.join(` and `)};function j(e){let t=[],n=null,r=!1;for(let i of e)i.kind===`edit`&&(!n||r)&&(n={start:i.at,end:i.at,edits:0,runs:0,looks:0},t.push(n),r=!1),n&&(n.end=i.at,i.kind===`edit`?n.edits++:i.kind===`run`?(n.runs++,r=!0):i.kind===`look`&&n.looks++);return t.length>1?t:[]}function M(e,t,n,r,i={}){let a=n.filter(e=>e.kind===`run`).length,o=n.filter(e=>e.kind===`edit`).length,s=n.filter(e=>e.kind===`look`),c=n.filter(e=>e.kind===`refused`).length,l=o?`build`:a?`explore`:s.length?`look`:`work`,u=r?k(r):l===`look`?s.some(e=>e.path)?`Read `+A(s.flatMap(e=>e.path?[e.path]:[])):`Looked at the project`:l===`explore`?`Explored with `+a+(a===1?` command`:` commands`):l===`build`?`Edited `+A(n.filter(e=>e.kind===`edit`).flatMap(e=>e.path?[e.path]:[])):`Worked`;return{id:e+`:`+t,turn:e,start:n[0]?.at??NaN,end:n.at(-1)?.at??NaN,title:u,said:!!r,kind:l,steps:n.length,runs:a,edits:o,rounds:j(n),files:[...new Set(n.flatMap(e=>e.path?[e.path]:[]))].slice(0,E.files),notes:c?[c+` refused`]:[],running:!1,...i}}function N(e,t,n){let r=[],i=e.steps.reduce((e,t,n)=>t.kind===`tool`?n:e,-1),a={said:null,at:O(e.startedAt??e.sentAt),steps:[],notices:0},o=()=>{if(!a.steps.length&&!a.said)return;let e=a.steps;if(!a.said){let n=e.findIndex((t,n)=>t.kind===`run`&&e[n+1]?.kind===`run`),i=n>0?e.slice(0,n):[];i.some(e=>e.kind===`look`)&&!i.some(e=>e.kind===`edit`)&&(r.push(M(t,r.length,i,null,{kind:`look`,title:`Read `+A(i.filter(e=>e.kind===`look`).flatMap(e=>e.path?[e.path]:[]))})),a.steps=e.slice(n))}if(a.steps.length||a.said){let e=M(t,r.length,a.steps,a.said,a.said?{start:a.at}:{});a.notices&&e.notes.push(a.notices+(a.notices===1?` provider error`:` provider errors`)),r.push(e)}};e.steps.forEach((e,t)=>{let r=O(e.at);if(e.kind===`text`){if(t>i)return;if(D(e.text??``)){a.notices++;return}o(),a={said:e.text??``,at:r,steps:[],notices:0};return}if(e.kind===`error`){a.notices++;return}let s=l(e,null,n),c=s.outcome===`rejected`?`refused`:s.action===`read`||s.action===`search`?`look`:s.action===`edit`||s.action===`write`?`edit`:s.action===`execute`?`run`:`other`,u=s.targetKind===`path`&&s.target?s.target:null;a.steps.push({at:O(e.startedAt??e.at),kind:c,path:u})}),o();let s=e.steps.slice(i+1).filter(e=>e.kind===`text`&&!D(e.text??``));return s.length&&e.state!==`running`&&r.push({...M(t,r.length,[],null),kind:`answer`,title:`Answered`,start:O(s[0].at),end:O(s.at(-1).at)}),e.state===`running`&&r.length&&(r.at(-1).running=!0),r}var P={input:3,code:3,result:6,report:2},F={root:`studio`,left:`studio-left`,input:`studio-input`,code:`studio-code`,commands:`studio-commands`,right:`studio-right`,figures:`studio-figures`,result:`studio-result`,console:`studio-console`,session:`studio-session`},I={supporting:64,method:64,run:64,input:64,report:64},L={code:0,result:1,report:2,input:3};function R(e,t){let n=new Map;for(let r of e.nodes){if(r.kind!==`file`||r.path!==t)continue;let e=r.versions?.length?r.versions:r.resource?[{resource:r.resource,capturedAt:r.capturedAt??r.at}]:[];for(let t of e){let e=t.resource.id+`@`+t.resource.version;n.has(e)||n.set(e,{resource:{id:t.resource.id,version:t.resource.version},at:t.capturedAt})}}return[...n.values()].sort((e,t)=>e.at-t.at)}function oe(e){let t=new Map,n=t=>Math.min(...e.nodes.filter(e=>e.path===t).flatMap(e=>[e.at,...e.events.map(e=>e.at)])),r=(r,i,a)=>{if(!r.path||r.path===`project-notes.md`)return;let o=t.get(r.path);o&&L[o.role]<L[i]||(o&&o.role===i?o.lead||=a:t.set(r.path,{path:r.path,title:r.title,role:i,category:r.category??null,lead:a,first:n(r.path),versions:R(e,r.path)}))};for(let t of[...e.turns].sort((e,t)=>e.start-t.start)){let n=C(e,t.id,I);for(let e of n?.items??[]){let t=e.role===`method`?`code`:e.role===`primary`||e.role===`supporting`?`result`:e.role===`report`?`report`:e.role===`input`?`input`:null;t&&r(e.node,t,e.role===`primary`)}}return[...t.values()].sort((e,t)=>L[e.role]-L[t.role]||Number(t.lead)-Number(e.lead)||e.first-t.first||e.path.localeCompare(t.path))}function se(e,t){return t===null?e:e.filter(e=>e.first<=t).map(e=>({...e,versions:e.versions.filter(e=>e.at<=t)}))}var z=(e,t)=>({id:e,kind:`group`,children:t}),B=(e,t,n)=>({id:e,kind:`group`,children:n.map(e=>e.id),presentation:{mode:`split`,axis:t,weights:n.map(e=>e.weight)}});function ce(e,t,n=null){let r=[],i=(e,t)=>t.length?(r.push(z(e,t.map(e=>e.id)),...t),e):null,a=t=>e.filter(e=>e.role===t).slice(0,P[t]),o=(e,t)=>{let n=t.filter(e=>!!e);return n.length<2?n[0]?.id??null:(r.push(B(e,`vertical`,n)),e)},s=i(F.input,a(`input`).map(e=>e.node)),c=i(F.code,a(`code`).map(e=>e.node)),l=i(F.commands,[t,n].filter(e=>!!e)),u=[...a(`result`),...a(`report`)],d=i(F.figures,u.filter(e=>e.figure).map(e=>e.node)),f=i(F.result,u.filter(e=>!e.figure).map(e=>e.node)),p=o(F.left,[s?{id:s,weight:1}:null,c?{id:c,weight:1.8}:null,l?{id:l,weight:1.2}:null]),m=o(F.right,[d?{id:d,weight:1.25}:null,f?{id:f,weight:1}:null]);if(p&&m)return r.push(B(F.root,`horizontal`,[{id:p,weight:1},{id:m,weight:1.3}])),{rootId:F.root,nodes:r};let h=p??m;return h?{rootId:h,nodes:r}:null}function le(e,t,n){let r=structuredClone(e.nodes),i=e.rootId,a=e=>r.find(t=>t.id===e),o=new Map(t.nodes.filter(e=>e.kind===`view`).map(e=>[e.id,e]));for(let e of r){let t=e.kind===`view`?o.get(e.id):void 0;t&&(e.bindings=t.bindings,e.props=t.props)}for(let[e,s]of o){if(a(e)||n(e))continue;let o=t.nodes.find(t=>t.kind===`group`&&t.children?.includes(e)),c=a(o.id);if(!c||c.kind!==`group`||c.presentation?.mode===`split`){c=z(o.id,[]),r.push(c);let e=a(i);if(e.presentation?.mode===`split`&&e.presentation.axis===`horizontal`)e.children=[...e.children,c.id],e.presentation={...e.presentation,weights:[...e.presentation.weights??e.children.slice(1).map(()=>1),1]};else{let e=`studio-wrap`,t=1;for(;a(e);)e=`studio-wrap-`+ ++t;r.push(B(e,`horizontal`,[{id:i,weight:1},{id:c.id,weight:1}])),i=e}}c.children=[...c.children,e],r.push(s)}return{rootId:i,nodes:r}}var V=t(),H={turns:8,readMs:700,stepMs:600,minStepMs:120},ue=e=>/\.(R|r|Rmd|qmd|py|md|markdown|txt|json|sh|sql|js|mjs|ts|ya?ml|toml|tex|log)$/.test(e);function de(e,t,n){let r=t.conversations?.find(e=>e.conversationId===n),[i,a]=(0,T.useState)(null),[o,s]=(0,T.useState)(``),c=(0,T.useRef)(void 0),l=(0,T.useRef)(0),d=(0,T.useRef)(r?.version);return d.current=r?.version,(0,T.useEffect)(()=>()=>clearTimeout(c.current),[]),(0,T.useEffect)(()=>{r&&i?.version!==r.version&&!c.current&&(c.current=setTimeout(()=>{let r=d.current??0;l.current=Date.now(),e.call(`conversation.read`,{projectId:t.project.id,conversationId:n,limit:H.turns}).then(e=>{a({version:r,read:e}),s(``)},e=>s(e instanceof Error?e.message:`The conversation could not be read.`)).finally(()=>{c.current=void 0})},Math.max(0,l.current+H.readMs-Date.now())))},[e,t.project.id,n,r?.version,i]),{turns:(0,T.useMemo)(()=>i&&r?i.read.turns.map(e=>({conversationId:n,conversationTitle:r.agentTitle||r.title,agent:u(r.client),turn:e,observation:i.read.observation})):[],[i,r?.title,r?.agentTitle]),problem:o,loading:!i&&!o,summary:r}}function fe({turns:e,then:t,root:n,at:r,onAt:i}){let a=(0,T.useMemo)(()=>e.map(e=>({turn:e.turn,title:f(e.turn.text).question.split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./react-Dss-ouuy.js";import{r}from"./markdown-0ngRuTpW.js";import{M as i,N as a,f as o,o as s}from"./canvas-D8rDdfDz.js";import{Jt as c,Kt as l,Mt as u,Nt as d,Rt as f,at as p,it as m,lt as h,mt as g,ot as _,pt as v,rt as y,st as ee}from"./index-BpL_Kl_s.js";import{i as b,r as x}from"./console-Trqc0swD.js";import{n as te,r as ne,t as re}from"./timeline-events-Chj2Gbx7.js";import{n as S,r as ie}from"./notes-meaning-DcVGUBBY.js";import{t as C}from"./answer-board-CBkGbSLD.js";import{Workspace as w}from"./workspace-COmCbGV3.js";var T=e(n(),1),ae=e(c(),1),E={titleChars:90,files:6},D=e=>/^\s*(API Error|Error:|Request failed|Overloaded)/i.test(e),O=e=>e?Date.parse(e):NaN,k=e=>{let t=e.replace(/\s+/g,` `).trim(),n=(/^(.+?[.!?。!?])(\s|$)/.exec(t)?.[1]??t).replace(/[::]$/,``);return n.length>E.titleChars?n.slice(0,E.titleChars-1).trimEnd()+`…`:n},A=e=>{let t=[...new Set(e.map(e=>e.split(`/`).at(-1)))];return t.length>2?t.slice(0,2).join(`, `)+` and `+(t.length-2)+` more`:t.join(` and `)};function j(e){let t=[],n=null,r=!1;for(let i of e)i.kind===`edit`&&(!n||r)&&(n={start:i.at,end:i.at,edits:0,runs:0,looks:0},t.push(n),r=!1),n&&(n.end=i.at,i.kind===`edit`?n.edits++:i.kind===`run`?(n.runs++,r=!0):i.kind===`look`&&n.looks++);return t.length>1?t:[]}function M(e,t,n,r,i={}){let a=n.filter(e=>e.kind===`run`).length,o=n.filter(e=>e.kind===`edit`).length,s=n.filter(e=>e.kind===`look`),c=n.filter(e=>e.kind===`refused`).length,l=o?`build`:a?`explore`:s.length?`look`:`work`,u=r?k(r):l===`look`?s.some(e=>e.path)?`Read `+A(s.flatMap(e=>e.path?[e.path]:[])):`Looked at the project`:l===`explore`?`Explored with `+a+(a===1?` command`:` commands`):l===`build`?`Edited `+A(n.filter(e=>e.kind===`edit`).flatMap(e=>e.path?[e.path]:[])):`Worked`;return{id:e+`:`+t,turn:e,start:n[0]?.at??NaN,end:n.at(-1)?.at??NaN,title:u,said:!!r,kind:l,steps:n.length,runs:a,edits:o,rounds:j(n),files:[...new Set(n.flatMap(e=>e.path?[e.path]:[]))].slice(0,E.files),notes:c?[c+` refused`]:[],running:!1,...i}}function N(e,t,n){let r=[],i=e.steps.reduce((e,t,n)=>t.kind===`tool`?n:e,-1),a={said:null,at:O(e.startedAt??e.sentAt),steps:[],notices:0},o=()=>{if(!a.steps.length&&!a.said)return;let e=a.steps;if(!a.said){let n=e.findIndex((t,n)=>t.kind===`run`&&e[n+1]?.kind===`run`),i=n>0?e.slice(0,n):[];i.some(e=>e.kind===`look`)&&!i.some(e=>e.kind===`edit`)&&(r.push(M(t,r.length,i,null,{kind:`look`,title:`Read `+A(i.filter(e=>e.kind===`look`).flatMap(e=>e.path?[e.path]:[]))})),a.steps=e.slice(n))}if(a.steps.length||a.said){let e=M(t,r.length,a.steps,a.said,a.said?{start:a.at}:{});a.notices&&e.notes.push(a.notices+(a.notices===1?` provider error`:` provider errors`)),r.push(e)}};e.steps.forEach((e,t)=>{let r=O(e.at);if(e.kind===`text`){if(t>i)return;if(D(e.text??``)){a.notices++;return}o(),a={said:e.text??``,at:r,steps:[],notices:0};return}if(e.kind===`error`){a.notices++;return}let s=l(e,null,n),c=s.outcome===`rejected`?`refused`:s.action===`read`||s.action===`search`?`look`:s.action===`edit`||s.action===`write`?`edit`:s.action===`execute`?`run`:`other`,u=s.targetKind===`path`&&s.target?s.target:null;a.steps.push({at:O(e.startedAt??e.at),kind:c,path:u})}),o();let s=e.steps.slice(i+1).filter(e=>e.kind===`text`&&!D(e.text??``));return s.length&&e.state!==`running`&&r.push({...M(t,r.length,[],null),kind:`answer`,title:`Answered`,start:O(s[0].at),end:O(s.at(-1).at)}),e.state===`running`&&r.length&&(r.at(-1).running=!0),r}var P={input:3,code:3,result:6,report:2},F={root:`studio`,left:`studio-left`,input:`studio-input`,code:`studio-code`,commands:`studio-commands`,right:`studio-right`,figures:`studio-figures`,result:`studio-result`,console:`studio-console`,session:`studio-session`},I={supporting:64,method:64,run:64,input:64,report:64},L={code:0,result:1,report:2,input:3};function R(e,t){let n=new Map;for(let r of e.nodes){if(r.kind!==`file`||r.path!==t)continue;let e=r.versions?.length?r.versions:r.resource?[{resource:r.resource,capturedAt:r.capturedAt??r.at}]:[];for(let t of e){let e=t.resource.id+`@`+t.resource.version;n.has(e)||n.set(e,{resource:{id:t.resource.id,version:t.resource.version},at:t.capturedAt})}}return[...n.values()].sort((e,t)=>e.at-t.at)}function oe(e){let t=new Map,n=t=>Math.min(...e.nodes.filter(e=>e.path===t).flatMap(e=>[e.at,...e.events.map(e=>e.at)])),r=(r,i,a)=>{if(!r.path||r.path===`project-notes.md`)return;let o=t.get(r.path);o&&L[o.role]<L[i]||(o&&o.role===i?o.lead||=a:t.set(r.path,{path:r.path,title:r.title,role:i,category:r.category??null,lead:a,first:n(r.path),versions:R(e,r.path)}))};for(let t of[...e.turns].sort((e,t)=>e.start-t.start)){let n=C(e,t.id,I);for(let e of n?.items??[]){let t=e.role===`method`?`code`:e.role===`primary`||e.role===`supporting`?`result`:e.role===`report`?`report`:e.role===`input`?`input`:null;t&&r(e.node,t,e.role===`primary`)}}return[...t.values()].sort((e,t)=>L[e.role]-L[t.role]||Number(t.lead)-Number(e.lead)||e.first-t.first||e.path.localeCompare(t.path))}function se(e,t){return t===null?e:e.filter(e=>e.first<=t).map(e=>({...e,versions:e.versions.filter(e=>e.at<=t)}))}var z=(e,t)=>({id:e,kind:`group`,children:t}),B=(e,t,n)=>({id:e,kind:`group`,children:n.map(e=>e.id),presentation:{mode:`split`,axis:t,weights:n.map(e=>e.weight)}});function ce(e,t,n=null){let r=[],i=(e,t)=>t.length?(r.push(z(e,t.map(e=>e.id)),...t),e):null,a=t=>e.filter(e=>e.role===t).slice(0,P[t]),o=(e,t)=>{let n=t.filter(e=>!!e);return n.length<2?n[0]?.id??null:(r.push(B(e,`vertical`,n)),e)},s=i(F.input,a(`input`).map(e=>e.node)),c=i(F.code,a(`code`).map(e=>e.node)),l=i(F.commands,[t,n].filter(e=>!!e)),u=[...a(`result`),...a(`report`)],d=i(F.figures,u.filter(e=>e.figure).map(e=>e.node)),f=i(F.result,u.filter(e=>!e.figure).map(e=>e.node)),p=o(F.left,[s?{id:s,weight:1}:null,c?{id:c,weight:1.8}:null,l?{id:l,weight:1.2}:null]),m=o(F.right,[d?{id:d,weight:1.25}:null,f?{id:f,weight:1}:null]);if(p&&m)return r.push(B(F.root,`horizontal`,[{id:p,weight:1},{id:m,weight:1.3}])),{rootId:F.root,nodes:r};let h=p??m;return h?{rootId:h,nodes:r}:null}function le(e,t,n){let r=structuredClone(e.nodes),i=e.rootId,a=e=>r.find(t=>t.id===e),o=new Map(t.nodes.filter(e=>e.kind===`view`).map(e=>[e.id,e]));for(let e of r){let t=e.kind===`view`?o.get(e.id):void 0;t&&(e.bindings=t.bindings,e.props=t.props)}for(let[e,s]of o){if(a(e)||n(e))continue;let o=t.nodes.find(t=>t.kind===`group`&&t.children?.includes(e)),c=a(o.id);if(!c||c.kind!==`group`||c.presentation?.mode===`split`){c=z(o.id,[]),r.push(c);let e=a(i);if(e.presentation?.mode===`split`&&e.presentation.axis===`horizontal`)e.children=[...e.children,c.id],e.presentation={...e.presentation,weights:[...e.presentation.weights??e.children.slice(1).map(()=>1),1]};else{let e=`studio-wrap`,t=1;for(;a(e);)e=`studio-wrap-`+ ++t;r.push(B(e,`horizontal`,[{id:i,weight:1},{id:c.id,weight:1}])),i=e}}c.children=[...c.children,e],r.push(s)}return{rootId:i,nodes:r}}var V=t(),H={turns:8,readMs:700,stepMs:600,minStepMs:120},ue=e=>/\.(R|r|Rmd|qmd|py|md|markdown|txt|json|sh|sql|js|mjs|ts|ya?ml|toml|tex|log)$/.test(e);function de(e,t,n){let r=t.conversations?.find(e=>e.conversationId===n),[i,a]=(0,T.useState)(null),[o,s]=(0,T.useState)(``),c=(0,T.useRef)(void 0),l=(0,T.useRef)(0),d=(0,T.useRef)(r?.version);return d.current=r?.version,(0,T.useEffect)(()=>()=>clearTimeout(c.current),[]),(0,T.useEffect)(()=>{r&&i?.version!==r.version&&!c.current&&(c.current=setTimeout(()=>{let r=d.current??0;l.current=Date.now(),e.call(`conversation.read`,{projectId:t.project.id,conversationId:n,limit:H.turns}).then(e=>{a({version:r,read:e}),s(``)},e=>s(e instanceof Error?e.message:`The conversation could not be read.`)).finally(()=>{c.current=void 0})},Math.max(0,l.current+H.readMs-Date.now())))},[e,t.project.id,n,r?.version,i]),{turns:(0,T.useMemo)(()=>i&&r?i.read.turns.map(e=>({conversationId:n,conversationTitle:r.agentTitle||r.title,agent:u(r.client),turn:e,observation:i.read.observation})):[],[i,r?.title,r?.agentTitle]),problem:o,loading:!i&&!o,summary:r}}function fe({turns:e,then:t,root:n,at:r,onAt:i}){let a=(0,T.useMemo)(()=>e.map(e=>({turn:e.turn,title:f(e.turn.text).question.split(`
2
2
  `)[0]??``,chapters:N(e.turn,e.turn.id,n)})),[e,n]),o=(0,T.useMemo)(()=>r===null?null:t.flatMap(e=>N(e.turn,e.turn.id,n)).at(-1)??null,[t,n,r]),s=a.flatMap(e=>e.chapters),c=s.filter(e=>r===null||e.start<=r).at(-1),l=(0,T.useRef)(null);if(!c)return null;let u=o??c,d=c.rounds.filter(e=>r===null||e.start<=r).length,p=e=>[e.rounds.length?e.rounds.length+` rounds`:``,e.edits?e.edits+(e.edits===1?` edit`:` edits`):``,e.runs?e.runs+(e.runs===1?` command`:` commands`):``,...e.notes].filter(Boolean).join(` · `);return(0,V.jsxs)(`details`,{ref:l,className:`steps-chip`,onKeyDown:e=>{e.key===`Escape`&&l.current?.open&&(e.preventDefault(),l.current.open=!1)},children:[(0,V.jsxs)(`summary`,{title:u.title,children:[(0,V.jsx)(`span`,{className:`steps-dot`+(u.running&&r===null?` live`:``),"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`steps-title`,children:u.title}),c.rounds.length>0&&(0,V.jsxs)(`span`,{className:`steps-round`,children:[`Round `,Math.max(1,d),` of `,c.rounds.length]}),(0,V.jsxs)(`span`,{className:`steps-count`,children:[s.indexOf(c)+1,`/`,s.length]})]}),(0,V.jsx)(`div`,{className:`steps-pop`,role:`list`,"aria-label":`Parts of this conversation`,children:a.map(e=>(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`p`,{className:`steps-asked`,title:e.turn.text,children:e.title.length>80?e.title.slice(0,79).trimEnd()+`…`:e.title}),e.chapters.map(e=>(0,V.jsxs)(`button`,{role:`listitem`,className:`steps-part `+e.kind+(e===c?` current`:r!==null&&e.start>r?` later`:``),onClick:()=>{i(e===s.at(-1)&&r!==null&&e.kind===`answer`?null:e.start),l.current&&(l.current.open=!1)},children:[(0,V.jsx)(`span`,{className:`steps-time`,children:y(e.start)}),(0,V.jsxs)(`span`,{className:`steps-name`,children:[e.title,e.said&&(0,V.jsx)(`small`,{children:` · in its words`})]}),p(e)&&(0,V.jsx)(`small`,{className:`steps-meta`,children:p(e)})]},e.id))]},e.turn.id))})]})}function pe({steps:e,marks:t,spans:n,at:i,playing:a,speed:o,running:s,onAt:c,onPlay:l,onSpeed:u}){let d=(0,T.useRef)(null),[f,h]=(0,T.useState)(400),[g,v]=(0,T.useState)(null),b=(0,T.useMemo)(()=>[...e.map(e=>({key:e.key,at:e.at,kind:p(e.action),failed:m(e),label:e.label})),...t.map(e=>({key:e.key,at:e.at,kind:p(e.action),failed:e.failed,label:ne(e)}))].sort((e,t)=>e.at-t.at),[e,t]);(0,T.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=new ResizeObserver(()=>h(e.clientHeight));return t.observe(e),h(e.clientHeight),()=>t.disconnect()},[]);let x=(0,T.useMemo)(()=>{let e=[];for(let t of[...n].sort((e,t)=>e.start-t.start)){let n=e.at(-1);n&&t.start<=n.end+3e4?n.end=Math.max(n.end,t.end):e.push({start:t.start,end:Math.max(t.end,t.start+1e3)})}return e},[n]),te=Math.max(60,f-16-26*Math.max(0,x.length-1)),re=ee(x,b,te,8,96),S=[],ie=8;x.forEach((e,t)=>{S.push(ie),ie+=re[t]+26});let C=e=>re[e],w=e=>{let t=x.findIndex(t=>e<=t.end),n=t<0?x.length-1:t,r=x[n];return r?S[n]+Math.min(C(n),Math.max(0,(e-r.start)/(r.end-r.start)*C(n))):8},ae=e=>{for(let t=x.length-1;t>=0;t--)if(e>=S[t]){let n=x[t];return n.start+Math.min(1,Math.max(0,(e-S[t])/C(t)))*(n.end-n.start)}return x[0]?.start??0},E=e=>b.reduce((t,n)=>!t||Math.abs(w(n.at)-e)<Math.abs(w(t.at)-e)?n:t,null);function D(e){let t=e.currentTarget,n=t.getBoundingClientRect();t.setPointerCapture(e.pointerId),v(null);let r=e=>{let t=e-n.top,r=E(t);c(r&&Math.abs(w(r.at)-t)<8?r.at:ae(t))};r(e.clientY);let i=e=>r(e.clientY),a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a)};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a)}function O(e){if(e.buttons)return;let t=e.clientY-e.currentTarget.getBoundingClientRect().top,n=E(t);v(n&&Math.abs(w(n.at)-t)<7?{event:n,y:w(n.at)}:null)}let k=i??b.at(-1)?.at??0,A=Math.floor(k/1e3)*1e3,j=()=>[...b].reverse().find(e=>e.at<A)?.at??b[0]?.at,M=()=>b.find(e=>e.at>k)?.at??null;function N(e){let t=e.key===`ArrowDown`?M():e.key===`ArrowUp`?j():e.key===`Home`?b[0]?.at:e.key===`End`?null:void 0;t!==void 0&&(e.preventDefault(),c(t))}let P=i===null?null:w(i),F=x.slice(1).map((e,t)=>({y:S[t+1]-26,length:e.start-x[t].end}));return(0,V.jsxs)(`aside`,{className:`side-timeline`,"aria-label":`Timeline`,children:[(0,V.jsxs)(`div`,{className:`side-tl-controls`,children:[(0,V.jsx)(`button`,{className:`icon-button`,"aria-label":a?`Pause`:i===null?`Play from the start`:`Play from here`,onClick:l,children:(0,V.jsx)(r,{name:a?`pause`:`run`,size:15})}),(0,V.jsxs)(`button`,{className:`side-tl-speed`,"aria-label":`Speed `+o+`×`,onClick:u,children:[o,`×`]}),(0,V.jsxs)(`span`,{className:`side-tl-step`,children:[(0,V.jsx)(`button`,{className:`icon-button`,"aria-label":`Earlier step`,disabled:!b.length||i!==null&&i<(b[0]?.at??0)+1e3,onClick:()=>{let e=j();e!==void 0&&c(e)},children:(0,V.jsx)(`span`,{className:`flip`,children:(0,V.jsx)(r,{name:`chevron`,size:14})})}),(0,V.jsx)(`span`,{className:`side-tl-at`,"aria-live":`polite`,children:i===null?`Now`:y(i,!0)}),(0,V.jsx)(`button`,{className:`icon-button`,"aria-label":`Later step`,disabled:i===null,onClick:()=>c(M()),children:(0,V.jsx)(r,{name:`chevron`,size:14})})]})]}),(0,V.jsxs)(`div`,{ref:d,className:`side-tl-track`,role:`slider`,tabIndex:0,"aria-orientation":`vertical`,"aria-label":`Moment shown`,"aria-valuemin":b[0]?.at??0,"aria-valuemax":b.at(-1)?.at??0,"aria-valuenow":i??b.at(-1)?.at??0,"aria-valuetext":i===null?`Now`:y(i,!0),onPointerDown:D,onPointerMove:O,onPointerLeave:()=>v(null),onKeyDown:N,children:[x.map((e,t)=>(0,V.jsx)(`span`,{className:`side-tl-stretch`,style:{top:S[t],height:C(t)},"aria-hidden":`true`,children:(0,V.jsx)(`small`,{children:y(e.start)})},t)),F.map((e,t)=>(0,V.jsx)(`span`,{className:`side-tl-fold`,style:{top:e.y,height:26},title:`A pause of `+_(e.length),"aria-hidden":`true`,children:(0,V.jsx)(`small`,{children:_(e.length)})},t)),b.map(e=>(0,V.jsx)(`i`,{className:`side-tl-mark `+e.kind+(e.failed?` failed`:``)+(i!==null&&e.at>i?` later`:``),style:{top:w(e.at)},"aria-hidden":`true`},e.key)),P!==null&&(0,V.jsx)(`span`,{className:`side-tl-head`,style:{top:P},"aria-hidden":`true`,children:(0,V.jsx)(`small`,{children:y(i,!0)})}),g&&(0,V.jsxs)(`span`,{className:`side-tl-hover`,style:{top:g.y},children:[g.event.label,` · `,y(g.event.at,!0)]})]}),(0,V.jsx)(`button`,{className:`side-tl-now`+(i===null?` on`:``),disabled:i===null,onClick:()=>c(null),children:i===null&&s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`pulse-dot`,"aria-hidden":`true`}),`Live`]}):`Now`})]})}function U({client:e,snapshot:t,files:n,conversationId:c,notesText:l=``,at:f,playing:p,speed:m,onAt:_,onPlaying:y,onSpeed:ee,stepsTarget:ne,agentNow:C,following:E,workspace:D}){let O=t.project.id,k=s(c),{turns:A,problem:j,loading:M,summary:N}=de(e,t,c),P=(0,T.useMemo)(()=>n.files.map(e=>({path:e.path,bytes:e.bytes,modifiedAt:e.modifiedAt,category:e.category})),[n.files]),I=(0,T.useMemo)(()=>d({turns:A,files:P,project:t.project,kindOf:a,now:Date.now()}),[A,P,t.project]),L=(0,T.useMemo)(()=>h(A,f),[A,f]),R=(0,T.useMemo)(()=>f===null?I:d({turns:L,files:P,project:t.project,kindOf:a,now:f}),[I,L,f]),z=(0,T.useMemo)(()=>oe(I),[I]),B=(0,T.useMemo)(()=>se(z,f),[z,f]),U=(0,T.useMemo)(()=>I.events.filter(e=>Number.isFinite(e.at)).sort((e,t)=>e.at-t.at),[I]),W=!!N&&N.state===`running`,{marks:me}=re(e,t),he=I.turns.length?Math.min(...I.turns.map(e=>e.start)):null,G=(0,T.useMemo)(()=>he===null?[]:te(me,c,he),[me,c,he]),K=(0,T.useMemo)(()=>[...U.map(e=>e.at),...G.map(e=>e.at)].sort((e,t)=>e-t),[U,G]),[ge,_e]=(0,T.useState)({}),ve=(0,T.useRef)(new Set),[ye,be]=(0,T.useState)({});(0,T.useEffect)(()=>{for(let t of z)ve.current.has(t.path)||(ue(t.path)?(ve.current.add(t.path),e.call(`document.open`,{projectId:O,path:t.path}).then(e=>_e(n=>({...n,[t.path]:e.id})),()=>_e(e=>({...e,[t.path]:null})))):i(t.path)&&!t.versions.length&&f===null&&(ve.current.add(t.path),e.call(`agent.activity.capture`,{projectId:O,path:t.path}).then(e=>be(n=>({...n,[t.path]:{id:e.id,version:e.version}})),()=>be(e=>({...e,[t.path]:null})))))},[z,f,e,O]);let xe=e=>t.catalog.components.find(t=>t.id===e),Se=R.nodes.filter(e=>e.kind===`run`).reduce((e,t)=>Math.min(e,t.at),1/0),Ce=I.nodes.filter(e=>e.kind===`run`).reduce((e,t)=>Math.min(e,t.at),1/0),we=e=>e.flatMap(e=>e.turn.steps??[]).filter(e=>e.kind===`tool`&&e.operation?.startsWith(`kernel.run`)).reduce((e,t)=>Math.min(e,Date.parse(t.startedAt??t.at)),1/0),Te=(0,T.useMemo)(()=>we(L),[L]),Ee=(0,T.useMemo)(()=>we(A),[A]),q=(0,T.useMemo)(()=>{let e=e=>{let t={title:e.title};if(i(e.path)){let n=e.versions.at(-1)?.resource??(f===null?ye[e.path]:null),r=xe(/\.csv$/i.test(e.path)?`rho.table`:`rho.media`);return!n||!r?null:{id:b(e.path),kind:`view`,component:r.id,version:r.version,props:t,bindings:{[Object.keys(r.bindings)[0]??`data`]:{id:n.id,version:n.version}}}}let n=ge[e.path],r=(/\.(md|markdown)$/i.test(e.path)?xe(`markdown.reader`):void 0)??xe(`rho.editor`);return!n||!r?null:{id:b(e.path),kind:`view`,component:r.id,version:r.version,props:t,bindings:{document:{kind:`live-document`,documentId:n}}}};return ce(B.flatMap(t=>{let n=e(t);return n?[{role:t.role,node:n,figure:n.component===`rho.media`}]:[]}),Number.isFinite(Se)?{id:F.console,kind:`view`,component:`rho.console`,version:`1`,props:{title:`Commands`},bindings:{}}:null,Number.isFinite(Te)?{id:F.session,kind:`view`,component:`rho.notebook`,version:`1`,props:{title:`Notebook`},bindings:{}}:null)},[B,ge,ye,f,Se,Te,t.catalog]),J=(0,T.useMemo)(()=>{let e=t.compositions.find(e=>e.compositionId===k);if(!e?.rootId||!e.nodes?.length)return q;let n={rootId:e.rootId,nodes:e.nodes};if(f!==null)return n.nodes.some(e=>e.kind===`view`)?le(n,q??{rootId:``,nodes:[]},()=>!1):q;let r=Date.parse(e.acknowledgedAt??``),i=e=>e===F.console?Ce:e===F.session?Ee:z.find(t=>b(t.path)===e)?.first??1/0;return le(n,q??{rootId:``,nodes:[]},e=>!Number.isFinite(r)||i(e)<=r)},[q,z,f,Ce,Ee,t.compositions]),Y=t.compositions.find(e=>e.compositionId===k),De=JSON.stringify(J)+`:`+(Y?.version??0),Oe=(0,T.useMemo)(()=>J?{...Y??{},compositionId:k,version:Y?.version??0,rootId:J.rootId,nodes:J.nodes,views:J.nodes.filter(e=>e.kind===`view`)}:null,[De]);(0,T.useEffect)(()=>{if(!p)return;let e=f===null?0:K.findIndex(e=>e>f);if(e<0||e>=K.length){y(!1),_(null);return}let t=Math.min(H.stepMs,Math.max(H.minStepMs,12e3/Math.max(1,K.length)))/m,n=setTimeout(()=>_(K[e]),f===null?0:t);return()=>clearTimeout(n)},[p,f,K,m]);let[ke,Ae]=(0,T.useState)(null),X=new Set(Oe?.views.map(e=>e.id)??[]),je=e=>e&&X.has(b(e))?b(e):void 0,Z=C?.running&&C.conversationId===c&&f===null?C:null,Q=f===null?null:[...U].reverse().find(e=>e.at<=f&&e.action!==`capture`),Me=Q&&([...U].reverse().find(e=>e.at<=f&&e.at>=Math.floor(Q.at/1e3)*1e3&&(e.action===`write`||e.action===`edit`))??Q),Ne=Me?R.nodes.find(e=>e.id===Me.node):null,Pe=f===null?null:[...G].reverse().find(e=>e.at<=f)??null,Fe=Pe&&(!Q||Pe.at>=Q.at)?Pe.source.startsWith(`kernel.`)?F.session:F.console:void 0,$=Z?Z.latest?.step.operation?.startsWith(`kernel.`)&&X.has(F.session)?F.session:Z.latest?.action===`execute`?F.console:je(Z.files.at(-1)?.path):Fe&&X.has(Fe)?Fe:Ne?Ne.kind===`run`?F.console:je(Ne.path):void 0,Ie=(ke&&X.has(ke)?ke:void 0)??(E||f!==null?$:void 0);(0,T.useEffect)(()=>{Ae(null)},[f===null,c]);let Le=Z&&$&&X.has($)?{viewId:$,label:Z.title,verb:$===F.console?`Running`:Z.files.at(-1)?.verb??`Working`,live:Z.latest?.outcome===`requested`}:null,[Re,ze]=(0,T.useState)(``),[Be,Ve]=(0,T.useState)(``),He=f===null&&t.catalog.operations.some(e=>e.method===`composition.apply`&&e.authorized&&e.state===`available`),Ue=f===null&&q?q.nodes.filter(e=>e.kind===`view`&&!X.has(e.id)):[];async function We(t,n){ze(n),Ve(``);try{await e.call(`composition.apply`,{projectId:O,compositionId:k,expectedVersion:Y?.version??0,changeId:`studio-`+n+`-`+crypto.randomUUID(),operations:[{op:`replace`,rootId:t.rootId,nodes:t.nodes}]})}catch(e){Ve(e instanceof Error?e.message:`The layout could not be written.`)}finally{ze(``)}}let Ge=(e,t)=>{let n=J&&o(J,e,t,e=>`${e}-${crypto.randomUUID().slice(0,8)}`);n&&(Ae(e.id),We(n,`reopen`))},Ke=He&&q?(0,V.jsxs)(`div`,{className:`studio-empty`,children:[(0,V.jsx)(`span`,{className:`empty-symbol`,children:(0,V.jsx)(r,{name:`layout`,size:26,stroke:1.5})}),(0,V.jsx)(`h2`,{children:`Every view of this work is closed`}),(0,V.jsx)(`p`,{children:`Its files, commands and versions are all kept. Lay them out again by what each is to the work, or choose a moment on the timeline to see the work as it was then.`}),(0,V.jsx)(`button`,{className:`primary`,disabled:!!Re,onClick:()=>void We(q,`relayout`),children:Re?`Laying out…`:`Lay out the work again`})]}):void 0,qe=He&&Ue.length?e=>(0,V.jsx)(`div`,{className:`page-add`,children:(0,V.jsxs)(`section`,{className:`page-add-kind`,"aria-label":`Closed views of this work`,children:[(0,V.jsx)(`h3`,{children:`Closed views of this work`}),Ue.map(t=>(0,V.jsxs)(`button`,{onClick:()=>Ge(t,e),children:[(0,V.jsx)(r,{name:t.component===`rho.console`?`prompt`:t.component===`rho.notebook`?`code`:t.component===`rho.media`?`image`:t.component===`rho.table`?`table`:`file`,size:15,stroke:1.7}),(0,V.jsx)(`span`,{children:String(t.props?.title??t.id)})]},t.id))]})}):void 0,Je=(0,T.useMemo)(()=>S(ie(l)),[l]),Ye=(0,T.useMemo)(()=>v(A),[A]),Xe=(0,T.useMemo)(()=>({conversationId:c,graph:R,whole:I,at:f,files:B,every:z,setAt:_,showPath:e=>Ae(b(e)),holds:e=>g(e,Je,Ye,f)}),[Ye,c,R,I,f,B,z,Je]);return(0,V.jsxs)(x.Provider,{value:Xe,children:[(0,V.jsxs)(`div`,{className:`process-studio`,children:[(0,V.jsxs)(`div`,{className:`process-stage`,children:[j&&(0,V.jsx)(`p`,{className:`inline-error`,role:`alert`,children:j}),Be&&(0,V.jsx)(`p`,{className:`inline-error`,role:`alert`,children:Be}),Oe?(0,V.jsx)(w,{...D,bar:!1,composition:Oe,snapshot:t,client:e,openView:Ie,presence:Le,arrange:f===null,following:E||f!==null,empty:Ke,addView:qe},O+k):(0,V.jsxs)(`div`,{className:`studio-empty`,children:[(0,V.jsx)(`span`,{className:`empty-symbol`,children:W?(0,V.jsx)(`span`,{className:`pulse-dot large`,"aria-hidden":`true`}):(0,V.jsx)(r,{name:`layout`,size:26,stroke:1.5})}),(0,V.jsx)(`h2`,{children:M?`Reading the conversation…`:W?(N?u(N.client):`The Agent`)+` is starting`:`Nothing to show yet`}),(0,V.jsx)(`p`,{children:W?`The data it reads, the code it writes, the commands it runs and the results they make appear here as it works.`:`This conversation has not read or made any project files.`})]})]}),K.length>0&&(0,V.jsx)(pe,{steps:U,marks:G,spans:[...I.turns,...G.map(e=>({start:e.at,end:e.end}))],at:f,playing:p,speed:m,running:W,onAt:e=>{y(!1),_(e)},onPlay:()=>y(!p),onSpeed:()=>ee(m===4?1:m*2)})]}),ne&&(0,ae.createPortal)((0,V.jsx)(fe,{turns:A,then:L,root:t.project.root,at:f,onAt:e=>{y(!1),_(e)}}),ne)]})}export{U as ProcessStudio};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-Dss-ouuy.js";import{Mt as n}from"./index-CxmItXqa.js";var r=e(t(),1),i=`person`,a=`other`;function o(e,t,n){let r=new Map(t.flatMap(e=>e.principal?[[e.principal,e]]:[]));return e.flatMap(e=>{let t=Date.parse(e.startedAt);if(!Number.isFinite(t))return[];let o=e.endedAt?Date.parse(e.endedAt):NaN,s=Math.max(t,Number.isFinite(o)?o:e.outcome===`running`?n:t),c=e.by===`browser:local`?null:r.get(e.by),l=e.by===`browser:local`?`person`:c?`conversation`:`other`;return[{key:e.source+`:`+e.id,at:t,end:s,lane:l===`person`?i:c?c.conversationId:a,laneTitle:l===`person`?`You`:c?c.title:`Outside Rho`,who:l,...c?{agent:c.agent}:{},source:e.source,action:e.action,label:e.label,where:e.where,outcome:e.outcome,failed:e.outcome===`failed`||e.outcome===`unknown`}]}).sort((e,t)=>e.at-t.at)}var s=(e,t,n)=>e.filter(e=>e.lane===t||e.who===`person`&&e.at>=n);function c(e){return`${e.who===`person`?`You`:e.who===`conversation`?e.agent??`The Agent`:`Someone outside Rho`} ${e.outcome===`running`?e.who===`person`?`are running`:`is running`:`ran`} ${e.label}${e.where?` · `+e.where:``}`}var l={events:200,readMs:1e3};function u(e){return e.catalog.plugins.flatMap(t=>t.timeline&&e.catalog.operations.some(e=>e.method===t.timeline&&e.state===`available`&&e.authorized)?[t.timeline]:[])}function d(e,t){let i=u(t),a=i.join(`,`),[s,c]=(0,r.useState)([]),[d,f]=(0,r.useState)(``),p=(0,r.useRef)(0),m=(0,r.useRef)(0),h=(0,r.useRef)(0);(0,r.useEffect)(()=>{if(!i.length){c([]);return}let n=setTimeout(()=>{p.current=Date.now();let n=++m.current;Promise.all(i.map(n=>e.call(n,{projectId:t.project.id,limit:l.events}).then(e=>e.events.map(e=>({...e,source:n}))))).then(e=>{n>h.current&&(h.current=n,c(e.flat()),f(``))},e=>{n>h.current&&f(e instanceof Error?e.message:`What was run could not be read.`)})},Math.max(0,p.current+l.readMs-Date.now()));return()=>clearTimeout(n)},[e,t.project.id,t.cursor,a]);let g=(0,r.useMemo)(()=>(t.conversations??[]).map(e=>({conversationId:e.conversationId,principal:e.principal,title:e.agentTitle||e.title,agent:n(e.client)})),[t.conversations]);return{marks:(0,r.useMemo)(()=>o(s,g,Date.now()),[s,g]),problem:d}}export{s as n,c as r,d as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-Dss-ouuy.js";import{Mt as n}from"./index-BpL_Kl_s.js";var r=e(t(),1),i=`person`,a=`other`;function o(e,t,n){let r=new Map(t.flatMap(e=>e.principal?[[e.principal,e]]:[]));return e.flatMap(e=>{let t=Date.parse(e.startedAt);if(!Number.isFinite(t))return[];let o=e.endedAt?Date.parse(e.endedAt):NaN,s=Math.max(t,Number.isFinite(o)?o:e.outcome===`running`?n:t),c=e.by===`browser:local`?null:r.get(e.by),l=e.by===`browser:local`?`person`:c?`conversation`:`other`;return[{key:e.source+`:`+e.id,at:t,end:s,lane:l===`person`?i:c?c.conversationId:a,laneTitle:l===`person`?`You`:c?c.title:`Outside Rho`,who:l,...c?{agent:c.agent}:{},source:e.source,action:e.action,label:e.label,where:e.where,outcome:e.outcome,failed:e.outcome===`failed`||e.outcome===`unknown`}]}).sort((e,t)=>e.at-t.at)}var s=(e,t,n)=>e.filter(e=>e.lane===t||e.who===`person`&&e.at>=n);function c(e){return`${e.who===`person`?`You`:e.who===`conversation`?e.agent??`The Agent`:`Someone outside Rho`} ${e.outcome===`running`?e.who===`person`?`are running`:`is running`:`ran`} ${e.label}${e.where?` · `+e.where:``}`}var l={events:200,readMs:1e3};function u(e){return e.catalog.plugins.flatMap(t=>t.timeline&&e.catalog.operations.some(e=>e.method===t.timeline&&e.state===`available`&&e.authorized)?[t.timeline]:[])}function d(e,t){let i=u(t),a=i.join(`,`),[s,c]=(0,r.useState)([]),[d,f]=(0,r.useState)(``),p=(0,r.useRef)(0),m=(0,r.useRef)(0),h=(0,r.useRef)(0);(0,r.useEffect)(()=>{if(!i.length){c([]);return}let n=setTimeout(()=>{p.current=Date.now();let n=++m.current;Promise.all(i.map(n=>e.call(n,{projectId:t.project.id,limit:l.events}).then(e=>e.events.map(e=>({...e,source:n}))))).then(e=>{n>h.current&&(h.current=n,c(e.flat()),f(``))},e=>{n>h.current&&f(e instanceof Error?e.message:`What was run could not be read.`)})},Math.max(0,p.current+l.readMs-Date.now()));return()=>clearTimeout(n)},[e,t.project.id,t.cursor,a]);let g=(0,r.useMemo)(()=>(t.conversations??[]).map(e=>({conversationId:e.conversationId,principal:e.principal,title:e.agentTitle||e.title,agent:n(e.client)})),[t.conversations]);return{marks:(0,r.useMemo)(()=>o(s,g,Date.now()),[s,g]),problem:d}}export{s as n,c as r,d as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-Dss-ouuy.js";import{Mt as n}from"./index-CxmItXqa.js";var r=e(t(),1),i={conversations:6,turns:8};function a(e,t){let a=(0,r.useMemo)(()=>[...t.conversations??[]].sort((e,t)=>t.lastAt.localeCompare(e.lastAt)).slice(0,i.conversations),[t.conversations]),[o,s]=(0,r.useState)({}),[c,l]=(0,r.useState)(``),u=a.map(e=>e.conversationId+`@`+e.version).join(`,`);(0,r.useEffect)(()=>{let n=!0,r=a.filter(e=>o[e.conversationId]?.version!==e.version);if(!r.length)return;let c=r.some(e=>e.state===`running`),u=setTimeout(()=>{Promise.all(r.map(n=>e.call(`conversation.read`,{projectId:t.project.id,conversationId:n.conversationId,limit:i.turns}).then(e=>[n,e]))).then(e=>{n&&(l(``),s(t=>{let n={...t};for(let[t,r]of e)n[t.conversationId]={version:t.version,read:r};return n}))},e=>{n&&l(e instanceof Error?e.message:`A conversation could not be read.`)})},c&&Object.keys(o).length?700:0);return()=>{n=!1,clearTimeout(u)}},[e,t.project.id,u]);let d=(0,r.useMemo)(()=>a.flatMap(e=>(o[e.conversationId]?.read.turns??[]).map(t=>({conversationId:e.conversationId,conversationTitle:e.agentTitle||e.title,agent:n(e.client),turn:t,observation:o[e.conversationId]?.read.observation}))),[a,o]),f=a.reduce((e,t)=>e+(o[t.conversationId]?.read.first??0),0)+Math.max(0,(t.conversations?.length??0)-a.length);return{turns:d,problem:c,loading:a.length>0&&!a.some(e=>o[e.conversationId]),omitted:f}}export{a as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-Dss-ouuy.js";import{Mt as n}from"./index-BpL_Kl_s.js";var r=e(t(),1),i={conversations:6,turns:8};function a(e,t){let a=(0,r.useMemo)(()=>[...t.conversations??[]].sort((e,t)=>t.lastAt.localeCompare(e.lastAt)).slice(0,i.conversations),[t.conversations]),[o,s]=(0,r.useState)({}),[c,l]=(0,r.useState)(``),u=a.map(e=>e.conversationId+`@`+e.version).join(`,`);(0,r.useEffect)(()=>{let n=!0,r=a.filter(e=>o[e.conversationId]?.version!==e.version);if(!r.length)return;let c=r.some(e=>e.state===`running`),u=setTimeout(()=>{Promise.all(r.map(n=>e.call(`conversation.read`,{projectId:t.project.id,conversationId:n.conversationId,limit:i.turns}).then(e=>[n,e]))).then(e=>{n&&(l(``),s(t=>{let n={...t};for(let[t,r]of e)n[t.conversationId]={version:t.version,read:r};return n}))},e=>{n&&l(e instanceof Error?e.message:`A conversation could not be read.`)})},c&&Object.keys(o).length?700:0);return()=>{n=!1,clearTimeout(u)}},[e,t.project.id,u]);let d=(0,r.useMemo)(()=>a.flatMap(e=>(o[e.conversationId]?.read.turns??[]).map(t=>({conversationId:e.conversationId,conversationTitle:e.agentTitle||e.title,agent:n(e.client),turn:t,observation:o[e.conversationId]?.read.observation}))),[a,o]),f=a.reduce((e,t)=>e+(o[t.conversationId]?.read.first??0),0)+Math.max(0,(t.conversations?.length??0)-a.length);return{turns:d,problem:c,loading:a.length>0&&!a.some(e=>o[e.conversationId]),omitted:f}}export{a as t};