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

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 +9 -0
  11. package/dist/extension.js +184 -109
  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 +6 -5
  44. package/dist/regenerate/loop.js +16 -17
  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 +7 -7
  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/dist/extension.js CHANGED
@@ -9,7 +9,7 @@ import { allocateImageId, Box, getCapabilities, getPngDimensions, isKeyRelease,
9
9
  import { defineTool, getMarkdownTheme, UserMessageComponent } from "@earendil-works/pi-coding-agent";
10
10
  import { Type } from "typebox";
11
11
  import { CODING_MODEL_ENV } from "./chat-models.js";
12
- import { AGENT_ROLES, CONFIG_FILE, configForSpec, readConfigFile, configModuleFor, hasProjectConfig, LEGACY_CONFIG_FILE, projectConfigFile, moduleConfigFile, moduleConfigFileIn, configModuleOf, moduleConfigsOf, withConfigModule, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, splitModelSpec, unknownConfigLines } from "./config.js";
12
+ import { AGENT_ROLES, CONFIG_FILE, configForSpec, readConfigFile, configModuleFor, hasProjectConfig, LEGACY_CONFIG_FILE, projectConfigFile, moduleConfigFile, moduleConfigFileIn, configModuleOf, moduleConfigsOf, withConfigModule, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, splitModelSpec, configLines } from "./config.js";
13
13
  import { projectDirOf, skillRunDir } from "./regenerate/paths.js";
14
14
  import { sweepOrphanedGroups } from "./regenerate/shell.js";
15
15
  import { readScript, scriptAgainstMachine, stackOnMachine, toolchainsBlock } from "./stack.js";
@@ -21,15 +21,16 @@ import { bannerWarnings } from "./turri-versions.js";
21
21
  import { CONFORMANCE_OFF_REFUSAL, conformanceBlock, conformanceTestsOn, conformanceTestsOnIn, turnOnConformanceTests } from "./conformance-switch.js";
22
22
  import { BACKGROUND_NOTE, doneLine, failedTask, ownChanges, runDetails, skillRunDelivery, startedText } from "./background-skills.js";
23
23
  import { createAskUserTool } from "./tools.js";
24
- import { asksFromScratch, asksWholeChain, driftTool, endWait, fromWorkingDir, haltTool, loopReply, startWait, toldByWaitingCall, MODEL_PARAM, regenerateTool, stopJob, WAIT_PARAM, whenBuildable, WORKING_DIR_PARAM } from "./loop-tools.js";
24
+ import { asksFromScratch, asksWholeChain, driftTool, endWait, fromWorkingDir, haltLaunched, haltTool, loopReply, startWait, toldByWaitingCall, MODEL_PARAM, regenerateTool, stopJob, WAIT_PARAM, whenBuildable, WORKING_DIR_PARAM } from "./loop-tools.js";
25
25
  import { createWebTools } from "./regenerate/web.js";
26
26
  import { describeGates, interruptedRun, runSkill } from "./genome.js";
27
27
  import { unqueue } from "./chat-waiting.js";
28
28
  import { skillStatus } from "./skill.js";
29
- import { runningDeployed, stopDeployed } from "./regenerate/release.js";
30
- import { createDeployState, createDeployTools, currentRelease } from "./release-tools.js";
29
+ import { runningLaunched, stopLaunched } from "./regenerate/launch.js";
30
+ import { launchTool } from "./launch-tools.js";
31
+ import { createSessionLaunches, launchedDir, launchedNote, replacedNote } from "./launch-session.js";
32
+ import { describeLaunchLine } from "./launch-track.js";
31
33
  import { checkedSpecs } from "./sentinel-check.js";
32
- import { runReleaseAgent } from "./release-agent.js";
33
34
  import { createSteeringStore, EVERY_MODULE, moduleNameOf, queueSectionOf, steeringFor } from "./regenerate/steer.js";
34
35
  import { askedForCommandLine, refusal, selfInvocation, TOOLS_NOT_CLI } from "./self-invocation.js";
35
36
  import { NEW_PROJECT } from "./new-project.js";
@@ -61,7 +62,7 @@ import { doctorTool } from "./doctor-tool.js";
61
62
  import { describeSpecConflict } from "./regenerate/stop-report.js";
62
63
  import { inheritProviders, inheritThinkingLevel } from "./pi.js";
63
64
  import { LOADING_PROVIDERS } from "./installed-providers.js";
64
- import { machineChange, machineChangeReason, writesPlain } from "./regenerate/command-check.js";
65
+ import { machineChange, machineChangeReason, runsBuiltCode, writesPlain } from "./regenerate/command-check.js";
65
66
  import { beginCapture, captureConsole, describeCaptured, dropNoise } from "./quiet.js";
66
67
  import { loadRules, renderRulesBlock } from "./rules.js";
67
68
  import { registerSettings, ruleNames } from "./settings.js";
@@ -336,8 +337,27 @@ export function createTurriCore(host = {}, options = {}) {
336
337
  core?.jobFinished(job);
337
338
  },
338
339
  });
