@turri-dev/cli 0.2.4-next.8422d0f → 0.2.4-next.efe96fe

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 (143) hide show
  1. package/README.md +5 -6
  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/chats.d.ts +2 -12
  9. package/dist/chats.js +3 -26
  10. package/dist/cli.js +11 -30
  11. package/dist/config-edit.d.ts +20 -8
  12. package/dist/config-edit.js +29 -23
  13. package/dist/config.d.ts +62 -71
  14. package/dist/config.js +170 -125
  15. package/dist/conform-cli.js +14 -3
  16. package/dist/conformance-switch.d.ts +13 -22
  17. package/dist/conformance-switch.js +37 -59
  18. package/dist/drift-cli.js +1 -1
  19. package/dist/extension.d.ts +8 -10
  20. package/dist/extension.js +257 -429
  21. package/dist/genome.js +9 -48
  22. package/dist/graph.js +3 -5
  23. package/dist/host-session.d.ts +5 -16
  24. package/dist/host-session.js +4 -6
  25. package/dist/host.d.ts +2 -4
  26. package/dist/host.js +4 -7
  27. package/dist/identity.js +0 -1
  28. package/dist/init-config.d.ts +0 -1
  29. package/dist/init-config.js +3 -10
  30. package/dist/installed-providers.d.ts +1 -1
  31. package/dist/installed-providers.js +1 -1
  32. package/dist/loop-cli.d.ts +4 -3
  33. package/dist/loop-cli.js +13 -11
  34. package/dist/loop-tools.d.ts +37 -18
  35. package/dist/loop-tools.js +118 -58
  36. package/dist/new-project.js +2 -2
  37. package/dist/parse-cli.js +2 -2
  38. package/dist/pi-launch.js +4 -1
  39. package/dist/pi-settings.d.ts +4 -0
  40. package/dist/pi-settings.js +39 -0
  41. package/dist/pi.js +12 -9
  42. package/dist/plain/check.d.ts +2 -9
  43. package/dist/plain/check.js +6 -39
  44. package/dist/plain-files.js +4 -4
  45. package/dist/regenerate/activity.d.ts +0 -7
  46. package/dist/regenerate/activity.js +2 -20
  47. package/dist/regenerate/agent-env.d.ts +1 -1
  48. package/dist/regenerate/agent-env.js +3 -3
  49. package/dist/regenerate/agent-shell.js +5 -3
  50. package/dist/regenerate/audit.js +9 -0
  51. package/dist/regenerate/base-folder.d.ts +2 -2
  52. package/dist/regenerate/base-folder.js +1 -1
  53. package/dist/regenerate/cases.js +7 -0
  54. package/dist/regenerate/chunk-plan.d.ts +5 -0
  55. package/dist/regenerate/chunk-plan.js +16 -1
  56. package/dist/regenerate/drift.d.ts +4 -0
  57. package/dist/regenerate/drift.js +26 -6
  58. package/dist/regenerate/failure-reports.d.ts +28 -0
  59. package/dist/regenerate/failure-reports.js +79 -0
  60. package/dist/regenerate/job-panel.js +3 -1
  61. package/dist/regenerate/jobs-tree.js +1 -1
  62. package/dist/regenerate/jobs.d.ts +4 -2
  63. package/dist/regenerate/jobs.js +14 -10
  64. package/dist/regenerate/ledger-view.d.ts +11 -24
  65. package/dist/regenerate/ledger-view.js +14 -60
  66. package/dist/regenerate/ledger.d.ts +2 -15
  67. package/dist/regenerate/ledger.js +1 -1
  68. package/dist/regenerate/loop.d.ts +48 -62
  69. package/dist/regenerate/loop.js +296 -131
  70. package/dist/regenerate/model-names.d.ts +33 -0
  71. package/dist/regenerate/{engine.js → model-names.js} +2 -28
  72. package/dist/regenerate/paths.d.ts +1 -1
  73. package/dist/regenerate/paths.js +2 -2
  74. package/dist/regenerate/records.d.ts +11 -0
  75. package/dist/regenerate/records.js +15 -0
  76. package/dist/regenerate/regenerate.d.ts +0 -2
  77. package/dist/regenerate/regenerate.js +4 -15
  78. package/dist/regenerate/renames.js +4 -4
  79. package/dist/regenerate/requires.d.ts +7 -0
  80. package/dist/regenerate/requires.js +24 -18
  81. package/dist/regenerate/scripts-being-written.d.ts +4 -4
  82. package/dist/regenerate/scripts-being-written.js +3 -3
  83. package/dist/regenerate/spec-map.js +3 -3
  84. package/dist/regenerate/standing.js +1 -1
  85. package/dist/regenerate/submit-work.d.ts +2 -0
  86. package/dist/regenerate/submit-work.js +8 -3
  87. package/dist/regenerate/test-scripts.d.ts +2 -1
  88. package/dist/regenerate/test-scripts.js +33 -23
  89. package/dist/regenerate/testing-steps.d.ts +16 -5
  90. package/dist/regenerate/testing-steps.js +28 -9
  91. package/dist/regenerate-cli.js +18 -9
  92. package/dist/self-invocation.d.ts +11 -0
  93. package/dist/self-invocation.js +33 -7
  94. package/dist/sentinel.js +8 -5
  95. package/dist/{config-command.d.ts → settings.d.ts} +13 -8
  96. package/dist/{config-command.js → settings.js} +155 -24
  97. package/dist/setup.d.ts +2 -2
  98. package/dist/setup.js +7 -7
  99. package/dist/skill.d.ts +0 -11
  100. package/dist/skill.js +0 -9
  101. package/dist/tools.js +2 -3
  102. package/dist/turri-versions.js +2 -1
  103. package/docs/README.md +2 -4
  104. package/docs/authoring-plain.md +3 -3
  105. package/docs/chats.md +4 -7
  106. package/docs/claude-subscription.md +2 -2
  107. package/docs/config.md +55 -45
  108. package/docs/deploy.md +1 -1
  109. package/docs/development.md +3 -4
  110. package/docs/headless.md +6 -5
  111. package/docs/hosting.md +11 -11
  112. package/docs/parser.md +3 -3
  113. package/docs/regenerating.md +27 -19
  114. package/docs/sentinel.md +6 -6
  115. package/docs/skills-and-gates.md +4 -9
  116. package/docs/using.md +20 -37
  117. package/genome/rules/project-model.md +2 -1
  118. package/genome/rules/test-plain-files.md +15 -7
  119. package/genome/rules/turri-regeneration.md +6 -9
  120. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  121. package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
  122. package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
  123. package/package.json +1 -1
  124. package/dist/advisor-chat.d.ts +0 -63
  125. package/dist/advisor-chat.js +0 -290
  126. package/dist/change-plain-cli.d.ts +0 -1
  127. package/dist/change-plain-cli.js +0 -55
  128. package/dist/ledger-cli.d.ts +0 -1
  129. package/dist/ledger-cli.js +0 -50
  130. package/dist/ledger-tools.d.ts +0 -10
  131. package/dist/ledger-tools.js +0 -64
  132. package/dist/regenerate/advisor-records.d.ts +0 -93
  133. package/dist/regenerate/advisor-records.js +0 -110
  134. package/dist/regenerate/advisor-runs.d.ts +0 -87
  135. package/dist/regenerate/advisor-runs.js +0 -327
  136. package/dist/regenerate/engine.d.ts +0 -52
  137. package/dist/regenerate/test-advisor.d.ts +0 -101
  138. package/dist/regenerate/test-advisor.js +0 -379
  139. package/dist/spec-tools.d.ts +0 -36
  140. package/dist/spec-tools.js +0 -128
  141. package/dist/stacks.d.ts +0 -13
  142. package/dist/stacks.js +0 -96
  143. package/docs/test-advisor.md +0 -110
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
106
  // Its write and edit reach the project's ***plain only - not the code, a release, 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";
