@applivity/plato 0.1.1 → 0.1.3

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 +39 -7
  2. package/dist/cli.js +1 -1
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -4,7 +4,12 @@ Plato is an AI coding agent for the terminal. It shows its work, lets you steer
4
4
  mid-run, and stops at a safe point. The same engine powers the
5
5
  [VS Code extension](https://marketplace.visualstudio.com/items?itemName=applivity.plato).
6
6
 
7
- **Pre-release.** This is `0.1.1`. The core of the agent is the same code the
7
+ **Plan, edit, or auto. Solo, duo, or academy. You hold the switch.**
8
+
9
+ [plato.applivity.com](https://plato.applivity.com) · [Install](#install) ·
10
+ [Authenticate](#authenticate) · [Teams](#teams) · [Commands](#commands)
11
+
12
+ **Pre-release.** This is `0.1.3`. The core of the agent is the same code the
8
13
  extension has shipped, but the terminal host is new.
9
14
 
10
15
  ## Install
@@ -93,15 +98,35 @@ you agree, and the same run continues.
93
98
 
94
99
  ### Teams
95
100
 
101
+ Plato is always the one doing the work. The team decides who is watching.
102
+
103
+ | Team | Who is watching |
104
+ |---|---|
105
+ | `solo` | Nobody. The default, and the cheapest to run. |
106
+ | `duo` | One philosopher, with its own role and permissions. |
107
+ | `academy` | Up to five, each watching for something different. |
108
+
96
109
  ```sh
97
- plato --team duo # Plato plus one philosopher
98
- plato --team academy # the council in ~/.plato/ACADEMY.yaml
110
+ plato --team duo # Plato plus one philosopher
111
+ plato --team academy # the council in ~/.plato/ACADEMY.yaml
112
+ plato -p "fix the test" --team duo
99
113
  ```
100
114
 
101
- A philosopher watches the run and can inject guidance, pause it, or stop it. It
102
- never approves a tool call. Duo uses `~/.plato/DUO.yaml`; Academy uses
103
- `~/.plato/ACADEMY.yaml`. Both files are shared with the extension, and a
104
- missing file runs the built-in default.
115
+ A philosopher reads the run and can do one of four things: leave it alone, send
116
+ a short correction, pause the run and hand it back to you, or stop it. It never
117
+ approves a tool call. Permissions are per watcher, so you can allow a pause and
118
+ refuse a stop. A run allows five interventions in total, however many are
119
+ watching, and a watcher that errors or answers with nonsense is counted and
120
+ ignored — it cannot hang the run.
121
+
122
+ Each watcher has its own model in the file, so it need not be the model doing
123
+ the work. Duo uses `~/.plato/DUO.yaml`; Academy uses `~/.plato/ACADEMY.yaml`.
124
+ Both are shared with the extension, and a missing file runs the built-in
125
+ default: Aristotle for Duo, and Aristotle and Pythagoras for Academy, seeded
126
+ with the working model.
127
+
128
+ Change it in a session with `/team duo`, or with `plato config set team duo`.
129
+ Both are saved, so the next run uses it too.
105
130
 
106
131
  ### Search and `.gitignore`
107
132
 
@@ -176,6 +201,13 @@ is covered by the same scrubbing wherever the value goes.
176
201
  A 0600 file is plaintext. The keychain raises the effort; it does not protect a
177
202
  compromised account. `plato auth status` names the source in use.
178
203
 
204
+ ## Support
205
+
206
+ Questions, bug reports, and feature requests:
207
+ [plato-feedback@applivity.com](mailto:plato-feedback@applivity.com).
208
+
209
+ Plato is made by [Applivity](https://applivity.com).
210
+
179
211
  ## Licence
180
212
 
181
213
  Apache License 2.0. See `LICENSE`, `NOTICE`, and `THIRD-PARTY-NOTICES.md` in this
package/dist/cli.js CHANGED
@@ -650,7 +650,7 @@ Read about how to prevent this error on https://github.com/vadimdemedes/ink/#isr
650
650
  `,I=this.lastTerminalHeight,D=wz({isStdoutTty:f,viewportRows:h,previousViewportRows:I,previousOutputHeight:this.lastOutputHeight,nextOutputHeight:i,isUnmounting:this.isUnmounting});if(this.lastTerminalHeight=h,!(!D&&!A&&y===this.lastOutputToRender&&!this.log.isCursorDirty())){if(this.log.setCursorPosition(this.cursorPosition),D){let T=this.shouldSync();if(T&&this.options.stdout.write(cd),this.alternateScreen)this.options.stdout.write(h4+this.fullStaticOutput+y);else if(this.lastOutputHeight>=h){let S=h4,x=this.log.getCursorPosition();!E4&&x&&h<I&&(S=(x.y>0?on.cursorUp(x.y):"")+on.cursorTo(0)+on.eraseDown),this.options.stdout.write(S+s+y)}else this.log.clear(),this.options.stdout.write(s+y);this.lastOutput=a,this.lastOutputToRender=y,this.lastOutputHeight=i,this.log.sync(y),T&&this.options.stdout.write(gc);return}if(A){let T=this.shouldSync();T&&this.options.stdout.write(cd),this.log.clear(),this.options.stdout.write(s),this.log(y),T&&this.options.stdout.write(gc)}else this.throttledLog(y);this.lastOutput=a,this.lastOutputToRender=y,this.lastOutputHeight=i}}initKittyKeyboard(){if(!this.options.kittyKeyboard)return;let a=this.options.kittyKeyboard,i=a.mode??"auto";if(i==="disabled")return;let s=a.flags??["disambiguateEscapeCodes"];if(i==="enabled"){bQ(this.options.stdin)&&this.options.stdout.isTTY&&this.enableKittyProtocol(s);return}!this.interactive||!bQ(this.options.stdin)||!this.options.stdout.isTTY||this.confirmKittySupport(s)}confirmKittySupport(a){let i=A=>{this.finishKittyDetection=void 0,clearTimeout(s),A&&!this.isUnmounted&&this.enableKittyProtocol(a)},s=setTimeout(()=>{i(!1)},200);this.finishKittyDetection=i,this.options.stdout.write("\x1B[?u")}enableKittyProtocol(a){this.options.stdout.write(`\x1B[>${ED(a)}u`),this.kittyProtocolEnabled=!0,this.kittyFlags=a}beginSuspend(){if(this.interactive){if(this.isSuspended)throw new Error("The terminal is already suspended. Resume the current suspension before suspending again.");if(this.finishKittyDetection?.(!1),this.isSuspended=!0,!(!this.interactive||this.isUnmounted||this.isUnmounting))try{let{stdout:a}=this.options,{canWriteToStdout:i}=UQ(a);Ch(this.throttledOnRender,i),Ch(this.throttledLog,i),i&&(this.log.clear(),this.log.done(),this.kittyProtocolEnabled&&(this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.kittyProtocolEnabled=!1),this.alternateScreen&&this.writeBestEffort(this.options.stdout,on.exitAlternativeScreen)),this.pauseInput?.()}catch(a){this.isSuspended=!1;try{this.resumeInput?.()}catch{}throw a}}}async endSuspend(){if(!this.isSuspended||(this.isSuspended=!1,!this.interactive||this.isUnmounted||this.isUnmounting))return;this.resumeInput?.();let{stdout:a}=this.options,{canWriteToStdout:i}=UQ(a);i&&(this.alternateScreen&&this.writeBestEffort(this.options.stdout,on.enterAlternativeScreen+(this.options.debug?"":this.fullStaticOutput)),this.kittyFlags&&(this.writeBestEffort(this.options.stdout,`\x1B[>${ED(this.kittyFlags)}u`),this.kittyProtocolEnabled=!0)),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.log.reset();try{this.calculateLayout(),this.onRender(),await this.waitUntilRenderFlush()}catch{}}render(a){let i=OQ.default.createElement(pc,{value:{isScreenReaderEnabled:this.isScreenReaderEnabled}},OQ.default.createElement(d4,{stdin:this.options.stdin,stdout:this.options.stdout,stderr:this.options.stderr,exitOnCtrlC:this.options.exitOnCtrlC,interactive:this.interactive,renderThrottleMs:this.renderThrottleMs,writeToStdout:this.writeToStdout,writeToStderr:this.writeToStderr,setCursorPosition:this.setCursorPosition,onExit:this.handleAppExit,onWaitUntilRenderFlush:this.waitUntilRenderFlush,onSuspendTerminal:this.suspendTerminal,onRegisterInputControl:this.registerInputControl,onKittyQueryResponse:this.handleKittyQueryResponse},OQ.default.createElement(MQ,{value:this.rootNode},a)));this.options.concurrent?ri.updateContainer(i,this.container,null,sy):(ri.updateContainerSync(i,this.container,null,sy),ri.flushSyncWork())}writeToStdout(a){if(this.isUnmounted||this.isSuspended)return;if(this.options.debug){this.options.stdout.write(a+this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stdout.write(a);return}let i=this.shouldSync();i&&this.options.stdout.write(cd),this.log.clear(),this.options.stdout.write(a),this.restoreLastOutput(),i&&this.options.stdout.write(gc)}writeToStderr(a){if(this.isUnmounted||this.isSuspended)return;if(this.options.debug){this.options.stderr.write(a),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stderr.write(a);return}let i=this.shouldSync();i&&this.options.stdout.write(cd),this.log.clear(),this.options.stderr.write(a),this.restoreLastOutput(),i&&this.options.stdout.write(gc)}unmount(a){if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(Ay.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);let{stdout:i}=this.options,{canWriteToStdout:s}=UQ(i);Ch(this.throttledOnRender,s),s&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&!this.hasRenderedStaticOutput)&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),Ch(this.throttledLog,s),typeof this.restoreConsole=="function"&&this.restoreConsole();let A=()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.finishKittyDetection?.(!1),s&&(this.kittyProtocolEnabled&&(this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.kittyProtocolEnabled=!1),this.interactive&&!this.options.debug&&this.log.done(),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,on.exitAlternativeScreen),this.writeBestEffort(this.options.stdout,AD),this.alternateScreen=!1),this.interactive||this.options.stdout.write(this.options.debug?`
651
651
  `:this.lastOutput+`
652
652
  `)),this.kittyProtocolEnabled=!1,ly.delete(this.options.stdout),this.rootNode.yogaNode?.free(),this.rootNode.yogaNode=void 0;let{exitResult:h}=this,C=()=>{wD(a)?this.rejectExitPromise(a):this.resolveExitPromise(h)};a!==void 0&&!wD(a)?C():s?this.options.stdout.write("",C):setImmediate(C)},f=ri;this.options.concurrent?(ri.updateContainerSync(null,this.container,null,sy),ri.flushSyncWork(),f.flushPassiveEffects?.(),A()):(ri.updateContainerSync(null,this.container,null,sy),ri.flushSyncWork(),A())}async waitUntilExit(){return!this.isUnmounting&&!this.beforeExitHandler&&(this.beforeExitHandler=()=>{this.unmount()},Ay.once("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await p4(),this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(this.isConcurrent&&this.hasPendingConcurrentWork()&&(await Promise.race([this.awaitNextRender(),this.awaitExit()]),this.isUnmounted||this.isUnmounting)){this.nextRenderCommit=void 0,await this.awaitExit();return}ri.flushSyncWork();let{stdout:a}=this.options,{canWriteToStdout:i}=UQ(a);if(Ch(this.throttledOnRender,i),Ch(this.throttledLog,i),i){await new Promise(s=>{this.options.stdout.write("",()=>{s()})});return}await p4()}clear(){!this.interactive||this.options.debug||(this.log.clear(),this.lastOutputHeight=0)}patchConsole(){this.options.debug||(this.restoreConsole=kx((a,i)=>{a==="stdout"?this.writeToStdout(i):a==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}registerInputControl(a,i){this.pauseInput=a,this.resumeInput=i}async suspendTerminal(a){if(this.beginSuspend(),a){try{await a()}finally{await this.endSuspend()}return}let i=!1,s=async()=>{i||(i=!0,await this.endSuspend())};return{resume:s,[Symbol.asyncDispose]:s}}};var Nz=(e,a)=>{let{stdout:i=cy.stdout,stdin:s=cy.stdin,stderr:A=cy.stderr,exitOnCtrlC:f=!0,patchConsole:h=!0,...C}=xz(a),y={stdout:i,stdin:s,stderr:A,debug:!1,exitOnCtrlC:f,patchConsole:h,maxFps:30,incrementalRendering:!1,concurrent:!1,alternateScreen:!1,...C},I=Tz(y.stdout,()=>new uy(y));return I.render(e),{rerender:I.render,unmount(){I.unmount()},waitUntilExit:I.waitUntilExit,waitUntilRenderFlush:I.waitUntilRenderFlush,cleanup(){I.unmount()},clear:I.clear}},bD=Nz,xz=(e={})=>e instanceof bz?{stdout:e,stdin:cy.stdin}:e,Tz=(e,a)=>{let i=ly.get(e);if(i===void 0){let s=a();return ly.set(e,s),s}return cy.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
653
- `),i};var _z=Ee(He(),1);var Mz=Ee(ZI(),1);var nr=Ee(He(),1);function GQ(e){let{items:a,children:i,style:s}=e,[A,f]=(0,nr.useState)(0),h=(0,nr.use)(kA),C=s?.backgroundColor||h,y=(0,nr.useMemo)(()=>a.slice(A),[a,A]);(0,nr.useLayoutEffect)(()=>{f(a.length)},[a.length]);let I=y.map((T,S)=>i(T,A+S)),D=(0,nr.useMemo)(()=>({position:"absolute",flexDirection:"column",...s,display:y.length>0?s?.display:"none"}),[s,y.length]);return nr.default.createElement(kA,{value:C},nr.default.createElement("ink-box",{internal_static:!0,style:D},I))}var C4=Ee(He(),1);var Uz=Ee(He(),1);var Oz=Ee(He(),1);var fy=Ee(He(),1);var y4=Ee(He(),1);var ND=()=>(0,y4.use)(NQ);var Hz=(e,a={})=>{let{setRawMode:i,internal_exitOnCtrlC:s,internal_eventEmitter:A}=ND();(0,fy.useEffect)(()=>{if(a.isActive!==!1)return i(!0),()=>{i(!1)}},[a.isActive,i]);let f=(0,fy.useEffectEvent)(h=>{let C=mh(h),y={upArrow:C.name==="up",downArrow:C.name==="down",leftArrow:C.name==="left",rightArrow:C.name==="right",pageDown:C.name==="pagedown",pageUp:C.name==="pageup",home:C.name==="home",end:C.name==="end",return:C.name==="return",escape:C.name==="escape",ctrl:C.ctrl,shift:C.shift,tab:C.name==="tab",backspace:C.name==="backspace",delete:C.name==="delete",meta:C.meta,super:C.super??!1,hyper:C.hyper??!1,capsLock:C.capsLock??!1,numLock:C.numLock??!1,eventType:C.eventType},I;C.isKittyProtocol?I=C.isPrintable?C.text??C.name:"":C.ctrl?I=C.name==="space"?" ":C.name??"":I=C.sequence,!C.isKittyProtocol&&xM.includes(C.name)&&(I=""),I.startsWith("\x1B")&&(I=I.slice(1)),!C.isKittyProtocol&&I.length===1&&/[A-Z]/.test(I)&&(y.shift=!0),!(s&&C.name==="c"&&y.ctrl&&C.eventType!=="release")&&ri.discreteUpdates(()=>{e(I,y)})});(0,fy.useEffect)(()=>{if(a.isActive!==!1)return A.on("input",f),()=>{A.removeListener("input",f)}},[a.isActive,A])},xD=Hz;var B4=Ee(He(),1);var Gz=Ee(He(),1);var I4=Ee(He(),1);function LQ(){return(0,I4.use)(xQ)}var Lz=Ee(He(),1);var TD=Ee(He(),1);var zz=Ee(He(),1);var Yz=Ee(He(),1);var kQ=Ee(He(),1);var dy=Ee(He(),1);var zQ=Ee(He(),1);var Kz=()=>{let{stdout:e}=LQ(),[a,i]=(0,zQ.useState)(()=>GA(e));return(0,zQ.useEffect)(()=>{let s=()=>{i(GA(e))};return e.on("resize",s),s(),()=>{e.off("resize",s)}},[e]),a},_D=Kz;var gy=Ee(He(),1);var L4=Ee(He(),1);var Rt=Ee(UD(),1);var Sl=Ee(He(),1);var JQ={text:"",cursor:0};function py(e){return{text:e,cursor:e.length}}function OD(e,a){let i=e.text.slice(0,e.cursor),s=e.text.slice(e.cursor);return{text:i+a+s,cursor:e.cursor+a.length}}function D4(e){return e.cursor===0?e:{text:e.text.slice(0,e.cursor-1)+e.text.slice(e.cursor),cursor:e.cursor-1}}function R4(e){return e.cursor>=e.text.length?e:{text:e.text.slice(0,e.cursor)+e.text.slice(e.cursor+1),cursor:e.cursor}}function HD(e,a){let i=Math.max(0,Math.min(e.text.length,e.cursor+a));return i===e.cursor?e:{...e,cursor:i}}function w4(e){return e.cursor===0?e:{...e,cursor:0}}function b4(e){return e.cursor===e.text.length?e:{...e,cursor:e.text.length}}var Fn=Ee(UD(),1);import{homedir as qz}from"node:os";var hy="0.1.1";var N4=[{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"}],x4=28,GD=["\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588"],Vz="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc interrupts",my=process.env.NO_COLOR===void 0;function Xz(e){return e>=64?Vz:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function Zz(e,a){return e>=68&&a>=24?"side":e>=37?"wordmark":"line"}function Pz(e,a=44){let i=qz(),s=e.startsWith(i)?`~${e.slice(i.length)}`:e;if(s.length<=a)return s;let A=Math.floor((a-1)*.4);return`${s.slice(0,A)}\u2026${s.slice(-(a-1-A))}`}function Wz({text:e,beak:a}){if(a===void 0)return(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:e.padEnd(x4)});let[i,s]=a;return(0,Fn.jsxs)(bt,{color:my?"cyan":void 0,children:[e.slice(0,i),(0,Fn.jsx)(bt,{color:my?"yellow":void 0,children:e.slice(i,s)}),e.padEnd(x4).slice(s)]})}function T4(){return(0,Fn.jsxs)(bt,{children:["Plato by Applivity",(0,Fn.jsxs)(bt,{dimColor:!0,children:[" \xB7 ",hy]})]})}function _4(){let{columns:e,rows:a}=_D(),i=Zz(e,a),s=Pz(process.cwd(),Math.max(20,Math.min(44,e-2))),A=Xz(e);if(i==="line")return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[(0,Fn.jsxs)(bt,{children:[(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,Fn.jsxs)(bt,{dimColor:!0,children:[" \xB7 ",hy]})]}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]});if(i==="wordmark")return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[GD.map(h=>(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:h},h)),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(T4,{}),(0,Fn.jsx)(bt,{dimColor:!0,children:s}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]});let f=Math.round((N4.length-GD.length)/2);return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[N4.map((h,C)=>(0,Fn.jsxs)(zn,{children:[(0,Fn.jsx)(Wz,{text:h.text,beak:h.beak}),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(bt,{children:GD[C-f]??""})]},h.text)),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(T4,{}),a<27?null:(0,Fn.jsx)(bt,{dimColor:!0,children:s}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]})}var LD=[{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 FQ(e){return e.args===void 0?`/${e.name}`:`/${e.name} ${e.args}`}function M4(e){return!e.startsWith("/")||e.includes(`
653
+ `),i};var _z=Ee(He(),1);var Mz=Ee(ZI(),1);var nr=Ee(He(),1);function GQ(e){let{items:a,children:i,style:s}=e,[A,f]=(0,nr.useState)(0),h=(0,nr.use)(kA),C=s?.backgroundColor||h,y=(0,nr.useMemo)(()=>a.slice(A),[a,A]);(0,nr.useLayoutEffect)(()=>{f(a.length)},[a.length]);let I=y.map((T,S)=>i(T,A+S)),D=(0,nr.useMemo)(()=>({position:"absolute",flexDirection:"column",...s,display:y.length>0?s?.display:"none"}),[s,y.length]);return nr.default.createElement(kA,{value:C},nr.default.createElement("ink-box",{internal_static:!0,style:D},I))}var C4=Ee(He(),1);var Uz=Ee(He(),1);var Oz=Ee(He(),1);var fy=Ee(He(),1);var y4=Ee(He(),1);var ND=()=>(0,y4.use)(NQ);var Hz=(e,a={})=>{let{setRawMode:i,internal_exitOnCtrlC:s,internal_eventEmitter:A}=ND();(0,fy.useEffect)(()=>{if(a.isActive!==!1)return i(!0),()=>{i(!1)}},[a.isActive,i]);let f=(0,fy.useEffectEvent)(h=>{let C=mh(h),y={upArrow:C.name==="up",downArrow:C.name==="down",leftArrow:C.name==="left",rightArrow:C.name==="right",pageDown:C.name==="pagedown",pageUp:C.name==="pageup",home:C.name==="home",end:C.name==="end",return:C.name==="return",escape:C.name==="escape",ctrl:C.ctrl,shift:C.shift,tab:C.name==="tab",backspace:C.name==="backspace",delete:C.name==="delete",meta:C.meta,super:C.super??!1,hyper:C.hyper??!1,capsLock:C.capsLock??!1,numLock:C.numLock??!1,eventType:C.eventType},I;C.isKittyProtocol?I=C.isPrintable?C.text??C.name:"":C.ctrl?I=C.name==="space"?" ":C.name??"":I=C.sequence,!C.isKittyProtocol&&xM.includes(C.name)&&(I=""),I.startsWith("\x1B")&&(I=I.slice(1)),!C.isKittyProtocol&&I.length===1&&/[A-Z]/.test(I)&&(y.shift=!0),!(s&&C.name==="c"&&y.ctrl&&C.eventType!=="release")&&ri.discreteUpdates(()=>{e(I,y)})});(0,fy.useEffect)(()=>{if(a.isActive!==!1)return A.on("input",f),()=>{A.removeListener("input",f)}},[a.isActive,A])},xD=Hz;var B4=Ee(He(),1);var Gz=Ee(He(),1);var I4=Ee(He(),1);function LQ(){return(0,I4.use)(xQ)}var Lz=Ee(He(),1);var TD=Ee(He(),1);var zz=Ee(He(),1);var Yz=Ee(He(),1);var kQ=Ee(He(),1);var dy=Ee(He(),1);var zQ=Ee(He(),1);var Kz=()=>{let{stdout:e}=LQ(),[a,i]=(0,zQ.useState)(()=>GA(e));return(0,zQ.useEffect)(()=>{let s=()=>{i(GA(e))};return e.on("resize",s),s(),()=>{e.off("resize",s)}},[e]),a},_D=Kz;var gy=Ee(He(),1);var L4=Ee(He(),1);var Rt=Ee(UD(),1);var Sl=Ee(He(),1);var JQ={text:"",cursor:0};function py(e){return{text:e,cursor:e.length}}function OD(e,a){let i=e.text.slice(0,e.cursor),s=e.text.slice(e.cursor);return{text:i+a+s,cursor:e.cursor+a.length}}function D4(e){return e.cursor===0?e:{text:e.text.slice(0,e.cursor-1)+e.text.slice(e.cursor),cursor:e.cursor-1}}function R4(e){return e.cursor>=e.text.length?e:{text:e.text.slice(0,e.cursor)+e.text.slice(e.cursor+1),cursor:e.cursor}}function HD(e,a){let i=Math.max(0,Math.min(e.text.length,e.cursor+a));return i===e.cursor?e:{...e,cursor:i}}function w4(e){return e.cursor===0?e:{...e,cursor:0}}function b4(e){return e.cursor===e.text.length?e:{...e,cursor:e.text.length}}var Fn=Ee(UD(),1);import{homedir as qz}from"node:os";var hy="0.1.3";var N4=[{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"}],x4=28,GD=["\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588","\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588"],Vz="Type / for commands \xB7 Shift+Tab switches mode \xB7 Esc interrupts",my=process.env.NO_COLOR===void 0;function Xz(e){return e>=64?Vz:e>=40?"Type / for commands \xB7 Shift+Tab mode":"Type / for commands"}function Zz(e,a){return e>=68&&a>=24?"side":e>=37?"wordmark":"line"}function Pz(e,a=44){let i=qz(),s=e.startsWith(i)?`~${e.slice(i.length)}`:e;if(s.length<=a)return s;let A=Math.floor((a-1)*.4);return`${s.slice(0,A)}\u2026${s.slice(-(a-1-A))}`}function Wz({text:e,beak:a}){if(a===void 0)return(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:e.padEnd(x4)});let[i,s]=a;return(0,Fn.jsxs)(bt,{color:my?"cyan":void 0,children:[e.slice(0,i),(0,Fn.jsx)(bt,{color:my?"yellow":void 0,children:e.slice(i,s)}),e.padEnd(x4).slice(s)]})}function T4(){return(0,Fn.jsxs)(bt,{children:["Plato by Applivity",(0,Fn.jsxs)(bt,{dimColor:!0,children:[" \xB7 ",hy]})]})}function _4(){let{columns:e,rows:a}=_D(),i=Zz(e,a),s=Pz(process.cwd(),Math.max(20,Math.min(44,e-2))),A=Xz(e);if(i==="line")return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[(0,Fn.jsxs)(bt,{children:[(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:"\u25C9\u25C9 "}),"Plato by Applivity",(0,Fn.jsxs)(bt,{dimColor:!0,children:[" \xB7 ",hy]})]}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]});if(i==="wordmark")return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[GD.map(h=>(0,Fn.jsx)(bt,{color:my?"cyan":void 0,children:h},h)),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(T4,{}),(0,Fn.jsx)(bt,{dimColor:!0,children:s}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]});let f=Math.round((N4.length-GD.length)/2);return(0,Fn.jsxs)(zn,{flexDirection:"column",marginTop:1,children:[N4.map((h,C)=>(0,Fn.jsxs)(zn,{children:[(0,Fn.jsx)(Wz,{text:h.text,beak:h.beak}),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(bt,{children:GD[C-f]??""})]},h.text)),(0,Fn.jsx)(bt,{children:" "}),(0,Fn.jsx)(T4,{}),a<27?null:(0,Fn.jsx)(bt,{dimColor:!0,children:s}),(0,Fn.jsx)(bt,{dimColor:!0,children:A})]})}var LD=[{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 FQ(e){return e.args===void 0?`/${e.name}`:`/${e.name} ${e.args}`}function M4(e){return!e.startsWith("/")||e.includes(`
654
654
  `)||/\s/.test(e)?null:e.slice(1)}function U4(e){let a=e.toLowerCase();return LD.filter(i=>i.name.startsWith(a))}var $z=10;function O4(e,a,i=$z){let s=Math.min(i,e),A=Math.max(0,Math.min(a-s+1,e-s));return{start:A,end:A+s}}function kD(e){return e.args===void 0?{text:`/${e.name}`,run:!0}:{text:`/${e.name} `,run:!1}}var H4={plan:"blue",edit:"green",auto:"yellow"},t9={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."};function G4({session:e,onExit:a,firstPrompt:i}){let s=(0,Sl.useSyncExternalStore)(e.subscribe,e.getSnapshot),[A,f]=(0,Sl.useState)(JQ),[h,C]=(0,Sl.useState)([]),[y,I]=(0,Sl.useState)(null),[D,T]=(0,Sl.useState)(0),[S,x]=(0,Sl.useState)(0),[_,U]=(0,Sl.useState)(null),G=M4(A.text),J=G===null?[]:U4(G),Qt=G!==null&&J.length>0&&s.card===null&&!s.running&&_!==A.text,st=Math.min(S,Math.max(0,J.length-1)),mt=s.rows.length===0&&s.streaming.length===0&&s.card===null&&!s.running&&i===void 0;(0,Sl.useEffect)(()=>{x(0)},[G]),(0,Sl.useEffect)(()=>{i!==void 0&&i.length>0&&e.submit(i)},[]),(0,Sl.useEffect)(()=>{s.running||T(0)},[s.running]);let jt=async St=>{if(f(JQ),I(null),U(null),C(ft=>[...ft,St]),St.startsWith("/")){await e.handleCommand(St)==="exit"&&a();return}await e.submit(St)};return xD((St,ft)=>{let vt=ft.return||St==="\r"||St===`
655
655
  `,W=St.includes("\r")||St.includes(`
656
656
  `),wt=s.card;if(wt!==null){if(ft.upArrow){e.cardMove(-1);return}if(ft.downArrow){e.cardMove(1);return}if(vt){e.cardConfirm();return}if(ft.escape){e.cardCancel();return}if(ft.ctrl&&St==="c"){e.cardCancel();return}if(wt.kind==="question"&&wt.freeText){if(ft.backspace||ft.delete){e.cardBackspace();return}if(W&&!ft.ctrl&&!ft.meta){e.cardType(St.replace(/[\r\n]+/g,"")),e.cardConfirm();return}!ft.ctrl&&!ft.meta&&St.length>0&&e.cardType(St);return}if(St===" "){e.cardToggle();return}if(/^[1-9]$/.test(St)){let Mt=Number.parseInt(St,10)-1,Yt=wt.kind==="question"?wt.options.length:wt.options.length-1;Mt<=Yt&&e.cardMove(Mt-wt.selected)}return}if(ft.tab&&ft.shift){e.cycleMode();return}if(Qt){let Mt=J[st];if(ft.upArrow){x(Math.max(0,st-1));return}if(ft.downArrow){x(Math.min(J.length-1,st+1));return}if(ft.escape){U(A.text);return}if(ft.tab&&Mt!==void 0){f(py(kD(Mt).text)),U(null);return}if(vt&&Mt!==void 0){let Yt=kD(Mt);if(U(null),Yt.run){jt(Yt.text);return}f(py(Yt.text));return}}if(ft.escape){s.running&&e.cancel();return}if(ft.ctrl&&St==="c"){if(s.running){e.cancel();return}if(D>=1){a();return}T(1),e.addNotice("Press Ctrl+C again to exit.");return}if(!s.running){if(vt){let Mt=A.text.trim();Mt.length>0&&jt(Mt);return}if(W&&!ft.ctrl&&!ft.meta){let Yt=OD(A,St.replace(/[\r\n]+/g," ")).text.trim();Yt.length>0&&jt(Yt);return}if(ft.upArrow){if(h.length===0)return;let Mt=y===null?h.length-1:Math.max(0,y-1);I(Mt),f(py(h[Mt]??""));return}if(ft.downArrow){if(y===null)return;let Mt=y+1;Mt>=h.length?(I(null),f(JQ)):(I(Mt),f(py(h[Mt]??"")));return}if(ft.leftArrow){f(HD(A,-1));return}if(ft.rightArrow){f(HD(A,1));return}if(ft.home||ft.ctrl&&St==="a"){f(w4(A));return}if(ft.end||ft.ctrl&&St==="e"){f(b4(A));return}if(ft.backspace){f(D4(A));return}if(ft.delete){f(R4(A));return}ft.ctrl||ft.meta||St==="\r"||St===`
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@applivity/plato",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "description": "An AI coding agent for the terminal that shows its work, lets you steer mid-run, and stops at a safe point.",
9
+ "homepage": "https://plato.applivity.com",
9
10
  "type": "module",
10
11
  "bin": {
11
12
  "plato": "dist/cli.js"