@humwick/server 0.130.3 → 0.130.4
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/docs/openapi.json +103 -1
- package/package.json +6 -6
- package/public/assets/{MessageBubble-Bq9kr21N.js → MessageBubble-BOkmEvgZ.js} +2 -2
- package/public/assets/{PlanGraphPanel-Dqiroy06.js → PlanGraphPanel-BkaDJp0r.js} +2 -2
- package/public/assets/{TraceView-DYU962-H.js → TraceView-B99Uu2yT.js} +2 -2
- package/public/assets/{VaultDecisionCard-DhPfzioE.js → VaultDecisionCard-DUIfTTFF.js} +2 -2
- package/public/assets/{activity-DzCcQTee.js → activity-ZIX0N1El.js} +2 -2
- package/public/assets/{agent-lineage-SgDt9i3T.js → agent-lineage-kq9TPYFw.js} +2 -2
- package/public/assets/agent-liveness-DSQY1Aa_.js +2 -0
- package/public/assets/{agent-name-CcY3Aijy.js → agent-name-C_7F4DFR.js} +2 -2
- package/public/assets/{agent-profiles-cxtRBn6O.js → agent-profiles-BNOcrGcY.js} +2 -2
- package/public/assets/{agent-project-badge-DGYbIhaI.js → agent-project-badge-B6yAh70a.js} +2 -2
- package/public/assets/{agent-tools-DHbftV0N.js → agent-tools-CcrhmOzF.js} +2 -2
- package/public/assets/{agent-type-icon-CY113sp-.js → agent-type-icon-CXSLrKiq.js} +2 -2
- package/public/assets/{agents-BPzY7IlQ.js → agents-DIZG97_X.js} +2 -2
- package/public/assets/{analytics-DENFPv_a.js → analytics-rasmoPjR.js} +2 -2
- package/public/assets/{artifact-viewer-KRvSc7sl.js → artifact-viewer-tBpTrEPb.js} +2 -2
- package/public/assets/{artifacts-C9gSmL3s.js → artifacts-BNkrynP1.js} +2 -2
- package/public/assets/{artifacts-DT-HkI5O.js → artifacts-Bjq-ZyBA.js} +2 -2
- package/public/assets/{automation-BsmjQhKD.js → automation-Cx422L3L.js} +2 -2
- package/public/assets/{backlog-8NYH_62t.js → backlog-RuFQ8PUu.js} +2 -2
- package/public/assets/{busy-health-D3hwvYb4.js → busy-health-BvNQ9g5x.js} +2 -2
- package/public/assets/{channels-DCJ5WL7O.js → channels-DNbKAS0I.js} +2 -2
- package/public/assets/{chat-DAIl357U.js → chat-Bp3Fx73h.js} +2 -2
- package/public/assets/{code-preview-CzrZfr9U.js → code-preview-KIRZA6cz.js} +2 -2
- package/public/assets/{connectors-xTxtlyou.js → connectors-k7vO4vvc.js} +2 -2
- package/public/assets/{cosmos-BpebFLK2.js → cosmos-BuVoq1aw.js} +2 -2
- package/public/assets/{crate-agent-BHvI5wXC.js → crate-agent-irqlt4NH.js} +2 -2
- package/public/assets/{dependency-graph-DGT0o3wJ.js → dependency-graph-D_rurNBz.js} +2 -2
- package/public/assets/{deploys-hqWOHSHE.js → deploys-yzZqIpxE.js} +2 -2
- package/public/assets/{display-CDeH4I8T.js → display-BemJG1f_.js} +2 -2
- package/public/assets/{files-BTeGVmTg.js → files-DXWcrxOz.js} +2 -2
- package/public/assets/{fleet-DgXtNgCa.js → fleet-TEuOCZXE.js} +2 -2
- package/public/assets/{fleet-metrics-BHEt5yc_.js → fleet-metrics-BGoDAFI-.js} +2 -2
- package/public/assets/{formatted-body-impl-CAe664Z8.js → formatted-body-impl-BB9eq9nN.js} +2 -2
- package/public/assets/{formatted-body-MLtodyPp.js → formatted-body-qy2nTD_1.js} +3 -3
- package/public/assets/{host-providers-dialog-mapF4Fj9.js → host-providers-dialog-BGPHxuwT.js} +2 -2
- package/public/assets/{index-CqqgOI5R.js → index-BC5XZc0z.js} +5 -5
- package/public/assets/{index-MYAIwYTX.css → index-D8Rp9pz2.css} +1 -1
- package/public/assets/{insights-DNyf7IzF.js → insights-C-KQG0h-.js} +2 -2
- package/public/assets/{integrations-DlYOHq7T.js → integrations-ClPRPyKU.js} +2 -2
- package/public/assets/{issue-ref-chip-CeWBNWn7.js → issue-ref-chip-DbH8J9Ak.js} +2 -2
- package/public/assets/{log-viewer-Cib8nqdE.js → log-viewer-PH4zVn24.js} +2 -2
- package/public/assets/{maintenance-DSn1cPm7.js → maintenance-5lV43uTL.js} +2 -2
- package/public/assets/{managed-agents-C3CkM81m.js → managed-agents-BdgU35aX.js} +2 -2
- package/public/assets/{markdown-preview-W4VQQPAv.js → markdown-preview-DNT4OUwQ.js} +3 -3
- package/public/assets/{markdown-preview-impl-CMsTdhjq.js → markdown-preview-impl-CnCcPy0A.js} +2 -2
- package/public/assets/{memory-BV17qtO4.js → memory--GgWH1gH.js} +2 -2
- package/public/assets/{messages-Bm_1AqSA.js → messages-CzFl_97O.js} +2 -2
- package/public/assets/{orchestrators-Dg-vfP09.js → orchestrators-CVvJVkzv.js} +2 -2
- package/public/assets/overview-DsrZvE86.js +2 -0
- package/public/assets/{pairs-8o9nuG3V.js → pairs-D2d0d2py.js} +2 -2
- package/public/assets/{profile-icon-BsRyBMea.js → profile-icon-_SMuSbYF.js} +2 -2
- package/public/assets/{project-profile-instructions-DETKFn_E.js → project-profile-instructions-Apn15y43.js} +2 -2
- package/public/assets/{projects-M_m6AHws.js → projects-D3B6kto5.js} +2 -2
- package/public/assets/{prompt-settings-C_mNCgeL.js → prompt-settings-DnPB6Ez6.js} +2 -2
- package/public/assets/provider-display-bWwiuedV.js +2 -0
- package/public/assets/{registry-DDHHHE5N.js → registry-D790cIhN.js} +2 -2
- package/public/assets/{run-card-Dt4I4jaP.js → run-card-BCro-Odj.js} +2 -2
- package/public/assets/{secrets-BkVwxI5O.js → secrets-CVXvfvbU.js} +2 -2
- package/public/assets/{service-access-settings-Crq-6a-B.js → service-access-settings-D3Xxqb9w.js} +2 -2
- package/public/assets/{settings-CYcavMFu.js → settings-CoUC7Jci.js} +2 -2
- package/public/assets/{shipping-H6gzEeZB.js → shipping-D_Lp9n_J.js} +2 -2
- package/public/assets/{stats-BJVeWkpV.js → stats-CXiNjB9S.js} +2 -2
- package/public/assets/{status-dot-BcHyw1Vw.js → status-dot-C703YIy1.js} +2 -2
- package/public/assets/store-BgDALGIX.js +9 -0
- package/public/assets/{tasks-qJjlQPpx.js → tasks-DO0WpJCx.js} +2 -2
- package/public/assets/{teams-Cd5Sk1uX.js → teams-FGkdi_tL.js} +2 -2
- package/public/assets/{terminal-viewer-CpY5_m7W.js → terminal-viewer-Dh8dSC7e.js} +3 -3
- package/public/assets/{terminal-viewer-impl-DI_2llFR.js → terminal-viewer-impl-B5Zriip3.js} +2 -2
- package/public/assets/{use-agent-terminal-0yJA_buM.js → use-agent-terminal-CRUVDvLC.js} +2 -2
- package/public/assets/{use-decisions-uJXHf34W.js → use-decisions-CoaqRh4l.js} +2 -2
- package/public/assets/{use-project-list-CpWl6eHQ.js → use-project-list-X-BgT53X.js} +2 -2
- package/public/assets/{use-selectors-BdxBW8mL.js → use-selectors-0X_UZkk-.js} +2 -2
- package/public/assets/{user-avatar-3IndfpOc.js → user-avatar-CkLhVBGu.js} +2 -2
- package/public/assets/{versioned-prompt-editor-CIVg7XB1.js → versioned-prompt-editor-BkTi7eim.js} +2 -2
- package/public/assets/{work-queue-B9rnLwHZ.js → work-queue-DDOLEyKo.js} +2 -2
- package/public/assets/{workflow-marker-X8wxyhzC.js → workflow-marker-CzOsB8BM.js} +2 -2
- package/public/assets/{workflows-o5YyMFW7.js → workflows-DJilvmRM.js} +2 -2
- package/public/assets/{workspaces-CzEGoAng.js → workspaces-CHcfbLR3.js} +2 -2
- package/public/cosmos.html +4 -4
- package/public/index.html +29 -29
- package/runner/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/runner/src/adapters/claude-api.ts +1 -1
- package/runner/src/provider-setup.ts +2 -2
- package/src/auth/login-link.ts +35 -0
- package/src/cli/index.ts +7 -1
- package/src/cli/init.ts +53 -0
- package/src/cli/orchestrator.ts +1 -7
- package/src/cli/setup.ts +6 -4
- package/src/db/spawn-delegation.ts +2 -1
- package/src/db/workflow-execution.ts +3 -3
- package/src/dev.ts +4 -13
- package/src/init.ts +299 -0
- package/src/invite-link.ts +16 -9
- package/src/routes/auth.ts +30 -2
- package/src/routes/host-providers.ts +18 -0
- package/src/routes/index.ts +5 -2
- package/src/routes/orchestrator-bootstrap.ts +2 -0
- package/src/routes/secrets-backup.ts +2 -3
- package/src/routes/secrets-import.ts +2 -3
- package/src/routes/secrets-vault.ts +5 -7
- package/src/runtime-install.ts +30 -0
- package/src/server.ts +4 -4
- package/src/services/auth-context.ts +6 -0
- package/src/services/provider-api-key.ts +73 -0
- package/src/setup.ts +47 -8
- package/src/utils.ts +7 -0
- package/public/assets/agent-liveness-Bq-s73jW.js +0 -2
- package/public/assets/overview-DcYCrvlr.js +0 -2
- package/public/assets/provider-display-BEeLXC_D.js +0 -2
- package/public/assets/store-DKPDIZBe.js +0 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-
|
|
2
|
-
//# sourceMappingURL=project-profile-instructions-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{M as i}from"./provider-display-bWwiuedV.js";import{t as a}from"./api-CIIVBtAV.js";import{t as o}from"./chevron-right-iljytE0x.js";import{t as s}from"./scroll-text-BKXS1ahr.js";import{t as c}from"./badge-DqJRtj_p.js";import{n as l}from"./token-estimate-Co-Jdphh.js";import{n as u}from"./versioned-prompt-editor-BkTi7eim.js";import{o as d,r as f,s as p,t as m}from"./card-C4QJ4hCW.js";var h=e(t(),1),g=n();function _(e){return`/projects/${encodeURIComponent(e.projectId)}/profile-instructions/${encodeURIComponent(e.profile)}`}function v(e){let[t,n]=(0,h.useState)(),[r,o]=(0,h.useState)(``);(0,h.useEffect)(()=>{let t=!0;return a(`GET`,e).then(e=>{t&&n(e.instructions)},e=>{t&&o(i(e))}),()=>{t=!1}},[e]);function s(e){n(t=>t?.map(t=>t.projectId===e.projectId&&t.profile===e.profile?{...t,template:e.template,version:e.version,updatedAt:e.updatedAt}:t))}return{entries:t,error:r,saved:s}}function y({entry:e,label:t,open:n,onToggle:r,onSaved:i}){let a=e.template.trim()===``;return(0,g.jsxs)(`li`,{className:`min-w-0 rounded border border-border bg-card/60`,"data-testid":`profile-instructions-row`,children:[(0,g.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:r,className:`flex min-h-9 w-full min-w-0 flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1.5 text-left hover:bg-muted/40`,children:[(0,g.jsx)(o,{className:`size-3.5 shrink-0 text-muted-foreground transition-transform ${n?`rotate-90`:``}`,"aria-hidden":!0}),(0,g.jsx)(`span`,{className:`min-w-0 text-xs font-medium [overflow-wrap:anywhere]`,children:t}),(0,g.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5 text-[10px] text-muted-foreground`,children:[e.version>0&&(0,g.jsxs)(c,{variant:`outline`,className:`text-[10px]`,children:[`v`,e.version]}),(0,g.jsx)(`span`,{children:a?`empty`:l(e.template)})]})]}),!n&&!a&&(0,g.jsx)(`p`,{className:`line-clamp-2 whitespace-pre-wrap break-words px-2 pb-1.5 text-xs text-muted-foreground`,children:e.template.trim()}),n&&(0,g.jsx)(`div`,{className:`border-t border-border p-1.5`,children:(0,g.jsx)(u,{path:_(e),title:t,textLabel:`Project instructions`,saveLabel:`Save instructions`,onSaved:i})})]})}function b({entries:e,error:t}){return t?(0,g.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:t}):e?null:(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading…`})}function x({projectId:e}){let t=r(e=>e.agentProfiles),{entries:n,error:i,saved:a}=v(`/projects/${encodeURIComponent(e)}/profile-instructions`),[o,c]=(0,h.useState)(``),l=n?.filter(e=>e.template.trim()!==``).length??0,u=e=>t.find(t=>t.name===e)?.icon?.trim()||`•`;return(0,g.jsxs)(m,{children:[(0,g.jsxs)(d,{children:[(0,g.jsxs)(p,{className:`flex flex-wrap items-center gap-2 text-base`,children:[(0,g.jsx)(s,{className:`size-4 text-muted-foreground`}),` Profile instructions`,n&&(0,g.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,l,` of `,n.length,` set)`]})]}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Extra text for each agent profile, added after the profile's own instructions when an agent starts in this project. Empty adds nothing.`})]}),(0,g.jsxs)(f,{className:`space-y-1.5`,children:[(0,g.jsx)(b,{entries:n,error:i}),(0,g.jsx)(`ul`,{className:`space-y-1.5`,children:n?.map(e=>(0,g.jsx)(y,{entry:e,onSaved:a,label:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`span`,{"aria-hidden":!0,className:`mr-1.5`,children:u(e.profile)}),(0,g.jsx)(`span`,{className:`font-mono`,children:e.profile})]}),open:o===e.profile,onToggle:()=>c(o===e.profile?``:e.profile)},e.profile))})]})]})}function S({profile:e}){let{entries:t,error:n,saved:r}=v(`/agent-profiles/${encodeURIComponent(e)}/project-instructions`),[i,a]=(0,h.useState)(``),[o,s]=(0,h.useState)([]),c=t?.filter(e=>e.version>0||o.includes(e.projectId))??[],l=t?.filter(e=>!c.includes(e))??[],u=e=>e.projectTitle||e.projectSlug||e.projectId;return(0,g.jsxs)(`section`,{className:`space-y-1.5`,"aria-label":`Project instructions for ${e}`,children:[(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Extra text added after this profile's instructions for agents started in one project.`}),(0,g.jsx)(b,{entries:t,error:n}),t&&c.length===0&&(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No project has text for this profile yet.`}),(0,g.jsx)(`ul`,{className:`space-y-1.5`,children:c.map(e=>(0,g.jsx)(y,{entry:e,onSaved:r,label:u(e),open:i===e.projectId,onToggle:()=>a(i===e.projectId?``:e.projectId)},e.projectId))}),l.length>0&&(0,g.jsxs)(`label`,{className:`flex min-w-0 flex-wrap items-center gap-1.5 text-xs`,children:[(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Add text for`}),(0,g.jsxs)(`select`,{value:``,"aria-label":`Add text for another project`,className:`h-8 min-w-0 flex-1 rounded-md border border-border bg-background px-1.5 text-base text-foreground sm:h-7 sm:text-xs`,onChange:e=>{let t=e.target.value;t&&(s([...o,t]),a(t))},children:[(0,g.jsx)(`option`,{value:``,children:`Choose a project…`}),l.map(e=>(0,g.jsx)(`option`,{value:e.projectId,children:u(e)},e.projectId))]})]})]})}export{x as n,S as t};
|
|
2
|
+
//# sourceMappingURL=project-profile-instructions-Apn15y43.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-DKPDIZBe.js";import{M as i}from"./provider-display-BEeLXC_D.js";import{n as a,t as o}from"./use-project-list-CpWl6eHQ.js";import{et as s}from"./display-CDeH4I8T.js";import{l as c,t as l}from"./api-CIIVBtAV.js";import{t as u}from"./label-BPBzm9FJ.js";import{t as d}from"./boxes-Cv7Wq3h4.js";import{t as f}from"./brain-circuit-CpQeSmp3.js";import{t as p}from"./folder-git-2-CJOmTT06.js";import{t as m}from"./button-Do6Z3vvn.js";import{t as h}from"./badge-DqJRtj_p.js";import{t as g}from"./copy-button-CjOj4HEf.js";import{t as _}from"./input-CsTB6jIx.js";import{o as v,r as y,s as b,t as x}from"./card-C4QJ4hCW.js";import{n as S}from"./project-profile-instructions-DETKFn_E.js";var C=e(t(),1),w=n();function T({project:e,roots:t,onChanged:n}){let a=r(e=>e.orchestrators),o=r(e=>e.authToken),[s,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)([]),[b,x]=(0,C.useState)([]),[S,T]=(0,C.useState)([]),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(!1),A=`/projects/${encodeURIComponent(e.id)}`,j=s||a.find(e=>e.status===`online`)?.id||``,M=t.filter(e=>!e.orchestratorId||e.orchestratorId===j),N=M.some(e=>e.rootPath===d)?d:M[0]?.rootPath||``,P=M.some(e=>e.rootPath===N&&e.orchestratorId===j);(0,C.useEffect)(()=>{let t=!0,n=()=>l(`GET`,`${A}/checkouts`).then(e=>{t&&(y(e.checkouts),x(e.refreshes??[]),T(e.enrollments??[]))}).catch(e=>{t&&D(i(e))}),r=c(o,{connected:()=>{n()},message:(t,r)=>{if(t===`config.changed`){let t=JSON.parse(r);t.namespace===`projects`&&t.key===e.id&&n();return}t.startsWith(`command.`)&&JSON.parse(r).command?.params.projectId===e.id&&n()}});return n(),()=>{t=!1,r.close()}},[e.id,A,o]);async function F(){k(!0),D(``);try{n((await l(`POST`,`${A}/archive`,{archived:e.status!==`archived`})).project)}catch(e){D(i(e))}finally{k(!1)}}async function I(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/bind`,{orchestratorId:j,rootPath:p??N});_(`Bound on ${j}: ${p??N}`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function L(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/unbind`,{orchestratorId:j,rootPath:N});_(`Unbound from ${j}: ${N}. Files kept.`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function R(){if(window.confirm(`Delete the checkout ${N} and its worktrees on ${j}? Unbind keeps the files.`)){k(!0),D(``);try{let{command:e}=await l(`DELETE`,`${A}/checkouts/${encodeURIComponent(j)}?deleteFiles=true&rootPath=${encodeURIComponent(N)}`),t=await l(`GET`,`${A}/checkouts`);y(t.checkouts.length?t.checkouts:[{commandId:e.id,type:e.type,status:e.status,orchestratorId:j,rootPath:N}])}catch(e){D(i(e))}finally{k(!1)}}}let z=v.some(e=>[`pending`,`accepted`,`running`].includes(e.status));return(0,w.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[(0,w.jsx)(m,{variant:`outline`,disabled:O,onClick:()=>void F(),children:e.status===`archived`?`Restore project`:`Archive project`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Archiving keeps checkouts and memory. Unbinding stops refresh, spawns and gates on that host and keeps its files. Deleting removes the checkout directory on that host and keeps project memory.`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`select`,{"aria-label":`Checkout host`,value:j,onChange:e=>u(e.target.value),className:`rounded-md border bg-background px-2 py-1`,children:[!j&&(0,w.jsx)(`option`,{value:``,children:`Choose a host`}),a.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[e.hostname,e.status===`online`?``:` (offline)`]},e.id))]}),t.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`select`,{"aria-label":`Checkout root`,value:N,onChange:e=>f(e.target.value),className:`max-w-full rounded-md border bg-background px-2 py-1`,children:M.map(e=>(0,w.jsx)(`option`,{value:e.rootPath,children:e.rootPath},e.rootPath))}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!P,onClick:()=>void L(),children:`Unbind from host (keep files)`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||z||!j||!N,onClick:()=>void R(),children:`Delete checkout files on host`})]}),(0,w.jsx)(`input`,{"aria-label":`Existing checkout root`,placeholder:`Absolute path to an existing checkout`,value:p??N,onChange:e=>h(e.target.value),className:`w-full min-w-0 rounded-md border bg-background px-2 py-1 sm:w-auto sm:min-w-64`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!j||!(p??N)||e.status!==`active`,onClick:()=>void I(),children:`Bind existing checkout`})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Binding verifies the checkout and its origin, then registers it on the selected host.`}),g&&(0,w.jsx)(`div`,{role:`status`,className:`text-sm`,children:g}),v.map(e=>(0,w.jsxs)(`div`,{role:[`failed`,`timed_out`,`canceled`].includes(e.status)?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — `,e.result?.action===`removed`?`Removed`:e.status,e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` — `,e.result?.errorCode,`: `,e.error]})]},e.commandId)),S.map(e=>(0,w.jsxs)(`div`,{role:e.disposition===`ambiguous`?`alert`:`status`,className:`text-sm`,children:[e.orchestratorId||`unknown host`,`: `,e.rootPath,` — Refresh enrollment `,e.disposition,` · `,e.reason]},JSON.stringify([e.orchestratorId,e.rootPath]))),b.map(e=>(0,w.jsxs)(`div`,{role:e.error||e.result?.reason&&e.health!==`unsupported`||e.health===`stale`?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — Checkout refresh `,e.result?.status??e.status,e.result&&(0,w.jsxs)(w.Fragment,{children:[e.health===`stale`&&(0,w.jsx)(`span`,{children:` · Refresh heartbeat stale`}),(0,w.jsxs)(`span`,{children:[` · Head `,e.result.headSha?.slice(0,12)??`unknown`,` · Target `,e.result.targetSha?.slice(0,12)??`unknown`,` · Behind `,e.result.behind??`unknown`]}),(0,w.jsxs)(`span`,{children:[` · Last success `,e.result.successAt?new Date(e.result.successAt).toLocaleString():`never`]}),e.result.dependency&&(0,w.jsxs)(`span`,{children:[` · Dependencies `,e.result.dependency.status]}),e.result.reason&&(0,w.jsxs)(`span`,{children:[` · `,e.result.reason]}),e.result.backups.map(e=>(0,w.jsxs)(`div`,{children:[`Backup: `,e.path,` → `,e.backup]},e.backup))]}),e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` · `,e.error]})]},e.commandId)),E&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:E})]})}function E({onCreated:e}){let t=r(e=>e.orchestrators),n=r(e=>e.authToken),a=r(e=>e.openOrchestratorSpawnAt),[o,s]=(0,C.useState)(!1),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(!1),[g,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(`private`),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(``),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(``),V=j??t.filter(e=>e.status===`online`).slice(0,1).map(e=>e.id);(0,C.useEffect)(()=>{if(!F)return;let e=!0,t=F.creation?[F.creation.commandId]:F.checkouts.flatMap(e=>e.commandId?[e.commandId]:[]),r=n=>{if(!e||!t.includes(n.id))return;R(e=>({...e,[n.id]:n}));let r=n.result;F.creation&&r?.onboarding&&I(r.onboarding)},a=t=>l(`GET`,`/commands/${encodeURIComponent(t)}`).then(r).catch(t=>{e&&B(i(t))}),o=()=>Promise.all(t.map(a)),s=c(n,{connected:()=>{o()},message:(e,n)=>{if(!e.startsWith(`command.`))return;let r=JSON.parse(n).command?.id;r&&t.includes(r)&&a(r)}});return o(),()=>{e=!1,s.close()}},[F,n]);async function H(t){t.preventDefault(),P(!0),B(``),R({}),I(null);try{let t=await l(`POST`,`/projects`,{...p?{create:{owner:g,name:y,visibility:x,...T.trim()?{template:T.trim()}:{}},...D?{setupTask:!0}:{}}:{url:d},...V.length===1?{orchestratorId:V[0]}:{hosts:V},...k.trim()?{slug:k.trim()}:{}});I(t),e()}catch(e){B(i(e))}finally{P(!1)}}let U=F?.creation?L[F.creation.commandId]:void 0,W=U?.result,G=W?.errorCode||U&&[`failed`,`timed_out`,`canceled`].includes(U.status),K=F?.creation&&(!U||[`pending`,`accepted`,`running`].includes(U.status))||F?.checkouts.some(e=>e.commandId&&(!L[e.commandId]||[`pending`,`accepted`,`running`].includes(L[e.commandId].status)));return(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!1),s(!0)},children:`Add project`}),(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!0),s(!0)},children:`New project`})]}),o&&(0,w.jsxs)(`form`,{onSubmit:H,className:`space-y-3 rounded-md border p-3`,children:[p?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-owner`,children:`GitHub owner`}),(0,w.jsx)(_,{id:`onboard-owner`,value:g,onChange:e=>v(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-name`,children:`Repository name`}),(0,w.jsx)(_,{id:`onboard-name`,value:y,onChange:e=>b(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-visibility`,children:`Visibility`}),(0,w.jsxs)(`select`,{id:`onboard-visibility`,className:`h-8 w-full rounded-md border border-border bg-card px-2 text-sm`,value:x,onChange:e=>S(e.target.value),children:[(0,w.jsx)(`option`,{value:`private`,children:`Private`}),(0,w.jsx)(`option`,{value:`public`,children:`Public`})]}),(0,w.jsx)(u,{htmlFor:`onboard-template`,children:`Template (optional, owner/repo)`}),(0,w.jsx)(_,{id:`onboard-template`,value:T,onChange:e=>E(e.target.value)}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),`Create a setup Task`]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-url`,children:`GitHub repository`}),(0,w.jsx)(_,{id:`onboard-url`,placeholder:`https://github.com/owner/repo`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,w.jsx)(u,{htmlFor:`onboard-slug`,children:`Slug (optional)`}),(0,w.jsx)(_,{id:`onboard-slug`,value:k,onChange:e=>A(e.target.value)}),(0,w.jsxs)(`fieldset`,{className:`space-y-1`,children:[(0,w.jsxs)(`legend`,{className:`flex w-full items-center gap-2`,children:[`Hosts`,(0,w.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select all online hosts`,onClick:()=>M(t.filter(e=>e.status===`online`).map(e=>e.id)),children:`all`}),(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select no hosts`,onClick:()=>M([]),children:`none`})]})]}),(0,w.jsx)(`div`,{className:`grid gap-x-4 gap-y-1 sm:grid-cols-2`,children:t.map(e=>(0,w.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(e.id),onChange:t=>M(t.target.checked?[...V,e.id]:V.filter(t=>t!==e.id))}),(0,w.jsxs)(`span`,{className:`truncate`,children:[e.hostname,e.status===`online`?``:` (offline)`]})]},e.id))})]}),(0,w.jsx)(m,{type:`submit`,disabled:N||!!K||!V.length,children:N?p?`Creating…`:`Adding…`:p?`Create`:`Add`})]}),z&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:z}),F?.creation&&(G?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[W?.errorCode?`${W.errorCode}: `:``,W?.error||U?.error||`Creation ${U?.status}. Check GitHub before retrying.`]}):(0,w.jsx)(`p`,{role:`status`,children:`Creating GitHub repository…`})),F?.setupTaskId&&(0,w.jsxs)(`p`,{children:[`Setup Task T`,F.setupTaskId,` created.`]}),F&&!F.creation&&(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,w.jsx)(`caption`,{className:`text-left`,children:`Host readiness`}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:`Host`}),(0,w.jsx)(`th`,{children:`Status`}),(0,w.jsx)(`th`,{children:`Checks`}),(0,w.jsx)(`th`,{children:`Action`})]})}),(0,w.jsx)(`tbody`,{children:F.checkouts.map(e=>{let n=e.commandId?L[e.commandId]:void 0,r=n?.result,i=t.find(t=>t.id===e.orchestratorId),o=n?.status===`succeeded`,s=e.errorCode??r?.errorCode,c=s||n&&[`failed`,`timed_out`,`canceled`].includes(n.status);return(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`row`,children:i?.hostname||e.orchestratorId}),(0,w.jsx)(`td`,{children:c?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[s?`${s}: `:``,e.error||n?.error||`Checkout ${n?.status}. Try again.`]}):(0,w.jsx)(`span`,{role:`status`,children:o?`Ready on ${i?.hostname||e.orchestratorId}`:`Preparing checkout…`})}),(0,w.jsx)(`td`,{children:(0,w.jsx)(`ul`,{children:r?.readiness?.map((e,t)=>(0,w.jsxs)(`li`,{children:[e.check,e.provider?` (${e.provider})`:``,`: `,e.status,` — `,e.detail]},t))})}),(0,w.jsx)(`td`,{children:o&&e.rootPath&&(0,w.jsx)(m,{onClick:()=>a({orchestratorId:e.orchestratorId,cwd:e.rootPath}),children:`Spawn agent here`})})]},e.orchestratorId)})})]})})]})}function D(){let e=a(),{projects:t,selectedId:n,loading:c,setError:u,refresh:_}=e,D=r(e=>e.set),O=r(e=>e.switchView),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(()=>Date.now());(0,C.useEffect)(()=>{if(!n){A(null);return}let e=!1;return l(`GET`,`/projects/${encodeURIComponent(n)}`).then(t=>{e||(A(t),M(Date.now()))}).catch(t=>{e||u(i(t))}),()=>{e=!0}},[n,u]);function N(e){O(`memory`),D({projectFocusId:e})}return(0,w.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,w.jsx)(o,{icon:(0,w.jsx)(d,{className:`size-5 text-primary`}),title:`Projects`,list:e,onRefresh:()=>void _()}),(0,w.jsx)(E,{onCreated:()=>{_()}}),!c&&t.length===0&&(0,w.jsx)(x,{children:(0,w.jsx)(y,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No projects yet. Add a GitHub repository or create a new one above.`})}),k&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,w.jsx)(`span`,{className:`min-w-0 break-words text-base font-semibold`,children:k.project.title||k.project.slug}),(0,w.jsx)(h,{variant:`outline`,className:`font-mono text-[10px]`,children:k.project.slug}),(0,w.jsx)(h,{variant:k.project.status===`active`?`secondary`:`outline`,className:`text-[10px]`,children:k.project.status}),(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`updated `,s(j,k.project.updatedAt)]}),(0,w.jsxs)(m,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:()=>N(k.project.id),children:[(0,w.jsx)(f,{className:`size-3.5`}),` Memories`]})]}),k.project.description&&(0,w.jsx)(`div`,{className:`line-clamp-2 break-words text-sm text-muted-foreground`,children:k.project.description}),k.project.issueRepo&&(0,w.jsxs)(`a`,{href:`https://github.com/${k.project.issueRepo}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex max-w-full items-center gap-1.5 text-primary hover:underline`,children:[(0,w.jsx)(p,{className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`truncate font-mono text-xs`,children:k.project.issueRepo})]})]}),(0,w.jsx)(T,{project:k.project,roots:k.roots,onChanged:(e,t)=>{A({...k,project:e,roots:t??k.roots}),_()}},k.project.id),(0,w.jsxs)(x,{children:[(0,w.jsx)(v,{children:(0,w.jsxs)(b,{className:`flex items-center gap-2 text-base`,children:[(0,w.jsx)(p,{className:`size-4 text-muted-foreground`}),` Roots`,(0,w.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,k.roots.length,`)`]})]})}),(0,w.jsx)(y,{children:k.roots.length===0?(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No roots bound. A project resolves to agents by the repo paths registered here.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:k.roots.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[e.orchestratorId&&(0,w.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-xs text-muted-foreground`,children:e.orchestratorId}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,title:e.rootPath,children:e.rootPath}),(0,w.jsx)(g,{value:e.rootPath,label:`Copy root path`,size:`icon`,className:`h-6 w-6`,iconClassName:`h-3 w-3`})]},JSON.stringify([e.orchestratorId,e.rootPath])))})})]}),(0,w.jsx)(S,{projectId:k.project.id},k.project.id)]})]})}export{D as ProjectsView};
|
|
2
|
-
//# sourceMappingURL=projects-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{t as r}from"./store-BgDALGIX.js";import{M as i}from"./provider-display-bWwiuedV.js";import{n as a,t as o}from"./use-project-list-X-BgT53X.js";import{et as s}from"./display-BemJG1f_.js";import{l as c,t as l}from"./api-CIIVBtAV.js";import{t as u}from"./label-BPBzm9FJ.js";import{t as d}from"./boxes-Cv7Wq3h4.js";import{t as f}from"./brain-circuit-CpQeSmp3.js";import{t as p}from"./folder-git-2-CJOmTT06.js";import{t as m}from"./button-Do6Z3vvn.js";import{t as h}from"./badge-DqJRtj_p.js";import{t as g}from"./copy-button-CjOj4HEf.js";import{t as _}from"./input-CsTB6jIx.js";import{o as v,r as y,s as b,t as x}from"./card-C4QJ4hCW.js";import{n as S}from"./project-profile-instructions-Apn15y43.js";var C=e(t(),1),w=n();function T({project:e,roots:t,onChanged:n}){let a=r(e=>e.orchestrators),o=r(e=>e.authToken),[s,u]=(0,C.useState)(``),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(),[g,_]=(0,C.useState)(``),[v,y]=(0,C.useState)([]),[b,x]=(0,C.useState)([]),[S,T]=(0,C.useState)([]),[E,D]=(0,C.useState)(``),[O,k]=(0,C.useState)(!1),A=`/projects/${encodeURIComponent(e.id)}`,j=s||a.find(e=>e.status===`online`)?.id||``,M=t.filter(e=>!e.orchestratorId||e.orchestratorId===j),N=M.some(e=>e.rootPath===d)?d:M[0]?.rootPath||``,P=M.some(e=>e.rootPath===N&&e.orchestratorId===j);(0,C.useEffect)(()=>{let t=!0,n=()=>l(`GET`,`${A}/checkouts`).then(e=>{t&&(y(e.checkouts),x(e.refreshes??[]),T(e.enrollments??[]))}).catch(e=>{t&&D(i(e))}),r=c(o,{connected:()=>{n()},message:(t,r)=>{if(t===`config.changed`){let t=JSON.parse(r);t.namespace===`projects`&&t.key===e.id&&n();return}t.startsWith(`command.`)&&JSON.parse(r).command?.params.projectId===e.id&&n()}});return n(),()=>{t=!1,r.close()}},[e.id,A,o]);async function F(){k(!0),D(``);try{n((await l(`POST`,`${A}/archive`,{archived:e.status!==`archived`})).project)}catch(e){D(i(e))}finally{k(!1)}}async function I(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/bind`,{orchestratorId:j,rootPath:p??N});_(`Bound on ${j}: ${p??N}`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function L(){k(!0),D(``),_(``);try{let e=await l(`POST`,`${A}/checkouts/unbind`,{orchestratorId:j,rootPath:N});_(`Unbound from ${j}: ${N}. Files kept.`),n(e.project,e.roots)}catch(e){D(i(e))}finally{k(!1)}}async function R(){if(window.confirm(`Delete the checkout ${N} and its worktrees on ${j}? Unbind keeps the files.`)){k(!0),D(``);try{let{command:e}=await l(`DELETE`,`${A}/checkouts/${encodeURIComponent(j)}?deleteFiles=true&rootPath=${encodeURIComponent(N)}`),t=await l(`GET`,`${A}/checkouts`);y(t.checkouts.length?t.checkouts:[{commandId:e.id,type:e.type,status:e.status,orchestratorId:j,rootPath:N}])}catch(e){D(i(e))}finally{k(!1)}}}let z=v.some(e=>[`pending`,`accepted`,`running`].includes(e.status));return(0,w.jsxs)(`div`,{className:`space-y-3 rounded-md border p-3`,children:[(0,w.jsx)(m,{variant:`outline`,disabled:O,onClick:()=>void F(),children:e.status===`archived`?`Restore project`:`Archive project`}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Archiving keeps checkouts and memory. Unbinding stops refresh, spawns and gates on that host and keeps its files. Deleting removes the checkout directory on that host and keeps project memory.`}),(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsxs)(`select`,{"aria-label":`Checkout host`,value:j,onChange:e=>u(e.target.value),className:`rounded-md border bg-background px-2 py-1`,children:[!j&&(0,w.jsx)(`option`,{value:``,children:`Choose a host`}),a.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[e.hostname,e.status===`online`?``:` (offline)`]},e.id))]}),t.length>0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`select`,{"aria-label":`Checkout root`,value:N,onChange:e=>f(e.target.value),className:`max-w-full rounded-md border bg-background px-2 py-1`,children:M.map(e=>(0,w.jsx)(`option`,{value:e.rootPath,children:e.rootPath},e.rootPath))}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!P,onClick:()=>void L(),children:`Unbind from host (keep files)`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||z||!j||!N,onClick:()=>void R(),children:`Delete checkout files on host`})]}),(0,w.jsx)(`input`,{"aria-label":`Existing checkout root`,placeholder:`Absolute path to an existing checkout`,value:p??N,onChange:e=>h(e.target.value),className:`w-full min-w-0 rounded-md border bg-background px-2 py-1 sm:w-auto sm:min-w-64`}),(0,w.jsx)(m,{variant:`outline`,disabled:O||!j||!(p??N)||e.status!==`active`,onClick:()=>void I(),children:`Bind existing checkout`})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Binding verifies the checkout and its origin, then registers it on the selected host.`}),g&&(0,w.jsx)(`div`,{role:`status`,className:`text-sm`,children:g}),v.map(e=>(0,w.jsxs)(`div`,{role:[`failed`,`timed_out`,`canceled`].includes(e.status)?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — `,e.result?.action===`removed`?`Removed`:e.status,e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` — `,e.result?.errorCode,`: `,e.error]})]},e.commandId)),S.map(e=>(0,w.jsxs)(`div`,{role:e.disposition===`ambiguous`?`alert`:`status`,className:`text-sm`,children:[e.orchestratorId||`unknown host`,`: `,e.rootPath,` — Refresh enrollment `,e.disposition,` · `,e.reason]},JSON.stringify([e.orchestratorId,e.rootPath]))),b.map(e=>(0,w.jsxs)(`div`,{role:e.error||e.result?.reason&&e.health!==`unsupported`||e.health===`stale`?`alert`:`status`,className:`text-sm`,children:[a.find(t=>t.id===e.orchestratorId)?.hostname||e.orchestratorId,`: `,e.rootPath,` — Checkout refresh `,e.result?.status??e.status,e.result&&(0,w.jsxs)(w.Fragment,{children:[e.health===`stale`&&(0,w.jsx)(`span`,{children:` · Refresh heartbeat stale`}),(0,w.jsxs)(`span`,{children:[` · Head `,e.result.headSha?.slice(0,12)??`unknown`,` · Target `,e.result.targetSha?.slice(0,12)??`unknown`,` · Behind `,e.result.behind??`unknown`]}),(0,w.jsxs)(`span`,{children:[` · Last success `,e.result.successAt?new Date(e.result.successAt).toLocaleString():`never`]}),e.result.dependency&&(0,w.jsxs)(`span`,{children:[` · Dependencies `,e.result.dependency.status]}),e.result.reason&&(0,w.jsxs)(`span`,{children:[` · `,e.result.reason]}),e.result.backups.map(e=>(0,w.jsxs)(`div`,{children:[`Backup: `,e.path,` → `,e.backup]},e.backup))]}),e.error&&(0,w.jsxs)(`span`,{className:`text-destructive`,children:[` · `,e.error]})]},e.commandId)),E&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:E})]})}function E({onCreated:e}){let t=r(e=>e.orchestrators),n=r(e=>e.authToken),a=r(e=>e.openOrchestratorSpawnAt),[o,s]=(0,C.useState)(!1),[d,f]=(0,C.useState)(``),[p,h]=(0,C.useState)(!1),[g,v]=(0,C.useState)(``),[y,b]=(0,C.useState)(``),[x,S]=(0,C.useState)(`private`),[T,E]=(0,C.useState)(``),[D,O]=(0,C.useState)(!1),[k,A]=(0,C.useState)(``),[j,M]=(0,C.useState)(null),[N,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),[L,R]=(0,C.useState)({}),[z,B]=(0,C.useState)(``),V=j??t.filter(e=>e.status===`online`).slice(0,1).map(e=>e.id);(0,C.useEffect)(()=>{if(!F)return;let e=!0,t=F.creation?[F.creation.commandId]:F.checkouts.flatMap(e=>e.commandId?[e.commandId]:[]),r=n=>{if(!e||!t.includes(n.id))return;R(e=>({...e,[n.id]:n}));let r=n.result;F.creation&&r?.onboarding&&I(r.onboarding)},a=t=>l(`GET`,`/commands/${encodeURIComponent(t)}`).then(r).catch(t=>{e&&B(i(t))}),o=()=>Promise.all(t.map(a)),s=c(n,{connected:()=>{o()},message:(e,n)=>{if(!e.startsWith(`command.`))return;let r=JSON.parse(n).command?.id;r&&t.includes(r)&&a(r)}});return o(),()=>{e=!1,s.close()}},[F,n]);async function H(t){t.preventDefault(),P(!0),B(``),R({}),I(null);try{let t=await l(`POST`,`/projects`,{...p?{create:{owner:g,name:y,visibility:x,...T.trim()?{template:T.trim()}:{}},...D?{setupTask:!0}:{}}:{url:d},...V.length===1?{orchestratorId:V[0]}:{hosts:V},...k.trim()?{slug:k.trim()}:{}});I(t),e()}catch(e){B(i(e))}finally{P(!1)}}let U=F?.creation?L[F.creation.commandId]:void 0,W=U?.result,G=W?.errorCode||U&&[`failed`,`timed_out`,`canceled`].includes(U.status),K=F?.creation&&(!U||[`pending`,`accepted`,`running`].includes(U.status))||F?.checkouts.some(e=>e.commandId&&(!L[e.commandId]||[`pending`,`accepted`,`running`].includes(L[e.commandId].status)));return(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!1),s(!0)},children:`Add project`}),(0,w.jsx)(m,{variant:`outline`,onClick:()=>{h(!0),s(!0)},children:`New project`})]}),o&&(0,w.jsxs)(`form`,{onSubmit:H,className:`space-y-3 rounded-md border p-3`,children:[p?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-owner`,children:`GitHub owner`}),(0,w.jsx)(_,{id:`onboard-owner`,value:g,onChange:e=>v(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-name`,children:`Repository name`}),(0,w.jsx)(_,{id:`onboard-name`,value:y,onChange:e=>b(e.target.value),required:!0}),(0,w.jsx)(u,{htmlFor:`onboard-visibility`,children:`Visibility`}),(0,w.jsxs)(`select`,{id:`onboard-visibility`,className:`h-8 w-full rounded-md border border-border bg-card px-2 text-sm`,value:x,onChange:e=>S(e.target.value),children:[(0,w.jsx)(`option`,{value:`private`,children:`Private`}),(0,w.jsx)(`option`,{value:`public`,children:`Public`})]}),(0,w.jsx)(u,{htmlFor:`onboard-template`,children:`Template (optional, owner/repo)`}),(0,w.jsx)(_,{id:`onboard-template`,value:T,onChange:e=>E(e.target.value)}),(0,w.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:D,onChange:e=>O(e.target.checked)}),`Create a setup Task`]})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(u,{htmlFor:`onboard-url`,children:`GitHub repository`}),(0,w.jsx)(_,{id:`onboard-url`,placeholder:`https://github.com/owner/repo`,value:d,onChange:e=>f(e.target.value),required:!0})]}),(0,w.jsx)(u,{htmlFor:`onboard-slug`,children:`Slug (optional)`}),(0,w.jsx)(_,{id:`onboard-slug`,value:k,onChange:e=>A(e.target.value)}),(0,w.jsxs)(`fieldset`,{className:`space-y-1`,children:[(0,w.jsxs)(`legend`,{className:`flex w-full items-center gap-2`,children:[`Hosts`,(0,w.jsxs)(`span`,{className:`ml-auto flex gap-1`,children:[(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select all online hosts`,onClick:()=>M(t.filter(e=>e.status===`online`).map(e=>e.id)),children:`all`}),(0,w.jsx)(m,{type:`button`,variant:`ghost`,size:`xs`,"aria-label":`Select no hosts`,onClick:()=>M([]),children:`none`})]})]}),(0,w.jsx)(`div`,{className:`grid gap-x-4 gap-y-1 sm:grid-cols-2`,children:t.map(e=>(0,w.jsxs)(`label`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(`input`,{type:`checkbox`,checked:V.includes(e.id),onChange:t=>M(t.target.checked?[...V,e.id]:V.filter(t=>t!==e.id))}),(0,w.jsxs)(`span`,{className:`truncate`,children:[e.hostname,e.status===`online`?``:` (offline)`]})]},e.id))})]}),(0,w.jsx)(m,{type:`submit`,disabled:N||!!K||!V.length,children:N?p?`Creating…`:`Adding…`:p?`Create`:`Add`})]}),z&&(0,w.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:z}),F?.creation&&(G?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[W?.errorCode?`${W.errorCode}: `:``,W?.error||U?.error||`Creation ${U?.status}. Check GitHub before retrying.`]}):(0,w.jsx)(`p`,{role:`status`,children:`Creating GitHub repository…`})),F?.setupTaskId&&(0,w.jsxs)(`p`,{children:[`Setup Task T`,F.setupTaskId,` created.`]}),F&&!F.creation&&(0,w.jsx)(`div`,{className:`overflow-x-auto`,children:(0,w.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,w.jsx)(`caption`,{className:`text-left`,children:`Host readiness`}),(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{children:`Host`}),(0,w.jsx)(`th`,{children:`Status`}),(0,w.jsx)(`th`,{children:`Checks`}),(0,w.jsx)(`th`,{children:`Action`})]})}),(0,w.jsx)(`tbody`,{children:F.checkouts.map(e=>{let n=e.commandId?L[e.commandId]:void 0,r=n?.result,i=t.find(t=>t.id===e.orchestratorId),o=n?.status===`succeeded`,s=e.errorCode??r?.errorCode,c=s||n&&[`failed`,`timed_out`,`canceled`].includes(n.status);return(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`row`,children:i?.hostname||e.orchestratorId}),(0,w.jsx)(`td`,{children:c?(0,w.jsxs)(`p`,{role:`alert`,className:`text-destructive`,children:[s?`${s}: `:``,e.error||n?.error||`Checkout ${n?.status}. Try again.`]}):(0,w.jsx)(`span`,{role:`status`,children:o?`Ready on ${i?.hostname||e.orchestratorId}`:`Preparing checkout…`})}),(0,w.jsx)(`td`,{children:(0,w.jsx)(`ul`,{children:r?.readiness?.map((e,t)=>(0,w.jsxs)(`li`,{children:[e.check,e.provider?` (${e.provider})`:``,`: `,e.status,` — `,e.detail]},t))})}),(0,w.jsx)(`td`,{children:o&&e.rootPath&&(0,w.jsx)(m,{onClick:()=>a({orchestratorId:e.orchestratorId,cwd:e.rootPath}),children:`Spawn agent here`})})]},e.orchestratorId)})})]})})]})}function D(){let e=a(),{projects:t,selectedId:n,loading:c,setError:u,refresh:_}=e,D=r(e=>e.set),O=r(e=>e.switchView),[k,A]=(0,C.useState)(null),[j,M]=(0,C.useState)(()=>Date.now());(0,C.useEffect)(()=>{if(!n){A(null);return}let e=!1;return l(`GET`,`/projects/${encodeURIComponent(n)}`).then(t=>{e||(A(t),M(Date.now()))}).catch(t=>{e||u(i(t))}),()=>{e=!0}},[n,u]);function N(e){O(`memory`),D({projectFocusId:e})}return(0,w.jsxs)(`div`,{className:`space-y-3 p-3 sm:p-4`,children:[(0,w.jsx)(o,{icon:(0,w.jsx)(d,{className:`size-5 text-primary`}),title:`Projects`,list:e,onRefresh:()=>void _()}),(0,w.jsx)(E,{onCreated:()=>{_()}}),!c&&t.length===0&&(0,w.jsx)(x,{children:(0,w.jsx)(y,{className:`py-8 text-center text-sm text-muted-foreground`,children:`No projects yet. Add a GitHub repository or create a new one above.`})}),k&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,w.jsx)(`span`,{className:`min-w-0 break-words text-base font-semibold`,children:k.project.title||k.project.slug}),(0,w.jsx)(h,{variant:`outline`,className:`font-mono text-[10px]`,children:k.project.slug}),(0,w.jsx)(h,{variant:k.project.status===`active`?`secondary`:`outline`,className:`text-[10px]`,children:k.project.status}),(0,w.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`updated `,s(j,k.project.updatedAt)]}),(0,w.jsxs)(m,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:()=>N(k.project.id),children:[(0,w.jsx)(f,{className:`size-3.5`}),` Memories`]})]}),k.project.description&&(0,w.jsx)(`div`,{className:`line-clamp-2 break-words text-sm text-muted-foreground`,children:k.project.description}),k.project.issueRepo&&(0,w.jsxs)(`a`,{href:`https://github.com/${k.project.issueRepo}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex max-w-full items-center gap-1.5 text-primary hover:underline`,children:[(0,w.jsx)(p,{className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`truncate font-mono text-xs`,children:k.project.issueRepo})]})]}),(0,w.jsx)(T,{project:k.project,roots:k.roots,onChanged:(e,t)=>{A({...k,project:e,roots:t??k.roots}),_()}},k.project.id),(0,w.jsxs)(x,{children:[(0,w.jsx)(v,{children:(0,w.jsxs)(b,{className:`flex items-center gap-2 text-base`,children:[(0,w.jsx)(p,{className:`size-4 text-muted-foreground`}),` Roots`,(0,w.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,k.roots.length,`)`]})]})}),(0,w.jsx)(y,{children:k.roots.length===0?(0,w.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`No roots bound. A project resolves to agents by the repo paths registered here.`}):(0,w.jsx)(`div`,{className:`space-y-1.5`,children:k.roots.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded border border-border bg-card/60 px-2 py-1`,children:[e.orchestratorId&&(0,w.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate text-xs text-muted-foreground`,children:e.orchestratorId}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,title:e.rootPath,children:e.rootPath}),(0,w.jsx)(g,{value:e.rootPath,label:`Copy root path`,size:`icon`,className:`h-6 w-6`,iconClassName:`h-3 w-3`})]},JSON.stringify([e.orchestratorId,e.rootPath])))})})]}),(0,w.jsx)(S,{projectId:k.project.id},k.project.id)]})]})}export{D as ProjectsView};
|
|
2
|
+
//# sourceMappingURL=projects-D3B6kto5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{M as i}from"./provider-display-BEeLXC_D.js";import{et as a}from"./display-CDeH4I8T.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./braces-BOks9SsY.js";import{t as c}from"./circle-alert-CryagaZd.js";import{t as l}from"./file-text-CKuoMR2U.js";import{t as u}from"./refresh-cw-CfpvQcUn.js";import{t as d}from"./rotate-ccw-CtD77qkX.js";import{t as f}from"./save-B_PGqSm4.js";import{t as p}from"./button-Do6Z3vvn.js";import{t as m}from"./badge-DqJRtj_p.js";import{t as h}from"./textarea-hs6Mpyfl.js";import{t as g}from"./versioned-prompt-editor-CIVg7XB1.js";import{a as _,i as ee,o as te,r as v,s as y,t as b}from"./card-C4QJ4hCW.js";var x=e(n(),1),S=r(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return Array.isArray(e)?[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r}):[]}function ne({template:e}){if(e.version===void 0)return null;let t=e.source===`bundled-fallback`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:t?`No saved version`:`v${e.version}`}),t&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Bundled fallback`}),e.bundledUpdateAvailable&&(0,S.jsx)(m,{className:`bg-tone-info/15 text-tone-info-fg hover:bg-tone-info/15`,children:`Update available`})]})}function E(){let[e,n]=(0,x.useState)([]),[r,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{let e=await o(`GET`,`/settings/prompts`);n(T(e.templates)),H(Date.now())}catch(e){O(i(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function re(e){I(e),A(``),M(``)}function $(e){n(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ie(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await o(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(i(e))}finally{B(``)}}}async function ae(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await o(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(i(e))}finally{B(``)}}}function oe(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(m,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(l,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(m,{variant:`outline`,className:t(`gap-1`,Z>0&&`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`),children:[Z,` modified`]}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:r,children:[(0,S.jsx)(u,{className:t(`size-4`,r&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),r&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(v,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let n=e.slug===q,r=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:t(`w-full rounded-xl border p-4 text-left transition-colors`,n?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>re(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),r&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Modified`}),(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:w(e.category)}),(0,S.jsx)(ne,{template:e})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),e.updatedAt>0&&(0,S.jsxs)(`span`,{children:[`Updated `,a(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(te,{className:`border-b border-border`,children:[(0,S.jsxs)(y,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Customized`}),X&&(0,S.jsx)(m,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(ee,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),J.version===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(v,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-tone-success/30 bg-tone-success/10 px-3 py-2 text-xs text-tone-success-fg`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(s,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(m,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-tone-warning/30 bg-tone-warning/10 px-3 py-2 text-xs text-tone-warning-fg`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(h,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(_,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${a(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void ae(),disabled:Q,children:[(0,S.jsx)(d,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(p,{variant:`outline`,size:`sm`,onClick:oe,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(p,{size:`sm`,onClick:()=>void ie(),disabled:!X||Q,children:[(0,S.jsx)(f,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(v,{className:`pt-4`,children:(0,S.jsx)(g,{slug:J.slug,onSaved:$},J.slug)})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
|
|
2
|
-
//# sourceMappingURL=prompt-settings-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{M as i}from"./provider-display-bWwiuedV.js";import{et as a}from"./display-BemJG1f_.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./braces-BOks9SsY.js";import{t as c}from"./circle-alert-CryagaZd.js";import{t as l}from"./file-text-CKuoMR2U.js";import{t as u}from"./refresh-cw-CfpvQcUn.js";import{t as d}from"./rotate-ccw-CtD77qkX.js";import{t as f}from"./save-B_PGqSm4.js";import{t as p}from"./button-Do6Z3vvn.js";import{t as m}from"./badge-DqJRtj_p.js";import{t as h}from"./textarea-hs6Mpyfl.js";import{t as g}from"./versioned-prompt-editor-BkTi7eim.js";import{a as _,i as ee,o as te,r as v,s as y,t as b}from"./card-C4QJ4hCW.js";var x=e(n(),1),S=r(),C=`all`;function w(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function T(e){return Array.isArray(e)?[...e].sort((e,t)=>{let n=e.category.localeCompare(t.category);if(n!==0)return n;let r=e.title.localeCompare(t.title);return r===0?e.slug.localeCompare(t.slug):r}):[]}function ne({template:e}){if(e.version===void 0)return null;let t=e.source===`bundled-fallback`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:t?`No saved version`:`v${e.version}`}),t&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Bundled fallback`}),e.bundledUpdateAvailable&&(0,S.jsx)(m,{className:`bg-tone-info/15 text-tone-info-fg hover:bg-tone-info/15`,children:`Update available`})]})}function E(){let[e,n]=(0,x.useState)([]),[r,E]=(0,x.useState)(!0),[D,O]=(0,x.useState)(``),[k,A]=(0,x.useState)(``),[j,M]=(0,x.useState)(``),[N,P]=(0,x.useState)(C),[F,I]=(0,x.useState)(``),[L,R]=(0,x.useState)({}),[z,B]=(0,x.useState)(``),[V,H]=(0,x.useState)(()=>Date.now());async function U(){E(!0),O(``);try{let e=await o(`GET`,`/settings/prompts`);n(T(e.templates)),H(Date.now())}catch(e){O(i(e))}finally{E(!1)}}(0,x.useEffect)(()=>{U()},[]);let W=(0,x.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.category,(t.get(n.category)??0)+1);return[...t.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,count:t,label:w(e)}))},[e]),G=N===C||W.some(e=>e.key===N)?N:C,K=(0,x.useMemo)(()=>G===C?e:e.filter(e=>e.category===G),[G,e]),q=K.some(e=>e.slug===F)?F:K[0]?.slug??``,J=K.find(e=>e.slug===q)??null,Y=J?L[J.slug]??J.template:``,X=J?Y!==J.template:!1,Z=e.filter(e=>e.template!==e.defaultTemplate).length,Q=J?z===J.slug:!1;function re(e){I(e),A(``),M(``)}function $(e){n(t=>T(t.map(t=>t.slug===e.slug?e:t))),R(t=>({...t,[e.slug]:e.template})),H(Date.now())}async function ie(){if(!(!J||!X)){B(J.slug),A(``),M(``);try{let e=await o(`PUT`,`/settings/prompts/${encodeURIComponent(J.slug)}`,{template:Y});$(e),M(`Saved ${e.title}.`)}catch(e){A(i(e))}finally{B(``)}}}async function ae(){if(!(!J||J.template===J.defaultTemplate)){B(J.slug),A(``),M(``);try{let e=await o(`POST`,`/settings/prompts/${encodeURIComponent(J.slug)}/reset`);$(e),M(`Reset ${e.title} to the built-in default.`)}catch(e){A(i(e))}finally{B(``)}}}function oe(){J&&(R(e=>({...e,[J.slug]:J.template})),A(``),M(`Unsaved edits discarded.`))}return(0,S.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Prompts`}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`View and edit the externalized prompt templates used across Relay lifecycle, routing, workspace, and automation flows.`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(m,{variant:`outline`,className:`gap-1`,children:[(0,S.jsx)(l,{className:`size-3`}),e.length,` template`,e.length===1?``:`s`]}),(0,S.jsxs)(m,{variant:`outline`,className:t(`gap-1`,Z>0&&`border-tone-warning/40 bg-tone-warning/10 text-tone-warning-fg`),children:[Z,` modified`]}),(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void U(),disabled:r,children:[(0,S.jsx)(u,{className:t(`size-4`,r&&`animate-spin`)}),`Refresh`]})]})]}),D&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-destructive/40 bg-destructive/10 p-3 text-sm text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-4`}),(0,S.jsx)(`span`,{children:D})]}),r&&e.length===0?(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Loading prompt templates…`})}):e.length===0?(0,S.jsx)(b,{children:(0,S.jsx)(v,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No prompt templates are available yet.`})}):(0,S.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[220px_minmax(0,0.9fr)_minmax(0,1.1fr)]`,children:[(0,S.jsxs)(`nav`,{className:`space-y-1 xl:sticky xl:top-4 xl:self-start`,children:[(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===C?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(C),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:`All`}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.length})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:`Every externalized prompt template`})]}),W.map(e=>(0,S.jsxs)(`button`,{type:`button`,className:t(`w-full rounded-md border px-3 py-2 text-left text-sm transition-colors`,G===e.key?`border-primary/50 bg-primary/10 text-foreground`:`border-transparent hover:border-border hover:bg-accent`),onClick:()=>P(e.key),children:[(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium`,children:e.label}),(0,S.jsx)(m,{variant:`outline`,className:`ml-auto h-4 px-1 text-[10px]`,children:e.count})]}),(0,S.jsx)(`span`,{className:`block truncate text-xs font-mono text-muted-foreground`,children:e.key})]},e.key))]}),(0,S.jsxs)(`div`,{className:`min-w-0 space-y-3`,children:[(0,S.jsx)(`div`,{className:`flex items-center justify-between gap-2 px-1`,children:(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold`,children:G===C?`All templates`:`${w(G)} templates`}),(0,S.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[K.length,` template`,K.length===1?``:`s`,` in this view`]})]})}),K.map(e=>{let n=e.slug===q,r=e.template!==e.defaultTemplate;return(0,S.jsx)(`button`,{type:`button`,className:t(`w-full rounded-xl border p-4 text-left transition-colors`,n?`border-primary/50 bg-primary/10 ring-1 ring-primary/20`:`border-border bg-card hover:border-primary/30 hover:bg-accent`),onClick:()=>re(e.slug),children:(0,S.jsx)(`div`,{className:`flex flex-wrap items-start gap-2`,children:(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-medium text-foreground`,children:e.title}),r&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Modified`}),(0,S.jsx)(m,{variant:`outline`,className:`text-[10px]`,children:w(e.category)}),(0,S.jsx)(ne,{template:e})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:e.slug}),e.description&&(0,S.jsx)(`p`,{className:`mt-2 line-clamp-2 text-sm text-muted-foreground`,children:e.description}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,S.jsxs)(`span`,{children:[e.variables.length,` variable`,e.variables.length===1?``:`s`]}),e.updatedAt>0&&(0,S.jsxs)(`span`,{children:[`Updated `,a(V,e.updatedAt)]})]})]})})},e.slug)})]}),(0,S.jsx)(`div`,{className:`min-w-0`,children:J?(0,S.jsxs)(b,{children:[(0,S.jsxs)(te,{className:`border-b border-border`,children:[(0,S.jsxs)(y,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{children:J.title}),J.template!==J.defaultTemplate&&(0,S.jsx)(m,{className:`bg-tone-warning/15 text-tone-warning-fg hover:bg-tone-warning/15`,children:`Customized`}),X&&(0,S.jsx)(m,{variant:`outline`,children:`Unsaved`})]}),(0,S.jsxs)(ee,{className:`space-y-1`,children:[(0,S.jsx)(`div`,{className:`font-mono text-[11px]`,children:J.slug}),J.description&&(0,S.jsx)(`div`,{children:J.description})]})]}),J.version===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(v,{className:`space-y-4 pt-4`,children:[k&&(0,S.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive`,children:[(0,S.jsx)(c,{className:`mt-0.5 size-3.5`}),(0,S.jsx)(`span`,{children:k})]}),j&&(0,S.jsx)(`div`,{className:`rounded-md border border-tone-success/30 bg-tone-success/10 px-3 py-2 text-xs text-tone-success-fg`,children:j}),(0,S.jsxs)(`div`,{className:`space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,S.jsx)(s,{className:`size-3.5`}),`Available variables`]}),J.variables.length>0?(0,S.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:J.variables.map(e=>(0,S.jsx)(m,{variant:`secondary`,className:`font-mono text-[11px]`,children:`{{${e}}}`},e))}):(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`This template has no placeholder variables.`})]}),J.template!==J.defaultTemplate&&(0,S.jsx)(`div`,{className:`rounded-lg border border-tone-warning/30 bg-tone-warning/10 px-3 py-2 text-xs text-tone-warning-fg`,children:`This template differs from the built-in default. Reset will restore the original text.`}),(0,S.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,S.jsx)(`label`,{htmlFor:`prompt-template-editor`,className:`text-xs font-medium text-muted-foreground`,children:`Template text`}),(0,S.jsx)(h,{id:`prompt-template-editor`,value:Y,onChange:e=>{let t=e.target.value;R(e=>({...e,[J.slug]:t})),k&&A(``),j&&M(``)},rows:18,spellCheck:!1,className:`min-h-[360px] resize-y font-mono text-xs leading-5`})]})]}),(0,S.jsxs)(_,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:X?`Editing local changes.`:`Updated ${a(V,J.updatedAt)}.`}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[J.template!==J.defaultTemplate&&(0,S.jsxs)(p,{variant:`outline`,size:`sm`,onClick:()=>void ae(),disabled:Q,children:[(0,S.jsx)(d,{className:`size-4`}),`Reset to default`]}),(0,S.jsx)(p,{variant:`outline`,size:`sm`,onClick:oe,disabled:!X||Q,children:`Cancel`}),(0,S.jsxs)(p,{size:`sm`,onClick:()=>void ie(),disabled:!X||Q,children:[(0,S.jsx)(f,{className:`size-4`}),`Save`]})]})]})]}):(0,S.jsx)(v,{className:`pt-4`,children:(0,S.jsx)(g,{slug:J.slug,onSaved:$},J.slug)})]}):(0,S.jsx)(b,{size:`sm`,children:(0,S.jsx)(v,{className:`text-sm text-muted-foreground`,children:`Select a prompt template to edit it.`})})})]})]})}export{E as PromptSettingsView};
|
|
2
|
+
//# sourceMappingURL=prompt-settings-DnPB6Ez6.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function t(e){if(typeof e!=`string`)return;let t=e.trim();return t.length>0?t:void 0}function n(e){return e instanceof Error?e.message:String(e)}var r=`provider-enablement`,i=`default`,a=`user`;function o(e){return`user:${e}`}var s=o(`claude-app`);function ee(e){return e===`user`||typeof e==`string`&&e.startsWith(`user:`)}function te(e){if(e===`user`)return i;if(typeof e==`string`&&e.startsWith(`user:`))return e.slice(5)||`default`}function ne(e){return e===`user`||e===o(`default`)||e===`user:`?a:e}var re=[`system`,`control`,`session`];function ie(e){return re.includes(e??``)}var c=[`memory`,`memory-area`,`instructions`,`tools`,`comms`,`knowledge`,`context`];function ae(e){return typeof e==`string`&&c.includes(e)}function oe(t){return e(t)&&(t.turnFinal===!0||t.final===!0)}function l(t){return e(t)&&e(t.finality)}function se(t){if(!e(t))return!1;if(l(t))return!0;let n=t.session;return e(n)&&n.final===!0&&n.turnFinal!==!0}function ce(t){if(t.messageType===`final-turn`)return!0;let n=e(t.payload?.responseCapture)?t.payload.responseCapture:void 0;return oe(n)&&n.type===`response`}var le=[`decisions`,`actions`,`escalations`,`finalReports`,`failures`];Object.freeze({decisions:`all`,actions:`all`,escalations:`all`,finalReports:`all`,failures:`all`});var ue=/^[a-z][a-z0-9-]*$/,u=new Map,d=[`CLAUDE_CODE_OAUTH_TOKEN`,`ANTHROPIC_API_KEY`,`ANTHROPIC_AUTH_TOKEN`];function f(e){if(!ue.test(e.id))throw Error(`invalid provider id: ${e.id}`);if(!e.label.trim())throw Error(`provider ${e.id} is missing a label`);if(!e.icon.trim())throw Error(`provider ${e.id} is missing an icon`);if(u.has(e.id))throw Error(`provider already registered: ${e.id}`);u.set(e.id,e)}function p(e){return u.get(e)}function m(){return[...u.values()]}function de(e,t){let n=u.get(e)?.capabilityDefaults.session?.shellMode,r=t===`read-only`?n?.readOnly:n?.[t];return!!(r&&r!==`unsupported`)}function h(e){return[`open`,`guarded`,`read-only`].filter(t=>de(e,t))}var g=`opencode-ai@latest`,fe=`@anthropic-ai/claude-code@latest`,_=[`low`,`medium`,`high`,`max`],v=[`low`,`medium`,`high`,`xhigh`,`max`],y={value:2e5,source:`catalog`,confidence:`declared`},b={value:1e6,source:`catalog`,confidence:`declared`},pe={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},x=[{name:`five_hour`,unit:`%`,reset:!0},{name:`seven_day`,unit:`%`,reset:!0}];function S(e){return{...e?{limits:e}:{},capabilities:pe}}var C={id:`claude`,credentialEnvKeys:d,label:`Claude`,icon:`🟠`,launchModes:[`interactive`,`headless`],effortSwitch:!0,launch:{managedPolicyPrompt:{alwaysOn:`append-system-prompt`},taskHydration:{channel:`append-system-prompt`}},catalog:{defaultModel:`sonnet`,models:[{alias:`haiku-5.5`,label:`Haiku 5.5`,providerModel:`claude-haiku-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-5.5`,label:`Opus 5.5`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet-5.5`,label:`Sonnet 5.5`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`fable-5.1`,label:`Fable 5.1`,providerModel:`claude-fable-5-1`,efforts:v,defaultEffort:`high`,...S({contextWindowTokens:b})},{alias:`fable-5`,label:`Fable 5`,providerModel:`claude-fable-5`,efforts:v,defaultEffort:`medium`,unavailable:`suspended by export-control directive, 2026-06-12`,...S({contextWindowTokens:b})},{alias:`opus-4.8`,label:`Opus 4.8`,providerModel:`claude-opus-4-8`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.8[1m]`,label:`Opus 4.8 1M`,providerModel:`claude-opus-4-8[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-4.7`,label:`Opus 4.7`,providerModel:`claude-opus-4-7`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.7[1m]`,label:`Opus 4.7 1M`,providerModel:`claude-opus-4-7[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus-4.6`,label:`Opus 4.6`,providerModel:`claude-opus-4-6`,efforts:_,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`opus-4.6[1m]`,label:`Opus 4.6 1M`,providerModel:`claude-opus-4-6[1m]`,efforts:_,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet-5`,label:`Sonnet 5`,providerModel:`claude-sonnet-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:y})},{alias:`sonnet-5[1m]`,label:`Sonnet 5 1M`,providerModel:`claude-sonnet-5[1m]`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`haiku`,label:`Haiku`,providerModel:`claude-haiku-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`fable`,label:`Fable`,providerModel:`claude-fable-5-1`,efforts:v,defaultEffort:`high`,...S({contextWindowTokens:b})},{alias:`opus`,label:`Opus`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`opus[1m]`,label:`Opus 1M`,providerModel:`claude-opus-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet`,label:`Sonnet`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})},{alias:`sonnet[1m]`,label:`Sonnet 1M`,providerModel:`claude-sonnet-5-5`,efforts:v,defaultEffort:`medium`,...S({contextWindowTokens:b})}]},quotaWindows:[...x],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:{when:`headless`,value:!0,otherwise:!1},restartHard:{when:`headless`,value:!0,otherwise:!1},semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:{when:`approval:not-read-only`,value:!0,otherwise:!1},shell:!0,shellMode:{open:`unrestricted`,guarded:`guarded`,readOnly:`read-only-guarded`}},context:{managed:`headless`,compact:{when:`headless`,value:!0,otherwise:!1},clear:{when:`headless`,value:!0,otherwise:!1},inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`probe`,unit:`%`,windows:[...x]},terminal:{mode:`live`,condition:`headless`,live:{read:!0,write:!0}},liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!0,slashCommands:!0}},slashCommands:[`/clear`,`/compact`,`/model`,`/help`],resume:{supported:!0,idFormat:`uuid-v4`,idPattern:`[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`},home:{configDir:`.claude`,envPrefix:`CLAUDE`,configDirEnvVar:`CLAUDE_CONFIG_DIR`,quotaCredentialFile:`.credentials.json`,authItems:[`.credentials.json`,`statsig`],globalInstructionFiles:[`CLAUDE.md`]},provisioning:{pluginManifestPath:`.claude-plugin/plugin.json`,bundledPlugin:{ref:`agent-relay-claude-plugin`,dir:`runner/plugins/claude`,title:`Humwick Claude plugin`,description:`Bundled Humwick Claude plugin, materialized whole through the provisioning registry.`,omitFiles:[`monitors/relay-monitor.provisioned.mjs`,`hooks/gate-run-guard.provisioned.mjs`,`hooks/kill-guard.provisioned.mjs`],fileOverrides:[{path:`monitors/relay-monitor.ts`,sourcePath:`monitors/relay-monitor.provisioned.mjs`},{path:`hooks/gate-run-guard.ts`,sourcePath:`hooks/gate-run-guard.provisioned.mjs`},{path:`hooks/kill-guard.ts`,sourcePath:`hooks/kill-guard.provisioned.mjs`}]},bundledHooks:[{ref:`agent-relay-rg-r-guard`,dir:`runner/hooks/rg-r-guard`,title:`Humwick baseline hook: rg -r guard`,description:"Baseline Humwick PreToolUse hook that blocks the ripgrep `rg -r` replace footgun.",baseline:!0},{ref:`agent-relay-fff-search-redirect`,dir:`runner/hooks/fff-search-redirect`,title:`Humwick fff search redirect`,description:`Redirects standalone repository searches to fff for Claude profiles with a configured fff MCP server.`,omitFiles:[`fff-search-redirect.test.ts`]},{ref:`agent-relay-web-tools-redirect`,dir:`runner/hooks/web-tools-redirect`,title:`Humwick web tools redirect`,description:`Redirects built-in WebSearch/WebFetch to the profile's Relay web_search and local-first page reader tools (#3024).`,omitFiles:[`web-tools-redirect.test.ts`]}]},upgrade:{packages:[`agent-relay-runner`,`agent-relay-plugin`],detectPackages:[`agent-relay-runner`],detectCommands:[`claude`]},harness:{upgrade:{strategy:`self-update`,args:[`update`],packages:[fe]}},probe:{command:`claude`,args:[`--version`],healthCheck:`claude --version`,authCheck:{command:`claude`,args:[`auth`,`status`,`--json`],loginArgs:[`auth`,`login`]}},quotaPoll:{strategy:`none`},shim:{kind:`claude-relay`},mcpToolManifest:{clientNativeToolDeferral:!0,runnerManagedToolDeferral:!1}};f(C),f({...C,id:`claude-b`,label:`Claude B`,home:{...C.home,configDir:`.claude-b`,dedicatedHome:!0}}),f({...C,id:`claude-api`,label:`Claude API`,automaticFamilyRouting:!1,defaultEnabled:!1,resume:{supported:!1},credentialEnvKeys:[`ANTHROPIC_API_KEY`],apiAuth:{keyPrefix:`sk-ant-`,keyEnvVar:`ANTHROPIC_API_KEY`,defaultKeyFile:`~/.config/agent-relay/secrets/anthropic-api.key`,unsetEnvKeys:[...d,`ANTHROPIC_BASE_URL`,`CLAUDE_CODE_USE_BEDROCK`,`CLAUDE_CODE_USE_VERTEX`,`CLAUDE_CODE_USE_FOUNDRY`,`ANTHROPIC_CUSTOM_HEADERS`,`CLAUDE_CODE_API_KEY_HELPER_TTL_MS`]},home:{...C.home,configDir:`.claude-api`,sourceEnvVar:`CLAUDE_API_CONFIG_DIR`,dedicatedHome:!0,authItems:[]},harness:{upgrade:{...C.harness.upgrade,installWhenMissing:!0}},launchModes:void 0,quotaWindows:[],capabilityDefaults:{...C.capabilityDefaults,quota:{supported:!1,source:`runtime`,unit:`USD`,windows:[]}}});var w=[`low`,`medium`,`high`,`xhigh`],T={value:2e5,source:`catalog`,confidence:`declared`},E={value:5e5,source:`catalog`,confidence:`declared`},me={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,review:!0,debug:!0,refactor:!0},source:`catalog`,confidence:`declared`},D=[{name:`primary`,unit:`%`,reset:!0},{name:`secondary`,unit:`%`,reset:!0}];function O(e){return{...e?{limits:e}:{},capabilities:me}}f({id:`codex`,credentialEnvKeys:[`OPENAI_API_KEY`],label:`Codex`,icon:`⌨️`,launchModes:[`interactive`,`headless`],launch:{secretEnvRequiresManagedHome:!0,managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`sol`,models:[{alias:`sol`,label:`GPT-6.1 Sol`,providerModel:`gpt-6.1-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:E})},{alias:`luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-6-sol`,label:`GPT-6 Sol`,providerModel:`gpt-6-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-6.1-sol`,label:`GPT-6.1 Sol`,providerModel:`gpt-6.1-sol`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:E})},{alias:`gpt-6-luna`,label:`GPT-6 Luna`,providerModel:`gpt-6-luna`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,providerModel:`gpt-5.6-terra`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.5`,label:`GPT-5.5`,providerModel:`gpt-5.5`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.4`,label:`GPT-5.4`,providerModel:`gpt-5.4`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.4-mini`,label:`GPT-5.4 Mini`,providerModel:`gpt-5.4-mini`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.3-codex`,label:`GPT-5.3 Codex`,providerModel:`gpt-5.3-codex`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})},{alias:`gpt-5.3-codex-spark`,label:`GPT-5.3 Codex Spark`,providerModel:`gpt-5.3-codex-spark`,efforts:w,defaultEffort:`high`,...O({contextWindowTokens:T})},{alias:`gpt-5.2`,label:`GPT-5.2`,providerModel:`gpt-5.2`,efforts:w,defaultEffort:`medium`,...O({contextWindowTokens:T})}]},quotaWindows:[...D],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:{when:`approval:not-read-only`,value:!0,otherwise:!1},shell:{when:`approval:not-read-only`,value:!0,otherwise:!1},shellMode:{open:`unrestricted`,guarded:`guarded`,readOnly:`none`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`probe`,unit:`%`,windows:[...D]},terminal:{mode:`attach`,attach:{create:!0,read:!0,write:!0,detach:!0}},liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!0,slashCommands:!0}},slashCommands:[`/compact`,`/new`],resume:{supported:!0,idFormat:`codex-thread-id`,idPattern:`[\\w-]+`},home:{configDir:`.codex`,envPrefix:`CODEX`,configDirEnvVar:`CODEX_HOME`,quotaCredentialFile:`auth.json`,authItems:[`auth.json`,`installation_id`],globalInstructionFiles:[`AGENTS.md`]},provisioning:{pluginManifestPath:`.codex-plugin/plugin.json`,bundledSkills:{refPrefix:`agent-relay-codex-`,dir:`runner/plugins/codex/skills`,titlePrefix:`Humwick Codex skill: `,description:`Bundled Humwick Codex skill, materialized through the provisioning registry.`,entryFile:`SKILL.md`},bundledHooks:[{ref:`agent-relay-rg-r-guard`,dir:`runner/hooks/rg-r-guard`,title:`Humwick baseline hook: rg -r guard`,description:"Baseline Humwick PreToolUse hook that blocks the ripgrep `rg -r` replace footgun.",baseline:!0}]},upgrade:{packages:[`agent-relay-runner`,`agent-relay-codex`],detectPackages:[`agent-relay-runner`,`agent-relay-codex`],detectCommands:[`codex-relay`,`agent-relay-runner`]},harness:{upgrade:{strategy:`self-update`,args:[`update`]}},probe:{command:`codex`,args:[`--version`],healthCheck:`codex --version`,authCheck:{command:`codex`,args:[`login`,`status`],loginArgs:[`login`]}},quotaPoll:{strategy:`codex-app-server`},resetCredits:{supported:!0},shim:{kind:`codex-relay`,extraBinPaths:[`codex/bin/codex`],cleanLegacyHooks:!0},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!0,runnerManagedToolDeferralRoute:`meta-only-callmux`}});var k={mode:`attach`,attach:{create:!0,read:!0,write:!0,detach:!0}};f({id:`opencode`,label:`OpenCode`,icon:`⚡`,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`muse-spark`,models:[{alias:`muse-spark`,label:`Muse Spark 1.3 Contributor`,providerModel:`meta/muse-spark-1.3-contributor`,efforts:[],limits:{contextWindowTokens:{value:1048576,source:`catalog`,confidence:`declared`},maxOutputTokens:{value:943718,source:`catalog`,confidence:`declared`}},capabilities:{modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`estimated`}},{alias:`openai/gpt-6.1-sol`,label:`GPT-6.1 Sol · OpenAI API`,providerModel:`openai/gpt-6.1-sol`,efforts:[],limits:{contextWindowTokens:{value:272e3,source:`catalog`,confidence:`declared`},maxOutputTokens:{value:128e3,source:`catalog`,confidence:`declared`}}}]},quotaWindows:[],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!1,source:`runtime`,unit:`%`,windows:[]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.config/opencode`,envPrefix:`OPENCODE`},opencode:{opencodeProviderID:`openrouter`,apiKeyEnvVar:`OPENROUTER_API_KEY`},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`none`},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}});var A=[{name:`rolling`,unit:`%`,reset:!0,description:`Rolling 5-hour usage window`},{name:`weekly`,unit:`%`,reset:!0,description:`Weekly usage window`},{name:`monthly`,unit:`%`,reset:!0,description:`Monthly usage window (display-only)`}],he={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`estimated`};function j(e,t){return{alias:e,label:t,providerModel:e,efforts:[],capabilities:he}}f({id:`opencode-go`,label:`OpenCode Go`,icon:`⚡`,defaultEnabled:!1,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`glm-5.3-flash`,models:[j(`claude-haiku-5-5`,`Claude Haiku 5.5`),j(`deepseek-v4-pro`,`DeepSeek V4 Pro`),j(`deepseek-v4.1-flash`,`DeepSeek V4.1 Flash`),j(`gemini-4-argon-contributor`,`Gemini 4 Argon Contributor`),j(`glm-5.2`,`GLM-5.2`),j(`glm-5.3`,`GLM-5.3`),j(`glm-5.3-flash`,`GLM-5.3 Flash`),j(`gpt-5.6-luna`,`GPT-5.6 Luna`),j(`gpt-6-luna`,`GPT-6 Luna`),j(`grok-4.6`,`Grok 4.6`),j(`grok-4.7`,`Grok 4.7`),j(`hy3`,`Hy3`),j(`hy4-preview`,`Hy4 Preview`),j(`kimi-k2.7-code`,`Kimi K2.7 Code`),j(`kimi-k3`,`Kimi K3`),j(`longcat-2.0`,`LongCat 2.0`),j(`mimo-v2.5`,`MiMo V2.5`),j(`mimo-v2.5-pro`,`MiMo V2.5 Pro`),j(`mimo-v2.6-flash`,`MiMo V2.6 Flash`),j(`mimo-v2.6-pro`,`MiMo V2.6 Pro`),j(`minimax-m2.7`,`MiniMax M2.7`),j(`minimax-m3`,`MiniMax M3`),j(`muse-spark-1.2-contributor`,`Muse Spark 1.2 Contributor`),j(`muse-spark-1.3-contributor`,`Muse Spark 1.3 Contributor`),j(`qwen3.7-plus`,`Qwen3.7 Plus`),j(`qwen3.8-flash`,`Qwen3.8 Flash`),j(`qwen3.8-max`,`Qwen3.8 Max`),j(`space-bunny`,`Space Bunny`)]},quotaWindows:[...A],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`runtime`,unit:`%`,windows:[...A]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.local/share/opencode`,envPrefix:`OPENCODE_GO`,quotaCredentialFile:`auth.json`},opencode:{opencodeProviderID:`opencode-go`,apiKeyEnvVar:`OPENCODE_API_KEY`,hostAuth:!0},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`opencode-go`},quotaAlsoWith:`opencode`,mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}});var M={value:1e6,source:`catalog`,confidence:`declared`},N={value:131072,source:`catalog`,confidence:`declared`},ge={modalities:{input:{text:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},P={modalities:{input:{text:!0,image:!0},output:{text:!0}},tools:{code:!0,shell:!0,fileRead:!0,fileWrite:!0},source:`provider`,confidence:`declared`},F=[{name:`five_hour`,unit:`%`,reset:!0,description:`Rolling 5-hour credit window`},{name:`seven_day`,unit:`%`,reset:!0,description:`Weekly credits, reset from the subscription timestamp`}];f({id:`zai`,label:`z.ai`,icon:`🟣`,launch:{managedPolicyPrompt:{alwaysOn:`prompt`},taskHydration:{channel:`prompt`}},catalog:{defaultModel:`glm-5.3-flash`,models:[{alias:`glm-5.3`,label:`GLM-5.3`,providerModel:`glm-5.3`,efforts:[],limits:{contextWindowTokens:M,maxOutputTokens:N},capabilities:ge},{alias:`glm-5.3-flash`,label:`GLM-5.3 Flash`,providerModel:`glm-5.3-flash`,efforts:[],limits:{contextWindowTokens:M,maxOutputTokens:N},capabilities:P}]},quotaWindows:[...F],capabilityDefaults:{lifecycle:{managed:!0,shutdownHard:!0,restartHard:!0,semanticStatus:!0,reconnect:!0},session:{fileRead:!0,fileWrite:!0,shell:!0,shellMode:{open:`unrestricted`,guarded:`unsupported`,readOnly:`unsupported`}},context:{managed:`always`,compact:!0,clear:!0,inject:!0,resumePreference:[`native`,`clear-inject`,`none`]},quota:{supported:!0,source:`runtime`,unit:`%`,windows:[...F]},terminal:k,liveSession:{capture:!0,inject:!0,interrupt:!0,promptEcho:!0,reasoning:!1,slashCommands:!1}},resume:{supported:!1},home:{configDir:`.config/opencode`,envPrefix:`ZAI`,quotaCredentialFile:`auth.json`},opencode:{opencodeProviderID:`zai`,baseURL:`https://api.z.ai/api/coding/paas/v4`,npm:`@ai-sdk/openai-compatible`,apiKeyEnvVar:`ZAI_API_KEY`},upgrade:{packages:[`agent-relay-runner`],externalPackages:[g],detectPackages:[`opencode-ai`],detectCommands:[`opencode`]},harness:{upgrade:{strategy:`external-packages`}},probe:{command:`opencode`,args:[`--version`],healthCheck:`opencode --version`},shim:{kind:`opencode-relay`},quotaPoll:{strategy:`zai`},mcpToolManifest:{clientNativeToolDeferral:!1,runnerManagedToolDeferral:!1}}),Object.freeze({codex:{"gpt-5.6-terra":`sol`,"gpt-5.6-sol":`sol`,"gpt-6-sol":`sol`,"gpt-6.1-sol":`sol`,"gpt-5.6-luna":`luna`,"gpt-6-luna":`luna`},claude:{"opus-4.8":`opus`,"sonnet-5":`sonnet`,"fable-5":`fable`},"claude-b":{"opus-4.8":`opus`,"sonnet-5":`sonnet`,"fable-5":`fable`}});var I={opencode:{envVar:`OPENCODE_API_KEY`},"opencode-go":{envVar:`OPENCODE_API_KEY`},anthropic:{envVar:`ANTHROPIC_API_KEY`},openai:{envVar:`OPENAI_API_KEY`},openrouter:{envVar:`OPENROUTER_API_KEY`},google:{envVar:`GOOGLE_GENERATIVE_AI_API_KEY`},mistral:{envVar:`MISTRAL_API_KEY`},deepseek:{envVar:`DEEPSEEK_API_KEY`},xai:{envVar:`XAI_API_KEY`},groq:{envVar:`GROQ_API_KEY`},azure:{envVar:`AZURE_API_KEY`},moonshotai:{envVar:`MOONSHOT_API_KEY`},cerebras:{envVar:`CEREBRAS_API_KEY`},cohere:{envVar:`COHERE_API_KEY`},"fireworks-ai":{envVar:`FIREWORKS_API_KEY`},togetherai:{envVar:`TOGETHER_API_KEY`},chutes:{envVar:`CHUTES_API_KEY`},zai:{envVar:`ZAI_API_KEY`,custom:!0}},L=class extends Error{candidates;constructor(e,t){super(e),this.candidates=t,this.name=`OpenCodeModelResolutionError`}},R=8;function z(e,t){let n=e.indexOf(`/`);return n<=0?{backendID:t,modelID:e,qualified:`${t}/${e}`}:{backendID:e.slice(0,n),modelID:e.slice(n+1),qualified:e}}function _e(e,t,n){let r=e.trim();if(!r)throw new L(`OpenCode model id is empty.`,[]);let i=r.indexOf(`/`),a=i>0?r.slice(0,i):void 0;if(!n)return a&&(a===t||I[a]!==void 0)?z(r,t):{backendID:t,modelID:r,qualified:`${t}/${r}`};if(n.models.has(r))return z(r,t);if(n.models.has(`${t}/${r}`))return{backendID:t,modelID:r,qualified:`${t}/${r}`};if(a&&n.providers.has(a))return z(r,t);if(!a){let e=[...n.models].filter(e=>e.slice(e.indexOf(`/`)+1)===r);if(e.length===1)return z(e[0],t);if(e.length>1){let t=e.sort().slice(0,R);throw new L(`OpenCode model "${r}" is ambiguous on this host (${n.source} registry); qualify it as one of: ${t.join(`, `)}.`,t)}}let o=ve(r,n),s=o.length?` Did you mean: ${o.join(`, `)}?`:``;throw new L(`OpenCode model "${r}" is not available on this host (${n.source} registry: backend "${a??t}" is not a known opencode provider and no listed model matches).${s}`,o)}function ve(e,t){let n=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(!n)return[];let r=[],i=[];for(let e of t.models){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();t===n?r.push(e):t.includes(n)&&i.push(e)}return[...r.sort(),...i.sort()].slice(0,R)}var ye=[`off`,`quiet`,`normal`,`verbose`];m().map(e=>e.id);var B=[`narration`,`tools`,`reasoning`,`memories`,`startup`,`injected`,`agentMessages`,`workflow`,`land`,`task`,`agents`,`other`,`undelivered`],be=[`workflow`,`land`,`task`,`agents`,`other`];function V(e){return Object.fromEntries(B.map(t=>[t,e(t)]))}var H=V(e=>be.includes(e)),U={calm:H,everything:V(()=>!0)};function W(e){let t=e&&typeof e==`object`&&!Array.isArray(e)?e:{};return V(e=>typeof t[e]==`boolean`?t[e]:H[e])}function xe(e){for(let[t,n]of Object.entries(U))if(B.every(t=>n[t]===e[t]))return t;return null}function Se(e,t){let n=e?.opencodeProviderID,r=t?.trim();if(!(!n||!r))return _e(r,n).qualified}function Ce(e){return!e?.disabled}var we=.1,Te=.9,G=.8,K=.4,q=256e3,J=1e6;function Ee(){return m().map(e=>({provider:e.id,label:e.label,models:[],...e.opencode?.opencodeProviderID?{opencodeProviderID:e.opencode.opencodeProviderID}:{},...e.launchModes?.length?{launchModes:[...e.launchModes]}:{},...e.effortSwitch?{effortSwitch:!0}:{}}))}function De(e){let t=Oe(e);return{selfCompactUtilization:t,warnUtilization:ke(t),hardBackstopUtilization:Math.max(Te,t)}}function Oe(e){return!Number.isFinite(e)||!e||e<=q?G:e>=J?K:Y(G-(e-q)/(J-q)*(G-K))}function ke(e){return Y(Math.max(0,e-we))}function Y(e){return Math.round(e*1e3)/1e3}function X(e,t){if(e)return(t??Ee()).find(t=>t.provider===e)}function Ae(e,t,n={}){let r=(Array.isArray(t)?t:t?[t]:[]).map(e=>e.trim()).filter(Boolean);if(r.length){for(let t of r){let i=je(e,t,n.requireUnambiguous),a=Me(e,i,r,n.observedWindowTokens);if(a)return a;if(i)return i}if(!(n.requireUnambiguous||n.exactOnly))for(let t of r){let n=e.models.find(e=>e.alias.startsWith(t+`-`));if(n)return n}}}function je(e,t,n=!1){let r=t.toLowerCase(),i=e.models.find(e=>e.alias===t)??e.models.find(e=>e.alias.toLowerCase()===r);if(i)return i;let a=e.models.filter(e=>e.providerModel.toLowerCase()===r);if(a.length>1&&n)throw Error(`ambiguous ${e.provider} provider model: ${t} (select an alias: ${a.map(e=>e.alias).join(`, `)})`);return a[0]}function Me(e,t,n,r){if(!Number.isFinite(r)||!r)return;if(t?.limits?.contextWindowTokens?.value===r)return t;let i=new Set([...t?[t.alias,t.providerModel]:[],...n].map(Z));return e.models.find(e=>e.limits?.contextWindowTokens?.value===r&&(i.has(Z(e.alias))||i.has(Z(e.providerModel))))}function Z(e){return e.trim().toLowerCase().replace(/\[[^\]]+\]$/,``)}function Ne(e){return!e.disabled&&!e.unavailable}function Pe(e){let t=e.defaultModel,n=t?e.models.find(e=>e.alias===t):void 0;return n&&Ne(n)?{alias:n.alias,preferred:t,fellBack:!1}:{alias:void 0,preferred:t,fellBack:!0}}function Fe(e){return p(e)?.resetCredits?.supported===!0}var Q=[`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`,`bg-tone-sky/10 text-tone-sky-fg border-tone-sky/30`,`bg-tone-violet/10 text-tone-violet-fg border-tone-violet/30`,`bg-tone-success/10 text-tone-success-fg border-tone-success/30`,`bg-tone-rose/10 text-tone-rose-fg border-tone-rose/30`];function Ie(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return t}var $=new Map(m().map((e,t)=>[e.id,Q[t%Q.length]]));function Le(e){return e?p(e)?.label??e.charAt(0).toUpperCase()+e.slice(1):`Unknown provider`}function Re(e){let t=$.get(e);if(t)return t;let n=Q[Ie(e)%Q.length];return $.set(e,n),n}function ze(){return m().map(e=>e.id)}function Be(e){return p(e)}function Ve(e,t){let n=e?.id||e?.alias;if(!e||!n)return;let r=X(e.provider,t),i=r?Ae(r,[e.alias||``,n]):void 0;return{label:i?.label||n,...i?{entry:i}:{}}}export{o as A,se as C,ne as D,a as E,n as M,e as N,ee as O,t as P,ae as S,i as T,h as _,Fe as a,ce as b,X as c,Pe as d,H as f,ye as g,W as h,Be as i,r as j,te as k,Ce as l,xe as m,Re as n,Ve as o,U as p,Le as r,De as s,ze as t,Se as u,le as v,s as w,ie as x,l as y};
|
|
2
|
+
//# sourceMappingURL=provider-display-bWwiuedV.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{M as r,n as i,t as a}from"./provider-display-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{p as t,u as n}from"./dist-DeW2Y1R5.js";import{M as r,n as i,t as a}from"./provider-display-bWwiuedV.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./label-BPBzm9FJ.js";import{t as c}from"./switch-DuCA7mrB.js";import{t as l}from"./circle-alert-CryagaZd.js";import{n as u,t as d}from"./package-plus-C1AKMjsl.js";import{t as f}from"./clock-BWPPBh1_.js";import{t as p}from"./download-KgtpDbt5.js";import{t as m}from"./play-BbT8m7A0.js";import{t as h}from"./plus-D5Ek4e2S.js";import{t as g}from"./refresh-cw-CfpvQcUn.js";import{t as _}from"./button-Do6Z3vvn.js";import{t as v}from"./badge-DqJRtj_p.js";import{t as y}from"./input-CsTB6jIx.js";import{t as b}from"./textarea-hs6Mpyfl.js";import{o as x,r as S,s as C,t as w}from"./card-C4QJ4hCW.js";var T=e(t(),1),E=n(),D=[{value:`none`,label:`None (host must already provide it)`},{value:`npm-global`,label:`npm install -g (pinned version)`},{value:`download`,label:`Download + checksum`},{value:`bundled`,label:`Bundled with relay`}],O=[`stdio`,`ws`,`http`],k=[`shared`,`per-agent`],A=[`none`,`tcp`,`http`];function j(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function M(e){let t={};for(let n of e.split(`
|
|
2
2
|
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);r<=0||(t[e.slice(0,r).trim()]=e.slice(r+1).trim())}return t}var N=[{value:`all`,label:`All`},{value:`skill`,label:`Skills`},{value:`plugin`,label:`Plugins`},{value:`mcp`,label:`MCP`},{value:`hook`,label:`Hooks`}],P=[`any`,...a()];function F(e){return e===`skill`?`bg-tone-info/10 text-tone-info-fg border-tone-info/30`:e===`plugin`?`bg-tone-violet/10 text-tone-violet-fg border-tone-violet/30`:e===`hook`?`bg-tone-warning/10 text-tone-warning-fg border-tone-warning/30`:`bg-tone-success/10 text-tone-success-fg border-tone-success/30`}function I(e){return e===`any`?`bg-tone-neutral/10 text-tone-neutral-fg border-tone-neutral/30`:i(e)}function L(e){return e===`approved`?`bg-tone-success/10 text-tone-success-fg border-tone-success/30`:e===`rejected`?`bg-tone-danger/10 text-tone-danger-fg border-tone-danger/30`:`bg-tone-yellow/10 text-tone-yellow-fg border-tone-yellow/30`}function R({status:e}){return e===`valid`?(0,E.jsx)(u,{className:`h-3.5 w-3.5 text-tone-success-fg`}):e===`invalid`?(0,E.jsx)(l,{className:`h-3.5 w-3.5 text-tone-danger-fg`}):(0,E.jsx)(f,{className:`h-3.5 w-3.5 text-tone-neutral-fg`})}var z={kind:`skill`,slug:``,title:``},B={githubUrl:``,ref:`main`,subpath:``,provider:`any`,versionConstraint:``},V={command:``,args:``,url:``,approvalStatus:`pending`,versionConstraint:``,setupKind:`none`,setupPkg:``,setupVersion:``,setupUrl:``,setupSha256:``,setupBin:``,runCommand:``,runArgs:``,runEnv:``,runTransport:`stdio`,healthProbeKind:`none`,healthProbePath:``,listenerMode:`shared`,applicabilityProviders:``,applicabilityProfiles:``};function H({variant:e,onToggle:t,onUpdate:n,onValidate:r,busy:i}){let a=i===e.id,o=e.kind===`mcp`?e.definition:void 0;return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${I(e.provider)}`,children:e.provider}),(0,E.jsx)(`span`,{className:`text-xs font-medium font-mono`,children:e.name}),e.approvalStatus&&(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${L(e.approvalStatus)}`,children:e.approvalStatus}),(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-1 ml-auto`,children:[(0,E.jsx)(R,{status:e.validationStatus}),e.validationStatus??`unvalidated`]}),(0,E.jsx)(c,{size:`sm`,checked:e.enabled,disabled:a,onCheckedChange:n=>t(e.id,n)})]}),(e.sourceUrl||e.sourceRef)&&(0,E.jsxs)(`div`,{className:`text-[10px] text-muted-foreground font-mono truncate`,title:e.sourceUrl,children:[e.sourceUrl,e.sourceRef?`@${e.resolvedRef??e.sourceRef}`:``,e.sourceSubpath?` · ${e.sourceSubpath}`:``]}),o&&(o.setup||o.runConfig||o.applicability)&&(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[o.setup&&(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-sky/10 text-tone-sky-fg border-tone-sky/30`,children:[`setup: `,o.setup.kind]}),o.runConfig&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-teal/10 text-tone-teal-fg border-tone-teal/30`,children:[`transport: `,o.runConfig.transport]}),(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-teal/10 text-tone-teal-fg border-tone-teal/30`,children:[`listener: `,o.runConfig.listenerMode]})]}),o.applicability?.providers?.length?(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-fuchsia/10 text-tone-fuchsia-fg border-tone-fuchsia/30`,children:[`providers: `,o.applicability.providers.join(`, `)]}):null,o.applicability?.profiles?.length?(0,E.jsxs)(v,{variant:`outline`,className:`text-[10px] bg-tone-fuchsia/10 text-tone-fuchsia-fg border-tone-fuchsia/30`,children:[`profiles: `,o.applicability.profiles.join(`, `)]}):null]}),(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:a||!e.sourceRef,onClick:()=>n(e.id),title:`Pull latest from source ref`,children:[(0,E.jsx)(p,{className:`h-3 w-3 mr-1`}),`Update ref`]}),(0,E.jsxs)(_,{variant:`outline`,size:`sm`,className:`h-6 text-xs`,disabled:a,onClick:()=>r(e.id),children:[(0,E.jsx)(m,{className:`h-3 w-3 mr-1`}),`Validate`]})]})]})}function U({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`New Capability`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Kind`}),(0,E.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.kind,onChange:e=>t({kind:e.target.value}),children:[(0,E.jsx)(`option`,{value:`skill`,children:`Skill`}),(0,E.jsx)(`option`,{value:`plugin`,children:`Plugin`}),(0,E.jsx)(`option`,{value:`mcp`,children:`MCP Server`}),(0,E.jsx)(`option`,{value:`hook`,children:`Hook`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Slug`}),(0,E.jsx)(y,{value:e.slug,onChange:e=>t({slug:e.target.value}),placeholder:`my-capability`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Title (optional)`}),(0,E.jsx)(y,{value:e.title,onChange:e=>t({title:e.target.value}),placeholder:`My Capability`,className:`mt-1 text-sm`})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.slug.trim(),children:i?`Creating…`:`Create`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function W({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`Import from GitHub`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`GitHub URL`}),(0,E.jsx)(y,{value:e.githubUrl,onChange:e=>t({githubUrl:e.target.value}),placeholder:`https://github.com/owner/repo`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Ref`}),(0,E.jsx)(y,{value:e.ref,onChange:e=>t({ref:e.target.value}),placeholder:`main`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Subpath (optional)`}),(0,E.jsx)(y,{value:e.subpath,onChange:e=>t({subpath:e.target.value}),placeholder:`skills/my-skill`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Provider`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.provider,onChange:e=>t({provider:e.target.value}),children:P.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version constraint (optional)`}),(0,E.jsx)(y,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.githubUrl.trim()||!e.ref.trim(),children:i?`Importing…`:`Import`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function G({form:e,onChange:t,onSubmit:n,onCancel:r,busy:i,error:a}){return(0,E.jsxs)(`div`,{className:`rounded-md border border-border bg-card/60 p-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-sm font-medium`,children:`Add MCP Server Variant`}),a&&(0,E.jsx)(`div`,{className:`text-xs text-destructive`,children:a}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Command (for stdio type)`}),(0,E.jsx)(y,{value:e.command,onChange:e=>t({command:e.target.value}),placeholder:`npx -y @modelcontextprotocol/server-foo`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Args (space-separated, overrides command split)`}),(0,E.jsx)(y,{value:e.args,onChange:e=>t({args:e.target.value}),placeholder:`--port 3000`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`URL (for http/sse type)`}),(0,E.jsx)(y,{value:e.url,onChange:e=>t({url:e.target.value}),placeholder:`http://localhost:3000/mcp`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Approval status`}),(0,E.jsxs)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.approvalStatus,onChange:e=>t({approvalStatus:e.target.value}),children:[(0,E.jsx)(`option`,{value:`pending`,children:`Pending`}),(0,E.jsx)(`option`,{value:`approved`,children:`Approved`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version constraint (optional)`}),(0,E.jsx)(y,{value:e.versionConstraint,onChange:e=>t({versionConstraint:e.target.value}),placeholder:`>=1.0.0`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{className:`border-t border-border pt-3 space-y-3`,children:[(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:`Setup recipe — how a host without this server obtains it`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Recipe kind`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.setupKind,onChange:e=>t({setupKind:e.target.value}),children:D.map(e=>(0,E.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),e.setupKind===`npm-global`&&(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Package`}),(0,E.jsx)(y,{value:e.setupPkg,onChange:e=>t({setupPkg:e.target.value}),placeholder:`@scope/mcp-server`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Version (exact, pinned)`}),(0,E.jsx)(y,{value:e.setupVersion,onChange:e=>t({setupVersion:e.target.value}),placeholder:`1.2.3`,className:`mt-1 text-sm font-mono`})]})]}),e.setupKind===`download`&&(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Download URL (https)`}),(0,E.jsx)(y,{value:e.setupUrl,onChange:e=>t({setupUrl:e.target.value}),placeholder:`https://example.com/server.tar.gz`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`sha256 checksum`}),(0,E.jsx)(y,{value:e.setupSha256,onChange:e=>t({setupSha256:e.target.value}),placeholder:`64 hex chars`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Binary name`}),(0,E.jsx)(y,{value:e.setupBin,onChange:e=>t({setupBin:e.target.value}),placeholder:`server-bin`,className:`mt-1 text-sm font-mono`})]})]})]}),(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground pt-1`,children:`Run config — how the orchestrator launches + supervises it`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Launch command`}),(0,E.jsx)(y,{value:e.runCommand,onChange:e=>t({runCommand:e.target.value}),placeholder:`server-bin`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Launch args (space-separated)`}),(0,E.jsx)(y,{value:e.runArgs,onChange:e=>t({runArgs:e.target.value}),placeholder:`--stdio`,className:`mt-1 text-sm font-mono`})]})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Env (one KEY=VALUE per line; use secret:/env:/file: refs for secrets, never literal values)`}),(0,E.jsx)(b,{value:e.runEnv,onChange:e=>t({runEnv:e.target.value}),placeholder:`API_TOKEN=secret:my-server-token
|
|
3
3
|
MODE=server`,className:`mt-1 text-sm font-mono`,rows:2})]}),(0,E.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Transport`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.runTransport,onChange:e=>t({runTransport:e.target.value}),children:O.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Listener mode`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.listenerMode,onChange:e=>t({listenerMode:e.target.value}),children:k.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Health probe`}),(0,E.jsx)(`select`,{className:`mt-1 w-full rounded-md border border-input bg-background px-2 py-1.5 text-sm`,value:e.healthProbeKind,onChange:e=>t({healthProbeKind:e.target.value}),children:A.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))})]})]}),e.healthProbeKind===`http`&&(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Health probe path`}),(0,E.jsx)(y,{value:e.healthProbePath,onChange:e=>t({healthProbePath:e.target.value}),placeholder:`/health`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground pt-1`,children:`Applicability — which profiles/providers may use this server (empty = unrestricted)`}),(0,E.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Providers (comma-separated)`}),(0,E.jsx)(y,{value:e.applicabilityProviders,onChange:e=>t({applicabilityProviders:e.target.value}),placeholder:`claude, codex`,className:`mt-1 text-sm font-mono`})]}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(s,{className:`text-xs`,children:`Profiles (comma-separated)`}),(0,E.jsx)(y,{value:e.applicabilityProfiles,onChange:e=>t({applicabilityProfiles:e.target.value}),placeholder:`worker, coordinator`,className:`mt-1 text-sm font-mono`})]})]})]}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(_,{size:`sm`,onClick:n,disabled:i||!e.command.trim()&&!e.url.trim(),children:i?`Adding…`:`Add MCP Variant`}),(0,E.jsx)(_,{size:`sm`,variant:`outline`,onClick:r,children:`Cancel`})]})]})}function K(){let[e,t]=(0,T.useState)([]),[n,i]=(0,T.useState)(`all`),[a,s]=(0,T.useState)(``),[c,l]=(0,T.useState)(!0),[u,f]=(0,T.useState)(null),[p,m]=(0,T.useState)(`none`),[y,b]=(0,T.useState)(!1),[D,O]=(0,T.useState)(null),[k,A]=(0,T.useState)(null),[P,I]=(0,T.useState)(z),[L,R]=(0,T.useState)(B),[K,q]=(0,T.useState)(V);async function J(){f(null);try{let e=await o(`GET`,`/provisioning/capabilities${n===`all`?``:`?kind=${n}`}`);t(e.capabilities),!a&&e.capabilities.length>0&&s(e.capabilities[0].capability.id)}catch(e){f(r(e))}finally{l(!1)}}(0,T.useEffect)(()=>{l(!0),J()},[n]);let Y=e.find(e=>e.capability.id===a)??null;function X(e){m(e),O(null),b(!1),I(z),R(B),q(V)}async function Z(){b(!0),O(null);try{await o(`POST`,`/provisioning/capabilities`,{kind:P.kind,slug:P.slug.trim(),title:P.title.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}async function Q(){if(Y){b(!0),O(null);try{await o(`POST`,`/provisioning/capabilities/${encodeURIComponent(Y.capability.id)}/variants/import`,{githubUrl:L.githubUrl.trim(),ref:L.ref.trim(),subpath:L.subpath.trim()||void 0,provider:L.provider,versionConstraint:L.versionConstraint.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}}async function ee(){if(Y){b(!0),O(null);try{let e={};if(K.url.trim())e.type=`http`,e.url=K.url.trim();else{e.type=`stdio`;let t=K.command.trim().split(/\s+/);e.command=t[0];let n=K.args.trim()?K.args.trim().split(/\s+/):t.slice(1);n.length>0&&(e.args=n)}let t;K.setupKind===`npm-global`?t={kind:`npm-global`,pkg:K.setupPkg.trim(),version:K.setupVersion.trim()}:K.setupKind===`download`?t={kind:`download`,url:K.setupUrl.trim(),sha256:K.setupSha256.trim(),bin:K.setupBin.trim()}:K.setupKind===`bundled`&&(t={kind:`bundled`});let n;if(K.runCommand.trim()){let e=M(K.runEnv);n={command:K.runCommand.trim(),...K.runArgs.trim()?{args:K.runArgs.trim().split(/\s+/)}:{},...Object.keys(e).length?{env:e}:{},transport:K.runTransport,...K.healthProbeKind===`none`?{}:{healthProbe:{kind:K.healthProbeKind,...K.healthProbePath.trim()?{path:K.healthProbePath.trim()}:{}}},listenerMode:K.listenerMode}}let r=j(K.applicabilityProviders),i=j(K.applicabilityProfiles),a=r.length||i.length?{...r.length?{providers:r}:{},...i.length?{profiles:i}:{}}:void 0;await o(`POST`,`/provisioning/capabilities/${encodeURIComponent(Y.capability.id)}/variants/mcp`,{server:e,...t?{setup:t}:{},...n?{runConfig:n}:{},...a?{applicability:a}:{},approvalStatus:K.approvalStatus,versionConstraint:K.versionConstraint.trim()||void 0}),m(`none`),await J()}catch(e){O(r(e))}finally{b(!1)}}}async function te(e,n){A(e);try{await o(`PATCH`,`/provisioning/variants/${encodeURIComponent(e)}`,{enabled:n}),t(t=>t.map(t=>({...t,variants:t.variants.map(t=>t.id===e?{...t,enabled:n}:t)})))}catch(e){f(r(e))}finally{A(null)}}async function ne(e){let t=Y?.variants.find(t=>t.id===e);if(t?.sourceRef){A(e);try{await o(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/update`,{ref:t.sourceRef,subpath:t.sourceSubpath}),await J()}catch(e){f(r(e))}finally{A(null)}}}async function re(e){A(e);try{await o(`POST`,`/provisioning/variants/${encodeURIComponent(e)}/validate`,{}),await J()}catch(e){f(r(e))}finally{A(null)}}let $=Y?.capability;return(0,E.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(d,{className:`size-5 text-primary`}),(0,E.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Registry`}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`provisioning capability registry`}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[N.map(e=>(0,E.jsx)(`button`,{type:`button`,onClick:()=>i(e.value),className:`rounded-md border px-2.5 py-1 text-xs transition-colors ${n===e.value?`border-primary/40 bg-primary/10 text-primary`:`border-border text-muted-foreground hover:bg-accent`}`,children:e.label},e.value)),(0,E.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>void J(),children:(0,E.jsx)(g,{className:`size-4`})})]})]}),u&&(0,E.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:u}),(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 xl:grid-cols-[300px_1fr]`,children:[(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,E.jsxs)(`span`,{className:`text-xs text-muted-foreground font-medium`,children:[e.length,` capabilities`]}),(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(`new-capability`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`New`]})]}),p===`new-capability`&&(0,E.jsx)(U,{form:P,onChange:e=>I(t=>({...t,...e})),onSubmit:()=>void Z(),onCancel:()=>m(`none`),busy:y,error:D}),c&&e.length===0&&(0,E.jsx)(`div`,{className:`py-8 text-center text-sm text-muted-foreground`,children:`Loading…`}),!c&&e.length===0&&(0,E.jsx)(w,{children:(0,E.jsx)(S,{className:`py-10 text-center text-sm text-muted-foreground`,children:`No capabilities yet. Click New to create one.`})}),e.map(({capability:e,variants:t})=>(0,E.jsxs)(`button`,{type:`button`,onClick:()=>{s(e.id),m(`none`)},className:`w-full rounded-md border p-3 text-left transition-colors ${a===e.id?`border-primary/50 bg-primary/5`:`border-border bg-card/60 hover:bg-accent`}`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:`text-[10px] ${F(e.kind)}`,children:e.kind}),(0,E.jsx)(`span`,{className:`text-xs font-medium font-mono truncate flex-1`,children:e.slug}),(0,E.jsxs)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:[t.length,`v`]})]}),e.title&&(0,E.jsx)(`div`,{className:`mt-1 text-xs text-muted-foreground truncate`,children:e.title}),(0,E.jsxs)(`div`,{className:`mt-1 flex items-center gap-1.5`,children:[(0,E.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 rounded-full ${e.status===`active`?`bg-tone-success`:`bg-tone-neutral`}`}),(0,E.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.status})]})]},e.id))]}),$?(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(w,{children:[(0,E.jsx)(x,{children:(0,E.jsxs)(C,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(v,{variant:`outline`,className:F($.kind),children:$.kind}),(0,E.jsx)(`span`,{className:`font-mono text-base`,children:$.slug}),$.title&&(0,E.jsxs)(`span`,{className:`text-sm font-normal text-muted-foreground`,children:[`· `,$.title]}),(0,E.jsx)(v,{variant:$.status===`active`?`secondary`:`outline`,className:`ml-auto text-[10px]`,children:$.status})]})}),$.description&&(0,E.jsx)(S,{className:`pt-0 text-sm text-muted-foreground`,children:$.description})]}),(0,E.jsxs)(w,{children:[(0,E.jsx)(x,{children:(0,E.jsxs)(C,{className:`flex items-center gap-2 text-base`,children:[`Variants`,(0,E.jsxs)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:[`(`,Y?.variants.length??0,`)`]}),(0,E.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(p===`import-github`?`none`:`import-github`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`GitHub`]}),$.kind===`mcp`&&(0,E.jsxs)(_,{size:`sm`,variant:`outline`,className:`h-7 text-xs gap-1`,onClick:()=>X(p===`import-mcp`?`none`:`import-mcp`),children:[(0,E.jsx)(h,{className:`h-3 w-3`}),`MCP Server`]})]})]})}),(0,E.jsxs)(S,{className:`space-y-3`,children:[p===`import-github`&&(0,E.jsx)(W,{form:L,onChange:e=>R(t=>({...t,...e})),onSubmit:()=>void Q(),onCancel:()=>m(`none`),busy:y,error:D}),p===`import-mcp`&&(0,E.jsx)(G,{form:K,onChange:e=>q(t=>({...t,...e})),onSubmit:()=>void ee(),onCancel:()=>m(`none`),busy:y,error:D}),Y&&Y.variants.length===0&&p===`none`&&(0,E.jsxs)(`div`,{className:`py-6 text-center text-sm text-muted-foreground`,children:[`No variants yet. Add one via GitHub import`,$.kind===`mcp`?` or MCP Server`:``,`.`]}),Y?.variants.map(e=>(0,E.jsx)(H,{variant:e,onToggle:(e,t)=>void te(e,t),onUpdate:e=>void ne(e),onValidate:e=>void re(e),busy:k},e.id))]})]})]}):!c&&(0,E.jsx)(w,{children:(0,E.jsx)(S,{className:`py-16 text-center text-sm text-muted-foreground`,children:`Select a capability to view details and variants.`})})]})]})}export{K as RegistryView};
|
|
4
|
-
//# sourceMappingURL=registry-
|
|
4
|
+
//# sourceMappingURL=registry-D790cIhN.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-DKPDIZBe.js";import{h as a}from"./display-CDeH4I8T.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./agent-liveness-Bq-s73jW.js";import{t as c}from"./check-B3M9Ug1P.js";import{n as l,t as u}from"./octagon-x-B5lnUY-8.js";import{t as d}from"./inbox-Dfwk3Gt8.js";import{t as f}from"./pause-DttnHD4c.js";import{t as p}from"./play-BbT8m7A0.js";import{t as m}from"./rotate-ccw-CtD77qkX.js";import{n as h}from"./workflow-marker-X8wxyhzC.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./input-CsTB6jIx.js";import{t as v}from"./crate-agent-BHvI5wXC.js";var y=e(n(),1),b=r();function x({runId:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)();async function a(e,t){try{let r=new URLSearchParams({verbose:`true`,...t}),a=await o(`GET`,`/workflows/runs/${encodeURIComponent(e)}?${r}`);n(e=>t&&e&&e.runId===a.runId?{...a,activations:t.activationCursor?[...e.activations??[],...a.activations??[]]:a.activations,children:t.childCursor?[...e.children??[],...a.children??[]]:a.children,itemResults:t.resultsCursor?[...e.itemResults??[],...a.itemResults??[]]:a.itemResults}:a),i(void 0)}catch(e){i(e.message)}}async function s(e,n){try{await o(`POST`,`/workflows/runs/${encodeURIComponent(t.runId)}/${e}`,{...n?{activationId:n}:{}}),await a(t.runId)}catch(e){i(e.message)}}return(0,b.jsxs)(`details`,{className:`text-xs`,onToggle:n=>{n.currentTarget.open&&!t&&a(e)},children:[(0,b.jsx)(`summary`,{className:`cursor-pointer`,children:`Workflow inputs, children and results`}),r&&(0,b.jsx)(`p`,{role:`alert`,children:r}),t&&(0,b.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,b.jsxs)(`p`,{children:[t.runId,`: `,t.status]}),(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId),children:`Refresh run`}),[`running`,`escalated`].includes(t.status)&&(0,b.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`cancel`),children:`Cancel run`}),t.cleanup&&(0,b.jsxs)(`p`,{children:[`Cleanup: `,t.cleanup.status,t.cleanup.error?` — ${t.cleanup.error}`:``]}),t.parentRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.parentRunId),children:[`Parent `,t.parentRunId]}),t.rootRunId&&t.rootRunId!==t.runId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(t.rootRunId),children:[`Root `,t.rootRunId]}),(0,b.jsx)(`ul`,{"aria-label":`Child workflows`,children:t.children?.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(e.runId),children:[e.workflow,`: `,e.runId]}),` — `,e.status,e.reason&&(0,b.jsx)(`p`,{children:e.reason})]},e.runId))}),t.childrenCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{childCursor:t.childrenCursor}),children:`More children`}),(0,b.jsx)(`ul`,{"aria-label":`Workflow activations`,children:t.activations?.map(e=>(0,b.jsxs)(`li`,{children:[e.path,`: `,e.state,e.needs?.length?(0,b.jsxs)(`span`,{children:[` · needs `,e.needs.join(`, `),` (`,e.remaining??0,` remaining)`]}):null,e.outcome?` (${e.outcome})`:``,e.container&&(0,b.jsxs)(`p`,{children:[e.container.settled,`/`,e.container.total,` settled · `,e.container.live,` active · `,e.container.failed,` failed`,e.container.winner?` · winner ${e.container.winner}`:``,e.container.stopped?` · admissions stopped`:``,` `,(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:e.id}),children:`Item results`})]}),e.childRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(e.childRunId),children:[`Child `,e.childRunId]}),e.parentId&&e.state===`failed`&&t.status===`escalated`&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`resume`,e.id),children:[`Retry item `,e.key??e.index]}),e.error&&(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.error,null,2)})]},e.id))}),t.activationsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{activationCursor:t.activationsCursor}),children:`More activations`}),t.itemResults&&(0,b.jsx)(`ol`,{"aria-label":`Item results`,children:t.itemResults.map(e=>(0,b.jsxs)(`li`,{children:[e.key,`: `,e.status,(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.outputs??e.error??{},null,2)})]},e.key))}),t.itemResultsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:t.resultsRef,resultsCursor:t.itemResultsCursor}),children:`More item results`}),(0,b.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap`,children:JSON.stringify({inputs:t.inputs,outputs:t.outputs??t.output},null,2)})]})]})}var S=[`provider`,`model`,`effort`,`orchestratorId`,`profile`],C={provider:`Provider`,model:`Model`,effort:`Effort`,orchestratorId:`Host`,profile:`Profile`};function w({runId:e,step:t}){let n=i(e=>e.updateWorkflowPins),[r,a]=(0,y.useState)(()=>Object.fromEntries(S.map(e=>[e,t.pin?.[e]??``]))),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null);return(0,b.jsxs)(`details`,{className:`rounded border border-border p-2`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer text-xs`,children:[`Change `,t.name,` pins`]}),(0,b.jsxs)(`form`,{className:`mt-2 flex flex-wrap gap-2`,onSubmit:async i=>{i.preventDefault(),s(!0),l(null);try{await n(e,{[t.name]:Object.fromEntries(S.filter(e=>r[e]?.trim()).map(e=>[e,r[e].trim()]))})}catch(e){l(e.message)}finally{s(!1)}},children:[S.map(e=>(0,b.jsxs)(`label`,{className:`text-xs`,children:[C[e],(0,b.jsx)(_,{"aria-label":`${t.name} ${C[e]}`,value:r[e]??``,onChange:t=>a({...r,[e]:t.target.value})})]},e)),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:o,children:o?`Saving…`:`Save ${t.name} pins`}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`w-full text-xs text-destructive`,children:c})]})]})}function T({run:e}){let t=e.status===`running`?e.steps.filter(e=>e.started===!1&&e.role):[];return!t.length&&!e.pinChanges?.length?null:(0,b.jsxs)(`div`,{className:`space-y-2`,children:[t.map(t=>(0,b.jsx)(w,{runId:e.runId,step:t},t.name)),!!e.pinChanges?.length&&(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-xs`,children:`Pin history`}),(0,b.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:e.pinChanges.map((e,t)=>(0,b.jsxs)(`li`,{children:[e.by,` · `,new Date(e.at).toLocaleString(),` · `,Object.entries(e.pins).map(([e,t])=>`${e}: ${S.filter(e=>t[e]).map(e=>`${C[e]} ${t[e]}`).join(`, `)||`workflow defaults`}`).join(`; `),e.note?` · ${e.note}`:``]},t))})]})]})}var E=e=>e.kind===`agent`?`/agents/${encodeURIComponent(e.agentId)}/spawn-budget`:`/workflows/runs/${encodeURIComponent(e.runId)}/budget`;function D(e,t){return e.kind===`agent`?t.budgets.find(t=>t.subtreeAgentId===e.agentId):t}function O(e){return[e.unknownReports?`${e.unknownReports} report${e.unknownReports===1?``:`s`} without counts`:``,e.unreportedReports?`${e.unreportedReports} not yet stored`:``,e.busyAgents?`${e.busyAgents} agent${e.busyAgents===1?``:`s`} mid-turn`:``].filter(Boolean).join(`, `)}function k({target:e}){return(0,b.jsx)(A,{target:e},E(e))}function A({target:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)(),[a,s]=(0,y.useState)(``),c=E(e);if((0,y.useEffect)(()=>{let t=!0,r=()=>o(`GET`,c).then(r=>{t&&n(D(e,r))},()=>{t&&n(void 0)});r().catch(()=>{});let i=setInterval(r,3e4);return()=>{t=!1,clearInterval(i)}},[c]),!t)return null;let l=async a=>{a.preventDefault();let l=Number(r);if(!Number.isSafeInteger(l)||l<=0){s(`Enter a whole number of tokens above 0`);return}try{let r=await o(`PATCH`,c,{tokenCap:l});n(D(e,r)??t),i(void 0),s(``)}catch(e){s(e instanceof Error?e.message:`Could not save the budget`)}},u=O(t),d=Math.min(100,Math.round(t.tokens/t.tokenCap*100));return(0,b.jsxs)(`section`,{"aria-label":`Token budget`,"data-testid":`delegated-budget`,"data-exhausted":t.exhausted,className:`space-y-2 rounded-md border p-3 text-xs`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h3`,{className:`font-medium`,children:`Token budget`}),t.exhausted&&(0,b.jsx)(`span`,{"data-testid":`budget-exhausted`,className:`rounded border border-tone-danger/30 bg-tone-danger/10 px-1.5 py-0.5 font-medium text-tone-danger-fg`,children:`Exhausted: new spawns refused`}),t.partlyUnknown&&(0,b.jsx)(`span`,{"data-testid":`budget-unknown`,title:u,className:`rounded border border-tone-warning/30 bg-tone-warning/10 px-1.5 py-0.5 text-tone-warning-fg`,children:`Partly unknown`})]}),(0,b.jsxs)(`p`,{"data-testid":`budget-spend`,className:`tabular-nums`,children:[t.partlyUnknown?`At least `:``,t.tokens.toLocaleString(),` of `,t.tokenCap.toLocaleString(),` tokens observed`]}),(0,b.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t.tokenCap,"aria-valuenow":Math.min(t.tokens,t.tokenCap),className:`h-1.5 overflow-hidden rounded bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full ${t.exhausted?`bg-tone-danger`:`bg-tone-info`}`,style:{width:`${d}%`}})}),u&&(0,b.jsxs)(`p`,{className:`text-muted-foreground`,children:[`True spend is higher than shown: `,u,`.`]}),r===void 0?(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>i(String(t.tokenCap)),children:`Edit cap`}):(0,b.jsxs)(`form`,{onSubmit:l,className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`label`,{className:`sr-only`,htmlFor:`budget-cap-${c}`,children:`Token cap`}),(0,b.jsx)(_,{id:`budget-cap-${c}`,inputMode:`numeric`,className:`h-8 w-36`,value:r,onChange:e=>i(e.target.value)}),(0,b.jsx)(g,{type:`submit`,size:`sm`,children:`Save`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{i(void 0),s(``)},children:`Cancel`})]}),a&&(0,b.jsx)(`p`,{role:`alert`,className:`text-tone-danger-fg`,children:a}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:`Soft cap: running work finishes; raising it lets new spawns through.`})]})}function j({text:e,className:n}){return(0,b.jsx)(`span`,{className:t(`block min-w-0 max-w-full truncate`,n),title:e,children:e})}var M=`land`,N=`ci-main`,P={pass:`CI pass`,fail:`CI red`,none:`no CI`};function F(e){let t=e.rounds.find(t=>t.round===e.round)?.steps??[],n=new Map(t.map(e=>[e.step,e.outcome])),r=e.stations?e.stations.map(t=>e.steps.find(e=>e.name===t)??{name:t}):[...e.steps,{name:M},...e.ciMain?[{name:N}]:[]],i=!!e.landedSha||e.status===`done`||e.step===`ci-main`;return r.map(t=>{let r=t.name===`ci-main`&&e.output?.ci?P[e.output.ci.status]:void 0,a=t.name===`land`&&i?`landed`:r??n.get(t.name),o={...t,state:`waiting`,...a?{outcome:a}:{}};return e.status===`running`?o.state=t.name===e.step?`current`:a?`done`:`waiting`:e.status===`done`?o.state=`done`:o.state=t.name===e.step?`stopped`:a?`done`:`waiting`,o})}function I(e){if(e.status!==`running`||!e.awaiting)return;if(e.awaiting.slot)return`Waiting for a slot on ${e.awaiting.slot.host}`;let{kind:t,taskId:n,timedOutAt:r}=e.awaiting,i=t===`landed`?`Waiting for the land`:t===`ci`?`Waiting for CI on main${e.awaiting.sha?` at ${e.awaiting.sha.slice(0,7)}`:``}`:t===`decision`?`Waiting for the operator decision`:t===`script`?`Waiting for the script`:t===`closed`?`Closing the Task and delivering issues`:`Waiting for a delivery${n?` on T${n}`:``}`;return r?`${i}, past its time limit`:i}function L(e){return e.reapedAt?`reaped`:e.exitedAt?`exited`:e.keptAt?`kept`:e.readyAt?`ready`:`starting`}function R(e){let t=e.crossProvider?.fallback?e.crossProvider:void 0;return e.provider?t?{label:`${e.provider}, same as ${t.step}`,title:`Prefers a provider other than ${t.step}'s ${t.avoided}${t.reason?`: ${t.reason}`:``}`}:{label:e.provider}:{}}var z=[`provider`,`model`,`effort`,`orchestratorId`],B={start:`start call`,resume:`resume`,team:`team default`,global:`global default`,workflow:`workflow file`};function V(e){let t=z.filter(t=>e?.[t]);if(!(!e||!t.length))return{label:`Pinned: ${t.map(t=>t===`orchestratorId`?`on ${e[t]}`:e[t]).join(` `)}`,title:t.map(t=>`${t===`orchestratorId`?`host`:t} ${e[t]} (${B[e.from[t]??`workflow`]})`).join(`, `)}}function H(e){if(e.status===`done`){if(e.step===`close`)return`Verified and closed`;if(e.scriptRuns?.length&&!e.output?.landedSha)return`Done`;let t=e.output?.ci?`, ${P[e.output.ci.status]}`:``;return e.output?.nothingToLand&&e.output.landedSha?`Nothing to land, on main at ${e.output.landedSha.slice(0,7)}`:e.output?.landedSha?`Landed ${e.output.landedSha.slice(0,7)}${t}`:`Done`}return e.status===`escalated`?`Escalated`:e.status===`cancelled`?`Cancelled`:e.status===`failed`?`Failed`:`Running`}var U={done:`done`,current:`current step`,waiting:`not reached`,stopped:`stopped here`};function W({taskId:e,title:t}){let n=i(e=>e.openTaskDetailById);return(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex min-w-0 max-w-full items-baseline gap-1.5 rounded text-left hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[(0,b.jsxs)(`span`,{className:`shrink-0 rounded bg-muted px-1 font-mono text-[11px] tabular-nums text-muted-foreground`,children:[`T`,e]}),t&&(0,b.jsx)(j,{text:t,className:`font-medium`})]})}function G({node:e,run:t}){let n=e.state===`current`?I(t):void 0,r=V(e.pin);return(0,b.jsxs)(`li`,{"data-testid":`workflow-node-${e.name}`,"data-state":e.state,className:`wf-station flex min-w-0 items-start gap-2 sm:flex-col sm:items-center sm:text-center`,children:[(0,b.jsxs)(`span`,{className:`wf-stop grid h-8 w-8 shrink-0 place-items-center rounded-full`,"aria-label":`${e.name}: ${U[e.state]}`,role:`img`,children:[e.state===`done`&&(0,b.jsx)(c,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`stopped`&&(0,b.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`waiting`&&(0,b.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`current`&&(0,b.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-current`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(j,{text:e.name,className:`text-sm font-semibold`}),e.role&&(0,b.jsx)(j,{text:`${e.role}${e.gate?`, gate ${e.gate}`:``}`,className:`text-xs text-muted-foreground`}),r&&(0,b.jsx)(`div`,{"data-testid":`workflow-node-pin`,className:`truncate text-xs text-muted-foreground`,title:r.title,children:r.label}),e.outcome&&(0,b.jsx)(`div`,{className:`wf-outcome truncate text-xs font-medium`,"data-outcome":e.outcome,children:e.outcome}),n&&(0,b.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n})]})]})}function K({run:e}){return(0,b.jsx)(`ol`,{"aria-label":`Steps`,className:`wf-line grid gap-3 sm:auto-cols-fr sm:grid-flow-col`,children:F(e).map(t=>(0,b.jsx)(G,{node:t,run:e},t.name))})}function q({run:e,agentsById:t,now:n}){return e.agents.length?(0,b.jsx)(`ul`,{"aria-label":`Step agents`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:e.agents.map(r=>{let i=r.agentId?t[r.agentId]:void 0,a=R(r);return(0,b.jsxs)(`li`,{"data-testid":`workflow-agent`,className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,b.jsx)(h,{workflow:e.workflow,step:r.step}),r.agentId?(0,b.jsx)(v,{holder:{id:r.agentId,...i?{agent:i}:{},live:s(n,i)},workflowMarker:!1}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`spawning`}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:r.keptReason,children:[r.step,`, round `,r.round,`, `,L(r)]}),r.routingSources&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:Object.entries(r.routingSources).map(([e,t])=>`${e}: ${t}`).join(`, `),children:[`via `,r.routingSources.provider]}),a.label&&(0,b.jsx)(`span`,{"data-testid":`workflow-agent-provider`,className:`shrink-0 text-muted-foreground`,title:a.title,children:a.label})]},r.spawnRequestId)})}):(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No step agent yet.`})}function J({run:e}){let t=i(e=>e.pauseWorkflowRun),[n,r]=(0,y.useState)(null);return e.status===`running`?e.paused?(0,b.jsxs)(`div`,{"data-testid":`workflow-paused`,className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Paused by `,e.paused.by,` since `,new Date(e.paused.at).toLocaleString(),`: `,e.paused.reason]}),(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void t(e.runId,null),children:[(0,b.jsx)(p,{"aria-hidden":!0}),`Resume`]})]}):n===null?(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>r(``),children:[(0,b.jsx)(f,{"aria-hidden":!0}),`Pause`]}):(0,b.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:i=>{i.preventDefault(),n.trim()&&t(e.runId,n.trim()).then(()=>r(null))},children:[(0,b.jsx)(_,{autoFocus:!0,"aria-label":`Pause reason`,placeholder:`Why does this run wait, and for what?`,value:n,onChange:e=>r(e.target.value),className:`min-w-48 flex-1`}),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:!n.trim(),children:`Pause run`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Cancel`})]}):null}function Y({run:e,agentsById:t,now:n,project:r}){return(0,b.jsxs)(`article`,{"data-testid":`workflow-run-${e.runId}`,"aria-label":`${e.workflow} on T${e.taskId}`,className:`wf-run space-y-3 rounded-lg p-3`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,b.jsxs)(`h3`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-sm font-semibold`,children:[(0,b.jsx)(h,{workflow:e.workflow,className:`h-3.5 w-3.5 shrink-0`}),(0,b.jsx)(j,{text:e.workflow})]}),(0,b.jsx)(`div`,{className:`min-w-0 flex-1 text-sm`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-muted-foreground`,children:[(0,b.jsxs)(`span`,{"data-testid":`workflow-round`,className:`flex items-center gap-1`,title:`A loop back to an earlier step starts a new round`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Round `,e.round]}),(0,b.jsxs)(`span`,{"data-testid":`workflow-held`,className:`flex items-center gap-1`,title:`Messages the run kept instead of waking the coordinator`,children:[(0,b.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.heldCount,` held`]}),(0,b.jsxs)(`span`,{title:`Started ${new Date(e.createdAt).toLocaleString()}`,children:[`Started `,a(n,e.createdAt),` ago`]}),r&&(0,b.jsx)(j,{text:r})]})]}),e.callerAgentId&&(0,b.jsxs)(`p`,{"data-testid":`workflow-caller`,className:`text-xs text-muted-foreground`,children:[`Caller: `,e.callerAgentId,` · up to `,e.maxLiveAgents??2,` live agents`]}),e.budget&&(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}}),(0,b.jsx)(J,{run:e}),(0,b.jsx)(K,{run:e}),(0,b.jsx)(T,{run:e}),e.rootRunId&&(0,b.jsx)(x,{runId:e.runId}),e.overdueAt!==void 0&&(0,b.jsx)(`p`,{"data-testid":`workflow-backstop`,className:`text-xs text-muted-foreground`,title:`Backstop ${new Date(e.overdueAt).toLocaleString()}`,children:e.overdueNotifiedAt===void 0?`Backstop ${new Date(e.overdueAt).toLocaleString()}`:`Overdue: coordinator notified`}),(0,b.jsx)(q,{run:e,agentsById:t,now:n})]})}function X({runs:e,now:t,projectTitles:n}){return e.length?(0,b.jsx)(`ul`,{"aria-label":`Finished runs`,className:`divide-y divide-border rounded-lg border border-border bg-card`,children:e.map(e=>(0,b.jsxs)(`li`,{"data-testid":`workflow-recent-${e.runId}`,"data-status":e.status,className:`wf-ledger flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`ship-lamp h-2 w-2 shrink-0 rounded-full`,"data-status":e.status===`done`?`success`:e.status===`escalated`?`failing`:`unknown`,"aria-hidden":!0}),(0,b.jsx)(j,{text:e.workflow,className:`font-medium sm:w-28 sm:shrink-0`}),(0,b.jsx)(`div`,{className:`order-last w-full min-w-0 pl-5 sm:order-none sm:w-auto sm:flex-1 sm:pl-0`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsx)(`span`,{className:`ml-auto shrink-0 font-medium sm:ml-0`,title:e.output?.landedSha,children:H(e)}),(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.round===1?`1 round`:`${e.round} rounds`}),(0,b.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,title:new Date(e.updatedAt).toLocaleString(),children:[a(t,e.updatedAt),` ago`]}),e.projectId&&n.get(e.projectId)&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.get(e.projectId)}),e.budget&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}})}),e.rootRunId&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(x,{runId:e.runId})}),e.reason&&(0,b.jsx)(j,{text:e.reason,className:`order-last w-full pl-5 text-xs text-muted-foreground`})]},e.runId))}):(0,b.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-sm text-muted-foreground`,children:`No finished runs yet.`})}export{j as a,N as i,Y as n,W as r,X as t};
|
|
2
|
-
//# sourceMappingURL=run-card-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{o as t,p as n,u as r}from"./dist-DeW2Y1R5.js";import{t as i}from"./store-BgDALGIX.js";import{h as a}from"./display-BemJG1f_.js";import{t as o}from"./api-CIIVBtAV.js";import{t as s}from"./agent-liveness-DSQY1Aa_.js";import{t as c}from"./check-B3M9Ug1P.js";import{n as l,t as u}from"./octagon-x-B5lnUY-8.js";import{t as d}from"./inbox-Dfwk3Gt8.js";import{t as f}from"./pause-DttnHD4c.js";import{t as p}from"./play-BbT8m7A0.js";import{t as m}from"./rotate-ccw-CtD77qkX.js";import{n as h}from"./workflow-marker-CzOsB8BM.js";import{t as g}from"./button-Do6Z3vvn.js";import{t as _}from"./input-CsTB6jIx.js";import{t as v}from"./crate-agent-irqlt4NH.js";var y=e(n(),1),b=r();function x({runId:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)();async function a(e,t){try{let r=new URLSearchParams({verbose:`true`,...t}),a=await o(`GET`,`/workflows/runs/${encodeURIComponent(e)}?${r}`);n(e=>t&&e&&e.runId===a.runId?{...a,activations:t.activationCursor?[...e.activations??[],...a.activations??[]]:a.activations,children:t.childCursor?[...e.children??[],...a.children??[]]:a.children,itemResults:t.resultsCursor?[...e.itemResults??[],...a.itemResults??[]]:a.itemResults}:a),i(void 0)}catch(e){i(e.message)}}async function s(e,n){try{await o(`POST`,`/workflows/runs/${encodeURIComponent(t.runId)}/${e}`,{...n?{activationId:n}:{}}),await a(t.runId)}catch(e){i(e.message)}}return(0,b.jsxs)(`details`,{className:`text-xs`,onToggle:n=>{n.currentTarget.open&&!t&&a(e)},children:[(0,b.jsx)(`summary`,{className:`cursor-pointer`,children:`Workflow inputs, children and results`}),r&&(0,b.jsx)(`p`,{role:`alert`,children:r}),t&&(0,b.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,b.jsxs)(`p`,{children:[t.runId,`: `,t.status]}),(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId),children:`Refresh run`}),[`running`,`escalated`].includes(t.status)&&(0,b.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`cancel`),children:`Cancel run`}),t.cleanup&&(0,b.jsxs)(`p`,{children:[`Cleanup: `,t.cleanup.status,t.cleanup.error?` — ${t.cleanup.error}`:``]}),t.parentRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.parentRunId),children:[`Parent `,t.parentRunId]}),t.rootRunId&&t.rootRunId!==t.runId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(t.rootRunId),children:[`Root `,t.rootRunId]}),(0,b.jsx)(`ul`,{"aria-label":`Child workflows`,children:t.children?.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(e.runId),children:[e.workflow,`: `,e.runId]}),` — `,e.status,e.reason&&(0,b.jsx)(`p`,{children:e.reason})]},e.runId))}),t.childrenCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{childCursor:t.childrenCursor}),children:`More children`}),(0,b.jsx)(`ul`,{"aria-label":`Workflow activations`,children:t.activations?.map(e=>(0,b.jsxs)(`li`,{children:[e.path,`: `,e.state,e.needs?.length?(0,b.jsxs)(`span`,{children:[` · needs `,e.needs.join(`, `),` (`,e.remaining??0,` remaining)`]}):null,e.outcome?` (${e.outcome})`:``,e.container&&(0,b.jsxs)(`p`,{children:[e.container.settled,`/`,e.container.total,` settled · `,e.container.live,` active · `,e.container.failed,` failed`,e.container.winner?` · winner ${e.container.winner}`:``,e.container.stopped?` · admissions stopped`:``,` `,(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:e.id}),children:`Item results`})]}),e.childRunId&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void a(e.childRunId),children:[`Child `,e.childRunId]}),e.parentId&&e.state===`failed`&&t.status===`escalated`&&(0,b.jsxs)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>void s(`resume`,e.id),children:[`Retry item `,e.key??e.index]}),e.error&&(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.error,null,2)})]},e.id))}),t.activationsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{activationCursor:t.activationsCursor}),children:`More activations`}),t.itemResults&&(0,b.jsx)(`ol`,{"aria-label":`Item results`,children:t.itemResults.map(e=>(0,b.jsxs)(`li`,{children:[e.key,`: `,e.status,(0,b.jsx)(`pre`,{className:`max-h-32 overflow-auto whitespace-pre-wrap`,children:JSON.stringify(e.outputs??e.error??{},null,2)})]},e.key))}),t.itemResultsCursor&&(0,b.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>void a(t.runId,{resultsRef:t.resultsRef,resultsCursor:t.itemResultsCursor}),children:`More item results`}),(0,b.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap`,children:JSON.stringify({inputs:t.inputs,outputs:t.outputs??t.output},null,2)})]})]})}var S=[`provider`,`model`,`effort`,`orchestratorId`,`profile`],C={provider:`Provider`,model:`Model`,effort:`Effort`,orchestratorId:`Host`,profile:`Profile`};function w({runId:e,step:t}){let n=i(e=>e.updateWorkflowPins),[r,a]=(0,y.useState)(()=>Object.fromEntries(S.map(e=>[e,t.pin?.[e]??``]))),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null);return(0,b.jsxs)(`details`,{className:`rounded border border-border p-2`,children:[(0,b.jsxs)(`summary`,{className:`cursor-pointer text-xs`,children:[`Change `,t.name,` pins`]}),(0,b.jsxs)(`form`,{className:`mt-2 flex flex-wrap gap-2`,onSubmit:async i=>{i.preventDefault(),s(!0),l(null);try{await n(e,{[t.name]:Object.fromEntries(S.filter(e=>r[e]?.trim()).map(e=>[e,r[e].trim()]))})}catch(e){l(e.message)}finally{s(!1)}},children:[S.map(e=>(0,b.jsxs)(`label`,{className:`text-xs`,children:[C[e],(0,b.jsx)(_,{"aria-label":`${t.name} ${C[e]}`,value:r[e]??``,onChange:t=>a({...r,[e]:t.target.value})})]},e)),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:o,children:o?`Saving…`:`Save ${t.name} pins`}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`w-full text-xs text-destructive`,children:c})]})]})}function T({run:e}){let t=e.status===`running`?e.steps.filter(e=>e.started===!1&&e.role):[];return!t.length&&!e.pinChanges?.length?null:(0,b.jsxs)(`div`,{className:`space-y-2`,children:[t.map(t=>(0,b.jsx)(w,{runId:e.runId,step:t},t.name)),!!e.pinChanges?.length&&(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{className:`cursor-pointer text-xs`,children:`Pin history`}),(0,b.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:e.pinChanges.map((e,t)=>(0,b.jsxs)(`li`,{children:[e.by,` · `,new Date(e.at).toLocaleString(),` · `,Object.entries(e.pins).map(([e,t])=>`${e}: ${S.filter(e=>t[e]).map(e=>`${C[e]} ${t[e]}`).join(`, `)||`workflow defaults`}`).join(`; `),e.note?` · ${e.note}`:``]},t))})]})]})}var E=e=>e.kind===`agent`?`/agents/${encodeURIComponent(e.agentId)}/spawn-budget`:`/workflows/runs/${encodeURIComponent(e.runId)}/budget`;function D(e,t){return e.kind===`agent`?t.budgets.find(t=>t.subtreeAgentId===e.agentId):t}function O(e){return[e.unknownReports?`${e.unknownReports} report${e.unknownReports===1?``:`s`} without counts`:``,e.unreportedReports?`${e.unreportedReports} not yet stored`:``,e.busyAgents?`${e.busyAgents} agent${e.busyAgents===1?``:`s`} mid-turn`:``].filter(Boolean).join(`, `)}function k({target:e}){return(0,b.jsx)(A,{target:e},E(e))}function A({target:e}){let[t,n]=(0,y.useState)(),[r,i]=(0,y.useState)(),[a,s]=(0,y.useState)(``),c=E(e);if((0,y.useEffect)(()=>{let t=!0,r=()=>o(`GET`,c).then(r=>{t&&n(D(e,r))},()=>{t&&n(void 0)});r().catch(()=>{});let i=setInterval(r,3e4);return()=>{t=!1,clearInterval(i)}},[c]),!t)return null;let l=async a=>{a.preventDefault();let l=Number(r);if(!Number.isSafeInteger(l)||l<=0){s(`Enter a whole number of tokens above 0`);return}try{let r=await o(`PATCH`,c,{tokenCap:l});n(D(e,r)??t),i(void 0),s(``)}catch(e){s(e instanceof Error?e.message:`Could not save the budget`)}},u=O(t),d=Math.min(100,Math.round(t.tokens/t.tokenCap*100));return(0,b.jsxs)(`section`,{"aria-label":`Token budget`,"data-testid":`delegated-budget`,"data-exhausted":t.exhausted,className:`space-y-2 rounded-md border p-3 text-xs`,children:[(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`h3`,{className:`font-medium`,children:`Token budget`}),t.exhausted&&(0,b.jsx)(`span`,{"data-testid":`budget-exhausted`,className:`rounded border border-tone-danger/30 bg-tone-danger/10 px-1.5 py-0.5 font-medium text-tone-danger-fg`,children:`Exhausted: new spawns refused`}),t.partlyUnknown&&(0,b.jsx)(`span`,{"data-testid":`budget-unknown`,title:u,className:`rounded border border-tone-warning/30 bg-tone-warning/10 px-1.5 py-0.5 text-tone-warning-fg`,children:`Partly unknown`})]}),(0,b.jsxs)(`p`,{"data-testid":`budget-spend`,className:`tabular-nums`,children:[t.partlyUnknown?`At least `:``,t.tokens.toLocaleString(),` of `,t.tokenCap.toLocaleString(),` tokens observed`]}),(0,b.jsx)(`div`,{role:`progressbar`,"aria-valuemin":0,"aria-valuemax":t.tokenCap,"aria-valuenow":Math.min(t.tokens,t.tokenCap),className:`h-1.5 overflow-hidden rounded bg-muted`,children:(0,b.jsx)(`div`,{className:`h-full ${t.exhausted?`bg-tone-danger`:`bg-tone-info`}`,style:{width:`${d}%`}})}),u&&(0,b.jsxs)(`p`,{className:`text-muted-foreground`,children:[`True spend is higher than shown: `,u,`.`]}),r===void 0?(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>i(String(t.tokenCap)),children:`Edit cap`}):(0,b.jsxs)(`form`,{onSubmit:l,className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`label`,{className:`sr-only`,htmlFor:`budget-cap-${c}`,children:`Token cap`}),(0,b.jsx)(_,{id:`budget-cap-${c}`,inputMode:`numeric`,className:`h-8 w-36`,value:r,onChange:e=>i(e.target.value)}),(0,b.jsx)(g,{type:`submit`,size:`sm`,children:`Save`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>{i(void 0),s(``)},children:`Cancel`})]}),a&&(0,b.jsx)(`p`,{role:`alert`,className:`text-tone-danger-fg`,children:a}),(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:`Soft cap: running work finishes; raising it lets new spawns through.`})]})}function j({text:e,className:n}){return(0,b.jsx)(`span`,{className:t(`block min-w-0 max-w-full truncate`,n),title:e,children:e})}var M=`land`,N=`ci-main`,P={pass:`CI pass`,fail:`CI red`,none:`no CI`};function F(e){let t=e.rounds.find(t=>t.round===e.round)?.steps??[],n=new Map(t.map(e=>[e.step,e.outcome])),r=e.stations?e.stations.map(t=>e.steps.find(e=>e.name===t)??{name:t}):[...e.steps,{name:M},...e.ciMain?[{name:N}]:[]],i=!!e.landedSha||e.status===`done`||e.step===`ci-main`;return r.map(t=>{let r=t.name===`ci-main`&&e.output?.ci?P[e.output.ci.status]:void 0,a=t.name===`land`&&i?`landed`:r??n.get(t.name),o={...t,state:`waiting`,...a?{outcome:a}:{}};return e.status===`running`?o.state=t.name===e.step?`current`:a?`done`:`waiting`:e.status===`done`?o.state=`done`:o.state=t.name===e.step?`stopped`:a?`done`:`waiting`,o})}function I(e){if(e.status!==`running`||!e.awaiting)return;if(e.awaiting.slot)return`Waiting for a slot on ${e.awaiting.slot.host}`;let{kind:t,taskId:n,timedOutAt:r}=e.awaiting,i=t===`landed`?`Waiting for the land`:t===`ci`?`Waiting for CI on main${e.awaiting.sha?` at ${e.awaiting.sha.slice(0,7)}`:``}`:t===`decision`?`Waiting for the operator decision`:t===`script`?`Waiting for the script`:t===`closed`?`Closing the Task and delivering issues`:`Waiting for a delivery${n?` on T${n}`:``}`;return r?`${i}, past its time limit`:i}function L(e){return e.reapedAt?`reaped`:e.exitedAt?`exited`:e.keptAt?`kept`:e.readyAt?`ready`:`starting`}function R(e){let t=e.crossProvider?.fallback?e.crossProvider:void 0;return e.provider?t?{label:`${e.provider}, same as ${t.step}`,title:`Prefers a provider other than ${t.step}'s ${t.avoided}${t.reason?`: ${t.reason}`:``}`}:{label:e.provider}:{}}var z=[`provider`,`model`,`effort`,`orchestratorId`],B={start:`start call`,resume:`resume`,team:`team default`,global:`global default`,workflow:`workflow file`};function V(e){let t=z.filter(t=>e?.[t]);if(!(!e||!t.length))return{label:`Pinned: ${t.map(t=>t===`orchestratorId`?`on ${e[t]}`:e[t]).join(` `)}`,title:t.map(t=>`${t===`orchestratorId`?`host`:t} ${e[t]} (${B[e.from[t]??`workflow`]})`).join(`, `)}}function H(e){if(e.status===`done`){if(e.step===`close`)return`Verified and closed`;if(e.scriptRuns?.length&&!e.output?.landedSha)return`Done`;let t=e.output?.ci?`, ${P[e.output.ci.status]}`:``;return e.output?.nothingToLand&&e.output.landedSha?`Nothing to land, on main at ${e.output.landedSha.slice(0,7)}`:e.output?.landedSha?`Landed ${e.output.landedSha.slice(0,7)}${t}`:`Done`}return e.status===`escalated`?`Escalated`:e.status===`cancelled`?`Cancelled`:e.status===`failed`?`Failed`:`Running`}var U={done:`done`,current:`current step`,waiting:`not reached`,stopped:`stopped here`};function W({taskId:e,title:t}){let n=i(e=>e.openTaskDetailById);return(0,b.jsxs)(`button`,{type:`button`,onClick:()=>n(e),className:`flex min-w-0 max-w-full items-baseline gap-1.5 rounded text-left hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[(0,b.jsxs)(`span`,{className:`shrink-0 rounded bg-muted px-1 font-mono text-[11px] tabular-nums text-muted-foreground`,children:[`T`,e]}),t&&(0,b.jsx)(j,{text:t,className:`font-medium`})]})}function G({node:e,run:t}){let n=e.state===`current`?I(t):void 0,r=V(e.pin);return(0,b.jsxs)(`li`,{"data-testid":`workflow-node-${e.name}`,"data-state":e.state,className:`wf-station flex min-w-0 items-start gap-2 sm:flex-col sm:items-center sm:text-center`,children:[(0,b.jsxs)(`span`,{className:`wf-stop grid h-8 w-8 shrink-0 place-items-center rounded-full`,"aria-label":`${e.name}: ${U[e.state]}`,role:`img`,children:[e.state===`done`&&(0,b.jsx)(c,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`stopped`&&(0,b.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`waiting`&&(0,b.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}),e.state===`current`&&(0,b.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-current`,"aria-hidden":!0})]}),(0,b.jsxs)(`div`,{className:`min-w-0`,children:[(0,b.jsx)(j,{text:e.name,className:`text-sm font-semibold`}),e.role&&(0,b.jsx)(j,{text:`${e.role}${e.gate?`, gate ${e.gate}`:``}`,className:`text-xs text-muted-foreground`}),r&&(0,b.jsx)(`div`,{"data-testid":`workflow-node-pin`,className:`truncate text-xs text-muted-foreground`,title:r.title,children:r.label}),e.outcome&&(0,b.jsx)(`div`,{className:`wf-outcome truncate text-xs font-medium`,"data-outcome":e.outcome,children:e.outcome}),n&&(0,b.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground`,children:n})]})]})}function K({run:e}){return(0,b.jsx)(`ol`,{"aria-label":`Steps`,className:`wf-line grid gap-3 sm:auto-cols-fr sm:grid-flow-col`,children:F(e).map(t=>(0,b.jsx)(G,{node:t,run:e},t.name))})}function q({run:e,agentsById:t,now:n}){return e.agents.length?(0,b.jsx)(`ul`,{"aria-label":`Step agents`,className:`flex flex-wrap gap-x-4 gap-y-1.5`,children:e.agents.map(r=>{let i=r.agentId?t[r.agentId]:void 0,a=R(r);return(0,b.jsxs)(`li`,{"data-testid":`workflow-agent`,className:`flex min-w-0 items-center gap-1.5 text-xs`,children:[(0,b.jsx)(h,{workflow:e.workflow,step:r.step}),r.agentId?(0,b.jsx)(v,{holder:{id:r.agentId,...i?{agent:i}:{},live:s(n,i)},workflowMarker:!1}):(0,b.jsx)(`span`,{className:`text-muted-foreground`,children:`spawning`}),(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:r.keptReason,children:[r.step,`, round `,r.round,`, `,L(r)]}),r.routingSources&&(0,b.jsxs)(`span`,{className:`text-muted-foreground`,title:Object.entries(r.routingSources).map(([e,t])=>`${e}: ${t}`).join(`, `),children:[`via `,r.routingSources.provider]}),a.label&&(0,b.jsx)(`span`,{"data-testid":`workflow-agent-provider`,className:`shrink-0 text-muted-foreground`,title:a.title,children:a.label})]},r.spawnRequestId)})}):(0,b.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No step agent yet.`})}function J({run:e}){let t=i(e=>e.pauseWorkflowRun),[n,r]=(0,y.useState)(null);return e.status===`running`?e.paused?(0,b.jsxs)(`div`,{"data-testid":`workflow-paused`,className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,b.jsx)(f,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Paused by `,e.paused.by,` since `,new Date(e.paused.at).toLocaleString(),`: `,e.paused.reason]}),(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>void t(e.runId,null),children:[(0,b.jsx)(p,{"aria-hidden":!0}),`Resume`]})]}):n===null?(0,b.jsxs)(g,{type:`button`,size:`sm`,variant:`outline`,className:`self-start`,onClick:()=>r(``),children:[(0,b.jsx)(f,{"aria-hidden":!0}),`Pause`]}):(0,b.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:i=>{i.preventDefault(),n.trim()&&t(e.runId,n.trim()).then(()=>r(null))},children:[(0,b.jsx)(_,{autoFocus:!0,"aria-label":`Pause reason`,placeholder:`Why does this run wait, and for what?`,value:n,onChange:e=>r(e.target.value),className:`min-w-48 flex-1`}),(0,b.jsx)(g,{type:`submit`,size:`sm`,disabled:!n.trim(),children:`Pause run`}),(0,b.jsx)(g,{type:`button`,size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Cancel`})]}):null}function Y({run:e,agentsById:t,now:n,project:r}){return(0,b.jsxs)(`article`,{"data-testid":`workflow-run-${e.runId}`,"aria-label":`${e.workflow} on T${e.taskId}`,className:`wf-run space-y-3 rounded-lg p-3`,children:[(0,b.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,b.jsxs)(`h3`,{className:`flex min-w-0 max-w-full items-center gap-1.5 text-sm font-semibold`,children:[(0,b.jsx)(h,{workflow:e.workflow,className:`h-3.5 w-3.5 shrink-0`}),(0,b.jsx)(j,{text:e.workflow})]}),(0,b.jsx)(`div`,{className:`min-w-0 flex-1 text-sm`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 text-xs text-muted-foreground`,children:[(0,b.jsxs)(`span`,{"data-testid":`workflow-round`,className:`flex items-center gap-1`,title:`A loop back to an earlier step starts a new round`,children:[(0,b.jsx)(m,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Round `,e.round]}),(0,b.jsxs)(`span`,{"data-testid":`workflow-held`,className:`flex items-center gap-1`,title:`Messages the run kept instead of waking the coordinator`,children:[(0,b.jsx)(d,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),e.heldCount,` held`]}),(0,b.jsxs)(`span`,{title:`Started ${new Date(e.createdAt).toLocaleString()}`,children:[`Started `,a(n,e.createdAt),` ago`]}),r&&(0,b.jsx)(j,{text:r})]})]}),e.callerAgentId&&(0,b.jsxs)(`p`,{"data-testid":`workflow-caller`,className:`text-xs text-muted-foreground`,children:[`Caller: `,e.callerAgentId,` · up to `,e.maxLiveAgents??2,` live agents`]}),e.budget&&(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}}),(0,b.jsx)(J,{run:e}),(0,b.jsx)(K,{run:e}),(0,b.jsx)(T,{run:e}),e.rootRunId&&(0,b.jsx)(x,{runId:e.runId}),e.overdueAt!==void 0&&(0,b.jsx)(`p`,{"data-testid":`workflow-backstop`,className:`text-xs text-muted-foreground`,title:`Backstop ${new Date(e.overdueAt).toLocaleString()}`,children:e.overdueNotifiedAt===void 0?`Backstop ${new Date(e.overdueAt).toLocaleString()}`:`Overdue: coordinator notified`}),(0,b.jsx)(q,{run:e,agentsById:t,now:n})]})}function X({runs:e,now:t,projectTitles:n}){return e.length?(0,b.jsx)(`ul`,{"aria-label":`Finished runs`,className:`divide-y divide-border rounded-lg border border-border bg-card`,children:e.map(e=>(0,b.jsxs)(`li`,{"data-testid":`workflow-recent-${e.runId}`,"data-status":e.status,className:`wf-ledger flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`ship-lamp h-2 w-2 shrink-0 rounded-full`,"data-status":e.status===`done`?`success`:e.status===`escalated`?`failing`:`unknown`,"aria-hidden":!0}),(0,b.jsx)(j,{text:e.workflow,className:`font-medium sm:w-28 sm:shrink-0`}),(0,b.jsx)(`div`,{className:`order-last w-full min-w-0 pl-5 sm:order-none sm:w-auto sm:flex-1 sm:pl-0`,children:(0,b.jsx)(W,{taskId:e.taskId,title:e.taskTitle})}),(0,b.jsx)(`span`,{className:`ml-auto shrink-0 font-medium sm:ml-0`,title:e.output?.landedSha,children:H(e)}),(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:e.round===1?`1 round`:`${e.round} rounds`}),(0,b.jsxs)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,title:new Date(e.updatedAt).toLocaleString(),children:[a(t,e.updatedAt),` ago`]}),e.projectId&&n.get(e.projectId)&&(0,b.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.get(e.projectId)}),e.budget&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(k,{target:{kind:`run`,runId:e.runId}})}),e.rootRunId&&(0,b.jsx)(`div`,{className:`w-full`,children:(0,b.jsx)(x,{runId:e.runId})}),e.reason&&(0,b.jsx)(j,{text:e.reason,className:`order-last w-full pl-5 text-xs text-muted-foreground`})]},e.runId))}):(0,b.jsx)(`p`,{className:`rounded-md border border-dashed border-border px-3 py-4 text-center text-sm text-muted-foreground`,children:`No finished runs yet.`})}export{j as a,N as i,Y as n,W as r,X as t};
|
|
2
|
+
//# sourceMappingURL=run-card-BCro-Odj.js.map
|