@turri-dev/cli 0.2.3-next.fea0bd9 → 0.2.4-next.240620d

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 (94) hide show
  1. package/README.md +52 -56
  2. package/dist/chat-idle.d.ts +2 -2
  3. package/dist/chat-idle.js +2 -2
  4. package/dist/chats.d.ts +0 -10
  5. package/dist/chats.js +0 -23
  6. package/dist/cli.js +32 -5
  7. package/dist/config-edit.js +1 -3
  8. package/dist/config.d.ts +6 -21
  9. package/dist/config.js +3 -16
  10. package/dist/conformance-switch.d.ts +7 -17
  11. package/dist/conformance-switch.js +21 -46
  12. package/dist/drift-cli.js +1 -1
  13. package/dist/extension.d.ts +16 -12
  14. package/dist/extension.js +247 -238
  15. package/dist/genome.js +5 -48
  16. package/dist/graph.js +3 -5
  17. package/dist/host-session.d.ts +4 -15
  18. package/dist/host-session.js +2 -4
  19. package/dist/host.d.ts +1 -3
  20. package/dist/host.js +1 -4
  21. package/dist/identity.js +0 -1
  22. package/dist/init-config.d.ts +0 -1
  23. package/dist/init-config.js +2 -9
  24. package/dist/installed-providers.d.ts +1 -1
  25. package/dist/installed-providers.js +2 -2
  26. package/dist/loop-cli.d.ts +4 -3
  27. package/dist/loop-cli.js +13 -11
  28. package/dist/loop-tools.js +5 -10
  29. package/dist/new-project.js +2 -2
  30. package/dist/pi-launch.js +1 -1
  31. package/dist/pi.js +6 -6
  32. package/dist/plain/check.d.ts +1 -8
  33. package/dist/plain/check.js +3 -38
  34. package/dist/regenerate/activity.d.ts +0 -7
  35. package/dist/regenerate/activity.js +2 -20
  36. package/dist/regenerate/failure-reports.d.ts +28 -0
  37. package/dist/regenerate/failure-reports.js +79 -0
  38. package/dist/regenerate/jobs-tree.js +1 -1
  39. package/dist/regenerate/jobs.d.ts +2 -0
  40. package/dist/regenerate/jobs.js +4 -0
  41. package/dist/regenerate/ledger-view.d.ts +11 -24
  42. package/dist/regenerate/ledger-view.js +14 -60
  43. package/dist/regenerate/ledger.d.ts +1 -14
  44. package/dist/regenerate/ledger.js +1 -1
  45. package/dist/regenerate/loop.d.ts +40 -58
  46. package/dist/regenerate/loop.js +209 -126
  47. package/dist/regenerate/regenerate.d.ts +0 -2
  48. package/dist/regenerate/regenerate.js +0 -14
  49. package/dist/regenerate/standing.js +1 -1
  50. package/dist/regenerate/testing-steps.d.ts +11 -0
  51. package/dist/regenerate/testing-steps.js +22 -3
  52. package/dist/regenerate-cli.js +18 -9
  53. package/dist/self-invocation.js +5 -8
  54. package/dist/sentinel.js +3 -3
  55. package/dist/skill.d.ts +0 -11
  56. package/dist/skill.js +0 -9
  57. package/dist/stacks.js +1 -1
  58. package/dist/tools.js +2 -3
  59. package/docs/README.md +0 -2
  60. package/docs/authoring-plain.md +3 -3
  61. package/docs/chats.md +1 -3
  62. package/docs/claude-subscription.md +6 -6
  63. package/docs/config.md +11 -13
  64. package/docs/deploy.md +1 -1
  65. package/docs/development.md +2 -3
  66. package/docs/headless.md +4 -3
  67. package/docs/hosting.md +7 -7
  68. package/docs/installation.md +4 -0
  69. package/docs/parser.md +2 -2
  70. package/docs/regenerating.md +12 -10
  71. package/docs/sentinel.md +3 -3
  72. package/docs/skills-and-gates.md +3 -8
  73. package/docs/using.md +11 -18
  74. package/genome/rules/test-plain-files.md +15 -7
  75. package/genome/rules/turri-regeneration.md +4 -9
  76. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  77. package/package.json +1 -1
  78. package/dist/advisor-chat.d.ts +0 -63
  79. package/dist/advisor-chat.js +0 -290
  80. package/dist/change-plain-cli.d.ts +0 -1
  81. package/dist/change-plain-cli.js +0 -55
  82. package/dist/ledger-cli.d.ts +0 -1
  83. package/dist/ledger-cli.js +0 -50
  84. package/dist/ledger-tools.d.ts +0 -10
  85. package/dist/ledger-tools.js +0 -64
  86. package/dist/regenerate/advisor-records.d.ts +0 -93
  87. package/dist/regenerate/advisor-records.js +0 -110
  88. package/dist/regenerate/advisor-runs.d.ts +0 -87
  89. package/dist/regenerate/advisor-runs.js +0 -327
  90. package/dist/regenerate/test-advisor.d.ts +0 -101
  91. package/dist/regenerate/test-advisor.js +0 -379
  92. package/dist/spec-tools.d.ts +0 -36
  93. package/dist/spec-tools.js +0 -128
  94. package/docs/test-advisor.md +0 -110
package/README.md CHANGED
@@ -7,7 +7,9 @@
7
7
  <a href="https://discord.com/invite/REJzFmVQfC"><img src="https://img.shields.io/badge/Discord-join%20the%20community-5865F2?logo=discord&logoColor=white" alt="Join the turri Discord"></a>
8
8
  </p>
9
9
 
