@rho-workspace/rho 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -5
- package/dist/browser-access.js +3 -2
- package/dist/capabilities.d.ts +29 -2
- package/dist/capabilities.js +79 -2
- package/dist/cli.js +237 -99
- package/dist/contract.generated.d.ts +441 -16
- package/dist/contract.generated.js +1 -1
- package/dist/contracts/owners.generated.js +459 -10
- package/dist/conversation-presentation.d.ts +3 -1
- package/dist/conversation-presentation.js +16 -6
- package/dist/conversations.d.ts +10 -6
- package/dist/conversations.js +17 -13
- package/dist/discovery.d.ts +1 -0
- package/dist/discovery.js +3 -3
- package/dist/extension-contract.d.ts +99 -0
- package/dist/extension-contract.js +52 -0
- package/dist/extension-directory.d.ts +9 -0
- package/dist/extension-directory.js +11 -0
- package/dist/extension-worker.d.ts +1 -0
- package/dist/extension-worker.js +36 -0
- package/dist/extensions.d.ts +157 -0
- package/dist/extensions.js +349 -0
- package/dist/installs.d.ts +11 -0
- package/dist/installs.js +179 -0
- package/dist/plugin-cli.d.ts +1 -0
- package/dist/plugin-cli.js +139 -0
- package/dist/plugin-inventory.json +18 -0
- package/dist/plugins.d.ts +3 -3
- package/dist/project-notes.js +2 -0
- package/dist/project-work.d.ts +3 -1
- package/dist/project-work.js +15 -2
- package/dist/protocol.d.ts +7 -0
- package/dist/protocol.js +11 -7
- package/dist/screen-check-skill.d.ts +2 -0
- package/dist/screen-check-skill.js +39 -0
- package/dist/server.d.ts +6 -1
- package/dist/server.js +105 -15
- package/dist/web/.vite/manifest.json +65 -65
- package/dist/web/assets/{canvas-BXhC8RDZ.js → canvas-D8rDdfDz.js} +1 -1
- package/dist/web/assets/choices-b0XhrGQV.js +1 -0
- package/dist/web/assets/{console-e1P5qYQ5.js → console-BSjLGe0T.js} +1 -1
- package/dist/web/assets/{dist-Dd3iAGFy.js → dist-Buk0lwzI.js} +2 -2
- package/dist/web/assets/dist-Cw8hRIlT.js +1 -0
- package/dist/web/assets/dist-Tzoe_zm-.js +3 -0
- package/dist/web/assets/{dist-DEorbOW0.js → dist-foH9IKc6.js} +1 -1
- package/dist/web/assets/explore-in-BVUy3ZW_.js +1 -0
- package/dist/web/assets/graph-1OdIJ9l7.js +2 -0
- package/dist/web/assets/index-CsC3sTRq.css +1 -0
- package/dist/web/assets/{index-BYuKpyoi.js → index-CxmItXqa.js} +220 -121
- package/dist/web/assets/{notes-meaning-B3HFbh84.js → notes-meaning-pVbbQUGP.js} +1 -1
- package/dist/web/assets/overview-B9UtVJ32.js +6 -0
- package/dist/web/assets/preview-CksD_5KS.js +1 -0
- package/dist/web/assets/{review-BVh9jWMB.js → review-CMxQlQ-C.js} +1 -1
- package/dist/web/assets/{skills-DPaEYkln.js → skills-BFNSyrnD.js} +1 -1
- package/dist/web/assets/{skills-work-dvjfy_tu.js → skills-work-BGPSnF_I.js} +1 -1
- package/dist/web/assets/{studio-process-BYm8mjRJ.js → studio-process-CsRoTHOh.js} +2 -2
- package/dist/web/assets/{timeline-events-CDZ7wiJX.js → timeline-events-BbuuFWHV.js} +1 -1
- package/dist/web/assets/{work-turns-BeCt303c.js → work-turns-BvJlIMmA.js} +1 -1
- package/dist/web/assets/workspace-CWlkjLNx.js +5 -0
- package/dist/web/composition.json +80 -80
- package/dist/web/index.html +3 -3
- package/dist/web/renderer.json +1 -1
- package/dist/web-assets.d.ts +2 -1
- package/dist/web-assets.js +3 -2
- package/dist/work-contract.js +2 -2
- package/docs/FRONTEND.md +30 -14
- package/docs/HEADLESS.md +60 -14
- package/docs/PLUGIN-AUTHORING.md +4 -0
- package/docs/THIRD-PARTY-PLUGINS.md +190 -0
- package/example/pa14-qs/.rho/rho/conversations/c-67f77cfebaba2cea.json +1 -1
- package/example/pa14-qs/.rho/rho/conversations/c-91aa2e46b1ac1a6c.json +1 -1
- package/example/pa14-qs/.rho/rho/conversations/c-fa24dfd80dfe4bcb.json +1 -1
- package/node_modules/@hono/node-server/dist/index.js +11 -0
- package/node_modules/@hono/node-server/dist/index.mjs +11 -0
- package/node_modules/@hono/node-server/dist/listener.js +11 -0
- package/node_modules/@hono/node-server/dist/listener.mjs +11 -0
- package/node_modules/@hono/node-server/dist/request.js +11 -0
- package/node_modules/@hono/node-server/dist/request.mjs +11 -0
- package/node_modules/@hono/node-server/dist/server.js +11 -0
- package/node_modules/@hono/node-server/dist/server.mjs +11 -0
- package/node_modules/@hono/node-server/dist/vercel.js +11 -0
- package/node_modules/@hono/node-server/dist/vercel.mjs +11 -0
- package/node_modules/@hono/node-server/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-agent/README.md +42 -1
- package/node_modules/@rho-workspace/plugin-agent/dist/acp-conversation.js +14 -3
- package/node_modules/@rho-workspace/plugin-agent/dist/activity-normalize.d.ts +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/activity-normalize.js +2 -2
- package/node_modules/@rho-workspace/plugin-agent/dist/conversation.d.ts +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/conversation.js +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/dsh-session.d.ts +6 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/dsh-session.js +174 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/external-session-contract.d.ts +82 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/external-session-contract.js +15 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/external-session.d.ts +73 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/external-session.js +190 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/generic-acp.d.ts +11 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/generic-acp.js +7 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/index.d.ts +373 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/index.js +1 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/mcp.js +5 -1
- package/node_modules/@rho-workspace/plugin-agent/dist/operations.d.ts +33 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/operations.js +3 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/presentation.d.ts +14 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/presentation.js +2 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/ui-external-session.d.ts +15 -0
- package/node_modules/@rho-workspace/plugin-agent/dist/ui-external-session.js +37 -0
- package/node_modules/@rho-workspace/plugin-agent/package.json +5 -1
- package/node_modules/@rho-workspace/plugin-annotations/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-documents/README.md +4 -0
- package/node_modules/@rho-workspace/plugin-documents/dist/index.d.ts +3 -0
- package/node_modules/@rho-workspace/plugin-documents/dist/index.js +1 -1
- package/node_modules/@rho-workspace/plugin-documents/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/README.md +71 -10
- package/node_modules/@rho-workspace/plugin-kernel/dist/code.d.ts +2 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/code.js +4 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/contract.js +5 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/index.d.ts +7 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/index.js +55 -8
- package/node_modules/@rho-workspace/plugin-kernel/dist/lineage.d.ts +9 -6
- package/node_modules/@rho-workspace/plugin-kernel/dist/lineage.js +18 -41
- package/node_modules/@rho-workspace/plugin-kernel/dist/operations.js +5 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/script-flow.d.ts +39 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/script-flow.js +661 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-base.d.ts +3 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-base.js +10 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-flow.d.ts +38 -4
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-flow.js +194 -97
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook-work.js +1 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook.d.ts +10 -2
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-notebook.js +79 -18
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui-styles.js +115 -45
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui.d.ts +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/ui.js +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/dist/value-graph.d.ts +63 -0
- package/node_modules/@rho-workspace/plugin-kernel/dist/value-graph.js +344 -0
- package/node_modules/@rho-workspace/plugin-kernel/package.json +1 -1
- package/node_modules/@rho-workspace/plugin-kernel/runners/runner.R +6 -3
- package/node_modules/@rho-workspace/plugin-kernel/runners/runner.py +6 -3
- package/node_modules/express-rate-limit/dist/index.cjs +1 -1
- package/node_modules/express-rate-limit/dist/index.mjs +1 -1
- package/node_modules/express-rate-limit/package.json +1 -1
- package/node_modules/ip-address/dist/ipv6.js +1 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/playwright-core/LICENSE +202 -0
- package/node_modules/playwright-core/NOTICE +5 -0
- package/node_modules/playwright-core/ThirdPartyNotices.txt +13 -0
- package/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- package/node_modules/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/node_modules/playwright-core/browsers.json +52 -0
- package/node_modules/playwright-core/cli.js +22 -0
- package/node_modules/playwright-core/index.js +17 -0
- package/node_modules/playwright-core/index.mjs +28 -0
- package/node_modules/playwright-core/lib/bootstrap.js +149 -0
- package/node_modules/playwright-core/lib/coreBundle.js +78041 -0
- package/node_modules/playwright-core/lib/entry/cliDaemon.js +5 -0
- package/node_modules/playwright-core/lib/entry/dashboardApp.js +3 -0
- package/node_modules/playwright-core/lib/entry/mcp.js +10 -0
- package/node_modules/playwright-core/lib/entry/oopBrowserDownload.js +3 -0
- package/node_modules/playwright-core/lib/package.js +50 -0
- package/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/server/electron/loader.js +123 -0
- package/node_modules/playwright-core/lib/serverRegistry.js +1939 -0
- package/node_modules/playwright-core/lib/serverRegistry.js.LICENSE +65 -0
- package/node_modules/playwright-core/lib/tools/cli-client/channelSessions.js +141 -0
- package/node_modules/playwright-core/lib/tools/cli-client/cli.js +7 -0
- package/node_modules/playwright-core/lib/tools/cli-client/help.json +808 -0
- package/node_modules/playwright-core/lib/tools/cli-client/minimist.js +128 -0
- package/node_modules/playwright-core/lib/tools/cli-client/output.js +352 -0
- package/node_modules/playwright-core/lib/tools/cli-client/program.js +422 -0
- package/node_modules/playwright-core/lib/tools/cli-client/registry.js +180 -0
- package/node_modules/playwright-core/lib/tools/cli-client/session.js +261 -0
- package/node_modules/playwright-core/lib/tools/dashboard/appIcon.png +0 -0
- package/node_modules/playwright-core/lib/tools/utils/extension.js +112 -0
- package/node_modules/playwright-core/lib/tools/utils/socketConnection.js +108 -0
- package/node_modules/playwright-core/lib/utilsBundle.js +86078 -0
- package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +1890 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/node_modules/playwright-core/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/node_modules/playwright-core/lib/vite/dashboard/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/index.html +16 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -0
- package/node_modules/playwright-core/lib/vite/htmlReport/report.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/node_modules/playwright-core/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- package/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.html +44 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +10 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +4 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
- package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
- package/node_modules/playwright-core/lib/xdg-open +1267 -0
- package/node_modules/playwright-core/package.json +34 -0
- package/package.json +13 -7
- package/protocol/index.json +75 -21
- package/protocol/operations/agent.sessions.list.json +100 -0
- package/protocol/operations/agent.sessions.read.json +266 -0
- package/protocol/operations/conversation.settings.check.json +147 -4
- package/protocol/operations/conversation.settings.read.json +145 -3
- package/protocol/operations/conversation.settings.update.json +166 -4
- package/protocol/operations/conversation.start.json +2 -1
- package/protocol/operations/extension.call.json +132 -0
- package/protocol/operations/extension.content.json +78 -0
- package/protocol/operations/extension.describe.json +195 -0
- package/protocol/operations/extension.install.json +198 -0
- package/protocol/operations/extension.list.json +123 -0
- package/protocol/operations/extension.manage.json +55 -0
- package/protocol/operations/extension.read.json +112 -0
- package/protocol/operations/kernel.interrupt.json +20 -0
- package/protocol/operations/kernel.read.json +30 -0
- package/protocol/operations/kernel.run.json +36 -1
- package/protocol/operations/kernel.stop.json +10 -0
- package/protocol/operations/project.work.read.json +3 -2
- package/protocol/operations/session.grant.json +9 -0
- package/scripts/browser-checks.mjs +53 -0
- package/scripts/screen-check.mjs +193 -0
- package/scripts/third-party-acceptance.mjs +77 -0
- package/vendor/composition.json +111 -111
- package/vendor/rho-workspace-plugin-agent-0.4.29.tgz +0 -0
- package/vendor/rho-workspace-plugin-annotations-0.5.2.tgz +0 -0
- package/vendor/rho-workspace-plugin-documents-0.4.11.tgz +0 -0
- package/vendor/rho-workspace-plugin-kernel-0.5.5.tgz +0 -0
- package/web/theme.css +17 -2
- package/dist/web/assets/choices-B-y2OYvE.js +0 -1
- package/dist/web/assets/dist-CBM2oq6g.js +0 -1
- package/dist/web/assets/dist-CH56yNDn.js +0 -3
- package/dist/web/assets/explore-in-muWXOGOY.js +0 -1
- package/dist/web/assets/graph-CK-df5lh.js +0 -2
- package/dist/web/assets/index-DBd77u4a.css +0 -1
- package/dist/web/assets/overview-D1Ev2OC_.js +0 -6
- package/dist/web/assets/preview-HbmQKUGY.js +0 -1
- package/dist/web/assets/workspace-d5Hw_ClZ.js +0 -5
- package/vendor/rho-workspace-plugin-agent-0.4.27.tgz +0 -0
- package/vendor/rho-workspace-plugin-documents-0.4.10.tgz +0 -0
- package/vendor/rho-workspace-plugin-kernel-0.5.2.tgz +0 -0
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/graph-CK-df5lh.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-Dss-ouuy.js","assets/markdown-0ngRuTpW.js","assets/canvas-BXhC8RDZ.js","assets/home-CCbP6kS-.js","assets/index-BYuKpyoi.js","assets/index-DBd77u4a.css","assets/work-turns-BeCt303c.js","assets/snapshot-CAxBYPvV.js","assets/timeline-events-CDZ7wiJX.js","assets/choices-B-y2OYvE.js","assets/notes-meaning-B3HFbh84.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-BXhC8RDZ.js";import{$ as p,At as m,C as h,Dt as g,Et as ee,Lt as te,Nt as ne,Ot as _,Pt as re,Rt as v,Tt as ie,Ut as ae,Vt as oe,_ as se,ct as y,dt as b,et as x,g as S,i as C,jt as ce,kt as le,lt as w,nt as T,qt as ue,st as E,tt as D,ut as de,v as O,yt as k}from"./index-BYuKpyoi.js";import{c as fe,d as pe,f as me,l as he,t as ge,u as _e}from"./facts-BMO6V3-3.js";import{t as ve}from"./work-turns-BeCt303c.js";import{n as A,t as ye}from"./choices-B-y2OYvE.js";import{t as j,u as M}from"./skills-work-dvjfy_tu.js";import{t as N}from"./explore-in-muWXOGOY.js";import{n as be,r as P}from"./answer-board-CBkGbSLD.js";var F=e(n(),1),I=t(),L={running:`Answering`,completed:`Last message answered`,failed:`Last message failed`,stopped:`Stopped`,unknown:`Outcome unknown`,retained:`Retained native activity`,idle:`No messages`};function R(e,t,n,r){let[i,a]=(0,F.useState)(null),[o,s]=(0,F.useState)(``),[c,l]=(0,F.useState)(!1),u=(0,F.useRef)(null),d=(0,F.useRef)(null);return(0,F.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,F.useEffect)(()=>{d.current?.()},[t.cursor]),{work:i,problem:o,reading:c,refresh:()=>d.current?.()}}function xe({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,I.jsxs)(`section`,{className:`project-section project-work`,"aria-label":`Project work`,children:[(0,I.jsxs)(`div`,{className:`section-heading`,children:[(0,I.jsx)(`h2`,{children:`Work progress`}),(0,I.jsx)(`button`,{className:`text-button`,disabled:o,onClick:s,children:o?`Reading…`:`Refresh`})]}),a&&(0,I.jsxs)(`p`,{role:`alert`,children:[a,` Retained observations remain below.`]}),c.length>0&&(0,I.jsx)(`div`,{className:`work-sessions`,children:c.map(e=>(0,I.jsxs)(`article`,{className:`work-session`,children:[(0,I.jsxs)(`header`,{children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h3`,{children:e.title}),(0,I.jsxs)(`p`,{children:[L[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`:`Claude CLI`]})]}),e.conversationId?(0,I.jsx)(`button`,{onClick:()=>t(e.conversationId),children:`Continue conversation`}):e.source===`external-acp`?(0,I.jsx)(`span`,{className:`muted`,children:`Input stays in the original client`}):(0,I.jsx)(`button`,{onClick:n,children:`View activity`})]}),e.observation?(0,I.jsx)(g,{observation:e.observation}):e.source===`native-transcript`?(0,I.jsxs)(`p`,{className:`muted`,children:[`Input stays in the original window. Retained through cursor `,e.cursor,`; `,e.droppedEvents??0,` events dropped.`]}):(0,I.jsx)(`p`,{className:`muted`,children:`No session projection retained yet.`}),e.source===`external-acp`&&(0,I.jsxs)(I.Fragment,{children:[(e.pendingPermissions??0)>0&&(0,I.jsx)(`p`,{role:`status`,children:`Waiting for a permission choice in the original client.`}),e.lastMessage&&(0,I.jsxs)(`details`,{children:[(0,I.jsx)(`summary`,{children:`Latest reply · read only`}),(0,I.jsx)(`p`,{className:`external-reply`,children:e.lastMessage}),(e.omittedMessageChars??0)>0&&(0,I.jsx)(`small`,{children:`Later reply text was not retained.`})]})]})]},e.id))})]})}var z=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 Se({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,I.jsxs)(`section`,{className:`project-section touched-files`,"aria-labelledby":`touched-title`,children:[(0,I.jsxs)(`div`,{className:`section-heading`,children:[(0,I.jsx)(`h2`,{id:`touched-title`,children:`Files the Agent used`}),(0,I.jsx)(`span`,{className:`touched-unit`,children:`Tool calls`})]}),(0,I.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,I.jsx)(`li`,{children:(0,I.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,I.jsx)(s,{name:z(o),size:16,stroke:1.6}),(0,I.jsxs)(`span`,{className:`touched-name`,children:[(0,I.jsx)(`strong`,{children:o}),(0,I.jsx)(`small`,{children:l?c||`Project folder`:n.state.replaceAll(`-`,` `)}),(0,I.jsx)(`i`,{"aria-hidden":`true`,style:{width:`${Math.max(4,n.references.length/i*100)}%`}})]}),(0,I.jsx)(`span`,{className:`touched-count`,children:n.references.length})]})},n.path)})}),a>0&&(0,I.jsxs)(`p`,{className:`touched-more`,children:[a,` more outside the project or past the limit`]}),e.native.state===`available`&&(0,I.jsxs)(`button`,{className:`text-button touched-native`,onClick:n,children:[`View native activity `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]})}function Ce({work:e,openFile:t}){let n=e?.notes.path??`project-notes.md`;return(0,I.jsxs)(`button`,{className:`notes-card`,"aria-label":`Open shared notes`,onClick:()=>t(n),children:[(0,I.jsxs)(`span`,{className:`notes-sheet`,"aria-hidden":`true`,children:[(0,I.jsx)(`i`,{}),(0,I.jsx)(`i`,{}),(0,I.jsx)(`i`,{})]}),(0,I.jsxs)(`span`,{className:`notes-name`,children:[(0,I.jsx)(`strong`,{children:`Shared notes`}),(0,I.jsx)(`small`,{children:n})]}),(0,I.jsx)(s,{name:`chevron`,size:14})]})}var B=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}),V={completed:`Answered`,failed:`Failed`,stopped:`Stopped`,running:`Working`,unknown:`Outcome unknown`};function H(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 U({client:e,snapshot:t,node:n}){let[r,i]=(0,F.useState)(null),a=n.path+`@`+(n.resource?.version??n.modifiedAt);return(0,F.useEffect)(()=>{let r=!0;return S(e,t,B(n)).then(e=>{r&&i(e)}),()=>{r=!1}},[a]),r?r.kind===`image`?(0,I.jsx)(`img`,{className:`board-figure`,src:r.url,alt:n.title}):(0,I.jsx)(`span`,{className:`board-figure none`,children:r.kind===`none`?r.note:``}):(0,I.jsx)(`span`,{className:`board-figure loading`,"aria-hidden":`true`})}function W({client:e,snapshot:t,node:n,rows:r}){let[i,a]=(0,F.useState)(void 0),o=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,F.useEffect)(()=>{let i=!0;return se(e,t,B(n),r).then(e=>{i&&a(e)}),()=>{i=!1}},[o,r]),i===void 0)return(0,I.jsx)(`span`,{className:`board-table loading`,"aria-hidden":`true`});if(!i)return(0,I.jsx)(`p`,{className:`board-note`,children:`This table could not be read.`});let s=i.rows.slice(0,r);return(0,I.jsxs)(`div`,{className:`board-table-wrap`,children:[(0,I.jsxs)(`table`,{className:`board-table`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsx)(`tr`,{children:i.columns.map(e=>(0,I.jsx)(`th`,{title:e,children:e},e))})}),(0,I.jsx)(`tbody`,{children:s.map((e,t)=>(0,I.jsx)(`tr`,{children:i.columns.map(t=>(0,I.jsx)(`td`,{title:e[t]===null||e[t]===void 0?``:String(e[t]),children:H(e[t])},t))},t))})]}),(0,I.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 we(e,t){let n=e.split(`
|
|
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 G({client:e,snapshot:t,node:n}){let[r,i]=(0,F.useState)(void 0),a=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,F.useEffect)(()=>{let r=!0;return O(e,t,B(n)).then(e=>{r&&i(e)}),()=>{r=!1}},[a]),r===void 0)return(0,I.jsx)(`span`,{className:`board-outline loading`,"aria-hidden":`true`});if(!r)return null;let{lines:o,marks:s}=we(r.text,n.path);return(0,I.jsxs)(`div`,{className:`board-outline`,children:[s.length>0&&(0,I.jsx)(`ol`,{children:s.slice(0,12).map(e=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`span`,{children:e.line}),(0,I.jsx)(`code`,{children:e.text})]},e.line))}),(0,I.jsxs)(`small`,{children:[o.toLocaleString(),` lines`,r.cut?` (more than Rho read)`:``,s.length>12?` · ${s.length-12} more sections`:``]})]})}function K({client:e,snapshot:t,node:n,lines:r}){let[i,a]=(0,F.useState)(void 0),o=n.path+`@`+(n.resource?.version??n.modifiedAt);if((0,F.useEffect)(()=>{let r=!0;return O(e,t,B(n)).then(e=>{r&&a(e)}),()=>{r=!1}},[o]),i===void 0)return(0,I.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
|
-
`);return(0,I.jsxs)(`div`,{className:`board-text`,children:[(0,I.jsx)(`pre`,{children:c.slice(0,r).join(`
|
|
5
|
-
`)}),(c.length>r||i.cut)&&(0,I.jsxs)(`small`,{children:[`First `,Math.min(r,c.length),` of `,i.cut?`more than `+c.length:c.length.toLocaleString(),` lines`]})]})}function q({node:e}){let t=e.outcome===`returned`&&(!e.end||/^exit 0\b/i.test(e.end));return(0,I.jsxs)(`details`,{className:`board-run`,children:[(0,I.jsxs)(`summary`,{children:[(0,I.jsxs)(`code`,{title:e.ran??e.command,children:[`$ `,P(e.ran??e.command??``)]}),(0,I.jsxs)(`span`,{className:`board-run-end`+(t?``:` problem`),children:[e.end??(e.outcome===`requested`?`Running`:`Returned`),e.durationMs?` · `+ae(e.durationMs):``]})]}),(0,I.jsx)(`pre`,{className:`board-run-full`,children:e.ran??e.command}),e.output?.text?(0,I.jsx)(`pre`,{ref:e=>{e&&(e.scrollTop=e.scrollHeight)},children:e.output.text}):(0,I.jsx)(`p`,{className:`board-note`,children:`The Agent reported no output for this command.`})]})}var Te=(e,t)=>e.length>t?e.slice(0,t-1).trimEnd()+`…`:e,J=e=>e instanceof Error?e.message:`The message could not be sent.`;function Ee({about:e,onSend:t,onCancel:n}){let[r,i]=(0,F.useState)(``),[a,o]=(0,F.useState)(!1),[s,c]=(0,F.useState)(``),l=(0,F.useRef)(null);(0,F.useEffect)(()=>{l.current?.focus()},[]);async function u(){if(r.trim()&&!a){o(!0),c(``);try{await t(r)}catch(e){c(J(e))}finally{o(!1)}}}return(0,I.jsxs)(`form`,{className:`board-ask-box`,onSubmit:e=>{e.preventDefault(),u()},onKeyDown:e=>{e.key===`Escape`&&n()},children:[e.kind===`passage`?(0,I.jsx)(`blockquote`,{children:e.text}):e.kind===`file`?(0,I.jsxs)(`p`,{className:`board-ask-about`,children:[`About `,(0,I.jsx)(`strong`,{children:e.title}),e.resource?` as this message left it`:``]}):(0,I.jsxs)(`p`,{className:`board-ask-about`,children:[(0,I.jsx)(`strong`,{children:`What needs to change?`}),` The Agent receives your words.`]}),(0,I.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,I.jsx)(`p`,{className:`inline-error`,role:`alert`,children:s}),(0,I.jsxs)(`div`,{className:`board-ask-actions`,children:[(0,I.jsx)(`button`,{type:`button`,onClick:n,children:`Cancel`}),(0,I.jsx)(`button`,{type:`submit`,className:`primary`,disabled:a||!r.trim(),children:a?`Sending…`:e.kind===`changes`?`Send to the Agent`:`Ask the Agent`})]})]})}function De({text:e}){return(0,I.jsx)(I.Fragment,{children:e.split("`").map((e,t)=>t%2?(0,I.jsx)(`code`,{children:e},t):e)})}function Y({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`,p=/\.(csv|tsv)$/i.test(u.path??``),h=d===`run`?null:f?(0,I.jsx)(U,{client:e,snapshot:t,node:u}):p&&(d===`primary`||d===`supporting`)?(0,I.jsx)(W,{client:e,snapshot:t,node:u,rows:d===`primary`?12:5}):d===`method`?(0,I.jsx)(G,{client:e,snapshot:t,node:u}):(d===`primary`||d===`supporting`)&&/\.(json|txt|md|ya?ml|log)$/i.test(u.path??``)?(0,I.jsx)(K,{client:e,snapshot:t,node:u,lines:d===`primary`?16:8}):null;return d===`run`?(0,I.jsxs)(`div`,{className:`board-item role-run`,children:[(0,I.jsx)(q,{node:u}),(0,I.jsx)(`small`,{className:`board-why`,children:(0,I.jsx)(De,{text:n.why})})]}):(0,I.jsxs)(`article`,{className:`board-item role-`+d+(o?` span-`+o:``)+(c?.open?` asking`:``),children:[(0,I.jsxs)(`header`,{children:[(0,I.jsxs)(`div`,{className:`board-item-title`,children:[(0,I.jsxs)(`button`,{className:`board-name`,title:`Show `+u.path,onClick:()=>r(u.path),children:[(0,I.jsx)(s,{name:m(u.path),size:15,stroke:1.7}),(0,I.jsx)(`strong`,{children:u.title})]}),(0,I.jsxs)(`span`,{className:`board-item-actions`,children:[c&&(0,I.jsx)(`button`,{className:`text-button board-ask-button`,"aria-expanded":c.open,onClick:c.toggle,children:`Ask`}),i&&D(u.path)&&C(t)&&(0,I.jsx)(N,{languages:[`r`,`python`],title:e=>`Open ${u.title} in Studio with the Notebook beside it, loaded into the ${T[e]} session as a new value`,onExplore:e=>i(u.path,e)})]})]}),l&&(0,I.jsx)(k,{className:`board-holds`,holds:l}),n.why!==a&&(0,I.jsx)(`small`,{className:`board-why`,children:(0,I.jsx)(De,{text:n.why})})]}),c?.open&&c.box,h]})}function Oe({record:e,graph:t,shown:n,onDecide:r,onNeedsChanges:i}){let a=e.decisions?.at(-1),[o,c]=(0,F.useState)(!1),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(!1),[p,m]=(0,F.useState)(``);if((0,F.useEffect)(()=>{c(!1),u(!1),m(``)},[e.id,a?.changeId]),e.state===`running`||oe(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 ee(){f(!0),m(``);try{await r()}catch(e){m(J(e))}finally{f(!1)}}return l?(0,I.jsx)(`div`,{className:`board-verdict`,children:(0,I.jsx)(Ee,{about:{kind:`changes`},onSend:i,onCancel:()=>u(!1)})}):(0,I.jsxs)(`div`,{className:`board-verdict`+(a&&!o?` `+a.decision:``),children:[a&&!o?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{children:[(0,I.jsx)(s,{name:a.decision===`accepted`?`check`:`pencil`,size:14,stroke:2}),` `,(0,I.jsx)(`strong`,{children:a.decision===`accepted`?`You chose to use this answer`:`You said this needs changes`}),(0,I.jsxs)(`span`,{className:`board-meta`,children:[` · `,le(a.at),` · for the `,a.results.length,` `,a.results.length===1?`file version`:`file versions`,` this message kept`]})]}),a.note&&(0,I.jsx)(`blockquote`,{children:a.note}),g.length>0&&(0,I.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,I.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,I.jsx)(`button`,{className:`text-button`,onClick:()=>c(!0),children:`Change`})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`board-meta`,children:`Will you use this answer?`}),(0,I.jsxs)(`div`,{className:`board-verdict-actions`,children:[(0,I.jsx)(`button`,{className:`primary`,disabled:d,onClick:()=>void ee(),children:d?`Saving…`:`Use this answer`}),(0,I.jsx)(`button`,{disabled:d,onClick:()=>u(!0),children:`Needs changes`}),o&&(0,I.jsx)(`button`,{className:`text-button`,onClick:()=>c(!1),children:`Cancel`})]})]}),p&&(0,I.jsx)(`p`,{className:`inline-error`,role:`alert`,children:p})]})}function ke({id:e,node:t,running:n,at:r,onOpen:i}){if(!t)return null;let{about:a,quote:o,question:c}=v(t.text??``);return(0,I.jsxs)(`li`,{className:`board-follow-up`,id:`board-follow-`+e,children:[(0,I.jsxs)(`div`,{className:`board-follow-ask`,children:[(a||o)&&(0,I.jsx)(`span`,{className:`board-follow-about`,title:o??a??``,children:a?`About `+(a.split(`/`).at(-1)??a):`“`+Te(o,60)+`”`}),(0,I.jsx)(`p`,{children:c}),(0,I.jsxs)(`button`,{className:`text-button`,onClick:i,children:[n?`Answering…`:new Date(r).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),` `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]}),t.answer?(0,I.jsx)(_,{text:t.answer,streaming:n}):n?(0,I.jsx)(`p`,{className:`board-note`,role:`status`,children:`The Agent is working on this.`}):null]})}function Ae({client:e,snapshot:t,files:n,notesText:r=``,onConversation:i,onPath:a,onExplore:o,onConsole:c,onGraph:l,onAsked:d}){let{turns:f,loading:p}=ve(e,t),h=(0,F.useMemo)(()=>n.files.map(e=>({path:e.path,bytes:e.bytes,modifiedAt:e.modifiedAt,category:e.category})),[n.files]),g=(0,F.useMemo)(()=>re(ne({turns:f,files:h,project:t.project,kindOf:u,now:Date.now()})),[f,h,t.project]),ee=A(e,t,g,h,r,f),ie=(0,F.useMemo)(()=>be(g),[g]),[ae,se]=(0,F.useState)(null),y=ae&&ie.find(e=>e.turn.id===ae)||ie[0],b=y?.turn,x=y?.board,S=y?.followUps??[],[C,w]=(0,F.useState)(null),[T,ue]=(0,F.useState)(null),E=(0,F.useRef)(null),D=(0,F.useRef)(null),de=(0,F.useRef)(null);if((0,F.useEffect)(()=>{w(null),ue(null)},[b?.id]),p||!x||!b)return null;let O=b.conversationId,k=t.conversations?.find(e=>e.conversationId===O)?.state===`running`;async function fe(n,r){let a=te(n,r);E.current?.text!==a&&(E.current={text:a,changeId:`ask-`+crypto.randomUUID()}),await e.call(`conversation.send`,{projectId:t.project.id,conversationId:O,changeId:E.current.changeId,text:a}),E.current=null,w(null),(d??i)(O)}async function pe(n,r){let i=b.id+`:`+n+`:`+(r??``);D.current?.key!==i&&(D.current={key:i,changeId:`decide-`+crypto.randomUUID()}),await e.call(`conversation.decide`,{projectId:t.project.id,conversationId:O,turnId:M.id,changeId:D.current.changeId,decision:n,...r?{note:r}:{}}),D.current=null}async function me(n){await pe(`needs-changes`,n.trim());let r=`Needs changes: `+n.trim();E.current?.text!==r&&(E.current={text:r,changeId:`ask-`+crypto.randomUUID()}),await e.call(`conversation.send`,{projectId:t.project.id,conversationId:O,changeId:E.current.changeId,text:r}),E.current=null,(d??i)(O)}let he=(e,t)=>C?.key===e?(0,I.jsx)(Ee,{about:C.about,onSend:e=>fe(C.about,e),onCancel:()=>w(null)}):null,ge=e=>{let t=`file:`+e.node.path;return{open:C?.key===t,toggle:()=>w(C?.key===t?null:{key:t,about:{kind:`file`,path:e.node.path,title:e.node.title,resource:e.node.resource??null}}),box:he(t,{kind:`file`,path:e.node.path,title:e.node.title})}};function _e(){let e=getSelection(),t=e?.toString().trim()??``,n=de.current;if(!e||!t||!n||!e.rangeCount||!n.contains(e.anchorNode)||!n.contains(e.focusNode)){ue(null);return}let r=e.getRangeAt(0).getBoundingClientRect(),i=n.getBoundingClientRect();ue({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:j}=x,M=f.find(e=>e.conversationId+`/`+e.turn.id===b.id)?.turn,N=e=>x.items.filter(t=>t.role===e),L=N(`primary`)[0],R=N(`supporting`),xe=N(`method`),z=N(`run`),Se=N(`input`),Ce=N(`report`),B=e=>x.omitted[e]?(0,I.jsxs)(`small`,{className:`board-more`,children:[x.omitted[e],` more in Files`]}):null,H=b.running?g.live:null,U=H&&g.nodes.find(e=>e.id===H.node),W=H&&U&&U.kind!==`question`?H.label+` `+(U.kind===`run`&&U.ran?P(U.ran):U.title):H?.waiting?H.label:null,we=S.find(e=>e.running),G=we?{id:we.id,title:Te(v(g.nodes.find(e=>e.id===`q:`+we.id)?.text??``).question.split(`
|
|
6
|
-
`)[0],60)}:null,K=[L,...R].filter(Boolean),q=e=>e.node.path?ee.holds(e.node.path):void 0,J=ee.meanings.find(e=>e.conversationId===O)?.statements.filter(e=>e.kind===`choice`)??[],Ae=K.length>1&&K.every(e=>e.why===K[0].why)?K[0].why:void 0,je=(L?Math.max(0,R.length-2):R.length)%3;return(0,I.jsxs)(`section`,{className:`project-section answer-board`,"aria-labelledby":`board-title`,children:[(0,I.jsxs)(`header`,{className:`board-head`,children:[(0,I.jsxs)(`div`,{className:`board-ask`,children:[(0,I.jsx)(`h2`,{id:`board-title`,title:j.text,children:j.title}),(0,I.jsxs)(`p`,{className:`board-meta`,children:[(0,I.jsx)(`span`,{className:`work-state `+(j.state??``),children:M&&oe(M)?`Turn limit reached`:V[j.state??``]??j.state}),M&&(0,I.jsxs)(I.Fragment,{children:[` · `,le(M.endedAt??M.sentAt),M.endedAt&&ce(M.startedAt??M.sentAt,M.endedAt)?` · took `+ce(M.startedAt??M.sentAt,M.endedAt):``]}),W&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(`span`,{className:`board-live`+(H?.waiting?` waiting`:``),title:W,children:W})]}),G&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsxs)(`button`,{className:`text-button board-live`,onClick:()=>document.getElementById(`board-follow-`+G.id)?.scrollIntoView({block:`center`,behavior:`smooth`}),children:[`Answering “`,G.title,`”`]})]})]})]}),(0,I.jsxs)(`div`,{className:`board-actions`,children:[ie.length>1&&(0,I.jsx)(`select`,{"aria-label":`Answer to show`,value:b.id,onChange:e=>se(e.target.value),children:ie.map(({turn:e})=>(0,I.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,I.jsxs)(`button`,{className:`text-button`,onClick:()=>i(b.conversationId),children:[`Conversation `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]})]}),j.answer?(0,I.jsxs)(`div`,{className:`board-answer`,ref:de,onMouseUp:_e,onKeyUp:_e,children:[(0,I.jsx)(_,{text:j.answer,streaming:!!b.running}),T&&!b.running&&(0,I.jsx)(`button`,{className:`board-select-ask`,style:{top:T.top,left:T.left},onMouseDown:e=>e.preventDefault(),onClick:()=>{w({key:`passage`,about:{kind:`passage`,text:T.text}}),ue(null),getSelection()?.removeAllRanges()},children:`Ask about this`})]}):b.running?(0,I.jsx)(`p`,{className:`board-note`,role:`status`,children:`The Agent is working on this message.`}):null,C?.key===`passage`&&he(`passage`,C.about),k&&C&&(0,I.jsx)(`p`,{className:`board-note`,children:`The Agent is still answering. Your question can be sent when it has finished.`}),(L||R.length>0)&&(0,I.jsxs)(`div`,{className:`board-results-block`,children:[(0,I.jsxs)(`p`,{className:`board-results-why`,children:[(0,I.jsx)(`strong`,{children:`Results`}),Ae&&(0,I.jsxs)(I.Fragment,{children:[` · `,(0,I.jsx)(De,{text:Ae})]})]}),(0,I.jsxs)(`div`,{className:`board-results beside-`+Math.min(R.length,2),children:[L&&(0,I.jsx)(Y,{client:e,snapshot:t,item:L,onPath:a,onExplore:o,said:Ae,holds:q(L),ask:b.running?void 0:ge(L)}),R.map((n,r)=>(0,I.jsx)(Y,{client:e,snapshot:t,item:n,onPath:a,onExplore:o,said:Ae,holds:q(n),span:r>=R.length-je?6/je:void 0,ask:b.running?void 0:ge(n)},n.node.id))]}),B(`supporting`)]}),(xe.length>0||z.length>0||Se.length>0||Ce.length>0||x.otherCommands>0)&&(0,I.jsxs)(`div`,{className:`board-how`,children:[xe.length>0&&(0,I.jsxs)(`div`,{className:`board-row`,children:[(0,I.jsx)(`span`,{className:`board-label`,children:`Method`}),(0,I.jsx)(`div`,{className:`board-cells`,children:xe.map(n=>(0,I.jsx)(Y,{client:e,snapshot:t,item:n,onPath:a,holds:q(n),ask:b.running?void 0:ge(n)},n.node.id))})]}),(z.length>0||x.otherCommands>0)&&(0,I.jsxs)(`div`,{className:`board-row`,children:[(0,I.jsx)(`span`,{className:`board-label`,children:`Ran`}),(0,I.jsxs)(`div`,{className:`board-cells`,children:[z.map(n=>(0,I.jsx)(Y,{client:e,snapshot:t,item:n,onPath:a},n.node.id)),x.otherCommands>0&&(0,I.jsxs)(`button`,{className:`text-button board-console`,onClick:()=>c(b.id),children:[z.length?x.otherCommands+` other `+(x.otherCommands===1?`command`:`commands`):x.otherCommands+(x.otherCommands===1?` command`:` commands`),` in the Console `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]})]}),Se.length>0&&(0,I.jsxs)(`div`,{className:`board-row`,children:[(0,I.jsx)(`span`,{className:`board-label`,children:`From`}),(0,I.jsxs)(`div`,{className:`board-chips`,children:[Se.map(e=>(0,I.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,I.jsx)(s,{name:m(e.node.path),size:14,stroke:1.7}),(0,I.jsx)(`span`,{children:e.node.title})]},e.node.id)),B(`input`)]})]}),Ce.length>0&&(0,I.jsxs)(`div`,{className:`board-row`,children:[(0,I.jsx)(`span`,{className:`board-label`,children:`Report`}),(0,I.jsx)(`div`,{className:`board-chips`,children:Ce.map(e=>(0,I.jsxs)(`button`,{className:`work-file`,title:e.why.replaceAll("`",``)+` · `+e.node.path,onClick:()=>a(e.node.path),children:[(0,I.jsx)(s,{name:`document`,size:14,stroke:1.7}),(0,I.jsx)(`span`,{children:e.node.title})]},e.node.id))})]})]}),J.length>0&&(0,I.jsxs)(`div`,{className:`board-choices`,children:[(0,I.jsxs)(`p`,{className:`board-results-why`,children:[(0,I.jsx)(`strong`,{children:`Choices`}),` · what the Agent went with`,J.some(e=>e.alternatives?.length)?`, and the other option where the notes name one`:``]}),J.map(n=>(0,I.jsx)(ye,{statement:n,trace:ee.traces.get(n),conversationId:O,client:e,projectId:t.project.id,onPath:a,onSent:e=>(d??i)(e)},n.line))]}),S.length>0&&(0,I.jsxs)(`div`,{className:`board-follow`,children:[(0,I.jsx)(`p`,{className:`board-results-why`,children:(0,I.jsx)(`strong`,{children:`Asked since`})}),(0,I.jsx)(`ol`,{children:S.map(e=>(0,I.jsx)(ke,{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))})]}),M&&(0,I.jsx)(Oe,{record:M,graph:g,shown:[L,...R,...Ce].filter(e=>!!e).map(e=>e.node.path),onDecide:()=>pe(`accepted`),onNeedsChanges:me}),(0,I.jsx)(`footer`,{className:`board-foot`,children:(0,I.jsxs)(`button`,{className:`text-button`,onClick:l,children:[`How each file connects, in the Graph `,(0,I.jsx)(s,{name:`chevron`,size:12})]})})]})}var je=(0,F.lazy)(()=>h(()=>import(`./graph-CK-df5lh.js`).then(e=>({default:e.WorkStrip})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),Me=e=>e>=6?6:e>=3?3:e,Ne=(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 Pe({client:e,snapshot:t,item:n,modifiedAt:r}){let i=/\.(png|jpe?g|svg|csv)$/i.test(n.path),[a,o]=(0,F.useState)(null);return(0,F.useEffect)(()=>{if(!i)return;let a=!0;return S(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,I.jsx)(`span`,{className:`figure-thumb loading`,"aria-hidden":`true`}):a?.kind===`image`?(0,I.jsx)(`span`,{className:`figure-thumb image`,children:(0,I.jsx)(`img`,{src:a.url,alt:``})}):a?.kind===`table`?(0,I.jsx)(`span`,{className:`figure-thumb table`,"aria-hidden":`true`,children:(0,I.jsxs)(`span`,{style:{gridTemplateColumns:`repeat(${a.columns.length}, minmax(0, 1fr))`},children:[a.columns.map(e=>(0,I.jsx)(`b`,{children:e},`h`+e)),a.rows.map((e,t)=>a.columns.map(n=>(0,I.jsx)(`i`,{children:e[n]===null||e[n]===void 0?``:String(e[n])},t+n)))]})}):(0,I.jsx)(`span`,{className:`figure-thumb kind`,"aria-hidden":`true`,children:(0,I.jsx)(s,{name:y(n),size:26,stroke:1.4})})}function Fe({composition:e}){let t=c(e),n=new Map(e.views.map(e=>[e.id,e]));if(!t)return(0,I.jsx)(`span`,{className:`mini-layout empty`,children:`Empty workspace`});let r=e=>{if(e.kind===`split`)return(0,I.jsx)(`span`,{className:`mini-split `+e.axis,children:e.children.map((t,n)=>(0,I.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,I.jsxs)(`span`,{className:`mini-pane`,children:[(0,I.jsx)(`span`,{className:`mini-tabs`,children:t.slice(0,5).map((e,t)=>(0,I.jsx)(`i`,{className:t===0?`on`:void 0},e.id))}),i&&(0,I.jsxs)(`span`,{className:`mini-face`,children:[(0,I.jsx)(s,{name:Ne(String(i.component),a),size:13}),(0,I.jsx)(`span`,{children:a})]}),t.length>1&&(0,I.jsxs)(`small`,{children:[`+`,t.length-1]})]})};return(0,I.jsx)(`span`,{className:`mini-layout`,"aria-hidden":`true`,children:r(t)})}function Ie(e){return e.provenance?.originalPath??e.path}function Le(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 X({project:e,snapshot:t,client:n,section:c,notesText:l=``,workspace:u,onExplore:m,onSection:h,onAgent:g,onLayout:te,onProjectChanged:ne,onOpened:_,category:re,files:v,sources:ae,onFile:oe,linked:se=!1,onPath:y,onNewConversation:S,onConsole:C}){let[ce,le]=(0,F.useState)(!1),{runs:T,problem:D,readAgain:O}=fe(n,e.id,t.cursor),[k,ve]=(0,F.useState)(null),[A,ye]=(0,F.useState)(null),[N,be]=(0,F.useState)(!1),[P,L]=(0,F.useState)(``),[z,B]=(0,F.useState)(``),[V,H]=(0,F.useState)(``),[U,W]=(0,F.useState)(!1),[we,G]=(0,F.useState)(``),[K,q]=(0,F.useState)(``),[Te,J]=(0,F.useState)(null),[Ee,De]=(0,F.useState)(!1),[Y,Oe]=(0,F.useState)(null),[ke,Ne]=(0,F.useState)(!1),X=t.catalog.operations.some(e=>e.method===`project.work.read`&&e.authorized),Z=R(n,t,c===`overview`&&X,Ne),ze=t.catalog.operations.some(e=>e.method===`kernel.read`&&e.state===`available`&&e.authorized),Be=x(n,e.id,t.cursor,c===`overview`&&ze),Ve=!ze||Be.read!==null||!!Be.problem,He=t.catalog.operations.some(e=>e.method===`skills.list`&&e.state===`available`&&e.authorized),Ue=M(n,e.id,t.cursor,c===`overview`&&He),We=!!Ue.problem||[...Ue.list?.skills??[],...Ue.list?.removed??[]].some(e=>e.last),Ge=(0,F.useRef)(0),Ke=(0,F.useRef)(null),Q=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=pe(t.resources.filter(e=>e.provenance?.source!==`current-filesystem-observation`),T??[]),Xe=[...T??[]].sort((e,t)=>t.acceptedAt.localeCompare(e.acceptedAt)),Ze=new Map((v?.files??[]).map(e=>[e.path,e.modifiedAt])),$=[...ae?.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&&!ke&&!Be.cells&&!Be.problem,et=!$e||(T!==null||!!D)&&Y!==null&&Ve,tt=c===`overview`&&$e&&T!==null&&T.length===0&&Y!==null&&Ve,nt=!!D||(T?.length??0)>0,rt=!!Z.work&&(Z.work.files.length>0||Z.work.omitted.fileReferences>0),it=nt||rt||X||t.compositions.length>0||We,at=Me($.length),ot=!!v&&!!t.conversations?.length,st=(Y??0)>0,ct=[{key:`files`,label:`Browse files`,icon:`folder`,run:()=>h(`files`),primary:st},{key:`agent`,label:`Work with Agent`,icon:`prompt`,run:()=>g(),primary:!st}].sort((e,t)=>Number(t.primary)-Number(e.primary));async function lt(t=``){let r=++Ge.current;be(!0),B(``);try{let i=await n.call(`project.entries`,{projectId:e.id,...t?{path:t}:{}});r===Ge.current&&(ye(i),H(``))}catch(e){r===Ge.current&&B(e instanceof Error?e.message:`Could not read this folder. Try again.`)}finally{r===Ge.current&&be(!1)}}(0,F.useEffect)(()=>{Q&&!A&&!N&<()},[Q]),(0,F.useEffect)(()=>{if(c!==`overview`||!$e)return;let t=!0;return n.call(`project.entries`,{projectId:e.id}).then(e=>{t&&Oe(e.entries.length)},()=>{t&&Oe(-1)}),()=>{t=!1}},[n,e.id,c,$e]),(0,F.useEffect)(()=>()=>{Ge.current++},[]),(0,F.useEffect)(()=>{k&&!Ke.current?.open&&Ke.current?.showModal()},[k]);async function ut(r){if(!P){L(r.path),B(``);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()});_(o.composition.compositionId,o.viewId)}catch(e){B(e instanceof Error?e.message:`Could not open this file. Try again.`)}finally{L(``)}}}async function dt(){W(!0),G(``);try{let t=await n.call(`project.source.add`,{projectId:e.id},new AbortController().signal);t.project&&ne(t.project)}catch(e){G(e instanceof Error?e.message:`Could not add the folder. Try again.`)}finally{W(!1)}}async function ft(){De(!0),q(``);try{J((await n.call(`project.doctor`,{projectId:e.id},new AbortController().signal)).checks)}catch(e){q(e instanceof Error?e.message:`Could not check this project. Try again.`)}finally{De(!1)}}let pt=e=>(0,I.jsxs)(`button`,{className:`activity-row`,onClick:()=>ve(e.operationId),children:[(0,I.jsx)(`span`,{className:`activity-symbol `+e.execution,children:(0,I.jsx)(s,{name:`run`,size:16})}),(0,I.jsxs)(`span`,{className:`activity-name`,children:[(0,I.jsx)(`strong`,{children:e.operationId}),(0,I.jsxs)(`small`,{children:[e.author,` · `,o(e.acceptedAt).text]})]}),(0,I.jsx)(`span`,{className:`state `+e.execution,children:he(e.execution)}),(0,I.jsx)(s,{name:`chevron`,size:13})]},e.operationId),mt=(e,t)=>e&&(0,I.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,I.jsx)(`p`,{children:e}),(0,I.jsx)(`button`,{onClick:t,children:`Try again`})]}),ht=(0,I.jsx)(`ul`,{className:`result-list`,children:Ye.map(({resource:e,run:t,earlier:n})=>{let r=qe.get(e.id+`@`+e.version),i=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`file-symbol`,children:(0,I.jsx)(s,{name:w(e.kind),size:19,stroke:1.6})}),(0,I.jsxs)(`span`,{className:`result-name`,children:[(0,I.jsx)(`strong`,{title:Ie(e),children:me(Ie(e))}),(0,I.jsxs)(`small`,{children:[e.kind,n?` · ${n} earlier version${n===1?``:`s`}`:``,t?` · `+t.operationId:``]})]}),(0,I.jsx)(`span`,{className:`result-state`,children:t?_e(t.integrity):E(e)}),r&&(0,I.jsx)(s,{name:`chevron`,size:14})]});return(0,I.jsx)(`li`,{children:r?(0,I.jsx)(`button`,{className:`result-row`,onClick:()=>te(r.compositionId,r.viewId),children:i}):(0,I.jsxs)(`div`,{className:`result-row`,children:[i,(0,I.jsx)(`small`,{children:`No open view`})]})},e.id+e.version)})}),gt=A?.entries.filter(e=>!V||e.name.toLocaleLowerCase().includes(V.toLocaleLowerCase()))??[],_t=b[re??`data`],vt=Q?`Files`:c===`agent`?`Agent`:c===`settings`?`Project settings`:c===`sources`?_t:r(e);return(0,I.jsxs)(`section`,{className:`project-page overview`+(Q?` files-page`:``),"aria-labelledby":`overview-title`,children:[(0,I.jsxs)(`header`,{className:`page-heading`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h1`,{id:`overview-title`,children:vt}),c===`overview`&&(0,I.jsx)(`p`,{title:Qe.full,children:Qe.text})]}),Q&&(0,I.jsxs)(`button`,{onClick:()=>void lt(A?.path),disabled:N,children:[(0,I.jsx)(s,{name:`refresh`,size:15}),`Refresh`]}),c===`sources`&&v&&(0,I.jsxs)(`button`,{onClick:v.refresh,disabled:v.reading,children:[(0,I.jsx)(s,{name:`refresh`,size:15}),`Refresh`]})]}),c===`sources`&&v&&oe&&(0,I.jsx)(Re,{category:re??`data`,files:v,items:ae?.[re??`data`]??null,artifacts:Ye,onFile:oe}),c===`overview`&&X&&(0,I.jsx)(xe,{state:Z,boarded:!!v&&!!t.conversations?.length,openConversation:g,openActivity:()=>h(`agent`)}),c===`overview`&&z&&(0,I.jsx)(`p`,{role:`alert`,children:z}),tt&&(0,I.jsxs)(`div`,{className:`empty-project`,children:[(0,I.jsx)(`span`,{className:`empty-symbol`,children:(0,I.jsx)(s,{name:`grid`,size:26,stroke:1.5})}),(0,I.jsx)(`h2`,{children:`No work yet`}),(0,I.jsx)(`div`,{className:`empty-actions`,children:ct.map(e=>(0,I.jsxs)(`button`,{className:e.primary?`primary`:void 0,onClick:e.run,children:[(0,I.jsx)(s,{name:e.icon,size:17,stroke:1.6}),(0,I.jsx)(`span`,{children:e.label})]},e.key))})]}),c===`overview`&&!tt&&et&&(0,I.jsxs)(I.Fragment,{children:[t.taskMap?.question&&(0,I.jsxs)(`div`,{className:`project-question`,children:[(0,I.jsx)(s,{name:`prompt`,size:18}),(0,I.jsx)(`h2`,{children:t.taskMap.question})]}),v&&!!t.conversations?.length&&(0,I.jsx)(Ae,{client:n,snapshot:t,files:v,notesText:l,onConversation:e=>g(e),onPath:e=>y?.(e),onExplore:m,onConsole:e=>C?C(e):h(`console`),onGraph:()=>h(`graph`)}),(0,I.jsxs)(`div`,{className:`project-columns`+(it?``:` single`),children:[(0,I.jsxs)(`div`,{className:`project-primary`,children:[v&&(0,I.jsx)(F.Suspense,{fallback:null,children:(0,I.jsx)(je,{client:n,snapshot:t,files:v,onOpen:()=>h(`graph`),onConversations:()=>h(`agent`)})}),(!ot||!$.length&&Ye.length>0)&&(0,I.jsxs)(`section`,{className:`project-section figures-section`,children:[(0,I.jsxs)(`div`,{className:`section-heading`,children:[(0,I.jsxs)(`h2`,{children:[`Results & figures`,$.length>0&&(0,I.jsx)(`span`,{className:`section-count`,children:$.length})]}),(0,I.jsxs)(`button`,{className:`text-button`,onClick:()=>h(`files`),children:[`All files `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]}),$.length?(0,I.jsx)(`ul`,{className:`figure-grid count-`+at+(at>=3?` featured`:``),children:$.slice(0,at).map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{className:`figure-card`,onClick:()=>oe?.(`results`,e),title:e.path,children:[(0,I.jsx)(Pe,{client:n,snapshot:t,item:e,modifiedAt:Ze.get(e.path)}),(0,I.jsxs)(`span`,{className:`figure-name`,children:[(0,I.jsx)(`strong`,{children:e.name}),(0,I.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,I.jsx)(`p`,{className:`quiet-empty`,children:`No results or figures yet.`}),$.length>at&&(0,I.jsxs)(`button`,{className:`text-button figures-more`,onClick:()=>h(`files`),children:[$.length-at,` more in Files `,(0,I.jsx)(s,{name:`chevron`,size:12})]})]}),(0,I.jsx)(p,{work:Be,snapshot:t,onOpen:()=>h(`notebook`)}),t.taskMap?.items.length?(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsx)(`div`,{className:`section-heading`,children:(0,I.jsx)(`h2`,{children:`From your Agent`})}),(0,I.jsx)(`ul`,{className:`agent-notes`,children:t.taskMap.items.map(e=>(0,I.jsxs)(`li`,{"data-fact":`agent`,children:[(0,I.jsx)(`strong`,{children:e.title}),e.summary&&(0,I.jsx)(`p`,{children:e.summary}),(0,I.jsx)(`small`,{children:t.taskMap.vocabulary.states[e.state]?.label??e.state})]},e.id))})]}):null]}),it&&(0,I.jsxs)(`aside`,{className:`project-side`,children:[(t.compositions.length>0||X)&&(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsx)(`div`,{className:`section-heading`,children:(0,I.jsx)(`h2`,{children:`Continue working`})}),(0,I.jsxs)(`div`,{className:`workspace-grid`,children:[t.compositions.filter(e=>!f(e.compositionId)).map(e=>(0,I.jsxs)(`button`,{className:`workspace-card`,onClick:()=>te(e.compositionId),children:[(0,I.jsxs)(`span`,{className:`workspace-card-head`,children:[(0,I.jsx)(`strong`,{children:d(e.compositionId)}),(0,I.jsxs)(`small`,{children:[e.views.length,` `,e.views.length===1?`view`:`views`]}),(0,I.jsx)(s,{name:`chevron`,size:14})]}),(0,I.jsx)(Fe,{composition:e})]},e.compositionId)),X&&(0,I.jsx)(Ce,{work:Z.work,openFile:e=>void ut({path:e})})]})]}),(0,I.jsx)(j,{list:Ue.list,problem:Ue.problem,snapshot:t,onOpen:()=>h(`skills`)}),(0,I.jsx)(Se,{work:Z.work,openFile:e=>void ut({path:e}),openActivity:()=>h(`agent`)}),nt&&(0,I.jsxs)(`section`,{className:`project-section project-recent`,children:[(0,I.jsxs)(`div`,{className:`section-heading`,children:[(0,I.jsx)(`h2`,{children:`Recent activity`}),(0,I.jsx)(`button`,{className:`text-button`,onClick:()=>h(`agent`),children:`View all`})]}),mt(D,O),Xe.length?(0,I.jsx)(`div`,{className:`activity-list`,children:Xe.slice(0,5).map(pt)}):(0,I.jsx)(`p`,{className:`quiet-empty`,children:`No runs yet.`})]})]})]})]}),Q&&(0,I.jsxs)(I.Fragment,{children:[t.documents.length>0&&(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsx)(`div`,{className:`section-heading`,children:(0,I.jsx)(`h2`,{children:`Open documents`})}),(0,I.jsx)(`div`,{className:`document-list`,children:t.documents.map(e=>{let t=Je.get(e.id);return(0,I.jsxs)(`button`,{className:`document-link`,disabled:!!P,onClick:()=>t?te(t.compositionId,t.viewId):void ut(e),children:[(0,I.jsx)(s,{name:`document`,size:18}),(0,I.jsx)(`span`,{children:me(e.path)}),e.dirty&&(0,I.jsx)(`span`,{className:`unsaved-dot`,title:`Unsaved changes`,"aria-label":`Unsaved changes`})]},e.id)})})]}),(0,I.jsxs)(`section`,{className:`project-section`,"aria-label":`Project files`,children:[(0,I.jsxs)(`div`,{className:`file-toolbar`,children:[(0,I.jsxs)(`div`,{className:`folder-location`,children:[A?.path&&(0,I.jsx)(`button`,{className:`icon-button`,"aria-label":`Up one folder`,onClick:()=>void lt(A.path.split(`/`).slice(0,-1).join(`/`)),children:(0,I.jsx)(s,{name:`chevron`,size:16})}),(0,I.jsx)(`strong`,{children:Le(A?.path??``,e)})]}),(0,I.jsxs)(`div`,{className:`search-field`,children:[(0,I.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,I.jsx)(`input`,{"aria-label":`Filter files`,placeholder:`Filter files…`,value:V,onChange:e=>H(e.target.value)})]})]}),mt(z,()=>void lt(A?.path)),N&&(0,I.jsx)(`p`,{className:`loading-inline`,role:`status`,children:`Reading folder…`}),A&&(gt.length?(0,I.jsxs)(`div`,{className:`file-table-wrap`,"aria-busy":N,children:[(0,I.jsxs)(`table`,{className:`file-table`,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{children:`Name`}),(0,I.jsx)(`th`,{children:`Type`}),(0,I.jsx)(`th`,{children:`Size`})]})}),(0,I.jsx)(`tbody`,{children:gt.map(e=>(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`td`,{children:(0,I.jsxs)(`button`,{className:`file-open`,disabled:!!P||N,onClick:()=>void(e.kind===`folder`?lt(e.path):ut(e)),children:[(0,I.jsx)(s,{name:e.kind===`folder`?`folder`:`file`,size:19,stroke:1.6}),e.name,P===e.path&&(0,I.jsx)(`span`,{role:`status`,children:`Opening…`})]})}),(0,I.jsx)(`td`,{children:e.kind===`folder`?`Folder`:e.name.split(`.`).at(-1)?.toUpperCase()||`File`}),(0,I.jsx)(`td`,{children:e.kind===`folder`?`—`:de(e.bytes)})]},e.path))})]}),A.truncated&&(0,I.jsxs)(`p`,{className:`muted`,children:[`Showing `,A.entries.length,` of `,A.total,` entries.`]})]}):(0,I.jsxs)(`div`,{className:`empty-state compact`,children:[(0,I.jsx)(`p`,{children:V?`No files match your search.`:`This folder is empty.`}),V&&(0,I.jsx)(`button`,{onClick:()=>H(``),children:`Clear search`})]}))]}),t.resources.length>0&&(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsx)(`div`,{className:`section-heading`,children:(0,I.jsx)(`h2`,{children:`Registered results`})}),ht]})]}),c===`agent`&&(()=>{let r=(0,I.jsxs)(I.Fragment,{children:[(Xe.length>0||D)&&(0,I.jsxs)(`section`,{className:`project-section agent-runs`,children:[(0,I.jsx)(`div`,{className:`section-heading`,children:(0,I.jsx)(`h2`,{children:`Runs`})}),mt(D,O),(0,I.jsx)(`div`,{className:`activity-list`,children:Xe.map(pt)})]}),se&&(0,I.jsxs)(`details`,{className:`agent-outside`,open:ce,onToggle:e=>le(e.currentTarget.open),children:[(0,I.jsx)(`summary`,{children:`Agent sessions with access`}),ce&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ue,{snapshot:t}),(0,I.jsx)(ee,{client:n,projectId:e.id,root:e.root,onOpened:_})]})]})]});return se?r:(0,I.jsx)(ie,{client:n,snapshot:t,exists:e=>!!v?.files.some(t=>t.path===e),onContinue:e=>g(e),onPath:e=>y?.(e),onNew:()=>S?.(),onOpened:_,extra:r})})(),c===`settings`&&(0,I.jsxs)(`div`,{className:`settings-sections`,children:[(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsx)(`h2`,{children:`Source folders`}),(0,I.jsx)(i,{folders:e.sources??[{id:e.id,root:e.root,name:r(e)}],busy:U,onAdd:()=>void dt()}),mt(we,()=>void dt())]}),(0,I.jsxs)(`section`,{className:`project-section`,children:[(0,I.jsxs)(`div`,{className:`section-heading`,children:[(0,I.jsx)(`h2`,{children:`Project health`}),(0,I.jsx)(`button`,{disabled:Ee,onClick:()=>void ft(),children:Ee?`Checking…`:`Check project`})]}),Te?(0,I.jsx)(`ul`,{className:`health-list`,children:Te.map(e=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`span`,{className:`state `+e.state,children:e.state===`ok`?`Ready`:e.state===`fail`?`Blocked`:`Check`}),(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`p`,{children:e.detail}),e.remedy&&(0,I.jsx)(`small`,{children:e.remedy})]})]},e.id))}):(0,I.jsx)(`p`,{className:`muted`,children:`Check the tools and capabilities available to this project.`}),mt(K,()=>void ft())]})]}),k&&(0,I.jsxs)(`dialog`,{ref:Ke,className:`run-dialog`,"aria-label":k,onClose:()=>ve(null),onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},children:[(0,I.jsx)(`button`,{className:`icon-button run-dialog-close`,"aria-label":`Close`,onClick:()=>Ke.current?.close(),children:(0,I.jsx)(s,{name:`close`,size:18})}),(0,I.jsx)(ge,{snapshot:t,client:n,operationId:k,runs:T,readRuns:O,onOpenRun:ve,opener:e=>{let t=qe.get(e.id+`@`+e.version);return t?()=>te(t.compositionId,t.viewId):null}},k)]})]})}var Z={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 Re({category:e,files:t,items:n,artifacts:r,onFile:i}){let[a,o]=(0,F.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,I.jsxs)(`section`,{className:`project-section source-list`,"aria-label":e,children:[(0,I.jsxs)(`div`,{className:`file-toolbar`,children:[(0,I.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,I.jsx)(`span`,{title:`Rho reads at most ${l.maxFolders} folders, ${l.maxDepth} levels deep.`,children:` · deeper folders were not read`})]}),(0,I.jsxs)(`div`,{className:`search-field`,children:[(0,I.jsx)(s,{name:`search`,size:17,stroke:1.7}),(0,I.jsx)(`input`,{"aria-label":`Filter these files`,placeholder:`Filter…`,value:a,onChange:e=>o(e.target.value)})]})]}),t.problem&&(0,I.jsxs)(`div`,{className:`inline-error`,role:`alert`,children:[(0,I.jsx)(`p`,{children:t.problem}),(0,I.jsx)(`button`,{onClick:t.refresh,children:`Try again`})]}),d===0&&t.readAt>0?(0,I.jsx)(`div`,{className:`empty-state compact`,children:(0,I.jsx)(`p`,{children:Z[e]})}):f.length>0?(0,I.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,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{className:`source-row`,onClick:()=>i(e,t),children:[(0,I.jsx)(`span`,{className:`file-symbol`,children:(0,I.jsx)(s,{name:y(t),size:18,stroke:1.6})}),(0,I.jsxs)(`span`,{className:`source-name`,children:[(0,I.jsx)(`strong`,{children:t.name}),(0,I.jsxs)(`small`,{children:[t.folder,n?.run?` · from `+n.run.operationId:``]})]}),(0,I.jsx)(`span`,{className:`source-meta`,children:t.resource?n?.run?_e(n.run.integrity):`Result`:t.bytes===null?``:de(t.bytes)})]})},t.key)})}):d>0?(0,I.jsxs)(`div`,{className:`empty-state compact`,children:[(0,I.jsx)(`p`,{children:`No files match your filter.`}),(0,I.jsx)(`button`,{onClick:()=>o(``),children:`Clear filter`})]}):null]})}export{X as ProjectOverview};
|
|
@@ -1 +0,0 @@
|
|
|
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-BXhC8RDZ.js";import{ct as o,it as s,nt as c,tt as l,u,ut as d}from"./index-BYuKpyoi.js";import{t as f}from"./explore-in-muWXOGOY.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:o(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&&(l(n.path)||s(n.path))&&(0,m.jsx)(f,{languages:l(n.path)?[`r`,`python`]:[s(n.path)],title:e=>l(n.path)?`Open ${n.name} in Studio with the Notebook beside it, loaded into the ${c[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,5 +0,0 @@
|
|
|
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,C as a,D as o,E as s,O as c,S as l,T as u,_ as d,b as f,d as p,g as m,h,k as g,m as _,v,w as y,x as b,y as x}from"./canvas-BXhC8RDZ.js";import{Jt as S,a as C,b as ee,c as w,d as te,f as T,ft as E,i as ne,it as re,l as ie,m as ae,n as oe,nt as se,o as ce,ot as le,p as ue,r as de,rt as fe,s as pe,t as me,tt as he,u as ge,y as _e,yt as ve}from"./index-BYuKpyoi.js";import{a as ye,i as be,t as xe}from"./console-e1P5qYQ5.js";import{a as Se,c as Ce,i as we,l as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./facts-BMO6V3-3.js";import{t as je}from"./snapshot-CAxBYPvV.js";import{t as Me}from"./explore-in-muWXOGOY.js";var D=e(n(),1),Ne=e(S(),1);function O(e){return e.at??e.after??null}var Pe=e=>e===null?null:Date.parse(e);function Fe(e=`following`){return{step:-1,time:null,attention:e,question:null,objects:{},order:[],views:[],active:null,agent:null,suggestions:[],escalations:[],digest:null,items:[],hidden:{catalog:0,rejected:0,retries:0},revealed:null,expanded:[],moves:[],lastMove:null,pending:null,away:null}}function Ie(e,t,n,r){e.presentationClock=r,We(e,t,{...n,seq:e.step+1})}function Le(e,t,n){Xe(e,t,{...n,at:e.step})}function Re(e,t){let n=e.time;e.presentationClock=t,e.time=new Date(t).toISOString(),F(e),e.time=n}function ze(e){for(let t of e.views)t.newer=et(e,t);let{lastMove:t,pending:n,away:r,presentationClock:i,...a}=e;return structuredClone(a)}function Be(e,t){return e.objects[t.id]||(e.objects[t.id]=t,e.order.push(t.id)),e.objects[t.id]}var k=(e,t,n)=>Be(e,{id:`source:`+t,kind:`source`,name:t,version:1,savedVersion:null,changedAt:n,touchedAt:n,hidden:0}),Ve=(e,t,n)=>Be(e,{id:`artifact:`+t,kind:`artifact`,name:t,versions:[],changedAt:n,touchedAt:n,hidden:0}),He=(e,t)=>e.views.find(e=>e.id===t),Ue=e=>e.openedBy===`person`||e.pinned,A=(e,t)=>He(e,t)??e.views.find(e=>e.object===t&&Ue(e))??e.views.find(e=>e.object===t),j=(e,t,n)=>{let r=He(e,e.active);return!!r&&r.object===t&&(n===null||r.run===n)};function M(e,t,n){let r=t;for(;He(e,r);)r+=`@`+n;return r}var N=(e,t,n,r,i)=>({id:M(e,t,n),object:t,run:n,openedBy:r,pinned:!1,preview:i,selection:[],newer:null});function We(e,t,n){e.step=n.seq,e.time=O(n)??e.time;let r=n.object?e.objects[n.object]:void 0;if(r&&(r.touchedAt=n.seq),n.outcome===`rejected`)return r?r.hidden++:e.hidden.rejected++,F(e);let i=n.effect;if(!i)return F(e);let a=t.principals[n.actor]?.kind===`agent`,o=(t,r)=>a?P(e,n,t,r):F(e);switch(i.kind){case`catalog`:return e.hidden.catalog++,F(e);case`open`:{if(i.source===null)return F(e);let t=!!e.objects[`source:`+i.source],r=k(e,i.source,n.seq);return r.version=i.version,t||(r.savedVersion=i.version),o(r.id,null)}case`edit`:{let t=k(e,i.source,n.seq);return t.version=i.version,t.changedAt=n.seq,o(t.id,null)}case`save`:{let t=k(e,i.source,n.seq);return t.savedVersion=i.version,t.changedAt=n.seq,o(t.id,null)}case`source-state`:{let t=k(e,i.source,n.seq);return t.version=i.version,t.savedVersion=i.savedVersion,t.changedAt=n.seq,F(e)}case`submit`:if(i.sourceVersion!==null&&!e.objects[`source:`+i.source]){let t=k(e,i.source,n.seq);t.version=t.savedVersion=i.sourceVersion}return Be(e,{id:`run:`+i.run,kind:`run`,name:`Run `+i.run,run:i.run,source:i.source,sourceVersion:i.sourceVersion,state:i.state??`running`,exit:null,firstLine:null,verified:[],changedAt:n.seq,touchedAt:n.seq,hidden:0}),o(`run:`+i.run,null);case`retry`:{let t=e.objects[`run:`+i.run];return t&&t.hidden++,e.hidden.retries++,F(e)}case`run-state`:case`ended`:{let t=e.objects[`run:`+i.run];return t?(i.kind===`ended`?(t.exit=i.exit,t.state=i.state??(i.exit===0?`completed`:i.exit===null?`unknown`:`failed`)):t.state=i.state,t.changedAt=n.seq,(t.state===`failed`||t.state===`unknown`)&&Ye(e,t,n.seq),t.state===`completed`&&(e.escalations=e.escalations.filter(n=>{let r=e.objects[n.object];return!(r?.kind===`run`&&r.source===t.source&&r.run<t.run)})),o(t.id,null)):F(e)}case`observe`:return o(`run:`+i.run,null);case`output`:{let n=e.objects[`run:`+i.run],r=i.stream?t.runs[i.run]?.outputs[i.stream]??``:``;(i.stream===`stderr`||i.stream&&!n.firstLine)&&(n.firstLine=tt(r));let a=e.escalations.find(e=>e.object===n.id);return a&&n.firstLine&&(a.reason=n.firstLine),o(n.id,null)}case`verified`:{let r=e.objects[`run:`+i.run],a=t.runs[i.run]?.verified??[];if(!r)return F(e);r.verified=[...i.artifacts],r.changedAt=n.seq;for(let t of i.artifacts){let r=Ve(e,t,n.seq),o=a.find(e=>e.name===t)?.digest??`unknown`,s=r.versions.find(e=>e.digest===o);s?s.runs.includes(i.run)||s.runs.push(i.run):(r.versions.push({digest:o,runs:[i.run]}),r.changedAt=n.seq)}return o(r.id,null)}case`registered`:{let t=Ve(e,i.artifact,n.seq);t.name=i.name;let r=t.versions.find(e=>e.digest===i.version);return r?i.run!==null&&!r.runs.includes(i.run)&&r.runs.push(i.run):(t.versions.push({digest:i.version,runs:i.run===null?[]:[i.run]}),t.changedAt=n.seq),F(e)}case`read`:{if(i.artifact===null)return F(e);let t=Ve(e,i.artifact,n.seq);return t.touchedAt=n.seq,o(t.id,i.run)}case`layout`:return a?qe(e,n,i.views,i.replace):F(e);case`items`:return i.question!==null&&(e.question=i.question),i.items&&(e.items=i.items),F(e);case`ask`:return Be(e,{id:i.question,kind:`question`,name:i.text,author:n.actor,target:i.target,version:i.version,run:i.run,rows:[...i.rows],document:i.document,state:`prepared`,fetchedBy:null,fetchedAt:null,changedAt:n.seq,touchedAt:n.seq,hidden:0}),F(e);case`fetched`:{let t=e.objects[i.question];return t?.kind===`question`&&(t.state!==`responded`&&(t.state=`fetched`),t.fetchedBy=n.actor,t.fetchedAt=n.seq,t.changedAt=n.seq),F(e)}case`responded`:{let t=e.objects[i.question];return t?.kind===`question`&&(t.state=`responded`,t.changedAt=n.seq),F(e)}}}function P(e,t,n,r){e.attention===`following`?j(e,n,r)?(e.agent={object:n,run:r,seq:t.seq,placement:`main`},e.pending=null):I(e,t)?(e.pending={kind:`focus`,object:n,run:r},e.agent={object:n,run:r,seq:t.seq,placement:`pending`}):(e.pending=null,Ke(e,n,r,`agent`),e.agent={object:n,run:r,seq:t.seq,placement:`main`},Ge(e,t,`agent`,`agent-focus`)):e.agent={object:n,run:r,seq:t.seq,placement:`marker`}}function F(e){if(!e.pending||e.attention!==`following`)return;let t={seq:e.step,at:e.time};if(I(e,t))return;let n=e.pending;e.pending=null,n.kind===`focus`?(Ke(e,n.object,n.run,`agent`),e.agent&&(e.agent.placement=`main`),Ge(e,t,`agent`,`agent-focus`)):Je(e,t,n.views,n.replace)}function I(e,t){let n=e.presentationClock??Pe(O(t))??Pe(e.time);return e.lastMove!==null&&n!==null&&n-e.lastMove<8e3}function Ge(e,t,n,r){n===`agent`&&(e.lastMove=e.presentationClock??Pe(O(t))??Pe(e.time)??e.lastMove),e.moves.push({seq:t.seq,by:n,view:e.active,rule:r})}function Ke(e,t,n,r,i){let a=e.views.filter(e=>e.object===t),o=r===`person`?A(e,t):a.find(e=>(n===null||e.run===n)&&(!i||e.version===i))??a.find(e=>!Ue(e));if(o&&r===`agent`&&n!==null&&(o.run=n),!o){o=N(e,t,n,r,r===`agent`);let i=r===`agent`?e.views.findIndex(e=>e.preview):-1;i>=0?e.views[i]=o:e.views.push(o)}r===`person`&&(o.preview=!1,o.openedBy=`person`),i&&(o.version=i),e.active=o.id}function qe(e,t,n,r){let i=e.views.some(t=>t.pinned&&t.id===e.active);if(e.attention===`following`&&!i){if(I(e,t)){e.pending={kind:`layout`,views:n,replace:r};return}return Je(e,t,n,r)}let a=e.attention===`away`?`away`:i?`pinned`:`working`,o=e.suggestions.find(e=>e.id.startsWith(`layout`));o?(o.views=n,o.merged++,o.cause=a):e.suggestions.push({id:`layout:`+t.seq,views:n,cause:a,from:t.seq,merged:0})}function Je(e,t,n,r,i=`agent`){r&&(e.views=e.views.filter(Ue));let a=null;for(let t of n){let n=t.object??`artifact:`+t.artifact,r=e.views.filter(e=>e.object===n),o=r.find(e=>e.run===t.run&&(!t.version||e.version===t.version))??r.find(e=>!Ue(e));o?(o.run=t.run,o.preview=!1):e.views.push(o=N(e,n,t.run,i,!1)),t.version&&(o.version=t.version),a??=o.id}e.active=a??e.active,Ge(e,t,i===`agent`?`agent`:`person`,i===`agent`?`agent-layout`:`accept`)}function Ye(e,t,n){if(e.attention!==`working`||Object.values(e.objects).some(e=>e.kind===`run`&&e.source===t.source&&e.run>t.run&&e.state===`completed`))return;let r=e.objects[He(e,e.active)?.object??``];r&&(r.id===t.id||r.id===`source:`+t.source||r.kind===`run`&&r.source===t.source||r.kind===`artifact`&&r.versions.some(n=>n.runs.some(n=>e.objects[`run:`+n]?.source===t.source)))&&!e.escalations.some(e=>e.object===t.id)&&e.escalations.push({object:t.id,reason:t.state===`unknown`?`Outcome unknown`:t.exit===null?`Execution failed`:`Exit `+t.exit,from:n})}function Xe(e,t,n){let r={seq:Math.max(n.at,-1),at:e.time},i=()=>{e.attention===`following`&&(e.attention=`working`)};switch(n.kind){case`follow`:e.attention=`following`,e.agent&&!j(e,e.agent.object,e.agent.run)&&(Ke(e,e.agent.object,e.agent.run,`agent`),e.moves.push({seq:r.seq,by:`person`,view:e.active,rule:`catch-up`})),e.agent&&(e.agent.placement=`main`),e.pending=null;return;case`unfollow`:e.attention=`working`;return;case`open`:{if(i(),n.version!==void 0||n.run!==void 0){let t=e.views.find(e=>e.object===n.target&&e.run===(n.run??null)&&(!n.version||e.version===n.version));t||(t=N(e,n.target,n.run??null,`person`,!1),e.views.push(t)),n.version&&(t.version=n.version),t.openedBy=`person`,t.preview=!1,e.active=t.id,e.escalations=e.escalations.filter(e=>e.object!==n.target),e.moves.push({seq:r.seq,by:`person`,view:e.active,rule:`person`});return}let t=e.objects[n.target],a=e.items.find(e=>`item:`+e.id===n.target),o=t?.kind===`question`?{object:t.target,version:t.version,run:t.run}:a?.artifact;if(o){let t=e.views.find(t=>t.object===o.object&&(t.version??Qe(e,o.object,t.run))===o.version);if(t)t.preview=!1,t.openedBy=`person`,e.active=t.id;else{let t=N(e,o.object,o.run,`person`,!1);t.version=o.version,e.views.push(t),e.active=t.id}e.moves.push({seq:r.seq,by:`person`,view:e.active,rule:`person`});return}let s=A(e,n.target),c=s?.object??n.target;s?(s.preview=!1,s.openedBy=`person`,e.active=s.id):Ke(e,c,c.startsWith(`artifact:`)?$e(e,c):null,`person`),e.escalations=e.escalations.filter(e=>e.object!==c),e.moves.push({seq:r.seq,by:`person`,view:e.active,rule:`person`});return}case`select`:{i();let t=A(e,n.target);t&&(t.selection=[...n.rows],t.preview=!1,t.openedBy=`person`);return}case`type`:i();return;case`close`:{let t=A(e,n.target);e.views=e.views.filter(e=>e!==t),t&&e.active===t.id&&(e.active=e.views.at(-1)?.id??null);return}case`pin`:case`unpin`:{let t=A(e,n.target);t&&(t.pinned=n.kind===`pin`,t.preview=!1,t.openedBy=`person`);return}case`update`:{i();let t=A(e,n.target),a=t?et(e,t):null;if(!t||a===null)return;t.run=a,t.version&&=Qe(e,t.object,a)??void 0,e.views=e.views.filter(e=>e===t||e.pinned||e.object!==t.object||e.run!==a),e.active=t.id,e.moves.push({seq:r.seq,by:`person`,view:e.active,rule:`person`});return}case`leave`:if(e.attention===`away`)return;e.pending=null,e.away={from:e.step,prior:e.attention,baseline:structuredClone(e.objects),suggestions:e.suggestions.map(e=>e.id),items:JSON.stringify(e.items)},e.attention=`away`;return;case`return`:{if(!e.away)return;let t=Ze(e,e.away);e.digest=t.length?{from:e.away.from,to:e.step,lines:t}:null,e.attention=e.away.prior,e.away=null;return}case`accept`:{let t=e.suggestions.find(e=>e.id===n.suggestion);if(!t)return;e.suggestions=e.suggestions.filter(e=>e!==t),Je(e,r,t.views,!1,`person`);return}case`ask`:{i();let t=A(e,n.target),a=t?Qe(e,t.object,t.run):null;if(!t||a===null||t.run===null)return;Be(e,{id:`question:asked-`+(e.order.filter(e=>e.startsWith(`question:asked-`)).length+1),kind:`question`,name:n.text,author:null,target:t.object,version:a,run:t.run,rows:[...n.rows],document:null,state:`prepared`,fetchedBy:null,fetchedAt:null,changedAt:r.seq,touchedAt:r.seq,hidden:0});return}case`dismiss`:e.suggestions=e.suggestions.filter(e=>e.id!==n.suggestion);return;case`dismiss-digest`:e.digest=null;return;case`reveal`:e.revealed=n.target;return;case`expand`:e.expanded.includes(n.target)||e.expanded.push(n.target);return;case`collapse`:e.expanded=e.expanded.filter(e=>e!==n.target);return}}function Ze(e,t){let n=[],r={source:0,run:1,artifact:2,question:3};for(let i of[...e.order].sort((t,n)=>r[e.objects[t].kind]-r[e.objects[n].kind])){let r=e.objects[i],a=t.baseline[i];if(r.kind===`source`&&(!a||a.version!==r.version)&&n.push({kind:`source`,object:i,from:a?a.version:null,to:r.version}),r.kind===`run`&&(!a||a.state!==r.state||a.verified.length!==r.verified.length)){let t={kind:`run`,object:i,state:r.state,firstLine:r.state===`completed`?null:r.firstLine,verified:r.verified.length,earlier:[]},a=n.findIndex(t=>t.kind===`run`&&e.objects[t.object].source===r.source);if(a<0)n.push(t);else{let e=n[a];t.earlier=[...e.earlier,e.object],n[a]=t}}r.kind===`artifact`&&r.versions.length!==(a?.versions.length??0)&&n.push({kind:`artifact`,object:i,versions:r.versions.length-(a?.versions.length??0)}),r.kind===`question`&&(!a||a.state!==r.state)&&n.push({kind:`question`,object:i,state:r.state})}for(let r of e.suggestions)t.suggestions.includes(r.id)||n.push({kind:`suggestion`,id:r.id});return JSON.stringify(e.items)!==t.items&&n.push({kind:`items`,count:e.items.length}),n}var Qe=(e,t,n)=>{let r=e.objects[t];return r?.kind===`artifact`&&n!==null?r.versions.find(e=>e.runs.includes(n))?.digest??null:null},$e=(e,t)=>e.objects[t]?.versions.at(-1)?.runs.at(-1)??null;function et(e,t){let n=e.objects[t.object];if(n?.kind!==`artifact`||t.run===null||!Ue(t))return null;let r=n.versions.findIndex(e=>e.runs.includes(t.run));return r>=0&&r<n.versions.length-1?$e(e,t.object):null}function tt(e){return e.split(`
|
|
2
|
-
`).map(e=>e.trim()).find(Boolean)??null}var L=()=>({activity:0,runs:[],states:{},documents:{},resources:{},composition:0,questions:{}}),nt=e=>e.split(`/`).at(-1)??e;function rt(e,t,n,r,i){let a={format:`rho.replay-trace/1`,recorded:{experiment:`live`,project:e.project.id,from:``,to:``},facts:[],principals:{},sources:{},runs:{},artifacts:{}},o={},s={},c=(e,t,n,r,i,o)=>{a.principals[t]={kind:t.startsWith(`agent:`)?`agent`:t.startsWith(`browser:`)?`browser`:`operator`,name:null},a.facts.push({seq:a.facts.length,label:e,op:e,actor:t,at:n,effect:r,object:i,outcome:o?`rejected`:`returned`,...o?{reason:o}:{}})},l=e=>{let t=r.runs.indexOf(e);return t<0?null:t+1},u=new Set;for(let e of[...t].sort((e,t)=>e.acceptedAt.localeCompare(t.acceptedAt))){r.runs.includes(e.operationId)||r.runs.push(e.operationId);let t=l(e.operationId),n=e.sourceKey??e.operationId;o[`run:`+t]=e.operationId,a.runs[t]={operationId:e.operationId,source:n,sourceVersion:null,declared:e.declared.map(e=>e.path),acceptedAt:e.acceptedAt,exit:null,observedAt:null,outputs:{}};let i=JSON.stringify([e.execution,e.integrity]);r.states[e.operationId]!==i&&u.add(e.operationId),e.operationId in r.states||c(`action.accepted`,`operator`,e.acceptedAt,{kind:`submit`,run:t,source:n,sourceVersion:null,state:`unobserved`},`run:`+t),r.states[e.operationId]!==i&&c(`operation.observed`,`operator`,null,{kind:`run-state`,run:t,state:e.execution===`active`?`running`:[`completed`,`failed`,`unobserved`].includes(e.execution)?e.execution:`unknown`},`run:`+t),r.states[e.operationId]=i}for(let t of e.documents){let e=`source:`+t.path;o[e]=t.path,a.sources[t.path]={versions:{},edited:{},saved:{},authors:{}};let n=JSON.stringify([t.version,t.dirty]);r.documents[t.id]!==n&&(c(`document.observed`,`operator`,t.acknowledgedAt,{kind:`source-state`,source:t.path,version:t.version,savedVersion:t.dirty?null:t.version},e),r.documents[t.id]=n),s[`document:`+t.id]={object:e,artifact:``,run:null}}for(let n of e.resources){let e=n.provenance,i=t.find(t=>t.operationId===e.operationId),u=i?.declared.find(e=>n.path===e.path||n.path.endsWith(`/`+e.path)),d=r.resources[n.id],f=`@`+n.version,p=i?.sourceKey&&u?i.sourceKey+`/`+u.path:d?.endsWith(f)?d.slice(0,-f.length):n.id,m=`artifact:`+p,h=e.operationId?l(e.operationId):null,g={artifact:p,run:h,version:n.version};s[n.id+`@`+n.version]=g,o[m]=nt(n.path);let _=(a.artifacts[p]??={kind:n.kind,versions:{}}).versions,v=_[n.version]??={runs:[],bytes:n.bytes};h!==null&&v.runs.push(h),r.resources[n.id]!==p+`@`+n.version&&(c(`resource.registered`,`operator`,null,{kind:`registered`,artifact:p,name:nt(n.path),version:n.version,run:h},m),r.resources[n.id]=p+`@`+n.version)}for(let n of t)if(n.integrity===`verified`&&u.has(n.operationId)){let t=l(n.operationId),r=e.resources.filter(e=>e.provenance.operationId===n.operationId);a.runs[t].verified=r.map(e=>({name:s[e.id+`@`+e.version].artifact,digest:e.version,kind:e.kind})),c(`artifact.integrity.observed`,`operator`,null,{kind:`verified`,run:t,artifacts:a.runs[t].verified.map(e=>e.name)},`run:`+t)}for(let e of n.views){let t=at(e,s);t&&(s[`view:`+e.id]=t)}let d=e.activity.retainedFrom>r.activity+1;for(let t of e.activity.entries){let n=t;if(n.cursor<=r.activity)continue;let i=e.documents.find(e=>e.id===n.documentId),a=typeof n.operationId==`string`?l(n.operationId):null,o=n.resource,u=o?s[o.id+`@`+o.version]:void 0,d,f;i&&(f=`source:`+i.path),a!==null&&(f=`run:`+a),u&&(f=u.object??`artifact:`+u.artifact),n.outcome===`rejected`?c(n.method,n.principal,n.at,void 0,f,{kind:typeof n.errorKind==`string`?n.errorKind:`unrecorded`,message:null}):([`capability.index`,`capability.resolve`].includes(n.method)&&(d={kind:`catalog`}),i&&typeof n.returnedVersion==`number`&&[`document.open`,`document.read`,`document.edit`,`document.save`].includes(n.method)&&(d={kind:`open`,source:i.path,version:i.version}),a!==null&&[`action.submit`,`action.lookup`,`action.observe`,`artifact.check`,`action.output`].includes(n.method)&&(d={kind:`observe`,run:a}),n.method===`data.page`&&(d={kind:`read`,artifact:u?.artifact??null,run:u?.run??null}),c(n.method,n.principal,n.at,d,f))}if(r.activity=Math.max(r.activity,e.activity.cursor),n.version!==r.composition){let e=n.views.flatMap(e=>s[`view:`+e.id]?[s[`view:`+e.id]]:[]);c(`composition.observed`,n.author??`operator`,n.acknowledgedAt??null,{kind:`layout`,replace:!0,views:e},`layout`),r.composition=n.version}for(let t of e.annotations){let n=t,i=n.messages?.[0],a=n.anchor;if(a?.kind!==`table`||!i)continue;let o=s[a.resource.id+`@`+a.resource.version];if(!o)continue;let l=`question:`+n.annotationId,u=e.contexts.find(e=>e.responses?.some(e=>e.annotationId===n.annotationId)),d=n.messages.some(e=>e.replyTo===i.id&&e.author.startsWith(`agent:`)),f=u?.delivery===`tool-fetched`&&u.fetchedBy?.startsWith(`agent:`),p=d?`responded`:f?`fetched`:`prepared`;if(l in r.questions||c(`annotation.create`,i.author,i.at,{kind:`ask`,question:l,text:i.draft.text,target:`artifact:`+o.artifact,version:a.resource.version,run:o.run,rows:a.entities,document:null},l),r.questions[l]!==p){if(f&&c(`context.read`,u.fetchedBy,u.fetchedAt,{kind:`fetched`,question:l},l),d){let e=n.messages.find(e=>e.replyTo===i.id&&e.author.startsWith(`agent:`));c(`annotation.reply`,e.author,e.at,{kind:`responded`,question:l},l)}r.questions[l]=p}}if(i){let e=i.items.map(e=>it(e,i.vocabulary,s)),t=JSON.stringify([i.question,e]);if(r.items!==t){let n=i.items.reduce((e,t)=>!e||t.at>e.at?t:e,void 0);c(`task.map.observed`,n?.author??`operator`,n?.at??null,{kind:`items`,question:i.question,items:e},`map`),r.items=t}}return{trace:a,refs:s,names:o,gap:d}}function it(e,t,n){let r=e.artifact&&n[e.artifact.id+`@`+e.artifact.version];return{id:e.id,kind:t.kinds[e.kind]?.label??e.kind,state:t.states[e.state]?.label??e.state,title:e.title,author:e.author,...e.summary?{summary:e.summary}:{},...e.view?{view:e.view}:{},...e.from?{from:e.from}:{},...e.lines?{lines:e.lines}:{},...r&&r.run!==null?{artifact:{object:r.object??`artifact:`+r.artifact,version:e.artifact.version,run:r.run}}:{}}}function at(e,t){for(let n of Object.values(e.bindings??{})){let e=n.documentId?t[`document:`+n.documentId]:t[n.id+`@`+n.version];if(e)return e}}var R={maxViews:64,maxEvidence:256,maxCheckpointBytes:1048576},ot=e=>e.object??`artifact:`+e.artifact,st=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function ct(e){let t=e.catalog?.components.find(e=>e.id===`rho.editor`),n=t?e.documents.map(e=>({id:`source:`+e.id,component:t.id,version:t.version,props:{title:e.path},bindings:{document:{kind:`live-document`,documentId:e.id}}})):[];for(let t of e.resources){let r=e.catalog?.components.find(e=>e.id===(t.kind===`table`?`rho.table`:t.kind===`media`?`rho.media`:``));if(!r)continue;let i=Object.keys(r.bindings)[0];i&&n.push({id:`object:`+t.id.slice(0,32)+`:`+t.version.slice(0,32),component:r.id,version:r.version,props:{title:t.path.split(`/`).at(-1)},bindings:{[i]:{id:t.id,version:t.version}}})}return n}function z(e,t,n,r){let i=L(),a=rt(e,t,n,i,r),o=Fe(`working`);for(let e of a.trace.facts)Ie(o,a.trace,e);return o.attention=`following`,o.suggestions=[],o.moves=[],o.views=n.views.flatMap(e=>{let t=at(e,a.refs);return t?[{id:e.id,object:ot(t),run:t.run,...t.version?{version:t.version}:{},openedBy:`agent`,pinned:!!e.protected,preview:!1,selection:[],newer:null}]:[]}),o.active=o.views[0]?.id??null,{format:1,expression:o,index:i,layout:structuredClone(n),latest:structuredClone(n),held:{},refs:a.refs,available:ct(e),trace:a.trace,evidence:a.trace.facts.slice(-R.maxEvidence),gap:a.gap,limit:``,active:n.views[0]?.id??``,names:a.names}}function B(e){let t=structuredClone(e.latest),n=new Map;for(let r of t.views){let i=e.held[r.id];i&&!st(i.bindings,r.bindings)&&n.set(r.id,`new:`+r.id.slice(0,70)+`:`+t.version)}t.views=t.views.map(e=>({...e,id:n.get(e.id)??e.id})),t.nodes&&=t.nodes.map(e=>e.kind===`view`?{...e,id:n.get(e.id)??e.id}:{...e,children:e.children.map(e=>n.get(e)??e)});for(let n of Object.values(e.held))if(!t.views.some(e=>e.id===n.id)){t.views.push(n);let e=t.nodes?.find(e=>e.kind===`group`&&e.id===t.rootId);e?.kind===`group`&&(e.children.push(n.id),e.presentation?.weights&&e.presentation.weights.push(1),t.nodes.push({...n,kind:`view`}))}t.views.length>R.maxViews?e.limit=`The 64-view presentation limit was reached. Existing views are kept; close or unpin views before accepting another layout.`:(e.layout=t,e.preview=void 0)}function V(e,t){let n=e.expression.moves.slice(t);n.some(e=>e.rule===`agent-layout`||e.rule===`accept`)&&B(e);let r=e.expression.views.find(t=>t.id===e.expression.active);if(!r||!n.length)return;let i=[...e.layout.views,...e.latest.views,...e.available??[]].find(t=>{let n=at(t,e.refs);return n&&ot(n)===r.object&&(r.run===null||n.run===r.run)&&(!r.version||n.version===r.version)});if(i){let t=i.id,n=e.layout.views.find(e=>e.id===t);if(n&&!st(n.bindings,i.bindings)&&(t=`preview:`+t.slice(0,70)+`:`+e.latest.version),!e.layout.views.some(e=>e.id===t)){if(e.layout.views.length>=R.maxViews){e.limit=`The 64-view presentation limit was reached; the new object remains in recorded evidence.`;return}let n=e.layout.views.filter(t=>t.id!==e.preview||e.held[t.id]);e.layout={...e.layout,views:[...n,{...i,id:t}]},r.preview&&(e.preview=t)}e.active=t}else if(r.object.startsWith(`run:`)){let t=e.names[r.object];if(!t)return;let n=`execution:`+t;!e.layout.views.some(e=>e.id===n)&&e.layout.views.length<R.maxViews&&(e.layout={...e.layout,views:[...e.layout.views.filter(t=>t.component!==`rho.execution`&&t.id!==e.preview||e.held[t.id]),{id:n,component:`rho.execution`,version:`1`,props:{title:t,operationId:t},bindings:{}}]},e.preview=n),e.layout.views.some(e=>e.id===n)&&(e.active=n)}}function lt(e,t,n,r,i,a){let o=rt(t,n,r,e.index,a),s=e.expression.moves.length;e.latest=structuredClone(r),e.refs=o.refs,e.names=o.names,e.trace=o.trace,e.available=ct(t),e.gap||=o.gap;for(let t of o.trace.facts)Ie(e.expression,o.trace,t,i);e.evidence.push(...o.trace.facts),e.evidence=e.evidence.slice(-R.maxEvidence),V(e,s),!r.author?.startsWith(`agent:`)&&e.layout.version!==r.version&&B(e),e.expression.moves=e.expression.moves.slice(-32)}function H(e,t){let n=e.expression.moves.length;Le(e.expression,e.trace,t),V(e,n)}function U(e,t){delete e.held[t]}function ut(e,t){let n=e.layout.views.find(e=>e.id===t);if(!n)return;e.held[t]=structuredClone(n),e.active=t;let r=at(n,e.refs);H(e,r?{kind:`open`,target:ot(r),run:r.run,version:r.version}:{kind:`unfollow`}),e.active=t}function dt(e,t){let n=e.expression.moves.length;Re(e.expression,t),V(e,n)}function ft(e){return ze(e.expression)}function pt(e,t,n,r,i=!1){let{runs:a,problem:o,readAgain:s}=Ce(n,e.project.id,e.cursor),c=e.catalog.operations.some(e=>e.method===`task.map.read`&&e.authorized&&e.state===`available`),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(``);(0,D.useEffect)(()=>{if(!c)return;let t=!0;return n.call(`task.map.read`,{projectId:e.project.id}).then(e=>{t&&(u(e),f(``))},e=>{t&&f(`The Agent's declared items could not be read. `+(e?.message??``))}),()=>{t=!1}},[n,e.project.id,e.cursor,c]);let p=[`rho-expression/1`,e.project.id,t.compositionId,r].join(`:`),m=(0,D.useRef)(null),h=(0,D.useRef)(!1),g=(0,D.useRef)(null),_=(0,D.useRef)(`owners`),[,v]=(0,D.useState)(0),[y,b]=(0,D.useState)(``),x=()=>{if(m.current&&sessionStorage.getItem(`rho.browser.session.v1`))try{let e=JSON.stringify(m.current);if(new TextEncoder().encode(e).length>R.maxCheckpointBytes)throw Error(`The 1 MiB return checkpoint limit was reached. Current views are retained in this tab; reload cannot restore the latest attention state.`);sessionStorage.setItem(p,e)}catch(e){b(e.message??`The return checkpoint could not be stored.`)}};(0,D.useEffect)(()=>{if(a){if(m.current){let n=m.current.active;lt(m.current,e,a,t,Date.now(),l),m.current.active!==n&&(_.current=`owners`)}else{try{let e=sessionStorage.getItem(p);if(e&&e.length<=R.maxCheckpointBytes){let n=JSON.parse(e);n.format===1&&n.layout?.compositionId===t.compositionId&&(m.current=n)}}catch{}m.current?(lt(m.current,e,a,t,Date.now(),l),H(m.current,{kind:`return`})):m.current=z(e,a,t,l),h.current&&ut(m.current,g.current&&m.current.layout.views.some(e=>e.id===g.current)?g.current:m.current.active),document.hidden&&H(m.current,{kind:`leave`})}i&&(m.current.layout=structuredClone(t),m.current.held={}),x(),v(e=>e+1)}},[e,t,a,l]),(0,D.useEffect)(()=>{let e=()=>{m.current&&(H(m.current,{kind:document.hidden?`leave`:`return`}),x(),v(e=>e+1))},t=()=>{m.current&&(H(m.current,{kind:`leave`}),x())},n=setInterval(()=>{if(m.current?.expression.pending){let e=m.current.active;dt(m.current,Date.now()),m.current.active!==e&&(_.current=`owners`),x(),v(e=>e+1)}},1e3);return document.addEventListener(`visibilitychange`,e),window.addEventListener(`pagehide`,t),()=>{t(),clearInterval(n),document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`pagehide`,t)}},[p]);let S=e=>{_.current=`person`,m.current&&(e.kind===`unfollow`&&ut(m.current,m.current.active),H(m.current,e),x(),v(e=>e+1))},C=e=>{h.current=!0,g.current=e,_.current=`person`,m.current&&(ut(m.current,e),x(),v(e=>e+1))};return{state:m.current,screen:m.current?ft(m.current):null,layout:m.current?.layout??t,active:m.current?.active,movedBy:_.current,runs:a,readRuns:s,map:l,act:S,release:e=>{m.current&&(U(m.current,e),x())},hold:C,openResource:t=>{if(!m.current)return;let n=e.resources.find(e=>e.id===t.id&&e.version===t.version),r=e.compositions.flatMap(e=>e.views).find(e=>Object.values(e.bindings).some(e=>`id`in e&&e.id===t.id&&e.version===t.version)),i=e.catalog.components.find(e=>e.id===(n?.kind===`table`?`rho.table`:`rho.media`)),a=i&&Object.keys(i.bindings)[0];if(!n||!r&&(!i||!a)){b(`The linked result has no available resource viewer. Its exact reference is retained in the reply.`);return}let o=`result:`+t.id.slice(0,32)+`:`+t.version.slice(0,32);if(!m.current.layout.views.some(e=>e.id===o)){if(m.current.layout.views.length>=R.maxViews){b(`The 64-view limit was reached. The reply and linked result are retained.`);return}let e=r?{...r,id:o}:{id:o,component:i.id,version:i.version,props:{title:n.path.split(`/`).at(-1)},bindings:{[a]:t}};m.current.layout={...m.current.layout,views:[...m.current.layout.views,e]}}C(o)},problem:[o,d,y,m.current?.limit].filter(Boolean).join(` · `)}}var W=t();function mt(e){let t=n=>{let r=e.screen?.objects[n];return r?.kind===`question`?`Question about `+t(r.target):e.state?.names[n]??r?.name??n};return t}var ht={running:`running`,completed:`completed`,failed:`failed`,unknown:`outcome unknown`,unobserved:`accepted, not seen running yet`},G={prepared:`prepared, not fetched`,fetched:`fetched by the Agent`,responded:`answered by the Agent`};function K(e){return e?e.kind===`run`?ht[e.state]??e.state:e.kind===`source`?e.savedVersion!==null&&e.savedVersion!==e.version?`version ${e.version}, unsaved`:`version ${e.version}`:e.kind===`artifact`?e.versions.length===1?`1 version`:`${e.versions.length} versions`:G[e.state]??e.state:``}var q=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),gt=e=>new Date(e).toLocaleDateString([],{month:`short`,day:`numeric`}),J=(e,t)=>new Date(e).toDateString()===new Date(t).toDateString(),Y=e=>{let t=Math.max(0,Math.round(e/1e3));return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`},_t=e=>(J(e,new Date().toISOString())?``:gt(e)+` `)+q(e);function X({live:e,who:t=!0}){let n=e.screen,r=n.agent,i=mt(e);return r?(0,W.jsxs)(`button`,{className:`shell-agent`,"data-rho-agent":``,title:`The Agent's latest object: ${i(r.object)}`,onClick:()=>e.act({kind:`open`,target:r.object}),children:[(0,W.jsx)(`span`,{className:t?`shell-agent-who`:`visually-hidden`,children:`Agent`}),` `,(0,W.jsx)(`span`,{className:`shell-agent-object`,children:i(r.object)}),` `,(0,W.jsxs)(`span`,{className:`shell-agent-state`,children:[K(n.objects[r.object]),r.placement===`pending`?` · shows when you pause`:``]})]}):null}function vt({live:e,evidence:t,onEvidence:n,held:i,attention:a=!0}){let{screen:o,act:s}=e;if(!o||!e.state)return(0,W.jsx)(`div`,{className:`shell-bar`,role:`status`,children:`Reading workspace…`});let c=o.attention===`following`;return(0,W.jsxs)(`div`,{className:`shell-bar`,"data-attention":o.attention,children:[(0,W.jsx)(X,{live:e}),(0,W.jsx)(`span`,{className:`shell-break`}),i>0&&(0,W.jsxs)(`span`,{className:`shell-held`,role:`status`,children:[i,` updates`]}),a&&(0,W.jsxs)(`button`,{className:`shell-follow`,"aria-pressed":c,title:`Follow the Agent's current view. Your input stops following.`,onClick:()=>s({kind:c?`unfollow`:`follow`}),children:[(0,W.jsx)(r,{name:`eye`,size:14}),c?`Following Agent`:`Follow Agent`]}),a&&(0,W.jsx)(`button`,{className:`shell-quiet`,onClick:()=>s({kind:o.attention===`away`?`return`:`leave`}),children:o.attention===`away`?`Return`:`Step away`}),(0,W.jsxs)(`button`,{className:`shell-quiet shell-evidence-toggle`,"aria-expanded":t,title:`Activity: the calls recorded for this workspace`,onClick:n,children:[(0,W.jsx)(r,{name:`list`,size:15}),(0,W.jsx)(`span`,{children:`Activity`})]})]})}function Z(e,t){let n=e.map?.items.find(e=>e.id===t);return n?e.map.vocabulary.states[n.state]?.role??``:``}var Q={prepared:`Prepared · not fetched by the Agent`,fetched:`Fetched by the Agent · no linked response yet`,responded:`Answered by the Agent`};function yt({contextId:e,prepare:t}){let[n,r]=(0,D.useState)(!1),[i,a]=(0,D.useState)(``);async function o(){a(``);try{let n=e??await t();await navigator.clipboard.writeText(`Answer my question in Rho: read context ${n}. It holds the table version, the rows I asked about and my question. Reply to it with annotation.reply, and link any new result you make.`),r(!0)}catch{a(`Could not copy. Try again.`)}}return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{className:`agent-question-copy`,onClick:o,children:n?`Copied`:`Copy request for the Agent`}),i&&(0,W.jsx)(`span`,{role:`alert`,children:i})]})}function bt({live:e,agents:t,contexts:n=[],prepare:i,principalId:a,evidence:o,onEvidence:s,focusObject:c,onClose:l}){let u=(0,D.useRef)(null),d=(0,D.useRef)(null);(0,D.useEffect)(()=>{o&&u.current?.scrollIntoView({block:`start`})},[o]),(0,D.useEffect)(()=>{l&&d.current?.focus()},[!!l]);let f=e.screen,p=e.state,m=mt(e),h=Object.values(f?.objects??{}).find(e=>e.kind===`run`&&e.state===`running`),[g,_]=(0,D.useState)(Date.now()),[v,y]=(0,D.useState)(!1);if((0,D.useEffect)(()=>{if(!h)return;let e=setInterval(()=>_(Date.now()),1e3);return()=>clearInterval(e)},[!!h]),!f||!p)return null;let b=[...t??[]].sort((e,t)=>(e.last?.at??``).localeCompare(t.last?.at??``)).at(-1),x=b?.label||Object.values(p.trace.principals).find(e=>e.kind===`agent`&&e.name)?.name||`The Agent`,S=b?.last?.at,C=h&&e.runs?.find(e=>e.operationId===m(h.id)&&e.execution===`active`),ee=C?C.startedAt??C.acceptedAt:void 0,w=Object.values(f.objects).filter(e=>e.kind===`question`).reverse(),te=f.items.find(e=>c&&e.artifact?.object===c)??f.items.find(t=>Z(e,t.id)===`working`),T=te?.artifact&&Object.values(f.objects).find(e=>e.kind===`run`&&e.run===te.artifact.run),E=T?e.runs?.find(e=>e.operationId===m(T.id)):void 0,ne=e=>E?.sourceKey?Object.values(p.refs).find(t=>t.artifact===E.sourceKey+`/`+e&&t.run===T?.run):void 0,re=v?w:w.slice(0,1);return!h&&!f.items.length&&!E?.declared.length&&!w.length&&!o?null:(0,W.jsxs)(`aside`,{ref:d,className:`agent-column`+(l?` drawer`:``),"aria-label":x,"data-scroll-region":``,tabIndex:0,onKeyDown:e=>{l&&e.key===`Escape`&&(e.stopPropagation(),l())},children:[(0,W.jsxs)(`section`,{className:`agent-card`,children:[(0,W.jsxs)(`header`,{className:`agent-card-head`,children:[(0,W.jsx)(`span`,{className:`agent-dot`+(h?` running`:``),"aria-hidden":`true`}),(0,W.jsx)(`strong`,{children:x}),(0,W.jsx)(`span`,{className:`agent-card-meta`,children:h?`running`+(ee?` `+Y(g-Date.parse(ee)):``):S?`last action `+_t(S):`no recorded action`}),l&&(0,W.jsx)(`button`,{className:`icon-button agent-close`,"aria-label":`Close `+x,onClick:l,children:(0,W.jsx)(r,{name:`close`,size:14,stroke:2})})]}),(0,W.jsx)(X,{live:e,who:!1}),f.items.length>0&&(0,W.jsx)(`section`,{className:`agent-items`,"aria-label":`The Agent's notes`,children:(0,W.jsx)(`ol`,{children:f.items.map(t=>{let n=Z(e,t.id),r=t===te,i=t.artifact?.object,a=i&&!t.title.includes(m(i))?m(i):``;return(0,W.jsxs)(`li`,{className:`agent-item `+(n||`declared`)+(r?` current`:``),"data-fact":`agent`,children:[(0,W.jsx)(`span`,{className:`agent-item-mark`,"aria-hidden":`true`}),i?(0,W.jsx)(`button`,{className:`agent-item-title`,onClick:()=>e.act({kind:`open`,target:i,run:t.artifact.run,version:t.artifact.version}),children:t.title}):(0,W.jsx)(`span`,{className:`agent-item-title`,children:t.title}),(0,W.jsxs)(`span`,{className:`agent-item-meta`,children:[a,n===`done`?(0,W.jsxs)(`span`,{className:`visually-hidden`,children:[a&&` · `,t.state]}):(a&&` · `)+t.state]}),r&&(t.summary||t.lines?.length)?(0,W.jsxs)(`div`,{className:`agent-item-body`,children:[t.summary&&(0,W.jsx)(`p`,{children:t.summary}),t.lines?.map((e,t)=>(0,W.jsxs)(`p`,{children:[e.label?e.label+`: `:``,e.text,e.judgment?` · the Agent's reading`:``]},t))]}):null]},t.id)})})})]}),E&&E.declared.length>0&&(0,W.jsxs)(`section`,{className:`agent-card agent-outputs`,"aria-label":`Outputs of `+E.operationId,children:[(0,W.jsxs)(`header`,{className:`agent-card-head`,children:[(0,W.jsx)(`strong`,{children:`Outputs`}),(0,W.jsx)(`span`,{className:`agent-card-sub`,children:E.operationId}),(0,W.jsx)(`span`,{className:`agent-card-count`,children:E.declared.length})]}),(0,W.jsx)(`ul`,{children:E.declared.map(t=>{let n=ne(t.path),i=n?`artifact:`+n.artifact:null,a=!!n&&i===c&&f.views.find(t=>t.id===e.active)?.version===n.version;return(0,W.jsxs)(`li`,{className:a?`current`:void 0,children:[(0,W.jsx)(r,{name:Oe(t.path),size:15,stroke:1.8}),i&&n?(0,W.jsx)(`button`,{className:`agent-output-name`,"aria-current":a||void 0,onClick:()=>e.act({kind:`open`,target:i,run:n.run,version:n.version}),children:t.path}):(0,W.jsx)(`span`,{className:`agent-output-name`,children:t.path}),E.integrity===`verified`&&t.present?(0,W.jsx)(`span`,{className:`agent-output-check`,title:`Bytes verified`,children:(0,W.jsx)(r,{name:`check`,size:14,stroke:2})}):t.present?null:(0,W.jsx)(`span`,{className:`agent-output-state`,children:`not on disk`})]},t.path)})})]}),w.length>0&&(0,W.jsxs)(`section`,{className:`agent-card`,"aria-label":`Your questions`,children:[(0,W.jsxs)(`header`,{className:`agent-card-head`,children:[(0,W.jsx)(`strong`,{children:`Your questions`}),w.length>1&&(0,W.jsx)(`button`,{className:`shell-quiet agent-card-meta`,"aria-expanded":v,onClick:()=>y(e=>!e),children:v?`Newest only`:`${w.length-1} earlier`})]}),(0,W.jsx)(`ul`,{className:`agent-questions`,children:re.map(t=>(0,W.jsxs)(`li`,{className:`agent-question `+t.state,children:[(0,W.jsx)(`p`,{"data-user-text":``,children:t.name}),(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>e.act({kind:`open`,target:t.target}),children:m(t.target)}),(()=>{let e=n.find(e=>e.responses?.some(e=>`question:`+e.annotationId===t.id)),r=t.state===`prepared`&&!e?`Question retained · context not confirmed`:Q[t.state]??t.state,a=e?.contextId??(i?void 0:null);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`agent-question-state`,children:r}),t.state!==`responded`&&a!==null&&(0,W.jsx)(yt,{contextId:a,prepare:()=>i(t.id.slice(9))})]})})()]},t.id))})]}),(0,W.jsxs)(`section`,{ref:u,className:`agent-card agent-record`,children:[(0,W.jsxs)(`button`,{className:`shell-quiet agent-record-toggle`,"aria-expanded":o,onClick:s,children:[`Recorded calls`,(0,W.jsx)(`span`,{className:`agent-card-meta`,children:p.evidence.length})]}),o&&(0,W.jsx)(Tt,{live:e,principalId:a,notes:!1})]})]})}function xt(e){let t=e.screen,n=[];e.problem&&n.push({key:`problem`,kind:`problem`,text:e.problem});for(let e of t?.escalations??[])n.push({key:`e:`+e.object,kind:`escalation`,object:e.object,text:e.reason});for(let e of t?.suggestions??[])n.push({key:`s:`+e.id,kind:`suggestion`,suggestion:e.id,text:`The Agent arranged a new layout`+(e.merged?` · ${e.merged+1} changes combined`:``)});return n}function St({live:e,items:t,onHide:n}){let[r,i]=(0,D.useState)(0),a=mt(e),o=t[Math.min(r,t.length-1)];return o?(0,W.jsxs)(`div`,{className:`shell-interruption `+o.kind,"data-rho-layer":`transient`,"data-rho-interruption":``,role:o.kind===`problem`?`alert`:`status`,children:[o.object&&(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>e.act({kind:`open`,target:o.object}),children:a(o.object)}),(0,W.jsx)(`span`,{className:`shell-interruption-text`,children:o.text}),o.suggestion&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{onClick:()=>e.act({kind:`accept`,suggestion:o.suggestion}),children:`Open update`}),(0,W.jsx)(`button`,{onClick:()=>e.act({kind:`dismiss`,suggestion:o.suggestion}),children:`Dismiss`})]}),t.length>1&&(0,W.jsxs)(`button`,{className:`shell-quiet`,onClick:()=>i(e=>(e+1)%t.length),children:[`Next of `,t.length]}),!o.suggestion&&(0,W.jsx)(`button`,{className:`shell-quiet`,"aria-label":`Hide until it changes`,onClick:()=>n(o.key+`:`+o.text),children:`Hide`})]}):null}function Ct(e){switch(e.kind){case`source`:return e.from===null?`edited, now version ${e.to}`:`version ${e.from} → ${e.to}`;case`run`:return[ht[e.state]??e.state,e.verified?`${e.verified} file${e.verified===1?``:`s`} verified`:``,e.firstLine??``,e.earlier.length?`${e.earlier.length} earlier run${e.earlier.length===1?``:`s`}`:``].filter(Boolean).join(` · `);case`artifact`:return e.versions===1?`1 new version`:`${e.versions} new versions`;case`question`:return G[e.state]??e.state;case`suggestion`:return`The Agent arranged a new layout`;case`items`:return`the Agent's notes changed · ${e.count} now`}}function wt({live:e}){let t=e.screen,n=mt(e),[r,i]=(0,D.useState)(!1);if(!t?.digest)return null;let a=t.digest.lines.filter(e=>e.kind!==`suggestion`||!t.suggestions.length),o=r?a:a.slice(0,a.length>6?5:6);return a.length?(0,W.jsxs)(`section`,{className:`shell-digest`,"data-rho-layer":`transient`,"data-rho-digest":``,"aria-label":`Changes while away`,...r?{"data-scroll-region":``,tabIndex:0}:{},children:[(0,W.jsxs)(`header`,{children:[(0,W.jsx)(`strong`,{children:`While you were away`}),(0,W.jsx)(`button`,{className:`shell-quiet`,onClick:()=>e.act({kind:`dismiss-digest`}),children:`Dismiss`})]}),(0,W.jsx)(`ul`,{children:o.map((t,r)=>(0,W.jsxs)(`li`,{children:[`object`in t?(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>e.act({kind:`open`,target:t.object}),children:n(t.object)}):null,(0,W.jsx)(`span`,{children:Ct(t)})]},r))}),o.length<a.length&&(0,W.jsxs)(`button`,{className:`shell-quiet`,onClick:()=>i(!0),children:[a.length-o.length,` more`]})]}):null}function Tt({live:e,principalId:t,notes:n=!0}){let r=e.state,i=mt(e);if(!r)return null;let a=e=>{if(t&&e===t)return`You`;let n=r.trace.principals[e],i=n?.kind??(e.startsWith(`agent:`)?`agent`:e.startsWith(`browser:`)?`browser`:void 0);return i===`agent`?n?.name??`The Agent`:i===`browser`?`Another browser tab`:e===`operator`?`Rho`:n?.name??`Unrecorded principal`},o=new Date().toISOString(),s=r.evidence.map((e,t)=>({f:e,i:t})).sort((e,t)=>(t.f.at??``).localeCompare(e.f.at??``)||t.i-e.i);return(0,W.jsxs)(`section`,{className:`shell-evidence`,"data-rho-layer":`transient`,"data-rho-evidence":``,"data-scroll-region":``,tabIndex:0,"aria-label":`Recorded activity`,children:[n&&e.screen&&e.screen.items.length>0&&(0,W.jsxs)(`section`,{"aria-label":`The Agent's notes`,className:`shell-notes`,children:[(0,W.jsxs)(`h3`,{children:[`The Agent's notes`,e.screen.question?` · `+e.screen.question:``]}),(0,W.jsx)(`ul`,{children:e.screen.items.map(t=>(0,W.jsxs)(`li`,{"data-fact":`agent`,children:[(0,W.jsx)(`strong`,{children:t.title}),(0,W.jsxs)(`span`,{children:[` · `,t.kind,` · `,t.state]}),t.artifact&&(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>e.act({kind:`open`,target:t.artifact.object,run:t.artifact.run,version:t.artifact.version}),children:i(t.artifact.object)}),t.summary&&(0,W.jsx)(`p`,{children:t.summary}),t.lines?.map((e,t)=>(0,W.jsxs)(`p`,{children:[e.label?e.label+`: `:``,e.text,e.judgment?` · the Agent's reading`:``]},t))]},t.id))})]}),r.gap&&(0,W.jsx)(`p`,{role:`status`,children:`Earlier activity is outside the retained window. No missing calls were reconstructed.`}),(0,W.jsx)(`ol`,{children:(()=>{let e=``;return s.map(({f:t,i:n})=>{let r=t.at&&!J(t.at,o)?gt(t.at):``,s=r===e?``:e=r;return(0,W.jsxs)(D.Fragment,{children:[s&&(0,W.jsx)(`li`,{className:`shell-evidence-day`,children:s}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`time`,{children:t.at?new Date(t.at).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}):`Time not recorded`}),(0,W.jsx)(`strong`,{children:a(t.actor)}),(0,W.jsxs)(`span`,{className:`shell-evidence-what`,children:[(0,W.jsx)(`code`,{children:t.op}),` `,t.object?i(t.object):`Object not recorded`,t.outcome===`rejected`?` · refused (${t.reason?.kind??`reason not recorded`})`:``]})]})]},n)})})()}),(0,W.jsxs)(`p`,{children:[`The latest `,r.evidence.length,` facts are kept (limit `,R.maxEvidence,`). Calls an adapter refused on its own are not recorded here.`]})]})}var Et=e=>Array.isArray(e?.type)?void 0:e?.type,Dt=e=>!!e&&(Et(e)===`string`||!!e.oneOf?.some(Dt)||!!e.anyOf?.some(Dt)),Ot=e=>!!e&&(Et(e)===`null`||Array.isArray(e.type)&&e.type.includes(`null`)||!!e.oneOf?.some(Ot)||!!e.anyOf?.some(Ot)),kt=e=>typeof e==`string`?/^[a-f0-9]{64}$/.test(e):!!e&&typeof e==`object`&&Object.values(e).some(kt);function At(e,t){if(!e||typeof e!=`object`||Array.isArray(e))return null;let n=e;if(typeof n.path==`string`)return n.kind===`disk`?`${n.path} · the saved file the Agent proposed`:n.path;if(typeof n.documentId==`string`){let e=t.documents.find(e=>e.id===n.documentId);return e?`${e.path} · version ${n.version}`:`A document that is not open in this project`}let r=n.resource??n;if(typeof r.id==`string`){let e=t.resources.find(e=>e.id===r.id&&e.version===r.version);return e?`${e.path} · the version the Agent proposed`:`A file version that is not registered here`}return null}function jt(e,t){if(!e)return`json`;if(kt(t)&&(!Array.isArray(t)||t.every(e=>typeof e==`string`||kt(e))))return`reference`;if(e.enum?.every(e=>typeof e==`string`))return`choice`;let n=Et(e);return n===`string`&&(t===void 0||typeof t==`string`)?`text`:!n&&Dt(e)&&Ot(e)&&(t===null||typeof t==`string`)?`optional-text`:(n===`number`||n===`integer`)&&(t===void 0||typeof t==`number`)?`number`:n===`boolean`&&(t===void 0||typeof t==`boolean`)?`boolean`:n===`array`&&Array.isArray(t)&&t.every(e=>typeof e==`string`)&&Dt(e.items)?`lines`:n===`object`&&e.properties&&!e.oneOf&&!e.anyOf&&typeof t==`object`&&t&&!Array.isArray(t)?`object`:`json`}function Mt({view:e,snapshot:t,client:n,live:r}){let i=e.props,a=t.catalog.actions.find(e=>e.id===i.action&&e.version===i.actionVersion),o=a?.inputSchema??{},[s,c]=(0,D.useState)(()=>structuredClone(i.input??{})),[l,u]=(0,D.useState)({}),[d,f]=(0,D.useState)(null),[p,m]=(0,D.useState)(!1),[h,g]=(0,D.useState)(!1),[_,v]=(0,D.useState)(``),[y,b]=(0,D.useState)(!1),x=e=>t.catalog.operations.some(t=>t.method===e&&t.state===`available`&&t.authorized),S=r.runs?.find(e=>e.operationId===i.operationId),C=(0,D.useMemo)(()=>({projectId:t.project.id,operationId:i.operationId,action:i.action,actionVersion:i.actionVersion,input:s,...i.repairOf?{repairOf:i.repairOf}:{}}),[t.project.id,i.operationId,i.action,i.actionVersion,i.repairOf,s]);(0,D.useEffect)(()=>{if(S||!x(`protocol.validate`))return;let e=!0;m(!0);let t=setTimeout(()=>{n.call(`protocol.validate`,{method:`action.submit`,body:C},AbortSignal.timeout(15e3)).then(t=>{e&&f(t.problems.map(e=>({path:e.path,message:e.message,fix:e.fix})))},()=>{e&&f(null)}).finally(()=>{e&&m(!1)})},250);return()=>{e=!1,clearTimeout(t)}},[C,S,n]);let ee=Object.keys(l).length>0||p||!!d?.length;async function w(){g(!0),v(``),b(!1);try{await n.call(`action.submit`,C,AbortSignal.timeout(6e4))}catch(e){let t=e?.error;t?.kind?v(t.message??`The owner did not accept this run.`):b(!0)}finally{g(!1),r.readRuns()}}let te=e=>(d??[]).filter(t=>t.path===e||t.path.startsWith(e+`/`)||t.path.startsWith(e+`.`)),T=e=>`/input/`+e;return a?(0,W.jsxs)(`section`,{className:`shell-action`,"data-owner-body":``,"data-rho-action-form":i.operationId,"aria-label":i.title??i.action,children:[(0,W.jsx)(`h2`,{children:i.title??a.presentation?.displayName??i.action}),(0,W.jsxs)(`p`,{className:`shell-action-identity`,children:[(0,W.jsx)(`code`,{children:i.operationId}),` · `,a.presentation?.displayName??i.action,` `,i.actionVersion,i.repairOf?(0,W.jsxs)(W.Fragment,{children:[` · repairs `,(0,W.jsx)(`code`,{children:i.repairOf})]}):null]}),S?(0,W.jsxs)(`p`,{role:`status`,"data-rho-submitted":i.operationId,children:[`Submitted · `,(0,W.jsx)(`span`,{className:`shell-state `+S.execution,children:Te(S.execution)}),` `,(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>{let e=De(r,S.operationId);e&&r.act({kind:`open`,target:e})},children:`Open run`})]}):(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),!ee&&!h&&w()},children:[Object.entries(o.properties??{}).filter(([e])=>e in s||o.required?.includes(e)).map(([e,n])=>(0,W.jsx)(Nt,{name:e,path:T(e),schema:n,value:s[e],snapshot:t,problems:te(T(e)),onValue:t=>c(n=>({...n,[e]:t})),onUnparsed:(e,t)=>u(n=>{let r={...n};return t===null?delete r[e]:r[e]=t,r})},e)),d&&te(`/input`).filter(e=>!Object.keys(o.properties??{}).some(t=>e.path.startsWith(T(t)))).map((e,t)=>(0,W.jsxs)(`p`,{role:`alert`,className:`shell-field-problem`,children:[e.message,e.fix?` · `+e.fix:``]},t)),_&&(0,W.jsx)(`p`,{role:`alert`,className:`shell-field-problem`,children:_}),y&&(0,W.jsxs)(`p`,{role:`status`,"data-rho-lost":i.operationId,children:[`The reply did not arrive, and the project's runs do not show `,i.operationId,` yet. Sending it again cannot start a second run.`]}),(0,W.jsxs)(`div`,{className:`shell-action-submit`,children:[(0,W.jsx)(`button`,{type:`submit`,disabled:ee||h||!x(`action.submit`),children:h?`Submitting…`:y?`Send again`:`Run`}),p?(0,W.jsx)(`span`,{role:`status`,children:`Checking…`}):d?.length?(0,W.jsxs)(`span`,{role:`status`,children:[d.length,` to fix`]}):null]})]})]}):(0,W.jsxs)(`section`,{className:`shell-action`,"data-owner-body":``,"aria-label":i.title??i.action,children:[(0,W.jsx)(`h2`,{children:i.title??i.action}),(0,W.jsxs)(`p`,{role:`status`,children:[i.action,` `,i.actionVersion,` is not registered in this project.`]})]})}function Nt({name:e,path:t,schema:n,value:r,snapshot:i,problems:a,onValue:o,onUnparsed:s}){let c=(0,D.useId)(),l=jt(n,r),u=a.filter(e=>l!==`object`||e.path===t),[d,f]=(0,D.useState)(()=>JSON.stringify(r??null,null,2)),[p,m]=(0,D.useState)(``),h=u.length||p?c+`-problem`:void 0,g={id:c,"aria-invalid":!!h||void 0,"aria-describedby":h},_;if(l===`object`){let c=r;return(0,W.jsxs)(`fieldset`,{className:`shell-field-group`,children:[(0,W.jsx)(`legend`,{children:e}),Object.entries(n.properties??{}).filter(([e])=>e in c||n.required?.includes(e)).map(([e,n])=>(0,W.jsx)(Nt,{name:e,path:t+`/`+e,schema:n,value:c[e],snapshot:i,problems:a.filter(n=>n.path===t+`/`+e||n.path.startsWith(t+`/`+e+`/`)),onValue:t=>o({...c,[e]:t}),onUnparsed:s},e)),u.map((e,t)=>(0,W.jsxs)(`p`,{role:`alert`,className:`shell-field-problem`,children:[e.message,e.fix?` · `+e.fix:``]},t))]})}if(l===`reference`){let t=(Array.isArray(r)?r:[r]).map(e=>typeof e==`string`?kt(e)?`A pinned version`:e:At(e,i)??`A pinned reference`);return(0,W.jsxs)(`div`,{className:`shell-field`,children:[(0,W.jsx)(`span`,{className:`shell-field-name`,id:c,children:e}),(0,W.jsx)(`ul`,{className:`shell-field-references`,"aria-labelledby":c,"data-rho-reference":e,children:t.map((e,t)=>(0,W.jsx)(`li`,{children:e},t))}),u.length>0&&(0,W.jsx)(`p`,{role:`alert`,className:`shell-field-problem`,children:u.map(e=>e.message+(e.fix?` · `+e.fix:``)).join(` · `)})]})}return _=l===`choice`?(0,W.jsx)(`select`,{...g,value:String(r??``),onChange:e=>o(e.target.value),children:n.enum.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))}):l===`text`?(0,W.jsx)(`input`,{...g,value:String(r??``),onChange:e=>o(e.target.value)}):l===`optional-text`?(0,W.jsx)(`input`,{...g,value:typeof r==`string`?r:``,onChange:e=>o(e.target.value===``?null:e.target.value)}):l===`number`?(0,W.jsx)(`input`,{...g,type:`number`,value:r===void 0?``:String(r),min:n.minimum,max:n.maximum,step:Et(n)===`integer`?1:`any`,onChange:e=>o(e.target.value===``?void 0:Number(e.target.value))}):l===`boolean`?(0,W.jsx)(`input`,{...g,type:`checkbox`,checked:r===!0,onChange:e=>o(e.target.checked)}):l===`lines`?(0,W.jsx)(`textarea`,{...g,rows:Math.min(8,Math.max(2,r.length+1)),value:r.join(`
|
|
3
|
-
`),onChange:e=>o(e.target.value===``?[]:e.target.value.split(`
|
|
4
|
-
`))}):(0,W.jsx)(`textarea`,{...g,className:`shell-field-json`,rows:Math.min(10,Math.max(2,d.split(`
|
|
5
|
-
`).length)),value:d,spellCheck:!1,onChange:e=>{f(e.target.value);try{o(JSON.parse(e.target.value)),m(``),s(t,null)}catch{m(`Not valid JSON yet`),s(t,e.target.value)}}}),(0,W.jsxs)(`div`,{className:`shell-field`+(l===`boolean`?` inline`:``),children:[(0,W.jsxs)(`label`,{htmlFor:c,children:[e,l===`lines`?` · one per line`:l===`json`?` · JSON`:``]}),_,h&&(0,W.jsx)(`p`,{id:c+`-problem`,role:`alert`,className:`shell-field-problem`,children:[p,...u.map(e=>e.message+(e.fix?` · `+e.fix:``))].filter(Boolean).join(` · `)})]})}function Pt({view:e,process:t,client:n,snapshot:i,children:a}){let o=t.every.find(t=>be(t.path)===e.id);if(!o)return(0,W.jsx)(W.Fragment,{children:a});let s=o.path,c=t.files.find(e=>e.path===s),l=o.versions,u=c?.versions.length??0,d=c?.versions.at(-1),f=Object.values(e.bindings??{}).some(e=>e.kind===`live-document`),p=e=>t.setAt(e>=l.length?null:l[e].at),m=t.holds(s);return(0,W.jsxs)(`div`,{className:`process-frame`,children:[m&&(0,W.jsx)(ve,{className:`process-holds`,holds:m}),(0,W.jsx)(`div`,{className:`process-version`,"data-fact":`observed`,children:l.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{children:d?`Version ${u} of ${l.length} · kept ${E(d.at)}`:`Not kept yet`}),l.length>1&&(0,W.jsxs)(`span`,{className:`process-version-steps`,children:[(0,W.jsx)(`button`,{className:`icon-button`,"aria-label":`Earlier version of `+o.title,disabled:u<=1,onClick:()=>p(u-2),children:(0,W.jsx)(`span`,{className:`flip`,children:(0,W.jsx)(r,{name:`chevron`,size:13})})}),(0,W.jsx)(`button`,{className:`icon-button`,"aria-label":`Later version of `+o.title,disabled:t.at===null&&u>=l.length,onClick:()=>p(u),children:(0,W.jsx)(r,{name:`chevron`,size:13})})]})]}):(0,W.jsx)(`span`,{children:t.at===null?`No version of this file was kept; it shows as it is now.`:`No version of this file was kept.`})}),t.at!==null&&f?d?(0,W.jsx)(`div`,{className:`process-replay-file`,children:(0,W.jsx)(je,{client:n,projectId:i.project.id,resource:d.resource,path:s})}):l.length?(0,W.jsxs)(`p`,{className:`process-note`,children:[`The work had reached this file by `,E(t.at,!0),`; its first version was kept at `,E(l[0].at,!0),`.`,(0,W.jsxs)(`button`,{className:`text-button`,onClick:()=>p(0),children:[`Go to `,E(l[0].at,!0)]})]}):(0,W.jsxs)(`p`,{className:`process-note`,children:[`The work had reached this file by `,E(t.at,!0),`, but no version of it was kept, so it cannot be shown as it was then.`,(0,W.jsx)(`button`,{className:`text-button`,onClick:()=>t.setAt(null),children:`Show it now`})]}):a]})}var Ft=e=>{let t=e.getBoundingClientRect();return{x:t.left,y:t.bottom+4,above:t.top-4}};function It({at:e,label:t,anchor:n,onClose:r,className:i,role:a=`menu`,children:o}){let s=(0,D.useRef)(null);(0,D.useLayoutEffect)(()=>{let t=s.current,n=t.offsetWidth,r=innerHeight-e.y-8,i=(e.above??e.y)-8,a=r<Math.min(t.scrollHeight,320)&&i>r;t.style.left=Math.max(8,Math.min(e.x,innerWidth-n-8))+`px`,t.style.maxHeight=(a?i:r)+`px`,a?t.style.bottom=innerHeight-(e.above??e.y)+`px`:t.style.top=e.y+`px`,t.querySelector(`button:not(:disabled)`)?.focus({preventScroll:!0})},[]),(0,D.useEffect)(()=>{let e=e=>{let t=e.target;!s.current?.contains(t)&&!n?.contains(t)&&r(!1)},t=()=>r(!1);return document.addEventListener(`pointerdown`,e,!0),addEventListener(`resize`,t),addEventListener(`blur`,t),()=>{document.removeEventListener(`pointerdown`,e,!0),removeEventListener(`resize`,t),removeEventListener(`blur`,t)}},[n]);function c(e){let t=[...s.current.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement),i={ArrowDown:n+1,ArrowUp:n-1,Home:0,End:t.length-1}[e.key];e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),r(!0)):e.key===`Tab`?r(!1):i!==void 0&&t.length&&(e.preventDefault(),t[(i+t.length)%t.length].focus())}return(0,Ne.createPortal)((0,W.jsx)(`div`,{ref:s,className:`floating-menu`+(i?` `+i:``),role:a,"aria-label":t,onKeyDown:c,onClick:e=>{e.target.closest(`button`)&&r(!1)},children:o}),document.body)}function Lt({items:e}){return(0,W.jsx)(W.Fragment,{children:e.map(e=>(0,W.jsxs)(`button`,{role:`menuitem`,onClick:e.run,children:[(0,W.jsx)(r,{name:e.icon,size:15}),(0,W.jsx)(`span`,{children:e.label}),e.keys&&(0,W.jsx)(`kbd`,{children:e.keys})]},e.id))})}var Rt=`application/x-rho-view`,zt=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Bt=e=>e&&`group`in e?e.group:null;function Vt(e){let t=e.currentTarget.getBoundingClientRect(),n=(e.clientX-t.left)/t.width,r=(e.clientY-t.top)/t.height,[i,a]=[[`left`,n],[`right`,1-n],[`top`,r],[`bottom`,1-r]].sort((e,t)=>e[1]-t[1])[0];return a<.25?i:`center`}var Ht=new WeakMap;function Ut(e,t){let n=document.activeElement,r=n instanceof HTMLElement&&e.contains(n)?n:Ht.get(e);Ht.delete(e),e.parentElement!==t&&t.appendChild(e),r&&e.contains(r)&&document.activeElement!==r&&r.focus({preventScroll:!0})}function Wt(e,t){if(e.parentElement!==t)return;let n=document.activeElement;n instanceof HTMLElement&&e.contains(n)&&Ht.set(e,n),t.removeChild(e)}function Gt({container:e,id:t,labelledBy:n}){let r=(0,D.useRef)(null);return(0,D.useLayoutEffect)(()=>{let t=r.current;return Ut(e,t),()=>Wt(e,t)},[e]),(0,W.jsx)(`div`,{ref:r,id:t,className:`shell-panel`,role:`tabpanel`,"aria-labelledby":n})}function Kt(e,t,n=!0){(0,D.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{let e=t.scrollLeft>1,n=t.scrollLeft+t.clientWidth<t.scrollWidth-1;e||n?t.dataset.overflow=e&&n?`both`:e?`start`:`end`:delete t.dataset.overflow};n();let r=new ResizeObserver(n),i=new MutationObserver(n);return r.observe(t),i.observe(t,{childList:!0,subtree:!0,characterData:!0}),t.addEventListener(`scroll`,n,{passive:!0}),()=>{r.disconnect(),i.disconnect(),t.removeEventListener(`scroll`,n)}},[e,n]),(0,D.useEffect)(()=>{e.current?.querySelector(`[aria-selected="true"]`)?.scrollIntoView({block:`nearest`,inline:`nearest`})},[e,t])}function qt({group:e,name:t,selected:n,onSelect:i,onHeader:a,render:o,drag:s,tools:c}){let l=(0,D.useRef)(null),[u,d]=(0,D.useState)(null);Kt(l,n);let f=`shell-`+e.id.replace(/[^A-Za-z0-9_-]/g,`_`),p=Math.max(0,e.views.indexOf(n)),m=()=>[...l.current?.querySelectorAll(`[role=tab]`)??[]];function h(t){let n=e.views.length,r={ArrowRight:(p+1)%n,ArrowLeft:(p-1+n)%n,Home:0,End:n-1}[t.key];r!==void 0&&(t.preventDefault(),i(e.views[r]),m()[r]?.focus())}function g(e,t){e.key===`Delete`&&c?.close?(e.preventDefault(),c.close(t)):(e.key===`ContextMenu`||e.key===`F10`&&e.shiftKey)&&c?.menu&&(e.preventDefault(),d({id:t,at:Ft(e.currentTarget),from:e.currentTarget}))}function _(e,t){c?.menu&&(e.preventDefault(),d({id:t,at:{x:e.clientX,y:e.clientY},from:e.currentTarget}))}let v=e=>{let t=u?.from;d(null),e&&t?.isConnected&&t.focus()},y=s?.dragging?.kind===`group`&&s.dragging.id===e.id;function b(t){if(!s?.dragging||y)return;t.preventDefault(),t.dataTransfer.dropEffect=`move`;let n=[...l.current?.querySelectorAll(`.shell-tab`)??[]].findIndex(e=>{let n=e.getBoundingClientRect();return t.clientX<n.left+n.width/2}),r={group:e.id,zone:`tab`,before:n<0?null:e.views[n]};zt(s.target,r)||s.over(r)}function x(t){if(!s?.dragging||y)return;t.preventDefault(),t.dataTransfer.dropEffect=`move`;let n={group:e.id,zone:Vt(t)};zt(s.target,n)||s.over(n)}let S=t=>{s?.dragging&&s.target&&Bt(s.target)===e.id&&(t.preventDefault(),s.drop(s.target))},C=s?.target&&`group`in s.target&&s.target.group===e.id?s.target:null,ee=s?.dragging?.kind===`view`?s.dragging.id:null,w=!!s&&!!c?.movable;return(0,W.jsxs)(`section`,{className:`shell-group`,"data-group":e.id,"data-dragging":y?``:void 0,"data-maximized":c?.maximized?``:void 0,children:[(0,W.jsxs)(`div`,{className:`shell-tabbar`,children:[(0,W.jsxs)(`div`,{className:`shell-tabstrip`,style:{"--tabs":e.views.length},onDragOver:b,onDrop:S,"data-drop":C?.zone===`tab`&&C.before===null?`end`:void 0,children:[(0,W.jsx)(`div`,{ref:l,className:`shell-tabs`,role:`tablist`,"aria-label":t,onKeyDown:h,children:e.views.map((e,t)=>(0,W.jsxs)(`div`,{className:`shell-tab`,"data-dragging":ee===e?``:void 0,"data-drop":C?.zone===`tab`&&C.before===e?`before`:void 0,"data-closable":c?.close?``:void 0,children:[(0,W.jsx)(`button`,{id:f+`-tab-`+t,role:`tab`,"aria-selected":e===n,"aria-controls":f+`-panel`,tabIndex:e===n?0:-1,title:o.label(e),onClick:()=>i(e),onKeyDown:t=>g(t,e),onContextMenu:t=>_(t,e),"aria-keyshortcuts":c?.close?`Delete`:void 0,onMouseDown:e=>{e.button===1&&c?.close&&e.preventDefault()},onAuxClick:t=>{t.button===1&&c?.close&&(t.preventDefault(),c.close(e))},draggable:!!s,onDragStart:t=>{s&&(t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Rt,e),s.start({kind:`view`,id:e}))},onDragEnd:()=>s?.end(),children:o.title(e)}),c?.close&&e===n&&(0,W.jsx)(`button`,{className:`shell-tab-close`,tabIndex:-1,"aria-hidden":`true`,title:`Close `+o.label(e),draggable:!1,onClick:()=>c.close(e),children:(0,W.jsx)(r,{name:`close`,size:12,stroke:2})})]},e))}),c?.add&&(0,W.jsx)(Jt,{name:t,content:c.add}),(0,W.jsx)(`div`,{className:`shell-tabs-fill`,"aria-hidden":`true`,"data-movable":w?``:void 0,title:w?`Drag to move these views together. Double-click to maximize.`:c?.maximized?`Double-click to show every group`:void 0,draggable:w,onDoubleClick:()=>(w||c?.maximized)&&c?.onMaximize?.(),onDragStart:t=>{w&&(t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(Rt,e.id),l.current&&t.dataTransfer.setDragImage(l.current,16,16),s.start({kind:`group`,id:e.id}))},onDragEnd:()=>s?.end()})]}),(0,W.jsx)(`div`,{className:`shell-header-slot`,ref:a}),c?.maximized&&(0,W.jsxs)(`button`,{className:`shell-restore`,title:`Show every group again`,onClick:c.onMaximize,children:[(0,W.jsx)(r,{name:`restore`,size:14}),`Restore`]})]}),(0,W.jsxs)(`div`,{className:`shell-body`,children:[(0,W.jsx)(Gt,{container:o.container(n),id:f+`-panel`,labelledBy:f+`-tab-`+p},n),s?.dragging&&!y&&(0,W.jsx)(`div`,{className:`shell-drop`,"data-zone":C&&C.zone!==`tab`?C.zone:void 0,onDragOver:x,onDrop:S,"aria-hidden":`true`,onDragLeave:e=>{C&&!e.currentTarget.contains(e.relatedTarget)&&s.over(null)},children:(0,W.jsx)(`div`,{className:`shell-drop-preview`})})]}),u&&c?.menu&&(0,W.jsx)(It,{at:u.at,anchor:u.from,label:o.label(u.id),onClose:v,children:(0,W.jsx)(Lt,{items:c.menu(u.id)})})]})}function Jt({name:e,content:t}){let n=(0,D.useRef)(null),[i,a]=(0,D.useState)(null);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{ref:n,className:`shell-tab-add`,"aria-label":`Add a view to `+e,title:`Add a view here`,"aria-haspopup":`dialog`,"aria-expanded":!!i,onClick:e=>a(i?null:Ft(e.currentTarget)),children:(0,W.jsx)(r,{name:`plus`,size:15,stroke:1.8})}),i&&(0,W.jsx)(It,{at:i,anchor:n.current,label:`Add a view to `+e,role:`dialog`,className:`add-into`,onClose:e=>{a(null),e&&n.current?.focus()},children:t()})]})}function Yt({region:e,weights:t,onResize:n,label:r,children:i}){let a=(0,D.useRef)(null),o=e.axis===`horizontal`,s=t.reduce((e,t)=>e+t,0),c=o?{less:`ArrowLeft`,more:`ArrowRight`}:{less:`ArrowUp`,more:`ArrowDown`};function l(e,r){let i=r.key===c.less?-.05:r.key===c.more?.05:r.key===`Home`?-1:+(r.key===`End`);i&&(r.preventDefault(),n(y(t,e,i)))}function u(e,r){let i=a.current;if(!i)return;r.currentTarget.setPointerCapture(r.pointerId);let s=o?i.clientWidth:i.clientHeight,c=o?r.clientX:r.clientY,l=t,u=t=>n(y(l,e,((o?t.clientX:t.clientY)-c)/s)),d=r.currentTarget,f=()=>{d.removeEventListener(`pointermove`,u),d.removeEventListener(`pointerup`,f),d.removeEventListener(`pointercancel`,f)};d.addEventListener(`pointermove`,u),d.addEventListener(`pointerup`,f),d.addEventListener(`pointercancel`,f)}let d=[];return i.forEach((e,n)=>{if(n){let e=t.slice(0,n).reduce((e,t)=>e+t,0);d.push((0,W.jsx)(`div`,{className:`shell-divider`,role:`separator`,tabIndex:0,"aria-orientation":o?`vertical`:`horizontal`,"aria-label":r(n),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(e/s*100),onKeyDown:e=>l(n-1,e),onPointerDown:e=>u(n-1,e)},`divider-`+n))}d.push((0,W.jsx)(`div`,{className:`shell-pane`,style:{flex:`${t[n]} 1 0`},children:e},`pane-`+n))}),(0,W.jsx)(`div`,{ref:a,className:`shell-split`,"data-axis":e.axis,"data-split":e.id,children:d})}var Xt={minSplitPx:640};function Zt({composition:e,snapshot:t,client:n,onAbout:y,contextTarget:S,principalId:E,onShowContext:ve,feedbackContextActive:be,openView:Ce,onCommands:Te,agentTarget:De,onShowAgent:Oe,presence:je,onPersonMoved:O,onConversation:Pe,onExplore:Fe,onObject:Ie,empty:Le,prepared:Re,onPrepare:ze,bar:Be=!0,barTarget:k,attention:Ve=!0,following:He=!1,arrange:Ue=!0,addView:A}){let j=ye(),M=pt(t,e,n,E,!!j),N=M.layout;async function We(e){let r=t.annotations.find(t=>t.annotationId===e)?.version??1;return(await n.call(`context.create`,{projectId:t.project.id,changeId:r===1?e:e+`@`+r,expectedVersion:0,annotations:[{annotationId:e,version:r}]},AbortSignal.timeout(3e4))).contextId}let P=(0,D.useMemo)(()=>a(N),[N]),F=(0,D.useMemo)(()=>i(P),[P]),I=(0,D.useMemo)(()=>new Map(N.views.map(e=>[e.id,e])),[N]),[Ge,Ke]=(0,D.useState)(()=>matchMedia(`(max-width: 767px)`).matches);(0,D.useEffect)(()=>{let e=matchMedia(`(max-width: 767px)`),t=()=>Ke(e.matches);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let qe=(0,D.useRef)(null),[Je,Ye]=(0,D.useState)(!1);(0,D.useLayoutEffect)(()=>{let e=qe.current;if(!e)return;let t=new ResizeObserver(([e])=>{e.contentRect.width&&Ye(e.contentRect.width<Xt.minSplitPx)});return t.observe(e),()=>t.disconnect()},[]);let[Xe,Ze]=(0,D.useState)({}),[Qe,$e]=(0,D.useState)(F[0]??``),et=e=>e.views.includes(Qe)?Qe:e.views.includes(Xe[e.id])?Xe[e.id]:e.views[0],tt=e=>{let t=d(P,e);t&&Ze(n=>({...n,[t.id]:e})),$e(e)},L=e=>{M.hold(e),tt(e)},nt=e=>{let t=N.views.find(t=>Object.values(t.bindings??{}).some(t=>`id`in t&&t.id===e.id&&t.version===e.version));t?L(t.id):M.openResource(e)},[rt,it]=(0,D.useState)(!1),[at,R]=(0,D.useState)([]),ot=xt(M),st=ot.filter(e=>!at.includes(e.key+`:`+e.text));(0,D.useEffect)(()=>{if(j||!M.active||!I.has(M.active))return;let e=document.activeElement?.closest(`[data-owner-view]`)?.dataset.ownerView;M.movedBy===`owners`&&e&&e!==M.active&&I.has(e)&&(V||d(P,e)?.id===d(P,M.active)?.id)?M.hold(e):tt(M.active)},[M.active,P]);let ct=(0,D.useRef)(``);(0,D.useEffect)(()=>{Ce&&ct.current!==Ce&&I.has(Ce)&&(ct.current=Ce,He?tt(Ce):L(Ce))},[Ce,I]);let z=F.includes(Qe)?Qe:F[0]??``,B=P?g(P):[],V=Ge||Je&&B.length>1,[lt,H]=(0,D.useState)(null),U=!V&&B.length>1?B.find(e=>e.id===lt)??null:null;(0,D.useEffect)(()=>{U&&z&&!U.views.includes(z)&&H(null)},[z]);let ut=V?z?[z]:[]:U?[et(U)]:B.map(et),[dt,ft]=(0,D.useState)({version:N.version,values:{}}),mt=dt.version===N.version?dt.values:{},[ht,G]=(0,D.useState)(``),K=e=>(Ue||!e.startsWith(`composition.`))&&t.catalog.operations.some(t=>t.method===e&&t.state===`available`&&t.authorized),q=e.rootId&&e.nodes?.length?{rootId:e.rootId,nodes:e.nodes}:null,gt=(0,D.useRef)(null),J=(0,D.useRef)(e);J.current=gt.current&>.current.compositionId===e.compositionId&>.current.version>e.version?{...e,...gt.current}:e;let Y=()=>J.current.rootId&&J.current.nodes?.length?{rootId:J.current.rootId,nodes:J.current.nodes}:null,_t=e=>{gt.current={compositionId:e.compositionId,version:e.version,rootId:e.rootId,nodes:e.nodes},J.current={...J.current,...gt.current}},X=e=>`${e}-${crypto.randomUUID().slice(0,8)}`,Z=e=>G(e instanceof Error?e.message:`The layout change was not accepted.`);async function Q(e){if(!e)return!1;G(``);try{return _t(await n.call(`composition.apply`,{projectId:t.project.id,compositionId:J.current.compositionId,expectedVersion:J.current.version,changeId:`layout-`+crypto.randomUUID(),operations:[{op:`replace`,rootId:e.rootId,nodes:e.nodes}]},AbortSignal.timeout(3e4))),!0}catch(e){return Z(e),!1}}async function yt(){G(``);try{_t(await n.call(`composition.undo`,{projectId:t.project.id,compositionId:J.current.compositionId,expectedVersion:J.current.version,changeId:`layout-undo-`+crypto.randomUUID()},AbortSignal.timeout(3e4)))}catch(e){Z(e)}}async function Ct(e,r){let i=Y()?.nodes.find(t=>t.kind===`group`&&t.children?.includes(e));if(!i)return;G(``);let a=X(`view`);try{await n.call(`composition.apply`,{projectId:t.project.id,compositionId:J.current.compositionId,expectedVersion:J.current.version,changeId:`layout-beside-`+crypto.randomUUID(),operations:[{op:`insert`,parentId:i.id,index:i.children.indexOf(e)+1,node:{id:a,kind:`view`,...r}}]},AbortSignal.timeout(3e4)).then(e=>_t(e)),L(a)}catch(e){Z(e)}}let[Tt,Et]=(0,D.useState)(null),[Dt,Ot]=(0,D.useState)(!1),kt=ze?Re??null:Tt,At=ze??Et,jt=ne(t)&&(j?!!Fe:!!q);async function Nt(e,r,i,a){if(j)Fe?.(r,i);else{G(``),Ot(!0);try{let o=N.views.find(e=>e.component===ce)?.id;if(!o){let t=I.get(e),n=Y(),r=`notebook`,i=t&&n&&l(n,t,X),a=i&&p(i,pe(r),e,`right`,X);if(!K(`composition.apply`)||!a){G(`The Notebook could not be placed beside this view.`);return}if(!await Q(a))return;o=r}a?At(w(r,i,a.dirty)):await C(n,t.project.id,r,i),O?.(),L(o)}catch(e){Z(e)}finally{Ot(!1)}}}let[Ft,It]=(0,D.useState)(null);(0,D.useEffect)(()=>{Ft&&I.has(Ft)&&(It(null),L(Ft))},[Ft,I]);function Lt(e,r){j?Ie?.(e,r):(G(``),oe(n,t.project.id,N.compositionId,e,r,qe.current?.clientWidth).then(e=>{O?.(),It(e)},Z))}function Rt(e,r){le(e,r);let i=N.views.find(e=>e.component===ie.servers)?.id;i?L(i):(G(``),de(n,t.project.id,N.compositionId,`servers`).then(e=>{O?.(),It(e)},Z))}let zt=(0,D.useRef)(Promise.resolve()),Bt=(0,D.useRef)(async()=>{});Bt.current=async({viewId:e,language:r,code:i,purpose:a})=>{G(``);let o=N.views.find(e=>e.component===ce)?.id;if(o){let t=d(P,o);t&&t.id!==d(P,e)?.id&&Ze(e=>({...e,[t.id]:o}))}else{let t=I.get(e),n=Y(),r=t&&n&&l(n,t,X),i=r&&p(r,pe(`notebook`,`console`),e,`bottom`,X);K(`composition.apply`)&&i&&await Q(i)}let s=zt.current.then(()=>n.call(`kernel.run`,{projectId:t.project.id,language:r,code:i,purpose:a,changeId:`script-`+crypto.randomUUID()}));zt.current=s.catch(()=>{}),await s.catch(Z)};function Vt(e,t){let n=Y(),r=n&&o(n,e,t);r&&K(`composition.apply`)&&Q(r)}let Ht=(0,D.useContext)(ae),Zt=!j&&!!q&&ne(t),Qt=(0,D.useMemo)(()=>Zt?{...Ht,runCode:e=>Bt.current(e)}:Ht,[Ht,Zt]);function $t(e,r,i){At({key:crypto.randomUUID(),language:e,code:r,note:`From the ${i} view. Build on it, then press Run.`});let a=N.views.find(e=>e.component===ce)?.id;a?L(a):j||me(n,t.project.id,N.compositionId,null).then(e=>L(e),Z)}let en=j?t.conversations?.find(e=>e.conversationId===j.conversationId)?.principal??null:null,tn=j?j.whole.turns.filter(e=>e.conversationId===j.conversationId).map(e=>e.start):[],nn={openValue:Lt,openRemote:Rt,toNotebook:(e,t,n)=>$t(e,t,n),prepared:kt,taken:()=>At(null),setProps:Vt,has:e=>N.views.some(t=>t.component===e),scope:j?{principal:en,since:tn.length?Math.min(...tn):null,at:j.at}:void 0,openConversation:Pe},rn=(0,D.useRef)(void 0);function an(e,t){ft(n=>({version:N.version,values:{...n.version===N.version?n.values:{},[e]:t}})),clearTimeout(rn.current),q&&K(`composition.apply`)&&(rn.current=setTimeout(()=>{let n=Y();Q(n&&u(n,e,t))},600))}(0,D.useEffect)(()=>()=>clearTimeout(rn.current),[]);let[on,sn]=(0,D.useState)(null);function cn(e){let t=on?.item;sn(null);let n=Y();if(!t||!n)return;let r=null,i;if(t.kind===`group`){let a=B.find(e=>e.id===t.id),o=m(t.id);if(!a)return;i=et(a),r=`edge`in e?f(n,o,e.edge,X):v(n,o,m(e.group),e.zone===`tab`?`center`:e.zone,e.zone===`tab`?e.before:null,X)}else{let a=I.get(t.id);if(!a||`group`in e&&e.zone===`center`&&d(P,a.id)?.id===e.group)return;let o=l(n,a,X);i=a.id,r=o?`edge`in e?f(o,a.id,e.edge,X):e.zone===`tab`?x(o,a.id,m(e.group),e.before,X):e.zone===`center`?x(o,a.id,m(e.group),null,X):h(o,a.id,m(e.group),e.zone,X):null}r&&(O?.(),i&&L(i),Q(r))}let ln=!!q&&K(`composition.apply`),$=ln?{dragging:on?.item??null,target:on?.target??null,start:e=>{H(null),sn({item:e,target:null})},end:()=>sn(null),over:e=>sn(t=>t&&{...t,target:e}),drop:cn}:void 0,[un,dn]=(0,D.useState)(null);(0,D.useEffect)(()=>{un&&e.version>un.version&&dn(null)},[e.version]),(0,D.useEffect)(()=>{if(!un)return;let e=setTimeout(()=>dn(null),1e4);return()=>clearTimeout(e)},[un]);async function fn(e,t){let n=Y(),r=n;for(let t of e)M.release(t),r&&=_(r,t)??r;O?.(),r&&r!==n&&await Q(r)&&dn({label:t,version:J.current.version})}let pn=e=>{let t=I.get(e);t&&fn([e],T(t))};async function mn(){let e=un;dn(null),e&&J.current.version===e.version&&await yt()}function hn(e){let t=I.get(e),n=Y(),r=d(P,e);if(!t||!n||!r)return[];let i=l(n,t,X),a=[{id:`close`,label:`Close`,icon:`close`,keys:`Del`,run:()=>pn(e)}],o=r.views.filter(t=>t!==e);o.length&&a.push({id:`close-others`,label:o.length===1?`Close the other tab`:`Close the ${o.length} other tabs`,icon:`close`,run:()=>void fn(o,o.length===1?T(I.get(o[0])):`${o.length} views`)});let s=n=>{let r=Y(),i=r&&l(r,t,X),a=i&&c(i,e,n,X);a&&(O?.(),L(e),Q(a))};return i&&c(i,e,`horizontal`,X)&&a.push({id:`split-right`,label:`Split right`,icon:`layout`,run:()=>s(`horizontal`)},{id:`split-down`,label:`Split down`,icon:`layout`,run:()=>s(`vertical`)}),B.length>1&&a.push(U?{id:`restore`,label:`Show every group`,icon:`restore`,run:()=>H(null)}:{id:`maximize`,label:`Maximize this group`,icon:`fit`,run:()=>{L(e),H(r.id)}}),a}let gn=e=>ln?{close:pn,menu:hn,add:A?()=>A(m(e.id)):void 0,movable:!U&&B.length>1,maximized:U?.id===e.id,onMaximize:()=>H(t=>t===e.id?null:e.id)}:void 0,_n=_e.entries.find(e=>e.component===`rho.feedback`),vn=!!t.feedback&&_n?.requiredOperations.every(e=>t.catalog.operations.some(t=>t.method===e&&t.authorized&&t.state===`available`)),[yn,bn]=(0,D.useState)(null),[xn,Sn]=(0,D.useState)(!1);(0,D.useEffect)(()=>{bn(null),Sn(!1)},[t.project.id,N.compositionId,t.feedback?.taskId,E]);let Cn=(0,D.useRef)(new Set),wn=(0,D.useRef)(new Set),Tn=(0,D.useRef)([]);for(let e of wn.current)I.has(e)||wn.current.delete(e);let En=ut.filter(e=>e&&I.has(e));Tn.current=[...En,...Tn.current.filter(e=>I.has(e)&&!En.includes(e))];let Dn=S&&be&&yn&&!xn?1:0;Cn.current=new Set;for(let e of[...Tn.current,...F])Cn.current.size<8-Dn&&!Cn.current.has(e)&&te(I.get(e),t)&&Cn.current.add(e);for(let e of ut)wn.current.add(e);let On=vn?e=>{Sn(Cn.current.size>=8),bn(e),ve()}:void 0,kn=(0,D.useRef)(new Map);for(let e of kn.current.keys())I.has(e)||kn.current.delete(e);let An=e=>{let t=kn.current.get(e);return t||(t=document.createElement(`div`),t.className=`shell-view`,t.dataset.ownerView=e,kn.current.set(e,t)),t},[jn,Mn]=(0,D.useState)({}),Nn=(0,D.useRef)(new Map),Pn=(0,D.useCallback)(e=>{let t=Nn.current.get(e);return t||(t=t=>Mn(n=>n[e]===t?n:{...n,[e]:t}),Nn.current.set(e,t)),t},[]),Fn=e=>V?jn.narrow??null:jn[d(P,e)?.id??``]??null,In=(0,D.useRef)(new Map);for(let e of In.current.keys())I.has(e)||In.current.delete(e);let Ln=e=>{let t=In.current.get(e);return t||(t=document.createElement(`div`),t.className=`shell-view-header`,t.dataset.ownerHeader=e,In.current.set(e,t)),t};(0,D.useLayoutEffect)(()=>{for(let[e,t]of In.current){let n=ut.includes(e)?Fn(e):null;n?Ut(t,n):t.parentElement&&Wt(t,t.parentElement)}});let Rn=e=>{let r=I.get(e),i=ut.includes(e);if(r.component===`rho.action`)return(0,W.jsx)(Mt,{view:r,snapshot:t,client:n,live:M});if(r.component===`rho.console`)return(0,W.jsx)(xe,{client:n,snapshot:t});if(r.component===`rho.execution`){let i=String(r.props.operationId??e);return(0,W.jsx)(Ae,{snapshot:t,client:n,operationId:i,runs:M.runs,readRuns:M.readRuns,firstLine:Se(M,i),opener:e=>()=>nt(e),onOpenRun:e=>we(M,e),chain:!0})}let a=ke(r,t.resources),o=r.bindings?.document,c=o?.kind===`live-document`?t.documents.find(e=>e.id===o.documentId):void 0,l=re(c?.path),u=a?.kind===`table`&&he(fe(a))?fe(a):null,d=jt&&i&&(u||c&&l)?(0,Ne.createPortal)(u?(0,W.jsx)(Me,{languages:[`r`,`python`],busy:Dt,title:e=>`${j?`Open it on your workspace with the Notebook beside it, and load `:`Load `}${u.split(`/`).at(-1)} as it is on disk now into the ${se[e]} session as a new value${j?``:`, with the Notebook beside it`}`,onExplore:t=>void Nt(e,u,t,null)}):(0,W.jsx)(Me,{languages:[l],busy:Dt,title:e=>`${j?`Open it on your workspace with the Notebook beside it, and put `:`Put `}a line that runs ${c.path.split(`/`).at(-1)} into the ${se[e]} Notebook's line, for you to check and run`,onExplore:t=>void Nt(e,c.path,t,{dirty:c.dirty})}),Ln(e),`explore-`+e):null,f=t.catalog.plugins.find(e=>e.id===`annotations`),p=a?.kind===`table`&&f?.projectEnabled&&f.dependenciesSatisfied&&f.state===`available`?_e.entries.find(e=>e.component===`rho.feedback`)?.TableQuestion:void 0,m=(0,W.jsx)(ge,{active:i,params:{view:r,snapshot:t,client:n,principalId:E,compositionId:N.compositionId,compositionVersion:N.version,contextTarget:e===z&&!be?S:null,headerTarget:i?Ln(e):null,renderAllowed:Cn.current.has(e),onAbout:y,onRequestFeedback:On,onOpenBeside:q&&K(`composition.apply`)&&q.nodes.some(t=>t.id===e)?t=>void Ct(e,t):void 0}});return j?(0,W.jsxs)(W.Fragment,{children:[d,(0,W.jsx)(Pt,{view:r,process:j,client:n,snapshot:t,children:m})]}):a?(0,W.jsxs)(W.Fragment,{children:[d,(0,W.jsx)(Ee,{live:M,snapshot:t,resource:a,viewId:e,onOpenRef:nt,children:p&&(0,W.jsx)(p,{projectId:t.project.id,viewId:e,resource:a,snapshot:t,client:n,principalId:E,headerTarget:Ln(e),selectionScope:s(r),onOpenResource:nt,requestFeedback:On?()=>On(e):void 0},a.id+a.version+e)}),m]}):(0,W.jsxs)(W.Fragment,{children:[d,m]})},zn={label:e=>T(I.get(e)),container:An,title:e=>{let n=I.get(e);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(r,{name:ue(n,t),size:14,stroke:2}),(0,W.jsx)(`span`,{className:`shell-tab-name`,children:T(n)}),je?.viewId===e&&(0,W.jsxs)(`span`,{className:`agent-presence`+(je.live?` live`:``),title:je.label,children:[(0,W.jsx)(`span`,{className:`pulse-dot`,"aria-hidden":`true`}),je.verb]})]})}},Bn=e=>B.length===1?`Views`:`Views ${B.findIndex(t=>t.id===e)+1} of ${B.length}`,Vn=e=>{let t=e.kind===`tabs`?et(e):i(e)[0];return t?T(I.get(t)):`view`},Hn=e=>e.kind===`tabs`?(0,W.jsx)(qt,{group:e,name:Bn(e.id),selected:et(e),onSelect:t=>{t!==et(e)&&O?.(),L(t)},onHeader:Pn(e.id),render:zn,drag:$,tools:gn(e)},e.id):(0,W.jsx)(Yt,{region:e,weights:mt[e.id]??e.weights,onResize:t=>an(e.id,t),label:t=>`Resize ${Vn(e.children[t-1])} and ${Vn(e.children[t])}`,children:e.children.map(Hn)},e.id);(0,D.useEffect)(()=>{if(!Te)return;let n=[],r=I.get(z),i=r?T(r):``;if(q&&r&&K(`composition.apply`)&&(q.nodes.some(e=>e.id===z)||te(r,t))){let e=z,t=(e,t,a)=>{let o=l(q,r,X);o&&a(o)&&n.push({id:e,label:t,icon:`layout`,meta:i,run:()=>{let e=Y(),t=e&&l(e,r,X),n=t&&a(t);n&&Q(n)}})};t(`layout-split-right`,`Split right`,t=>c(t,e,`horizontal`,X)),t(`layout-split-down`,`Split down`,t=>c(t,e,`vertical`,X)),t(`layout-next`,`Move to the next group`,t=>b(t,e,1,X)),t(`layout-previous`,`Move to the previous group`,t=>b(t,e,-1,X)),n.push({id:`layout-close`,label:`Close view`,icon:`close`,meta:i,run:()=>pn(e)})}K(`composition.undo`)&&e.history?.length&&n.push({id:`layout-undo`,label:`Undo layout change`,icon:`refresh`,run:()=>void yt()}),Te(n.length?{label:`Layout`,commands:n}:null)},[z,e,t.catalog,N.views]),(0,D.useEffect)(()=>()=>Te?.(null),[]);let Un=(0,D.useId)(),Wn=(0,D.useRef)(null);Kt(Wn,z,V);function Gn(e){let t=F.indexOf(z),n=F.length,r={ArrowRight:(t+1)%n,ArrowLeft:(t-1+n)%n,Home:0,End:n-1}[e.key];r!==void 0&&(e.preventDefault(),L(F[r]),e.currentTarget.querySelectorAll(`[role=tab]`)[r]?.focus())}let Kn=M.screen?.views.find(e=>e.id===z)?.object??null,qn=()=>{it(e=>!e),Oe?.(),M.act({kind:`reveal`,target:rt?null:M.screen?.agent?.object??`workspace`})},Jn=Be&&(0,W.jsx)(vt,{live:M,evidence:rt,held:ot.length-st.length,onEvidence:qn,attention:Ve});return(0,W.jsx)(ae.Provider,{value:Qt,children:(0,W.jsx)(ee.Provider,{value:nn,children:(0,W.jsxs)(`section`,{className:`workspace shell`,"aria-label":`Layout`,children:[Jn&&(k?(0,Ne.createPortal)(Jn,k):k===void 0&&Jn),De&&(0,Ne.createPortal)((0,W.jsx)(bt,{live:M,agents:t.agents,contexts:t.contexts,prepare:We,principalId:E,evidence:rt,onEvidence:qn,focusObject:Kn}),De),(0,W.jsx)(St,{live:M,items:st,onHide:e=>R(t=>[...t,e])}),ht&&(0,W.jsxs)(`div`,{className:`shell-interruption problem`,"data-rho-layer":`transient`,"data-rho-interruption":``,role:`alert`,children:[(0,W.jsx)(`span`,{className:`shell-interruption-text`,children:ht}),(0,W.jsx)(`button`,{className:`shell-quiet`,onClick:()=>G(``),children:`Dismiss`})]}),(0,W.jsx)(wt,{live:M}),(0,W.jsxs)(`div`,{ref:qe,className:`shell-stage`,onPointerDownCapture:e=>M.hold(e.target.closest(`[data-owner-view]`)?.dataset.ownerView??z),onKeyDownCapture:e=>{M.hold(z),!e.metaKey&&!e.ctrlKey&&e.key.length===1&&O?.()},onCompositionStartCapture:()=>M.hold(z),children:[S&&be&&yn&&vn&&_n&&t.feedback?.draftDocumentId&&(0,Ne.createPortal)(xn?(0,W.jsxs)(`section`,{className:`unavailable`,role:`status`,children:[(0,W.jsx)(`h3`,{children:`Close a view before opening feedback`}),(0,W.jsx)(`p`,{children:`Existing views and input are kept within this layout's view limit.`})]}):(0,W.jsx)(_n.View,{viewId:`feedback:`+yn,view:{id:`feedback:`+yn,component:_n.component,version:_n.componentVersion,props:{title:`Your question`,taskId:t.feedback.taskId,sourceSelectionScope:I.get(yn)?s(I.get(yn)):{kind:`shared`,id:yn}},bindings:{draft:{kind:`live-document`,documentId:t.feedback.draftDocumentId}}},projectId:t.project.id,snapshot:t,client:n,active:!0,principalId:E,contextTarget:null,feedbackConfiguration:{...t.feedback,draftDocumentId:t.feedback.draftDocumentId}},[t.project.id,t.feedback.taskId,yn,E].join(`:`)),S),P?V?(0,W.jsxs)(`section`,{className:`shell-group`,children:[(0,W.jsxs)(`div`,{className:`shell-tabbar`,children:[(0,W.jsx)(`div`,{ref:Wn,className:`shell-tabs`,role:`tablist`,"aria-label":`Views`,onKeyDown:Gn,children:F.map((e,t)=>(0,W.jsxs)(`div`,{className:`shell-tab`,"data-closable":ln?``:void 0,children:[(0,W.jsx)(`button`,{id:Un+t,role:`tab`,"aria-selected":e===z,"aria-controls":Un+`panel`,tabIndex:e===z?0:-1,"aria-keyshortcuts":ln?`Delete`:void 0,onClick:()=>{e!==z&&O?.(),L(e)},onKeyDown:t=>{t.key===`Delete`&&ln&&(t.preventDefault(),pn(e))},children:(0,W.jsx)(`span`,{className:`shell-tab-name`,children:T(I.get(e))})}),ln&&e===z&&(0,W.jsx)(`button`,{className:`shell-tab-close`,tabIndex:-1,"aria-hidden":`true`,title:`Close `+T(I.get(e)),onClick:()=>pn(e),children:(0,W.jsx)(r,{name:`close`,size:12,stroke:2})})]},e))}),ln&&A&&(0,W.jsx)(Jt,{name:`Views`,content:()=>A(m(d(P,z)?.id??P.id))})]}),(0,W.jsx)(`div`,{className:`shell-header-slot shell-header-narrow`,ref:Pn(`narrow`)}),z&&(0,W.jsx)(Gt,{container:An(z),id:Un+`panel`,labelledBy:Un+F.indexOf(z)},z)]}):Hn(U??P):Le??(0,W.jsxs)(`div`,{className:`empty`,children:[(0,W.jsx)(`h2`,{children:`No views in this layout`}),(0,W.jsx)(`p`,{children:`The saved layout is empty. No view is created automatically.`})]}),$?.dragging&&!V&&(0,W.jsxs)(`div`,{className:`shell-edges`,"aria-hidden":`true`,children:[[`left`,`right`,`top`,`bottom`].map(e=>(0,W.jsx)(`div`,{className:`shell-edge`,"data-side":e,"data-over":$.target&&`edge`in $.target&&$.target.edge===e?``:void 0,onDragOver:t=>{t.preventDefault(),t.dataTransfer.dropEffect=`move`,$.target&&`edge`in $.target&&$.target.edge===e||$.over({edge:e})},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||$.over(null)},onDrop:t=>{t.preventDefault(),$.drop({edge:e})}},e)),$.target&&`edge`in $.target&&(0,W.jsx)(`div`,{className:`shell-edge-preview`,"data-side":$.target.edge})]}),un&&ln&&(0,W.jsxs)(`div`,{className:`shell-closed`,role:`status`,children:[(0,W.jsxs)(`span`,{children:[`Closed `,un.label]}),(0,W.jsx)(`button`,{className:`shell-link`,onClick:()=>void mn(),children:`Undo`}),(0,W.jsx)(`button`,{className:`shell-quiet`,"aria-label":`Dismiss`,onClick:()=>dn(null),children:(0,W.jsx)(r,{name:`close`,size:13})})]}),[...wn.current].filter(e=>I.has(e)).map(e=>(0,Ne.createPortal)(Rn(e),An(e),e))]})]})})})}export{Zt as Workspace};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|