@turri-dev/cli 0.4.2 → 0.4.3-next.3fc888b
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 +1 -0
- package/dist/background-skills.d.ts +4 -1
- package/dist/background-skills.js +9 -1
- package/dist/capture/agents.d.ts +391 -0
- package/dist/capture/agents.js +338 -0
- package/dist/capture/area.d.ts +58 -0
- package/dist/capture/area.js +197 -0
- package/dist/capture/assemble.d.ts +122 -0
- package/dist/capture/assemble.js +452 -0
- package/dist/capture/capture.d.ts +116 -0
- package/dist/capture/capture.js +1281 -0
- package/dist/capture/chat.d.ts +29 -0
- package/dist/capture/chat.js +94 -0
- package/dist/capture/checks.d.ts +142 -0
- package/dist/capture/checks.js +643 -0
- package/dist/capture/config.d.ts +13 -0
- package/dist/capture/config.js +60 -0
- package/dist/capture/interface.d.ts +71 -0
- package/dist/capture/interface.js +199 -0
- package/dist/capture/map.d.ts +58 -0
- package/dist/capture/map.js +530 -0
- package/dist/capture/plan.d.ts +8 -0
- package/dist/capture/plan.js +13 -0
- package/dist/capture/progress.d.ts +109 -0
- package/dist/capture/progress.js +240 -0
- package/dist/capture/report.d.ts +75 -0
- package/dist/capture/report.js +268 -0
- package/dist/capture/scripts.d.ts +26 -0
- package/dist/capture/scripts.js +33 -0
- package/dist/capture/state.d.ts +299 -0
- package/dist/capture/state.js +43 -0
- package/dist/capture/trial.d.ts +34 -0
- package/dist/capture/trial.js +89 -0
- package/dist/capture-cli.d.ts +1 -0
- package/dist/capture-cli.js +77 -0
- package/dist/chat-commands.d.ts +2 -10
- package/dist/chat-commands.js +3 -57
- package/dist/chat-tab-header.d.ts +15 -0
- package/dist/chat-tab-header.js +78 -0
- package/dist/chat-tabs.d.ts +26 -0
- package/dist/chat-tabs.js +100 -0
- package/dist/chat-terminal.js +57 -8
- package/dist/chat-waiting.d.ts +4 -1
- package/dist/chat-waiting.js +7 -4
- package/dist/chats.d.ts +11 -6
- package/dist/chats.js +34 -20
- package/dist/cli.js +32 -14
- package/dist/config-edit.js +4 -2
- package/dist/config.d.ts +15 -2
- package/dist/config.js +62 -4
- package/dist/extension.d.ts +1 -0
- package/dist/extension.js +199 -55
- package/dist/identity.js +2 -1
- package/dist/init-config.js +2 -0
- package/dist/loop-cli.js +5 -1
- package/dist/loop-tools.js +5 -1
- package/dist/new-project.d.ts +5 -0
- package/dist/new-project.js +11 -0
- package/dist/pi-launch.js +2 -0
- package/dist/pi-themes.d.ts +3 -0
- package/dist/pi-themes.js +21 -0
- package/dist/pi.js +2 -2
- package/dist/plain-code-blocks.d.ts +14 -0
- package/dist/plain-code-blocks.js +56 -0
- package/dist/pointer-hover.d.ts +12 -0
- package/dist/pointer-hover.js +48 -0
- package/dist/question-dialog.d.ts +5 -0
- package/dist/question-dialog.js +20 -1
- package/dist/regenerate/command-check.js +80 -11
- package/dist/regenerate/job-panel.d.ts +5 -107
- package/dist/regenerate/job-panel.js +4 -289
- package/dist/regenerate/jobs-tree.d.ts +1 -0
- package/dist/regenerate/jobs-tree.js +5 -1
- package/dist/regenerate/loop.js +9 -1
- package/dist/regenerate/side-panel.d.ts +6 -1
- package/dist/regenerate/side-panel.js +158 -22
- package/dist/regenerate/spec-map-view.d.ts +11 -3
- package/dist/regenerate/spec-map-view.js +22 -2
- package/dist/regenerate/test-scripts.d.ts +5 -0
- package/dist/regenerate/test-scripts.js +4 -0
- package/dist/reopen.d.ts +29 -0
- package/dist/reopen.js +47 -0
- package/dist/resume-line.d.ts +4 -1
- package/dist/resume-line.js +5 -2
- package/dist/sentinel-chat.js +7 -2
- package/dist/sentinel.d.ts +1 -1
- package/dist/sentinel.js +3 -1
- package/dist/setup.js +9 -1
- package/dist/terminal-notifications.d.ts +31 -0
- package/dist/terminal-notifications.js +134 -0
- package/docs/README.md +2 -0
- package/docs/capture.md +207 -0
- package/docs/chats.md +8 -6
- package/docs/config.md +16 -3
- package/docs/development.md +4 -1
- package/docs/hosting.md +2 -2
- package/docs/launch.md +2 -2
- package/docs/regenerating.md +1 -1
- package/docs/sandbox.md +2 -2
- package/docs/sentinel.md +11 -11
- package/docs/theming.md +3 -3
- package/docs/using.md +10 -2
- package/genome/capture/capture.md +26 -0
- package/genome/capture/check-conventions.md +5 -0
- package/genome/capture/check-reference.md +11 -0
- package/genome/capture/compact.md +7 -0
- package/genome/capture/concepts.md +3 -0
- package/genome/capture/divide.md +9 -0
- package/genome/capture/feature.md +45 -0
- package/genome/capture/interface.md +9 -0
- package/genome/capture/modules.md +23 -0
- package/genome/capture/outline.md +11 -0
- package/genome/capture/readability.md +12 -0
- package/genome/capture/reference.md +10 -0
- package/genome/capture/split.md +9 -0
- package/genome/capture/survey.md +37 -0
- package/genome/capture/trial.md +18 -0
- package/genome/capture/verify.md +7 -0
- package/genome/rules/turri-regeneration.md +1 -1
- package/package.json +3 -3
package/dist/extension.js
CHANGED
|
@@ -20,6 +20,12 @@ import { applyBedrockRegion } from "./bedrock-region.js";
|
|
|
20
20
|
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
|
+
import { runCapture } from "./capture/capture.js";
|
|
24
|
+
import { captureEnded, captureFailed, captureGoesOn, captureOpenQuestion, captureRefusal, captureStartedText, readReopenedAfterCapture, reopenedAfterCapture } from "./capture/chat.js";
|
|
25
|
+
import { reportFile as captureReportFile } from "./capture/state.js";
|
|
26
|
+
import { canReopen, REOPENED_AFTER_CAPTURE, reopenIn } from "./reopen.js";
|
|
27
|
+
import { captureStatusLines } from "./capture/progress.js";
|
|
28
|
+
import { highlightPlainCodeBlocks } from "./plain-code-blocks.js";
|
|
23
29
|
import { createAskUserTool } from "./tools.js";
|
|
24
30
|
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
31
|
import { createWebTools } from "./regenerate/web.js";
|
|
@@ -32,7 +38,7 @@ import { createSessionLaunches, launchedDir, launchedNote, replacedNote } from "
|
|
|
32
38
|
import { describeLaunchLine, launchText } from "./launch-track.js";
|
|
33
39
|
import { checkedSpecs } from "./sentinel-check.js";
|
|
34
40
|
import { askedForCommandLine, refusal, selfInvocation, TOOLS_NOT_CLI } from "./self-invocation.js";
|
|
35
|
-
import { NEW_PROJECT } from "./new-project.js";
|
|
41
|
+
import { CAPTURE_HINT, NEW_PROJECT } from "./new-project.js";
|
|
36
42
|
import { describeResolution, resolveModel } from "./regenerate/model-names.js";
|
|
37
43
|
import { checkPlainFile, formatCheckResults } from "./plain/check.js";
|
|
38
44
|
import { checkPlainTool } from "./parse-tool.js";
|
|
@@ -42,7 +48,7 @@ import { didNotLand } from "./regenerate/failure-reports.js";
|
|
|
42
48
|
import { conformanceRefusal, createWorkLoop, TestingStepsMissing, describeModules, isUpToDate } from "./regenerate/loop.js";
|
|
43
49
|
import { brandNeon, brandPink, plainPaint } from "./regenerate/plain-palette.js";
|
|
44
50
|
import { halfBlocks, JELLYFISH_FRAME_MS, JELLYFISH_REST, JELLYFISH_SEQUENCE, JELLYFISH_TEXT_FRAMES } from "./jellyfish.js";
|
|
45
|
-
import {
|
|
51
|
+
import { didNotPass, PANEL_KEY, spinner } from "./regenerate/job-panel.js";
|
|
46
52
|
import { clickToFocus, dockedWidth, narrowChat, shade, shadeChat } from "./regenerate/panel-dock.js";
|
|
47
53
|
import { overPictureRow, PICTURE_AT } from "./picture-row.js";
|
|
48
54
|
import { padScreen, paddedColumns, paddedRows, SCREEN_PADDING } from "./screen-padding.js";
|
|
@@ -50,6 +56,7 @@ import { skillAboutLine, skillProgressLine } from "./skill-progress.js";
|
|
|
50
56
|
import { createSidePanel } from "./regenerate/side-panel.js";
|
|
51
57
|
import { createSpecMapSource, defaultMapFiles } from "./regenerate/spec-map.js";
|
|
52
58
|
import { createSpecMapState } from "./regenerate/spec-map-view.js";
|
|
59
|
+
import { notificationView } from "./terminal-notifications.js";
|
|
53
60
|
import { createJobsTreeState, selectJob } from "./regenerate/jobs-tree.js";
|
|
54
61
|
import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
|
|
55
62
|
import { HISTORY_DIR, historyLog } from "./regenerate/lineage.js";
|
|
@@ -78,6 +85,7 @@ import { ignoredGuidance, keepGuidance, landedNote, pulseEndsBlock, SENTINEL, SE
|
|
|
78
85
|
import { noticeDialogs, registerSentinel } from "./sentinel-chat.js";
|
|
79
86
|
import { currentChat } from "./chat-scope.js";
|
|
80
87
|
import { registerChats } from "./chat-commands.js";
|
|
88
|
+
import { buttonLabel, terminalPointer } from "./pointer-hover.js";
|
|
81
89
|
import { turriIdentity } from "./environment.js";
|
|
82
90
|
import { answerSideQuestion, askWithAsides, BTW_HOW, runningSkill, skillRunStarted, skillSessionText, transcriptOf } from "./btw.js";
|
|
83
91
|
import { createJobRegistry, defaultParallelJobs, describeJob, formatDuration, pulseName, shouldWait, STOPPED_ON_REQUEST, } from "./regenerate/jobs.js";
|
|
@@ -294,12 +302,29 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
294
302
|
// The AWS region the project's Bedrock models need, before any model is called - a host has no shell to export it in.
|
|
295
303
|
applyBedrockRegion(cwd);
|
|
296
304
|
let core;
|
|
305
|
+
// One activity light for every chat. Only plan changes need to read the plan; streaming job updates do not.
|
|
306
|
+
let planning = false;
|
|
307
|
+
const running = new Set();
|
|
308
|
+
const busy = () => planning || running.size > 0;
|
|
309
|
+
const updateActivity = (job) => {
|
|
310
|
+
if (!core?.terminal)
|
|
311
|
+
return;
|
|
312
|
+
const before = busy();
|
|
313
|
+
if (!job)
|
|
314
|
+
planning = workLoops.get(jobs)?.loop.planned().some((row) => row.planning !== undefined) ?? false;
|
|
315
|
+
else if (job.status === "running" && (job.kind === "regenerate" || job.kind === "conformance"))
|
|
316
|
+
running.add(job.id);
|
|
317
|
+
else
|
|
318
|
+
running.delete(job.id);
|
|
319
|
+
if (busy() !== before)
|
|
320
|
+
core.changed();
|
|
321
|
+
};
|
|
297
322
|
// Finished work is announced twice, to two audiences, because pi treats them differently - see ChatInstance.announce:
|
|
298
323
|
// in the chat that asked for it, or the one shown when that is closed.
|
|
299
324
|
const jobs = createJobRegistry({
|
|
300
|
-
// The
|
|
325
|
+
// The planner can be at work before the registry has its first pulse.
|
|
301
326
|
onNotify: () => {
|
|
302
|
-
|
|
327
|
+
updateActivity();
|
|
303
328
|
host.onPlanChange?.();
|
|
304
329
|
},
|
|
305
330
|
// A job that fails is run once more; failing again, it and every job behind it fail, and the
|
|
@@ -321,16 +346,16 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
321
346
|
return diagnosis !== undefined ? describeDiagnosis(diagnosis) : undefined;
|
|
322
347
|
},
|
|
323
348
|
onChange: (job) => {
|
|
324
|
-
|
|
349
|
+
updateActivity(job);
|
|
325
350
|
host.onJobChange?.(job);
|
|
326
351
|
},
|
|
327
352
|
onFinish: (job) => {
|
|
328
|
-
|
|
353
|
+
updateActivity(job);
|
|
329
354
|
host.onJobChange?.(job);
|
|
330
355
|
// Queued again as another job: that one says how it went.
|
|
331
356
|
if (job.replacedBy !== undefined)
|
|
332
357
|
return;
|
|
333
|
-
// Gone wrong: the next ctrl+h opens on it
|
|
358
|
+
// Gone wrong: the next ctrl+h opens on it.
|
|
334
359
|
if (job.status === "failed" || job.status === "stopped" || didNotPass(job))
|
|
335
360
|
needsLooking.set(jobs, job.id);
|
|
336
361
|
core?.jobFinished(job);
|
|
@@ -343,7 +368,6 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
343
368
|
jobs,
|
|
344
369
|
model: (plainFile) => launchModel(workLoops.get(jobs)?.from.ctx, plainFile),
|
|
345
370
|
onChange: (launch) => {
|
|
346
|
-
core?.jobsChanged();
|
|
347
371
|
try {
|
|
348
372
|
host.onLaunch?.(launch);
|
|
349
373
|
}
|
|
@@ -359,7 +383,7 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
359
383
|
launches,
|
|
360
384
|
host,
|
|
361
385
|
jobs,
|
|
362
|
-
extension: (pi, link) => turriExtension(pi, core, link),
|
|
386
|
+
extension: (pi, link) => turriExtension(pi, core, link, busy),
|
|
363
387
|
// A finished pulse goes to the sentinel when the project wants one - read as each pulse finishes - the person asked
|
|
364
388
|
// first under `sentinel: ask`, and what they choose for the project written.
|
|
365
389
|
sentinel: () => sentinelSetting(cwd),
|
|
@@ -427,7 +451,7 @@ export function sessionLoop(session) {
|
|
|
427
451
|
* turri's extension, built into one chat of the session: its tools, commands and handlers run in the chat's scope -
|
|
428
452
|
* its id on the pulses it asks for - on the session's job registry and work loop.
|
|
429
453
|
*/
|
|
430
|
-
function turriExtension(api, session, link) {
|
|
454
|
+
function turriExtension(api, session, link, busy) {
|
|
431
455
|
const pi = scopedToChat(api, link.scope);
|
|
432
456
|
const { cwd, host, jobs } = session;
|
|
433
457
|
// The session's sentinel: its own prompt and tools - the project to read, notices, its guidance - and nothing that
|
|
@@ -442,8 +466,6 @@ function turriExtension(api, session, link) {
|
|
|
442
466
|
const dialogs = link.dialogs ?? host.dialogs;
|
|
443
467
|
// turri's own skills, and the project's - .turri/skills, .agents/skills (skills.ts).
|
|
444
468
|
const discoveredSkills = discoverSkills(PACKAGE_ROOT, cwd);
|
|
445
|
-
// What the background work is doing right now, drawn above the editor while it runs.
|
|
446
|
-
const panel = createJobPanel(() => shownJobs(jobs));
|
|
447
469
|
// The chat's context, as its tools and handlers were last given it: for its model and its providers.
|
|
448
470
|
let lastContext;
|
|
449
471
|
const contextNow = () => {
|
|
@@ -464,7 +486,8 @@ function turriExtension(api, session, link) {
|
|
|
464
486
|
// does what the project's guidance says to do then (launch what was built, say), or says
|
|
465
487
|
// what finished. In the chat that asked for the pulse, shown or not.
|
|
466
488
|
const announce = (job) => {
|
|
467
|
-
|
|
489
|
+
if (!session.terminal)
|
|
490
|
+
announceJob(pi, job);
|
|
468
491
|
// A pulse a call of this chat waits for is told in that call's reply: a turn of its own would say it again.
|
|
469
492
|
if (toldByWaitingCall(jobs, job) && job.specConflict === undefined)
|
|
470
493
|
return;
|
|
@@ -480,12 +503,13 @@ function turriExtension(api, session, link) {
|
|
|
480
503
|
catch {
|
|
481
504
|
/* a config that cannot be read launches nothing */
|
|
482
505
|
}
|
|
506
|
+
const quiet = session.terminal && job.status === "succeeded" && !didNotPass(job);
|
|
483
507
|
void pi.sendMessage({
|
|
484
508
|
customType: "turri_job",
|
|
485
|
-
content: pulseEndNote(job, { launching }),
|
|
509
|
+
content: pulseEndNote(job, { launching, quiet }),
|
|
486
510
|
display: false,
|
|
487
511
|
details: { jobId: job.id, status: job.status },
|
|
488
|
-
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
512
|
+
}, quiet ? { triggerTurn: false } : { triggerTurn: true, deliverAs: "followUp" });
|
|
489
513
|
};
|
|
490
514
|
// The sentinel's: what a pulse that ended is, told to its agent in a conversation of its own for the pulse. The hidden
|
|
491
515
|
// message is the conversation's first entry - a host splits the sentinel's work by pulse on it - so the pulse's end is
|
|
@@ -530,13 +554,14 @@ function turriExtension(api, session, link) {
|
|
|
530
554
|
// it landed and what the sentinel does with it - and nothing more: the pulse is the sentinel's. ***plain that
|
|
531
555
|
// contradicts itself is put to the person at once, by turri itself, as the chat would have been started on it.
|
|
532
556
|
const landed = (job, options = {}) => {
|
|
533
|
-
|
|
557
|
+
if (!session.terminal)
|
|
558
|
+
announceJob(pi, job);
|
|
534
559
|
if (job.specConflict !== undefined)
|
|
535
560
|
session.notice(specConflictNotice(job, specConflictTask(job.specConflict)));
|
|
536
561
|
if (options.tell !== true || toldByWaitingCall(jobs, job))
|
|
537
562
|
return;
|
|
538
563
|
// A host that shows the person the pulse's end itself: the chat knows of it - in order, with no turn of its own.
|
|
539
|
-
const shown = host.pulseEndsShown === true;
|
|
564
|
+
const shown = session.terminal || host.pulseEndsShown === true;
|
|
540
565
|
let launching = false;
|
|
541
566
|
try {
|
|
542
567
|
launching = readProjectConfig(cwd, job.configModule).launchAfterPulse === true;
|
|
@@ -548,6 +573,18 @@ function turriExtension(api, session, link) {
|
|
|
548
573
|
};
|
|
549
574
|
const notices = noticeDialogs(pi, session, link, contextNow);
|
|
550
575
|
link.live({
|
|
576
|
+
plainPanel: {
|
|
577
|
+
busy,
|
|
578
|
+
open: () => sidePanelOf(session).visible(),
|
|
579
|
+
toggle: () => {
|
|
580
|
+
const panel = sidePanelOf(session);
|
|
581
|
+
if (panel.visible())
|
|
582
|
+
return panel.close();
|
|
583
|
+
const ctx = contextNow();
|
|
584
|
+
if (ctx?.hasUI)
|
|
585
|
+
panel.open(ctx, "map", "beside");
|
|
586
|
+
},
|
|
587
|
+
},
|
|
551
588
|
announce,
|
|
552
589
|
landed,
|
|
553
590
|
brief,
|
|
@@ -560,7 +597,6 @@ function turriExtension(api, session, link) {
|
|
|
560
597
|
act: (task) => {
|
|
561
598
|
void pi.sendMessage({ customType: "turri_notice_answer", content: task, display: false }, { triggerTurn: true, deliverAs: "followUp" });
|
|
562
599
|
},
|
|
563
|
-
jobsChanged: () => panel.refresh(),
|
|
564
600
|
thinkingLevel: () => pi.getThinkingLevel(),
|
|
565
601
|
context: contextNow,
|
|
566
602
|
});
|
|
@@ -612,7 +648,8 @@ function turriExtension(api, session, link) {
|
|
|
612
648
|
systemPrompt: conversationSystemPrompt(event.systemPrompt, host, [
|
|
613
649
|
TOOLS_NOT_CLI,
|
|
614
650
|
NEW_PROJECT,
|
|
615
|
-
|
|
651
|
+
CAPTURE_HINT,
|
|
652
|
+
pulseEndsBlock(session.sentinelOn(), session.terminal),
|
|
616
653
|
// Conformance tests - what they are, whether they are on here, and how they are turned on: every turn, read afresh.
|
|
617
654
|
conformanceBlock(conformanceTestsOnIn(cwd)),
|
|
618
655
|
projectConfigBlock(cwd),
|
|
@@ -704,31 +741,9 @@ function turriExtension(api, session, link) {
|
|
|
704
741
|
};
|
|
705
742
|
pi.on("agent_end", endTurnCapture);
|
|
706
743
|
pi.on("agent_settled", endTurnCapture);
|
|
707
|
-
pi.on("session_start", (_event, ctx) => {
|
|
708
|
-
if (!ctx.hasUI)
|
|
709
|
-
return;
|
|
710
|
-
panel.attach({
|
|
711
|
-
setWidget: (key, content, options) => {
|
|
712
|
-
try {
|
|
713
|
-
ctx.ui.setWidget(key, content, options);
|
|
714
|
-
}
|
|
715
|
-
catch {
|
|
716
|
-
/* rebuilt by pi since: its new extension draws the panel */
|
|
717
|
-
}
|
|
718
|
-
},
|
|
719
|
-
getToolsExpanded: () => {
|
|
720
|
-
try {
|
|
721
|
-
return ctx.ui.getToolsExpanded();
|
|
722
|
-
}
|
|
723
|
-
catch {
|
|
724
|
-
return false;
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
});
|
|
728
|
-
});
|
|
729
744
|
registerBranding(pi, discoveredSkills);
|
|
730
745
|
registerInterviewLog(pi);
|
|
731
|
-
registerJobTools(pi,
|
|
746
|
+
registerJobTools(pi, session);
|
|
732
747
|
// The skills the person starts themselves - a project's, marked command-only: each has its command, and cultivate starts it only
|
|
733
748
|
// once its command is typed, or picked among the options the conversation offers with ask_user.
|
|
734
749
|
const gate = createCommandGate();
|
|
@@ -775,6 +790,8 @@ function turriExtension(api, session, link) {
|
|
|
775
790
|
for (const controller of backgroundSkillRuns.values())
|
|
776
791
|
controller.abort();
|
|
777
792
|
});
|
|
793
|
+
// An existing codebase captured into ***plain, in the background: the person starts it, never the chat's agent.
|
|
794
|
+
registerCapture(pi, cwd, skillRunEnds);
|
|
778
795
|
const startInBackground = (skill, params, plainFile, ctx) => {
|
|
779
796
|
const key = `${cwd}\0${skill.name}`;
|
|
780
797
|
const kind = scriptKindOfSkill(skill.name);
|
|
@@ -1986,7 +2003,8 @@ const needsLooking = new WeakMap();
|
|
|
1986
2003
|
/** What heads a pulse told from the ledger: it is not this session's, and the facts are all there is of it. */
|
|
1987
2004
|
const pastPulseNote = "A pulse of an earlier session, as the ledger recorded it - facts, not its transcript. Its whole log is the file it names, " +
|
|
1988
2005
|
"for the read tool.";
|
|
1989
|
-
function registerJobTools(pi,
|
|
2006
|
+
function registerJobTools(pi, session) {
|
|
2007
|
+
const { jobs, cwd } = session;
|
|
1990
2008
|
pi.registerTool(doctorTool({ cwd }));
|
|
1991
2009
|
pi.registerTool({
|
|
1992
2010
|
name: "pulses",
|
|
@@ -2067,8 +2085,6 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2067
2085
|
return { content: [{ type: "text", text }], details: { status: job.status } };
|
|
2068
2086
|
},
|
|
2069
2087
|
});
|
|
2070
|
-
// The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
|
|
2071
|
-
// list, finished jobs included, put in the transcript where it stays.
|
|
2072
2088
|
pi.registerCommand("halt", {
|
|
2073
2089
|
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>]",
|
|
2074
2090
|
handler: async (args, ctx) => {
|
|
@@ -2146,8 +2162,14 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2146
2162
|
// While the panel has the keys, every key is its own.
|
|
2147
2163
|
// The side panel is the session's, one for every chat: it stays on the screen - beside the chat or over it - as
|
|
2148
2164
|
// another chat is shown, and what it says to a chat it says to the one shown.
|
|
2149
|
-
const sidePanel = sidePanelOf(
|
|
2165
|
+
const sidePanel = sidePanelOf(session);
|
|
2150
2166
|
const openPanel = sidePanel.open;
|
|
2167
|
+
if (session.terminal)
|
|
2168
|
+
pi.registerCommand("notifications", {
|
|
2169
|
+
description: "Open the side panel on finished pulses and sentinel notices",
|
|
2170
|
+
handler: async (_args, ctx) => { if (ctx.hasUI)
|
|
2171
|
+
openPanel(ctx, "notifications", "beside"); },
|
|
2172
|
+
});
|
|
2151
2173
|
pi.on("session_start", () => {
|
|
2152
2174
|
sidePanel.say = (text) => pi.sendUserMessage(text, { deliverAs: "followUp" });
|
|
2153
2175
|
});
|
|
@@ -2234,6 +2256,8 @@ export function pulseEndNote(job, options = {}) {
|
|
|
2234
2256
|
: job.status === "stopped"
|
|
2235
2257
|
? `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." : ""}`
|
|
2236
2258
|
: `Pulse ${job.id} (${job.kind}) failed after ${formatDuration(job)}.\n\n${job.error ?? ""}`;
|
|
2259
|
+
if (options.quiet)
|
|
2260
|
+
return `${head}\n\nThis result is in notifications. It needs no announcement in the chat.`;
|
|
2237
2261
|
const landed = job.status === "succeeded" && job.details?.landed === true;
|
|
2238
2262
|
if (!landed || options.launching !== true)
|
|
2239
2263
|
return `${head}\n\n${JOB_FINISHED_REACTION}`;
|
|
@@ -2281,12 +2305,15 @@ export const JOB_FINISHED_REACTION = [
|
|
|
2281
2305
|
].join("\n");
|
|
2282
2306
|
const sidePanels = new WeakMap();
|
|
2283
2307
|
/** The side panel of the session these jobs are, made as a chat first asks for it. */
|
|
2284
|
-
function sidePanelOf(
|
|
2308
|
+
function sidePanelOf(session) {
|
|
2309
|
+
const { jobs, cwd } = session;
|
|
2285
2310
|
const known = sidePanels.get(jobs);
|
|
2286
2311
|
if (known !== undefined)
|
|
2287
2312
|
return known;
|
|
2288
2313
|
const self = {
|
|
2289
|
-
open: (ctx, view) => openPanel(ctx, view),
|
|
2314
|
+
open: (ctx, view, placement) => openPanel(ctx, view, placement),
|
|
2315
|
+
visible: () => panel !== undefined && panel.handle?.isHidden() !== true,
|
|
2316
|
+
close: () => panel?.close(),
|
|
2290
2317
|
shown: () => panel !== undefined && panel.keys,
|
|
2291
2318
|
};
|
|
2292
2319
|
sidePanels.set(jobs, self);
|
|
@@ -2324,9 +2351,7 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2324
2351
|
plan: () => workLoops.get(jobs)?.loop.mapPlan() ?? { files: [], codebases: [] },
|
|
2325
2352
|
});
|
|
2326
2353
|
/** Open the side panel - on the view named, or as it was left. */
|
|
2327
|
-
const openPanel = (ctx, view) => {
|
|
2328
|
-
// Found: ctrl+h under the job panel stops breathing.
|
|
2329
|
-
keyPressed("peek");
|
|
2354
|
+
const openPanel = (ctx, view, placement) => {
|
|
2330
2355
|
if (view !== undefined)
|
|
2331
2356
|
mapState.view = view;
|
|
2332
2357
|
// A pulse that failed or stopped since the panel was last opened: opened as it is, it is on that pulse - what went
|
|
@@ -2337,7 +2362,10 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2337
2362
|
mapState.view = "pulses";
|
|
2338
2363
|
}
|
|
2339
2364
|
needsLooking.delete(jobs);
|
|
2365
|
+
if (placement === "beside")
|
|
2366
|
+
panelDocked = true;
|
|
2340
2367
|
if (panel !== undefined) {
|
|
2368
|
+
panel.layOut();
|
|
2341
2369
|
panel.keepChatFocus();
|
|
2342
2370
|
panel.handle?.setHidden(false);
|
|
2343
2371
|
panel.keys = true;
|
|
@@ -2406,6 +2434,9 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2406
2434
|
// Opened, it reads the files again at once: they may have changed while it was closed.
|
|
2407
2435
|
specMap.refresh();
|
|
2408
2436
|
const view = createSidePanel({
|
|
2437
|
+
...(session.terminal ? { notifications: notificationView(session, { accent: (text) => theme.fg("accent", text), muted: (text) => theme.fg("muted", text), bold: (text) => theme.bold(text) }, back) } : {}),
|
|
2438
|
+
pointer: terminalPointer(tui.terminal),
|
|
2439
|
+
tabLabel: (text, active, hovered, role) => buttonLabel(theme, text, active, hovered, role),
|
|
2409
2440
|
jobs: () => shownJobs(jobs),
|
|
2410
2441
|
earlier: earlierJobs,
|
|
2411
2442
|
tree: jobsTree,
|
|
@@ -2451,7 +2482,7 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2451
2482
|
return focused !== null && focused !== component;
|
|
2452
2483
|
},
|
|
2453
2484
|
});
|
|
2454
|
-
const entry = { view, close, keepChatFocus, keys: true };
|
|
2485
|
+
const entry = { view, close, keepChatFocus, layOut, keys: true };
|
|
2455
2486
|
panel = entry;
|
|
2456
2487
|
layOut();
|
|
2457
2488
|
// Every key goes to the panel while it shows, whatever has the focus: a question the chat model asks in the
|
|
@@ -2529,7 +2560,7 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2529
2560
|
view.handleInput(data);
|
|
2530
2561
|
tui.requestRender();
|
|
2531
2562
|
},
|
|
2532
|
-
handleMouse: (event) => view.handleMouse(event),
|
|
2563
|
+
handleMouse: (event) => view.handleMouse(panelBeside() > 0 ? { ...event, x: event.x - 2, width: event.width - 2 } : event),
|
|
2533
2564
|
invalidate: () => view.invalidate(),
|
|
2534
2565
|
dispose: () => {
|
|
2535
2566
|
unlisten();
|
|
@@ -2658,6 +2689,117 @@ function registerCheckPlain(pi, cwd, dialogs, afterAnswer) {
|
|
|
2658
2689
|
const SIDE_ENTRY = "turri_btw";
|
|
2659
2690
|
/** A message the person sent while a skill ran in the chat, read by the skill's agent: drawn as the message it is. */
|
|
2660
2691
|
const SKILL_MESSAGE_ENTRY = "turri_skill_message";
|
|
2692
|
+
/** The capture's lines above the input while it runs. */
|
|
2693
|
+
const CAPTURE_WIDGET = "turri-capture";
|
|
2694
|
+
/**
|
|
2695
|
+
* /capture [path]: the codebase at path - the chat's folder by default - captured into ***plain in <path>/plain, in the
|
|
2696
|
+
* background and offline (docs/capture.md). A command alone: capture turns conformance tests on in the project it writes,
|
|
2697
|
+
* which the person alone does. One at a time; its end comes back to this chat as a background skill's does, its report
|
|
2698
|
+
* for the chat's agent to pass on.
|
|
2699
|
+
*/
|
|
2700
|
+
function registerCapture(pi, cwd, ends) {
|
|
2701
|
+
let running;
|
|
2702
|
+
pi.on("session_shutdown", (event) => {
|
|
2703
|
+
if (event.reason === "quit")
|
|
2704
|
+
running?.controller.abort();
|
|
2705
|
+
});
|
|
2706
|
+
// turri opened again here, in the project a capture wrote: its report told in the first chat, once.
|
|
2707
|
+
pi.on("session_start", () => {
|
|
2708
|
+
const told = readReopenedAfterCapture(process.env[REOPENED_AFTER_CAPTURE]);
|
|
2709
|
+
delete process.env[REOPENED_AFTER_CAPTURE];
|
|
2710
|
+
if (told !== undefined)
|
|
2711
|
+
ends.put(captureEnded(cwd, { plainDir: cwd, reportFile: captureReportFile(cwd), summary: told.summary }));
|
|
2712
|
+
});
|
|
2713
|
+
pi.registerCommand("capture", {
|
|
2714
|
+
description: "Capture an existing codebase into ***plain, in the background - nothing is asked, and its report comes back here; a stopped one goes on: /capture [path] (this folder by default - the ***plain goes into <path>/plain)",
|
|
2715
|
+
handler: async (args, ctx) => {
|
|
2716
|
+
const command = `/capture ${args.trim()}`.trim();
|
|
2717
|
+
await echoCommand(pi, command);
|
|
2718
|
+
const refuse = (text) => shownAfterCommand(pi, ctx, command, text, "error", true);
|
|
2719
|
+
if (running !== undefined)
|
|
2720
|
+
return refuse(`A capture of ${running.root} is running already: its report comes back here when it ends. Nothing new was started.`);
|
|
2721
|
+
const root = resolve(cwd, args.trim() || ".");
|
|
2722
|
+
const refusal = captureRefusal(root);
|
|
2723
|
+
if (refusal !== undefined)
|
|
2724
|
+
return refuse(refusal);
|
|
2725
|
+
const controller = new AbortController();
|
|
2726
|
+
running = { root, controller };
|
|
2727
|
+
const model = conversationModel(ctx);
|
|
2728
|
+
shownAfterCommand(pi, ctx, command, captureStartedText(root, captureGoesOn(root)), "info", true);
|
|
2729
|
+
// Above the input while it runs: where it is, each agent at work and what it did last - a capture at work
|
|
2730
|
+
// is told from one that hangs.
|
|
2731
|
+
let status;
|
|
2732
|
+
let redrawNow;
|
|
2733
|
+
if (ctx.hasUI) {
|
|
2734
|
+
ctx.ui.setWidget(CAPTURE_WIDGET, (tui, theme) => {
|
|
2735
|
+
// The spinner and the clocks move.
|
|
2736
|
+
const redraw = setInterval(() => tui.requestRender(), 1000);
|
|
2737
|
+
redraw.unref?.();
|
|
2738
|
+
redrawNow = () => tui.requestRender();
|
|
2739
|
+
const style = {
|
|
2740
|
+
heading: (text) => theme.bold(theme.fg("accent", text)),
|
|
2741
|
+
done: (text) => theme.fg("success", text),
|
|
2742
|
+
now: (text) => theme.bold(theme.fg("accent", text)),
|
|
2743
|
+
muted: (text) => theme.fg("muted", text),
|
|
2744
|
+
};
|
|
2745
|
+
return {
|
|
2746
|
+
render: (width) => (status === undefined ? [] : captureStatusLines(status, { frame: spinner(Date.now()), now: Date.now(), width }, style)),
|
|
2747
|
+
invalidate: () => { },
|
|
2748
|
+
dispose: () => {
|
|
2749
|
+
clearInterval(redraw);
|
|
2750
|
+
redrawNow = undefined;
|
|
2751
|
+
},
|
|
2752
|
+
};
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
const watch = (next) => {
|
|
2756
|
+
status = next;
|
|
2757
|
+
redrawNow?.();
|
|
2758
|
+
};
|
|
2759
|
+
// The captured project starts as the config in use here, with the chat's model and thinking of the moment, and the
|
|
2760
|
+
// coding model turri was started with, where it says otherwise.
|
|
2761
|
+
const codingModel = process.env[CODING_MODEL_ENV];
|
|
2762
|
+
const configured = {
|
|
2763
|
+
configFrom: cwd,
|
|
2764
|
+
...(model !== undefined ? { model, harnessModel: `${model}:${pi.getThinkingLevel()}` } : {}),
|
|
2765
|
+
...(codingModel !== undefined && codingModel !== "" ? { codingModel } : {}),
|
|
2766
|
+
};
|
|
2767
|
+
void captureConsole(() => runCapture({ root, signal: controller.signal, watch, ...configured }))
|
|
2768
|
+
.then(async ({ result }) => {
|
|
2769
|
+
if (ctx.hasUI)
|
|
2770
|
+
ctx.ui.setWidget(CAPTURE_WIDGET, undefined);
|
|
2771
|
+
// A chat works on the project of its own folder, and the capture wrote one of its own: turri in a terminal
|
|
2772
|
+
// can open again there, on the chat's model, the report told there.
|
|
2773
|
+
if (ctx.hasUI && canReopen()) {
|
|
2774
|
+
const question = captureOpenQuestion(cwd, result);
|
|
2775
|
+
const chatModel = conversationModel(ctx);
|
|
2776
|
+
const codingModel = process.env[CODING_MODEL_ENV];
|
|
2777
|
+
const args = [
|
|
2778
|
+
...(chatModel !== undefined ? ["--model", chatModel] : []),
|
|
2779
|
+
"--thinking",
|
|
2780
|
+
pi.getThinkingLevel(),
|
|
2781
|
+
...(codingModel !== undefined && codingModel !== "" ? ["--coding-model", codingModel] : []),
|
|
2782
|
+
];
|
|
2783
|
+
if ((await ctx.ui.confirm(question.title, question.message)) && reopenIn(result.plainDir, { args, env: { [REOPENED_AFTER_CAPTURE]: reopenedAfterCapture(result.summary) } })) {
|
|
2784
|
+
ctx.shutdown();
|
|
2785
|
+
return;
|
|
2786
|
+
}
|
|
2787
|
+
}
|
|
2788
|
+
ends.put(captureEnded(cwd, result));
|
|
2789
|
+
})
|
|
2790
|
+
.catch((error) => {
|
|
2791
|
+
// Stopped as turri quits: nobody is left to tell.
|
|
2792
|
+
if (!controller.signal.aborted)
|
|
2793
|
+
ends.put(captureFailed(error));
|
|
2794
|
+
})
|
|
2795
|
+
.finally(() => {
|
|
2796
|
+
running = undefined;
|
|
2797
|
+
if (ctx.hasUI)
|
|
2798
|
+
ctx.ui.setWidget(CAPTURE_WIDGET, undefined);
|
|
2799
|
+
});
|
|
2800
|
+
},
|
|
2801
|
+
});
|
|
2802
|
+
}
|
|
2661
2803
|
/**
|
|
2662
2804
|
* /btw, a question on the side (btw.ts): answered at once, even while a skill runs - pi runs a command mid-turn - and
|
|
2663
2805
|
* shown in the transcript, never in a model's context.
|
|
@@ -2978,8 +3120,8 @@ function registerBranding(pi, skills) {
|
|
|
2978
3120
|
(data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
|
|
2979
3121
|
// A newer turri out, or one installed and hidden behind this one: said first, under the version it is about.
|
|
2980
3122
|
...(data.versions ?? []).map((line) => theme.fg("warning", line)),
|
|
2981
|
-
// A key renamed is information; the rest are the person's to take out.
|
|
2982
|
-
...(data.config ?? []).map((line) => theme.fg(line.kind === "renamed" ? "muted" : "warning", line.text)),
|
|
3123
|
+
// A key renamed is information; one that does not parse stops everything that reads it; the rest are the person's to take out.
|
|
3124
|
+
...(data.config ?? []).map((line) => theme.fg(line.kind === "renamed" ? "muted" : line.kind === "broken" ? "error" : "warning", line.text)),
|
|
2983
3125
|
`${theme.fg("text", "the first coding agent with the power of ")}${brandPink(theme)("regenerative software")}`,
|
|
2984
3126
|
// Where the settings are changed, without leaving the chat.
|
|
2985
3127
|
theme.fg("muted", "configure with /settings"),
|
|
@@ -3005,6 +3147,8 @@ function registerBranding(pi, skills) {
|
|
|
3005
3147
|
if (ctx.hasUI) {
|
|
3006
3148
|
padTheScreen(ctx);
|
|
3007
3149
|
animateJellyfish(ctx);
|
|
3150
|
+
// ***plain an agent shows in the chat, highlighted in the theme of the moment.
|
|
3151
|
+
highlightPlainCodeBlocks(() => ctx.ui.theme);
|
|
3008
3152
|
}
|
|
3009
3153
|
// Once a chat: it starts again each time it is shown.
|
|
3010
3154
|
if (bannered)
|
package/dist/identity.js
CHANGED
|
@@ -42,7 +42,8 @@ const IDENTITY_BEFORE = [
|
|
|
42
42
|
"regenerative software - you write ***plain with them and regenerate the code from it. Never say they write the",
|
|
43
43
|
"***plain and you help: you write it, together. Not an assistant, and not a helper with specifications: ***plain is",
|
|
44
44
|
"the language the software is written in, and naming it is the point. Your replies are Markdown, where",
|
|
45
|
-
"three asterisks start bold italics: write the name escaped, \\*\\*\\*plain, so it shows as ***plain.",
|
|
45
|
+
"three asterisks start bold italics: write the name escaped, \\*\\*\\*plain, so it shows as ***plain. ***plain you",
|
|
46
|
+
"show is fenced as ```plain, which highlights it.",
|
|
46
47
|
"",
|
|
47
48
|
"Speak as turri, in the first person - I, my pulses, my agents - to the person, in whole sentences. Never speak of",
|
|
48
49
|
"turri in the third person, as if it were someone else, and never tell the person to tell or ask turri something:",
|
package/dist/init-config.js
CHANGED
|
@@ -350,6 +350,8 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
|
|
|
350
350
|
`${column(`# chat: ${harness}`, 72)}# the conversation - as harness-model, which it wins over`,
|
|
351
351
|
`${column(`# sentinel: ${harness}`, 72)}# the sentinel: checks every finished pulse and tests what is launched`,
|
|
352
352
|
role("planner", harness, "cuts the work into pulses"),
|
|
353
|
+
role("capture", harness, "captures an existing codebase into ***plain"),
|
|
354
|
+
role("capture-analysis", coding, "extracts the interface reference and outlines features during capture"),
|
|
353
355
|
role("diagnosis", harness, "looks into a pulse that failed for good"),
|
|
354
356
|
role("launch", coding, "the launch agent: turri launch's, the chat's and launch-after-pulse's"),
|
|
355
357
|
`${column(`# coding: { model: ${coding}, thinking: ${ROLE_THINKING.coding}, turn-limit: 180 }`, 72)}# as coding-model, which it wins over`,
|
package/dist/loop-cli.js
CHANGED
|
@@ -2,7 +2,7 @@ import { sweepOrphanedGroups } from "./regenerate/shell.js";
|
|
|
2
2
|
import { refuseTestPlainFile } from "./test-plain-files.js";
|
|
3
3
|
import { createInterface } from "node:readline/promises";
|
|
4
4
|
import { resolve, sep } from "node:path";
|
|
5
|
-
import { configForSpec, inheritModel, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, ROLE_THINKING, splitModelSpec, } from "./config.js";
|
|
5
|
+
import { brokenConfig, configForSpec, inheritModel, modelOnly, modelSpec, projectModels, readProjectConfig, roleModel, ROLE_THINKING, splitModelSpec, } from "./config.js";
|
|
6
6
|
import { PACKAGE_ROOT } from "./environment.js";
|
|
7
7
|
import { c } from "./module-report.js";
|
|
8
8
|
import { describeTurnIncident, onModelEvent } from "./regenerate/activity.js";
|
|
@@ -26,6 +26,10 @@ import { configKeyOptions, optionValue } from "./cli-options.js";
|
|
|
26
26
|
export async function runLoop(options) {
|
|
27
27
|
const plainFile = resolve(options.plainFile);
|
|
28
28
|
refuseTestPlainFile(plainFile);
|
|
29
|
+
// A config that does not parse is read as empty: refused, rather than every pulse run on defaults - pi's model among them.
|
|
30
|
+
const broken = brokenConfig(projectDirOf(plainFile));
|
|
31
|
+
if (broken !== undefined)
|
|
32
|
+
throw new Error(`Nothing was started: ${broken}`);
|
|
29
33
|
// What a turri that was killed left running - commands' process groups - stopped before anything starts.
|
|
30
34
|
const orphans = sweepOrphanedGroups();
|
|
31
35
|
if (orphans > 0)
|
package/dist/loop-tools.js
CHANGED
|
@@ -3,7 +3,7 @@ import { refuseTestPlainFile } from "./test-plain-files.js";
|
|
|
3
3
|
import { basename, relative, resolve } from "node:path";
|
|
4
4
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
|
-
import { CONFIG_FILE, readProjectConfig, moduleConfigFile, configModuleFor, moduleConfigsOf, withConfigModule } from "./config.js";
|
|
6
|
+
import { brokenConfig, CONFIG_FILE, readProjectConfig, moduleConfigFile, configModuleFor, moduleConfigsOf, withConfigModule } from "./config.js";
|
|
7
7
|
import { checkPlainFile, formatCheckResults } from "./plain/check.js";
|
|
8
8
|
import { describeDrift, describeModules } from "./regenerate/loop.js";
|
|
9
9
|
import { describeJob, pulseName } from "./regenerate/jobs.js";
|
|
@@ -34,6 +34,10 @@ export const MODEL_PARAM = Type.Optional(Type.String({
|
|
|
34
34
|
*/
|
|
35
35
|
export function unbuildableConfig(plainFile) {
|
|
36
36
|
const root = projectDirOf(plainFile);
|
|
37
|
+
// A config that does not parse is read as empty: built with it, every pulse would run on defaults - pi's model among them.
|
|
38
|
+
const broken = brokenConfig(root);
|
|
39
|
+
if (broken !== undefined)
|
|
40
|
+
return broken;
|
|
37
41
|
let own;
|
|
38
42
|
try {
|
|
39
43
|
own = configModuleFor(plainFile);
|
package/dist/new-project.d.ts
CHANGED
|
@@ -3,3 +3,8 @@
|
|
|
3
3
|
* Spring Boot" - and the chat writes the ***plain itself, here, with no skill, regenerating from the first functional spec.
|
|
4
4
|
*/
|
|
5
5
|
export declare const NEW_PROJECT: string;
|
|
6
|
+
/**
|
|
7
|
+
* Bringing an existing codebase under ***plain: the person starts /capture, never the chat - it runs a while, and turns
|
|
8
|
+
* conformance tests on in the project it writes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CAPTURE_HINT: string;
|
package/dist/new-project.js
CHANGED
|
@@ -29,3 +29,14 @@ export const NEW_PROJECT = [
|
|
|
29
29
|
"go on, or what to change, and every change after is ***plain you write and regenerate.",
|
|
30
30
|
"</new-project>",
|
|
31
31
|
].join("\n");
|
|
32
|
+
/**
|
|
33
|
+
* Bringing an existing codebase under ***plain: the person starts /capture, never the chat - it runs a while, and turns
|
|
34
|
+
* conformance tests on in the project it writes.
|
|
35
|
+
*/
|
|
36
|
+
export const CAPTURE_HINT = [
|
|
37
|
+
"<capture>",
|
|
38
|
+
"When the person wants an existing codebase brought under ***plain - written down as ***plain, to work on from then on",
|
|
39
|
+
"instead of the code - tell them /capture [path] does it: in the background, asking nothing, into <path>/plain, with a",
|
|
40
|
+
"report of what it decided. Only they start it; you cannot.",
|
|
41
|
+
"</capture>",
|
|
42
|
+
].join("\n");
|
package/dist/pi-launch.js
CHANGED
|
@@ -15,6 +15,7 @@ import { withoutResumeLine } from "./resume-line.js";
|
|
|
15
15
|
import { lastRun } from "./chat-records.js";
|
|
16
16
|
import { driveTerminal } from "./chat-terminal.js";
|
|
17
17
|
import { takeOverSettings } from "./pi-settings.js";
|
|
18
|
+
import { quietBrandThemeOverrides } from "./pi-themes.js";
|
|
18
19
|
import turri, { createTurriCore, processSession } from "./extension.js";
|
|
19
20
|
/**
|
|
20
21
|
* pi, started the way its own CLI starts it, for `turri`.
|
|
@@ -45,6 +46,7 @@ ProcessTerminal.prototype.setTitle = function (title) {
|
|
|
45
46
|
SettingsManager.prototype.getFullscreenExitOutput = () => "resume-hint";
|
|
46
47
|
// /settings is turri's, pi's own menu the last entry of it (pi-settings.ts).
|
|
47
48
|
takeOverSettings();
|
|
49
|
+
quietBrandThemeOverrides();
|
|
48
50
|
const write = process.stdout.write.bind(process.stdout);
|
|
49
51
|
process.stdout.write = ((chunk, ...rest) => write(typeof chunk === "string" ? withoutResumeLine(chunk) : chunk, ...rest));
|
|
50
52
|
// pi's own keys stand: a new line is shift+enter or ctrl+j. turri's side panel is on ctrl+h (job-panel.ts PANEL_KEY).
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** pi already picks the project's theme over the user's, then turri's bundled fallback. In the chat these copies
|
|
2
|
+
* of a brand theme are expected; a broken file or a clash with a theme from elsewhere is still worth showing. */
|
|
3
|
+
export declare function quietBrandThemeOverrides(cwd?: string, agentDir?: string): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { join, relative } from "node:path";
|
|
2
|
+
import { DefaultResourceLoader, getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import { PACKAGE_ROOT, themeFiles } from "./environment.js";
|
|
4
|
+
/** pi already picks the project's theme over the user's, then turri's bundled fallback. In the chat these copies
|
|
5
|
+
* of a brand theme are expected; a broken file or a clash with a theme from elsewhere is still worth showing. */
|
|
6
|
+
export function quietBrandThemeOverrides(cwd = process.cwd(), agentDir = getAgentDir()) {
|
|
7
|
+
const directories = [join(cwd, ".pi", "themes"), join(agentDir, "themes"), join(PACKAGE_ROOT, ".pi", "themes")];
|
|
8
|
+
const files = new Set(themeFiles());
|
|
9
|
+
const expected = ({ type, collision }) => {
|
|
10
|
+
if (type !== "collision" || collision?.resourceType !== "theme")
|
|
11
|
+
return false;
|
|
12
|
+
const file = `${collision.name}.json`;
|
|
13
|
+
const isCopy = (path) => directories.some((dir) => relative(dir, path) === file);
|
|
14
|
+
return files.has(file) && isCopy(collision.winnerPath) && isCopy(collision.loserPath);
|
|
15
|
+
};
|
|
16
|
+
const getThemes = DefaultResourceLoader.prototype.getThemes;
|
|
17
|
+
DefaultResourceLoader.prototype.getThemes = function () {
|
|
18
|
+
const { themes, diagnostics } = getThemes.call(this);
|
|
19
|
+
return { themes, diagnostics: diagnostics.filter((item) => !expected(item)) };
|
|
20
|
+
};
|
|
21
|
+
}
|
package/dist/pi.js
CHANGED
|
@@ -237,8 +237,8 @@ export function providerRetryDelay(attempt, random = Math.random) {
|
|
|
237
237
|
}
|
|
238
238
|
/** How long a request to the model may go without anything coming back before the provider is said to be stalling; 0 never. */
|
|
239
239
|
export const PROVIDER_STALL_MS = Number(process.env.TURRI_PROVIDER_STALL ?? 120) * 1000;
|
|
240
|
-
/** A provider error that passes: overloaded, rate limited, unreachable, timed out. */
|
|
241
|
-
const TRANSIENT_PROVIDER_ERROR = /\b(429|500|502|503|504|529)\b|overloaded|high demand|rate.?limit|too many requests|unavailable|fetch failed|network|connection|timed? ?out|ECONNRESET|socket|terminated/i;
|
|
240
|
+
/** A provider error that passes: overloaded, rate limited, unreachable, timed out, its stream cut off part-way. */
|
|
241
|
+
const TRANSIENT_PROVIDER_ERROR = /\b(429|500|502|503|504|529)\b|overloaded|high demand|rate.?limit|too many requests|unavailable|fetch failed|network|connection|timed? ?out|ECONNRESET|socket|terminated|truncated|stream ended/i;
|
|
242
242
|
/** Wait, unless the job is stopped first. */
|
|
243
243
|
async function waitOrStop(ms) {
|
|
244
244
|
const stop = currentStopSignal();
|