@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
|
@@ -4,9 +4,11 @@ import { countFilesRecursive, listFilesRecursive } from "./filesystem.js";
|
|
|
4
4
|
import { discoverSourceFiles } from "./discovery.js";
|
|
5
5
|
import { resolveSourceFolderPath } from "./interf.js";
|
|
6
6
|
import { readJsonFileUnchecked } from "./parse.js";
|
|
7
|
+
import { workspaceHomeIsShaped } from "./workspace-home.js";
|
|
7
8
|
import { WorkspaceInventorySchema, WorkspaceStateSchema, } from "./schema.js";
|
|
8
9
|
import { readWorkspaceConfig, validateSynthFiles, countBrokenWikilinks, asNumber, isOutputMarkdownFile, } from "./validate.js";
|
|
9
10
|
import { readInventoryFiles, readInventoryTotal, } from "./validate-helpers.js";
|
|
11
|
+
import { workspaceInterfConfigPath, workspaceRuntimeRoot, } from "./workspace-paths.js";
|
|
10
12
|
export function validateWorkspace(dirPath) {
|
|
11
13
|
const config = readWorkspaceConfig(dirPath);
|
|
12
14
|
const summaryFiles = listFilesRecursive(join(dirPath, "summaries"), isOutputMarkdownFile);
|
|
@@ -32,8 +34,9 @@ export function validateWorkspaceSummarize(dirPath) {
|
|
|
32
34
|
const summaryFiles = listFilesRecursive(join(dirPath, "summaries"), isOutputMarkdownFile);
|
|
33
35
|
const summaryValidation = validateSynthFiles(summaryFiles);
|
|
34
36
|
const summarized = summaryFiles.length;
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
+
const runtimeRoot = workspaceRuntimeRoot(dirPath);
|
|
38
|
+
const statePath = join(runtimeRoot, "state.json");
|
|
39
|
+
const inventoryPath = join(runtimeRoot, "inventory.json");
|
|
37
40
|
const statePresent = existsSync(statePath);
|
|
38
41
|
const inventoryPresent = existsSync(inventoryPath);
|
|
39
42
|
const state = statePresent
|
|
@@ -69,21 +72,21 @@ export function validateWorkspaceSummarize(dirPath) {
|
|
|
69
72
|
};
|
|
70
73
|
const errors = [];
|
|
71
74
|
if (!checks.config_present)
|
|
72
|
-
errors.push(
|
|
75
|
+
errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
|
|
73
76
|
else if (!checks.config_valid)
|
|
74
|
-
errors.push(
|
|
77
|
+
errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
|
|
75
78
|
else if (!checks.config_type_match)
|
|
76
79
|
errors.push("Config is not a workspace.");
|
|
77
80
|
if (required && !checks.summaries_present)
|
|
78
81
|
errors.push("Missing summaries/ directory.");
|
|
79
82
|
if (required && !checks.state_present)
|
|
80
|
-
errors.push("Missing .interf/state.json.");
|
|
83
|
+
errors.push("Missing .interf/runtime/state.json.");
|
|
81
84
|
else if (required && !checks.state_valid)
|
|
82
|
-
errors.push("Could not parse .interf/state.json.");
|
|
85
|
+
errors.push("Could not parse .interf/runtime/state.json.");
|
|
83
86
|
if (required && !checks.inventory_present)
|
|
84
|
-
errors.push("Missing .interf/inventory.json.");
|
|
87
|
+
errors.push("Missing .interf/runtime/inventory.json.");
|
|
85
88
|
else if (required && !checks.inventory_valid)
|
|
86
|
-
errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
|
|
89
|
+
errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
|
|
87
90
|
if (required && checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
|
|
88
91
|
errors.push("state.json does not mark inventory_complete.");
|
|
89
92
|
}
|
|
@@ -126,8 +129,9 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
126
129
|
const summarizeValidation = validateWorkspaceSummarize(dirPath);
|
|
127
130
|
const structureValidation = validateWorkspaceStructure(dirPath);
|
|
128
131
|
const config = readWorkspaceConfig(dirPath);
|
|
129
|
-
const
|
|
130
|
-
const
|
|
132
|
+
const runtimeRoot = workspaceRuntimeRoot(dirPath);
|
|
133
|
+
const statePath = join(runtimeRoot, "state.json");
|
|
134
|
+
const inventoryPath = join(runtimeRoot, "inventory.json");
|
|
131
135
|
const statePresent = existsSync(statePath);
|
|
132
136
|
const inventoryPresent = existsSync(inventoryPath);
|
|
133
137
|
const state = statePresent
|
|
@@ -169,6 +173,7 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
169
173
|
const indexFiles = countFilesRecursive(join(dirPath, "knowledge", "indexes"));
|
|
170
174
|
const outputs = entityFiles + claimFiles + indexFiles;
|
|
171
175
|
const homePresent = existsSync(join(dirPath, "home.md"));
|
|
176
|
+
const homeShaped = workspaceHomeIsShaped(dirPath);
|
|
172
177
|
const brokenLinks = countBrokenWikilinks(dirPath, [join(dirPath, "summaries"), join(dirPath, "knowledge"), join(dirPath, "home.md")], [join(dirPath, "summaries"), join(dirPath, "knowledge"), join(dirPath, "home.md")]);
|
|
173
178
|
const required = structureValidation.required || homePresent || shaped > 0 || compiled > 0 || inventoryPresent;
|
|
174
179
|
const checks = {
|
|
@@ -195,13 +200,14 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
195
200
|
state.last_compile.length > 0,
|
|
196
201
|
outputs_present: outputs > 0,
|
|
197
202
|
home_present: homePresent,
|
|
203
|
+
home_shaped: homeShaped,
|
|
198
204
|
links_valid: brokenLinks === 0,
|
|
199
205
|
};
|
|
200
206
|
const errors = [];
|
|
201
207
|
if (!checks.config_present)
|
|
202
|
-
errors.push(
|
|
208
|
+
errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
|
|
203
209
|
else if (!checks.config_valid)
|
|
204
|
-
errors.push(
|
|
210
|
+
errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
|
|
205
211
|
else if (!checks.config_type_match)
|
|
206
212
|
errors.push("Config is not a workspace.");
|
|
207
213
|
if (!checks.summarize_complete)
|
|
@@ -209,13 +215,13 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
209
215
|
if (!checks.structure_complete)
|
|
210
216
|
errors.push("Workspace structure is incomplete or invalid.");
|
|
211
217
|
if (!checks.state_present)
|
|
212
|
-
errors.push("Missing .interf/state.json.");
|
|
218
|
+
errors.push("Missing .interf/runtime/state.json.");
|
|
213
219
|
else if (!checks.state_valid)
|
|
214
|
-
errors.push("Could not parse .interf/state.json.");
|
|
220
|
+
errors.push("Could not parse .interf/runtime/state.json.");
|
|
215
221
|
if (!checks.inventory_present)
|
|
216
|
-
errors.push("Missing .interf/inventory.json.");
|
|
222
|
+
errors.push("Missing .interf/runtime/inventory.json.");
|
|
217
223
|
else if (!checks.inventory_valid)
|
|
218
|
-
errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
|
|
224
|
+
errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
|
|
219
225
|
if (checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
|
|
220
226
|
errors.push("state.json does not mark inventory_complete.");
|
|
221
227
|
}
|
|
@@ -238,6 +244,9 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
238
244
|
errors.push("Workspace compile outputs are missing or empty.");
|
|
239
245
|
if (!checks.home_present)
|
|
240
246
|
errors.push("Workspace home.md is missing.");
|
|
247
|
+
if (checks.home_present && !checks.home_shaped) {
|
|
248
|
+
errors.push("Workspace home.md still contains the uncompiled scaffold placeholder.");
|
|
249
|
+
}
|
|
241
250
|
if (!checks.links_valid)
|
|
242
251
|
errors.push("Some knowledge notes contain broken wikilinks.");
|
|
243
252
|
const ok = required ? errors.length === 0 : true;
|
|
@@ -272,8 +281,9 @@ export function validateWorkspaceCompile(dirPath) {
|
|
|
272
281
|
export function validateWorkspaceStructure(dirPath) {
|
|
273
282
|
const summarizeValidation = validateWorkspaceSummarize(dirPath);
|
|
274
283
|
const config = readWorkspaceConfig(dirPath);
|
|
275
|
-
const
|
|
276
|
-
const
|
|
284
|
+
const runtimeRoot = workspaceRuntimeRoot(dirPath);
|
|
285
|
+
const statePath = join(runtimeRoot, "state.json");
|
|
286
|
+
const inventoryPath = join(runtimeRoot, "inventory.json");
|
|
277
287
|
const statePresent = existsSync(statePath);
|
|
278
288
|
const inventoryPresent = existsSync(inventoryPath);
|
|
279
289
|
const state = statePresent
|
|
@@ -335,21 +345,21 @@ export function validateWorkspaceStructure(dirPath) {
|
|
|
335
345
|
};
|
|
336
346
|
const errors = [];
|
|
337
347
|
if (!checks.config_present)
|
|
338
|
-
errors.push(
|
|
348
|
+
errors.push(`Missing ${workspaceInterfConfigPath(dirPath)}.`);
|
|
339
349
|
else if (!checks.config_valid)
|
|
340
|
-
errors.push(
|
|
350
|
+
errors.push(`Could not parse ${workspaceInterfConfigPath(dirPath)}.`);
|
|
341
351
|
else if (!checks.config_type_match)
|
|
342
352
|
errors.push("Config is not a workspace.");
|
|
343
353
|
if (!checks.summarize_complete)
|
|
344
354
|
errors.push("Workspace summarize is incomplete or invalid.");
|
|
345
355
|
if (!checks.state_present)
|
|
346
|
-
errors.push("Missing .interf/state.json.");
|
|
356
|
+
errors.push("Missing .interf/runtime/state.json.");
|
|
347
357
|
else if (!checks.state_valid)
|
|
348
|
-
errors.push("Could not parse .interf/state.json.");
|
|
358
|
+
errors.push("Could not parse .interf/runtime/state.json.");
|
|
349
359
|
if (!checks.inventory_present)
|
|
350
|
-
errors.push("Missing .interf/inventory.json.");
|
|
360
|
+
errors.push("Missing .interf/runtime/inventory.json.");
|
|
351
361
|
else if (!checks.inventory_valid)
|
|
352
|
-
errors.push("Could not parse .interf/inventory.json or it has the wrong shape.");
|
|
362
|
+
errors.push("Could not parse .interf/runtime/inventory.json or it has the wrong shape.");
|
|
353
363
|
if (checks.inventory_present && checks.inventory_valid && !checks.inventory_complete) {
|
|
354
364
|
errors.push("state.json does not mark inventory_complete.");
|
|
355
365
|
}
|
|
@@ -395,4 +405,3 @@ export function validateWorkspaceStructure(dirPath) {
|
|
|
395
405
|
errors,
|
|
396
406
|
};
|
|
397
407
|
}
|
|
398
|
-
//# sourceMappingURL=validate-workspace.js.map
|
package/dist/lib/validate.d.ts
CHANGED
|
@@ -15,4 +15,3 @@ export declare function isOutputMarkdownFile(filePath: string): boolean;
|
|
|
15
15
|
export declare function safeReadText(filePath: string): string | null;
|
|
16
16
|
export { validateWorkspace, validateWorkspaceSummarize, validateWorkspaceStructure, validateWorkspaceCompile, } from "./validate-workspace.js";
|
|
17
17
|
export type { WorkspaceValidationSummary, WorkspaceSummarizeValidation, WorkspaceStructureValidation, WorkspaceCompileValidation, } from "./validate-workspace.js";
|
|
18
|
-
//# sourceMappingURL=validate.d.ts.map
|
package/dist/lib/validate.js
CHANGED
|
@@ -3,6 +3,7 @@ import { basename, extname, join } from "node:path";
|
|
|
3
3
|
import { listFilesRecursive } from "./filesystem.js";
|
|
4
4
|
import { readInterfConfig } from "./interf.js";
|
|
5
5
|
import { parseJsonFrontmatter } from "./parse.js";
|
|
6
|
+
import { workspaceInterfConfigPath } from "./workspace-paths.js";
|
|
6
7
|
const REQUIRED_DIGEST_FIELDS = [
|
|
7
8
|
"source_kind",
|
|
8
9
|
"evidence_tier",
|
|
@@ -11,8 +12,10 @@ const REQUIRED_DIGEST_FIELDS = [
|
|
|
11
12
|
];
|
|
12
13
|
const MIN_ABSTRACT_WORDS = 5;
|
|
13
14
|
const WIKILINK_PATTERN = /!?\[\[([^[\]]+)\]\]/g;
|
|
15
|
+
const KNOWLEDGE_RELATIVE_PREFIXES = new Set(["entities", "claims", "indexes"]);
|
|
14
16
|
export function readWorkspaceConfig(dirPath) {
|
|
15
|
-
const configPath =
|
|
17
|
+
const configPath = workspaceInterfConfigPath(dirPath);
|
|
18
|
+
const value = readInterfConfig(dirPath);
|
|
16
19
|
const present = existsSync(configPath);
|
|
17
20
|
if (!present) {
|
|
18
21
|
return {
|
|
@@ -22,7 +25,6 @@ export function readWorkspaceConfig(dirPath) {
|
|
|
22
25
|
typeMatch: () => false,
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
|
-
const value = readInterfConfig(dirPath);
|
|
26
28
|
return {
|
|
27
29
|
present: true,
|
|
28
30
|
valid: value !== null,
|
|
@@ -57,7 +59,9 @@ export function validateSynthFiles(files) {
|
|
|
57
59
|
export function countBrokenWikilinks(workspaceRoot, noteIndexRoots, linkScanRoots) {
|
|
58
60
|
const noteIndex = new Set();
|
|
59
61
|
for (const filePath of dedupeFiles(noteIndexRoots)) {
|
|
60
|
-
|
|
62
|
+
for (const target of collectWikilinkTargets(filePath)) {
|
|
63
|
+
noteIndex.add(target.toLowerCase());
|
|
64
|
+
}
|
|
61
65
|
}
|
|
62
66
|
let brokenLinks = 0;
|
|
63
67
|
for (const filePath of dedupeFiles(linkScanRoots)) {
|
|
@@ -73,11 +77,7 @@ export function countBrokenWikilinks(workspaceRoot, noteIndexRoots, linkScanRoot
|
|
|
73
77
|
if (!target)
|
|
74
78
|
continue;
|
|
75
79
|
if (target.includes("/")) {
|
|
76
|
-
|
|
77
|
-
const markdownPath = directPath.endsWith(".md")
|
|
78
|
-
? directPath
|
|
79
|
-
: `${directPath}.md`;
|
|
80
|
-
if (!existsSync(directPath) && !existsSync(markdownPath)) {
|
|
80
|
+
if (!wikilinkPathExists(workspaceRoot, target)) {
|
|
81
81
|
brokenLinks += 1;
|
|
82
82
|
}
|
|
83
83
|
continue;
|
|
@@ -157,5 +157,51 @@ function countWords(text) {
|
|
|
157
157
|
function noteName(filePath) {
|
|
158
158
|
return basename(filePath, extname(filePath));
|
|
159
159
|
}
|
|
160
|
+
function wikilinkPathExists(workspaceRoot, target) {
|
|
161
|
+
return linkPathCandidates(workspaceRoot, target).some((candidate) => existsSync(candidate));
|
|
162
|
+
}
|
|
163
|
+
function linkPathCandidates(workspaceRoot, target) {
|
|
164
|
+
const candidates = new Set();
|
|
165
|
+
addPathCandidate(candidates, join(workspaceRoot, target));
|
|
166
|
+
const [firstSegment] = target.split("/");
|
|
167
|
+
if (firstSegment && KNOWLEDGE_RELATIVE_PREFIXES.has(firstSegment)) {
|
|
168
|
+
addPathCandidate(candidates, join(workspaceRoot, "knowledge", target));
|
|
169
|
+
}
|
|
170
|
+
return Array.from(candidates);
|
|
171
|
+
}
|
|
172
|
+
function addPathCandidate(candidates, absolutePath) {
|
|
173
|
+
candidates.add(absolutePath);
|
|
174
|
+
if (!absolutePath.endsWith(".md")) {
|
|
175
|
+
candidates.add(`${absolutePath}.md`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function collectWikilinkTargets(filePath) {
|
|
179
|
+
const targets = new Set();
|
|
180
|
+
targets.add(noteName(filePath));
|
|
181
|
+
const content = safeReadText(filePath);
|
|
182
|
+
if (content === null)
|
|
183
|
+
return Array.from(targets);
|
|
184
|
+
const parsed = parseJsonFrontmatter(content);
|
|
185
|
+
const frontmatter = parsed?.frontmatter;
|
|
186
|
+
if (!frontmatter)
|
|
187
|
+
return Array.from(targets);
|
|
188
|
+
addFrontmatterLinkTarget(targets, frontmatter.label);
|
|
189
|
+
addFrontmatterLinkTarget(targets, frontmatter.title);
|
|
190
|
+
addFrontmatterLinkTarget(targets, frontmatter.alias);
|
|
191
|
+
addFrontmatterLinkTarget(targets, frontmatter.aliases);
|
|
192
|
+
return Array.from(targets);
|
|
193
|
+
}
|
|
194
|
+
function addFrontmatterLinkTarget(targets, value) {
|
|
195
|
+
if (typeof value === "string") {
|
|
196
|
+
const trimmed = value.trim();
|
|
197
|
+
if (trimmed.length > 0)
|
|
198
|
+
targets.add(trimmed);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (Array.isArray(value)) {
|
|
202
|
+
for (const entry of value) {
|
|
203
|
+
addFrontmatterLinkTarget(targets, entry);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
160
207
|
export { validateWorkspace, validateWorkspaceSummarize, validateWorkspaceStructure, validateWorkspaceCompile, } from "./validate-workspace.js";
|
|
161
|
-
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
export declare const WORKSPACE_CONTRACT_TYPES: readonly ["workspace-file-evidence", "workspace-knowledge-structure", "workspace-query-shape"];
|
|
2
|
+
export type WorkspaceContractType = typeof WORKSPACE_CONTRACT_TYPES[number];
|
|
3
|
+
export declare const WORKSPACE_ZONE_KINDS: readonly ["directory", "file", "runtime"];
|
|
4
|
+
export type WorkspaceZoneKind = typeof WORKSPACE_ZONE_KINDS[number];
|
|
5
|
+
export declare const WORKSPACE_CONTRACT_FAMILY_METADATA: {
|
|
6
|
+
readonly "workspace-file-evidence": {
|
|
7
|
+
readonly order: 0;
|
|
8
|
+
readonly bundledSkill: "compile/stages/summarize";
|
|
9
|
+
};
|
|
10
|
+
readonly "workspace-knowledge-structure": {
|
|
11
|
+
readonly order: 1;
|
|
12
|
+
readonly bundledSkill: "compile/stages/structure";
|
|
13
|
+
};
|
|
14
|
+
readonly "workspace-query-shape": {
|
|
15
|
+
readonly order: 2;
|
|
16
|
+
readonly bundledSkill: "compile/stages/shape";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const BUILTIN_WORKSPACE_STAGE_IDS: {
|
|
20
|
+
readonly SUMMARIZE: "summarize";
|
|
21
|
+
readonly STRUCTURE: "structure";
|
|
22
|
+
readonly SHAPE: "shape";
|
|
23
|
+
};
|
|
24
|
+
export type BuiltinWorkspaceStageId = typeof BUILTIN_WORKSPACE_STAGE_IDS[keyof typeof BUILTIN_WORKSPACE_STAGE_IDS];
|
|
25
|
+
export declare const BUILTIN_WORKSPACE_ZONE_IDS: {
|
|
26
|
+
readonly RAW: "raw";
|
|
27
|
+
readonly SUMMARIES: "summaries";
|
|
28
|
+
readonly KNOWLEDGE_ENTITIES: "knowledge-entities";
|
|
29
|
+
readonly KNOWLEDGE_CLAIMS: "knowledge-claims";
|
|
30
|
+
readonly KNOWLEDGE_INDEXES: "knowledge-indexes";
|
|
31
|
+
readonly HOME: "home";
|
|
32
|
+
readonly RUNTIME: "runtime";
|
|
33
|
+
};
|
|
34
|
+
export type BuiltinWorkspaceZoneId = typeof BUILTIN_WORKSPACE_ZONE_IDS[keyof typeof BUILTIN_WORKSPACE_ZONE_IDS];
|
|
35
|
+
export interface BuiltinWorkspaceZoneSpec {
|
|
36
|
+
id: BuiltinWorkspaceZoneId;
|
|
37
|
+
path: string;
|
|
38
|
+
kind: WorkspaceZoneKind;
|
|
39
|
+
required: true;
|
|
40
|
+
description: string;
|
|
41
|
+
}
|
|
42
|
+
export declare const BUILTIN_WORKSPACE_ZONE_SPECS: readonly [{
|
|
43
|
+
readonly id: "raw";
|
|
44
|
+
readonly path: "raw";
|
|
45
|
+
readonly kind: "directory";
|
|
46
|
+
readonly required: true;
|
|
47
|
+
readonly description: "Workspace-local raw snapshot copied from the dataset for direct evidence and verification.";
|
|
48
|
+
}, {
|
|
49
|
+
readonly id: "summaries";
|
|
50
|
+
readonly path: "summaries";
|
|
51
|
+
readonly kind: "directory";
|
|
52
|
+
readonly required: true;
|
|
53
|
+
readonly description: "Per-file evidence notes produced by file-evidence stages.";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "knowledge-entities";
|
|
56
|
+
readonly path: "knowledge/entities";
|
|
57
|
+
readonly kind: "directory";
|
|
58
|
+
readonly required: true;
|
|
59
|
+
readonly description: "Canonical entity notes produced by knowledge-structure stages.";
|
|
60
|
+
}, {
|
|
61
|
+
readonly id: "knowledge-claims";
|
|
62
|
+
readonly path: "knowledge/claims";
|
|
63
|
+
readonly kind: "directory";
|
|
64
|
+
readonly required: true;
|
|
65
|
+
readonly description: "Claim notes produced by knowledge-structure stages.";
|
|
66
|
+
}, {
|
|
67
|
+
readonly id: "knowledge-indexes";
|
|
68
|
+
readonly path: "knowledge/indexes";
|
|
69
|
+
readonly kind: "directory";
|
|
70
|
+
readonly required: true;
|
|
71
|
+
readonly description: "Retrieval indexes and navigation notes produced by structure and shape stages.";
|
|
72
|
+
}, {
|
|
73
|
+
readonly id: "home";
|
|
74
|
+
readonly path: "home.md";
|
|
75
|
+
readonly kind: "file";
|
|
76
|
+
readonly required: true;
|
|
77
|
+
readonly description: "Primary entrypoint note for agents using the compiled workspace.";
|
|
78
|
+
}, {
|
|
79
|
+
readonly id: "runtime";
|
|
80
|
+
readonly path: ".interf/runtime";
|
|
81
|
+
readonly kind: "runtime";
|
|
82
|
+
readonly required: true;
|
|
83
|
+
readonly description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.";
|
|
84
|
+
}];
|
|
85
|
+
export interface BuiltinWorkspaceStageAccessPattern {
|
|
86
|
+
id: BuiltinWorkspaceStageId;
|
|
87
|
+
label: string;
|
|
88
|
+
description: string;
|
|
89
|
+
contractType: WorkspaceContractType;
|
|
90
|
+
skillDir: string;
|
|
91
|
+
reads: readonly BuiltinWorkspaceZoneId[];
|
|
92
|
+
writes: readonly BuiltinWorkspaceZoneId[];
|
|
93
|
+
}
|
|
94
|
+
export declare const BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS: readonly [{
|
|
95
|
+
readonly id: "summarize";
|
|
96
|
+
readonly label: "Summarize";
|
|
97
|
+
readonly description: "Turn source files into per-file summaries.";
|
|
98
|
+
readonly contractType: "workspace-file-evidence";
|
|
99
|
+
readonly skillDir: "summarize";
|
|
100
|
+
readonly reads: readonly ["raw", "runtime"];
|
|
101
|
+
readonly writes: readonly ["summaries"];
|
|
102
|
+
}, {
|
|
103
|
+
readonly id: "structure";
|
|
104
|
+
readonly label: "Structure";
|
|
105
|
+
readonly description: "Build the cross-file knowledge structure from the summaries.";
|
|
106
|
+
readonly contractType: "workspace-knowledge-structure";
|
|
107
|
+
readonly skillDir: "structure";
|
|
108
|
+
readonly reads: readonly ["summaries", "runtime"];
|
|
109
|
+
readonly writes: readonly ["knowledge-entities", "knowledge-claims", "knowledge-indexes"];
|
|
110
|
+
}, {
|
|
111
|
+
readonly id: "shape";
|
|
112
|
+
readonly label: "Shape";
|
|
113
|
+
readonly description: "Shape the final workspace around the saved focus and truth checks.";
|
|
114
|
+
readonly contractType: "workspace-query-shape";
|
|
115
|
+
readonly skillDir: "shape";
|
|
116
|
+
readonly reads: readonly ["raw", "summaries", "knowledge-entities", "knowledge-claims", "knowledge-indexes", "runtime"];
|
|
117
|
+
readonly writes: readonly ["knowledge-indexes", "home"];
|
|
118
|
+
}];
|
|
119
|
+
export declare function workspaceContractOrder(contractType: WorkspaceContractType): number;
|
|
120
|
+
export declare function workspaceBundledSkillForContractType(contractType: WorkspaceContractType): string;
|
|
121
|
+
export declare function hasValidWorkspaceContractSequence(contractTypes: readonly WorkspaceContractType[]): boolean;
|
|
122
|
+
export declare function listMissingWorkspaceContractTypes(contractTypes: readonly string[]): WorkspaceContractType[];
|
|
123
|
+
export declare function validateWorkspaceContractSequence(contractTypes: readonly WorkspaceContractType[]): {
|
|
124
|
+
ok: boolean;
|
|
125
|
+
orderValid: boolean;
|
|
126
|
+
missing: WorkspaceContractType[];
|
|
127
|
+
};
|
|
128
|
+
export declare function listBuiltinWorkspaceZoneSpecs(): BuiltinWorkspaceZoneSpec[];
|
|
129
|
+
export declare function listBuiltinWorkspaceFallbackStages(): Array<{
|
|
130
|
+
id: BuiltinWorkspaceStageId;
|
|
131
|
+
contract_type: WorkspaceContractType;
|
|
132
|
+
reads: BuiltinWorkspaceZoneId[];
|
|
133
|
+
writes: BuiltinWorkspaceZoneId[];
|
|
134
|
+
}>;
|
|
135
|
+
export declare function requiredWorkspaceZoneOwners<TStage extends {
|
|
136
|
+
id: string;
|
|
137
|
+
contractType: WorkspaceContractType;
|
|
138
|
+
}>(stages: readonly TStage[], zoneId: BuiltinWorkspaceZoneId): string[];
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
export const WORKSPACE_CONTRACT_TYPES = [
|
|
2
|
+
"workspace-file-evidence",
|
|
3
|
+
"workspace-knowledge-structure",
|
|
4
|
+
"workspace-query-shape",
|
|
5
|
+
];
|
|
6
|
+
export const WORKSPACE_ZONE_KINDS = [
|
|
7
|
+
"directory",
|
|
8
|
+
"file",
|
|
9
|
+
"runtime",
|
|
10
|
+
];
|
|
11
|
+
export const WORKSPACE_CONTRACT_FAMILY_METADATA = {
|
|
12
|
+
"workspace-file-evidence": {
|
|
13
|
+
order: 0,
|
|
14
|
+
bundledSkill: "compile/stages/summarize",
|
|
15
|
+
},
|
|
16
|
+
"workspace-knowledge-structure": {
|
|
17
|
+
order: 1,
|
|
18
|
+
bundledSkill: "compile/stages/structure",
|
|
19
|
+
},
|
|
20
|
+
"workspace-query-shape": {
|
|
21
|
+
order: 2,
|
|
22
|
+
bundledSkill: "compile/stages/shape",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const BUILTIN_WORKSPACE_STAGE_IDS = {
|
|
26
|
+
SUMMARIZE: "summarize",
|
|
27
|
+
STRUCTURE: "structure",
|
|
28
|
+
SHAPE: "shape",
|
|
29
|
+
};
|
|
30
|
+
export const BUILTIN_WORKSPACE_ZONE_IDS = {
|
|
31
|
+
RAW: "raw",
|
|
32
|
+
SUMMARIES: "summaries",
|
|
33
|
+
KNOWLEDGE_ENTITIES: "knowledge-entities",
|
|
34
|
+
KNOWLEDGE_CLAIMS: "knowledge-claims",
|
|
35
|
+
KNOWLEDGE_INDEXES: "knowledge-indexes",
|
|
36
|
+
HOME: "home",
|
|
37
|
+
RUNTIME: "runtime",
|
|
38
|
+
};
|
|
39
|
+
export const BUILTIN_WORKSPACE_ZONE_SPECS = [
|
|
40
|
+
{
|
|
41
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.RAW,
|
|
42
|
+
path: "raw",
|
|
43
|
+
kind: "directory",
|
|
44
|
+
required: true,
|
|
45
|
+
description: "Workspace-local raw snapshot copied from the dataset for direct evidence and verification.",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
49
|
+
path: "summaries",
|
|
50
|
+
kind: "directory",
|
|
51
|
+
required: true,
|
|
52
|
+
description: "Per-file evidence notes produced by file-evidence stages.",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
56
|
+
path: "knowledge/entities",
|
|
57
|
+
kind: "directory",
|
|
58
|
+
required: true,
|
|
59
|
+
description: "Canonical entity notes produced by knowledge-structure stages.",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
63
|
+
path: "knowledge/claims",
|
|
64
|
+
kind: "directory",
|
|
65
|
+
required: true,
|
|
66
|
+
description: "Claim notes produced by knowledge-structure stages.",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
70
|
+
path: "knowledge/indexes",
|
|
71
|
+
kind: "directory",
|
|
72
|
+
required: true,
|
|
73
|
+
description: "Retrieval indexes and navigation notes produced by structure and shape stages.",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.HOME,
|
|
77
|
+
path: "home.md",
|
|
78
|
+
kind: "file",
|
|
79
|
+
required: true,
|
|
80
|
+
description: "Primary entrypoint note for agents using the compiled workspace.",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
84
|
+
path: ".interf/runtime",
|
|
85
|
+
kind: "runtime",
|
|
86
|
+
required: true,
|
|
87
|
+
description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
export const BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS = [
|
|
91
|
+
{
|
|
92
|
+
id: BUILTIN_WORKSPACE_STAGE_IDS.SUMMARIZE,
|
|
93
|
+
label: "Summarize",
|
|
94
|
+
description: "Turn source files into per-file summaries.",
|
|
95
|
+
contractType: "workspace-file-evidence",
|
|
96
|
+
skillDir: "summarize",
|
|
97
|
+
reads: [
|
|
98
|
+
BUILTIN_WORKSPACE_ZONE_IDS.RAW,
|
|
99
|
+
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
100
|
+
],
|
|
101
|
+
writes: [
|
|
102
|
+
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: BUILTIN_WORKSPACE_STAGE_IDS.STRUCTURE,
|
|
107
|
+
label: "Structure",
|
|
108
|
+
description: "Build the cross-file knowledge structure from the summaries.",
|
|
109
|
+
contractType: "workspace-knowledge-structure",
|
|
110
|
+
skillDir: "structure",
|
|
111
|
+
reads: [
|
|
112
|
+
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
113
|
+
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
114
|
+
],
|
|
115
|
+
writes: [
|
|
116
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
117
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
118
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: BUILTIN_WORKSPACE_STAGE_IDS.SHAPE,
|
|
123
|
+
label: "Shape",
|
|
124
|
+
description: "Shape the final workspace around the saved focus and truth checks.",
|
|
125
|
+
contractType: "workspace-query-shape",
|
|
126
|
+
skillDir: "shape",
|
|
127
|
+
reads: [
|
|
128
|
+
BUILTIN_WORKSPACE_ZONE_IDS.RAW,
|
|
129
|
+
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
130
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
131
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
132
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
133
|
+
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
134
|
+
],
|
|
135
|
+
writes: [
|
|
136
|
+
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
137
|
+
BUILTIN_WORKSPACE_ZONE_IDS.HOME,
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
export function workspaceContractOrder(contractType) {
|
|
142
|
+
return WORKSPACE_CONTRACT_FAMILY_METADATA[contractType].order;
|
|
143
|
+
}
|
|
144
|
+
export function workspaceBundledSkillForContractType(contractType) {
|
|
145
|
+
return WORKSPACE_CONTRACT_FAMILY_METADATA[contractType].bundledSkill;
|
|
146
|
+
}
|
|
147
|
+
export function hasValidWorkspaceContractSequence(contractTypes) {
|
|
148
|
+
return contractTypes.every((contractType, index) => index === 0 ||
|
|
149
|
+
workspaceContractOrder(contractType) >= workspaceContractOrder(contractTypes[index - 1]));
|
|
150
|
+
}
|
|
151
|
+
export function listMissingWorkspaceContractTypes(contractTypes) {
|
|
152
|
+
return WORKSPACE_CONTRACT_TYPES.filter((contractType) => !contractTypes.includes(contractType));
|
|
153
|
+
}
|
|
154
|
+
export function validateWorkspaceContractSequence(contractTypes) {
|
|
155
|
+
const missing = listMissingWorkspaceContractTypes(contractTypes);
|
|
156
|
+
const orderValid = hasValidWorkspaceContractSequence(contractTypes);
|
|
157
|
+
return {
|
|
158
|
+
ok: missing.length === 0 && orderValid,
|
|
159
|
+
orderValid,
|
|
160
|
+
missing,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
export function listBuiltinWorkspaceZoneSpecs() {
|
|
164
|
+
return BUILTIN_WORKSPACE_ZONE_SPECS.map((zone) => ({ ...zone }));
|
|
165
|
+
}
|
|
166
|
+
export function listBuiltinWorkspaceFallbackStages() {
|
|
167
|
+
return BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS.map((stage) => ({
|
|
168
|
+
id: stage.id,
|
|
169
|
+
contract_type: stage.contractType,
|
|
170
|
+
reads: [...stage.reads],
|
|
171
|
+
writes: [...stage.writes],
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
export function requiredWorkspaceZoneOwners(stages, zoneId) {
|
|
175
|
+
const writerContractTypes = new Set(BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS
|
|
176
|
+
.filter((stage) => stage.writes.includes(zoneId))
|
|
177
|
+
.map((stage) => stage.contractType));
|
|
178
|
+
return Array.from(new Set(stages
|
|
179
|
+
.filter((stage) => writerContractTypes.has(stage.contractType))
|
|
180
|
+
.map((stage) => stage.id)));
|
|
181
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RuntimeContractType, RuntimeStageAcceptance, WorkflowCompilerApi, WorkflowId, WorkflowZoneId } from "./schema.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export interface WorkflowStarterDoc {
|
|
3
|
+
relativePath: string;
|
|
4
|
+
content: string;
|
|
4
5
|
}
|
|
5
6
|
export interface WorkflowStageDefinition {
|
|
6
7
|
id: string;
|
|
@@ -24,12 +25,29 @@ export interface WorkflowDefinition<TId extends string> {
|
|
|
24
25
|
scope?: "builtin" | "local";
|
|
25
26
|
}
|
|
26
27
|
export type WorkspaceWorkflowId = string;
|
|
27
|
-
export declare
|
|
28
|
+
export declare function standaloneWorkflowDefinitionFromLocalPackage(local: {
|
|
29
|
+
id: string;
|
|
30
|
+
compiler_api?: WorkflowCompilerApi;
|
|
31
|
+
label: string;
|
|
32
|
+
hint: string;
|
|
33
|
+
stages?: Array<{
|
|
34
|
+
id: string;
|
|
35
|
+
label: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
contract_type: RuntimeContractType;
|
|
38
|
+
skill_dir?: string;
|
|
39
|
+
reads: WorkflowZoneId[];
|
|
40
|
+
writes: WorkflowZoneId[];
|
|
41
|
+
acceptance?: RuntimeStageAcceptance;
|
|
42
|
+
}>;
|
|
43
|
+
stage_policy_notes?: Record<string, string[]>;
|
|
44
|
+
starter_docs: WorkflowStarterDoc[];
|
|
45
|
+
}): WorkflowDefinition<string>;
|
|
28
46
|
export declare function listWorkspaceWorkflowChoices(sourcePath?: string): WorkflowDefinition<string>[];
|
|
29
47
|
export declare function getWorkspaceWorkflow(workflowId: WorkspaceWorkflowId, options?: {
|
|
30
48
|
sourcePath?: string;
|
|
31
|
-
visited?: Set<string>;
|
|
32
49
|
}): WorkflowDefinition<string>;
|
|
50
|
+
export declare function getActiveWorkspaceWorkflow(workspacePath: string, fallbackWorkflowId: WorkspaceWorkflowId): WorkflowDefinition<string>;
|
|
33
51
|
export declare function resolveWorkspaceWorkflowId(value: unknown): WorkspaceWorkflowId;
|
|
34
52
|
export declare function resolveWorkspaceWorkflowFromConfig(config: unknown): WorkspaceWorkflowId;
|
|
35
53
|
export declare function formatWorkspaceWorkflowStageStep(workflowId: WorkspaceWorkflowId, stage: string, options?: {
|
|
@@ -42,5 +60,8 @@ export declare function getWorkflowStagePosition(workflowId: WorkflowId, stage:
|
|
|
42
60
|
stages: string[];
|
|
43
61
|
} | null;
|
|
44
62
|
export declare function getWorkflowStages(workflowId: WorkflowId, sourcePath?: string): string[];
|
|
63
|
+
export declare function getActiveWorkspaceStages(workspacePath: string, fallbackWorkflowId: WorkflowId): string[];
|
|
45
64
|
export declare function getWorkflowStagePolicyNotes(workflowId: WorkflowId, stage: string, sourcePath?: string): string[];
|
|
46
|
-
|
|
65
|
+
export declare function getActiveWorkspaceStagePolicyNotes(workspacePath: string, fallbackWorkflowId: WorkflowId, stage: string): string[];
|
|
66
|
+
export declare function resolveActiveWorkspaceStageAcceptance(workspacePath: string, fallbackWorkflowId: WorkflowId, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
|
|
67
|
+
export declare function formatActiveWorkspaceWorkflowStageStep(workspacePath: string, fallbackWorkflowId: WorkspaceWorkflowId, stage: string): string;
|