@turri-dev/cli 0.3.1-next.9b12558 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/launch.md CHANGED
@@ -9,7 +9,7 @@ With `launch-after-pulse: true`, turri launches what every pulse lands itself -
9
9
  Every launch goes through the session's launch track, one codebase at a time:
10
10
 
11
11
  - **One at a time.** A codebase has one launch running at most. A launch is never stopped for a newer one: it finishes, and then the newest is launched.
12
- - **The newest wins.** While one runs, a newer commit asked for waits as the next - and replaces any older one waiting there, which is never launched (`superseded`). Its code is in the newer one: code accumulates commit by commit. A launch that ends with a newer one waiting is replaced too (`replacedBy`): the newer one starts at once and stops what it started - unless its code is out already. Whoever asked for either is told that a newer launch takes its place, and then where that one runs, or why it did not come up, once it ends - never that the one it asked for is up, only for it to be stopped the next moment.
12
+ - **The newest wins.** While one runs, a newer commit asked for waits as the next - and replaces any older one waiting there, which is never launched (`superseded`). Its code is in the newer one: code accumulates commit by commit. A launch that ends with a newer one waiting is replaced too (`replacedBy`): the newer one starts at once and stops what it started - unless its code is out already. Whoever asked for either is told that a newer launch takes its place, and then where that one runs, or why it did not come up, once it ends - never that the one it asked for is up, only for it to be stopped the next moment. The same holds up a `requires` chain - see [across a project](#across-a-project).
13
13
  - **Nothing waits on it.** A launch is not a pulse. It holds no lane and takes no `parallel-jobs` slot: the next pulse starts while it runs, and the person goes on talking.
14
14
  - **Out already.** When what runs is a commit's code already - the same code, and nothing it started has ended - it does nothing, and says so: nothing exported, nothing stopped, what runs left running. It still ends as a launch of its own, at once - `already`, its own cause, the commit asked for - and when that commit is built on what runs, what runs holds it from then on; the launch that started what runs is left as it was. A pulse that landed only conformance tests is out already. Guidance passed again does not launch it anew - the agent found the project's guidance itself; `again: true` launches it anyway, for when the last launch did not leave it as you need it - guidance that says to launch it some other way, say.
15
15
 
@@ -26,9 +26,9 @@ Guidance is whatever says it, in any words - a line in AGENTS.md such as *integr
26
26
 
27
27
  ## What goes in dist
28
28
 
29
- - **The module on top.** Code accumulates up a `requires` chain: a module starts from a copy of the code of the one it requires. So a launch takes the module on top of the `requires` chain - the project's `module` from `config.turri.yaml` unless another module's \*\*\*plain is named. Before the module on top has anything built, it takes the nearest one below it that has, and says so.
29
+ - **The module on top.** Code accumulates up a `requires` chain: a module starts from a copy of the code of the one it requires, and each built module is a codebase of its own, `plain_modules/<module>`. So a launch takes the built module on top of the `requires` chain - the project's `module` from `config.turri.yaml` unless another module's \*\*\*plain is named - and, as the chain is built, that is a new module each time one starts: `ocean`, then `depths` built on it, then `predators`. Before the module on top has anything built, it takes the nearest one below it that has, and says so. Each goes in `dist/` of its own, and what launches of the modules below it started is stopped as it starts - see [across a project](#across-a-project).
30
30
  - **A commit, whole.** Each `plain_modules/<module>` is a git repository (`.plaingit`), and every unit of work starts from a commit and ends with one. A launch after a pulse takes the commit the pulse landed; one the chat asks for, the codebase's last. What a pulse is writing right now is half-done, so it is left out: the launch exports the commit - `git archive` of `code/` - which is the code with every uncommitted change put back, and no `node_modules`, `.venv`, `target` or other build leftovers, whatever the stack. The working tree the next pulse is using is never read, reset or touched. The harness's own files - `.turri.json`, the agents' notes - are left out too.
31
- - **Replaced whole.** Each launch stops what the last one of the codebase started, empties `dist/<module>` and exports again. Change nothing there you want to keep. `dist/` is not added to `.gitignore`: whether it is committed is yours to decide.
31
+ - **Replaced whole.** Each launch stops what the last one of the codebase started - and what launches of the modules below it started - empties `dist/<module>` and exports again. Change nothing there you want to keep. `dist/` is not added to `.gitignore`: whether it is committed is yours to decide.
32
32
 
33
33
  ## Starting it
34
34
 
@@ -36,14 +36,36 @@ It runs on your machine, outside the [sandbox](sandbox.md) - with your toolchain
36
36
 
37
37
  1. **Checks the toolchains** it needs (`node`, `python3`, `go`, ...) - under another name too: `python` where `python3` is not, of the version it needs. One is missing: it stops, and says the exact command to install it yourself (`brew install node`). turri installs nothing on your machine and changes none of its settings - not a launch, not the chat, not any agent: its shell refuses it.
38
38
  2. **Installs what it needs into the project.** Dependencies into a virtual environment or `node_modules`, a build that downloads packages, an image pull, a guided launch's project scripts: it runs them in its own shell, as any agent with a shell would, and fixes what fails. Nothing is put to you - there is no dialog to answer. Never a global install, never a system setting.
39
- 3. **Starts what serves** with `activate`: in the background, in its own process group, its output in `.turri/launch/<module>-<name>.log`. It waits until something answers at the server's URL - up to a minute - so the URL you are given has answered once; one that exits first comes back with the end of its output. A port something else holds is said, with what holds it, and nothing is started there: the app is not moved to a port you were not told about. It runs in `dist/<module>`, or a folder inside it the agent names (`frontend`) - or, with guidance, in the host codebase; a folder that is not there starts nothing, and the agent is told so with what the folder holds, to name the right one.
39
+ 3. **Starts what serves** with `activate`: in the background, in its own process group, its output in `.turri/launch/<module>-<name>.log`. It waits until something answers at the server's URL - up to a minute - so the URL you are given has answered once; one that exits first comes back with the end of its output. A port that is held already is taken when one of turri's own launches holds it, and otherwise said - what holds it, whose it is and how to free it - with nothing started there: the app is never moved to a port you were not told about (see [what holds what a launch needs](#what-holds-what-a-launch-needs)). It runs in `dist/<module>`, or a folder inside it the agent names (`frontend`) - or, with guidance, in the host codebase; a folder that is not there starts nothing, and the agent is told so with what the folder holds, to name the right one.
40
40
  4. **Says how it went** with `submit_launch`: launched or not, whether it serves - a backend or a frontend, against a CLI or a library tried from its folder - and in a line or three where it runs, or why it did not come up. The chat is told that, not the agent's prose. turri checks it rather than trusting it: a launch that says it serves - or names a URL - is launched only while something it started with `activate` still runs. Something else answering at its port - an earlier build left running, another program - is not this launch: `submit_launch` refuses it, and a launch that ends that way is `failed`, saying what holds the port.
41
41
 
42
- `activate` and `submit_launch` are the launch agent's alone: the chat has `launch`, and nothing else of it. What a launch started is listed by the `pulses` tool and by **`/halt`**, with the launches under way and waiting, and stopped by **`/halt launched <name>`** (one server), **`/halt launched <module>`** (the module's launch under way, the one waiting, and what it started), by `halt` with `launched`, by the next launch of the codebase, and when turri exits. Halted, a launch that has nothing left running is `stopped` - "Stopped on request." - a host hears it, the sentinel has nothing of it to test, and the next launch of the codebase launches anew, never out already.
42
+ `activate`, `stop_launched` and `submit_launch` are the launch agent's alone: the chat has `launch`, and nothing else of it. What a launch started is listed by the `pulses` tool and by **`/halt`**, with the launches under way and waiting, and stopped by **`/halt launched <name>`** (one server), **`/halt launched <module>`** (the module's launch under way, the one waiting, and what it started), by `halt` with `launched`, by the next launch of the codebase or of a module built on it, by a launch that needs what it holds, and when turri exits. Halted, a launch that has nothing left running is `stopped` - "Stopped on request." - a host hears it, the sentinel has nothing of it to test, and the next launch of the codebase launches anew, never out already.
43
+
44
+ ## Across a project
45
+
46
+ A project's launches are of several codebases: the modules of a `requires` chain, one after another as it is built, and the modules of a branch - two built on one, `in_module` - side by side. What their launches start runs on the same machine, and the code of one module is often started the same way as the one below it - the same command, on the same port - since it was copied from it. So:
47
+
48
+ - **Up a chain, the newer module replaces the one below.** A launch stops what launches of every module below it in its `requires` chain started, as it stops what the last launch of its own codebase started: their code is in it, an older build of the same app. That is everything they started - a server on the same port, one on another, a worker - whatever it holds. What an earlier turri left running of them is stopped too. A launch of a module below it under way is waited for - it ends, and the newer one starts and stops what it started; one waiting is never launched (`superseded`). So whichever pulse lands, the newest build of the chain is what runs - and nothing older answers at its URL, even when the newer one does not come up.
49
+ - **Side by side, what does not get in the way runs on.** What turri's launches of any other module started - a branch beside it - is left running, unless it holds what this launch needs: then turri stops it, and this launch takes it. A port the harness sees itself, as `activate` starts the server. Anything else - a socket, a lock or pid file, a container name, a database kept open - the launch agent finds in what failed (its output, `lsof`, `ps`), and frees with `stop_launched`, naming a pid of it and what it holds. Either way turri stops only what its own records say one of its launches started.
50
+ - **Said, every time.** A launch whose servers were stopped this way is replaced: a host hears it again (`onLaunch`), with `replacedBy` the newer launch's id - nothing of it runs, and its codebase's code, for a module below, is what the newer launch runs. What the newer launch stopped is kept on it apart from what its agent said - `stopped`, an entry a process with why, whose launch, module, commit, pid and address, for a host to show beside it ([hosting](hosting.md)) - and what the chat and the terminal are told begins with a line for each - `Stopped what bestiary's launch launch-17 at befa07f started - bestiary (pid 96379, http://localhost:5173): upgrades is built on bestiary and holds its code, so this launch takes its place.`, or `Stopped server (pid 96379, http://localhost:5173), from web's launch launch-4 at 1a2b3c4: it held port 5173, which cli needs.` - and the ledger has `launch.freed` and `launch.replaced`.
51
+
52
+ The [sentinel](sentinel.md) tests a pulse of a module below in the launch of the module built on it that replaced its own: that launch holds its commit, as the module started from that code.
53
+
54
+ ### What holds what a launch needs
55
+
56
+ What holds a port - or anything else a launch needs - is looked up by its process, in turri's records (`.turri/launch/running/`, below), and said as it is:
57
+
58
+ - **This turri's launch of another module.** Stopped, and taken - kept in the launch's `stopped` and said to the chat, as above.
59
+ - **An earlier turri's, ended.** Stopped too, as [what an earlier session left running](#what-an-earlier-session-left-running) is.
60
+ - **Another turri still running** - in another terminal, say. That turri's: never stopped. Said with the launch and module it started it for, and how to free it - `/halt launched <module>` in that turri's chat, or quit it - then ask for the launch again.
61
+ - **Nothing turri's records name.** Not turri's: never stopped, and said so - the process and its pid. If it is yours to stop, stop it, or ask the chat to (`kill <pid>`), then ask for the launch again.
62
+ - **This launch's own** - two of its servers on one port. The agent's to sort out: nothing stopped.
63
+
64
+ Where turri cannot tell - no `lsof` - it says that, and nothing is stopped. Nothing turri started is ever said to be someone else's, nor anything else turri's; and the app is never moved to another port.
43
65
 
44
66
  ### What an earlier session left running
45
67
 
46
- What a launch starts is written down as it starts - `.turri/launch/running/<pid>.json`: its process, its process group, its codebase, its command, folder and URL, and the turri that started it - and taken out as it ends. A turri that is killed outright stops nothing it started, and a server it left would hold its port in the next session, answering with old code. So as a session starts, and again before each launch of a codebase, turri stops what those records name whose turri has ended - its process group, politely and then not, as it stops its own - and says so in the ledger (`launch.left-behind`) and at the head of the summary of the codebase's next launch: `Stopped what an earlier turri session left running of shorty: backend (pid 66816, http://127.0.0.1:8000).` It stops only a process its records name, and only while it is still the one recorded - started when the record says; a pid given to another process since is left alone, its record taken out. What another turri still running started is that turri's.
68
+ What a launch starts is written down as it starts - `.turri/launch/running/<pid>.json`: its process, its process group, its codebase, its command, folder and URL, and the turri that started it - and taken out as it ends. A turri that is killed outright stops nothing it started, and a server it left would hold its port in the next session, answering with old code. So as a session starts, and again before each launch of a codebase, turri stops what those records name whose turri has ended - its process group, politely and then not, as it stops its own - and says so in the ledger (`launch.left-behind`), in the next launch's `stopped` for a host, and at the head of what the chat is told of the codebase's next launch: `Stopped what an earlier turri session left running of shorty: backend (pid 66816, http://127.0.0.1:8000).` Each record names the launch and the commit it started it for. It stops only a process its records name, and only while it is still the one recorded - started when the record says; a pid given to another process since is left alone, its record taken out. What another turri still running started is that turri's. Before a launch, what was left of the modules below it in its chain is stopped as well as its own codebase's.
47
69
 
48
70
  ## After every pulse
49
71
 
package/docs/sentinel.md CHANGED
@@ -45,7 +45,7 @@ It checks every pulse, one at a time, in the order they finished. A pulse that f
45
45
 
46
46
  ## What it tests in
47
47
 
48
- With `launch-after-pulse` on, a pulse is launched in the background on the [launch track](launch.md#the-launch-track), the newest commit winning - so what runs may be a later commit than the pulse's own. The sentinel tests a pulse only in a launch whose commit holds the pulse's: its commit, or one built on it. Before it is told of a pulse, turri waits for its codebase's launches to settle - nothing launching, nothing waiting to - and checks that what runs holds the pulse's commit. The pulses waiting behind it wait with it.
48
+ With `launch-after-pulse` on, a pulse is launched in the background on the [launch track](launch.md#the-launch-track), the newest commit winning - so what runs may be a later commit than the pulse's own. The sentinel tests a pulse only in a launch whose commit holds the pulse's: its commit, or one built on it - or, once a module built on the pulse's has been launched and replaced its launches (see [across a project](launch.md#across-a-project)), that module's launch, which started from code that held it; the sentinel is told it is built on the pulse's module. Before it is told of a pulse, turri waits for its codebase's launches to settle - nothing launching, nothing waiting to, of it or of the module that took its launches over - and checks that what runs holds the pulse's commit. The pulses waiting behind it wait with it.
49
49
 
50
50
  - **What runs holds it**: it is told the launch, the commit, the pulses after it that the launch holds too - and that what those changed again is theirs to test. A launch that left nothing running - a CLI, a library - is named with the folder to try it from, `dist/<module>`, its absolute path.
51
51
  - **The launch did not come up**: it is told why, and that is what it finds out about - a finding like any other. It tests nothing in its place: never the code in `plain_modules`, where a pulse may be writing, nor a server of its own.
@@ -53,7 +53,7 @@ With `launch-after-pulse` on, a pulse is launched in the background on the [laun
53
53
  - **Whichever it is**, it is told never to run the code in `plain_modules`, where a pulse may be writing, nor to start a server of its own - not in its shell, not with a host's terminal: what would pass there is not what you try. A server that should run and does not is its finding. A host's terminal command that starts or runs the code there - `cd plain_modules/shorty/code && .venv/bin/uvicorn …`, a program or a path there, an environment variable pointing there - is refused it, saying why; reading there is not.
54
54
  - **What runs cannot hold it** - turri got it wrong: it is not told of the pulse. The error is shown in the chat you are in, recorded in the ledger (`sentinel.refused`), and the pulse is concluded unchecked; the next is taken.
55
55
 
56
- When its codebase is launched again while it checks a pulse - a newer pulse landed - its turn is stopped where it is, its conversation kept: what it was testing is being replaced. It takes nothing else meanwhile. Once the codebase's launches have settled - one, or several in a row - turri checks again that what runs holds the pulse's commit, and tells it, in the same conversation, to carry on: what runs now, and to do again what it was doing as the servers restarted. What runs no longer holding it, it is refused as above. A launch of another codebase leaves it alone.
56
+ When its codebase is launched again while it checks a pulse - a newer pulse landed, of it or of a module built on it - or what runs of it is stopped for another module's launch that needed what it held, its turn is stopped where it is, its conversation kept: what it was testing is being replaced. It takes nothing else meanwhile. Once the codebase's launches have settled - one, or several in a row - turri checks again that what runs holds the pulse's commit, and tells it, in the same conversation, to carry on: what runs now, and to do again what it was doing as the servers restarted. What runs no longer holding it, it is refused as above - for one stopped for another module's launch, saying which. A launch of another codebase that stops nothing of its own leaves it alone.
57
57
 
58
58
  A notice may be **ignorable**: the sentinel marks one so when you may reasonably leave it as it is - chiefly a gap in the \*\*\*plain the build settled with an assumption: *the \*\*\*plain does not say what happens to passwords over 72 bytes; the build refuses them with 422*. Never something broken, a pulse that went wrong, a launch that did not come up, nor the question whether to start the sentinel. Ignore one and it is left as the build has it, for good: nothing is done in your chat, and a line is written to the sentinel's guidance (`.turri/sentinel.md`, as `keep_guidance` writes) saying what was left as it is - its module, the gap, what the build does - and that you chose to. Every conversation after has it, and does not raise it again - unless the build no longer does what you accepted. To have it raised again, take the line out of `.turri/sentinel.md`.
59
59
 
@@ -67,7 +67,7 @@ It fixes the project's tooling itself, and nothing else:
67
67
  - **It never changes \*\*\*plain.** The \*\*\*plain is your intent: what needs it changed is a notice, its action a task for your chat's agent once you accept it.
68
68
  - **It installs nothing, and changes no setting of the machine's or your shell's** - not a toolchain, not a package, not a PATH line in your profile - under no circumstances: its shell refuses it, as every shell turri runs does. What the machine lacks is a notice with the exact command for you to run, and resuming as its action once you have.
69
69
 
70
- Its file tools - `read`, `ls`, `grep`, `find` - read the whole project; `write` and `edit` reach the tooling above and nothing else, \*\*\*plain never. Its shell runs [behind the walls](sandbox.md) every agent's does - the command check, the OS sandbox where one is up, the audit - with the project read only and the network open, its home and temporary folder its own. It has `pulses`, `parse`, `doctor` and the web, `resume`, `notify_person` for its notices, `conclude` for when it is done with a pulse, `keep_guidance`, and what a host gives it. Whatever else it calls is refused: it never steers, launches, or regenerates but by `resume` after a fix of its own, and never asks you a question - a notice is how it reaches you.
70
+ Its file tools - `read`, `ls`, `grep`, `find` - read the whole project; `write` and `edit` reach the tooling above and nothing else, \*\*\*plain never. Its shell runs [behind the walls](sandbox.md) every agent's does - the command check, the OS sandbox where one is up, the audit - with the project read only and the network open, its home and temporary folder its own. The sandbox hides every other process from it - `ps` and `lsof` do not run there - so `who_holds` says what holds a port and whose it is: a server one of turri's launches started (which launch, module and commit), another turri's, or a program turri did not start, with how you free it ([what holds what a launch needs](launch.md#what-holds-what-a-launch-needs)). It has `pulses`, `parse`, `doctor` and the web, `resume`, `notify_person` for its notices, `conclude` for when it is done with a pulse, `keep_guidance`, `who_holds`, and what a host gives it. Whatever else it calls is refused: it never steers, launches, or regenerates but by `resume` after a fix of its own, and never asks you a question - a notice is how it reaches you.
71
71
 
72
72
  ## Talking to it
73
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turri-dev/cli",
3
- "version": "0.3.1-next.9b12558",
3
+ "version": "0.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {