@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
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, } from "node:fs";
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { dirname, join, relative } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
+
import { PACKAGE_ROOT } from "./config.js";
|
|
4
5
|
import { isMarkdownFile } from "./util.js";
|
|
5
6
|
import { listFilesRecursive } from "./filesystem.js";
|
|
6
7
|
import { warnInterf } from "./logger.js";
|
|
7
8
|
import { readJsonFileUnchecked, readJsonFileWithSchema } from "./parse.js";
|
|
9
|
+
import { listBuiltinWorkspaceZoneSpecs, validateWorkspaceContractSequence, } from "./workflow-abi.js";
|
|
8
10
|
import { WorkflowCompilerApiSchema, RuntimeContractTypeSchema, RuntimeStageAcceptanceSchema, WorkflowStageZoneAccessSchema, WorkflowWorkspaceSchemaSchema, WorkflowIdPattern, } from "./schema.js";
|
|
9
|
-
import {
|
|
11
|
+
import { writeWorkspaceSchemaFile, workspaceSchemaFilePath } from "./workspace-schema.js";
|
|
10
12
|
const LocalWorkflowStageDefinitionSchema = z.object({
|
|
11
13
|
id: z.string().regex(WorkflowIdPattern),
|
|
12
14
|
label: z.string().min(1),
|
|
@@ -27,24 +29,31 @@ const LocalWorkflowDefinitionSchema = z.object({
|
|
|
27
29
|
stages: z.array(LocalWorkflowStageDefinitionSchema).min(1).optional(),
|
|
28
30
|
stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
|
|
29
31
|
}).superRefine((value, ctx) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
const stages = value.stages ?? [];
|
|
33
|
+
if (stages.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
const sequence = validateWorkspaceContractSequence(stages.map((stage) => stage.contract_type));
|
|
36
|
+
if (!sequence.orderValid) {
|
|
37
|
+
ctx.addIssue({
|
|
38
|
+
code: z.ZodIssueCode.custom,
|
|
39
|
+
path: ["stages"],
|
|
40
|
+
message: "Workspace workflow stages must keep non-decreasing order: file-evidence -> knowledge-structure -> query-shape.",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
for (const missing of sequence.missing) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: z.ZodIssueCode.custom,
|
|
46
|
+
path: ["stages"],
|
|
47
|
+
message: `Workspace workflows must include at least one ${missing} stage.`,
|
|
48
|
+
});
|
|
43
49
|
}
|
|
44
50
|
});
|
|
45
51
|
function workflowRootPath(sourcePath) {
|
|
46
52
|
return join(sourcePath, "interf", "workflows");
|
|
47
53
|
}
|
|
54
|
+
function builtinWorkflowRootPath(workflowId) {
|
|
55
|
+
return join(PACKAGE_ROOT, "builtin-workflows", workflowId);
|
|
56
|
+
}
|
|
48
57
|
export function workflowDefinitionPath(sourcePath, id) {
|
|
49
58
|
return join(workflowRootPath(sourcePath), id);
|
|
50
59
|
}
|
|
@@ -104,9 +113,162 @@ export function listLocalWorkflowDefinitions(sourcePath) {
|
|
|
104
113
|
export function loadLocalWorkflowDefinition(sourcePath, id) {
|
|
105
114
|
return loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id));
|
|
106
115
|
}
|
|
116
|
+
export function resolveWorkflowPackageSourcePath(sourcePath, workflowId) {
|
|
117
|
+
const builtinPath = builtinWorkflowRootPath(workflowId);
|
|
118
|
+
if (workflowId === "interf" && existsSync(join(builtinPath, "workflow.json")))
|
|
119
|
+
return builtinPath;
|
|
120
|
+
const localPath = workflowDefinitionPath(sourcePath, workflowId);
|
|
121
|
+
if (existsSync(join(localPath, "workflow.json")))
|
|
122
|
+
return localPath;
|
|
123
|
+
if (existsSync(join(builtinPath, "workflow.json")))
|
|
124
|
+
return builtinPath;
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
107
127
|
export function isWorkflowId(value) {
|
|
108
128
|
return WorkflowIdPattern.test(value);
|
|
109
129
|
}
|
|
130
|
+
function normalizeStagePolicyNotes(value) {
|
|
131
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
132
|
+
return undefined;
|
|
133
|
+
const normalized = {};
|
|
134
|
+
for (const [stageId, notes] of Object.entries(value)) {
|
|
135
|
+
if (!Array.isArray(notes))
|
|
136
|
+
continue;
|
|
137
|
+
const cleaned = Array.from(new Set(notes
|
|
138
|
+
.filter((note) => typeof note === "string")
|
|
139
|
+
.map((note) => note.trim())
|
|
140
|
+
.filter((note) => note.length > 0)));
|
|
141
|
+
if (cleaned.length > 0) {
|
|
142
|
+
normalized[stageId] = cleaned;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return Object.keys(normalized).length > 0 ? normalized : undefined;
|
|
146
|
+
}
|
|
147
|
+
function mergeStagePolicyNotes(currentValue, nextValue) {
|
|
148
|
+
const current = normalizeStagePolicyNotes(currentValue);
|
|
149
|
+
if (!nextValue || Object.keys(nextValue).length === 0)
|
|
150
|
+
return current;
|
|
151
|
+
const merged = { ...(current ?? {}) };
|
|
152
|
+
for (const [stageId, notes] of Object.entries(nextValue)) {
|
|
153
|
+
merged[stageId] = Array.from(new Set([
|
|
154
|
+
...(merged[stageId] ?? []),
|
|
155
|
+
...notes.map((note) => note.trim()).filter((note) => note.length > 0),
|
|
156
|
+
]));
|
|
157
|
+
}
|
|
158
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
159
|
+
}
|
|
160
|
+
function readWorkflowJsonObject(dirPath) {
|
|
161
|
+
const workflowPath = join(dirPath, "workflow.json");
|
|
162
|
+
const raw = readJsonFileUnchecked(workflowPath, "workflow package");
|
|
163
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
164
|
+
throw new Error(`Workflow package at ${dirPath} is missing a valid workflow.json.`);
|
|
165
|
+
}
|
|
166
|
+
return { ...raw };
|
|
167
|
+
}
|
|
168
|
+
export function patchWorkflowPackageMetadata(dirPath, options = {}) {
|
|
169
|
+
const workflowPath = join(dirPath, "workflow.json");
|
|
170
|
+
const schemaPath = workspaceSchemaFilePath(dirPath);
|
|
171
|
+
const workflowJson = readWorkflowJsonObject(dirPath);
|
|
172
|
+
const normalizedStages = Array.isArray(workflowJson.stages) && workflowJson.stages.length > 0
|
|
173
|
+
? workflowJson.stages
|
|
174
|
+
: null;
|
|
175
|
+
if (!normalizedStages) {
|
|
176
|
+
throw new Error(`Cannot patch workflow package at ${dirPath}: workflow.json must declare explicit stages before it can be copied or rewritten.`);
|
|
177
|
+
}
|
|
178
|
+
const nextWorkflowJson = {
|
|
179
|
+
...workflowJson,
|
|
180
|
+
type: "workspace",
|
|
181
|
+
compiler_api: workflowJson.compiler_api ?? {
|
|
182
|
+
kind: "workspace",
|
|
183
|
+
version: 1,
|
|
184
|
+
},
|
|
185
|
+
stages: normalizedStages,
|
|
186
|
+
...(options.id ? { id: options.id } : {}),
|
|
187
|
+
...(options.label ? { label: options.label } : {}),
|
|
188
|
+
...(options.hint ? { hint: options.hint } : {}),
|
|
189
|
+
};
|
|
190
|
+
delete nextWorkflowJson.extends;
|
|
191
|
+
const mergedStagePolicyNotes = mergeStagePolicyNotes(workflowJson.stage_policy_notes, options.stagePolicyNotes);
|
|
192
|
+
if (mergedStagePolicyNotes) {
|
|
193
|
+
nextWorkflowJson.stage_policy_notes = mergedStagePolicyNotes;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
delete nextWorkflowJson.stage_policy_notes;
|
|
197
|
+
}
|
|
198
|
+
writeFileSync(workflowPath, JSON.stringify(nextWorkflowJson, null, 2) + "\n");
|
|
199
|
+
const schemaLabel = `${String(nextWorkflowJson.label ?? workflowJson.label ?? options.id ?? "Workflow")} workspace schema`;
|
|
200
|
+
if (!existsSync(schemaPath)) {
|
|
201
|
+
writeWorkspaceSchemaFile(dirPath, normalizedStages, schemaLabel);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const rawSchema = readJsonFileUnchecked(schemaPath, "workspace schema");
|
|
205
|
+
if (!rawSchema || typeof rawSchema !== "object" || Array.isArray(rawSchema))
|
|
206
|
+
return;
|
|
207
|
+
writeFileSync(schemaPath, JSON.stringify({
|
|
208
|
+
...rawSchema,
|
|
209
|
+
label: schemaLabel,
|
|
210
|
+
}, null, 2) + "\n");
|
|
211
|
+
}
|
|
212
|
+
export function describeWorkflowPackagePortability(dirPath) {
|
|
213
|
+
const issues = [];
|
|
214
|
+
const workflowPath = join(dirPath, "workflow.json");
|
|
215
|
+
const schemaPath = workspaceSchemaFilePath(dirPath);
|
|
216
|
+
if (!existsSync(workflowPath))
|
|
217
|
+
issues.push("missing workflow.json");
|
|
218
|
+
if (!existsSync(schemaPath))
|
|
219
|
+
issues.push("missing workspace.schema.json");
|
|
220
|
+
if (!existsSync(join(dirPath, "README.md")))
|
|
221
|
+
issues.push("missing README.md");
|
|
222
|
+
if (!existsSync(join(dirPath, "improve", "SKILL.md")))
|
|
223
|
+
issues.push("missing improve/SKILL.md");
|
|
224
|
+
if (!existsSync(join(dirPath, "use", "query", "SKILL.md")))
|
|
225
|
+
issues.push("missing use/query/SKILL.md");
|
|
226
|
+
if (issues.length > 0)
|
|
227
|
+
return issues;
|
|
228
|
+
let workflowJson;
|
|
229
|
+
try {
|
|
230
|
+
workflowJson = readWorkflowJsonObject(dirPath);
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
issues.push(error instanceof Error ? error.message : String(error));
|
|
234
|
+
return issues;
|
|
235
|
+
}
|
|
236
|
+
const parsed = LocalWorkflowDefinitionSchema.safeParse(workflowJson);
|
|
237
|
+
if (!parsed.success) {
|
|
238
|
+
issues.push(...parsed.error.issues.map((issue) => issue.path.length > 0
|
|
239
|
+
? `workflow.json ${issue.path.join(".")}: ${issue.message}`
|
|
240
|
+
: `workflow.json: ${issue.message}`));
|
|
241
|
+
return issues;
|
|
242
|
+
}
|
|
243
|
+
if (typeof parsed.data.extends === "string" && parsed.data.extends.trim().length > 0) {
|
|
244
|
+
issues.push("workflow.json uses legacy extends; portable workflow packages must be materialized standalone");
|
|
245
|
+
}
|
|
246
|
+
if (!parsed.data.stages || parsed.data.stages.length === 0) {
|
|
247
|
+
issues.push("workflow.json must declare explicit stages for a portable workflow package");
|
|
248
|
+
return issues;
|
|
249
|
+
}
|
|
250
|
+
for (const stage of parsed.data.stages) {
|
|
251
|
+
const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
|
|
252
|
+
? stage.skill_dir
|
|
253
|
+
: stage.id;
|
|
254
|
+
if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
|
|
255
|
+
issues.push(`missing compile/stages/${skillDir}/SKILL.md`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return issues;
|
|
259
|
+
}
|
|
260
|
+
export function isPortableWorkflowPackage(dirPath) {
|
|
261
|
+
return describeWorkflowPackagePortability(dirPath).length === 0;
|
|
262
|
+
}
|
|
263
|
+
export function copyWorkflowPackageDirectory(sourceWorkflowPath, targetWorkflowPath) {
|
|
264
|
+
const portabilityIssues = describeWorkflowPackagePortability(sourceWorkflowPath);
|
|
265
|
+
if (portabilityIssues.length > 0) {
|
|
266
|
+
throw new Error(`Workflow package at ${sourceWorkflowPath} is not directly copyable: ${portabilityIssues.join("; ")}.`);
|
|
267
|
+
}
|
|
268
|
+
rmSync(targetWorkflowPath, { recursive: true, force: true });
|
|
269
|
+
mkdirSync(dirname(targetWorkflowPath), { recursive: true });
|
|
270
|
+
cpSync(sourceWorkflowPath, targetWorkflowPath, { recursive: true });
|
|
271
|
+
}
|
|
110
272
|
export function validateWorkflowPackage(dirPath) {
|
|
111
273
|
const workflowPath = join(dirPath, "workflow.json");
|
|
112
274
|
const schemaPath = workspaceSchemaFilePath(dirPath);
|
|
@@ -139,70 +301,53 @@ export function validateWorkflowPackage(dirPath) {
|
|
|
139
301
|
}
|
|
140
302
|
const def = parsed.data;
|
|
141
303
|
const errors = [];
|
|
304
|
+
if (typeof def.extends === "string" && def.extends.trim().length > 0) {
|
|
305
|
+
errors.push("workflow.json uses legacy extends. Portable workflow packages must be materialized as standalone packages.");
|
|
306
|
+
}
|
|
307
|
+
if (!def.stages || def.stages.length === 0) {
|
|
308
|
+
errors.push("workflow.json must declare explicit stages. Legacy inherited packages are not portable.");
|
|
309
|
+
}
|
|
142
310
|
if (!existsSync(schemaPath)) {
|
|
143
311
|
errors.push("Missing workspace.schema.json.");
|
|
144
312
|
}
|
|
313
|
+
if (!existsSync(join(dirPath, "README.md"))) {
|
|
314
|
+
errors.push("Missing README.md.");
|
|
315
|
+
}
|
|
316
|
+
if (!existsSync(join(dirPath, "improve", "SKILL.md"))) {
|
|
317
|
+
errors.push("Missing improve/SKILL.md.");
|
|
318
|
+
}
|
|
319
|
+
if (!existsSync(join(dirPath, "use", "query", "SKILL.md"))) {
|
|
320
|
+
errors.push("Missing use/query/SKILL.md.");
|
|
321
|
+
}
|
|
145
322
|
const workspaceSchema = readJsonFileWithSchema(schemaPath, "workspace schema", WorkflowWorkspaceSchemaSchema);
|
|
146
323
|
if (!workspaceSchema) {
|
|
147
324
|
errors.push("workspace.schema.json is missing or invalid.");
|
|
148
325
|
}
|
|
149
326
|
if (def.stages && def.stages.length > 0) {
|
|
150
|
-
const order = new Map([
|
|
151
|
-
["workspace-file-evidence", 0],
|
|
152
|
-
["workspace-knowledge-structure", 1],
|
|
153
|
-
["workspace-query-shape", 2],
|
|
154
|
-
]);
|
|
155
327
|
const contractTypes = def.stages.map((stage) => stage.contract_type);
|
|
328
|
+
const sequence = validateWorkspaceContractSequence(contractTypes);
|
|
156
329
|
if (def.stages.length < 3) {
|
|
157
330
|
errors.push("Workspace workflows must include summarize, structure, and shape stages in order.");
|
|
158
331
|
}
|
|
159
|
-
else if (!
|
|
332
|
+
else if (!sequence.orderValid) {
|
|
160
333
|
errors.push("Workspace workflow stages must keep non-decreasing order: file-evidence -> knowledge-structure -> query-shape.");
|
|
161
334
|
}
|
|
162
335
|
else {
|
|
163
|
-
|
|
164
|
-
errors.push(
|
|
336
|
+
for (const missing of sequence.missing) {
|
|
337
|
+
errors.push(`Workspace workflows must include at least one ${missing} stage.`);
|
|
165
338
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
339
|
+
}
|
|
340
|
+
for (const stage of def.stages) {
|
|
341
|
+
const skillDir = typeof stage.skill_dir === "string" && stage.skill_dir.trim().length > 0
|
|
342
|
+
? stage.skill_dir
|
|
343
|
+
: stage.id;
|
|
344
|
+
if (!existsSync(join(dirPath, "compile", "stages", skillDir, "SKILL.md"))) {
|
|
345
|
+
errors.push(`Missing compile/stages/${skillDir}/SKILL.md.`);
|
|
171
346
|
}
|
|
172
347
|
}
|
|
173
348
|
}
|
|
174
349
|
if (workspaceSchema) {
|
|
175
|
-
const
|
|
176
|
-
{
|
|
177
|
-
id: "summarize",
|
|
178
|
-
reads: [BUILTIN_WORKSPACE_ZONE_IDS.RAW, BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME],
|
|
179
|
-
writes: [BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES],
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
id: "structure",
|
|
183
|
-
reads: [BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES, BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME],
|
|
184
|
-
writes: [
|
|
185
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
186
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
187
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
188
|
-
],
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
id: "shape",
|
|
192
|
-
reads: [
|
|
193
|
-
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
194
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
195
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
196
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
197
|
-
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
198
|
-
],
|
|
199
|
-
writes: [
|
|
200
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
201
|
-
BUILTIN_WORKSPACE_ZONE_IDS.HOME,
|
|
202
|
-
],
|
|
203
|
-
},
|
|
204
|
-
];
|
|
205
|
-
const stages = def.stages ?? fallbackStages;
|
|
350
|
+
const stages = def.stages ?? [];
|
|
206
351
|
const stageIds = new Set(stages.map((stage) => stage.id));
|
|
207
352
|
const seenPaths = new Map();
|
|
208
353
|
const seenZoneIds = new Set();
|
|
@@ -255,16 +400,7 @@ export function validateWorkflowPackage(dirPath) {
|
|
|
255
400
|
}
|
|
256
401
|
}
|
|
257
402
|
}
|
|
258
|
-
const
|
|
259
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.RAW, path: "raw", kind: "directory" },
|
|
260
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES, path: "summaries", kind: "directory" },
|
|
261
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES, path: "knowledge/entities", kind: "directory" },
|
|
262
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS, path: "knowledge/claims", kind: "directory" },
|
|
263
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES, path: "knowledge/indexes", kind: "directory" },
|
|
264
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.HOME, path: "home.md", kind: "file" },
|
|
265
|
-
{ id: BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME, path: ".interf", kind: "runtime" },
|
|
266
|
-
];
|
|
267
|
-
for (const requiredZone of requiredZones) {
|
|
403
|
+
for (const requiredZone of listBuiltinWorkspaceZoneSpecs()) {
|
|
268
404
|
const match = zoneById.get(requiredZone.id);
|
|
269
405
|
if (!match) {
|
|
270
406
|
errors.push(`workspace.schema.json is missing required zone "${requiredZone.id}".`);
|
|
@@ -278,7 +414,9 @@ export function validateWorkflowPackage(dirPath) {
|
|
|
278
414
|
}
|
|
279
415
|
}
|
|
280
416
|
}
|
|
281
|
-
const stageDirs =
|
|
417
|
+
const stageDirs = existsSync(join(dirPath, "compile", "stages"))
|
|
418
|
+
? listFilesRecursive(join(dirPath, "compile", "stages"), (filePath) => basename(filePath) === "SKILL.md")
|
|
419
|
+
: [];
|
|
282
420
|
const counts = {
|
|
283
421
|
starter_docs: collectStarterDocs(dirPath).length,
|
|
284
422
|
compile_stage_docs: stageDirs.length,
|
|
@@ -291,33 +429,6 @@ export function validateWorkflowPackage(dirPath) {
|
|
|
291
429
|
counts,
|
|
292
430
|
};
|
|
293
431
|
}
|
|
294
|
-
export function writeLocalWorkflowDefinition(sourcePath, id, workflowJson, docs) {
|
|
295
|
-
const root = workflowDefinitionPath(sourcePath, id);
|
|
296
|
-
mkdirSync(root, { recursive: true });
|
|
297
|
-
const normalizedWorkflowJson = {
|
|
298
|
-
compiler_api: {
|
|
299
|
-
kind: "workspace",
|
|
300
|
-
version: 1,
|
|
301
|
-
},
|
|
302
|
-
...workflowJson,
|
|
303
|
-
};
|
|
304
|
-
writeFileSync(join(root, "workflow.json"), JSON.stringify(normalizedWorkflowJson, null, 2) + "\n");
|
|
305
|
-
const stages = Array.isArray(normalizedWorkflowJson.stages)
|
|
306
|
-
? (normalizedWorkflowJson.stages)
|
|
307
|
-
: [
|
|
308
|
-
{ id: "summarize", contract_type: "workspace-file-evidence" },
|
|
309
|
-
{ id: "structure", contract_type: "workspace-knowledge-structure" },
|
|
310
|
-
{ id: "shape", contract_type: "workspace-query-shape" },
|
|
311
|
-
];
|
|
312
|
-
writeWorkspaceSchemaFile(root, stages, `${String(normalizedWorkflowJson.label ?? id)} workspace schema`);
|
|
313
|
-
for (const doc of docs) {
|
|
314
|
-
const targetPath = join(root, doc.relativePath);
|
|
315
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
316
|
-
writeFileSync(targetPath, doc.content);
|
|
317
|
-
}
|
|
318
|
-
return root;
|
|
319
|
-
}
|
|
320
432
|
function basename(filePath) {
|
|
321
433
|
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
322
434
|
}
|
|
323
|
-
//# sourceMappingURL=local-workflows.js.map
|
package/dist/lib/logger.d.ts
CHANGED
package/dist/lib/logger.js
CHANGED
package/dist/lib/obsidian.d.ts
CHANGED
package/dist/lib/obsidian.js
CHANGED
package/dist/lib/parse.d.ts
CHANGED
package/dist/lib/parse.js
CHANGED
package/dist/lib/registry.d.ts
CHANGED
|
@@ -14,4 +14,3 @@ export declare function listWorkspaceEntries(registry?: Registry): WorkspaceEntr
|
|
|
14
14
|
export declare function addWorkspace(name: string, path: string, workflow: string): void;
|
|
15
15
|
export declare function findWorkspaceByName(name: string): WorkspaceEntry[];
|
|
16
16
|
export declare function findInterf(name: string): WorkspaceEntry | undefined;
|
|
17
|
-
//# sourceMappingURL=registry.d.ts.map
|
package/dist/lib/registry.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { type RuntimeStageContract } from "./schema.js";
|
|
2
2
|
import { type RuntimeStageAcceptanceValidation } from "./runtime-types.js";
|
|
3
3
|
export declare function validateStageContractAcceptance(dirPath: string, contract?: RuntimeStageContract | null): RuntimeStageAcceptanceValidation;
|
|
4
|
-
//# sourceMappingURL=runtime-acceptance.d.ts.map
|
|
@@ -68,7 +68,7 @@ export function validateStageContractAcceptance(dirPath, contract = null) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
const failures = [];
|
|
71
|
-
const state = readWorkspaceJsonFile(dirPath, ".interf/state.json");
|
|
71
|
+
const state = readWorkspaceJsonFile(dirPath, ".interf/runtime/state.json");
|
|
72
72
|
for (const relativePath of acceptance?.artifacts_exist ?? []) {
|
|
73
73
|
if (!existsSync(join(dirPath, relativePath))) {
|
|
74
74
|
failures.push(`Missing required artifact: ${relativePath}.`);
|
|
@@ -120,4 +120,3 @@ export function validateStageContractAcceptance(dirPath, contract = null) {
|
|
|
120
120
|
failures,
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
//# sourceMappingURL=runtime-acceptance.js.map
|
|
@@ -2,4 +2,3 @@ import { type RuntimeStageContractDraft, type WorkspaceKnowledgeContractOptions,
|
|
|
2
2
|
export declare function buildWorkspaceSummarizeContract(options: WorkspaceSummarizeContractOptions): RuntimeStageContractDraft;
|
|
3
3
|
export declare function buildWorkspaceStructureContract(options: WorkspaceKnowledgeContractOptions): RuntimeStageContractDraft;
|
|
4
4
|
export declare function buildWorkspaceShapeContract(options: WorkspaceShapeContractOptions): RuntimeStageContractDraft;
|
|
5
|
-
//# sourceMappingURL=runtime-contracts.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CHART_APPROXIMATION_NOTES } from "./chart-guidance.js";
|
|
1
2
|
export function buildWorkspaceSummarizeContract(options) {
|
|
2
3
|
const localSkillDocs = options.localSkillDocs ?? [];
|
|
3
4
|
const workflowNotes = options.workflowNotes ?? [];
|
|
@@ -14,12 +15,12 @@ export function buildWorkspaceSummarizeContract(options) {
|
|
|
14
15
|
"interf.json",
|
|
15
16
|
options.planPath,
|
|
16
17
|
"workflow/workspace.schema.json",
|
|
17
|
-
".interf/raw-snapshot.json",
|
|
18
|
+
".interf/runtime/raw-snapshot.json",
|
|
18
19
|
...localSkillDocs,
|
|
19
20
|
],
|
|
20
21
|
writes: [
|
|
21
22
|
"summaries/",
|
|
22
|
-
".interf/inventory.json",
|
|
23
|
+
".interf/runtime/inventory.json",
|
|
23
24
|
],
|
|
24
25
|
verifies: [
|
|
25
26
|
"interf verify summarize --json",
|
|
@@ -39,10 +40,10 @@ export function buildWorkspaceSummarizeContract(options) {
|
|
|
39
40
|
"Also include a `## Abstract` section or another clearly labeled abstract block so humans can scan the summary quickly.",
|
|
40
41
|
"Use cautious, source-grounded titles. Summary filenames should describe what the file is or records without overstating uncertain conclusions.",
|
|
41
42
|
"If links are added, keep them minimal and source-grounded.",
|
|
42
|
-
"Do not precreate `.interf/inventory.json` with placeholder writes. Write the final JSON document directly.",
|
|
43
|
-
"When updating `.interf/inventory.json`, rewrite the full JSON document in one whole-file write instead of patching partial lines.",
|
|
44
|
-
"The CLI reconciles `.interf/state.json` and refreshes `.interf/health.json` after stage validation. Do not treat those files as stage-owned write targets for this stage.",
|
|
45
|
-
"Prefer the current inventory runtime shape: `.interf/inventory.json` should use `entries` plus `total`, with one object per source file containing at least `source`, `summary`, and a conservative status/state field.",
|
|
43
|
+
"Do not precreate `.interf/runtime/inventory.json` with placeholder writes. Write the final JSON document directly.",
|
|
44
|
+
"When updating `.interf/runtime/inventory.json`, rewrite the full JSON document in one whole-file write instead of patching partial lines.",
|
|
45
|
+
"The CLI reconciles `.interf/runtime/state.json` and refreshes `.interf/runtime/health.json` after stage validation. Do not treat those files as stage-owned write targets for this stage.",
|
|
46
|
+
"Prefer the current inventory runtime shape: `.interf/runtime/inventory.json` should use `entries` plus `total`, with one object per source file containing at least `source`, `summary`, and a conservative status/state field.",
|
|
46
47
|
"Keep scratch extraction commands single-purpose and non-destructive. Do not use `rm`, wildcard cleanup, `;`, or `&&` chains during summarize.",
|
|
47
48
|
"Use `workflow/workspace.schema.json` as the deterministic output-shape reference for this workspace.",
|
|
48
49
|
"The workspace includes its own `raw/` snapshot. Read source files there when summary evidence depends on direct inspection.",
|
|
@@ -78,7 +79,7 @@ export function buildWorkspaceStructureContract(options) {
|
|
|
78
79
|
"interf.json",
|
|
79
80
|
"workflow/workspace.schema.json",
|
|
80
81
|
"summaries/",
|
|
81
|
-
".interf/inventory.json",
|
|
82
|
+
".interf/runtime/inventory.json",
|
|
82
83
|
...localSkillDocs,
|
|
83
84
|
],
|
|
84
85
|
writes: [
|
|
@@ -137,6 +138,7 @@ export function buildWorkspaceShapeContract(options) {
|
|
|
137
138
|
"interf.json",
|
|
138
139
|
"workflow/workspace.schema.json",
|
|
139
140
|
options.shapeInputPath,
|
|
141
|
+
"raw/",
|
|
140
142
|
"knowledge/entities/",
|
|
141
143
|
"knowledge/claims/",
|
|
142
144
|
"knowledge/indexes/",
|
|
@@ -158,7 +160,12 @@ export function buildWorkspaceShapeContract(options) {
|
|
|
158
160
|
`Use ${options.shapeInputPath} as the shaping input for this workspace.`,
|
|
159
161
|
"The shaping input provides the workspace focus plus saved truth-check question text only. It does not provide expected answers.",
|
|
160
162
|
"Use the focus and saved truth checks to bias routing, navigation, priority notes, and the final workspace home.",
|
|
163
|
+
"Replace any scaffold or placeholder content in `home.md`. The final home note must not keep the initial `Not yet compiled.` message.",
|
|
161
164
|
"Do not copy expected answers into the workspace or treat the checks as license to hallucinate missing evidence.",
|
|
165
|
+
"When a focused question depends on chart-derived or table-derived evidence, prefer the saved summaries and structured notes if they already preserve the needed bounded reads plus provenance.",
|
|
166
|
+
"Use `raw/` during shaping only when the compiled layer is missing the needed value, the metric family is ambiguous, or the earlier bounded read is clearly inconsistent.",
|
|
167
|
+
"Carry the final bounded reads forward into focused indexes with clear provenance instead of repeatedly recomputing them from `raw/`.",
|
|
168
|
+
...CHART_APPROXIMATION_NOTES,
|
|
162
169
|
"Use `workflow/workspace.schema.json` as the deterministic output-shape reference for this workspace.",
|
|
163
170
|
"Prefer better retrieval routes, tighter home.md guidance, and focused indexes over speculative synthesis.",
|
|
164
171
|
...workflowNotes,
|
|
@@ -182,4 +189,3 @@ export function buildWorkspaceShapeContract(options) {
|
|
|
182
189
|
},
|
|
183
190
|
};
|
|
184
191
|
}
|
|
185
|
-
//# sourceMappingURL=runtime-contracts.js.map
|
|
@@ -5,4 +5,3 @@ export declare function logsDirPath(dirPath: string): string;
|
|
|
5
5
|
export declare function promptLogPath(dirPath: string, runId: string): string;
|
|
6
6
|
export declare function eventLogPath(dirPath: string, runId: string): string;
|
|
7
7
|
export declare function statusLogPath(dirPath: string, runId: string): string;
|
|
8
|
-
//# sourceMappingURL=runtime-paths.d.ts.map
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import {
|
|
3
|
-
const RUN_FILE = "run.json";
|
|
4
|
-
const RUN_HISTORY_FILE = "run-history.jsonl";
|
|
5
|
-
const STAGE_CONTRACT_FILE = "stage-contract.json";
|
|
6
|
-
const LOGS_DIR = "logs";
|
|
2
|
+
import { workspaceRuntimeLogsRoot, workspaceRuntimeRunHistoryPath, workspaceRuntimeRunPath, workspaceRuntimeStageContractPath, } from "./workspace-paths.js";
|
|
7
3
|
export function runPath(dirPath) {
|
|
8
|
-
return
|
|
4
|
+
return workspaceRuntimeRunPath(dirPath);
|
|
9
5
|
}
|
|
10
6
|
export function runHistoryPath(dirPath) {
|
|
11
|
-
return
|
|
7
|
+
return workspaceRuntimeRunHistoryPath(dirPath);
|
|
12
8
|
}
|
|
13
9
|
export function stageContractPath(dirPath) {
|
|
14
|
-
return
|
|
10
|
+
return workspaceRuntimeStageContractPath(dirPath);
|
|
15
11
|
}
|
|
16
12
|
export function logsDirPath(dirPath) {
|
|
17
|
-
return
|
|
13
|
+
return workspaceRuntimeLogsRoot(dirPath);
|
|
18
14
|
}
|
|
19
15
|
export function promptLogPath(dirPath, runId) {
|
|
20
16
|
return join(logsDirPath(dirPath), `${runId}.prompt.txt`);
|
|
@@ -25,4 +21,3 @@ export function eventLogPath(dirPath, runId) {
|
|
|
25
21
|
export function statusLogPath(dirPath, runId) {
|
|
26
22
|
return join(logsDirPath(dirPath), `${runId}.status.log`);
|
|
27
23
|
}
|
|
28
|
-
//# sourceMappingURL=runtime-paths.js.map
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync, } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { SKILLS_DIR } from "./config.js";
|
|
4
1
|
export function buildStagePrompt(instructions, contractPath, statusLines) {
|
|
5
|
-
const bundledSkillPath = join(SKILLS_DIR, ...instructions.bundled_skill.split("/"), "SKILL.md");
|
|
6
|
-
const bundledSkillDoc = existsSync(bundledSkillPath)
|
|
7
|
-
? readFileSync(bundledSkillPath, "utf8").trim()
|
|
8
|
-
: null;
|
|
9
2
|
const modeNotes = instructions.effective_mode === "override"
|
|
10
3
|
? [
|
|
11
4
|
"Local stage instruction docs are authoritative for this run.",
|
|
@@ -14,30 +7,31 @@ export function buildStagePrompt(instructions, contractPath, statusLines) {
|
|
|
14
7
|
]
|
|
15
8
|
: instructions.effective_mode === "extend"
|
|
16
9
|
? [
|
|
17
|
-
"Use the
|
|
18
|
-
"Then apply any local stage instruction docs referenced by the contract as stage-specific extensions.",
|
|
10
|
+
"Use the current workspace workflow docs as the default workflow for this run.",
|
|
11
|
+
"Then apply any additional local stage instruction docs referenced by the contract as stage-specific extensions.",
|
|
19
12
|
]
|
|
20
13
|
: [
|
|
21
|
-
"Use the
|
|
14
|
+
"Use the current workspace workflow docs as the default workflow for this run.",
|
|
22
15
|
];
|
|
23
16
|
return [
|
|
24
|
-
`Interf built-in stage: ${instructions.bundled_skill}`,
|
|
17
|
+
`Interf built-in stage id: ${instructions.bundled_skill}`,
|
|
25
18
|
"",
|
|
26
19
|
"This is an automated Interf stage run, not an open-ended chat session.",
|
|
27
20
|
"The user has already invoked this stage through the Interf CLI. Execute it now.",
|
|
28
21
|
"Do not ask what the user wants, offer help, list tools, or wait for another instruction.",
|
|
29
22
|
`Read \`${contractPath}\` first. It is the authoritative contract for this stage.`,
|
|
30
23
|
"If `runtime/paths.json` exists in this shell, read it next. It maps workflow zone ids onto the shell-local `inputs/` and `outputs/` mounts for this stage.",
|
|
24
|
+
"For file-zone mounts, `runtime/paths.json` also gives the exact file path inside the `inputs/` or `outputs/` mount root.",
|
|
31
25
|
"Honor the contract's counts, artifact paths, and policies instead of inventing another workflow.",
|
|
32
26
|
"Read only the files named by the contract's `artifacts.reads` list plus any paths they explicitly direct you to open.",
|
|
33
27
|
"If the contract lists `instructions.local_docs`, open every one of those files before you write artifacts or declare the stage complete.",
|
|
34
28
|
"If `AGENTS.md` is listed in the contract, use it only for workspace routing that is directly relevant to this stage.",
|
|
35
|
-
"`.interf/run.json`, `.interf/state.json`, `.interf/health.json`, and `.interf/view-spec.json` are CLI-owned runtime artifacts. You may read them, but do not create, edit, or replace them unless the contract explicitly marks a different proof artifact as stage-owned.",
|
|
29
|
+
"`.interf/runtime/run.json`, `.interf/runtime/state.json`, `.interf/runtime/health.json`, and `.interf/runtime/view-spec.json` are CLI-owned runtime artifacts. You may read them, but do not create, edit, or replace them unless the contract explicitly marks a different proof artifact as stage-owned.",
|
|
36
30
|
"If a contract-listed output file does not exist yet, create it in one whole-file write. Do not attempt patch-style edits against a missing runtime path.",
|
|
37
31
|
"Stay inside the current workspace. Do not try to open SDK repo docs, SDK source files, or other paths outside the workspace unless the stage contract explicitly requires them.",
|
|
38
32
|
instructions.effective_mode === "override"
|
|
39
|
-
? "Do not depend on globally installed
|
|
40
|
-
: "Do not depend on globally installed
|
|
33
|
+
? "Do not depend on any repo-root or globally installed skill cache for this run. Local stage instruction docs are the primary workflow layer for this run."
|
|
34
|
+
: "Do not depend on any repo-root or globally installed skill cache for this run. Use the current workspace workflow docs and the contract as the default behavior.",
|
|
41
35
|
...modeNotes,
|
|
42
36
|
"Do not narrate intentions, plans, or reasoning to the user.",
|
|
43
37
|
"Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
|
|
@@ -47,14 +41,5 @@ export function buildStagePrompt(instructions, contractPath, statusLines) {
|
|
|
47
41
|
"If you respond conversationally instead of executing the stage, the run will be treated as failed.",
|
|
48
42
|
"As soon as the required proof artifacts are complete, stop. Do not keep browsing or auditing after the contract is satisfied.",
|
|
49
43
|
...statusLines,
|
|
50
|
-
...(bundledSkillDoc && instructions.effective_mode !== "override"
|
|
51
|
-
? [
|
|
52
|
-
"",
|
|
53
|
-
"Bundled Stage Instructions",
|
|
54
|
-
"==========================",
|
|
55
|
-
bundledSkillDoc,
|
|
56
|
-
]
|
|
57
|
-
: []),
|
|
58
44
|
].join("\n");
|
|
59
45
|
}
|
|
60
|
-
//# sourceMappingURL=runtime-prompt.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare function reconcileWorkspaceSummarizeRun(dirPath: string, expectedSummaryTotal: number): boolean;
|
|
2
2
|
export declare function reconcileWorkspaceStructureRun(dirPath: string): boolean;
|
|
3
3
|
export declare function reconcileWorkspaceShapeRun(dirPath: string): boolean;
|
|
4
|
-
//# sourceMappingURL=runtime-reconcile.d.ts.map
|