chamba 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +7 -2
  2. package/dist/commands/dev.js +11 -11
  3. package/dist/commands/menu.js +1 -1
  4. package/dist/commands/settings.js +9 -6
  5. package/dist/lib/awake-holder.js +3 -0
  6. package/dist/lib/awake-marker.js +4 -0
  7. package/dist/lib/awake.js +1 -0
  8. package/dist/lib/constants.js +1 -1
  9. package/dist/lib/global-config.js +3 -3
  10. package/dist/lib/skills.js +2 -2
  11. package/package.json +1 -1
  12. package/templates/pane-apps/client/assets/api-Cyoc3E6K.css +1 -0
  13. package/templates/pane-apps/client/assets/home-CLFnmg7u.css +1 -0
  14. package/templates/pane-apps/client/assets/home-CrhBkqDQ.js +1 -0
  15. package/templates/pane-apps/client/assets/reviews-Bq8EwmG-.js +153 -0
  16. package/templates/pane-apps/client/assets/reviews-DzHtA35Q.css +1 -0
  17. package/templates/pane-apps/client/assets/{files-BkmyervY.js → search-DgFnnu-J.js} +1 -1
  18. package/templates/pane-apps/client/assets/specs-JvdNFtXR.js +13 -0
  19. package/templates/pane-apps/client/assets/{useNow-BHFKFraS.js → useNow-Ww-Gffnk.js} +1 -1
  20. package/templates/pane-apps/client/home/index.html +5 -5
  21. package/templates/pane-apps/client/reviews/index.html +6 -6
  22. package/templates/pane-apps/client/specs/index.html +4 -4
  23. package/templates/pane-apps/server/home.mjs +11 -12
  24. package/templates/pane-apps/server/specs.mjs +4 -4
  25. package/templates/skills/dx-spec/SKILL.md +4 -16
  26. package/templates/skills/dx-spec/references/review-guide.md +13 -7
  27. package/templates/skills/dx-spec/references/spec-guide.md +11 -4
  28. package/templates/skills/dx-spec/references/stages.md +38 -22
  29. package/templates/skills/dx-spec-execute/SKILL.md +5 -21
  30. package/templates/webterm/README.md +11 -8
  31. package/templates/webterm/awake.js +27 -0
  32. package/templates/webterm/config.js +10 -0
  33. package/templates/webterm/public/app/state.js +4 -0
  34. package/templates/webterm/public/app/tabs.js +37 -3
  35. package/templates/webterm/public/styles.css +13 -0
  36. package/templates/webterm/server.js +24 -1
  37. package/templates/webterm/tools/home.js +25 -3
  38. package/templates/pane-apps/client/assets/api-DNLbSBpK.css +0 -1
  39. package/templates/pane-apps/client/assets/home-3SeGzySM.css +0 -1
  40. package/templates/pane-apps/client/assets/home-Cu9xOd2i.js +0 -1
  41. package/templates/pane-apps/client/assets/reviews-DMrGB-kG.js +0 -153
  42. package/templates/pane-apps/client/assets/reviews-nK_yRav9.css +0 -1
  43. package/templates/pane-apps/client/assets/specs-Cabb15F0.js +0 -13
  44. package/templates/skills/dx-spec/references/principles-template.md +0 -2
  45. /package/templates/pane-apps/client/assets/{api-BBDf_rzz.js → api-CguEsvNp.js} +0 -0
