@turri-dev/cli 0.2.3 → 0.2.4-next.009bd0c

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 (175) hide show
  1. package/README.md +7 -8
  2. package/dist/bedrock-region.js +3 -3
  3. package/dist/chat-idle.d.ts +2 -2
  4. package/dist/chat-idle.js +2 -2
  5. package/dist/chat-models.d.ts +1 -1
  6. package/dist/chat-models.js +1 -1
  7. package/dist/chat-scope.d.ts +1 -3
  8. package/dist/chat-skills.d.ts +1 -1
  9. package/dist/chat-skills.js +1 -1
  10. package/dist/chats.d.ts +44 -20
  11. package/dist/chats.js +125 -64
  12. package/dist/cli.js +12 -31
  13. package/dist/config-edit.d.ts +20 -8
  14. package/dist/config-edit.js +32 -26
  15. package/dist/config.d.ts +106 -78
  16. package/dist/config.js +267 -133
  17. package/dist/conform-cli.js +14 -3
  18. package/dist/conformance-switch.d.ts +13 -22
  19. package/dist/conformance-switch.js +37 -59
  20. package/dist/drift-cli.js +1 -1
  21. package/dist/extension.d.ts +17 -10
  22. package/dist/extension.js +425 -531
  23. package/dist/genome.js +10 -49
  24. package/dist/graph.js +3 -5
  25. package/dist/host-session.d.ts +11 -21
  26. package/dist/host-session.js +6 -8
  27. package/dist/host.d.ts +4 -4
  28. package/dist/host.js +4 -7
  29. package/dist/identity.js +2 -3
  30. package/dist/init-config.d.ts +1 -2
  31. package/dist/init-config.js +10 -17
  32. package/dist/installed-providers.d.ts +1 -1
  33. package/dist/installed-providers.js +1 -1
  34. package/dist/launch-agent.d.ts +41 -0
  35. package/dist/launch-agent.js +219 -0
  36. package/dist/{release-cli.js → launch-cli.js} +41 -24
  37. package/dist/launch-session.d.ts +58 -0
  38. package/dist/launch-session.js +195 -0
  39. package/dist/launch-tools.d.ts +28 -0
  40. package/dist/launch-tools.js +69 -0
  41. package/dist/launch-track.d.ts +120 -0
  42. package/dist/launch-track.js +298 -0
  43. package/dist/loop-cli.d.ts +4 -3
  44. package/dist/loop-cli.js +17 -15
  45. package/dist/loop-tools.d.ts +45 -21
  46. package/dist/loop-tools.js +155 -90
  47. package/dist/new-project.js +2 -2
  48. package/dist/notice.d.ts +7 -6
  49. package/dist/parse-cli.js +2 -2
  50. package/dist/pi-launch.js +4 -1
  51. package/dist/pi-settings.d.ts +4 -0
  52. package/dist/pi-settings.js +39 -0
  53. package/dist/pi.js +12 -9
  54. package/dist/plain/check.d.ts +2 -9
  55. package/dist/plain/check.js +6 -39
  56. package/dist/plain-files.d.ts +2 -2
  57. package/dist/plain-files.js +7 -7
  58. package/dist/regenerate/activity.d.ts +0 -7
  59. package/dist/regenerate/activity.js +2 -20
  60. package/dist/regenerate/agent-env.d.ts +1 -1
  61. package/dist/regenerate/agent-env.js +3 -3
  62. package/dist/regenerate/agent-shell.js +5 -3
  63. package/dist/regenerate/audit.js +9 -0
  64. package/dist/regenerate/base-folder.d.ts +2 -2
  65. package/dist/regenerate/base-folder.js +1 -1
  66. package/dist/regenerate/cases.js +7 -0
  67. package/dist/regenerate/chunk-plan.d.ts +5 -0
  68. package/dist/regenerate/chunk-plan.js +16 -1
  69. package/dist/regenerate/command-check.d.ts +1 -1
  70. package/dist/regenerate/command-check.js +1 -1
  71. package/dist/regenerate/delivery.d.ts +1 -1
  72. package/dist/regenerate/delivery.js +3 -3
  73. package/dist/regenerate/drift.d.ts +4 -0
  74. package/dist/regenerate/drift.js +26 -6
  75. package/dist/regenerate/failure-reports.d.ts +28 -0
  76. package/dist/regenerate/failure-reports.js +79 -0
  77. package/dist/regenerate/job-panel.js +3 -1
  78. package/dist/regenerate/jobs-tree.js +1 -1
  79. package/dist/regenerate/jobs.d.ts +4 -2
  80. package/dist/regenerate/jobs.js +14 -10
  81. package/dist/regenerate/launch.d.ts +126 -0
  82. package/dist/regenerate/{release.js → launch.js} +60 -48
  83. package/dist/regenerate/ledger-view.d.ts +11 -24
  84. package/dist/regenerate/ledger-view.js +14 -60
  85. package/dist/regenerate/ledger.d.ts +26 -16
  86. package/dist/regenerate/ledger.js +1 -1
  87. package/dist/regenerate/lineage.d.ts +2 -0
  88. package/dist/regenerate/lineage.js +8 -0
  89. package/dist/regenerate/loop.d.ts +54 -67
  90. package/dist/regenerate/loop.js +312 -148
  91. package/dist/regenerate/model-names.d.ts +33 -0
  92. package/dist/regenerate/{engine.js → model-names.js} +2 -28
  93. package/dist/regenerate/paths.d.ts +3 -3
  94. package/dist/regenerate/paths.js +4 -4
  95. package/dist/regenerate/records.d.ts +11 -0
  96. package/dist/regenerate/records.js +15 -0
  97. package/dist/regenerate/regenerate.d.ts +0 -2
  98. package/dist/regenerate/regenerate.js +4 -15
  99. package/dist/regenerate/renames.js +4 -4
  100. package/dist/regenerate/requires.d.ts +7 -0
  101. package/dist/regenerate/requires.js +24 -18
  102. package/dist/regenerate/scripts-being-written.d.ts +4 -4
  103. package/dist/regenerate/scripts-being-written.js +3 -3
  104. package/dist/regenerate/spec-map.js +3 -3
  105. package/dist/regenerate/standing.js +1 -1
  106. package/dist/regenerate/submit-work.d.ts +2 -0
  107. package/dist/regenerate/submit-work.js +8 -3
  108. package/dist/regenerate/test-scripts.d.ts +2 -1
  109. package/dist/regenerate/test-scripts.js +33 -23
  110. package/dist/regenerate/testing-steps.d.ts +16 -5
  111. package/dist/regenerate/testing-steps.js +28 -9
  112. package/dist/regenerate-cli.js +18 -9
  113. package/dist/self-invocation.d.ts +11 -0
  114. package/dist/self-invocation.js +36 -10
  115. package/dist/sentinel-check.d.ts +3 -3
  116. package/dist/sentinel-check.js +3 -3
  117. package/dist/sentinel.d.ts +17 -12
  118. package/dist/sentinel.js +75 -46
  119. package/dist/{config-command.d.ts → settings.d.ts} +13 -8
  120. package/dist/{config-command.js → settings.js} +155 -24
  121. package/dist/setup.d.ts +2 -2
  122. package/dist/setup.js +7 -7
  123. package/dist/skill.d.ts +0 -11
  124. package/dist/skill.js +0 -9
  125. package/dist/tools.js +2 -3
  126. package/dist/turri-versions.js +2 -1
  127. package/docs/README.md +4 -6
  128. package/docs/authoring-plain.md +3 -3
  129. package/docs/chats.md +6 -9
  130. package/docs/claude-subscription.md +2 -2
  131. package/docs/config.md +61 -51
  132. package/docs/development.md +4 -5
  133. package/docs/headless.md +7 -6
  134. package/docs/hosting.md +24 -23
  135. package/docs/launch.md +63 -0
  136. package/docs/parser.md +3 -3
  137. package/docs/regenerating.md +30 -22
  138. package/docs/sandbox.md +3 -3
  139. package/docs/sentinel.md +27 -16
  140. package/docs/skills-and-gates.md +6 -11
  141. package/docs/using.md +25 -42
  142. package/genome/rules/project-model.md +2 -1
  143. package/genome/rules/test-plain-files.md +15 -7
  144. package/genome/rules/turri-regeneration.md +7 -10
  145. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  146. package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
  147. package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
  148. package/package.json +1 -1
  149. package/dist/advisor-chat.d.ts +0 -63
  150. package/dist/advisor-chat.js +0 -290
  151. package/dist/change-plain-cli.js +0 -55
  152. package/dist/ledger-cli.d.ts +0 -1
  153. package/dist/ledger-cli.js +0 -50
  154. package/dist/ledger-tools.d.ts +0 -10
  155. package/dist/ledger-tools.js +0 -64
  156. package/dist/regenerate/advisor-records.d.ts +0 -93
  157. package/dist/regenerate/advisor-records.js +0 -110
  158. package/dist/regenerate/advisor-runs.d.ts +0 -87
  159. package/dist/regenerate/advisor-runs.js +0 -327
  160. package/dist/regenerate/engine.d.ts +0 -52
  161. package/dist/regenerate/release.d.ts +0 -121
  162. package/dist/regenerate/test-advisor.d.ts +0 -101
  163. package/dist/regenerate/test-advisor.js +0 -379
  164. package/dist/release-agent.d.ts +0 -43
  165. package/dist/release-agent.js +0 -130
  166. package/dist/release-cli.d.ts +0 -1
  167. package/dist/release-tools.d.ts +0 -44
  168. package/dist/release-tools.js +0 -170
  169. package/dist/spec-tools.d.ts +0 -36
  170. package/dist/spec-tools.js +0 -128
  171. package/dist/stacks.d.ts +0 -13
  172. package/dist/stacks.js +0 -96
  173. package/docs/deploy.md +0 -48
  174. package/docs/test-advisor.md +0 -110
  175. /package/dist/{change-plain-cli.d.ts → launch-cli.d.ts} +0 -0
