@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
package/dist/lib/schema.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { WORKSPACE_CONTRACT_TYPES, WORKSPACE_ZONE_KINDS, } from "./workflow-abi.js";
|
|
2
3
|
const JsonRecordSchema = z.record(z.string(), z.unknown());
|
|
3
4
|
const WORKSPACE_RELATIVE_PATH_SEGMENT = /^(?!\.{1,2}$)[^/\\]+$/;
|
|
4
5
|
function isWorkspaceRelativePath(value) {
|
|
@@ -11,35 +12,13 @@ function isWorkspaceRelativePath(value) {
|
|
|
11
12
|
.every((segment) => WORKSPACE_RELATIVE_PATH_SEGMENT.test(segment));
|
|
12
13
|
}
|
|
13
14
|
export const RuntimeTargetTypeSchema = z.enum(["workspace"]);
|
|
14
|
-
export const
|
|
15
|
+
export const TestTargetTypeSchema = z.enum(["workspace", "raw"]);
|
|
15
16
|
export const WorkflowIdPattern = /^[a-z0-9][a-z0-9-]{0,79}$/;
|
|
16
17
|
export const RuntimeStageSchema = z.string().regex(WorkflowIdPattern);
|
|
17
|
-
export const RuntimeContractTypeSchema = z.enum(
|
|
18
|
-
"workspace-file-evidence",
|
|
19
|
-
"workspace-knowledge-structure",
|
|
20
|
-
"workspace-query-shape",
|
|
21
|
-
]);
|
|
18
|
+
export const RuntimeContractTypeSchema = z.enum(WORKSPACE_CONTRACT_TYPES);
|
|
22
19
|
export const WorkflowIdSchema = z.string().regex(WorkflowIdPattern);
|
|
23
20
|
export const WorkflowZoneIdSchema = z.string().regex(WorkflowIdPattern);
|
|
24
|
-
export const
|
|
25
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
26
|
-
return value;
|
|
27
|
-
const raw = value;
|
|
28
|
-
return {
|
|
29
|
-
...raw,
|
|
30
|
-
type: "workspace",
|
|
31
|
-
source: raw.source ?? { path: "./raw" },
|
|
32
|
-
};
|
|
33
|
-
}, z.object({
|
|
34
|
-
type: z.literal("workspace"),
|
|
35
|
-
name: z.string(),
|
|
36
|
-
about: z.string().optional(),
|
|
37
|
-
workflow: WorkflowIdSchema.optional(),
|
|
38
|
-
source: z.object({
|
|
39
|
-
path: z.string(),
|
|
40
|
-
}),
|
|
41
|
-
}).passthrough());
|
|
42
|
-
export const InterfConfigSchema = WorkspaceInterfConfigSchema;
|
|
21
|
+
export const WorkflowWorkspaceZoneKindSchema = z.enum(WORKSPACE_ZONE_KINDS);
|
|
43
22
|
export const WorkspaceStateSchema = z.object({
|
|
44
23
|
version: z.literal(1),
|
|
45
24
|
pending: z.array(z.string()),
|
|
@@ -138,7 +117,7 @@ export const WorkflowWorkspaceZoneSchema = z.object({
|
|
|
138
117
|
path: z.string().min(1).refine(isWorkspaceRelativePath, {
|
|
139
118
|
message: "Zone paths must stay inside the workspace root",
|
|
140
119
|
}),
|
|
141
|
-
kind:
|
|
120
|
+
kind: WorkflowWorkspaceZoneKindSchema,
|
|
142
121
|
required: z.boolean(),
|
|
143
122
|
owned_by: z.array(z.string().regex(WorkflowIdPattern)),
|
|
144
123
|
description: z.string().min(1),
|
|
@@ -282,7 +261,7 @@ export const WorkspaceInventorySchema = z.union([
|
|
|
282
261
|
summary_total: z.number().optional(),
|
|
283
262
|
}),
|
|
284
263
|
]);
|
|
285
|
-
export const
|
|
264
|
+
export const TestCaseExpectSchema = z.object({
|
|
286
265
|
must_include: z.array(z.string().min(1)).optional(),
|
|
287
266
|
must_include_one_of: z.array(z.array(z.string().min(1)).min(1)).optional(),
|
|
288
267
|
must_not_include: z.array(z.string().min(1)).optional(),
|
|
@@ -297,24 +276,24 @@ export const BenchmarkCaseExpectSchema = z.object({
|
|
|
297
276
|
(value.must_not_include?.length ?? 0) > 0 ||
|
|
298
277
|
value.min_words !== undefined ||
|
|
299
278
|
value.max_words !== undefined, {
|
|
300
|
-
message: "
|
|
279
|
+
message: "Test expectations must include at least one check",
|
|
301
280
|
});
|
|
302
|
-
const
|
|
281
|
+
const TestCaseCoreSchema = z.object({
|
|
303
282
|
id: z.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/),
|
|
304
283
|
question: z.string().min(1),
|
|
305
284
|
file: z.string().min(1).optional(),
|
|
306
285
|
answer: z.string().min(1).optional(),
|
|
307
|
-
expect:
|
|
286
|
+
expect: TestCaseExpectSchema.optional(),
|
|
308
287
|
strictness: z.string().min(1).optional(),
|
|
309
288
|
}).superRefine((value, ctx) => {
|
|
310
289
|
if (!value.file && !value.answer && !value.expect) {
|
|
311
290
|
ctx.addIssue({
|
|
312
291
|
code: z.ZodIssueCode.custom,
|
|
313
|
-
message: "
|
|
292
|
+
message: "Test cases need at least one of file, answer, or expect.",
|
|
314
293
|
});
|
|
315
294
|
}
|
|
316
295
|
});
|
|
317
|
-
export const
|
|
296
|
+
export const TestCaseSchema = z.preprocess((value) => {
|
|
318
297
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
319
298
|
return value;
|
|
320
299
|
const raw = value;
|
|
@@ -323,14 +302,14 @@ export const BenchmarkCaseSchema = z.preprocess((value) => {
|
|
|
323
302
|
question: raw.question ?? raw.check ?? raw.ask,
|
|
324
303
|
answer: raw.answer ?? raw.expected ?? raw.pass_when,
|
|
325
304
|
};
|
|
326
|
-
},
|
|
327
|
-
const
|
|
328
|
-
type:
|
|
305
|
+
}, TestCaseCoreSchema);
|
|
306
|
+
const TestSpecCoreSchema = z.object({
|
|
307
|
+
type: TestTargetTypeSchema,
|
|
329
308
|
name: z.string().min(1),
|
|
330
309
|
description: z.string().min(1).optional(),
|
|
331
|
-
cases: z.array(
|
|
310
|
+
cases: z.array(TestCaseSchema).min(1),
|
|
332
311
|
});
|
|
333
|
-
export const
|
|
312
|
+
export const TestSpecSchema = z.preprocess((value) => {
|
|
334
313
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
335
314
|
return value;
|
|
336
315
|
const raw = value;
|
|
@@ -339,12 +318,12 @@ export const BenchmarkSpecSchema = z.preprocess((value) => {
|
|
|
339
318
|
type: raw.type ?? "workspace",
|
|
340
319
|
cases: raw.cases ?? raw.checks,
|
|
341
320
|
};
|
|
342
|
-
},
|
|
343
|
-
export const
|
|
321
|
+
}, TestSpecCoreSchema);
|
|
322
|
+
export const SourceTruthCheckSchema = z.object({
|
|
344
323
|
id: z.string().regex(WorkflowIdPattern).optional(),
|
|
345
324
|
question: z.string().min(1),
|
|
346
325
|
answer: z.string().min(1).optional(),
|
|
347
|
-
expect:
|
|
326
|
+
expect: TestCaseExpectSchema.optional(),
|
|
348
327
|
strictness: z.string().min(1).optional(),
|
|
349
328
|
}).strict().superRefine((value, ctx) => {
|
|
350
329
|
if (!value.answer && !value.expect) {
|
|
@@ -356,6 +335,7 @@ export const SourceEvalCaseSchema = z.object({
|
|
|
356
335
|
}
|
|
357
336
|
});
|
|
358
337
|
export const SourceWorkspaceMaxAttemptsSchema = z.number().int().min(1).max(5);
|
|
338
|
+
export const SourceWorkspaceMaxLoopsSchema = z.number().int().min(1).max(3);
|
|
359
339
|
export const SourceWorkspaceConfigSchema = z.preprocess((value) => {
|
|
360
340
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
361
341
|
return value;
|
|
@@ -366,6 +346,7 @@ export const SourceWorkspaceConfigSchema = z.preprocess((value) => {
|
|
|
366
346
|
return {
|
|
367
347
|
...raw,
|
|
368
348
|
max_attempts: raw.max_attempts ?? legacyRetryPolicy?.max_attempts,
|
|
349
|
+
max_loops: raw.max_loops,
|
|
369
350
|
};
|
|
370
351
|
}, z.object({
|
|
371
352
|
id: z.string().regex(WorkflowIdPattern).optional(),
|
|
@@ -373,8 +354,129 @@ export const SourceWorkspaceConfigSchema = z.preprocess((value) => {
|
|
|
373
354
|
about: z.string().min(1).optional(),
|
|
374
355
|
workflow: WorkflowIdSchema.optional(),
|
|
375
356
|
max_attempts: SourceWorkspaceMaxAttemptsSchema.optional(),
|
|
376
|
-
|
|
357
|
+
max_loops: SourceWorkspaceMaxLoopsSchema.optional(),
|
|
358
|
+
checks: z.array(SourceTruthCheckSchema).default([]),
|
|
377
359
|
}).strict());
|
|
360
|
+
export const WorkspaceInterfConfigSchema = z.preprocess((value) => {
|
|
361
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
362
|
+
return value;
|
|
363
|
+
const raw = value;
|
|
364
|
+
return {
|
|
365
|
+
...raw,
|
|
366
|
+
type: "workspace",
|
|
367
|
+
source: raw.source ?? { path: "./raw" },
|
|
368
|
+
checks: raw.checks ?? [],
|
|
369
|
+
};
|
|
370
|
+
}, z.object({
|
|
371
|
+
type: z.literal("workspace"),
|
|
372
|
+
name: z.string(),
|
|
373
|
+
about: z.string().optional(),
|
|
374
|
+
workflow: WorkflowIdSchema.optional(),
|
|
375
|
+
max_attempts: SourceWorkspaceMaxAttemptsSchema.optional(),
|
|
376
|
+
max_loops: SourceWorkspaceMaxLoopsSchema.optional(),
|
|
377
|
+
checks: z.array(SourceTruthCheckSchema).default([]),
|
|
378
|
+
workflow_origin: z.object({
|
|
379
|
+
selected: WorkflowIdSchema,
|
|
380
|
+
local_draft: z.boolean().optional(),
|
|
381
|
+
}).optional(),
|
|
382
|
+
source: z.object({
|
|
383
|
+
path: z.string(),
|
|
384
|
+
control_path: z.string().optional(),
|
|
385
|
+
}),
|
|
386
|
+
}).passthrough());
|
|
387
|
+
export const InterfConfigSchema = WorkspaceInterfConfigSchema;
|
|
388
|
+
export const WorkflowImprovementLoopSummarySchema = z.object({
|
|
389
|
+
variation: z.number().int().min(1),
|
|
390
|
+
kind: z.enum(["baseline", "edited"]),
|
|
391
|
+
attempts_run: z.number().int().min(1),
|
|
392
|
+
passed: z.boolean(),
|
|
393
|
+
passed_questions: z.number().int().min(0),
|
|
394
|
+
total_questions: z.number().int().min(0),
|
|
395
|
+
failed_stage: z.string().nullable().optional(),
|
|
396
|
+
test_run_path: z.string().nullable().optional(),
|
|
397
|
+
test_sandbox_path: z.string().nullable().optional(),
|
|
398
|
+
summary: z.string().min(1),
|
|
399
|
+
});
|
|
400
|
+
export const WorkflowImprovementContextSchema = z.object({
|
|
401
|
+
kind: z.literal("interf-workflow-improvement-loop"),
|
|
402
|
+
version: z.literal(1),
|
|
403
|
+
generated_at: z.string(),
|
|
404
|
+
target_name: z.string(),
|
|
405
|
+
workflow_id: WorkflowIdSchema,
|
|
406
|
+
loop_index: z.number().int().min(1),
|
|
407
|
+
max_loops: SourceWorkspaceMaxLoopsSchema,
|
|
408
|
+
max_attempts: SourceWorkspaceMaxAttemptsSchema,
|
|
409
|
+
review_paths: z.object({
|
|
410
|
+
workflow_root: z.string(),
|
|
411
|
+
workspace_runtime: z.string().nullable(),
|
|
412
|
+
test_comparisons: z.string().nullable(),
|
|
413
|
+
execution_shells: z.string().nullable(),
|
|
414
|
+
test_runs: z.string().nullable(),
|
|
415
|
+
test_sandboxes: z.string().nullable(),
|
|
416
|
+
}),
|
|
417
|
+
truth_checks: z.object({
|
|
418
|
+
count: z.number().int().min(0),
|
|
419
|
+
questions: z.array(z.object({
|
|
420
|
+
id: z.string(),
|
|
421
|
+
question: z.string(),
|
|
422
|
+
})),
|
|
423
|
+
}),
|
|
424
|
+
previous_variations: z.array(WorkflowImprovementLoopSummarySchema),
|
|
425
|
+
latest_failure: WorkflowImprovementLoopSummarySchema.nullable(),
|
|
426
|
+
});
|
|
427
|
+
export const PreservedShellTypeSchema = z.enum([
|
|
428
|
+
"stage-execution",
|
|
429
|
+
"workflow-improvement",
|
|
430
|
+
]);
|
|
431
|
+
export const PreservedShellSnapshotSchema = z.object({
|
|
432
|
+
kind: z.literal("interf-preserved-shell"),
|
|
433
|
+
version: z.literal(1),
|
|
434
|
+
shell_type: PreservedShellTypeSchema,
|
|
435
|
+
generated_at: z.string(),
|
|
436
|
+
root_path: z.string(),
|
|
437
|
+
materialized_symlinks: z.number().int().min(0),
|
|
438
|
+
});
|
|
439
|
+
export const WorkflowPackageValidationSchema = z.object({
|
|
440
|
+
ok: z.boolean(),
|
|
441
|
+
summary: z.string(),
|
|
442
|
+
errors: z.array(z.string()),
|
|
443
|
+
counts: z.record(z.string(), z.number()),
|
|
444
|
+
});
|
|
445
|
+
export const WorkflowImprovementLoopRecordSchema = z.object({
|
|
446
|
+
kind: z.literal("interf-workflow-improvement-loop-record"),
|
|
447
|
+
version: z.literal(1),
|
|
448
|
+
recorded_at: z.string(),
|
|
449
|
+
run_id: z.string(),
|
|
450
|
+
loop_index: z.number().int().min(1),
|
|
451
|
+
target_name: z.string(),
|
|
452
|
+
workflow_id: WorkflowIdSchema,
|
|
453
|
+
result: z.enum(["updated", "no-change", "invalid", "executor-failed"]),
|
|
454
|
+
changed: z.boolean(),
|
|
455
|
+
applied: z.boolean(),
|
|
456
|
+
summary: z.string(),
|
|
457
|
+
shell_path: z.string(),
|
|
458
|
+
loop_root_path: z.string(),
|
|
459
|
+
context_path: z.string(),
|
|
460
|
+
workflow_before_path: z.string(),
|
|
461
|
+
workflow_after_path: z.string(),
|
|
462
|
+
prompt_log_path: z.string(),
|
|
463
|
+
event_log_path: z.string(),
|
|
464
|
+
status_log_path: z.string(),
|
|
465
|
+
preserved_shell_manifest_path: z.string().nullable(),
|
|
466
|
+
validation: WorkflowPackageValidationSchema.nullable(),
|
|
467
|
+
});
|
|
468
|
+
export const WorkflowImprovementRunLedgerSchema = z.object({
|
|
469
|
+
kind: z.literal("interf-workflow-improvement-run"),
|
|
470
|
+
version: z.literal(1),
|
|
471
|
+
generated_at: z.string(),
|
|
472
|
+
updated_at: z.string(),
|
|
473
|
+
run_id: z.string(),
|
|
474
|
+
target_name: z.string(),
|
|
475
|
+
workflow_id: WorkflowIdSchema,
|
|
476
|
+
max_loops: SourceWorkspaceMaxLoopsSchema,
|
|
477
|
+
max_attempts: SourceWorkspaceMaxAttemptsSchema,
|
|
478
|
+
loops: z.array(WorkflowImprovementLoopRecordSchema),
|
|
479
|
+
});
|
|
378
480
|
export const SourceFolderConfigSchema = z.object({
|
|
379
481
|
workspaces: z.array(SourceWorkspaceConfigSchema).optional(),
|
|
380
482
|
}).strict().superRefine((value, ctx) => {
|
|
@@ -385,12 +487,12 @@ export const SourceFolderConfigSchema = z.object({
|
|
|
385
487
|
});
|
|
386
488
|
}
|
|
387
489
|
});
|
|
388
|
-
export const
|
|
490
|
+
export const TestCheckResultSchema = z.object({
|
|
389
491
|
label: z.string(),
|
|
390
492
|
ok: z.boolean(),
|
|
391
493
|
detail: z.string(),
|
|
392
494
|
});
|
|
393
|
-
export const
|
|
495
|
+
export const TestCaseResultSchema = z.object({
|
|
394
496
|
caseId: z.string(),
|
|
395
497
|
question: z.string(),
|
|
396
498
|
file: z.string().optional(),
|
|
@@ -398,13 +500,13 @@ export const BenchmarkCaseResultSchema = z.object({
|
|
|
398
500
|
wordCount: z.number(),
|
|
399
501
|
passedChecks: z.number(),
|
|
400
502
|
totalChecks: z.number(),
|
|
401
|
-
checks: z.array(
|
|
503
|
+
checks: z.array(TestCheckResultSchema),
|
|
402
504
|
answer: z.string().optional(),
|
|
403
505
|
trace: JsonRecordSchema.nullable().optional(),
|
|
404
506
|
});
|
|
405
|
-
export const
|
|
507
|
+
export const TestTargetResultSchema = z.object({
|
|
406
508
|
target: z.object({
|
|
407
|
-
type:
|
|
509
|
+
type: TestTargetTypeSchema,
|
|
408
510
|
name: z.string(),
|
|
409
511
|
path: z.string(),
|
|
410
512
|
workflow: z.string(),
|
|
@@ -415,16 +517,16 @@ export const BenchmarkTargetResultSchema = z.object({
|
|
|
415
517
|
totalCases: z.number(),
|
|
416
518
|
passedChecks: z.number(),
|
|
417
519
|
totalChecks: z.number(),
|
|
418
|
-
caseResults: z.array(
|
|
520
|
+
caseResults: z.array(TestCaseResultSchema),
|
|
419
521
|
});
|
|
420
|
-
export const
|
|
421
|
-
kind: z.literal("interf-
|
|
522
|
+
export const TestTargetRunSchema = z.object({
|
|
523
|
+
kind: z.literal("interf-test-target-run"),
|
|
422
524
|
version: z.literal(1),
|
|
423
525
|
generated_at: z.string(),
|
|
424
|
-
|
|
526
|
+
spec: z.object({
|
|
425
527
|
id: z.string(),
|
|
426
528
|
name: z.string(),
|
|
427
|
-
type:
|
|
529
|
+
type: TestTargetTypeSchema,
|
|
428
530
|
file: z.string(),
|
|
429
531
|
description: z.string().optional(),
|
|
430
532
|
case_count: z.number(),
|
|
@@ -434,13 +536,47 @@ export const BenchmarkRunResultSchema = z.object({
|
|
|
434
536
|
file: z.string().optional(),
|
|
435
537
|
answer: z.string().optional(),
|
|
436
538
|
strictness: z.string().optional(),
|
|
437
|
-
expect:
|
|
539
|
+
expect: TestCaseExpectSchema.optional(),
|
|
438
540
|
})),
|
|
439
541
|
}),
|
|
440
542
|
source_path: z.string(),
|
|
441
543
|
executor: RuntimeExecutorInfoSchema.optional(),
|
|
442
544
|
target_count: z.number(),
|
|
443
|
-
results: z.array(
|
|
545
|
+
results: z.array(TestTargetResultSchema),
|
|
546
|
+
});
|
|
547
|
+
export const TestRunModeSchema = z.enum(["raw", "workspace", "both"]);
|
|
548
|
+
export const TestRunTargetSummarySchema = z.object({
|
|
549
|
+
label: z.string(),
|
|
550
|
+
run_path: z.string(),
|
|
551
|
+
ok: z.boolean(),
|
|
552
|
+
passed_cases: z.number(),
|
|
553
|
+
total_cases: z.number(),
|
|
554
|
+
passed_checks: z.number(),
|
|
555
|
+
total_checks: z.number(),
|
|
556
|
+
target: z.object({
|
|
557
|
+
type: TestTargetTypeSchema,
|
|
558
|
+
name: z.string(),
|
|
559
|
+
path: z.string(),
|
|
560
|
+
workflow: z.string(),
|
|
561
|
+
}),
|
|
562
|
+
});
|
|
563
|
+
export const TestRunComparisonSchema = z.object({
|
|
564
|
+
kind: z.literal("interf-test-run"),
|
|
565
|
+
version: z.literal(1),
|
|
566
|
+
generated_at: z.string(),
|
|
567
|
+
mode: TestRunModeSchema,
|
|
568
|
+
source_path: z.string(),
|
|
569
|
+
workspace: z.object({
|
|
570
|
+
name: z.string(),
|
|
571
|
+
path: z.string(),
|
|
572
|
+
}),
|
|
573
|
+
raw: TestRunTargetSummarySchema.nullable(),
|
|
574
|
+
compiled_workspace: TestRunTargetSummarySchema.nullable(),
|
|
575
|
+
summary: z.object({
|
|
576
|
+
raw_pass_rate: z.number().nullable(),
|
|
577
|
+
compiled_pass_rate: z.number().nullable(),
|
|
578
|
+
pass_rate_delta: z.number().nullable(),
|
|
579
|
+
}),
|
|
444
580
|
});
|
|
445
581
|
export const InterfUserConfigSchema = z.object({
|
|
446
582
|
agent: z.string(),
|
|
@@ -449,4 +585,3 @@ export const InterfUserConfigSchema = z.object({
|
|
|
449
585
|
viewer: z.enum(["plain", "obsidian"]).optional(),
|
|
450
586
|
initialized: z.string(),
|
|
451
587
|
});
|
|
452
|
-
//# sourceMappingURL=schema.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type InterfConfig, type TestSpec, type TestTargetType, type SourceTruthCheck, type SourceWorkspaceConfig, type SourceFolderConfig } from "./schema.js";
|
|
2
2
|
export declare const SOURCE_FOLDER_CONFIG_FILE = "interf.config.json";
|
|
3
|
-
export interface
|
|
3
|
+
export interface LoadedSourceTestSpec extends TestSpec {
|
|
4
4
|
id: string;
|
|
5
5
|
filePath: string;
|
|
6
6
|
}
|
|
@@ -8,19 +8,28 @@ export declare function loadSourceFolderConfig(sourcePath: string): SourceFolder
|
|
|
8
8
|
export interface WritableSourceFolderConfig {
|
|
9
9
|
workspaces?: SourceWorkspaceConfig[];
|
|
10
10
|
}
|
|
11
|
-
export declare function saveSourceFolderConfig(sourcePath: string, config: WritableSourceFolderConfig): void;
|
|
12
11
|
export declare function listSourceWorkspaceConfigs(config: SourceFolderConfig | null): SourceWorkspaceConfig[];
|
|
13
12
|
export declare function resolveWorkspaceCompileMaxAttempts(workspaceConfig: Pick<SourceWorkspaceConfig, "max_attempts">, override?: number | null): number | null;
|
|
13
|
+
export declare function resolveWorkspaceCompileMaxLoops(workspaceConfig: Pick<SourceWorkspaceConfig, "max_loops">, override?: number | null): number | null;
|
|
14
14
|
export declare function getDefaultSourceWorkspaceConfig(config: SourceFolderConfig | null): SourceWorkspaceConfig | null;
|
|
15
15
|
export declare function findSourceWorkspaceConfig(config: SourceFolderConfig | null, workspaceName: string): SourceWorkspaceConfig | null;
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function saveSourceFolderConfig(sourcePath: string, config: WritableSourceFolderConfig): void;
|
|
17
|
+
export declare function appendSourceWorkspaceChecks(sourcePath: string, workspaceName: string, checks: SourceTruthCheck[]): void;
|
|
17
18
|
export declare function upsertSourceWorkspaceConfig(sourcePath: string, workspaceConfig: SourceWorkspaceConfig, options?: {
|
|
18
19
|
matchName?: string;
|
|
19
20
|
}): void;
|
|
20
21
|
export declare function workspaceMaxAttempts(maxAttempts: number | null | undefined): number | undefined;
|
|
21
|
-
export declare function
|
|
22
|
+
export declare function workspaceMaxLoops(maxLoops: number | null | undefined): number | undefined;
|
|
23
|
+
export declare function sourceWorkspaceConfigFromInterfConfig(config: InterfConfig): SourceWorkspaceConfig;
|
|
24
|
+
export declare function loadWorkspaceControlConfig(workspacePath: string): SourceWorkspaceConfig | null;
|
|
25
|
+
export declare function saveWorkspaceInterfConfig(workspacePath: string, config: InterfConfig): InterfConfig;
|
|
26
|
+
export declare function syncWorkspaceInterfConfigFromSourceWorkspaceConfig(workspacePath: string, workspaceConfig: SourceWorkspaceConfig): InterfConfig;
|
|
27
|
+
export declare function buildTestSpecFromSourceFolderConfig(options: {
|
|
22
28
|
sourcePath: string;
|
|
23
29
|
targetName?: string | null;
|
|
24
|
-
targetType?:
|
|
25
|
-
}):
|
|
26
|
-
|
|
30
|
+
targetType?: TestTargetType;
|
|
31
|
+
}): LoadedSourceTestSpec | null;
|
|
32
|
+
export declare function buildTestSpecFromWorkspaceConfig(options: {
|
|
33
|
+
workspacePath: string;
|
|
34
|
+
targetType?: TestTargetType;
|
|
35
|
+
}): LoadedSourceTestSpec | null;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { existsSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { readInterfConfig, refreshWorkspaceBootstrapGuidance, resolveSourceControlPath, } from "./interf.js";
|
|
4
|
+
import { seedWorkspaceWorkflowPackage } from "./interf-workflow-package.js";
|
|
3
5
|
import { readJsonFileWithSchema } from "./parse.js";
|
|
6
|
+
import { getWorkspaceWorkflow } from "./workflow-definitions.js";
|
|
4
7
|
import { SourceFolderConfigSchema, } from "./schema.js";
|
|
5
8
|
import { slugify } from "./util.js";
|
|
9
|
+
import { defaultControlPathForWorkspace, workspaceInterfConfigPath, workspaceInterfRoot, } from "./workspace-paths.js";
|
|
6
10
|
export const SOURCE_FOLDER_CONFIG_FILE = "interf.config.json";
|
|
7
11
|
function sourceConfigPath(sourcePath) {
|
|
8
12
|
return join(sourcePath, SOURCE_FOLDER_CONFIG_FILE);
|
|
9
13
|
}
|
|
10
|
-
function
|
|
14
|
+
function normalizeTruthChecks(cases) {
|
|
11
15
|
const seen = new Set();
|
|
12
16
|
return cases.map((caseSpec, index) => {
|
|
13
17
|
const baseId = slugify(caseSpec.id ?? caseSpec.question) || `check-${index + 1}`;
|
|
@@ -33,9 +37,6 @@ export function loadSourceFolderConfig(sourcePath) {
|
|
|
33
37
|
return null;
|
|
34
38
|
return readJsonFileWithSchema(filePath, "source-folder config", SourceFolderConfigSchema);
|
|
35
39
|
}
|
|
36
|
-
export function saveSourceFolderConfig(sourcePath, config) {
|
|
37
|
-
writeFileSync(sourceConfigPath(sourcePath), JSON.stringify(config, null, 2) + "\n");
|
|
38
|
-
}
|
|
39
40
|
export function listSourceWorkspaceConfigs(config) {
|
|
40
41
|
return config?.workspaces ?? [];
|
|
41
42
|
}
|
|
@@ -48,6 +49,15 @@ export function resolveWorkspaceCompileMaxAttempts(workspaceConfig, override = n
|
|
|
48
49
|
return 1;
|
|
49
50
|
return Math.min(5, normalized);
|
|
50
51
|
}
|
|
52
|
+
export function resolveWorkspaceCompileMaxLoops(workspaceConfig, override = null) {
|
|
53
|
+
const configured = override ?? workspaceConfig.max_loops ?? null;
|
|
54
|
+
if (configured == null)
|
|
55
|
+
return null;
|
|
56
|
+
const normalized = Math.trunc(configured);
|
|
57
|
+
if (!Number.isFinite(normalized) || normalized < 1)
|
|
58
|
+
return 1;
|
|
59
|
+
return Math.min(3, normalized);
|
|
60
|
+
}
|
|
51
61
|
export function getDefaultSourceWorkspaceConfig(config) {
|
|
52
62
|
const workspaces = listSourceWorkspaceConfigs(config);
|
|
53
63
|
return workspaces[0] ?? null;
|
|
@@ -62,14 +72,18 @@ function toWritableSourceFolderConfig(config) {
|
|
|
62
72
|
workspaces: workspaces.map((workspace) => ({
|
|
63
73
|
name: workspace.name,
|
|
64
74
|
...(workspace.about ? { about: workspace.about } : {}),
|
|
65
|
-
...(workspace.workflow ? { workflow: workspace.workflow } : {}),
|
|
75
|
+
...(workspace.workflow && workspace.workflow !== "interf" ? { workflow: workspace.workflow } : {}),
|
|
66
76
|
...(typeof workspace.max_attempts === "number" ? { max_attempts: workspace.max_attempts } : {}),
|
|
77
|
+
...(typeof workspace.max_loops === "number" ? { max_loops: workspace.max_loops } : {}),
|
|
67
78
|
checks: workspace.checks,
|
|
68
79
|
})),
|
|
69
80
|
};
|
|
70
81
|
}
|
|
71
82
|
return {};
|
|
72
83
|
}
|
|
84
|
+
export function saveSourceFolderConfig(sourcePath, config) {
|
|
85
|
+
writeFileSync(sourceConfigPath(sourcePath), JSON.stringify(toWritableSourceFolderConfig(config), null, 2) + "\n");
|
|
86
|
+
}
|
|
73
87
|
export function appendSourceWorkspaceChecks(sourcePath, workspaceName, checks) {
|
|
74
88
|
const existing = loadSourceFolderConfig(sourcePath);
|
|
75
89
|
const currentWorkspace = findSourceWorkspaceConfig(existing, workspaceName);
|
|
@@ -84,6 +98,9 @@ export function appendSourceWorkspaceChecks(sourcePath, workspaceName, checks) {
|
|
|
84
98
|
...(typeof currentWorkspace?.max_attempts === "number"
|
|
85
99
|
? { max_attempts: currentWorkspace.max_attempts }
|
|
86
100
|
: {}),
|
|
101
|
+
...(typeof currentWorkspace?.max_loops === "number"
|
|
102
|
+
? { max_loops: currentWorkspace.max_loops }
|
|
103
|
+
: {}),
|
|
87
104
|
checks: [...currentChecks, ...checks],
|
|
88
105
|
},
|
|
89
106
|
...otherWorkspaces,
|
|
@@ -110,7 +127,86 @@ export function workspaceMaxAttempts(maxAttempts) {
|
|
|
110
127
|
return undefined;
|
|
111
128
|
return resolveWorkspaceCompileMaxAttempts({ max_attempts: maxAttempts }, null) ?? 1;
|
|
112
129
|
}
|
|
113
|
-
export function
|
|
130
|
+
export function workspaceMaxLoops(maxLoops) {
|
|
131
|
+
if (maxLoops == null)
|
|
132
|
+
return undefined;
|
|
133
|
+
return resolveWorkspaceCompileMaxLoops({ max_loops: maxLoops }, null) ?? 1;
|
|
134
|
+
}
|
|
135
|
+
export function sourceWorkspaceConfigFromInterfConfig(config) {
|
|
136
|
+
return {
|
|
137
|
+
name: config.name,
|
|
138
|
+
...(config.about ? { about: config.about } : {}),
|
|
139
|
+
...(config.workflow ? { workflow: config.workflow } : {}),
|
|
140
|
+
...(typeof config.max_attempts === "number"
|
|
141
|
+
? { max_attempts: config.max_attempts }
|
|
142
|
+
: {}),
|
|
143
|
+
...(typeof config.max_loops === "number"
|
|
144
|
+
? { max_loops: config.max_loops }
|
|
145
|
+
: {}),
|
|
146
|
+
checks: config.checks ?? [],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export function loadWorkspaceControlConfig(workspacePath) {
|
|
150
|
+
const config = readInterfConfig(workspacePath);
|
|
151
|
+
return config ? sourceWorkspaceConfigFromInterfConfig(config) : null;
|
|
152
|
+
}
|
|
153
|
+
export function saveWorkspaceInterfConfig(workspacePath, config) {
|
|
154
|
+
mkdirSync(workspaceInterfRoot(workspacePath), { recursive: true });
|
|
155
|
+
writeFileSync(workspaceInterfConfigPath(workspacePath), JSON.stringify(config, null, 2) + "\n");
|
|
156
|
+
return config;
|
|
157
|
+
}
|
|
158
|
+
export function syncWorkspaceInterfConfigFromSourceWorkspaceConfig(workspacePath, workspaceConfig) {
|
|
159
|
+
const current = readInterfConfig(workspacePath);
|
|
160
|
+
const workflowId = workspaceConfig.workflow ?? current?.workflow ?? "interf";
|
|
161
|
+
const workflowChanged = current?.workflow !== undefined && current.workflow !== workflowId;
|
|
162
|
+
const workflowOrigin = workflowChanged || !current?.workflow_origin
|
|
163
|
+
? {
|
|
164
|
+
selected: workflowId,
|
|
165
|
+
local_draft: false,
|
|
166
|
+
}
|
|
167
|
+
: current.workflow_origin;
|
|
168
|
+
const { type: _ignoredType, name: _ignoredName, about: _ignoredAbout, workflow: _ignoredWorkflow, max_attempts: _ignoredMaxAttempts, max_loops: _ignoredMaxLoops, checks: _ignoredChecks, workflow_origin: _ignoredWorkflowOrigin, source: _ignoredSource, ...passthrough } = current ?? {};
|
|
169
|
+
const nextConfig = {
|
|
170
|
+
...passthrough,
|
|
171
|
+
...(!current ? {
|
|
172
|
+
type: "workspace",
|
|
173
|
+
source: {
|
|
174
|
+
path: "./raw",
|
|
175
|
+
},
|
|
176
|
+
} : {}),
|
|
177
|
+
type: "workspace",
|
|
178
|
+
name: workspaceConfig.name,
|
|
179
|
+
...(workspaceConfig.about ? { about: workspaceConfig.about } : {}),
|
|
180
|
+
workflow: workflowId,
|
|
181
|
+
...(typeof workspaceConfig.max_attempts === "number"
|
|
182
|
+
? { max_attempts: workspaceConfig.max_attempts }
|
|
183
|
+
: {}),
|
|
184
|
+
...(typeof workspaceConfig.max_loops === "number"
|
|
185
|
+
? { max_loops: workspaceConfig.max_loops }
|
|
186
|
+
: {}),
|
|
187
|
+
checks: workspaceConfig.checks,
|
|
188
|
+
workflow_origin: workflowOrigin,
|
|
189
|
+
source: {
|
|
190
|
+
path: current?.source?.path ?? "./raw",
|
|
191
|
+
...(current?.source?.control_path
|
|
192
|
+
? { control_path: current.source.control_path }
|
|
193
|
+
: { control_path: defaultControlPathForWorkspace(workspacePath) }),
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
const saved = saveWorkspaceInterfConfig(workspacePath, nextConfig);
|
|
197
|
+
if (workflowChanged) {
|
|
198
|
+
const sourcePath = resolveSourceControlPath(workspacePath);
|
|
199
|
+
const selectedWorkflow = getWorkspaceWorkflow(workflowId, { sourcePath });
|
|
200
|
+
seedWorkspaceWorkflowPackage({
|
|
201
|
+
workspacePath,
|
|
202
|
+
sourcePath,
|
|
203
|
+
workflowId: selectedWorkflow.id,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
refreshWorkspaceBootstrapGuidance(workspacePath);
|
|
207
|
+
return saved;
|
|
208
|
+
}
|
|
209
|
+
export function buildTestSpecFromSourceFolderConfig(options) {
|
|
114
210
|
const { sourcePath, targetName, targetType = "workspace" } = options;
|
|
115
211
|
const config = loadSourceFolderConfig(sourcePath);
|
|
116
212
|
if (!config)
|
|
@@ -127,16 +223,34 @@ export function buildBenchmarkSpecFromSourceFolderConfig(options) {
|
|
|
127
223
|
if (!match || workspaceChecks.length === 0)
|
|
128
224
|
return null;
|
|
129
225
|
const configPath = sourceConfigPath(sourcePath);
|
|
130
|
-
const
|
|
226
|
+
const testId = match.id ?? slugify(match.name);
|
|
131
227
|
return {
|
|
132
|
-
id: targetType === "raw" ? `${
|
|
228
|
+
id: targetType === "raw" ? `${testId}-raw` : testId,
|
|
133
229
|
filePath: targetType === "raw"
|
|
134
230
|
? `${configPath}#workspaces/${match.name}:raw`
|
|
135
231
|
: `${configPath}#workspaces/${match.name}`,
|
|
136
232
|
type: targetType,
|
|
137
233
|
name: match.name,
|
|
138
234
|
description: match.about ?? `Derived from dataset truth checks in ${SOURCE_FOLDER_CONFIG_FILE}`,
|
|
139
|
-
cases:
|
|
235
|
+
cases: normalizeTruthChecks(workspaceChecks),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
export function buildTestSpecFromWorkspaceConfig(options) {
|
|
239
|
+
const { workspacePath, targetType = "workspace" } = options;
|
|
240
|
+
const config = readInterfConfig(workspacePath);
|
|
241
|
+
const workspaceChecks = config?.checks ?? [];
|
|
242
|
+
if (!config || workspaceChecks.length === 0)
|
|
243
|
+
return null;
|
|
244
|
+
const testId = slugify(config.name);
|
|
245
|
+
const configPath = workspaceInterfConfigPath(workspacePath);
|
|
246
|
+
return {
|
|
247
|
+
id: targetType === "raw" ? `${testId}-raw` : testId,
|
|
248
|
+
filePath: targetType === "raw"
|
|
249
|
+
? `${configPath}#checks:raw`
|
|
250
|
+
: `${configPath}#checks:workspace`,
|
|
251
|
+
type: targetType,
|
|
252
|
+
name: config.name,
|
|
253
|
+
description: config.about ?? "Derived from workspace truth checks.",
|
|
254
|
+
cases: normalizeTruthChecks(workspaceChecks),
|
|
140
255
|
};
|
|
141
256
|
}
|
|
142
|
-
//# sourceMappingURL=source-config.js.map
|
|
@@ -2,4 +2,3 @@ import { type WorkspaceHealth, type WorkspaceState, type WorkspaceStage, type Ru
|
|
|
2
2
|
export declare function computeWorkspaceHealth(dirPath: string): WorkspaceHealth;
|
|
3
3
|
export declare function resolveWorkspaceStatus(sourceTotal: number, summarized: number, toSummarize: number, toStructure: number, toShape: number, errors: number, state: WorkspaceState): RuntimeStatus;
|
|
4
4
|
export declare function resolveWorkspaceStage(state: WorkspaceState, sourceTotal: number, summarized: number, toSummarize: number, toStructure: number, toShape: number, errors: number): WorkspaceStage;
|
|
5
|
-
//# sourceMappingURL=state-health.d.ts.map
|
package/dist/lib/state-health.js
CHANGED
|
@@ -5,8 +5,8 @@ import { discoverSourceFiles } from "./discovery.js";
|
|
|
5
5
|
import { readInterfConfig, resolveSourceFolderPath, } from "./interf.js";
|
|
6
6
|
import { loadRuntimeRun } from "./runtime.js";
|
|
7
7
|
import { validateWorkspace } from "./validate.js";
|
|
8
|
-
import { STATE_DIR } from "./util.js";
|
|
9
8
|
import { initWorkspaceState, loadState, } from "./state-io.js";
|
|
9
|
+
import { workspaceRuntimeInventoryPath } from "./workspace-paths.js";
|
|
10
10
|
export function computeWorkspaceHealth(dirPath) {
|
|
11
11
|
const state = {
|
|
12
12
|
...initWorkspaceState(),
|
|
@@ -19,7 +19,7 @@ export function computeWorkspaceHealth(dirPath) {
|
|
|
19
19
|
const sourcePath = resolveSourceFolderPath(dirPath, config);
|
|
20
20
|
const discovery = discoverSourceFiles(sourcePath, dirPath);
|
|
21
21
|
const summariesPresent = existsSync(join(dirPath, "summaries"));
|
|
22
|
-
const inventoryPresent = existsSync(
|
|
22
|
+
const inventoryPresent = existsSync(workspaceRuntimeInventoryPath(dirPath));
|
|
23
23
|
const homePresent = existsSync(join(dirPath, "home.md"));
|
|
24
24
|
const outputs = countOutputFiles(dirPath);
|
|
25
25
|
const outputsPresent = outputs > 0;
|
|
@@ -146,4 +146,3 @@ function countOutputFiles(dirPath) {
|
|
|
146
146
|
join(dirPath, "knowledge", "indexes"),
|
|
147
147
|
].reduce((total, dir) => total + countFilesRecursive(dir), 0);
|
|
148
148
|
}
|
|
149
|
-
//# sourceMappingURL=state-health.js.map
|
package/dist/lib/state-io.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare function saveWorkspaceHealth(dirPath: string, health: WorkspaceHe
|
|
|
6
6
|
export declare function loadWorkspaceViewSpec(dirPath: string): WorkspaceViewSpec | null;
|
|
7
7
|
export declare function saveWorkspaceViewSpec(dirPath: string, viewSpec: WorkspaceViewSpec): void;
|
|
8
8
|
export declare function loadWorkspaceRawSnapshot(dirPath: string): WorkspaceRawSnapshot | null;
|
|
9
|
+
export declare function saveEmptyWorkspaceInventory(dirPath: string): void;
|
|
9
10
|
export declare function initWorkspaceState(): WorkspaceState;
|
|
10
|
-
//# sourceMappingURL=state-io.d.ts.map
|