@@ -82,27 +81,17 @@ export interface Turri {
82
81
  refused: string;
83
82
  };
84
83
  /**
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
84
+ * Every value /settings offers for a setting after `typed` - what its completions compute, in their order, but
96
85
  * whole: uncapped, and without "unset", which a host draws itself; the values alone, not `<key> <value>`. A model
97
86
  * setting's are every model of every provider signed in to, from the model registry the chats use - and after a colon,
98
87
  * `harness-model amazon-bedrock/global.anthropic.claude-opus-5-5:`, that model's thinking levels. An unknown key gives none.
99
88
  */
100
89
  settingChoices(key: string, typed?: string): string[];
101
90
  /**
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,
91
+ * Conformance tests turned on, as /conform does before it tests - the person's decision, a host's switch for it:
92
+ * `conformance-tests: true` written where the module's value comes from - its own `config.turri.<module>.yaml`, or a required module's, when
93
+ * that sets the key, else `config.turri.yaml` - the chats' conform no longer refused. `plainFile`, absolute or from the
94
+ * project, picks the module; omitted,
106
95
  * the project's. Returns the file written, from the project. Starts no conformance pulse: that is `conform`'s.
107
96
  */
108
97
  turnOnConformanceTests(plainFile?: string): string;
@@ -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";
6
+ import { createTurriCore, sessionLoop, turnOnConformance } from "./extension.js";
8
7
  import { stopDeployed } from "./regenerate/release.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) {