340
+ // The session's launches (docs/launch.md): a codebase's one at a time, the newest commit winning, on the coding model
341
+ // of the codebase - and what the sentinel waits on of them.
342
+ const launches = createSessionLaunches({
343
+ cwd,
344
+ jobs,
345
+ model: (plainFile) => launchModel(workLoops.get(jobs)?.from.ctx, plainFile),
346
+ onChange: (launch) => {
347
+ core?.jobsChanged();
348
+ try {
349
+ host.onLaunch?.(launch);
350
+ }
351
+ catch {
352
+ /* a host that throws still has the launch in the track */
353
+ }
354
+ core?.launchChanged(launch);
355
+ },
356
+ });
357
+ sessionLaunches.set(jobs, launches);
339
358
  core = createChats({
340
359
  cwd,
360
+ launches,
341
361
  host,
342
362
  jobs,
343
363
  extension: (pi, link) => turriExtension(pi, core, link),
@@ -354,8 +374,6 @@ export function createTurriCore(host = {}, options = {}) {
354
374
  hosts.set(jobs, host);
355
375
  // What the model is told of where the person watches the work, deep in the tools too: the host's surface, or the terminal.
356
376
  setSurface(jobs, host.surface);
357
- // What release has shipped, module by module: release does nothing for a module whose last commit it already shipped.
358
- deployStates.set(jobs, createDeployState());
359
377
  // What this session does, as facts, in the project's .turri/ledger - a pulse's own in its project. Said once, in the
360
378
  // chat shown, when it cannot be written.
361
379
  if (ledgerWanted()) {
@@ -444,7 +462,7 @@ function turriExtension(api, session, link) {
444
462
  // gets the full report as a hidden message that starts a turn of its own - at once when it is
445
463
  // idle, else as soon as the turn it is in ends (a follow-up, never cutting into a reply or an
446
464
  // interview) - so it reacts to every job that ends without waiting for the person to speak:
447
- // does what the project's guidance says to do then (release what was built, say), or says
465
+ // does what the project's guidance says to do then (launch what was built, say), or says
448
466
  // what finished. In the chat that asked for the pulse, shown or not.
449
467
  const announce = (job) => {
450
468
  announceJob(pi, job);
@@ -456,66 +474,59 @@ function turriExtension(api, session, link) {
456
474
  void pi.sendMessage({ customType: "turri_spec_conflict", content: specConflictTask(job.specConflict), display: false, details: { jobId: job.id } }, { triggerTurn: true });
457
475
  return;
458
476
  }
477
+ let launching = false;
478
+ try {
479
+ launching = readProjectConfig(cwd, job.configModule).launchAfterPulse === true;
480
+ }
481
+ catch {
482
+ /* a config that cannot be read launches nothing */
483
+ }
459
484
  void pi.sendMessage({
460
485
  customType: "turri_job",
461
- content: (job.status === "succeeded"
462
- ? `Pulse ${job.id} (${job.kind}) finished after ${formatDuration(job)}.\n\n${job.report ?? ""}`
463
- : job.status === "stopped"
464
- ? `Pulse ${job.id} (${job.kind}) was stopped after ${formatDuration(job)}. ${job.error ?? STOPPED_ON_REQUEST}${job.error === undefined || job.error === STOPPED_ON_REQUEST ? " The person stopped it; what it was building counts as not built." : ""}`
465
- : `Pulse ${job.id} (${job.kind}) failed after ${formatDuration(job)}.\n\n${job.error ?? ""}`) +
466
- `\n\n${JOB_FINISHED_REACTION}`,
486
+ content: pulseEndNote(job, { launching }),
467
487
  display: false,
468
488
  details: { jobId: job.id, status: job.status },
469
489
  }, { triggerTurn: true, deliverAs: "followUp" });
470
490
  };
471
491
  // The sentinel's: what a pulse that ended is, told to its agent in a conversation of its own for the pulse. The hidden
472
492
  // message is the conversation's first entry - a host splits the sentinel's work by pulse on it - so the pulse's end is
473
- // not drawn above it here: the person's chat shows it.
493
+ // not drawn above it here: the person's chat shows it. Told once what runs holds its commit (chats.ts readyFor).
474
494
  const brief = async (job, context) => {
475
- const config = readProjectConfig(cwd);
495
+ const launch = sessionLaunches.get(jobs)?.forPulse(job) ?? { later: [], laterSpecs: [], running: [] };
476
496
  const content = sentinelBrief(job, {
477
497
  project: cwd,
478
498
  ...(context.asked !== undefined ? { asked: context.asked } : {}),
479
499
  ...(context.focused !== undefined ? { focused: context.focused } : {}),
480
- released: runningDeployed(job.module),
481
- releaseAfterPulse: config.releaseAfterPulse === true,
500
+ launch,
482
501
  reaction: JOB_FINISHED_REACTION,
483
502
  });
484
503
  void pi.sendMessage({ customType: "turri_sentinel_pulse", content, display: false, details: { jobId: job.id, status: job.status } }, { triggerTurn: true });
485
504
  };
486
- // The sentinel's: functional specs a host asked it to check. The module is released first - as release-after-pulse
487
- // releases it - unless what runs is its own codebase's last commit; then told, in a conversation of its own for the
488
- // check, its hidden first message `turri_sentinel_check`. Why not, when the release failed: its agent is told nothing.
505
+ // The sentinel's: functional specs a host asked it to check, in what is launched of the module - told, in a
506
+ // conversation of its own for the check, its hidden first message `turri_sentinel_check`. It launches nothing.
489
507
  const briefCheck = async (check, context) => {
490
- const state = deployStates.get(jobs) ?? createDeployState();
491
- let releasedNow = false;
492
- if (currentRelease(state, check.plainFile, check.module) === undefined) {
493
- // Behind, never made, or what it started died: released afresh - the release tool would say it shipped that already.
494
- state.released.delete(check.module);
495
- let said;
496
- try {
497
- const ctx = contextNow();
498
- const model = ctx !== undefined ? releaseModel(ctx, check.plainFile) : undefined;
499
- said = await runReleaseAgent({ plainFile: check.plainFile, cwd, state, inModule: check.module, forCheck: { moduleName: check.module }, ...(model !== undefined ? { model } : {}) });
500
- }
501
- catch (error) {
502
- return error instanceof Error ? error.message : String(error);
503
- }
504
- if (currentRelease(state, check.plainFile, check.module) === undefined)
505
- return said.trim() || "its last commit was not released";
506
- releasedNow = true;
507
- }
508
- const commit = state.released.get(check.module)?.commit;
508
+ const current = sessionLaunches.get(jobs)?.track.current(check.module);
509
+ const commit = current?.short;
509
510
  const content = sentinelCheckBrief(check, {
510
511
  specs: checkedSpecs(check),
511
- released: runningDeployed(check.module),
512
- releasedNow,
512
+ running: runningLaunched(check.module),
513
513
  ...(commit !== undefined ? { commit } : {}),
514
+ ...(current?.status === "failed" ? { failed: { id: current.id, ...(current.summary !== undefined ? { summary: current.summary } : {}) } } : {}),
515
+ ...(current !== undefined ? { dir: launchedDir(current) } : {}),
514
516
  ...(context.focused !== undefined ? { focused: context.focused } : {}),
515
517
  });
516
518
  void pi.sendMessage({ customType: "turri_sentinel_check", content, display: false, details: { checkId: check.id, module: check.module, funcIds: check.funcIds } }, { triggerTurn: true });
517
- return undefined;
518
519
  };
520
+ // The sentinel's: its check carried on in the conversation it was in, once its codebase was launched again.
521
+ const resume = async (work) => {
522
+ const launches = sessionLaunches.get(jobs);
523
+ if (launches === undefined)
524
+ return;
525
+ const content = launches.resumeText(work);
526
+ void pi.sendMessage({ customType: "turri_sentinel_resume", content, display: false }, { triggerTurn: true });
527
+ };
528
+ // A launch this chat is to hear of ended: its agent told how it went, to tell the person.
529
+ const launched = (launch) => tellLaunch(pi, jobs, launch);
519
530
  // A pulse ended, with the sentinel on: said in the chat. One that landed is told to its agent too, to tell the person
520
531
  // it landed and what the sentinel does with it - and nothing more: the pulse is the sentinel's. ***plain that
521
532
  // contradicts itself is put to the person at once, by turri itself, as the chat would have been started on it.
@@ -527,7 +538,14 @@ function turriExtension(api, session, link) {
527
538
  return;
528
539
  // A host that shows the person the pulse's end itself: the chat knows of it - in order, with no turn of its own.
529
540
  const shown = host.pulseEndsShown === true;
530
- void pi.sendMessage({ customType: "turri_job_landed", content: landedNote(job, runningDeployed(job.module), { shown }), display: false, details: { jobId: job.id, status: job.status } }, shown ? { triggerTurn: false } : { triggerTurn: true, deliverAs: "followUp" });
541
+ let launching = false;
542
+ try {
543
+ launching = readProjectConfig(cwd, job.configModule).launchAfterPulse === true;
544
+ }
545
+ catch {
546
+ /* a config that cannot be read launches nothing */
547
+ }
548
+ void pi.sendMessage({ customType: "turri_job_landed", content: landedNote(job, { shown, launching }), display: false, details: { jobId: job.id, status: job.status } }, shown ? { triggerTurn: false } : { triggerTurn: true, deliverAs: "followUp" });
531
549
  };
532
550
  const notices = noticeDialogs(pi, session, link, contextNow);
533
551
  link.live({
@@ -535,6 +553,8 @@ function turriExtension(api, session, link) {
535
553
  landed,
536
554
  brief,
537
555
  briefCheck,
556
+ resume,
557
+ launched,
538
558
  notice: notices.put,
539
559
  noticeOver: notices.over,
540
560
  concluded: notices.concluded,
@@ -632,6 +652,14 @@ function turriExtension(api, session, link) {
632
652
  const plain = isSentinel ? writesPlain(command) : undefined;
633
653
  if (plain !== undefined)
634
654
  return { block: true, reason: `${plain} is ***plain: the sentinel never changes it - put what it needs to the person with notify_person.` };
655
+ // Nor does a host's terminal start the code in plain_modules for it: what it tests is what is launched.
656
+ const built = isSentinel && event.toolName !== "bash" ? runsBuiltCode(command) : undefined;
657
+ if (built !== undefined) {
658
+ return {
659
+ block: true,
660
+ reason: `${built} is in plain_modules - the code a pulse may be writing, which nobody launched: the sentinel never runs it, nor starts a server of its own. Test what is launched, from where its brief says; a server that should run and does not is your finding.`,
661
+ };
662
+ }
635
663
  }
636
664
  if (event.toolName === "bash" && typeof command === "string") {
637
665
  const what = selfInvocation(command);
@@ -716,7 +744,7 @@ function turriExtension(api, session, link) {
716
744
  registerRegenerate(pi, cwd, jobs);
717
745
  registerDrift(pi, cwd, jobs);
718
746
  registerBind(pi, cwd, jobs, (plainFile) => turnOnConformance(session, plainFile));
719
- registerDeploy(pi, cwd, jobs, deployStates.get(jobs) ?? createDeployState());
747
+ registerLaunch(pi, cwd, jobs);
720
748
  registerSteering(pi, cwd);
721
749
  registerSideQuestions(pi, cwd, jobs);
722
750
  // More chats beside this one, in the terminal: /chat, alt+n, alt+1…9 (chat-commands.ts).
@@ -991,7 +1019,7 @@ function turriExtension(api, session, link) {
991
1019
  },
992
1020
  };
993
1021
  // What the run changes in the project's ***plain - its specs, resources, scripts - is said with its result: a skill
994
- // that writes nothing is not taken for one that did its work. Only those: a release or a running app changes other
1022
+ // that writes nothing is not taken for one that did its work. Only those: a launch or a running app changes other
995
1023
  // files while it runs, and they are not its doing.
996
1024
  const filesBefore = projectFiles(cwd);
997
1025
  // A side question asked while it runs is told what it has done so far.
@@ -1035,7 +1063,7 @@ function turriExtension(api, session, link) {
1035
1063
  loopTools: [
1036
1064
  regenerateTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, named, plainFile), wait: () => false }),
1037
1065
  driftTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx) }),
1038
- haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop }),
1066
+ haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop, ...(sessionLaunches.get(jobs) !== undefined ? { launches: sessionLaunches.get(jobs).track } : {}) }),
1039
1067
  conformTool({ cwd, jobs, loop: () => workLoopFor(jobs, cwd, ctx), model: (_skill, plainFile, named) => jobModel(ctx, named, plainFile), wait: () => false }),
1040
1068
  ],
