@interf/compiler 0.7.3 → 0.9.1
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 +123 -89
- package/TRADEMARKS.md +1 -1
- package/agent-skills/interf-actions/SKILL.md +71 -0
- package/agent-skills/interf-actions/references/cli.md +190 -0
- package/apps/compiler-ui/.next/server/app/index.html +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_buildManifest.js +11 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_clientMiddlewareManifest.js +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_ssgManifest.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/03~yq9q893hmn.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/06z~l3kwb891e.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08g7lvje.te.u.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08m7vf5asqlsm.js +91 -0
- package/apps/compiler-ui/.next/static/chunks/0_i-3_5l9t2qe.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b-ywny_j0g~0.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b52v41o1gixx.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js +124 -0
- package/apps/compiler-ui/.next/static/chunks/0gpzgsv0w.q~m.js +31 -0
- package/apps/compiler-ui/.next/static/chunks/0ilwfezfvu6~-.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0n51hrfoufc7g.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +5 -0
- package/apps/compiler-ui/.next/static/chunks/0xxmf45eskdt~.css +1 -0
- package/apps/compiler-ui/.next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
- package/apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css +3 -0
- package/apps/compiler-ui/.next/static/chunks/14wtz~vq25~qq.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
- package/apps/compiler-ui/.next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/worker.102zas1s52_pf.js +109 -0
- package/builtin-workflows/interf/README.md +8 -8
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +4 -4
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
- package/builtin-workflows/interf/improve/SKILL.md +1 -1
- package/builtin-workflows/interf/use/query/SKILL.md +1 -1
- package/builtin-workflows/interf/workflow.json +8 -8
- package/builtin-workflows/interf/workflow.schema.json +1 -1
- package/dist/cli/commands/check-draft.d.ts +5 -4
- package/dist/cli/commands/check-draft.js +18 -17
- package/dist/cli/commands/compile-controller.d.ts +3 -0
- package/dist/cli/commands/compile-controller.js +53 -45
- package/dist/cli/commands/compile.js +83 -27
- package/dist/cli/commands/compiled-flow.d.ts +3 -0
- package/dist/cli/commands/compiled-flow.js +9 -7
- package/dist/cli/commands/control-path.d.ts +11 -0
- package/dist/cli/commands/control-path.js +72 -0
- package/dist/cli/commands/create-workflow-wizard.d.ts +6 -0
- package/dist/cli/commands/create-workflow-wizard.js +191 -77
- package/dist/cli/commands/create.js +54 -40
- package/dist/cli/commands/default.js +4 -3
- package/dist/cli/commands/doctor.js +5 -5
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.js +326 -76
- package/dist/cli/commands/list.js +8 -7
- package/dist/cli/commands/preparation-selection.d.ts +6 -0
- package/dist/cli/commands/preparation-selection.js +11 -0
- package/dist/cli/commands/reset.js +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +4 -3
- package/dist/cli/commands/source-config-wizard.js +175 -197
- package/dist/cli/commands/status.js +116 -8
- package/dist/cli/commands/test-flow.d.ts +1 -1
- package/dist/cli/commands/test-flow.js +31 -31
- package/dist/cli/commands/test.d.ts +4 -0
- package/dist/cli/commands/test.js +95 -58
- package/dist/cli/commands/verify.js +7 -7
- package/dist/cli/commands/web.d.ts +11 -0
- package/dist/cli/commands/web.js +373 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/packages/agents/lib/execution.js +4 -2
- package/dist/packages/agents/lib/executors.d.ts +1 -0
- package/dist/packages/agents/lib/executors.js +1 -0
- package/dist/packages/agents/lib/render.d.ts +2 -2
- package/dist/packages/agents/lib/render.js +10 -9
- package/dist/packages/agents/lib/shells.d.ts +3 -11
- package/dist/packages/agents/lib/shells.js +45 -96
- package/dist/packages/agents/lib/types.d.ts +1 -0
- package/dist/packages/compiler/compiled-paths.d.ts +4 -1
- package/dist/packages/compiler/compiled-paths.js +7 -1
- package/dist/packages/compiler/compiled-pipeline.d.ts +7 -0
- package/dist/packages/compiler/compiled-pipeline.js +15 -4
- package/dist/packages/compiler/compiled-schema.js +1 -1
- package/dist/packages/compiler/compiled-stage-plan.d.ts +2 -2
- package/dist/packages/compiler/compiled-stage-plan.js +4 -4
- package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -0
- package/dist/packages/compiler/compiled-stage-runner.js +50 -2
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +161 -1
- package/dist/packages/compiler/lib/schema.js +87 -1
- package/dist/packages/compiler/raw-snapshot.d.ts +9 -2
- package/dist/packages/compiler/runtime-acceptance.js +1 -1
- package/dist/packages/compiler/runtime-contracts.js +2 -2
- package/dist/packages/compiler/runtime-prompt.js +6 -6
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +3 -0
- package/dist/packages/compiler/runtime-types.d.ts +1 -0
- package/dist/packages/compiler/state-health.js +1 -1
- package/dist/packages/compiler/state-view.js +2 -2
- package/dist/packages/compiler/validate-compiled.js +11 -9
- package/dist/packages/execution/adapters.d.ts +15 -0
- package/dist/packages/execution/adapters.js +1 -0
- package/dist/packages/execution/events.d.ts +8 -0
- package/dist/packages/execution/events.js +16 -0
- package/dist/packages/execution/index.d.ts +9 -0
- package/dist/packages/execution/index.js +6 -0
- package/dist/packages/execution/lib/schema.d.ts +1554 -0
- package/dist/packages/execution/lib/schema.js +319 -0
- package/dist/packages/local-service/action-values.d.ts +23 -0
- package/dist/packages/local-service/action-values.js +31 -0
- package/dist/packages/local-service/client.d.ts +119 -0
- package/dist/packages/local-service/client.js +356 -0
- package/dist/packages/local-service/index.d.ts +15 -0
- package/dist/packages/local-service/index.js +11 -0
- package/dist/packages/local-service/lib/schema.d.ts +7355 -0
- package/dist/packages/local-service/lib/schema.js +636 -0
- package/dist/packages/local-service/routes.d.ts +27 -0
- package/dist/packages/local-service/routes.js +32 -0
- package/dist/packages/local-service/runtime.d.ts +134 -0
- package/dist/packages/local-service/runtime.js +2841 -0
- package/dist/packages/local-service/server.d.ts +17 -0
- package/dist/packages/local-service/server.js +572 -0
- package/dist/packages/project-model/index.d.ts +2 -1
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/interf-detect.d.ts +6 -2
- package/dist/packages/project-model/interf-detect.js +25 -10
- package/dist/packages/project-model/interf-scaffold.js +9 -6
- package/dist/packages/project-model/interf.d.ts +1 -1
- package/dist/packages/project-model/interf.js +1 -1
- package/dist/packages/project-model/lib/schema.d.ts +80 -6
- package/dist/packages/project-model/lib/schema.js +29 -19
- package/dist/packages/project-model/source-config.d.ts +22 -13
- package/dist/packages/project-model/source-config.js +140 -123
- package/dist/packages/project-model/source-folders.d.ts +11 -0
- package/dist/packages/project-model/source-folders.js +110 -0
- package/dist/packages/testing/test-execution.js +5 -5
- package/dist/packages/testing/test-paths.js +1 -3
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
- package/dist/packages/workflow-authoring/workflow-authoring.js +45 -86
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +80 -49
- package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
- package/dist/packages/workflow-package/context-interface.js +1 -1
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
- package/dist/packages/workflow-package/local-workflows.js +33 -17
- package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
- package/dist/packages/workflow-package/workflow-definitions.js +23 -22
- package/dist/packages/workflow-package/workflow-helpers.js +10 -6
- package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
- package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
- package/package.json +17 -1
- package/dist/cli/commands/dataset-selection.d.ts +0 -6
- package/dist/cli/commands/dataset-selection.js +0 -11
- package/dist/lib/agent-args.d.ts +0 -1
- package/dist/lib/agent-args.js +0 -1
- package/dist/lib/agent-constants.d.ts +0 -1
- package/dist/lib/agent-constants.js +0 -1
- package/dist/lib/agent-detection.d.ts +0 -1
- package/dist/lib/agent-detection.js +0 -1
- package/dist/lib/agent-execution.d.ts +0 -1
- package/dist/lib/agent-execution.js +0 -1
- package/dist/lib/agent-logs.d.ts +0 -1
- package/dist/lib/agent-logs.js +0 -1
- package/dist/lib/agent-preflight.d.ts +0 -1
- package/dist/lib/agent-preflight.js +0 -1
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +0 -1
- package/dist/lib/agent-shells.js +0 -1
- package/dist/lib/agent-status.d.ts +0 -1
- package/dist/lib/agent-status.js +0 -1
- package/dist/lib/agent-types.d.ts +0 -1
- package/dist/lib/agent-types.js +0 -1
- package/dist/lib/agents.d.ts +0 -1
- package/dist/lib/agents.js +0 -1
- package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
- package/dist/lib/builtin-compiled-workflow.js +0 -1
- package/dist/lib/chart-guidance.d.ts +0 -1
- package/dist/lib/chart-guidance.js +0 -1
- package/dist/lib/compiled-compile.d.ts +0 -1
- package/dist/lib/compiled-compile.js +0 -1
- package/dist/lib/compiled-paths.d.ts +0 -1
- package/dist/lib/compiled-paths.js +0 -3
- package/dist/lib/compiled-raw.d.ts +0 -1
- package/dist/lib/compiled-raw.js +0 -3
- package/dist/lib/compiled-reset.d.ts +0 -1
- package/dist/lib/compiled-reset.js +0 -3
- package/dist/lib/compiled-schema.d.ts +0 -1
- package/dist/lib/compiled-schema.js +0 -1
- package/dist/lib/discovery.d.ts +0 -1
- package/dist/lib/discovery.js +0 -1
- package/dist/lib/execution-profile.d.ts +0 -1
- package/dist/lib/execution-profile.js +0 -1
- package/dist/lib/executors.d.ts +0 -1
- package/dist/lib/executors.js +0 -1
- package/dist/lib/filesystem.d.ts +0 -1
- package/dist/lib/filesystem.js +0 -1
- package/dist/lib/interf-bootstrap.d.ts +0 -1
- package/dist/lib/interf-bootstrap.js +0 -3
- package/dist/lib/interf-detect.d.ts +0 -1
- package/dist/lib/interf-detect.js +0 -3
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +0 -3
- package/dist/lib/interf-workflow-package.d.ts +0 -1
- package/dist/lib/interf-workflow-package.js +0 -1
- package/dist/lib/interf.d.ts +0 -1
- package/dist/lib/interf.js +0 -3
- package/dist/lib/local-workflows.d.ts +0 -1
- package/dist/lib/local-workflows.js +0 -1
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/package-root.d.ts +0 -1
- package/dist/lib/package-root.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/project-paths.d.ts +0 -1
- package/dist/lib/project-paths.js +0 -3
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +0 -1
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +0 -1
- package/dist/lib/runtime-inventory.d.ts +0 -1
- package/dist/lib/runtime-inventory.js +0 -1
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +0 -1
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +0 -1
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +0 -1
- package/dist/lib/runtime-types.d.ts +0 -1
- package/dist/lib/runtime-types.js +0 -1
- package/dist/lib/runtime.d.ts +0 -1
- package/dist/lib/runtime.js +0 -1
- package/dist/lib/schema.d.ts +0 -4
- package/dist/lib/schema.js +0 -6
- package/dist/lib/source-config.d.ts +0 -1
- package/dist/lib/source-config.js +0 -3
- package/dist/lib/state-artifacts.d.ts +0 -1
- package/dist/lib/state-artifacts.js +0 -1
- package/dist/lib/state-health.d.ts +0 -1
- package/dist/lib/state-health.js +0 -1
- package/dist/lib/state-io.d.ts +0 -1
- package/dist/lib/state-io.js +0 -1
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +0 -1
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +0 -1
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/test-execution.d.ts +0 -1
- package/dist/lib/test-execution.js +0 -3
- package/dist/lib/test-matrices.d.ts +0 -1
- package/dist/lib/test-matrices.js +0 -3
- package/dist/lib/test-paths.d.ts +0 -1
- package/dist/lib/test-paths.js +0 -3
- package/dist/lib/test-profile-presets.d.ts +0 -1
- package/dist/lib/test-profile-presets.js +0 -3
- package/dist/lib/test-sandbox.d.ts +0 -1
- package/dist/lib/test-sandbox.js +0 -3
- package/dist/lib/test-specs.d.ts +0 -1
- package/dist/lib/test-specs.js +0 -3
- package/dist/lib/test-targets.d.ts +0 -1
- package/dist/lib/test-targets.js +0 -3
- package/dist/lib/test-types.d.ts +0 -1
- package/dist/lib/test-types.js +0 -3
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/test.js +0 -3
- package/dist/lib/util.d.ts +0 -1
- package/dist/lib/util.js +0 -1
- package/dist/lib/validate-compiled.d.ts +0 -1
- package/dist/lib/validate-compiled.js +0 -1
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +0 -1
- package/dist/lib/workflow-authoring.d.ts +0 -1
- package/dist/lib/workflow-authoring.js +0 -1
- package/dist/lib/workflow-definitions.d.ts +0 -1
- package/dist/lib/workflow-definitions.js +0 -1
- package/dist/lib/workflow-edit-session.d.ts +0 -1
- package/dist/lib/workflow-edit-session.js +0 -1
- package/dist/lib/workflow-edit-utils.d.ts +0 -1
- package/dist/lib/workflow-edit-utils.js +0 -1
- package/dist/lib/workflow-helpers.d.ts +0 -1
- package/dist/lib/workflow-helpers.js +0 -1
- package/dist/lib/workflow-improvement.d.ts +0 -1
- package/dist/lib/workflow-improvement.js +0 -1
- package/dist/lib/workflow-primitives.d.ts +0 -1
- package/dist/lib/workflow-primitives.js +0 -1
- package/dist/lib/workflow-review-paths.d.ts +0 -1
- package/dist/lib/workflow-review-paths.js +0 -1
- package/dist/lib/workflow-stage-policy.d.ts +0 -1
- package/dist/lib/workflow-stage-policy.js +0 -1
- package/dist/lib/workflow-stage-runner.d.ts +0 -1
- package/dist/lib/workflow-stage-runner.js +0 -1
- package/dist/lib/workflows.d.ts +0 -1
- package/dist/lib/workflows.js +0 -1
|
@@ -2,37 +2,37 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
const
|
|
5
|
+
const DraftReadinessCheckSchema = z.object({
|
|
6
6
|
question: z.string().min(1),
|
|
7
7
|
answer: z.string().min(1),
|
|
8
8
|
}).strict();
|
|
9
|
-
const
|
|
10
|
-
export function
|
|
9
|
+
const DraftReadinessChecksSchema = z.array(DraftReadinessCheckSchema).min(1).max(8);
|
|
10
|
+
export function buildReadinessCheckDraftPrompt(options) {
|
|
11
11
|
const normalizedAbout = options.about?.trim();
|
|
12
12
|
const taskLines = normalizedAbout
|
|
13
13
|
? [
|
|
14
|
-
`Primary work: ${normalizedAbout}`,
|
|
15
|
-
"Draft checks that directly measure whether a local agent can
|
|
16
|
-
"Prefer checks that would make a human confident the
|
|
14
|
+
`Primary agent work: ${normalizedAbout}`,
|
|
15
|
+
"Draft readiness checks that directly measure whether a local agent can recover the agent-work-critical facts from the source files.",
|
|
16
|
+
"Prefer checks that would make a human confident the Preparation is useful for that exact job.",
|
|
17
17
|
]
|
|
18
18
|
: [
|
|
19
|
-
"No primary work was provided.",
|
|
20
|
-
"Prefer broad, representative checks that reflect the
|
|
19
|
+
"No primary agent work was provided.",
|
|
20
|
+
"Prefer broad, representative readiness checks that reflect the facts a human would verify from this Source Folder.",
|
|
21
21
|
];
|
|
22
22
|
return [
|
|
23
|
-
"You are drafting Interf checks for a local
|
|
23
|
+
"You are drafting Interf readiness checks for a local Source Folder.",
|
|
24
24
|
"Read the files in this folder and draft a small set of checks that a human can verify from the source material.",
|
|
25
25
|
"Do not ask follow-up questions.",
|
|
26
|
-
"Keep the checks concrete, explicit, and useful for measuring whether an agent can reason correctly over the files in this
|
|
26
|
+
"Keep the checks concrete, explicit, and useful for measuring whether an agent can reason correctly over the files in this Source Folder.",
|
|
27
27
|
"",
|
|
28
|
-
`
|
|
29
|
-
`Source
|
|
28
|
+
`Preparation id: ${options.datasetName}`,
|
|
29
|
+
`Source Folder: ${options.datasetPath}`,
|
|
30
30
|
...taskLines,
|
|
31
31
|
"",
|
|
32
32
|
`Write exactly one JSON array to ${JSON.stringify(options.outputPath)}.`,
|
|
33
|
-
`Draft ${options.targetCount} checks unless the
|
|
33
|
+
`Draft ${options.targetCount} checks unless the Source Folder is too small; in that case write fewer.`,
|
|
34
34
|
"Each array item must be an object with exactly these keys:",
|
|
35
|
-
'- "question": a plain-English question answerable from this
|
|
35
|
+
'- "question": a plain-English question answerable from this Source Folder',
|
|
36
36
|
'- "answer": the expected correct answer in plain English',
|
|
37
37
|
"",
|
|
38
38
|
"Quality bar:",
|
|
@@ -52,11 +52,11 @@ export function buildTruthCheckDraftPrompt(options) {
|
|
|
52
52
|
"- Stop after writing the file.",
|
|
53
53
|
].join("\n");
|
|
54
54
|
}
|
|
55
|
-
export async function
|
|
55
|
+
export async function draftReadinessChecks(options) {
|
|
56
56
|
const tempDir = mkdtempSync(join(tmpdir(), "interf-draft-checks-"));
|
|
57
57
|
const outputPath = join(tempDir, "checks.json");
|
|
58
58
|
const promptPath = join(tempDir, "prompt.txt");
|
|
59
|
-
const prompt =
|
|
59
|
+
const prompt = buildReadinessCheckDraftPrompt({
|
|
60
60
|
datasetName: options.datasetName,
|
|
61
61
|
datasetPath: options.datasetPath,
|
|
62
62
|
about: options.about,
|
|
@@ -67,6 +67,7 @@ export async function draftTruthChecks(options) {
|
|
|
67
67
|
try {
|
|
68
68
|
const code = await options.executor.execute(options.datasetPath, prompt, {
|
|
69
69
|
completionCheck: () => existsSync(outputPath),
|
|
70
|
+
onStatus: options.onStatus,
|
|
70
71
|
});
|
|
71
72
|
if (!existsSync(outputPath)) {
|
|
72
73
|
return {
|
|
@@ -86,7 +87,7 @@ export async function draftTruthChecks(options) {
|
|
|
86
87
|
error: `Draft checks were not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
87
88
|
};
|
|
88
89
|
}
|
|
89
|
-
const validated =
|
|
90
|
+
const validated = DraftReadinessChecksSchema.safeParse(parsed);
|
|
90
91
|
if (!validated.success) {
|
|
91
92
|
const detail = validated.error.issues[0]?.message ?? "invalid draft checks";
|
|
92
93
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { WorkflowExecutionProfile, WorkflowExecutor } from "../../packages/agents/lib/executors.js";
|
|
2
2
|
import type { SourceDatasetConfig } from "../../packages/project-model/lib/schema.js";
|
|
3
3
|
import type { StageShellRetentionMode } from "../../packages/compiler/workflows.js";
|
|
4
|
+
import type { RunEventSink } from "../../packages/execution/events.js";
|
|
4
5
|
export declare function runConfiguredCompiledCompile(options: {
|
|
5
6
|
executor: WorkflowExecutor;
|
|
6
7
|
testExecutor?: WorkflowExecutor | null;
|
|
@@ -11,4 +12,6 @@ export declare function runConfiguredCompiledCompile(options: {
|
|
|
11
12
|
maxAttemptsOverride: number | null;
|
|
12
13
|
maxLoopsOverride: number | null;
|
|
13
14
|
preserveStageShells?: StageShellRetentionMode;
|
|
15
|
+
runId?: string;
|
|
16
|
+
events?: RunEventSink;
|
|
14
17
|
}): Promise<boolean>;
|
|
@@ -11,10 +11,10 @@ import { stageExecutionShellsRoot, workflowPackagePathForCompiled, } from "../..
|
|
|
11
11
|
import { readCompiledSchemaFile } from "../../packages/compiler/compiled-schema.js";
|
|
12
12
|
import { initializeCompiledRuntimeState } from "../../packages/compiler/state.js";
|
|
13
13
|
import { compileCompiledWithReporter } from "./compiled-flow.js";
|
|
14
|
-
import { printSavedTestOutcome,
|
|
14
|
+
import { printSavedTestOutcome, readinessPassRate, runSavedCompiledTest, } from "./test-flow.js";
|
|
15
15
|
function printCompileFailure(compiledPath, failedStage) {
|
|
16
|
-
|
|
17
|
-
const failedStageLabel = formatActiveCompiledWorkflowStageStep(compiledPath,
|
|
16
|
+
resolveRequiredCompiledWorkflowFromConfig(readInterfConfig(compiledPath), `.interf/interf.json for ${compiledPath}`);
|
|
17
|
+
const failedStageLabel = formatActiveCompiledWorkflowStageStep(compiledPath, failedStage ?? "compile");
|
|
18
18
|
console.log(chalk.red(` ${failedStageLabel} failed.`));
|
|
19
19
|
}
|
|
20
20
|
function testScore(outcome) {
|
|
@@ -33,7 +33,7 @@ function bestVariationRestorePaths(compiledPath) {
|
|
|
33
33
|
".agents",
|
|
34
34
|
".cursor",
|
|
35
35
|
".interf/interf.json",
|
|
36
|
-
".interf/
|
|
36
|
+
".interf/method",
|
|
37
37
|
...zonePaths,
|
|
38
38
|
];
|
|
39
39
|
}
|
|
@@ -78,17 +78,19 @@ async function runWorkflowVariation(options) {
|
|
|
78
78
|
const resetTarget = attempt > 1
|
|
79
79
|
? `attempt ${attempt}/${options.maxAttempts}`
|
|
80
80
|
: options.variationLabel;
|
|
81
|
-
console.log(chalk.dim(` Resetting generated
|
|
81
|
+
console.log(chalk.dim(` Resetting generated Portable Context state before ${resetTarget}...`));
|
|
82
82
|
resetCompiledGeneratedState(options.compiledPath, "compile");
|
|
83
83
|
}
|
|
84
84
|
const result = await compileCompiledWithReporter(options.executor, options.compiledPath, {
|
|
85
85
|
heading: options.maxAttempts > 1
|
|
86
|
-
? `Building
|
|
87
|
-
: `Building
|
|
86
|
+
? `Building Portable Context (${options.variationLabel}, attempt ${attempt}/${options.maxAttempts})...`
|
|
87
|
+
: `Building Portable Context (${options.variationLabel})...`,
|
|
88
88
|
successMessage: options.maxAttempts > 1
|
|
89
|
-
? `Portable
|
|
90
|
-
: `Portable
|
|
89
|
+
? `Portable Context ready for ${options.variationLabel}, attempt ${attempt}.`
|
|
90
|
+
: `Portable Context ready for ${options.variationLabel}.`,
|
|
91
91
|
preserveStageShells: options.preserveStageShells,
|
|
92
|
+
runId: options.runId,
|
|
93
|
+
events: options.events,
|
|
92
94
|
});
|
|
93
95
|
if (!result.ok) {
|
|
94
96
|
printCompileFailure(options.compiledPath, result.failedStage);
|
|
@@ -123,7 +125,7 @@ async function runWorkflowVariation(options) {
|
|
|
123
125
|
bestOutcome,
|
|
124
126
|
bestSnapshotPath,
|
|
125
127
|
bestAttempt,
|
|
126
|
-
fatalError: "Could not run the saved
|
|
128
|
+
fatalError: "Could not run the saved Portable Context comparison after compile.",
|
|
127
129
|
};
|
|
128
130
|
}
|
|
129
131
|
console.log();
|
|
@@ -138,7 +140,7 @@ async function runWorkflowVariation(options) {
|
|
|
138
140
|
}
|
|
139
141
|
if (outcome.result.ok) {
|
|
140
142
|
console.log();
|
|
141
|
-
console.log(chalk.green(`
|
|
143
|
+
console.log(chalk.green(` Portable Context passed on ${options.variationLabel}, attempt ${attempt}/${options.maxAttempts}.`));
|
|
142
144
|
printStageShellReviewHint(options.compiledPath, options.preserveStageShells, "success");
|
|
143
145
|
return {
|
|
144
146
|
passed: true,
|
|
@@ -152,7 +154,7 @@ async function runWorkflowVariation(options) {
|
|
|
152
154
|
}
|
|
153
155
|
if (attempt < options.maxAttempts) {
|
|
154
156
|
console.log();
|
|
155
|
-
console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} did not pass. Retrying with the same
|
|
157
|
+
console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} did not pass. Retrying with the same Method.`));
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
160
|
return {
|
|
@@ -178,22 +180,22 @@ async function runWorkflowVariation(options) {
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
function summarizeWorkflowVariation(options) {
|
|
181
|
-
const
|
|
182
|
-
const
|
|
183
|
+
const passedChecks = options.result.bestOutcome?.result.passedCases ?? 0;
|
|
184
|
+
const totalChecks = options.result.bestOutcome?.result.totalCases ?? options.defaultTotalChecks;
|
|
183
185
|
const summary = options.result.passed
|
|
184
|
-
? `Passed ${
|
|
186
|
+
? `Passed ${passedChecks}/${totalChecks} readiness checks.`
|
|
185
187
|
: options.result.bestOutcome
|
|
186
|
-
? `Best result: ${
|
|
188
|
+
? `Best result: ${passedChecks}/${totalChecks} readiness checks passed.`
|
|
187
189
|
: options.result.failedStage
|
|
188
190
|
? `Compile failed at stage ${options.result.failedStage} before any saved comparison result.`
|
|
189
|
-
: "
|
|
191
|
+
: "Method variation did not produce a passing result.";
|
|
190
192
|
return {
|
|
191
193
|
variation: options.variation,
|
|
192
194
|
kind: options.kind,
|
|
193
195
|
attempts_run: Math.max(1, options.result.attemptsRun),
|
|
194
196
|
passed: options.result.passed,
|
|
195
|
-
passed_questions:
|
|
196
|
-
total_questions:
|
|
197
|
+
passed_questions: passedChecks,
|
|
198
|
+
total_questions: totalChecks,
|
|
197
199
|
...(options.result.failedStage ? { failed_stage: options.result.failedStage } : {}),
|
|
198
200
|
...(options.result.bestOutcome ? { test_run_path: options.result.bestOutcome.runPath } : {}),
|
|
199
201
|
...(options.result.bestOutcome?.result.sandbox_path
|
|
@@ -213,39 +215,39 @@ function printStageShellReviewHint(compiledPath, preserveStageShells, result) {
|
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
217
|
function printPostCompileNextStep(options) {
|
|
216
|
-
console.log(chalk.dim(` Portable
|
|
218
|
+
console.log(chalk.dim(` Portable Context: ${options.compiledPath}`));
|
|
217
219
|
if (options.checks === 0) {
|
|
218
|
-
console.log(chalk.dim(" Next: run `interf` to add
|
|
220
|
+
console.log(chalk.dim(" Next: run `interf` to add readiness checks, then `interf test`."));
|
|
219
221
|
return;
|
|
220
222
|
}
|
|
221
223
|
if (options.testedDuringCompile) {
|
|
222
|
-
console.log(chalk.dim(" Next: inspect the
|
|
224
|
+
console.log(chalk.dim(" Next: inspect the Portable Context agents will use, or run `interf test` if you also want a source files versus Portable Context comparison."));
|
|
223
225
|
return;
|
|
224
226
|
}
|
|
225
|
-
console.log(chalk.dim(" Next: run `interf test` to compare source files and
|
|
227
|
+
console.log(chalk.dim(" Next: run `interf test` to compare source files and Portable Context."));
|
|
226
228
|
}
|
|
227
|
-
function
|
|
229
|
+
function formatVariationReadinessSummary(summary) {
|
|
228
230
|
return `${summary.passed_questions}/${summary.total_questions}`;
|
|
229
231
|
}
|
|
230
232
|
function printWorkflowVariationSummary(summaries) {
|
|
231
233
|
if (summaries.length === 0)
|
|
232
234
|
return;
|
|
233
235
|
console.log();
|
|
234
|
-
console.log(chalk.bold("
|
|
236
|
+
console.log(chalk.bold(" Method variation summary"));
|
|
235
237
|
console.log();
|
|
236
|
-
console.log(" | Variation | Kind |
|
|
238
|
+
console.log(" | Variation | Kind | Readiness checks | Result |");
|
|
237
239
|
console.log(" | --- | --- | --- | --- |");
|
|
238
240
|
for (const summary of summaries) {
|
|
239
|
-
console.log(` | ${summary.variation} | ${summary.kind} | \`${
|
|
241
|
+
console.log(` | ${summary.variation} | ${summary.kind} | \`${formatVariationReadinessSummary(summary)}\` | ${summary.passed ? "pass" : "fail"} |`);
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
244
|
function printCompiledLocalWorkflowOwnership(compiledPath, bestVariation) {
|
|
243
245
|
if (bestVariation <= 1)
|
|
244
246
|
return;
|
|
245
247
|
console.log();
|
|
246
|
-
console.log(chalk.dim(` Best
|
|
247
|
-
console.log(chalk.dim(" The project-level
|
|
248
|
-
console.log(chalk.dim(" Recompiling this existing
|
|
248
|
+
console.log(chalk.dim(` Best Method variation now lives in: ${workflowPackagePathForCompiled(compiledPath)}`));
|
|
249
|
+
console.log(chalk.dim(" The project-level Method selection was not changed automatically."));
|
|
250
|
+
console.log(chalk.dim(" Recompiling this existing Portable Context reuses that local Method draft."));
|
|
249
251
|
}
|
|
250
252
|
export async function runConfiguredCompiledCompile(options) {
|
|
251
253
|
const preserveStageShells = options.preserveStageShells ?? "on-failure";
|
|
@@ -255,24 +257,26 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
255
257
|
const loopEnabled = maxAttempts != null;
|
|
256
258
|
const checks = options.compiledConfig?.checks ?? [];
|
|
257
259
|
if (loopEnabled && checks.length === 0) {
|
|
258
|
-
console.log(chalk.yellow(" Retry and self-improving modes need saved
|
|
260
|
+
console.log(chalk.yellow(" Retry and self-improving modes need saved readiness checks. Building once without those loops."));
|
|
259
261
|
}
|
|
260
262
|
else if (loopEnabled) {
|
|
261
263
|
if (maxAttempts > 1) {
|
|
262
264
|
console.log(chalk.dim(` Retry mode: up to ${maxAttempts} compile attempts.`));
|
|
263
|
-
console.log(chalk.dim(" Interf will rerun the same
|
|
265
|
+
console.log(chalk.dim(" Interf will rerun the same Method variation, check the Portable Context agents can use, and stop early if it passes."));
|
|
264
266
|
}
|
|
265
267
|
else {
|
|
266
|
-
console.log(chalk.dim("
|
|
268
|
+
console.log(chalk.dim(" Compilation mode: 1 attempt per Method variation."));
|
|
267
269
|
}
|
|
268
270
|
if (maxLoops != null) {
|
|
269
|
-
console.log(chalk.dim(` Self-improving loops: up to ${maxLoops}
|
|
270
|
-
console.log(chalk.dim(" Interf will review failed runs, edit the
|
|
271
|
+
console.log(chalk.dim(` Self-improving loops: up to ${maxLoops} Method edits after retries fail.`));
|
|
272
|
+
console.log(chalk.dim(" Interf will review failed runs, edit the Method, and test new Method variations."));
|
|
271
273
|
}
|
|
272
274
|
}
|
|
273
275
|
if (!loopEnabled || checks.length === 0) {
|
|
274
276
|
const result = await compileCompiledWithReporter(options.executor, options.compiledPath, {
|
|
275
277
|
preserveStageShells,
|
|
278
|
+
runId: options.runId,
|
|
279
|
+
events: options.events,
|
|
276
280
|
});
|
|
277
281
|
if (!result.ok) {
|
|
278
282
|
process.exitCode = 1;
|
|
@@ -327,7 +331,9 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
327
331
|
executionProfile: options.executionProfile,
|
|
328
332
|
preserveStageShells,
|
|
329
333
|
maxAttempts,
|
|
330
|
-
variationLabel: "baseline
|
|
334
|
+
variationLabel: "baseline Method",
|
|
335
|
+
runId: options.runId,
|
|
336
|
+
events: options.events,
|
|
331
337
|
});
|
|
332
338
|
if (baseline.fatalError) {
|
|
333
339
|
process.exitCode = 1;
|
|
@@ -339,7 +345,7 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
339
345
|
variation: 1,
|
|
340
346
|
kind: "baseline",
|
|
341
347
|
result: baseline,
|
|
342
|
-
|
|
348
|
+
defaultTotalChecks: checks.length,
|
|
343
349
|
}));
|
|
344
350
|
if (baseline.passed) {
|
|
345
351
|
printWorkflowVariationSummary(previousVariations);
|
|
@@ -353,7 +359,7 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
353
359
|
if (maxLoops != null) {
|
|
354
360
|
for (let loopIndex = 1; loopIndex <= maxLoops; loopIndex += 1) {
|
|
355
361
|
console.log();
|
|
356
|
-
console.log(chalk.dim(` Self-improving loop ${loopIndex}/${maxLoops}: reviewing failed runs and editing the
|
|
362
|
+
console.log(chalk.dim(` Self-improving loop ${loopIndex}/${maxLoops}: reviewing failed runs and editing the Method.`));
|
|
357
363
|
const improvement = await runWorkflowImprovementLoop({
|
|
358
364
|
executor: options.executor,
|
|
359
365
|
compiledPath: options.compiledPath,
|
|
@@ -365,7 +371,7 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
365
371
|
maxAttempts,
|
|
366
372
|
previousVariations,
|
|
367
373
|
});
|
|
368
|
-
console.log(chalk.dim(`
|
|
374
|
+
console.log(chalk.dim(` Method improvement shell: ${improvement.shellPath}`));
|
|
369
375
|
if (improvement.status === "executor-failed") {
|
|
370
376
|
process.exitCode = 1;
|
|
371
377
|
console.log(chalk.red(` ${improvement.summary}`));
|
|
@@ -384,8 +390,10 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
384
390
|
executionProfile: options.executionProfile,
|
|
385
391
|
preserveStageShells,
|
|
386
392
|
maxAttempts,
|
|
387
|
-
variationLabel: `
|
|
393
|
+
variationLabel: `Method variation ${loopIndex + 1}`,
|
|
388
394
|
resetBeforeFirstAttempt: true,
|
|
395
|
+
runId: options.runId,
|
|
396
|
+
events: options.events,
|
|
389
397
|
});
|
|
390
398
|
if (variation.fatalError) {
|
|
391
399
|
process.exitCode = 1;
|
|
@@ -397,7 +405,7 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
397
405
|
variation: loopIndex + 1,
|
|
398
406
|
kind: "edited",
|
|
399
407
|
result: variation,
|
|
400
|
-
|
|
408
|
+
defaultTotalChecks: checks.length,
|
|
401
409
|
}));
|
|
402
410
|
if (variation.passed) {
|
|
403
411
|
printWorkflowVariationSummary(previousVariations);
|
|
@@ -414,20 +422,20 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
414
422
|
if (bestSnapshotPath && bestVariation > 0) {
|
|
415
423
|
restoreCompiledBestState(bestSnapshotPath, options.compiledPath);
|
|
416
424
|
console.log();
|
|
417
|
-
console.log(chalk.dim(` Restored the best-performing
|
|
425
|
+
console.log(chalk.dim(` Restored the best-performing Portable Context from variation ${bestVariation}, attempt ${bestAttempt}.`));
|
|
418
426
|
}
|
|
419
427
|
process.exitCode = 1;
|
|
420
428
|
console.log();
|
|
421
429
|
printWorkflowVariationSummary(previousVariations);
|
|
422
430
|
printCompiledLocalWorkflowOwnership(options.compiledPath, bestVariation);
|
|
423
431
|
if (maxLoops != null) {
|
|
424
|
-
console.log(chalk.red(` Portable
|
|
432
|
+
console.log(chalk.red(` Portable Context did not pass after ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"} per variation and ${maxLoops} Method-improvement loop${maxLoops === 1 ? "" : "s"}.`));
|
|
425
433
|
}
|
|
426
434
|
else {
|
|
427
|
-
console.log(chalk.red(` Portable
|
|
435
|
+
console.log(chalk.red(` Portable Context did not pass within ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}.`));
|
|
428
436
|
}
|
|
429
437
|
if (bestOutcome) {
|
|
430
|
-
console.log(chalk.dim(` Best attempt
|
|
438
|
+
console.log(chalk.dim(` Best attempt readiness-check pass rate: ${readinessPassRate(bestOutcome)}%.`));
|
|
431
439
|
}
|
|
432
440
|
printStageShellReviewHint(options.compiledPath, preserveStageShells, "failure");
|
|
433
441
|
return false;
|
|
@@ -4,20 +4,25 @@ import { detectInterf, readInterfConfig, resolveSourceControlPath, } from "../..
|
|
|
4
4
|
import { loadCompiledDatasetConfig, sourceDatasetConfigFromInterfConfig, resolveDatasetCompileMaxAttempts, resolveDatasetCompileMaxLoops, } from "../../packages/project-model/source-config.js";
|
|
5
5
|
import { addExecutionProfileOptions, executionProfileFromArgv, } from "../../packages/agents/lib/execution-profile.js";
|
|
6
6
|
import { chooseCompiledConfigToBuild, ensureCompiledFromConfig, } from "./compiled-flow.js";
|
|
7
|
-
import {
|
|
7
|
+
import { resolveConfiguredPreparationSelection } from "./preparation-selection.js";
|
|
8
8
|
import { promptCompileLoopSelection, } from "./source-config-wizard.js";
|
|
9
9
|
import { resolveOrConfigureLocalExecutor } from "./executor-flow.js";
|
|
10
10
|
import { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
11
|
+
import { submitCompileRunToLocalService, waitForLocalCompileRun, } from "../../packages/local-service/index.js";
|
|
12
|
+
import { resolveCommandControlPath } from "./control-path.js";
|
|
11
13
|
export { runConfiguredCompiledCompile } from "./compile-controller.js";
|
|
12
14
|
export const compileCommand = {
|
|
13
15
|
command: "compile",
|
|
14
|
-
describe: "
|
|
15
|
-
builder: (yargs) => addExecutionProfileOptions(yargs).option("
|
|
16
|
+
describe: "Prepare files and write Portable Context agents can use",
|
|
17
|
+
builder: (yargs) => addExecutionProfileOptions(yargs).option("preparation", {
|
|
18
|
+
type: "string",
|
|
19
|
+
describe: "Preparation id to compile when this Source Folder has more than one Preparation",
|
|
20
|
+
}).option("max-attempts", {
|
|
16
21
|
type: "number",
|
|
17
|
-
describe: "Retry
|
|
22
|
+
describe: "Retry the prepare run and run saved readiness checks with the same Method until the Preparation is ready or reaches this total attempt limit",
|
|
18
23
|
}).option("max-loops", {
|
|
19
24
|
type: "number",
|
|
20
|
-
describe: "After retries fail, let Interf edit the
|
|
25
|
+
describe: "After retries fail, let Interf edit the Method and run saved readiness checks on new Method variations for this Preparation up to this loop limit",
|
|
21
26
|
}).option("keep-stage-shells", {
|
|
22
27
|
type: "boolean",
|
|
23
28
|
default: false,
|
|
@@ -42,8 +47,9 @@ function readHintedSourcePath(argv) {
|
|
|
42
47
|
: null;
|
|
43
48
|
}
|
|
44
49
|
function readRequestedDatasetName(argv) {
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
const raw = argv.preparation;
|
|
51
|
+
return typeof raw === "string" && raw.trim().length > 0
|
|
52
|
+
? raw.trim()
|
|
47
53
|
: null;
|
|
48
54
|
}
|
|
49
55
|
function shouldSkipCompileConfirm(argv) {
|
|
@@ -69,7 +75,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
69
75
|
let compiledPath = null;
|
|
70
76
|
const hintedSourcePath = readHintedSourcePath(argv);
|
|
71
77
|
const detected = hintedSourcePath ? null : helpers.detectInterf(process.cwd());
|
|
72
|
-
let sourcePath = hintedSourcePath ??
|
|
78
|
+
let sourcePath = hintedSourcePath ?? resolveCommandControlPath();
|
|
73
79
|
let compiledConfig = null;
|
|
74
80
|
const requestedDatasetName = readRequestedDatasetName(argv);
|
|
75
81
|
const hintedDatasetConfig = (argv.datasetConfig ?? null);
|
|
@@ -82,7 +88,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
82
88
|
?? sourceDatasetConfigFromInterfConfig(detected.config);
|
|
83
89
|
if (!skipConfirm && process.stdin.isTTY && process.stdout.isTTY) {
|
|
84
90
|
const confirmed = await helpers.confirm({
|
|
85
|
-
message: `
|
|
91
|
+
message: `Prepare files for Preparation "${detected.config.name}" now?`,
|
|
86
92
|
initialValue: true,
|
|
87
93
|
});
|
|
88
94
|
if (p.isCancel(confirmed) || !confirmed)
|
|
@@ -91,32 +97,32 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
91
97
|
}
|
|
92
98
|
else {
|
|
93
99
|
const selectedCompiled = requestedDatasetName || hintedDatasetConfig
|
|
94
|
-
?
|
|
100
|
+
? resolveConfiguredPreparationSelection({
|
|
95
101
|
sourcePath,
|
|
96
|
-
requestedDatasetName,
|
|
97
|
-
hintedDatasetConfig,
|
|
102
|
+
requestedPreparationName: requestedDatasetName,
|
|
103
|
+
hintedPreparationConfig: hintedDatasetConfig,
|
|
98
104
|
})
|
|
99
105
|
: await helpers.chooseCompiledConfigToBuild({
|
|
100
106
|
sourcePath,
|
|
101
|
-
selectMessage: "Which
|
|
107
|
+
selectMessage: "Which saved Preparation do you want to compile?",
|
|
102
108
|
});
|
|
103
109
|
if (selectedCompiled === undefined)
|
|
104
110
|
return null;
|
|
105
111
|
if (!selectedCompiled) {
|
|
106
112
|
process.exitCode = 1;
|
|
107
113
|
if (requestedDatasetName) {
|
|
108
|
-
console.log(chalk.red(`
|
|
109
|
-
console.log(chalk.dim(" Run `interf list` to see the saved
|
|
114
|
+
console.log(chalk.red(` Preparation "${requestedDatasetName}" is not saved in this Source Folder.`));
|
|
115
|
+
console.log(chalk.dim(" Run `interf list` to see the saved Preparations."));
|
|
110
116
|
}
|
|
111
117
|
else {
|
|
112
|
-
console.log(chalk.red(" No saved
|
|
118
|
+
console.log(chalk.red(" No saved Preparations are configured for this Source Folder yet."));
|
|
113
119
|
console.log(chalk.dim(" Start with `interf` or `interf init` to set up this folder."));
|
|
114
120
|
}
|
|
115
121
|
return null;
|
|
116
122
|
}
|
|
117
123
|
if (!skipConfirm && process.stdin.isTTY && process.stdout.isTTY) {
|
|
118
124
|
const confirmed = await helpers.confirm({
|
|
119
|
-
message: `
|
|
125
|
+
message: `Prepare files for Preparation "${selectedCompiled.name}" now?`,
|
|
120
126
|
initialValue: true,
|
|
121
127
|
});
|
|
122
128
|
if (p.isCancel(confirmed) || !confirmed)
|
|
@@ -125,7 +131,7 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
125
131
|
compiledConfig = selectedCompiled;
|
|
126
132
|
compiledPath = helpers.ensureCompiledFromConfig(sourcePath, selectedCompiled);
|
|
127
133
|
if (!skipDatasetBanner) {
|
|
128
|
-
console.log(chalk.dim(`
|
|
134
|
+
console.log(chalk.dim(` Preparation: ${selectedCompiled.name}`));
|
|
129
135
|
}
|
|
130
136
|
}
|
|
131
137
|
let maxAttemptsOverride = null;
|
|
@@ -155,6 +161,56 @@ export async function runCompileCommand(argv = {}, deps = {}) {
|
|
|
155
161
|
maxAttemptsOverride,
|
|
156
162
|
maxLoopsOverride,
|
|
157
163
|
});
|
|
164
|
+
if (argv.skipService !== true && compiledConfig) {
|
|
165
|
+
const submitted = await submitCompileRunToLocalService({
|
|
166
|
+
projectPath: sourcePath,
|
|
167
|
+
request: {
|
|
168
|
+
preparation: compiledConfig.name,
|
|
169
|
+
...(compiledConfig.method ? { method: compiledConfig.method } : {}),
|
|
170
|
+
...(maxAttemptsOverride != null ? { max_attempts: maxAttemptsOverride } : {}),
|
|
171
|
+
...(maxLoopsOverride != null ? { max_loops: maxLoopsOverride } : {}),
|
|
172
|
+
preserve_stage_shells: readStageShellRetentionMode(argv),
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
if (submitted) {
|
|
176
|
+
console.log(chalk.dim(` Visible in Interf: ${submitted.serviceUrl}/`));
|
|
177
|
+
let lastStatus = "";
|
|
178
|
+
let lastStage = "";
|
|
179
|
+
const completed = await waitForLocalCompileRun({
|
|
180
|
+
serviceUrl: submitted.serviceUrl,
|
|
181
|
+
runId: submitted.resource.run.run_id,
|
|
182
|
+
onUpdate(resource) {
|
|
183
|
+
const activeStage = resource.run.stages.find((stage) => stage.status === "running")
|
|
184
|
+
?? [...resource.run.stages].reverse().find((stage) => stage.status === "succeeded" || stage.status === "failed")
|
|
185
|
+
?? null;
|
|
186
|
+
const statusKey = `${resource.run.status}:${activeStage?.stage_id ?? ""}:${activeStage?.status ?? ""}`;
|
|
187
|
+
if (statusKey === `${lastStatus}:${lastStage}`)
|
|
188
|
+
return;
|
|
189
|
+
lastStatus = resource.run.status;
|
|
190
|
+
lastStage = `${activeStage?.stage_id ?? ""}:${activeStage?.status ?? ""}`;
|
|
191
|
+
if (activeStage) {
|
|
192
|
+
console.log(chalk.dim(` ${activeStage.stage_label ?? activeStage.stage_id}: ${activeStage.status}`));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
console.log(chalk.dim(` Prepare run: ${resource.run.status}`));
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
if (completed.run.status !== "succeeded") {
|
|
200
|
+
process.exitCode = 1;
|
|
201
|
+
const failure = completed.run.stages.find((stage) => stage.status === "failed");
|
|
202
|
+
console.log(chalk.red(` Prepare run ${completed.run.status}.`));
|
|
203
|
+
if (failure?.failure)
|
|
204
|
+
console.log(chalk.red(` ${failure.failure}`));
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
console.log(chalk.green(" Portable Context ready."));
|
|
208
|
+
return {
|
|
209
|
+
compiledPath: completed.run.portable_context_path,
|
|
210
|
+
testedDuringCompile,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
158
214
|
const executionProfile = executionProfileFromArgv(argv);
|
|
159
215
|
const { executor, error } = await helpers.resolveOrConfigureLocalExecutor({
|
|
160
216
|
executionProfile,
|
|
@@ -231,10 +287,10 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
|
|
|
231
287
|
initialMaxAttempts: savedCompiledConfig.max_attempts,
|
|
232
288
|
initialMaxLoops: savedCompiledConfig.max_loops,
|
|
233
289
|
intro: [
|
|
234
|
-
`
|
|
235
|
-
"This selection applies to this
|
|
290
|
+
`Method: ${savedCompiledConfig.method ?? savedCompiledConfig.workflow ?? currentConfig?.method ?? currentConfig?.workflow ?? "interf-default"}`,
|
|
291
|
+
"This selection applies to this prepare run only. It does not change the saved Preparation.",
|
|
236
292
|
],
|
|
237
|
-
message: "How should this
|
|
293
|
+
message: "How should this prepare run work?",
|
|
238
294
|
});
|
|
239
295
|
if (overrideSelection === null)
|
|
240
296
|
return null;
|
|
@@ -249,17 +305,17 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
|
|
|
249
305
|
};
|
|
250
306
|
}
|
|
251
307
|
const savedMode = await p.select({
|
|
252
|
-
message: "Which
|
|
308
|
+
message: "Which prepare mode should this run use?",
|
|
253
309
|
options: [
|
|
254
310
|
{
|
|
255
311
|
value: "saved",
|
|
256
|
-
label: "Use saved
|
|
312
|
+
label: "Use saved prepare mode (Recommended)",
|
|
257
313
|
hint: `${savedCompiledConfig.max_loops ? "Self-improving" : savedCompiledConfig.max_attempts && savedCompiledConfig.max_attempts > 1 ? "Retry" : "Single attempt"} · ${formatCompileModeHint(savedCompiledConfig)}`,
|
|
258
314
|
},
|
|
259
315
|
{
|
|
260
316
|
value: "override",
|
|
261
317
|
label: "Change it for this run only",
|
|
262
|
-
hint: "Keep the saved
|
|
318
|
+
hint: "Keep the saved Preparation unchanged",
|
|
263
319
|
},
|
|
264
320
|
],
|
|
265
321
|
});
|
|
@@ -277,10 +333,10 @@ export async function resolveInteractiveCompileLoopOverrides(options) {
|
|
|
277
333
|
initialMaxAttempts: savedCompiledConfig.max_attempts,
|
|
278
334
|
initialMaxLoops: savedCompiledConfig.max_loops,
|
|
279
335
|
intro: [
|
|
280
|
-
`
|
|
281
|
-
"This applies to this
|
|
336
|
+
`Method: ${savedCompiledConfig.method ?? savedCompiledConfig.workflow ?? currentConfig?.method ?? currentConfig?.workflow ?? "interf-default"}`,
|
|
337
|
+
"This applies to this prepare run only. It does not change the saved Preparation.",
|
|
282
338
|
],
|
|
283
|
-
message: "Override the
|
|
339
|
+
message: "Override the prepare mode for this run",
|
|
284
340
|
});
|
|
285
341
|
if (selection === null)
|
|
286
342
|
return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SourceDatasetConfig } from "../../packages/project-model/lib/schema.js";
|
|
2
2
|
import { type StageShellRetentionMode, type CompiledCompileResult } from "../../packages/compiler/workflows.js";
|
|
3
3
|
import type { WorkflowExecutor } from "../../packages/agents/lib/executors.js";
|
|
4
|
+
import type { RunEventSink } from "../../packages/execution/events.js";
|
|
4
5
|
export interface SavedDatasetEntry {
|
|
5
6
|
config: SourceDatasetConfig;
|
|
6
7
|
path: string | null;
|
|
@@ -19,4 +20,6 @@ export declare function compileCompiledWithReporter(executor: WorkflowExecutor,
|
|
|
19
20
|
heading?: string;
|
|
20
21
|
successMessage?: string;
|
|
21
22
|
preserveStageShells?: StageShellRetentionMode;
|
|
23
|
+
runId?: string;
|
|
24
|
+
events?: RunEventSink;
|
|
22
25
|
}): Promise<CompiledCompileResult>;
|