@@ -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
@@ -11,7 +11,7 @@ export type { CheckRequest } from "./sentinel-check.ts";
11
11
  export type { AskUserIO } from "./ask.ts";
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
- export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, stacksOf, testDirOf, type ProjectConfig } from "./config.ts";
14
+ export { configForSpec, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, moduleConfigsOf, testDirOf, type ProjectConfig } from "./config.ts";
15
15
  export { MODULES_DIR, projectDirOf, resolveTemplateDirs } from "./regenerate/paths.ts";
16
16
  export { configSettings, currentValue, EFFECT_TEXT, overriddenBy, readConfigText, type Effect, type Setting, type SettingKind } from "./config-edit.ts";
17
17
  export { bedrockRegionFor, type BedrockRegion, type BedrockRegionSource } from "./bedrock-region.ts";
@@ -28,13 +28,11 @@ export { conceptsOf, type ModuleConcept } from "./plain/module-concepts.ts";
28
28
  export { conceptBeingTyped, findConcepts } from "./plain/concepts.ts";
29
29
  export { plainGraph, type PlainConceptNode, type PlainGraph, type PlainItemNode, type PlainLink, type PlainModuleNode, type PlainScenario, type PlainSection, type PlainTestPlainFileNode } from "./plain/graph.ts";
30
30
  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";
31
+ export { createWorkLoop, describeModules, functionalityCompletion, type DriftReport, type ModuleStatus, type PlannedPulse, type WorkLoop } from "./regenerate/loop.ts";
32
32
  export { projectStanding, type ModuleStanding, type StandingOptions } from "./regenerate/standing.ts";
33
33
  export { requiresOrder } from "./regenerate/requires.ts";
34
34
  export { createJobRegistry, defaultParallelJobs, type Job, type JobRegistry, type PulseCases, type PulseSpec } from "./regenerate/jobs.ts";
35
35
  export { describeTurnIncident, onModelEvent, type TranscriptEntry } from "./regenerate/activity.ts";
36
36
  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
37
  export { ledgerDir, onLedgerEvent, readLedger, type AgentRef, type LedgerEntry, type LedgerEvent, type LedgerKind, type LedgerQuery } from "./regenerate/ledger.ts";
40
38
  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
@@ -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
  ];