1041
1069
  // The escalation becomes a real dialog - the host's own, when it has them. Without one there is nobody to ask,
@@ -1269,7 +1297,7 @@ echoed = false, react) {
1269
1297
  */
1270
1298
  export const COMMAND_STARTED_REACTION = "My pulses are running from the person's command, in the background. Tell the person, in a line or two, what " +
1271
1299
  "runs and what is planned - and that the two of us can go on with the ***plain, or anything else, meanwhile: they need " +
1272
- "not wait for it. Start nothing for it: no regenerate, no check, no release - its end is told when it comes.";
1300
+ "not wait for it. Start nothing for it: no regenerate, no check, no launch - its end is told when it comes.";
1273
1301
  /**
1274
1302
  * What the agent does when /conform started nothing: answers it at once - why, and what would let it start - and offers
1275
1303
  * to do that, rather than leave the person with a refusal and a silent chat.
@@ -1706,9 +1734,19 @@ function conversationModel(ctx, override) {
1706
1734
  * The chat's model, read now - it can change while a skill runs - or, from a context that has
1707
1735
  * gone stale since, the model it had when it was last readable.
1708
1736
  */
1709
- /** The model a release runs on - a pulse's last stage, and a check's: the one that regenerated the module. A release follows steps, and a small model thinking little does that well. */
1710
- function releaseModel(ctx, plainFile) {
1711
- return projectModel(ctx, plainFile) ?? chatModelOf(ctx);
1737
+ /**
1738
+ * The model a launch runs on: the coding model of the codebase - a launch follows steps, and a small model thinking little
1739
+ * does that well. Without a chat's context yet, the config's as it names it.
1740
+ */
1741
+ function launchModel(ctx, plainFile) {
1742
+ try {
1743
+ if (ctx !== undefined)
1744
+ return projectModel(ctx, plainFile) ?? chatModelOf(ctx);
1745
+ }
1746
+ catch {
1747
+ /* a name the chat cannot resolve: the config's, as it is */
1748
+ }
1749
+ return modelSpec(projectModels(configForSpec(plainFile)).coding);
1712
1750
  }
1713
1751
  function chatModelOf(ctx) {
1714
1752
  try {
@@ -1799,8 +1837,8 @@ function projectModel(ctx, plainFile) {
1799
1837
  const workLoops = new WeakMap();
1800
1838
  /** How the conversation wants the work planned, for the session - set with steer. */
1801
1839
  const steeringStore = createSteeringStore();
1802
- /** What release has shipped in a conversation, by its jobs: shared by the chat's release and a pulse's own. */
1803
- const deployStates = new WeakMap();
1840
+ /** A session's launches, by its jobs: the launch track every chat's launch tool and every pulse's launch share. */
1841
+ const sessionLaunches = new WeakMap();
1804
1842
  function workLoopFor(jobs, cwd, ctx) {
1805
1843
  let shared = workLoops.get(jobs);
1806
1844
  if (shared === undefined) {
@@ -1813,19 +1851,9 @@ function workLoopFor(jobs, cwd, ctx) {
1813
1851
  plannerModel: () => chatModelOf(from.ctx),
1814
1852
  // How the work is to be planned: the conversation's steering, and AGENTS.md's - read afresh each plan.
1815
1853
  steering: (plainFile) => steeringFor(plainFile, cwd, steeringStore),
1816
- // Under release-after-pulse, a pulse releases what it landed itself, before the next starts - on the model that
1817
- // regenerated it: a release follows steps, and a small model thinking little does that well.
1818
- release: ({ plainFile, moduleName, title, onDelta }) => {
1819
- const model = releaseModel(from.ctx, plainFile);
1820
- return runReleaseAgent({
1821
- plainFile,
1822
- cwd,
1823
- state: deployStates.get(jobs) ?? createDeployState(),
1824
- afterPulse: { moduleName, subject: title },
1825
- onDelta,
1826
- ...(model !== undefined ? { model } : {}),
1827
- });
1828
- },
1854
+ // A pulse landed: its commit kept for the sentinel - and, under launch-after-pulse, launched in the background, the
1855
+ // codebase's next pulse not waiting on it.
1856
+ landed: (input) => sessionLaunches.get(jobs)?.landed(input),
1829
1857
  });
1830
1858
  shared = { loop, from };
1831
1859
  workLoops.set(jobs, shared);
@@ -1899,7 +1927,7 @@ function registerJobTools(pi, jobs, cwd) {
1899
1927
  name: "pulses",
1900
1928
  label: "Pulses",
1901
1929
  description: "Pulses in every tense - earlier sessions', this session's, running now and what runs next. With no parameter: every pulse of " +
1902
- "this session - finished, running, and planned, those of a look ahead marked as waiting for regenerate - what activate started, " +
1930
+ "this session - finished, running, and planned, those of a look ahead marked as waiting for regenerate - the launches and what they started, " +
1903
1931
  "and the last runs of earlier sessions, a line a pulse - how each ended, how long, what it cost. With job_id, one pulse: " +
1904
1932
  "running, whether it still is and its latest output; finished, its report and what the ledger recorded of it - its rounds " +
1905
1933
  "and test runs (how many failed the same way), the verdicts, the healers, the model provider's trouble, what turri refused, " +
@@ -1977,33 +2005,43 @@ function registerJobTools(pi, jobs, cwd) {
1977
2005
  // The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
1978
2006
  // list, finished jobs included, put in the transcript where it stays.
1979
2007
  pi.registerCommand("halt", {
1980
- description: "Halt a queued or running pulse, a module's planned pulses, or what activate started: /halt [pulse id | module | activated <name>]",
2008
+ description: "Halt a queued or running pulse, a module's planned pulses, a launch, or what a launch started: /halt [pulse id | module | launched <name | module>]",
1981
2009
  handler: async (args, ctx) => {
1982
2010
  if (!ctx.hasUI)
1983
2011
  return;
1984
2012
  const live = jobs.list().filter((job) => job.status === "running" || job.status === "queued");
1985
- const deployed = runningDeployed();
2013
+ const servers = runningLaunched();
2014
+ const track = sessionLaunches.get(jobs)?.track;
2015
+ const underWay = (track?.list() ?? []).filter((launch) => launch.status === "running" || launch.status === "waiting");
1986
2016
  const loop = workLoops.get(jobs)?.loop;
1987
2017
  // A module's planned pulses, one line a module: halting one halts the module.
1988
2018
  const plannedRows = loop?.planned() ?? [];
1989
2019
  const planned = [...new Set(plannedRows.map((row) => row.module ?? ""))].filter((module) => module !== "");
1990
2020
  let id = args.trim();
1991
2021
  if (id === "") {
1992
- if (live.length === 0 && deployed.length === 0 && planned.length === 0)
1993
- return ctx.ui.notify("Nothing is regenerating, queued or planned.", "info");
2022
+ if (live.length === 0 && servers.length === 0 && underWay.length === 0 && planned.length === 0)
2023
+ return ctx.ui.notify("Nothing is regenerating, queued, planned or launched.", "info");
1994
2024
  const label = (job) => `${job.id} ${job.status.padEnd(8)} ${pulseName(job)}`;
1995
2025
  const plannedLabel = (module) => {
1996
2026
  const rows = plannedRows.filter((row) => row.module === module);
1997
2027
  const waiting = rows.find((row) => row.id.endsWith("-waiting"));
1998
2028
  return `${module} ${waiting !== undefined ? waiting.summary : `${rows.length} planned`} - halts the module`;
1999
2029
  };
2000
- const labels = [...live.map(label), ...planned.map(plannedLabel), ...deployed.map((item) => deployedLabel(item.name, item.url ?? item.command))];
2030
+ const labels = [
2031
+ ...live.map(label),
2032
+ ...planned.map(plannedLabel),
2033
+ ...underWay.map(describeLaunchLine),
2034
+ ...servers.map((item) => launchedLabel(item.name, item.url ?? item.command)),
2035
+ ];
2001
2036
  const picked = await ctx.ui.select("Halt which?", labels);
2002
2037
  const job = live.find((candidate) => picked !== undefined && label(candidate) === picked);
2003
2038
  const module = planned.find((name) => picked !== undefined && plannedLabel(name) === picked);
2004
- const server = deployed.find((item) => picked !== undefined && deployedLabel(item.name, item.url ?? item.command) === picked);
2039
+ const launch = underWay.find((candidate) => picked !== undefined && describeLaunchLine(candidate) === picked);
2040
+ const server = servers.find((item) => picked !== undefined && launchedLabel(item.name, item.url ?? item.command) === picked);
2005
2041
  if (server !== undefined)
2006
- id = `activated ${server.name}`;
2042
+ id = `launched ${server.name}`;
2043
+ else if (launch !== undefined)
2044
+ id = `launched ${launch.codebase}`;
2007
2045
  else if (job !== undefined)
2008
2046
  id = job.id;
2009
2047
  else if (module !== undefined)
@@ -2011,11 +2049,9 @@ function registerJobTools(pi, jobs, cwd) {
2011
2049
  else
2012
2050
  return;
2013
2051
  }
2014
- const name = /^(?:activated|deploy)\s+(.+)$/.exec(id)?.[1]?.trim();
2015
- if (name !== undefined) {
2016
- const stopped = await stopDeployed({ name });
2017
- return shownAfterCommand(pi, ctx, `/halt ${id}`, stopped.length > 0 ? `Halted ${stopped.join(", ")}.` : `Nothing activate started is running as ${name}.`, "info");
2018
- }
2052
+ const name = /^launched\s+(.+)$/.exec(id)?.[1]?.trim();
2053
+ if (name !== undefined)
2054
+ return shownAfterCommand(pi, ctx, `/halt ${id}`, await haltLaunched(name, track), "info");
2019
2055
  ctx.ui.notify(stopJob(jobs, id, undefined, loop), "info");
2020
2056
  },
2021
2057
  });
@@ -2122,18 +2158,42 @@ function registerJobTools(pi, jobs, cwd) {
2122
2158
  }
2123
2159
  export { fromWorkingDir };
2124
2160
  const WATCH_REDRAW_MS = 500;
2161
+ /**
2162
+ * What a chat's agent is told of a pulse it asked for that ended, with the sentinel off. One that landed under
2163
+ * launch-after-pulse is being launched as it is told: it says so, and offers nothing else for it - it is told once the
2164
+ * launch ends.
2165
+ */
2166
+ export function pulseEndNote(job, options = {}) {
2167
+ const head = job.status === "succeeded"
2168
+ ? `Pulse ${job.id} (${job.kind}) finished after ${formatDuration(job)}.\n\n${job.report ?? ""}`
2169
+ : job.status === "stopped"
2170
+ ? `Pulse ${job.id} (${job.kind}) was stopped after ${formatDuration(job)}. ${job.error ?? STOPPED_ON_REQUEST}${job.error === undefined || job.error === STOPPED_ON_REQUEST ? " The person stopped it; what it was building counts as not built." : ""}`
2171
+ : `Pulse ${job.id} (${job.kind}) failed after ${formatDuration(job)}.\n\n${job.error ?? ""}`;
2172
+ const landed = job.status === "succeeded" && job.details?.landed === true;
2173
+ if (!landed || options.launching !== true)
2174
+ return `${head}\n\n${JOB_FINISHED_REACTION}`;
2175
+ return [
2176
+ head,
2177
+ "",
2178
+ "It landed, and turri is launching the commit it landed now, in the background (launch-after-pulse): you are told once",
2179
+ "that launch ends - where it runs, or why it did not come up. React to this now - the person has not asked, and need",
2180
+ "not: say in a line or two what landed and that it is being launched. Offer nothing else for it - do not call launch,",
2181
+ "open it, run it or test it, and never say nothing runs - and start no other work, unless guidance for this project",
2182
+ "(its AGENTS.md, a skill, what the person said) says to do something besides launching it when a pulse finishes: do",
2183
+ "that. When you are told it is launched, do what you were told to do once something is launched.",
2184
+ ].join("\n");
2185
+ }
2125
2186
  /**
2126
2187
  * What the agent is to do with a job that just ended, unasked: what the project's guidance says to do then, or else say
2127
2188
  * in a line or two what ended - the person saw it end already, in the transcript.
2128
2189
  */
2129
2190
  export const JOB_FINISHED_REACTION = [
2130
2191
  "React to this now - the person has not asked, and need not. If guidance for this project - its AGENTS.md, a skill,",
2131
- "what the person said earlier - says what to do when a pulse finishes (release what was built, run something, tell",
2192
+ "what the person said earlier - says what to do when a pulse finishes (launch what was built, run something, tell",
2132
2193
  "someone), do that, as it says. Otherwise say in a line or two what finished and what it means for the person - the",
2133
2194
  "report is theirs to read in full; do not repeat it - and, when it failed, what they can do. Start no other work.",
2134
- "A report that says \"Released after the pulse\" was released by turri itself, as the pulse's last stage: do not call",
2135
- "release for it. Say in a line what was released, or why nothing was - then, when it was released, do what you were",
2136
- "told to do once something is released (opening it where the person can watch it, saying what to test), if anything.",
2195
+ "Under launch-after-pulse turri launches what a pulse lands itself, in the background: do not call launch for it - you",
2196
+ "are told once it is launched, and do then what you were told to do once something is launched.",
2137
2197
  "A pulse that stopped on its environment - \"stopped: turri's sandbox kept its agents from…\" or \"stopped: the",
2138
2198
  "environment lacks…\" - stops the same way again until that is fixed: never regenerate it before. Heal it, then regenerate the",
2139
2199
  "module to resume:",
@@ -2448,9 +2508,9 @@ function modulesWithHistory(cwd) {
2448
2508
  }
2449
2509
  /** Stop a job by id or id prefix, and say what that means for the queue. */
2450
2510
  /** Every job, in the order it was started, with what a queued one is waiting for. */
2451
- /** What deploy started, as /halt offers it. */
2452
- function deployedLabel(name, what) {
2453
- return `deploy ${name} running ${what}`;
2511
+ /** What a launch started, as /halt offers it. */
2512
+ function launchedLabel(name, what) {
2513
+ return `launched ${name} running ${what}`;
2454
2514
  }
2455
2515
  /** The jobs as the person is shown them: those started, and those the work loop has planned after them. */
2456
2516
  function shownJobs(jobs) {
@@ -2458,8 +2518,10 @@ function shownJobs(jobs) {
2458
2518
  }
2459
2519
  function listJobs(jobs, cwd, runs = EARLIER_RUNS) {
2460
2520
  const all = [...shownJobs(jobs)].reverse().filter((job) => job.replacedBy === undefined);
2461
- const deployed = runningDeployed().map((item) => `deploy ${item.name} running ${item.moduleName}: ${item.url ?? item.command} (pid ${item.pid}, output in ${relative(process.cwd(), item.log) || item.log})`);
2462
- const listed = deployed.length > 0 ? `\n\nActivated from dist - /halt activated <name> halts one:\n${deployed.join("\n")}` : "";
2521
+ const servers = runningLaunched().map((item) => `launched ${item.name} running ${item.moduleName}: ${item.url ?? item.command} (pid ${item.pid}, output in ${relative(process.cwd(), item.log) || item.log})`);
2522
+ const launches = (sessionLaunches.get(jobs)?.track.list() ?? []).slice(-10).reverse().map(describeLaunchLine);
2523
+ const listed = (launches.length > 0 ? `\n\nLaunches, newest first - /halt launched <module> halts one under way:\n${launches.join("\n")}` : "") +
2524
+ (servers.length > 0 ? `\n\nWhat launches started - /halt launched <name> halts one:\n${servers.join("\n")}` : "");
2463
2525
  const before = earlierRuns(jobs, cwd, runs);
2464
2526
  if (all.length === 0)
2465
2527
  return `No pulses have been started in this session.${listed}${before}`;
@@ -2586,11 +2648,6 @@ function registerSteering(pi, cwd) {
2586
2648
  },
2587
2649
  });
2588
2650
  }
2589
- /**
2590
- * Deploy: the conversation puts what is built out in dist/<module> and starts it on this machine (see
2591
- * regenerate/release.ts), installing what it needs in its own shell - nothing is put to the person. What it
2592
- * started is stopped when the session ends.
2593
- */
2594
2651
  const SIDE_ENTRY = "turri_btw";
2595
2652
  /** A message the person sent while a skill ran in the chat, read by the skill's agent: drawn as the message it is. */
2596
2653
  const SKILL_MESSAGE_ENTRY = "turri_skill_message";
@@ -2663,20 +2720,37 @@ async function askOnTheSide(pi, ctx, cwd, jobs, question) {
2663
2720
  }
2664
2721
  return answer;
2665
2722
  }
2666
- function registerDeploy(pi, cwd, jobs, state) {
2667
- const tools = createDeployTools({
2668
- cwd,
2669
- state,
2670
- jobs,
2671
- workLoop: () => workLoops.get(jobs)?.loop,
2672
- defaultPlainFile: () => readProjectConfig(cwd).module,
2673
- });
2674
- for (const tool of tools)
2675
- pi.registerTool(tool);
2676
- // What activate started runs until turri ends - not when a chat is opened, closed, forked or reloaded.
2723
+ /** A launch ended, told to a chat's agent - to tell the person where it runs, or why it did not come up. */
2724
+ function tellLaunch(pi, jobs, launch) {
2725
+ const job = "pulse" in launch.cause ? jobs.get(launch.cause.pulse) : undefined;
2726
+ void pi.sendMessage({ customType: "turri_launch", content: launchedNote(launch, job), display: false, details: { launch: launch.id, status: launch.status } }, { triggerTurn: true, deliverAs: "followUp" });
2727
+ }
2728
+ /** A newer launch took the place of one a chat asked for, told to its agent: it hears that one's end instead. */
2729
+ function tellReplaced(pi, jobs, launch, next) {
2730
+ const job = "pulse" in next.cause ? jobs.get(next.cause.pulse) : undefined;
2731
+ void pi.sendMessage({ customType: "turri_launch", content: replacedNote(launch, next, job), display: false, details: { launch: launch.id, status: launch.status, replacedBy: next.id } }, { triggerTurn: true, deliverAs: "followUp" });
2732
+ }
2733
+ function registerLaunch(pi, cwd, jobs) {
2734
+ const launches = sessionLaunches.get(jobs);
2735
+ if (launches !== undefined) {
2736
+ pi.registerTool(launchTool({
2737
+ cwd,
2738
+ track: launches.track,
2739
+ defaultPlainFile: () => readProjectConfig(cwd).module,
2740
+ chat: () => currentChat()?.id,
2741
+ // Told in the chat that asked, as a launch after a pulse is with the sentinel off.
2742
+ ended: (launch) => tellLaunch(pi, jobs, launch),
2743
+ replaced: (launch, next) => tellReplaced(pi, jobs, launch, next),
2744
+ wait: (ctx) => shouldWait(ctx.mode, undefined),
2745
+ }));
2746
+ }
2747
+ pi.registerTool(haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop, ...(launches !== undefined ? { launches: launches.track } : {}) }));
2748
+ // What launches started runs until turri ends - not when a chat is opened, closed, forked or reloaded.
2677
2749
  pi.on("session_shutdown", async (event) => {
2678
- if (event.reason === "quit")
2679
- await stopDeployed();
2750
+ if (event.reason !== "quit")
2751
+ return;
2752
+ await launches?.track.stop();
2753
+ await stopLaunched();
2680
2754
  });
2681
2755
  }
2682
2756
  const MILESTONE_ENTRY = "turri_milestone";
@@ -2897,7 +2971,8 @@ function registerBranding(pi, skills) {
2897
2971
  (data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
2898
2972
  // A newer turri out, or one installed and hidden behind this one: said first, under the version it is about.
2899
2973
  ...(data.versions ?? []).map((line) => theme.fg("warning", line)),
2900
- ...(data.config ?? []).map((line) => theme.fg("warning", line)),
2974
+ // A key renamed is information; the rest are the person's to take out.
2975
+ ...(data.config ?? []).map((line) => theme.fg(line.kind === "renamed" ? "muted" : "warning", line.text)),
2901
2976
  `${theme.fg("text", "the first coding agent with the power of ")}${brandPink(theme)("regenerative software")}`,
2902
2977
  // Where the settings are changed, without leaving the chat.
2903
2978
  theme.fg("muted", "configure with /settings"),
@@ -2949,7 +3024,7 @@ function registerBranding(pi, skills) {
2949
3024
  pending: skills.pending.length,
2950
3025
  sandbox: sandboxSummary(),
2951
3026
  versions: versions.lines,
2952
- config: unknownConfigLines(ctx.cwd),
3027
+ config: configLines(ctx.cwd),
2953
3028
  });
2954
3029
  }
2955
3030
  catch {
package/dist/genome.js CHANGED
@@ -103,7 +103,7 @@ async function runStoppable(opts) {
103
103
  }
104
104
  }
105
105
  customTools.push(...(opts.sharedTools ?? []));
106
- // 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.
107
107
  customTools.push(...plainWriteTools(opts.cwd).filter((tool) => skill.allowedTools.includes(tool.name)));
108
108
  // Its shell runs neither turri nor another pi again: that would build outside the session's work loop.
109
109
  if (skill.allowedTools.includes("bash"))
@@ -51,7 +51,7 @@ export interface Turri {
51
51
  /**
52
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 `!`
53
53
  * command, a compaction - and nothing in the others (`stopped`). In a chat doing nothing the session ends - every
54
- * 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`).
55
55
  * A second interrupt straight after one that stopped something does nothing (`ignored`); `missing` for a chat not open.
56
56
  */
57
57
  interrupt(id: string): Promise<"stopped" | "ignored" | "ended" | "missing">;
@@ -68,9 +68,10 @@ export interface Turri {
68
68
  */
69
69
  notices(): Notice[];
70
70
  /**
71
- * The sentinel asked to check functional specs in a module's release - `funcIds` each `module:func-id`, of the module or
72
- * 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
73
- * 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
74
75
  * sentinel's work, in a conversation of its own. Returns the check's id - its notices and its conclusion carry it - or
75
76
  * why it was refused: the sentinel off or not started this session, a module not there or that does not parse, a
76
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.
@@ -104,7 +105,7 @@ export interface Turri {
104
105
  answer(id: string, answer: NoticeAnswer): Promise<"done" | "dismissed" | "ignored" | "refused" | "missing" | "over">;
105
106
  /** Told when a chat is opened, closed, renamed, or starts or stops working. */
106
107
  onChats(listener: (chats: ChatInfo[]) => void): () => void;
107
- /** Every chat let go, and what activate started stopped. */
108
+ /** Every chat let go, and what launches started stopped. */
108
109
  dispose(): Promise<void>;
109
110
  }
110
111
  /** turri's session in a host, in the process's working folder - the project's. */
@@ -4,7 +4,7 @@ import { interruptChat } from "./chats.js";
4
4
  import { reachable, ruleNames, settingCandidates } from "./settings.js";
5
5
  import { settingOf } from "./config-edit.js";
6
6
  import { createTurriCore, sessionLoop, turnOnConformance } from "./extension.js";
7
- import { stopDeployed } from "./regenerate/release.js";
7
+ import { stopLaunched } from "./regenerate/launch.js";
8
8
  import { prepareCheck } from "./sentinel-check.js";
9
9
  /** turri's session in a host, in the process's working folder - the project's. */
10
10
  export async function createTurri(options = {}) {
@@ -43,7 +43,7 @@ export async function createTurri(options = {}) {
43
43
  let lastStop = 0;
44
44
  const dispose = async () => {
45
45
  await core.dispose();
46
- await stopDeployed();
46
+ await stopLaunched();
47
47
  };
48
48
  return {
49
49
  jobs: core.jobs,
package/dist/host.d.ts CHANGED
@@ -6,6 +6,8 @@
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";