@turri-dev/core 0.1.1-next.35d4c49 → 0.1.1-next.ad4aa8f
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/CHANGELOG.md +56 -0
- package/README.md +17 -11
- package/dist/api/models.d.ts +9 -0
- package/dist/api/models.js +15 -0
- package/dist/api/plain.d.ts +6 -6
- package/dist/api/plain.js +4 -7
- package/dist/api/project.d.ts +35 -0
- package/dist/api/project.js +47 -0
- package/dist/api/session.d.ts +48 -0
- package/dist/api/session.js +17 -0
- package/dist/api/system.d.ts +18 -0
- package/dist/api/system.js +23 -0
- package/dist/btw.d.ts +1 -1
- package/dist/capture/capture.js +11 -8
- package/dist/capture/chat.d.ts +0 -11
- package/dist/capture/chat.js +0 -29
- package/dist/capture/config.d.ts +4 -5
- package/dist/capture/config.js +34 -20
- package/dist/capture/models.d.ts +2 -1
- package/dist/capture/models.js +1 -0
- package/dist/chat-entries.d.ts +81 -39
- package/dist/chat-entries.js +125 -11
- package/dist/chat-model.d.ts +37 -0
- package/dist/chat-model.js +61 -0
- package/dist/chats.d.ts +54 -42
- package/dist/chats.js +86 -80
- package/dist/client.d.ts +30 -0
- package/dist/client.js +12 -0
- package/dist/config-edit.d.ts +54 -1
- package/dist/config-edit.js +103 -33
- package/dist/config.d.ts +12 -9
- package/dist/config.js +38 -9
- package/dist/doctor-checks.d.ts +42 -0
- package/dist/doctor-checks.js +39 -0
- package/dist/environment.d.ts +2 -23
- package/dist/environment.js +5 -68
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +24 -0
- package/dist/extension.d.ts +23 -16
- package/dist/extension.js +170 -234
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +13 -9
- package/dist/init-config.d.ts +11 -9
- package/dist/init-config.js +15 -7
- package/dist/launch-session.d.ts +2 -0
- package/dist/launch-session.js +17 -1
- package/dist/loop-tools.js +11 -10
- package/dist/module-check.d.ts +13 -0
- package/dist/module-check.js +117 -0
- package/dist/notice.d.ts +5 -0
- package/dist/parse-tool.js +3 -2
- package/dist/plain/check.d.ts +27 -13
- package/dist/plain/check.js +51 -116
- package/dist/plain/files.d.ts +2 -0
- package/dist/plain/files.js +13 -0
- package/dist/plain/graph.js +2 -2
- package/dist/plain/highlight.d.ts +4 -20
- package/dist/plain/highlight.js +7 -5
- package/dist/project.d.ts +19 -0
- package/dist/project.js +34 -0
- package/dist/quiet.d.ts +0 -2
- package/dist/quiet.js +0 -14
- package/dist/regenerate/command-check.d.ts +0 -8
- package/dist/regenerate/command-check.js +133 -53
- package/dist/regenerate/conversation-writes.d.ts +5 -1
- package/dist/regenerate/conversation-writes.js +7 -3
- package/dist/regenerate/jobs.d.ts +25 -2
- package/dist/regenerate/jobs.js +3 -0
- package/dist/regenerate/launch.d.ts +1 -0
- package/dist/regenerate/launch.js +9 -0
- package/dist/regenerate/ledger-view.d.ts +14 -14
- package/dist/regenerate/ledger.d.ts +1 -0
- package/dist/regenerate/ledger.js +4 -2
- package/dist/regenerate/loop.d.ts +2 -1
- package/dist/regenerate/loop.js +9 -1
- package/dist/regenerate/os-sandbox.d.ts +4 -2
- package/dist/regenerate/os-sandbox.js +0 -1
- package/dist/regenerate/regenerate.js +2 -1
- package/dist/regenerate/requires-chain.d.ts +44 -0
- package/dist/regenerate/requires-chain.js +174 -0
- package/dist/regenerate/requires.d.ts +2 -40
- package/dist/regenerate/requires.js +14 -171
- package/dist/regenerate/resources.d.ts +0 -2
- package/dist/regenerate/resources.js +2 -14
- package/dist/regenerate/shell.js +20 -9
- package/dist/regenerate/spec-map.d.ts +2 -0
- package/dist/regenerate/spec-map.js +4 -0
- package/dist/regenerate/standing.d.ts +5 -2
- package/dist/run-report.js +2 -2
- package/dist/self-invocation.d.ts +1 -1
- package/dist/self-invocation.js +2 -3
- package/dist/sentinel-chat.js +7 -11
- package/dist/sentinel.d.ts +1 -1
- package/dist/sentinel.js +12 -5
- package/dist/session-events.d.ts +14 -0
- package/dist/session.d.ts +594 -0
- package/dist/session.js +672 -0
- package/dist/settings.d.ts +28 -2
- package/dist/settings.js +92 -56
- package/dist/setup.d.ts +6 -30
- package/dist/setup.js +28 -105
- package/dist/stack.d.ts +25 -12
- package/dist/stack.js +77 -12
- package/dist/surface.d.ts +2 -2
- package/dist/surface.js +4 -5
- package/dist/work.d.ts +125 -0
- package/dist/work.js +250 -0
- package/docs/README.md +2 -3
- package/docs/capture.md +4 -4
- package/docs/chats.md +5 -3
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +4 -4
- package/docs/core.md +105 -128
- package/docs/development.md +9 -9
- package/docs/headless.md +1 -1
- package/docs/installation.md +4 -2
- package/docs/launch.md +2 -2
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +1 -1
- package/docs/sandbox.md +4 -4
- package/docs/sentinel.md +4 -4
- package/docs/skills-and-gates.md +1 -1
- package/docs/using.md +2 -2
- package/genome/rules/integration-embedded-testing.md +3 -3
- package/genome/rules/integration-embedded.md +3 -3
- package/genome/skills/implement-conformance-testing-script/SKILL.md +6 -4
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +13 -11
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +8 -7
- package/genome/skills/implement-unit-testing-script/SKILL.md +7 -5
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +9 -13
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +1 -1
- package/package.json +19 -32
- package/dist/api/commands.d.ts +0 -45
- package/dist/api/commands.js +0 -54
- package/dist/api/config.d.ts +0 -8
- package/dist/api/config.js +0 -8
- package/dist/api/ledger.d.ts +0 -3
- package/dist/api/ledger.js +0 -3
- package/dist/api/startup.d.ts +0 -8
- package/dist/api/startup.js +0 -8
- package/dist/api/terminal.d.ts +0 -18
- package/dist/api/terminal.js +0 -16
- package/dist/chat-models.d.ts +0 -11
- package/dist/chat-models.js +0 -11
- package/dist/chat-ui.d.ts +0 -33
- package/dist/chat-ui.js +0 -192
- package/dist/headless.d.ts +0 -99
- package/dist/headless.js +0 -226
- package/dist/host-session.d.ts +0 -136
- package/dist/host-session.js +0 -139
- package/dist/host.d.ts +0 -8
- package/dist/host.js +0 -17
- package/dist/index.d.ts +0 -16
- package/dist/index.js +0 -7
- package/dist/notifications.d.ts +0 -21
- package/dist/notifications.js +0 -44
- package/dist/reopen.d.ts +0 -29
- package/dist/reopen.js +0 -47
- package/dist/turri-versions.d.ts +0 -71
- package/dist/turri-versions.js +0 -276
- package/dist/view.d.ts +0 -78
- package/dist/view.js +0 -1
- package/docs/hosting.md +0 -284
|
@@ -44,7 +44,7 @@ turri does not depend on the extension: it finds it as pi does, once you have in
|
|
|
44
44
|
coding-model: claude-code/claude-sonnet-5:low # it writes the code
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
For a project that has a `config.turri.yaml` already,
|
|
47
|
+
For a project that has a `config.turri.yaml` already, `init-config` switches the project pair and the three capture models to the subscription. To change just the harness model, use `/settings harness-model claude-code/claude-opus-5-5:medium` in the chat.
|
|
48
48
|
|
|
49
49
|
Two settings of the extension's own, read from the environment: `PI_CLAUDE_CODE_COMMAND`, the Claude Code to run when it is not `claude` on the PATH, and `PI_CLAUDE_CODE_CONFIG_DIR`, a Claude Code configuration folder of its own - another account's sign-in, say.
|
|
50
50
|
|
|
@@ -107,7 +107,7 @@ Each step says what you should see; the first one that does not is where it stop
|
|
|
107
107
|
|
|
108
108
|
## In turri-desktop
|
|
109
109
|
|
|
110
|
-
The desktop app runs turri's chats itself, and finds the extension as the terminal does: install it and sign in to Claude Code as above - in a terminal, once - and choose **Claude subscription** among the vendors of a new project. The app's engine runs with your login shell's PATH, so it finds the `claude` your terminal finds. The sign-in sheet shows `claude-code` among the providers, connected once Claude Code is signed in; its sign-in is Claude Code's own - `claude auth login` in a terminal - not the app's, and its button says so. Doctor's sheet has the `Claude subscription` line of step 3. A host's own part in it is in [running turri in a host](
|
|
110
|
+
The desktop app runs turri's chats itself, and finds the extension as the terminal does: install it and sign in to Claude Code as above - in a terminal, once - and choose **Claude subscription** among the vendors of a new project. The app's engine runs with your login shell's PATH, so it finds the `claude` your terminal finds. The sign-in sheet shows `claude-code` among the providers, connected once Claude Code is signed in; its sign-in is Claude Code's own - `claude auth login` in a terminal - not the app's, and its button says so. Doctor's sheet has the `Claude subscription` line of step 3. A host's own part in it is in [running turri in a host](core.md).
|
|
111
111
|
|
|
112
112
|
## What to know
|
|
113
113
|
|
package/docs/config.md
CHANGED
|
@@ -14,17 +14,17 @@ A project says how its \*\*\*plain is built in `config.turri.yaml`, at the proje
|
|
|
14
14
|
| `claude-code`, a Claude subscription | `claude-code/claude-opus-5-5` | `claude-code/claude-sonnet-5` | none: Claude Code's own sign-in (below) |
|
|
15
15
|
| `other` | `anthropic/claude-opus-5-5` | `google/gemini-3.1-flash-lite` | `ANTHROPIC_API_KEY`, `GEMINI_API_KEY` |
|
|
16
16
|
|
|
17
|
-
Amazon Bedrock asks three more things, from [pi](https://pi.dev)'s catalogue: whose models (`--maker`) - any maker [pi](https://pi.dev) has there, Anthropic, OpenAI, xAI, Meta, Mistral, Qwen, DeepSeek, Amazon, Moonshot, Z.ai, ... - the geography of the inference profile they run in (`--region`) - `global`, `us`, `eu`, `jp`, `au`, `apac`, `in`, `ca` or `us-gov`, as the maker's models are served, or `in-region`, a model served in the AWS region it is called in - and which two. The pair offered is turri's own where it has one - the table's, for Anthropic's and OpenAI's in the geographies they are served in - and otherwise the catalogue's: the strongest model that reasons to talk to, by price, and the cheapest costing at least a fifth of it to code, ties to the newest. Enter takes it; `c` chooses each from the maker's models there. The region is turri's to set, not the person's: [pi](https://pi.dev) calls Bedrock in `AWS_REGION`, else `AWS_DEFAULT_REGION`, else the `AWS_PROFILE`'s region, else `us-east-1` - so every geography but `global`, `us` and `in-region` needs a region of its own (`eu-central-1` for `eu`, `ap-northeast-1` for `jp`, `ap-southeast-2` for `au`, `ap-southeast-1` for `apac`, `ap-south-1` for `in`, `ca-central-1` for `ca`, `us-gov-west-1` for `us-gov`), and turri sets `AWS_REGION` to it in its own process before any model is called (`src/bedrock-region.ts`) - the chat, every command that calls a model, a host's session
|
|
17
|
+
Amazon Bedrock asks three more things, from [pi](https://pi.dev)'s catalogue: whose models (`--maker`) - any maker [pi](https://pi.dev) has there, Anthropic, OpenAI, xAI, Meta, Mistral, Qwen, DeepSeek, Amazon, Moonshot, Z.ai, ... - the geography of the inference profile they run in (`--region`) - `global`, `us`, `eu`, `jp`, `au`, `apac`, `in`, `ca` or `us-gov`, as the maker's models are served, or `in-region`, a model served in the AWS region it is called in - and which two. The pair offered is turri's own where it has one - the table's, for Anthropic's and OpenAI's in the geographies they are served in - and otherwise the catalogue's: the strongest model that reasons to talk to, by price, and the cheapest costing at least a fifth of it to code, ties to the newest. Enter takes it; `c` chooses each from the maker's models there. The region is turri's to set, not the person's: [pi](https://pi.dev) calls Bedrock in `AWS_REGION`, else `AWS_DEFAULT_REGION`, else the `AWS_PROFILE`'s region, else `us-east-1` - so every geography but `global`, `us` and `in-region` needs a region of its own (`eu-central-1` for `eu`, `ap-northeast-1` for `jp`, `ap-southeast-2` for `au`, `ap-southeast-1` for `apac`, `ap-south-1` for `in`, `ca-central-1` for `ca`, `us-gov-west-1` for `us-gov`), and turri sets `AWS_REGION` to it in its own process before any model is called (`src/bedrock-region.ts`) - the chat, every command that calls a model, a host's session, and what calls a model with no session open: `doctor` asking the models, `runCapture`, `launchModule`. `AWS_REGION` or `AWS_DEFAULT_REGION`, set, is always used instead, and so is the profile's region when it is in the geography. Models of two geographies that need two regions get none: one `AWS_REGION` serves every model, and `turri doctor` says which model needs which. `init-config` says which region turri will use.
|
|
18
18
|
|
|
19
19
|
`--harness-model` and `--coding-model` name the two models instead, for any vendor: provider/model-id without a thinking level - `turri init-config --harness-model amazon-bedrock/global.xai.grok-4.7 --coding-model amazon-bedrock/global.xai.grok-4.6`. They are written wherever the vendor's own would be - the two models with their thinking, the commented-out `judge-model` and `models:` examples - and the vendor, maker and geography are read from them. `--judge-model` names the strong one the judging examples use, the harness model unless given. Each is checked against [pi](https://pi.dev)'s catalogue first: one it does not have, or that is not a chat model, is named, with the closest it has, and nothing is written.
|
|
20
20
|
|
|
21
|
-
Each is written with how hard it thinks - `harness-model: openai/gpt-6-astra:medium`, `coding-model: openai/gpt-6-luna:low`
|
|
21
|
+
Each is written with how hard it thinks - `harness-model: openai/gpt-6-astra:medium`, `coding-model: openai/gpt-6-luna:low`. Running `init-config` again sets the pair and all three [capture models](capture.md#models) from the new choice. This replaces earlier capture models, including explicit overrides. For OpenAI on Bedrock, exploration and analysis use the selected coding model and writing uses the harness model, all with their Bedrock IDs and geography. Active `models.chat` and `models.coding` entries follow the selected pair too. Role turn limits and other settings are kept; `--force` writes the whole file again. The reviews and judges of a regeneration run on the coding model but think medium (see [models per role](#models-per-role)).
|
|
22
22
|
|
|
23
23
|
They are an example, not a requirement - any model [pi](https://pi.dev) supports works, signed in any way [pi](https://pi.dev) supports; `other` is the starting point for another provider. What we recommend is that split, a capable model to talk to and a smaller, cheaper one for the coding. Once written, it says what to do next: the key to set in your shell - or `/login` in turri, which [pi](https://pi.dev) keeps in `~/.pi/agent/auth.json` - and that the file belongs to that folder: turri reads the nearest `config.turri.yaml` upwards from where it starts, so one written anywhere else is not seen.
|
|
24
24
|
|
|
25
25
|
Below them it writes every other setting out, each with what it does and the value turri uses for it - `review: false`, `turn-limit: 120`, `parallel-jobs` as this machine's cores make it - so the file says how the project is built, and you change one by changing it. The optional ones, which have no value of their own - the testing scripts (written in by the skill that writes them), `module`, `test-dir`, `judge-model`, `models` - are there commented out, each with an example: uncomment one to use it. A key taken out of the file is still read as the table below says.
|
|
26
26
|
|
|
27
|
-
Beside a `config.yaml` - another tool's, say - the new file takes from it the keys turri reads too, each in its place, its testing scripts above all, and says which it left (see [the old config.yaml](#the-old-configyaml)); `config.yaml` is left as it is.
|
|
27
|
+
Beside a `config.yaml` - another tool's, say - the new file takes from it the keys turri reads too, each in its place, its testing scripts above all, and says which it left (see [the old config.yaml](#the-old-configyaml)); `config.yaml` is left as it is. To initialise a folder other than the current one, give it as an argument.
|
|
28
28
|
|
|
29
29
|
### A Claude subscription
|
|
30
30
|
|
|
@@ -99,7 +99,7 @@ models: # each agent role's model, thinking and tur
|
|
|
99
99
|
| key | what it sets | left out |
|
|
100
100
|
| --- | --- | --- |
|
|
101
101
|
| `module` | the `.plain` file `turri regenerate` and the chat's `regenerate` build when none is named, from the project root | a file has to be named |
|
|
102
|
-
| `harness-model` | the model `turri` starts on - the one you talk to - and, in the conversation, the planner that cuts the work into jobs (on whatever model the chat is on when it plans); under `turri regenerate`, the planner too | [pi](https://pi.dev)'s configured model |
|
|
102
|
+
| `harness-model` | the model `turri` starts on - the one you talk to: every chat of yours is put on it as it opens and again when it changes, and sends nothing while it cannot be reached here - and, in the conversation, the planner that cuts the work into jobs (on whatever model the chat is on when it plans); under `turri regenerate`, the planner too | [pi](https://pi.dev)'s configured model |
|
|
103
103
|
| `coding-model` | every regeneration: functionalities, \*\*\*plain diffs, conformance tests, repairs, planning \*\*\*plain diffs, the explorer | `harness-model` |
|
|
104
104
|
| `judge-model` | the judge and the test review of a conformance run | `coding-model` |
|
|
105
105
|
| `review` | `true` or `false`: whether the code and its unit tests - and the conformance tests - are reviewed once they pass: two reviews at most, the second weighed by the arbiter; off, a job lands once its tests pass. A module's first pulse of one functional spec - the project set up and the smallest thing that runs - lands on its unit tests with no review - see [regenerating the code](regenerating.md#the-code-and-its-unit-tests-are-reviewed) | `false` |
|
package/docs/core.md
CHANGED
|
@@ -1,167 +1,144 @@
|
|
|
1
1
|
# The core
|
|
2
2
|
|
|
3
|
-
turri is two
|
|
3
|
+
turri is two kinds of package. **`@turri-dev/core`** - this one - is everything that decides and does: the session and its chats, the work loop, its pulses and their agents, the sandbox, launch, capture, the sentinel, the ledger, the \*\*\*plain parser, the genome and the standard library, built on [pi](https://pi.dev). **Front ends** build on it: turri's CLI (`@turri-dev/cli`), turri desktop, and any other - an editor's extension, a web service. None is special to the core: each opens the same session, says what it does differently in the same `Frontend`, hears the same events and asks the same methods. With no front end at all, the session works unattended - CI, a scheduled run.
|
|
4
4
|
|
|
5
|
-
The core draws nothing, prints nothing and exits nothing.
|
|
5
|
+
The core draws nothing, prints nothing and exits nothing. It knows no key, panel, widget or spinner; it gives typed data, turri's own words where they are turri's (a launch's text, a pulse's name), and events.
|
|
6
6
|
|
|
7
|
-
## The
|
|
7
|
+
## The five entries
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| entry | what | needs a session |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `@turri-dev/core` | the session (`createTurri`), its events, the data they carry, `TurriError`, and turri's words for its data (`launchText`, `pulseName`, `didNotPass`, `pulseCost`, `formatDuration`, `describeAgents`, `captureStageText`, `capturePhases`, the spec map's `rungOf`, `focusOf`, `countOf`, `lineDiff`) | yes |
|
|
12
|
+
| `@turri-dev/core/plain` | the \*\*\*plain language: parse and check it (`checkPlainFile`), the graph, concepts, highlighting (`HighlightState` is opaque), the standard library's stacks, a diff's place in a spec - with no pi loaded, for an editor that only reads \*\*\*plain | no |
|
|
13
|
+
| `@turri-dev/core/project` | a project on disk: a module checked in it (`checkModule`, `checkModules` - the language's check, then its config files, the steps of adding tests it skipped and its base folder, as `turri parse` checks), its config read, its settings' catalogue and edits (`configSettings`, `readSetting` by key and type), a first config (`initConfig`), how far its modules are built and what drifted (`projectStanding`, `readDrift`), each one's lineage by its name (`historyLog`, `historyShow`), the ledger of what turri did, the last run's chats (`lastRun`), capture (`runCapture`), a launch of its own (`launchModule`), the code exported (`exportCode`) | no |
|
|
14
|
+
| `@turri-dev/core/models` | the vendors' pairs, Amazon Bedrock's makers and geographies, pi's model catalogue, model specs, the providers signed in to | no |
|
|
15
|
+
| `@turri-dev/core/system` | the machine: `doctor({ dir?, models?, overrides?, env? })` (each check named; with `dir` the project too, with `models` its models asked for a word, `overrides` models of the caller's own in place of the config's), the Node check, what an agent's command would change on it, the core's version - with no pi loaded until `doctor` runs, so `coreVersion()` is quick for a `--version` | no |
|
|
10
16
|
|
|
11
|
-
|
|
12
|
-
- **pi's terminal**, from `@earendil-works/pi-coding-agent`: its interactive mode and runtime, CLI, components, editor, borders, key hints and themes. Imports and re-exports by name, type imports, namespace members, destructuring and dynamic imports are checked. Re-exporting all of pi also crosses the boundary. A consumer that builds a pi extension imports its pi peer directly.
|
|
13
|
-
- **What only a screen does**: `registerEntryRenderer`, `registerMessageRenderer`, `registerShortcut`, `setFooter`, `setHeader`, `setEditorComponent` and `onTerminalInput`, whatever they are read from and whatever is done with them - called, kept (`const reg = pi.registerEntryRenderer`), taken out by name (`const { registerShortcut } = pi`), read by a string key (`pi["registerShortcut"]`) or called by a bare name; and a ui's `custom`, read off anything that is a ui - `ui`, `x.ui`, `x["ui"]`, a name given one (`const io = ctx.ui`, `const { ui: io } = ctx`), or anything typed or cast as one: `ExtensionUIContext` (`pi.ExtensionUIContext` too), any type's `["ui"]` (`ExtensionContext["ui"]`), `typeof ctx.ui`, or a type the file names for one (`type Screen = ExtensionContext["ui"]`) - or destructured from one (`const { custom } = ctx.ui`). Beyond the test: a name read by a key computed as the code runs (`pi[key]`), and a ui or pi's API a file reaches without naming it - one a call returns, or one typed by an interface of the file's own. Two core files pass one on without doing anything of their own with it, each site let by for its file, the function it is in and the name it is read from, and checked to be still there: `chats.ts` hands the view pi's `registerShortcut`, its handler run in the chat's scope (`target.registerShortcut` in `scopedToChat`), and `chat-ui.ts`, a hidden chat's stand-in for the screen, passes pi's `onTerminalInput` on to the screen the chat is shown on (`screen` and `next` in `createChatUi`). Anywhere else in those files, it is a crossing.
|
|
17
|
+
Nothing else is importable: a private path is `ERR_PACKAGE_PATH_NOT_EXPORTED`. Every type a public signature reaches has a public name. ESM only.
|
|
14
18
|
|
|
15
|
-
The
|
|
19
|
+
## The session
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
```ts
|
|
22
|
+
import { createTurri } from "@turri-dev/core";
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
const turri = await createTurri({
|
|
25
|
+
frontend, // what the front end does - none: unattended
|
|
26
|
+
client: { name: "turri", version: "0.5.0", mode: "chat" }, // who runs turri, and how: the banner shows it, the ledger and run reports record it
|
|
27
|
+
overrides: { codingModel: "anthropic/claude-haiku-5-5:low" }, // this session's own config values
|
|
28
|
+
onEvent: (event) => {}, // a listener from the moment it opens
|
|
29
|
+
});
|
|
30
|
+
try {
|
|
31
|
+
// ...
|
|
32
|
+
} finally {
|
|
33
|
+
await turri.dispose(); // or `await using turri = ...` where the runtime has it
|
|
34
|
+
}
|
|
35
|
+
```
|
|
20
36
|
|
|
21
|
-
|
|
37
|
+
One session a process, on the project in the process's working folder: a second `createTurri` while one is open throws `session-open`. Several projects in one process - a `cwd` option - is a later step, which will add to this and change nothing in it.
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
| --- | --- | --- |
|
|
25
|
-
| `chat(pi, chat)` | in every chat - the sentinel's too - as its extension is built, inside the chat's scope: after the handlers that remember the chat's context, just before the core's banner, `/stdlib` and the conversation's tools, and before the return of a chat with no skills - so every chat gets it | registers the renderers of every entry and message the core appends ([the entries](#the-entries)); paints the banner and the jellyfish on `session_start` while `session.welcomeVisible(chat.link.id)`, pads the screen and highlights \*\*\*plain code blocks; registers `PANEL_KEY` (`ctrl+h`) and points the side panel's `say` at this chat |
|
|
26
|
-
| `chatCommands(pi, chat)` | in every chat of a terminal session (`TurriCore.terminal`), inside the chat's scope: right after `/btw`, the last of the conversation's commands, and before the commands of a project's command-only skills and `/capture` - and before the return of a chat with no skills - so pi's command list keeps turri's order | registers `/chat`, `alt+n`, `alt+w`, `alt+1…9` and the chat strip |
|
|
27
|
-
| `questions.dialogs(ctx, declining, decline)` | for each question asked in a chat with a screen and no host dialogs (`askUserVia`): the conversation's `ask_user`, a skill's interview - every caller passes `session.view?.questions` | puts the question in turri's dialog over the chat - its options, "Something else…", what was said before it - calling `decline` when the person presses `ctrl+c`, and setting `declining.close` so a stopped turn closes it |
|
|
28
|
-
| `questions.whileAsking(ctx)` | as each such question opens; its undo once it is answered or declined | lets the side panel's key through the dialog, so the person can peek at regen and the pulses while the question waits |
|
|
29
|
-
| `panel(session)` | once a session, as the first chat is built (cached by session, `sidePanelOf` in extension.ts) | makes the side panel: regen, the pulses, and finished pulses with the sentinel's notices - drawn from `shownJobs`, `plannedLoop`, `sessionLaunchesOf`, `spec-map.ts`, `job-panel.ts` and `diff-where.ts` |
|
|
30
|
-
| `panel(...).open(ctx, page, placement)` | `/pulses` (`"pulses"`, in a chat with a screen), `/notifications` (`"notifications"`, `"beside"` - registered in a terminal session only), and the chat header's toggle, `link.live.plainPanel.toggle` (`"map"`, `"beside"`, with the chat's last context) | opens the panel over the screen, or beside the chat |
|
|
31
|
-
| `panel(...).visible()` / `.close()` | `link.live.plainPanel.open()` and its toggle | says whether the panel is on the screen, and closes it |
|
|
32
|
-
| `pulseFinished(job)` | for every pulse that ends and is not replaced by another, just before the session tells its chats (`TurriCore.jobFinished`) | remembers a pulse that failed, was stopped or did not pass (`didNotPass`), so the side panel opens on it at the next `ctrl+h` |
|
|
33
|
-
| `captureProgress(ctx)` | as `/capture` starts a capture in a chat with a screen; `update(status)` with each status the capture reports, `close()` as it ends, however it ends | draws the capture's status above the input - its phase, each agent at work and what it did last - from `CaptureStatus`, `COMPACT_PHASES`, `captureStageText` and the spinner |
|
|
34
|
-
| `skillProgress(ctx, progress)` | a foreground skill starts, enters a step or retries it; `null` when it ends | draws or clears the chat's skill widget, choosing its own width, colours and spinner |
|
|
35
|
-
| `openPiSettings()` | when the person picks pi's own settings, the last entry of `/settings`; false or absent, the core says they open only in the terminal's chat | opens pi's own settings menu, patched into `InteractiveMode` |
|
|
36
|
-
|
|
37
|
-
The hook's parameters:
|
|
38
|
-
|
|
39
|
-
- **`ViewChat`** - `session` (the `TurriCore`), `link` (the chat's `ChatLink`) and `context()`, the context the chat's tools and handlers were last given - undefined until its session starts.
|
|
40
|
-
- **`QuestionView`** - `dialogs` and `whileAsking`, above. With a screen and no view's dialogs, a question is put in pi's own `ctx.ui.select` and `ctx.ui.input` (`uiDialogs` in extension.ts), what to read above it; with no screen and no host dialogs, the asker is told no one is there to answer (`NO_USER_ANSWER`).
|
|
41
|
-
- **`Declining`** - `declined`, and `close`, set by the dialog shown.
|
|
42
|
-
- **`SidePanelView`** - `open(ctx, page?, placement?)`, `visible()`, `close()`; **`PanelPage`** is `"map"`, `"pulses"` or `"notifications"`.
|
|
43
|
-
- **`CaptureProgressView`** - `update(status)` and `close()`, which may be called more than once.
|
|
44
|
-
|
|
45
|
-
## The entries
|
|
46
|
-
|
|
47
|
-
What the core keeps in a chat besides its messages - the entries it appends and the custom messages it sends that a front-end draws - is a contract with two readers: the CLI's renderers and turri-app, which draws them from their data itself. Their types and data are in `src/chat-entries.ts`, except where a module of their own owns them. Renaming a type or a field here renames it for both.
|
|
39
|
+
**Options.** `frontend` (below); `client` - the front end's `name` and `version`, its `commit` and `changed` when it runs from a clone, and `mode`, its own word for how it runs turri this time (`chat` in a terminal, `regenerate` for a command run unattended, `host` in a desktop app), which the ledger's `run.started` records - the core cannot tell a terminal from an app; without one it is `frontend`, or `unattended` with no front end; `overrides` - `harnessModel`, `codingModel`, `judgeModel` (`provider/model-id[:thinking]`), `review`, `mutationTesting`, `debug` - read in the project as config.turri.yaml's keys, a `models:` entry still winning over them, cleared as the session closes, and a key set with `/settings` dropping the session's value for it; `persist` - keep the open chats in `.turri/chats.json` for `chats.restore("last")`, on by default with a front end; `agentDir`, `sessionDir` - pi's folder and where managed chats are saved; `captured` - opened in the project a capture wrote, its report told in the first chat; `onEvent`.
|
|
48
40
|
|
|
49
|
-
|
|
50
|
-
| --- | --- | --- | --- |
|
|
51
|
-
| `turri_banner` | `BANNER_ENTRY` | once a chat, at its first `session_start` | `BannerData`: the version, the clone's commit, skills that failed to load, the sandbox, newer versions, what turri says of the config files (`config`, which turri-app shows) |
|
|
52
|
-
| `turri_version` | `VERSION_ENTRY` | when a newer turri is found once turri has started | `{ text }` |
|
|
53
|
-
| `turri_command_outcome` | `COMMAND_OUTCOME` | an entry: what a slash command showed the person - first the command as typed (`echoCommand`, then one 20 ms frame), then its outcome; a message (`display: false`): what the conversation is told of it | `CommandOutcome`: `command`, `text`, `level`, `echoed` |
|
|
54
|
-
| `turri_btw` | `SIDE_ENTRY` | a side question (`/btw`) answered | `{ question, answer }` |
|
|
55
|
-
| `turri_skill_message` | `SKILL_MESSAGE_ENTRY` | a message the person sent while a skill ran, read by the skill's agent | `{ text, skill }` |
|
|
56
|
-
| `turri_exchange` | `INTERVIEW_ENTRY` | each question of a skill's interview, answered | `Exchange`: `skill`, `said`, `question`, `answer` |
|
|
57
|
-
| `turri_job` | `JOB_ENTRY` | a pulse's end, announced in a chat | `JobAnnouncement` |
|
|
58
|
-
| `turri_history` | `HISTORY_ENTRY` | `/lineage` | `{ module, text }` |
|
|
59
|
-
| `turri_milestone`, `turri_jobs` | `MILESTONE_ENTRY`, `JOBS_LIST_ENTRY` | by nothing now - chats saved earlier have them, and they are still drawn | |
|
|
60
|
-
| `turri_notice` | `NOTICE_ENTRY` (`sentinel-chat.ts`) | a sentinel's notice, in a session that is not the terminal's | `Notice` |
|
|
61
|
-
| `turri_notice_over` | `NOTICE_OVER_ENTRY` (`sentinel-chat.ts`) | a notice answered or over, likewise | `{ state, summary }` |
|
|
62
|
-
| `turri_sentinel_concluded` | `CONCLUDED_ENTRY` (`sentinel-chat.ts`) | an entry when the sentinel concludes a pulse, likewise; and in every session, a message (`display: false`) the chat's agent is told by | `Conclusion` |
|
|
63
|
-
| `turri_skill_run` | `SKILL_RUN_ENTRY` (`background-skills.ts`) | an entry for each background skill that did its work; a message (`display: false`) for those that did not | `{ text }`; the message's `details`: `{ skills, runs }` |
|
|
64
|
-
| `turri_skill_report` | `SKILL_REPORT_ENTRY` (`background-skills.ts`) | a message (`display: false`): what a background run that did its work has for the chat's agent - a capture's report | `details`: `{ skills }` |
|
|
41
|
+
**`chats`.** `list()`, `get(id)`, `focused()`, `focus(id)` - the chat the person looks at, where a pulse a closed chat asked for is told; `open({ sessionFile?, title?, focus? })` - a fresh chat or a saved one, focused unless `focus: false`, at most nine (`chat-limit`), and none without a front end (`no-chat`); `adopt(session)` - a pi session the front end made with `turri.extension` in it, as a chat; `restore(run?)` - a run's chats, the last one by default, except those open already; `close(id)`; `onHarnessModel()`. A `Chat` has `id`, `info()`, `session` (pi's `AgentSession`: prompt it, subscribe to it, set its model), `entries()`, `stop()` - its turn, a command, a compaction or a retry stopped, `idle` when it did nothing, never the session ended - `decline()`, every question it asks declined - and `outOfReach()`. A handle to a closed chat throws `chat-closed`.
|
|
65
42
|
|
|
66
|
-
`
|
|
43
|
+
**A person's chat runs on `harness-model`**, read from the config each time: put on it as it starts - fresh or reopened - and again when `harness-model` changes, whoever changes it; a model the person chooses in a chat holds until then. While `harness-model` cannot be reached - no such model here (`why: "unknown"`), or its provider not signed in (`"signed-out"`) - the chat sends nothing to a model: its commands run, and anything else sent to it is refused and said, never sent to pi's own choice of model instead - the first provider with credentials, billed unseen. `chat.outOfReach()` says what and why, an `outOfReach` event says it as it changes, and `chats.onHarnessModel()` - after the person signs in, or changes `harness-model` outside turri - puts every chat that can be on it. The sentinel's chat runs on `models.sentinel`, and none of this is its.
|
|
67
44
|
|
|
68
|
-
|
|
45
|
+
**`work`.** `status()` - each codebase, this session's pulses, those planned, and `busy`; `jobs()`, `job(id)`; `standing(files?)`; `map({ refresh? })` - the spec map, its items marked, read at most every second - and, for a front end that shows it (`shows.map`), sent as a `map` event as it changes; `history({ runs? })` - earlier sessions' pulses; `lookAhead(plainFile)` - planned as regenerate would, the plan held, the next pulses' prompts, nothing started; `regenerate(request)` and `conform(request)` - `plainFile` (else config's `module`), `funcIds`, `fromScratch`, `separately`, `model`, `chat` (told when it ends), `startOver` - the answer when a codebase must be started over: `true`; `false`, the rest of the chain regenerated without it; `"ask"`, the person asked through the front end; or a function asked for this run alone, `({ title, body, codebases })` to `true`, `false` or undefined; absent or unanswered, the run ends incomplete at once, saying why, `report` (a run report file), `exportTo` (the code exported as it ends), `signal` - each resolving to `{ planned, done }`, `done` the verdict once nothing more can start: `completed`, `failed`, `incomplete` or `stopped`, with every job, those that failed and the codebases unfinished; `halt({ pulse } | { launched })`. These call what the chat's own regenerate and conform tools call (`src/work.ts`), so the two never differ. A session's work loop needs no chat: without one, the coding model builds and the harness model plans, as the config names them.
|
|
69
46
|
|
|
70
|
-
|
|
47
|
+
**`launches`.** `list()`, `running()`, `launch(plainFile?, { chat?, guidance?, inModule?, again?, onOutput?, signal? })` - resolving when it ends, or when the newer launch that took its place as it waited ends; `onOutput` hears the launch agent's words as they stream, its own and its replacement's; `signal` stops it and what it started - and `followLogs(onLine, { signal })`. **`notices`.** `list()`, `answer(id, answer)`. **`sentinel`.** `check(request)`. **`settings`.** By their keys as config.turri.yaml writes them (`SettingKey`), each value its type (`SettingValues`: `review` a boolean, `max-specs-per-pulse` a number, `agent-env.files` a list, `models.coding` a `provider/model-id[:thinking]`). `get(key, { module? })` - undefined when unset, `config-invalid` when the file has a value its kind cannot take - `set(key, value, { module? })` - undefined unsets it; checked as `/settings` checks what is typed (`refused`, with why), written through the same path as `/settings`, and what turri fixed at its start changed now: a model the session was opened with gives way to the file's, how many pulses run at once - `choices(key, typed?)` and `turnOnConformanceTests(plainFile?)`, the person's decision, written where the module's value comes from. **`skills`.** `list()` - each skill with its `steps`, each with the review `gate` after it (`rubric`, `judges`, `quorum`, `onFail`, `maxRetries`, `continuous?`) - and `run(skill, { plainFile?, context?, model?, signal?, onReport? })` - `skill` one by name, turri's own or the project's, or `{ dir }`, the skill in a folder with a SKILL.md (`not-found` for neither, `refused` for one that does not parse) - its questions and review gates put through the front end, its progress as `skillProgress` events, and what it says as it goes to `onReport` (`SkillReport`: `start` with its steps and gates, each `step` tried, the `artifact` it left, the reviewer reading along (`livePass`, `liveReview`), the `gate` and how many judges, each `judge`'s verdict, and the gate's `outcome` - `advance`, `retry`, `escalate`, `abort` - with its critique) - resolving to whether it got through its gates (`ok`), each step's artifact, the last one's, and `runDir`, the run's folder, where they are and what an interrupted run resumes from. `spending()` and `dispose()`.
|
|
71
48
|
|
|
72
|
-
|
|
49
|
+
## The front end
|
|
73
50
|
|
|
74
|
-
|
|
75
|
-
| --- | --- |
|
|
76
|
-
| `orphansStopped(count)` | before anything starts, when a turri that was killed left process groups running and they were stopped |
|
|
77
|
-
| `warn(message)` | what the ledger could not write |
|
|
78
|
-
| `exported(exported, buildDir)` | as the process exits: the code exported into `--build-dir`, or why nothing was |
|
|
79
|
-
| `pulseRunning(job)` | a pulse starting, and again at each new stage |
|
|
80
|
-
| `pulseFinished(job)` | a pulse ended, however it ended, before the run report is written again |
|
|
81
|
-
| `turnIncident(event, line)` | a provider failing and waited out, a turn turri ended itself |
|
|
82
|
-
| `planned(statuses)` | what the request planned in each codebase, and again after a start over |
|
|
83
|
-
| `canAsk()`, `ask(title, body)` | whether there is someone to ask, and whether to start over a codebase that has to be on a module it now requires |
|
|
84
|
-
| `startOverRefused(message)` | the run stops at such a codebase, with no one to ask and no `startOver` |
|
|
85
|
-
| `nextPulse(pulse)` | a dry run: each codebase's next pulse, from the plan the look ahead kept |
|
|
86
|
-
| `drained(statuses)` | nothing more can start: how each codebase stands |
|
|
87
|
-
| `ended(end)` | how the run ended: every job, those that failed, the codebases not complete |
|
|
51
|
+
Every member is optional; a front end says only what it does differently.
|
|
88
52
|
|
|
89
|
-
|
|
53
|
+
| member | what it does |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `surface` | where the person watches turri's work, in the front end's own words: told the model, which otherwise names no key, panel or view. The terminal says regen and ctrl+h here; a desktop app its views |
|
|
56
|
+
| `extensions` | the front end's own pi extensions, built into every chat after turri's: its renderers, tools, commands and keys |
|
|
57
|
+
| `ask(question, { chat?, signal })` | a question - ask_user's, a skill's interview, a review gate's, a start over's: `{ kind: "select", title, options, context?, at? }` or `{ kind: "input", title, context? }` - resolving to the answer, undefined for none; `chat` the chat that asks, none for a question outside any chat (`skills.run`, `work`'s start over with no chat named); `signal` is aborted when the question is over without it, declined or its turn stopped. Without it, a chat with a screen asks in pi's own dialogs |
|
|
58
|
+
| `sessions` | where the chats' pi sessions are made: `{ kind: "managed", ui? }` - turri makes and disposes them, `ui(chat)` the pi UI context a chat's extensions call - or `{ kind: "external", create, show?, release? }` - the front end makes them on its own pi runtime with `turri.extension` built in before `create` resolves (else `extension-not-built`), shows a chat when turri asks, and lets them go itself - or `{ kind: "none" }`: the front end has no chats - a command at a terminal that answers questions and prints the events - so no chat opens (`no-chat`), the sentinel neither. Default: managed |
|
|
59
|
+
| `reveal(target, { chat })` | the person asked to see something the front end shows - `/pulses`: true when it shows it, else the chat lists it |
|
|
60
|
+
| `openProject(dir, { summary, reportFile })` | a capture wrote a project of its own: open it, as the front end opens projects, and tell its report there (a session opened with `captured`); false leaves the report to the chat |
|
|
61
|
+
| `openPiSettings()` | pi's own settings, the last entry of `/settings` |
|
|
62
|
+
| `systemPrompt(prompt, { chat })` | the last word on a chat's whole system prompt |
|
|
63
|
+
| `shows: { pulseEnds?, notices?, map? }` | what the front end shows the person itself, from the events: pulse ends and the sentinel's conclusions - the chat's agent is told them with no turn of its own - notices, which a chat then never puts as a question, and the spec map, which the session then watches - its files each second, its marks as the work moves - sending `map` as it changes. It changes what turri does, never what it records: a pulse's end, a notice and a conclusion are appended to the chat's transcript whatever `shows` says (`turri_job`, `turri_notice`, `turri_sentinel_concluded`), and a front end that shows them elsewhere - an inbox - draws those entries in the transcript as well, or not at all |
|
|
64
|
+
| `sentinel: { tools?, surface? }` | the sentinel's own tools beside turri's - a front end's browser - and where the person watches it use them |
|
|
90
65
|
|
|
91
|
-
|
|
66
|
+
**pi's print mode** makes its one session itself, with `turri.extension` built in, and hands it to no extension: the front end that runs it adopts it (`chats.adopt`) - pi's `AgentSession.prototype.bindExtensions` is where print mode binds it - in a session with no front end, so the chat has its title, its entries and its cost in `spending()`.
|
|
92
67
|
|
|
93
|
-
|
|
68
|
+
**No front end** is unattended: no chats, the sentinel never opens, nobody is asked - a start over is what `startOver` says, a function of the caller's asking whoever it likes, and otherwise refused with why, never waited on.
|
|
94
69
|
|
|
95
|
-
|
|
96
|
-
- **The pulses and the panel**: `shownJobs`, `plannedLoop` and `sessionLaunchesOf` (extension.ts); `PANEL_KEY`, `spinner`, `didNotPass`, `finishedMark`, `pulseCost` and `summarizeDiff` (`regenerate/job-panel.ts`); `Rung`, `rungOf`, `focusOf` and `lineDiff` with regen's marks (`regenerate/spec-map.ts`); `DiffWhere`, `locateDiffLines` and `DIFF_HEADER` (`regenerate/diff-where.ts`); `TerminalNotifications`, the terminal session's inbox (`notifications.ts`); `QueueOf` and `unqueue` (`chat-queue.ts`).
|
|
97
|
-
- **Capture and skill progress**: `CaptureStatus`, `CAPTURE_PHASES`, `COMPACT_PHASES` and `captureStageText` (`capture/progress.ts`); `SkillProgress` from the session. Text layout belongs to the CLI.
|
|
98
|
-
- **The commands**: `followLaunchedLogs(onLine)` (`regenerate/launch.ts`), what `turri launch` prints of what runs as it logs; `doctor`, `allChecks`, `verdictOf`, `MARK` and each check (`setup.ts`), which `turri doctor` prints; `initConfig` and its presets (`init-config.ts`), which `turri init-config` asks for, its colours an injected `Paint` (`PLAIN_PAINT`, no escape codes, by default); `runSkill` (`genome.ts`), for `turri cultivate`; the capture itself (`src/capture/`), for `turri capture`.
|
|
99
|
-
- **This turri**: `setTurriRoot(root)` and `turriRoot()` from `@turri-dev/core/commands`. Set the CLI's package root at startup, before the banner, `--version`, doctor or a headless run. The version and commit, ledger identity, PATH checks and themes then refer to the CLI. Without a CLI root they refer to the core. `PACKAGE_ROOT` always locates the core's own genome, standard library, rules and capture prompts.
|
|
70
|
+
Whatever the front end, the same rules hold: turri appends its entries to a chat's transcript (a transcript is a record; whether to draw one is the front end's choice), a chat is marked unread when something happens in it out of sight, its `"question"` status is turri's own pending asks, and what turri says outside any transcript is said in the chat shown and sent once - as a `notification`, or as the event of its own that tells it (`incident`, `orphansStopped`).
|
|
100
71
|
|
|
101
|
-
##
|
|
72
|
+
## Events
|
|
102
73
|
|
|
103
|
-
|
|
104
|
-
- **pi in the terminal**: `pi-launch.ts`, which builds the extension into pi with the view; `pi-settings.ts`, `pi-themes.ts` and `.pi/`'s themes. The themes are found in the CLI's own package: where `cli.ts` and `pi-themes.ts` read `join(PACKAGE_ROOT, ".pi", "themes")` before the split, they read the CLI's root - `turriRoot()` once set - since the core's `PACKAGE_ROOT` has no `.pi/`.
|
|
105
|
-
- **The terminal's chats**: `chat-terminal.ts`, `chat-commands.ts`, `chat-tabs.ts`, `chat-tab-header.ts`, `chat-waiting.ts`.
|
|
106
|
-
- **What a screen draws**: the renderers, `question-dialog.ts`, `screen-padding.ts`, `pointer-hover.ts`, `terminal-images.ts`, `picture-row.ts`, `jellyfish.ts`, `plain-code-blocks.ts`, `terminal-notifications.ts`'s drawing, and the side panel - `regenerate/side-panel.ts`, `jobs-tree.ts`, `spec-map-view.ts`, `panel-dock.ts`, `plain-palette.ts`, `transcript-view.ts`, `diff-view.ts`.
|
|
107
|
-
- **What is shipped beside them**: `assets/`, `docker/` and `examples/`.
|
|
74
|
+
`turri.on(type, listener, { signal? })` hears one type, `turri.on(listener)` every one; both return what stops hearing. `turri.events({ signal? })` is the same stream as an async iterable, ended as the session is let go. Events are plain data, safe to `structuredClone` and send to another process - snapshots, never live objects or pi sessions. Dispatch is synchronous, in the order things happen; a listener that throws reaches `process.emitWarning` (`TURRI_LISTENER`), never turri or another listener.
|
|
108
75
|
|
|
109
|
-
|
|
76
|
+
| type | when | carries |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `chats` | a chat opened, closed, renamed, started or stopped working or asking | `chats` |
|
|
79
|
+
| `chatSession` | a chat's pi session replaced under the same id - the sentinel's fresh conversation | `chat` - read `chats.get(chat).session` |
|
|
80
|
+
| `entry` | turri appended an entry or sent a message to a chat | `chat`, `entry` |
|
|
81
|
+
| `notification` | turri said something to the person outside any transcript - but what an event of its own tells (`incident`, `orphansStopped`), which is said in the chat shown and not sent again | `chat?`, `text`, `level` |
|
|
82
|
+
| `job` | a pulse started, moved on, or ended | `job`, `final` - ended and not run again as another |
|
|
83
|
+
| `plan` | what is planned changed, no pulse changing | |
|
|
84
|
+
| `launch` | a launch asked for, started or ended | `launch` |
|
|
85
|
+
| `launchOutput` | a launch's agent said more, as it streams - each `text` follows the one before | `launch` (its id), `codebase`, `text` |
|
|
86
|
+
| `map` | the spec map changed, while the front end shows it (`shows.map`) | `pages` |
|
|
87
|
+
| `notice`, `noticeOver` | put to the person; answered, dismissed or superseded - `job` or `check` filled in when the sentinel was checking one | `notice` |
|
|
88
|
+
| `concluded` | the sentinel done with a pulse or a check | `chat`, `conclusion` - with `tryIt`, how the person tries what was tested as its launch said it (where it runs, or the commands to run a CLI or library from `dist/<module>`), for a front end to show with it |
|
|
89
|
+
| `skillProgress` | a foreground skill's place in its phases; null as it ends | `chat?`, `progress` |
|
|
90
|
+
| `captureProgress`, `captureEnded` | a capture's status; its end | `chat?`, `status` / `root`, `state`, `result` or `error` |
|
|
91
|
+
| `incident` | a provider failing and waited out, a turn turri ended itself | `text`, `event` |
|
|
92
|
+
| `spending` | what the session spent changed | `spending` |
|
|
93
|
+
| `outOfReach` | a person's chat cannot be on `harness-model` now - and sends nothing to a model - or, `null`, it can again | `chat`, `outOfReach`: `model`, `provider`, `why` |
|
|
94
|
+
| `failure` | turri's own healer, a provider, the history or the planner failed | `what`, `text` |
|
|
95
|
+
| `renamed` | a func-id or scenario-id renamed in a module's records | `what`, `from`, `to`, `spec` |
|
|
96
|
+
| `orphansStopped` | a killed turri's process groups stopped as the session opened (hear it with `onEvent`) | `count` |
|
|
97
|
+
|
|
98
|
+
## The transcript's entries
|
|
99
|
+
|
|
100
|
+
What the core keeps in a chat besides its messages - the entries it appends and the custom messages it sends - is typed in `src/chat-entries.ts` and exported: `ChatEntryMap` (each entry's `data` by its `customType`), `ChatMessageMap` (each message's `details`), a constant for each type, and `ChatEntry`, their union. `isChatEntry(record)` tells turri's records in a pi transcript, safe as an array filter: its type is turri's and what it carries is that type's, field by field - a field it does not know is let through, one missing or of another type is not; `isChatEntryOf(record, customType)` narrows to one. A field a later turri added is optional, as a chat saved earlier lacks it.
|
|
110
101
|
|
|
111
|
-
|
|
102
|
+
| type | constant | appended or sent | data |
|
|
103
|
+
| --- | --- | --- | --- |
|
|
104
|
+
| `turri_banner` | `BANNER_ENTRY` | once a chat, at its first `session_start` | `BannerData`: who runs turri (`name`, `version`, the clone's `commit`), skills that failed to load, the sandbox, what turri says of the config files |
|
|
105
|
+
| `turri_command_outcome` | `COMMAND_OUTCOME` | an entry: what a slash command showed the person; a message (`display: false`): what the conversation is told of it | `CommandOutcome` |
|
|
106
|
+
| `turri_btw` | `SIDE_ENTRY` | a side question (`/btw`) answered | `{ question, answer }` |
|
|
107
|
+
| `turri_skill_message` | `SKILL_MESSAGE_ENTRY` | a message the person sent while a skill ran | `{ text, skill }` |
|
|
108
|
+
| `turri_exchange` | `INTERVIEW_ENTRY` | each question of a skill's interview, answered | `Exchange` |
|
|
109
|
+
| `turri_job` | `JOB_ENTRY` | a pulse's end, in the chat told of it; and a message its agent is told by | `JobAnnouncement`; `JobRef` |
|
|
110
|
+
| `turri_history` | `HISTORY_ENTRY` | `/lineage` | `{ module, text }` |
|
|
111
|
+
| `turri_notice`, `turri_notice_over` | `NOTICE_ENTRY`, `NOTICE_OVER_ENTRY` | a notice put in the chat; one over | `Notice`; `{ state, summary }` |
|
|
112
|
+
| `turri_sentinel_concluded` | `CONCLUDED_ENTRY` | the sentinel concluded a pulse or check: an entry, and a message the chat's agent is told by | `Conclusion` |
|
|
113
|
+
| `turri_skill_run`, `turri_skill_report` | `SKILL_RUN_ENTRY`, `SKILL_REPORT_ENTRY` | a background skill's end: an entry for one that did its work, a message for one that did not; what one that did has for the agent - a capture's report | `{ text }`; `{ skills, runs }` / `{ skills }` |
|
|
114
|
+
| `turri_version`, `turri_milestone`, `turri_jobs` | `VERSION_ENTRY`, `MILESTONE_ENTRY`, `JOBS_LIST_ENTRY` | by an earlier turri only - chats it saved have them | |
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
The messages a chat's agent is sent, unseen: `SPEC_CONFLICT_MESSAGE`, `SENTINEL_PULSE_MESSAGE`, `SENTINEL_CHECK_MESSAGE`, `SENTINEL_RESUME_MESSAGE`, `JOB_LANDED_MESSAGE`, `NOTICE_ANSWER_MESSAGE`, `LAUNCH_MESSAGE`.
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
| --- | --- |
|
|
117
|
-
| `.` | `createTurri`, its session and event types, chat entries, notices, jobs and launches |
|
|
118
|
-
| `/host` | desktop operations: `doctor`, installed providers, credentials location, sign-in device id and saved chat files |
|
|
119
|
-
| `/plain` | parse, check, highlight, follow links and read the project's standing on disk |
|
|
120
|
-
| `/config` | read and initialise project settings and model choices |
|
|
121
|
-
| `/ledger` | subscribe to facts, read runs and inspect pulses |
|
|
122
|
-
| `/terminal` | the default pi extension, `createTurriCore`, `TurriView`, chat driver, panel data and renderer constants |
|
|
123
|
-
| `/commands` | `runHeadless`, `readDrift`, `launchModule`, capture, cultivate and CLI setup |
|
|
124
|
-
| `/startup` | check Node, set the CLI's identity, resolve its themes and read launch settings before loading pi. Import `/terminal` after the CLI's own terminal setup. |
|
|
118
|
+
A pulse's `Job.details` is `JobDetails`: `passed`, `landed`, `skipped`, `stoppedAt` (where its gate stopped one that did not pass), `notBuilt`, `story`, `specGaps`, `commit` - kept on a job that failed for good too.
|
|
125
119
|
|
|
126
|
-
|
|
120
|
+
## Errors
|
|
127
121
|
|
|
128
|
-
|
|
122
|
+
A call that cannot be made as asked throws a `TurriError` with a `code`: `config-invalid`, `refused`, `chat-limit`, `no-chat`, `chat-closed`, `not-found`, `extension-not-built`, `session-open`, `aborted`; its `cause` is what it came from. An outcome that is expected - a notice already over, a check refused, a chat idle when stopped - is returned, never thrown. Tell one with `isTurriError(error, code?)`, not `instanceof`: a front end and a package it depends on may each have their own copy of the core.
|
|
129
123
|
|
|
130
|
-
##
|
|
124
|
+
## The boundary
|
|
131
125
|
|
|
132
|
-
|
|
126
|
+
What only a screen needs is the front end's. `tests/boundary.test.ts` reads every file under `src/` by its syntax - a comment or a string that names one is not a crossing - and fails on any of these, naming the file and line:
|
|
133
127
|
|
|
134
|
-
|
|
128
|
+
- **pi-tui**, anywhere in the core - type imports, re-exports, a dynamic `import()` or `require` included. A front end measures text and draws; the core reports progress as data.
|
|
129
|
+
- **pi's terminal**, from `@earendil-works/pi-coding-agent`: its interactive mode and runtime, CLI, components, editor, borders, key hints and themes - imported or re-exported by name, as a type, a namespace member, destructured or dynamically. Re-exporting all of pi crosses it too: a front end imports its pi peer itself.
|
|
130
|
+
- **What only a screen does**: `registerEntryRenderer`, `registerMessageRenderer`, `registerShortcut`, `setFooter`, `setHeader`, `setEditorComponent`, `onTerminalInput` and a ui's `custom`, however they are read. One core file passes one on, doing nothing of its own with it, and is let by there alone: `chats.ts` hands pi's `registerShortcut` a handler run in the chat's scope (`scopedToChat`) - a front end's extension registering a key in a chat.
|
|
135
131
|
|
|
136
|
-
The
|
|
132
|
+
The core may call `ctx.ui`'s abstract methods - `notify`, `select`, `input`, `confirm`, `setStatus`, `setWorkingMessage` - which any front end answers. A seam a front end needs is a member of `Frontend`, an event or a method of the session - never a copy of the core's state or logic in the front end.
|
|
137
133
|
|
|
138
|
-
|
|
139
|
-
| --- | --- |
|
|
140
|
-
| `createWorkLoop`, `createJobRegistry` | The session owns both. The Plan button calls `lookAhead` on the open session; `status`, `jobs` and `job` read what that session holds. A separate spec worker uses `/plain`'s `projectStanding` without opening a session. |
|
|
141
|
-
| `functionalityCompletion` | Read `completion` on the matching `ModuleStanding` from `standing([file])` or `projectStanding(dir, [file])`. A parse failure is `completionError` on that module. |
|
|
142
|
-
| `describeTurnIncident`, `onModelEvent` | Subscribe at session creation to `incident` and `agentCost`. Job usage is already on the job. |
|
|
143
|
-
| `sweepOrphanedGroups` | Session startup does the sweep and reports `orphansStopped`. |
|
|
144
|
-
| `pi` | `openChat` supplies the pi session. `/host` provides saved chats, credentials location, device id and the installed model runtime. A consumer implementing a pi extension or the pi terminal imports the shared peer directly. |
|
|
134
|
+
## Importing the core
|
|
145
135
|
|
|
146
|
-
|
|
136
|
+
Node's package export map is the import boundary, for an installed package and a linked clone alike. The JavaScript and declarations are ESM; `moduleResolution` `node16`, `nodenext` or `bundler` reads them. The core finds its genome, standard library and prompts beside its own files (`import.meta.url`): a bundler keeps the package external rather than bundling it. Importing an entry changes nothing of the process: turri sets its exit and signal handlers - which stop the process groups it started - only once it starts one, so `sideEffects` is `false`. pi, which every entry but `/plain` loads, sets its own as it is imported.
|
|
147
137
|
|
|
148
|
-
|
|
138
|
+
**pi is a peer.** The core and its front end share `@earendil-works/pi-coding-agent` at the exact version in `package.json`: a chat's `AgentSession` is pi's, a front end's extension is built into pi's sessions, and a prototype patched in one must be the one the other runs. pi's types are in the core's, so a pi upgrade is a breaking release of the core. When developing with `npm link`ed checkouts, make both resolve pi to the same installation.
|
|
149
139
|
|
|
150
|
-
|
|
140
|
+
**A clone runs its sources.** Each entry has a `turri-source` condition pointing at `src/`: a front end started with `NODE_OPTIONS=--conditions=turri-source` runs a linked core clone unbuilt; without it, Node loads `dist/`.
|
|
151
141
|
|
|
152
|
-
|
|
142
|
+
## Versioning
|
|
153
143
|
|
|
154
|
-
|
|
155
|
-
| --- | --- |
|
|
156
|
-
| CLI `bin/turri.mjs`, `src/cli.ts`, `src/pi-launch.ts`, `src/pi-themes.ts` | The launcher and the pi chat are separate processes: set the CLI package root in **both**. The banner art and themes are CLI assets; the genome and standard library are core assets. CLI argument parsing, including `chatModels`, stays with the CLI. Its pi package manager commands invoke the shared pi peer. |
|
|
157
|
-
| CLI terminal and unattended commands | Keep the CLI driver, shortcuts, renderers, dialogs, notifications view and side panel; wire the rendering formerly inside the monolithic extension to `TurriView`. Register the view on the process session, including the old global-extension path. The CLI owns console output, signals and exit codes; use `/commands` for the operation itself. |
|
|
158
|
-
| Desktop `engine/engine.mjs`, `chat.mjs`, `describe.mjs`, `describe-worker.mjs` | Adapt both the worker and its main-thread fallback. `projectStanding(dir, files)` takes the file array directly. Use the session's held preview for Plan (no build); do not create a second loop. The current renderer sends named specs or from-scratch options for Regenerate; its unused engine argument for free-form grouping guidance is no longer accepted by turri. |
|
|
159
|
-
| Desktop chat, providers and history | `openChat()` returns a chat with a pi `session` for ordinary messages, models, queued input and extension commands. `entries(id)` supplies turri records only; the window also owns custom button and checkpoint entries. Look up a chat model with `chat.session.modelRuntime.getModel(provider, id)`; before a chat opens use `installedModelRuntime()` from `/host`. The app owns its provider filters, dialogs, browser/PTY tools and per-window presentation. |
|
|
160
|
-
| Desktop project editor | The graph and parser must agree on scenario locations, including a module-specific or inherited `test-dir`. `isStack({ name })` accepts the import name, as the desktop catalogue uses it. A host's banner still carries project config findings but does not compare its core version with CLI releases or look for the CLI on PATH. |
|
|
161
|
-
| Desktop window reopened in the same engine | `session.launches()` gives the launch history and `session.spending()` the dollars spent since the project opened. Neither requires a window to have followed events from startup. Closed chats, earlier sentinel conversations and replaced jobs still count; costs already in a restored chat are excluded. |
|
|
162
|
-
| Desktop settings and notifications | `/config`'s `configuredModel(config, key)` reads the choice written on a model setting, before inheritance, and `configLines(projectDir)` gives current findings without searching past banners. Its `file` identifies the config; the desktop's existing IPC returns just `kind` and `text`. A version such as Bedrock's `:0` round-trips through `/settings`, with or without an extra thinking level. |
|
|
163
|
-
| Desktop development, distribution and About | Account for `engine/turri.mjs` and the worker, `scripts/dev.mjs`, Electron's engine child environment (`electron/main.ts` strips `NODE_OPTIONS`), the version/pin checks and About label, the lockfile, release-note links and Dependabot. The packaged app needs the runtime peer; its third-party notice collector follows dependencies and optional dependencies, not peers. Preserve old release links when reading historical tags. |
|
|
164
|
-
|
|
165
|
-
The first rehearsal typechecked the retained CLI modules and extracted view code against the packaged declarations, exercised command dispatch, parsing and drift, and rendered the banner and `/pulses` panel in a pseudo-terminal. The desktop engine ran over IPC with its real spec worker and a local model stub: project open, scenario links, settings, provider listing, multiple chats, messages, history and a held preview with zero jobs started.
|
|
166
|
-
|
|
167
|
-
A second rehearsal ran 82 CLI tests across eight files against the packed core: the terminal chat driver and tab header, interrupts, queued messages, settings, notifications, jobs tree, panel docking and diff rendering. Seven desktop Playwright tests ran in Electron against an adapted engine and its worker: spending after closing a chat, project opening, scenario discovery, a signed-out provider, a versioned Bedrock model in the settings sheet, and projects with and without config findings. The core suite separately exercises sentinel rotation and reading launch history with no launch subscriber; the packed contract reopens a real saved pi conversation. The consumer migrations, their complete suites, the packaged Electron installer and a live provider sign-in are still to be checked in the consumer repositories.
|
|
144
|
+
The surface is 0.x until the front ends that build on it - the CLI, then turri desktop - run on it: each migration may change it. `api/<entry>.api.md` is each entry's declaration report; `npm run api:check` fails on any change to it, `npm run api:report` writes the change for review, and `CHANGELOG.md` says what changed and why. A breaking change bumps the minor version while 0.x.
|
package/docs/development.md
CHANGED
|
@@ -44,19 +44,19 @@ The workflow signs in to npm with npm's trusted publishing (OIDC), not a token:
|
|
|
44
44
|
|
|
45
45
|
| path | what it is |
|
|
46
46
|
|---|---|
|
|
47
|
-
| `src/
|
|
48
|
-
| `src/
|
|
49
|
-
| `src/
|
|
50
|
-
| `src/
|
|
51
|
-
| `src/
|
|
47
|
+
| `src/api/` | the five public entries - `session.ts` (`.`), `plain.ts`, `project.ts`, `models.ts`, `system.ts` - each a list of exports, reported in `api/` |
|
|
48
|
+
| `src/session.ts` | `createTurri`: the one session every front end opens - its `Frontend`, events and namespaces - over the core (`createTurriCore`) and its chats |
|
|
49
|
+
| `src/work.ts` | regenerate and conform work, as the chat's tools and a front end ask it: the loop's call (`planWork`), its checks (`askLoop`), and a run of it - start over, report, export, drain, verdict (`runWork`) |
|
|
50
|
+
| `src/errors.ts`, `src/client.ts`, `src/project.ts` | `TurriError` and its codes; who runs turri (`ClientInfo`); what can be asked of a project with no session (drift, a launch of its own) |
|
|
51
|
+
| `src/extension.ts` | the [pi](https://pi.dev) extension: every conversation tool and command, and `createTurriCore`, the core the session is built on |
|
|
52
|
+
| `src/chat-entries.ts` | what the core appends to a chat and the messages it sends: their types and data, for every front end that draws them |
|
|
53
|
+
| `src/session-events.ts` | what the core says happened, internally, and foreground skill progress as data - the session turns it into its events |
|
|
52
54
|
| `tests/boundary.test.ts` | the core's boundary with the terminal: no pi-tui, none of pi's terminal, no renderer, key or screen of the core's own |
|
|
53
|
-
| `src/headless.ts` | `runHeadless`: an unattended run - `turri regenerate`, `conform` - driven as the chat drives the work loop, everything a person sees and is asked through its `HeadlessView`, printing nothing and never exiting |
|
|
54
55
|
| `src/setup.ts`, `src/doctor-tool.ts`, `src/environment.ts`, `src/stack.ts` | what `turri doctor` and the chat's `doctor` tool check - this machine, and in a project what its modules need of it; `turri doctor` prints them in turri's CLI |
|
|
55
56
|
| `src/init-config.ts` | a project's first `config.turri.yaml`, as `turri init-config` and a host write it |
|
|
56
57
|
| `src/chats.ts`, `src/chat-scope.ts`, `src/chat-records.ts` | the session's [chats](chats.md): which chat a pulse is told to, each chat's scope - its id and stack - and `.turri/chats.json` |
|
|
57
|
-
| `src/chat-
|
|
58
|
+
| `src/chat-queue.ts` | a message taken out of a session's queue (`unqueue`) |
|
|
58
59
|
| `src/sentinel.ts`, `src/sentinel-chat.ts` | [the sentinel](sentinel.md): its prompt, what it is told of a pulse, its fenced tools, its guidance; notices - what is appended of them, the dialog, their answers |
|
|
59
|
-
| `src/host.ts`, `src/host-session.ts` | the package's `./host`, and `createTurri`, the session for a host |
|
|
60
60
|
| `src/skill.ts` | parses `SKILL.md` into steps and gates |
|
|
61
61
|
| `src/graph.ts` | compiles a skill into a LangGraph `StateGraph`: step -> gate -> route |
|
|
62
62
|
| `src/judge.ts` | runs independent judges, applies the quorum, builds the critique |
|
|
@@ -64,6 +64,7 @@ The workflow signs in to npm with npm's trusted publishing (OIDC), not a token:
|
|
|
64
64
|
| `src/pi.ts` | [pi](https://pi.dev) session factories for executors, sub-agents and judges |
|
|
65
65
|
| `src/loop-tools.ts` | `regenerate`, `drift` and `halt` - one definition each, for the conversation and the skills alike |
|
|
66
66
|
| `src/plain/` | the [\*\*\*plain](https://plainlang.org/docs/) parser - see [parser](parser.md) - and `highlight.ts`, which highlights \*\*\*plain with turri's own grammar, `plain.tmLanguage.json` - started from [plyn](https://github.com/plainlang/plyn)'s at `f9c02b8`, and changed here since: test plain files' sections and keys, the `# <id>` heading |
|
|
67
|
+
| `src/module-check.ts` | a module checked in its project - `turri parse`, the chat's `parse` and the check before regenerating: the language's check (`src/plain/check.ts`), then its config files, the steps of adding tests it skipped, its base folder |
|
|
67
68
|
| `src/regenerate/conformance.ts` | conformance tests: writing them, and fixing the test or the code until they pass |
|
|
68
69
|
| `src/regenerate/regenerate.ts`, `src/regenerate/conform.ts` | a code job - a \*\*\*plain diff regenerated in the code - and a conformance job |
|
|
69
70
|
| `src/regenerate/loop.ts`, `src/regenerate/records.ts`, `src/regenerate/drift.ts`, `src/regenerate/jobs.ts` | the work loop, the records and the work derived from them, and background jobs |
|
|
@@ -80,7 +81,6 @@ The workflow signs in to npm with npm's trusted publishing (OIDC), not a token:
|
|
|
80
81
|
| `src/regenerate/failure-reports.ts` | why a pulse that failed or finished without landing did - what `pulses` says of it - kept in `.turri/pulses/<id>.md` whatever the debug setting, for a later session |
|
|
81
82
|
| `src/regenerate/ledger.ts`, `src/regenerate/ledger-view.ts` | the ledger: what turri did, as typed facts, in `.turri/ledger/` - `record()`, read back for `pulses` - see [the ledger](using.md#the-ledger) |
|
|
82
83
|
| `src/capture/` | [capture](capture.md): the map, areas folded to a budget, the agents and the checks of what they hand over, assembling the modules, the testing scripts, the report, resuming, its status while it runs - `turri capture` is turri's CLI's |
|
|
83
|
-
| `src/reopen.ts` | a chat opened again in another folder by `turri` once it quits - into the project a capture wrote |
|
|
84
84
|
| `genome/` | what turri knows and can do: `genome/skills/`, the skill library, `genome/rules/`, the \*\*\*plain authoring rules, and `genome/capture/`, capture's prompts |
|
|
85
85
|
|
|
86
86
|
## Known edges
|
package/docs/headless.md
CHANGED
|
@@ -10,7 +10,7 @@ turri doctor
|
|
|
10
10
|
|
|
11
11
|
Everything marked `✗` stops the run, so fix those first. Two more things matter for a long run:
|
|
12
12
|
|
|
13
|
-
- **The toolchains.** The agents use this machine's: run `turri doctor` in the project, and it says which toolchain a module's implementation reqs name that this machine lacks.
|
|
13
|
+
- **The toolchains.** The agents use this machine's: run `turri doctor` in the project, and it says which toolchain a module's implementation reqs name that this machine lacks, or has older than the version they pin.
|
|
14
14
|
- **The models.** In a project, `turri doctor` sends each model `config.turri.yaml` names one short request, as turri's agents will - so a key the provider refuses, a model [pi](https://pi.dev) does not know or an account without access to it shows now, not an hour into the run. Models the run is given on the command line are given to doctor the same way - `--harness-model`, `--coding-model`, `--judge-model`, read as the config's keys - and are checked with the config's.
|
|
15
15
|
- **Credentials that do not expire mid-run.** An API key in the environment (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, ...) or [pi](https://pi.dev)'s saved login - whatever `doctor` shows as the model provider.
|
|
16
16
|
|
package/docs/installation.md
CHANGED
|
@@ -91,16 +91,18 @@ It checks, in order, and says exactly what to run for anything missing:
|
|
|
91
91
|
| `turri` on PATH | so it runs from any project - and every turri on the PATH, with its version: an older one in front of a newer one is a problem, the newer one hidden behind it | `npm install -g @turri-dev/cli`, or `npm link` in a clone - and, for an older one in front, the command that takes it off, by where it is (another Node version of nvm, a linked clone, an npm prefix) |
|
|
92
92
|
| turri and `pi` apart | `turri` starts [pi](https://pi.dev) with turri; a plain `pi` stays [pi](https://pi.dev) | an older `turri setup` wrote a file that loads turri into every `pi` - `doctor` offers to remove it |
|
|
93
93
|
|
|
94
|
+
The last three are the command line's own; the rest are the core's, and every front end that checks the machine runs them.
|
|
95
|
+
|
|
94
96
|
In a project - a folder with `config.turri.yaml` (or the old `config.yaml`) or `plain_modules` - it checks what the project needs of this machine too:
|
|
95
97
|
|
|
96
98
|
| what | |
|
|
97
99
|
| --- | --- |
|
|
98
|
-
| each module's toolchains | what its implementation reqs name - Python, Node, Java, Go, Rust, C/C++, Zig, ... - against this machine's PATH - and Java against a JDK, for macOS keeps a `/usr/bin/java` that only asks to install one: the agents use this machine's toolchains and install none, so a missing one is yours to install |
|
|
100
|
+
| each module's toolchains | what its implementation reqs name - Python, Node, Java, Go, Rust, C/C++, Zig, ... - against this machine's PATH - and Java against a JDK, for macOS keeps a `/usr/bin/java` that only asks to install one - and, where they pin a version of Go, Java, Node or Rust (the standard library's `Go 1.25`, `Java 21`), the one here against it: older is said with the version to install. Not Python's: uv finds or fetches the Python a project asks for. The agents use this machine's toolchains and install none, so a missing or older one is yours to install |
|
|
99
101
|
| the testing scripts | what in them this machine does not have: a program named by its whole path that is not here (a macOS-only `/usr/libexec/java_home` on Linux), a toolchain they run that is not on the PATH |
|
|
100
102
|
| the AWS region | for a project whose models are on Amazon Bedrock: the region they are called in, and where it comes from - turri's, set for the geography they need; the person's `AWS_REGION`; the profile's - and wrong when the person's is outside that geography, or the models need two regions, which one `AWS_REGION` cannot serve |
|
|
101
103
|
| the models | each model `config.turri.yaml` names - `harness-model`, `coding-model`, `judge-model`, every role under `models:` - sent one short request through [pi](https://pi.dev), with the credentials turri's agents will use, for any provider [pi](https://pi.dev) supports. One that answers is ready; for one that does not, it says what the provider said and what to do: the credentials [pi](https://pi.dev) reads for that provider (`AWS_PROFILE` and `AWS_REGION` for Amazon Bedrock, `OPENAI_API_KEY`, `/login`, ...), model access in the Bedrock console, the closest model ids [pi](https://pi.dev) knows for one it does not. `--harness-model`, `--coding-model` (`--model`) and `--judge-model` name models as the config's keys, as `turri regenerate` reads them - checked in a project or not. `--no-models` skips it |
|
|
102
104
|
|
|
103
|
-
Removing that file is the one thing `doctor` changes, and it asks first; `turri doctor --yes` says yes. Run without a terminal - piped, or in CI - it asks nothing and changes nothing. Run it again whenever something breaks; `turri doctor --no-models` leaves out the models' requests. In the chat, ask for a self check: the `doctor` tool runs the same checks, the models only when you ask. A host - a desktop app - runs the same checks through `doctor` and shows them itself (see [doctor in a host](
|
|
105
|
+
Removing that file is the one thing `doctor` changes, and it asks first; `turri doctor --yes` says yes. Run without a terminal - piped, or in CI - it asks nothing and changes nothing. Run it again whenever something breaks; `turri doctor --no-models` leaves out the models' requests. In the chat, ask for a self check: the `doctor` tool runs the same checks, the models only when you ask. A host - a desktop app - runs the same checks through `doctor` and shows them itself (see [doctor in a host](core.md)).
|
|
104
106
|
|
|
105
107
|
The chat is told every turn which wall is up and what the project's modules need of this machine that it lacks. What they need is worked out from all the project's \*\*\*plain - seconds, on a project of long requires chains - so it is worked out when the first turn asks - not as the chat opens - and again after a turn in which \*\*\*plain changed, never while your message waits: a turn is told what was known last.
|
|
106
108
|
|
package/docs/launch.md
CHANGED
|
@@ -47,7 +47,7 @@ A project's launches are of several codebases: the modules of a `requires` chain
|
|
|
47
47
|
|
|
48
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
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
|
|
50
|
+
- **Said, every time.** A launch whose servers were stopped this way is replaced: a front end hears it again (a `launch` event), 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](core.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
51
|
|
|
52
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
53
|
|
|
@@ -73,7 +73,7 @@ With `launch-after-pulse: true` in `config.turri.yaml`, turri launches what each
|
|
|
73
73
|
|
|
74
74
|
The launch agent finds the guidance as for any launch: what the chat passed to `launch` earlier for the codebase, the project's AGENTS.md and its skills. The setting is the word to launch; the guidance says only how - without any, the code goes to `dist/<module>` and is started from there.
|
|
75
75
|
|
|
76
|
-
- **With the [sentinel](sentinel.md) on**, the terminal puts the finished pulse in notifications. Once the launch holds its commit, the sentinel tests it and adds its conclusion there. A launch that did not come up is a finding like any other. A
|
|
76
|
+
- **With the [sentinel](sentinel.md) on**, the terminal puts the finished pulse in notifications. Once the launch holds its commit, the sentinel tests it and adds its conclusion there - with how you try it yourself, as the launch said it: where it runs, or for a command-line tool or a library the commands to run from `dist/<module>` (`Conclusion.tryIt`, which the chat is told too). The person hears how to try what was launched whoever tests it. A launch that did not come up is a finding like any other. A front end hears every launch as it is asked for, starts and ends (a `launch` event) - one out already once, as launched - and what its agent says as it streams (`launchOutput`).
|
|
77
77
|
- **With `sentinel: false`**, finished pulses still appear in the terminal's notifications. The chat that asked for the pulse hears when the launch ends: where it runs, or why it did not come up - unless a newer launch replaced it, whose end is told instead. It then does what it was told to do once something is launched - a host such as a desktop app tells it, in its `surface`, to open it where the person can watch and say what to test.
|
|
78
78
|
|
|
79
79
|
Off without the key: launching after a pulse is then the chat's, when its guidance says so. `turri init-config` writes `launch-after-pulse: true`.
|
package/docs/parser.md
CHANGED
|
@@ -27,7 +27,7 @@ _Not yet run at these commits._ The comparison is run outside this repository -
|
|
|
27
27
|
| `src/plain/markdown.ts` | mistletoe's AST + `PlainRenderer` (mdast + a matching serializer) |
|
|
28
28
|
| `src/plain/liquid.ts` | the reference implementation's Liquid nodes + the two filters in `plain_spec.py` (liquidjs) |
|
|
29
29
|
| `src/plain/files.ts` | `loaders.open_from` / `get_loaded_templates` / `liquid_error_message` / `relative_resource_path`, base64 blob detection |
|
|
30
|
-
| `src/plain/module-concepts.ts`, `src/plain/graph.ts` | nothing - turri's own, for a host: the concepts a module can name and where each is defined, and a project's \*\*\*plain as a graph of modules, items and concepts (see [hosting](
|
|
30
|
+
| `src/plain/module-concepts.ts`, `src/plain/graph.ts` | nothing - turri's own, for a host: the concepts a module can name and where each is defined, and a project's \*\*\*plain as a graph of modules, items and concepts (see [hosting](core.md)). The parser keeps, beside the reference's result, which module each item an import brought is written in (`importedFrom`) |
|
|
31
31
|
| `src/plain/stdlib.ts` | nothing - turri's own: `stdlib/` is a reserved import prefix, read from turri's standard library only, and a project module at such a path is an error (see [the standard library](authoring-plain.md#the-standard-library)) |
|
|
32
32
|
|
|
33
33
|
The ported functions keep the reference's names where it keeps them: `getFrids`, `getSpecificationsForFrid`, `getFridsRange` - a frid there is a functional spec's func-id.
|
package/docs/regenerating.md
CHANGED
|
@@ -247,7 +247,7 @@ They are required: a build with no unit testing script, or with conformance on a
|
|
|
247
247
|
|
|
248
248
|
**What they run on.** By default, the code in place: the project's own script at its own path, from the project's folder, on the real build and tests folders. A script that finds things from its own path - an integration embedded in a host codebase, whose scripts merge the generated code into the host and find the host from where they sit - finds them. What the script does to the host - copying the package into it - it does, as it is written to.
|
|
249
249
|
|
|
250
|
-
`testing-scripts-run-on: copy` in the project's `config.turri.yaml` runs them on a fresh copy of the code instead, and of the whole conformance suite, in `plain_modules/.turri/scripts/`, named for its module and the run, with the project's script copied in beside it:
|
|
250
|
+
`testing-scripts-run-on: copy` in the project's `config.turri.yaml` runs them on a fresh copy of the code instead, and of the whole conformance suite, in `plain_modules/.turri/scripts/`, named for its module and the run, with the project's script copied in beside it: a script written before its working folder was one `mktemp -d` makes works in `/tmp/<lang>_<basename of the build>`, and every module's build is called `code`, so two modules testing at once never share that folder; and build output stays out of the code, and nothing a test writes reaches it. The testing-script skills now write scripts that make a working folder of their own each run, which no other run - of this project or another - shares, and remove it as they exit, read-only files (Go's module cache) and all. A script copied there no longer sits beside the project, so one that finds things from its own path does not find them:
|
|
251
251
|
|
|
252
252
|
```yaml
|
|
253
253
|
# plain/config.turri.yaml
|