@turri-dev/cli 0.2.4-next.efe96fe → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/chat-skills.d.ts +1 -1
- package/dist/chat-skills.js +1 -1
- package/dist/chats.d.ts +42 -8
- package/dist/chats.js +122 -38
- package/dist/cli.js +1 -1
- package/dist/config-edit.js +4 -4
- package/dist/config.d.ts +48 -11
- package/dist/config.js +102 -13
- package/dist/extension.d.ts +22 -2
- package/dist/extension.js +225 -125
- package/dist/genome.js +1 -1
- package/dist/host-session.d.ts +6 -5
- package/dist/host-session.js +2 -2
- package/dist/host.d.ts +2 -0
- package/dist/identity.js +2 -2
- package/dist/init-config.d.ts +1 -1
- package/dist/init-config.js +7 -7
- package/dist/launch-agent.d.ts +51 -0
- package/dist/launch-agent.js +267 -0
- package/dist/{release-cli.js → launch-cli.js} +41 -24
- package/dist/launch-session.d.ts +68 -0
- package/dist/launch-session.js +217 -0
- package/dist/launch-tools.d.ts +28 -0
- package/dist/launch-tools.js +69 -0
- package/dist/launch-track.d.ts +125 -0
- package/dist/launch-track.js +320 -0
- package/dist/loop-cli.js +4 -4
- package/dist/loop-tools.d.ts +8 -3
- package/dist/loop-tools.js +37 -32
- package/dist/notice.d.ts +7 -6
- package/dist/plain-files.d.ts +2 -2
- package/dist/plain-files.js +3 -3
- package/dist/regenerate/command-check.d.ts +7 -1
- package/dist/regenerate/command-check.js +43 -1
- package/dist/regenerate/delivery.d.ts +1 -1
- package/dist/regenerate/delivery.js +3 -3
- package/dist/regenerate/launch.d.ts +154 -0
- package/dist/regenerate/{release.js → launch.js} +195 -51
- package/dist/regenerate/ledger.d.ts +32 -1
- package/dist/regenerate/lineage.d.ts +2 -0
- package/dist/regenerate/lineage.js +8 -0
- package/dist/regenerate/loop.d.ts +18 -7
- package/dist/regenerate/loop.js +28 -22
- package/dist/regenerate/paths.d.ts +2 -2
- package/dist/regenerate/paths.js +2 -2
- package/dist/self-invocation.js +7 -7
- package/dist/sentinel-check.d.ts +3 -3
- package/dist/sentinel-check.js +3 -3
- package/dist/sentinel.d.ts +18 -12
- package/dist/sentinel.js +68 -42
- package/docs/README.md +2 -2
- package/docs/chats.md +2 -2
- package/docs/config.md +9 -9
- package/docs/development.md +1 -1
- package/docs/headless.md +1 -1
- package/docs/hosting.md +14 -13
- package/docs/launch.md +67 -0
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +3 -3
- package/docs/sandbox.md +3 -3
- package/docs/sentinel.md +24 -12
- package/docs/skills-and-gates.md +3 -3
- package/docs/using.md +8 -8
- package/genome/rules/turri-regeneration.md +1 -1
- package/package.json +1 -1
- package/dist/regenerate/release.d.ts +0 -121
- package/dist/release-agent.d.ts +0 -43
- package/dist/release-agent.js +0 -130
- package/dist/release-tools.d.ts +0 -44
- package/dist/release-tools.js +0 -170
- package/docs/deploy.md +0 -48
- /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,
|
|
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 {
|
|
30
|
-
import {
|
|
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";
|
|
@@ -39,7 +40,7 @@ import { checkPlainTool } from "./parse-tool.js";
|
|
|
39
40
|
import { changedFiles, projectFiles } from "./plain-files.js";
|
|
40
41
|
import { whyFailed } from "./regenerate/diagnose-job.js";
|
|
41
42
|
import { didNotLand } from "./regenerate/failure-reports.js";
|
|
42
|
-
import { conformanceRefusal, createWorkLoop, describeModules, isUpToDate } from "./regenerate/loop.js";
|
|
43
|
+
import { conformanceRefusal, createWorkLoop, TestingStepsMissing, describeModules, isUpToDate } from "./regenerate/loop.js";
|
|
43
44
|
import { brandNeon, brandPink, plainPaint } from "./regenerate/plain-palette.js";
|
|
44
45
|
import { halfBlocks, JELLYFISH_FRAME_MS, JELLYFISH_REST, JELLYFISH_SEQUENCE, JELLYFISH_TEXT_FRAMES } from "./jellyfish.js";
|
|
45
46
|
import { createJobPanel, didNotPass, keyPressed, PANEL_KEY, spinner } from "./regenerate/job-panel.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 (
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
487
|
-
//
|
|
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
|
|
491
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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,
|
|
@@ -1263,27 +1291,41 @@ echoed = false, react) {
|
|
|
1263
1291
|
else
|
|
1264
1292
|
void pi.sendMessage({ customType: COMMAND_OUTCOME, content, display: false }, { triggerTurn: true, deliverAs: "followUp" });
|
|
1265
1293
|
}
|
|
1294
|
+
/**
|
|
1295
|
+
* What a slash command found for the agent alone - guidance the person need not see: put in the conversation unseen,
|
|
1296
|
+
* and the agent started on it - at once when it is idle, else once its turn ends - told what to do with it.
|
|
1297
|
+
*/
|
|
1298
|
+
export function toldAfterCommand(pi, command, text, react) {
|
|
1299
|
+
const content = `The person ran ${command}. Not shown to them:\n${text}\n\n${react}`;
|
|
1300
|
+
void pi.sendMessage({ customType: COMMAND_OUTCOME, content, display: false }, { triggerTurn: true, deliverAs: "followUp" });
|
|
1301
|
+
}
|
|
1266
1302
|
/**
|
|
1267
1303
|
* What the agent does once /regenerate or /conform has started pulses: a command's output alone leaves the chat silent,
|
|
1268
1304
|
* and the person wondering whether to wait. It says what runs, and that they need not - and starts nothing itself.
|
|
1269
1305
|
*/
|
|
1270
1306
|
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
1307
|
"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
|
|
1308
|
+
"not wait for it. Start nothing for it: no regenerate, no check, no launch - its end is told when it comes.";
|
|
1309
|
+
/**
|
|
1310
|
+
* What the agent does when /conform found a step of adding tests still to take: takes it at once, asking nothing - the
|
|
1311
|
+
* /conform was the person's yes - and says what it writes as the way there, never as a failure: the person saw none.
|
|
1312
|
+
*/
|
|
1313
|
+
export const CONFORM_STEPS_REACTION = "That is what conform needs before it can start - the steps of adding tests still to take - not an error: nothing " +
|
|
1314
|
+
"failed, and the person saw none of it. Their /conform is their yes to conformance tests here, so take the steps now, " +
|
|
1315
|
+
"in that order and only what is missing, asking nothing: the test reqs first; then the conformance testing script, " +
|
|
1316
|
+
"started with its skill before anything else - it runs in the background, so the scenarios are written while it does; " +
|
|
1317
|
+
"then the scenarios of the functional specs they named, or, naming none, of each functional spec that needs them by " +
|
|
1318
|
+
"the rules on test plain files. Then call regenerate for the module: the work loop writes and runs their tests once the " +
|
|
1319
|
+
"code is built. Tell the person in a line or two, as the way to their conformance tests and not as a refusal, what you " +
|
|
1320
|
+
"are writing, and for each functional spec why it needs scenarios - or, when none does, that and why.";
|
|
1273
1321
|
/**
|
|
1274
|
-
* What the agent does when /conform started nothing
|
|
1275
|
-
*
|
|
1322
|
+
* What the agent does when /conform started nothing for a reason that is not a step of adding tests - a functional spec
|
|
1323
|
+
* named that is not there, words it does not take: answers it at once - why, and what would let it start - rather than
|
|
1324
|
+
* leave the person with a refusal and a silent chat.
|
|
1276
1325
|
*/
|
|
1277
|
-
export const CONFORM_REFUSED_REACTION = "Nothing was started from the person's /conform, for the reason shown
|
|
1278
|
-
"
|
|
1279
|
-
"
|
|
1280
|
-
"script, started with its skill before anything else - it runs in the background, so the scenarios are written while it " +
|
|
1281
|
-
"does; then the scenarios of the functional specs they named, " +
|
|
1282
|
-
"or, naming none, of each functional spec that needs them by the rules on test plain files. Then call regenerate for the " +
|
|
1283
|
-
"module: the work loop writes and runs their tests once the code is built. Say in a line or two what you wrote, and for " +
|
|
1284
|
-
"each functional spec why it needs scenarios - or, when none does, that and why. Where it is not yours to settle - a " +
|
|
1285
|
-
"functional spec they named that is not there, ***plain that would have to change its meaning to be tested - tell them " +
|
|
1286
|
-
"why nothing started and what would let it, and start nothing.";
|
|
1326
|
+
export const CONFORM_REFUSED_REACTION = "Nothing was started from the person's /conform, for the reason shown. Tell them in a line or two why, and what would " +
|
|
1327
|
+
"let it start - a functional spec they named that is not there, ***plain that does not parse or would have to change its " +
|
|
1328
|
+
"meaning to be tested - and offer to do what is yours to do; start nothing.";
|
|
1287
1329
|
export const COMMAND_OUTCOME = "turri_command_outcome";
|
|
1288
1330
|
/** Longer than a frame of the TUI's (16ms): an entry appended before it is drawn by its end. */
|
|
1289
1331
|
const ONE_FRAME_MS = 20;
|
|
@@ -1388,10 +1430,18 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1388
1430
|
refusal = whenBuildable(plainFile, () => conformanceRefusal(plainFile, funcIds.length > 0 ? funcIds : undefined));
|
|
1389
1431
|
}
|
|
1390
1432
|
catch (error) {
|
|
1391
|
-
refusal = error instanceof Error ? error.message : String(error);
|
|
1433
|
+
refusal = { text: error instanceof Error ? error.message : String(error), stepsMissing: false };
|
|
1434
|
+
}
|
|
1435
|
+
// A step of adding tests still to take - the test reqs, the script, the scenarios: the chat's to take, so told to it
|
|
1436
|
+
// alone, as what conform needs first. The person sees it take them, and conformance turned on, if it was.
|
|
1437
|
+
if (refusal?.stepsMissing === true) {
|
|
1438
|
+
if (turnedOn !== undefined)
|
|
1439
|
+
shownAfterCommand(pi, ctx, command, turnedOn, "info", true);
|
|
1440
|
+
toldAfterCommand(pi, command, refusal.text, CONFORM_STEPS_REACTION);
|
|
1441
|
+
return;
|
|
1392
1442
|
}
|
|
1393
1443
|
if (refusal !== undefined) {
|
|
1394
|
-
refuse(withTurnedOn(refusal));
|
|
1444
|
+
refuse(withTurnedOn(refusal.text));
|
|
1395
1445
|
return;
|
|
1396
1446
|
}
|
|
1397
1447
|
const module = basename(plainFile).replace(/\.plain$/, "");
|
|
@@ -1417,7 +1467,10 @@ function registerBind(pi, cwd, jobs, turnOn) {
|
|
|
1417
1467
|
shownAfterCommand(pi, ctx, command, text, "info", true, upToDate ? undefined : COMMAND_STARTED_REACTION);
|
|
1418
1468
|
}
|
|
1419
1469
|
catch (error) {
|
|
1420
|
-
|
|
1470
|
+
if (error instanceof TestingStepsMissing)
|
|
1471
|
+
toldAfterCommand(pi, command, error.message, CONFORM_STEPS_REACTION);
|
|
1472
|
+
else
|
|
1473
|
+
refuse(error instanceof Error ? error.message : String(error));
|
|
1421
1474
|
}
|
|
1422
1475
|
})().catch(() => {
|
|
1423
1476
|
// The chat let go meanwhile: there is nobody to say it to.
|
|
@@ -1706,9 +1759,19 @@ function conversationModel(ctx, override) {
|
|
|
1706
1759
|
* The chat's model, read now - it can change while a skill runs - or, from a context that has
|
|
1707
1760
|
* gone stale since, the model it had when it was last readable.
|
|
1708
1761
|
*/
|
|
1709
|
-
/**
|
|
1710
|
-
|
|
1711
|
-
|
|
1762
|
+
/**
|
|
1763
|
+
* The model a launch runs on: the coding model of the codebase - a launch follows steps, and a small model thinking little
|
|
1764
|
+
* does that well. Without a chat's context yet, the config's as it names it.
|
|
1765
|
+
*/
|
|
1766
|
+
function launchModel(ctx, plainFile) {
|
|
1767
|
+
try {
|
|
1768
|
+
if (ctx !== undefined)
|
|
1769
|
+
return projectModel(ctx, plainFile) ?? chatModelOf(ctx);
|
|
1770
|
+
}
|
|
1771
|
+
catch {
|
|
1772
|
+
/* a name the chat cannot resolve: the config's, as it is */
|
|
1773
|
+
}
|
|
1774
|
+
return modelSpec(projectModels(configForSpec(plainFile)).coding);
|
|
1712
1775
|
}
|
|
1713
1776
|
function chatModelOf(ctx) {
|
|
1714
1777
|
try {
|
|
@@ -1799,8 +1862,8 @@ function projectModel(ctx, plainFile) {
|
|
|
1799
1862
|
const workLoops = new WeakMap();
|
|
1800
1863
|
/** How the conversation wants the work planned, for the session - set with steer. */
|
|
1801
1864
|
const steeringStore = createSteeringStore();
|
|
1802
|
-
/**
|
|
1803
|
-
const
|
|
1865
|
+
/** A session's launches, by its jobs: the launch track every chat's launch tool and every pulse's launch share. */
|
|
1866
|
+
const sessionLaunches = new WeakMap();
|
|
1804
1867
|
function workLoopFor(jobs, cwd, ctx) {
|
|
1805
1868
|
let shared = workLoops.get(jobs);
|
|
1806
1869
|
if (shared === undefined) {
|
|
@@ -1813,19 +1876,9 @@ function workLoopFor(jobs, cwd, ctx) {
|
|
|
1813
1876
|
plannerModel: () => chatModelOf(from.ctx),
|
|
1814
1877
|
// How the work is to be planned: the conversation's steering, and AGENTS.md's - read afresh each plan.
|
|
1815
1878
|
steering: (plainFile) => steeringFor(plainFile, cwd, steeringStore),
|
|
1816
|
-
//
|
|
1817
|
-
//
|
|
1818
|
-
|
|
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
|
-
},
|
|
1879
|
+
// A pulse landed: its commit kept for the sentinel - and, under launch-after-pulse, launched in the background, the
|
|
1880
|
+
// codebase's next pulse not waiting on it.
|
|
1881
|
+
landed: (input) => sessionLaunches.get(jobs)?.landed(input),
|
|
1829
1882
|
});
|
|
1830
1883
|
shared = { loop, from };
|
|
1831
1884
|
workLoops.set(jobs, shared);
|
|
@@ -1899,7 +1952,7 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1899
1952
|
name: "pulses",
|
|
1900
1953
|
label: "Pulses",
|
|
1901
1954
|
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
|
|
1955
|
+
"this session - finished, running, and planned, those of a look ahead marked as waiting for regenerate - the launches and what they started, " +
|
|
1903
1956
|
"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
1957
|
"running, whether it still is and its latest output; finished, its report and what the ledger recorded of it - its rounds " +
|
|
1905
1958
|
"and test runs (how many failed the same way), the verdicts, the healers, the model provider's trouble, what turri refused, " +
|
|
@@ -1977,33 +2030,43 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
1977
2030
|
// The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
|
|
1978
2031
|
// list, finished jobs included, put in the transcript where it stays.
|
|
1979
2032
|
pi.registerCommand("halt", {
|
|
1980
|
-
description: "Halt a queued or running pulse, a module's planned pulses, or what
|
|
2033
|
+
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
2034
|
handler: async (args, ctx) => {
|
|
1982
2035
|
if (!ctx.hasUI)
|
|
1983
2036
|
return;
|
|
1984
2037
|
const live = jobs.list().filter((job) => job.status === "running" || job.status === "queued");
|
|
1985
|
-
const
|
|
2038
|
+
const servers = runningLaunched();
|
|
2039
|
+
const track = sessionLaunches.get(jobs)?.track;
|
|
2040
|
+
const underWay = (track?.list() ?? []).filter((launch) => launch.status === "running" || launch.status === "waiting");
|
|
1986
2041
|
const loop = workLoops.get(jobs)?.loop;
|
|
1987
2042
|
// A module's planned pulses, one line a module: halting one halts the module.
|
|
1988
2043
|
const plannedRows = loop?.planned() ?? [];
|
|
1989
2044
|
const planned = [...new Set(plannedRows.map((row) => row.module ?? ""))].filter((module) => module !== "");
|
|
1990
2045
|
let id = args.trim();
|
|
1991
2046
|
if (id === "") {
|
|
1992
|
-
if (live.length === 0 &&
|
|
1993
|
-
return ctx.ui.notify("Nothing is regenerating, queued or
|
|
2047
|
+
if (live.length === 0 && servers.length === 0 && underWay.length === 0 && planned.length === 0)
|
|
2048
|
+
return ctx.ui.notify("Nothing is regenerating, queued, planned or launched.", "info");
|
|
1994
2049
|
const label = (job) => `${job.id} ${job.status.padEnd(8)} ${pulseName(job)}`;
|
|
1995
2050
|
const plannedLabel = (module) => {
|
|
1996
2051
|
const rows = plannedRows.filter((row) => row.module === module);
|
|
1997
2052
|
const waiting = rows.find((row) => row.id.endsWith("-waiting"));
|
|
1998
2053
|
return `${module} ${waiting !== undefined ? waiting.summary : `${rows.length} planned`} - halts the module`;
|
|
1999
2054
|
};
|
|
2000
|
-
const labels = [
|
|
2055
|
+
const labels = [
|
|
2056
|
+
...live.map(label),
|
|
2057
|
+
...planned.map(plannedLabel),
|
|
2058
|
+
...underWay.map(describeLaunchLine),
|
|
2059
|
+
...servers.map((item) => launchedLabel(item.name, item.url ?? item.command)),
|
|
2060
|
+
];
|
|
2001
2061
|
const picked = await ctx.ui.select("Halt which?", labels);
|
|
2002
2062
|
const job = live.find((candidate) => picked !== undefined && label(candidate) === picked);
|
|
2003
2063
|
const module = planned.find((name) => picked !== undefined && plannedLabel(name) === picked);
|
|
2004
|
-
const
|
|
2064
|
+
const launch = underWay.find((candidate) => picked !== undefined && describeLaunchLine(candidate) === picked);
|
|
2065
|
+
const server = servers.find((item) => picked !== undefined && launchedLabel(item.name, item.url ?? item.command) === picked);
|
|
2005
2066
|
if (server !== undefined)
|
|
2006
|
-
id = `
|
|
2067
|
+
id = `launched ${server.name}`;
|
|
2068
|
+
else if (launch !== undefined)
|
|
2069
|
+
id = `launched ${launch.codebase}`;
|
|
2007
2070
|
else if (job !== undefined)
|
|
2008
2071
|
id = job.id;
|
|
2009
2072
|
else if (module !== undefined)
|
|
@@ -2011,11 +2074,9 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2011
2074
|
else
|
|
2012
2075
|
return;
|
|
2013
2076
|
}
|
|
2014
|
-
const name = /^
|
|
2015
|
-
if (name !== undefined)
|
|
2016
|
-
|
|
2017
|
-
return shownAfterCommand(pi, ctx, `/halt ${id}`, stopped.length > 0 ? `Halted ${stopped.join(", ")}.` : `Nothing activate started is running as ${name}.`, "info");
|
|
2018
|
-
}
|
|
2077
|
+
const name = /^launched\s+(.+)$/.exec(id)?.[1]?.trim();
|
|
2078
|
+
if (name !== undefined)
|
|
2079
|
+
return shownAfterCommand(pi, ctx, `/halt ${id}`, await haltLaunched(name, track), "info");
|
|
2019
2080
|
ctx.ui.notify(stopJob(jobs, id, undefined, loop), "info");
|
|
2020
2081
|
},
|
|
2021
2082
|
});
|
|
@@ -2122,18 +2183,42 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2122
2183
|
}
|
|
2123
2184
|
export { fromWorkingDir };
|
|
2124
2185
|
const WATCH_REDRAW_MS = 500;
|
|
2186
|
+
/**
|
|
2187
|
+
* What a chat's agent is told of a pulse it asked for that ended, with the sentinel off. One that landed under
|
|
2188
|
+
* launch-after-pulse is being launched as it is told: it says so, and offers nothing else for it - it is told once the
|
|
2189
|
+
* launch ends.
|
|
2190
|
+
*/
|
|
2191
|
+
export function pulseEndNote(job, options = {}) {
|
|
2192
|
+
const head = job.status === "succeeded"
|
|
2193
|
+
? `Pulse ${job.id} (${job.kind}) finished after ${formatDuration(job)}.\n\n${job.report ?? ""}`
|
|
2194
|
+
: job.status === "stopped"
|
|
2195
|
+
? `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." : ""}`
|
|
2196
|
+
: `Pulse ${job.id} (${job.kind}) failed after ${formatDuration(job)}.\n\n${job.error ?? ""}`;
|
|
2197
|
+
const landed = job.status === "succeeded" && job.details?.landed === true;
|
|
2198
|
+
if (!landed || options.launching !== true)
|
|
2199
|
+
return `${head}\n\n${JOB_FINISHED_REACTION}`;
|
|
2200
|
+
return [
|
|
2201
|
+
head,
|
|
2202
|
+
"",
|
|
2203
|
+
"It landed, and turri is launching the commit it landed now, in the background (launch-after-pulse): you are told once",
|
|
2204
|
+
"that launch ends - where it runs, or why it did not come up. React to this now - the person has not asked, and need",
|
|
2205
|
+
"not: say in a line or two what landed and that it is being launched. Offer nothing else for it - do not call launch,",
|
|
2206
|
+
"open it, run it or test it, and never say nothing runs - and start no other work, unless guidance for this project",
|
|
2207
|
+
"(its AGENTS.md, a skill, what the person said) says to do something besides launching it when a pulse finishes: do",
|
|
2208
|
+
"that. When you are told it is launched, do what you were told to do once something is launched.",
|
|
2209
|
+
].join("\n");
|
|
2210
|
+
}
|
|
2125
2211
|
/**
|
|
2126
2212
|
* 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
2213
|
* in a line or two what ended - the person saw it end already, in the transcript.
|
|
2128
2214
|
*/
|
|
2129
2215
|
export const JOB_FINISHED_REACTION = [
|
|
2130
2216
|
"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 (
|
|
2217
|
+
"what the person said earlier - says what to do when a pulse finishes (launch what was built, run something, tell",
|
|
2132
2218
|
"someone), do that, as it says. Otherwise say in a line or two what finished and what it means for the person - the",
|
|
2133
2219
|
"report is theirs to read in full; do not repeat it - and, when it failed, what they can do. Start no other work.",
|
|
2134
|
-
"
|
|
2135
|
-
"
|
|
2136
|
-
"told to do once something is released (opening it where the person can watch it, saying what to test), if anything.",
|
|
2220
|
+
"Under launch-after-pulse turri launches what a pulse lands itself, in the background: do not call launch for it - you",
|
|
2221
|
+
"are told once it is launched, and do then what you were told to do once something is launched.",
|
|
2137
2222
|
"A pulse that stopped on its environment - \"stopped: turri's sandbox kept its agents from…\" or \"stopped: the",
|
|
2138
2223
|
"environment lacks…\" - stops the same way again until that is fixed: never regenerate it before. Heal it, then regenerate the",
|
|
2139
2224
|
"module to resume:",
|
|
@@ -2448,9 +2533,9 @@ function modulesWithHistory(cwd) {
|
|
|
2448
2533
|
}
|
|
2449
2534
|
/** Stop a job by id or id prefix, and say what that means for the queue. */
|
|
2450
2535
|
/** Every job, in the order it was started, with what a queued one is waiting for. */
|
|
2451
|
-
/** What
|
|
2452
|
-
function
|
|
2453
|
-
return `
|
|
2536
|
+
/** What a launch started, as /halt offers it. */
|
|
2537
|
+
function launchedLabel(name, what) {
|
|
2538
|
+
return `launched ${name} running ${what}`;
|
|
2454
2539
|
}
|
|
2455
2540
|
/** The jobs as the person is shown them: those started, and those the work loop has planned after them. */
|
|
2456
2541
|
function shownJobs(jobs) {
|
|
@@ -2458,8 +2543,10 @@ function shownJobs(jobs) {
|
|
|
2458
2543
|
}
|
|
2459
2544
|
function listJobs(jobs, cwd, runs = EARLIER_RUNS) {
|
|
2460
2545
|
const all = [...shownJobs(jobs)].reverse().filter((job) => job.replacedBy === undefined);
|
|
2461
|
-
const
|
|
2462
|
-
const
|
|
2546
|
+
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})`);
|
|
2547
|
+
const launches = (sessionLaunches.get(jobs)?.track.list() ?? []).slice(-10).reverse().map(describeLaunchLine);
|
|
2548
|
+
const listed = (launches.length > 0 ? `\n\nLaunches, newest first - /halt launched <module> halts one under way:\n${launches.join("\n")}` : "") +
|
|
2549
|
+
(servers.length > 0 ? `\n\nWhat launches started - /halt launched <name> halts one:\n${servers.join("\n")}` : "");
|
|
2463
2550
|
const before = earlierRuns(jobs, cwd, runs);
|
|
2464
2551
|
if (all.length === 0)
|
|
2465
2552
|
return `No pulses have been started in this session.${listed}${before}`;
|
|
@@ -2586,11 +2673,6 @@ function registerSteering(pi, cwd) {
|
|
|
2586
2673
|
},
|
|
2587
2674
|
});
|
|
2588
2675
|
}
|
|
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
2676
|
const SIDE_ENTRY = "turri_btw";
|
|
2595
2677
|
/** 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
2678
|
const SKILL_MESSAGE_ENTRY = "turri_skill_message";
|
|
@@ -2663,20 +2745,37 @@ async function askOnTheSide(pi, ctx, cwd, jobs, question) {
|
|
|
2663
2745
|
}
|
|
2664
2746
|
return answer;
|
|
2665
2747
|
}
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2748
|
+
/** A launch ended, told to a chat's agent - to tell the person where it runs, or why it did not come up. */
|
|
2749
|
+
function tellLaunch(pi, jobs, launch) {
|
|
2750
|
+
const job = "pulse" in launch.cause ? jobs.get(launch.cause.pulse) : undefined;
|
|
2751
|
+
void pi.sendMessage({ customType: "turri_launch", content: launchedNote(launch, job), display: false, details: { launch: launch.id, status: launch.status } }, { triggerTurn: true, deliverAs: "followUp" });
|
|
2752
|
+
}
|
|
2753
|
+
/** A newer launch took the place of one a chat asked for, told to its agent: it hears that one's end instead. */
|
|
2754
|
+
function tellReplaced(pi, jobs, launch, next) {
|
|
2755
|
+
const job = "pulse" in next.cause ? jobs.get(next.cause.pulse) : undefined;
|
|
2756
|
+
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" });
|
|
2757
|
+
}
|
|
2758
|
+
function registerLaunch(pi, cwd, jobs) {
|
|
2759
|
+
const launches = sessionLaunches.get(jobs);
|
|
2760
|
+
if (launches !== undefined) {
|
|
2761
|
+
pi.registerTool(launchTool({
|
|
2762
|
+
cwd,
|
|
2763
|
+
track: launches.track,
|
|
2764
|
+
defaultPlainFile: () => readProjectConfig(cwd).module,
|
|
2765
|
+
chat: () => currentChat()?.id,
|
|
2766
|
+
// Told in the chat that asked, as a launch after a pulse is with the sentinel off.
|
|
2767
|
+
ended: (launch) => tellLaunch(pi, jobs, launch),
|
|
2768
|
+
replaced: (launch, next) => tellReplaced(pi, jobs, launch, next),
|
|
2769
|
+
wait: (ctx) => shouldWait(ctx.mode, undefined),
|
|
2770
|
+
}));
|
|
2771
|
+
}
|
|
2772
|
+
pi.registerTool(haltTool({ jobs, workLoop: () => workLoops.get(jobs)?.loop, ...(launches !== undefined ? { launches: launches.track } : {}) }));
|
|
2773
|
+
// What launches started runs until turri ends - not when a chat is opened, closed, forked or reloaded.
|
|
2677
2774
|
pi.on("session_shutdown", async (event) => {
|
|
2678
|
-
if (event.reason
|
|
2679
|
-
|
|
2775
|
+
if (event.reason !== "quit")
|
|
2776
|
+
return;
|
|
2777
|
+
await launches?.track.stop();
|
|
2778
|
+
await stopLaunched();
|
|
2680
2779
|
});
|
|
2681
2780
|
}
|
|
2682
2781
|
const MILESTONE_ENTRY = "turri_milestone";
|
|
@@ -2897,7 +2996,8 @@ function registerBranding(pi, skills) {
|
|
|
2897
2996
|
(data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
|
|
2898
2997
|
// A newer turri out, or one installed and hidden behind this one: said first, under the version it is about.
|
|
2899
2998
|
...(data.versions ?? []).map((line) => theme.fg("warning", line)),
|
|
2900
|
-
|
|
2999
|
+
// A key renamed is information; the rest are the person's to take out.
|
|
3000
|
+
...(data.config ?? []).map((line) => theme.fg(line.kind === "renamed" ? "muted" : "warning", line.text)),
|
|
2901
3001
|
`${theme.fg("text", "the first coding agent with the power of ")}${brandPink(theme)("regenerative software")}`,
|
|
2902
3002
|
// Where the settings are changed, without leaving the chat.
|
|
2903
3003
|
theme.fg("muted", "configure with /settings"),
|
|
@@ -2949,7 +3049,7 @@ function registerBranding(pi, skills) {
|
|
|
2949
3049
|
pending: skills.pending.length,
|
|
2950
3050
|
sandbox: sandboxSummary(),
|
|
2951
3051
|
versions: versions.lines,
|
|
2952
|
-
config:
|
|
3052
|
+
config: configLines(ctx.cwd),
|
|
2953
3053
|
});
|
|
2954
3054
|
}
|
|
2955
3055
|
catch {
|