@@ -1 +0,0 @@
1
- :root{--rv-accent-bg:#58a6ff1f;--rv-ok-bg:#3fb9501f;--rv-warn-bg:#d2992224;--rv-issue:#f85149;--rv-reply:#a371f7;--rv-add-bg:#12291b;--rv-add:#7ee787;--rv-del-bg:#2b1719;--rv-del:#ffa198;--rv-btn-text:#0d1117;--rv-shadow:#00000073}[data-theme=light]{--rv-accent-bg:#0969da1a;--rv-ok-bg:#1a7f371a;--rv-warn-bg:#9a67001f;--rv-issue:#cf222e;--rv-reply:#8250df;--rv-add-bg:#dafbe1;--rv-add:#116329;--rv-del-bg:#ffebe9;--rv-del:#82071e;--rv-btn-text:#fff;--rv-shadow:#1f23282e}.workspace.is-review .stage.has-bar .theme-toggle{background:0 0;top:8px;right:10px}.rv-mono{font-family:ui-monospace,Menlo,monospace;font-size:12px}.nav-list button.rv-row{padding:6px 14px 7px;display:block}.nav-list button.rv-row:hover{color:inherit;background:var(--sunken)}.rv-row:disabled{cursor:default;opacity:.6}.rv-row-top{align-items:flex-start;gap:6px;display:flex}.rv-row-name{overflow-wrap:anywhere;flex:1;min-width:0;font-weight:600}.rv-row-chip{border:1px solid var(--border);color:var(--muted);border-radius:9px;flex:none;margin-top:2px;padding:0 6px;font-size:10.5px;line-height:15px}.rv-row-chip.is-merged{border-color:var(--accent);color:var(--accent)}.rv-bar{background:var(--border);border-radius:2px;height:3px;margin-top:5px;overflow:hidden}.rv-bar i{background:var(--ok);height:100%;display:block}.rv-row-state{color:var(--muted);margin-top:4px;font-size:11px}.rv-row-note{color:var(--muted);margin-top:2px;font-size:11px;font-style:italic}.rv-row-ended{color:var(--muted);margin-top:2px;font-size:11.5px}.rv-dot{background:var(--accent);vertical-align:middle;border-radius:50%;width:7px;height:7px;margin-right:5px;display:inline-block}@media (prefers-reduced-motion:no-preference){.rv-dot{animation:1.6s infinite rv-pulse}}@keyframes rv-pulse{0%,to{opacity:1}50%{opacity:.3}}.nav-list button.rv-gi{color:var(--fg);border-left:0;padding:6px 14px;font-size:12.5px}.rv-gdots{flex:none;gap:4px;display:inline-flex}.rv-gdot{background:var(--accent);border-radius:50%;width:7px;height:7px;display:inline-block}.rv-gdot.is-issue{background:var(--rv-issue)}.rv-gdot.is-attention{background:var(--warn)}.rv-gdot.is-reply{background:var(--rv-reply)}.rv-gright{line-height:var(--nav-line);color:var(--muted);white-space:nowrap;flex:none;align-items:center;gap:6px;margin-left:auto;font-size:11px;display:inline-flex}.rv-gcheck{font-size:12px}.rv-ring{width:14px;height:14px;display:block}.rv-ring circle{fill:none;stroke-width:2px}.rv-ring-bg{stroke:var(--border)}.rv-ring-fg{stroke:var(--ok);stroke-linecap:round;transform-origin:50%;transform:rotate(-90deg)}.rv-gsep{border-top:1px solid var(--border);margin-top:6px;padding-top:6px}.rv-gsep .rv-gname{color:var(--muted)}.rv-gi:hover{background:var(--sunken)}.nav-list button.rv-gi[aria-current=true]{background:var(--sel);box-shadow:inset 3px 0 0 var(--accent)}.rv-gi.is-done,.rv-gi.is-empty{color:var(--muted)}.rv-gi.is-done .rv-gright{color:var(--ok)}.rv-gwait{min-height:calc(var(--nav-line) * 1em);align-items:center;padding:6px 14px;display:flex}.rv-plus{color:var(--rv-add)}.rv-minus{color:var(--rv-del)}.rv-gnote{position:relative}.rv-info{all:unset;box-sizing:border-box;width:14px;height:14px;color:var(--muted);vertical-align:-2px;cursor:default;justify-content:center;align-items:center;display:inline-flex}.rv-info:hover,.rv-info:focus{color:var(--fg)}.rv-infotip{width:220px;box-shadow:0 6px 18px var(--rv-shadow)}.rv-screen{flex-direction:column;height:100%;min-height:0;display:flex}.rv-head{border-bottom:1px solid var(--border);background:var(--panel);align-items:center;gap:10px;padding:8px 40px 8px 12px;display:flex}.rv-head h2{white-space:nowrap;margin:0;font-size:14px;font-weight:600}.rv-head-what{color:var(--muted);white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.rv-grow{flex:1}.rv-chip{white-space:nowrap;border:1px solid #0000;border-radius:10px;padding:0 7px;font-size:11px;line-height:18px;display:inline-block}.rv-chip.is-you{background:var(--rv-warn-bg);color:var(--warn);border-color:var(--warn)}.rv-chip.is-ready{background:var(--rv-ok-bg);color:var(--ok);border-color:var(--ok)}.rv-chip.is-ended{background:var(--ok);color:var(--rv-btn-text)}.rv-agentbar{border-bottom:1px solid var(--border);background:var(--rv-accent-bg);align-items:center;gap:12px;padding:8px 12px;display:flex}.rv-agentbar b{color:var(--accent);white-space:nowrap}.rv-say{flex:1;min-width:0}.rv-asked{color:var(--muted)}.rv-say .rv-late{color:var(--warn)}.rv-status{border-top:1px solid var(--border);background:var(--panel);color:var(--muted);white-space:nowrap;align-items:center;gap:12px;padding:6px 12px;font-size:12px;display:flex}.rv-loops{align-items:center;gap:4px;display:inline-flex}.rv-loops svg{width:14px;height:14px;display:block}.rv-prog{background:var(--border);border-radius:3px;width:150px;height:6px;overflow:hidden}.rv-prog i{background:var(--ok);height:100%;display:block}.rv-fact{color:var(--fg);align-items:center;gap:5px;display:inline-flex}.rv-fact i{background:var(--muted);border-radius:50%;width:6px;height:6px;display:inline-block}.rv-fact.is-issue i{background:var(--rv-issue)}.rv-fact.is-attention i,.rv-fact.is-you i,.rv-fact.is-changed i{background:var(--warn)}.rv-fact.is-reply i{background:var(--rv-reply)}.rv-log-toggle{all:unset;color:var(--muted);cursor:pointer;font:inherit;align-items:center;gap:5px;font-size:12px;display:inline-flex}.rv-log{border-top:1px solid var(--border);background:var(--bg);max-height:40%;color:var(--muted);padding:6px 12px 6px 30px;font-size:12px;line-height:1.7;overflow:auto}.rv-log b{color:var(--fg);font-weight:500}.rv-ghead{z-index:5;border-bottom:1px solid var(--border);background:var(--bg);margin:0 -12px 4px;padding:10px 12px 0;position:sticky;top:0}.rv-ghead.is-under{top:var(--rv-bar)}.rv-gtitle{align-items:center;gap:10px;display:flex}.rv-gacts{flex:none;gap:8px;display:inline-flex}.rv-ghead h3{margin:0;font-size:15px;font-weight:600}.rv-gnarr{max-width:820px;color:var(--muted);margin:6px 0 10px}.rv-gfacts{color:var(--muted);margin:0 0 8px;padding-left:18px;font-size:12px}.rv-gshared{color:var(--muted);margin:0 0 8px;font-size:12px}.rv-gstrip{background:var(--border);height:3px;margin:8px -12px 0;overflow:hidden}.rv-gstrip i{background:var(--ok);height:100%;display:block}.rv-gfold{height:calc(var(--rv-fold,0px) * (1 - var(--rv-collapse,0)));opacity:calc(1 - var(--rv-collapse,0));overflow:hidden}.rv-gfold-in{display:flow-root}.rv-gfold-in>:last-child{margin-bottom:0}.rv-ghead.is-compact{box-shadow:0 6px 12px -6px var(--rv-shadow)}.rv-ghead.is-skel{padding-bottom:10px;position:static}.rv-gtalk{flex-direction:column;gap:8px;display:flex}.rv-navrow{flex-wrap:wrap;gap:6px;padding-bottom:8px;display:flex}.rv-ghead .rv-navrow{padding-top:8px}.rv-nav{all:unset;box-sizing:border-box;border:1px solid var(--border);background:var(--panel);color:var(--fg);cursor:pointer;font:inherit;white-space:nowrap;border-radius:12px;align-items:center;gap:6px;padding:2px 9px 2px 6px;font-size:12px;display:inline-flex}.rv-nav:hover{border-color:var(--accent)}.rv-navn{background:var(--muted);min-width:16px;color:var(--rv-btn-text);text-align:center;border-radius:8px;padding:0 5px;font-size:11px;font-weight:600}.rv-nav.is-issue .rv-navn{background:var(--rv-issue)}.rv-nav.is-attention .rv-navn{background:var(--warn)}.rv-nav.is-reply .rv-navn{background:var(--rv-reply)}.rv-nav.is-morph{background:var(--rv-accent-bg);color:var(--muted);border-color:#0000}.rv-nav.is-morph b{color:var(--fg);font-weight:600}.rv-navdot{background:var(--accent);border-radius:50%;width:8px;height:8px;display:inline-block}.rv-nav.is-issue .rv-navdot{background:var(--rv-issue)}.rv-nav.is-attention .rv-navdot{background:var(--warn)}.rv-nav.is-reply .rv-navdot{background:var(--rv-reply)}.rv-nav.is-done{color:var(--muted);cursor:default;border-style:dashed}.rv-nav.is-done .rv-navn{color:var(--ok);background:0 0;font-size:12px}.rv-allbar{z-index:7;height:var(--rv-bar);border-bottom:1px solid var(--border);background:var(--bg);align-items:center;gap:10px;margin:0 -12px;padding:0 12px;display:flex;position:sticky;top:0}.rv-allbar h3{margin:0;font-size:13px;font-weight:600}.rv-allbar .rv-navrow{padding:0}.is-landed{animation:1.2s ease-out rv-landed}@keyframes rv-landed{0%{background:var(--rv-accent-bg)}to{background:0 0}}.rv-body{flex:1;min-height:0;display:flex;position:relative}.rv-feed{--rv-bar:44px;overflow-anchor:none;flex:1;min-width:0;overflow:auto}.rv-totop{z-index:5;border:1px solid var(--border);background:var(--panel);width:34px;height:34px;box-shadow:0 6px 18px var(--rv-shadow);color:var(--fg);cursor:pointer;font:inherit;border-radius:50%;font-size:16px;position:absolute;bottom:60px;right:52px}.rv-fgrid{padding:10px 4px 10px 12px;position:relative}.rv-fmain{flex-direction:column;gap:10px;min-width:0;padding-right:12px;display:flex}.rv-gcard{border:1px solid var(--border);background:var(--panel);border-radius:8px;padding:10px 12px}.rv-gcard-top{align-items:center;gap:8px;display:flex}.rv-gcard h3{margin:0;font-size:13px;font-weight:600}.rv-facts{color:var(--muted);font-size:12px}.rv-gcard p{margin:6px 0}.rv-gcard ul{color:var(--muted);margin:6px 0 0;padding-left:18px;font-size:12px}.rv-gcard-acts{gap:8px;margin-top:6px;display:flex}.rv-section{flex-direction:column;gap:10px;display:flex}.rv-fmain.is-all .rv-section+.rv-section{margin-top:8px}.rv-hunk{border:1px solid var(--border);background:var(--panel);border-radius:8px;min-width:0;position:relative}.rv-fh{border-bottom:1px solid var(--border);color:var(--muted);align-items:center;gap:8px;padding:6px 10px;font-size:12px;display:flex}.rv-fh.is-note,.rv-folded.is-note{padding-left:24px}.rv-nt-head.is-note{padding-left:14px}.rv-fh .rv-path{color:var(--fg);text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.rv-fh .rv-path i{color:var(--muted);font-style:normal}.rv-also{border:1px solid var(--border);white-space:nowrap;border-radius:9px;padding:0 6px;font-size:11px}.rv-changed{border:1px solid var(--warn);background:var(--rv-warn-bg);color:var(--warn);white-space:nowrap;border-radius:9px;padding:0 6px;font-size:10.5px;line-height:15px}.rv-diff{margin:0;padding:4px 0 6px;overflow-x:auto}.rv-hd{color:var(--muted);background:var(--rv-accent-bg);padding:2px 10px 4px;font-family:ui-monospace,Menlo,monospace;font-size:12px}.rv-l{white-space:pre;grid-template-columns:34px 34px 1fr;font-family:ui-monospace,Menlo,monospace;font-size:12px;line-height:20px;display:grid}.rv-l .rv-ln{all:unset;box-sizing:border-box;color:var(--muted);text-align:right;font:inherit;padding-right:8px;font-size:11px;display:block}.rv-l button.rv-ln{cursor:pointer}.rv-l button.rv-ln:hover{color:var(--fg);background:var(--sunken)}.rv-l.is-picked{box-shadow:inset 0 0 0 1px var(--accent)}.rv-l,.rv-fh,.rv-folded,.rv-nt-head{position:relative}.rv-hdot{background:var(--accent);border:0;border-radius:50%;width:6px;height:6px;margin:-3px 0 0;padding:0;position:absolute;top:50%;left:10px}button.rv-hdot{cursor:pointer}.rv-fh.is-note .rv-hdot,.rv-nt-head .rv-hdot{background:var(--accent)}.rv-nt-head .rv-hdot{left:0}.rv-fh.is-note.is-attention .rv-hdot{background:var(--warn)}.rv-fh.is-note.is-issue .rv-hdot{background:var(--rv-issue)}.rv-folded.is-note:before{content:"";background:var(--accent);border-radius:50%;width:6px;height:6px;margin-top:-3px;position:absolute;top:50%;left:10px}.rv-folded.is-note.is-attention:before{background:var(--warn)}.rv-folded.is-note.is-issue:before{background:var(--rv-issue)}.rv-nl{background:var(--accent);border:0;width:3px;padding:0;position:absolute;top:0;bottom:0}button.rv-nl{cursor:pointer}button.rv-nl:hover{width:5px}.rv-nl.is-lane0{left:2px}.rv-nl.is-lane1{left:7px}.rv-nl.is-attention{background:var(--warn)}.rv-nl.is-issue{background:var(--rv-issue)}.rv-nl.is-first{border-radius:2px 2px 0 0;top:3px}.rv-nl.is-last{border-radius:0 0 2px 2px;bottom:3px}.rv-nl.is-first.is-last{border-radius:2px}.rv-l span:last-child{padding-left:10px}.rv-l.is-add{background:var(--rv-add-bg);color:var(--rv-add)}.rv-l.is-del{background:var(--rv-del-bg);color:var(--rv-del)}.rv-expand{background:var(--sunken);gap:10px;padding:2px 10px;font-size:11.5px;display:flex}.rv-trouble{color:var(--warn);margin:0;padding:4px 10px 6px;font-size:12px}.rv-folded{border:1px solid var(--border);background:var(--panel);min-width:0;color:var(--muted);border-radius:8px;align-items:center;gap:8px;padding:6px 10px;font-size:12px;display:flex}.rv-fnotes{color:var(--accent);font-size:11.5px}.rv-folded .rv-mono{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rv-ok{color:var(--ok)}.rv-link{all:unset;color:var(--accent);cursor:pointer;font:inherit;font-size:12px}.rv-fh .rv-link{white-space:nowrap;border:1px solid var(--border);border-radius:999px;flex:none;padding:1px 8px;font-size:11.5px}.rv-fh .rv-link:hover{border-color:var(--accent)}.rv-fh .rv-link:disabled{opacity:.5;cursor:default}.rv-state{font-size:11.5px}.rv-state.is-seen{color:var(--ok)}button.rv-state{all:unset;white-space:nowrap;cursor:pointer;font:inherit;color:var(--ok);border:1px solid #0000;border-radius:999px;flex:none;padding:1px 8px;font-size:11.5px}button.rv-state .rv-state-off{display:none}button.rv-state:hover,button.rv-state:focus-visible{border-color:var(--border);color:var(--fg)}button.rv-state:hover .rv-state-on,button.rv-state:focus-visible .rv-state-on{display:none}button.rv-state:hover .rv-state-off,button.rv-state:focus-visible .rv-state-off{display:inline}.rv-fab{background:var(--accent);width:30px;height:30px;color:var(--rv-btn-text);cursor:pointer;box-shadow:0 3px 10px var(--rv-shadow);opacity:0;border:0;border-radius:50%;justify-content:center;align-items:center;font-size:18px;font-weight:600;transition:opacity .12s;display:flex;position:absolute;bottom:10px;right:10px}.rv-hunk:hover .rv-fab,.rv-hunk:focus-within .rv-fab{opacity:1}.rv-fabmenu{background:var(--panel);border:1px solid var(--border);box-shadow:0 10px 24px var(--rv-shadow);z-index:3;border-radius:8px;min-width:170px;padding:4px;position:absolute;bottom:10px;right:46px;overflow:hidden}.rv-fabmenu button{all:unset;box-sizing:border-box;text-align:left;cursor:pointer;width:100%;font:inherit;border-radius:3px;padding:5px 9px;font-size:12.5px;display:block}.rv-fabmenu button.rv-seen{color:var(--ok);font-weight:600}.rv-fabmenu button:hover:not(:disabled){background:var(--sunken)}.rv-fabmenu button:disabled{opacity:.5;cursor:default}.rv-fabmenu hr{border:0;border-top:1px solid var(--border);margin:3px 0}.rv-nt{border:1px solid var(--border);background:var(--panel);border-radius:8px}.rv-nt>summary{color:var(--muted);cursor:pointer;padding:6px 10px;font-size:12px}.rv-nt-names{margin-left:8px;font-family:ui-monospace,Menlo,monospace;font-size:11.5px}.rv-nt-row{border-top:1px solid var(--border);padding:6px 10px}.rv-nt-head{align-items:center;gap:8px;min-width:0;font-size:12px;display:flex}.rv-nt-images{gap:12px;padding:8px 0 2px;display:flex}.rv-nt-images figure{color:var(--muted);margin:0;font-size:11px}.rv-nt-images img{border:1px solid var(--border);background:var(--sunken);border-radius:4px;max-width:220px;max-height:160px;display:block}.rv-waiting{min-height:70px}.rv-skel{background:var(--border);opacity:.7;border-radius:3px;height:12px;margin:8px 0}.rv-skel.is-narrow{width:40%}.rv-skel.is-wide{width:80%}.rv-skel.is-half{width:60%}.rv-gwait .rv-skel{width:70%;margin:0}.rv-inote{border-left:3px solid var(--accent);background:var(--sunken);color:var(--fg);white-space:normal;border-radius:0 6px 6px 0;margin:4px 10px 6px 2px;padding:6px 10px 7px;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:12.5px;line-height:1.5}.rv-hunk>.rv-inote{margin:8px 10px 4px 2px}.rv-inote-top{align-items:baseline;gap:8px;display:flex}.rv-inote .rv-note-kind{color:var(--accent);letter-spacing:.04em;text-transform:uppercase;font-size:10.5px;font-weight:700}.rv-inote .rv-note-ln{color:var(--muted);font-family:ui-monospace,Menlo,monospace;font-size:11px}.rv-inote .rv-note-txt{margin:2px 0 6px}.rv-inote .rv-note-acts{gap:6px;display:flex}.rv-inote .rv-note-dismissed{color:var(--muted);margin-right:6px;font-size:11.5px}.rv-inote-box{margin:0 10px 8px 2px}.rv-inote .rv-note-locked{color:var(--muted);font-size:11.5px}.rv-inote.is-attention{border-left-color:var(--warn)}.rv-inote.is-attention .rv-note-kind{color:var(--warn)}.rv-inote.is-issue{border-left-color:var(--rv-issue)}.rv-inote.is-issue .rv-note-kind{color:var(--rv-issue)}.rv-inote.is-dismissed{display:none}.rv-inote.is-dismissed.is-back{display:block}.rv-note-act{border:1px solid var(--border);background:var(--panel);color:var(--fg);cursor:pointer;font:inherit;border-radius:5px;padding:2px 8px;font-size:11.5px}.rv-note-act:hover{border-color:var(--accent)}.rv-note-act.is-fix{border-color:var(--accent);color:var(--accent)}.rv-form{max-width:640px;margin:28px auto;padding:0 20px;overflow:auto}.rv-form h2{margin:0 0 4px;font-size:18px;font-weight:600}.rv-form h3{margin:22px 0 4px;font-size:15px;font-weight:600}.rv-form-row{justify-content:space-between;align-items:baseline;gap:10px;display:flex}.rv-form-row h3{margin-bottom:4px}.rv-opt.is-waiting{color:var(--muted);cursor:default;border-style:dashed;align-items:center;gap:10px;padding:12px 14px;display:flex}.rv-lead{color:var(--muted);margin:0 0 14px}.rv-opt{border:1px solid var(--border);background:var(--panel);cursor:pointer;border-radius:6px;grid-template-columns:16px minmax(0,1fr);gap:6px 8px;margin-bottom:6px;padding:8px 10px;display:grid;position:relative}.rv-opt.is-chosen{border-color:var(--accent);background:var(--rv-accent-bg)}.rv-opt.is-refused{border-color:var(--border);cursor:default}.rv-radio-input{opacity:0;width:0;height:0;margin:0;position:absolute}.rv-radio{border:1px solid var(--muted);border-radius:50%;width:12px;height:12px;margin-top:3px}.rv-opt.is-chosen .rv-radio{border:4px solid var(--accent)}.rv-opt-title{justify-content:space-between;gap:8px;min-width:0;display:flex}.rv-opt-title b{overflow-wrap:anywhere;min-width:0;font-weight:600}.rv-count{color:var(--muted);white-space:nowrap}.rv-opt-detail{min-width:0;color:var(--muted);overflow-wrap:anywhere;grid-column:2;font-size:12px}.rv-opt-detail input,.rv-opt-detail select{font:inherit;color:var(--fg);background:var(--sunken);border:1px solid var(--border);border-radius:5px;padding:1px 5px;font-size:12px}.rv-commits{min-width:0;color:var(--muted);grid-column:2;margin:0;padding:0;font-size:12px;list-style:none}.rv-commits li{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.rv-check{grid-column:2;align-items:center;gap:6px;font-size:12px;display:flex}.rv-form-foot{align-items:center;gap:10px;margin-top:12px;display:flex}.rv-form-foot label{color:var(--muted);font-size:12px}.rv-form-foot input{font:inherit;color:var(--fg);background:var(--sunken);border:1px solid var(--border);border-radius:5px;flex:1;padding:3px 7px}.rv-form-note{color:var(--muted);margin-top:8px;font-size:12px}.rv-form-acts{border-top:1px solid var(--border);justify-content:flex-end;gap:10px;margin-top:18px;padding-top:14px;display:flex}.rv-refused{border:1px solid var(--warn);background:var(--rv-warn-bg);color:var(--fg);border-radius:6px;margin-top:10px;padding:6px 10px;font-size:12px}.rv-btn{border:1px solid var(--border);background:var(--panel);color:var(--fg);cursor:pointer;font:inherit;white-space:nowrap;border-radius:6px;padding:4px 10px}.rv-btn.is-primary{background:var(--accent);border-color:var(--accent);color:var(--rv-btn-text);font-weight:600}.rv-btn.is-outline{border-color:var(--accent);color:var(--accent);background:0 0}.rv-btn.is-small{padding:2px 8px;font-size:12px}.rv-btn:disabled{opacity:.5;cursor:default}.rv-icon{all:unset;color:var(--muted);cursor:pointer;align-items:center;padding:0 2px;display:inline-flex}.rv-icon svg{stroke:currentColor;fill:none;stroke-width:1.5px;stroke-linecap:round;stroke-linejoin:round;width:14px;height:14px}.rv-thread{border-top:1px solid var(--border);padding:8px 10px;font-size:12.5px}.rv-msg{margin-bottom:6px}.rv-who{color:var(--muted);font-size:11px;display:block}.rv-who.is-agent{color:var(--accent)}.rv-new{border:1px solid var(--accent);color:var(--accent);vertical-align:middle;border-radius:8px;margin-left:6px;padding:0 5px;font-size:10px;line-height:14px;display:inline-block}.rv-msg.is-unread .rv-msg-body{border-left:2px solid var(--accent);padding-left:6px}.rv-msg-body.is-tool{color:var(--muted);font-style:italic}.rv-tf{color:var(--muted);justify-content:space-between;align-items:center;gap:8px;font-size:12px;display:flex}.rv-tag{border:1px solid var(--warn);color:var(--warn);border-radius:9px;margin-right:auto;padding:0 6px;font-size:10.5px;line-height:15px}.rv-compose{border-top:1px solid var(--border);padding:8px 10px}.rv-inote-box .rv-compose{border:1px solid var(--border);border-radius:6px}.rv-compose-head{align-items:baseline;gap:8px;margin:0 0 4px;display:flex}.rv-compose textarea,.rv-rdialog textarea,.rv-aclose textarea{box-sizing:border-box;border:1px solid var(--border);background:var(--sunken);width:100%;color:var(--fg);font:inherit;resize:vertical;border-radius:6px;padding:6px 8px;font-size:12.5px}.rv-compose-acts{gap:8px;margin:6px 0 0;display:flex}.rv-editing{z-index:7;border:1px solid var(--border);background:var(--panel);width:360px;box-shadow:0 10px 24px var(--rv-shadow);border-radius:10px;position:absolute;bottom:18px;right:18px}.rv-send{z-index:6;border:1px solid var(--border);background:var(--panel);box-shadow:0 10px 24px var(--rv-shadow);border-radius:17px;font-size:12px;position:absolute;bottom:18px;right:40px}.rv-send.is-open{border-radius:10px;width:360px}.rv-sendpill{all:unset;box-sizing:border-box;width:100%;color:var(--fg);cursor:pointer;font:inherit;white-space:nowrap;align-items:center;gap:8px;padding:7px 14px;font-weight:600;display:flex}.rv-n{background:var(--accent);color:var(--rv-btn-text);border-radius:999px;padding:0 6px;font-size:11px;line-height:16px}.rv-send-head{border-bottom:1px solid var(--border);margin:0;padding:8px 12px;font-size:13px;font-weight:600}.rv-si{border-bottom:1px solid var(--border);grid-template-columns:1fr auto;gap:1px 8px;padding:7px 12px;display:grid}.rv-si b,.rv-si .rv-f,.rv-si .rv-q{grid-column:1;min-width:0}.rv-si b{font-size:11.5px}.rv-si .rv-f{color:var(--muted);font-family:ui-monospace,Menlo,monospace;font-size:11px}.rv-si .rv-q:before{content:"“"}.rv-si .rv-q:after{content:"”"}.rv-si-ctl{grid-area:1/2/4;align-self:start;gap:4px;display:flex}.rv-si-ctl button{all:unset;width:20px;height:20px;color:var(--muted);cursor:pointer;font:inherit;border-radius:4px;justify-content:center;align-items:center;font-size:12px;display:inline-flex}.rv-si-ctl button:hover{background:var(--sunken);color:var(--fg)}.rv-send-foot{margin:0;padding:10px 12px}.rv-send-foot .rv-btn{width:100%;padding:6px 10px}.rv-send-foot small{color:var(--muted);text-align:center;margin-top:6px;font-size:11px;display:block}.rv-banner{border-bottom:1px solid var(--border);background:var(--rv-warn-bg);align-items:center;gap:10px;padding:7px 12px;font-size:13px;display:flex}.rv-banner b{color:var(--warn);white-space:nowrap}.rv-banner.is-merged{background:var(--rv-accent-bg)}.rv-banner.is-merged b{color:var(--accent)}.rv-hunk.is-dim,.rv-gcard.is-dim{opacity:.72}.rv-adialog{width:620px;max-width:100%}.rv-adialog-head{justify-content:space-between;align-items:center;gap:12px;font-size:14px;display:flex}.rv-adialog-x{font-size:18px;line-height:1}.rv-adialog .dialog-body{flex-direction:column;gap:14px;display:flex}.rv-asign{grid-template-columns:1fr 1fr;gap:14px;display:grid}.rv-adialog-acts{align-items:center}.rv-adialog-acts .rv-btn{width:auto}.rv-left{border:1px solid var(--warn);background:var(--rv-warn-bg);border-radius:8px;margin:0;padding:10px 14px}.rv-left.is-clean{border-color:var(--ok);background:var(--rv-ok-bg);font-size:13px}.rv-left h3{color:var(--warn);align-items:center;gap:8px;margin:0 0 6px;font-size:13px;font-weight:600;display:flex}.rv-left ul{margin:0;padding:0;list-style:none}.rv-left li{align-items:center;gap:8px;padding:3px 0;font-size:13px;display:flex}.rv-left li b{text-align:right;font-variant-numeric:tabular-nums;min-width:34px}.rv-left li .rv-link{white-space:nowrap;margin-left:auto;font-size:12px}.rv-left-ack{border-top:1px solid var(--warn);align-items:flex-start;gap:9px;margin-top:10px;padding-top:10px;font-size:13px;display:flex}.rv-left-ack input{margin-top:3px}.rv-left-mark{border:1px solid var(--warn);background:var(--rv-warn-bg);width:16px;height:16px;color:var(--warn);cursor:default;border-radius:50%;flex:none;justify-content:center;align-items:center;font-size:11px;font-weight:700;line-height:1;display:inline-flex;position:relative}.rv-left-mark.is-plain{border-color:var(--muted);width:14px;height:14px;color:var(--muted);vertical-align:-3px;background:0 0;margin-left:6px;font-size:10px}.rv-left h3 .rv-left-mark{cursor:default}.rv-tip{width:280px;box-shadow:0 10px 30px var(--rv-shadow);border-radius:8px;padding:10px 12px}.rv-tip b{color:var(--warn);margin-bottom:4px;display:block}.rv-tip.is-plain b{color:var(--fg)}.rv-tip ul{margin:0;padding-left:16px}.rv-tip li{margin:2px 0}.rv-tip small{color:var(--muted);margin-top:6px;display:block}.rv-abadge{background:var(--rv-warn-bg);min-width:16px;color:var(--warn);text-align:center;border-radius:9px;margin-left:6px;padding:0 5px;font-size:11px;line-height:16px;display:inline-block}.rv-abadge.is-warn{border-radius:50%;width:16px;padding:0;font-weight:700}.rv-ameta{grid-template-columns:1fr 1fr;gap:8px 18px;min-width:0;display:grid}.rv-ameta>div{border-bottom:1px dashed var(--border);justify-content:space-between;gap:12px;padding-bottom:3px;display:flex}.rv-ameta .rv-k{color:var(--muted);font-size:12px}.rv-ameta .rv-v{text-align:right;overflow-wrap:anywhere;font-size:13px}.rv-ameta .rv-v.rv-mono{font-size:12px}.rv-aact{flex-direction:column;gap:16px;min-width:0;margin:0;display:flex}.rv-field{flex-direction:column;gap:6px;margin:0;display:flex}.rv-field label,.rv-field .rv-label{color:var(--muted);font-size:12px}.rv-field label small,.rv-field .rv-label small{margin-left:4px;font-size:10.5px}.rv-field input{border:1px solid var(--border);background:var(--deep);width:100%;color:var(--fg);font:inherit;border-radius:6px;padding:5px 8px}.rv-sig{border:1px solid var(--border);background:var(--deep);border-radius:6px;min-height:80px;display:block;position:relative}.rv-sig canvas{touch-action:none;cursor:crosshair;width:100%;height:80px;display:block}.rv-sig .rv-link{font-size:10.5px;position:absolute;bottom:3px;right:6px}.rv-btn.is-ok{border-color:var(--ok);background:var(--rv-ok-bg);color:var(--fg);font-weight:600}.rv-btn.is-warn{border-color:var(--warn);background:var(--rv-warn-bg);color:var(--fg);font-weight:600}.rv-btn.is-quiet{border:1px dashed var(--border);color:var(--muted);background:0 0;font-weight:400}.rv-btn.is-quiet:hover,.rv-btn.is-quiet:focus-visible{background:var(--panel);color:var(--fg);border-style:solid}.rv-rdialog{max-width:560px}.rv-rdialog .dialog-body p{margin:0 0 12px;font-size:13px;line-height:1.5}.rv-rgoes{margin:0 0 14px;font-size:13px}.rv-rgoes h4{color:var(--muted);letter-spacing:.05em;text-transform:uppercase;margin:0 0 4px;font-size:11px;font-weight:600}.rv-rgoes ul{margin:0 0 12px;padding-left:18px;line-height:1.55}.rv-rgoes ul:last-child{margin-bottom:0}.rv-rdialog label{color:var(--muted);margin-bottom:6px;font-size:12px;display:block}.rv-rdialog textarea{min-height:84px}.rv-rdialog .dialog-acts{justify-content:flex-end;gap:8px;display:flex}.rv-aclose{flex-direction:column;align-items:center;gap:4px;display:flex}.rv-aclose textarea{background:var(--deep)}.rv-aclose-acts{gap:8px;display:flex}.rv-adialog-acts .rv-aclose{align-items:flex-start}.rv-ended{border-bottom:1px solid var(--border);background:var(--panel);color:var(--muted);white-space:nowrap;align-items:center;gap:16px;padding:6px 12px;font-size:12px;display:flex}.rv-ended b{color:var(--fg);font-weight:600}.rv-ended-how,.rv-ended .rv-left-mark,.rv-ended .rv-btn{flex:none}.rv-ended img{object-fit:contain;flex:none;width:96px;height:26px;display:block}.rv-ended-fact,.rv-ended .rv-reason{text-overflow:ellipsis;min-width:0;overflow:hidden}
@@ -1,13 +0,0 @@
1
- import{A as e,D as t,E as n,O as r,S as i,_ as a,a as o,c as s,d as c,f as l,g as u,h as d,i as f,l as p,m,n as h,o as g,p as _,t as ee,u as te,v,w as y,x as b}from"./api-BBDf_rzz.js";import{a as ne,i as x,n as S,o as re}from"./files-BkmyervY.js";var C=e(),w=r();function ie(e){let t=e.replace(/\r\n?/g,`
2
- `).trim(),n=5381;for(let e=0;e<t.length;e++)n=(n*33^t.charCodeAt(e))>>>0;return n.toString(36)}function ae(e,t){return t?.readHash?t.readHash===e?{read:!0,changed:!1}:{read:!1,changed:!0}:{read:!1,changed:!1}}function T(e){return e===`markdown`||e===`text`}function E(e){let t=[],n=[];if(e.kind===`markdown`&&typeof e.text==`string`)for(let r of te(e.text)){let i=ie(r.heading?`## ${r.heading}\n${r.body}`:r.body);t.push({heading:r.heading,body:r.body,hash:i}),n.push(c(e.path,r.heading))}else{let r=e.text,i=ie(typeof r==`string`?r:e.fingerprint??e.path);t.push({heading:null,body:typeof r==`string`?r:``,hash:i}),n.push(c(e.path,null))}let r=g(n);return t.map((e,t)=>({...e,id:r[t]}))}function oe(e,t,n){let r=c(t,n);return e.find(e=>e.id===r)??null}var se=600;function ce(e,t){let[n,r]=(0,C.useState)(t.empty),[i,a]=(0,C.useState)(null),o=(0,C.useRef)(t);o.current=t;let s=(0,C.useRef)(n),c=(0,C.useRef)(null),l=(0,C.useRef)(null),u=(0,C.useRef)(!1),d=(0,C.useRef)(0),f=(0,C.useRef)(0),p=(0,C.useRef)(!1),m=(0,C.useCallback)(e=>{s.current=e,r(e)},[]),h=(0,C.useCallback)(()=>{if(e===null)return;let t=e,n=d.current;o.current.get(t).then(e=>{if(d.current===n){if(f.current>0||l.current!==null){p.current=!0;return}u.current=!0,m(e),a(null)}}).catch(()=>{d.current===n&&(u.current=!1,a(o.current.whenUnreadable))})},[e,m]),g=(0,C.useCallback)(()=>{f.current>0||!p.current||(p.current=!1,h())},[h]),_=(0,C.useCallback)(t=>{if(e===null||!u.current||o.current.persist===!1){g();return}let n=d.current;f.current+=1,o.current.put(e,t).then(()=>a(null),()=>a(o.current.whenUnwritable)).finally(()=>{d.current===n&&(--f.current,g())})},[e,g]);return(0,C.useEffect)(()=>{d.current+=1,u.current=!1,f.current=0,p.current=!1,m(o.current.empty()),a(null),h()},[h,m]),(0,C.useEffect)(()=>()=>{c.current&&clearTimeout(c.current),l.current&&_(l.current),l.current=null,c.current=null},[_]),{value:n,update:(0,C.useCallback)((e,t=!1)=>{let n=e(s.current);if(n!==s.current){if(m(n),c.current&&clearTimeout(c.current),c.current=null,t){l.current=null,_(n);return}l.current=n,c.current=setTimeout(()=>{c.current=null;let e=l.current;l.current=null,e&&_(e)},se)}},[m,_]),reload:h,failure:i}}var D=t();function le(e){if(e===null)return[];let t=[],n=e.protocol.filter(e=>e.status!==`done`).length;n>0&&t.push(`${n} ${n===1?`stage`:`stages`} not done`);let r=e.phases.filter(e=>e.status!==`done`).length;r>0&&t.push(`${r} ${r===1?`phase`:`phases`} not done`);let i=e.awaiting.length;return i>0&&t.push(`${i} ${i===1?`thing`:`things`} waiting for an answer`),t}function ue(e){let t=le(e.state);return(0,D.jsx)(`div`,{className:`dialog-shade`,children:(0,D.jsxs)(`div`,{className:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Archive this spec`,children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Archive this spec`}),(0,D.jsxs)(`div`,{className:`dialog-body`,children:[(0,D.jsx)(`p`,{className:`rail-fact muted`,children:`It moves to:`}),(0,D.jsx)(`p`,{className:`archive-target`,children:e.filed}),t.length===0?(0,D.jsx)(`p`,{className:`rail-fact muted`,children:`Nothing is left open.`}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`p`,{className:`rail-fact`,children:[`Still open in `,e.name,`:`]}),(0,D.jsx)(`ul`,{className:`archive-open`,children:t.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}),(0,D.jsx)(`p`,{className:`rail-fact muted`,children:`The tool writes the sign-off and moves the directory. It deletes nothing.`})]}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),(0,D.jsxs)(`div`,{className:`dialog-acts`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:e.onCancel,disabled:e.working,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,onClick:e.onArchive,disabled:e.working,children:e.working?`Archiving…`:`Archive`})]})]})})}var de=new Set(`address article aside audio blockquote br button canvas details div dl dd dt fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 header hr iframe img input label li main nav ol p picture pre section select span style summary svg table tbody td textarea tfoot th thead tr ul video`.split(` `)),fe=new Set(`br hr img input source track wbr col`.split(` `)),pe=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/,O=/^(\s*)([-*+]|\d{1,9}[.)])(\s+)(.*)$/,me=/^\s{0,3}([-*_])\s*(?:\1\s*){2,}$/,he=/^\s{0,3}\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/;function ge(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function _e(e){let t=e.match(/^\s{0,3}<([a-zA-Z][a-zA-Z0-9-]*)(?=[\s/>])/);if(!t)return null;let n=t[1].toLowerCase();return de.has(n)?n:null}function ve(e){let t=ge(e),n=[];t=t.replace(/(`+)([\s\S]*?)\1/g,(e,t,r)=>(n.push(r.replace(/^ (.*) $/,`$1`)),`\uE000c${n.length-1}\uE000`));let r=e=>e.replace(/"/g,`&quot;`);return t=t.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+"[^)]*")?\)/g,(e,t,n)=>`<img alt="${r(t)}" src="${r(n)}">`),t=t.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^)]*")?\)/g,(e,t,n)=>`<a href="${r(n)}">${t}</a>`),t=t.replace(/&lt;((?:https?|mailto):[^\s&]+)&gt;/g,`<a href="$1">$1</a>`),t=t.replace(/\*\*(?!\s)([\s\S]+?)(?<!\s)\*\*/g,`<strong>$1</strong>`),t=t.replace(/(^|[^\w\\])__(?!\s)([\s\S]+?)(?<!\s)__(?!\w)/g,`$1<strong>$2</strong>`),t=t.replace(/(^|[^\w*\\])\*(?!\s)([^*\n]+?)(?<!\s)\*(?!\w)/g,`$1<em>$2</em>`),t=t.replace(/(^|[^\w_\\])_(?!\s)([^_\n]+?)(?<!\s)_(?!\w)/g,`$1<em>$2</em>`),t=t.replace(/~~(?!\s)([\s\S]+?)(?<!\s)~~/g,`<del>$1</del>`),t=t.replace(/\uE000c(\d+)\uE000/g,(e,t)=>`<code>${n[+t]}</code>`),t}function k(e){return!e.trim()||o.test(e)||pe.test(e)||me.test(e)||O.test(e)||/^\s{0,3}>/.test(e)||_e(e)!==null||/^\s{0,3}<!--/.test(e)}function A(e){let t=e.replace(/\r\n?/g,`
3
- `).split(`
4
- `),n=[],r=0;for(;r<t.length;){let e=t[r];if(!e.trim()){r++;continue}let i=e.match(o);if(i){let e=i[2],a=i[3].trim().split(/\s+/)[0],o=[];for(r++;r<t.length;){let n=t[r].trim();if(n.startsWith(e[0].repeat(e.length))&&/^(`+|~+)$/.test(n)){r++;break}o.push(t[r]),r++}let s=a?` class="language-${ge(a)}"`:``;n.push(`<pre><code${s}>${ge(o.join(`
5
- `))}</code></pre>`);continue}if(/^\s{0,3}<!--/.test(e)){for(;r<t.length&&!t[r].includes(`-->`);)r++;r++;continue}let a=_e(e);if(a){let i=[t[r]];if(fe.has(a)||/\/>\s*$/.test(e)||e.includes(`</${a}>`))r++;else{let e=1;for(r++;r<t.length&&e>0;){let n=(t[r].match(RegExp(`<${a}(?=[\\s/>])`,`gi`))||[]).length,o=(t[r].match(RegExp(`</${a}\\s*>`,`gi`))||[]).length;e+=n-o,i.push(t[r]),r++}}n.push(i.join(`
6
- `));continue}let s=e.match(pe);if(s){let e=s[1].length;n.push(`<h${e}>${ve(s[2])}</h${e}>`),r++;continue}if(me.test(e)){n.push(`<hr>`),r++;continue}if(/^\s{0,3}>/.test(e)){let e=[];for(;r<t.length&&(/^\s{0,3}>/.test(t[r])||t[r].trim()&&e.length>0&&!k(t[r]));)e.push(t[r].replace(/^\s{0,3}>\s?/,``)),r++;n.push(`<blockquote>${A(e.join(`
7
- `))}</blockquote>`);continue}if(e.includes(`|`)&&r+1<t.length&&he.test(t[r+1])&&t[r+1].includes(`-`)){let e=e=>{let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&!t.endsWith(`\\|`)&&(t=t.slice(0,-1)),t.split(/(?<!\\)\|/).map(e=>e.trim().replace(/\\\|/g,`|`))},i=e(t[r]),a=e(t[r+1]).map(e=>e.startsWith(`:`)&&e.endsWith(`:`)?`center`:e.endsWith(`:`)?`right`:e.startsWith(`:`)?`left`:``),o=e=>a[e]?` class="cell-${a[e]}"`:``,s=[];for(r+=2;r<t.length&&t[r].trim()&&t[r].includes(`|`);)s.push(e(t[r])),r++;n.push(`<table><thead><tr>${i.map((e,t)=>`<th${o(t)}>${ve(e)}</th>`).join(``)}</tr></thead><tbody>${s.map(e=>`<tr>${e.map((e,t)=>`<td${o(t)}>${ve(e)}</td>`).join(``)}</tr>`).join(``)}</tbody></table>`);continue}if(O.test(e)){let[e,i]=ye(t,r);n.push(e),r=i;continue}let c=[];for(;r<t.length&&!k(t[r]);)c.push(t[r].replace(/\s+$/,``)),r++;n.push(`<p>${ve(c.join(`
8
- `)).replace(/\n/g,`<br>
9
- `)}</p>`)}return n.join(`
10
- `)}function ye(e,t){let n=e[t].match(O);if(!n)return[``,t+1];let r=n[1].length,i=/\d/.test(n[2]),a=[],o=t,s=null;for(;o<e.length;){let t=e[o];if(!t.trim()){let t=o+1;for(;t<e.length&&!e[t].trim();)t++;if(t>=e.length)break;let n=e[t].match(O),a=e[t].match(/^\s*/)[0].length,c=n!==null&&/\d/.test(n[2])===i;if(s&&(c&&a>=r||!n&&a>r)){s.push(``),o=t;continue}break}let n=t.match(O),c=t.match(/^\s*/)[0].length;if(n&&c<=r){if(/\d/.test(n[2])!==i)break;s=[n[4]],a.push({lines:s,offset:n[1].length+n[2].length+n[3].length}),o++;continue}if(c>r&&s){s.push(t.slice(Math.min(c,a[a.length-1].offset))),o++;continue}break}let c=a.map(e=>{let t=e.lines.join(`
11
- `),n=``,r=``,i=t.match(/^\[([ xX])\]\s+([\s\S]*)$/);i&&(n=` class="task"`,r=`<span class="task-box${i[1]===` `?``:` is-done`}"></span>`,t=i[2]);let a=A(t),o=a.match(/^<p>([\s\S]*?)<\/p>([\s\S]*)$/);return o&&!o[1].includes(`<p>`)&&(a=o[1]+o[2]),`<li${n}>${r}${a}</li>`}).join(`
12
- `);return[(i?`<ol>`:`<ul>`)+c+(i?`</ol>`:`</ul>`),o]}var be=new Set(`p br hr span div a em strong b i u s del ins code pre kbd blockquote ul ol li dl dt dd h1 h2 h3 h4 h5 h6 table thead tbody tr th td caption img details summary figure figcaption sup sub small mark`.split(` `)),xe=new Set([`title`,`class`]),Se={a:new Set([`href`]),img:new Set([`src`,`alt`,`width`,`height`]),ol:new Set([`start`]),details:new Set([`open`]),th:new Set([`colspan`,`rowspan`]),td:new Set([`colspan`,`rowspan`])},j=new Set([`script`,`style`,`textarea`,`title`,`xmp`,`noembed`,`noframes`,`noscript`,`template`]),M={href:`a`,src:`img`},N=new Set([`http:`,`https:`,`mailto:`]);function Ce(e){let t=e.trim();if(t===``)return!1;let n;try{n=new URL(t)}catch{return!0}return N.has(n.protocol)}function we(e,t){return t.includes(`:`)?!1:xe.has(t)?!0:Se[e]?.has(t)??!1}function Te(e){for(let t of[...e.children])Te(t);for(let t of[...e.children]){let e=t.tagName.toLowerCase();if(!be.has(e)){j.has(e)?t.remove():t.replaceWith(...t.childNodes);continue}for(let n of[...t.attributes]){let r=n.name.toLowerCase();if(!we(e,r)){t.removeAttribute(n.name);continue}M[r]===e&&!Ce(n.value)&&t.removeAttribute(n.name)}}return e}function Ee(e,t,n={}){let r=new DOMParser().parseFromString(A(t),`text/html`);Te(r.body),n.imageUrl&&De(r.body,n.imageUrl);let i=e.ownerDocument;e.replaceChildren(...[...r.body.childNodes].map(e=>i.adoptNode(e)))}function De(e,t){for(let n of e.querySelectorAll(`img`)){let e=n.getAttribute(`src`);if(e===null)continue;let r=t(e);r!==null&&n.setAttribute(`src`,r)}}function P({source:e,imageUrl:t,className:n}){let r=(0,C.useRef)(null);return(0,C.useEffect)(()=>{r.current&&Ee(r.current,e,t?{imageUrl:t}:{})},[e,t]),(0,D.jsx)(`div`,{className:n?`prose ${n}`:`prose`,ref:r})}function Oe(e){if(F(e)){if(e.kind===`execution`)return{kind:`execution`};if(e.kind===`checkpoint`&&typeof e.after==`string`&&e.after!==``)return{kind:`checkpoint`,after:e.after}}return{kind:`spec`}}var F=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ke=(e,t=``)=>typeof e==`string`?e:t;function I(e){let t=[];for(let n of Array.isArray(e)?e:[]){if(!F(n)||typeof n.id!=`string`)continue;let e=[];for(let t of Array.isArray(n.options)?n.options:[])!F(t)||typeof t.id!=`string`||e.push({id:t.id,said:ke(t.said,t.id),...t.recommended===!0?{recommended:!0}:{}});t.push({id:n.id,ask:ke(n.ask),options:e,multi:n.multi===!0,...typeof n.invite==`string`&&n.invite!==``?{invite:n.invite}:{}})}return t}function Ae(e){if(!F(e))return{kind:`gate`,asks:``,offer:null};if(e.kind===`decision`){let t=ke(e.heading),n=I(e.questions);return t!==``&&n.length===1?{kind:`decision`,heading:t,questions:n}:{kind:`gate`,asks:``,offer:null}}return e.kind===`round`||Array.isArray(e.questions)?{kind:`round`,questions:I(e.questions)}:{kind:`gate`,asks:ke(e.asks),offer:je(e.offer)}}function je(e){if(!F(e))return null;let t=ke(e.said);return t===``?null:{said:t,preset:e.preset===!0}}function L(e,t){return e.map(e=>{let n=t.get(e.id),r=n?.chosen??[],i=n?.said??``;return{question:e.id,chosen:r,said:i,answered:r.length>0||i.trim()!==``}})}var R=50,z=600,Me={gate:`What should change?`,round:`Anything else?`,decision:`Your words`};function Ne(e){return e.split(`
13
- `).find(e=>e.trim()!==``)?.trim()??e}function Pe(e){let[t,n]=(0,C.useState)(()=>e.draft?.given??new Map),[r,i]=(0,C.useState)(()=>e.draft?.said??``),a=e.onDraft;(0,C.useEffect)(()=>{a({given:t,said:r})},[t,r,a]);let o=(0,C.useRef)(null),s=(0,C.useRef)(null);(0,C.useEffect)(()=>{let t=e.summon??0;if(!e.settled||s.current===t)return;s.current=t;let n=()=>o.current?.scrollIntoView?.({block:`start`}),r=setTimeout(n,R),i=[o.current?.parentElement,o.current?.previousElementSibling].filter(e=>e instanceof Element),a=typeof ResizeObserver==`function`&&i.length>0?new ResizeObserver(n):null;for(let e of i)a?.observe(e);let c=setTimeout(()=>a?.disconnect(),z);return()=>{clearTimeout(r),clearTimeout(c),a?.disconnect()}},[e.settled,e.summon]);let c=e.ask.kind===`gate`?e.ask.offer:null,[l,u]=(0,C.useState)(c?.preset===!0),d=e.ask.kind===`gate`?[]:e.ask.questions,f=(t,n=[])=>e.onAnswer({outcome:t,said:r.trim(),questions:n,accepted:t===`approved`&&c!==null&&l}),p=()=>{let n=e.ask.kind===`decision`&&d[0]!==void 0?new Map(t).set(d[0].id,{chosen:t.get(d[0].id)?.chosen??[],said:r.trim()}):t;f(`answered`,L(d,n))},m=(e,t,r)=>n(n=>{let i=new Map(n),a=i.get(e)??{chosen:[],said:``},o=r?a.chosen.includes(t)?a.chosen.filter(e=>e!==t):[...a.chosen,t]:[t];return i.set(e,{...a,chosen:o}),i}),h=(e,t)=>n(n=>{let r=new Map(n),i=r.get(e)??{chosen:[],said:``};return r.set(e,{...i,said:t}),r});return(0,D.jsxs)(`section`,{className:`ask`,"aria-label":e.title,ref:o,children:[(0,D.jsxs)(`div`,{className:`ask-head`,children:[(0,D.jsx)(`h2`,{children:e.title}),e.file!==``&&(0,D.jsxs)(`p`,{className:`ask-about`,children:[`about `,(0,D.jsx)(`b`,{children:e.file}),e.ask.kind===`decision`&&(0,D.jsxs)(D.Fragment,{children:[` › `,(0,D.jsx)(`b`,{children:e.ask.heading})]})]})]}),e.ask.kind===`gate`&&e.ask.asks!==``&&(0,D.jsx)(P,{className:`ask-asks`,source:e.ask.asks}),d.length>0&&(0,D.jsx)(`ol`,{className:`questions`,children:d.map(n=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(P,{className:`question-ask`,source:n.ask}),(0,D.jsx)(`ul`,{className:`choices`,children:n.options.map(e=>(0,D.jsx)(`li`,{className:e.recommended?`is-recommended`:void 0,children:(0,D.jsxs)(`label`,{children:[(0,D.jsx)(`input`,{type:n.multi?`checkbox`:`radio`,name:n.id,checked:t.get(n.id)?.chosen.includes(e.id)??!1,onChange:()=>m(n.id,e.id,n.multi)}),(0,D.jsxs)(`span`,{className:`choice-title`,children:[e.said,e.recommended&&(0,D.jsx)(`span`,{className:`choice-flag`,children:`recommended`})]})]})},e.id))}),e.ask.kind===`round`&&(0,D.jsx)(`textarea`,{className:`question-said`,value:t.get(n.id)?.said??``,placeholder:n.invite??`Your words`,"aria-label":`Anything to add about: ${Ne(n.ask)}`,onChange:e=>h(n.id,e.target.value)})]},n.id))}),(0,D.jsx)(`textarea`,{className:`field-dump`,value:r,placeholder:Me[e.ask.kind],"aria-label":e.ask.kind===`decision`?`Your words`:`Anything else`,onChange:e=>i(e.target.value)}),c!==null&&(0,D.jsxs)(`label`,{className:`ask-offer`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked)}),(0,D.jsx)(`span`,{children:c.said})]}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),e.asked!==null&&(0,D.jsxs)(`p`,{className:`ask-asked`,children:[`Asked in the terminal: “`,e.asked,`”. This is still waiting for your answer.`]}),(0,D.jsxs)(`div`,{className:`form-acts`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:e.onDismiss,children:`Later`}),(0,D.jsx)(`button`,{type:`button`,className:`ask-question`,disabled:e.sending||r.trim()===``,title:`Send this to the agent in the terminal, and answer nothing`,onClick:()=>void e.onAsk(r.trim()).then(e=>{e&&i(``)}),children:`Ask`}),e.ask.kind===`gate`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,disabled:e.sending||r.trim()===``,onClick:()=>f(`changes`),children:`Request changes`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,disabled:e.sending,onClick:()=>f(`approved`),children:`Approve`})]}),e.ask.kind!==`gate`&&(0,D.jsx)(`button`,{type:`button`,className:`send`,disabled:e.sending,onClick:p,children:e.sending?`Sending…`:`Submit`})]})]})}function Fe(){return`a-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ie(e,t,n=``){return{id:Fe(),unit:e.unit,file:e.file,heading:e.heading,kind:t,quote:e.quote,text:n}}function Le(e){return e.quote?`“${Re(e.quote)}”`:e.heading?`${e.file} - ${e.heading}`:e.file||`this spec`}function Re(e,t=80){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function ze(e){return e.filter(e=>e.kind===`remove`||e.text.trim()!==``)}function Be(e){return{queued:e.map(e=>e.id),comments:ze(e).map(e=>({unit:e.unit,file:e.file,heading:e.heading,kind:e.kind,quote:e.quote,text:e.text.trim(),assets:[]}))}}function Ve(e){let t=ze(e);if(t.length===0)return``;let n=t.filter(e=>e.kind===`remove`).length,r=t.length-n,i=[];r>0&&i.push(`${r} ${r===1?`comment`:`comments`}`),n>0&&i.push(`${n} to remove`);let a=t[0];return`${i.join(`, `)} - first on ${Le(a)}`}function He(){return{version:1,units:{},dismissed:[]}}function B(e){return{version:1,entry:e,annotations:[]}}var V=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ue=(e,t=``)=>typeof e==`string`?e:t;function We(e){let t;try{t=JSON.parse(e||`null`)}catch{return He()}if(!V(t)||t.version!==1)return He();let n=He();if(V(t.units))for(let[e,r]of Object.entries(t.units)){if(!V(r))continue;let t={};typeof r.readHash==`string`&&(t.readHash=r.readHash),typeof r.readAt==`string`&&(t.readAt=r.readAt),n.units[e]=t}return Array.isArray(t.dismissed)&&(n.dismissed=t.dismissed.filter(e=>typeof e==`string`)),n}function H(e,t){let n;try{n=JSON.parse(e||`null`)}catch{return B(t)}if(!V(n)||n.version!==1)return B(t);let r=[];if(Array.isArray(n.annotations))for(let e of n.annotations)!V(e)||typeof e.id!=`string`||typeof e.unit!=`string`||e.id===``||e.unit===``||r.push({id:e.id,unit:e.unit,file:Ue(e.file),heading:Ue(e.heading),kind:e.kind===`remove`?`remove`:`comment`,quote:Ue(e.quote),text:Ue(e.text)});return{version:1,entry:Ue(n.entry,t),annotations:r}}var Ge=`quality-review`,Ke=[{id:`exploration`,title:`High-level exploration`,group:`discovery`,about:`We think the problem through together first - directions to take, risks, and what is still unclear.`},{id:`interview`,title:`Interview`,group:`discovery`,about:`I ask you focused questions until nothing important is left open.`},{id:`research`,title:`Research`,group:`discovery`,about:`I look outside your code - a library, a protocol, an algorithm, a subject area - and write up what I find.`},{id:`codebase-analysis`,title:`Codebase analysis`,group:`discovery`,about:`I read the parts of your code this work touches and note what shapes the design.`},{id:`technical-specs`,title:`Technical specs`,group:`deliverables`,about:`A written specification another agent can build from without asking you anything.`},{id:`ui-mocks`,title:`UI mocks`,group:`deliverables`,about:`Mock screens you open in your browser and comment on before anything is built.`},{id:`execution-plan`,title:`Execution plan`,group:`deliverables`,about:`The work split into phases, each with a goal and a way to tell it is done.`},{id:Ge,title:`Specs quality review`,group:`deliverables`,about:`Fresh helper agents review everything we wrote, and I fix what is plainly wrong and bring the judgment calls to you.`}],U=[`exploration`,`ui-mocks`];function W(e){return Ke.find(t=>t.id===e)??null}function qe(e){return[...e].sort((e,t)=>e.startedAt===t.startedAt?0:e.startedAt?t.startedAt?e.startedAt<t.startedAt?-1:1:-1:1)}var Je=`final`;function Ye(e,t){if(e===`final`)return Je;let n=t.find(t=>t.id===e);return n===void 0?null:n.title}var Xe=[`consistency and completeness`,`principles alignment`,`better ways to do this`],G=[{id:`per-phase`,said:`a commit per phase`},{id:`single`,said:`a single commit at the end`},{id:`none`,said:`no commits`}],K=[{id:`current`,said:`the current branch`},{id:`new`,said:`a new branch`}],Ze=[{id:`none`,said:`none`},{id:`chosen`,said:`after chosen phases`},{id:`every`,said:`every phase`}];function Qe(e){return{commits:`per-phase`,branch:`current`,branchName:`spec/${e}`,pauses:`none`,pausePhases:[],checkpoints:[{after:Je,why:`judges the finished work as a whole`,panel:[...Xe],chosen:!0}]}}function $e(e,t=new Date){let{said:n,at:r}=e.activity;if(n===``||r===``||e.log.reduce((e,t)=>t.at>e?t.at:e,``)>r)return null;let i=Date.parse(r);return Number.isNaN(i)||t.getTime()-i>18e5?null:{said:n,at:r}}function q(e,t){return{version:1,name:e,created:t,status:`specifying`,protocol:[],modes:{imagination:!1},wish:{imagination:!1},stageSettings:{research:null},activity:{said:``,at:``},awaiting:[],phases:[],runRecommendations:null,runDecisions:null,reviews:[],approvals:[],log:[]}}var J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=(e,t=``)=>typeof e==`string`?e:t,et=(e,t,n)=>t.includes(e)?e:n,tt=[`specifying`,`ready`,`executing`,`complete`],nt=[`waiting`,`running`,`done`],X=[`gate`,`round`,`protocol`],rt=[`focused`,`named`,`broad`],it=G.map(e=>e.id),at=K.map(e=>e.id),ot=Ze.map(e=>e.id);function st(e){if(!J(e)||e.scope===void 0)return null;let t=et(e.scope,rt,`focused`);return{scope:t,subject:t===`named`?Z(Y(e.subject)):``}}function Z(e,t=200){return e.replace(/\p{C}+/gu,` `).replace(/\s+/g,` `).trim().slice(0,t)}function ct(e){if(!J(e))return null;let t=[];for(let n of Array.isArray(e.checkpoints)?e.checkpoints:[]){if(!J(n))continue;let e=Array.isArray(n.panel)?n.panel.filter(e=>typeof e==`string`).map(e=>Z(e)):[];t.push({after:p(Y(n.after)),why:Z(Y(n.why)),panel:e,chosen:n.chosen!==!1&&e.length>0})}return{commits:et(e.commits,it,`per-phase`),branch:et(e.branch,at,`current`),branchName:Z(Y(e.branchName)),pauses:et(e.pauses,ot,`none`),pausePhases:Array.isArray(e.pausePhases)?e.pausePhases.filter(e=>typeof e==`string`).map(e=>p(e)):[],checkpoints:t}}function lt(e){if(!J(e))return null;let t=ct(e);if(t===null)return null;let n={};if(J(e.pauseReasons))for(let[t,r]of Object.entries(e.pauseReasons)){if(typeof r!=`string`)continue;let e=Z(r);e!==``&&(n[p(t)]=e)}return{...t,pauseReasons:n,noPauseReason:Z(Y(e.noPauseReason))}}function ut(e,t=``,n=``){let r;try{r=JSON.parse(e||`null`)}catch{return q(t,n)}if(!J(r)||r.version!==1)return q(t,n);let i=q(Y(r.name,t),Y(r.created,n)),a=Y(r.status);if(tt.includes(a)&&(i.status=a),Array.isArray(r.protocol))for(let e of r.protocol){if(!J(e)||!W(Y(e.id)))continue;let t=Y(e.status);i.protocol.push({id:Y(e.id),status:nt.includes(t)?t:`waiting`,artifacts:Array.isArray(e.artifacts)?e.artifacts.filter(e=>typeof e==`string`):[],startedAt:Y(e.startedAt)})}if(J(r.modes)&&(i.modes.imagination=r.modes.imagination===!0),J(r.wish)&&(i.wish.imagination=r.wish.imagination===!0),J(r.stageSettings)&&(i.stageSettings={research:st(r.stageSettings.research)}),J(r.activity)&&(i.activity={said:Y(r.activity.said),at:Y(r.activity.at)}),Array.isArray(r.awaiting))for(let e of r.awaiting){if(!J(e)||!e.id)continue;let t=Y(e.kind);i.awaiting.push({id:Y(e.id),kind:X.includes(t)?t:`round`,title:Y(e.title),file:Y(e.file),payload:Y(e.payload),declaredAt:Y(e.declaredAt)})}if(Array.isArray(r.phases))for(let e of r.phases){if(!J(e)||!e.id)continue;let t=Y(e.status);i.phases.push({id:Y(e.id),title:Y(e.title),status:nt.includes(t)?t:`waiting`})}i.runRecommendations=lt(r.runRecommendations);let o=ct(r.runDecisions);if(o!==null&&J(r.runDecisions)&&(i.runDecisions={...o,decidedAt:Y(r.runDecisions.decidedAt)}),Array.isArray(r.reviews))for(let e of r.reviews)!J(e)||typeof e.round!=`number`||i.reviews.push({round:e.round,verdict:Y(e.verdict),findings:typeof e.findings==`number`?e.findings:0,judgments:typeof e.judgments==`number`?e.judgments:0,source:Oe(e.source),at:Y(e.at)});if(Array.isArray(r.approvals))for(let e of r.approvals)!J(e)||!e.id||i.approvals.push({id:Y(e.id),at:Y(e.at),outcome:Y(e.outcome)});if(Array.isArray(r.log))for(let e of r.log)J(e)&&i.log.push({at:Y(e.at),said:Y(e.said)});return i}var Q=h(`specs`);Q.receive;var dt=Q.credentialsReady,ft=Q.onChange,pt=Q.onSession,mt=Q.openOutside,ht=Q.deliver,gt=Q.sayWaiting,_t=Q.listen;function vt(e){return Q.askTheme(e)}var yt=ee({prefix:`specs`,label:`Specs`,credentialsReady:dt});yt.keyHeader;var $=yt.ask;function bt(){return $(`dashboard`)}function xt(e){return $(`entry?path=${encodeURIComponent(e)}`)}function St(e){return $(`archive?entry=${encodeURIComponent(e)}`,{method:`POST`})}function Ct(e){return $(`file?path=${encodeURIComponent(e)}`)}async function wt(e){let t=await $(`state?entry=${encodeURIComponent(e)}`);return We(JSON.stringify(t))}function Tt(e,t){return $(`state?entry=${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}async function Et(e){let t=await $(`pending?entry=${encodeURIComponent(e)}`);return H(JSON.stringify(t),e).annotations}function Dt(e,t){return $(`pending?entry=${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...B(e),annotations:t})})}function Ot(e){return $(`feedback?entry=${encodeURIComponent(e)}`)}function kt(e,t){return $(`feedback?entry=${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}async function At(e){let t=await $(`protocol?entry=${encodeURIComponent(e)}`);return ut(JSON.stringify(t))}function jt(e,t){return $(`round?entry=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`)}function Mt(e){return $(`intake`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}async function Nt(e,t){let n=await $(`confirm?entry=${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return{state:ut(JSON.stringify(n.state)),change:n.change}}async function Pt(e,t){let n=await $(`decide?entry=${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});return ut(JSON.stringify(n))}function Ft(e,t,n){return $(`answer?entry=${encodeURIComponent(e)}&id=${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})}var It=yt.rawUrl;yt.fileUrl;var Lt=`archive`;function Rt(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function zt(e,t){let n=e.split(`/`).pop()??e;return`${Lt}/${Rt(t)}-${n}`}var Bt=30,Vt=108,Ht=8,Ut=240;function Wt(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function Gt({unit:e,state:t,name:n,onToggle:r}){let i=t?.read??!1;return(0,D.jsxs)(`button`,{type:`button`,className:`mark`,"aria-pressed":i,title:i?`Mark as unread`:`Mark as read`,onClick:()=>r(e),children:[`✓`,(0,D.jsxs)(`span`,{className:`visually-hidden`,children:[i?`Mark as unread`:`Mark as read`,`: `,n]})]})}function Kt({at:e,onPick:t,onDismiss:r}){return(0,D.jsxs)(`div`,{className:`annotate`,style:{top:e.top,left:e.left},children:[(0,D.jsxs)(`button`,{type:`button`,className:`annotate-drop`,title:`Ask for this to be removed`,onClick:()=>t(`remove`),children:[(0,D.jsx)(n,{}),(0,D.jsx)(`span`,{className:`visually-hidden`,children:`Ask for this to be removed`})]}),(0,D.jsxs)(`button`,{type:`button`,title:`Say something about this`,onClick:()=>t(`comment`),children:[(0,D.jsx)(d,{}),(0,D.jsx)(`span`,{className:`visually-hidden`,children:`Say something about this`})]}),(0,D.jsxs)(`button`,{type:`button`,className:`annotate-close`,title:`Dismiss`,onClick:r,children:[(0,D.jsx)(m,{}),(0,D.jsx)(`span`,{className:`visually-hidden`,children:`Dismiss`})]})]})}function qt({at:e,onAdd:t,onDismiss:n}){let[r,i]=(0,C.useState)(``),a=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let e=e=>{let t=e.target;t!==null&&a.current?.contains(t)===!0||n()},t=e=>{e.key===`Escape`&&n()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,D.jsxs)(`div`,{className:`annotate-composer`,style:{top:e.top,left:e.left},ref:a,children:[(0,D.jsx)(`p`,{className:`composer-target`,children:e.quote===``?e.name:`“${e.quote}”`}),(0,D.jsx)(`textarea`,{autoFocus:!0,value:r,placeholder:`What about it?`,"aria-label":`Your comment`,onChange:e=>i(e.target.value)}),(0,D.jsxs)(`div`,{className:`composer-acts`,children:[(0,D.jsx)(`button`,{type:`button`,className:`composer-cancel`,onClick:n,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`composer-add`,disabled:r.trim()===``,onClick:()=>t(r.trim()),children:`Add`})]})]})}function Jt(e){let{entry:t,file:n,units:r,text:i,marks:a,raw:o,landOn:c,onLanded:l,onCurrent:u,onOpen:f,onLeave:p}=e,m=Wt(n.path),h=(0,C.useRef)(null),g=(0,C.useCallback)(e=>{let n=x(m,e);return n===null?null:It(o,t?`${t}/${n}`:n)},[m,t,o]),_=r[0],ee=(0,C.useMemo)(()=>{let e=It(o,t?`${t}/${n.path}`:n.path);return _===void 0?e:`${e}?v=${encodeURIComponent(_.hash)}`},[t,n.path,o,_]),[te,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(null),ne=(0,C.useCallback)(()=>b(null),[]),re=(0,C.useCallback)(e=>{let t=h.current,n=t===null?e.left:t.clientWidth+t.scrollLeft-Ut;b({...e,left:Math.max(0,Math.min(e.left,n))})},[]),w=`${e.reader}/${t}/${n.path}`,ie=(0,C.useRef)(w);(0,C.useEffect)(()=>{ie.current!==w&&(ie.current=w,v(null),b(null))},[w]);let ae=(0,C.useCallback)(e=>{let t=(e instanceof Element?e:e?.parentElement)?.closest?.(`[data-unit]`),n=t instanceof HTMLElement?t.dataset.unit:void 0;return r.find(e=>e.id===n)??null},[r]),T=e.onAnnotate,E=T!==null,oe=(0,C.useCallback)((e,t,r,i)=>{let a=h.current;if(!a||!E)return;let o=a.getBoundingClientRect(),s=e.top-o.top+a.scrollTop,c=e.left-o.left+a.scrollLeft,l=s-a.scrollTop>=38;v({unit:t?.id??_?.id??``,file:n.path,heading:t?.heading??``,quote:r,name:i,top:l?s-Bt-Ht:s+e.height+Ht,left:Math.max(0,Math.min(c,a.clientWidth+a.scrollLeft-Vt))})},[E,n.path,_]);(0,C.useEffect)(()=>{let e=h.current;if(!e||typeof IntersectionObserver!=`function`)return;let t=[...e.querySelectorAll(`[data-unit]`)];if(t.length===0)return;let n=new Map,r=new IntersectionObserver(e=>{for(let t of e)n.set(t.target.getAttribute(`data-unit`)??``,t);let t=[...n.values()].filter(e=>e.isIntersecting).sort((e,t)=>e.boundingClientRect.top-t.boundingClientRect.top)[0]?.target.getAttribute(`data-unit`);t&&u(t)},{root:e,rootMargin:`0px 0px -65% 0px`,threshold:0});for(let e of t)r.observe(e);return()=>r.disconnect()},[u,r]),(0,C.useEffect)(()=>{if(c===null)return;let e=[...h.current?.querySelectorAll(`[data-unit]`)??[]].find(e=>e.dataset.unit===c);e&&(e.scrollIntoView?.({block:`start`}),l())},[c,l,r]),(0,C.useEffect)(()=>{let e=h.current;if(!e)return;let t=t=>{if(t.target?.closest?.(`.annotate, .annotate-composer`))return;let n=document.getSelection(),r=n?.toString()??``;if(!n||n.isCollapsed||r.trim()===``){v(null);return}let i=n.anchorNode;if(!i||!e.contains(i))return;let a=n.getRangeAt(0).getBoundingClientRect();oe(a,ae(i),r,r)};return e.addEventListener(`mouseup`,t),()=>e.removeEventListener(`mouseup`,t)},[oe,ae]),(0,C.useEffect)(()=>{let e=h.current;if(!e)return;let t=e=>{let t=e.target;if(t instanceof HTMLImageElement){e.preventDefault(),oe(t.getBoundingClientRect(),ae(t),``,t.alt||n.name);return}let r=t?.closest?.(`a`);if(!r)return;let i=r.getAttribute(`href`);if(i===null)return;e.preventDefault();let[a,o=``]=i.split(`#`);if(a===``){f(n.path,o);return}let s=x(m,a);if(s!==null){f(s,o);return}let c=S(a);c!==null&&p(c)};return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[m,n.name,n.path,p,f,oe,ae]);let se=e.failure===null&&!e.loading,ce=r.filter(e=>a[e.id]?.read).length,le=r.filter(e=>a[e.id]?.changed).length;return(0,D.jsxs)(`div`,{className:`doc`,ref:h,children:[te!==null&&T!==null&&(0,D.jsx)(Kt,{at:te,onPick:e=>{e===`comment`?re(te):T(te,e),v(null),document.getSelection()?.removeAllRanges()},onDismiss:()=>v(null)}),y!==null&&T!==null&&(0,D.jsx)(qt,{at:y,onAdd:e=>{T(y,`comment`,e),b(null)},onDismiss:ne}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),e.failure===null&&e.loading&&(0,D.jsxs)(`p`,{className:`notice`,children:[`Reading `,n.name,`…`]}),se&&(0,D.jsxs)(`div`,{className:`doc-facts`,children:[(0,D.jsxs)(`span`,{children:[n.path,` · `,s(n.size)]}),r.length>0&&(0,D.jsxs)(`span`,{children:[`· `,ce,` of `,r.length,` read`]}),le>0&&(0,D.jsxs)(`span`,{className:`doc-changed`,children:[`· `,le,` changed since you read `,le===1?`it`:`them`]}),n.kind!==`markdown`&&_!==void 0&&(0,D.jsx)(Gt,{unit:_,state:a[_.id],name:n.name,onToggle:e.onToggleRead}),E&&(0,D.jsx)(`span`,{className:`doc-facts-acts`,children:(0,D.jsxs)(`button`,{type:`button`,className:`annotate-whole`,title:`Say something about this artifact`,onClick:e=>oe(e.currentTarget.getBoundingClientRect(),_??null,``,n.name),children:[(0,D.jsx)(d,{size:13}),(0,D.jsx)(`span`,{className:`visually-hidden`,children:`Say something about this artifact`})]})})]}),se&&n.kind===`markdown`&&r.map(t=>{let r=a[t.id];return(0,D.jsxs)(C.Fragment,{children:[(0,D.jsxs)(`section`,{"data-unit":t.id,className:`doc-section${r?.read?` is-read`:``}`,children:[(0,D.jsx)(`div`,{className:`sec-mark`,children:(0,D.jsx)(Gt,{unit:t,state:r,name:t.heading??n.name,onToggle:e.onToggleRead})}),t.heading!==null&&(0,D.jsxs)(`h2`,{children:[t.heading,r?.changed&&(0,D.jsx)(`span`,{className:`sec-changed`,children:`changed since you read it`})]}),t.heading===null&&r?.changed&&(0,D.jsx)(`p`,{className:`sec-changed`,children:`changed since you read it`}),(0,D.jsx)(P,{source:t.body,imageUrl:g})]}),e.under?.unit===t.id&&e.under.node]},t.id)}),se&&n.kind===`html`&&(0,D.jsx)(`iframe`,{className:`art-frame`,title:n.name,src:ee,sandbox:`allow-scripts allow-forms`,referrerPolicy:`no-referrer`}),se&&n.kind===`image`&&(0,D.jsx)(`p`,{className:`art-image`,children:(0,D.jsx)(`img`,{src:ee,alt:n.name})}),se&&n.kind===`text`&&(0,D.jsx)(`pre`,{className:`plain`,children:i??``}),se&&n.kind===`binary`&&(0,D.jsxs)(`p`,{className:`notice`,children:[n.name,` is `,s(n.size),` of something this tool does not render. It is in the spec directory, where the agent beside you can read it.`]})]})}function Yt(e){let t=(0,C.useId)();return(0,D.jsxs)(`div`,{className:e.className??`run-field`,children:[(0,D.jsx)(`span`,{id:t,children:e.label}),(0,D.jsxs)(`div`,{className:`run-with`,children:[(0,D.jsx)(`select`,{"aria-labelledby":t,value:e.value,onChange:t=>e.onPick(t.target.value),children:e.options.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.said},e.id))}),e.children]})]})}function Xt(e){let t=Qe(e.slug),n=e.decided??e.recommended??t;return{...n,branchName:n.branchName||t.branchName}}var Zt=0,Qt=()=>`k${++Zt}`;function $t(e){return e.map(e=>({key:Qt(),after:e.after,why:e.why,chosen:e.chosen,panel:e.panel.map(e=>({key:Qt(),focus:e})),typing:``}))}function en(e){return[...e.panel.map(e=>e.focus),e.typing].map(e=>e.trim()).filter(e=>e!==``)}function tn(e){return e.map(e=>({after:e.after,why:e.why,chosen:e.chosen,panel:en(e)}))}function nn(e){let[t]=(0,C.useState)(()=>Xt(e)),[n,r]=(0,C.useState)(t.commits),[a,o]=(0,C.useState)(t.branch),[s,c]=(0,C.useState)(t.branchName),[l,u]=(0,C.useState)(t.pauses),[d,f]=(0,C.useState)(t.pausePhases),[p,h]=(0,C.useState)(()=>$t(t.checkpoints)),g=e.decided!==null,_=g?null:e.recommended,ee=e.phases.filter(e=>e.status===`done`).length,te=e.phases.length>0,v=d.filter(t=>!e.phases.some(e=>e.id===t)),y=_?.pauses===`chosen`?_.pausePhases.map(t=>({id:t,place:Ye(t,e.phases)??t,said:Object.hasOwn(_.pauseReasons,t)?_.pauseReasons[t]:``})).filter(e=>e.said!==``):[],b=_?.pauses===`none`?_.noPauseReason:``,ne=(l===`chosen`?v.length:0)+p.filter(t=>t.chosen&&Ye(t.after,e.phases)===null).length,x=(e,t)=>e.map(e=>e.id===t&&_!==null?{...e,said:`${e.said} (recommended)`}:e),S=(e,t)=>h(n=>n.map(n=>n.key===e?t(n):n)),re=e=>e.typing.trim()===``?e:{...e,panel:[...e.panel,{key:Qt(),focus:e.typing.trim()}],typing:``},w=(e,t)=>S(e,e=>{let n=e.panel.find(e=>e.key===t),r=re(e);return{...r,panel:r.panel.filter(e=>e.key!==t),typing:n?.focus??r.typing}});return(0,D.jsx)(`div`,{className:`dialog-shade`,children:(0,D.jsxs)(`div`,{className:`dialog dialog-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`Execute this spec`,children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Execute this spec`}),(0,D.jsxs)(`div`,{className:`dialog-body`,children:[(0,D.jsxs)(`p`,{className:`rail-fact muted`,children:[`Set up the run for `,(0,D.jsx)(`b`,{children:e.name}),`.`,_!==null&&` Pre-filled from the recommendations in the plan - change anything.`]}),g&&(0,D.jsxs)(`p`,{className:`run-banner`,children:[(0,D.jsx)(`b`,{children:`Resuming a run in progress.`}),` `,(0,D.jsxs)(`span`,{className:`muted`,children:[ee,` of `,e.phases.length,` phases done - these are the choices this run started with.`]})]}),(0,D.jsx)(Yt,{label:`Commits`,options:x(G,_?.commits),value:n,onPick:r}),(0,D.jsx)(Yt,{label:`Branch`,options:x(K,_?.branch),value:a,onPick:o,children:a===`new`&&(0,D.jsx)(`input`,{value:s,"aria-label":`The branch to make`,onChange:e=>c(e.target.value)})}),(0,D.jsx)(Yt,{label:`Pauses`,options:x(Ze.filter(e=>e.id!==`chosen`||te),_?.pauses),value:l,onPick:u}),(l===`chosen`||y.length>0||b!==``)&&(0,D.jsxs)(`div`,{className:`run-phases`,children:[l===`chosen`&&(0,D.jsxs)(D.Fragment,{children:[e.phases.map(e=>(0,D.jsxs)(`label`,{children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:d.includes(e.id),onChange:()=>f(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])}),e.title]},e.id)),v.map(e=>(0,D.jsxs)(`p`,{className:`run-stale`,children:[e,` is not in the plan any more - re-place this pause`]},e))]}),y.map(e=>(0,D.jsxs)(`p`,{className:`run-why`,children:[(0,D.jsxs)(`b`,{children:[`After `,e.place,`:`]}),` `,e.said]},e.id)),b!==``&&(0,D.jsxs)(`p`,{className:`run-why`,children:[(0,D.jsx)(`b`,{children:`No pause recommended:`}),` `,b]})]}),(0,D.jsx)(`h3`,{className:`run-head`,children:`Review checkpoints`}),p.length===0&&(0,D.jsx)(`p`,{className:`rail-fact muted`,children:`None proposed.`}),p.map(t=>{let n=Ye(t.after,e.phases),r=n===null?`somewhere the plan no longer holds`:`after ${n}`;return(0,D.jsxs)(`div`,{className:`run-checkpoint`,children:[(0,D.jsxs)(`label`,{className:`run-checkpoint-head`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:t.chosen,onChange:()=>S(t.key,e=>({...e,chosen:!e.chosen}))}),(0,D.jsx)(`span`,{children:r})]}),t.why!==``&&(0,D.jsx)(`p`,{className:`run-why`,children:t.why}),t.chosen&&n===null&&(0,D.jsx)(`p`,{className:`run-stale`,children:`This checkpoint has nowhere to sit - untick it, or re-place it in the plan`}),t.chosen&&en(t).length===0&&(0,D.jsx)(`p`,{className:`run-stale`,children:`Nobody is on this panel, so this checkpoint will not run`}),(0,D.jsxs)(`div`,{className:`run-panel`,children:[t.panel.map((e,n)=>(0,D.jsxs)(`span`,{className:`run-reviewer`,children:[(0,D.jsx)(`button`,{type:`button`,className:`run-focus`,title:`Change this reviewer`,onClick:()=>w(t.key,e.key),children:e.focus}),(0,D.jsx)(`button`,{type:`button`,className:`run-drop`,"aria-label":`Drop reviewer ${n+1} ${r}`,onClick:()=>S(t.key,t=>({...t,panel:t.panel.filter(t=>t.key!==e.key)})),children:(0,D.jsx)(m,{size:11})})]},e.key)),(0,D.jsxs)(`span`,{className:`run-new`,children:[(0,D.jsx)(`input`,{value:t.typing,"aria-label":`New reviewer ${r}`,placeholder:`What the next reviewer judges`,onChange:e=>S(t.key,t=>({...t,typing:e.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S(t.key,re))}}),(0,D.jsxs)(`button`,{type:`button`,"aria-label":`Add a reviewer ${r}`,onClick:()=>S(t.key,re),children:[(0,D.jsx)(i,{size:11}),`add`]})]})]})]},t.key)})]}),ne>0&&(0,D.jsxs)(`p`,{className:`notice notice-failure`,children:[ne===1?`One choice names`:`${ne} choices name`,` a phase this plan no longer holds. Re-place `,ne===1?`it`:`them`,` before you run.`]}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),(0,D.jsxs)(`div`,{className:`dialog-acts`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:e.onCancel,disabled:e.working,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,disabled:e.working||ne>0,onClick:()=>e.onRun({commits:n,branch:a,branchName:s.trim(),pauses:l,pausePhases:l===`chosen`?d:[],checkpoints:tn(p)}),children:e.working?`Starting…`:g?`Resume`:`Run`})]})]})})}function rn(e){return new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(Error(`${e.name} could not be read`)),r.onload=()=>{let n=String(r.result??``);t({name:e.name,type:e.type,data:n.slice(n.indexOf(`,`)+1)})},r.readAsDataURL(e)})}var an=0;function on(e){let[t,n]=(0,C.useState)(()=>e.draft?.name??``),[r,i]=(0,C.useState)(()=>e.draft?.text??``),[a,o]=(0,C.useState)(()=>e.draft?.attachments??[]),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(()=>e.draft?.imagination===!0),d=e.onDraft;(0,C.useEffect)(()=>{d({name:t,text:r,attachments:a,imagination:l})},[t,r,a,l,d]);let f=(0,C.useCallback)(async e=>{let t=[...e??[]];if(t.length!==0){c(null);try{let e=await Promise.all(t.map(rn));o(t=>[...t,...e.map(e=>(an+=1,{key:`f${an}`,file:e}))])}catch(e){c(e.message)}}},[]),m=t.trim()!==``&&(r.trim()!==``||a.length>0),h=p(t.trim());return(0,D.jsx)(`div`,{className:`dialog-shade`,children:(0,D.jsxs)(`div`,{className:`dialog dialog-wide`,role:`dialog`,"aria-modal":`true`,"aria-label":`A new spec`,children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`A new piece of work`}),(0,D.jsxs)(`div`,{className:`dialog-body`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Working name`}),(0,D.jsx)(`input`,{value:t,placeholder:`What would you call it?`,onChange:e=>n(e.target.value)}),h!==``&&(0,D.jsxs)(`span`,{className:`field-slug`,children:[`Saved as `,(0,D.jsx)(`code`,{children:h})]})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`What is it about?`}),(0,D.jsx)(`textarea`,{className:`field-dump`,value:r,placeholder:`Say as much or as little as you have. Drop or paste files in here too.`,onChange:e=>i(e.target.value),onPaste:e=>void f(e.clipboardData?.files??null),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),f(e.dataTransfer?.files??null)}})]}),a.length>0&&(0,D.jsx)(`ul`,{className:`attached`,children:a.map(e=>(0,D.jsxs)(`li`,{children:[e.file.name,(0,D.jsx)(`button`,{type:`button`,onClick:()=>o(t=>t.filter(t=>t.key!==e.key)),children:`drop`})]},e.key))}),(0,D.jsxs)(`label`,{className:`flavour`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:l,onChange:()=>u(!l)}),(0,D.jsxs)(`span`,{className:`flavour-what`,children:[`Imagination mode`,(0,D.jsx)(`span`,{className:`flavour-hint`,children:`Explore the ideal version first, before feasibility - best for open-ended or user-facing work. Confirmed with the steps.`})]})]})]}),s!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:s}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),(0,D.jsxs)(`div`,{className:`dialog-acts`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:e.onCancel,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,disabled:!m||e.filing,onClick:()=>void e.onFile({name:t.trim(),text:r.trim(),attachments:a.map(e=>e.file),wish:{imagination:l}}),children:e.filing?`Submitting…`:`Submit`})]})]})})}function sn(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.dir===n.dir?e.files.push(n):t.push({dir:n.dir,files:[n]})}return t}function cn(e){return e.openSpec===null?(0,D.jsx)(ln,{...e}):(0,D.jsx)(un,{...e})}function ln(e){let t=e.specs.filter(e=>!e.archived),n=e.specs.filter(e=>e.archived),r=t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,className:`nav-entry`,onClick:()=>e.onOpenSpec(t.path),children:[(0,D.jsx)(`span`,{className:`nav-entry-name`,children:t.name}),t.status!==null&&(0,D.jsx)(`span`,{className:`nav-entry-status`,children:t.status}),t.awaiting>0&&(0,D.jsx)(`span`,{className:`nav-entry-awaiting`,title:`waiting for you`,children:t.awaiting})]})},t.path);return(0,D.jsxs)(`nav`,{className:`nav`,"aria-label":`Specs`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`nav-new`,onClick:e.onNewSpec,children:[(0,D.jsx)(i,{size:12}),`New spec`]}),(0,D.jsx)(`h2`,{className:`nav-head`,children:`Specs`}),t.length===0?(0,D.jsx)(`p`,{className:`nav-empty`,children:`none yet`}):(0,D.jsx)(`ul`,{className:`nav-list`,children:t.map(r)}),n.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h2`,{className:`nav-head`,children:`Archive`}),(0,D.jsx)(`ul`,{className:`nav-list nav-archived`,children:n.map(r)})]})]})}function un(e){let t=e.spec?.name??e.openSpec??``;return(0,D.jsxs)(`nav`,{className:`nav`,"aria-label":t,children:[(0,D.jsxs)(`button`,{type:`button`,className:`nav-back`,onClick:e.onBack,children:[(0,D.jsx)(_,{size:11}),`All specs`]}),(0,D.jsxs)(`div`,{className:`nav-title`,children:[(0,D.jsx)(`div`,{className:`nav-title-name`,children:t}),e.spec?.status!=null&&(0,D.jsx)(`div`,{className:`nav-title-status`,children:e.spec.status})]}),sn(e.artifacts).map(t=>(0,D.jsxs)(`div`,{children:[t.dir!==``&&(0,D.jsxs)(`p`,{className:`nav-dir`,children:[t.dir,`/`]}),(0,D.jsx)(`ul`,{className:`nav-list`,children:t.files.map(t=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`button`,{type:`button`,className:`nav-artifact`,"aria-current":t.path===e.openArtifact?`true`:void 0,onClick:()=>e.onOpenArtifact(t.path),children:t.name}),t.path===e.openArtifact&&e.units.length>1&&(0,D.jsx)(`ul`,{className:`nav-sections`,children:e.units.filter(e=>e.heading!==null).map(t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(`button`,{type:`button`,className:e.marks[t.id]?.read?`is-read`:void 0,"aria-current":t.id===e.currentUnit?`true`:void 0,onClick:()=>e.onOpenUnit(t.id),children:[t.heading,e.marks[t.id]?.changed&&(0,D.jsx)(`span`,{className:`nav-changed`,title:`Changed since you read it`,children:`●`})]})},t.id))})]},t.path))})]},t.dir||`.`))]})}var dn=[{id:`discovery`,head:`Before writing anything down`,said:`What we do first.`},{id:`deliverables`,head:`What this work produces`,said:`What we end up with.`}],fn=[{id:`focused`,said:`focused - the agent decides what to research`},{id:`named`,said:`focused on...`},{id:`broad`,said:`broad - deep research, can use many tokens`}];function pn(e){return new Map(e.stages.map(e=>[e.id,e]))}function mn(e){let t=(0,C.useMemo)(()=>pn(e.proposal),[e.proposal]),{held:n}=e,[r,i]=(0,C.useState)(()=>n===null?new Set([...t.values()].filter(e=>e.recommended).map(e=>e.id)):new Set(n.stages.map(e=>e.id))),[a,o]=(0,C.useState)(n===null?e.wish:n.imagination),[s,c]=(0,C.useState)(n?.settings.research?.scope??`focused`),[l,u]=(0,C.useState)(n?.settings.research?.subject??``),[d,f]=(0,C.useState)(``),p=U.some(e=>r.has(e)),m=n===null&&e.wish,h=(0,C.useMemo)(()=>new Set((n?.stages??[]).filter(e=>e.status!==`waiting`).map(e=>e.id)),[n]),g=e=>{h.has(e)||i(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},_=(0,C.useMemo)(()=>{if(n===null)return!0;let e=new Set(n.stages.map(e=>e.id));if(e.size!==r.size||![...r].every(t=>e.has(t))||(a&&p)!==n.imagination)return!0;if(r.has(`research`)){let e=n.settings.research??{scope:`focused`,subject:``};if(s!==e.scope||s===`named`&&l.trim()!==e.subject)return!0}return!1},[n,r,a,p,s,l]);return(0,D.jsx)(`div`,{className:`doc`,children:(0,D.jsxs)(`div`,{className:`prose form`,children:[(0,D.jsxs)(`h1`,{children:[`The steps for `,e.name]}),n===null?e.proposal.note!==``&&(0,D.jsx)(`p`,{className:`lede`,children:e.proposal.note}):(0,D.jsx)(`p`,{className:`lede`,children:`Change what this work does. A step already under way stays where it is.`}),dn.map(e=>(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{children:e.head}),(0,D.jsx)(`ul`,{className:`choices`,children:Ke.filter(t=>t.group===e.id).map(e=>{let n=t.get(e.id),i=h.has(e.id);return(0,D.jsxs)(`li`,{className:n?.recommended?`is-recommended`:void 0,children:[(0,D.jsxs)(`label`,{children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:r.has(e.id),disabled:i,onChange:()=>g(e.id)}),(0,D.jsxs)(`span`,{className:`choice-title`,children:[e.title,n?.recommended&&(0,D.jsx)(`span`,{className:`choice-flag`,children:`recommended`}),i&&(0,D.jsx)(`span`,{className:`choice-flag choice-locked`,children:`under way`})]})]}),(0,D.jsx)(`p`,{className:`choice-about`,children:e.about}),n?.why!==void 0&&n.why!==``&&(0,D.jsx)(`p`,{className:`choice-why`,children:n.why}),e.id===`research`&&r.has(e.id)&&(0,D.jsx)(`div`,{className:`extras`,children:(0,D.jsx)(Yt,{className:`extra`,label:`Scope`,options:fn,value:s,onPick:c,children:s===`named`&&(0,D.jsx)(`input`,{value:l,"aria-label":`What to research`,placeholder:`What to research`,onChange:e=>u(e.target.value)})})})]},e.id)})})]},e.id)),p&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{children:`Imagination mode`}),(0,D.jsxs)(`label`,{className:`choice-mode`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:a,onChange:e=>o(e.target.checked)}),(0,D.jsxs)(`span`,{children:[`Imagine the ideal version first, as if anything were possible - trimming it back to what can be built comes after. Best while you are still deciding what this should be.`,m&&(0,D.jsx)(`span`,{className:`choice-flag`,children:`asked for at intake`})]})]})]}),(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{children:`Anything else`}),(0,D.jsx)(`textarea`,{className:`field-dump`,value:d,placeholder:`Anything the steps above do not cover.`,onChange:e=>f(e.target.value)})]}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure}),(0,D.jsxs)(`div`,{className:`form-acts`,children:[e.onCancel!==null&&(0,D.jsx)(`button`,{type:`button`,onClick:e.onCancel,children:`Cancel`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>e.onAsk(d.trim()||`about the steps for this work`),children:`Ask`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,disabled:e.sending||r.size===0||!_,onClick:()=>e.onConfirm({stages:[...r],imagination:a&&p,note:d,settings:{research:r.has(`research`)?{scope:s,subject:s===`named`?l.trim():``}:null}}),children:e.sending?n===null?`Confirming…`:`Updating…`:n===null?`Confirm ${r.size} ${r.size===1?`step`:`steps`}`:`Update protocol`})]})]})})}var hn={waiting:`○`,running:`◐`,done:`●`},gn=6e4;function _n(e,t){let n=new Set([...e.phases.map(e=>e.id),Je]),r=[];for(let n of e.phases){if(n.id===`final`)continue;let e=t.get(n.id)??[];e.length>0&&r.push({id:n.id,place:`after ${n.title||n.id}`,rounds:e})}let i=t.get(`final`)??[];i.length>0&&r.push({id:Je,place:`Final review`,rounds:i});let a=e.reviews.filter(e=>e.source.kind===`execution`||e.source.kind===`checkpoint`&&!n.has(e.source.after));return a.length>0&&r.push({id:`no-place`,place:``,rounds:a}),r}function vn(e){let t=new Map;for(let n of e.reviews){if(n.source.kind!==`checkpoint`)continue;let e=t.get(n.source.after);e===void 0?t.set(n.source.after,[n]):e.push(n)}return t}function yn(e,t){let n=e.runDecisions,r=e=>t.has(e),i=(n?.checkpoints??[]).filter(e=>e.chosen),a=e.phases.map(e=>{let t=[];if(n!==null&&((n.pauses===`every`||n.pauses===`chosen`&&n.pausePhases.includes(e.id))&&t.push({kind:`pause`,said:`Pause after this phase`}),i.some(t=>t.after===e.id))){let n=r(e.id);t.push({kind:`review`,ran:n,said:n?`Reviewed after this phase`:`Review after this phase`})}return{id:e.id,label:e.title||e.id,status:e.status,artifacts:[],marks:t}});if(i.some(e=>e.after===`final`)&&a.length>0){let e=r(Je);a.push({id:Je,label:`Final review`,status:e?`done`:`waiting`,artifacts:[],className:`board-final`,marks:[{kind:`review`,ran:e,said:e?`Reviewed after the last phase`:`Review after the last phase`}]})}return a}function bn(e){return(0,D.jsx)(`ul`,{className:`board-list`,children:e.map(e=>(0,D.jsxs)(`li`,{className:`board-review`,children:[(0,D.jsxs)(`p`,{className:`board-stage-name`,children:[`round `,e.round,`: `,e.verdict]}),(0,D.jsxs)(`p`,{className:`rail-fact muted`,children:[e.findings,` `,e.findings===1?`finding`:`findings`,e.judgments>0?`, ${e.judgments} for you`:``]})]},`${xn(e.source)}-${e.round}-${e.at}`))})}function xn(e){return e.kind===`checkpoint`?`checkpoint:${e.after}`:e.kind}function Sn(e){let{flag:t}=e,n=t.kind===`pause`?``:t.ran?` is-ran`:` is-waiting`,r=f({className:`board-tip`,side:`bottom`,delay:250});return(0,D.jsxs)(`span`,{className:`board-flag${n}`,...r.anchor,children:[t.kind===`pause`?(0,D.jsx)(b,{size:13}):(0,D.jsx)(y,{size:13}),(0,D.jsx)(`span`,{className:`visually-hidden`,children:t.said}),r.says(t.said)]})}function Cn(e){let{row:t}=e,n=(0,D.jsx)(`span`,{className:`board-mark`,"aria-hidden":`true`,children:hn[t.status]}),r=t.artifacts.length===1?t.artifacts[0]:null,i=t.artifacts.length>1;return(0,D.jsxs)(`li`,{className:`board-stage is-${t.status}${t.className?` ${t.className}`:``}`,children:[(0,D.jsxs)(`p`,{className:`board-stage-name`,children:[n,r!==null&&(0,D.jsx)(`button`,{type:`button`,title:`Open ${r}`,onClick:()=>e.onOpen(r),children:t.label}),i&&(0,D.jsxs)(`button`,{type:`button`,"aria-expanded":e.open,onClick:e.onFold,children:[t.label,(0,D.jsx)(`span`,{className:`board-chevron`,"aria-hidden":`true`,children:e.open?`▾`:`▸`})]}),r===null&&!i&&t.label,t.marks!==void 0&&t.marks.length>0&&(0,D.jsx)(`span`,{className:`board-marks`,children:t.marks.map(e=>(0,D.jsx)(Sn,{flag:e},e.kind))})]}),i&&e.open&&(0,D.jsx)(`ul`,{className:`board-artifacts`,children:t.artifacts.map(t=>(0,D.jsx)(`li`,{children:(0,D.jsx)(`button`,{type:`button`,onClick:()=>e.onOpen(t),children:t})},t))})]})}function wn(e){let{state:t}=e,n=t.awaiting.length>0,[r,i]=(0,C.useState)({}),o=e=>i(t=>({...t,[e]:!t[e]})),[s,c]=(0,C.useState)(()=>new Date),l=t.activity.said!==``;(0,C.useEffect)(()=>{if(!l)return;let e=setInterval(()=>c(new Date),gn);return()=>clearInterval(e)},[l]);let u=$e(t,s),d=t.reviews.filter(e=>e.source.kind===`spec`),f=vn(t),p=_n(t,f),m=t=>(0,D.jsx)(`ul`,{className:`board-list`,children:t.map(t=>(0,D.jsx)(Cn,{row:t,onOpen:e.onOpen,open:r[t.id]===!0,onFold:()=>o(t.id)},t.id))});return(0,D.jsxs)(`section`,{className:`board`,children:[(0,D.jsxs)(`div`,{className:`board-head`,children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Protocol`}),e.onAmend!==null&&t.protocol.length>0&&(0,D.jsx)(`button`,{type:`button`,className:`board-amend`,title:`Edit the protocol`,"aria-label":`Edit the protocol`,onClick:e.onAmend,children:(0,D.jsx)(a,{size:12})})]}),t.protocol.length===0?(0,D.jsx)(`p`,{className:`rail-fact muted`,children:n?`The steps are waiting for you.`:`No steps yet.`}):m(qe(t.protocol).map(e=>({id:e.id,label:W(e.id)?.title??e.id,status:e.status,artifacts:e.artifacts}))),u!==null&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Now`}),(0,D.jsxs)(`p`,{className:`board-now`,title:u.at,children:[(0,D.jsx)(`span`,{className:`pulse`,"aria-hidden":`true`}),u.said]})]}),t.phases.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Execution`}),m(yn(t,f))]}),t.reviews.length>0&&(0,D.jsxs)(`div`,{className:`board-log`,children:[d.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Specs review`}),bn(d)]}),p.length>0&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Execution review`}),(0,D.jsx)(`ul`,{className:`board-list board-nested`,children:p.map(e=>(0,D.jsxs)(`li`,{className:`board-under`,children:[e.place!==``&&(0,D.jsx)(`p`,{className:`board-under-name`,children:e.place}),bn(e.rounds)]},e.id))})]})]})]})}function Tn(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleString()}function En(e){return(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Needs you`}),(0,D.jsx)(`ul`,{className:`rail-awaiting`,children:e.awaiting.map(t=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`button`,{type:`button`,className:`send`,onClick:()=>e.onAnswer(t.id),children:t.title}),t.file!==``&&(0,D.jsx)(`p`,{className:`rail-fact muted`,children:t.file})]},t.id))})]})}function Dn(e){let[t,n]=(0,C.useState)(null),r=e.queue.length>0,i=ze(e.queue).length;return(0,D.jsxs)(`section`,{className:`rail-annotations`,children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:r?`Annotations (${e.queue.length})`:`Annotations`}),r&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`ul`,{className:`queue`,children:e.queue.map(r=>(0,D.jsxs)(`li`,{className:`queued is-${r.kind}`,children:[(0,D.jsx)(`p`,{className:`queued-target`,children:Le(r)}),r.kind===`remove`?(0,D.jsx)(`p`,{className:`queued-kind`,children:`Asking for this to be removed`}):t===r.id?(0,D.jsx)(`textarea`,{value:r.text,placeholder:`What about it?`,"aria-label":`Comment on ${Le(r)}`,onChange:t=>e.onEdit(r.id,t.target.value)}):r.text===``?(0,D.jsx)(`p`,{className:`queued-empty`,children:`Nothing written yet - this one will not be sent`}):(0,D.jsx)(`p`,{className:`queued-text`,children:r.text}),(0,D.jsxs)(`div`,{className:`queued-acts`,children:[r.kind===`comment`&&(0,D.jsx)(`button`,{type:`button`,onClick:()=>n(t===r.id?null:r.id),children:t===r.id?`done`:`edit`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>e.onSendOne(r.id),disabled:e.sending,children:`send now`}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>e.onDrop(r.id),children:`drop`})]})]},r.id))}),(0,D.jsx)(`button`,{type:`button`,className:`send`,onClick:e.onSendBatch,disabled:e.sending||i===0,children:e.sending?`Sending…`:`Send`})]}),e.filed.length>0&&(0,D.jsx)(`ul`,{className:`filed`,children:e.filed.slice().reverse().map((t,n)=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`span`,{className:`filed-round`,children:[`round `,e.filed.length-n]}),(0,D.jsxs)(`span`,{className:`filed-count`,children:[t.comments.length,` `,t.comments.length===1?`note`:`notes`]}),(0,D.jsx)(`span`,{className:`filed-when`,children:Tn(t.submittedAt)})]},t.submittedAt||String(n)))})]})}function On(e){let t=e.queue.length>0,n=!t&&e.filed.length>0,r=(0,D.jsx)(Dn,{...e});return(0,D.jsxs)(`aside`,{className:`rail`,"aria-label":`Status`,children:[e.spec!==null&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Spec`}),(0,D.jsx)(`p`,{className:`rail-fact`,children:e.spec.name}),(0,D.jsxs)(`p`,{className:`rail-fact muted`,children:[e.spec.files,` `,e.spec.files===1?`artifact`:`artifacts`,e.spec.archived?` · archived`:``]}),(0,D.jsxs)(`p`,{className:`rail-fact muted`,children:[`last changed `,Tn(e.spec.modified)]})]}),e.spec!==null&&(0,D.jsxs)(`section`,{children:[(0,D.jsx)(`h2`,{className:`rail-head`,children:`Actions`}),(0,D.jsxs)(`div`,{className:`rail-acts`,children:[(0,D.jsxs)(`button`,{type:`button`,className:`rail-act`,onClick:e.onContinue,children:[(0,D.jsx)(u,{size:15}),`Continue`]}),e.executable&&(0,D.jsxs)(`button`,{type:`button`,className:`rail-act`,onClick:e.onExecute,children:[(0,D.jsx)(v,{size:15}),`Execute`]}),e.onQualityReview!==null&&(0,D.jsxs)(`button`,{type:`button`,className:`rail-act`,onClick:e.onQualityReview,children:[(0,D.jsx)(y,{size:15}),`Specs quality review`]}),!e.spec.archived&&(0,D.jsxs)(`button`,{type:`button`,className:`rail-act`,onClick:e.onArchive,children:[(0,D.jsx)(l,{size:15}),`Archive`]})]})]}),e.protocol!==null&&e.protocol.awaiting.length>0&&(0,D.jsx)(En,{awaiting:e.protocol.awaiting,onAnswer:e.onAnswer}),t&&r,e.protocol!==null&&(0,D.jsx)(wn,{state:e.protocol,onOpen:e.onOpenArtifact,onAmend:e.onAmend}),n&&r,e.sent!==null&&(0,D.jsx)(`p`,{className:`rail-fact muted`,children:e.sent}),e.failure!==null&&(0,D.jsx)(`p`,{className:`notice notice-failure`,children:e.failure})]})}var kn={units:[],text:null,loading:!1,failure:null,from:null};function An(e,t){return e?`${e}/${t.path}`:t.path}function jn(e,t){let[n,r]=(0,C.useState)(kn),i=(0,C.useRef)(null),a=(0,C.useCallback)((e,t)=>{let n=An(e,t);if(i.current=n,!T(t.kind)){let e=E({path:t.path,kind:t.kind,fingerprint:t.hash??`${t.size}:${t.modified}`});r({units:e,text:null,loading:!1,failure:null,from:n});return}r(e=>({...e,loading:!0})),Ct(n).then(e=>{if(i.current!==n)return;let a=E({path:t.path,kind:t.kind,text:e.text});r({units:a,text:e.text,loading:!1,failure:null,from:n})}).catch(e=>{i.current===n&&r({units:[],text:null,loading:!1,failure:e.message,from:n})})},[]);(0,C.useEffect)(()=>{if(!t){i.current=null,r(kn);return}a(e,t)},[e,t,a]),(0,C.useEffect)(()=>{if(!t)return;let n=An(e,t);return ft(r=>{r.path===n&&a(e,t)})},[e,t,a]);let o=t?An(e,t):null;return n.from===o?{units:n.units,text:n.text,loading:n.loading,failure:n.failure}:{units:[],text:null,loading:o!==null,failure:null}}function Mn(e){let[t,n]=(0,C.useState)({for:null,state:null}),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(null),o=(0,C.useCallback)(()=>{if(e===null){a.current=null,n({for:null,state:null});return}a.current=e,At(e).then(t=>{a.current===e&&(n({for:e,state:t}),i(null))}).catch(t=>{a.current===e&&i(t.message)})},[e]);return(0,C.useEffect)(o,[o]),(0,C.useEffect)(()=>{if(e!==null)return ft(t=>{t.entry===e&&o()})},[e,o]),{state:t.for===e?t.state:null,failure:r,refresh:o}}var Nn={openSpec:null,openArtifact:null,answering:null,shade:null,draft:null,intake:null};function Pn(){let[e,t]=(0,C.useState)(null),[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),[g,_]=(0,C.useState)(null),[ee,te]=(0,C.useState)(null),[v,y]=(0,C.useState)(!1),[b,x]=(0,C.useState)(null),[S,w]=(0,C.useState)(null),ie=ne({onSession:pt,askTheme:vt}),T=(0,C.useRef)(new Map),E=(0,C.useRef)(null),[se,le]=(0,C.useState)(null),de=(0,C.useRef)(Nn),fe=(0,C.useRef)(null),pe=(0,C.useRef)(null);(0,C.useEffect)(()=>{dt().then(e=>r(e.raw))},[]);let O=(0,C.useCallback)(()=>{bt().then(e=>{t(e),a(null)}).catch(e=>a(e.message))},[]);(0,C.useEffect)(O,[O]),(0,C.useEffect)(()=>ft(O),[O]);let me=(0,C.useCallback)(e=>{l(e),p(null),d(null),X(!1),Ue(e=>e===`intake`?e:null),x(null)},[]),he=(0,C.useRef)(null),ge=(0,C.useCallback)(e=>{he.current=e,xt(e).then(t=>{he.current===e&&(d(t),s(null))}).catch(t=>{he.current===e&&s(t.message)})},[]);(0,C.useEffect)(()=>{c!==null&&ge(c)},[c,ge]);let[_e,ve]=(0,C.useState)([]),k=(0,C.useCallback)(e=>{Ot(e).then(t=>{he.current===e&&ve(t.rounds)}).catch(()=>ve([]))},[]);(0,C.useEffect)(()=>{c===null?ve([]):k(c)},[c,k]);let A=u?.archived!==!0,ye=u!==null&&!u.archived,be=ce(c,{get:wt,put:Tt,empty:He,whenUnwritable:`Your marks are not being saved - the state file cannot be written.`,whenUnreadable:`This spec’s saved state could not be read, so nothing is being saved.`,persist:A}),xe=ce(ye?c:null,{get:Et,put:Dt,empty:()=>[],whenUnwritable:`Your annotations are not being saved - the queue file cannot be written.`,whenUnreadable:`This spec’s queued annotations could not be read, so nothing is being saved.`}),Se=xe.reload;(0,C.useEffect)(()=>{if(c!==null)return ft(e=>{if(e.entry===c){if(e.path.endsWith(`/.specs/pending-annotations.json`)){Se();return}ge(c),k(c)}})},[c,ge,k,Se]);let j=(0,C.useMemo)(()=>u?.files??[],[u]);(0,C.useEffect)(()=>{j.length!==0&&(j.some(e=>e.path===f)||p(j[0].path))},[j,f]);let M=j.find(e=>e.path===f)??null,N=jn(c??``,M),Ce=(0,C.useMemo)(()=>{let e={};for(let t of N.units)e[t.id]=ae(t.hash,be.value.units[t.id]);return e},[N.units,be.value]);(0,C.useEffect)(()=>{g===null||M===null||N.units.length===0||(h(oe(N.units,M.path,g)?.id??null),_(null))},[N.units,M,g]);let we=(0,C.useCallback)((e,t)=>{p(e),_(t===``?null:t)},[]),Te=be.update,Ee=(0,C.useCallback)(e=>{Te(t=>{let n=t.units[e.id],r={...t.units};if(n?.readHash===e.hash){let{readHash:t,readAt:i,...a}=n;r[e.id]=a}else r[e.id]={...n,readHash:e.hash,readAt:new Date().toISOString()};return{...t,units:r}})},[Te]),De=(0,C.useCallback)(()=>h(null),[]),P=e?.entries.find(e=>e.path===c)??null,Oe=xe.value,F=xe.update,ke=(0,C.useCallback)((e,t,n=``)=>{F(r=>[...r,Ie(e,t,n)],!0),x(null)},[F]),I=(0,C.useCallback)(async e=>{let t=await ht(e);return t.ok?!0:t.error===`no-session`?(w(e),!1):(x(`No agent was told: ${t.error}`),!1)},[]),je=(0,C.useCallback)(async e=>{if(!(c===null||ze(e).length===0)){y(!0),x(null);try{let t=await kt(c,Be(e)),n=new Set(e.map(e=>e.id));F(e=>e.filter(e=>!n.has(e.id)),!0),k(c),await I({event:`annotations`,detail:Ve(e),path:t.path})||x(e=>e??`Round ${t.round} was filed. Nobody has been told yet.`)}catch(e){x(`That could not be filed: ${e.message}`)}finally{y(!1)}}},[c,I,k,F]),L=Mn(c),[R,z]=(0,C.useState)(null),[Me,Ne]=(0,C.useState)(0),[Fe,Le]=(0,C.useState)(null),[Re,B]=(0,C.useState)(null),[V,Ue]=(0,C.useState)(null),[We,H]=(0,C.useState)(null),[Ke,U]=(0,C.useState)(!1),W=(0,C.useCallback)(e=>{H(null),U(!1),Ue(e)},[]),[qe,Je]=(0,C.useState)(0);(0,C.useEffect)(()=>{de.current={openSpec:c,openArtifact:f,answering:R,shade:V===`intake`?`intake`:null}},[c,f,R,V]);let Ye=(0,C.useCallback)(e=>{if(E.current===e)return;let t=de.current,n=e===null?void 0:T.current.get(e);if(E.current===null&&n===void 0){E.current=e,le(e),x(null);return}E.current!==null&&T.current.set(E.current,{...t,draft:fe.current,intake:pe.current}),E.current=e,le(e);let r=n??Nn;de.current=r,fe.current=r.draft,pe.current=r.intake,l(r.openSpec),p(r.openArtifact),z(r.answering),Ue(r.shade),Je(e=>e+1),X(!1),x(null),B(null),H(null),U(!1),r.openSpec!==t.openSpec&&(d(null),h(null),_(null),te(null))},[]);(0,C.useEffect)(()=>pt(e=>Ye(e.sid)),[Ye]);let Xe=L.state?.awaiting.length??0;(0,C.useEffect)(()=>{gt(Xe)},[Xe]),(0,C.useEffect)(()=>{if(c===null||R===null){Le(null);return}let e=!0;return jt(c,R).then(t=>{if(!e)return;Le(t),B(null);let n=typeof t.file==`string`?t.file:``;n!==``&&we(n,``)}).catch(t=>{e&&B(t.message)}),()=>{e=!1}},[c,R,we]);let G=L.state?.awaiting.find(e=>e.id===R)??null,K=G?.kind??null,Ze=Fe===null?null:Fe.payload??Fe,Qe=Ze===null?null:Ae(Ze),$e=Qe?.kind===`decision`&&M!==null&&M.path===(G?.file??``)?oe(N.units,M.path,Qe.heading)?.id??null:null;(0,C.useEffect)(()=>{let e=L.state?.awaiting;R===null||e===void 0||e.some(e=>e.id===R)||z(null)},[R,L.state]);let q=c===null||R===null?null:`${c}:${R}`,J=(0,C.useCallback)((e,t)=>{X(!1),K===`protocol`&&z(null),we(e,t)},[K,we]),Y=(0,C.useCallback)(e=>{X(!1),K===`protocol`&&z(null),h(e)},[K]),[et,tt]=(0,C.useState)(null),[nt,X]=(0,C.useState)(!1),rt=(0,C.useMemo)(()=>{if(K===`protocol`&&Ze!==null)return{proposal:Ze,held:null};let e=L.state;return!nt||e===null||e.protocol.length===0?null:{proposal:{stages:[],note:``},held:{stages:e.protocol,imagination:e.modes.imagination,settings:e.stageSettings}}},[nt,K,Ze,L.state]),it=(0,C.useCallback)(e=>{if(q===null||R===null)return Promise.resolve(!1);let t=G?.file??``;return I({event:`question`,detail:`${G?.title??R}: ${e}`,...t===``?{}:{path:`${c}/${t}`}}).then(t=>(t&&tt({for:q,said:e}),t))},[R,q,G,c,I]),at=(0,C.useCallback)(e=>{q!==null&&(fe.current={for:q,...e})},[q]),ot=(0,C.useCallback)(async e=>{if(!(c===null||R===null)){y(!0),B(null);try{let t=await Ft(c,R,e);z(null),fe.current=null,L.refresh(),await I({event:G?.kind===`gate`?`gate`:`answers`,detail:`${G?.title??R}: ${t.outcome}`,path:t.path})}catch(e){B(e.message)}finally{y(!1)}}},[R,G,c,L,I]),st=(0,C.useCallback)(e=>{pe.current=e},[]),Z=(0,C.useCallback)(e=>{if(e!==null&&e!==E.current){let t=T.current.get(e);if(t!==void 0){T.current.set(e,{...t,shade:null,intake:null});return}}W(null),pe.current=null},[W]),ct=(0,C.useCallback)(async e=>{let t=E.current;U(!0),H(null);try{let n=await Mt(e);Z(t),l(n.entry),p(n.path.slice(n.entry.length+1)),d(null),O(),await I({event:`brief`,detail:n.entry})}catch(e){H(e.message)}finally{U(!1)}},[Z,O,I]),lt=(0,C.useCallback)(async e=>{if(c===null)return null;y(!0),B(null);try{let{change:t}=await Nt(c,e);if(z(null),X(!1),L.refresh(),t.amended&&!t.changed)return null;await I({event:t.amended?`amendment`:`answers`,detail:t.amended?`${P?.name??c}: ${t.said}`:`protocol confirmed - ${t.said}`,path:`${c}/README.md`})}catch(e){let t=e.message;return B(t),t}finally{y(!1)}return null},[c,L,I,P?.name]),ut=(0,C.useCallback)(()=>{P!==null&&(x(null),I({event:`brief`,detail:P.name}).then(e=>{e&&x(`An agent was asked to pick this spec up.`)}))},[I,P]),Q=(0,C.useMemo)(()=>A&&j.some(e=>e.path===`plan/PLAN.md`),[j,A]),_t=(0,C.useCallback)(async e=>{if(!(c===null||P===null)){U(!0),H(null);try{await Pt(c,e),W(null),L.refresh(),x(null),await I({event:`execute`,detail:P.name})?x(`The run was started in the session beside this pane.`):x(e=>e??`The run is set up. Nobody has been told yet.`)}catch(e){H(e.message)}finally{U(!1)}}},[c,L,I,W,P]),yt=(0,C.useCallback)(()=>{let e=L.state?.protocol??[];x(null),lt({stages:[...e.map(e=>e.id),Ge],imagination:null,note:``,settings:{research:null}}).then(e=>{e!==null&&x(`Specs quality review was not added: ${e}`)})},[lt,L.state]),$=(0,C.useMemo)(()=>{let e=L.state?.protocol??[];return A&&e.length>0&&!e.some(e=>e.id===`quality-review`)},[A,L.state]),Ct=(0,C.useCallback)(async()=>{if(c!==null){U(!0),H(null);try{let e=await St(c);W(null),d(null),p(e.path.slice(e.entry.length+1)),l(e.entry),x(`Signed off, and filed as ${e.entry}.`)}catch(e){H(e.message)}finally{U(!1)}}},[c,W]);if(n===null||e===null)return(0,D.jsx)(`p`,{className:`notice notice-failure`,children:i??`Waiting for the pane to hand over…`});let At=R===null||Qe===null||K===`protocol`?null:(0,D.jsx)(Pe,{title:G?.title??R,ask:Qe,file:G?.file??``,onAnswer:e=>void ot(e),onAsk:it,asked:et?.for===q?et.said:null,onDismiss:()=>z(null),settled:M===null||!N.loading,summon:Me,sending:v,failure:Re,draft:fe.current?.for===q?fe.current:null,onDraft:at},q);return(0,D.jsxs)(`div`,{className:c===null?`workspace is-alone`:`workspace`,children:[(0,D.jsx)(cn,{specs:e.entries,openSpec:c,spec:P,onOpenSpec:me,onBack:()=>me(null),artifacts:j,openArtifact:f,onOpenArtifact:e=>J(e,``),units:N.units,currentUnit:ee,marks:Ce,onOpenUnit:Y,onNewSpec:()=>W(`intake`)}),(0,D.jsxs)(`main`,{className:`stage`,"data-theme":ie.theme,children:[(0,D.jsx)(re,{theme:ie.theme,kept:ie.kept,onToggle:ie.toggle}),rt===null?M===null?(0,D.jsxs)(`div`,{className:`doc`,children:[S!==null&&At!==null?null:(0,D.jsx)(`p`,{className:`notice`,children:o??(e.entries.length===0?`No work here yet. Start a piece with New spec.`:c===null?`Nothing is open. Pick a piece of work on the left.`:u===null?`Opening…`:`This spec holds nothing to read yet.`)}),At]}):(0,D.jsxs)(`div`,{className:`doc-and-ask`,children:[(0,D.jsx)(Jt,{reader:se??``,entry:c??``,file:M,units:N.units,text:N.text,marks:Ce,loading:N.loading,failure:N.failure,raw:n,onToggleRead:Ee,landOn:m,onLanded:De,onCurrent:te,onOpen:we,onLeave:e=>void mt(e),onAnnotate:ye?ke:null,under:$e===null?null:{unit:$e,node:At}}),$e===null&&At]}):(0,D.jsx)(mn,{name:P?.name??c??``,proposal:rt.proposal,held:rt.held,wish:L.state?.wish.imagination===!0,onConfirm:e=>void lt(e),onAsk:e=>void I({event:`question`,detail:`the steps: ${e}`}),onCancel:rt.held===null?null:()=>X(!1),sending:v,failure:Re},`${c}:${rt.held===null?`propose:${rt.proposal.offeredAt??``}`:`amend`}`)]}),c!==null&&(0,D.jsx)(On,{spec:P,failure:be.failure??xe.failure,queue:Oe,filed:_e,onEdit:(e,t)=>F(n=>n.map(n=>n.id===e?{...n,text:t}:n)),onDrop:e=>F(t=>t.filter(t=>t.id!==e),!0),onSendOne:e=>{let t=Oe.find(t=>t.id===e);t&&je([t])},onSendBatch:()=>void je(Oe),sending:v,sent:b,onContinue:ut,onExecute:()=>W(`execute`),executable:Q,onQualityReview:$?yt:null,onArchive:()=>W(`archive`),protocol:L.state,onOpenArtifact:e=>J(e,``),onAnswer:e=>{if(X(!1),e!==R){z(e);return}let t=G?.file??``;t!==``&&we(t,``),Ne(e=>e+1)},onAmend:A?()=>{B(null),X(!0)}:null}),V===`archive`&&P!==null&&c!==null&&(0,D.jsx)(ue,{name:P.name,filed:zt(c,new Date),state:L.state,onArchive:()=>void Ct(),onCancel:()=>W(null),working:Ke,failure:We}),V===`execute`&&P!==null&&c!==null&&(0,D.jsx)(nn,{name:P.name,slug:c.slice(c.lastIndexOf(`/`)+1),phases:L.state?.phases??[],recommended:L.state?.runRecommendations??null,decided:L.state?.runDecisions??null,onRun:e=>void _t(e),onCancel:()=>W(null),working:Ke,failure:We},c),V===`intake`&&(0,D.jsx)(on,{onFile:ct,onCancel:()=>Z(E.current),filing:Ke,failure:We,draft:pe.current,onDraft:st},qe),S!==null&&(0,D.jsx)(Fn,{onCancel:()=>{w(null),x(`Nobody was told: there was no session in this window.`)},onConfirm:()=>{let e=S;w(null),ht({...e,create:!0}).then(e=>{x(e.ok?`A session was started, and it opens on this.`:`A session could not be started: ${e.error}`)})}})]})}function Fn({onCancel:e,onConfirm:t}){return(0,D.jsx)(`div`,{className:`dialog-shade`,children:(0,D.jsxs)(`div`,{className:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`No session is running`,children:[(0,D.jsx)(`div`,{className:`dialog-body`,children:(0,D.jsx)(`p`,{children:`No session is running in this window. Start one and let it pick this up?`})}),(0,D.jsxs)(`div`,{className:`dialog-acts`,children:[(0,D.jsx)(`button`,{type:`button`,onClick:e,children:`Not now`}),(0,D.jsx)(`button`,{type:`button`,className:`send`,onClick:t,children:`Start`})]})]})})}_t();var In=document.getElementById(`root`);In&&(0,w.createRoot)(In).render((0,D.jsx)(C.StrictMode,{children:(0,D.jsx)(Pn,{})}));
@@ -1,2 +0,0 @@
1
- # Principles
2
-