@turri-dev/cli 0.2.4-next.efe96fe → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/README.md +2 -2
  2. package/dist/chat-skills.d.ts +1 -1
  3. package/dist/chat-skills.js +1 -1
  4. package/dist/chats.d.ts +42 -8
  5. package/dist/chats.js +122 -38
  6. package/dist/cli.js +1 -1
  7. package/dist/config-edit.js +4 -4
  8. package/dist/config.d.ts +48 -11
  9. package/dist/config.js +102 -13
  10. package/dist/extension.d.ts +22 -2
  11. package/dist/extension.js +225 -125
  12. package/dist/genome.js +1 -1
  13. package/dist/host-session.d.ts +6 -5
  14. package/dist/host-session.js +2 -2
  15. package/dist/host.d.ts +2 -0
  16. package/dist/identity.js +2 -2
  17. package/dist/init-config.d.ts +1 -1
  18. package/dist/init-config.js +7 -7
  19. package/dist/launch-agent.d.ts +51 -0
  20. package/dist/launch-agent.js +267 -0
  21. package/dist/{release-cli.js → launch-cli.js} +41 -24
  22. package/dist/launch-session.d.ts +68 -0
  23. package/dist/launch-session.js +217 -0
  24. package/dist/launch-tools.d.ts +28 -0
  25. package/dist/launch-tools.js +69 -0
  26. package/dist/launch-track.d.ts +125 -0
  27. package/dist/launch-track.js +320 -0
  28. package/dist/loop-cli.js +4 -4
  29. package/dist/loop-tools.d.ts +8 -3
  30. package/dist/loop-tools.js +37 -32
  31. package/dist/notice.d.ts +7 -6
  32. package/dist/plain-files.d.ts +2 -2
  33. package/dist/plain-files.js +3 -3
  34. package/dist/regenerate/command-check.d.ts +7 -1
  35. package/dist/regenerate/command-check.js +43 -1
  36. package/dist/regenerate/delivery.d.ts +1 -1
  37. package/dist/regenerate/delivery.js +3 -3
  38. package/dist/regenerate/launch.d.ts +154 -0
  39. package/dist/regenerate/{release.js → launch.js} +195 -51
  40. package/dist/regenerate/ledger.d.ts +32 -1
  41. package/dist/regenerate/lineage.d.ts +2 -0
  42. package/dist/regenerate/lineage.js +8 -0
  43. package/dist/regenerate/loop.d.ts +18 -7
  44. package/dist/regenerate/loop.js +28 -22
  45. package/dist/regenerate/paths.d.ts +2 -2
  46. package/dist/regenerate/paths.js +2 -2
  47. package/dist/self-invocation.js +7 -7
  48. package/dist/sentinel-check.d.ts +3 -3
  49. package/dist/sentinel-check.js +3 -3
  50. package/dist/sentinel.d.ts +18 -12
  51. package/dist/sentinel.js +68 -42
  52. package/docs/README.md +2 -2
  53. package/docs/chats.md +2 -2
  54. package/docs/config.md +9 -9
  55. package/docs/development.md +1 -1
  56. package/docs/headless.md +1 -1
  57. package/docs/hosting.md +14 -13
  58. package/docs/launch.md +67 -0
  59. package/docs/parser.md +1 -1
  60. package/docs/regenerating.md +3 -3
  61. package/docs/sandbox.md +3 -3
  62. package/docs/sentinel.md +24 -12
  63. package/docs/skills-and-gates.md +3 -3
  64. package/docs/using.md +8 -8
  65. package/genome/rules/turri-regeneration.md +1 -1
  66. package/package.json +1 -1
  67. package/dist/regenerate/release.d.ts +0 -121
  68. package/dist/release-agent.d.ts +0 -43
  69. package/dist/release-agent.js +0 -130
  70. package/dist/release-tools.d.ts +0 -44
  71. package/dist/release-tools.js +0 -170
  72. package/docs/deploy.md +0 -48
  73. /package/dist/{release-cli.d.ts → launch-cli.d.ts} +0 -0
package/README.md CHANGED
@@ -151,7 +151,7 @@ Then say what you want:
151
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:
152
152
 
