@kky42/pievo-server 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{MarkdownView-BuFKr9Jg.js → MarkdownView-C9-AzIkl.js} +1 -1
  3. package/.output/public/assets/{actionUi-BZrLpgHT.js → actionUi-D47jwMfh.js} +1 -1
  4. package/.output/public/assets/app-C5xfpeJe.css +2 -0
  5. package/.output/public/assets/index-BgNjFXWE.js +10 -0
  6. package/.output/public/assets/loops._loopId-Bo63FXPQ.js +2 -0
  7. package/.output/public/assets/loops._loopId_.runs._runId-DW2HPjtj.js +3 -0
  8. package/.output/public/assets/{preload-helper-BSxGu4d0.js → preload-helper-CbYqBpY9.js} +2 -2
  9. package/.output/public/assets/routes-C88oSApK.js +1 -0
  10. package/.output/public/assets/routes-CTCh8xYm.js +1 -0
  11. package/.output/server/_ssr/{MachinesModal-CLBZxZkq.mjs → MachinesModal-DwHy2cis.mjs} +43 -24
  12. package/.output/server/_ssr/{MarkdownView-D1J7ImYF.mjs → MarkdownView-BOe75tli.mjs} +3 -6
  13. package/.output/server/_ssr/{actionUi-DE-Pb2tv.mjs → actionUi-CszQXDSN.mjs} +20 -2
  14. package/.output/server/_ssr/artifactFiles-DJiK99sF.mjs +67 -0
  15. package/.output/server/_ssr/{artifactKind-a2oxT2wQ.mjs → artifactKind-DYMU0q3N.mjs} +2 -7
  16. package/.output/server/_ssr/{boot-DmpKtb0A.mjs → boot-CecCDRoH.mjs} +218 -204
  17. package/.output/server/_ssr/{lifecycleUi-DEjM8Etm.mjs → lifecycleUi-Bd7_sthp.mjs} +8 -15
  18. package/.output/server/_ssr/{loopApi-DK1lQPrx.mjs → loopApi-uEiBQ5YX.mjs} +12 -18
  19. package/.output/server/_ssr/{loopProjection-DdFivf7-.mjs → loopProjection-Bo54jjGd.mjs} +3 -2
  20. package/.output/server/_ssr/{loops._loopId-DVCvGSEc.mjs → loops._loopId-c1oRP7cr.mjs} +15 -30
  21. package/.output/server/_ssr/{loops._loopId_.runs._runId-BXbTfLlC.mjs → loops._loopId_.runs._runId-Dl0SwOlC.mjs} +28 -19
  22. package/.output/server/_ssr/loops._loopId_.runs._runId-czMVvNsk.mjs +11 -0
  23. package/.output/server/_ssr/{machineFns-DLRHgDdS.mjs → machineFns-aw9xe5oz.mjs} +6 -20
  24. package/.output/server/_ssr/{router-BhHsTGqu.mjs → router-3OQ849sN.mjs} +22 -31
  25. package/.output/server/_ssr/{routes-CCallyCT.mjs → routes-CL4y6AEv.mjs} +2 -2
  26. package/.output/server/_ssr/{routes-CL2Kef-Q.mjs → routes-CT5IdoiP.mjs} +6 -6
  27. package/.output/server/_ssr/{routes-ngpX7h8D.mjs → routes-nU2PDK3W.mjs} +2 -2
  28. package/.output/server/_ssr/ssr.mjs +22 -22
  29. package/.output/server/{_tanstack-start-manifest_v-BPiJ4yWT.mjs → _tanstack-start-manifest_v-_nMS2ozp.mjs} +8 -8
  30. package/.output/server/drizzle/0002_run_attention.sql +1 -0
  31. package/.output/server/drizzle/meta/_journal.json +7 -0
  32. package/.output/server/index.mjs +49 -49
  33. package/drizzle/0002_run_attention.sql +1 -0
  34. package/drizzle/meta/_journal.json +7 -0
  35. package/package.json +1 -1
  36. package/.output/public/assets/app-x1CeeY7N.css +0 -2
  37. package/.output/public/assets/index-D0FIKiiW.js +0 -10
  38. package/.output/public/assets/loops._loopId-DTkIz4C0.js +0 -2
  39. package/.output/public/assets/loops._loopId_.runs._runId-CsV2Ih4Z.js +0 -3
  40. package/.output/public/assets/routes-BIOJZsig.js +0 -1
  41. package/.output/public/assets/routes-m4Z90DTR.js +0 -1
  42. package/.output/server/_ssr/artifactFiles-B0NPRDOR.mjs +0 -52
  43. package/.output/server/_ssr/loops._loopId_.runs._runId-Dr6E-FA5.mjs +0 -16
