@applivity/plato 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -9
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,8 +10,27 @@ 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
|
-
**
|
|
14
|
-
|
|
13
|
+
**0.5.1** updates this README to the current release; no code changed.
|
|
14
|
+
|
|
15
|
+
**0.5.0** adds pause and steering to the terminal. Esc pauses a run at a safe
|
|
16
|
+
point: a tool that is already running finishes, an approval card still opens,
|
|
17
|
+
and the text holds where you stopped it. Typing during a run steers it: Enter
|
|
18
|
+
sends the line, and the run receives it at its next safe point. `/continue`
|
|
19
|
+
resumes a paused run; `/continue <text>` sends the text and then resumes. Enter
|
|
20
|
+
alone never resumes. `/queue <text>` keeps a line for the next run instead.
|
|
21
|
+
Alt+Enter starts a new line in the composer. During a run only `/help`,
|
|
22
|
+
`/queue`, `/sessions`, `/compact` and `/continue` (while paused) act; every
|
|
23
|
+
other command is refused with one line, "Finish or stop the run first.", and
|
|
24
|
+
stays in the composer, so you can send it after the run. Two Esc presses within
|
|
25
|
+
about 1.5 s stop a paused run; a later press does nothing. Ctrl+C stops in one
|
|
26
|
+
press. A paused run does not survive Plato exiting.
|
|
27
|
+
|
|
28
|
+
**0.4.0** makes setup one screen, with the key checked before anything is saved,
|
|
29
|
+
and reads the context window the provider publishes, so a 1M model no longer
|
|
30
|
+
shows as 131k. A command's arguments come from one table, and the status line
|
|
31
|
+
is denser. It also adds `/resume`, the full tool row behind Ctrl+O, `@`
|
|
32
|
+
completion, the cold-start line, prompt history with Ctrl+R, and Ctrl+G to
|
|
33
|
+
bring a line back from an editor.
|
|
15
34
|
|
|
16
35
|
**0.3.0** brings long conversations to the terminal. `/compact` folds the older
|
|
17
36
|
messages into a summary, and so does the history when it reaches your compaction
|
|
@@ -127,13 +146,16 @@ In the interactive terminal:
|
|
|
127
146
|
| Key | Action |
|
|
128
147
|
|---|---|
|
|
129
148
|
| `Shift+Tab` | switch `plan`, `edit`, `auto` |
|
|
130
|
-
| `Enter` | send |
|
|
131
|
-
| `
|
|
132
|
-
| `
|
|
149
|
+
| `Enter` | send; during a run, steer it |
|
|
150
|
+
| `Alt+Enter` | start a new line in the composer |
|
|
151
|
+
| `Esc` | pause the run |
|
|
152
|
+
| `Esc` `Esc` | stop a paused run |
|
|
153
|
+
| `Ctrl+C` | stop the run; at the prompt, press twice to exit |
|
|
133
154
|
| `↑` / `↓` | prompt history |
|
|
134
155
|
|
|
135
|
-
Slash commands: `/mode`, `/model`, `/team`, `/gitignore`, `/compact`,
|
|
136
|
-
`/new`, `/sessions`, `/help`,
|
|
156
|
+
Slash commands: `/mode`, `/model`, `/team`, `/gitignore`, `/compact`,
|
|
157
|
+
`/continue`, `/queue`, `/resume`, `/undo`, `/new`, `/sessions`, `/help`,
|
|
158
|
+
`/exit`.
|
|
137
159
|
|
|
138
160
|
Type `/` to list them. Typing after the slash filters the list, `↑`/`↓` move,
|
|
139
161
|
`Tab` fills the command in, and `Enter` runs a command that takes no
|
|
@@ -143,6 +165,26 @@ A command that takes a word lists its words: after `/mode `, `/model `,
|
|
|
143
165
|
`/team ` or `/gitignore `, each choice appears with one line on what it does.
|
|
144
166
|
`Tab` completes and `Enter` accepts only a word from the list.
|
|
145
167
|
|
|
168
|
+
### While a run is live
|
|
169
|
+
|
|
170
|
+
A line typed during a run steers it: Enter sends the line, and the run receives
|
|
171
|
+
it at its next safe point. No second run starts. `/queue <text>` keeps the line
|
|
172
|
+
for the next run instead; a queued line survives a stop.
|
|
173
|
+
|
|
174
|
+
Esc pauses. A tool that is already running finishes, an approval card still
|
|
175
|
+
opens, and the text holds where you stopped it. At the prompt, `/continue`
|
|
176
|
+
resumes, and `/continue <text>` sends the text and then resumes. Enter alone
|
|
177
|
+
never resumes. Two Esc presses within about 1.5 s stop a paused run; a later
|
|
178
|
+
press does nothing. Ctrl+C stops in one press. An approval card takes Esc first:
|
|
179
|
+
there it denies the action and stops the run.
|
|
180
|
+
|
|
181
|
+
While a run is live, only `/help`, `/queue`, `/sessions`, `/compact` and
|
|
182
|
+
`/continue` (when a pause is in effect) act. Any other command is refused with
|
|
183
|
+
one line — "Finish or stop the run first." — and stays in the composer, so you
|
|
184
|
+
can send it after the run. It is not queued.
|
|
185
|
+
|
|
186
|
+
A paused run does not survive Plato exiting.
|
|
187
|
+
|
|
146
188
|
### The header and the status line
|
|
147
189
|
|
|
148
190
|
The top line names Plato, how it is running and the conversation. The
|
|
@@ -297,7 +339,7 @@ Plan-mode session asks before it sends.
|
|
|
297
339
|
|---|---|
|
|
298
340
|
| `plato auth login\|status\|list\|logout` | Manage connections and keys |
|
|
299
341
|
| `plato models [connection] [--refresh]` | List the models a connection offers |
|
|
300
|
-
| `plato model [
|
|
342
|
+
| `plato model [connection:model]` | Show the model in use, or switch to another |
|
|
301
343
|
| `plato sessions list\|export\|delete` | Manage saved conversations |
|
|
302
344
|
| `plato config [get\|set] [key] [value]` | Show or change a setting |
|
|
303
345
|
| `plato doctor` | Check the config, keys, keychain, model limits, writes, and the last run |
|
|
@@ -318,7 +360,8 @@ Plan-mode session asks before it sends.
|
|
|
318
360
|
| `~/.plato/DUO.yaml`, `ACADEMY.yaml` | Teams |
|
|
319
361
|
|
|
320
362
|
`PLATO_CONFIG_DIR`, `PLATO_DATA_DIR`, and `PLATO_HOME` override the first three
|
|
321
|
-
roots.
|
|
363
|
+
roots. On Windows, the config and data roots above are `%APPDATA%\Plato` and
|
|
364
|
+
`%LOCALAPPDATA%\Plato`.
|
|
322
365
|
|
|
323
366
|
## Privacy and safety
|
|
324
367
|
|
package/dist/cli.js
CHANGED
|
@@ -742,7 +742,7 @@ Cancelling at the next safe point. Press Ctrl+C again to exit.
|
|
|
742
742
|
`).split(`
|
|
743
743
|
`),r=[],u=0;for(;u<i.length;){let c=i[u]??"";if(c.trim().length===0){u+=1;continue}let h=l2.exec(c);if(h){let S=u+1;for(;S<i.length&&!l2.test(i[S]??"");)S+=1;if(S<i.length){r.push({kind:"code",lang:h[1]??"",lines:i.slice(u+1,S)}),u=S+1;continue}}let m=qU.exec(c);if(m){r.push({kind:"heading",level:m[1]?.length??1,spans:om(m[2]??"")}),u+=1;continue}if(VU.test(c)){r.push({kind:"rule"}),u+=1;continue}if(u+1<i.length&&c.includes("|")&&XU(i[u+1]??"")){let S=qS(c).map(om),R=qS(i[u+1]??"").map($Y);u+=2;let T=[];for(;u<i.length&&(i[u]??"").includes("|")&&(i[u]??"").trim()!=="";)T.push(qS(i[u]??"").map(om)),u+=1;r.push({kind:"table",align:R,header:S,rows:T});continue}let C=u2.exec(c);if(C){let S=Number.parseInt(C[1]??"",10),R=Number.isInteger(S),T=[],O=u;for(;O<i.length;){let M=u2.exec(i[O]??"");if(!M)break;T.push(om(M[2]??"")),O+=1}r.push({kind:"list",ordered:R,...R?{start:S}:{},items:T}),u=O;continue}let B=A2.exec(c);if(B){let S=[B[1]??""],R=u+1;for(;R<i.length;){let T=A2.exec(i[R]??"");if(!T)break;S.push(T[1]??""),R+=1}r.push({kind:"quote",spans:om(S.join(" "))}),u=R;continue}let v=[c.trim()],w=u+1;for(;w<i.length;){let S=i[w]??"";if(S.trim().length===0||l2.test(S)||qU.test(S)||VU.test(S)||u2.test(S)||A2.test(S)||S.includes("|")&&XU(i[w+1]??""))break;v.push(S.trim()),w+=1}r.push({kind:"paragraph",spans:om(v.join(" "))}),u=w}return r}var $U=8,PY=["team","duration","rate","tokens","model","waiting"];function WY(e,t,i=!1){let r=t>0?Math.max(0,Math.min(1,e/t)):0,u=Math.round(r*$U),c=`${"\u2588".repeat(u)}${"\u2591".repeat($U-u)}`,h=Math.round(r*100);return`${Ld(e)}/${i?"~":""}${Ld(t)} ${c} ${h}%`}function f2(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let i=Math.floor(t/60),r=t%60;if(i<60)return r===0?`${i}m`:`${i}m ${r}s`;let u=Math.floor(i/60),c=i%60;return c===0?`${u}h`:`${u}h ${c}m`}function d2(e,t){if(!(e<=0||t<1e3))return Math.round(e/(t/1e3))}function PU(e){return e.reduce((t,i)=>t+Ci(i.text),0)+Math.max(0,e.length-1)*3}function WU(e,t){let i=[{key:"mode",text:`mode: ${e.mode}`}];if(e.waiting!==void 0&&i.push({key:"waiting",text:e.waiting}),i.push({key:"team",text:`team: ${e.team}`}),i.push({key:"model",text:e.model}),e.window!==void 0&&i.push({key:"share",text:WY(e.usedTokens,e.window,e.windowApprox===!0)}),e.contextDue===!0&&i.push({key:"due",text:"summary due next run"}),i.push({key:"tokens",text:`\u2191${Ld(e.inputTokens)} \u2193${Ld(e.outputTokens)}`}),e.rate!==void 0&&i.push({key:"rate",text:`${e.rate} t/s`}),e.durationMs!==void 0&&i.push({key:"duration",text:f2(e.durationMs)}),PU(i)<=t)return i;let r=i;for(let u of PY)if(r.some(c=>c.key===u)&&(r=r.filter(c=>c.key!==u),PU(r)<=t))return r;return r}var eF=Ci("Plato \xB7 terminal \xB7 working\u2026"),tF=2,nF=8;function eH(e){return Math.max(0,e-eF-tF)}function XS(e,t,i){let r=i??t;return r<nF?"":Ps(e,r)}import{mkdirSync as oF,readFileSync as iF,renameSync as aF,writeFileSync as rF}from"node:fs";import{dirname as sF,join as lF}from"node:path";var tH=200;function nH(e,t=process.env){return lF(wg(t),"history",`${Dd(e)}.json`)}function uF(e){try{let t=JSON.parse(e);if(typeof t!="object"||t===null)return[];let i=t.entries;if(!Array.isArray(i))return[];let r=[];for(let u of i){if(typeof u!="object"||u===null)continue;let c=u,h=c.text,m=c.at;typeof h!="string"||h.trim().length===0||typeof m!="string"||Number.isNaN(Date.parse(m))||r.push({text:h,at:m})}return r.slice(-tH)}catch{return[]}}function oH(e,t=process.env){try{return uF(iF(nH(e,t),"utf8"))}catch{return[]}}function ZS(e,t,i=new Date){let r=t.trim();if(r.length===0)return[...e];let u=[...e];return u.at(-1)?.text===r?u[u.length-1]={text:r,at:i.toISOString()}:u.push({text:r,at:i.toISOString()}),u.slice(-tH)}function iH(e,t,i){let r=nH(e,t);oF(sF(r),{recursive:!0,mode:448});let u=`${r}.tmp`;rF(u,`${JSON.stringify({entries:i},null,2)}
|
|
744
744
|
`,{mode:384}),aF(u,r)}function aH(e,t){let i=t.toLowerCase(),r=[];for(let u=e.length-1;u>=0;u-=1){let c=e[u];c!==void 0&&c.text.toLowerCase().includes(i)&&r.push(c)}return r}function $S(e,t=Date.now()){let i=Date.parse(e);if(Number.isNaN(i))return"";let r=Math.max(0,Math.floor((t-i)/1e3));if(r<60)return"just now";let u=Math.floor(r/60);if(u<60)return`${u}m ago`;let c=Math.floor(u/60);if(c<24)return`${c}h ago`;let h=Math.floor(c/24);return h<7?`${h}d ago`:`${Math.floor(h/7)}w ago`}var AF=50;function rH(e,t){if(e.includes(`
|
|
745
|
-
`))return null;let i=Math.max(0,Math.min(t,e.length)),r=/(^|\s)@([^\s]*)$/.exec(e.slice(0,i));if(r===null||i<e.length&&!/\s/.test(e[i]??""))return null;let u=r[2]??"";return{start:i-u.length-1,query:u}}function sH(e,t){return Yu(e,"",{respectGitignore:t}).files}function cF(e,t){let i=t.lastIndexOf("/"),r=i<0?"":t.slice(0,i+1),u=(i<0?t:t.slice(i+1)).toLowerCase(),c=new Set,h=[];for(let C of e){if(!C.startsWith(r))continue;let B=C.slice(r.length);if(B.length===0)continue;let v=B.indexOf("/");if(v<0)B.toLowerCase().startsWith(u)&&h.push({path:`${r}${B}`,kind:"file"});else{let w=B.slice(0,v);w.toLowerCase().startsWith(u)&&c.add(`${r}${w}`)}}let m=[...[...c].map(C=>({path:C,kind:"dir"})),...h];return m.sort((C,B)=>C.kind!==B.kind?C.kind==="dir"?-1:1:C.path<B.path?-1:C.path>B.path?1:0),m}function lH(e,t){let i=cF(e,t.query);return{token:t,choices:i.slice(0,AF),total:i.length}}function uH(e){return e.kind==="dir"?`@${e.path}/`:`@${e.path} `}var tn=Bt(W0(),1);var AH=Bt(kt(),1);var cH=process.env.NO_COLOR===void 0;function h2({text:e,columns:t}){let i=(0,AH.useMemo)(()=>ZU(e),[e]);return(0,tn.jsx)(Nt,{flexDirection:"column",children:i.map((r,u)=>(0,tn.jsx)(Nt,{flexDirection:"column",marginBottom:u===i.length-1?0:1,children:(0,tn.jsx)(fF,{block:r,columns:t})},u))})}function fF({block:e,columns:t}){switch(e.kind){case"heading":return(0,tn.jsx)($,{bold:!0,underline:e.level===1,children:(0,tn.jsx)(lC,{spans:e.spans})});case"paragraph":return(0,tn.jsx)($,{children:(0,tn.jsx)(lC,{spans:e.spans})});case"code":return(0,tn.jsx)(hF,{block:e,columns:t});case"list":return(0,tn.jsx)(Nt,{flexDirection:"column",children:e.items.map((i,r)=>(0,tn.jsxs)($,{children:[e.ordered?`${(e.start??1)+r}. `:"\u2022 ",(0,tn.jsx)(lC,{spans:i})]},r))});case"quote":return(0,tn.jsx)(Nt,{paddingLeft:2,children:(0,tn.jsx)($,{dimColor:!0,children:(0,tn.jsx)(lC,{spans:e.spans})})});case"rule":return(0,tn.jsx)($,{dimColor:!0,children:"\u2500".repeat(Math.max(3,Math.min(t,40)))});case"table":return(0,tn.jsx)(pF,{block:e,columns:t})}}function dF(e,t){if(!(!cH||t!=="diff"&&t!=="patch")){if(e.startsWith("+"))return"green";if(e.startsWith("-"))return"red";if(e.startsWith("@@"))return"cyan"}}function hF({block:e,columns:t}){let i=Math.max(8,t-2);return(0,tn.jsxs)(Nt,{flexDirection:"column",paddingLeft:2,children:[e.lang.length>0?(0,tn.jsx)($,{dimColor:!0,children:e.lang}):null,e.lines.flatMap((r,u)=>{let c=/^\s*/.exec(r)?.[0]??"";return VS(r,i,c).map((m,C)=>(0,tn.jsx)($,{color:dF(r,e.lang),children:m.length>0?m:" "},`${u}-${C}`))})]})}function pF({block:e,columns:t}){let i=e.header.map((c,h)=>Math.max(1,Ci(sC(c)),...e.rows.map(m=>Ci(sC(m[h]??[])))));if(i.reduce((c,h)=>c+h,0)+Math.max(0,i.length-1)*3>t){let c=[e.header,...e.rows].map(h=>h.map(sC).join(" | "));return(0,tn.jsx)(Nt,{flexDirection:"column",children:c.map((h,m)=>(0,tn.jsx)($,{bold:m===0,children:h},m))})}let u=(c,h)=>(0,tn.jsx)($,{bold:h,children:c.map((m,C)=>(0,tn.jsxs)($,{children:[C>0?" \u2502 ":"",(0,tn.jsx)(gF,{spans:m,width:i[C]??1,align:e.align[C]??"left"})]},C))});return(0,tn.jsxs)(Nt,{flexDirection:"column",children:[u(e.header,!0),(0,tn.jsx)($,{dimColor:!0,children:i.map(c=>"\u2500".repeat(c)).join("\u2500\u253C\u2500")}),e.rows.map((c,h)=>(0,tn.jsx)($,{children:u(c,!1)},h))]})}function gF({spans:e,width:t,align:i}){let r=Math.max(0,t-Ci(sC(e))),u=i==="right"?r:i==="center"?Math.floor(r/2):0;return(0,tn.jsxs)($,{children:[" ".repeat(u),(0,tn.jsx)(lC,{spans:e})," ".repeat(r-u)]})}function lC({spans:e}){return(0,tn.jsx)(tn.Fragment,{children:e.map((t,i)=>{switch(t.kind){case"bold":return(0,tn.jsx)($,{bold:!0,children:t.text},i);case"italic":return(0,tn.jsx)($,{italic:!0,children:t.text},i);case"code":return(0,tn.jsx)($,{color:cH?"cyan":void 0,children:t.text},i);case"link":return(0,tn.jsxs)($,{children:[t.text,t.href===void 0?null:(0,tn.jsxs)($,{dimColor:!0,children:[" (",t.href,")"]})]},i);default:return(0,tn.jsx)($,{children:t.text},i)}})})}var jn=Bt(W0(),1);import{homedir as mF}from"node:os";var zd="0.5.0";var fH=[{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"}],dH=28,p2=["\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"],EF="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc pauses a run",uC=process.env.NO_COLOR===void 0;function yF(e){return e>=64?EF:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function CF(e,t){return e>=68&&t>=24?"side":e>=37?"wordmark":"line"}function BF(e,t=44){let i=mF(),r=e.startsWith(i)?`~${e.slice(i.length)}`:e;if(r.length<=t)return r;let u=Math.floor((t-1)*.4);return`${r.slice(0,u)}\u2026${r.slice(-(t-1-u))}`}function IF({text:e,beak:t}){if(t===void 0)return(0,jn.jsx)($,{color:uC?"cyan":void 0,children:e.padEnd(dH)});let[i,r]=t;return(0,jn.jsxs)($,{color:uC?"cyan":void 0,children:[e.slice(0,i),(0,jn.jsx)($,{color:uC?"yellow":void 0,children:e.slice(i,r)}),e.padEnd(dH).slice(r)]})}function hH(){return(0,jn.jsxs)($,{children:["Plato by Applivity",(0,jn.jsxs)($,{dimColor:!0,children:[" \xB7 ",zd]})]})}function pH(){let{columns:e,rows:t}=$0(),i=CF(e,t),r=BF(process.cwd(),Math.max(20,Math.min(44,e-2))),u=yF(e);if(i==="line")return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[(0,jn.jsxs)($,{children:[(0,jn.jsx)($,{color:uC?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,jn.jsxs)($,{dimColor:!0,children:[" \xB7 ",zd]})]}),(0,jn.jsx)($,{dimColor:!0,children:u})]});if(i==="wordmark")return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[p2.map(h=>(0,jn.jsx)($,{color:uC?"cyan":void 0,children:h},h)),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)(hH,{}),(0,jn.jsx)($,{dimColor:!0,children:r}),(0,jn.jsx)($,{dimColor:!0,children:u})]});let c=Math.round((fH.length-p2.length)/2);return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[fH.map((h,m)=>(0,jn.jsxs)(Nt,{children:[(0,jn.jsx)(IF,{text:h.text,beak:h.beak}),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)($,{children:p2[m-c]??""})]},h.text)),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)(hH,{}),t<27?null:(0,jn.jsx)($,{dimColor:!0,children:r}),(0,jn.jsx)($,{dimColor:!0,children:u})]})}var AC=[{name:"mode",summary:"Switch mode (Shift+Tab cycles)",choices:[{value:"plan",summary:"Read and propose; make no changes"},{value:"edit",summary:"Ask before each write or command"},{value:"auto",summary:"Write and run without asking"}]},{name:"model",summary:"Use another model",choices:[{value:"add",summary:"Set up another provider"}],takes:"connection:model"},{name:"team",summary:"Choose the team for the next run",choices:[{value:"solo",summary:"The worker works alone"},{value:"duo",summary:"One watcher reads the work and can advise"},{value:"academy",summary:"A panel of watchers reads the work"}]},{name:"gitignore",summary:"Skip what .gitignore excludes in search",choices:[{value:"on",summary:"Skip .gitignore paths in search"},{value:"off",summary:"Include them, marked in results"}]},{name:"compact",summary:"Summarise the conversation; mid-run, ask it to compact",freeText:!0},{name:"new",summary:"Start a new conversation"},{name:"continue",summary:"Resume a paused run (/continue <text> steers it)",freeText:!0},{name:"queue",summary:"Run this line when the current run ends",freeText:!0},{name:"resume",summary:"Open a saved conversation"},{name:"undo",summary:"Put back the files the last run wrote"},{name:"sessions",summary:"List saved sessions (/resume opens them)"},{name:"help",summary:"Show this help"},{name:"exit",summary:"Leave Plato"}];function QF(e){let t=(e.choices??[]).map(i=>i.value);return e.takes!==void 0&&t.push(e.takes),t.length===0?void 0:t.join("|")}function cC(e){let t=QF(e);return t===void 0?`/${e.name}`:`/${e.name} ${t}`}function gH(e){return!e.startsWith("/")||e.includes(`
|
|
745
|
+
`))return null;let i=Math.max(0,Math.min(t,e.length)),r=/(^|\s)@([^\s]*)$/.exec(e.slice(0,i));if(r===null||i<e.length&&!/\s/.test(e[i]??""))return null;let u=r[2]??"";return{start:i-u.length-1,query:u}}function sH(e,t){return Yu(e,"",{respectGitignore:t}).files}function cF(e,t){let i=t.lastIndexOf("/"),r=i<0?"":t.slice(0,i+1),u=(i<0?t:t.slice(i+1)).toLowerCase(),c=new Set,h=[];for(let C of e){if(!C.startsWith(r))continue;let B=C.slice(r.length);if(B.length===0)continue;let v=B.indexOf("/");if(v<0)B.toLowerCase().startsWith(u)&&h.push({path:`${r}${B}`,kind:"file"});else{let w=B.slice(0,v);w.toLowerCase().startsWith(u)&&c.add(`${r}${w}`)}}let m=[...[...c].map(C=>({path:C,kind:"dir"})),...h];return m.sort((C,B)=>C.kind!==B.kind?C.kind==="dir"?-1:1:C.path<B.path?-1:C.path>B.path?1:0),m}function lH(e,t){let i=cF(e,t.query);return{token:t,choices:i.slice(0,AF),total:i.length}}function uH(e){return e.kind==="dir"?`@${e.path}/`:`@${e.path} `}var tn=Bt(W0(),1);var AH=Bt(kt(),1);var cH=process.env.NO_COLOR===void 0;function h2({text:e,columns:t}){let i=(0,AH.useMemo)(()=>ZU(e),[e]);return(0,tn.jsx)(Nt,{flexDirection:"column",children:i.map((r,u)=>(0,tn.jsx)(Nt,{flexDirection:"column",marginBottom:u===i.length-1?0:1,children:(0,tn.jsx)(fF,{block:r,columns:t})},u))})}function fF({block:e,columns:t}){switch(e.kind){case"heading":return(0,tn.jsx)($,{bold:!0,underline:e.level===1,children:(0,tn.jsx)(lC,{spans:e.spans})});case"paragraph":return(0,tn.jsx)($,{children:(0,tn.jsx)(lC,{spans:e.spans})});case"code":return(0,tn.jsx)(hF,{block:e,columns:t});case"list":return(0,tn.jsx)(Nt,{flexDirection:"column",children:e.items.map((i,r)=>(0,tn.jsxs)($,{children:[e.ordered?`${(e.start??1)+r}. `:"\u2022 ",(0,tn.jsx)(lC,{spans:i})]},r))});case"quote":return(0,tn.jsx)(Nt,{paddingLeft:2,children:(0,tn.jsx)($,{dimColor:!0,children:(0,tn.jsx)(lC,{spans:e.spans})})});case"rule":return(0,tn.jsx)($,{dimColor:!0,children:"\u2500".repeat(Math.max(3,Math.min(t,40)))});case"table":return(0,tn.jsx)(pF,{block:e,columns:t})}}function dF(e,t){if(!(!cH||t!=="diff"&&t!=="patch")){if(e.startsWith("+"))return"green";if(e.startsWith("-"))return"red";if(e.startsWith("@@"))return"cyan"}}function hF({block:e,columns:t}){let i=Math.max(8,t-2);return(0,tn.jsxs)(Nt,{flexDirection:"column",paddingLeft:2,children:[e.lang.length>0?(0,tn.jsx)($,{dimColor:!0,children:e.lang}):null,e.lines.flatMap((r,u)=>{let c=/^\s*/.exec(r)?.[0]??"";return VS(r,i,c).map((m,C)=>(0,tn.jsx)($,{color:dF(r,e.lang),children:m.length>0?m:" "},`${u}-${C}`))})]})}function pF({block:e,columns:t}){let i=e.header.map((c,h)=>Math.max(1,Ci(sC(c)),...e.rows.map(m=>Ci(sC(m[h]??[])))));if(i.reduce((c,h)=>c+h,0)+Math.max(0,i.length-1)*3>t){let c=[e.header,...e.rows].map(h=>h.map(sC).join(" | "));return(0,tn.jsx)(Nt,{flexDirection:"column",children:c.map((h,m)=>(0,tn.jsx)($,{bold:m===0,children:h},m))})}let u=(c,h)=>(0,tn.jsx)($,{bold:h,children:c.map((m,C)=>(0,tn.jsxs)($,{children:[C>0?" \u2502 ":"",(0,tn.jsx)(gF,{spans:m,width:i[C]??1,align:e.align[C]??"left"})]},C))});return(0,tn.jsxs)(Nt,{flexDirection:"column",children:[u(e.header,!0),(0,tn.jsx)($,{dimColor:!0,children:i.map(c=>"\u2500".repeat(c)).join("\u2500\u253C\u2500")}),e.rows.map((c,h)=>(0,tn.jsx)($,{children:u(c,!1)},h))]})}function gF({spans:e,width:t,align:i}){let r=Math.max(0,t-Ci(sC(e))),u=i==="right"?r:i==="center"?Math.floor(r/2):0;return(0,tn.jsxs)($,{children:[" ".repeat(u),(0,tn.jsx)(lC,{spans:e})," ".repeat(r-u)]})}function lC({spans:e}){return(0,tn.jsx)(tn.Fragment,{children:e.map((t,i)=>{switch(t.kind){case"bold":return(0,tn.jsx)($,{bold:!0,children:t.text},i);case"italic":return(0,tn.jsx)($,{italic:!0,children:t.text},i);case"code":return(0,tn.jsx)($,{color:cH?"cyan":void 0,children:t.text},i);case"link":return(0,tn.jsxs)($,{children:[t.text,t.href===void 0?null:(0,tn.jsxs)($,{dimColor:!0,children:[" (",t.href,")"]})]},i);default:return(0,tn.jsx)($,{children:t.text},i)}})})}var jn=Bt(W0(),1);import{homedir as mF}from"node:os";var zd="0.5.1";var fH=[{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"}],dH=28,p2=["\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"],EF="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc pauses a run",uC=process.env.NO_COLOR===void 0;function yF(e){return e>=64?EF:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function CF(e,t){return e>=68&&t>=24?"side":e>=37?"wordmark":"line"}function BF(e,t=44){let i=mF(),r=e.startsWith(i)?`~${e.slice(i.length)}`:e;if(r.length<=t)return r;let u=Math.floor((t-1)*.4);return`${r.slice(0,u)}\u2026${r.slice(-(t-1-u))}`}function IF({text:e,beak:t}){if(t===void 0)return(0,jn.jsx)($,{color:uC?"cyan":void 0,children:e.padEnd(dH)});let[i,r]=t;return(0,jn.jsxs)($,{color:uC?"cyan":void 0,children:[e.slice(0,i),(0,jn.jsx)($,{color:uC?"yellow":void 0,children:e.slice(i,r)}),e.padEnd(dH).slice(r)]})}function hH(){return(0,jn.jsxs)($,{children:["Plato by Applivity",(0,jn.jsxs)($,{dimColor:!0,children:[" \xB7 ",zd]})]})}function pH(){let{columns:e,rows:t}=$0(),i=CF(e,t),r=BF(process.cwd(),Math.max(20,Math.min(44,e-2))),u=yF(e);if(i==="line")return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[(0,jn.jsxs)($,{children:[(0,jn.jsx)($,{color:uC?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,jn.jsxs)($,{dimColor:!0,children:[" \xB7 ",zd]})]}),(0,jn.jsx)($,{dimColor:!0,children:u})]});if(i==="wordmark")return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[p2.map(h=>(0,jn.jsx)($,{color:uC?"cyan":void 0,children:h},h)),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)(hH,{}),(0,jn.jsx)($,{dimColor:!0,children:r}),(0,jn.jsx)($,{dimColor:!0,children:u})]});let c=Math.round((fH.length-p2.length)/2);return(0,jn.jsxs)(Nt,{flexDirection:"column",marginTop:1,children:[fH.map((h,m)=>(0,jn.jsxs)(Nt,{children:[(0,jn.jsx)(IF,{text:h.text,beak:h.beak}),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)($,{children:p2[m-c]??""})]},h.text)),(0,jn.jsx)($,{children:" "}),(0,jn.jsx)(hH,{}),t<27?null:(0,jn.jsx)($,{dimColor:!0,children:r}),(0,jn.jsx)($,{dimColor:!0,children:u})]})}var AC=[{name:"mode",summary:"Switch mode (Shift+Tab cycles)",choices:[{value:"plan",summary:"Read and propose; make no changes"},{value:"edit",summary:"Ask before each write or command"},{value:"auto",summary:"Write and run without asking"}]},{name:"model",summary:"Use another model",choices:[{value:"add",summary:"Set up another provider"}],takes:"connection:model"},{name:"team",summary:"Choose the team for the next run",choices:[{value:"solo",summary:"The worker works alone"},{value:"duo",summary:"One watcher reads the work and can advise"},{value:"academy",summary:"A panel of watchers reads the work"}]},{name:"gitignore",summary:"Skip what .gitignore excludes in search",choices:[{value:"on",summary:"Skip .gitignore paths in search"},{value:"off",summary:"Include them, marked in results"}]},{name:"compact",summary:"Summarise the conversation; mid-run, ask it to compact",freeText:!0},{name:"new",summary:"Start a new conversation"},{name:"continue",summary:"Resume a paused run (/continue <text> steers it)",freeText:!0},{name:"queue",summary:"Run this line when the current run ends",freeText:!0},{name:"resume",summary:"Open a saved conversation"},{name:"undo",summary:"Put back the files the last run wrote"},{name:"sessions",summary:"List saved sessions (/resume opens them)"},{name:"help",summary:"Show this help"},{name:"exit",summary:"Leave Plato"}];function QF(e){let t=(e.choices??[]).map(i=>i.value);return e.takes!==void 0&&t.push(e.takes),t.length===0?void 0:t.join("|")}function cC(e){let t=QF(e);return t===void 0?`/${e.name}`:`/${e.name} ${t}`}function gH(e){return!e.startsWith("/")||e.includes(`
|
|
746
746
|
`)||/\s/.test(e)?null:e.slice(1)}function mH(e){let t=e.toLowerCase();return AC.filter(i=>i.name.startsWith(t))}var SF=10;function fC(e,t,i=SF){let r=Math.min(i,e),u=Math.max(0,Math.min(t-r+1,e-r));return{start:u,end:u+r}}function g2(e){return(e.choices??[]).length>0||e.takes!==void 0?{text:`/${e.name} `,run:!1}:{text:`/${e.name}`,run:!0}}function EH(e,t){let i=e.trim();if(i===`/${t.name}`)return{action:"run",text:i};let r=g2(t);return r.run?{action:"run",text:r.text}:{action:"fill",text:r.text}}function vF(e){if(!e.startsWith("/")||e.includes(`
|
|
747
747
|
`))return null;let t=/^\/(\S+) (.*)$/.exec(e);if(t===null)return null;let i=t[1]??"",r=AC.find(u=>u.name===i);return r===void 0?null:{command:r,fragment:t[2]??""}}function wF(e){let t=e.fragment.toLowerCase();return(e.command.choices??[]).filter(i=>i.value.toLowerCase().startsWith(t))}function yH(e){let t=vF(e);if(t===null)return null;let i=wF(t);return i.length>0?{...t,choices:i,described:!1}:t.command.freeText===!0&&t.fragment.length===0?{...t,choices:[],described:!0}:null}function CH(e,t,i){if(i===void 0)return null;let r=`/${t.command.name} ${i.value}`;return e.trim()===r?{action:"run",text:r}:{action:"fill",text:r}}function IH(e){let t=e.replace(/\r\n?/g,`
|
|
748
748
|
`);return t.endsWith(`
|