@north-light/cli 0.3.651 → 0.3.652

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.
@@ -1 +1 @@
1
- var P=Object.defineProperty;var n=(o,r)=>P(o,"name",{value:r,configurable:!0});import{claimTicket as q,heartbeatClaim as E,releaseClaim as y}from"../../../core/human/claim.js";import{watchInboxActivity as $}from"../../../core/human/root.js";import{resolvePageComponents as A}from"../../../core/config.js";import{fillBar as M,stripSgr as w,truncate as S,REVERSE as K}from"../../../core/canvas/nav-render.js";import{cliClient as x}from"../../../commands/api-client.js";import{visibleWidth as D}from"../../inbox/tui/ansi.js";import{pageViewFromDTO as I,settledStatusOf as h}from"../../inbox/dto-adapt.js";import{PageAdapter as F}from"../../inbox/page-adapter.js";import{decodeInboxKey as H}from"../../inbox/tui/keys.js";import{daemonErrorMessage as b,resolveFailureKind as O,resolveTicketPage as V}from"../../inbox/resolve.js";import{editBufferInEditor as _}from"../../inbox/review/roundtrip.js";function se(o,r){const{tui:s,pal:g}=o;let c,f=!1,m=0,p=0;const v=n(()=>Math.max(3,s.terminal.rows-10),"capRows"),u=n(e=>{const t=c;t!==void 0&&(c=void 0,clearInterval(t.heartbeat),t.unwatch(),t.adapter.close(),e&&y(t.dir,t.token),r.syncCursor(),r.refreshStrip(),s.requestRender())},"closeSession"),T=n(async(e,t)=>{f=!0;try{await V(e.id,t),u(!1),r.setNotice("Response sent")}catch(a){const i=O(a);if(i==="unreachable"||i==="other"){r.setNotice(b(a));return}u(!1),r.setNotice(i==="already_settled"?await k(e.ticketId):b(a))}finally{f=!1}},"complete"),R=n(async e=>{if(c!==e||f)return;let t;try{t=await x().getHumanInboxPage(e.ticketId)}catch(a){if(c!==e)return;u(!0),r.setNotice(`Ticket could not be read: ${b(a)}`);return}if(!(c!==e||f)){if(t.state==="resolved"||t.state==="canceled"){u(!0),r.setNotice(t.state==="canceled"?"Ticket was canceled by its requester":"Ticket was resolved elsewhere");return}if(t.revision!==e.revision){e.revision=t.revision;try{e.adapter.reload(I(t))}catch{r.setNotice("Page could not be read")}s.requestRender()}}},"onActivity"),C=n(e=>{const t=e.adapter.inputBuffer();if(t===void 0)return;const a=r.suspendForChild();let i={text:t};try{i=_(t)}finally{a(),e.adapter.setInputBuffer(i.text),i.error!==void 0&&r.setNotice(i.error),s.requestRender()}},"editPageInput");return{component:{render(e){const t=c;if(t===void 0)return[];const a=Math.max(20,e-2),i=v();(a!==m||i!==p)&&(m=a,p=i,t.adapter.resize(a,i));const d=M(w(S(` \u2691 ${t.title} \xB7 Esc closes`,e)),e,K),l=z(),B=W(t.adapter.render()).map(N=>U(` ${N}`,e,l));return[d,...B,g.border("\u2500".repeat(Math.max(0,e)))]},invalidate(){}},open:n(async e=>{if(c!==void 0&&u(!0),e.kind!=="page"){r.openInbox(e.dir);return}const t=q(e.dir);if(t===null){r.setNotice("Ticket is being edited by another inbox");return}let a,i;try{const l=await x().getHumanInboxPage(e.inboxTicketId);if(l.state==="resolved"||l.state==="canceled"){y(e.dir,t.token),r.setNotice(h(l));return}a=I(l),i=l.revision}catch{y(e.dir,t.token),r.openInbox(e.dir);return}if(c!==void 0){y(e.dir,t.token);return}m=Math.max(20,s.terminal.columns-2),p=v();const d={dir:e.dir,id:e.id,ticketId:e.inboxTicketId,title:e.title,token:t.token,revision:i,adapter:new F({ticketId:e.inboxTicketId,page:a,productKinds:A(),cols:m,rows:p,onDirty:n(()=>s.requestRender(),"onDirty"),onBack:n(()=>u(!0),"onBack"),onComplete:n(l=>{T(d,l)},"onComplete"),onEditorRequest:n(()=>C(d),"onEditorRequest")}),unwatch:n(()=>{},"unwatch"),heartbeat:setInterval(()=>{c===d&&E(d.dir,d.token)},1e4)};d.unwatch=$(()=>{R(d)}),c=d,r.syncCursor(),r.refreshStrip(),s.requestRender()},"open"),handleKey:n(e=>{const t=c;if(t===void 0)return!1;const{input:a,key:i}=H(e);return t.adapter.handleKey(a,i),s.requestRender(),!0},"handleKey"),close:n(()=>u(!0),"close"),active:n(()=>c!==void 0,"active"),currentDir:n(()=>c?.dir,"currentDir")}}n(se,"createTicketPanel");async function k(o){let r;try{r=h(await x().getHumanInboxPage(o))}catch(s){return`Ticket result is unreadable: ${b(s)}`}return r.charAt(0).toUpperCase()+r.slice(1)}n(k,"resolvedElsewhereNotice");function z(){const o=globalThis[Symbol.for("@earendil-works/pi-coding-agent:theme")];try{return o?.getBgAnsi?.("customMessageBg")}catch{return}}n(z,"contextCardBg");function U(o,r,s){if(s===void 0)return o;const g=o.replaceAll("\x1B[0m",`\x1B[0m${s}`).replaceAll("\x1B[49m",s),c=" ".repeat(Math.max(0,r-D(o)));return`${s}${g}${c}\x1B[49m`}n(U,"paintBg");function W(o){let r=o.length;for(;r>0&&w(o[r-1]).trim()==="";)r--;return o.slice(0,r)}n(W,"trimTrailingBlank");export{se as createTicketPanel};
1
+ var N=Object.defineProperty;var n=(s,t)=>N(s,"name",{value:t,configurable:!0});import{watchInboxActivity as P}from"../../../core/human/root.js";import{resolvePageComponents as q}from"../../../core/config.js";import{fillBar as E,stripSgr as x,truncate as $,REVERSE as A}from"../../../core/canvas/nav-render.js";import{cliClient as g}from"../../../commands/api-client.js";import{visibleWidth as M}from"../../inbox/tui/ansi.js";import{pageViewFromDTO as v,settledStatusOf as w}from"../../inbox/dto-adapt.js";import{PageAdapter as S}from"../../inbox/page-adapter.js";import{decodeInboxKey as K}from"../../inbox/tui/keys.js";import{daemonErrorMessage as p,resolveFailureKind as D,resolveTicketPage as F}from"../../inbox/resolve.js";import{editBufferInEditor as H}from"../../inbox/review/roundtrip.js";function ne(s,t){const{tui:o,pal:y}=s;let c,l=!1,f=0,m=0;const b=n(()=>Math.max(3,o.terminal.rows-10),"capRows"),u=n(()=>{const e=c;e!==void 0&&(c=void 0,e.unwatch(),e.adapter.close(),t.syncCursor(),t.refreshStrip(),o.requestRender())},"closeSession"),I=n(async(e,r)=>{l=!0;try{await F(e.id,r),u(),t.setNotice("Response sent")}catch(a){const i=D(a);if(i==="unreachable"||i==="other"){t.setNotice(p(a));return}u(),t.setNotice(i==="already_settled"?await O(e.ticketId):p(a))}finally{l=!1}},"complete"),h=n(async e=>{if(c!==e||l)return;let r;try{r=await g().getHumanInboxPage(e.ticketId)}catch(a){if(c!==e)return;u(),t.setNotice(`Ticket could not be read: ${p(a)}`);return}if(!(c!==e||l)){if(r.state==="resolved"||r.state==="canceled"){u(),t.setNotice(r.state==="canceled"?"Ticket was canceled by its requester":"Ticket was resolved elsewhere");return}if(r.revision!==e.revision){e.revision=r.revision;try{e.adapter.reload(v(r))}catch{t.setNotice("Page could not be read")}o.requestRender()}}},"onActivity"),R=n(e=>{const r=e.adapter.inputBuffer();if(r===void 0)return;const a=t.suspendForChild();let i={text:r};try{i=H(r)}finally{a(),e.adapter.setInputBuffer(i.text),i.error!==void 0&&t.setNotice(i.error),o.requestRender()}},"editPageInput");return{component:{render(e){const r=c;if(r===void 0)return[];const a=Math.max(20,e-2),i=b();(a!==f||i!==m)&&(f=a,m=i,r.adapter.resize(a,i));const d=E(x($(` \u2691 ${r.title} \xB7 Esc closes`,e)),e,A),T=V(),B=U(r.adapter.render()).map(C=>z(` ${C}`,e,T));return[d,...B,y.border("\u2500".repeat(Math.max(0,e)))]},invalidate(){}},open:n(async e=>{if(c!==void 0&&u(),e.kind!=="page"){t.openInbox(e.dir);return}let r,a;try{const d=await g().getHumanInboxPage(e.inboxTicketId);if(d.state==="resolved"||d.state==="canceled"){t.setNotice(w(d));return}r=v(d),a=d.revision}catch{t.openInbox(e.dir);return}if(c!==void 0)return;f=Math.max(20,o.terminal.columns-2),m=b();const i={dir:e.dir,id:e.id,ticketId:e.inboxTicketId,title:e.title,revision:a,adapter:new S({ticketId:e.inboxTicketId,page:r,productKinds:q(),cols:f,rows:m,onDirty:n(()=>o.requestRender(),"onDirty"),onBack:n(()=>u(),"onBack"),onComplete:n(d=>{I(i,d)},"onComplete"),onEditorRequest:n(()=>R(i),"onEditorRequest")}),unwatch:n(()=>{},"unwatch")};i.unwatch=P(()=>{h(i)}),c=i,t.syncCursor(),t.refreshStrip(),o.requestRender()},"open"),handleKey:n(e=>{const r=c;if(r===void 0)return!1;const{input:a,key:i}=K(e);return r.adapter.handleKey(a,i),o.requestRender(),!0},"handleKey"),close:n(()=>u(),"close"),active:n(()=>c!==void 0,"active"),currentDir:n(()=>c?.dir,"currentDir")}}n(ne,"createTicketPanel");async function O(s){let t;try{t=w(await g().getHumanInboxPage(s))}catch(o){return`Ticket result is unreadable: ${p(o)}`}return t.charAt(0).toUpperCase()+t.slice(1)}n(O,"resolvedElsewhereNotice");function V(){const s=globalThis[Symbol.for("@earendil-works/pi-coding-agent:theme")];try{return s?.getBgAnsi?.("customMessageBg")}catch{return}}n(V,"contextCardBg");function z(s,t,o){if(o===void 0)return s;const y=s.replaceAll("\x1B[0m",`\x1B[0m${o}`).replaceAll("\x1B[49m",o),c=" ".repeat(Math.max(0,t-M(s)));return`${o}${y}${c}\x1B[49m`}n(z,"paintBg");function U(s){let t=s.length;for(;t>0&&x(s[t-1]).trim()==="";)t--;return s.slice(0,t)}n(U,"trimTrailingBlank");export{ne as createTicketPanel};