@@ -1,2 +0,0 @@
1
- import{A as e,C as t,E as n,I as r,L as i,M as a,O as o,S as s,T as c,a as l,b as u,d,f,g as p,h as m,i as h,l as g,m as _,n as ee,o as te,r as ne,t as re,u as ie,v,y,z as ae}from"./actionUi-BZrLpgHT.js";import{E as oe,T as b,_ as se,c as x,g as ce,h as le,i as ue,n as de,o as fe,p as pe,r as me,s as S,u as he,v as ge,y as _e}from"./preload-helper-BSxGu4d0.js";import{a as ve,c as C,n as w,o as ye,s as T}from"./index-D0FIKiiW.js";import{t as E}from"./MarkdownView-BuFKr9Jg.js";var D=ae(i(),1),O={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,avif:`image/avif`,bmp:`image/bmp`,ico:`image/x-icon`,svg:`image/svg+xml`};function k(e){return(e.match(/\.([a-z0-9]+)$/i)?.[1]??``).toLowerCase()}function A(e){return O[k(e)]??null}var j=e=>A(e)!==null,M=e=>k(e)===`html`||k(e)===`htm`,N=e=>k(e)===`md`||k(e)===`markdown`;function P(e){return j(e)?`image`:M(e)?`html`:N(e)?`markdown`:`text`}function F(e,t){let n=t.split(`/`).map(encodeURIComponent).join(`/`);return`/api/artifact/${encodeURIComponent(e)}/${n}`}function I(e,t){return`${F(e,t)}?view=inline`}var L=r();function R({path:e,meta:t,action:n}){return(0,L.jsxs)(`div`,{className:`sticky top-0 z-10 flex flex-wrap items-center gap-x-2 gap-y-1 border-b border-hairline bg-surface px-5 py-2.5`,children:[(0,L.jsx)(`span`,{className:`break-all font-mono text-label text-primary`,children:e}),t&&(0,L.jsxs)(`span`,{className:`font-mono text-caption text-disabled`,children:[`· `,t]}),n&&(0,L.jsx)(`span`,{className:`ml-auto shrink-0`,children:n})]})}function z({loopId:e,path:t,oversize:n}){return(0,L.jsx)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:n?(0,L.jsx)(`span`,{className:`text-disabled`,children:`Too large to preview - stored as metadata only (no synced bytes).`}):(0,L.jsxs)(L.Fragment,{children:[`Binary file - not previewable.`,` `,(0,L.jsx)(`a`,{href:F(e,t),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`})]})})}function B({loopId:e,path:t,mode:n,onMode:r,showToggle:i}){return(0,L.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-hairline bg-surface px-5 py-1.5`,children:[i&&n&&r&&(0,L.jsx)(`div`,{className:`inline-flex overflow-hidden rounded-control border border-hairline`,children:[`preview`,`source`].map(e=>(0,L.jsx)(`button`,{type:`button`,onClick:()=>r(e),className:`cursor-pointer border-none px-2.5 py-0.5 text-caption font-medium transition-colors ${n===e?`bg-raised text-display`:`bg-transparent text-secondary hover:text-display`}`,children:e===`preview`?`Preview`:`Source`},e))}),(0,L.jsx)(`a`,{href:F(e,t),download:!0,className:`ml-auto shrink-0 text-caption font-medium text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download ↓`})]})}function V({html:e}){return(0,L.jsx)(`iframe`,{title:`Rendered HTML artifact (sandboxed)`,srcDoc:e,sandbox:`allow-scripts`,referrerPolicy:`no-referrer`,className:`h-[min(70vh,620px)] w-full border-0 bg-white`})}function H({loopId:e,file:t}){let[n,r]=(0,D.useState)(!1);return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(B,{loopId:e,path:t.path,showToggle:!1}),n?(0,L.jsxs)(`div`,{className:`px-5 py-8 text-body text-secondary`,children:[`Couldn't load this image.`,` `,(0,L.jsx)(`a`,{href:F(e,t.path),download:!0,className:`text-interactive underline underline-offset-2 transition-colors hover:text-display`,children:`Download`}),` `,`instead.`]}):(0,L.jsx)(`div`,{className:`flex justify-center overflow-auto px-5 py-6`,children:(0,L.jsx)(`img`,{src:I(e,t.path),alt:t.path,onError:()=>r(!0),className:`max-w-full rounded-control border border-hairline bg-white object-contain`})})]})}function U({loopId:e,file:t,kind:n}){let[r,i]=(0,D.useState)({loading:!0}),[a,o]=(0,D.useState)(`preview`);if((0,D.useEffect)(()=>{let n=!0;return i({loading:!0}),S({data:{loopId:e,path:t.path}}).then(e=>n&&i(e)).catch(e=>n&&i({error:String(e)})),()=>{n=!1}},[e,t.path,t.updatedAt]),`loading`in r)return(0,L.jsx)(`div`,{className:`px-5 py-6 text-body text-disabled`,children:`Loading…`});if(`binary`in r)return(0,L.jsx)(z,{loopId:e,path:t.path,oversize:r.oversize});if(`error`in r)return(0,L.jsxs)(`div`,{className:`px-5 py-6 text-body text-accent`,children:[`Couldn't load this file - `,r.error]});let s=r.text||`(empty file)`,c=n===`html`||n===`markdown`,l=!c||a===`source`;return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(B,{loopId:e,path:t.path,mode:a,onMode:o,showToggle:c}),n===`html`&&!l?(0,L.jsx)(V,{html:r.text||``}):n===`markdown`&&!l?(0,L.jsx)(E,{content:s}):(0,L.jsx)(`pre`,{className:`m-0 overflow-x-auto whitespace-pre-wrap px-5 py-4 font-mono text-label leading-relaxed text-secondary`,children:s})]})}function W({loopId:e,file:t}){let n=P(t.path);return t.oversize?(0,L.jsx)(z,{loopId:e,path:t.path,oversize:!0}):n===`image`?(0,L.jsx)(H,{loopId:e,file:t},`${t.path}:${t.updatedAt??``}`):t.binary?(0,L.jsx)(z,{loopId:e,path:t.path,oversize:!1}):(0,L.jsx)(U,{loopId:e,file:t,kind:n},t.path)}function be({loopId:e,configuredPaths:t,running:r}){let[i,a]=(0,D.useState)(null),[s,c]=(0,D.useState)(null),l=(0,D.useRef)(0),u=(0,D.useCallback)(async()=>{let t=++l.current;try{let n=await x({data:{loopId:e}});t===l.current&&a(n)}catch{t===l.current&&a(e=>e??[])}},[e]);(0,D.useEffect)(()=>{a(null),c(null),u()},[e,u]),(0,D.useEffect)(()=>{let e=setInterval(()=>void u(),r?4e3:12e3);return()=>clearInterval(e)},[r,u]);let d=i??[],f=s&&d.some(e=>e.path===s)?s:d[0]?.path??null,p=d.find(e=>e.path===f)??null;return(0,L.jsxs)(`section`,{id:`files`,className:`min-w-0`,children:[(0,L.jsxs)(`div`,{className:`mb-2.5 flex items-end justify-between gap-3 border-b border-hairline pb-1.5`,children:[(0,L.jsxs)(`h2`,{className:`text-label font-semibold text-secondary`,children:[`Files`,i?` (${d.length})`:``]}),(0,L.jsxs)(`span`,{className:`text-caption font-medium text-disabled`,children:[`MEMORY.md + `,t.length,` artifact`,t.length===1?``:`s`]})]}),d.length===0?(0,L.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled shadow-card`,children:i==null?`Loading…`:`No loop file has been written yet. Runs create MEMORY.md and any configured artifacts.`}):(0,L.jsxs)(`div`,{className:`grid h-[min(600px,68vh)] grid-cols-1 overflow-hidden rounded-card border border-hairline bg-surface shadow-card sm:grid-cols-[210px_1fr]`,children:[(0,L.jsx)(`nav`,{className:`max-h-44 overflow-y-auto border-b border-hairline sm:max-h-none sm:border-b-0 sm:border-r`,children:(0,L.jsx)(`ul`,{className:`py-1.5`,children:d.map(e=>{let t=e.path===f;return(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,onClick:()=>c(e.path),className:`flex w-full items-center border-l-2 px-3 py-2 text-left transition-colors ${t?`border-display bg-raised`:`border-transparent hover:bg-raised/60`}`,children:(0,L.jsx)(`span`,{className:`block min-w-0 flex-1 truncate font-mono text-label ${t?`text-display`:`text-primary`}`,title:e.path,children:e.path})})},e.path)})})}),(0,L.jsx)(`div`,{className:`min-w-0 overflow-y-auto`,children:p&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(R,{path:p.path,meta:[p.size==null?``:o(p.size),`updated ${n(p.updatedAt)}`].filter(Boolean).join(` · `)}),(0,L.jsx)(W,{loopId:e,file:p})]})})]})]})}var xe=[`claude-code`,`codex`,`pi`],Se=new Set([`all loops`,`active`,`paused`,`blocked`]);function Ce(e){return e.normalize(`NFKC`).trim().replace(/\s+/gu,` `).toLocaleLowerCase(`en-US`)}function G(e){if(e===void 0)return{ok:!0,value:[]};if(!Array.isArray(e))return{ok:!1,detail:`tags must be an array of strings`};if(e.length>4)return{ok:!1,detail:`tags must contain at most 4 values`};let t=[],n=new Set;for(let r of e){if(typeof r!=`string`)return{ok:!1,detail:`tags must contain only strings`};if(/\p{Cc}|\p{Cf}|\p{Default_Ignorable_Code_Point}/u.test(r))return{ok:!1,detail:`tags must not contain control or invisible characters`};let e=Ce(r);if(!e)return{ok:!1,detail:`tags must not contain empty values`};if([...e].length>64)return{ok:!1,detail:`each tag must contain at most 64 characters`};if(Se.has(e))return{ok:!1,detail:`reserved tag: ${e}`};if(n.has(e))return{ok:!1,detail:`duplicate tag: ${e}`};n.add(e),t.push(e)}return{ok:!0,value:[...t].sort()}}var K={"claude-code":`Claude Code`,codex:`Codex`,pi:`Pi`},q=`mt-1 text-caption leading-snug text-disabled`;function J(e){let t=e?.schedule;return{name:e?.name??``,tags:e?.tags??[],tagDraft:``,mode:t?.mode??`cron`,cron:t?.mode===`cron`?t.cron:`0 */3 * * *`,timezone:t?.mode===`cron`?t.timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`,overlap:t?.mode===`cron`?t.overlap:`queue-one`,delayMinutes:String(t?.mode===`continuous`?t.delayMinutes:1),workdir:e?.workdir??``,agent:e?.agent??`claude-code`,model:e?.model??``,reasoningEffort:e?.reasoningEffort??``,prompt:e?.prompt??``,keep:e?.statusDefinitions?.keep??``,noChange:e?.statusDefinitions?.noChange??``,block:e?.statusDefinitions?.block??``,artifacts:(e?.artifacts??[]).join(`
2
- `)}}function Y({title:e,hint:t}){return(0,L.jsxs)(`div`,{className:`mb-3 mt-7 border-b border-hairline pb-1.5 first:mt-2`,children:[(0,L.jsx)(`h2`,{className:y,children:e}),t&&(0,L.jsx)(`div`,{className:`mt-0.5 text-caption text-disabled`,children:t})]})}function X({label:e,value:t,onChange:n,mono:r,hint:i,placeholder:a}){let o=(0,D.useId)();return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`label`,{htmlFor:o,className:p,children:e}),(0,L.jsx)(`input`,{id:o,className:`${m} ${r?`font-mono`:``}`,value:t,placeholder:a,onChange:e=>n(e.target.value)}),i&&(0,L.jsx)(`div`,{className:q,children:i})]})}function Z({label:e,value:t,onChange:n,rows:r=4,mono:i,hint:a}){let o=(0,D.useId)();return(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`label`,{htmlFor:o,className:p,children:e}),(0,L.jsx)(`textarea`,{id:o,rows:r,className:`${m} h-auto resize-y ${i?`font-mono`:``}`,value:t,onChange:e=>n(e.target.value)}),a&&(0,L.jsx)(`div`,{className:q,children:a})]})}var we=(0,D.forwardRef)(function({initial:e},t){let[n,r]=(0,D.useState)(()=>J(e)),[i,a]=(0,D.useState)(null),[o,s]=(0,D.useState)(null),c=(0,D.useId)(),l=(0,D.useId)(),d=(0,D.useId)(),f=(0,D.useRef)(null),m=(0,D.useRef)(null),h=(e,t)=>r(n=>({...n,[e]:t})),g=()=>{let e=n.tagDraft.trim()?[n.tagDraft]:[];if(!e.length){h(`tagDraft`,``);return}let t=G([...n.tags,...e]);if(!t.ok){s(t.detail);return}r(e=>({...e,tags:t.value,tagDraft:``})),s(null),t.value.length===4&&requestAnimationFrame(()=>{document.activeElement===document.body&&f.current?.focus()})};return(0,D.useImperativeHandle)(t,()=>({read(){let e=[[`Name`,n.name],[`Working directory`,n.workdir],[`Prompt`,n.prompt],[`Keep definition`,n.keep],[`No-change definition`,n.noChange],[`Block definition`,n.block]].find(([,e])=>!e.trim());if(e)return a(`${e[0]} is required.`),null;let t=G([...n.tags,...n.tagDraft.trim()?[n.tagDraft]:[]]);if(!t.ok)return s(t.detail),a(null),null;let r=Number(n.delayMinutes);if(n.mode===`continuous`&&(!Number.isInteger(r)||r<1))return a(`Continuous delay must be an integer of at least 1 minute.`),null;let i=n.mode===`cron`?{mode:`cron`,cron:n.cron.trim(),timezone:n.timezone.trim(),overlap:n.overlap}:{mode:`continuous`,delayMinutes:r};return a(null),s(null),{name:n.name.trim(),tags:t.value,schedule:i,workdir:n.workdir.trim(),agent:n.agent,model:n.model.trim()||null,reasoningEffort:n.reasoningEffort.trim()||null,prompt:n.prompt,statusDefinitions:{keep:n.keep,noChange:n.noChange,block:n.block},artifacts:n.artifacts.split(/\r?\n/).filter(e=>e.length>0)}}})),(0,L.jsxs)(`div`,{className:`grid gap-x-10 lg:grid-cols-[minmax(300px,380px)_minmax(0,1fr)]`,children:[(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(Y,{title:`Basics`}),(0,L.jsx)(X,{label:`Name`,value:n.name,onChange:e=>h(`name`,e)}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{id:c,className:p,children:`Tags`}),(0,L.jsxs)(`div`,{ref:f,role:`group`,tabIndex:-1,"aria-labelledby":c,"aria-describedby":`${l}${o?` ${d}`:``}`,"aria-invalid":o?`true`:void 0,className:`flex min-h-10 flex-wrap items-center gap-1.5 rounded-control border border-wire bg-surface px-2.5 py-1.5 outline-none transition-shadow focus-within:border-transparent focus-within:shadow-focus`,children:[n.tags.map(e=>(0,L.jsxs)(`span`,{className:`inline-flex h-6 max-w-full items-center gap-1 rounded-full bg-raised px-2.5 text-caption font-medium text-secondary`,children:[(0,L.jsx)(`span`,{className:`max-w-52 truncate`,title:e,children:e}),(0,L.jsx)(`button`,{type:`button`,"aria-label":`Remove tag ${e}`,onClick:()=>{h(`tags`,n.tags.filter(t=>t!==e)),s(null),requestAnimationFrame(()=>(m.current??f.current)?.focus())},className:`-mr-1 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-full text-disabled transition-colors hover:bg-surface hover:text-primary ${_}`,children:(0,L.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e)),n.tags.length<4&&(0,L.jsx)(`input`,{ref:m,"aria-label":`Add tag`,value:n.tagDraft,placeholder:n.tags.length?`Add another…`:`Add a tag…`,onChange:e=>{h(`tagDraft`,e.target.value),s(null)},onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Enter`?(e.preventDefault(),g()):e.key===`Backspace`&&!n.tagDraft&&n.tags.length&&h(`tags`,n.tags.slice(0,-1)))},onBlur:g,className:`h-6 min-w-28 flex-1 bg-transparent px-1 text-sm text-primary outline-none placeholder:text-disabled`})]}),(0,L.jsxs)(`div`,{id:l,className:q,children:[`Up to `,4,`. Press Enter to add.`]}),o&&(0,L.jsx)(`div`,{id:d,role:`alert`,className:`mt-1 text-caption text-accent`,children:o})]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`label`,{className:p,children:`Schedule`}),(0,L.jsxs)(`select`,{"aria-label":`Schedule`,className:u,value:n.mode,onChange:e=>h(`mode`,e.target.value),children:[(0,L.jsx)(`option`,{value:`cron`,children:`Cron`}),(0,L.jsx)(`option`,{value:`continuous`,children:`Continuous`})]})]}),n.mode===`cron`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(X,{label:`Cron expression`,value:n.cron,onChange:e=>h(`cron`,e),mono:!0}),(0,L.jsx)(X,{label:`Timezone`,value:n.timezone,onChange:e=>h(`timezone`,e),mono:!0,hint:`IANA timezone, for example America/Los_Angeles.`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`label`,{className:p,children:`Cron overlap`}),(0,L.jsxs)(`select`,{"aria-label":`Cron overlap`,className:u,value:n.overlap,onChange:e=>h(`overlap`,e.target.value),children:[(0,L.jsx)(`option`,{value:`skip`,children:`Skip occurrence`}),(0,L.jsx)(`option`,{value:`queue-one`,children:`Queue one follow-up`})]}),(0,L.jsx)(`div`,{className:q,children:`Applies only when a cron occurrence is due while a run is still open.`})]})]}):(0,L.jsx)(X,{label:`Delay after terminal run (minutes)`,value:n.delayMinutes,onChange:e=>h(`delayMinutes`,e),mono:!0}),(0,L.jsx)(Y,{title:`Execution`}),(0,L.jsx)(X,{label:`Working directory`,value:n.workdir,onChange:e=>h(`workdir`,e),mono:!0,placeholder:`/Users/you/project`}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(`label`,{className:p,children:`Coding agent`}),(0,L.jsx)(`select`,{"aria-label":`Coding agent`,className:u,value:n.agent,onChange:e=>h(`agent`,e.target.value),children:xe.map(e=>(0,L.jsx)(`option`,{value:e,children:K[e]??e},e))})]}),(0,L.jsx)(X,{label:`Model`,value:n.model,onChange:e=>h(`model`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`}),(0,L.jsx)(X,{label:`Reasoning effort`,value:n.reasoningEffort,onChange:e=>h(`reasoningEffort`,e),placeholder:`default`,hint:`Optional. Empty uses the agent default.`})]}),(0,L.jsxs)(`div`,{className:`min-w-0`,children:[(0,L.jsx)(Y,{title:`Prompt`,hint:`Sent unchanged before Pievo appends the report contract.`}),(0,L.jsx)(Z,{label:`User prompt`,value:n.prompt,onChange:e=>h(`prompt`,e),rows:10}),(0,L.jsx)(Y,{title:`Status definitions`,hint:`All three definitions are required and are appended to every run.`}),(0,L.jsx)(Z,{label:`keep`,value:n.keep,onChange:e=>h(`keep`,e),rows:2}),(0,L.jsx)(Z,{label:`no-change`,value:n.noChange,onChange:e=>h(`noChange`,e),rows:2}),(0,L.jsx)(Z,{label:`block`,value:n.block,onChange:e=>h(`block`,e),rows:2}),(0,L.jsx)(Y,{title:`Artifacts`,hint:`Optional .md or .html file names (up to 4, 2 MB each) that runs update and the dashboard renders. One name per line. Every loop also has MEMORY.md.`}),(0,L.jsx)(Z,{label:`Artifact files`,value:n.artifacts,onChange:e=>h(`artifacts`,e),rows:6,mono:!0}),i&&(0,L.jsx)(`div`,{className:`mt-4 text-body text-accent`,children:i})]})]})}),Te={"claude-code":`Claude Code`,codex:`Codex`,pi:`Pi`};function Ee({id:t}){let n=oe(),[r,i]=(0,D.useState)(null),[a,o]=(0,D.useState)(null),[s,c]=(0,D.useState)(null),[u,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(!1),[_,v]=(0,D.useState)(null),[ae,x]=(0,D.useState)(!1),[S,w]=h(),[T,E]=(0,D.useState)([]),O=(0,D.useRef)(null),k=(0,D.useRef)(!1),A=(0,D.useCallback)(async(e=!1)=>{try{let e=await he({data:t});i(e),k.current=e.summary.deleteRequestedAt!=null,o(null)}catch(t){k.current?n({to:`/`}):e||o(String(t))}},[t]);(0,D.useEffect)(()=>{i(null),f(!1),x(!1),E([]),A()},[t,A]);let j=!!r?.summary.running;(0,D.useEffect)(()=>{if(u)return;let e=setInterval(()=>void A(!0),j||k.current?3e3:8e3);return()=>clearInterval(e)},[u,j,A]);async function M(){c(null),v(`run`);try{let e=await se({data:t});if(e.error)return c(`Run failed: ${e.error}`);w({label:e.coalesced?`Already queued`:`Queued`,hold:4e3}),await A()}finally{v(null)}}async function N(e){c(null),v(`lifecycle`);try{let r=e===`pause`?await ce({data:t}):e===`start`?await ge({data:t}):e===`stop`?await _e({data:t}):await fe({data:t});if(r.error)return c(`${e[0].toUpperCase()+e.slice(1)} failed: ${r.error}`);if(x(!1),r.deleted)return n({to:`/`});e===`delete`&&(k.current=!0),await A(),w({label:e===`start`?`Started`:e===`pause`?`Paused`:e===`stop`?`Stop requested`:`Deleting`})}finally{v(null)}}async function P(){let e=O.current?.read();if(e){c(null),v(`save`);try{let n=await le({data:{id:t,patch:e}});if(n.error)return c(`Save failed: ${n.error}`);f(!1),await A(),w({label:`Saved`})}finally{v(null)}}}let F=(0,L.jsxs)(b,{to:`/`,className:`inline-flex items-center gap-1.5 text-meta font-medium text-secondary hover:text-display`,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Loops`]});if(a)return(0,L.jsx)($,{back:F,children:(0,L.jsx)(ne,{title:`Couldn't load this loop.`,detail:a,onRetry:()=>void A()})});if(!r)return(0,L.jsx)($,{back:F,children:(0,L.jsx)(te,{})});let{loop:I,summary:R,runs:z}=r,B=ue(R)===`deleting`,V=R.enabled&&!B,H=!R.enabled&&!B,U=_!=null,W=me(r.machine.daemonProtocol),xe=!B&&!!R.running&&W.supported,Se=r.machine.online,Ce=r.machine.presence===`asleep`;if(u)return(0,L.jsxs)($,{back:F,children:[(0,L.jsx)(Oe,{name:R.name,onBack:()=>f(!1)}),(0,L.jsxs)(`div`,{className:`mt-5 rounded-card border border-hairline bg-surface px-6 pb-6 pt-2 shadow-card`,children:[(0,L.jsx)(we,{ref:O,initial:I}),(0,L.jsxs)(`div`,{className:`mt-7 border-t border-hairline pt-4`,children:[s&&(0,L.jsx)(l,{message:s,onDismiss:()=>c(null),className:`mb-3`}),(0,L.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,L.jsx)(`button`,{className:d,disabled:_===`save`,onClick:()=>void P(),children:_===`save`?`Saving…`:`Save`}),(0,L.jsx)(`button`,{className:g,disabled:_===`save`,onClick:()=>f(!1),children:`Cancel`})]})]})]})]});let G=I.schedule.mode===`cron`?`${I.schedule.cron} · ${I.schedule.timezone} · overlap ${I.schedule.overlap}`:`continuous · ${I.schedule.delayMinutes}m after terminal`,K=I.model||`default`,q=I.reasoningEffort||`default`,J=T.length?C(R.runs,T):R.runs,Y=async()=>{let e=J[0];if(!e)return 0;let n=await pe({data:{loopId:t,beforeTs:e.ts,limit:16}});return n.length&&E(e=>C(e,n)),n.length};return(0,L.jsxs)($,{back:F,children:[(0,L.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-[26px] pb-5 pt-[22px] shadow-card`,children:[(0,L.jsx)(ye,{loop:R,runs:J,onLoadMore:Y,onPickRun:e=>n({to:`/loops/$loopId/runs/$runId`,params:{loopId:t,runId:e.id}})}),(0,L.jsxs)(`div`,{className:`mt-5 border-t border-hairline pt-4`,children:[r.machine.needsUpdate&&(0,L.jsx)(De,{tone:`warn`,text:`Daemon update required · server requires v${r.machine.requiredDaemonVersion}; machine reports ${r.machine.daemonVersion?`v${r.machine.daemonVersion}`:`an unknown version`}.`,action:`Update daemon`,onAction:()=>m(!0)}),!Se&&(0,L.jsx)(De,{text:`Machine ${Ce?`seems asleep or offline`:`is offline`}; queued work starts when it reconnects.${r.machine.lastSeen?` Last seen ${e(r.machine.lastSeen)}.`:``}`,action:`Reconnect`,onAction:()=>m(!0)}),s&&(0,L.jsx)(l,{message:s,onDismiss:()=>c(null),className:`mb-2.5`}),S&&(0,L.jsx)(`div`,{className:`mb-2.5`,children:(0,L.jsx)(ee,{label:S.label,tone:S.tone,onUndo:S.undo})}),(0,L.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,L.jsx)(`button`,{className:d,disabled:U||B,onClick:()=>void M(),children:_===`run`?`Queuing…`:`Run once`}),(0,L.jsx)(`button`,{className:g,disabled:U||B,onClick:()=>f(!0),children:`Settings`}),(0,L.jsx)(`button`,{className:g,disabled:U||!H,onClick:()=>void N(`start`),children:`Start`}),(0,L.jsx)(`button`,{className:g,disabled:U||!V,onClick:()=>void N(`pause`),children:`Pause`}),(0,L.jsx)(`button`,{className:ie,disabled:U||!xe,title:R.running&&!W.supported?de:R.running?void 0:`No run is currently running`,onClick:()=>void N(`stop`),children:`Stop`}),(0,L.jsx)(`button`,{className:ie,disabled:U||B,onClick:()=>x(!0),children:B?`Deleting…`:`Delete`})]}),ae&&!B&&(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(re,{prompt:`Stop this loop and delete its server data?`,note:`This stops the loop and deletes server history, the loop memory, and artifacts. Files in the working directory are not deleted. If the machine is unreachable, its local process may continue running.`,cta:`Delete`,danger:!0,busy:U,onConfirm:()=>void N(`delete`),onCancel:()=>x(!1)})})]})]}),(0,L.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,L.jsx)(be,{loopId:t,configuredPaths:I.artifacts,running:j}),(0,L.jsx)(ke,{loopId:t,summary:R,runs:z,older:T,onPickRun:e=>n({to:`/loops/$loopId/runs/$runId`,params:{loopId:t,runId:e.id}}),onMore:Y})]}),(0,L.jsxs)(`section`,{className:`mt-6 min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,L.jsx)(`h2`,{className:`mb-4 border-b border-hairline pb-1.5 ${y}`,children:`Configuration`}),(0,L.jsxs)(`dl`,{className:`grid min-w-0 gap-x-6 gap-y-4 md:grid-cols-[180px_minmax(0,1fr)]`,children:[(0,L.jsx)(Q,{label:`Schedule`,children:(0,L.jsx)(`code`,{className:`break-all font-mono`,children:G})}),(0,L.jsx)(Q,{label:`Tags`,children:I.tags.length?(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:I.tags.map(e=>(0,L.jsx)(`span`,{className:`inline-flex h-[22px] max-w-52 items-center truncate rounded-full bg-raised px-2.5 text-caption font-medium text-secondary`,title:e,children:e},e))}):(0,L.jsx)(`span`,{className:`text-disabled`,children:`None`})}),(0,L.jsx)(Q,{label:`Working directory`,children:(0,L.jsx)(`code`,{className:`break-all font-mono`,children:I.workdir})}),(0,L.jsx)(Q,{label:`Agent`,children:Te[I.agent]}),(0,L.jsxs)(Q,{label:`Model / effort`,children:[K,` / `,q]}),(0,L.jsx)(Q,{label:`Prompt`,children:(0,L.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-sans`,children:I.prompt})}),(0,L.jsx)(Q,{label:`Status definitions`,children:(0,L.jsxs)(`ul`,{className:`space-y-1`,children:[(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`b`,{children:`keep:`}),` `,I.statusDefinitions.keep]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`b`,{children:`no-change:`}),` `,I.statusDefinitions.noChange]}),(0,L.jsxs)(`li`,{children:[(0,L.jsx)(`b`,{children:`block:`}),` `,I.statusDefinitions.block]})]})}),(0,L.jsx)(Q,{label:`Artifacts`,children:I.artifacts.length?(0,L.jsx)(`ul`,{className:`space-y-1`,children:I.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`code`,{className:`break-all font-mono`,children:e})},e))}):(0,L.jsx)(`span`,{className:`text-disabled`,children:`None`})})]})]}),(0,L.jsx)(ve,{open:p,onClose:()=>m(!1)})]})}function Q({label:e,children:t}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`dt`,{className:`text-label font-medium text-secondary`,children:e}),(0,L.jsx)(`dd`,{className:`min-w-0 text-body text-primary`,children:t})]})}function De({text:e,action:t,onAction:n,tone:r}){return(0,L.jsxs)(`div`,{className:`mb-2.5 flex flex-wrap items-center gap-3 rounded-control border px-4 py-2.5 text-meta ${r===`warn`?`border-warn/40 bg-warn/10`:`border-hairline bg-raised`}`,children:[(0,L.jsx)(`span`,{className:`text-secondary`,children:e}),(0,L.jsx)(`button`,{onClick:n,className:`ml-auto font-medium text-interactive underline`,children:t})]})}function Oe({name:e,onBack:t}){return(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`button`,{type:`button`,onClick:t,className:f,children:[(0,L.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]}),(0,L.jsxs)(`h1`,{className:`mt-2.5 text-[24px] font-semibold text-display`,children:[`Settings · `,e]}),(0,L.jsx)(`p`,{className:`mt-1.5 text-meta text-secondary`,children:`Edit tags, schedule, execution settings, prompt, status definitions, and artifact files.`})]})}function $({back:e,children:t}){return(0,L.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-10`,children:[(0,L.jsx)(`div`,{className:`mb-5`,children:e}),t]})}function ke({loopId:e,summary:n,runs:r,older:i,onMore:o,onPickRun:l}){let u=(0,D.useMemo)(()=>i.length?C(n.runs,i):n.runs,[n.runs,i]);return(0,L.jsxs)(`section`,{className:`min-w-0`,children:[(0,L.jsx)(`div`,{className:`mb-2.5 border-b border-hairline pb-1.5`,children:(0,L.jsxs)(`h2`,{className:y,children:[`Runs (`,n.runCount,`)`]})}),n.runCount===0?(0,L.jsx)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 py-10 text-center text-body text-disabled`,children:`Never run`}):(0,L.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-5 pb-4 pt-5 shadow-card`,children:[(0,L.jsx)(T,{loop:n,runs:u,total:n.runCount,onLoadMore:o,onPickRun:l}),(0,L.jsx)(`ul`,{className:`mt-5 max-h-[clamp(280px,46vh,520px)] divide-y divide-hairline overflow-y-auto border-t border-hairline`,children:r.map(n=>(0,L.jsx)(`li`,{children:(0,L.jsxs)(b,{to:`/loops/$loopId/runs/$runId`,params:{loopId:e,runId:n.id},className:`flex items-start gap-2.5 py-2.5 hover:bg-raised`,children:[(0,L.jsx)(`span`,{className:`mt-1 inline-block size-2.5 shrink-0 rounded-[2px]`,style:{background:s(n)},title:t(n)}),(0,L.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`span`,{className:`flex justify-between gap-2`,children:[(0,L.jsx)(`span`,{className:`font-mono text-label text-secondary`,children:a(n.ts)}),(0,L.jsx)(`span`,{className:`font-mono text-caption text-disabled`,children:c(n.durationMs)})]}),(0,L.jsx)(`span`,{className:`mt-0.5 block line-clamp-2 text-meta text-primary`,children:n.phase===`pending`?`Queued`:n.phase===`running`?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,L.jsx)(`span`,{className:`size-1.5 rounded-full`,style:v}),`Running`]}):n.error||n.message||t(n)})]})]})},n.id))})]})]})}function Ae(){let{loopId:e}=w.useParams();return(0,L.jsx)(Ee,{id:e})}export{Ae as component};
@@ -1,3 +0,0 @@
1
- import{D as e,E as t,I as n,L as r,O as i,T as a,c as o,l as s,o as c,r as l,s as u,u as d,v as f,y as p,z as m}from"./actionUi-BZrLpgHT.js";import{T as h,b as g,d as _,p as v,u as y}from"./preload-helper-BSxGu4d0.js";import{t as b}from"./index-D0FIKiiW.js";import{t as x}from"./MarkdownView-BuFKr9Jg.js";var S=m(r(),1);function C(e,t){return e.startsWith(`@@`)?{kind:`hunk`,text:e,gutter:``}:t?e.startsWith(`+`)?{kind:`add`,text:e.slice(1),gutter:`+`}:e.startsWith(`-`)?{kind:`del`,text:e.slice(1),gutter:`-`}:e.startsWith(` `)?{kind:`context`,text:e.slice(1),gutter:``}:{kind:`context`,text:e,gutter:``}:e.startsWith(`---`)||e.startsWith(`+++`)||e.startsWith(`diff `)||e.startsWith(`index `)||e.startsWith(`Index:`)||e.startsWith(`===`)?{kind:`meta`,text:e,gutter:``}:{kind:`context`,text:e,gutter:``}}function w(e){if(!e)return[];let t=e.endsWith(`
2
- `)?e.slice(0,-1):e,n=!1;return t.split(`
3
- `).map(e=>{let t=C(e,n);return t.kind===`hunk`&&(n=!0),t})}function T(e){let t=0,n=0;for(let r of e)r.kind===`add`?t++:r.kind===`del`&&n++;return{added:t,removed:n}}var E=n(),D={added:`Added`,modified:`Changed`,removed:`Removed`},O={added:`text-success`,modified:`text-secondary`,removed:`text-accent`};function k(e){return e==null||e===0?``:`${e>0?`+`:`−`}${i(e)}`}var A={add:`bg-[color:var(--color-diff-add-bg)] text-primary`,del:`bg-[color:var(--color-diff-del-bg)] text-primary`,hunk:`bg-[color:var(--color-diff-hunk-bg)] text-disabled`,meta:`text-disabled`,context:`text-secondary`},j={add:`text-success`,del:`text-accent`,hunk:`text-disabled`,meta:`text-disabled`,context:`text-disabled`};function M({lines:e}){return(0,E.jsx)(`div`,{className:`min-w-0 max-h-[420px] overflow-auto border-t border-hairline bg-raised font-mono text-label leading-[1.55]`,children:(0,E.jsx)(`div`,{className:`min-w-max`,children:e.map((e,t)=>(0,E.jsxs)(`div`,{className:`flex ${A[e.kind]}`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:`w-6 shrink-0 select-none pl-2.5 text-center ${j[e.kind]}`,children:e.gutter}),(0,E.jsx)(`span`,{className:`whitespace-pre pr-4`,children:e.text||`\xA0`})]},t))})})}function N({f:e,lines:t}){let n=k(e.sizeDelta),r=t?T(t):null;return(0,E.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2.5 gap-y-1 text-meta`,children:[(0,E.jsx)(`span`,{className:`shrink-0 text-caption font-medium ${O[e.status]}`,children:D[e.status]}),(0,E.jsx)(`span`,{className:`min-w-0 break-all font-mono text-primary`,children:e.path}),r&&(r.added>0||r.removed>0)&&(0,E.jsxs)(`span`,{className:`shrink-0 font-mono text-caption`,children:[r.added>0&&(0,E.jsxs)(`span`,{className:`text-success`,children:[`+`,r.added]}),r.added>0&&r.removed>0&&` `,r.removed>0&&(0,E.jsxs)(`span`,{className:`text-accent`,children:[`−`,r.removed]})]}),n&&(0,E.jsx)(`span`,{className:`shrink-0 font-mono text-caption text-disabled`,children:n}),e.binary&&(0,E.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Binary`}),e.tooLarge&&(0,E.jsx)(`span`,{className:`shrink-0 text-caption text-secondary`,children:`Too large to diff`})]})}var P=40;function F({files:e}){return(0,E.jsx)(`div`,{className:`space-y-1.5`,children:e.map(e=>{if(!e.diff)return(0,E.jsx)(`div`,{className:`rounded-control border border-hairline bg-surface px-3.5 py-2`,children:(0,E.jsx)(N,{f:e,lines:null})},e.path);let t=w(e.diff);return(0,E.jsxs)(`details`,{open:t.length<=P,className:`group min-w-0 overflow-hidden rounded-control border border-hairline bg-surface`,children:[(0,E.jsxs)(`summary`,{className:`flex cursor-pointer select-none items-center gap-2 px-3.5 py-2 marker:content-['']`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled transition-transform group-open:rotate-90`,children:`▸`}),(0,E.jsx)(N,{f:e,lines:t})]}),(0,E.jsx)(M,{lines:t})]},e.path)})})}function I({label:e,count:t,children:n}){return(0,E.jsxs)(`section`,{className:`min-w-0 rounded-card border border-hairline bg-surface px-6 py-5 shadow-card`,children:[(0,E.jsxs)(`div`,{className:`mb-3.5 border-b border-hairline pb-1.5 ${p}`,children:[e,t!=null&&(0,E.jsxs)(`span`,{className:`text-disabled`,children:[` (`,t,`)`]})]}),n]})}function L({k:e,children:t}){return(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`div`,{className:`mb-0.5 text-label font-medium text-secondary`,children:e}),(0,E.jsx)(`div`,{className:`min-w-0 text-body text-primary`,children:t})]})}function R(e){return!e||e.inputTokens===void 0&&e.outputTokens===void 0?null:(e.inputTokens??0)+(e.outputTokens??0)}function z({run:e}){let[t,n]=(0,S.useState)(null);return(0,S.useEffect)(()=>{if(e.phase===`pending`||e.phase===`running`)return;let t=!0;return _({data:{runId:e.id}}).then(e=>t&&n(e)).catch(()=>t&&n({hasSnapshot:!1,files:[]})),()=>{t=!1}},[e.id,e.phase]),e.phase===`pending`||e.phase===`running`?(0,E.jsx)(I,{label:`Changes`,children:(0,E.jsx)(`div`,{className:`text-body text-disabled`,children:`File changes appear once the run finishes.`})}):t?t.hasSnapshot?(0,E.jsx)(I,{label:`Changes`,count:t.files.length,children:t.files.length===0?(0,E.jsx)(`div`,{className:`text-body text-disabled`,children:`No files changed since the previous run.`}):(0,E.jsx)(F,{files:t.files})}):(0,E.jsx)(I,{label:`Changes`,children:(0,E.jsx)(`div`,{className:`text-body text-disabled`,children:`No file snapshot was recorded for this run.`})}):(0,E.jsx)(I,{label:`Changes`,children:(0,E.jsx)(c,{})})}function B({run:e}){let t=a(Math.max(0,Date.now()-Date.parse(e.ts)));return(0,E.jsx)(I,{label:`Activity`,children:(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 text-body text-secondary`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,className:`size-2 shrink-0 rounded-full`,style:f}),(0,E.jsxs)(`span`,{children:[`Run in progress`,t?` for ${t}`:``,`.`]})]})})}function V({id:e}){let[t,n]=(0,S.useState)(!1);return(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{navigator.clipboard?.writeText(e),n(!0),setTimeout(()=>n(!1),1200)},title:`Copy session id`,className:`inline-flex max-w-full cursor-pointer items-center gap-1.5 border-none bg-transparent p-0 text-left font-mono text-label text-secondary transition-colors hover:text-display`,children:[(0,E.jsx)(`span`,{className:`truncate`,children:e}),(0,E.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-micro text-disabled`,children:t?`✓ copied`:`copy`})]})}var H=64;function U({loopId:n,runId:r}){let[i,f]=(0,S.useState)(null),[p,m]=(0,S.useState)(null),[_,b]=(0,S.useState)(!1),[C,w]=(0,S.useState)(null),T=(0,S.useCallback)(async()=>{try{f(await y({data:n})),w(null)}catch(e){w(String(e))}},[n]),D=(0,S.useCallback)(async()=>{try{f(await y({data:n}))}catch{}},[n]);(0,S.useEffect)(()=>{f(null),m(null),b(!1),w(null),T()},[n,r,T]);let O=i?.runs.find(e=>e.id===r)??p,k=R(O?.usage??null);(0,S.useEffect)(()=>{if(!i||O||_)return;let e=!0;return(async()=>{try{let t=i.runs.length?i.runs[i.runs.length-1].ts:new Date().toISOString();for(let i=0;i<H&&e;i++){let i=await v({data:{loopId:n,beforeTs:t,limit:100}});if(!i.length)break;let a=i.find(e=>e.id===r);if(a){e&&m(a);return}t=i[0].ts}}finally{e&&b(!0)}})(),()=>{e=!1}},[i,O,_,n,r]);let A=!!O&&(O.phase===`pending`||O.phase===`running`||!!O.reconciliation);(0,S.useEffect)(()=>{if(!A)return;let e=setInterval(()=>void D(),3e3);return()=>clearInterval(e)},[A,D]);async function j(){if(!O||!confirm(`Stop this run? If it is running, Pievo will ask the daemon to terminate it.`))return;let e=await g({data:O.id});if(e?.error){alert(`Stop failed: ${e.error}`);return}await T()}if(C)return(0,E.jsx)(l,{title:`Couldn't load this run.`,detail:C,onRetry:()=>void T()});if(!i||!O&&!_)return(0,E.jsx)(c,{});if(!O)return(0,E.jsxs)(`div`,{className:`rounded-card border border-hairline bg-surface px-6 py-10 text-center shadow-card`,children:[(0,E.jsx)(`div`,{className:`text-[14px] text-secondary`,children:`This run is no longer available.`}),(0,E.jsx)(h,{to:`/loops/$loopId`,params:{loopId:n},className:`mt-3 inline-block text-label font-medium text-interactive underline underline-offset-2 hover:text-display`,children:`← Back to the loop`})]});let M=i.summary.name;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`header`,{className:`rounded-card border border-hairline bg-surface px-6 pb-5 pt-[22px] shadow-card`,children:[(0,E.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-4`,children:(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,E.jsxs)(`h1`,{className:`text-[26px] font-medium leading-tight tracking-tight text-display`,children:[`Run · `,M]}),(0,E.jsx)(o,{run:O,colorText:!0})]}),(0,E.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-x-2.5 gap-y-1.5 text-meta text-secondary`,children:[(0,E.jsx)(`span`,{className:`text-primary`,children:t(O.ts)}),(0,E.jsx)(`span`,{className:`text-wire`,children:`·`}),O.durationMs!=null&&(0,E.jsx)(u,{tone:`ink`,children:a(O.durationMs)}),(0,E.jsx)(`code`,{className:`font-mono text-disabled`,children:O.id})]})]})}),(0,E.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2.5 border-t border-hairline pt-4`,children:[(0,E.jsx)(h,{to:`/loops/$loopId`,params:{loopId:n},className:s,children:`View the whole loop →`}),(O.phase===`pending`||O.phase===`running`)&&(0,E.jsx)(`button`,{type:`button`,onClick:j,className:d,disabled:O.phase===`running`&&i.machine.daemonProtocol!==5,title:O.phase===`running`&&i.machine.daemonProtocol!==5?"Daemon upgrade required to stop a running process. Run `npm install -g @kky42/pievo@latest`, then `pievo daemon restart`.":void 0,children:`Stop run`})]})]}),(0,E.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(300px,360px)]`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[O.phase===`pending`?(0,E.jsx)(I,{label:`Activity`,children:(0,E.jsx)(`div`,{className:`text-body text-secondary`,children:`Queued; it starts when this loop is free and the machine polls.`})}):O.phase===`running`?(0,E.jsx)(B,{run:O}):O.reconciliation?(0,E.jsx)(I,{label:`Recovery`,children:(0,E.jsx)(`div`,{className:`text-body text-secondary`,children:O.reconciliation===`blocking`?i.machine.presence===`online`?`The machine is online and checking an interrupted run. Queued work starts automatically after recovery.`:`Waiting for the machine to reconnect and check an interrupted run. Queued work starts automatically; no action is required.`:`This interrupted run no longer blocks queued work. Pievo will still accept its saved report if it arrives.`})}):null,O.reportIncident&&(0,E.jsx)(I,{label:`Terminal report rejected`,children:(0,E.jsxs)(`div`,{className:`space-y-3 text-body text-primary`,children:[(0,E.jsx)(`div`,{className:`font-medium`,children:O.reportIncident.code}),(0,E.jsx)(`div`,{className:`break-words text-secondary`,children:O.reportIncident.reason}),(0,E.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[max-content_minmax(0,1fr)] gap-x-3 gap-y-1.5 text-label`,children:[(0,E.jsx)(`dt`,{className:`text-secondary`,children:`Fault domain`}),(0,E.jsx)(`dd`,{children:O.reportIncident.faultDomain}),(0,E.jsx)(`dt`,{className:`text-secondary`,children:`Recommended action`}),(0,E.jsx)(`dd`,{className:`break-words`,children:O.reportIncident.recommendedAction}),(0,E.jsx)(`dt`,{className:`text-secondary`,children:`Report ID`}),(0,E.jsx)(`dd`,{className:`break-all font-mono`,children:O.reportIncident.reportId})]})]})}),O.fileNotices&&O.fileNotices.length>0&&(0,E.jsx)(I,{label:`Loop files not kept`,children:(0,E.jsx)(`ul`,{className:`list-disc space-y-1.5 pl-5 text-body text-primary`,children:O.fileNotices.map(e=>(0,E.jsx)(`li`,{className:`break-words`,children:e},e))})}),O.message&&(0,E.jsx)(I,{label:`Report`,children:(0,E.jsx)(`div`,{className:`break-words rounded-control border border-hairline bg-raised text-body leading-relaxed text-primary`,children:(0,E.jsx)(x,{content:O.message})})}),(0,E.jsx)(z,{run:O}),O.finalText&&!O.message&&(0,E.jsx)(I,{label:`Final output`,children:(0,E.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-body text-primary`,children:O.finalText})})]}),(0,E.jsx)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:(0,E.jsx)(I,{label:`Details`,children:(0,E.jsxs)(`div`,{className:`space-y-3.5`,children:[O.status&&(0,E.jsx)(L,{k:`Status`,children:O.status}),O.durationMs!=null&&(0,E.jsx)(L,{k:`Duration`,children:a(O.durationMs)}),O.exitCode!=null&&(0,E.jsx)(L,{k:`Exit code`,children:O.exitCode}),k!=null&&(0,E.jsx)(L,{k:`Token usage`,children:(0,E.jsxs)(`span`,{className:`text-disabled`,children:[e(k),` tokens`]})}),O.error&&(0,E.jsx)(L,{k:`Error`,children:(0,E.jsx)(`span`,{className:`break-words`,style:{color:`var(--color-run-error)`},children:O.error})}),O.sessionId&&(0,E.jsx)(L,{k:`Session`,children:(0,E.jsx)(V,{id:O.sessionId})})]})})})]})]})}function W(){let{loopId:e,runId:t}=b.useParams();return(0,E.jsxs)(`main`,{className:`mx-auto max-w-[1360px] px-8 pb-24 pt-6`,children:[(0,E.jsx)(`div`,{className:`mb-5`,children:(0,E.jsxs)(h,{to:`/loops/$loopId`,params:{loopId:e},className:`inline-flex items-center gap-1.5 text-label font-medium text-secondary transition-colors hover:text-display`,children:[(0,E.jsx)(`span`,{"aria-hidden":!0,children:`←`}),` Back to loop`]})}),(0,E.jsx)(U,{loopId:e,runId:t})]})}export{W as component};
@@ -1 +0,0 @@
1
- import{I as e,P as t,r as n}from"./actionUi-BZrLpgHT.js";var r=e();function i({error:e}){let i=t();return(0,r.jsx)(`main`,{className:`mx-auto max-w-[1180px] px-8 pt-12`,children:(0,r.jsx)(n,{title:`Couldn't load the dashboard.`,detail:String(e),onRetry:()=>void i.invalidate()})})}export{i as errorComponent};
@@ -1 +0,0 @@
1
- import{I as e}from"./actionUi-BZrLpgHT.js";import{i as t,r as n}from"./index-D0FIKiiW.js";var r=e();function i(){return(0,r.jsx)(t,{initial:n.useLoaderData()})}export{i as component};
@@ -1,52 +0,0 @@
1
- import { D as listArtifacts, b as getArtifactFile, c as getLoopFiles } from "./boot-DmpKtb0A.mjs";
2
- import { n as toArtifactSummary } from "./loopProjection-DdFivf7-.mjs";
3
- //#region node_modules/.nitro/vite/services/ssr/assets/artifactFiles-B0NPRDOR.js
4
- /**
5
- * Server-side reads over a loop's current files (MEMORY.md + artifacts). Pure helpers
6
- * (no request/session context) so they're shared by the lazy server fns
7
- * (`getArtifacts` / `getArtifact` in loopApi) AND the download route, and are
8
- * directly unit-testable against an injected blob store.
9
- *
10
- * The bytes live in the gateway's local BlobStore; here we only read them — never write — so the feature is strictly read-only and
11
- * the server's zero-exec invariant holds (it decodes text, never interprets it).
12
- */
13
- async function listLoopArtifacts(loopId) {
14
- return (await listArtifacts(loopId)).map(toArtifactSummary);
15
- }
16
- /**
17
- * One file's content for inline display: decoded text for a text file, or a
18
- * binary/oversize marker (the UI then offers the download route). Returns an
19
- * error marker for an unknown/tombstoned name or a row whose blob bytes are
20
- * absent — never throws.
21
- */
22
- async function readLoopArtifact(loopId, rawPath) {
23
- const row = await getArtifactFile(loopId, rawPath);
24
- if (!row || row.deleted) return { error: "file not found" };
25
- if (row.binary || row.oversize) return {
26
- binary: true,
27
- size: row.size ?? null,
28
- oversize: row.oversize
29
- };
30
- if (!row.hash) return { error: "file has no stored version" };
31
- const bytes = await (await getLoopFiles()).readBlob(row.hash);
32
- if (!bytes) return { error: "file not found" };
33
- return { text: bytes.toString("utf8") };
34
- }
35
- /**
36
- * Resolve a loop file name to its stored bytes for the download route. Names are
37
- * matched exactly against stored rows; tombstoned/absent → 404. The bytes stream straight from the BlobStore.
38
- */
39
- async function readLoopArtifactBytes(loopId, rawPath) {
40
- const row = await getArtifactFile(loopId, rawPath);
41
- if (!row || row.deleted || !row.hash) return { status: 404 };
42
- const bytes = await (await getLoopFiles()).readBlob(row.hash);
43
- if (!bytes) return { status: 404 };
44
- return {
45
- status: 200,
46
- bytes,
47
- binary: row.binary,
48
- filename: rawPath
49
- };
50
- }
51
- //#endregion
52
- export { listLoopArtifacts, readLoopArtifact, readLoopArtifactBytes };
@@ -1,16 +0,0 @@
1
- import { c as createFileRoute, s as lazyRouteComponent } from "../_libs/@tanstack/react-router+[...].mjs";
2
- //#region node_modules/.nitro/vite/services/ssr/assets/loops._loopId_.runs._runId-Dr6E-FA5.js
3
- var $$splitComponentImporter = () => import("./loops._loopId_.runs._runId-BXbTfLlC.mjs");
4
- /**
5
- * Run detail PAGE — `/loops/$loopId/runs/$runId`. A standalone page (the trailing
6
- * `_` on the `$loopId` segment opts it out of the loop page's component so the run
7
- * gets its own full surface, deep-linkable + browser-back friendly) rather than a
8
- * modal or an inline panel. It resolves the run from the loop's detail payload
9
- * (reusing getLoopDetail) and the existing loop-file diff.
10
- */
11
- var Route = createFileRoute("/loops/$loopId_/runs/$runId")({
12
- ssr: false,
13
- component: lazyRouteComponent($$splitComponentImporter, "component")
14
- });
15
- //#endregion
16
- export { Route as t };