@interf/compiler 0.3.4 → 0.4.0
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 +131 -149
- package/builtin-workflows/interf/README.md +19 -0
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +28 -0
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +18 -0
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +18 -0
- package/builtin-workflows/interf/improve/SKILL.md +18 -0
- package/builtin-workflows/interf/use/query/SKILL.md +28 -0
- package/builtin-workflows/interf/workflow.json +120 -0
- package/builtin-workflows/interf/workspace.schema.json +75 -0
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +0 -1
- package/dist/commands/compile-controller.d.ts +14 -0
- package/dist/commands/compile-controller.js +409 -0
- package/dist/commands/compile.d.ts +8 -9
- package/dist/commands/compile.js +151 -153
- package/dist/commands/create-workflow-wizard.d.ts +4 -2
- package/dist/commands/create-workflow-wizard.js +33 -31
- package/dist/commands/create.d.ts +0 -1
- package/dist/commands/create.js +15 -11
- package/dist/commands/default.d.ts +0 -1
- package/dist/commands/default.js +0 -1
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/doctor.js +1 -16
- package/dist/commands/executor-flow.d.ts +0 -1
- package/dist/commands/executor-flow.js +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +71 -14
- package/dist/commands/list.d.ts +0 -1
- package/dist/commands/list.js +0 -1
- package/dist/commands/reset.d.ts +0 -1
- package/dist/commands/reset.js +0 -1
- package/dist/commands/source-config-wizard.d.ts +28 -7
- package/dist/commands/source-config-wizard.js +159 -63
- package/dist/commands/status.d.ts +0 -1
- package/dist/commands/status.js +0 -1
- package/dist/commands/test-flow.d.ts +20 -10
- package/dist/commands/test-flow.js +89 -23
- package/dist/commands/test.d.ts +0 -1
- package/dist/commands/test.js +36 -72
- package/dist/commands/verify.d.ts +0 -1
- package/dist/commands/verify.js +0 -1
- package/dist/commands/workspace-flow.d.ts +3 -3
- package/dist/commands/workspace-flow.js +30 -12
- package/dist/index.d.ts +5 -6
- package/dist/index.js +3 -4
- 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 +47 -12
- 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 +1 -2
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +30 -3
- package/dist/lib/agent-shells.js +517 -54
- 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 -9
- package/dist/lib/agents.js +0 -9
- package/dist/lib/chart-guidance.d.ts +1 -0
- package/dist/lib/chart-guidance.js +8 -0
- package/dist/lib/config.d.ts +0 -3
- package/dist/lib/config.js +0 -5
- 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 +6 -2
- package/dist/lib/interf-detect.d.ts +2 -2
- package/dist/lib/interf-detect.js +25 -8
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +54 -21
- package/dist/lib/interf-workflow-package.d.ts +18 -1
- package/dist/lib/interf-workflow-package.js +164 -23
- package/dist/lib/interf.d.ts +1 -2
- package/dist/lib/interf.js +1 -2
- package/dist/lib/local-workflows.d.ts +10 -5
- package/dist/lib/local-workflows.js +208 -97
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/obsidian.d.ts +0 -1
- package/dist/lib/obsidian.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/registry.d.ts +0 -1
- package/dist/lib/registry.js +0 -1
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +1 -2
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +14 -8
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +5 -10
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +8 -23
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +7 -3
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +4 -5
- 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 +356 -51
- package/dist/lib/schema.js +189 -54
- package/dist/lib/source-config.d.ts +17 -8
- package/dist/lib/source-config.js +125 -11
- 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 +2 -3
- package/dist/lib/state-io.d.ts +1 -1
- package/dist/lib/state-io.js +9 -10
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +5 -11
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +7 -8
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/summarize-plan.d.ts +0 -1
- package/dist/lib/summarize-plan.js +3 -3
- package/dist/lib/test-execution.d.ts +14 -0
- package/dist/lib/{benchmark-execution.js → test-execution.js} +122 -120
- package/dist/lib/test-matrices.d.ts +90 -0
- package/dist/lib/test-matrices.js +96 -0
- package/dist/lib/test-paths.d.ts +12 -0
- package/dist/lib/test-paths.js +44 -0
- package/dist/lib/test-profile-presets.d.ts +57 -0
- package/dist/lib/test-profile-presets.js +50 -0
- package/dist/lib/test-sandbox.d.ts +11 -0
- package/dist/lib/{benchmark-sandbox.js → test-sandbox.js} +18 -13
- package/dist/lib/test-specs.d.ts +7 -0
- package/dist/lib/test-specs.js +114 -0
- package/dist/lib/test-targets.d.ts +5 -0
- package/dist/lib/test-targets.js +38 -0
- package/dist/lib/test-types.d.ts +17 -0
- package/dist/lib/test-types.js +1 -0
- package/dist/lib/test.d.ts +4 -0
- package/dist/lib/test.js +3 -0
- package/dist/lib/user-config.d.ts +0 -1
- package/dist/lib/user-config.js +0 -1
- package/dist/lib/util.d.ts +0 -2
- package/dist/lib/util.js +0 -2
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate-workspace.d.ts +0 -1
- package/dist/lib/validate-workspace.js +34 -25
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +55 -9
- package/dist/lib/workflow-abi.d.ts +138 -0
- package/dist/lib/workflow-abi.js +181 -0
- package/dist/lib/workflow-definitions.d.ts +26 -5
- package/dist/lib/workflow-definitions.js +105 -168
- package/dist/lib/workflow-helpers.d.ts +1 -2
- package/dist/lib/workflow-helpers.js +32 -21
- package/dist/lib/workflow-improvement.d.ts +22 -0
- package/dist/lib/workflow-improvement.js +396 -0
- package/dist/lib/workflow-review-paths.d.ts +10 -0
- package/dist/lib/workflow-review-paths.js +27 -0
- package/dist/lib/workflow-stage-runner.d.ts +1 -1
- package/dist/lib/workflow-stage-runner.js +4 -1
- package/dist/lib/workflows.d.ts +1 -2
- package/dist/lib/workflows.js +1 -2
- package/dist/lib/workspace-compile.d.ts +0 -1
- package/dist/lib/workspace-compile.js +146 -109
- package/dist/lib/workspace-home.d.ts +5 -0
- package/dist/lib/workspace-home.js +32 -0
- package/dist/lib/workspace-layout.d.ts +2 -0
- package/dist/lib/workspace-layout.js +60 -0
- package/dist/lib/workspace-paths.d.ts +41 -0
- package/dist/lib/workspace-paths.js +107 -0
- package/dist/lib/workspace-raw.d.ts +20 -2
- package/dist/lib/workspace-raw.js +6 -8
- package/dist/lib/workspace-reset.d.ts +0 -1
- package/dist/lib/workspace-reset.js +27 -5
- package/dist/lib/workspace-schema.d.ts +1 -10
- package/dist/lib/workspace-schema.js +16 -74
- package/package.json +16 -15
- package/dist/bin.d.ts.map +0 -1
- package/dist/bin.js.map +0 -1
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/create-workflow-wizard.d.ts.map +0 -1
- package/dist/commands/create-workflow-wizard.js.map +0 -1
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/default.d.ts.map +0 -1
- package/dist/commands/default.js.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/executor-flow.d.ts.map +0 -1
- package/dist/commands/executor-flow.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list.d.ts.map +0 -1
- package/dist/commands/list.js.map +0 -1
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js.map +0 -1
- package/dist/commands/source-config-wizard.d.ts.map +0 -1
- package/dist/commands/source-config-wizard.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/test-flow.d.ts.map +0 -1
- package/dist/commands/test-flow.js.map +0 -1
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/verify.d.ts.map +0 -1
- package/dist/commands/verify.js.map +0 -1
- package/dist/commands/workspace-flow.d.ts.map +0 -1
- package/dist/commands/workspace-flow.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/agent-args.d.ts.map +0 -1
- package/dist/lib/agent-args.js.map +0 -1
- package/dist/lib/agent-constants.d.ts.map +0 -1
- package/dist/lib/agent-constants.js.map +0 -1
- package/dist/lib/agent-detection.d.ts.map +0 -1
- package/dist/lib/agent-detection.js.map +0 -1
- package/dist/lib/agent-execution.d.ts.map +0 -1
- package/dist/lib/agent-execution.js.map +0 -1
- package/dist/lib/agent-logs.d.ts.map +0 -1
- package/dist/lib/agent-logs.js.map +0 -1
- package/dist/lib/agent-preflight.d.ts.map +0 -1
- package/dist/lib/agent-preflight.js.map +0 -1
- package/dist/lib/agent-render.d.ts.map +0 -1
- package/dist/lib/agent-render.js.map +0 -1
- package/dist/lib/agent-shells.d.ts.map +0 -1
- package/dist/lib/agent-shells.js.map +0 -1
- package/dist/lib/agent-skills.d.ts +0 -21
- package/dist/lib/agent-skills.d.ts.map +0 -1
- package/dist/lib/agent-skills.js +0 -215
- package/dist/lib/agent-skills.js.map +0 -1
- package/dist/lib/agent-status.d.ts.map +0 -1
- package/dist/lib/agent-status.js.map +0 -1
- package/dist/lib/agent-types.d.ts.map +0 -1
- package/dist/lib/agent-types.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/benchmark-execution.d.ts +0 -13
- package/dist/lib/benchmark-execution.d.ts.map +0 -1
- package/dist/lib/benchmark-execution.js.map +0 -1
- package/dist/lib/benchmark-paths.d.ts +0 -13
- package/dist/lib/benchmark-paths.d.ts.map +0 -1
- package/dist/lib/benchmark-paths.js +0 -44
- package/dist/lib/benchmark-paths.js.map +0 -1
- package/dist/lib/benchmark-sandbox.d.ts +0 -12
- package/dist/lib/benchmark-sandbox.d.ts.map +0 -1
- package/dist/lib/benchmark-sandbox.js.map +0 -1
- package/dist/lib/benchmark-specs.d.ts +0 -8
- package/dist/lib/benchmark-specs.d.ts.map +0 -1
- package/dist/lib/benchmark-specs.js +0 -115
- package/dist/lib/benchmark-specs.js.map +0 -1
- package/dist/lib/benchmark-targets.d.ts +0 -5
- package/dist/lib/benchmark-targets.d.ts.map +0 -1
- package/dist/lib/benchmark-targets.js +0 -38
- package/dist/lib/benchmark-targets.js.map +0 -1
- package/dist/lib/benchmark-types.d.ts +0 -18
- package/dist/lib/benchmark-types.d.ts.map +0 -1
- package/dist/lib/benchmark-types.js +0 -2
- package/dist/lib/benchmark-types.js.map +0 -1
- package/dist/lib/benchmark.d.ts +0 -5
- package/dist/lib/benchmark.d.ts.map +0 -1
- package/dist/lib/benchmark.js +0 -4
- package/dist/lib/benchmark.js.map +0 -1
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/discovery.d.ts.map +0 -1
- package/dist/lib/discovery.js.map +0 -1
- package/dist/lib/eval-packs.d.ts +0 -158
- package/dist/lib/eval-packs.d.ts.map +0 -1
- package/dist/lib/eval-packs.js +0 -149
- package/dist/lib/eval-packs.js.map +0 -1
- package/dist/lib/execution-profile.d.ts.map +0 -1
- package/dist/lib/execution-profile.js.map +0 -1
- package/dist/lib/executors.d.ts.map +0 -1
- package/dist/lib/executors.js.map +0 -1
- package/dist/lib/filesystem.d.ts.map +0 -1
- package/dist/lib/filesystem.js.map +0 -1
- package/dist/lib/interf-bootstrap.d.ts.map +0 -1
- package/dist/lib/interf-bootstrap.js.map +0 -1
- package/dist/lib/interf-detect.d.ts.map +0 -1
- package/dist/lib/interf-detect.js.map +0 -1
- package/dist/lib/interf-scaffold.d.ts.map +0 -1
- package/dist/lib/interf-scaffold.js.map +0 -1
- package/dist/lib/interf-workflow-package.d.ts.map +0 -1
- package/dist/lib/interf-workflow-package.js.map +0 -1
- package/dist/lib/interf.d.ts.map +0 -1
- package/dist/lib/interf.js.map +0 -1
- package/dist/lib/local-workflows.d.ts.map +0 -1
- package/dist/lib/local-workflows.js.map +0 -1
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/logger.js.map +0 -1
- package/dist/lib/obsidian.d.ts.map +0 -1
- package/dist/lib/obsidian.js.map +0 -1
- package/dist/lib/parse.d.ts.map +0 -1
- package/dist/lib/parse.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/runtime-acceptance.d.ts.map +0 -1
- package/dist/lib/runtime-acceptance.js.map +0 -1
- package/dist/lib/runtime-contracts.d.ts.map +0 -1
- package/dist/lib/runtime-contracts.js.map +0 -1
- package/dist/lib/runtime-paths.d.ts.map +0 -1
- package/dist/lib/runtime-paths.js.map +0 -1
- package/dist/lib/runtime-prompt.d.ts.map +0 -1
- package/dist/lib/runtime-prompt.js.map +0 -1
- package/dist/lib/runtime-reconcile.d.ts.map +0 -1
- package/dist/lib/runtime-reconcile.js.map +0 -1
- package/dist/lib/runtime-runs.d.ts.map +0 -1
- package/dist/lib/runtime-runs.js.map +0 -1
- package/dist/lib/runtime-types.d.ts.map +0 -1
- package/dist/lib/runtime-types.js.map +0 -1
- package/dist/lib/runtime.d.ts.map +0 -1
- package/dist/lib/runtime.js.map +0 -1
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/schema.js.map +0 -1
- package/dist/lib/source-config.d.ts.map +0 -1
- package/dist/lib/source-config.js.map +0 -1
- package/dist/lib/state-artifacts.d.ts.map +0 -1
- package/dist/lib/state-artifacts.js.map +0 -1
- package/dist/lib/state-health.d.ts.map +0 -1
- package/dist/lib/state-health.js.map +0 -1
- package/dist/lib/state-io.d.ts.map +0 -1
- package/dist/lib/state-io.js.map +0 -1
- package/dist/lib/state-paths.d.ts.map +0 -1
- package/dist/lib/state-paths.js.map +0 -1
- package/dist/lib/state-view.d.ts.map +0 -1
- package/dist/lib/state-view.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/summarize-plan.d.ts.map +0 -1
- package/dist/lib/summarize-plan.js.map +0 -1
- package/dist/lib/user-config.d.ts.map +0 -1
- package/dist/lib/user-config.js.map +0 -1
- package/dist/lib/util.d.ts.map +0 -1
- package/dist/lib/util.js.map +0 -1
- package/dist/lib/validate-helpers.d.ts.map +0 -1
- package/dist/lib/validate-helpers.js.map +0 -1
- package/dist/lib/validate-workspace.d.ts.map +0 -1
- package/dist/lib/validate-workspace.js.map +0 -1
- package/dist/lib/validate.d.ts.map +0 -1
- package/dist/lib/validate.js.map +0 -1
- package/dist/lib/workflow-definitions.d.ts.map +0 -1
- package/dist/lib/workflow-definitions.js.map +0 -1
- package/dist/lib/workflow-helpers.d.ts.map +0 -1
- package/dist/lib/workflow-helpers.js.map +0 -1
- package/dist/lib/workflow-stage-runner.d.ts.map +0 -1
- package/dist/lib/workflow-stage-runner.js.map +0 -1
- package/dist/lib/workflow-starter-docs.d.ts +0 -7
- package/dist/lib/workflow-starter-docs.d.ts.map +0 -1
- package/dist/lib/workflow-starter-docs.js +0 -3
- package/dist/lib/workflow-starter-docs.js.map +0 -1
- package/dist/lib/workflows.d.ts.map +0 -1
- package/dist/lib/workflows.js.map +0 -1
- package/dist/lib/workspace-compile.d.ts.map +0 -1
- package/dist/lib/workspace-compile.js.map +0 -1
- package/dist/lib/workspace-docs.d.ts +0 -3
- package/dist/lib/workspace-docs.d.ts.map +0 -1
- package/dist/lib/workspace-docs.js +0 -82
- package/dist/lib/workspace-docs.js.map +0 -1
- package/dist/lib/workspace-raw.d.ts.map +0 -1
- package/dist/lib/workspace-raw.js.map +0 -1
- package/dist/lib/workspace-reset.d.ts.map +0 -1
- package/dist/lib/workspace-reset.js.map +0 -1
- package/dist/lib/workspace-schema.d.ts.map +0 -1
- package/dist/lib/workspace-schema.js.map +0 -1
- package/skills/benchmark/SKILL.md +0 -122
- package/skills/workflow/create/SKILL.md +0 -141
- package/skills/workspace/shape/SKILL.md +0 -15
- package/skills/workspace/structure/SKILL.md +0 -15
- package/skills/workspace/summarize/SKILL.md +0 -15
- package/templates/workspace/README.md +0 -24
- package/templates/workspace/interfignore +0 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "workspace-schema",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"target_type": "workspace",
|
|
5
|
+
"label": "Interf Compiler (Recommended) workspace schema",
|
|
6
|
+
"zones": [
|
|
7
|
+
{
|
|
8
|
+
"id": "raw",
|
|
9
|
+
"path": "raw",
|
|
10
|
+
"kind": "directory",
|
|
11
|
+
"required": true,
|
|
12
|
+
"owned_by": [],
|
|
13
|
+
"description": "Workspace-local raw snapshot copied from the dataset for direct evidence and verification."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"id": "summaries",
|
|
17
|
+
"path": "summaries",
|
|
18
|
+
"kind": "directory",
|
|
19
|
+
"required": true,
|
|
20
|
+
"owned_by": [
|
|
21
|
+
"summarize"
|
|
22
|
+
],
|
|
23
|
+
"description": "Per-file evidence notes produced by file-evidence stages."
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "knowledge-entities",
|
|
27
|
+
"path": "knowledge/entities",
|
|
28
|
+
"kind": "directory",
|
|
29
|
+
"required": true,
|
|
30
|
+
"owned_by": [
|
|
31
|
+
"structure"
|
|
32
|
+
],
|
|
33
|
+
"description": "Canonical entity notes produced by knowledge-structure stages."
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "knowledge-claims",
|
|
37
|
+
"path": "knowledge/claims",
|
|
38
|
+
"kind": "directory",
|
|
39
|
+
"required": true,
|
|
40
|
+
"owned_by": [
|
|
41
|
+
"structure"
|
|
42
|
+
],
|
|
43
|
+
"description": "Claim notes produced by knowledge-structure stages."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"id": "knowledge-indexes",
|
|
47
|
+
"path": "knowledge/indexes",
|
|
48
|
+
"kind": "directory",
|
|
49
|
+
"required": true,
|
|
50
|
+
"owned_by": [
|
|
51
|
+
"structure",
|
|
52
|
+
"shape"
|
|
53
|
+
],
|
|
54
|
+
"description": "Retrieval indexes and navigation notes produced by structure and shape stages."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "home",
|
|
58
|
+
"path": "home.md",
|
|
59
|
+
"kind": "file",
|
|
60
|
+
"required": true,
|
|
61
|
+
"owned_by": [
|
|
62
|
+
"shape"
|
|
63
|
+
],
|
|
64
|
+
"description": "Primary entrypoint note for agents using the compiled workspace."
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "runtime",
|
|
68
|
+
"path": ".interf/runtime",
|
|
69
|
+
"kind": "runtime",
|
|
70
|
+
"required": true,
|
|
71
|
+
"owned_by": [],
|
|
72
|
+
"description": "CLI-owned runtime state, health, stage contracts, and proof artifacts."
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
package/dist/bin.d.ts
CHANGED
package/dist/bin.js
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WorkflowExecutionProfile, WorkflowExecutor } from "../lib/executors.js";
|
|
2
|
+
import type { SourceWorkspaceConfig } from "../lib/schema.js";
|
|
3
|
+
import type { StageShellRetentionMode } from "../lib/workflows.js";
|
|
4
|
+
export declare function runConfiguredWorkspaceCompile(options: {
|
|
5
|
+
executor: WorkflowExecutor;
|
|
6
|
+
testExecutor?: WorkflowExecutor | null;
|
|
7
|
+
workspacePath: string;
|
|
8
|
+
sourcePath: string;
|
|
9
|
+
workspaceConfig: SourceWorkspaceConfig | null;
|
|
10
|
+
executionProfile?: WorkflowExecutionProfile;
|
|
11
|
+
maxAttemptsOverride: number | null;
|
|
12
|
+
maxLoopsOverride: number | null;
|
|
13
|
+
preserveStageShells?: StageShellRetentionMode;
|
|
14
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { readInterfConfig } from "../lib/interf.js";
|
|
6
|
+
import { resetWorkspaceGeneratedState } from "../lib/workspace-reset.js";
|
|
7
|
+
import { formatActiveWorkspaceWorkflowStageStep, resolveWorkspaceWorkflowFromConfig, } from "../lib/workflow-definitions.js";
|
|
8
|
+
import { resolveWorkspaceCompileMaxAttempts, resolveWorkspaceCompileMaxLoops, } from "../lib/source-config.js";
|
|
9
|
+
import { runWorkflowImprovementLoop } from "../lib/workflow-improvement.js";
|
|
10
|
+
import { stageExecutionShellsRoot, workflowPackagePathForWorkspace, } from "../lib/workspace-paths.js";
|
|
11
|
+
import { compileWorkspaceWithReporter } from "./workspace-flow.js";
|
|
12
|
+
import { printSavedTestOutcome, questionPassRate, runSavedWorkspaceTest, } from "./test-flow.js";
|
|
13
|
+
function printCompileFailure(workspacePath, failedStage) {
|
|
14
|
+
const workflowId = resolveWorkspaceWorkflowFromConfig(readInterfConfig(workspacePath));
|
|
15
|
+
const failedStageLabel = formatActiveWorkspaceWorkflowStageStep(workspacePath, workflowId, failedStage ?? "compile");
|
|
16
|
+
console.log(chalk.red(` ${failedStageLabel} failed.`));
|
|
17
|
+
}
|
|
18
|
+
function testScore(outcome) {
|
|
19
|
+
return (outcome.result.passedCases * 1000) + outcome.result.passedChecks;
|
|
20
|
+
}
|
|
21
|
+
const BEST_VARIATION_RESTORE_PATHS = [
|
|
22
|
+
"AGENTS.md",
|
|
23
|
+
"CLAUDE.md",
|
|
24
|
+
"home.md",
|
|
25
|
+
"summaries",
|
|
26
|
+
"knowledge",
|
|
27
|
+
".claude",
|
|
28
|
+
".codex",
|
|
29
|
+
".agents",
|
|
30
|
+
".cursor",
|
|
31
|
+
".obsidian",
|
|
32
|
+
".interf/interf.json",
|
|
33
|
+
".interf/workflow",
|
|
34
|
+
".interf/runtime/state.json",
|
|
35
|
+
".interf/runtime/health.json",
|
|
36
|
+
".interf/runtime/view-spec.json",
|
|
37
|
+
".interf/runtime/inventory.json",
|
|
38
|
+
".interf/runtime/run.json",
|
|
39
|
+
".interf/runtime/raw-snapshot.json",
|
|
40
|
+
".interf/runtime/stage-contract.json",
|
|
41
|
+
".interf/runtime/summarize-targets.json",
|
|
42
|
+
];
|
|
43
|
+
function copyRelativePathIfPresent(sourceRoot, targetRoot, relativePath) {
|
|
44
|
+
const sourcePath = join(sourceRoot, relativePath);
|
|
45
|
+
if (!existsSync(sourcePath))
|
|
46
|
+
return;
|
|
47
|
+
const targetPath = join(targetRoot, relativePath);
|
|
48
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
49
|
+
cpSync(sourcePath, targetPath, {
|
|
50
|
+
recursive: true,
|
|
51
|
+
force: true,
|
|
52
|
+
errorOnExist: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function snapshotWorkspaceBestState(workspacePath) {
|
|
56
|
+
const snapshotRoot = mkdtempSync(join(tmpdir(), "interf-compile-attempt-"));
|
|
57
|
+
const snapshotPath = join(snapshotRoot, "workspace");
|
|
58
|
+
for (const relativePath of BEST_VARIATION_RESTORE_PATHS) {
|
|
59
|
+
copyRelativePathIfPresent(workspacePath, snapshotPath, relativePath);
|
|
60
|
+
}
|
|
61
|
+
return snapshotPath;
|
|
62
|
+
}
|
|
63
|
+
function restoreWorkspaceBestState(snapshotPath, workspacePath) {
|
|
64
|
+
for (const relativePath of BEST_VARIATION_RESTORE_PATHS) {
|
|
65
|
+
rmSync(join(workspacePath, relativePath), { recursive: true, force: true });
|
|
66
|
+
copyRelativePathIfPresent(snapshotPath, workspacePath, relativePath);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function runWorkflowVariation(options) {
|
|
70
|
+
let bestOutcome = null;
|
|
71
|
+
let bestSnapshotPath = null;
|
|
72
|
+
let bestAttempt = 0;
|
|
73
|
+
let attemptsRun = 0;
|
|
74
|
+
try {
|
|
75
|
+
for (let attempt = 1; attempt <= options.maxAttempts; attempt += 1) {
|
|
76
|
+
attemptsRun = attempt;
|
|
77
|
+
if (attempt > 1 || (attempt === 1 && options.resetBeforeFirstAttempt)) {
|
|
78
|
+
console.log();
|
|
79
|
+
const resetTarget = attempt > 1
|
|
80
|
+
? `attempt ${attempt}/${options.maxAttempts}`
|
|
81
|
+
: options.variationLabel;
|
|
82
|
+
console.log(chalk.dim(` Resetting generated workspace state before ${resetTarget}...`));
|
|
83
|
+
resetWorkspaceGeneratedState(options.workspacePath, "compile");
|
|
84
|
+
}
|
|
85
|
+
const result = await compileWorkspaceWithReporter(options.executor, options.workspacePath, {
|
|
86
|
+
heading: options.maxAttempts > 1
|
|
87
|
+
? `Building compiled workspace (${options.variationLabel}, attempt ${attempt}/${options.maxAttempts})...`
|
|
88
|
+
: `Building compiled workspace (${options.variationLabel})...`,
|
|
89
|
+
successMessage: options.maxAttempts > 1
|
|
90
|
+
? `Compiled workspace ready for ${options.variationLabel}, attempt ${attempt}.`
|
|
91
|
+
: `Compiled workspace ready for ${options.variationLabel}.`,
|
|
92
|
+
preserveStageShells: options.preserveStageShells,
|
|
93
|
+
});
|
|
94
|
+
if (!result.ok) {
|
|
95
|
+
printCompileFailure(options.workspacePath, result.failedStage);
|
|
96
|
+
printStageShellReviewHint(options.workspacePath, options.preserveStageShells);
|
|
97
|
+
if (attempt < options.maxAttempts) {
|
|
98
|
+
console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} failed. Retrying with a fresh compile.`));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
passed: false,
|
|
103
|
+
attemptsRun,
|
|
104
|
+
failedStage: result.failedStage,
|
|
105
|
+
bestOutcome,
|
|
106
|
+
bestSnapshotPath,
|
|
107
|
+
bestAttempt,
|
|
108
|
+
fatalError: null,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const outcome = await runSavedWorkspaceTest({
|
|
112
|
+
sourcePath: options.sourcePath,
|
|
113
|
+
workspaceConfig: options.workspaceConfig,
|
|
114
|
+
executor: options.testExecutor,
|
|
115
|
+
executionProfile: options.executionProfile,
|
|
116
|
+
workspacePath: options.workspacePath,
|
|
117
|
+
preserveSandboxes: options.preserveStageShells === "always" ? "always" : "on-failure",
|
|
118
|
+
});
|
|
119
|
+
if (!outcome) {
|
|
120
|
+
return {
|
|
121
|
+
passed: false,
|
|
122
|
+
attemptsRun,
|
|
123
|
+
failedStage: null,
|
|
124
|
+
bestOutcome,
|
|
125
|
+
bestSnapshotPath,
|
|
126
|
+
bestAttempt,
|
|
127
|
+
fatalError: "Could not run the saved workspace test after compile.",
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
console.log();
|
|
131
|
+
printSavedTestOutcome(`${options.variationLabel} · attempt ${attempt}/${options.maxAttempts}`, outcome);
|
|
132
|
+
if (!bestOutcome || testScore(outcome) > testScore(bestOutcome)) {
|
|
133
|
+
if (bestSnapshotPath) {
|
|
134
|
+
rmSync(bestSnapshotPath, { recursive: true, force: true });
|
|
135
|
+
}
|
|
136
|
+
bestOutcome = outcome;
|
|
137
|
+
bestSnapshotPath = snapshotWorkspaceBestState(options.workspacePath);
|
|
138
|
+
bestAttempt = attempt;
|
|
139
|
+
}
|
|
140
|
+
if (outcome.result.ok) {
|
|
141
|
+
console.log();
|
|
142
|
+
console.log(chalk.green(` Workspace passed on ${options.variationLabel}, attempt ${attempt}/${options.maxAttempts}.`));
|
|
143
|
+
printStageShellReviewHint(options.workspacePath, options.preserveStageShells);
|
|
144
|
+
return {
|
|
145
|
+
passed: true,
|
|
146
|
+
attemptsRun,
|
|
147
|
+
failedStage: null,
|
|
148
|
+
bestOutcome,
|
|
149
|
+
bestSnapshotPath,
|
|
150
|
+
bestAttempt,
|
|
151
|
+
fatalError: null,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (attempt < options.maxAttempts) {
|
|
155
|
+
console.log();
|
|
156
|
+
console.log(chalk.yellow(` ${options.variationLabel} attempt ${attempt}/${options.maxAttempts} did not pass. Retrying with the same workflow.`));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
passed: false,
|
|
161
|
+
attemptsRun,
|
|
162
|
+
failedStage: null,
|
|
163
|
+
bestOutcome,
|
|
164
|
+
bestSnapshotPath,
|
|
165
|
+
bestAttempt,
|
|
166
|
+
fatalError: null,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
return {
|
|
171
|
+
passed: false,
|
|
172
|
+
attemptsRun,
|
|
173
|
+
failedStage: null,
|
|
174
|
+
bestOutcome,
|
|
175
|
+
bestSnapshotPath,
|
|
176
|
+
bestAttempt,
|
|
177
|
+
fatalError: error instanceof Error ? error.message : String(error),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function summarizeWorkflowVariation(options) {
|
|
182
|
+
const passedQuestions = options.result.bestOutcome?.result.passedCases ?? 0;
|
|
183
|
+
const totalQuestions = options.result.bestOutcome?.result.totalCases ?? options.defaultTotalQuestions;
|
|
184
|
+
const summary = options.result.passed
|
|
185
|
+
? `Passed ${passedQuestions}/${totalQuestions} truth checks.`
|
|
186
|
+
: options.result.bestOutcome
|
|
187
|
+
? `Best result: ${passedQuestions}/${totalQuestions} truth checks passed.`
|
|
188
|
+
: options.result.failedStage
|
|
189
|
+
? `Compile failed at stage ${options.result.failedStage} before any test result.`
|
|
190
|
+
: "Workflow variation did not produce a passing result.";
|
|
191
|
+
return {
|
|
192
|
+
variation: options.variation,
|
|
193
|
+
kind: options.kind,
|
|
194
|
+
attempts_run: Math.max(1, options.result.attemptsRun),
|
|
195
|
+
passed: options.result.passed,
|
|
196
|
+
passed_questions: passedQuestions,
|
|
197
|
+
total_questions: totalQuestions,
|
|
198
|
+
...(options.result.failedStage ? { failed_stage: options.result.failedStage } : {}),
|
|
199
|
+
...(options.result.bestOutcome ? { test_run_path: options.result.bestOutcome.runPath } : {}),
|
|
200
|
+
...(options.result.bestOutcome?.result.sandbox_path
|
|
201
|
+
? { test_sandbox_path: options.result.bestOutcome.result.sandbox_path }
|
|
202
|
+
: {}),
|
|
203
|
+
summary,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function printStageShellReviewHint(workspacePath, preserveStageShells) {
|
|
207
|
+
const reviewRoot = stageExecutionShellsRoot(workspacePath);
|
|
208
|
+
if (preserveStageShells === "always") {
|
|
209
|
+
console.log(chalk.dim(` Preserved stage shells: ${reviewRoot}`));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
console.log(chalk.dim(` Failed stage shells remain under: ${reviewRoot}`));
|
|
213
|
+
}
|
|
214
|
+
function formatVariationQuestionSummary(summary) {
|
|
215
|
+
return `${summary.passed_questions}/${summary.total_questions}`;
|
|
216
|
+
}
|
|
217
|
+
function printWorkflowVariationSummary(summaries) {
|
|
218
|
+
if (summaries.length === 0)
|
|
219
|
+
return;
|
|
220
|
+
console.log();
|
|
221
|
+
console.log(chalk.bold(" Workflow variation summary"));
|
|
222
|
+
console.log();
|
|
223
|
+
console.log(" | Variation | Kind | Truth checks | Result |");
|
|
224
|
+
console.log(" | --- | --- | --- | --- |");
|
|
225
|
+
for (const summary of summaries) {
|
|
226
|
+
console.log(` | ${summary.variation} | ${summary.kind} | \`${formatVariationQuestionSummary(summary)}\` | ${summary.passed ? "pass" : "fail"} |`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function printWorkspaceLocalWorkflowOwnership(workspacePath, bestVariation) {
|
|
230
|
+
if (bestVariation <= 1)
|
|
231
|
+
return;
|
|
232
|
+
console.log();
|
|
233
|
+
console.log(chalk.dim(` Best workflow variation now lives in: ${workflowPackagePathForWorkspace(workspacePath)}`));
|
|
234
|
+
console.log(chalk.dim(" Source-folder workflow selection was not changed automatically."));
|
|
235
|
+
console.log(chalk.dim(" Recompiling this existing workspace reuses that workspace-local workflow draft."));
|
|
236
|
+
}
|
|
237
|
+
export async function runConfiguredWorkspaceCompile(options) {
|
|
238
|
+
const preserveStageShells = options.preserveStageShells ?? "on-failure";
|
|
239
|
+
const configuredMaxAttempts = resolveWorkspaceCompileMaxAttempts(options.workspaceConfig ?? { max_attempts: undefined }, options.maxAttemptsOverride);
|
|
240
|
+
const maxLoops = resolveWorkspaceCompileMaxLoops(options.workspaceConfig ?? { max_loops: undefined }, options.maxLoopsOverride);
|
|
241
|
+
const maxAttempts = configuredMaxAttempts ?? (maxLoops != null ? 1 : null);
|
|
242
|
+
const loopEnabled = maxAttempts != null;
|
|
243
|
+
const checks = options.workspaceConfig?.checks ?? [];
|
|
244
|
+
if (loopEnabled && checks.length === 0) {
|
|
245
|
+
console.log(chalk.yellow(" Retry and self-improving modes need saved truth checks. Building once without those loops."));
|
|
246
|
+
}
|
|
247
|
+
else if (loopEnabled) {
|
|
248
|
+
if (maxAttempts > 1) {
|
|
249
|
+
console.log(chalk.dim(` Retry mode: up to ${maxAttempts} compile attempts.`));
|
|
250
|
+
console.log(chalk.dim(" Interf Compiler will rerun the same workflow variation, test the workspace, and stop early if it passes."));
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
console.log(chalk.dim(" Compile mode: 1 attempt per workflow variation."));
|
|
254
|
+
}
|
|
255
|
+
if (maxLoops != null) {
|
|
256
|
+
console.log(chalk.dim(` Self-improving loops: up to ${maxLoops} workflow edits after retries fail.`));
|
|
257
|
+
console.log(chalk.dim(" Interf Compiler will review failed runs, edit the workflow package, and test new workflow variations."));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (!loopEnabled || checks.length === 0) {
|
|
261
|
+
const result = await compileWorkspaceWithReporter(options.executor, options.workspacePath, {
|
|
262
|
+
preserveStageShells,
|
|
263
|
+
});
|
|
264
|
+
if (!result.ok) {
|
|
265
|
+
process.exitCode = 1;
|
|
266
|
+
printCompileFailure(options.workspacePath, result.failedStage);
|
|
267
|
+
printStageShellReviewHint(options.workspacePath, preserveStageShells);
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
printStageShellReviewHint(options.workspacePath, preserveStageShells);
|
|
271
|
+
return true;
|
|
272
|
+
}
|
|
273
|
+
let bestOutcome = null;
|
|
274
|
+
let bestSnapshotPath = null;
|
|
275
|
+
let bestAttempt = 0;
|
|
276
|
+
let bestVariation = 0;
|
|
277
|
+
const previousVariations = [];
|
|
278
|
+
const improvementRunId = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
279
|
+
try {
|
|
280
|
+
const workspaceConfig = options.workspaceConfig ?? {
|
|
281
|
+
name: readInterfConfig(options.workspacePath)?.name ?? "workspace",
|
|
282
|
+
checks: [],
|
|
283
|
+
};
|
|
284
|
+
const adoptVariationBest = (variation, result) => {
|
|
285
|
+
if (result.bestOutcome && result.bestSnapshotPath && (!bestOutcome || testScore(result.bestOutcome) > testScore(bestOutcome))) {
|
|
286
|
+
if (bestSnapshotPath) {
|
|
287
|
+
rmSync(bestSnapshotPath, { recursive: true, force: true });
|
|
288
|
+
}
|
|
289
|
+
bestOutcome = result.bestOutcome;
|
|
290
|
+
bestSnapshotPath = result.bestSnapshotPath;
|
|
291
|
+
bestAttempt = result.bestAttempt;
|
|
292
|
+
bestVariation = variation;
|
|
293
|
+
result.bestSnapshotPath = null;
|
|
294
|
+
}
|
|
295
|
+
if (result.bestSnapshotPath) {
|
|
296
|
+
rmSync(result.bestSnapshotPath, { recursive: true, force: true });
|
|
297
|
+
result.bestSnapshotPath = null;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
const baseline = await runWorkflowVariation({
|
|
301
|
+
executor: options.executor,
|
|
302
|
+
testExecutor: options.testExecutor,
|
|
303
|
+
workspacePath: options.workspacePath,
|
|
304
|
+
sourcePath: options.sourcePath,
|
|
305
|
+
workspaceConfig,
|
|
306
|
+
executionProfile: options.executionProfile,
|
|
307
|
+
preserveStageShells,
|
|
308
|
+
maxAttempts,
|
|
309
|
+
variationLabel: "baseline workflow",
|
|
310
|
+
});
|
|
311
|
+
if (baseline.fatalError) {
|
|
312
|
+
process.exitCode = 1;
|
|
313
|
+
console.log(chalk.red(` ${baseline.fatalError}`));
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
adoptVariationBest(1, baseline);
|
|
317
|
+
previousVariations.push(summarizeWorkflowVariation({
|
|
318
|
+
variation: 1,
|
|
319
|
+
kind: "baseline",
|
|
320
|
+
result: baseline,
|
|
321
|
+
defaultTotalQuestions: checks.length,
|
|
322
|
+
}));
|
|
323
|
+
if (baseline.passed) {
|
|
324
|
+
printWorkflowVariationSummary(previousVariations);
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
if (maxLoops != null) {
|
|
328
|
+
for (let loopIndex = 1; loopIndex <= maxLoops; loopIndex += 1) {
|
|
329
|
+
console.log();
|
|
330
|
+
console.log(chalk.dim(` Self-improving loop ${loopIndex}/${maxLoops}: reviewing failed runs and editing the workflow.`));
|
|
331
|
+
const improvement = await runWorkflowImprovementLoop({
|
|
332
|
+
executor: options.executor,
|
|
333
|
+
workspacePath: options.workspacePath,
|
|
334
|
+
workflowId: resolveWorkspaceWorkflowFromConfig(readInterfConfig(options.workspacePath)),
|
|
335
|
+
workspaceConfig,
|
|
336
|
+
runId: improvementRunId,
|
|
337
|
+
loopIndex,
|
|
338
|
+
maxLoops,
|
|
339
|
+
maxAttempts,
|
|
340
|
+
previousVariations,
|
|
341
|
+
});
|
|
342
|
+
console.log(chalk.dim(` Workflow improvement shell: ${improvement.shellPath}`));
|
|
343
|
+
if (improvement.status === "executor-failed") {
|
|
344
|
+
process.exitCode = 1;
|
|
345
|
+
console.log(chalk.red(` ${improvement.summary}`));
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if (improvement.status !== "updated") {
|
|
349
|
+
console.log(chalk.yellow(` ${improvement.summary}`));
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const variation = await runWorkflowVariation({
|
|
353
|
+
executor: options.executor,
|
|
354
|
+
testExecutor: options.testExecutor,
|
|
355
|
+
workspacePath: options.workspacePath,
|
|
356
|
+
sourcePath: options.sourcePath,
|
|
357
|
+
workspaceConfig,
|
|
358
|
+
executionProfile: options.executionProfile,
|
|
359
|
+
preserveStageShells,
|
|
360
|
+
maxAttempts,
|
|
361
|
+
variationLabel: `workflow variation ${loopIndex + 1}`,
|
|
362
|
+
resetBeforeFirstAttempt: true,
|
|
363
|
+
});
|
|
364
|
+
if (variation.fatalError) {
|
|
365
|
+
process.exitCode = 1;
|
|
366
|
+
console.log(chalk.red(` ${variation.fatalError}`));
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
adoptVariationBest(loopIndex + 1, variation);
|
|
370
|
+
previousVariations.push(summarizeWorkflowVariation({
|
|
371
|
+
variation: loopIndex + 1,
|
|
372
|
+
kind: "edited",
|
|
373
|
+
result: variation,
|
|
374
|
+
defaultTotalQuestions: checks.length,
|
|
375
|
+
}));
|
|
376
|
+
if (variation.passed) {
|
|
377
|
+
printWorkflowVariationSummary(previousVariations);
|
|
378
|
+
printWorkspaceLocalWorkflowOwnership(options.workspacePath, bestVariation);
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (bestSnapshotPath && bestVariation > 0) {
|
|
384
|
+
restoreWorkspaceBestState(bestSnapshotPath, options.workspacePath);
|
|
385
|
+
console.log();
|
|
386
|
+
console.log(chalk.dim(` Restored the best-performing compiled workspace from variation ${bestVariation}, attempt ${bestAttempt}.`));
|
|
387
|
+
}
|
|
388
|
+
process.exitCode = 1;
|
|
389
|
+
console.log();
|
|
390
|
+
printWorkflowVariationSummary(previousVariations);
|
|
391
|
+
printWorkspaceLocalWorkflowOwnership(options.workspacePath, bestVariation);
|
|
392
|
+
if (maxLoops != null) {
|
|
393
|
+
console.log(chalk.red(` Workspace did not pass after ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"} per variation and ${maxLoops} workflow-improvement loop${maxLoops === 1 ? "" : "s"}.`));
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
console.log(chalk.red(` Workspace did not pass within ${maxAttempts} attempt${maxAttempts === 1 ? "" : "s"}.`));
|
|
397
|
+
}
|
|
398
|
+
if (bestOutcome) {
|
|
399
|
+
console.log(chalk.dim(` Best attempt truth-check pass rate: ${questionPassRate(bestOutcome)}%.`));
|
|
400
|
+
}
|
|
401
|
+
printStageShellReviewHint(options.workspacePath, preserveStageShells);
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
finally {
|
|
405
|
+
if (bestSnapshotPath) {
|
|
406
|
+
rmSync(bestSnapshotPath, { recursive: true, force: true });
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type { WorkflowExecutionProfile, WorkflowExecutor } from "../lib/executors.js";
|
|
2
1
|
import type { SourceWorkspaceConfig } from "../lib/schema.js";
|
|
3
2
|
import type { CommandModule } from "yargs";
|
|
4
|
-
|
|
3
|
+
export { runConfiguredWorkspaceCompile } from "./compile-controller.js";
|
|
5
4
|
export declare const compileCommand: CommandModule;
|
|
6
5
|
export declare function runCompileCommand(argv?: Record<string, unknown>): Promise<void>;
|
|
7
|
-
export declare function
|
|
8
|
-
executor: WorkflowExecutor;
|
|
6
|
+
export declare function resolveInteractiveCompileLoopOverrides(options: {
|
|
9
7
|
workspacePath: string;
|
|
10
|
-
sourcePath: string;
|
|
11
8
|
workspaceConfig: SourceWorkspaceConfig | null;
|
|
12
|
-
executionProfile?: WorkflowExecutionProfile;
|
|
13
9
|
maxAttemptsOverride: number | null;
|
|
14
|
-
|
|
15
|
-
}): Promise<
|
|
16
|
-
|
|
10
|
+
maxLoopsOverride: number | null;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
workspaceConfig: SourceWorkspaceConfig | null;
|
|
13
|
+
maxAttemptsOverride: number | null;
|
|
14
|
+
maxLoopsOverride: number | null;
|
|
15
|
+
} | null>;
|