@turri-dev/core 0.1.1-next.8cda3cc → 0.1.1-next.ad4aa8f
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/CHANGELOG.md +56 -0
- package/README.md +17 -11
- package/dist/api/models.d.ts +9 -0
- package/dist/api/models.js +15 -0
- package/dist/api/plain.d.ts +6 -6
- package/dist/api/plain.js +4 -7
- package/dist/api/project.d.ts +35 -0
- package/dist/api/project.js +47 -0
- package/dist/api/session.d.ts +48 -0
- package/dist/api/session.js +17 -0
- package/dist/api/system.d.ts +18 -0
- package/dist/api/system.js +23 -0
- package/dist/btw.d.ts +1 -1
- package/dist/capture/capture.js +11 -8
- package/dist/capture/chat.d.ts +0 -11
- package/dist/capture/chat.js +0 -29
- package/dist/capture/config.d.ts +4 -5
- package/dist/capture/config.js +34 -20
- package/dist/capture/models.d.ts +2 -1
- package/dist/capture/models.js +1 -0
- package/dist/chat-entries.d.ts +81 -39
- package/dist/chat-entries.js +125 -11
- package/dist/chat-model.d.ts +37 -0
- package/dist/chat-model.js +61 -0
- package/dist/chats.d.ts +54 -42
- package/dist/chats.js +86 -80
- package/dist/client.d.ts +30 -0
- package/dist/client.js +12 -0
- package/dist/config-edit.d.ts +54 -1
- package/dist/config-edit.js +103 -33
- package/dist/config.d.ts +12 -9
- package/dist/config.js +38 -9
- package/dist/doctor-checks.d.ts +42 -0
- package/dist/doctor-checks.js +39 -0
- package/dist/environment.d.ts +2 -23
- package/dist/environment.js +5 -68
- package/dist/errors.d.ts +32 -0
- package/dist/errors.js +24 -0
- package/dist/extension.d.ts +23 -16
- package/dist/extension.js +170 -234
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +13 -9
- package/dist/init-config.d.ts +11 -9
- package/dist/init-config.js +15 -7
- package/dist/launch-session.d.ts +2 -0
- package/dist/launch-session.js +17 -1
- package/dist/loop-tools.js +11 -10
- package/dist/module-check.d.ts +13 -0
- package/dist/module-check.js +117 -0
- package/dist/notice.d.ts +5 -0
- package/dist/parse-tool.js +3 -2
- package/dist/plain/check.d.ts +27 -13
- package/dist/plain/check.js +51 -116
- package/dist/plain/files.d.ts +2 -0
- package/dist/plain/files.js +13 -0
- package/dist/plain/graph.js +2 -2
- package/dist/plain/highlight.d.ts +4 -20
- package/dist/plain/highlight.js +7 -5
- package/dist/project.d.ts +19 -0
- package/dist/project.js +34 -0
- package/dist/quiet.d.ts +0 -2
- package/dist/quiet.js +0 -14
- package/dist/regenerate/command-check.d.ts +0 -8
- package/dist/regenerate/command-check.js +133 -53
- package/dist/regenerate/conversation-writes.d.ts +5 -1
- package/dist/regenerate/conversation-writes.js +7 -3
- package/dist/regenerate/jobs.d.ts +25 -2
- package/dist/regenerate/jobs.js +3 -0
- package/dist/regenerate/launch.d.ts +1 -0
- package/dist/regenerate/launch.js +9 -0
- package/dist/regenerate/ledger-view.d.ts +14 -14
- package/dist/regenerate/ledger.d.ts +1 -0
- package/dist/regenerate/ledger.js +4 -2
- package/dist/regenerate/loop.d.ts +2 -1
- package/dist/regenerate/loop.js +9 -1
- package/dist/regenerate/os-sandbox.d.ts +4 -2
- package/dist/regenerate/os-sandbox.js +0 -1
- package/dist/regenerate/regenerate.js +2 -1
- package/dist/regenerate/requires-chain.d.ts +44 -0
- package/dist/regenerate/requires-chain.js +174 -0
- package/dist/regenerate/requires.d.ts +2 -40
- package/dist/regenerate/requires.js +14 -171
- package/dist/regenerate/resources.d.ts +0 -2
- package/dist/regenerate/resources.js +2 -14
- package/dist/regenerate/shell.js +20 -9
- package/dist/regenerate/spec-map.d.ts +2 -0
- package/dist/regenerate/spec-map.js +4 -0
- package/dist/regenerate/standing.d.ts +5 -2
- package/dist/run-report.js +2 -2
- package/dist/self-invocation.d.ts +1 -1
- package/dist/self-invocation.js +2 -3
- package/dist/sentinel-chat.js +7 -11
- package/dist/sentinel.d.ts +1 -1
- package/dist/sentinel.js +12 -5
- package/dist/session-events.d.ts +14 -0
- package/dist/session.d.ts +594 -0
- package/dist/session.js +672 -0
- package/dist/settings.d.ts +28 -2
- package/dist/settings.js +92 -56
- package/dist/setup.d.ts +6 -30
- package/dist/setup.js +28 -105
- package/dist/stack.d.ts +25 -12
- package/dist/stack.js +77 -12
- package/dist/surface.d.ts +2 -2
- package/dist/surface.js +4 -5
- package/dist/work.d.ts +125 -0
- package/dist/work.js +250 -0
- package/docs/README.md +2 -3
- package/docs/capture.md +4 -4
- package/docs/chats.md +5 -3
- package/docs/claude-subscription.md +2 -2
- package/docs/config.md +4 -4
- package/docs/core.md +105 -128
- package/docs/development.md +9 -9
- package/docs/headless.md +1 -1
- package/docs/installation.md +4 -2
- package/docs/launch.md +2 -2
- package/docs/parser.md +1 -1
- package/docs/regenerating.md +1 -1
- package/docs/sandbox.md +4 -4
- package/docs/sentinel.md +4 -4
- package/docs/skills-and-gates.md +1 -1
- package/docs/using.md +2 -2
- package/genome/rules/integration-embedded-testing.md +3 -3
- package/genome/rules/integration-embedded.md +3 -3
- package/genome/skills/implement-conformance-testing-script/SKILL.md +6 -4
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +13 -11
- package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +8 -7
- package/genome/skills/implement-unit-testing-script/SKILL.md +7 -5
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +9 -13
- package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +1 -1
- package/package.json +19 -32
- package/dist/api/commands.d.ts +0 -45
- package/dist/api/commands.js +0 -54
- package/dist/api/config.d.ts +0 -8
- package/dist/api/config.js +0 -8
- package/dist/api/ledger.d.ts +0 -3
- package/dist/api/ledger.js +0 -3
- package/dist/api/startup.d.ts +0 -8
- package/dist/api/startup.js +0 -8
- package/dist/api/terminal.d.ts +0 -18
- package/dist/api/terminal.js +0 -16
- package/dist/chat-models.d.ts +0 -11
- package/dist/chat-models.js +0 -11
- package/dist/chat-ui.d.ts +0 -33
- package/dist/chat-ui.js +0 -192
- package/dist/headless.d.ts +0 -99
- package/dist/headless.js +0 -226
- package/dist/host-session.d.ts +0 -136
- package/dist/host-session.js +0 -139
- package/dist/host.d.ts +0 -8
- package/dist/host.js +0 -17
- package/dist/index.d.ts +0 -16
- package/dist/index.js +0 -7
- package/dist/notifications.d.ts +0 -21
- package/dist/notifications.js +0 -44
- package/dist/reopen.d.ts +0 -29
- package/dist/reopen.js +0 -47
- package/dist/turri-versions.d.ts +0 -71
- package/dist/turri-versions.js +0 -276
- package/dist/view.d.ts +0 -78
- package/dist/view.js +0 -1
- package/docs/hosting.md +0 -284
package/dist/api/commands.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
import { configForSpec, modelSpec, projectModels } from "../config.js";
|
|
3
|
-
import { createLaunchTrack } from "../launch-track.js";
|
|
4
|
-
import { runLaunchAgent } from "../launch-agent.js";
|
|
5
|
-
import { createJobRegistry } from "../regenerate/jobs.js";
|
|
6
|
-
import { createWorkLoop } from "../regenerate/loop.js";
|
|
7
|
-
import { refuseTestPlainFile } from "../test-plain-files.js";
|
|
8
|
-
import { lookAhead } from "../preview.js";
|
|
9
|
-
import { runHeadless as run } from "../headless.js";
|
|
10
|
-
export { moduleStates } from "../headless.js";
|
|
11
|
-
export { describeDrift, describeModules } from "../regenerate/loop.js";
|
|
12
|
-
export { allChecks, asksModels, MARK, verdictOf } from "../setup.js";
|
|
13
|
-
export { runCapture, CaptureError, DEFAULT_PARALLEL } from "../capture/capture.js";
|
|
14
|
-
export { runSkill, describeGates } from "../genome.js";
|
|
15
|
-
export { discoverSkills } from "../skills.js";
|
|
16
|
-
export { loadSkill } from "../skill.js";
|
|
17
|
-
export { runAsk } from "../ask.js";
|
|
18
|
-
export { skillRunDir, defaultBuildDir } from "../regenerate/paths.js";
|
|
19
|
-
export { historyLog, historyShow } from "../regenerate/lineage.js";
|
|
20
|
-
export { PACKAGE_ROOT, setTurriRoot, turriRoot, versionLine, themeFiles, extensionInstalledGlobally, themesInstalledGlobally } from "../environment.js";
|
|
21
|
-
export { describeVersion } from "../turri-versions.js";
|
|
22
|
-
export { applyBedrockRegion } from "../bedrock-region.js";
|
|
23
|
-
export { bedrockMakerOf, bedrockRegionOf, vendorOf, priced } from "../init-config.js";
|
|
24
|
-
export { globalExtensionFile } from "../environment.js";
|
|
25
|
-
export { dropNoise } from "../quiet.js";
|
|
26
|
-
export { followLaunchedLogs, runningLaunched, stopLaunched } from "../regenerate/launch.js";
|
|
27
|
-
/** Give the CLI's request to the loop. A preview can never take a path that starts a pulse. */
|
|
28
|
-
export function runHeadless(request, view) {
|
|
29
|
-
const file = resolve(request.plainFile);
|
|
30
|
-
return run({ ...request, plainFile: file, dryRun: request.work === "preview", ask: (loop) => {
|
|
31
|
-
switch (request.work) {
|
|
32
|
-
case "preview": return lookAhead(loop, file);
|
|
33
|
-
case "regenerate": return request.again?.length ? loop.regenerateAgain(file, request.again) : loop.bringUp(file);
|
|
34
|
-
case "fromScratch": return loop.fromScratch(file, { chain: request.chain });
|
|
35
|
-
case "conform": return loop.conformance(file, { funcIds: request.funcIds, separately: request.separately, fromScratch: request.fromScratch });
|
|
36
|
-
}
|
|
37
|
-
} }, view);
|
|
38
|
-
}
|
|
39
|
-
/** `turri drift` without a session, a model or any work started. */
|
|
40
|
-
export function readDrift(plainFile, cwd = process.cwd()) {
|
|
41
|
-
const file = resolve(cwd, plainFile);
|
|
42
|
-
refuseTestPlainFile(file);
|
|
43
|
-
return createWorkLoop({ registry: createJobRegistry(), cwd, planner: false }).drift(file);
|
|
44
|
-
}
|
|
45
|
-
/** A standalone CLI launch. Its view owns the console, signals and how long to follow the logs. */
|
|
46
|
-
export async function launchModule(plainFile, options = {}) {
|
|
47
|
-
const cwd = options.cwd ?? process.cwd();
|
|
48
|
-
const file = resolve(cwd, plainFile);
|
|
49
|
-
refuseTestPlainFile(file);
|
|
50
|
-
const model = options.model ?? modelSpec(projectModels(configForSpec(file)).coding);
|
|
51
|
-
const track = createLaunchTrack({ cwd, run: (launch, code, signal, freed) => runLaunchAgent({ cwd, launch, code, signal, freed, model, onDelta: options.onDelta }) });
|
|
52
|
-
const { launch } = track.request({ plainFile: file, inModule: options.inModule, guidance: options.guidance, cause: {} });
|
|
53
|
-
return track.done(launch.id);
|
|
54
|
-
}
|
package/dist/api/config.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { CONFIG_FILE, configForSpec, configLines, configuredModel, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, moduleConfigsOf, testDirOf, booleanOption, overrideConfig, splitModelSpec, skillModel, type ConfigLine, type ConfigLineKind, type ModelChoice as ConfiguredModel, type ProjectConfig } from "../config.ts";
|
|
2
|
-
export { MODULES_DIR, projectDirOf } from "../regenerate/paths.ts";
|
|
3
|
-
export { defaultParallelJobs } from "../regenerate/jobs.ts";
|
|
4
|
-
export { configSettings, currentValue, EFFECT_TEXT, overriddenBy, readConfigText, type Effect, type Setting, type SettingKind } from "../config-edit.ts";
|
|
5
|
-
export { bedrockRegionFor, type BedrockRegion, type BedrockRegionSource } from "../bedrock-region.ts";
|
|
6
|
-
export { BEDROCK_DEFAULT, BEDROCK_GEOGRAPHIES, BEDROCK_IN_REGION, BEDROCK_REGIONS, bedrockAwsRegion, bedrockDefaultModels, bedrockMakers, bedrockModels, bedrockModelsIn, bedrockNeedsAwsRegion, bedrockPlaceOf, initConfig, makerLabel, VENDORS, type BedrockChoice, type BedrockMaker, type BedrockOffer, type InitConfigOptions, type ModelChoice, type ModelSet, type Vendor } from "../init-config.ts";
|
|
7
|
-
export { piModelCatalogue, type CatalogueModel, type ModelCatalogue } from "../model-check.ts";
|
|
8
|
-
export { hasPreset as hasBedrockPreset } from "../init-config.ts";
|
package/dist/api/config.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { CONFIG_FILE, configForSpec, configLines, configuredModel, debugMode, DEFAULT_TEST_DIR, hasProjectConfig, modelSpec, projectModels, readProjectConfig, moduleConfigsOf, testDirOf, booleanOption, overrideConfig, splitModelSpec, skillModel } from "../config.js";
|
|
2
|
-
export { MODULES_DIR, projectDirOf } from "../regenerate/paths.js";
|
|
3
|
-
export { defaultParallelJobs } from "../regenerate/jobs.js";
|
|
4
|
-
export { configSettings, currentValue, EFFECT_TEXT, overriddenBy, readConfigText } from "../config-edit.js";
|
|
5
|
-
export { bedrockRegionFor } from "../bedrock-region.js";
|
|
6
|
-
export { BEDROCK_DEFAULT, BEDROCK_GEOGRAPHIES, BEDROCK_IN_REGION, BEDROCK_REGIONS, bedrockAwsRegion, bedrockDefaultModels, bedrockMakers, bedrockModels, bedrockModelsIn, bedrockNeedsAwsRegion, bedrockPlaceOf, initConfig, makerLabel, VENDORS } from "../init-config.js";
|
|
7
|
-
export { piModelCatalogue } from "../model-check.js";
|
|
8
|
-
export { hasPreset as hasBedrockPreset } from "../init-config.js";
|
package/dist/api/ledger.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** Observe live facts and read earlier sessions. Only the harness records them. */
|
|
2
|
-
export { ledgerDir, onLedgerEvent, readLedger, type AgentRef, type LedgerEntry, type LedgerEvent, type LedgerKind, type LedgerQuery } from "../regenerate/ledger.ts";
|
|
3
|
-
export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews, type PulseView, type RunView } from "../regenerate/ledger-view.ts";
|
package/dist/api/ledger.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/** Observe live facts and read earlier sessions. Only the harness records them. */
|
|
2
|
-
export { ledgerDir, onLedgerEvent, readLedger } from "../regenerate/ledger.js";
|
|
3
|
-
export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews } from "../regenerate/ledger-view.js";
|
package/dist/api/startup.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Before pi loads: check the runtime, identify the CLI and select the models and themes for this invocation. */
|
|
2
|
-
export { checkNode } from "../node-check.ts";
|
|
3
|
-
export { setTurriRoot, turriRoot, versionLine, themeFiles, extensionInstalledGlobally, themesInstalledGlobally, globalExtensionFile } from "../environment.ts";
|
|
4
|
-
export { describeVersion } from "../turri-versions.ts";
|
|
5
|
-
export { readProjectConfig, modelSpec, projectModels } from "../config.ts";
|
|
6
|
-
export { dropNoise } from "../quiet.ts";
|
|
7
|
-
export { CODING_MODEL_ENV } from "../chat-models.ts";
|
|
8
|
-
export { REOPEN_FILE_ENV, takeReopening } from "../reopen.ts";
|
package/dist/api/startup.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Before pi loads: check the runtime, identify the CLI and select the models and themes for this invocation. */
|
|
2
|
-
export { checkNode } from "../node-check.js";
|
|
3
|
-
export { setTurriRoot, turriRoot, versionLine, themeFiles, extensionInstalledGlobally, themesInstalledGlobally, globalExtensionFile } from "../environment.js";
|
|
4
|
-
export { describeVersion } from "../turri-versions.js";
|
|
5
|
-
export { readProjectConfig, modelSpec, projectModels } from "../config.js";
|
|
6
|
-
export { dropNoise } from "../quiet.js";
|
|
7
|
-
export { CODING_MODEL_ENV } from "../chat-models.js";
|
|
8
|
-
export { REOPEN_FILE_ENV, takeReopening } from "../reopen.js";
|
package/dist/api/terminal.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** The CLI's driver and view: register them against the same pi peer as the core. */
|
|
2
|
-
export { default, createTurriCore, processSession, shownJobs, plannedLoop, sessionLaunchesOf, echoCommand, shownAfterCommand } from "../extension.ts";
|
|
3
|
-
export type { TurriView, ViewChat, QuestionView, Declining, SidePanelView, PanelPage, CaptureProgressView } from "../view.ts";
|
|
4
|
-
export { interruptChat, terminalUi, type ChatDriver, type ChatLink, type ChatState, type Stoppable, type TurriCore } from "../chats.ts";
|
|
5
|
-
export { createChatUi, type ChatUi } from "../chat-ui.ts";
|
|
6
|
-
export { unqueue, type QueueOf } from "../chat-queue.ts";
|
|
7
|
-
export { lastRun, type RunRecord } from "../chat-records.ts";
|
|
8
|
-
export { CODING_MODEL_ENV } from "../chat-models.ts";
|
|
9
|
-
export { TerminalNotifications, type TerminalNotification } from "../notifications.ts";
|
|
10
|
-
export { BANNER_ENTRY, VERSION_ENTRY, COMMAND_OUTCOME, SIDE_ENTRY, SKILL_MESSAGE_ENTRY, INTERVIEW_ENTRY, JOB_ENTRY, HISTORY_ENTRY, MILESTONE_ENTRY, JOBS_LIST_ENTRY, NOTICE_ENTRY, NOTICE_OVER_ENTRY, CONCLUDED_ENTRY, SKILL_RUN_ENTRY, SKILL_REPORT_ENTRY, type BannerData, type CommandOutcome, type Exchange, type JobAnnouncement } from "../chat-entries.ts";
|
|
11
|
-
export { CAPTURE_PHASES, COMPACT_PHASES, capturePhases, captureStageText, duration, workOf, type CaptureStatus } from "../capture/progress.ts";
|
|
12
|
-
export { PANEL_KEY, spinner, didNotPass, finishedMark, pulseCost, summarizeDiff, type DiffStyle } from "../regenerate/job-panel.ts";
|
|
13
|
-
export { countOf, createSpecMapSource, defaultMapFiles, focusOf, hasScenarioViews, lineDiff, rungOf, type Rung, type Mark, type MarkedPage, type MarkedItem } from "../regenerate/spec-map.ts";
|
|
14
|
-
export { DIFF_HEADER, locateDiffLines, type DiffWhere } from "../regenerate/diff-where.ts";
|
|
15
|
-
export { describeAgents } from "../regenerate/activity.ts";
|
|
16
|
-
export { formatDuration, pulseName } from "../regenerate/jobs.ts";
|
|
17
|
-
export type { SpecGap } from "../regenerate/notes.ts";
|
|
18
|
-
export { REOPEN_FILE_ENV, takeReopening } from "../reopen.ts";
|
package/dist/api/terminal.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** The CLI's driver and view: register them against the same pi peer as the core. */
|
|
2
|
-
export { default, createTurriCore, processSession, shownJobs, plannedLoop, sessionLaunchesOf, echoCommand, shownAfterCommand } from "../extension.js";
|
|
3
|
-
export { interruptChat, terminalUi } from "../chats.js";
|
|
4
|
-
export { createChatUi } from "../chat-ui.js";
|
|
5
|
-
export { unqueue } from "../chat-queue.js";
|
|
6
|
-
export { lastRun } from "../chat-records.js";
|
|
7
|
-
export { CODING_MODEL_ENV } from "../chat-models.js";
|
|
8
|
-
export { TerminalNotifications } from "../notifications.js";
|
|
9
|
-
export { BANNER_ENTRY, VERSION_ENTRY, COMMAND_OUTCOME, SIDE_ENTRY, SKILL_MESSAGE_ENTRY, INTERVIEW_ENTRY, JOB_ENTRY, HISTORY_ENTRY, MILESTONE_ENTRY, JOBS_LIST_ENTRY, NOTICE_ENTRY, NOTICE_OVER_ENTRY, CONCLUDED_ENTRY, SKILL_RUN_ENTRY, SKILL_REPORT_ENTRY } from "../chat-entries.js";
|
|
10
|
-
export { CAPTURE_PHASES, COMPACT_PHASES, capturePhases, captureStageText, duration, workOf } from "../capture/progress.js";
|
|
11
|
-
export { PANEL_KEY, spinner, didNotPass, finishedMark, pulseCost, summarizeDiff } from "../regenerate/job-panel.js";
|
|
12
|
-
export { countOf, createSpecMapSource, defaultMapFiles, focusOf, hasScenarioViews, lineDiff, rungOf } from "../regenerate/spec-map.js";
|
|
13
|
-
export { DIFF_HEADER, locateDiffLines } from "../regenerate/diff-where.js";
|
|
14
|
-
export { describeAgents } from "../regenerate/activity.js";
|
|
15
|
-
export { formatDuration, pulseName } from "../regenerate/jobs.js";
|
|
16
|
-
export { REOPEN_FILE_ENV, takeReopening } from "../reopen.js";
|
package/dist/chat-models.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The two models of `turri`, from its arguments and the project's config.turri.yaml.
|
|
3
|
-
*
|
|
4
|
-
* The harness model is the one the person talks to: pi's own `--model`, which `--harness-model`
|
|
5
|
-
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
6
|
-
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
7
|
-
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
8
|
-
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
9
|
-
*/
|
|
10
|
-
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
11
|
-
export declare const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-models.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The two models of `turri`, from its arguments and the project's config.turri.yaml.
|
|
3
|
-
*
|
|
4
|
-
* The harness model is the one the person talks to: pi's own `--model`, which `--harness-model`
|
|
5
|
-
* is another name for, or else `harness-model:` in config.turri.yaml. The coding model is the one
|
|
6
|
-
* every render runs on: `--coding-model`, or else `coding-model:` in config.turri.yaml - pi knows
|
|
7
|
-
* nothing of it, so it reaches the extension through the environment. Either can still be
|
|
8
|
-
* changed in the conversation: pi's /model, and the settings tool or /settings for the coding model.
|
|
9
|
-
*/
|
|
10
|
-
/** The environment variable a chat's --coding-model reaches the extension through. */
|
|
11
|
-
export const CODING_MODEL_ENV = "TURRI_CODING_MODEL";
|
package/dist/chat-ui.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
/**
|
|
3
|
-
* What a chat draws on, in a terminal of several chats: pi's screen while the chat is shown, and a stand-in while it is
|
|
4
|
-
* not. pi has one screen; a hidden chat goes on working - its turns, its tools, a pulse it hears of - and what it
|
|
5
|
-
* would draw must neither land on the chat shown nor be lost:
|
|
6
|
-
*
|
|
7
|
-
* - its questions - a dialog, a pick, a confirm - wait, and are asked once it is shown, one after another;
|
|
8
|
-
* - what it says in passing - a notice - is said when it is shown;
|
|
9
|
-
* - what it keeps on the screen - its widgets, statuses, the working line - is kept, and put back each time it is
|
|
10
|
-
* shown: pi clears an extension's widgets as it shows another session;
|
|
11
|
-
* - what is typed in its editor and not sent stays its own.
|
|
12
|
-
*
|
|
13
|
-
* Everything else - the theme, how tools are drawn - is the screen's, read where it is.
|
|
14
|
-
*/
|
|
15
|
-
export interface ChatUi {
|
|
16
|
-
/** What the chat's extension is given as its ui, shown or not. */
|
|
17
|
-
readonly ui: ExtensionUIContext;
|
|
18
|
-
readonly shown: boolean;
|
|
19
|
-
/** Shown on `screen`: what it keeps put back, its draft in the editor, what it said told, its questions asked. */
|
|
20
|
-
show(screen: ExtensionUIContext): void;
|
|
21
|
-
/** Another chat is shown: its draft kept, what it draws from now on held back. */
|
|
22
|
-
hide(): void;
|
|
23
|
-
/** The questions waiting for it to be shown. */
|
|
24
|
-
waiting(): number;
|
|
25
|
-
/** The chat is closed: every question waiting is answered with nothing. */
|
|
26
|
-
close(): void;
|
|
27
|
-
}
|
|
28
|
-
export declare function createChatUi(options: {
|
|
29
|
-
/** The screen to read the theme and the like from before the chat was ever shown. */
|
|
30
|
-
screen: () => ExtensionUIContext | undefined;
|
|
31
|
-
/** Its questions waiting changed, or it was shown or hidden. */
|
|
32
|
-
onChange?: () => void;
|
|
33
|
-
}): ChatUi;
|
package/dist/chat-ui.js
DELETED
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
/** Notices kept for a hidden chat: the most recent. */
|
|
2
|
-
const NOTICES_KEPT = 10;
|
|
3
|
-
export function createChatUi(options) {
|
|
4
|
-
let screen;
|
|
5
|
-
let lastScreen;
|
|
6
|
-
const waiting = [];
|
|
7
|
-
let asking = false;
|
|
8
|
-
let notices = [];
|
|
9
|
-
let draft = "";
|
|
10
|
-
// What the chat keeps on the screen, to put back each time it is shown.
|
|
11
|
-
const widgets = new Map();
|
|
12
|
-
const statuses = new Map();
|
|
13
|
-
const kept = new Map();
|
|
14
|
-
const inputHandlers = new Map();
|
|
15
|
-
const providers = [];
|
|
16
|
-
const any = () => screen ?? lastScreen ?? options.screen();
|
|
17
|
-
const call = (name, args) => screen[name](...args);
|
|
18
|
-
/** Its questions, asked one after another while it is shown. */
|
|
19
|
-
const askWaiting = async () => {
|
|
20
|
-
if (asking)
|
|
21
|
-
return;
|
|
22
|
-
asking = true;
|
|
23
|
-
try {
|
|
24
|
-
while (screen !== undefined && waiting.length > 0) {
|
|
25
|
-
const next = waiting.shift();
|
|
26
|
-
options.onChange?.();
|
|
27
|
-
try {
|
|
28
|
-
next.resolve(await next.ask(screen));
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
next.reject(error);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
asking = false;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const dialog = (name, none) => (...args) => {
|
|
40
|
-
if (screen !== undefined && waiting.length === 0)
|
|
41
|
-
return call(name, args);
|
|
42
|
-
return new Promise((resolve, reject) => {
|
|
43
|
-
waiting.push({ ask: (shown) => shown[name](...args), resolve, reject, none });
|
|
44
|
-
options.onChange?.();
|
|
45
|
-
void askWaiting();
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
// What it keeps on the screen: written down, and drawn when it is shown.
|
|
49
|
-
const keep = (name) => (...args) => {
|
|
50
|
-
kept.set(name, args);
|
|
51
|
-
if (screen !== undefined)
|
|
52
|
-
call(name, args);
|
|
53
|
-
};
|
|
54
|
-
const overrides = {
|
|
55
|
-
select: dialog("select", undefined),
|
|
56
|
-
confirm: dialog("confirm", false),
|
|
57
|
-
input: dialog("input", undefined),
|
|
58
|
-
editor: dialog("editor", undefined),
|
|
59
|
-
custom: dialog("custom", undefined),
|
|
60
|
-
notify: (message, type) => {
|
|
61
|
-
if (screen !== undefined)
|
|
62
|
-
screen.notify(message, type);
|
|
63
|
-
else
|
|
64
|
-
notices = [...notices, [message, type]].slice(-NOTICES_KEPT);
|
|
65
|
-
},
|
|
66
|
-
setWidget: (key, ...rest) => {
|
|
67
|
-
if (rest[0] === undefined)
|
|
68
|
-
widgets.delete(key);
|
|
69
|
-
else
|
|
70
|
-
widgets.set(key, [key, ...rest]);
|
|
71
|
-
if (screen !== undefined)
|
|
72
|
-
call("setWidget", [key, ...rest]);
|
|
73
|
-
},
|
|
74
|
-
setStatus: (key, text) => {
|
|
75
|
-
if (text === undefined)
|
|
76
|
-
statuses.delete(key);
|
|
77
|
-
else
|
|
78
|
-
statuses.set(key, text);
|
|
79
|
-
if (screen !== undefined)
|
|
80
|
-
screen.setStatus(key, text);
|
|
81
|
-
},
|
|
82
|
-
setWorkingMessage: keep("setWorkingMessage"),
|
|
83
|
-
setWorkingVisible: keep("setWorkingVisible"),
|
|
84
|
-
setWorkingIndicator: keep("setWorkingIndicator"),
|
|
85
|
-
setHiddenThinkingLabel: keep("setHiddenThinkingLabel"),
|
|
86
|
-
setFooter: keep("setFooter"),
|
|
87
|
-
setHeader: keep("setHeader"),
|
|
88
|
-
setTitle: keep("setTitle"),
|
|
89
|
-
setEditorComponent: keep("setEditorComponent"),
|
|
90
|
-
onTerminalInput: (handler) => {
|
|
91
|
-
inputHandlers.set(handler, screen?.onTerminalInput(handler));
|
|
92
|
-
return () => {
|
|
93
|
-
inputHandlers.get(handler)?.();
|
|
94
|
-
inputHandlers.delete(handler);
|
|
95
|
-
};
|
|
96
|
-
},
|
|
97
|
-
addAutocompleteProvider: (factory) => {
|
|
98
|
-
providers.push(factory);
|
|
99
|
-
if (screen !== undefined)
|
|
100
|
-
call("addAutocompleteProvider", [factory]);
|
|
101
|
-
},
|
|
102
|
-
getEditorText: () => (screen !== undefined ? screen.getEditorText() : draft),
|
|
103
|
-
setEditorText: (text) => {
|
|
104
|
-
if (screen !== undefined)
|
|
105
|
-
screen.setEditorText(text);
|
|
106
|
-
else
|
|
107
|
-
draft = text;
|
|
108
|
-
},
|
|
109
|
-
pasteToEditor: (text) => {
|
|
110
|
-
if (screen !== undefined)
|
|
111
|
-
screen.pasteToEditor(text);
|
|
112
|
-
else
|
|
113
|
-
draft += text;
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
// What the screen has besides, forwarded to the screen as it is when called: one function a name, kept.
|
|
117
|
-
const forwarders = new Map();
|
|
118
|
-
const read = (key) => {
|
|
119
|
-
if (typeof key === "string" && key in overrides)
|
|
120
|
-
return overrides[key];
|
|
121
|
-
const target = any();
|
|
122
|
-
if (target === undefined)
|
|
123
|
-
return undefined;
|
|
124
|
-
const value = Reflect.get(target, key);
|
|
125
|
-
if (typeof value !== "function")
|
|
126
|
-
return value;
|
|
127
|
-
let forward = forwarders.get(key);
|
|
128
|
-
if (forward === undefined) {
|
|
129
|
-
forward = (...args) => Reflect.get(any(), key).apply(any(), args);
|
|
130
|
-
forwarders.set(key, forward);
|
|
131
|
-
}
|
|
132
|
-
return forward;
|
|
133
|
-
};
|
|
134
|
-
const keys = () => [...new Set([...Object.keys(overrides), ...(any() !== undefined ? Reflect.ownKeys(any()) : [])])];
|
|
135
|
-
// pi copies the ui it is given - `{ ...ui }` - so every name is the stand-in's own, not only read through it.
|
|
136
|
-
const ui = new Proxy({}, {
|
|
137
|
-
get: (_target, key) => read(key),
|
|
138
|
-
has: (_target, key) => keys().includes(key),
|
|
139
|
-
ownKeys: () => keys().filter((key) => typeof key !== "number"),
|
|
140
|
-
getOwnPropertyDescriptor: (_target, key) => (keys().includes(key) ? { value: read(key), enumerable: true, configurable: true, writable: false } : undefined),
|
|
141
|
-
});
|
|
142
|
-
return {
|
|
143
|
-
ui,
|
|
144
|
-
get shown() {
|
|
145
|
-
return screen !== undefined;
|
|
146
|
-
},
|
|
147
|
-
show(next) {
|
|
148
|
-
screen = next;
|
|
149
|
-
lastScreen = next;
|
|
150
|
-
for (const args of widgets.values())
|
|
151
|
-
call("setWidget", args);
|
|
152
|
-
for (const [key, text] of statuses)
|
|
153
|
-
next.setStatus(key, text);
|
|
154
|
-
for (const [name, args] of kept)
|
|
155
|
-
call(name, args);
|
|
156
|
-
for (const handler of inputHandlers.keys())
|
|
157
|
-
inputHandlers.set(handler, next.onTerminalInput(handler));
|
|
158
|
-
for (const factory of providers)
|
|
159
|
-
call("addAutocompleteProvider", [factory]);
|
|
160
|
-
if (draft !== "")
|
|
161
|
-
next.setEditorText(draft);
|
|
162
|
-
draft = "";
|
|
163
|
-
for (const [message, type] of notices)
|
|
164
|
-
next.notify(message, type);
|
|
165
|
-
notices = [];
|
|
166
|
-
options.onChange?.();
|
|
167
|
-
void askWaiting();
|
|
168
|
-
},
|
|
169
|
-
hide() {
|
|
170
|
-
if (screen === undefined)
|
|
171
|
-
return;
|
|
172
|
-
try {
|
|
173
|
-
draft = screen.getEditorText();
|
|
174
|
-
screen.setEditorText("");
|
|
175
|
-
}
|
|
176
|
-
catch {
|
|
177
|
-
draft = "";
|
|
178
|
-
}
|
|
179
|
-
// pi takes them off the screen as it shows another chat; they are put on again when this one is shown.
|
|
180
|
-
for (const handler of inputHandlers.keys())
|
|
181
|
-
inputHandlers.set(handler, undefined);
|
|
182
|
-
screen = undefined;
|
|
183
|
-
options.onChange?.();
|
|
184
|
-
},
|
|
185
|
-
waiting: () => waiting.length,
|
|
186
|
-
close() {
|
|
187
|
-
for (const next of waiting.splice(0))
|
|
188
|
-
next.resolve(next.none);
|
|
189
|
-
screen = undefined;
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
}
|
package/dist/headless.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { type ProjectConfig } from "./config.ts";
|
|
2
|
-
import { type ModelEvent } from "./regenerate/activity.ts";
|
|
3
|
-
import { type Job } from "./regenerate/jobs.ts";
|
|
4
|
-
import { type DriftReport, type ModuleStatus, type PlannedPulse, type WorkLoop } from "./regenerate/loop.ts";
|
|
5
|
-
import { type ModuleState } from "./run-report.ts";
|
|
6
|
-
/**
|
|
7
|
-
* A headless run: what every command that builds - `turri regenerate`, `conform` - does around its own request of the
|
|
8
|
-
* work loop, as the chat does it: the project's models, a job that fails run once more and, failing again, diagnosed;
|
|
9
|
-
* then the loop run until nothing more can start, and how it ended. With `dryRun`, `ask` is a look ahead
|
|
10
|
-
* (`WorkLoop.lookAhead`): the work is planned, the next pulse of each codebase told from the plan kept, and nothing runs.
|
|
11
|
-
*
|
|
12
|
-
* It prints nothing, asks nothing and never exits the process: what a person is shown and asked goes through the
|
|
13
|
-
* HeadlessView, and how the run ended - with the exit code the command ends with - is returned. A run refused before it
|
|
14
|
-
* starts - a test plain file, a config that does not parse, a --build-dir the export would wipe something in - throws.
|
|
15
|
-
*/
|
|
16
|
-
export interface HeadlessOptions {
|
|
17
|
-
plainFile: string;
|
|
18
|
-
/** Where the code is exported to as the run ends, however it ends: the furthest-built codebase's last commit. */
|
|
19
|
-
buildDir?: string;
|
|
20
|
-
/** The run report's file (`--report`): see run-report.ts. */
|
|
21
|
-
report?: string;
|
|
22
|
-
/** The command, as the report gives it: its name and its arguments. */
|
|
23
|
-
command?: string[];
|
|
24
|
-
/** Start over, unasked, a codebase that has to be on a module it now requires (`--start-over`). */
|
|
25
|
-
startOver?: boolean;
|
|
26
|
-
}
|
|
27
|
-
/** The internal driver. The public command selects an operation rather than receiving a work loop. */
|
|
28
|
-
export interface HeadlessRun extends HeadlessOptions {
|
|
29
|
-
/** Plan and tell the next pulses, starting nothing - `ask` a look ahead. */
|
|
30
|
-
dryRun?: boolean;
|
|
31
|
-
/** The request: bring up, regenerate, conformance. */
|
|
32
|
-
ask: (loop: WorkLoop) => Promise<ModuleStatus[]>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* What a headless run shows and asks, each at the point it happens - the command line's console, a test's record. A
|
|
36
|
-
* run calls nothing else of the person.
|
|
37
|
-
*/
|
|
38
|
-
export interface HeadlessView {
|
|
39
|
-
/** Before anything starts: the process groups a turri that was killed left running, stopped - only when there were any. */
|
|
40
|
-
orphansStopped(count: number): void;
|
|
41
|
-
/** What the ledger could not write. */
|
|
42
|
-
warn(message: string): void;
|
|
43
|
-
/** As the process exits, however it exits: the code exported into the --build-dir - or why nothing was (`exportCode`). */
|
|
44
|
-
exported(exported: Record<string, unknown>, buildDir: string): void;
|
|
45
|
-
/** A pulse running: as it starts, and again at each new stage. */
|
|
46
|
-
pulseRunning(job: Job): void;
|
|
47
|
-
/**
|
|
48
|
-
* A pulse ended, however it ended - before the run report is written again. Nobody is asked here: the spec gaps its
|
|
49
|
-
* agents met are in its details (`specGaps`).
|
|
50
|
-
*/
|
|
51
|
-
pulseFinished(job: Job): void;
|
|
52
|
-
/** A provider failing and waited out, a turn turri ended itself - and its line (`describeTurnIncident`). */
|
|
53
|
-
turnIncident(event: ModelEvent, line: string): void;
|
|
54
|
-
/** What the request planned in each codebase - and again after a start over. */
|
|
55
|
-
planned(statuses: ModuleStatus[]): void;
|
|
56
|
-
/** Whether there is someone to ask - a terminal. */
|
|
57
|
-
canAsk(): boolean;
|
|
58
|
-
/** Yes or no, put to the person: whether to start over - true for yes. Undefined when there is no one to ask after all. */
|
|
59
|
-
ask(title: string, body: string): Promise<boolean | undefined>;
|
|
60
|
-
/** The run stops at a codebase it would have to start over, with no one to ask and no `startOver`: why, and what to do. */
|
|
61
|
-
startOverRefused(message: string): void;
|
|
62
|
-
/** A dry run: the next pulse of a codebase, from the plan the look ahead kept - the one regenerate would start. */
|
|
63
|
-
nextPulse(pulse: PlannedPulse): void;
|
|
64
|
-
/** Nothing more can start: how each codebase stands. */
|
|
65
|
-
drained(statuses: ModuleStatus[]): void;
|
|
66
|
-
/** How the run ended: every job, those that failed, and the codebases not complete. */
|
|
67
|
-
ended(end: HeadlessEnd): void;
|
|
68
|
-
}
|
|
69
|
-
/** What a headless run's verdict is made of. */
|
|
70
|
-
export interface HeadlessEnd {
|
|
71
|
-
/** The spec the run was for, resolved. */
|
|
72
|
-
plainFile: string;
|
|
73
|
-
/** Every job of the run, in the order they were queued. */
|
|
74
|
-
jobs: Job[];
|
|
75
|
-
failed: Job[];
|
|
76
|
-
/** The codebases not regenerated from the spec as it is, its conformance tests too. */
|
|
77
|
-
unfinished: ModuleState[];
|
|
78
|
-
}
|
|
79
|
-
/** How a headless run ended, and the exit code the command ends with: 0 only for a dry run, or nothing failed and every codebase complete. */
|
|
80
|
-
export interface HeadlessResult {
|
|
81
|
-
status: "completed" | "incomplete" | "failed" | "dry_run";
|
|
82
|
-
exitCode: 0 | 1;
|
|
83
|
-
}
|
|
84
|
-
/** Run it, the view shown and asked what a person would be: see HeadlessRun. `turri regenerate` and `conform` exit with its exitCode. */
|
|
85
|
-
export declare function runHeadless(options: HeadlessRun, view: HeadlessView): Promise<HeadlessResult>;
|
|
86
|
-
/** How each codebase stands, from what is left to regenerate there. */
|
|
87
|
-
export declare function moduleStates(reports: DriftReport[]): ModuleState[];
|
|
88
|
-
/**
|
|
89
|
-
* Why a --build-dir cannot be used - one the export would wipe something in: the project, a folder holding it, or one
|
|
90
|
-
* inside plain_modules - or undefined when it can. Anything else is the export's own, its contents replaced as the run ends.
|
|
91
|
-
*/
|
|
92
|
-
export declare function buildDirProblem(buildDir: string, projectDir: string): string | undefined;
|
|
93
|
-
/** The furthest-built codebase's last commit, exported into `dir` - or why nothing was. */
|
|
94
|
-
export declare function exportCode(plainFile: string, dir: string): Record<string, unknown>;
|
|
95
|
-
/** The models of the three roles as this run uses them: the coding model given, the others as they fall back - each with the level it thinks at. */
|
|
96
|
-
export declare function reportModels(project: ProjectConfig, model: string | undefined): Record<"harness" | "coding" | "judge", {
|
|
97
|
-
model?: string;
|
|
98
|
-
thinking?: string;
|
|
99
|
-
}>;
|