@turri-dev/cli 0.1.3-next.79e2ad0 → 0.1.3-next.b675516

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.
@@ -18,6 +18,12 @@ which tests reach which mutant (`vitest.stryker.config.ts`, the suite without th
18
18
  mutant against those tests. `scripts/mutation.mjs` sets two things in Stryker's vitest runner the suite needs - forked
19
19
  workers, and a test-name filter that matches vitest 5's names - again after every `npm install`.
20
20
 
21
+ The `mutation` workflow (`.github/workflows/mutation.yml`) runs it on GitHub, started by hand: Actions, mutation, Run
22
+ workflow. It takes the parts to run, space-separated (empty for every part), each a job of its own side by side, on
23
+ four cores (`TURRI_MUTATION_CONCURRENCY`; six here). Each part's `mutation.html` and `mutation.json` are uploaded as an
24
+ artifact, `mutation-<part>`, and summed up on the run's page. Stryker's incremental file is cached from run to run, so
25
+ a run tests again only the mutants whose code or tests changed; tick `fresh` to test every one again.
26
+
21
27
  Working on turri itself, `npm link` points the global `turri` at this clone, so edits
22
28
  take effect immediately. `npm run chat` starts pi with the extension loaded from `src/`.
23
29
 
@@ -69,6 +75,7 @@ trust `turri-oss/turri`, the workflow `publish.yml` and the environment `npm`. R
69
75
  | `src/regenerate/confine.ts`, `src/regenerate/agent-shell.ts`, `src/regenerate/command-check.ts`, `src/regenerate/os-sandbox.ts`, `src/regenerate/audit.ts`, `src/regenerate/agent-env.ts`, `src/regenerate/shell.ts` | the file-tool fence and the walls around every agent command: the check, the OS sandbox, the audit, the module's environment, the host runner - see [sandbox](sandbox.md) |
70
76
  | `src/regenerate/engine.ts` | choosing and resolving render models |
71
77
  | `src/regenerate/job-panel.ts`, `src/regenerate/transcript-view.ts`, `src/regenerate/diff-view.ts` | the job panel, the side panel's colours, and a spec diff as they show it - highlighted and banded |
78
+ | `src/regenerate/side-panel.ts`, `src/regenerate/panel-dock.ts` | the side panel, and the chat narrowed beside it when it is docked |
72
79
  | `src/regenerate/spec-map.ts`, `src/regenerate/spec-map-view.ts` | regen: each item's mark, from the records, the `.plain` files and the work loop's plan (`mapPlan`), and the map drawn |
73
80
  | `src/regenerate/debug-log.ts` | each render agent's whole conversation, always streamed to `.turri/debug/` |
74
81
  | `genome/` | what turri knows and can do: `genome/skills/`, the skill library, and `genome/rules/`, the \*\*\*plain authoring rules |
package/docs/headless.md CHANGED
@@ -81,7 +81,7 @@ Useful options - `turri regenerate --help` lists all of them:
81
81
 
82
82
  | | |
83
83
  | --- | --- |
84
- | `--harness-model <provider/id>` | `harness-model`: the planner, the conformance chooser, the diagnosis of a failed pulse |
84
+ | `--harness-model <provider/id>` | `harness-model`: the planner and the conformance chooser |
85
85
  | `--coding-model <provider/id>` | `coding-model` (`--model` too): the agents that build - with `:level` for how hard it thinks (`provider/id:high`); not given, the harness model's |
86
86
  | `--judge-model <provider/id>` | `judge-model`: the judge and the test review; not given, the coding model |
87
87
  | `--conformance-tests <all\|chosen\|module\|false>` | `conformance-tests`, with its values (`true` is `all`) |
@@ -151,7 +151,7 @@ changes meaning or goes; new fields may appear in the same version. Paths in `pu
151
151
  "conformance_tests": "all", // all | chosen | module | false
152
152
  "review": false,
153
153
  "models": {
154
- "harness": { "model": "…", "thinking": "medium" }, // the planner, the chooser, the diagnosis
154
+ "harness": { "model": "…", "thinking": "medium" }, // the planner, the chooser
155
155
  "coding": { "model": "…", "thinking": "low" },
156
156
  "judge": { "model": "…", "thinking": "medium" },
157
157
  "observed": { "coding": ["provider/id:low"], "planner": ["provider/id:medium"] } // what each role really ran on
@@ -160,6 +160,10 @@ runs the unit testing script itself**, and only that run counts (see
160
160
  tried. An agent circles a cause it has not thought of - an in-memory database every connection opens
161
161
  empty, a test runner that leaves the code off its path - and this is the way out. The rounds go on as
162
162
  before, up to 20; should the same failure come round three times again, the debugger looks again.
163
+ **A run the time limit stopped** is looked at by the debugger at once, told how long the run had and that the limit
164
+ stopped it: it finds what hangs - the root cause and the fix, as above - or that nothing does, the run getting on up
165
+ to the limit and needing more time than a test run may take. Then the pulse stops, rolled back and not retried, and
166
+ the person is told to raise `TURRI_COMMAND_TIMEOUT` or make the suite faster.
163
167
  - **It goes round in circles in its own runs.** An agent stuck on a failure can try the same few changes in
164
168
  turn - three signatures of a stand-in function, say - and run the tests after each, dozens of times in one
165
169
  turn. Its own `run_unit_tests` runs are watched (`createLoopWatch` in `test-scripts.ts`): the code folder back
@@ -218,7 +222,7 @@ and the `implement-unit-testing-script` and `implement-conformance-testing-scrip
218
222
  - **The formatting is the agents'.** The harness formats nothing: the scripts check, and leave their inputs as they
219
223
  found them. Every agent that writes code or tests is told to run, in its shell, the formatter its script checks with,
220
224
  on the files it changes, before the final run.
221
- - **A toolchain missing** where the checks run - exit 69, 127, `command not found` - stops the pulse as it does for the
225
+ - **A toolchain missing** where the checks run - exit 69, 127, a `command not found` the run ended on - stops the pulse as it does for the
222
226
  tests: the person installs it, the agents install nothing.
223
227
 
224
228
  ### Checking its own work
@@ -262,7 +266,8 @@ Passing unit tests prove only what they check, and a coding agent is quick to wr
262
266
  next to nothing - that a function exists, that a result is not empty, that a status is 200 - or code
263
267
  that no test reaches. So, with `review: true` in the [config](config.md), once the unit testing script
264
268
  passes a reviewer on the judge model reads what the work wrote, beside the spec, and changes nothing. It
265
- reviews both halves. The review is off by default - `review: false`, or the key left out - and so is the
269
+ reviews both halves, with the unit testing script word for word in its prompt: a test the script never reaches is
270
+ not run, and checks nothing. The review is off by default - `review: false`, or the key left out - and so is the
266
271
  conformance tests' review: the work goes on once its tests pass.
267
272
 
268
273
  - **The code.** Every behaviour, edge case, validation rule and error the spec states for this work
@@ -499,16 +504,19 @@ testing script, stops before it starts and says which skill adds it.
499
504
  `prepare-environment-script:` in the config, else the one `prepare_environment*.sh` at the root, else in
500
505
  `test_scripts/` - on the build, before every run of the conformance testing script: the harness's own, and the agents'
501
506
  `run_conformance_tests`. Both get the same build folder - the code in place, or the same fresh copy - so what it sets up
502
- for that build, the conformance testing script finds. With conformance off it is not run. The conformance agents are
503
- shown it, before the conformance testing script.
507
+ for that build, the conformance testing script finds. With conformance off it is not run. Every agent shown the
508
+ conformance testing script - the explorer, the conformance agent, the judge, the code fixer and the repair agent - is
509
+ shown it too, before the conformance testing script.
504
510
 
505
511
  **Where they run.** On this machine, as you would run them: unfenced - no sandbox, no command check, no audit - in
506
512
  your own environment with this machine's toolchains, turri's model providers' API keys alone left out. They are yours,
507
513
  and whatever they do is your doing. That is the only way the two scripts are ever run: the harness's own runs, and the
508
514
  agents' `run_unit_tests` and `run_conformance_tests`, which run them exactly as the harness does - through the host
509
515
  runner, in a process group of their own, so the time limit and a stopped job end the script and all it started. A
510
- toolchain the script needs and this machine lacks - exit 69, exit 127, or a `command not found` / `failed to run
511
- command` in its output (`missingToolchain`) - is yours to install, never the agent's: the agent is told to report it
516
+ toolchain the script needs and this machine lacks - exit 69, exit 127, or a run that ended on a `command not found` /
517
+ `failed to run command`, the last line it printed (`missingToolchain`) - is yours to install. Only on that evidence: a
518
+ `command not found` earlier in the output, the run going on after it and failing for its own reasons, is a warning -
519
+ a shell profile's, an optional tool probed for - and the failure is the agent's to fix. A missing toolchain is yours to install, never the agent's: the agent is told to report it
512
520
  with `report_environment_error` rather than work around it, and the pulse stops at the harness's first run of either
513
521
  script - unit or conformance - that cannot find it, rolled back, saying what to install (see
514
522
  [when the environment lacks something](#when-the-environment-lacks-something)). The code and the tests an agent wrote run unfenced inside the script too: what an agent runs with its own
@@ -562,7 +570,7 @@ It is raised two ways:
562
570
  is shown its output once, and a report made again after that stands. A report that stands ends its turn, the pulse
563
571
  stops, and what it said goes to you as it is;
564
572
  - **by the harness itself**: a testing script - the unit or the conformance one, in a code pulse, a conformance pulse or
565
- the whole-suite run - that cannot find its toolchain (exit 69 or 127, `command not found`), or
573
+ the whole-suite run - that cannot find its toolchain (exit 69 or 127, a `command not found` the run ended on), or
566
574
  a credential `agent-env:` names that is not there when the pulse starts - before any agent does. What the harness
567
575
  found it works out at once - the diagnosis, not after a second failure - to say how to fix it on this machine.
568
576
 
@@ -575,10 +583,20 @@ not an install:
575
583
  > **lunch stopped: turri's sandbox kept its agents from reading `…/mise/installs/node/24.16.0/lib/node_modules/npm/bin/npm-cli.js` - it is on this machine; nothing is missing.**
576
584
  > To fix: let the agents read that toolchain - add its folder to `toolchains:` in config.turri.yaml, keeping what is there: `toolchains: [/Users/…/mise/installs/node/24.16.0]`. Nothing needs installing.
577
585
 
586
+ A write the sandbox refused is told apart from a read - a report naming a lock file (`*.lock`, `*.lck`, `lockfile`, even
587
+ one never made), or saying a write, a create or a lock not taken. No setting lets the agents write outside their
588
+ module's folders, their own home and temporary folder and the package caches, and `toolchains:` only lets them read; so
589
+ the stop names the lock and what fixes it instead. In your home - a tool that found it without `$HOME`, as a JVM does for
590
+ `user.home` - it is having the tool use `$HOME` (`-Duser.home=$HOME` where the build starts its JVM); in a toolchain's own
591
+ install, it is a setting of the tool's that keeps the write elsewhere, or a copy of the toolchain that keeps its writes in
592
+ its cache. The agents are told such a refusal is the sandbox's, to report at once - not to work around it for half an
593
+ hour.
594
+
578
595
  **The conversation heals it.** Told of the stop, it never regenerates the module again before the cause is fixed - a pulse
579
596
  stopped on its environment stops the same way again - and fixes what it can:
580
597
 
581
- - **hidden by the sandbox**: it adds the folder to `toolchains:` itself, says so in a line, and resumes;
598
+ - **hidden by the sandbox**: it adds the folder to `toolchains:` itself, says so in a line, and resumes - a refused
599
+ write, which no setting fixes, it fixes in the project's own files when it can, and otherwise tells you what to do;
582
600
  - **a toolchain or a tool missing** - a JDK, Maven, Go, uv: it looks first for one installed off the PATH - Homebrew's opt
583
601
  folders, `/Library/Java/JavaVirtualMachines`, mise, asdf, sdkman, nvm - then asks you, with the exact command for this
584
602
  machine (`brew install openjdk@21`, `mise use -g java@21`), and on your yes runs it in its shell, checks the command is
@@ -820,7 +838,8 @@ coding agent that fixes the code is told the same of the tests: it can read them
820
838
  Before the test author starts, an explorer - an agent in
821
839
  the code's folder with the file tools alone: it reads the code, runs nothing and changes nothing - hands over everything
822
840
  the author needs, in parts: how to build and run it; how the conformance tests reach it as the project's
823
- conformance testing script runs them - the explorer is given the script, and says what it builds or
841
+ conformance testing script runs them - the explorer is given the script, and the prepare script before it where there
842
+ is one, and says what they build or
824
843
  installs and what the tests depend on or start (a package, a module, an entry point, by its exact name);
825
844
  how each functionality is reached from outside
826
845
  (the command, or the route, method and the request and response fields); what it needs around it; and
@@ -894,10 +913,17 @@ agent is told that a failure of the software itself - it does not build or start
894
913
  spec says it must not - is not the tests' to work around. When it fails, a judge - an agent that reads
895
914
  the code and the tests, changes neither, and holds both to the spec - decides which is wrong. It has the
896
915
  file tools and the web (`web_search`, `web_fetch`), to look up what a service the code calls answers - no shell: it
897
- judges from the code, the tests, the spec and the failing run's output, and its file tools write nothing:
916
+ judges from the code, the tests, the spec, the conformance testing script word for word and the failing run's output,
917
+ and its file tools write nothing. The explorer's account of how the code is invoked is in its prompt too, marked as
918
+ written before the run and possibly wrong: the judge checks what it uses of it against the script and the files, and
919
+ gives in `evidence` what it found itself. The script is fixed - neither agent can change it - so it is never the
920
+ culprit: what it does with the tests, the tests fit; what it needs of the build, the code provides.
898
921
 
899
922
  - **the code:** the coding agent - in the code's folder, reading the tests but never changing them - fixes it,
900
- and keeps its unit tests passing;
923
+ and keeps its unit tests passing. The judge quotes the spec's own words the code does not meet, or the testing
924
+ script's for what it needs of the build (`script_needs`: a build output, an entry point, a module) - each checked
925
+ by the harness against the text it quotes. The acceptance tests are in that text, labelled as their tests are:
926
+ for a spec change, those of every functional spec it touches, not only the last one's;
901
927
  - **the tests:** the conformance agent corrects them to what the spec says;
902
928
  - **the spec:** two functional specs cannot both hold, whatever the code does;
903
929
  - **the environment:** neither the code nor the tests can fix it - only the person can, in what the run is given:
@@ -939,16 +965,41 @@ spending the rest of its 20 attempts on it. Two failures are the same once what
939
965
  taken out of their lines - numbers, times, paths, colour codes, and the ids a service makes up for each
940
966
  response, a UUID or a correlation id. Nothing changes either when the agent sent to fix the code or the tests
941
967
  changes no file: two such fixes in a row, and the run stops. The conformance agent has the testing script in its prompt,
942
- and is told to fit the tests' own build to it.
968
+ and is told to fit the tests' own build to it. The code fixer has the testing scripts its fixes are run by - the
969
+ conformance testing script, the prepare script before it, and the unit testing script - word for word in its task:
970
+ what the conformance testing script needs of the build, it reads there, not only in the judge's quote of it.
971
+
972
+ **Escalation.** A failure judged the tests' goes to the conformance agent first: it owns the tests. When the run then
973
+ fails the same way - the fix changed nothing, or nothing that mattered - the judge is asked again, now whether the
974
+ failure belongs to the code rather than the tests: the run failing on something the code is meant to produce (a build
975
+ output, an entry point, a module the testing script needs), or the tests running and the behaviour itself being
976
+ wrong. Its verdict, either way, has to rest on evidence it gathered: each piece from a file it opened (the harness
977
+ keeps track of what it read, listed and searched), the testing script or the failing run - and not the run alone.
978
+ A verdict without it is sent back; a verdict of code still without it is taken as the tests'. Judged the tests'
979
+ again, the failure stays with the conformance agent, and a fix that changes nothing counts towards stopping as
980
+ before. Judged the code's, it is escalated to the coding agent, handed the script's error, the conformance tests as
981
+ they stand and the judge's reason and evidence (`the script runs dist/cli.js; the build emits dist/src/cli.js`). Its
982
+ fix has to build and pass the unit tests, then the suite runs again. Should the run still fail the same way - or the
983
+ fix change nothing - the run stops there, with the judge's reasoning and evidence in what the person is told. Each of
984
+ these runs is one of the run's 20 attempts, so a failure neither agent can fix stops in three of them.
943
985
 
944
986
  Every attempt is written into the working notes' pitfalls by the harness as cause and effect - what
945
987
  the run failed with, how it was judged, and which files the agent sent to fix it changed; the next
946
988
  attempt's line says what came of it - and each judge reads them first, so it does not send a
947
989
  failure the way that already failed. A run that does not pass is undone whole, its notes with it.
948
990
 
949
- Then the suite runs again. A run stopped by its time limit goes back to the conformance agent without a judge: the
950
- tests' environment is its. So does a run that exits 80 - the tests pass and only their static checks do not (see
951
- [the static checks](#the-static-checks)): the findings are the tests'. A run whose script cannot find its
991
+ Then the suite runs again. A run that exits 80 goes back to the conformance agent without a judge - the tests pass and
992
+ only their static checks do not (see [the static checks](#the-static-checks)): the findings are the tests'.
993
+
994
+ **Timing.** Every run is shown to the judge, the debugger and whoever fixes it with how long it ran against its time
995
+ limit (`runTiming` in `test-scripts.ts`): `This run ended on its own - exit 1, after 37.2s of the 120.0s a test run
996
+ may take`, or `The time limit stopped this run: it had run 120.0s of the 120.0s ...` - so none takes a run that
997
+ ended on its own for one the limit stopped, or the other way. A run the time limit stopped is judged like any other,
998
+ and the judge is told what keeps a run from finishing: the code hangs (it waits on input, keeps a server in the
999
+ foreground, never exits) - the code's; a test waits for what never comes - the tests'; or nothing hangs, the output
1000
+ showing the run getting on up to the limit, and it needs more time than a test run may take - the environment. That
1001
+ verdict stops the pulse at once, rolled back and not retried, and the person is told to raise `TURRI_COMMAND_TIMEOUT`
1002
+ or make the suite faster - no agent can give a run more time. A run whose script cannot find its
952
1003
  toolchain stops the pulse instead - see [when the environment lacks something](#when-the-environment-lacks-something).
953
1004
  Unit tests failing after the suite passes go to the coding agent. It goes round up to 20 times; still failing, the work is undone.
954
1005
 
package/docs/using.md CHANGED
@@ -13,8 +13,10 @@ banner - the jellyfish it is named after, swimming until the conversation fills
13
13
  terminal that shows images (Kitty, Ghostty, WezTerm, Warp, iTerm2), and drawn in text in any other, tmux
14
14
  included - swimming a stroke a loop, its tentacles following its bell, frames `scripts/jellyfish-frames.mjs`
15
15
  writes -
16
- where commands will run, the rules and skills loaded - rather than pi's startup header
17
- and resource list; `turri --verbose` shows those too. Talk to it: ask it to start a
16
+ turri's version (and, run from a clone, the commit it is on, and whether the clone has changes), where commands
17
+ will run, the rules and skills loaded - rather than pi's startup header and resource list; `turri --verbose` shows
18
+ those too. pi's "Update Available" notice is left out - turri's pi is a pinned dependency `pi update` never
19
+ touches - and the terminal's tab reads `🪼 turri - <folder>`, not pi's `π`. Talk to it: ask it to start a
18
20
  project, add a feature, render a module, fix a spec. It decides which skill or tool applies - but
19
21
  not *how* a skill runs: `cultivate` hands the work to the gated runner, which owns the steps, the
20
22
  gates and the judges (see [skills and gates](skills-and-gates.md)).
@@ -125,10 +127,13 @@ come waits for a free slot, and says so.
125
127
  as GitHub names a hunk's function: each section is named once.
126
128
  - **The side panel** (`ctrl+h`, as it was left - but on the pulse that last failed, stopped or did not pass, when one has
127
129
  since it was last opened: the live panel that showed it is gone with the last pulse, and its announcement in the chat
128
- says `ctrl+h shows this pulse`; **`/regen`** on regen, **`/pulses`** on the pulses; not `ctrl+j`, which a terminal without the Kitty
130
+ says `ctrl+h shows this pulse`; **`/pulses`** on the pulses; not `ctrl+j`, which a terminal without the Kitty
129
131
  keyboard protocol sends as a line feed, the same as `shift+enter`, and which a dialog takes for
130
132
  `enter`; both stay pi's new-line keys. `ctrl+h` is the byte old terminals sent for backspace; a
131
- terminal set to send `^H` for its Backspace key would open the panel on it) takes the whole screen - the panel or the chat, one at a time.
133
+ terminal set to send `^H` for its Backspace key would open the panel on it) takes the whole screen - the panel or the chat, one at a time -
134
+ or, `s`, sits beside the chat: the chat on the left, the panel in the right half of the screen, and `s` again
135
+ over the whole screen. It opens as it was last left, for the conversation; a terminal under 100 columns has
136
+ no room for both and shows the panel over the whole screen.
132
137
  It opens on **regen**: the spec itself, in full, with how much of it the code has been regenerated from drawn
133
138
  onto it.
134
139
 
@@ -212,7 +217,13 @@ come waits for a free slot, and says so.
212
217
  closes when it moves to another section. What is open is kept while the panel is closed. What the agents
213
218
  said and did is not shown - it is in each pulse's log (see [Agent logs](#agent-logs)).
214
219
 
215
- `ctrl+h` again, or `esc`, closes it and goes back to the chat. While it shows, every key is the panel's,
220
+ `ctrl+h` again, or `esc`, closes it and goes back to the chat. Beside the chat, a click decides which side has
221
+ the keys - the chat or the panel, the one clicked, or the one `⌥⌘←` / `⌥⌘→` points at (on a
222
+ terminal that passes ⌘ on, over the Kitty keyboard protocol - Ghostty, kitty, WezTerm, iTerm2; not Apple's Terminal);
223
+ the other is drawn faint - and `esc` gives the chat the keys too, the panel staying and
224
+ following the pulses; `ctrl+h` gives the panel the keys again, and from the panel closes it. (pi's regular screen,
225
+ `--tui-mode regular`, reads no mouse: there it is the keys alone.)
226
+ While the panel has the keys, every key is the panel's,
216
227
  whatever else happens: a question the chat model asks in the background (`ask_user`) waits in the chat,
217
228
  unanswered - an `enter` in the panel never answers it - and the panel's top line says "the chat is waiting
218
229
  for your answer". Back in the chat, the question is there, with the keys.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turri-dev/cli",
3
- "version": "0.1.3-next.79e2ad0",
3
+ "version": "0.1.3-next.b675516",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -33,8 +33,8 @@
33
33
  "grammar:sync": "node scripts/sync-plyn-grammar.mjs"
34
34
  },
35
35
  "dependencies": {
36
- "@earendil-works/pi-coding-agent": "^1.1.0",
37
- "@earendil-works/pi-tui": "^1.1.0",
36
+ "@earendil-works/pi-coding-agent": "^1.2.0",
37
+ "@earendil-works/pi-tui": "^1.2.0",
38
38
  "@langchain/langgraph": "1.4.15",
39
39
  "gray-matter": "^4.0.3",
40
40
  "js-yaml": "^5.4.2",