153
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;
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;
154
+ - ask to try it at any time - "let me try it" - and **`launch`** puts what is built so far in `dist/<module>` and starts it in the background, installing what it needs - nothing to approve;
155
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`);
156
156
  - **`/halt`** halts a pulse, **`/lineage`** shows every generation of a module, and the **`drift`** tool says what is left to regenerate;
157
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;
@@ -189,7 +189,7 @@ Start at the [documentation index](docs/README.md), or go straight to a page:
189
189
  | [Examples](examples/README.md) | projects to build with turri step by step: guestbook - a backend and a frontend in minutes - a CLI, and a backend service tested where it matters |
190
190
  | [Using **turri**](docs/using.md) | the conversation, skills, tools, pulses and regen, choosing models, the command line |
191
191
  | [The project config](docs/config.md) | `config.turri.yaml` and a module's own `config.turri.<module>.yaml`: every key, models and their inheritance, conformance, the testing scripts, which file builds a module, the old `config.yaml` |
192
- | [Deploy](docs/deploy.md) | trying what is built: the last commit in `dist/<module>`, started on your machine, nothing installed without asking |
192
+ | [Launch](docs/launch.md) | trying what is built: a commit in `dist/<module>`, started on your machine in the background - after every pulse too - nothing installed without asking |
193
193
  | [Running unattended](docs/headless.md) | regenerating \*\*\*plain overnight or in CI: the command, keeping it running, the results, resuming, rebuilding one functionality |
194
194
  | [Authoring \*\*\*plain](docs/authoring-plain.md) | what \*\*\*plain is made of, the authoring rules, the skills that write and fix it, checking it |
195
195
  | [Regenerating](docs/regenerating.md) | what each build does and in which order: functionalities, modules, regeneration, changes to \*\*\*plain, conformance and acceptance tests, working notes, what the code is built from |
@@ -8,7 +8,7 @@
8
8
  * runs its own skills, and the project's, with `cultivate`, steps and gates and all. A skill the chat followed by hand
9
9
  * instead would skip those gates, and one from another tool may say otherwise than turri's rules. So the conversation
10
10
  * is offered neither: no skill turri runs itself, and none about ***plain. A skill about anything else - a commit
11
- * message, a deploy - is offered as pi offers it.
11
+ * message, a launch - is offered as pi offers it.
12
12
  */
13
13
  /** Whether turri has what a pi skill offers: it runs a skill of that name itself, or the skill is about ***plain. */
14
14
  export declare function supersededByTurri(skill: {
@@ -8,7 +8,7 @@
8
8
  * runs its own skills, and the project's, with `cultivate`, steps and gates and all. A skill the chat followed by hand
9
9
  * instead would skip those gates, and one from another tool may say otherwise than turri's rules. So the conversation
10
10
  * is offered neither: no skill turri runs itself, and none about ***plain. A skill about anything else - a commit
11
- * message, a deploy - is offered as pi offers it.
11
+ * message, a launch - is offered as pi offers it.
12
12
  */
13
13
  /** What a skill says it is about, that turri covers: ***plain specs and their testing scripts. */
14
14
  const ABOUT_PLAIN = /\*\*\*plain|\\\*\\\*\\\*plain|\.plain\b|functional specs?\b|testing scripts?\b|run_unittests|run_conformance_tests/i;
package/dist/chats.d.ts CHANGED
@@ -5,6 +5,7 @@ import { type ChatUi } from "./chat-ui.ts";
5
5
  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
+ import type { Launch } from "./launch-track.ts";
8
9
  import type { ToolDefinition } from "@earendil-works/pi-coding-agent";
9
10
  import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type NoticeInput, type SentinelCheck } from "./notice.ts";
10
11
  /**
@@ -13,7 +14,7 @@ import { type ChatRole, type Conclusion, type Notice, type NoticeAnswer, type No
13
14
  * One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
14
15
  * history, model, thinking level and questions, each working while another is shown. What they share is the
15
16
  * session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
16
- * chat's side panel - the coding model, steering, releases and the ledger.
17
+ * chat's side panel - the coding model, steering, launches and the ledger.
17
18
  *
18
19
  * A chat is a pi session with turri's extension in it. The extension, built once for each, links itself to its chat
19
20
  * here (`attach`); its tools, commands and handlers then run inside the chat's scope (chat-scope.ts), so a pulse knows
@@ -79,13 +80,19 @@ export interface TurriHost {
79
80
  * not say it again in the conversation. Unset, it says both, as in the terminal.
80
81
  */
81
82
  pulseEndsShown?: boolean;
83
+ /**
84
+ * A launch was asked for, started, or ended (docs/launch.md): what the host shows of what runs is drawn again. One that
85
+ * ended with a newer launch waiting has `replacedBy` - stopped the next moment - and one whose servers were halted on
86
+ * request comes again, `stopped`.
87
+ */
88
+ onLaunch?(launch: Launch): void;
82
89
  /** What the sentinel puts to the person - and, `kind: "sentinel-start"`, whether to start it: the host draws it in the chat it names, and answers it with `answer`. */
83
90
  onNotice?(notice: Notice): void;
84
91
  /** A notice is over - answered, dismissed, or superseded by a newer one about its module: the host takes its card down. */
85
92
  onNoticeOver?(notice: Notice): void;
86
93
  /**
87
94
  * The sentinel's own tools beside turri's - a host's browser, say - and its surface: where the person watches it use
88
- * them, in the host's words. Given, the sentinel tries a release with those tools, keeping its shell for what they
95
+ * them, in the host's words. Given, the sentinel tries what is launched with those tools, keeping its shell for what they
89
96
  * cannot show; absent, the person does not watch it, and the tools are only to test with as well.
90
97
  */
91
98
  sentinel?: {
@@ -109,14 +116,21 @@ export interface ChatInstance {
109
116
  asked?: string;
110
117
  focused?: string;
111
118
  }): Promise<void>;
112
- /**
113
- * The sentinel's: functional specs a host asked it to check - the module released first, unless what runs is its last
114
- * commit, then its agent told, in a conversation of its own for the check. Why not, when the release failed: then its
115
- * agent is told nothing.
116
- */
119
+ /** The sentinel's: functional specs a host asked it to check - its agent told, in a conversation of its own for the check, in what is launched of the module. */
117
120
  briefCheck(check: SentinelCheck, context: {
118
121
  focused?: string;
119
- }): Promise<string | undefined>;
122
+ }): Promise<void>;
123
+ /**
124
+ * The sentinel's: its check of a pulse - or a host's check - paused while the codebase was launched again, carried on in
125
+ * the launch that holds it: its agent told so, in the conversation it was in. Throws when what runs no longer holds it.
126
+ */
127
+ resume(work: {
128
+ job: Job;
129
+ } | {
130
+ check: SentinelCheck;
131
+ }): Promise<void>;
132
+ /** A launch this chat is to hear of ended - one it asked for, or one after a pulse of its with the sentinel off: its agent told how it went. */
133
+ launched(launch: Launch): void;
120
134
  /** A notice put in the chat: drawn, and - in the terminal - put to the person once the chat is idle. */
121
135
  notice(notice: Notice): void;
122
136
  /** A notice is over: its dialog closed, if it is open. */
@@ -222,6 +236,12 @@ export interface TurriCore {
222
236
  showing(chat: ChatState): void;
223
237
  /** For the extension: a pulse ended - told to the chat that asked for it, or, with the sentinel on, to the sentinel. */
224
238
  jobFinished(job: Job): void;
239
+ /**
240
+ * For the extension: a launch started, or ended. Started, the sentinel's check of a pulse or a check of its codebase is
241
+ * paused, to carry on once the codebase's launches are settled. Ended, one after a pulse, with the sentinel off: told to
242
+ * the chat that asked for the pulse, or the one shown.
243
+ */
244
+ launchChanged(launch: Launch): void;
225
245
  /** Whether finished pulses go to the sentinel now: it is on, and there is somewhere to open it. */
226
246
  sentinelOn(): boolean;
227
247
  /** A notice put to the person, in the chat they look at - the sentinel's, or turri's own. Undefined: no chat to put it in. */
@@ -275,6 +295,20 @@ export interface CoreOptions {
275
295
  setSentinel?: (on: boolean) => void;
276
296
  /** The person ignored a notice for good: kept in the sentinel's guidance, for every conversation after. */
277
297
  ignored?: (notice: Notice) => void;
298
+ /** The launch track, as the sentinel waits on it (docs/sentinel.md). Not given: the sentinel waits for nothing. */
299
+ launches?: SentinelLaunches;
300
+ }
301
+ /**
302
+ * What the sentinel waits on of the launch track: a pulse is tested only in a launch whose commit holds the pulse's, and
303
+ * a check only in what runs of its module - each told once its codebase's launches are settled.
304
+ */
305
+ export interface SentinelLaunches {
306
+ /** Resolves once what runs can be tested for the pulse, or there is nothing running to test it in. Throws when what runs cannot hold it - turri got it wrong. */
307
+ readyFor(job: Job): Promise<void>;
308
+ /** Resolves once what runs of the check's module is settled. Throws when nothing of it runs. */
309
+ readyForCheck(check: SentinelCheck): Promise<void>;
310
+ /** Resolves once nothing of the codebase's is launching or waiting to. */
311
+ settled(codebase: string): Promise<void>;
278
312
  }
279
313
  /** A chat's session, as stopping what it does reaches it. */
280
314
  export type Stoppable = Pick<AgentSession, "isStreaming" | "isCompacting" | "isRetrying" | "isBashRunning" | "abort" | "abortBash">;
package/dist/chats.js CHANGED
@@ -4,7 +4,7 @@ import { currentChat, inChat } from "./chat-scope.js";
4
4
  import { adoptRun, forgetChat, forgetSessionFile, recordRun } from "./chat-records.js";
5
5
  import { createChatUi } from "./chat-ui.js";
6
6
  import { debugMode } from "./config.js";
7
- import { record } from "./regenerate/ledger.js";
7
+ import { firstLine, record } from "./regenerate/ledger.js";
8
8
  import { newNotice, noticeTask, SENTINEL, sentinelStartChoice, wentWrong } from "./notice.js";
9
9
  /**
10
10
  * The chats of a turri session.
@@ -12,7 +12,7 @@ import { newNotice, noticeTask, SENTINEL, sentinelStartChoice, wentWrong } from
12
12
  * One turri process is one session on one project, and holds up to MAX_CHATS chats: conversations, each with its own
13
13
  * history, model, thinking level and questions, each working while another is shown. What they share is the
14
14
  * session's: the one job registry and work loop the project's pulses run in - a pulse any chat starts is in every
15
- * chat's side panel - the coding model, steering, releases and the ledger.
15
+ * chat's side panel - the coding model, steering, launches and the ledger.
16
16
  *
17
17
  * A chat is a pi session with turri's extension in it. The extension, built once for each, links itself to its chat
18
18
  * here (`attach`); its tools, commands and handlers then run inside the chat's scope (chat-scope.ts), so a pulse knows
@@ -91,8 +91,10 @@ export function createChats(options) {
91
91
  let notices = [];
92
92
  /** What the sentinel put to the person, and turri itself, this session: open until answered or superseded. */
93
93
  const open = [];
94
- /** The work the sentinel's conversation is on, from its brief until its agent is done: a newer pulse of the same module replaces a check of one that went well. */
94
+ /** The work the sentinel's conversation is on, from its brief until its agent is done - `concluded` once it said so. */
95
95
  let checking;
96
+ /** Its check paused while its codebase is launched again: carried on once the codebase's launches are settled. */
97
+ let paused;
96
98
  /** Pulses that finished, and checks asked for, while the sentinel was at work: each taken in turn, in a conversation of its own. */
97
99
  const waiting = [];
98
100
  /** The checks hosts asked for this session, by id: what a notice or a conclusion about one is about. */
@@ -185,8 +187,12 @@ export function createChats(options) {
185
187
  chat.unread = true;
186
188
  persist();
187
189
  changed();
190
+ }
191
+ else if (event.type === "agent_settled") {
188
192
  // Done with its pulse - or with what the person said to it: the next pulse waiting, in a conversation of its own.
189
- if (chat.role === SENTINEL && event.willRetry !== true) {
193
+ // Settled, not at agent_end: pi's session still streams while agent_end's listeners run, and a retry comes after
194
+ // it. Paused for a launch, it is not done: it carries on once the launch is settled.
195
+ if (chat.role === SENTINEL && paused === undefined) {
190
196
  checking = undefined;
191
197
  toSentinel(() => nextWork(chat));
192
198
  }
@@ -277,6 +283,7 @@ export function createChats(options) {
277
283
  // Closed, the sentinel is let go with what it had to check: the next pulse that finishes opens it again.
278
284
  if (chat.role === SENTINEL) {
279
285
  checking = undefined;
286
+ paused = undefined;
280
287
  // A check a host asked for ends all the same: it is told it was not done.
281
288
  for (const work of waiting.splice(0))
282
289
  if ("check" in work)
@@ -392,6 +399,30 @@ export function createChats(options) {
392
399
  }
393
400
  toAsker(job);
394
401
  },
402
+ launchChanged(launch) {
403
+ if (launch.status === "running") {
404
+ pauseFor(launch);
405
+ return;
406
+ }
407
+ // One after a pulse, ended, with the sentinel off: its chat is told - the sentinel, on, tests it with the pulse. One a
408
+ // newer launch replaced as it ended is not: what it started is stopped the next moment, and the newer one is told.
409
+ if (!("pulse" in launch.cause) || (launch.status !== "launched" && launch.status !== "failed") || launch.replacedBy !== undefined || core.sentinelOn())
410
+ return;
411
+ const job = jobs.get(launch.cause.pulse);
412
+ const asked = chats.find((chat) => chat.id === job?.chat && chat.role !== SENTINEL && chat.instance !== undefined);
413
+ const where = asked ?? personFacing();
414
+ if (where === undefined)
415
+ return;
416
+ if (where.id !== shownId)
417
+ where.unread = true;
418
+ try {
419
+ where.instance?.launched(launch);
420
+ }
421
+ catch {
422
+ /* a chat let go as it ended: the host still hears of it */
423
+ }
424
+ changed();
425
+ },
395
426
  check(prepare) {
396
427
  if (driver === undefined)
397
428
  return { refused: "There is nowhere to open the sentinel in this session." };
@@ -464,6 +495,10 @@ export function createChats(options) {
464
495
  },
465
496
  notices: () => open.filter((notice) => notice.state === "open"),
466
497
  concluded(conclusion) {
498
+ // The sentinel's work concluded: a launch from now on does not pause it - it is only saying so.
499
+ const work = checking?.work;
500
+ if (work !== undefined && ("pulse" in work ? conclusion.job === work.pulse.id : conclusion.check === work.check.id))
501
+ checking = { ...checking, concluded: true };
467
502
  const job = conclusion.job !== undefined ? jobs.get(conclusion.job) : undefined;
468
503
  const check = conclusion.check !== undefined ? checks.get(conclusion.check) : undefined;
469
504
  const target = personFacing(chats.find((chat) => chat.id === job?.chat));
@@ -717,29 +752,16 @@ export function createChats(options) {
717
752
  core.notify(`The sentinel: ${error instanceof Error ? error.message : String(error)}`, "warning");
718
753
  });
719
754
  }
720
- /** Whether the sentinel is at work: on a pulse - its turn starts as it is told of one - or on what the person said to it. */
721
- const sentinelBusy = (sentinel) => sentinel.session?.isStreaming === true;
722
755
  /**
723
- * A finished pulse or a host's check, for the sentinel: taken now when it is free. Busy, a newer pulse of a module
724
- * replaces a check of the module's last pulse that went well - and a pulse of it that went well and waits - and one that
725
- * went wrong is looked into to its end; the rest, checks among them, wait their turn.
756
+ * Whether the sentinel is at work: on a pulse - its turn starts as it is told of one - or on what the person said to it;
757
+ * or its check is paused while its codebase is launched again.
726
758
  */
759
+ const sentinelBusy = (sentinel) => sentinel.session?.isStreaming === true || paused !== undefined;
760
+ /** A finished pulse or a host's check, for the sentinel: taken now when it is free, else after what waits - every one, in order. */
727
761
  function takeWork(sentinel, work) {
728
762
  if (!sentinelBusy(sentinel))
729
763
  return begin(sentinel, work);
730
- if (!("pulse" in work)) {
731
- waiting.push(work);
732
- return;
733
- }
734
- const job = work.pulse;
735
- const sameModule = (other) => job.module !== undefined && "pulse" in other && other.pulse.module === job.module;
736
- if (checking !== undefined && !checking.wrong && sameModule(checking.work) && "pulse" in checking.work)
737
- return check(sentinel, job, checking.work.pulse);
738
- const older = waiting.findIndex((other) => sameModule(other) && "pulse" in other && !wentWrong(other.pulse));
739
- if (older !== -1)
740
- waiting.splice(older, 1, work);
741
- else
742
- waiting.push(work);
764
+ waiting.push(work);
743
765
  }
744
766
  /** The sentinel free again: the next pulse or check that waits, taken. */
745
767
  function nextWork(sentinel) {
@@ -752,13 +774,40 @@ export function createChats(options) {
752
774
  function begin(sentinel, work) {
753
775
  return "pulse" in work ? check(sentinel, work.pulse) : checkSpecs(sentinel, work.check);
754
776
  }
777
+ /** The codebase a piece of the sentinel's work is tested in: the pulse's, or the check's module's. */
778
+ const codebaseOf = (work) => ("pulse" in work ? work.pulse.module : work.check.module);
755
779
  /**
756
- * The sentinel on a host's check, from scratch, as on a pulse: a conversation of its own, the module released first
757
- * unless what runs is its last commit. A release that fails ends the check - a conclusion of its own - and the next
758
- * waiting is taken.
780
+ * What runs cannot be tested for a pulse or a check: recorded, and concluded as unchecked; the next waiting taken. For a
781
+ * pulse turri got it wrong - what runs cannot hold its commit - and that is said as an error where the person is too. A
782
+ * host's check with nothing launched to test it in is an answer, not an error: its conclusion says it alone.
783
+ */
784
+ async function refuse(sentinel, work, why) {
785
+ const module = codebaseOf(work);
786
+ inChat(sentinel.scope, () => record({ kind: "sentinel.refused", ...(module !== undefined ? { module } : {}), ...("check" in work ? { check: work.check.id } : {}), why: firstLine(why, 300) }, { project: cwd, ...("pulse" in work ? { job: work.pulse.id } : {}) }));
787
+ if ("pulse" in work)
788
+ core.notify(`The sentinel cannot check pulse ${work.pulse.id}: ${why}`, "error");
789
+ core.concluded({
790
+ ...("pulse" in work ? { job: work.pulse.id } : { check: work.check.id }),
791
+ ...(module !== undefined ? { module } : {}),
792
+ verdict: "unchecked",
793
+ summary: `Not checked: ${why}`,
794
+ });
795
+ checking = undefined;
796
+ changed();
797
+ await nextWork(sentinel);
798
+ }
799
+ /**
800
+ * The sentinel on a host's check, from scratch, as on a pulse: a conversation of its own, once what runs of the module
801
+ * is settled - nothing launched for it, and the check ends unchecked.
759
802
  */
760
803
  async function checkSpecs(sentinel, check) {
761
- checking = { work: { check }, wrong: false };
804
+ try {
805
+ await options.launches?.readyForCheck(check);
806
+ }
807
+ catch (error) {
808
+ return refuse(sentinel, { check }, error instanceof Error ? error.message : String(error));
809
+ }
810
+ checking = { work: { check } };
762
811
  inChat(sentinel.scope, () => record({ kind: "sentinel.checking", module: check.module, check: check.id }, { project: cwd }));
763
812
  const session = sentinel.session;
764
813
  if (session !== undefined && (session.messages.length > 0 || session.isStreaming))
@@ -766,28 +815,29 @@ export function createChats(options) {
766
815
  if (sentinel.id !== shownId)
767
816
  sentinel.unread = true;
768
817
  const where = personFacing();
769
- let why;
770
818
  try {
771
- why = await sentinel.instance.briefCheck(check, where !== undefined ? { focused: titleFor(where) } : {});
819
+ await sentinel.instance.briefCheck(check, where !== undefined ? { focused: titleFor(where) } : {});
772
820
  }
773
821
  catch (error) {
774
- why = error instanceof Error ? error.message : String(error);
822
+ core.notify(`The sentinel could not be told of check ${check.id}: ${error instanceof Error ? error.message : String(error)}`, "warning");
823
+ checking = undefined;
775
824
  }
776
825
  changed();
777
- if (why === undefined)
778
- return;
779
- checking = undefined;
780
- core.concluded({ check: check.id, module: check.module, verdict: "wrong", summary: `Not tested: ${check.module} could not be released - ${why}` });
781
- await nextWork(sentinel);
782
826
  }
783
827
  /**
784
828
  * The sentinel on a pulse, from scratch: a conversation of its own - its prompt, the project's guidance and this
785
- * pulse's brief, nothing of the pulses before it - in place of the one it had, stopped when it was on `replacing`.
829
+ * pulse's brief, nothing of the pulses before it - once what runs holds the pulse's commit (`readyFor`).
786
830
  */
787
- async function check(sentinel, job, replacing) {
788
- checking = { work: { pulse: job }, wrong: wentWrong(job) };
831
+ async function check(sentinel, job) {
832
+ try {
833
+ await options.launches?.readyFor(job);
834
+ }
835
+ catch (error) {
836
+ return refuse(sentinel, { pulse: job }, error instanceof Error ? error.message : String(error));
837
+ }
838
+ checking = { work: { pulse: job } };
789
839
  const module = job.module;
790
- inChat(sentinel.scope, () => record({ kind: "sentinel.checking", ...(module !== undefined ? { module } : {}), ...(replacing !== undefined ? { replaced: replacing.id } : {}) }, { project: cwd, job: job.id }));
840
+ inChat(sentinel.scope, () => record({ kind: "sentinel.checking", ...(module !== undefined ? { module } : {}) }, { project: cwd, job: job.id }));
791
841
  const session = sentinel.session;
792
842
  if (session !== undefined && (session.messages.length > 0 || session.isStreaming))
793
843
  await freshConversation(sentinel);
@@ -807,6 +857,40 @@ export function createChats(options) {
807
857
  }
808
858
  changed();
809
859
  }
860
+ /**
861
+ * A launch of a codebase started while the sentinel checks a pulse or a check of it: its turn stopped - its conversation
862
+ * kept - until the codebase's launches are settled, then carried on in the launch that holds it.
863
+ */
864
+ function pauseFor(launch) {
865
+ const sentinel = sentinelChat();
866
+ const now = checking;
867
+ // Concluded, it is only saying so: nothing to carry on.
868
+ if (sentinel === undefined || now === undefined || now.concluded === true || paused !== undefined || codebaseOf(now.work) !== launch.codebase)
869
+ return;
870
+ paused = now;
871
+ inChat(sentinel.scope, () => record({ kind: "sentinel.paused", module: launch.codebase, launch: launch.id }, { project: cwd, ...("pulse" in now.work ? { job: now.work.pulse.id } : {}) }));
872
+ void sentinel.session?.abort().catch(() => undefined);
873
+ changed();
874
+ void (async () => {
875
+ await options.launches?.settled(launch.codebase);
876
+ // Let go meanwhile - closed, or given another conversation: nothing to carry on.
877
+ if (paused !== now || !chats.includes(sentinel) || sentinel.instance === undefined) {
878
+ if (paused === now)
879
+ paused = undefined;
880
+ return;
881
+ }
882
+ paused = undefined;
883
+ const resumed = "pulse" in now.work ? { job: now.work.pulse } : { check: now.work.check };
884
+ try {
885
+ await sentinel.instance.resume(resumed);
886
+ inChat(sentinel.scope, () => record({ kind: "sentinel.resumed", module: launch.codebase, launch: launch.id }, { project: cwd, ...("pulse" in now.work ? { job: now.work.pulse.id } : {}) }));
887
+ }
888
+ catch (error) {
889
+ toSentinel(() => refuse(sentinel, now.work, error instanceof Error ? error.message : String(error)));
890
+ }
891
+ changed();
892
+ })();
893
+ }
810
894
  /**
811
895
  * The sentinel's chat given a new session, under the same id: what it does now stopped, and what it said let go - its
812
896
  * saved conversation deleted outside debug mode. The model and thinking it had carry over: what the person picked in
package/dist/cli.js CHANGED
@@ -77,7 +77,7 @@ const COMMANDS = {
77
77
  conform: { module: "./conform-cli.ts", blurb: "write and run a module's conformance tests" },
78
78
  parse: { module: "./parse-cli.ts", blurb: "parse ***plain - its syntax and structure, never its code or tests - regenerating nothing" },
79
79
  lineage: { module: "./lineage-cli.ts", blurb: "a module's lineage: what was regenerated into it, and when" },
80
- release: { module: "./release-cli.ts", blurb: "release what is regenerated to dist/<module> and activate it on this machine" },
80
+ launch: { module: "./launch-cli.ts", blurb: "launch what is regenerated from dist/<module> on this machine" },
81
81
  cultivate: { module: "./cultivate-cli.ts", blurb: "run a gated skill" },
82
82
  };
83
83
  /** Getting the machine ready, and checking it is. */
@@ -20,10 +20,10 @@ const SECONDS = ["0", "60", "120", "180", "300"];
20
20
  const ROLE_ABOUT = {
21
21
  default: "every role not named",
22
22
  chat: "the conversation - as harness-model, which it wins over",
23
- sentinel: "the sentinel: checks every finished pulse and tests the release",
23
+ sentinel: "the sentinel: checks every finished pulse and tests what is launched",
24
24
  planner: "cuts the work into pulses",
25
25
  diagnosis: "looks into a pulse that failed for good",
26
- release: "the release agent",
26
+ launch: "the launch agent",
27
27
  coding: "writes the code - as coding-model, which it wins over",
28
28
  conformance: "writes the conformance tests",
29
29
  explorer: "explores the code for a conformance run",
@@ -62,8 +62,8 @@ export function settings(rules = []) {
62
62
  { key: "review", about: "whether the code and its tests are reviewed once they pass", kind: "boolean", unset: "true", effect: "next-pulse" },
63
63
  { key: "mutation-testing", about: "whether the coding agent and the reviewer can put a bug in the code for one test run (can_it_fail)", kind: "boolean", unset: "true", effect: "next-pulse" },
64
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" },
65
- { key: "release-after-pulse", about: "whether every pulse that lands code releases it", kind: "boolean", unset: "false", effect: "next-landing" },
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", personOnly: true },
65
+ { key: "launch-after-pulse", about: "whether every pulse that lands code is launched, in the background", kind: "boolean", unset: "false", effect: "next-landing" },
66
+ { key: "sentinel", about: "whether a chat of its own checks every finished pulse, tests what is launched, 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", personOnly: true },
67
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", personOnly: true },
68
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" },
69
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" },
package/dist/config.d.ts CHANGED
@@ -19,8 +19,8 @@
19
19
  * review: false # review the code and its tests once they pass (default: true)
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
- * release-after-pulse: true # release what each pulse lands, as its last stage, before the next pulse (default: false)
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)
22
+ * launch-after-pulse: true # launch what each pulse lands, in the background, the newest commit winning (default: false)
23
+ * sentinel: true # a chat of its own every finished pulse goes to, which tests what is launched and tells you what is wrong: true, false, or ask - the person asked before it first opens in a session (default: ask)
24
24
  * rules-off: [integrations] # ***plain rules to leave out of the prompts, by name (default: none)
25
25
  * unittests-script: test_scripts/run_unittests.sh # the testing scripts - see test-scripts.ts
26
26
  * conformance-tests-script: test_scripts/run_conformance_tests.sh
@@ -83,6 +83,27 @@ export declare function moduleConfigsOf(root: string): string[];
83
83
  * config.turri.yaml, and each config.<module>.yaml to config.turri.<module>.yaml, so nothing is lost when the old files
84
84
  * stop being read. The old files are left as they are. Gives back the files written, by name.
85
85
  */
86
+ /**
87
+ * Keys turri has renamed, old to new - no alias: a project's config.turri.yaml or config.turri.<module>.yaml that still has
88
+ * the old one has it renamed as turri first reads or writes the project's config (`renameOldKeys`), its value and its
89
+ * comment kept. One that sets the new one too is left as it is, the old one said in the banner as doing nothing.
90
+ */
91
+ export declare const RENAMED_KEYS: Readonly<Record<string, string>>;
92
+ /** A key renamed in a config file. */
93
+ export interface RenamedKey {
94
+ file: string;
95
+ from: string;
96
+ to: string;
97
+ }
98
+ /**
99
+ * Rename the old keys of `RENAMED_KEYS` in the project's config.turri*.yaml files - once a process, or again with `again`
100
+ * (a file just copied from its old name). A top-level key alone, its line kept but for the key's name; a file that also
101
+ * sets the new key, one that does not parse, or one that cannot be written is left as it is. Returns every key renamed
102
+ * in the project this process.
103
+ */
104
+ export declare function renameOldKeys(root: string, options?: {
105
+ again?: boolean;
106
+ }): RenamedKey[];
86
107
  export declare function adoptLegacyConfig(root: string, options?: {
87
108
  projectFile?: boolean;
88
109
  }): string[];
@@ -122,11 +143,11 @@ export interface ModelChoice {
122
143
  * The code fixer of a conformance run and the repair agent are coding agents; the unit-test and conformance arbiters
123
144
  * are both `arbiter`.
124
145
  */
125
- export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "release", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
146
+ export declare const AGENT_ROLES: readonly ["chat", "sentinel", "planner", "diagnosis", "launch", "coding", "conformance", "explorer", "reviewer", "test-reviewer", "judge", "arbiter", "debugger"];
126
147
  export type AgentRole = (typeof AGENT_ROLES)[number];
127
148
  /**
128
149
  * How hard each role thinks when nothing names a level - not the config's `models:`, nor a `:level` on the model it is
129
- * given. The agents that do the work - write the code and the tests, explore, release - think little: they work from a
150
+ * given. The agents that do the work - write the code and the tests, explore, launch - think little: they work from a
130
151
  * spec that leaves little to guess, and every turn of theirs is many. The ones that judge - review, weigh, plan, find a
131
152
  * cause - think more: a wrong call there costs pulses. The conversation keeps its own level, pi's.
132
153
  */
@@ -206,12 +227,12 @@ export interface ProjectConfig {
206
227
  */
207
228
  allowToStopJobs?: boolean;
208
229
  /**
209
- * Whether every pulse that lands code releases it as its last stage, before the module's next pulse starts - an agent
210
- * looking for the project's release guidance as the chat does, and doing what it says. Unset: false.
230
+ * Whether every pulse that lands code is launched (docs/launch.md): in the background, on the launch track - the newest
231
+ * commit winning, no pulse waiting on it - by an agent that follows the project's launch guidance. Unset: false.
211
232
  */
212
- releaseAfterPulse?: boolean;
233
+ launchAfterPulse?: boolean;
213
234
  /**
214
- * Whether the session has a sentinel: a chat of its own that every finished pulse goes to - checked, a release tested,
235
+ * Whether the session has a sentinel: a chat of its own that every finished pulse goes to - checked, what is launched tested,
215
236
  * and what is wrong put to the person - instead of the chat that asked for it (docs/sentinel.md). `ask`: the person is
216
237
  * asked, before it first opens in a session, whether to start it. Unset: ask.
217
238
  */
@@ -305,7 +326,7 @@ export declare const CONFIG_KEYS: {
305
326
  readonly review: "review";
306
327
  readonly mutationTesting: "mutation-testing";
307
328
  readonly allowToStopJobs: "allow-to-stop-jobs";
308
- readonly releaseAfterPulse: "release-after-pulse";
329
+ readonly launchAfterPulse: "launch-after-pulse";
309
330
  readonly sentinel: "sentinel";
310
331
  readonly testDir: "test-dir";
311
332
  readonly conformanceTests: "conformance-tests";
@@ -373,6 +394,22 @@ export declare function unknownConfigKeys(root: string): Array<{
373
394
  file: string;
374
395
  keys: string[];
375
396
  }>;
376
- /** The banner's line for each config file with keys turri does not read. */
377
- export declare function unknownConfigLines(root: string): string[];
397
+ /**
398
+ * What a line under the banner about a config file is, for a host that draws them without reading their text: `renamed`,
399
+ * a key turri renamed in the file - information, nothing to do; `old-beside-new`, an old name left beside its new one,
400
+ * doing nothing - take it out; `unknown`, keys turri does not read - take them out, or fix their spelling.
401
+ */
402
+ export type ConfigLineKind = "renamed" | "old-beside-new" | "unknown";
403
+ export interface ConfigLine {
404
+ kind: ConfigLineKind;
405
+ /** The file, from the project: `config.turri.yaml`, `config.turri.<module>.yaml`. */
406
+ file: string;
407
+ /** The line, as the terminal shows it. */
408
+ text: string;
409
+ }
410
+ /**
411
+ * The banner's lines for the project's config files: each key turri renamed in them this process, each old name left
412
+ * beside its new one - doing nothing - and each file with keys turri does not read.
413
+ */
414
+ export declare function configLines(root: string): ConfigLine[];
378
415
  export {};