10
- **turri** builds regenerative software: what lasts is the system's intent, and the code is derived from it - cheap to throw away and build again. You tell **turri** what the system should do; **turri** writes that down as durable intent, with the tests that say when it is met, and builds the code from it. From then on the durable intent is the source of truth: as it changes, the code is regenerated from it rather than patched in place, and never left to drift from it.
10
+ **turri** is the first coding agent with the power of [regenerative software](https://chadfowler.com/regenerative-software/). It gives you back control over engineering while the agent handles the coding. Instead of maintaining code, you maintain the system's definition (specs, tests, and ADRs) structured using [\*\*\*plain](https://plainlang.org/). You describe what you want, **turri** captures it as a durable, reviewable system definition, and generates the code from it. As your intent evolves, **turri** regenerates the affected code rather than patching it prompt after prompt. The system definition remains the source of truth, and tests verify that the generated code conforms to it.
11
+
12
+ Code is disposable, system definition is durable.
11
13
 
12
14
  **turri** is named after *Turritopsis dohrnii*, the immortal jellyfish that regenerates itself from its young form, again and again - as **turri** regenerates the code from the durable intent - see [the name](#the-name).
13
15
 
@@ -15,53 +17,53 @@
15
17
 
16
18
  ## Quick start
17
19
 
18
- **turri** is built on [pi](https://pi.dev), the coding agent, and runs wherever [pi](https://pi.dev) runs: macOS, Linux, WSL; native Windows best effort, with Git Bash. You need git, bash and [Node](https://nodejs.org/en/download) 22.19 or newer - a Linux distribution's own `nodejs` package is often older. The agents use this machine's toolchains, fenced by a command check and an audit everywhere, and an OS sandbox where the OS has one - Seatbelt on macOS, bubblewrap on Linux (`apt install bubblewrap`) - see [installation](docs/installation.md#installation).
20
+ **turri** is built on [pi](https://pi.dev/) and runs on macOS, Linux, and WSL (native Windows via Git Bash is best effort). You'll need Git, Bash, and Node.js 22.19+.
21
+
22
+ ### Install
19
23
 
20
24
  ```bash
21
- npm install -g @turri-dev/cli # puts `turri` on your PATH
22
- turri --version # the version you installed? if not, see docs/installation.md#an-older-turri-runs
23
- turri doctor # checks the machine
25
+ npm install -g @turri-dev/cli
26
+ turri doctor
24
27
  ```
25
28
 
26
- To follow `main` as it moves, or work on turri itself, run it [from a clone](#from-a-clone) instead.
29
+ `turri doctor` checks your environment and tells you how to fix any missing dependencies. See the [installation guide](docs/installation.md) for details.
27
30
 
28
- `doctor` checks for Node 22.19+, bash, the OS sandbox and a model provider for [pi](https://pi.dev); in a project, the toolchains its modules need, what its testing scripts run against this machine, and that each model `config.turri.yaml` names answers with your credentials. It changes nothing without asking: when a check fails - the OS sandbox does not start, say - it says why, and the command for you to run. Run it again whenever something breaks. What each check means: [installation](docs/installation.md).
31
+ ### Configure your models
29
32
 
30
- Then start it in your project, signed in to your model providers:
33
+ **turri** uses a capable model to define the system and plan the work, and a smaller, cheaper model to write the code. It supports any model provider available through [pi](https://pi.dev/), and some subscriptions too.
31
34
 
32
35
  ```bash
33
- cd ~/my-project
34
- turri init-config # asks which vendor you use: Anthropic, OpenAI, Google, Amazon Bedrock, a Claude subscription, or other
35
- export ANTHROPIC_API_KEY=... # the key it names - or skip it, and type /login in turri once it has started
36
- turri
36
+ mkdir my-project && cd my-project
37
+ turri init-config
37
38
  ```
38
39
 
39
- `turri init-config` asks which vendor's models you use and writes the project's `config.turri.yaml` with two of theirs - a capable one you talk to, which writes the durable intent and plans the work, and a smaller, cheaper one that writes the code. For Anthropic:
40
+ Choose your model provider, then sign in with `/login` once **turri** has started.
40
41
 
41
- ```yaml
42
- harness-model: anthropic/claude-opus-5-5:medium # you talk to it
43
- coding-model: anthropic/claude-haiku-5-5:low # it writes the code
44
- ```
45
-
46
- To skip the question, name the vendor - `anthropic`, `openai`, `google`, `amazon-bedrock` (with `--maker` and `--region`), `claude-code` - your Claude Pro or Max subscription, through Claude Code ([how](docs/claude-subscription.md)) - or `other`:
42
+ ### Build your first app
47
43
 
48
44
  ```bash
49
- turri init-config --vendor anthropic
45
+ turri
50
46
  ```
51
47
 
52
- It then tells you which API key to set - or to type `/login` once **turri** is running instead. **turri** loads the `config.turri.yaml` in the folder you start it from. Below the two models, the file sets every other setting to its default - change any of them in the file, or from the chat with `/turri-config`. Any other model works too: [models](#models).
48
+ Then simply describe what you want:
49
+
50
+ > Build a small API where users can register and sign in.
53
51
 
54
- Once `turri` is running, say what you want - `a small API where people can register and sign in` - and **turri** starts the project and regenerates it at once.
52
+ **turri** captures your intent in [\*\*\*plain](https://plainlang.org/), generates the code, and validates it against the system definition.
55
53
 
56
- No project of your own yet? Build one of [**the examples**](examples/README.md) with turri, step by step.
54
+ As your requirements evolve, just describe the changes. **turri** updates the system definition and regenerates the affected code.
57
55
 
58
- Rather not install Node and the rest? **turri** also runs in Docker, from one image: [turri in Docker](docker/README.md).
56
+ ### Other ways to run turri
59
57
 
60
- Choosing models: [models](#models); what to do next: [use](#use).
58
+ Prefer a graphical interface? Try [turri desktop](https://github.com/turri-oss/turri-desktop).
59
+
60
+ You can also run **turri** [in Docker](docker/README.md), or [from a clone](#from-a-clone) to follow `main` or work on **turri** itself.
61
+
62
+ For more, see [Using **turri**](docs/using.md) and [Examples](examples/README.md).
61
63
 
62
64
  ### From a clone
63
65
 
64
- In place of the npm package - for the latest of `main`, or to change turri itself:
66
+ To run the local version of **turri** instead of the npm package:
65
67
 
66
68
  ```bash
67
69
  git clone git@github.com:turri-oss/turri.git && cd turri
@@ -70,47 +72,41 @@ npm link # puts `turri` on your PATH, pointing at this clone
70
72
  turri doctor
71
73
  ```
72
74
 
73
- The clone runs its TypeScript sources directly, so there is nothing to build. When new commits land:
75
+ The clone runs its TypeScript sources directly, so there is nothing to build. To pick up new commits, run `git pull` and `npm install`, then start **turri** again - a running one keeps the code it started with. More in the [installation guide](docs/installation.md#from-a-clone).
74
76
 
75
- ```bash
76
- git pull
77
- npm install # picks up any dependency that changed
78
- ```
77
+ ## Why
79
78
 
80
- A **turri** already running keeps the code it started with - start it again to run what you pulled. More in [installation](docs/installation.md#from-a-clone).
79
+ Coding agents write in minutes what used to take teams weeks. But while coding got faster, our ability to understand and review code didn't. We increasingly become accountable for software we don't fully understand.
81
80
 
82
- ## Why
81
+ Software built with coding agents grows prompt after prompt, patch upon patch. Decisions and reasoning get lost in chat sessions, misunderstandings accumulate in the code, and each change builds on top of the last. Eventually, neither the developer nor the agent fully understands the system anymore.
82
+
83
+ Better models and more elaborate agent workflows don't solve the fundamental problem: code remains the source of truth, and humans are expected to understand and maintain something they can no longer meaningfully review.
84
+
85
+ Regenerative software flips the traditional model of software development. Instead of maintaining code and trying to preserve the reasoning behind it, we maintain the system's definition and regenerate the code from it.
86
+
87
+ With **turri**, you engineer the system's definition instead of maintaining its implementation. The agent writes the code, but you retain the understanding and control over what gets built.
88
+
89
+ **The goal isn't to write code faster. It's to understand your software again.**
83
90
 
84
- Software has always been maintained: written once, then patched for as long as it lives and everything learnt while building it lived only in the code. Coding agents code in minutes what took a team weeks, and they get better at it with every model, so code is now cheap and a disposable asset. It no longer has to be maintained - it can be regenerated. What has to last instead is the intent: what the system should do, and the tests that say whether it does. Get that right and the code is replaceable. Get it wrong and no agent, however capable, can guess what you meant.
91
+ For the story behind **turri**, read [Why I built turri](https://turri.dev/blog/why-i-built-turri/).
85
92
 
86
- Code that is patched, prompt after prompt, drifts: every misunderstanding stays in it, and the next change is made on top. When the software can always be regenerated from durable information instead, that understanding is written down - explicit, reviewable and tested - and it evolves with the software rather than against it.
93
+ ## Code is disposable
87
94
 
88
- ## How it differs from ye old coding agent
95
+ ### 1. Define
89
96
 
90
- With a coding agent you work on code: you ask for a change, it edits the code, and you review the code it wrote.
97
+ Describe what you want to build or change. **turri** captures your intent as a structured system definition using [\*\*\*plain](https://plainlang.org/), including specifications, architectural decisions, and tests.
91
98
 
92
- With **turri** you work on the durable intent. You say what the software must do, and **turri** updates durable intent and can always regenerate the code from that. You don't review the code or keep it - you review and keep the intent: what the software must do, and what must hold as it changes. The code is a disposable artefact, rebuilt from it whenever it changes.
99
+ ### 2. Review
93
100
 
94
- | | ye old coding agent | **turri** |
95
- | --- | --- | --- |
96
- | **What you maintain** | the code, patched prompt after prompt | the durable intent |
97
- | **What gets built, in what order** | whatever the agent decides, as it goes | the code is built from the durable intent step by step, in a fixed order, so no intent is skipped |
98
- | **Who writes the code** | the agent, and it decides everything else too | the agent - **turri** decides what it builds, the agent only how, line by line |
99
- | **How it works** | improvised, differently every time | a developer workflow baked in - build, unit test, review, conformance test, regression test, commit - the same every time |
100
- | **What counts as done** | the agent says so | every unit of intent is tested and validated by **turri** itself: all its tests pass, or the work goes back |
101
- | **Tests** | written and changed by the agent that writes the code | written from the durable intent, apart from the code; the agent writing the code cannot change them |
102
- | **When it gets stuck** | it keeps going, or quietly works around the problem | it stops and tells you which intent to clarify |
101
+ Review the system definition before implementation begins. Make sure it describes what you actually want, without getting lost in implementation details.
103
102
 
104
- ## How it works
103
+ ### 3. Regenerate
105
104
 
106
- **turri** captures the durable intent in [\*\*\*plain](https://plainlang.org/docs/), a language for saying what software should do. \*\*\*plain breaks the intent down into functionalities - small units, each a single thing the software does - and **turri** regenerates the code from them piece by piece.
105
+ **turri** generates code from the approved definition. When requirements change, it regenerates the affected parts of the implementation rather than accumulating patches on top of existing code.
107
106
 
108
- 1. **Define.** You say what the software should do; **turri** writes it down as \*\*\*plain.
109
- 2. **Review and refine.** You review \*\*\*plain and change it with **turri** until it says what you mean.
110
- 3. **Regenerate.** Agents write the code; **turri** decides what they write and when, step by step, the same way every time.
111
- 4. **Validate.** Agents write conformance tests from \*\*\*plain; **turri** runs them, and keeps the code only when it does what \*\*\*plain says.
107
+ ### 4. Prove
112
108
 
113
- These are not phases, one after the other: you don't spend hours writing \*\*\*plain and then hours waiting for the code. You go round the loop in small steps, in conversation with **turri** - while you refine the next functionality, the one before it is already being regenerated and validated. A bug is fixed in \*\*\*plain; a new behaviour goes into \*\*\*plain; and the next regeneration carries it. Ask to try it at any time: **turri** puts what is built in `dist` and starts it on your machine - an app, and it tells you where to open your browser.
109
+ **turri** verifies the generated implementation against independently defined tests. The coding agent cannot change the tests to make its implementation pass. If validation fails, **turri** iterates until the implementation conforms to the definition.
114
110
 
115
111
  ## The name
116
112
 
@@ -152,14 +148,14 @@ Then say what you want:
152
148
 
153
149
  > A small API where people can register and sign in, in Python.
154
150
 
155
- In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or the [test advisor](docs/test-advisor.md) finds a functional spec that needs them), regenerates the smallest thing that runs at once, then the main thing you described, and says what it chose and what it would write next. Every change after is yours to ask for: **turri** writes it as \*\*\*plain and regenerates it. While it works:
151
+ In a new project **turri** starts it itself, without asking how: it chooses the stack - the one you name, else a standard library stack this machine can build - writes the module and its unit testing script (and the conformance tests' when you ask for them, or - conformance tests on - it judges a functional spec needs them), regenerates the smallest thing that runs at once, then the main thing you described, and says what it chose and what it would write next. Every change after is yours to ask for: **turri** writes it as \*\*\*plain and regenerates it. While it works:
156
152
 
157
153
  - the **panel** above the input shows every build - its stage, what its agents are doing, its model and cost - and the queue behind it;
158
154
  - ask to try it at any time - "let me try it" - and **`release`** puts what is built so far in `dist/<module>` and **`activate`** starts it, installing what it needs - nothing to approve;
159
155
  - the **side panel** (`ctrl+h`) takes the screen and opens on **regen** - \*\*\*plain, every item marked planned, working, regenerated, validating, conform or needs you - and `p` turns it to the **pulses** (`/pulses`) - every pulse, running, queued and finished, and what each regenerates; what its agents did is in each pulse's log in `.turri/jobs/`, kept with `--debug` (`debug: true`);
160
156
  - **`/halt`** halts a pulse, **`/lineage`** shows every generation of a module, and the **`drift`** tool says what is left to regenerate;
161
157
  - **`/btw <question>`** asks turri something on the side - answered at once, even while a question waits for you (typed as the answer, under "Something else…"), and left out of the conversation;
162
- - **`/turri-config`** changes any setting of the project's `config.turri.yaml` - the models, review, the test advisor, how many pulses at once - and says when it takes effect: now, at your next message, or at the next pulse. No restart: `/turri-config review false`, or `/turri-config` alone to pick from the list;
158
+ - **`/turri-config`** changes any setting of the project's `config.turri.yaml` - the models, review, how many pulses at once - and says when it takes effect: now, at your next message, or at the next pulse. No restart: `/turri-config review false`, or `/turri-config` alone to pick from the list;
163
159
  - **`/sentinel`** says whether the sentinel checks every pulse that finishes: `ask` (you are asked before it first opens), `on` or `off`;
164
160
  - **`/stack`** chooses the stack to build with, in a project whose backend and frontend each have their own testing scripts in `config.turri.<stack>.yaml` - `/stack backend`, `/stack none` - for the session (`--stack <name>` on the command line). The chat's model builds each part with its own stack by itself, pinned to that module's pulses.
165
161
 
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { ChatLink } from "./chats.ts";
3
3
  /**
4
- * Whether a chat is busy, for what turri tells it of its own accord - a test advisor's verdict, a background skill run's
5
- * end - and so waits: its agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
4
+ * Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
5
+ * agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
6
6
  */
7
7
  export declare function chatBusy(link: ChatLink, context: () => ExtensionContext | undefined): boolean;
package/dist/chat-idle.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Whether a chat is busy, for what turri tells it of its own accord - a test advisor's verdict, a background skill run's
3
- * end - and so waits: its agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
2
+ * Whether a chat is busy, for what turri tells it of its own accord - a background skill run's end - and so waits: its
3
+ * agent working, or the person typing - or no session to tell yet. Nothing told so interrupts.
4
4
  */
5
5
  export function chatBusy(link, context) {
6
6
  const session = link.session();
package/dist/chats.d.ts CHANGED
@@ -6,7 +6,6 @@ import { type SentinelSetting } from "./config.ts";
6
6
  import type { AskUserIO } from "./ask.ts";
7
7
  import type { Job, JobRegistry } from "./regenerate/jobs.ts";
8
8
  import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
9
- import type { AdvisorVerdict } from "./regenerate/advisor-runs.ts";
10
9
  import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type NoticeInput, type SentinelCheck } from "./notice.ts";
11
10
  /**
12
11
  * The chats of a turri session.
@@ -126,19 +125,12 @@ export interface ChatInstance {
126
125
  concluded(conclusion: Conclusion): void;
127
126
  /** The person answered a notice with something to do: the chat's agent started on it. */
128
127
  act(task: string): void;
129
- /**
130
- * The test advisor's verdict: once the chat is idle - its agent done, nothing typed - a yes starts a turn that writes its
131
- * scenarios, and a no is a line. Those that arrive meanwhile are delivered together.
132
- */
133
- advised(verdict: AdvisorVerdict): void;
134
128
  /** The jobs changed: what it draws of them is drawn again. */
135
129
  jobsChanged(): void;
136
130
  /** How hard the chat's model thinks now: sub-agents started from it think as hard. */
137
131
  thinkingLevel(): string | undefined;
138
132
  /** The chat's context, as its tools get it - for its model and its providers. */
139
133
  context(): ExtensionContext | undefined;
140
- /** Conformance tests turned on or off: the chat's tools switched to match - conform and evaluate_tests, or the tool that turns them on. */
141
- conformanceSwitched?(): void;
142
134
  }
143
135
  /** A chat's extension, linked to its chat. */
144
136
  export interface ChatLink {
@@ -248,8 +240,6 @@ export interface TurriCore {
248
240
  } | {
249
241
  refused: string;
250
242
  };
251
- /** The test advisor's verdict, for the chat the person looks at - held until there is one. Undefined: no chat to hand it to yet. */
252
- advised(verdict: AdvisorVerdict): string | undefined;
253
243
  /** The notices put to the person and not yet answered. */
254
244
  notices(): Notice[];
255
245
  /**
package/dist/chats.js CHANGED
@@ -106,8 +106,6 @@ export function createChats(options) {
106
106
  let consent = "unasked";
107
107
  let asking;
108
108
  const held = [];
109
- /** The test advisor's verdicts that came with no chat of the person's to hand them to: handed on as one comes up. */
110
- const unplaced = [];
111
109
  const run = { run: randomUUID().slice(0, 8), pid: process.pid, started: new Date().toISOString(), chats: [] };
112
110
  const changed = () => {
113
111
  for (const listener of listeners) {
@@ -364,10 +362,6 @@ export function createChats(options) {
364
362
  session: () => chat.session,
365
363
  live: (instance) => {
366
364
  chat.instance = instance;
367
- // The advisor's verdicts that waited for a chat of the person's.
368
- if (unplaced.length > 0 && personFacing() !== undefined)
369
- for (const verdict of unplaced.splice(0))
370
- core.advised(verdict);
371
365
  },
372
366
  };
373
367
  },
@@ -496,23 +490,6 @@ export function createChats(options) {
496
490
  changed();
497
491
  return target.id;
498
492
  },
499
- advised(verdict) {
500
- const target = personFacing();
501
- if (target?.instance === undefined) {
502
- unplaced.push(verdict);
503
- return undefined;
504
- }
505
- if (target.id !== shownId)
506
- target.unread = true;
507
- try {
508
- target.instance.advised(verdict);
509
- }
510
- catch {
511
- /* a chat let go as it was told: a yes stays undelivered in the advisor's file, for the next start */
512
- }
513
- changed();
514
- return target.id;
515
- },
516
493
  answer(id, answer) {
517
494
  const notice = open.find((candidate) => candidate.id === id);
518
495
  if (notice === undefined)
package/dist/cli.js CHANGED
@@ -73,13 +73,10 @@ function chat(args) {
73
73
  }
74
74
  const COMMANDS = {
75
75
  regenerate: { module: "./regenerate-cli.ts", blurb: "regenerate a module and its chain from the spec as it is (with module:func-ids: regenerate those again)" },
76
- glimpse: { module: "./regenerate-cli.ts", blurb: "plan the work and print the first job's prompt, starting nothing", args: ["--dry-run"] },
77
76
  drift: { module: "./drift-cli.ts", blurb: "what is left to regenerate: how far the code has drifted from its spec" },
78
77
  conform: { module: "./conform-cli.ts", blurb: "write and run a module's conformance tests" },
79
- "change-plain": { module: "./change-plain-cli.ts", blurb: "apply a change to ***plain, given as a git diff, and regenerate it" },
80
78
  parse: { module: "./parse-cli.ts", blurb: "parse ***plain - its syntax and structure, never its code or tests - regenerating nothing" },
81
79
  lineage: { module: "./lineage-cli.ts", blurb: "a module's lineage: what was regenerated into it, and when" },
82
- ledger: { module: "./ledger-cli.ts", blurb: "what turri did here: the last runs and their pulses, or one pulse, from the ledger" },
83
80
  release: { module: "./release-cli.ts", blurb: "release what is regenerated to dist/<module> and activate it on this machine" },
84
81
  cultivate: { module: "./cultivate-cli.ts", blurb: "run a gated skill" },
85
82
  };
@@ -88,6 +85,25 @@ const SETUP_COMMANDS = {
88
85
  "init-config": "write a quick start config.turri.yaml here, from the vendor you use: a strong model to talk to, a smaller one to write the code",
89
86
  doctor: "check what turri needs - in a project, what it needs of this machine, and that its models answer",
90
87
  };
88
+ /**
89
+ * pi's package commands, run by pi itself: someone who installs turri has no `pi` on the PATH - npm links only turri's
90
+ * own command - and turri reads the packages pi installs (installed-providers.ts). `update` updates packages only: pi's
91
+ * own `update` with no source updates pi, and turri's pi is a pinned dependency (`updatesPi`).
92
+ */
93
+ const PACKAGE_COMMANDS = {
94
+ install: "install a pi package for every turri, -l for this project only - pi-claude-code for a Claude subscription, say",
95
+ update: "update a pi package, or --extensions for all of them",
96
+ remove: "remove a pi package `turri install` put in",
97
+ list: "the pi packages installed, yours and this project's",
98
+ };
99
+ /** Whether `update <args>` would update pi itself, as pi reads it: no package named, `self` or `pi`, `--self` or `--all`. */
100
+ function updatesPi(args) {
101
+ if (args.some((arg) => arg === "--self" || arg === "--all" || arg === "self" || arg === "pi"))
102
+ return true;
103
+ if (args.some((arg) => arg === "-h" || arg === "--help" || arg === "--extensions" || arg === "--extension" || arg === "--models"))
104
+ return false;
105
+ return !args.some((arg) => !arg.startsWith("-"));
106
+ }
91
107
  const USAGE = [
92
108
  "usage: turri [options] open the conversation here: pi, with turri's tools and themes loaded",
93
109
  " turri <command> [args]",
@@ -101,6 +117,7 @@ const USAGE = [
101
117
  ...Object.entries(COMMANDS).map(([name, { blurb }]) => ` ${name.padEnd(12)} ${blurb}`),
102
118
  "",
103
119
  ...Object.entries(SETUP_COMMANDS).map(([name, blurb]) => ` ${name.padEnd(12)} ${blurb}`),
120
+ ...Object.entries(PACKAGE_COMMANDS).map(([name, blurb]) => ` ${name.padEnd(12)} ${blurb}`),
104
121
  "",
105
122
  "Run `turri <command> --help` for that command's options.",
106
123
  "",
@@ -152,7 +169,7 @@ if (command === "-v" || command === "--version") {
152
169
  // The AWS region the project's Bedrock models need, set before any model is called - here, and in the pi the chat starts,
153
170
  // which inherits it - unless the person set one (bedrock-region.ts). The models named on the command line count too. A
154
171
  // command that calls no model is left alone.
155
- if (!["parse", "drift", "lineage", "ledger", "init-config"].includes(command ?? "")) {
172
+ if (!["parse", "drift", "lineage", "init-config", ...Object.keys(PACKAGE_COMMANDS)].includes(command ?? "")) {
156
173
  const { applyBedrockRegion } = await import("./bedrock-region.js");
157
174
  const named = argv.flatMap((arg, at) => ["--harness-model", "--coding-model", "--model"].includes(arg) ? [argv[at + 1] ?? ""] : arg.startsWith("--harness-model=") || arg.startsWith("--coding-model=") || arg.startsWith("--model=") ? [arg.slice(arg.indexOf("=") + 1)] : []);
158
175
  applyBedrockRegion(process.cwd(), { also: named.filter((model) => model !== "") });
@@ -169,6 +186,16 @@ if (command === "doctor") {
169
186
  const { main } = await import("./setup.js");
170
187
  process.exit(await main(rest));
171
188
  }
189
+ // pi's own main answers them, as `pi install` would - into the same ~/.pi/agent turri reads - and exits.
190
+ if (Object.hasOwn(PACKAGE_COMMANDS, command)) {
191
+ if (command === "update" && updatesPi(rest)) {
192
+ console.error("turri update updates pi packages: name one (turri update <source>), or --extensions for all of them. pi is part of turri - npm install -g @turri-dev/cli@latest updates both.");
193
+ process.exit(1);
194
+ }
195
+ const { main } = await import("@earendil-works/pi-coding-agent");
196
+ await main(argv);
197
+ process.exit(process.exitCode ?? 0);
198
+ }
172
199
  const entry = COMMANDS[command];
173
200
  if (entry === undefined) {
174
201
  console.error(`unknown command: ${command}\n\n${USAGE}`);
@@ -185,7 +212,7 @@ process.argv = [
185
212
  // A headless run is stopped by a signal - SIGTERM, SIGHUP, Ctrl-C - whatever else listens for it: it exits, and what
186
213
  // its agents left running goes with it (shell.ts kills every process group on exit). Left to the libraries' own
187
214
  // handlers, one ran on for minutes after it was told to stop, building in the same codebase as the run after it.
188
- if (!["parse", "drift", "lineage", "ledger"].includes(command)) {
215
+ if (!["parse", "drift", "lineage"].includes(command)) {
189
216
  for (const [signal, code] of [["SIGTERM", 143], ["SIGHUP", 129], ["SIGINT", 130]]) {
190
217
  process.on(signal, () => {
191
218
  console.error(`\nstopped (${signal})`);
@@ -32,7 +32,6 @@ const ROLE_ABOUT = {
32
32
  judge: "judges a failing conformance run - as judge-model, which it wins over",
33
33
  arbiter: "weighs a second review",
34
34
  debugger: "a fresh look at unit tests that keep failing the same way",
35
- advisor: "the test advisor: whether a new or changed functional spec needs scenarios",
36
35
  };
37
36
  /** Every setting, in the order the list shows them. */
38
37
  export function settings(rules = []) {
@@ -65,8 +64,7 @@ export function settings(rules = []) {
65
64
  { key: "allow-to-stop-jobs", about: "whether turri stops a running pulse the ***plain has moved on from", kind: "boolean", unset: "true", effect: "now" },
66
65
  { key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
67
66
  { key: "sentinel", about: "whether a chat of its own checks every finished pulse, tests the release, and tells you what is wrong - ask: you are asked before it first opens", kind: "choice", options: ["ask", "true", "false"], unset: "ask", effect: "next-landing" },
68
- { key: "test-advisor", about: "whether turri checks each new or changed functional spec with no scenarios in the background, to see whether it needs scenarios - on a yes, the chat writes them", kind: "boolean", unset: "true", effect: "now" },
69
- { key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, the test advisor and conform off", kind: "boolean", unset: "false", effect: "now" },
67
+ { key: "conformance-tests", about: "whether functional specs' scenarios are written and conformance tested - false: none, and the chat's conform refused", kind: "boolean", unset: "false", effect: "now" },
70
68
  { key: "test-dir", about: "the folder of the test plain files, a folder per module in it, by path from the project root", kind: "path", unset: "tests", effect: "now" },
71
69
  { key: "base-folder", about: "a folder a codebase that requires no other module starts from, by path from the project root - code to build on, files to use, copied in once", kind: "path", unset: "none: it starts empty", effect: "next-pulse" },
72
70
  { key: "unittests-script", about: "the unit testing script, by path from the project root", kind: "path", unset: "the one run_unittests*.sh found", effect: "next-test-run" },
package/dist/config.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * ```yaml
7
7
  * module: prism_cli.plain # what `turri regenerate` builds by default
8
- * conformance-tests: false # whether scenarios are written and conformance tested - false: none, the test advisor off (default: false)
8
+ * conformance-tests: false # whether scenarios are written and conformance tested - false: none (default: false)
9
9
  * test-dir: tests # where the test plain files are, a folder per module: tests/<module>/ (default: tests)
10
10
  * base-folder: existing-app # a codebase that requires none starts as a copy of it - code to build on, assets to use
11
11
  * harness-model: # the model you chat with in `turri`
@@ -20,7 +20,6 @@
20
20
  * mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
21
21
  * allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
22
22
  * release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
23
- * test-advisor: false # check each new or changed functional spec with no scenarios for whether it needs them - on a yes, the chat writes them (default: true)
24
23
  * sentinel: true # a chat of its own every finished pulse goes to, which tests the release and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
25
24
  * rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
26
25
  * unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
@@ -128,10 +127,9 @@ export interface ModelChoice {
128
127
  /**
129
128
  * The agents turri starts, by what they do - each can be given its own model, thinking and turn limit (`models:`).
130
129
  * The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
131
- * are both `arbiter`. The test advisor's calls - classifying a functional spec, its probes, its readers, its verifier -
132
- * are `advisor`.
130
+ * are both `arbiter`.
133
131
  */
134
- export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger", "advisor"];
132
+ export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
135
133
  export type AgentRole = (typeof AGENT_ROLES)[number];
136
134
  /**
137
135
  * How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
@@ -181,11 +179,6 @@ export declare function skillModel(root: string, role?: "harness" | "coding"): s
181
179
  * The coding role always runs on what it is given: its config is already in it (projectModels).
182
180
  */
183
181
  export declare function roleModel(config: Pick<ProjectConfig, "harnessModel" | "judgeModel" | "models">, role: AgentRole): ModelChoice | undefined;
184
- /**
185
- * What the test advisor's calls run on: `models.advisor` - else `default` - and without either the coding
186
- * model alone, thinking as the role has it (ROLE_THINKING). Undefined when the config names no model at all.
187
- */
188
- export declare function advisorModel(config: ProjectConfig): string | undefined;
189
182
  /** How long each turn of a role's agents may take, in milliseconds: its own, `default`'s, `turn-limit:`'s - or undefined, the harness's default. */
190
183
  export declare function roleTurnLimitMs(config: Pick<ProjectConfig, "models" | "turnLimit">, role: AgentRole | undefined): number | undefined;
191
184
  /** `sentinel:` - on, off, or `ask`: on once the person says so, asked before it first opens in a session. */
@@ -230,13 +223,6 @@ export interface ProjectConfig {
230
223
  * asked, before it first opens in a session, whether to start it. Unset: ask.
231
224
  */
232
225
  sentinel?: SentinelSetting;
233
- /**
234
- * Whether the test advisor starts by itself: in the chat and a host, each new or changed functional spec with no
235
- * scenarios is classified in the background, and on a yes the chat writes its scenarios (docs/test-advisor.md). false
236
- * turns off only that: the chat's evaluate_tests still works, and asked for scenarios, the chat writes them as before.
237
- * Unset: true.
238
- */
239
- testAdvisor?: boolean;
240
226
  /**
241
227
  * The folder of the test plain files, from the project's folder: a functional spec's scenarios are in its test plain
242
228
  * file in `<test-dir>/<module>/`. Unset: `tests`.
@@ -244,9 +230,9 @@ export interface ProjectConfig {
244
230
  testDir?: string;
245
231
  /**
246
232
  * Whether functional specs' scenarios are written and conformance tested (conformance-switch.ts). False: none - no
247
- * conformance pulse, no conformance testing script, the test advisor and the chat's conform and evaluate_tests off; the
248
- * test plain files there are kept, and not tested. The person asking for tests, or agreeing to the chat's offer, turns it
249
- * on. Unset: false.
233
+ * conformance pulse, no conformance testing script, the chat's conform refused; the test plain
234
+ * files there are kept, and not tested. They make each change take about twice as long, so only the person turns them
235
+ * on - /conform, or this key. Unset: false.
250
236
  */
251
237
  conformanceTests?: boolean;
252
238
  /**
@@ -328,7 +314,6 @@ export declare const CONFIG_KEYS: {
328
314
  readonly allowToStopJobs: "allow-to-stop-jobs";
329
315
  readonly releaseAfterPulse: "release-after-pulse";
330
316
  readonly sentinel: "sentinel";
331
- readonly testAdvisor: "test-advisor";
332
317
  readonly testDir: "test-dir";
333
318
  readonly conformanceTests: "conformance-tests";
334
319
  readonly baseFolder: "base-folder";
package/dist/config.js CHANGED
@@ -11,7 +11,7 @@ import { projectDirOf } from "./regenerate/paths.js";
11
11
  *
12
12
  * ```yaml
13
13
  * module: prism_cli.plain # what `turri regenerate` builds by default
14
- * conformance-tests: false # whether scenarios are written and conformance tested - false: none, the test advisor off (default: false)
14
+ * conformance-tests: false # whether scenarios are written and conformance tested - false: none (default: false)
15
15
  * test-dir: tests # where the test plain files are, a folder per module: tests/<module>/ (default: tests)
16
16
  * base-folder: existing-app # a codebase that requires none starts as a copy of it - code to build on, assets to use
17
17
  * harness-model: # the model you chat with in `turri`
@@ -26,7 +26,6 @@ import { projectDirOf } from "./regenerate/paths.js";
26
26
  * mutation-testing: false # give the coding agent and the reviewer can_it_fail (default: true)
27
27
  * allow-to-stop-jobs: false # stop a running job the spec moved on from (default: true)
28
28
  * release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
29
- * test-advisor: false # check each new or changed functional spec with no scenarios for whether it needs them - on a yes, the chat writes them (default: true)
30
29
  * sentinel: true # a chat of its own every finished pulse goes to, which tests the release and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
31
30
  * rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
32
31
  * unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
@@ -229,10 +228,9 @@ export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhig
229
228
  /**
230
229
  * The agents turri starts, by what they do - each can be given its own model, thinking and turn limit (`models:`).
231
230
  * The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
232
- * are both `arbiter`. The test advisor's calls - classifying a functional spec, its probes, its readers, its verifier -
233
- * are `advisor`.
231
+ * are both `arbiter`.
234
232
  */
235
- export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger", "advisor"];
233
+ export const AGENT_ROLES = ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
236
234
  /**
237
235
  * How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
238
236
  * given. The agents that do the work - write the code and the tests, explore, release - think little: they work from a
@@ -244,7 +242,6 @@ export const ROLE_THINKING = {
244
242
  conformance: "low",
245
243
  explorer: "low",
246
244
  release: "low",
247
- advisor: "low",
248
245
  reviewer: "medium",
249
246
  "test-reviewer": "medium",
250
247
  judge: "medium",
@@ -344,14 +341,6 @@ export function roleModel(config, role) {
344
341
  const legacy = role === "judge" || role === "test-reviewer" ? config.judgeModel : undefined;
345
342
  return inheritModel(own, inheritModel(legacy, choiceOf(models.default)));
346
343
  }
347
- /**
348
- * What the test advisor's calls run on: `models.advisor` - else `default` - and without either the coding
349
- * model alone, thinking as the role has it (ROLE_THINKING). Undefined when the config names no model at all.
350
- */
351
- export function advisorModel(config) {
352
- const coding = projectModels(config).coding?.model;
353
- return modelSpec(inheritModel(roleModel(config, "advisor"), coding !== undefined ? { model: coding } : undefined));
354
- }
355
344
  /** How long each turn of a role's agents may take, in milliseconds: its own, `default`'s, `turn-limit:`'s - or undefined, the harness's default. */
356
345
  export function roleTurnLimitMs(config, role) {
357
346
  const models = config.models ?? {};
@@ -414,7 +403,6 @@ export const CONFIG_KEYS = {
414
403
  allowToStopJobs: "allow-to-stop-jobs",
415
404
  releaseAfterPulse: "release-after-pulse",
416
405
  sentinel: "sentinel",
417
- testAdvisor: "test-advisor",
418
406
  testDir: "test-dir",
419
407
  conformanceTests: "conformance-tests",
420
408
  baseFolder: "base-folder",
@@ -589,7 +577,6 @@ function readConfigFileNow(path) {
589
577
  allowToStopJobs: typeof raw[CONFIG_KEYS.allowToStopJobs] === "boolean" ? raw[CONFIG_KEYS.allowToStopJobs] : undefined,
590
578
  releaseAfterPulse: typeof raw[CONFIG_KEYS.releaseAfterPulse] === "boolean" ? raw[CONFIG_KEYS.releaseAfterPulse] : undefined,
591
579
  sentinel: typeof raw[CONFIG_KEYS.sentinel] === "boolean" || raw[CONFIG_KEYS.sentinel] === "ask" ? raw[CONFIG_KEYS.sentinel] : undefined,
592
- testAdvisor: typeof raw[CONFIG_KEYS.testAdvisor] === "boolean" ? raw[CONFIG_KEYS.testAdvisor] : undefined,
593
580
  testDir: text(raw[CONFIG_KEYS.testDir]),
594
581
  conformanceTests: typeof raw[CONFIG_KEYS.conformanceTests] === "boolean" ? raw[CONFIG_KEYS.conformanceTests] : undefined,
595
582
  baseFolder: text(raw[CONFIG_KEYS.baseFolder]),
@@ -1,15 +1,13 @@
1
- import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
2
1
  /**
3
2
  * Whether a project's functional specs are conformance tested: `conformance-tests:` in its config, a stack's own over the
4
- * project's, false when unset. Off, nothing of conformance testing runs - no conformance pulse, no conformance testing
5
- * script, the test advisor and the chat's conform and evaluate_tests off; the test plain files there are kept, and not
6
- * tested. The chat always knows it, and how they are turned on: the person asking for tests, or agreeing to the chat's
7
- * offer of them, turns them on - for this session and the next, written into the config.
3
+ * project's, false when unset. Conformance testing is a validation step that makes each change take about twice as long,
4
+ * so it is off until the person turns it on - with /conform, or the setting - and they keep it off to iterate fast. Off,
5
+ * nothing of conformance testing runs - no conformance pulse, no conformance testing script, the
6
+ * chat's conform refused; the test plain files there are kept, and not tested. The chat never turns them on: it says why
7
+ * it wants them, and the person decides.
8
8
  */
9
- /** The chat's tools that run conformance testing: there while the tests are on. */
10
- export declare const CONFORMANCE_TOOLS: string[];
11
- /** The chat's tool that turns them on: there while they are off. */
12
- export declare const TURN_ON_TOOL = "turn_on_conformance_tests";
9
+ /** Why the chat's conform, or a skill that writes the conformance testing script, is refused while they are off. */
10
+ export declare const CONFORMANCE_OFF_REFUSAL: string;
13
11
  /** Whether a module's functional specs are conformance tested: its stack's `conformance-tests:` over the project's. */
14
12
  export declare function conformanceTestsOn(plainFile: string): boolean;
15
13
  /** Whether the project conformance tests anything: its own config, or a stack's - for the chat's tools, which are the project's. */
@@ -24,11 +22,3 @@ export declare function turnOnConformanceTests(project: string, plainFile?: stri
24
22
  * turned on, and that it may offer it.
25
23
  */
26
24
  export declare function conformanceBlock(on: boolean): string;
27
- /**
28
- * turn_on_conformance_tests: the chat turns conformance testing on, the person having asked for it or agreed to it.
29
- * `turnOn` is the session's (extension.ts `turnOnConformance`): the setting written, every chat's tools switched - the
30
- * file written, from the project.
31
- */
32
- export declare function turnOnConformanceTestsTool(options: {
33
- turnOn: (plainFile?: string) => string;
34
- }): ToolDefinition;