@turri-dev/cli 0.4.3-next.620bae9 → 0.4.3-next.a60ada5
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 +361 -0
- package/dist/capture/agents.js +332 -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 +1228 -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 +56 -0
- package/dist/capture/map.js +530 -0
- package/dist/capture/progress.d.ts +108 -0
- package/dist/capture/progress.js +234 -0
- package/dist/capture/report.d.ts +75 -0
- package/dist/capture/report.js +267 -0
- package/dist/capture/scripts.d.ts +26 -0
- package/dist/capture/scripts.js +33 -0
- package/dist/capture/state.d.ts +296 -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-tabs.d.ts +7 -1
- package/dist/chat-tabs.js +10 -6
- package/dist/chat-terminal.js +5 -2
- package/dist/chats.d.ts +11 -8
- package/dist/chats.js +34 -20
- package/dist/cli.js +32 -14
- package/dist/config-edit.js +1 -0
- package/dist/config.d.ts +15 -2
- package/dist/config.js +57 -3
- package/dist/extension.d.ts +1 -0
- package/dist/extension.js +188 -55
- package/dist/identity.js +2 -1
- package/dist/init-config.js +1 -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 +1 -1
- package/dist/pointer-hover.js +4 -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/loop.js +9 -1
- package/dist/regenerate/side-panel.d.ts +2 -0
- package/dist/regenerate/side-panel.js +32 -5
- package/dist/regenerate/spec-map-view.d.ts +2 -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/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 +191 -0
- package/docs/chats.md +3 -2
- package/docs/config.md +15 -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 +7 -3
- 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/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 +1 -1
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";
|
|
@@ -295,12 +302,29 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
295
302
|
// The AWS region the project's Bedrock models need, before any model is called - a host has no shell to export it in.
|
|
296
303
|
applyBedrockRegion(cwd);
|
|
297
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
|
+
};
|
|
298
322
|
// Finished work is announced twice, to two audiences, because pi treats them differently - see ChatInstance.announce:
|
|
299
323
|
// in the chat that asked for it, or the one shown when that is closed.
|
|
300
324
|
const jobs = createJobRegistry({
|
|
301
|
-
// The
|
|
325
|
+
// The planner can be at work before the registry has its first pulse.
|
|
302
326
|
onNotify: () => {
|
|
303
|
-
|
|
327
|
+
updateActivity();
|
|
304
328
|
host.onPlanChange?.();
|
|
305
329
|
},
|
|
306
330
|
// A job that fails is run once more; failing again, it and every job behind it fail, and the
|
|
@@ -322,16 +346,16 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
322
346
|
return diagnosis !== undefined ? describeDiagnosis(diagnosis) : undefined;
|
|
323
347
|
},
|
|
324
348
|
onChange: (job) => {
|
|
325
|
-
|
|
349
|
+
updateActivity(job);
|
|
326
350
|
host.onJobChange?.(job);
|
|
327
351
|
},
|
|
328
352
|
onFinish: (job) => {
|
|
329
|
-
|
|
353
|
+
updateActivity(job);
|
|
330
354
|
host.onJobChange?.(job);
|
|
331
355
|
// Queued again as another job: that one says how it went.
|
|
332
356
|
if (job.replacedBy !== undefined)
|
|
333
357
|
return;
|
|
334
|
-
// Gone wrong: the next ctrl+h opens on it
|
|
358
|
+
// Gone wrong: the next ctrl+h opens on it.
|
|
335
359
|
if (job.status === "failed" || job.status === "stopped" || didNotPass(job))
|
|
336
360
|
needsLooking.set(jobs, job.id);
|
|
337
361
|
core?.jobFinished(job);
|
|
@@ -344,7 +368,6 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
344
368
|
jobs,
|
|
345
369
|
model: (plainFile) => launchModel(workLoops.get(jobs)?.from.ctx, plainFile),
|
|
346
370
|
onChange: (launch) => {
|
|
347
|
-
core?.jobsChanged();
|
|
348
371
|
try {
|
|
349
372
|
host.onLaunch?.(launch);
|
|
350
373
|
}
|
|
@@ -360,7 +383,7 @@ export function createTurriCore(host = {}, options = {}) {
|
|
|
360
383
|
launches,
|
|
361
384
|
host,
|
|
362
385
|
jobs,
|
|
363
|
-
extension: (pi, link) => turriExtension(pi, core, link),
|
|
386
|
+
extension: (pi, link) => turriExtension(pi, core, link, busy),
|
|
364
387
|
// A finished pulse goes to the sentinel when the project wants one - read as each pulse finishes - the person asked
|
|
365
388
|
// first under `sentinel: ask`, and what they choose for the project written.
|
|
366
389
|
sentinel: () => sentinelSetting(cwd),
|
|
@@ -428,7 +451,7 @@ export function sessionLoop(session) {
|
|
|
428
451
|
* turri's extension, built into one chat of the session: its tools, commands and handlers run in the chat's scope -
|
|
429
452
|
* its id on the pulses it asks for - on the session's job registry and work loop.
|
|
430
453
|
*/
|
|
431
|
-
function turriExtension(api, session, link) {
|
|
454
|
+
function turriExtension(api, session, link, busy) {
|
|
432
455
|
const pi = scopedToChat(api, link.scope);
|
|
433
456
|
const { cwd, host, jobs } = session;
|
|
434
457
|
// The session's sentinel: its own prompt and tools - the project to read, notices, its guidance - and nothing that
|
|
@@ -443,8 +466,6 @@ function turriExtension(api, session, link) {
|
|
|
443
466
|
const dialogs = link.dialogs ?? host.dialogs;
|
|
444
467
|
// turri's own skills, and the project's - .turri/skills, .agents/skills (skills.ts).
|
|
445
468
|
const discoveredSkills = discoverSkills(PACKAGE_ROOT, cwd);
|
|
446
|
-
// What the background work is doing right now, drawn above the editor while it runs.
|
|
447
|
-
const panel = createJobPanel(() => shownJobs(jobs));
|
|
448
469
|
// The chat's context, as its tools and handlers were last given it: for its model and its providers.
|
|
449
470
|
let lastContext;
|
|
450
471
|
const contextNow = () => {
|
|
@@ -465,7 +486,8 @@ function turriExtension(api, session, link) {
|
|
|
465
486
|
// does what the project's guidance says to do then (launch what was built, say), or says
|
|
466
487
|
// what finished. In the chat that asked for the pulse, shown or not.
|
|
467
488
|
const announce = (job) => {
|
|
468
|
-
|
|
489
|
+
if (!session.terminal)
|
|
490
|
+
announceJob(pi, job);
|
|
469
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.
|
|
470
492
|
if (toldByWaitingCall(jobs, job) && job.specConflict === undefined)
|
|
471
493
|
return;
|
|
@@ -481,12 +503,13 @@ function turriExtension(api, session, link) {
|
|
|
481
503
|
catch {
|
|
482
504
|
/* a config that cannot be read launches nothing */
|
|
483
505
|
}
|
|
506
|
+
const quiet = session.terminal && job.status === "succeeded" && !didNotPass(job);
|
|
484
507
|
void pi.sendMessage({
|
|
485
508
|
customType: "turri_job",
|
|
486
|
-
content: pulseEndNote(job, { launching }),
|
|
509
|
+
content: pulseEndNote(job, { launching, quiet }),
|
|
487
510
|
display: false,
|
|
488
511
|
details: { jobId: job.id, status: job.status },
|
|
489
|
-
}, { triggerTurn: true, deliverAs: "followUp" });
|
|
512
|
+
}, quiet ? { triggerTurn: false } : { triggerTurn: true, deliverAs: "followUp" });
|
|
490
513
|
};
|
|
491
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
|
|
492
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
|
|
@@ -531,13 +554,14 @@ function turriExtension(api, session, link) {
|
|
|
531
554
|
// it landed and what the sentinel does with it - and nothing more: the pulse is the sentinel's. ***plain that
|
|
532
555
|
// contradicts itself is put to the person at once, by turri itself, as the chat would have been started on it.
|
|
533
556
|
const landed = (job, options = {}) => {
|
|
534
|
-
|
|
557
|
+
if (!session.terminal)
|
|
558
|
+
announceJob(pi, job);
|
|
535
559
|
if (job.specConflict !== undefined)
|
|
536
560
|
session.notice(specConflictNotice(job, specConflictTask(job.specConflict)));
|
|
537
561
|
if (options.tell !== true || toldByWaitingCall(jobs, job))
|
|
538
562
|
return;
|
|
539
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.
|
|
540
|
-
const shown = host.pulseEndsShown === true;
|
|
564
|
+
const shown = session.terminal || host.pulseEndsShown === true;
|
|
541
565
|
let launching = false;
|
|
542
566
|
try {
|
|
543
567
|
launching = readProjectConfig(cwd, job.configModule).launchAfterPulse === true;
|
|
@@ -549,10 +573,17 @@ function turriExtension(api, session, link) {
|
|
|
549
573
|
};
|
|
550
574
|
const notices = noticeDialogs(pi, session, link, contextNow);
|
|
551
575
|
link.live({
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
+
},
|
|
556
587
|
},
|
|
557
588
|
announce,
|
|
558
589
|
landed,
|
|
@@ -566,7 +597,6 @@ function turriExtension(api, session, link) {
|
|
|
566
597
|
act: (task) => {
|
|
567
598
|
void pi.sendMessage({ customType: "turri_notice_answer", content: task, display: false }, { triggerTurn: true, deliverAs: "followUp" });
|
|
568
599
|
},
|
|
569
|
-
jobsChanged: () => panel.refresh(),
|
|
570
600
|
thinkingLevel: () => pi.getThinkingLevel(),
|
|
571
601
|
context: contextNow,
|
|
572
602
|
});
|
|
@@ -618,7 +648,8 @@ function turriExtension(api, session, link) {
|
|
|
618
648
|
systemPrompt: conversationSystemPrompt(event.systemPrompt, host, [
|
|
619
649
|
TOOLS_NOT_CLI,
|
|
620
650
|
NEW_PROJECT,
|
|
621
|
-
|
|
651
|
+
CAPTURE_HINT,
|
|
652
|
+
pulseEndsBlock(session.sentinelOn(), session.terminal),
|
|
622
653
|
// Conformance tests - what they are, whether they are on here, and how they are turned on: every turn, read afresh.
|
|
623
654
|
conformanceBlock(conformanceTestsOnIn(cwd)),
|
|
624
655
|
projectConfigBlock(cwd),
|
|
@@ -710,31 +741,9 @@ function turriExtension(api, session, link) {
|
|
|
710
741
|
};
|
|
711
742
|
pi.on("agent_end", endTurnCapture);
|
|
712
743
|
pi.on("agent_settled", endTurnCapture);
|
|
713
|
-
pi.on("session_start", (_event, ctx) => {
|
|
714
|
-
if (!ctx.hasUI)
|
|
715
|
-
return;
|
|
716
|
-
panel.attach({
|
|
717
|
-
setWidget: (key, content, options) => {
|
|
718
|
-
try {
|
|
719
|
-
ctx.ui.setWidget(key, content, options);
|
|
720
|
-
}
|
|
721
|
-
catch {
|
|
722
|
-
/* rebuilt by pi since: its new extension draws the panel */
|
|
723
|
-
}
|
|
724
|
-
},
|
|
725
|
-
getToolsExpanded: () => {
|
|
726
|
-
try {
|
|
727
|
-
return ctx.ui.getToolsExpanded();
|
|
728
|
-
}
|
|
729
|
-
catch {
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
},
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
744
|
registerBranding(pi, discoveredSkills);
|
|
736
745
|
registerInterviewLog(pi);
|
|
737
|
-
registerJobTools(pi,
|
|
746
|
+
registerJobTools(pi, session);
|
|
738
747
|
// The skills the person starts themselves - a project's, marked command-only: each has its command, and cultivate starts it only
|
|
739
748
|
// once its command is typed, or picked among the options the conversation offers with ask_user.
|
|
740
749
|
const gate = createCommandGate();
|
|
@@ -781,6 +790,8 @@ function turriExtension(api, session, link) {
|
|
|
781
790
|
for (const controller of backgroundSkillRuns.values())
|
|
782
791
|
controller.abort();
|
|
783
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);
|
|
784
795
|
const startInBackground = (skill, params, plainFile, ctx) => {
|
|
785
796
|
const key = `${cwd}\0${skill.name}`;
|
|
786
797
|
const kind = scriptKindOfSkill(skill.name);
|
|
@@ -1992,7 +2003,8 @@ const needsLooking = new WeakMap();
|
|
|
1992
2003
|
/** What heads a pulse told from the ledger: it is not this session's, and the facts are all there is of it. */
|
|
1993
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, " +
|
|
1994
2005
|
"for the read tool.";
|
|
1995
|
-
function registerJobTools(pi,
|
|
2006
|
+
function registerJobTools(pi, session) {
|
|
2007
|
+
const { jobs, cwd } = session;
|
|
1996
2008
|
pi.registerTool(doctorTool({ cwd }));
|
|
1997
2009
|
pi.registerTool({
|
|
1998
2010
|
name: "pulses",
|
|
@@ -2073,8 +2085,6 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2073
2085
|
return { content: [{ type: "text", text }], details: { status: job.status } };
|
|
2074
2086
|
},
|
|
2075
2087
|
});
|
|
2076
|
-
// The panel is compact and ctrl+o only lasts as long as the work does. This is the whole
|
|
2077
|
-
// list, finished jobs included, put in the transcript where it stays.
|
|
2078
2088
|
pi.registerCommand("halt", {
|
|
2079
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>]",
|
|
2080
2090
|
handler: async (args, ctx) => {
|
|
@@ -2152,8 +2162,14 @@ function registerJobTools(pi, jobs, cwd) {
|
|
|
2152
2162
|
// While the panel has the keys, every key is its own.
|
|
2153
2163
|
// The side panel is the session's, one for every chat: it stays on the screen - beside the chat or over it - as
|
|
2154
2164
|
// another chat is shown, and what it says to a chat it says to the one shown.
|
|
2155
|
-
const sidePanel = sidePanelOf(
|
|
2165
|
+
const sidePanel = sidePanelOf(session);
|
|
2156
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
|
+
});
|
|
2157
2173
|
pi.on("session_start", () => {
|
|
2158
2174
|
sidePanel.say = (text) => pi.sendUserMessage(text, { deliverAs: "followUp" });
|
|
2159
2175
|
});
|
|
@@ -2240,6 +2256,8 @@ export function pulseEndNote(job, options = {}) {
|
|
|
2240
2256
|
: job.status === "stopped"
|
|
2241
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." : ""}`
|
|
2242
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.`;
|
|
2243
2261
|
const landed = job.status === "succeeded" && job.details?.landed === true;
|
|
2244
2262
|
if (!landed || options.launching !== true)
|
|
2245
2263
|
return `${head}\n\n${JOB_FINISHED_REACTION}`;
|
|
@@ -2287,12 +2305,15 @@ export const JOB_FINISHED_REACTION = [
|
|
|
2287
2305
|
].join("\n");
|
|
2288
2306
|
const sidePanels = new WeakMap();
|
|
2289
2307
|
/** The side panel of the session these jobs are, made as a chat first asks for it. */
|
|
2290
|
-
function sidePanelOf(
|
|
2308
|
+
function sidePanelOf(session) {
|
|
2309
|
+
const { jobs, cwd } = session;
|
|
2291
2310
|
const known = sidePanels.get(jobs);
|
|
2292
2311
|
if (known !== undefined)
|
|
2293
2312
|
return known;
|
|
2294
2313
|
const self = {
|
|
2295
2314
|
open: (ctx, view, placement) => openPanel(ctx, view, placement),
|
|
2315
|
+
visible: () => panel !== undefined && panel.handle?.isHidden() !== true,
|
|
2316
|
+
close: () => panel?.close(),
|
|
2296
2317
|
shown: () => panel !== undefined && panel.keys,
|
|
2297
2318
|
};
|
|
2298
2319
|
sidePanels.set(jobs, self);
|
|
@@ -2331,8 +2352,6 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2331
2352
|
});
|
|
2332
2353
|
/** Open the side panel - on the view named, or as it was left. */
|
|
2333
2354
|
const openPanel = (ctx, view, placement) => {
|
|
2334
|
-
// Found: ctrl+h under the job panel stops breathing.
|
|
2335
|
-
keyPressed("peek");
|
|
2336
2355
|
if (view !== undefined)
|
|
2337
2356
|
mapState.view = view;
|
|
2338
2357
|
// A pulse that failed or stopped since the panel was last opened: opened as it is, it is on that pulse - what went
|
|
@@ -2415,6 +2434,7 @@ function sidePanelOf(jobs, cwd) {
|
|
|
2415
2434
|
// Opened, it reads the files again at once: they may have changed while it was closed.
|
|
2416
2435
|
specMap.refresh();
|
|
2417
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) } : {}),
|
|
2418
2438
|
pointer: terminalPointer(tui.terminal),
|
|
2419
2439
|
tabLabel: (text, active, hovered, role) => buttonLabel(theme, text, active, hovered, role),
|
|
2420
2440
|
jobs: () => shownJobs(jobs),
|
|
@@ -2669,6 +2689,117 @@ function registerCheckPlain(pi, cwd, dialogs, afterAnswer) {
|
|
|
2669
2689
|
const SIDE_ENTRY = "turri_btw";
|
|
2670
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. */
|
|
2671
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, model, 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
|
+
}
|
|
2672
2803
|
/**
|
|
2673
2804
|
* /btw, a question on the side (btw.ts): answered at once, even while a skill runs - pi runs a command mid-turn - and
|
|
2674
2805
|
* shown in the transcript, never in a model's context.
|
|
@@ -2989,8 +3120,8 @@ function registerBranding(pi, skills) {
|
|
|
2989
3120
|
(data.commit !== undefined ? theme.fg("dim", ` from a clone, ${data.commit}${data.changed ? " with changes" : ""}`) : ""),
|
|
2990
3121
|
// A newer turri out, or one installed and hidden behind this one: said first, under the version it is about.
|
|
2991
3122
|
...(data.versions ?? []).map((line) => theme.fg("warning", line)),
|
|
2992
|
-
// A key renamed is information; the rest are the person's to take out.
|
|
2993
|
-
...(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)),
|
|
2994
3125
|
`${theme.fg("text", "the first coding agent with the power of ")}${brandPink(theme)("regenerative software")}`,
|
|
2995
3126
|
// Where the settings are changed, without leaving the chat.
|
|
2996
3127
|
theme.fg("muted", "configure with /settings"),
|
|
@@ -3016,6 +3147,8 @@ function registerBranding(pi, skills) {
|
|
|
3016
3147
|
if (ctx.hasUI) {
|
|
3017
3148
|
padTheScreen(ctx);
|
|
3018
3149
|
animateJellyfish(ctx);
|
|
3150
|
+
// ***plain an agent shows in the chat, highlighted in the theme of the moment.
|
|
3151
|
+
highlightPlainCodeBlocks(() => ctx.ui.theme);
|
|
3019
3152
|
}
|
|
3020
3153
|
// Once a chat: it starts again each time it is shown.
|
|
3021
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,7 @@ 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"),
|
|
353
354
|
role("diagnosis", harness, "looks into a pulse that failed for good"),
|
|
354
355
|
role("launch", coding, "the launch agent: turri launch's, the chat's and launch-after-pulse's"),
|
|
355
356
|
`${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();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type PlainRole } from "./plain/highlight.ts";
|
|
2
|
+
export declare function isPlainLanguage(lang: string | undefined): boolean;
|
|
3
|
+
/** Whether a fenced block is ***plain: fenced as plain, or fenced with no language around a section's header. */
|
|
4
|
+
export declare function isPlainBlock(lang: string | undefined, text: string): boolean;
|
|
5
|
+
/** Lines of ***plain, each piece painted by its role; the text around them in `rest`. */
|
|
6
|
+
export declare function highlightPlain(code: string, paint: (role: PlainRole, text: string) => string, rest?: (text: string) => string): string[];
|
|
7
|
+
/** What a theme says of itself that the palette needs: dark or light, and how many colours the terminal has. */
|
|
8
|
+
type ThemeLike = {
|
|
9
|
+
appearance?: "dark" | "light";
|
|
10
|
+
getColorMode?(): string;
|
|
11
|
+
};
|
|
12
|
+
/** From now on, a ***plain block in the chat is highlighted - in the colours of the theme `theme` gives at the time. */
|
|
13
|
+
export declare function highlightPlainCodeBlocks(theme: () => ThemeLike | undefined): void;
|
|
14
|
+
export {};
|