@interf/compiler 0.3.3 → 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 +137 -243
- 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 +16 -12
- package/dist/commands/default.d.ts +0 -1
- package/dist/commands/default.js +1 -2
- package/dist/commands/doctor.d.ts +0 -1
- package/dist/commands/doctor.js +7 -22
- 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 +72 -15
- 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 +527 -63
- 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 +17 -16
- 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,133 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { isWorkflowId, listLocalWorkflowDefinitions, loadLocalWorkflowDefinition, loadWorkflowDefinitionFromDir, } from "./local-workflows.js";
|
|
4
|
+
import { PACKAGE_ROOT } from "./config.js";
|
|
5
|
+
import { resolveSourceControlPath } from "./interf.js";
|
|
6
|
+
import { validateWorkspaceContractSequence, } from "./workflow-abi.js";
|
|
3
7
|
import { warnInterf } from "./logger.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
id: "summarize",
|
|
8
|
-
label: "Summarize",
|
|
9
|
-
description: "Turn source files into per-file summaries.",
|
|
10
|
-
contractType: "workspace-file-evidence",
|
|
11
|
-
skillDir: "summarize",
|
|
12
|
-
reads: [
|
|
13
|
-
BUILTIN_WORKSPACE_ZONE_IDS.RAW,
|
|
14
|
-
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
15
|
-
],
|
|
16
|
-
writes: [
|
|
17
|
-
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
18
|
-
],
|
|
19
|
-
acceptance: {
|
|
20
|
-
artifacts_exist: [".interf/inventory.json"],
|
|
21
|
-
state_truthy: ["last_summarize", "inventory_complete"],
|
|
22
|
-
state_at_least_counts: {
|
|
23
|
-
summarized: "expected_summary_total",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
id: "structure",
|
|
29
|
-
label: "Structure",
|
|
30
|
-
description: "Build the cross-file knowledge structure from the summaries.",
|
|
31
|
-
contractType: "workspace-knowledge-structure",
|
|
32
|
-
skillDir: "structure",
|
|
33
|
-
reads: [
|
|
34
|
-
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
35
|
-
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
36
|
-
],
|
|
37
|
-
writes: [
|
|
38
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
39
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
40
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
41
|
-
],
|
|
42
|
-
acceptance: {
|
|
43
|
-
artifacts_exist: ["knowledge/indexes"],
|
|
44
|
-
state_truthy: ["last_structure", "inventory_complete"],
|
|
45
|
-
state_at_least_counts: {
|
|
46
|
-
structured: "summary_total",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "shape",
|
|
52
|
-
label: "Shape",
|
|
53
|
-
description: "Shape the final workspace around the saved focus and truth checks.",
|
|
54
|
-
contractType: "workspace-query-shape",
|
|
55
|
-
skillDir: "shape",
|
|
56
|
-
reads: [
|
|
57
|
-
BUILTIN_WORKSPACE_ZONE_IDS.SUMMARIES,
|
|
58
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
59
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
60
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
61
|
-
BUILTIN_WORKSPACE_ZONE_IDS.RUNTIME,
|
|
62
|
-
],
|
|
63
|
-
writes: [
|
|
64
|
-
BUILTIN_WORKSPACE_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
65
|
-
BUILTIN_WORKSPACE_ZONE_IDS.HOME,
|
|
66
|
-
],
|
|
67
|
-
acceptance: {
|
|
68
|
-
artifacts_exist: ["home.md"],
|
|
69
|
-
state_truthy: ["last_shape", "inventory_complete"],
|
|
70
|
-
state_at_least_counts: {
|
|
71
|
-
shaped: "summary_total",
|
|
72
|
-
compiled: "summary_total",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
export const WORKSPACE_WORKFLOWS = [
|
|
78
|
-
{
|
|
79
|
-
id: "interf",
|
|
80
|
-
compilerApi: {
|
|
81
|
-
kind: "workspace",
|
|
82
|
-
version: 1,
|
|
83
|
-
},
|
|
84
|
-
label: "Interf (Recommended)",
|
|
85
|
-
hint: "Interf's default methodology: summarize source-grounded evidence, structure the cross-file layer, then shape the final workspace around its focus and saved truth checks.",
|
|
86
|
-
recommended: true,
|
|
87
|
-
stages: WORKSPACE_RUNTIME_STAGES,
|
|
88
|
-
scope: "builtin",
|
|
89
|
-
stagePolicyNotes: {
|
|
90
|
-
summarize: [
|
|
91
|
-
"Favor conservative, source-grounded summaries that preserve evidence tiers and leave broader synthesis for later stages.",
|
|
92
|
-
"For large reports or decks, capture scope, headline evidence, and chart/table routing in one light pass.",
|
|
93
|
-
"As soon as one report summary can state scope, headline metrics, and chart/table routing, stop reading and write the summary batch plus runtime artifacts immediately.",
|
|
94
|
-
"Keep scratch extraction commands single-purpose and non-destructive.",
|
|
95
|
-
],
|
|
96
|
-
structure: [
|
|
97
|
-
"Bias structure toward canonical entities, claims, timelines, and stable indexes.",
|
|
98
|
-
"Use taxonomy and ontology only as means to improve retrieval, navigation, and evidence tracking.",
|
|
99
|
-
"For small datasets, prefer a minimal stable substrate over exhaustive graph sprawl.",
|
|
100
|
-
],
|
|
101
|
-
shape: [
|
|
102
|
-
"Use the workspace focus and saved truth checks to bias the final workspace toward the job it should be especially good at.",
|
|
103
|
-
"Do not copy expected answers into the final workspace just because the checks imply them.",
|
|
104
|
-
"Prefer better routing, prioritization, and focused navigation over speculative synthesis.",
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
starterDocs: WORKSPACE_INTERF_STARTER_DOCS,
|
|
108
|
-
},
|
|
109
|
-
];
|
|
110
|
-
function titleCaseWorkflowId(workflowId) {
|
|
111
|
-
return workflowId
|
|
112
|
-
.split("-")
|
|
113
|
-
.filter((part) => part.length > 0)
|
|
114
|
-
.map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))
|
|
115
|
-
.join(" ");
|
|
116
|
-
}
|
|
8
|
+
import { workflowPackagePathForWorkspace } from "./workspace-paths.js";
|
|
9
|
+
let builtinInterfWorkflowCache = null;
|
|
117
10
|
function validateWorkspaceStages(stages) {
|
|
118
11
|
if (stages.length < 3)
|
|
119
12
|
return false;
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
["workspace-knowledge-structure", 1],
|
|
123
|
-
["workspace-query-shape", 2],
|
|
124
|
-
]);
|
|
125
|
-
const contractTypes = stages.map((stage) => stage.contractType);
|
|
126
|
-
if (!contractTypes.every((contractType, index) => index === 0 || (order.get(contractType) ?? -1) >= (order.get(contractTypes[index - 1]) ?? -1)))
|
|
127
|
-
return false;
|
|
128
|
-
return contractTypes.includes("workspace-file-evidence") &&
|
|
129
|
-
contractTypes.includes("workspace-knowledge-structure") &&
|
|
130
|
-
contractTypes.includes("workspace-query-shape");
|
|
13
|
+
const sequence = validateWorkspaceContractSequence(stages.map((stage) => stage.contractType));
|
|
14
|
+
return sequence.ok;
|
|
131
15
|
}
|
|
132
16
|
function toWorkflowStages(stages, fallbackStages) {
|
|
133
17
|
if (!stages || stages.length === 0)
|
|
@@ -143,14 +27,6 @@ function toWorkflowStages(stages, fallbackStages) {
|
|
|
143
27
|
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
144
28
|
}));
|
|
145
29
|
}
|
|
146
|
-
function mergeStarterDocs(baseDocs, overrideDocs) {
|
|
147
|
-
const merged = new Map();
|
|
148
|
-
for (const doc of baseDocs ?? [])
|
|
149
|
-
merged.set(doc.relativePath, doc);
|
|
150
|
-
for (const doc of overrideDocs ?? [])
|
|
151
|
-
merged.set(doc.relativePath, doc);
|
|
152
|
-
return Array.from(merged.values()).sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
153
|
-
}
|
|
154
30
|
function mergeStagePolicyNotes(stages, baseNotes, overrideNotes) {
|
|
155
31
|
const merged = {};
|
|
156
32
|
for (const definition of stages) {
|
|
@@ -164,69 +40,111 @@ function mergeStagePolicyNotes(stages, baseNotes, overrideNotes) {
|
|
|
164
40
|
}
|
|
165
41
|
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
166
42
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
43
|
+
export function standaloneWorkflowDefinitionFromLocalPackage(local) {
|
|
44
|
+
if (!local.stages || local.stages.length === 0) {
|
|
45
|
+
throw new Error(`Workflow package "${local.id}" is missing explicit stages. Workspace-local and portable workflow packages must be standalone.`);
|
|
46
|
+
}
|
|
47
|
+
const stages = toWorkflowStages(local.stages, []);
|
|
169
48
|
return {
|
|
170
49
|
id: local.id,
|
|
171
|
-
compilerApi: local.compiler_api ??
|
|
50
|
+
compilerApi: local.compiler_api ?? {
|
|
51
|
+
kind: "workspace",
|
|
52
|
+
version: 1,
|
|
53
|
+
},
|
|
172
54
|
label: local.label,
|
|
173
55
|
hint: local.hint,
|
|
174
56
|
recommended: false,
|
|
175
57
|
stages,
|
|
176
|
-
stagePolicyNotes: mergeStagePolicyNotes(stages,
|
|
177
|
-
starterDocs:
|
|
58
|
+
stagePolicyNotes: mergeStagePolicyNotes(stages, undefined, local.stage_policy_notes),
|
|
59
|
+
starterDocs: [...local.starter_docs],
|
|
178
60
|
scope: "local",
|
|
179
61
|
};
|
|
180
62
|
}
|
|
181
|
-
function
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
63
|
+
function builtinWorkflowPackagePath(workflowId) {
|
|
64
|
+
return join(PACKAGE_ROOT, "builtin-workflows", workflowId);
|
|
65
|
+
}
|
|
66
|
+
function getBuiltinInterfWorkflow() {
|
|
67
|
+
if (builtinInterfWorkflowCache)
|
|
68
|
+
return builtinInterfWorkflowCache;
|
|
69
|
+
const local = loadWorkflowDefinitionFromDir(builtinWorkflowPackagePath("interf"));
|
|
70
|
+
if (!local) {
|
|
71
|
+
throw new Error("Missing built-in Interf workflow package at builtin-workflows/interf.");
|
|
72
|
+
}
|
|
73
|
+
const resolved = standaloneWorkflowDefinitionFromLocalPackage(local);
|
|
74
|
+
if (!validateWorkspaceStages(resolved.stages)) {
|
|
75
|
+
throw new Error("Built-in Interf workflow package has an invalid stage ordering.");
|
|
76
|
+
}
|
|
77
|
+
builtinInterfWorkflowCache = {
|
|
78
|
+
...resolved,
|
|
79
|
+
id: "interf",
|
|
80
|
+
recommended: true,
|
|
81
|
+
scope: "builtin",
|
|
191
82
|
};
|
|
83
|
+
return builtinInterfWorkflowCache;
|
|
192
84
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
195
|
-
|
|
85
|
+
function listBuiltinWorkspaceWorkflows() {
|
|
86
|
+
return [getBuiltinInterfWorkflow()];
|
|
87
|
+
}
|
|
88
|
+
function resolveWorkspaceWorkflowFromLocal(workflowId, sourcePath) {
|
|
196
89
|
const local = loadLocalWorkflowDefinition(sourcePath, workflowId);
|
|
197
90
|
if (!local)
|
|
198
91
|
return null;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const resolved = toResolvedWorkflowDefinition(local, base);
|
|
92
|
+
if (local.extends) {
|
|
93
|
+
throw new Error(`Workflow "${workflowId}" uses legacy extends. Rewrite it as a standalone package before creating or compiling a workspace.`);
|
|
94
|
+
}
|
|
95
|
+
const resolved = standaloneWorkflowDefinitionFromLocalPackage(local);
|
|
204
96
|
if (!validateWorkspaceStages(resolved.stages)) {
|
|
205
|
-
|
|
206
|
-
return fallbackWorkspaceWorkflow(workflowId);
|
|
97
|
+
throw new Error(`Workflow "${workflowId}" has an invalid stage ordering. Workspace workflows must have one or more workspace-file-evidence stages followed by one or more workspace-knowledge-structure stages and one or more workspace-query-shape stages.`);
|
|
207
98
|
}
|
|
208
99
|
return resolved;
|
|
209
100
|
}
|
|
210
101
|
export function listWorkspaceWorkflowChoices(sourcePath) {
|
|
211
|
-
const builtins =
|
|
102
|
+
const builtins = listBuiltinWorkspaceWorkflows();
|
|
212
103
|
if (!sourcePath)
|
|
213
104
|
return builtins;
|
|
214
105
|
const locals = listLocalWorkflowDefinitions(sourcePath)
|
|
215
106
|
.filter((definition) => definition.id !== "interf")
|
|
216
|
-
.map((definition) =>
|
|
107
|
+
.map((definition) => {
|
|
108
|
+
try {
|
|
109
|
+
return resolveWorkspaceWorkflowFromLocal(definition.id, sourcePath);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
warnInterf(`Warning: skipping local workflow "${definition.id}" because it could not be resolved cleanly: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
})
|
|
217
116
|
.filter((definition) => definition !== null);
|
|
218
117
|
return [...builtins, ...locals];
|
|
219
118
|
}
|
|
220
119
|
export function getWorkspaceWorkflow(workflowId, options = {}) {
|
|
221
|
-
const builtin =
|
|
120
|
+
const builtin = listBuiltinWorkspaceWorkflows().find((candidate) => candidate.id === workflowId);
|
|
222
121
|
if (builtin)
|
|
223
122
|
return builtin;
|
|
224
123
|
if (options.sourcePath) {
|
|
225
|
-
const local = resolveWorkspaceWorkflowFromLocal(workflowId, options.sourcePath
|
|
124
|
+
const local = resolveWorkspaceWorkflowFromLocal(workflowId, options.sourcePath);
|
|
226
125
|
if (local)
|
|
227
126
|
return local;
|
|
127
|
+
throw new Error(`No local workflow package found for "${workflowId}" under ${join(options.sourcePath, "interf", "workflows", workflowId)}.`);
|
|
228
128
|
}
|
|
229
|
-
|
|
129
|
+
throw new Error(`Workflow "${workflowId}" is not built-in. Provide a source path so Interf Compiler can resolve a local workflow package.`);
|
|
130
|
+
}
|
|
131
|
+
export function getActiveWorkspaceWorkflow(workspacePath, fallbackWorkflowId) {
|
|
132
|
+
const workflowPath = workflowPackagePathForWorkspace(workspacePath);
|
|
133
|
+
if (existsSync(join(workflowPath, "workflow.json"))) {
|
|
134
|
+
const local = loadWorkflowDefinitionFromDir(workflowPath);
|
|
135
|
+
if (!local) {
|
|
136
|
+
throw new Error(`Workspace-local workflow package at ${workflowPath} is missing or invalid. Interf compile runs the workspace-local package directly; recreate or reseed this workspace instead of relying on source-root fallback.`);
|
|
137
|
+
}
|
|
138
|
+
if (local.extends) {
|
|
139
|
+
throw new Error(`Workspace-local workflow package at ${workflowPath} still uses legacy extends. Materialize it as a standalone package before compiling this workspace.`);
|
|
140
|
+
}
|
|
141
|
+
const resolved = standaloneWorkflowDefinitionFromLocalPackage(local);
|
|
142
|
+
if (!validateWorkspaceStages(resolved.stages)) {
|
|
143
|
+
throw new Error(`Workspace-local workflow package at ${workflowPath} has an invalid stage ordering. Interf compile will not silently switch methods for this workspace.`);
|
|
144
|
+
}
|
|
145
|
+
return resolved;
|
|
146
|
+
}
|
|
147
|
+
throw new Error(`Missing workspace-local workflow package at ${workflowPath}. Interf compile runs the workspace-local package directly, so recreate or reseed this workspace instead of relying on source-root workflow "${fallbackWorkflowId}" under ${resolveSourceControlPath(workspacePath)}.`);
|
|
230
148
|
}
|
|
231
149
|
export function resolveWorkspaceWorkflowId(value) {
|
|
232
150
|
if (typeof value === "string" && isWorkflowId(value)) {
|
|
@@ -243,6 +161,13 @@ export function resolveWorkspaceWorkflowFromConfig(config) {
|
|
|
243
161
|
export function formatWorkspaceWorkflowStageStep(workflowId, stage, options = {}) {
|
|
244
162
|
return formatWorkflowStageStep(getWorkspaceWorkflow(workflowId, options), stage);
|
|
245
163
|
}
|
|
164
|
+
function resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath) {
|
|
165
|
+
if (sourcePath &&
|
|
166
|
+
existsSync(join(workflowPackagePathForWorkspace(sourcePath), "workflow.json"))) {
|
|
167
|
+
return getActiveWorkspaceWorkflow(sourcePath, workflowId);
|
|
168
|
+
}
|
|
169
|
+
return getWorkspaceWorkflow(workflowId, { sourcePath });
|
|
170
|
+
}
|
|
246
171
|
function formatWorkflowStageStep(workflow, stage) {
|
|
247
172
|
const stageIndex = workflow.stages.findIndex((candidate) => candidate.id === stage);
|
|
248
173
|
if (stageIndex === -1) {
|
|
@@ -255,7 +180,7 @@ function formatWorkflowStageStep(workflow, stage) {
|
|
|
255
180
|
return `Step ${stageIndex + 1}/${workflow.stages.length} - ${stageDefinition.label}`;
|
|
256
181
|
}
|
|
257
182
|
export function getWorkflowStageDefinition(workflowId, stage, sourcePath) {
|
|
258
|
-
const workflow =
|
|
183
|
+
const workflow = resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath);
|
|
259
184
|
return workflow.stages.find((candidate) => candidate.id === stage) ?? null;
|
|
260
185
|
}
|
|
261
186
|
export function getWorkflowStagePosition(workflowId, stage, sourcePath) {
|
|
@@ -270,10 +195,22 @@ export function getWorkflowStagePosition(workflowId, stage, sourcePath) {
|
|
|
270
195
|
};
|
|
271
196
|
}
|
|
272
197
|
export function getWorkflowStages(workflowId, sourcePath) {
|
|
273
|
-
return
|
|
198
|
+
return resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath).stages.map((definition) => definition.id);
|
|
199
|
+
}
|
|
200
|
+
export function getActiveWorkspaceStages(workspacePath, fallbackWorkflowId) {
|
|
201
|
+
return getActiveWorkspaceWorkflow(workspacePath, fallbackWorkflowId).stages.map((definition) => definition.id);
|
|
274
202
|
}
|
|
275
203
|
export function getWorkflowStagePolicyNotes(workflowId, stage, sourcePath) {
|
|
276
|
-
const workflow =
|
|
204
|
+
const workflow = resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath);
|
|
205
|
+
return [...(workflow.stagePolicyNotes?.[stage] ?? [])];
|
|
206
|
+
}
|
|
207
|
+
export function getActiveWorkspaceStagePolicyNotes(workspacePath, fallbackWorkflowId, stage) {
|
|
208
|
+
const workflow = getActiveWorkspaceWorkflow(workspacePath, fallbackWorkflowId);
|
|
277
209
|
return [...(workflow.stagePolicyNotes?.[stage] ?? [])];
|
|
278
210
|
}
|
|
279
|
-
|
|
211
|
+
export function resolveActiveWorkspaceStageAcceptance(workspacePath, fallbackWorkflowId, stage) {
|
|
212
|
+
return getActiveWorkspaceWorkflow(workspacePath, fallbackWorkflowId).stages.find((candidate) => candidate.id === stage)?.acceptance;
|
|
213
|
+
}
|
|
214
|
+
export function formatActiveWorkspaceWorkflowStageStep(workspacePath, fallbackWorkflowId, stage) {
|
|
215
|
+
return formatWorkflowStageStep(getActiveWorkspaceWorkflow(workspacePath, fallbackWorkflowId), stage);
|
|
216
|
+
}
|
|
@@ -9,8 +9,8 @@ export interface WorkflowStageResult {
|
|
|
9
9
|
code: number;
|
|
10
10
|
summary?: string | null;
|
|
11
11
|
}
|
|
12
|
-
export declare function workflowCreateDirectory(): string;
|
|
13
12
|
export declare function workflowQueryDirectory(): string;
|
|
13
|
+
export declare function workflowImproveDirectory(): string;
|
|
14
14
|
export declare function workflowCompileStageDirectory(stageDir: string): string;
|
|
15
15
|
export interface LocalSkillContractExtension {
|
|
16
16
|
reads: string[];
|
|
@@ -37,4 +37,3 @@ export declare function validateStageOutcome(_dirPath: string, validation: {
|
|
|
37
37
|
ok: boolean;
|
|
38
38
|
summary: string;
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=workflow-helpers.d.ts.map
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join, relative } from "node:path";
|
|
2
|
+
import { join, relative, sep } from "node:path";
|
|
3
3
|
import { listFilesRecursive } from "./filesystem.js";
|
|
4
4
|
import { isMarkdownFile } from "./util.js";
|
|
5
|
+
import { workspaceBundledSkillForContractType } from "./workflow-abi.js";
|
|
5
6
|
import { getWorkspaceWorkflow, } from "./workflow-definitions.js";
|
|
6
7
|
import { parseJsonFrontmatter } from "./parse.js";
|
|
8
|
+
import { workflowPackagePathForWorkspace } from "./workspace-paths.js";
|
|
7
9
|
const LOCAL_SKILL_READ_LIMIT = 50;
|
|
8
|
-
export function workflowCreateDirectory() {
|
|
9
|
-
return "workflow/create";
|
|
10
|
-
}
|
|
11
10
|
export function workflowQueryDirectory() {
|
|
12
11
|
return "workflow/use/query";
|
|
13
12
|
}
|
|
13
|
+
export function workflowImproveDirectory() {
|
|
14
|
+
return "workflow/improve";
|
|
15
|
+
}
|
|
14
16
|
export function workflowCompileStageDirectory(stageDir) {
|
|
15
17
|
return `workflow/compile/stages/${stageDir}`;
|
|
16
18
|
}
|
|
@@ -39,9 +41,10 @@ function collectLocalSkillDocs(rootPath, directories) {
|
|
|
39
41
|
}
|
|
40
42
|
function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories) {
|
|
41
43
|
const docs = new Map();
|
|
42
|
-
const
|
|
44
|
+
const workflowRoot = workflowPackagePathForWorkspace(rootPath);
|
|
45
|
+
const rootReadme = join(workflowRoot, "README.md");
|
|
43
46
|
if (existsSync(rootReadme)) {
|
|
44
|
-
const read =
|
|
47
|
+
const read = projectWorkflowReadPath(rootPath, relativeToPath, rootReadme);
|
|
45
48
|
docs.set(read, {
|
|
46
49
|
read,
|
|
47
50
|
absolutePath: rootReadme,
|
|
@@ -49,8 +52,9 @@ function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories)
|
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
for (const directory of directories) {
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
const absoluteDirectory = resolveAuthoringDirectory(rootPath, directory);
|
|
56
|
+
for (const filePath of listFilesRecursive(absoluteDirectory, isMarkdownFile)) {
|
|
57
|
+
const read = projectWorkflowReadPath(rootPath, relativeToPath, filePath);
|
|
54
58
|
docs.set(read, {
|
|
55
59
|
read,
|
|
56
60
|
absolutePath: filePath,
|
|
@@ -62,6 +66,25 @@ function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories)
|
|
|
62
66
|
.sort((a, b) => a.read.localeCompare(b.read))
|
|
63
67
|
.slice(0, LOCAL_SKILL_READ_LIMIT);
|
|
64
68
|
}
|
|
69
|
+
function resolveAuthoringDirectory(rootPath, directory) {
|
|
70
|
+
if (directory === "workflow") {
|
|
71
|
+
return workflowPackagePathForWorkspace(rootPath);
|
|
72
|
+
}
|
|
73
|
+
if (directory.startsWith(`workflow${sep}`) || directory.startsWith("workflow/")) {
|
|
74
|
+
const relativeWorkflowPath = directory.replace(/^workflow[\\/]/, "");
|
|
75
|
+
return join(workflowPackagePathForWorkspace(rootPath), relativeWorkflowPath);
|
|
76
|
+
}
|
|
77
|
+
return join(rootPath, directory);
|
|
78
|
+
}
|
|
79
|
+
function projectWorkflowReadPath(rootPath, relativeToPath, absolutePath) {
|
|
80
|
+
const workflowRoot = workflowPackagePathForWorkspace(rootPath);
|
|
81
|
+
const normalizedWorkflowRoot = `${workflowRoot}${sep}`;
|
|
82
|
+
if (absolutePath === workflowRoot || absolutePath.startsWith(normalizedWorkflowRoot)) {
|
|
83
|
+
const relativeWorkflowPath = relative(workflowRoot, absolutePath);
|
|
84
|
+
return relative(relativeToPath, join(rootPath, "workflow", relativeWorkflowPath));
|
|
85
|
+
}
|
|
86
|
+
return relative(relativeToPath, absolutePath);
|
|
87
|
+
}
|
|
65
88
|
export function buildLocalSkillContractExtension(rootPath, directories, purpose) {
|
|
66
89
|
const docs = collectLocalSkillDocs(rootPath, directories);
|
|
67
90
|
return buildContractExtensionFromDocs(docs, directories, purpose);
|
|
@@ -138,18 +161,7 @@ export function reportValidationFailure(reporter, summary, errors = []) {
|
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
163
|
export function bundledSkillForContractType(contractType) {
|
|
141
|
-
|
|
142
|
-
case "workspace-file-evidence":
|
|
143
|
-
return "workspace/summarize";
|
|
144
|
-
case "workspace-knowledge-structure":
|
|
145
|
-
return "workspace/structure";
|
|
146
|
-
case "workspace-query-shape":
|
|
147
|
-
return "workspace/shape";
|
|
148
|
-
default: {
|
|
149
|
-
const exhaustiveCheck = contractType;
|
|
150
|
-
throw new Error(`Unknown workspace contract type: ${exhaustiveCheck}`);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
164
|
+
return workspaceBundledSkillForContractType(contractType);
|
|
153
165
|
}
|
|
154
166
|
export function resolveStageAcceptance(workflowId, stageId, sourcePath) {
|
|
155
167
|
return getWorkspaceWorkflow(workflowId, { sourcePath }).stages.find((stage) => stage.id === stageId)?.acceptance;
|
|
@@ -157,4 +169,3 @@ export function resolveStageAcceptance(workflowId, stageId, sourcePath) {
|
|
|
157
169
|
export function validateStageOutcome(_dirPath, validation) {
|
|
158
170
|
return validation;
|
|
159
171
|
}
|
|
160
|
-
//# sourceMappingURL=workflow-helpers.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { WorkflowExecutor } from "./executors.js";
|
|
2
|
+
import { type WorkflowValidationResult } from "./local-workflows.js";
|
|
3
|
+
import type { SourceWorkspaceConfig, WorkflowImprovementLoopSummary } from "./schema.js";
|
|
4
|
+
export interface WorkflowImprovementRunResult {
|
|
5
|
+
status: "updated" | "no-change" | "invalid" | "executor-failed";
|
|
6
|
+
changed: boolean;
|
|
7
|
+
validation: WorkflowValidationResult | null;
|
|
8
|
+
summary: string;
|
|
9
|
+
shellPath: string;
|
|
10
|
+
loopRootPath: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function runWorkflowImprovementLoop(options: {
|
|
13
|
+
executor: WorkflowExecutor;
|
|
14
|
+
workspacePath: string;
|
|
15
|
+
workflowId: string;
|
|
16
|
+
workspaceConfig: Pick<SourceWorkspaceConfig, "checks">;
|
|
17
|
+
runId: string;
|
|
18
|
+
loopIndex: number;
|
|
19
|
+
maxLoops: number;
|
|
20
|
+
maxAttempts: number;
|
|
21
|
+
previousVariations: WorkflowImprovementLoopSummary[];
|
|
22
|
+
}): Promise<WorkflowImprovementRunResult>;
|