@applivity/plato 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +11 -1
  2. package/dist/cli.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,9 +10,19 @@ mid-run, and stops at a safe point. The same engine powers the
10
10
  [Authenticate](#authenticate) · [Teams](#teams) · [Commands](#commands) ·
11
11
  [Source](https://github.com/Applivity/plato)
12
12
 
13
- **Pre-release.** This is `0.1.5`. The core of the agent is the same code the
13
+ **Pre-release.** This is `0.2.2`. The core of the agent is the same code the
14
14
  extension has shipped, but the terminal host is new.
15
15
 
16
+ **0.2.2** updates this README to the current version; no code changed.
17
+
18
+ **0.2.1** adds the author and keywords the npm page shows; no code changed.
19
+
20
+ **0.2.0** adds session messaging. A Plato session can list the other Plato
21
+ sessions on this machine and send one a message. The receiver shows who asked,
22
+ starts work if it is idle, and queues the message behind a run that is already
23
+ going. One answer comes back, and the session that answered cannot send it
24
+ onward.
25
+
16
26
  **0.1.5** adds the source link above; no behaviour changed.
17
27
 
18
28
  **0.1.4** adds Windows support for commands, background shells, and MCP
package/dist/cli.js CHANGED
@@ -677,7 +677,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
677
677
  `).split(`
678
678
  `),s=[],A=0;for(;A<a.length;){let f=a[A]??"";if(f.trim().length===0){A+=1;continue}let h=rD.exec(f);if(h){let S=A+1;for(;S<a.length&&!rD.test(a[S]??"");)S+=1;if(S<a.length){s.push({kind:"code",lang:h[1]??"",lines:a.slice(A+1,S)}),A=S+1;continue}}let E=DO.exec(f);if(E){s.push({kind:"heading",level:E[1]?.length??1,spans:Dh(E[2]??"")}),A+=1;continue}if(RO.test(f)){s.push({kind:"rule"}),A+=1;continue}if(A+1<a.length&&f.includes("|")&&bO(a[A+1]??"")){let S=AS(f).map(Dh),N=AS(a[A+1]??"").map(T7);A+=2;let _=[];for(;A<a.length&&(a[A]??"").includes("|")&&(a[A]??"").trim()!=="";)_.push(AS(a[A]??"").map(Dh)),A+=1;s.push({kind:"table",align:N,header:S,rows:_});continue}let y=lD.exec(f);if(y){let S=/\d/.test(y[1]??""),N=[],_=A;for(;_<a.length;){let O=lD.exec(a[_]??"");if(!O)break;N.push(Dh(O[2]??"")),_+=1}s.push({kind:"list",ordered:S,items:N}),A=_;continue}let I=sD.exec(f);if(I){let S=[I[1]??""],N=A+1;for(;N<a.length;){let _=sD.exec(a[N]??"");if(!_)break;S.push(_[1]??""),N+=1}s.push({kind:"quote",spans:Dh(S.join(" "))}),A=N;continue}let v=[f.trim()],x=A+1;for(;x<a.length;){let S=a[x]??"";if(S.trim().length===0||rD.test(S)||DO.test(S)||RO.test(S)||lD.test(S)||sD.test(S)||S.includes("|")&&bO(a[x+1]??""))break;v.push(S.trim()),x+=1}s.push({kind:"paragraph",spans:Dh(v.join(" "))}),A=x}return s}function xO(e,n,a){if(e.length===0||n<=0)return{text:"",hidden:0};let s=Math.max(1,a),A=e.split(`
679
679
  `),f=I=>Math.max(1,Math.ceil(wy(I)/s)),h=A.reduce((I,v)=>I+f(v),0);if(h<=n)return{text:e,hidden:0};let E=0,y=A.length;for(;y>0;){let I=f(A[y-1]??"");if(E+I>n)break;E+=I,y-=1}return y===A.length?{text:(A[A.length-1]??"").slice(-(n*s)),hidden:h-n}:{text:A.slice(y).join(`
680
- `),hidden:h-E}}var Ft=gt(lS(),1);var TO=gt(Ut(),1);var _7=process.env.NO_COLOR===void 0;function _O({text:e,columns:n}){let a=(0,TO.useMemo)(()=>NO(e),[e]);return(0,Ft.jsx)(kt,{flexDirection:"column",children:a.map((s,A)=>(0,Ft.jsx)(kt,{flexDirection:"column",marginBottom:A===a.length-1?0:1,children:(0,Ft.jsx)(M7,{block:s,columns:n})},A))})}function M7({block:e,columns:n}){switch(e.kind){case"heading":return(0,Ft.jsx)(he,{bold:!0,underline:e.level===1,children:(0,Ft.jsx)(Ry,{spans:e.spans})});case"paragraph":return(0,Ft.jsx)(he,{children:(0,Ft.jsx)(Ry,{spans:e.spans})});case"code":return(0,Ft.jsx)(O7,{block:e});case"list":return(0,Ft.jsx)(kt,{flexDirection:"column",children:e.items.map((a,s)=>(0,Ft.jsxs)(he,{children:[e.ordered?`${s+1}. `:"\u2022 ",(0,Ft.jsx)(Ry,{spans:a})]},s))});case"quote":return(0,Ft.jsx)(kt,{paddingLeft:2,children:(0,Ft.jsx)(he,{dimColor:!0,children:(0,Ft.jsx)(Ry,{spans:e.spans})})});case"rule":return(0,Ft.jsx)(he,{dimColor:!0,children:"\u2500".repeat(Math.max(3,Math.min(n,40)))});case"table":return(0,Ft.jsx)(U7,{block:e,columns:n})}}function O7({block:e}){return(0,Ft.jsxs)(kt,{flexDirection:"column",paddingLeft:2,children:[e.lang.length>0?(0,Ft.jsx)(he,{dimColor:!0,children:e.lang}):null,e.lines.map((n,a)=>(0,Ft.jsx)(he,{children:n.length>0?n:" "},a))]})}function U7({block:e,columns:n}){let a=e.header.map((f,h)=>Math.max(1,wy(Dy(f)),...e.rows.map(E=>wy(Dy(E[h]??[])))));if(a.reduce((f,h)=>f+h,0)+Math.max(0,a.length-1)*3>n){let f=[e.header,...e.rows].map(h=>h.map(Dy).join(" | "));return(0,Ft.jsx)(kt,{flexDirection:"column",children:f.map((h,E)=>(0,Ft.jsx)(he,{bold:E===0,children:h},E))})}let A=(f,h)=>(0,Ft.jsx)(he,{bold:h,children:f.map((E,y)=>(0,Ft.jsxs)(he,{children:[y>0?" \u2502 ":"",(0,Ft.jsx)(H7,{spans:E,width:a[y]??1,align:e.align[y]??"left"})]},y))});return(0,Ft.jsxs)(kt,{flexDirection:"column",children:[A(e.header,!0),(0,Ft.jsx)(he,{dimColor:!0,children:a.map(f=>"\u2500".repeat(f)).join("\u2500\u253C\u2500")}),e.rows.map((f,h)=>(0,Ft.jsx)(he,{children:A(f,!1)},h))]})}function H7({spans:e,width:n,align:a}){let s=Math.max(0,n-wy(Dy(e))),A=a==="right"?s:a==="center"?Math.floor(s/2):0;return(0,Ft.jsxs)(he,{children:[" ".repeat(A),(0,Ft.jsx)(Ry,{spans:e})," ".repeat(s-A)]})}function Ry({spans:e}){return(0,Ft.jsx)(Ft.Fragment,{children:e.map((n,a)=>{switch(n.kind){case"bold":return(0,Ft.jsx)(he,{bold:!0,children:n.text},a);case"italic":return(0,Ft.jsx)(he,{italic:!0,children:n.text},a);case"code":return(0,Ft.jsx)(he,{color:_7?"cyan":void 0,children:n.text},a);case"link":return(0,Ft.jsxs)(he,{children:[n.text,n.href===void 0?null:(0,Ft.jsxs)(he,{dimColor:!0,children:[" (",n.href,")"]})]},a);default:return(0,Ft.jsx)(he,{children:n.text},a)}})})}var jn=gt(lS(),1);import{homedir as G7}from"node:os";var hd="0.2.1";var MO=[{text:" \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588"},{text:" \u2580\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2580"},{text:" \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584"},{text:" \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584"},{text:" \u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2584\u2584\u2584 \u2588\u2588 \u2584\u2584\u2584 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2580\u2580\u2580 \u2588\u2588 \u2580\u2580\u2580 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588\u2588\u2584 \u2584\u2588\u2588\u2588\u2588\u2584 \u2584\u2588\u2588\u2588\u2588",beak:[13,17]},{text:" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",beak:[14,16]},{text:" \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580",beak:[14,16]},{text:" \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580"},{text:" \u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580"}],OO=28,uD=["\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588"],k7="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc interrupts",by=process.env.NO_COLOR===void 0;function L7(e){return e>=64?k7:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function z7(e,n){return e>=68&&n>=24?"side":e>=37?"wordmark":"line"}function Y7(e,n=44){let a=G7(),s=e.startsWith(a)?`~${e.slice(a.length)}`:e;if(s.length<=n)return s;let A=Math.floor((n-1)*.4);return`${s.slice(0,A)}\u2026${s.slice(-(n-1-A))}`}function K7({text:e,beak:n}){if(n===void 0)return(0,jn.jsx)(he,{color:by?"cyan":void 0,children:e.padEnd(OO)});let[a,s]=n;return(0,jn.jsxs)(he,{color:by?"cyan":void 0,children:[e.slice(0,a),(0,jn.jsx)(he,{color:by?"yellow":void 0,children:e.slice(a,s)}),e.padEnd(OO).slice(s)]})}function UO(){return(0,jn.jsxs)(he,{children:["Plato by Applivity",(0,jn.jsxs)(he,{dimColor:!0,children:[" \xB7 ",hd]})]})}function HO(){let{columns:e,rows:n}=Qy(),a=z7(e,n),s=Y7(process.cwd(),Math.max(20,Math.min(44,e-2))),A=L7(e);if(a==="line")return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[(0,jn.jsxs)(he,{children:[(0,jn.jsx)(he,{color:by?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,jn.jsxs)(he,{dimColor:!0,children:[" \xB7 ",hd]})]}),(0,jn.jsx)(he,{dimColor:!0,children:A})]});if(a==="wordmark")return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[uD.map(h=>(0,jn.jsx)(he,{color:by?"cyan":void 0,children:h},h)),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(UO,{}),(0,jn.jsx)(he,{dimColor:!0,children:s}),(0,jn.jsx)(he,{dimColor:!0,children:A})]});let f=Math.round((MO.length-uD.length)/2);return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[MO.map((h,E)=>(0,jn.jsxs)(kt,{children:[(0,jn.jsx)(K7,{text:h.text,beak:h.beak}),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(he,{children:uD[E-f]??""})]},h.text)),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(UO,{}),n<27?null:(0,jn.jsx)(he,{dimColor:!0,children:s}),(0,jn.jsx)(he,{dimColor:!0,children:A})]})}var cD=[{name:"mode",args:"plan|edit|auto",summary:"Switch mode (Shift+Tab cycles)"},{name:"model",args:"connection:model",summary:"Use another model"},{name:"team",args:"solo|duo|academy",summary:"Choose the team for the next run"},{name:"gitignore",args:"on|off",summary:"Skip what .gitignore excludes in search"},{name:"compact",summary:"Ask the current run to compact now"},{name:"new",summary:"Start a new conversation"},{name:"undo",summary:"Put back the files the last run wrote"},{name:"sessions",summary:"List saved sessions"},{name:"help",summary:"Show this help"},{name:"exit",summary:"Leave Plato"}];function uS(e){return e.args===void 0?`/${e.name}`:`/${e.name} ${e.args}`}function GO(e){return!e.startsWith("/")||e.includes(`
680
+ `),hidden:h-E}}var Ft=gt(lS(),1);var TO=gt(Ut(),1);var _7=process.env.NO_COLOR===void 0;function _O({text:e,columns:n}){let a=(0,TO.useMemo)(()=>NO(e),[e]);return(0,Ft.jsx)(kt,{flexDirection:"column",children:a.map((s,A)=>(0,Ft.jsx)(kt,{flexDirection:"column",marginBottom:A===a.length-1?0:1,children:(0,Ft.jsx)(M7,{block:s,columns:n})},A))})}function M7({block:e,columns:n}){switch(e.kind){case"heading":return(0,Ft.jsx)(he,{bold:!0,underline:e.level===1,children:(0,Ft.jsx)(Ry,{spans:e.spans})});case"paragraph":return(0,Ft.jsx)(he,{children:(0,Ft.jsx)(Ry,{spans:e.spans})});case"code":return(0,Ft.jsx)(O7,{block:e});case"list":return(0,Ft.jsx)(kt,{flexDirection:"column",children:e.items.map((a,s)=>(0,Ft.jsxs)(he,{children:[e.ordered?`${s+1}. `:"\u2022 ",(0,Ft.jsx)(Ry,{spans:a})]},s))});case"quote":return(0,Ft.jsx)(kt,{paddingLeft:2,children:(0,Ft.jsx)(he,{dimColor:!0,children:(0,Ft.jsx)(Ry,{spans:e.spans})})});case"rule":return(0,Ft.jsx)(he,{dimColor:!0,children:"\u2500".repeat(Math.max(3,Math.min(n,40)))});case"table":return(0,Ft.jsx)(U7,{block:e,columns:n})}}function O7({block:e}){return(0,Ft.jsxs)(kt,{flexDirection:"column",paddingLeft:2,children:[e.lang.length>0?(0,Ft.jsx)(he,{dimColor:!0,children:e.lang}):null,e.lines.map((n,a)=>(0,Ft.jsx)(he,{children:n.length>0?n:" "},a))]})}function U7({block:e,columns:n}){let a=e.header.map((f,h)=>Math.max(1,wy(Dy(f)),...e.rows.map(E=>wy(Dy(E[h]??[])))));if(a.reduce((f,h)=>f+h,0)+Math.max(0,a.length-1)*3>n){let f=[e.header,...e.rows].map(h=>h.map(Dy).join(" | "));return(0,Ft.jsx)(kt,{flexDirection:"column",children:f.map((h,E)=>(0,Ft.jsx)(he,{bold:E===0,children:h},E))})}let A=(f,h)=>(0,Ft.jsx)(he,{bold:h,children:f.map((E,y)=>(0,Ft.jsxs)(he,{children:[y>0?" \u2502 ":"",(0,Ft.jsx)(H7,{spans:E,width:a[y]??1,align:e.align[y]??"left"})]},y))});return(0,Ft.jsxs)(kt,{flexDirection:"column",children:[A(e.header,!0),(0,Ft.jsx)(he,{dimColor:!0,children:a.map(f=>"\u2500".repeat(f)).join("\u2500\u253C\u2500")}),e.rows.map((f,h)=>(0,Ft.jsx)(he,{children:A(f,!1)},h))]})}function H7({spans:e,width:n,align:a}){let s=Math.max(0,n-wy(Dy(e))),A=a==="right"?s:a==="center"?Math.floor(s/2):0;return(0,Ft.jsxs)(he,{children:[" ".repeat(A),(0,Ft.jsx)(Ry,{spans:e})," ".repeat(s-A)]})}function Ry({spans:e}){return(0,Ft.jsx)(Ft.Fragment,{children:e.map((n,a)=>{switch(n.kind){case"bold":return(0,Ft.jsx)(he,{bold:!0,children:n.text},a);case"italic":return(0,Ft.jsx)(he,{italic:!0,children:n.text},a);case"code":return(0,Ft.jsx)(he,{color:_7?"cyan":void 0,children:n.text},a);case"link":return(0,Ft.jsxs)(he,{children:[n.text,n.href===void 0?null:(0,Ft.jsxs)(he,{dimColor:!0,children:[" (",n.href,")"]})]},a);default:return(0,Ft.jsx)(he,{children:n.text},a)}})})}var jn=gt(lS(),1);import{homedir as G7}from"node:os";var hd="0.2.2";var MO=[{text:" \u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588"},{text:" \u2580\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2580"},{text:" \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584"},{text:" \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584"},{text:" \u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588\u2580 \u2580\u2588\u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2584\u2584\u2584 \u2588\u2588 \u2584\u2584\u2584 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588 \u2580\u2580\u2580 \u2588\u2588 \u2580\u2580\u2580 \u2588\u2588\u2588"},{text:" \u2588\u2588\u2588\u2588\u2584 \u2584\u2588\u2588\u2588\u2588\u2584 \u2584\u2588\u2588\u2588\u2588",beak:[13,17]},{text:" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588",beak:[14,16]},{text:" \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580",beak:[14,16]},{text:" \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580"},{text:" \u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580"}],OO=28,uD=["\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588"],k7="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc interrupts",by=process.env.NO_COLOR===void 0;function L7(e){return e>=64?k7:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function z7(e,n){return e>=68&&n>=24?"side":e>=37?"wordmark":"line"}function Y7(e,n=44){let a=G7(),s=e.startsWith(a)?`~${e.slice(a.length)}`:e;if(s.length<=n)return s;let A=Math.floor((n-1)*.4);return`${s.slice(0,A)}\u2026${s.slice(-(n-1-A))}`}function K7({text:e,beak:n}){if(n===void 0)return(0,jn.jsx)(he,{color:by?"cyan":void 0,children:e.padEnd(OO)});let[a,s]=n;return(0,jn.jsxs)(he,{color:by?"cyan":void 0,children:[e.slice(0,a),(0,jn.jsx)(he,{color:by?"yellow":void 0,children:e.slice(a,s)}),e.padEnd(OO).slice(s)]})}function UO(){return(0,jn.jsxs)(he,{children:["Plato by Applivity",(0,jn.jsxs)(he,{dimColor:!0,children:[" \xB7 ",hd]})]})}function HO(){let{columns:e,rows:n}=Qy(),a=z7(e,n),s=Y7(process.cwd(),Math.max(20,Math.min(44,e-2))),A=L7(e);if(a==="line")return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[(0,jn.jsxs)(he,{children:[(0,jn.jsx)(he,{color:by?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,jn.jsxs)(he,{dimColor:!0,children:[" \xB7 ",hd]})]}),(0,jn.jsx)(he,{dimColor:!0,children:A})]});if(a==="wordmark")return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[uD.map(h=>(0,jn.jsx)(he,{color:by?"cyan":void 0,children:h},h)),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(UO,{}),(0,jn.jsx)(he,{dimColor:!0,children:s}),(0,jn.jsx)(he,{dimColor:!0,children:A})]});let f=Math.round((MO.length-uD.length)/2);return(0,jn.jsxs)(kt,{flexDirection:"column",marginTop:1,children:[MO.map((h,E)=>(0,jn.jsxs)(kt,{children:[(0,jn.jsx)(K7,{text:h.text,beak:h.beak}),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(he,{children:uD[E-f]??""})]},h.text)),(0,jn.jsx)(he,{children:" "}),(0,jn.jsx)(UO,{}),n<27?null:(0,jn.jsx)(he,{dimColor:!0,children:s}),(0,jn.jsx)(he,{dimColor:!0,children:A})]})}var cD=[{name:"mode",args:"plan|edit|auto",summary:"Switch mode (Shift+Tab cycles)"},{name:"model",args:"connection:model",summary:"Use another model"},{name:"team",args:"solo|duo|academy",summary:"Choose the team for the next run"},{name:"gitignore",args:"on|off",summary:"Skip what .gitignore excludes in search"},{name:"compact",summary:"Ask the current run to compact now"},{name:"new",summary:"Start a new conversation"},{name:"undo",summary:"Put back the files the last run wrote"},{name:"sessions",summary:"List saved sessions"},{name:"help",summary:"Show this help"},{name:"exit",summary:"Leave Plato"}];function uS(e){return e.args===void 0?`/${e.name}`:`/${e.name} ${e.args}`}function GO(e){return!e.startsWith("/")||e.includes(`
681
681
  `)||/\s/.test(e)?null:e.slice(1)}function kO(e){let n=e.toLowerCase();return cD.filter(a=>a.name.startsWith(n))}var J7=10;function LO(e,n,a=J7){let s=Math.min(a,e),A=Math.max(0,Math.min(n-s+1,e-s));return{start:A,end:A+s}}function fD(e){return e.args===void 0?{text:`/${e.name}`,run:!0}:{text:`/${e.name} `,run:!1}}var zO={plan:"blue",edit:"green",auto:"yellow"},j7={plan:"Plan mode reads and proposes. It cannot write, and it runs only commands that read.",edit:"Edit mode asks before a write or a command.",auto:"Auto mode writes and runs commands without asking."},dD=process.env.NO_COLOR===void 0;function YO({session:e,onExit:n,firstPrompt:a}){let s=(0,ci.useSyncExternalStore)(e.subscribe,e.getSnapshot),{columns:A,rows:f}=Qy(),[h,E]=(0,ci.useState)(sS),[y,I]=(0,ci.useState)([]),[v,x]=(0,ci.useState)(null),[S,N]=(0,ci.useState)(0),[_,O]=(0,ci.useState)(0),[G,j]=(0,ci.useState)(null),we=(0,ci.useRef)(h);we.current=h,(0,ci.useEffect)(()=>{e.setEditorProbe(()=>we.current.text.length===0)},[e]);let oe=GO(h.text),Ae=oe===null?[]:kO(oe),xe=oe!==null&&Ae.length>0&&s.card===null&&!s.running&&G!==h.text,Me=Math.min(_,Math.max(0,Ae.length-1)),Re=s.rows.length===0&&s.streaming.length===0&&s.card===null&&!s.running&&a===void 0;(0,ci.useEffect)(()=>{O(0)},[oe]),(0,ci.useEffect)(()=>{a!==void 0&&a.length>0&&e.submit(a)},[]),(0,ci.useEffect)(()=>{s.running||N(0)},[s.running]);let ue=async Y=>{if(E(sS),x(null),j(null),I(ee=>[...ee,Y]),Y.startsWith("/")){await e.handleCommand(Y)==="exit"&&n();return}await e.submit(Y)};return $2((Y,ee)=>{let Je=ee.return||Y==="\r"||Y===`
682
682
  `,$e=Y.includes("\r")||Y.includes(`
683
683
  `),Ct=s.card;if(Ct!==null){if(ee.upArrow){e.cardMove(-1);return}if(ee.downArrow){e.cardMove(1);return}if(Je){e.cardConfirm();return}if(ee.escape){e.cardCancel();return}if(ee.ctrl&&Y==="c"){e.cardCancel();return}if(Ct.kind==="question"&&Ct.freeText){if(ee.backspace||ee.delete){e.cardBackspace();return}if($e&&!ee.ctrl&&!ee.meta){e.cardType(Y.replace(/[\r\n]+/g,"")),e.cardConfirm();return}!ee.ctrl&&!ee.meta&&Y.length>0&&e.cardType(Y);return}if(Y===" "){e.cardToggle();return}if(/^[1-9]$/.test(Y)){let Xe=Number.parseInt(Y,10)-1,fe=Ct.kind==="question"?Ct.options.length:Ct.options.length-1;Xe<=fe&&e.cardMove(Xe-Ct.selected)}return}if(ee.tab&&ee.shift){e.cycleMode();return}if(xe){let Xe=Ae[Me];if(ee.upArrow){O(Math.max(0,Me-1));return}if(ee.downArrow){O(Math.min(Ae.length-1,Me+1));return}if(ee.escape){j(h.text);return}if(ee.tab&&Xe!==void 0){E(vy(fD(Xe).text)),j(null);return}if(Je&&Xe!==void 0){let fe=fD(Xe);if(j(null),fe.run){ue(fe.text);return}E(vy(fe.text));return}}if(ee.escape){s.running&&e.cancel();return}if(ee.ctrl&&Y==="c"){if(s.running){e.cancel();return}if(S>=1){n();return}N(1),e.addNotice("Press Ctrl+C again to exit.");return}if(!s.running){if(Je){let Xe=h.text.trim();Xe.length>0&&ue(Xe);return}if($e&&!ee.ctrl&&!ee.meta){let fe=nD(h,Y.replace(/[\r\n]+/g," ")).text.trim();fe.length>0&&ue(fe);return}if(ee.upArrow){if(y.length===0)return;let Xe=v===null?y.length-1:Math.max(0,v-1);x(Xe),E(vy(y[Xe]??""));return}if(ee.downArrow){if(v===null)return;let Xe=v+1;Xe>=y.length?(x(null),E(sS)):(x(Xe),E(vy(y[Xe]??"")));return}if(ee.leftArrow){E(ee.ctrl||ee.meta?aD(h):oD(h,-1));return}if(ee.rightArrow){E(ee.ctrl||ee.meta?QO(h):oD(h,1));return}if(ee.home||ee.ctrl&&Y==="a"){E(vO(h));return}if(ee.end||ee.ctrl&&Y==="e"){E(wO(h));return}if(ee.ctrl&&Y==="w"){E(iD(h));return}if(ee.backspace){E(ee.ctrl||ee.meta?iD(h):BO(h));return}if(ee.delete){E(ee.ctrl||ee.meta?SO(h):IO(h));return}ee.ctrl||ee.meta||Y==="\r"||Y===`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applivity/plato",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"