package/dist/genome.js CHANGED
@@ -1,18 +1,16 @@
1
- import { mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1
+ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
3
  import { Command, MemorySaver } from "@langchain/langgraph";
4
4
  import { compileSkill } from "./graph.js";
5
5
  import { createExecutor } from "./pi.js";
6
6
  import { plainWriteTools } from "./plain-files.js";
7
+ import { skillShell } from "./self-invocation.js";
7
8
  import { toolchainsBlock } from "./stack.js";
8
9
  import { clearOfStop, describeToolCall, describeToolResult, withStopSignal } from "./regenerate/activity.js";
9
10
  import { createLiveReviewer } from "./review/live.js";
10
11
  import { loadSkill, readRubric } from "./skill.js";
11
12
  import { createAskUserTool, createEndQuestionsTool, createReviewTools, createWriteArtifactTool, withReviewNote } from "./tools.js";
12
- import { DECLINED, DISMISSED } from "./ask.js";
13
13
  import { createQuestioning, levelOf, questioningQuestion } from "./questioning.js";
14
- import { createSpecDiffTools } from "./spec-tools.js";
15
- const CHANGE_PLAIN = "change_plain";
16
14
  /** The conversation's tools a skill acts on the work loop with - never pi built-ins. */
17
15
  const LOOP_TOOLS = ["regenerate", "drift", "halt", "conform"];
18
16
  /** How much of what the agent said before a question is shown with it: its end, where the brief is. */
@@ -78,41 +76,20 @@ async function runStoppable(opts) {
78
76
  const startQuestioning = (level, from) => (questioning = createQuestioning({ level: levelOf(level), phases: skill.questioning, from, onChange: keepQuestioning }));
79
77
  if (capsQuestions && resumed?.questioning !== undefined)
80
78
  startQuestioning(resumed.questioning.level, resumed.questioning);
81
- // The step running now, and whether each of its answers is a spec change: then the next question waits until the last
82
- // answer is written, and a change the agent decides itself needs no answer before it.
83
- let currentStep = "";
84
- const diffPerAnswer = () => skill.diffPerAnswer.includes(currentStep);
85
- const holdsQuestions = capsQuestions || (skill.diffPerAnswer.length > 0 && opts.askUser !== undefined);
86
79
  const questions = {
87
- refusal: (confirmsPhase) => diffPerAnswer() && diffs?.pace.owed() === true
88
- ? "This question was not asked: the last answer is not in the spec yet. Every answer in this phase is a spec " +
89
- "change, built at once - write it with change_plain first, then ask."
90
- : questioning?.refusal(confirmsPhase),
80
+ refusal: (confirmsPhase) => questioning?.refusal(confirmsPhase),
91
81
  answered: (confirmsPhase) => questioning?.answered(confirmsPhase),
92
82
  end: () => questioning?.end() ?? "No questioning level was chosen: ask what the phase needs.",
93
83
  };
94
- // A skill whose unit of work is a spec change gets change_plain: the change is applied
95
- // and its build queued in one step.
96
- const diffs = opts.renderQueue !== undefined && skill.allowedTools.includes(CHANGE_PLAIN)
97
- ? createSpecDiffTools({
98
- loop: opts.renderQueue,
99
- cwd: opts.cwd,
100
- liveReview: liveProxy,
101
- paced: skill.paced,
102
- free: diffPerAnswer,
103
- })
104
- : undefined;
105
84
  // What the agent says between its questions - a brief to confirm, a plan - reaches the person only with
106
85
  // the next question: the session it talks in is its own, and nobody reads it.
107
86
  let said = "";
108
87
  /** A new message of the agent's has started, and has said nothing yet. */
109
88
  let saidFresh = false;
110
89
  if (opts.askUser !== undefined) {
111
- customTools.push(createAskUserTool(opts.askUser, (answer, confirmsPhase) => {
90
+ customTools.push(createAskUserTool(opts.askUser, () => {
112
91
  said = "";
113
- // A phase's confirmation, or a question dismissed, owes the spec nothing.
114
- diffs?.pace.answered(!confirmsPhase && answer !== DISMISSED && answer !== DECLINED);
115
- }, () => said, holdsQuestions ? questions : undefined));
92
+ }, () => said, capsQuestions ? questions : undefined));
116
93
  if (capsQuestions)
117
94
  customTools.push(createEndQuestionsTool(questions));
118
95
  }
@@ -125,14 +102,15 @@ async function runStoppable(opts) {
125
102
  customTools.push(tool);
126
103
  }
127
104
  }
128
- if (diffs !== undefined)
129
- customTools.push(...diffs.tools);
130
105
  customTools.push(...(opts.sharedTools ?? []));
131
- // Its write and edit reach the project's ***plain only - not the code, a release, or what an app it started writes.
106
+ // Its write and edit reach the project's ***plain only - not the code, a launch, or what an app it started writes.
132
107
  customTools.push(...plainWriteTools(opts.cwd).filter((tool) => skill.allowedTools.includes(tool.name)));
108
+ // Its shell runs neither turri nor another pi again: that would build outside the session's work loop.
109
+ if (skill.allowedTools.includes("bash"))
110
+ customTools.push(skillShell(opts.cwd));
133
111
  const names = customTools.map((tool) => tool.name);
134
112
  // Tools this harness provides are never pi built-ins, even when it did not provide them.
135
- const builtins = skill.allowedTools.filter((t) => !names.includes(t) && t !== CHANGE_PLAIN && !LOOP_TOOLS.includes(t));
113
+ const builtins = skill.allowedTools.filter((t) => !names.includes(t) && !LOOP_TOOLS.includes(t));
136
114
  const executor = await createExecutor({
137
115
  cwd: opts.cwd,
138
116
  customTools,
@@ -203,11 +181,6 @@ async function runStoppable(opts) {
203
181
  });
204
182
  manifest.sessionFile = executor.sessionFile;
205
183
  writeManifest(runDir, manifest);
206
- // Built renders were lost with the process; queue what the specs hold that is not built.
207
- if (resumed !== undefined && opts.renderQueue !== undefined) {
208
- for (const file of plainFilesIn(opts.cwd))
209
- void opts.renderQueue.bringUp(file, { specChange: true }).catch(() => undefined);
210
- }
211
184
  if (liveStep !== undefined && liveProxy !== undefined) {
212
185
  const continuous = liveStep.gate.continuous;
213
186
  holder.reviewer = createLiveReviewer({
@@ -243,7 +216,6 @@ async function runStoppable(opts) {
243
216
  writeManifest(runDir, manifest);
244
217
  },
245
218
  beforeStep: async (step) => {
246
- currentStep = step;
247
219
  if (!capsQuestions)
248
220
  return;
249
221
  // The first question of the first phase is the harness's: how many the capped phases may ask.
@@ -295,17 +267,6 @@ function writeManifest(runDir, manifest) {
295
267
  manifest.updatedAt = new Date().toISOString();
296
268
  writeFileSync(join(runDir, MANIFEST), JSON.stringify(manifest, null, 2));
297
269
  }
298
- /** The .plain files at the top of a project. */
299
- function plainFilesIn(dir) {
300
- try {
301
- return readdirSync(dir)
302
- .filter((name) => name.endsWith(".plain"))
303
- .map((name) => join(dir, name));
304
- }
305
- catch {
306
- return [];
307
- }
308
- }
309
270
  /** Whether there is a run of this skill here that was interrupted, and could be resumed. */
310
271
  export function interruptedRun(runDir, skillName) {
311
272
  const manifest = readManifest(resolve(runDir));
package/dist/graph.js CHANGED
@@ -49,13 +49,11 @@ export function endsOnQuestion(reply) {
49
49
  return /\?$/.test(last.replace(/[*_`)\]"'\s]+$/, ""));
50
50
  }
51
51
  /** Sent when a step's turn ended on a question in its reply: no one reads it, and the step is not done. */
52
- function unansweredQuestionPrompt(skill, step) {
52
+ function unansweredQuestionPrompt(step) {
53
53
  return [
54
54
  "Your turn ended on a question in your reply. No one reads it: the person sees only what ask_user asks, and",
55
55
  `the step ends when your turn does - so step '${step.name}' would end here, not done.`,
56
- skill.paced
57
- ? "If it is truly the person's to decide, ask it with ask_user. Otherwise decide it yourself."
58
- : `'${skill.name}' asks the person nothing more: decide it yourself, as a careful engineer would, and say what you chose.`,
56
+ "If it is truly the person's to decide, ask it with ask_user. Otherwise decide it yourself.",
59
57
  `Then carry on with step '${step.name}' until all of it is done, and end your turn only then.`,
60
58
  ].join("\n");
61
59
  }
@@ -124,7 +122,7 @@ export function compileSkill(opts) {
124
122
  // A question in the reply reaches no one - the person sees only what ask_user asks - and the step ends with the
125
123
  // turn: back to the work, so a step is not left half done on a question nobody answers.
126
124
  for (let nudges = 0; nudges < QUESTION_NUDGES && endsOnQuestion(reply); nudges += 1) {
127
- reply = await ask(opts.executor, unansweredQuestionPrompt(skill, step));
125
+ reply = await ask(opts.executor, unansweredQuestionPrompt(step));
128
126
  }
129
127
  let artifact = "";
130
128
  try {
@@ -1,7 +1,6 @@
1
1
  import { type AgentSession, type ExtensionFactory, type ExtensionUIContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { AskUserIO } from "./ask.ts";
3
3
  import { type ChatInfo, type TurriHost } from "./chats.ts";
4
- import { type EvaluateOutcome } from "./advisor-chat.ts";
5
4
  import type { JobRegistry } from "./regenerate/jobs.ts";
6
5
  import type { WorkLoop } from "./regenerate/loop.ts";
7
6
  import type { Notice, NoticeAnswer } from "./notice.ts";
@@ -52,7 +51,7 @@ export interface Turri {
52
51
  /**
53
52
  * ctrl+c in a chat, as the terminal has it: what the chat is doing stopped - its turn, a skill or a tool in it, a `!`
54
53
  * command, a compaction - and nothing in the others (`stopped`). In a chat doing nothing the session ends - every
55
- * chat let go and what activate started stopped, as `dispose` does - for the host to close what showed it (`ended`).
54
+ * chat let go and what launches started stopped, as `dispose` does - for the host to close what showed it (`ended`).
56
55
  * A second interrupt straight after one that stopped something does nothing (`ignored`); `missing` for a chat not open.
57
56
  */
58
57
  interrupt(id: string): Promise<"stopped" | "ignored" | "ended" | "missing">;
@@ -69,9 +68,10 @@ export interface Turri {
69
68
  */
70
69
  notices(): Notice[];
71
70
  /**
72
- * The sentinel asked to check functional specs in a module's release - `funcIds` each `module:func-id`, of the module or
73
- * of any module its requires chain builds on (a bare func-id is the module's own) - in the module's release, as it tests a release after a pulse: the module's own codebase's last
74
- * commit, which holds every module its chain builds on, released first unless that is what runs. Queued behind the
71
+ * The sentinel asked to check functional specs in what is launched of a module - `funcIds` each `module:func-id`, of the
72
+ * module or of any module its requires chain builds on (a bare func-id is the module's own) - as it tests a launch after a
73
+ * pulse: the module's own codebase's code, which holds every module its chain builds on. Nothing launched of it, the
74
+ * check ends unchecked: the sentinel launches nothing. Queued behind the
75
75
  * sentinel's work, in a conversation of its own. Returns the check's id - its notices and its conclusion carry it - or
76
76
  * why it was refused: the sentinel off or not started this session, a module not there or that does not parse, a
77
77
  * module outside its chain, a func-id a module does not have, one not built in its codebase as its ***plain has it now.
@@ -82,27 +82,17 @@ export interface Turri {
82
82
  refused: string;
83
83
  };
84
84
  /**
85
- * The test advisor asked to evaluate functional specs, as the chat's `evaluate_tests` does - for a host's own way in,
86
- * a button on a functional spec: `module:func-id`s, or func-ids of `plainFile`'s module, even a text judged already and
87
- * whatever `test-advisor` says, `reason` given to it as context. It returns at once; each verdict comes to the chat the
88
- * person looks at, as the advisor's verdicts do - a yes starting a turn that writes the scenarios, a no a line.
89
- */
90
- evaluateTests(funcIds: string[], options?: {
91
- plainFile?: string;
92
- reason?: string;
93
- }): EvaluateOutcome;
94
- /**
95
- * Every value /turri-config offers for a setting after `typed` - what its completions compute, in their order, but
85
+ * Every value /settings offers for a setting after `typed` - what its completions compute, in their order, but
96
86
  * whole: uncapped, and without "unset", which a host draws itself; the values alone, not `<key> <value>`. A model
97
87
  * setting's are every model of every provider signed in to, from the model registry the chats use - and after a colon,
98
88
  * `harness-model amazon-bedrock/global.anthropic.claude-opus-5-5:`, that model's thinking levels. An unknown key gives none.
99
89
  */
100
90
  settingChoices(key: string, typed?: string): string[];
101
91
  /**
102
- * Conformance tests turned on, as the chat's turn_on_conformance_tests does: `conformance-tests: true` written where
103
- * the module's value comes from - its stack's `config.turri.<stack>.yaml` when that sets the key, else
104
- * `config.turri.yaml` - and every open chat's tools switched (conform and evaluate_tests in, turn_on_conformance_tests
105
- * out), the test advisor starting at its next look. `plainFile`, absolute or from the project, picks the module; omitted,
92
+ * Conformance tests turned on, as /conform does before it tests - the person's decision, a host's switch for it:
93
+ * `conformance-tests: true` written where the module's value comes from - its own `config.turri.<module>.yaml`, or a required module's, when
94
+ * that sets the key, else `config.turri.yaml` - the chats' conform no longer refused. `plainFile`, absolute or from the
95
+ * project, picks the module; omitted,
106
96
  * the project's. Returns the file written, from the project. Starts no conformance pulse: that is `conform`'s.
107
97
  */
108
98
  turnOnConformanceTests(plainFile?: string): string;
@@ -115,7 +105,7 @@ export interface Turri {
115
105
  answer(id: string, answer: NoticeAnswer): Promise<"done" | "dismissed" | "ignored" | "refused" | "missing" | "over">;
116
106
  /** Told when a chat is opened, closed, renamed, or starts or stops working. */
117
107
  onChats(listener: (chats: ChatInfo[]) => void): () => void;
118
- /** Every chat let go, and what activate started stopped. */
108
+ /** Every chat let go, and what launches started stopped. */
119
109
  dispose(): Promise<void>;
120
110
  }
121
111
  /** turri's session in a host, in the process's working folder - the project's. */
@@ -1,16 +1,15 @@
1
1
  import { createAgentSession, DefaultResourceLoader, getAgentDir, SessionManager } from "@earendil-works/pi-coding-agent";
2
2
  import { lastRun } from "./chat-records.js";
3
3
  import { interruptChat } from "./chats.js";
4
- import { evaluateTests } from "./advisor-chat.js";
5
- import { reachable, ruleNames, settingCandidates } from "./config-command.js";
4
+ import { reachable, ruleNames, settingCandidates } from "./settings.js";
6
5
  import { settingOf } from "./config-edit.js";
7
- import { createTurriCore, sessionAdvisor, sessionLoop, turnOnConformance } from "./extension.js";
8
- import { stopDeployed } from "./regenerate/release.js";
6
+ import { createTurriCore, sessionLoop, turnOnConformance } from "./extension.js";
7
+ import { stopLaunched } from "./regenerate/launch.js";
9
8
  import { prepareCheck } from "./sentinel-check.js";
10
9
  /** turri's session in a host, in the process's working folder - the project's. */
11
10
  export async function createTurri(options = {}) {
12
11
  const { dialogs, uiContext, extensions = [], agentDir = getAgentDir(), sessionDir, restore, ...host } = options;
13
- const core = createTurriCore(host, { persist: true, advisor: true, ...(dialogs !== undefined ? { dialogs } : {}) });
12
+ const core = createTurriCore(host, { persist: true, ...(dialogs !== undefined ? { dialogs } : {}) });
14
13
  const cwd = core.cwd;
15
14
  core.setDriver({
16
15
  async create(chat, sessionFile) {
@@ -44,7 +43,7 @@ export async function createTurri(options = {}) {
44
43
  let lastStop = 0;
45
44
  const dispose = async () => {
46
45
  await core.dispose();
47
- await stopDeployed();
46
+ await stopLaunched();
48
47
  };
49
48
  return {
50
49
  jobs: core.jobs,
@@ -73,14 +72,13 @@ export async function createTurri(options = {}) {
73
72
  decline: async (id) => core.decline(id),
74
73
  notices: () => core.notices(),
75
74
  check: (request) => core.check(() => prepareCheck(cwd, request)),
76
- evaluateTests: (funcIds, options) => evaluateTests(cwd, sessionAdvisor(core), funcIds, options),
77
75
  turnOnConformanceTests: (plainFile) => turnOnConformance(core, plainFile),
78
76
  settingChoices: (key, typed = "") => {
79
77
  const setting = settingOf(key, ruleNames());
80
78
  if (setting === undefined)
81
79
  return [];
82
80
  // The models from a chat's own context - the one shown, else any open: the registry the chats use, whether or not one
83
- // has run /turri-config.
81
+ // has run /settings.
84
82
  const context = () => {
85
83
  const shown = core.shownChat();
86
84
  const states = [shown, ...core.chats().map((chat) => core.session(chat.id)).map((session) => (session !== undefined ? core.chatOfSession(session) : undefined))];
package/dist/host.d.ts CHANGED
@@ -6,12 +6,14 @@
6
6
  */
7
7
  export { createTurri, type Turri, type TurriOptions } from "./host-session.ts";
8
8
  export { MAX_CHATS, type ChatInfo, type ChatStatus, type TurriHost } from "./chats.ts";
9
+ export type { Launch, LaunchCause, LaunchStatus } from "./launch-track.ts";
10
+ export type { ConfigLine, ConfigLineKind } from "./config.ts";
9
11
  export { SENTINEL, SENTINEL_START, type Conclusion, type Notice, type NoticeAction, type NoticeAnswer, type NoticeSeverity, type NoticeState, type SentinelCheck } from "./notice.ts";
10
12
  export type { CheckRequest } from "./sentinel-check.ts";
11
13
  export type { AskUserIO } from "./ask.ts";
12
14
  /** pi itself, as turri is built against it: a host's own extensions and UI are made with this one, not another copy. */
13
15
  export * as pi from "@earendil-works/pi-coding-agent";
14
- export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, stacksOf, testDirOf, type ProjectConfig } from "./config.ts";
16
+ export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, moduleConfigsOf, testDirOf, type ProjectConfig } from "./config.ts";
15
17
  export { MODULES_DIR, projectDirOf, resolveTemplateDirs } from "./regenerate/paths.ts";
16
18
  export { configSettings, currentValue, EFFECT_TEXT, overriddenBy, readConfigText, type Effect, type Setting, type SettingKind } from "./config-edit.ts";
17
19
  export { bedrockRegionFor, type BedrockRegion, type BedrockRegionSource } from "./bedrock-region.ts";
@@ -28,13 +30,11 @@ export { conceptsOf, type ModuleConcept } from "./plain/module-concepts.ts";
28
30
  export { conceptBeingTyped, findConcepts } from "./plain/concepts.ts";
29
31
  export { plainGraph, type PlainConceptNode, type PlainGraph, type PlainItemNode, type PlainLink, type PlainModuleNode, type PlainScenario, type PlainSection, type PlainTestPlainFileNode } from "./plain/graph.ts";
30
32
  export { isStack, STDLIB_KINDS, stdlibTemplates, type StdlibKind, type StdlibTemplate } from "./stdlib.ts";
31
- export { createWorkLoop, describeModules, functionalityCompletion, promptOf, type DriftReport, type ModuleStatus, type WorkLoop } from "./regenerate/loop.ts";
33
+ export { createWorkLoop, describeModules, functionalityCompletion, type DriftReport, type ModuleStatus, type PlannedPulse, type WorkLoop } from "./regenerate/loop.ts";
32
34
  export { projectStanding, type ModuleStanding, type StandingOptions } from "./regenerate/standing.ts";
33
35
  export { requiresOrder } from "./regenerate/requires.ts";
34
36
  export { createJobRegistry, defaultParallelJobs, type Job, type JobRegistry, type PulseCases, type PulseSpec } from "./regenerate/jobs.ts";
35
37
  export { describeTurnIncident, onModelEvent, type TranscriptEntry } from "./regenerate/activity.ts";
36
38
  export { sweepOrphanedGroups } from "./regenerate/shell.ts";
37
- export { readAdvisor, textHash, type AdvisorEntry, type AdvisorFile, type AdvisorReport, type AdvisorState } from "./regenerate/advisor-records.ts";
38
- export type { EvaluateOutcome } from "./advisor-chat.ts";
39
39
  export { ledgerDir, onLedgerEvent, readLedger, type AgentRef, type LedgerEntry, type LedgerEvent, type LedgerKind, type LedgerQuery } from "./regenerate/ledger.ts";
40
40
  export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews, type PulseView, type RunView } from "./regenerate/ledger-view.ts";
package/dist/host.js CHANGED
@@ -12,10 +12,10 @@ export { SENTINEL, SENTINEL_START } from "./notice.js";
12
12
  /** pi itself, as turri is built against it: a host's own extensions and UI are made with this one, not another copy. */
13
13
  export * as pi from "@earendil-works/pi-coding-agent";
14
14
  // The project and its settings.
15
- export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, stacksOf, testDirOf } from "./config.js";
15
+ export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, moduleConfigsOf, testDirOf } from "./config.js";
16
16
  export { MODULES_DIR, projectDirOf, resolveTemplateDirs } from "./regenerate/paths.js";
17
- // Every setting of config.turri.yaml as /turri-config knows it - what it takes, what it is unset, when a change takes
18
- // effect - and what the file has now: for a host that shows them all, changing each through /turri-config.
17
+ // Every setting of config.turri.yaml as /settings knows it - what it takes, what it is unset, when a change takes
18
+ // effect - and what the file has now: for a host that shows them all, changing each through /settings.
19
19
  export { configSettings, currentValue, EFFECT_TEXT, overriddenBy, readConfigText } from "./config-edit.js";
20
20
  // The AWS region a project's Bedrock models are called in, and where it comes from - what turri sets itself, as a host's
21
21
  // session starts, when the models need one and the person set none.
@@ -42,15 +42,12 @@ export { plainGraph } from "./plain/graph.js";
42
42
  // The standard library: every template, what it is, what it imports, and its conformance template or stack.
43
43
  export { isStack, STDLIB_KINDS, stdlibTemplates } from "./stdlib.js";
44
44
  // The work: what is built, what is left, and the jobs that build it.
45
- export { createWorkLoop, describeModules, functionalityCompletion, promptOf } from "./regenerate/loop.js";
45
+ export { createWorkLoop, describeModules, functionalityCompletion } from "./regenerate/loop.js";
46
46
  export { projectStanding } from "./regenerate/standing.js";
47
47
  export { requiresOrder } from "./regenerate/requires.js";
48
48
  export { createJobRegistry, defaultParallelJobs } from "./regenerate/jobs.js";
49
49
  export { describeTurnIncident, onModelEvent } from "./regenerate/activity.js";
50
50
  export { sweepOrphanedGroups } from "./regenerate/shell.js";
51
- // The test advisor: what it made of each functional spec of a module - pending, yes, no or failed, with its report - by
52
- // func-id, an entry current while its hash is textHash of the functional spec's text; and what an evaluation came to.
53
- export { readAdvisor, textHash } from "./regenerate/advisor-records.js";
54
51
  // What turri did, as facts: the ledger, heard live and read back - this session's pulses and every earlier one's.
55
52
  export { ledgerDir, onLedgerEvent, readLedger } from "./regenerate/ledger.js";
56
53
  export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews } from "./regenerate/ledger-view.js";
package/dist/identity.js CHANGED
@@ -49,13 +49,13 @@ const IDENTITY_BEFORE = [
49
49
  "they are talking to turri. What they should ask for, they ask you for, here.",
50
50
  "",
51
51
  "The person may have several chats with you open on this project at once, this one among them. What regenerates is",
52
- "the same in every chat: the pulses and their plan, steering, the engine's coding model and what activate started -",
52
+ "the same in every chat: the pulses and their plan, steering, the engine's coding model and what was launched -",
53
53
  "pulses lists every pulse, whichever chat asked for it. What was said in another chat is not in this one: when the",
54
54
  "person speaks of it, ask.",
55
55
  "",
56
56
  "Pulses regenerate in the background and never hold the conversation: while they run, you and the person go on -",
57
57
  "shaping the ***plain and writing its next change, answering their questions, trying what has landed or was",
58
- "released. When a pulse starts, say so in a way that makes it plain they need not wait for it to finish; never tell",
58
+ "launched. When a pulse starts, say so in a way that makes it plain they need not wait for it to finish; never tell",
59
59
  "them to wait for one, and never stop to wait for one yourself. Changing the ***plain while a pulse runs is safe: a",
60
60
  "change inside what the running pulse regenerates steers it, and the rest is planned again around it - the next",
61
61
  "change never waits for the last to land.",
@@ -67,7 +67,6 @@ const IDENTITY_BEFORE = [
67
67
  " allow-to-stop-jobs in config.turri.yaml are about pulses. \"Job\" in what you read is a pulse; say pulse.",
68
68
  ];
69
69
  const IDENTITY_AFTER = [
70
- "- mutate, in a skill's activity, is change_plain: a spec change written and regenerated in one step.",
71
70
  "- Regenerate is the word for what you do to the code: never grow, grew or grown - older text, a tool's description",
72
71
  " or a report may still say it, and means regenerate.",
73
72
  ];
@@ -111,9 +111,8 @@ export declare const DEFAULTS: {
111
111
  readonly review: false;
112
112
  readonly mutationTesting: true;
113
113
  readonly allowToStopJobs: true;
114
- readonly releaseAfterPulse: true;
114
+ readonly launchAfterPulse: true;
115
115
  readonly sentinel: "ask";
116
- readonly testAdvisor: true;
117
116
  readonly testingScriptsRunOn: "in-place";
118
117
  readonly turnLimit: 120;
119
118
  readonly compactAt: 100000;
@@ -227,9 +227,8 @@ export const DEFAULTS = {
227
227
  review: false,
228
228
  mutationTesting: true,
229
229
  allowToStopJobs: true,
230
- releaseAfterPulse: true,
230
+ launchAfterPulse: true,
231
231
  sentinel: "ask",
232
- testAdvisor: true,
233
232
  testingScriptsRunOn: "in-place",
234
233
  turnLimit: 120,
235
234
  compactAt: 100000,
@@ -257,8 +256,8 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
257
256
  "# one to use it. docs/config.md has them all.",
258
257
  "",
259
258
  "# Whether functional specs are conformance tested: black-box tests of the built software against the scenarios of",
260
- "# their test plain files, run with the whole suite as more lands. false: none - no scenarios written or tested, the",
261
- "# test advisor off. Asking for them in the chat turns them on, or true here.",
259
+ "# their test plain files, run with the whole suite as more lands. They make each change take about twice as long.",
260
+ "# false: none - no scenarios written or tested. /conform in the chat turns them on, or true here.",
262
261
  "conformance-tests: false",
263
262
  "",
264
263
  "# Whether the code and its tests are reviewed once they pass - two reviews at most, the second weighed by the arbiter.",
@@ -271,19 +270,14 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
271
270
  "# Whether turri stops a running pulse the spec has moved on from. false: it lands, the change regenerated on top.",
272
271
  `allow-to-stop-jobs: ${DEFAULTS.allowToStopJobs}`,
273
272
  "",
274
- "# Whether every pulse that lands code releases it, as the project's release guidance says.",
275
- `release-after-pulse: ${DEFAULTS.releaseAfterPulse}`,
273
+ "# Whether every pulse that lands code is launched, in the background, as the project's launch guidance says.",
274
+ `launch-after-pulse: ${DEFAULTS.launchAfterPulse}`,
276
275
  "",
277
- "# Whether a chat of its own, the sentinel, checks every pulse that finishes - and, with release-after-pulse, tests what",
278
- "# was released - and tells you in the chat you are in when something needs you. ask: you are asked, with what it does,",
276
+ "# Whether a chat of its own, the sentinel, checks every pulse that finishes - and, with launch-after-pulse, tests what",
277
+ "# was launched - and tells you in the chat you are in when something needs you. ask: you are asked, with what it does,",
279
278
  "# before it first opens in a session; true: it opens without asking; false: none.",
280
279
  `sentinel: ${DEFAULTS.sentinel}`,
281
280
  "",
282
- "# Whether turri checks, in the background, each new or changed functional spec with no scenarios - could it fail",
283
- "# silently, be read two ways, cost a lot when wrong - and when it needs testing, writes its test reqs, conformance",
284
- "# testing script and scenarios itself. false: only the scenarios you ask for are written.",
285
- `test-advisor: ${DEFAULTS.testAdvisor}`,
286
- "",
287
281
  "# What the testing scripts run on: in-place - the code itself; copy - a fresh copy of it.",
288
282
  `testing-scripts-run-on: ${DEFAULTS.testingScriptsRunOn}`,
289
283
  "",
@@ -354,10 +348,10 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
354
348
  "# models:",
355
349
  `# default: ${coding}`,
356
350
  `${column(`# chat: ${harness}`, 72)}# the conversation - as harness-model, which it wins over`,
357
- `${column(`# sentinel: ${harness}`, 72)}# the sentinel: checks every finished pulse and tests the release`,
351
+ `${column(`# sentinel: ${harness}`, 72)}# the sentinel: checks every finished pulse and tests what is launched`,
358
352
  role("planner", harness, "cuts the work into pulses"),
359
353
  role("diagnosis", harness, "looks into a pulse that failed for good"),
360
- role("release", coding, "turri release's agent, and release-after-pulse's"),
354
+ role("launch", coding, "the launch agent: turri launch's, the chat's and launch-after-pulse's"),
361
355
  `${column(`# coding: { model: ${coding}, thinking: ${ROLE_THINKING.coding}, turn-limit: 180 }`, 72)}# as coding-model, which it wins over`,
362
356
  role("conformance", coding, "writes the conformance tests"),
363
357
  role("explorer", coding, "explores the code for a conformance run"),
@@ -366,7 +360,6 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
366
360
  role("judge", strong, "judges a failing conformance run - as judge-model, which it wins over"),
367
361
  role("arbiter", strong, "weighs a second review"),
368
362
  role("debugger", strong, "a fresh look at unit tests that keep failing the same way"),
369
- role("advisor", coding, "the test advisor: which functional specs need scenarios"),
370
363
  "",
371
364
  ].join("\n");
372
365
  }
@@ -598,7 +591,7 @@ export async function initConfig(dir, options = {}) {
598
591
  return { written: false, message: chosen.problem };
599
592
  const { vendor, bedrock, models, given } = chosen;
600
593
  const folder = resolve(dir);
601
- // The old stacks' files, config.<stack>.yaml, copied to their new names; config.turri.yaml is written below.
594
+ // The modules' old files, config.<module>.yaml, copied to their new names; config.turri.yaml is written below.
602
595
  adoptLegacyConfig(folder, { projectFile: false });
603
596
  const path = join(folder, CONFIG_FILE);
604
597
  const existing = existsSync(path) && options.force !== true;
@@ -5,7 +5,7 @@ import { ModelRegistry, ModelRuntime } from "@earendil-works/pi-coding-agent";
5
5
  *
6
6
  * In a chat, pi loads the person's installed pi packages itself, and turri's agents take the providers from the
7
7
  * conversation's model registry (pi.ts `inheritProviders`). A command with no conversation - `turri regenerate`,
8
- * `turri change-plain`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
8
+ * `turri conform`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
9
9
  * process, and only the providers they register are kept. turri's own extension, when an older turri installed it into
10
10
  * every pi, is loaded as nothing meanwhile (`LOADING_PROVIDERS`): it would start a session of its own.
11
11
  */
@@ -6,7 +6,7 @@ import { createAgentSessionServices, getAgentDir, ModelRegistry, ModelRuntime }
6
6
  *
7
7
  * In a chat, pi loads the person's installed pi packages itself, and turri's agents take the providers from the
8
8
  * conversation's model registry (pi.ts `inheritProviders`). A command with no conversation - `turri regenerate`,
9
- * `turri change-plain`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
9
+ * `turri conform`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
10
10
  * process, and only the providers they register are kept. turri's own extension, when an older turri installed it into
11
11
  * every pi, is loaded as nothing meanwhile (`LOADING_PROVIDERS`): it would start a session of its own.
12
12
  */
@@ -0,0 +1,41 @@
1
+ import { type ToolDefinition } from "@earendil-works/pi-coding-agent";
2
+ import { type ExportedCode } from "./regenerate/launch.ts";
3
+ import type { Launch, LaunchOutcome } from "./launch-track.ts";
4
+ /**
5
+ * The launch agent: every launch's - the chat's launch tool, a pulse that landed under `launch-after-pulse`, and
6
+ * `turri launch`. The harness has put the commit's code in dist/<module> already; the agent finds out how it runs - or
7
+ * the project's guidance for launching it, which it follows from the host codebase - installs what it needs, starts what
8
+ * keeps running with activate, and says how it went with submit_launch. It asks no one.
9
+ */
10
+ type AnyTool = ToolDefinition<any, any, any>;
11
+ /**
12
+ * The person's own shell, in the host codebase: it installs what the launch needs into the project, and runs it. It
13
+ * changes nothing of the machine's - no toolchain installed, no system setting changed: a command that would is refused.
14
+ */
15
+ export declare function launchShell(dir: string): AnyTool;
16
+ /**
17
+ * What the project says of itself, for the agent to find launch guidance in: its AGENTS.md and its skills
18
+ * (`.agents/skills`, `.pi/skills`, `.claude/skills`), where turri runs and in the host codebase - once each, whole.
19
+ */
20
+ export declare function projectNotes(dirs: string[]): string[];
21
+ /**
22
+ * activate: start what keeps running - a backend, a frontend's dev server - owned by the harness: in its own process
23
+ * group, its output kept, stopped on the codebase's next launch, on /halt and when turri exits.
24
+ */
25
+ export declare function activateTool(launch: Pick<Launch, "codebase" | "plainFile" | "hostDir">, code: Pick<ExportedCode, "dir">): AnyTool;
26
+ /** What the agent does once the code is in dist: find guidance and follow it from the host, or start it from dist. */
27
+ export declare function launchGuide(code: ExportedCode, hostDir: string): string;
28
+ export interface LaunchAgentInput {
29
+ launch: Launch;
30
+ /** Its code, exported to dist already. */
31
+ code: ExportedCode;
32
+ /** Where turri runs. */
33
+ cwd: string;
34
+ /** The agent's model: the coding model of the codebase. */
35
+ model?: string;
36
+ signal?: AbortSignal;
37
+ onDelta?: (delta: string) => void;
38
+ }
39
+ /** Run the launch agent to its end: how it went, as it submitted it - or, never submitted, its last words as a failure. */
40
+ export declare function runLaunchAgent(input: LaunchAgentInput): Promise<LaunchOutcome>;
41
+ export {};