@interf/compiler 0.6.3 → 0.6.5
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 +92 -94
- package/dist/cli/commands/check-draft.js +4 -4
- package/dist/cli/commands/compile-controller.js +23 -23
- package/dist/cli/commands/compile.js +2 -2
- package/dist/cli/commands/compiled-flow.js +4 -4
- package/dist/cli/commands/create-workflow-wizard.js +8 -8
- package/dist/cli/commands/create.js +5 -5
- package/dist/cli/commands/default.js +1 -1
- package/dist/cli/commands/init.js +44 -44
- package/dist/cli/commands/list.js +2 -2
- package/dist/cli/commands/reset.js +1 -1
- package/dist/cli/commands/source-config-wizard.d.ts +1 -1
- package/dist/cli/commands/source-config-wizard.js +40 -40
- package/dist/cli/commands/status.js +5 -5
- package/dist/cli/commands/test-flow.js +26 -26
- package/dist/cli/commands/test.js +12 -12
- package/dist/lib/chart-guidance.d.ts +1 -1
- package/dist/lib/chart-guidance.js +1 -8
- package/dist/lib/discovery.d.ts +1 -7
- package/dist/lib/discovery.js +1 -84
- package/dist/lib/filesystem.d.ts +1 -2
- package/dist/lib/filesystem.js +1 -55
- package/dist/lib/logger.d.ts +1 -3
- package/dist/lib/logger.js +1 -10
- package/dist/lib/parse.d.ts +1 -8
- package/dist/lib/parse.js +1 -145
- package/dist/lib/util.d.ts +1 -4
- package/dist/lib/util.js +1 -25
- package/dist/packages/agents/index.d.ts +1 -0
- package/dist/packages/agents/index.js +1 -0
- package/dist/packages/agents/lib/chart-guidance.d.ts +1 -0
- package/dist/packages/agents/lib/chart-guidance.js +8 -0
- package/dist/packages/agents/lib/compiled-bootstrap.d.ts +3 -0
- package/dist/packages/agents/lib/compiled-bootstrap.js +18 -0
- package/dist/packages/agents/lib/executors.d.ts +2 -2
- package/dist/packages/agents/lib/shells.d.ts +3 -1
- package/dist/packages/agents/lib/shells.js +22 -20
- package/dist/packages/agents/lib/user-config.js +1 -1
- package/dist/packages/compiler/compiled-compile.d.ts +4 -48
- package/dist/packages/compiler/compiled-compile.js +4 -256
- package/dist/packages/compiler/compiled-paths.d.ts +40 -0
- package/dist/packages/compiler/compiled-paths.js +106 -0
- package/dist/packages/compiler/compiled-pipeline.d.ts +39 -0
- package/dist/packages/compiler/compiled-pipeline.js +134 -0
- package/dist/packages/compiler/compiled-schema.js +2 -2
- package/dist/packages/compiler/compiled-stage-plan.d.ts +15 -0
- package/dist/packages/compiler/compiled-stage-plan.js +79 -0
- package/dist/packages/compiler/compiled-stage-runner.d.ts +10 -0
- package/dist/packages/compiler/compiled-stage-runner.js +46 -0
- package/dist/packages/compiler/compiled-target.d.ts +11 -0
- package/dist/packages/compiler/compiled-target.js +16 -0
- package/dist/packages/compiler/discovery.d.ts +7 -0
- package/dist/packages/compiler/discovery.js +80 -0
- package/dist/packages/compiler/lib/schema.js +2 -0
- package/dist/packages/compiler/raw-snapshot.d.ts +49 -0
- package/dist/packages/compiler/raw-snapshot.js +102 -0
- package/dist/packages/compiler/reset.d.ts +2 -0
- package/dist/packages/compiler/reset.js +72 -0
- package/dist/packages/compiler/runtime-acceptance.js +3 -3
- package/dist/packages/compiler/runtime-contracts.js +1 -1
- package/dist/packages/compiler/runtime-paths.js +1 -1
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +2 -2
- package/dist/packages/compiler/state-health.js +3 -3
- package/dist/packages/compiler/state-io.js +3 -3
- package/dist/packages/compiler/state-paths.js +1 -1
- package/dist/packages/compiler/state-view.js +2 -2
- package/dist/packages/compiler/validate-compiled.js +3 -3
- package/dist/packages/compiler/validate.js +4 -4
- package/dist/packages/project-model/compiled-paths.d.ts +1 -40
- package/dist/packages/project-model/compiled-paths.js +1 -106
- package/dist/packages/project-model/compiled-raw.d.ts +1 -49
- package/dist/packages/project-model/compiled-raw.js +1 -102
- package/dist/packages/project-model/compiled-reset.d.ts +1 -2
- package/dist/packages/project-model/compiled-reset.js +1 -72
- package/dist/packages/project-model/interf-bootstrap.d.ts +1 -3
- package/dist/packages/project-model/interf-bootstrap.js +1 -18
- package/dist/packages/project-model/interf-detect.js +4 -4
- package/dist/packages/project-model/interf-scaffold.js +7 -7
- package/dist/packages/project-model/source-config.js +6 -5
- package/dist/packages/shared/file-types.d.ts +1 -0
- package/dist/packages/shared/file-types.js +4 -0
- package/dist/packages/shared/filesystem.d.ts +2 -0
- package/dist/packages/shared/filesystem.js +55 -0
- package/dist/packages/shared/index.d.ts +7 -0
- package/dist/packages/shared/index.js +7 -0
- package/dist/packages/shared/logger.d.ts +3 -0
- package/dist/packages/shared/logger.js +10 -0
- package/dist/packages/shared/naming.d.ts +1 -0
- package/dist/packages/shared/naming.js +8 -0
- package/dist/packages/shared/parse.d.ts +8 -0
- package/dist/packages/shared/parse.js +145 -0
- package/dist/packages/shared/path-guards.d.ts +2 -0
- package/dist/packages/shared/path-guards.js +14 -0
- package/dist/packages/shared/util.d.ts +3 -0
- package/dist/packages/shared/util.js +3 -0
- package/dist/packages/testing/test-execution.js +3 -3
- package/dist/packages/testing/test-paths.js +1 -1
- package/dist/packages/testing/test-sandbox.js +3 -3
- package/dist/packages/testing/test-specs.js +1 -1
- package/dist/packages/workflow-authoring/workflow-authoring.js +5 -4
- package/dist/packages/workflow-authoring/workflow-improvement.js +6 -5
- package/dist/packages/workflow-package/builtin-compiled-workflow.js +1 -1
- package/dist/packages/workflow-package/context-interface.d.ts +96 -0
- package/dist/packages/workflow-package/context-interface.js +146 -0
- package/dist/packages/workflow-package/index.d.ts +2 -0
- package/dist/packages/workflow-package/index.js +2 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +75 -28
- package/dist/packages/workflow-package/local-workflows.d.ts +5 -2
- package/dist/packages/workflow-package/local-workflows.js +15 -13
- package/dist/packages/workflow-package/workflow-definitions.d.ts +11 -7
- package/dist/packages/workflow-package/workflow-definitions.js +10 -3
- package/dist/packages/workflow-package/workflow-helpers.js +4 -4
- package/dist/packages/workflow-package/workflow-review-paths.js +1 -1
- package/package.json +3 -2
|
@@ -25,8 +25,8 @@ export function currentRunTargetStatus(rows, target) {
|
|
|
25
25
|
function describeSavedQuestions(dataset) {
|
|
26
26
|
const count = dataset.checks.length;
|
|
27
27
|
if (count === 0)
|
|
28
|
-
return "No
|
|
29
|
-
return `${count}
|
|
28
|
+
return "No questions yet";
|
|
29
|
+
return `${count} question${count === 1 ? "" : "s"}`;
|
|
30
30
|
}
|
|
31
31
|
function printDatasetSummary(options) {
|
|
32
32
|
const compiledConfig = options.builtCompiledPath
|
|
@@ -44,18 +44,18 @@ function printDatasetSummary(options) {
|
|
|
44
44
|
maxLoops: options.dataset.max_loops,
|
|
45
45
|
}));
|
|
46
46
|
p.log.info(describeSavedQuestions(options.dataset));
|
|
47
|
-
p.log.info(options.built ? "
|
|
47
|
+
p.log.info(options.built ? "Portable context is available." : "Portable context has not been built yet.");
|
|
48
48
|
if (options.latestComparison?.raw && options.latestComparison?.compiled) {
|
|
49
|
-
p.log.info(`Latest saved comparison: files
|
|
49
|
+
p.log.info(`Latest saved comparison: source files ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}, portable context for your agents ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
|
|
50
50
|
}
|
|
51
51
|
else if (options.latestComparison?.raw) {
|
|
52
|
-
p.log.info(`Latest saved files
|
|
52
|
+
p.log.info(`Latest saved source-files run: ${options.latestComparison.raw.passed_cases}/${options.latestComparison.raw.total_cases}.`);
|
|
53
53
|
}
|
|
54
54
|
else if (options.latestComparison?.compiled) {
|
|
55
|
-
p.log.info(`Latest
|
|
55
|
+
p.log.info(`Latest portable-context run: ${options.latestComparison.compiled.passed_cases}/${options.latestComparison.compiled.total_cases}.`);
|
|
56
56
|
}
|
|
57
57
|
else if (options.latestComparisonStale) {
|
|
58
|
-
p.log.info("Saved test results are stale for the current
|
|
58
|
+
p.log.info("Saved test results are stale for the current questions.");
|
|
59
59
|
}
|
|
60
60
|
if (options.sourcePath !== process.cwd()) {
|
|
61
61
|
p.log.info(`Project folder: ${options.sourcePath}`);
|
|
@@ -70,37 +70,37 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
70
70
|
options.push({
|
|
71
71
|
value: "test",
|
|
72
72
|
label: built
|
|
73
|
-
? "Compare files
|
|
73
|
+
? "Compare source files and the portable context your agents would use (Recommended)"
|
|
74
74
|
: hasSavedRawBaseline
|
|
75
|
-
? "Rerun the files
|
|
76
|
-
: "Measure the files
|
|
75
|
+
? "Rerun the source-files baseline"
|
|
76
|
+
: "Measure the source-files baseline (Recommended)",
|
|
77
77
|
hint: built
|
|
78
|
-
? "See whether the
|
|
78
|
+
? "See whether the portable context helps your agents on the saved questions"
|
|
79
79
|
: hasSavedRawBaseline
|
|
80
|
-
? "Refresh the saved
|
|
80
|
+
? "Refresh the saved source-files baseline on the current questions"
|
|
81
81
|
: "See whether the source files are already good enough before compiling",
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
options.push({
|
|
85
85
|
value: "compile",
|
|
86
|
-
label: built ? "Rebuild
|
|
86
|
+
label: built ? "Rebuild portable context for your agents" : "Build portable context for your agents",
|
|
87
87
|
hint: built
|
|
88
88
|
? "Refresh it from the current source files"
|
|
89
89
|
: dataset.checks.length > 0
|
|
90
90
|
? latestRawPasses
|
|
91
|
-
? "Optional: build
|
|
91
|
+
? "Optional: build portable context for your agents for a side-by-side comparison with the latest saved source-files run"
|
|
92
92
|
: hasSavedRawBaseline
|
|
93
|
-
? "Some
|
|
94
|
-
: "Build
|
|
95
|
-
: "Build it first, then measure it
|
|
93
|
+
? "Some questions still fail on the source files. Build portable context for your agents and compare it on the same questions"
|
|
94
|
+
: "Build portable context for your agents and compare it on the same questions"
|
|
95
|
+
: "Build it for your agents first, then measure it",
|
|
96
96
|
}, {
|
|
97
97
|
value: "dataset",
|
|
98
98
|
label: "Add another setup",
|
|
99
99
|
hint: "Add a separate folder, focus, or question set",
|
|
100
100
|
}, {
|
|
101
101
|
value: "edit",
|
|
102
|
-
label: "Edit
|
|
103
|
-
hint: "Update
|
|
102
|
+
label: "Edit questions and settings",
|
|
103
|
+
hint: "Update questions, focus, workflow, or compile mode",
|
|
104
104
|
}, {
|
|
105
105
|
value: "workflow",
|
|
106
106
|
label: "Create workflow",
|
|
@@ -120,32 +120,32 @@ async function promptDatasetAction(dataset, built, latestComparison) {
|
|
|
120
120
|
}
|
|
121
121
|
function printDatasetRecommendation(dataset, built, latestComparison) {
|
|
122
122
|
if (dataset.checks.length === 0) {
|
|
123
|
-
p.log.info("Recommended first step: save a few
|
|
123
|
+
p.log.info("Recommended first step: save a few questions for this dataset.");
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
if (!built) {
|
|
127
127
|
if (latestComparison?.raw) {
|
|
128
128
|
p.log.info(latestComparison.raw.passed_cases === latestComparison.raw.total_cases
|
|
129
|
-
? `Latest files
|
|
130
|
-
: `Latest files
|
|
129
|
+
? `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Rerun the baseline if you want current numbers for a different agent set, or build portable context for your agents if you want a side-by-side comparison.`
|
|
130
|
+
: `Latest source-files run: ${latestComparison.raw.passed_cases}/${latestComparison.raw.total_cases}. Some questions still fail on the source files. Build portable context for your agents if you want Interf to prepare context for this work and compare it on the same questions.`);
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
p.log.info("Recommended first step: measure the files
|
|
133
|
+
p.log.info("Recommended first step: measure the source-files baseline before compiling.");
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
p.log.info("Recommended first step: compare the files
|
|
136
|
+
p.log.info("Recommended first step: compare the source-files baseline and the portable context your agents would use.");
|
|
137
137
|
}
|
|
138
138
|
async function promptPostBaselineAction(rows) {
|
|
139
139
|
const status = currentRunTargetStatus(rows, "raw");
|
|
140
140
|
const subject = rows.length === 1 ? "selected agent" : "selected agents";
|
|
141
141
|
if (status === "pass") {
|
|
142
|
-
p.log.info(`
|
|
142
|
+
p.log.info(`Source files passed on all ${subject} in this run.`);
|
|
143
143
|
}
|
|
144
144
|
else if (status === "mixed") {
|
|
145
|
-
p.log.info(`
|
|
145
|
+
p.log.info(`Source files were mixed across the ${subject} in this run.`);
|
|
146
146
|
}
|
|
147
147
|
else if (status === "fail") {
|
|
148
|
-
p.log.info(`
|
|
148
|
+
p.log.info(`Source files did not pass on the ${subject} in this run.`);
|
|
149
149
|
}
|
|
150
150
|
const compileRecommended = status !== "pass";
|
|
151
151
|
const selected = await p.select({
|
|
@@ -154,23 +154,23 @@ async function promptPostBaselineAction(rows) {
|
|
|
154
154
|
{
|
|
155
155
|
value: "compile",
|
|
156
156
|
label: compileRecommended
|
|
157
|
-
? "Build
|
|
158
|
-
: "Build
|
|
157
|
+
? "Build portable context for your agents (Recommended)"
|
|
158
|
+
: "Build portable context for your agents",
|
|
159
159
|
hint: compileRecommended
|
|
160
160
|
? status === "mixed"
|
|
161
|
-
? "Some selected agents still failed on the
|
|
162
|
-
: "Build
|
|
163
|
-
: "Build
|
|
161
|
+
? "Some selected agents still failed on the source files. Build portable context for your agents and compare it on the same questions"
|
|
162
|
+
: "Build portable context for your agents and compare it on the same questions"
|
|
163
|
+
: "Build portable context for your agents and compare it on the same questions",
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
value: "edit",
|
|
167
|
-
label: "Change
|
|
168
|
-
hint: "Revise the
|
|
167
|
+
label: "Change questions and settings",
|
|
168
|
+
hint: "Revise the questions or setup settings before the next run",
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
value: "rerun",
|
|
172
|
-
label: "Rerun the files
|
|
173
|
-
hint: "Run the same
|
|
172
|
+
label: "Rerun the source-files baseline",
|
|
173
|
+
hint: "Run the same questions again, including different local agents if you want",
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
value: "done",
|
|
@@ -348,8 +348,8 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
348
348
|
if (action === "test") {
|
|
349
349
|
if (compiledConfig.checks.length === 0) {
|
|
350
350
|
process.exitCode = 1;
|
|
351
|
-
console.log(chalk.red(` Setup "${compiledConfig.name}" does not have any
|
|
352
|
-
console.log(chalk.dim(" Run `interf`, edit this setup, and add a few
|
|
351
|
+
console.log(chalk.red(` Setup "${compiledConfig.name}" does not have any questions yet.`));
|
|
352
|
+
console.log(chalk.dim(" Run `interf`, edit this setup, and add a few questions first."));
|
|
353
353
|
console.log(chalk.dim(" Then rerun `interf test`."));
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
@@ -407,7 +407,7 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
407
407
|
return;
|
|
408
408
|
}
|
|
409
409
|
if (compileResult.testedDuringCompile) {
|
|
410
|
-
p.log.info("This compile run already
|
|
410
|
+
p.log.info("This compile run already checked the portable context for your agents on the saved questions.");
|
|
411
411
|
p.log.info("Run `interf test` later if you want a fresh side-by-side comparison summary.");
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
@@ -426,14 +426,14 @@ async function runCompiledActionMenu(sourcePath, compiledConfig, options = {}) {
|
|
|
426
426
|
if (compiledConfig.checks.length === 0)
|
|
427
427
|
return;
|
|
428
428
|
if (compileResult.testedDuringCompile) {
|
|
429
|
-
p.log.info("This compile run already
|
|
429
|
+
p.log.info("This compile run already checked the portable context for your agents on the compile agent.");
|
|
430
430
|
}
|
|
431
431
|
const runCompiledTest = await p.confirm({
|
|
432
432
|
message: compileResult.testedDuringCompile
|
|
433
|
-
? "Run a fresh files
|
|
433
|
+
? "Run a fresh source-files versus portable-context comparison now?"
|
|
434
434
|
: builtCompiledPath
|
|
435
|
-
? "Run files
|
|
436
|
-
: "Compare files
|
|
435
|
+
? "Run source files and the portable context your agents would use on the saved questions now?"
|
|
436
|
+
: "Compare source files and the portable context your agents would use on the saved questions now?",
|
|
437
437
|
initialValue: true,
|
|
438
438
|
});
|
|
439
439
|
if (p.isCancel(runCompiledTest) || !runCompiledTest)
|
|
@@ -456,7 +456,7 @@ export const initCommand = {
|
|
|
456
456
|
};
|
|
457
457
|
export async function runInitCommand() {
|
|
458
458
|
p.intro(chalk.bold("Interf"));
|
|
459
|
-
p.log.info("Interf prepares
|
|
459
|
+
p.log.info("Interf prepares context for your agents from the source folder you choose. Start with the work, review the suggested questions, check the source files first, and build a local folder when the files need more structure.");
|
|
460
460
|
const cwd = process.cwd();
|
|
461
461
|
const detected = detectInterf(cwd);
|
|
462
462
|
const sourcePath = detected ? resolveSourceControlPath(detected.path) : cwd;
|
|
@@ -9,7 +9,7 @@ export const listCommand = {
|
|
|
9
9
|
const sourcePath = detected ? resolveSourceControlPath(detected.path) : process.cwd();
|
|
10
10
|
const datasets = listSavedCompiledEntries(sourcePath);
|
|
11
11
|
if (datasets.length === 0) {
|
|
12
|
-
console.log(chalk.dim(" Nothing found. Start with `interf` or `interf init` to define a setup and save
|
|
12
|
+
console.log(chalk.dim(" Nothing found. Start with `interf` or `interf init` to define a setup and save questions."));
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
console.log();
|
|
@@ -22,7 +22,7 @@ export const listCommand = {
|
|
|
22
22
|
}
|
|
23
23
|
console.log(chalk.dim(` ${dataset.path ? "built" : "not built yet"} · source folder: ${dataset.config.path}`));
|
|
24
24
|
console.log(chalk.dim(` workflow: ${dataset.config.workflow ?? "interf"}${dataset.localDraft ? " (local draft)" : ""}`));
|
|
25
|
-
console.log(chalk.dim(`
|
|
25
|
+
console.log(chalk.dim(` questions: ${dataset.config.checks.length}`));
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { detectInterf } from "../../packages/project-model/interf.js";
|
|
3
|
-
import { resetCompiledGeneratedState } from "../../packages/
|
|
3
|
+
import { resetCompiledGeneratedState } from "../../packages/compiler/reset.js";
|
|
4
4
|
export const resetCommand = {
|
|
5
5
|
command: "reset <scope>",
|
|
6
6
|
describe: "Reset generated compiled state while keeping `raw/` and the local workflow package",
|
|
@@ -2,7 +2,7 @@ import { type SourceDatasetConfig, type SourceTruthCheck } from "../../packages/
|
|
|
2
2
|
export declare const DEFAULT_COMPILED_NAME = "dataset1";
|
|
3
3
|
export declare const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "A question you can already verify from this source folder";
|
|
4
4
|
export declare const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
|
|
5
|
-
export declare const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board
|
|
5
|
+
export declare const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board prep from these files, chart reads from this report, or tax review from these exports.";
|
|
6
6
|
export declare const DEFAULT_DATASET_PATH_PLACEHOLDER = "./dataset1";
|
|
7
7
|
export declare const DEFAULT_COMPILE_RETRY_ATTEMPTS = 3;
|
|
8
8
|
export declare const DEFAULT_SELF_IMPROVING_LOOPS = 3;
|
|
@@ -2,13 +2,13 @@ import { existsSync, readdirSync, statSync } from "node:fs";
|
|
|
2
2
|
import { join, relative, sep } from "node:path";
|
|
3
3
|
import * as p from "@clack/prompts";
|
|
4
4
|
import { sourceConfig as projectSourceConfig, } from "../../packages/project-model/index.js";
|
|
5
|
-
import { slugify } from "../../
|
|
5
|
+
import { slugify } from "../../packages/shared/naming.js";
|
|
6
6
|
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
7
7
|
import { draftTruthChecks } from "./check-draft.js";
|
|
8
8
|
export const DEFAULT_COMPILED_NAME = "dataset1";
|
|
9
9
|
export const DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER = "A question you can already verify from this source folder";
|
|
10
10
|
export const DEFAULT_COMPILED_CHECK_ANSWER_PLACEHOLDER = "The expected answer in plain English";
|
|
11
|
-
export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board
|
|
11
|
+
export const DEFAULT_COMPILED_ABOUT_PLACEHOLDER = "Example: board prep from these files, chart reads from this report, or tax review from these exports.";
|
|
12
12
|
export const DEFAULT_DATASET_PATH_PLACEHOLDER = "./dataset1";
|
|
13
13
|
export const DEFAULT_COMPILE_RETRY_ATTEMPTS = 3;
|
|
14
14
|
export const DEFAULT_SELF_IMPROVING_LOOPS = 3;
|
|
@@ -162,9 +162,9 @@ async function promptDatasetFolderPath(options) {
|
|
|
162
162
|
}
|
|
163
163
|
export function datasetAboutPromptMessage(introStyle) {
|
|
164
164
|
if (introStyle === "edit") {
|
|
165
|
-
return "What
|
|
165
|
+
return "What work should this source folder stay focused on?";
|
|
166
166
|
}
|
|
167
|
-
return "What
|
|
167
|
+
return "What work should this source folder help with?";
|
|
168
168
|
}
|
|
169
169
|
function formatAttemptLabel(count, noun) {
|
|
170
170
|
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
@@ -246,7 +246,7 @@ export async function promptCheckCases(options) {
|
|
|
246
246
|
}
|
|
247
247
|
function printDraftTruthChecks(checks) {
|
|
248
248
|
console.log();
|
|
249
|
-
p.log.info(`Draft
|
|
249
|
+
p.log.info(`Draft tests: ${checks.length}`);
|
|
250
250
|
for (const [index, check] of checks.entries()) {
|
|
251
251
|
console.log(` ${index + 1}. ${check.question}`);
|
|
252
252
|
console.log(` Expected: ${check.answer ?? ""}`);
|
|
@@ -271,19 +271,19 @@ async function promptDraftTruthChecks(options) {
|
|
|
271
271
|
if (!resolved.executor) {
|
|
272
272
|
if (resolved.cancelled)
|
|
273
273
|
return null;
|
|
274
|
-
p.log.error(resolved.error ?? "No local agent detected for
|
|
274
|
+
p.log.error(resolved.error ?? "No local agent detected for question drafting.");
|
|
275
275
|
const fallback = await p.select({
|
|
276
276
|
message: "How do you want to continue?",
|
|
277
277
|
options: [
|
|
278
278
|
{
|
|
279
279
|
value: "manual",
|
|
280
|
-
label: "Add
|
|
280
|
+
label: "Add questions manually",
|
|
281
281
|
hint: "Write the questions and expected answers yourself",
|
|
282
282
|
},
|
|
283
283
|
{
|
|
284
284
|
value: "skip",
|
|
285
285
|
label: "Skip for now",
|
|
286
|
-
hint: "Save this dataset without
|
|
286
|
+
hint: "Save this dataset without questions",
|
|
287
287
|
},
|
|
288
288
|
],
|
|
289
289
|
});
|
|
@@ -292,7 +292,7 @@ async function promptDraftTruthChecks(options) {
|
|
|
292
292
|
return fallback === "manual" ? "manual" : [];
|
|
293
293
|
}
|
|
294
294
|
while (true) {
|
|
295
|
-
p.log.info("Drafting
|
|
295
|
+
p.log.info("Drafting questions from the source files.");
|
|
296
296
|
const drafted = await draftTruthChecks({
|
|
297
297
|
datasetName: options.datasetName,
|
|
298
298
|
datasetPath: resolvedDatasetPath,
|
|
@@ -301,7 +301,7 @@ async function promptDraftTruthChecks(options) {
|
|
|
301
301
|
targetCount: 4,
|
|
302
302
|
});
|
|
303
303
|
if (!drafted.checks) {
|
|
304
|
-
p.log.error(drafted.error ?? "Could not draft
|
|
304
|
+
p.log.error(drafted.error ?? "Could not draft questions from this source folder.");
|
|
305
305
|
const retryMode = await p.select({
|
|
306
306
|
message: "How do you want to continue?",
|
|
307
307
|
options: [
|
|
@@ -312,13 +312,13 @@ async function promptDraftTruthChecks(options) {
|
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
value: "manual",
|
|
315
|
-
label: "Add
|
|
316
|
-
hint: "Write the
|
|
315
|
+
label: "Add questions manually",
|
|
316
|
+
hint: "Write the questions yourself instead",
|
|
317
317
|
},
|
|
318
318
|
{
|
|
319
319
|
value: "skip",
|
|
320
320
|
label: "Skip for now",
|
|
321
|
-
hint: "Save this dataset without
|
|
321
|
+
hint: "Save this dataset without questions",
|
|
322
322
|
},
|
|
323
323
|
],
|
|
324
324
|
});
|
|
@@ -330,12 +330,12 @@ async function promptDraftTruthChecks(options) {
|
|
|
330
330
|
}
|
|
331
331
|
printDraftTruthChecks(drafted.checks);
|
|
332
332
|
const nextStep = await p.select({
|
|
333
|
-
message: "Use these
|
|
333
|
+
message: "Use these questions?",
|
|
334
334
|
options: [
|
|
335
335
|
{
|
|
336
336
|
value: "use",
|
|
337
337
|
label: "Use this draft (Recommended)",
|
|
338
|
-
hint: "Save these
|
|
338
|
+
hint: "Save these questions and edit them later if needed",
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
341
|
value: "retry",
|
|
@@ -344,13 +344,13 @@ async function promptDraftTruthChecks(options) {
|
|
|
344
344
|
},
|
|
345
345
|
{
|
|
346
346
|
value: "manual",
|
|
347
|
-
label: "Add
|
|
348
|
-
hint: "Discard this draft and write the
|
|
347
|
+
label: "Add questions manually instead",
|
|
348
|
+
hint: "Discard this draft and write the questions yourself",
|
|
349
349
|
},
|
|
350
350
|
{
|
|
351
351
|
value: "skip",
|
|
352
352
|
label: "Skip for now",
|
|
353
|
-
hint: "Save this dataset without
|
|
353
|
+
hint: "Save this dataset without questions",
|
|
354
354
|
},
|
|
355
355
|
],
|
|
356
356
|
});
|
|
@@ -370,24 +370,24 @@ async function promptCompiledChecks(options) {
|
|
|
370
370
|
if (options.initialAbout) {
|
|
371
371
|
p.log.info(`About: ${options.initialAbout}`);
|
|
372
372
|
}
|
|
373
|
-
p.log.info("
|
|
373
|
+
p.log.info("Questions are simple question-and-answer pairs Interf uses to check accuracy, so you can decide whether to trust the portable context.");
|
|
374
374
|
const mode = await p.select({
|
|
375
375
|
message: "How should Interf create them?",
|
|
376
376
|
options: [
|
|
377
377
|
{
|
|
378
378
|
value: "draft",
|
|
379
|
-
label: "Auto-create a draft (Recommended)",
|
|
380
|
-
hint: "Let your chosen local agent
|
|
379
|
+
label: "Auto-create a question draft (Recommended)",
|
|
380
|
+
hint: "Let your chosen local agent recommend a few clear, verifiable questions from this source folder",
|
|
381
381
|
},
|
|
382
382
|
{
|
|
383
383
|
value: "manual",
|
|
384
|
-
label: "Add
|
|
384
|
+
label: "Add questions manually",
|
|
385
385
|
hint: "Write the questions and expected answers yourself",
|
|
386
386
|
},
|
|
387
387
|
{
|
|
388
388
|
value: "skip",
|
|
389
389
|
label: "Skip for now",
|
|
390
|
-
hint: "You can save the dataset first and add
|
|
390
|
+
hint: "You can save the dataset first and add questions later",
|
|
391
391
|
},
|
|
392
392
|
],
|
|
393
393
|
});
|
|
@@ -406,7 +406,7 @@ async function promptCompiledChecks(options) {
|
|
|
406
406
|
return null;
|
|
407
407
|
if (drafted === "manual") {
|
|
408
408
|
return promptCheckCases({
|
|
409
|
-
heading: "
|
|
409
|
+
heading: "Questions",
|
|
410
410
|
questionMessage: "Question 1?",
|
|
411
411
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
412
412
|
answerMessage: "Expected answer 1?",
|
|
@@ -417,7 +417,7 @@ async function promptCompiledChecks(options) {
|
|
|
417
417
|
return drafted;
|
|
418
418
|
}
|
|
419
419
|
return promptCheckCases({
|
|
420
|
-
heading: "
|
|
420
|
+
heading: "Questions",
|
|
421
421
|
questionMessage: "Question 1?",
|
|
422
422
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
423
423
|
answerMessage: "Expected answer 1?",
|
|
@@ -428,34 +428,34 @@ async function promptCompiledChecks(options) {
|
|
|
428
428
|
if (options.initialAbout) {
|
|
429
429
|
p.log.info(`About: ${options.initialAbout}`);
|
|
430
430
|
}
|
|
431
|
-
p.log.info(`Current
|
|
431
|
+
p.log.info(`Current questions: ${options.initialChecks.length}`);
|
|
432
432
|
const mode = await p.select({
|
|
433
433
|
message: "What do you want to do with them?",
|
|
434
434
|
options: [
|
|
435
435
|
{
|
|
436
436
|
value: "keep",
|
|
437
437
|
label: "Keep them",
|
|
438
|
-
hint: "Leave the current
|
|
438
|
+
hint: "Leave the current questions as-is",
|
|
439
439
|
},
|
|
440
440
|
{
|
|
441
441
|
value: "add",
|
|
442
442
|
label: "Add more",
|
|
443
|
-
hint: "Append more
|
|
443
|
+
hint: "Append more questions",
|
|
444
444
|
},
|
|
445
445
|
{
|
|
446
446
|
value: "replace",
|
|
447
447
|
label: "Replace all",
|
|
448
|
-
hint: "Rewrite the
|
|
448
|
+
hint: "Rewrite the questions from scratch",
|
|
449
449
|
},
|
|
450
450
|
{
|
|
451
451
|
value: "redraft",
|
|
452
452
|
label: "Replace with auto-created draft",
|
|
453
|
-
hint: "Let a local agent rewrite the
|
|
453
|
+
hint: "Let a local agent rewrite the questions from the dataset files",
|
|
454
454
|
},
|
|
455
455
|
{
|
|
456
456
|
value: "clear",
|
|
457
457
|
label: "Clear them for now",
|
|
458
|
-
hint: "Keep this setup without
|
|
458
|
+
hint: "Keep this setup without questions",
|
|
459
459
|
},
|
|
460
460
|
],
|
|
461
461
|
});
|
|
@@ -478,7 +478,7 @@ async function promptCompiledChecks(options) {
|
|
|
478
478
|
return null;
|
|
479
479
|
if (drafted === "manual") {
|
|
480
480
|
return promptCheckCases({
|
|
481
|
-
heading: "Replace
|
|
481
|
+
heading: "Replace questions",
|
|
482
482
|
questionMessage: "Question 1?",
|
|
483
483
|
questionPlaceholder: DEFAULT_COMPILED_CHECK_QUESTION_PLACEHOLDER,
|
|
484
484
|
answerMessage: "Expected answer 1?",
|
|
@@ -489,7 +489,7 @@ async function promptCompiledChecks(options) {
|
|
|
489
489
|
return drafted;
|
|
490
490
|
}
|
|
491
491
|
const nextChecks = await promptCheckCases({
|
|
492
|
-
heading: mode === "add" ? "Add more
|
|
492
|
+
heading: mode === "add" ? "Add more questions" : "Replace questions",
|
|
493
493
|
questionMessage: mode === "add"
|
|
494
494
|
? `Question ${options.initialChecks.length + 1}?`
|
|
495
495
|
: "Question 1?",
|
|
@@ -544,7 +544,7 @@ export async function promptCompileLoopSelection(options) {
|
|
|
544
544
|
once: {
|
|
545
545
|
value: "once",
|
|
546
546
|
label: "Compile once",
|
|
547
|
-
hint: "Build
|
|
547
|
+
hint: "Build portable context for your agents once with the selected workflow",
|
|
548
548
|
},
|
|
549
549
|
"self-improving": {
|
|
550
550
|
value: "self-improving",
|
|
@@ -556,7 +556,7 @@ export async function promptCompileLoopSelection(options) {
|
|
|
556
556
|
retry: {
|
|
557
557
|
value: "retry",
|
|
558
558
|
label: "Retry same workflow",
|
|
559
|
-
hint: `Retry compile and
|
|
559
|
+
hint: `Retry compile and portable-context checks up to ${options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS} total time${(options.initialMaxAttempts ?? DEFAULT_COMPILE_RETRY_ATTEMPTS) === 1 ? "" : "s"} without editing the workflow`,
|
|
560
560
|
},
|
|
561
561
|
};
|
|
562
562
|
const orderedModes = (hasSavedPolicy
|
|
@@ -607,11 +607,11 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
607
607
|
const initial = options.initial;
|
|
608
608
|
const introStyle = options.introStyle ?? "first";
|
|
609
609
|
if (introStyle === "first") {
|
|
610
|
-
p.log.info("Pick the source folder for this
|
|
611
|
-
p.log.info("Then say what
|
|
610
|
+
p.log.info("Pick the source folder for this work.");
|
|
611
|
+
p.log.info("Then say what work this source folder should help with and review the recommended questions.");
|
|
612
612
|
}
|
|
613
613
|
else if (introStyle === "additional") {
|
|
614
|
-
p.log.info("Add another setup only if this project needs a separate folder or set of
|
|
614
|
+
p.log.info("Add another setup only if this project needs a separate folder or set of questions.");
|
|
615
615
|
}
|
|
616
616
|
const fixedName = options.fixedName ? slugify(String(options.fixedName)) : undefined;
|
|
617
617
|
if (options.fixedName && !fixedName) {
|
|
@@ -620,7 +620,7 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
620
620
|
}
|
|
621
621
|
let name = fixedName;
|
|
622
622
|
if (name && options.fixedName) {
|
|
623
|
-
p.log.info(`Editing
|
|
623
|
+
p.log.info(`Editing questions for dataset "${name}".`);
|
|
624
624
|
}
|
|
625
625
|
let about = normalizeOptionalPromptText(initial?.about);
|
|
626
626
|
const projectPath = options.projectPath ?? process.cwd();
|
|
@@ -684,7 +684,7 @@ export async function promptSingleCompiledConfig(options = {}) {
|
|
|
684
684
|
hasChecks: checks.length > 0,
|
|
685
685
|
intro: [
|
|
686
686
|
"Compile mode",
|
|
687
|
-
"Choose whether Interf should compile once, retry the same workflow, or try self-improving workflow variations on the same
|
|
687
|
+
"Choose whether Interf should compile once, retry the same workflow, or try self-improving workflow variations on the same questions.",
|
|
688
688
|
],
|
|
689
689
|
});
|
|
690
690
|
if (compileLoopSelection === null)
|
|
@@ -18,7 +18,7 @@ function statusColor(status) {
|
|
|
18
18
|
}
|
|
19
19
|
export const statusCommand = {
|
|
20
20
|
command: "status",
|
|
21
|
-
describe: "Show deterministic health for
|
|
21
|
+
describe: "Show deterministic health for the portable context your agents use",
|
|
22
22
|
handler: async () => {
|
|
23
23
|
let compiledPath = null;
|
|
24
24
|
const detected = detectInterf(process.cwd());
|
|
@@ -33,8 +33,8 @@ export const statusCommand = {
|
|
|
33
33
|
}));
|
|
34
34
|
if (local.length === 0) {
|
|
35
35
|
process.exitCode = 1;
|
|
36
|
-
console.log(chalk.red(" No
|
|
37
|
-
console.log(chalk.dim(" Run `interf`, save
|
|
36
|
+
console.log(chalk.red(" No portable contexts found."));
|
|
37
|
+
console.log(chalk.dim(" Run `interf`, save questions, and compile portable context for your agents first."));
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
40
|
if (local.length === 1) {
|
|
@@ -74,8 +74,8 @@ export const statusCommand = {
|
|
|
74
74
|
else {
|
|
75
75
|
console.log();
|
|
76
76
|
console.log(chalk.dim(latestComparisonState.stale
|
|
77
|
-
? " Saved test results are stale for the current
|
|
78
|
-
: " No saved
|
|
77
|
+
? " Saved test results are stale for the current questions. Run `interf test` again."
|
|
78
|
+
: " No saved comparison yet. Run `interf test` to measure source files and the portable context your agents would use."));
|
|
79
79
|
}
|
|
80
80
|
console.log();
|
|
81
81
|
const metricOrder = [
|