spexcode 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -2
- package/spec-cli/src/claude-headless.ts +105 -16
- package/spec-cli/src/cli.ts +13 -2
- package/spec-cli/src/codex-headless.ts +13 -0
- package/spec-cli/src/guide.ts +8 -7
- package/spec-cli/src/harness.ts +53 -5
- package/spec-cli/src/host.ts +1 -0
- package/spec-cli/src/opencode-headless.ts +119 -5
- package/spec-cli/src/opencode.ts +8 -4
- package/spec-cli/src/pi-headless.ts +1 -0
- package/spec-cli/src/pty-bridge.ts +31 -4
- package/spec-cli/src/pty-helper.mjs +16 -6
- package/spec-cli/src/pty-native-helper.mjs +22 -0
- package/spec-cli/src/session-timeline.ts +29 -21
- package/spec-cli/src/sessions.ts +72 -32
- package/spec-cli/templates/spexcode.json +1 -0
- package/spec-dashboard/dist/assets/{Dashboard-C_w_wdk5.js → Dashboard-CTAuTyZ3.js} +3 -3
- package/spec-dashboard/dist/assets/{EvalsPage-5_nfIYll.js → EvalsPage-KbMMownG.js} +2 -2
- package/spec-dashboard/dist/assets/{IssuesPage-By-u--95.js → IssuesPage-DmyLb9Rj.js} +1 -1
- package/spec-dashboard/dist/assets/{MobileApp-CVEwjHr9.js → MobileApp-D2RZGt4Z.js} +2 -2
- package/spec-dashboard/dist/assets/{Modal-BqgvzMJD.js → Modal-3brXUhM0.js} +1 -1
- package/spec-dashboard/dist/assets/{PageScroll-B_dKCuXx.js → PageScroll-CadAKuSy.js} +1 -1
- package/spec-dashboard/dist/assets/ProjectsPage-DU3x4Y8l.js +1 -0
- package/spec-dashboard/dist/assets/{SessionInterface-Bh3vq8SU.js → SessionInterface-BtrzlOPs.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionWindow-BuJ5mzjC.js → SessionWindow-BWH5O0jh.js} +1 -1
- package/spec-dashboard/dist/assets/{Settings-B8KFocsz.js → Settings-COgdKTJB.js} +1 -1
- package/spec-dashboard/dist/assets/{TimelineChat-K0wdlweB.js → TimelineChat-DQ21GSJK.js} +1 -1
- package/spec-dashboard/dist/assets/{index-BKaTHjmU.js → index-D6HBvKkJ.js} +2 -2
- package/spec-dashboard/dist/assets/{index-DcnCaBAC.css → index-DFdlYy4H.css} +1 -1
- package/spec-dashboard/dist/index.html +2 -2
- package/spec-dashboard/dist/assets/ProjectsPage-RVP8AqK4.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as T,r,m as O,n as $,C as M,j as e,o as _,I as L,b as A,q,t as J,P as K,e as F,p as U,v as B,w as V,x as Q,y as W,z as X,A as Y,B as Z,D as ee,E as se,F as te,G as ae,H as oe}from"./index-BKaTHjmU.js";import{M as re}from"./Modal-BqgvzMJD.js";import{P as ne}from"./PageScroll-B_dKCuXx.js";const R=["claude","codex","opencode","pi"];function D({onSet:t,onClear:l,placeholder:s,busy:o,t:n}){const[a,b]=r.useState("");return e.jsxs("form",{className:"proj-drawer proj-pw",onSubmit:d=>{d.preventDefault(),a&&(t(a),b(""))},children:[e.jsx("input",{className:"proj-add-path",type:"password",value:a,onChange:d=>b(d.target.value),placeholder:s,"aria-label":s}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!a||o,children:n("projects.passwordSet")}),e.jsx("button",{className:"proj-act",type:"button",disabled:o,onClick:l,children:n("projects.passwordClear")})]})}function ce({onAdded:t,onClose:l,t:s}){const[o,n]=r.useState(""),[a,b]=r.useState(null),[d,p]=r.useState(!0),[i,y]=r.useState(!1),[g,m]=r.useState(null),[S,f]=r.useState(""),[C,v]=r.useState(!1),[P,h]=r.useState(!1),[c,N]=r.useState([]),x=r.useCallback(async j=>{if(i)return;p(!0),m(null),f("");const k=await V(j);if(p(!1),!k.ok){m(k.error==="network"?s("projects.actionFailed"):k.error);return}b(k),n(k.path),v(!1),h(!1),N([])},[i,s]);r.useEffect(()=>{x("")},[]),r.useEffect(()=>{const j=k=>{k.key==="Escape"&&!i&&l()};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[i,l]);const I=!!a&&o===a.path,z=I&&!a.gitRoot,G=I&&!a.initialized,u=I&&!d&&!i&&!a.cataloged&&(!z||C)&&(!P||!!c.length),w=j=>N(k=>k.includes(j)?k.filter(H=>H!==j):[...k,j]),E=async j=>{if(j.preventDefault(),!u)return;y(!0),m(null),f("");const k=await Z(a.path,{...z?{initGit:C}:{},...G&&P?{init:{harness:c.join(",")}}:{}});if(y(!1),k.ok){t(k.project);return}m(k.error==="network"?s("projects.actionFailed"):k.error),f(k.output||"")};return e.jsx(re,{title:s("projects.addTitle"),closeLabel:s("common.close"),onClose:()=>{i||l()},className:"proj-add-modal",children:e.jsxs("form",{className:"proj-add-flow",onSubmit:E,children:[e.jsxs("div",{className:"proj-add-pathbar",children:[e.jsx(F,{icon:"arrow-left",size:14,className:"proj-act icon",label:s("projects.browseParent"),disabled:!(a!=null&&a.parent)||d||i,onClick:()=>x(a.parent)}),e.jsx("button",{type:"button",className:"proj-act icon proj-home-btn","data-tip":s("projects.browseHome"),"aria-label":s("projects.browseHome"),disabled:!(a!=null&&a.home)||d||i,onClick:()=>x(a.home),children:"~"}),e.jsx("input",{className:"proj-add-path",value:o,autoFocus:!0,spellCheck:!1,onChange:j=>{n(j.target.value),m(null)},onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),o.trim()&&x(o.trim()))},placeholder:s("projects.addPlaceholder"),"aria-label":s("projects.addPlaceholder"),disabled:i}),e.jsx("button",{className:"proj-act",type:"button",disabled:!o.trim()||d||i,onClick:()=>x(o.trim()),children:s(d?"projects.browseLoading":"projects.browseGo")})]}),e.jsxs("div",{className:"proj-folder-list","aria-label":s("projects.folderList"),"aria-busy":d,children:[!d&&(a==null?void 0:a.entries.map(j=>e.jsxs("button",{type:"button",className:"proj-folder-row",onClick:()=>x(j.path),disabled:i,children:[e.jsx(L,{name:"chevron-right",size:13}),e.jsx("span",{className:"proj-folder-name",children:j.name}),j.git&&e.jsx("span",{className:"proj-folder-tag",children:"Git"}),j.initialized&&e.jsx("span",{className:"proj-folder-tag spex",children:"SpexCode"})]},j.path))),!d&&a&&!a.entries.length&&e.jsx("div",{className:"proj-folder-empty",children:s("projects.folderEmpty")}),d&&e.jsx("div",{className:"proj-folder-empty",children:s("projects.browseLoading")})]}),I&&e.jsxs("div",{className:"proj-add-options",children:[e.jsx("div",{className:"proj-add-selected",title:a.path,children:a.path}),a.gitRoot?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(L,{name:"check",size:13})," Git ",e.jsx("code",{children:a.gitRoot})]}):e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:C,onChange:j=>v(j.target.checked),disabled:i}),e.jsx("span",{children:s("projects.initGit")})]}),a.initialized?e.jsxs("div",{className:"proj-add-state",children:[e.jsx(L,{name:"check",size:13})," ",s("projects.spexInitialized")]}):e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"proj-add-check",children:[e.jsx("input",{type:"checkbox",checked:P,onChange:j=>{h(j.target.checked),f(""),m(null)},disabled:i}),e.jsx("span",{children:s("projects.initSpex")})]}),P&&e.jsxs("fieldset",{className:"proj-add-harnesses",disabled:i,children:[e.jsx("legend",{children:s("projects.harnessTargets")}),R.map(j=>e.jsxs("label",{className:"proj-add-harness",children:[e.jsx("input",{type:"checkbox",checked:c.includes(j),onChange:()=>w(j)}),e.jsx("span",{children:j})]},j))]})]}),a.cataloged&&e.jsx("div",{className:"proj-op-status ok",children:s("projects.alreadyAdded")})]}),(g||S)&&e.jsxs("div",{className:"proj-add-result",children:[g&&e.jsx("div",{className:"proj-err",children:g}),S&&e.jsx("pre",{className:"proj-log",children:S})]}),e.jsxs("div",{className:"proj-add-actions",children:[e.jsx("button",{className:"proj-act",type:"button",disabled:i,onClick:l,children:s("common.cancel")}),e.jsx("button",{className:"proj-act primary",type:"submit",disabled:!u,children:s(i?"projects.addBusy":"projects.addSubmit")})]})]})})}function ie({p:t,onRefresh:l,t:s}){const[o,n]=r.useState(null),[a,b]=r.useState(""),[d,p]=r.useState(!1),[i,y]=r.useState(null),[g,m]=r.useState(!1),[S,f]=r.useState(0),[C,v]=r.useState(t.identity.icon),[P,h]=r.useState(!1),[c,N]=r.useState(null);r.useEffect(()=>{let u=!0;return n(null),y(null),m(!1),Q(t.id).then(w=>{if(u){if(!w.ok){y(w.error==="network"?s("projects.actionFailed"):w.error);return}n({content:w.content,revision:w.revision}),b(w.content),v(t.identity.icon)}}),()=>{u=!1}},[t.id,t.identity.icon,S,s]);let x=!1;try{const u=JSON.parse(a);x=!u||typeof u!="object"||Array.isArray(u)}catch{x=!0}const I=!!o&&a!==o.content,z=async()=>{var w,E;if(!o||x||!I||d)return;p(!0),y(null),m(!1);const u=await ee(t.id,a,o.revision);if(p(!1),!u.ok){y(u.error==="network"?s("projects.actionFailed"):u.error);return}n({content:u.content,revision:u.revision}),b(u.content),m(!0);try{v(((E=(w=JSON.parse(u.content))==null?void 0:w.dashboard)==null?void 0:E.icon)||t.identity.icon)}catch{}l()},G=async u=>{if(!o||P)return!1;const w=C;v(u),h(!0),N(null),m(!1);const E=await se(t.id,u,o.revision);return h(!1),E.ok?(n({content:E.content,revision:E.revision}),b(E.content),v(E.identity.icon),m(!0),l(),!0):(v(w),N(E.error==="network"?s("projects.actionFailed"):E.error),!1)};return e.jsxs("div",{className:"proj-drawer proj-config",children:[e.jsxs("div",{className:"proj-config-head",children:[e.jsx("code",{children:"spexcode.json"}),g&&e.jsx("span",{className:"proj-op-status ok",children:s("projects.configSaved")})]}),o?e.jsxs(e.Fragment,{children:[e.jsx("textarea",{className:x?"proj-config-editor invalid":"proj-config-editor",value:a,onChange:u=>{b(u.target.value),m(!1),y(null)},"aria-label":s("projects.configEditor"),spellCheck:!1,disabled:d}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!I||x||d,onClick:z,children:s(d?"projects.configSaving":"projects.configSave")}),e.jsx("button",{className:"proj-act",type:"button",disabled:d,onClick:()=>f(u=>u+1),children:s("projects.configReload")}),x&&e.jsx("span",{className:"proj-err",children:s("projects.configInvalid")}),i&&e.jsx("span",{className:"proj-err",children:i})]}),e.jsx(B,{value:C,onChange:G,label:s("projects.projectIcon"),editLabel:s("projects.editProjectIcon"),name:`project-icon-${t.id}`,disabled:d||P}),c&&e.jsx("span",{className:"proj-err",children:c})]}):e.jsxs("div",{className:"proj-setup-row",children:[!i&&e.jsx("span",{className:"proj-dim",children:s("projects.configLoading")}),i&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"proj-err",children:i}),e.jsx("button",{className:"proj-act",type:"button",onClick:()=>f(u=>u+1),children:s("projects.configReload")})]})]})]})}function le({p:t,busyOp:l,run:s,result:o,t:n}){const[a,b]=r.useState([]),d=p=>b(i=>i.includes(p)?i.filter(y=>y!==p):[...i,p]);return e.jsxs("div",{className:"proj-drawer proj-setup",children:[e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("span",{className:"proj-dim",children:n("projects.harnessLabel")}),R.map(p=>e.jsx("button",{type:"button",className:a.includes(p)?"proj-act on":"proj-act","aria-pressed":a.includes(p),disabled:!!l,onClick:()=>d(p),children:p},p))]}),e.jsxs("div",{className:"proj-setup-row",children:[e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!l||!a.length,title:a.length?void 0:n("projects.harnessRequired"),onClick:()=>s("init",()=>W(t.id,a.join(","))),children:n(l==="init"?"projects.running":"projects.init")}),e.jsx("button",{className:"proj-act",type:"button",disabled:!!l,onClick:()=>s("doctor",()=>X(t.id)),children:n(l==="doctor"?"projects.running":"projects.doctor")})]}),o&&e.jsxs("div",{className:"proj-op-result proj-full",children:[e.jsx("div",{className:o.ok?"proj-op-status ok":"proj-op-status fail",children:o.ok?n("projects.opOk",{op:n(`projects.${o.op}`)}):n("projects.opFail",{op:n(`projects.${o.op}`),code:o.code??"?"})}),o.output?e.jsx("pre",{className:"proj-log",children:o.output}):null]})]})}function de({p:t,health:l,onRefresh:s,t:o}){const[n,a]=r.useState(null),[b,d]=r.useState(!1),[p,i]=r.useState(null),[y,g]=r.useState(null),[m,S]=r.useState(null),f=t.id===K,C=t.online===!1,v=C?"stopped":l||"probing",P=async c=>{d(!0),g(null);const N=await c();d(!1),N.ok?a(null):g(N.error||o("projects.actionFailed")),s()},h=async(c,N)=>{i(c),g(null),S(null);const x=await N();i(null),c!=="serve"?S({op:c,ok:x.ok,code:x.code,output:x.output||(x.ok?"":x.error||"")}):x.ok||g(x.error||o("projects.actionFailed")),s()};return e.jsxs("li",{className:f?"proj-row current":"proj-row",children:[e.jsxs("div",{className:"proj-row-main",children:[e.jsx("span",{className:`proj-health h-${v}`,"data-tip":o(`projects.health.${v}`)}),e.jsx(A,{icon:t.identity.icon,size:26}),e.jsx("span",{className:"proj-name",children:t.identity.title}),t.gated&&e.jsx(L,{name:"lock",size:12,className:"proj-locked"}),f&&e.jsx("span",{className:"proj-tag",children:o("projects.current")}),e.jsx("span",{className:"proj-path",title:t.id,children:t.root||t.id}),e.jsxs("span",{className:"proj-actions",children:[e.jsx(F,{icon:"settings",label:o("projects.configTitle"),className:n==="config"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{a(c=>c==="config"?null:"config"),g(null)}}),e.jsx(F,{icon:"terminal",label:o("projects.setupTitle"),className:n==="setup"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{a(c=>c==="setup"?null:"setup"),g(null)}}),e.jsx(F,{icon:"lock",label:o("projects.passwordTitle"),className:n==="pw"?"proj-act icon on":"proj-act icon",size:13,onClick:()=>{a(c=>c==="pw"?null:"pw"),g(null)}}),C?e.jsx("button",{className:"proj-act primary",type:"button",disabled:!!p,onClick:()=>h("serve",()=>te(t.id)),children:o(p==="serve"?"projects.startBusy":"projects.start")}):e.jsx("a",{className:"proj-act primary",href:U(t.id),children:o("projects.open")})]})]}),y&&e.jsx("div",{className:"proj-err",children:y}),n==="pw"&&e.jsx(D,{t:o,busy:b,placeholder:o("projects.passwordPlaceholder"),onSet:c=>P(()=>oe(t.id,c)),onClear:()=>P(()=>ae(t.id))}),n==="config"&&e.jsx(ie,{p:t,onRefresh:s,t:o}),n==="setup"&&e.jsx(le,{p:t,busyOp:p,run:h,result:m,t:o})]})}function je({gateway:t,onRefresh:l,t:s}){const[o,n]=r.useState(t.identity.icon),[a,b]=r.useState(!1),[d,p]=r.useState(null);r.useEffect(()=>{n(t.identity.icon)},[t.identity.icon]);const i=async y=>{if(a||!t.revision)return!1;const g=o;n(y),b(!0),p(null);const m=await Y(y,t.revision);return b(!1),m.ok?(n(m.gateway.identity.icon),l(),!0):(n(g),p(m.error==="network"?s("projects.actionFailed"):m.error),!1)};return e.jsxs("div",{className:"proj-gateway-identity",children:[e.jsx(B,{value:o,onChange:i,label:s("projects.gatewayIcon"),editLabel:s("projects.editGatewayIcon"),name:"gateway-icon",fallback:"gateway",disabled:a||!t.revision}),d&&e.jsx("span",{className:"proj-err",children:d})]})}function he(){const t=T(),[l,s]=r.useState({kind:"loading"}),[o,n]=r.useState({}),[a,b]=r.useState(null),[d,p]=r.useState(!1),[i,y]=r.useState(!1),[g,m]=r.useState(null),S=r.useRef(0),f=r.useCallback(async()=>{const h=++S.current,c=await O();h===S.current&&(c.state==="ok"?(s({kind:"ok",adminGated:c.adminGated,gateway:c.gateway,projects:c.projects}),c.projects.filter(N=>N.online!==!1).forEach(N=>{$(N.id).then(x=>{h===S.current&&n(I=>({...I,[N.id]:x}))})})):c.state==="denied"?s({kind:"denied",reason:c.reason}):s(N=>N.kind==="ok"?N:{kind:"absent"}))},[]);r.useEffect(()=>{f();const h=setInterval(f,M),c=()=>{document.hidden||f()};return document.addEventListener("visibilitychange",c),()=>{clearInterval(h),document.removeEventListener("visibilitychange",c)}},[f]);const C=async h=>{y(!0),m(null);const c=await h();y(!1),c.ok?b(null):m(c.error||t("projects.actionFailed")),f()},v=l.kind==="loading"?e.jsx("div",{className:"loading",children:t("hud.loading")}):l.kind==="denied"?e.jsx(_,{scope:"admin",locked:l.reason==="locked",onUnlocked:f}):l.kind==="absent"?e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:t("projects.absent")})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"proj-head",children:[e.jsx("span",{className:"proj-count",children:t("projects.count",{n:l.projects.length})}),e.jsxs("button",{className:d?"proj-act on":"proj-act",onClick:()=>p(!0),children:[e.jsx(L,{name:"plus",size:12})," ",t("projects.add")]}),e.jsxs("button",{className:a==="admin"?"proj-act on":"proj-act",onClick:()=>{b(h=>h==="admin"?null:"admin"),m(null)},children:[e.jsx(L,{name:"lock",size:12})," ",t("projects.adminPassword")]})]}),!l.adminGated&&e.jsx("div",{className:"proj-hint",children:t("projects.adminUngated")}),a==="admin"&&e.jsxs("div",{className:"proj-admin-pw",children:[e.jsx(D,{t,busy:i,placeholder:t("projects.adminPasswordPlaceholder"),onSet:h=>C(()=>J(h)),onClear:()=>C(()=>q())}),g&&e.jsx("div",{className:"proj-err",children:g})]}),l.projects.length?e.jsx("ul",{className:"proj-list",children:l.projects.map(h=>e.jsx(de,{p:h,health:o[h.id],onRefresh:f,t},h.id))}):e.jsx("div",{className:"proj-empty",children:e.jsx("p",{children:t("projects.empty")})}),e.jsx("div",{className:"proj-page-details","aria-label":t("projects.gatewaySettings"),children:e.jsx(je,{gateway:l.gateway,onRefresh:f,t})})]}),P=l.kind==="ok"?l.gateway.identity:{icon:"gateway"};return e.jsxs("div",{className:"page-pane page-projects",children:[e.jsx(ne,{className:"page-projects-scroll",children:e.jsxs("div",{className:"proj-body",children:[e.jsxs("div",{className:"cred-brand proj-brand",children:[e.jsx(A,{icon:P.icon,fallback:"gateway",size:30}),e.jsx("span",{children:"$ spexcode"})]}),e.jsx("h1",{className:"page-title",children:t("projects.title")}),v]})}),d&&e.jsx(ce,{t,onClose:()=>p(!1),onAdded:()=>{p(!1),f()}})]})}export{he as default};
|