@@ -113,7 +113,6 @@ export declare const DEFAULTS: {
113
113
  readonly allowToStopJobs: true;
114
114
  readonly releaseAfterPulse: 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;
@@ -229,7 +229,6 @@ export const DEFAULTS = {
229
229
  allowToStopJobs: true,
230
230
  releaseAfterPulse: 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.",
@@ -279,11 +278,6 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
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
  "",
@@ -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
  */
@@ -1,11 +1,11 @@
1
1
  import { type DriftReport, type ModuleStatus, type WorkLoop } from "./regenerate/loop.ts";
2
2
  import { type ModuleState } from "./run-report.ts";
3
3
  /**
4
- * What every command that builds - `turri regenerate`, `conform`, `change-plain` - does around its own
4
+ * What every command that builds - `turri regenerate`, `conform` - does around its own
5
5
  * request of the work loop, as the chat does it: the project's models, a job that fails run once more and, failing again,
6
6
  * diagnosed, a line as each job starts and ends; then the loop run until nothing more can start, how each job ended,
7
- * and exit 1 when any failed or a module is not complete. With `dryRun`, the work is planned and the prompt of the first job each codebase would
8
- * start printed, and nothing runs.
7
+ * and exit 1 when any failed or a module is not complete. With `dryRun`, `ask` is a look ahead (`WorkLoop.lookAhead`): the work is
8
+ * planned, the prompt of the next pulse of each codebase printed from the plan kept, and nothing runs.
9
9
  */
10
10
  export declare function runLoop(options: {
11
11
  plainFile: string;
@@ -15,6 +15,7 @@ export declare function runLoop(options: {
15
15
  report?: string;
16
16
  /** The command, as the report gives it: its name and its arguments. */
17
17
  command?: string[];
18
+ /** Plan and print the next pulses, starting nothing - `ask` a look ahead. */
18
19
  dryRun?: boolean;
19
20
  /** Start over, unasked, a codebase that has to be on a module it now requires (`--start-over`). */
20
21
  startOver?: boolean;
package/dist/loop-cli.js CHANGED
@@ -10,18 +10,18 @@ import { ledgerWanted, startLedger } from "./regenerate/ledger.js";
10
10
  import { tryItCommand } from "./regenerate/delivery.js";
11
11
  import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
12
12
  import { createJobRegistry, pulseName } from "./regenerate/jobs.js";
13
- import { createWorkLoop, describeModules, functionalityCompletion, promptOf } from "./regenerate/loop.js";
13
+ import { createWorkLoop, describeModules, functionalityCompletion } from "./regenerate/loop.js";
14
14
  import { MODULES_DIR, projectDirOf } from "./regenerate/paths.js";
15
15
  import { exportModule } from "./regenerate/release.js";
16
16
  import { listFiles } from "./regenerate/testing.js";
17
17
  import { startRunReport } from "./run-report.js";
18
18
  import { configKeyOptions, optionValue } from "./cli-options.js";
19
19
  /**
20
- * What every command that builds - `turri regenerate`, `conform`, `change-plain` - does around its own
20
+ * What every command that builds - `turri regenerate`, `conform` - does around its own
21
21
  * request of the work loop, as the chat does it: the project's models, a job that fails run once more and, failing again,
22
22
  * diagnosed, a line as each job starts and ends; then the loop run until nothing more can start, how each job ended,
23
- * and exit 1 when any failed or a module is not complete. With `dryRun`, the work is planned and the prompt of the first job each codebase would
24
- * start printed, and nothing runs.
23
+ * and exit 1 when any failed or a module is not complete. With `dryRun`, `ask` is a look ahead (`WorkLoop.lookAhead`): the work is
24
+ * planned, the prompt of the next pulse of each codebase printed from the plan kept, and nothing runs.
25
25
  */
26
26
  export async function runLoop(options) {
27
27
  const plainFile = resolve(options.plainFile);
@@ -110,7 +110,6 @@ async function runLoopReporting(options) {
110
110
  cwd: process.cwd(),
111
111
  ...(model !== undefined ? { modelFor: () => model } : {}),
112
112
  ...(planner !== undefined ? { plannerModel: planner } : {}),
113
- ...(options.dryRun === true ? { dryRun: true } : {}),
114
113
  });
115
114
  report?.attach({
116
115
  jobs: () => registry.list(),
@@ -146,13 +145,16 @@ async function runLoopReporting(options) {
146
145
  }
147
146
  }
148
147
  if (options.dryRun === true) {
149
- for (const first of loop.firsts()) {
150
- console.log(`\n${c.bold(`${first.module}: ${first.planned.title}`)}${first.planned.track === "conformance" ? c.dim(" (conformance)") : ""}`);
151
- if (first.planned.track === "conformance") {
152
- console.log(c.dim("A conformance job's prompt is built from what the code it tests holds once it is built: not shown before."));
148
+ // The next pulse of each codebase, from the plan the look ahead kept - the one regenerate would start.
149
+ for (const status of planned) {
150
+ const first = status.planned[0];
151
+ if (first === undefined || first.afterCode === true || first.planning === true)
153
152
  continue;
154
- }
155
- console.log((await promptOf(first)) ?? "(no task)");
153
+ const next = await loop.plannedPulse(`planned-${status.module}-1`);
154
+ if (next === undefined)
155
+ continue;
156
+ console.log(`\n${c.bold(`${next.module}: ${next.title}`)}${next.track === "conformance" ? c.dim(" (conformance)") : ""}`);
157
+ console.log(next.task ?? c.dim(next.why ?? "(no task)"));
156
158
  }
157
159
  process.exit(0);
158
160
  }
@@ -1,8 +1,7 @@
1
1
  import { type ExtensionContext, type ToolDefinition } from "@earendil-works/pi-coding-agent";
2
2
  import { Type } from "typebox";
3
3
  import { type ModuleStatus, type WorkLoop } from "./regenerate/loop.ts";
4
- import type { RenderWork } from "./regenerate/engine.ts";
5
- import { type JobRegistry } from "./regenerate/jobs.ts";
4
+ import { type Job, type JobRegistry } from "./regenerate/jobs.ts";
6
5
  /**
7
6
  * The tools that act on the work loop - `regenerate`, `drift` and `halt` - defined once, for the conversation and for the
8
7
  * skills alike: a skill that regenerates what a spec holds, or reads how far it is regenerated, uses the conversation's
@@ -13,18 +12,15 @@ type AnyTool = ToolDefinition<any, any, any>;
13
12
  export declare const GUIDANCE_PARAM: Type.TOptional<Type.TString>;
14
13
  export declare const WORKING_DIR_PARAM: Type.TOptional<Type.TString>;
15
14
  export declare const MODEL_PARAM: Type.TOptional<Type.TString>;
16
- export declare const STACK_PARAM: Type.TOptional<Type.TString>;
17
15
  /**
18
- * Why a module asked for with no stack named cannot be built: a project of stacks where it has no stack of its own and
19
- * none is chosen, and config.turri.yaml alone names no unit testing script - every pulse would stop for want of one.
20
- * The stacks and the script each names, and what to do. Undefined when it can be built.
16
+ * Why a module cannot be built with the config it would be built with: two of the modules it requires have a config
17
+ * file of their own (`configModuleFor`); or, in a project where modules have their own files, it has none - nor any
18
+ * module it requires - and config.turri.yaml alone names no unit testing script, so every pulse would stop for want of
19
+ * one. The files there are and the script each names, and what to do. Undefined when it can be built.
21
20
  */
22
- export declare function stacklessBuild(plainFile: string): string | undefined;
23
- /**
24
- * `work` with the stack a call names chosen for it - or, none named, as it is: each module is then built with its own
25
- * (`stackForModule`). A module that could not be built that way is refused before anything is planned (`stacklessBuild`).
26
- */
27
- export declare function withCallStack<T>(plainFile: string, named: string | undefined, work: () => T): T;
21
+ export declare function unbuildableConfig(plainFile: string): string | undefined;
22
+ /** `work`, once the module asked for can be built with the config it would be built with - refused before anything is planned otherwise (`unbuildableConfig`). */
23
+ export declare function whenBuildable<T>(plainFile: string, work: () => T): T;
28
24
  export declare const WAIT_PARAM: Type.TOptional<Type.TBoolean>;
29
25
  /**
30
26
  * A render tool's arguments as if turri had been started in `working_dir`: the .plain file
@@ -37,8 +33,31 @@ export declare function fromWorkingDir<T extends {
37
33
  }>(cwd: string, params: T): T & {
38
34
  base: string;
39
35
  };
40
- /** What the loop is doing for a spec's modules, for the conversation - and, waiting, how each module ended. */
41
- export declare function loopReply(loop: WorkLoop, statuses: ModuleStatus[], wait: boolean): Promise<{
36
+ /**
37
+ * A call that waits for its pulses - print, json and rpc modes, or `wait: true` - in the chat it was made in: every pulse
38
+ * of that chat that was not there when it was made, and ends while it waits, is told in its reply.
39
+ */
40
+ export interface Wait {
41
+ chat: string | undefined;
42
+ before: ReadonlySet<string>;
43
+ }
44
+ /** A call in this chat starts waiting, from the pulses there are now. */
45
+ export declare function startWait(jobs: JobRegistry): Wait;
46
+ /** A call is done waiting: what ends now is told as any pulse's end is. */
47
+ export declare function endWait(jobs: JobRegistry, wait: Wait): void;
48
+ /**
49
+ * Whether a pulse that ended is told by a call still waiting in its chat - its agent is told it in that call's reply, so
50
+ * a turn of its own to say it again would only repeat it.
51
+ */
52
+ export declare function toldByWaitingCall(jobs: JobRegistry, job: Job): boolean;
53
+ /**
54
+ * What the loop is doing for a spec's modules, for the conversation - and, waiting, the pulses that ran meanwhile and how
55
+ * each ended, then how each module stands: `ran` is the registry and the call's wait (startWait).
56
+ */
57
+ export declare function loopReply(loop: WorkLoop, statuses: ModuleStatus[], wait: boolean, ran?: {
58
+ jobs: JobRegistry;
59
+ wait: Wait;
60
+ }): Promise<{
42
61
  content: {
43
62
  type: "text";
44
63
  text: string;
@@ -56,14 +75,14 @@ export interface LoopToolsOptions {
56
75
  jobs?: JobRegistry;
57
76
  /** The work loop the tools act on - the conversation's, for a call in it. */
58
77
  loop?: (ctx: ExtensionContext) => WorkLoop;
59
- /** The model a pulse of this call regenerates on: the one named, or the one chosen for the work. Default: the one named. */
60
- model?: (ctx: ExtensionContext, plainFile: string, named?: string, work?: RenderWork) => string | undefined;
78
+ /** The model a pulse of this call regenerates on: the one named, or the module's coding model. Default: the one named. */
79
+ model?: (ctx: ExtensionContext, plainFile: string, named?: string) => string | undefined;
61
80
  /** Whether a call waits for its work to finish, given what it asked. Default: only when it asked to. */
62
81
  wait?: (ctx: ExtensionContext, asked?: boolean) => boolean;
63
82
  }
64
- /** Whether a /regenerate's words ask for the module from scratch: its code deleted, and all of it regenerated again. */
83
+ /** Whether a /regenerate's words ask for the module from scratch - its code deleted, and all of it regenerated again - or a /conform's, for its conformance tests written again. */
65
84
  export declare function asksFromScratch(words: string): boolean;
66
- /** Whether a /regenerate asking for its module from scratch asks for its whole requires chain with it. */
85
+ /** Whether a /regenerate or /conform asking for its module from scratch asks for its whole requires chain with it. */
67
86
  export declare function asksWholeChain(words: string): boolean;
68
87
  /** regenerate: regenerate a module's code up to its spec as it is now. */
69
88
  export declare function regenerateTool(options: LoopToolsOptions & {