@interf/compiler 0.7.2 → 0.9.1
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 +141 -99
- package/TRADEMARKS.md +1 -1
- package/agent-skills/interf-actions/SKILL.md +71 -0
- package/agent-skills/interf-actions/references/cli.md +190 -0
- package/apps/compiler-ui/.next/server/app/index.html +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_buildManifest.js +11 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_clientMiddlewareManifest.js +1 -0
- package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_ssgManifest.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/03~yq9q893hmn.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/06z~l3kwb891e.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08g7lvje.te.u.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/08m7vf5asqlsm.js +91 -0
- package/apps/compiler-ui/.next/static/chunks/0_i-3_5l9t2qe.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b-ywny_j0g~0.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0b52v41o1gixx.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js +124 -0
- package/apps/compiler-ui/.next/static/chunks/0gpzgsv0w.q~m.js +31 -0
- package/apps/compiler-ui/.next/static/chunks/0ilwfezfvu6~-.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0n51hrfoufc7g.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +5 -0
- package/apps/compiler-ui/.next/static/chunks/0xxmf45eskdt~.css +1 -0
- package/apps/compiler-ui/.next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
- package/apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css +3 -0
- package/apps/compiler-ui/.next/static/chunks/14wtz~vq25~qq.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
- package/apps/compiler-ui/.next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
- package/apps/compiler-ui/.next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
- package/apps/compiler-ui/.next/static/media/worker.102zas1s52_pf.js +109 -0
- package/builtin-workflows/interf/README.md +8 -8
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +6 -6
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
- package/builtin-workflows/interf/improve/SKILL.md +2 -2
- package/builtin-workflows/interf/use/query/SKILL.md +2 -2
- package/builtin-workflows/interf/workflow.json +9 -9
- package/builtin-workflows/interf/workflow.schema.json +2 -2
- package/dist/cli/commands/check-draft.d.ts +5 -4
- package/dist/cli/commands/check-draft.js +18 -17
- package/dist/cli/commands/compile-controller.d.ts +3 -0
- package/dist/cli/commands/compile-controller.js +53 -45
- package/dist/cli/commands/compile.js +83 -27
- package/dist/cli/commands/compiled-flow.d.ts +3 -0
- package/dist/cli/commands/compiled-flow.js +9 -7
- package/dist/cli/commands/control-path.d.ts +11 -0
- package/dist/cli/commands/control-path.js +72 -0
- package/dist/cli/commands/create-workflow-wizard.d.ts +12 -0
- package/dist/cli/commands/create-workflow-wizard.js +232 -66
- package/dist/cli/commands/create.js +70 -46
- package/dist/cli/commands/default.js +5 -3
- package/dist/cli/commands/doctor.js +5 -5
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.js +362 -101
- package/dist/cli/commands/list.js +8 -7
- package/dist/cli/commands/preparation-selection.d.ts +6 -0
- package/dist/cli/commands/preparation-selection.js +11 -0
- package/dist/cli/commands/reset.js +3 -3
- package/dist/cli/commands/source-config-wizard.d.ts +4 -4
- package/dist/cli/commands/source-config-wizard.js +175 -200
- package/dist/cli/commands/status.js +116 -8
- package/dist/cli/commands/test-flow.d.ts +1 -1
- package/dist/cli/commands/test-flow.js +35 -33
- package/dist/cli/commands/test.d.ts +4 -0
- package/dist/cli/commands/test.js +95 -58
- package/dist/cli/commands/verify.js +7 -7
- package/dist/cli/commands/web.d.ts +11 -0
- package/dist/cli/commands/web.js +373 -0
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +3 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/packages/agents/lib/execution.js +4 -2
- package/dist/packages/agents/lib/executors.d.ts +1 -0
- package/dist/packages/agents/lib/executors.js +1 -0
- package/dist/packages/agents/lib/render.d.ts +2 -2
- package/dist/packages/agents/lib/render.js +10 -9
- package/dist/packages/agents/lib/shells.d.ts +3 -11
- package/dist/packages/agents/lib/shells.js +58 -106
- package/dist/packages/agents/lib/types.d.ts +1 -0
- package/dist/packages/compiler/compiled-paths.d.ts +4 -1
- package/dist/packages/compiler/compiled-paths.js +8 -2
- package/dist/packages/compiler/compiled-pipeline.d.ts +7 -0
- package/dist/packages/compiler/compiled-pipeline.js +15 -4
- package/dist/packages/compiler/compiled-schema.js +1 -1
- package/dist/packages/compiler/compiled-stage-plan.d.ts +2 -2
- package/dist/packages/compiler/compiled-stage-plan.js +4 -4
- package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -0
- package/dist/packages/compiler/compiled-stage-runner.js +50 -2
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +161 -1
- package/dist/packages/compiler/lib/schema.js +87 -1
- package/dist/packages/compiler/raw-snapshot.d.ts +9 -2
- package/dist/packages/compiler/runtime-acceptance.js +1 -1
- package/dist/packages/compiler/runtime-contracts.js +2 -2
- package/dist/packages/compiler/runtime-prompt.js +7 -7
- package/dist/packages/compiler/runtime-reconcile.js +3 -3
- package/dist/packages/compiler/runtime-runs.js +3 -0
- package/dist/packages/compiler/runtime-types.d.ts +1 -0
- package/dist/packages/compiler/state-health.js +1 -1
- package/dist/packages/compiler/state-view.js +2 -2
- package/dist/packages/compiler/validate-compiled.js +11 -9
- package/dist/packages/execution/adapters.d.ts +15 -0
- package/dist/packages/execution/adapters.js +1 -0
- package/dist/packages/execution/events.d.ts +8 -0
- package/dist/packages/execution/events.js +16 -0
- package/dist/packages/execution/index.d.ts +9 -0
- package/dist/packages/execution/index.js +6 -0
- package/dist/packages/execution/lib/schema.d.ts +1554 -0
- package/dist/packages/execution/lib/schema.js +319 -0
- package/dist/packages/local-service/action-values.d.ts +23 -0
- package/dist/packages/local-service/action-values.js +31 -0
- package/dist/packages/local-service/client.d.ts +119 -0
- package/dist/packages/local-service/client.js +356 -0
- package/dist/packages/local-service/index.d.ts +15 -0
- package/dist/packages/local-service/index.js +11 -0
- package/dist/packages/local-service/lib/schema.d.ts +7355 -0
- package/dist/packages/local-service/lib/schema.js +636 -0
- package/dist/packages/local-service/routes.d.ts +27 -0
- package/dist/packages/local-service/routes.js +32 -0
- package/dist/packages/local-service/runtime.d.ts +134 -0
- package/dist/packages/local-service/runtime.js +2841 -0
- package/dist/packages/local-service/server.d.ts +17 -0
- package/dist/packages/local-service/server.js +572 -0
- package/dist/packages/project-model/index.d.ts +2 -1
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/interf-detect.d.ts +6 -2
- package/dist/packages/project-model/interf-detect.js +48 -19
- package/dist/packages/project-model/interf-scaffold.d.ts +1 -0
- package/dist/packages/project-model/interf-scaffold.js +39 -17
- package/dist/packages/project-model/interf.d.ts +2 -2
- package/dist/packages/project-model/interf.js +2 -2
- package/dist/packages/project-model/lib/schema.d.ts +80 -6
- package/dist/packages/project-model/lib/schema.js +29 -19
- package/dist/packages/project-model/project-paths.d.ts +3 -1
- package/dist/packages/project-model/project-paths.js +6 -2
- package/dist/packages/project-model/source-config.d.ts +25 -11
- package/dist/packages/project-model/source-config.js +152 -82
- package/dist/packages/project-model/source-folders.d.ts +11 -0
- package/dist/packages/project-model/source-folders.js +110 -0
- package/dist/packages/testing/test-execution.js +5 -5
- package/dist/packages/testing/test-paths.js +4 -3
- package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
- package/dist/packages/workflow-authoring/workflow-authoring.js +46 -85
- package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
- package/dist/packages/workflow-authoring/workflow-edit-session.js +83 -49
- package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
- package/dist/packages/workflow-package/context-interface.js +2 -2
- package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
- package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
- package/dist/packages/workflow-package/local-workflows.js +33 -17
- package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
- package/dist/packages/workflow-package/workflow-definitions.js +23 -22
- package/dist/packages/workflow-package/workflow-helpers.js +10 -6
- package/dist/packages/workflow-package/workflow-review-paths.js +5 -1
- package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
- package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
- package/package.json +18 -4
- package/dist/cli/commands/dataset-selection.d.ts +0 -6
- package/dist/cli/commands/dataset-selection.js +0 -11
- 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 +0 -1
- 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 +0 -1
- package/dist/lib/agent-render.d.ts +0 -1
- package/dist/lib/agent-render.js +0 -1
- package/dist/lib/agent-shells.d.ts +0 -1
- package/dist/lib/agent-shells.js +0 -1
- 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 -1
- package/dist/lib/agents.js +0 -1
- package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
- package/dist/lib/builtin-compiled-workflow.js +0 -1
- package/dist/lib/chart-guidance.d.ts +0 -1
- package/dist/lib/chart-guidance.js +0 -1
- package/dist/lib/compiled-compile.d.ts +0 -1
- package/dist/lib/compiled-compile.js +0 -1
- package/dist/lib/compiled-paths.d.ts +0 -1
- package/dist/lib/compiled-paths.js +0 -3
- package/dist/lib/compiled-raw.d.ts +0 -1
- package/dist/lib/compiled-raw.js +0 -3
- package/dist/lib/compiled-reset.d.ts +0 -1
- package/dist/lib/compiled-reset.js +0 -3
- package/dist/lib/compiled-schema.d.ts +0 -1
- package/dist/lib/compiled-schema.js +0 -1
- 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 +0 -3
- package/dist/lib/interf-detect.d.ts +0 -1
- package/dist/lib/interf-detect.js +0 -3
- package/dist/lib/interf-scaffold.d.ts +0 -1
- package/dist/lib/interf-scaffold.js +0 -3
- package/dist/lib/interf-workflow-package.d.ts +0 -1
- package/dist/lib/interf-workflow-package.js +0 -1
- package/dist/lib/interf.d.ts +0 -1
- package/dist/lib/interf.js +0 -3
- package/dist/lib/local-workflows.d.ts +0 -1
- package/dist/lib/local-workflows.js +0 -1
- package/dist/lib/logger.d.ts +0 -1
- package/dist/lib/logger.js +0 -1
- package/dist/lib/package-root.d.ts +0 -1
- package/dist/lib/package-root.js +0 -1
- package/dist/lib/parse.d.ts +0 -1
- package/dist/lib/parse.js +0 -1
- package/dist/lib/project-paths.d.ts +0 -1
- package/dist/lib/project-paths.js +0 -3
- package/dist/lib/runtime-acceptance.d.ts +0 -1
- package/dist/lib/runtime-acceptance.js +0 -1
- package/dist/lib/runtime-contracts.d.ts +0 -1
- package/dist/lib/runtime-contracts.js +0 -1
- package/dist/lib/runtime-inventory.d.ts +0 -1
- package/dist/lib/runtime-inventory.js +0 -1
- package/dist/lib/runtime-paths.d.ts +0 -1
- package/dist/lib/runtime-paths.js +0 -1
- package/dist/lib/runtime-prompt.d.ts +0 -1
- package/dist/lib/runtime-prompt.js +0 -1
- package/dist/lib/runtime-reconcile.d.ts +0 -1
- package/dist/lib/runtime-reconcile.js +0 -1
- package/dist/lib/runtime-runs.d.ts +0 -1
- package/dist/lib/runtime-runs.js +0 -1
- 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 +0 -4
- package/dist/lib/schema.js +0 -6
- package/dist/lib/source-config.d.ts +0 -1
- package/dist/lib/source-config.js +0 -3
- 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 +0 -1
- package/dist/lib/state-io.d.ts +0 -1
- package/dist/lib/state-io.js +0 -1
- package/dist/lib/state-paths.d.ts +0 -1
- package/dist/lib/state-paths.js +0 -1
- package/dist/lib/state-view.d.ts +0 -1
- package/dist/lib/state-view.js +0 -1
- package/dist/lib/state.d.ts +0 -1
- package/dist/lib/state.js +0 -1
- package/dist/lib/test-execution.d.ts +0 -1
- package/dist/lib/test-execution.js +0 -3
- package/dist/lib/test-matrices.d.ts +0 -1
- package/dist/lib/test-matrices.js +0 -3
- package/dist/lib/test-paths.d.ts +0 -1
- package/dist/lib/test-paths.js +0 -3
- package/dist/lib/test-profile-presets.d.ts +0 -1
- package/dist/lib/test-profile-presets.js +0 -3
- package/dist/lib/test-sandbox.d.ts +0 -1
- package/dist/lib/test-sandbox.js +0 -3
- package/dist/lib/test-specs.d.ts +0 -1
- package/dist/lib/test-specs.js +0 -3
- package/dist/lib/test-targets.d.ts +0 -1
- package/dist/lib/test-targets.js +0 -3
- package/dist/lib/test-types.d.ts +0 -1
- package/dist/lib/test-types.js +0 -3
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/test.js +0 -3
- package/dist/lib/util.d.ts +0 -1
- package/dist/lib/util.js +0 -1
- package/dist/lib/validate-compiled.d.ts +0 -1
- package/dist/lib/validate-compiled.js +0 -1
- package/dist/lib/validate-helpers.d.ts +0 -1
- package/dist/lib/validate-helpers.js +0 -1
- package/dist/lib/validate.d.ts +0 -1
- package/dist/lib/validate.js +0 -1
- package/dist/lib/workflow-authoring.d.ts +0 -1
- package/dist/lib/workflow-authoring.js +0 -1
- package/dist/lib/workflow-definitions.d.ts +0 -1
- package/dist/lib/workflow-definitions.js +0 -1
- package/dist/lib/workflow-edit-session.d.ts +0 -1
- package/dist/lib/workflow-edit-session.js +0 -1
- package/dist/lib/workflow-edit-utils.d.ts +0 -1
- package/dist/lib/workflow-edit-utils.js +0 -1
- package/dist/lib/workflow-helpers.d.ts +0 -1
- package/dist/lib/workflow-helpers.js +0 -1
- package/dist/lib/workflow-improvement.d.ts +0 -1
- package/dist/lib/workflow-improvement.js +0 -1
- package/dist/lib/workflow-primitives.d.ts +0 -1
- package/dist/lib/workflow-primitives.js +0 -1
- package/dist/lib/workflow-review-paths.d.ts +0 -1
- package/dist/lib/workflow-review-paths.js +0 -1
- package/dist/lib/workflow-stage-policy.d.ts +0 -1
- package/dist/lib/workflow-stage-policy.js +0 -1
- package/dist/lib/workflow-stage-runner.d.ts +0 -1
- package/dist/lib/workflow-stage-runner.js +0 -1
- package/dist/lib/workflows.d.ts +0 -1
- package/dist/lib/workflows.js +0 -1
|
@@ -1,28 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
4
2
|
import { createWorkflowAuthoringShell } from "../agents/lib/shells.js";
|
|
5
|
-
import {
|
|
3
|
+
import { createScratchLocalWorkflowPackage } from "../workflow-package/interf-workflow-package.js";
|
|
6
4
|
import { CONTEXT_INTERFACE_FILE } from "../workflow-package/context-interface.js";
|
|
7
5
|
import { validateWorkflowPackage, workflowDefinitionPath } from "../workflow-package/local-workflows.js";
|
|
8
|
-
import { createCompiled, compileCompiled } from "../compiler/workflows.js";
|
|
9
|
-
import { projectRawSnapshot } from "../compiler/raw-snapshot.js";
|
|
10
6
|
import { runWorkflowEditSession } from "./workflow-edit-session.js";
|
|
11
|
-
import { copyDirectory } from "./lib/workflow-edit-utils.js";
|
|
12
7
|
function buildWorkflowAuthoringPrompt() {
|
|
13
8
|
return [
|
|
14
9
|
"This is an automated Interf workflow-authoring run, not an open-ended chat session.",
|
|
15
10
|
"Execute it now.",
|
|
16
|
-
"Create one standalone workflow for the
|
|
11
|
+
"Create one standalone workflow for the source data, desired portable-context outputs, and proof requirements in this source folder.",
|
|
17
12
|
"Read `runtime/authoring-context.json` first.",
|
|
13
|
+
"Treat `task_prompt` as the user's preparation-and-evidence brief: source data, output shape, and evidence that should show the data is ready.",
|
|
18
14
|
`Then read \`workflow/README.md\`, \`workflow/workflow.json\`, and \`workflow/${CONTEXT_INTERFACE_FILE}\`.`,
|
|
19
|
-
"
|
|
15
|
+
"The workflow directory starts as a neutral scaffold, not as a suggested workflow.",
|
|
16
|
+
"Replace the scaffold purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the method this work actually needs.",
|
|
17
|
+
"Review `artifacts/source-dataset/raw/` before editing the package.",
|
|
20
18
|
"Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
21
19
|
"Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
|
|
22
20
|
"Edit only files under `workflow/`.",
|
|
23
21
|
"Keep the workflow valid for the current compiler API and workflow schema.",
|
|
24
|
-
"
|
|
22
|
+
"Choose stage ids, stage order, reads, writes, acceptance criteria, and stage docs from the source data and preparation-and-evidence brief.",
|
|
23
|
+
"Do not preserve the placeholder `prepare` stage unless the final workflow genuinely needs a stage with that exact role.",
|
|
24
|
+
"When editing acceptance criteria: `zone_counts_at_least` maps declared zone ids to fixed numeric minimums.",
|
|
25
|
+
"`zone_counts_at_least_counts` also maps declared zone ids to runtime count-key strings such as `source_total`; `source_total` is a value, never a zone key.",
|
|
26
|
+
"Before stopping, verify every acceptance zone key is declared in `workflow.schema.json`.",
|
|
27
|
+
"For every stage in `workflow.json`, create `workflow/compile/stages/<skill_dir>/SKILL.md` and make the folder name exactly match that stage's `skill_dir`.",
|
|
28
|
+
"Every zone path in `workflow.schema.json` must be unique and non-overlapping. Do not declare both `knowledge/indexes` and `knowledge/indexes/some-file.md` as separate zones.",
|
|
29
|
+
"Make the package materially specific to this dataset task, output shape, and proof requirement. A no-op scaffold is not acceptable.",
|
|
25
30
|
"Treat the workflow package as four aligned layers: purpose, inputs, context interface, and stages.",
|
|
31
|
+
"Keep the portable-context entrypoint canonical: if the Method writes an agent entrypoint, declare zone id `home` with path `home.md` and make the final shaping stage own it.",
|
|
32
|
+
"Do not move the main entrypoint to `knowledge/home.md` or any other nested path.",
|
|
26
33
|
"Prefer explicit stage-doc, stage-policy, purpose, input-contract, and context-interface edits over vague rewrites.",
|
|
27
34
|
"Do not introduce wikilinks unless the workflow also creates the target note by exact basename or explicit relative path.",
|
|
28
35
|
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
|
|
@@ -33,88 +40,42 @@ function buildWorkflowAuthoringPrompt() {
|
|
|
33
40
|
"As soon as the workflow edits are complete, stop.",
|
|
34
41
|
].join("\n");
|
|
35
42
|
}
|
|
36
|
-
async function prepareWorkflowAuthoringPreview(options) {
|
|
37
|
-
const tempRoot = mkdtempSync(join(tmpdir(), "interf-workflow-preview-"));
|
|
38
|
-
projectRawSnapshot({
|
|
39
|
-
sourcePath: options.datasetPath,
|
|
40
|
-
destinationPath: tempRoot,
|
|
41
|
-
compiledPath: tempRoot,
|
|
42
|
-
mode: "copy",
|
|
43
|
-
prune: true,
|
|
44
|
-
preserveTimestamps: true,
|
|
45
|
-
});
|
|
46
|
-
copyDirectory(options.workflowPath, workflowDefinitionPath(tempRoot, options.workflowId));
|
|
47
|
-
const compiledPath = createCompiled("preview", tempRoot, options.workflowId, options.about, tempRoot);
|
|
48
|
-
const result = await compileCompiled({
|
|
49
|
-
executor: options.executor,
|
|
50
|
-
compiledPath,
|
|
51
|
-
...(options.reporter ? { reporter: options.reporter } : {}),
|
|
52
|
-
preserveStageShells: "on-failure",
|
|
53
|
-
});
|
|
54
|
-
return {
|
|
55
|
-
tempRoot,
|
|
56
|
-
compiledPath,
|
|
57
|
-
compileResult: {
|
|
58
|
-
ok: result.ok,
|
|
59
|
-
failedStage: result.failedStage,
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
43
|
export async function runWorkflowAuthoringDraft(options) {
|
|
64
|
-
const workflowPath =
|
|
44
|
+
const workflowPath = createScratchLocalWorkflowPackage({
|
|
65
45
|
sourcePath: options.sourcePath,
|
|
66
|
-
baseWorkflowId: options.baseWorkflowId,
|
|
67
46
|
workflowId: options.workflowId,
|
|
68
47
|
label: options.label,
|
|
69
48
|
hint: options.hint,
|
|
70
49
|
});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
preview,
|
|
92
|
-
});
|
|
93
|
-
if (preview) {
|
|
94
|
-
rmSync(preview.tempRoot, { recursive: true, force: true });
|
|
95
|
-
preview = null;
|
|
96
|
-
}
|
|
97
|
-
const session = await runWorkflowEditSession({
|
|
98
|
-
executor: options.executor,
|
|
99
|
-
workflowPath,
|
|
100
|
-
shell,
|
|
101
|
-
prompt: buildWorkflowAuthoringPrompt(),
|
|
102
|
-
validate: validateWorkflowPackage,
|
|
103
|
-
});
|
|
104
|
-
return {
|
|
105
|
-
status: session.status,
|
|
106
|
-
changed: session.changed,
|
|
107
|
-
summary: session.summary,
|
|
108
|
-
validation: session.validation,
|
|
109
|
-
workflowPath,
|
|
110
|
-
shellPath: shell.rootPath,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
finally {
|
|
114
|
-
if (preview) {
|
|
115
|
-
rmSync(preview.tempRoot, { recursive: true, force: true });
|
|
116
|
-
}
|
|
50
|
+
const shell = createWorkflowAuthoringShell({
|
|
51
|
+
workflowPath,
|
|
52
|
+
workflowId: options.workflowId,
|
|
53
|
+
label: options.label,
|
|
54
|
+
referenceWorkflowId: options.baseWorkflowId ?? null,
|
|
55
|
+
datasetPath: options.datasetPath,
|
|
56
|
+
taskPrompt: options.taskPrompt,
|
|
57
|
+
checks: options.checks ?? [],
|
|
58
|
+
});
|
|
59
|
+
const session = await runWorkflowEditSession({
|
|
60
|
+
executor: options.executor,
|
|
61
|
+
workflowPath,
|
|
62
|
+
shell,
|
|
63
|
+
prompt: buildWorkflowAuthoringPrompt(),
|
|
64
|
+
validate: validateWorkflowPackage,
|
|
65
|
+
maxValidationRepairAttempts: 1,
|
|
66
|
+
onStatus: options.onStatus,
|
|
67
|
+
});
|
|
68
|
+
if (session.status !== "updated") {
|
|
69
|
+
rmSync(workflowPath, { recursive: true, force: true });
|
|
117
70
|
}
|
|
71
|
+
return {
|
|
72
|
+
status: session.status,
|
|
73
|
+
changed: session.changed,
|
|
74
|
+
summary: session.summary,
|
|
75
|
+
validation: session.validation,
|
|
76
|
+
workflowPath,
|
|
77
|
+
shellPath: shell.rootPath,
|
|
78
|
+
};
|
|
118
79
|
}
|
|
119
80
|
export function resolveWorkflowDraftPath(sourcePath, workflowId) {
|
|
120
81
|
return workflowDefinitionPath(sourcePath, workflowId);
|
|
@@ -13,4 +13,6 @@ export declare function runWorkflowEditSession(options: {
|
|
|
13
13
|
shell: WorkflowEditShellArtifacts;
|
|
14
14
|
prompt: string;
|
|
15
15
|
validate: (workflowPath: string) => WorkflowValidationResult;
|
|
16
|
+
maxValidationRepairAttempts?: number;
|
|
17
|
+
onStatus?: (line: string) => void;
|
|
16
18
|
}): Promise<WorkflowEditSessionResult>;
|
|
@@ -1,57 +1,91 @@
|
|
|
1
|
-
import { writeFileSync } from "node:fs";
|
|
1
|
+
import { appendFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { copyDirectory, directoriesMatch, } from "./lib/workflow-edit-utils.js";
|
|
3
3
|
export async function runWorkflowEditSession(options) {
|
|
4
4
|
copyDirectory(options.workflowPath, options.shell.workflowBeforePath);
|
|
5
5
|
writeFileSync(options.shell.promptLogPath, `${options.prompt}\n`);
|
|
6
|
-
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
code =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
6
|
+
const maxValidationRepairAttempts = options.maxValidationRepairAttempts ?? 0;
|
|
7
|
+
let prompt = options.prompt;
|
|
8
|
+
for (let attempt = 0; attempt <= maxValidationRepairAttempts; attempt += 1) {
|
|
9
|
+
let code = 1;
|
|
10
|
+
let executeError = null;
|
|
11
|
+
try {
|
|
12
|
+
code = await options.executor.execute(options.shell.rootPath, prompt, {
|
|
13
|
+
eventLogPath: options.shell.eventLogPath,
|
|
14
|
+
statusLogPath: options.shell.statusLogPath,
|
|
15
|
+
onStatus: options.onStatus,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
executeError = error instanceof Error ? error.message : String(error);
|
|
20
|
+
}
|
|
21
|
+
copyDirectory(options.workflowPath, options.shell.workflowAfterPath);
|
|
22
|
+
const changed = !directoriesMatch(options.shell.workflowBeforePath, options.shell.workflowAfterPath);
|
|
23
|
+
if (executeError) {
|
|
24
|
+
copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
|
|
25
|
+
return {
|
|
26
|
+
status: "executor-failed",
|
|
27
|
+
changed,
|
|
28
|
+
validation: null,
|
|
29
|
+
summary: `Workflow editor failed before completing: ${executeError}`,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (code !== 0) {
|
|
33
|
+
copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
|
|
34
|
+
return {
|
|
35
|
+
status: "executor-failed",
|
|
36
|
+
changed,
|
|
37
|
+
validation: null,
|
|
38
|
+
summary: `Workflow editor exited with code ${code}.`,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const validation = options.validate(options.workflowPath);
|
|
42
|
+
if (validation.ok) {
|
|
43
|
+
return {
|
|
44
|
+
status: changed ? "updated" : "no-change",
|
|
45
|
+
changed,
|
|
46
|
+
validation,
|
|
47
|
+
summary: changed
|
|
48
|
+
? "Workflow package updated and validated."
|
|
49
|
+
: "Workflow package is valid without additional edits.",
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const details = validation.errors.length > 0
|
|
53
|
+
? `: ${validation.errors.slice(0, 6).join("; ")}`
|
|
54
|
+
: "";
|
|
55
|
+
if (!changed || attempt >= maxValidationRepairAttempts) {
|
|
56
|
+
copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
|
|
57
|
+
return {
|
|
58
|
+
status: "invalid",
|
|
59
|
+
changed,
|
|
60
|
+
validation,
|
|
61
|
+
summary: changed
|
|
62
|
+
? `Workflow package failed validation: ${validation.summary}${details}`
|
|
63
|
+
: `Workflow package is invalid without any workflow edits: ${validation.summary}${details}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
prompt = [
|
|
67
|
+
"This is an automated Interf Method validation-repair pass.",
|
|
68
|
+
"The previous edit did not pass package validation.",
|
|
69
|
+
"Fix only the validation errors below. Do not redesign the Method.",
|
|
70
|
+
"",
|
|
71
|
+
"Validation errors:",
|
|
72
|
+
...validation.errors.slice(0, 12).map((error) => `- ${error}`),
|
|
73
|
+
"",
|
|
74
|
+
"Rules:",
|
|
75
|
+
"- Edit only files under `workflow/`.",
|
|
76
|
+
"- Keep every stage `skill_dir` matched by `workflow/compile/stages/<skill_dir>/SKILL.md`.",
|
|
77
|
+
"- Keep `workflow.schema.json` zone paths unique and non-overlapping.",
|
|
78
|
+
"- Keep acceptance zone keys declared in `workflow.schema.json`.",
|
|
79
|
+
"- Preserve root `home.md` as the main portable-context entrypoint when the Method writes an entrypoint.",
|
|
80
|
+
"- Stop as soon as the package should validate.",
|
|
81
|
+
].join("\n");
|
|
82
|
+
appendFileSync(options.shell.promptLogPath, `\n\n---\n\n${prompt}\n`);
|
|
48
83
|
}
|
|
84
|
+
copyDirectory(options.shell.workflowBeforePath, options.workflowPath);
|
|
49
85
|
return {
|
|
50
|
-
status:
|
|
51
|
-
changed,
|
|
52
|
-
validation,
|
|
53
|
-
summary:
|
|
54
|
-
? "Workflow package updated and validated."
|
|
55
|
-
: "Workflow package is valid without additional edits.",
|
|
86
|
+
status: "invalid",
|
|
87
|
+
changed: true,
|
|
88
|
+
validation: null,
|
|
89
|
+
summary: "Workflow package failed validation.",
|
|
56
90
|
};
|
|
57
91
|
}
|
|
@@ -42,7 +42,7 @@ function buildLoopContext(options) {
|
|
|
42
42
|
max_loops: options.maxLoops,
|
|
43
43
|
max_attempts: options.maxAttempts,
|
|
44
44
|
review_paths: resolveWorkflowImprovementReviewPaths(options.compiledPath),
|
|
45
|
-
|
|
45
|
+
readiness_checks: {
|
|
46
46
|
count: options.compiledConfig.checks.length,
|
|
47
47
|
questions: options.compiledConfig.checks.map((check, index) => ({
|
|
48
48
|
id: check.id ?? `check-${index + 1}`,
|
|
@@ -167,6 +167,7 @@ export async function runWorkflowImprovementLoop(options) {
|
|
|
167
167
|
shell,
|
|
168
168
|
prompt: buildWorkflowImprovementPrompt(),
|
|
169
169
|
validate: validateWorkflowPackage,
|
|
170
|
+
maxValidationRepairAttempts: 1,
|
|
170
171
|
});
|
|
171
172
|
const preservedShellManifestPath = freezeWorkflowImprovementShell(shell.rootPath);
|
|
172
173
|
writeWorkflowImprovementRunLedger(options.compiledPath, options.runId, buildWorkflowImprovementLoopRecord({
|
|
@@ -13,7 +13,7 @@ export const ContextInterfaceSchema = WorkflowCompiledSchemaSchema;
|
|
|
13
13
|
export const ContextInterfaceZoneSchema = WorkflowCompiledZoneSchema;
|
|
14
14
|
export const ContextInterfaceZoneIdSchema = WorkflowZoneIdSchema;
|
|
15
15
|
export const ContextInterfaceZoneRoleSchema = WorkflowZoneRoleSchema;
|
|
16
|
-
// Package-owned input contract for authoring, review, and future
|
|
16
|
+
// Package-owned input contract for authoring, review, and future authoring flows.
|
|
17
17
|
// This does not change compiler execution semantics; it describes what data a
|
|
18
18
|
// workflow expects to organize before the compiler materializes the context
|
|
19
19
|
// interface on disk.
|
|
@@ -54,7 +54,7 @@ export function contextInterfaceExists(rootPath) {
|
|
|
54
54
|
return existsSync(contextInterfaceFilePath(rootPath));
|
|
55
55
|
}
|
|
56
56
|
export function contextInterfaceRelativePath() {
|
|
57
|
-
return `
|
|
57
|
+
return `method/${CONTEXT_INTERFACE_FILE}`;
|
|
58
58
|
}
|
|
59
59
|
export function listContextInterfaceZones(contextInterface) {
|
|
60
60
|
return [...contextInterface.zones];
|
|
@@ -23,3 +23,9 @@ export declare function seedLocalWorkflowPackageFromBase(options: {
|
|
|
23
23
|
label: string;
|
|
24
24
|
hint: string;
|
|
25
25
|
}): string;
|
|
26
|
+
export declare function createScratchLocalWorkflowPackage(options: {
|
|
27
|
+
sourcePath: string;
|
|
28
|
+
workflowId: string;
|
|
29
|
+
label: string;
|
|
30
|
+
hint: string;
|
|
31
|
+
}): string;
|
|
@@ -135,7 +135,7 @@ function renderWorkflowReadme(workflow) {
|
|
|
135
135
|
"",
|
|
136
136
|
stageLines,
|
|
137
137
|
"",
|
|
138
|
-
"Interf runs the local copy of this package directly from `.interf/
|
|
138
|
+
"Interf runs the local copy of this package directly from `.interf/method/` inside each portable context.",
|
|
139
139
|
"",
|
|
140
140
|
].join("\n");
|
|
141
141
|
}
|
|
@@ -145,9 +145,10 @@ function renderDerivedWorkflowReadme(options) {
|
|
|
145
145
|
"",
|
|
146
146
|
options.hint,
|
|
147
147
|
"",
|
|
148
|
-
`This workflow package was
|
|
148
|
+
`This workflow package was forked from \`${options.baseWorkflowId}\` and materialized as a standalone package for this kind of work.`,
|
|
149
|
+
"It starts with that workflow's topology; edit the package when the work needs different stages, zones, or proof.",
|
|
149
150
|
"",
|
|
150
|
-
"Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance
|
|
151
|
+
"Interf runs the local copy of this package directly. Keep purpose, inputs, context interface, and stage docs self-contained in this folder instead of relying on runtime inheritance.",
|
|
151
152
|
"",
|
|
152
153
|
"## Emphasis",
|
|
153
154
|
"",
|
|
@@ -163,9 +164,23 @@ function renderSeedWorkflowReadme(options) {
|
|
|
163
164
|
"",
|
|
164
165
|
options.hint,
|
|
165
166
|
"",
|
|
166
|
-
`This workflow package was
|
|
167
|
+
`This workflow package was forked from \`${options.baseWorkflowId}\` as a standalone local package.`,
|
|
168
|
+
"It starts with that workflow's topology; edit the package when the work needs different stages, zones, or proof.",
|
|
167
169
|
"",
|
|
168
|
-
"Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance
|
|
170
|
+
"Interf runs the local copy of this package directly. Refine purpose, inputs, context interface, and stage instructions in this folder instead of relying on inheritance.",
|
|
171
|
+
"",
|
|
172
|
+
].join("\n");
|
|
173
|
+
}
|
|
174
|
+
function renderScratchWorkflowReadme(options) {
|
|
175
|
+
return [
|
|
176
|
+
`# ${options.label}`,
|
|
177
|
+
"",
|
|
178
|
+
options.hint,
|
|
179
|
+
"",
|
|
180
|
+
"This workflow package is a neutral from-scratch authoring scaffold.",
|
|
181
|
+
"",
|
|
182
|
+
"It is not copied from `interf-default`, and its placeholder stage is not a recommended topology.",
|
|
183
|
+
"Replace purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the workflow this source data and task actually need.",
|
|
169
184
|
"",
|
|
170
185
|
].join("\n");
|
|
171
186
|
}
|
|
@@ -181,13 +196,13 @@ function renderImproveSkill(workflow) {
|
|
|
181
196
|
"Default loop:",
|
|
182
197
|
"1. Read the loop context first.",
|
|
183
198
|
"2. Review preserved stage shells, runtime logs, and saved test runs from failed attempts.",
|
|
184
|
-
"3. Edit only the local
|
|
199
|
+
"3. Edit only the local Method package for this portable context to create a better Method variation for this kind of work.",
|
|
185
200
|
`4. Keep purpose, inputs, \`workflow.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
|
|
186
201
|
"",
|
|
187
202
|
"Guardrails:",
|
|
188
203
|
"- do not edit checks, test specs, or raw files",
|
|
189
204
|
"- do not hardcode expected answers into workflow docs",
|
|
190
|
-
"- keep this package standalone; do not add or rely on runtime `extends`
|
|
205
|
+
"- keep this package standalone; do not add or rely on runtime `extends`",
|
|
191
206
|
"- keep the workflow stack coherent: purpose, inputs, context interface, and stages should describe the same job",
|
|
192
207
|
"- prefer small, defensible workflow changes over random churn",
|
|
193
208
|
"",
|
|
@@ -291,7 +306,7 @@ export function seedCompiledWorkflowPackage(options) {
|
|
|
291
306
|
const sourceWorkflowPath = resolveWorkflowPackageSourcePath(options.sourcePath, resolvedWorkflow.id);
|
|
292
307
|
if (sourceWorkflowPath && isPortableWorkflowPackage(sourceWorkflowPath)) {
|
|
293
308
|
// Portable seed packages can be copied directly because compile runs the
|
|
294
|
-
// local package folder without
|
|
309
|
+
// local package folder without reading source-root workflow packages.
|
|
295
310
|
copyWorkflowPackageDirectory(sourceWorkflowPath, workflowPackagePath(options.compiledPath));
|
|
296
311
|
patchWorkflowPackageMetadata(workflowPackagePath(options.compiledPath), {
|
|
297
312
|
id: resolvedWorkflow.id,
|
|
@@ -387,3 +402,95 @@ export function seedLocalWorkflowPackageFromBase(options) {
|
|
|
387
402
|
writeWorkflowPackageToDir(targetPath, localWorkflow);
|
|
388
403
|
return targetPath;
|
|
389
404
|
}
|
|
405
|
+
export function createScratchLocalWorkflowPackage(options) {
|
|
406
|
+
const targetPath = workflowDefinitionPath(options.sourcePath, options.workflowId);
|
|
407
|
+
const workflow = {
|
|
408
|
+
id: options.workflowId,
|
|
409
|
+
compilerApi: {
|
|
410
|
+
kind: "compiled",
|
|
411
|
+
version: 1,
|
|
412
|
+
},
|
|
413
|
+
purpose: {
|
|
414
|
+
label: "From-scratch workflow draft",
|
|
415
|
+
taskHint: "Replace this neutral scaffold with the workflow stages, outputs, and proof rules this work requires.",
|
|
416
|
+
},
|
|
417
|
+
inputs: [
|
|
418
|
+
{
|
|
419
|
+
id: "raw",
|
|
420
|
+
label: "Raw",
|
|
421
|
+
description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
|
|
422
|
+
required: true,
|
|
423
|
+
},
|
|
424
|
+
],
|
|
425
|
+
label: options.label,
|
|
426
|
+
hint: options.hint,
|
|
427
|
+
recommended: false,
|
|
428
|
+
scope: "local",
|
|
429
|
+
contextInterface: {
|
|
430
|
+
kind: "workflow-schema",
|
|
431
|
+
version: 1,
|
|
432
|
+
target_type: "compiled",
|
|
433
|
+
label: `${options.label} workflow schema`,
|
|
434
|
+
zones: [
|
|
435
|
+
{
|
|
436
|
+
id: "raw",
|
|
437
|
+
role: "input",
|
|
438
|
+
path: "raw",
|
|
439
|
+
kind: "directory",
|
|
440
|
+
required: true,
|
|
441
|
+
owned_by: [],
|
|
442
|
+
description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
id: "draft-context",
|
|
446
|
+
role: "output",
|
|
447
|
+
path: "draft",
|
|
448
|
+
kind: "directory",
|
|
449
|
+
required: true,
|
|
450
|
+
owned_by: ["prepare"],
|
|
451
|
+
description: "Temporary placeholder output zone for the neutral authoring scaffold. Replace it with task-specific output zones.",
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
id: "runtime",
|
|
455
|
+
role: "runtime",
|
|
456
|
+
path: ".interf/runtime",
|
|
457
|
+
kind: "runtime",
|
|
458
|
+
required: true,
|
|
459
|
+
owned_by: [],
|
|
460
|
+
description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
|
|
461
|
+
},
|
|
462
|
+
],
|
|
463
|
+
},
|
|
464
|
+
stages: [
|
|
465
|
+
{
|
|
466
|
+
id: "prepare",
|
|
467
|
+
label: "Prepare",
|
|
468
|
+
description: "Neutral placeholder stage for workflow authoring. Replace this stage with the topology this work needs.",
|
|
469
|
+
contractType: "workflow-draft-stage",
|
|
470
|
+
skillDir: "prepare",
|
|
471
|
+
reads: ["raw", "runtime"],
|
|
472
|
+
writes: ["draft-context"],
|
|
473
|
+
acceptance: {
|
|
474
|
+
stage_truthy: ["finished_at"],
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
],
|
|
478
|
+
stagePolicyNotes: {
|
|
479
|
+
prepare: [
|
|
480
|
+
"This is a neutral authoring scaffold, not a recommended workflow topology.",
|
|
481
|
+
"Replace this stage, output zone, and proof rule when drafting the final workflow.",
|
|
482
|
+
],
|
|
483
|
+
},
|
|
484
|
+
starterDocs: [
|
|
485
|
+
{
|
|
486
|
+
relativePath: "README.md",
|
|
487
|
+
content: renderScratchWorkflowReadme({
|
|
488
|
+
label: options.label,
|
|
489
|
+
hint: options.hint,
|
|
490
|
+
}),
|
|
491
|
+
},
|
|
492
|
+
],
|
|
493
|
+
};
|
|
494
|
+
writeWorkflowPackageToDir(targetPath, workflow);
|
|
495
|
+
return targetPath;
|
|
496
|
+
}
|
|
@@ -33,6 +33,9 @@ const LocalWorkflowDefinitionSchema = z.object({
|
|
|
33
33
|
stage_policy_notes: z.record(z.string(), z.array(z.string())).optional(),
|
|
34
34
|
});
|
|
35
35
|
function workflowRootPath(sourcePath) {
|
|
36
|
+
return join(sourcePath, "interf", "methods");
|
|
37
|
+
}
|
|
38
|
+
function legacyWorkflowRootPath(sourcePath) {
|
|
36
39
|
return join(sourcePath, "interf", "workflows");
|
|
37
40
|
}
|
|
38
41
|
function builtinWorkflowRootPath(workflowId) {
|
|
@@ -41,6 +44,9 @@ function builtinWorkflowRootPath(workflowId) {
|
|
|
41
44
|
export function workflowDefinitionPath(sourcePath, id) {
|
|
42
45
|
return join(workflowRootPath(sourcePath), id);
|
|
43
46
|
}
|
|
47
|
+
function legacyWorkflowDefinitionPath(sourcePath, id) {
|
|
48
|
+
return join(legacyWorkflowRootPath(sourcePath), id);
|
|
49
|
+
}
|
|
44
50
|
function isSupportedWorkflowStarterDocPath(relativePath) {
|
|
45
51
|
if (relativePath === "README.md")
|
|
46
52
|
return true;
|
|
@@ -110,30 +116,36 @@ export function loadWorkflowDefinitionFromDir(dirPath) {
|
|
|
110
116
|
};
|
|
111
117
|
}
|
|
112
118
|
export function listLocalWorkflowDefinitions(sourcePath) {
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
.map((entry) => join(root, entry))
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
const definitions = new Map();
|
|
120
|
+
for (const root of [legacyWorkflowRootPath(sourcePath), workflowRootPath(sourcePath)]) {
|
|
121
|
+
if (!existsSync(root))
|
|
122
|
+
continue;
|
|
123
|
+
for (const entryPath of readdirSync(root).map((entry) => join(root, entry))) {
|
|
124
|
+
try {
|
|
125
|
+
if (!statSync(entryPath).isDirectory())
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const definition = loadWorkflowDefinitionFromDir(entryPath);
|
|
132
|
+
if (definition)
|
|
133
|
+
definitions.set(definition.id, definition);
|
|
124
134
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.filter((definition) => definition !== null)
|
|
128
|
-
.sort((a, b) => a.label.localeCompare(b.label));
|
|
135
|
+
}
|
|
136
|
+
return [...definitions.values()].sort((a, b) => a.label.localeCompare(b.label));
|
|
129
137
|
}
|
|
130
138
|
export function loadLocalWorkflowDefinition(sourcePath, id) {
|
|
131
|
-
return loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id))
|
|
139
|
+
return (loadWorkflowDefinitionFromDir(workflowDefinitionPath(sourcePath, id)) ??
|
|
140
|
+
loadWorkflowDefinitionFromDir(legacyWorkflowDefinitionPath(sourcePath, id)));
|
|
132
141
|
}
|
|
133
142
|
export function resolveWorkflowPackageSourcePath(sourcePath, workflowId) {
|
|
134
143
|
const localPath = workflowDefinitionPath(sourcePath, workflowId);
|
|
135
144
|
if (existsSync(join(localPath, "workflow.json")))
|
|
136
145
|
return localPath;
|
|
146
|
+
const legacyLocalPath = legacyWorkflowDefinitionPath(sourcePath, workflowId);
|
|
147
|
+
if (existsSync(join(legacyLocalPath, "workflow.json")))
|
|
148
|
+
return legacyLocalPath;
|
|
137
149
|
const builtinPath = builtinWorkflowRootPath(workflowId);
|
|
138
150
|
if (existsSync(join(builtinPath, "workflow.json")))
|
|
139
151
|
return builtinPath;
|
|
@@ -155,7 +167,11 @@ export function seedLocalDefaultWorkflow(options) {
|
|
|
155
167
|
throw new Error(`Built-in "interf" workflow not found at ${builtinInterfPath}.`);
|
|
156
168
|
}
|
|
157
169
|
copyWorkflowPackageDirectory(builtinInterfPath, targetPath);
|
|
158
|
-
patchWorkflowPackageMetadata(targetPath, {
|
|
170
|
+
patchWorkflowPackageMetadata(targetPath, {
|
|
171
|
+
id: workflowId,
|
|
172
|
+
label: "Built-in Interf Workflow",
|
|
173
|
+
hint: "Built-in file-processing workflow: summarize source-grounded evidence, structure cross-file connections, and shape portable context around the saved readiness checks.",
|
|
174
|
+
});
|
|
159
175
|
return { workflowId, targetPath, alreadyExisted: false };
|
|
160
176
|
}
|
|
161
177
|
export function isWorkflowId(value) {
|
|
@@ -61,7 +61,7 @@ export declare function listCompiledWorkflowChoices(sourcePath?: string): Workfl
|
|
|
61
61
|
export declare function getCompiledWorkflow(workflowId: CompiledWorkflowId, options?: {
|
|
62
62
|
sourcePath?: string;
|
|
63
63
|
}): WorkflowDefinition<string>;
|
|
64
|
-
export declare function getActiveCompiledWorkflow(compiledPath: string
|
|
64
|
+
export declare function getActiveCompiledWorkflow(compiledPath: string): WorkflowDefinition<string>;
|
|
65
65
|
export declare function resolveCompiledWorkflowId(value: unknown): CompiledWorkflowId | null;
|
|
66
66
|
export declare function resolveCompiledWorkflowFromConfig(config: unknown): CompiledWorkflowId | null;
|
|
67
67
|
export declare function resolveRequiredCompiledWorkflowFromConfig(config: unknown, label?: string): CompiledWorkflowId;
|
|
@@ -75,8 +75,8 @@ export declare function getWorkflowStagePosition(workflowId: WorkflowId, stage:
|
|
|
75
75
|
stages: string[];
|
|
76
76
|
} | null;
|
|
77
77
|
export declare function getWorkflowStages(workflowId: WorkflowId, sourcePath?: string): string[];
|
|
78
|
-
export declare function getActiveCompiledStages(compiledPath: string
|
|
78
|
+
export declare function getActiveCompiledStages(compiledPath: string): string[];
|
|
79
79
|
export declare function getWorkflowStagePolicyNotes(workflowId: WorkflowId, stage: string, sourcePath?: string): string[];
|
|
80
|
-
export declare function getActiveCompiledStagePolicyNotes(compiledPath: string,
|
|
81
|
-
export declare function resolveActiveCompiledStageAcceptance(compiledPath: string,
|
|
82
|
-
export declare function formatActiveCompiledWorkflowStageStep(compiledPath: string,
|
|
80
|
+
export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, stage: string): string[];
|
|
81
|
+
export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
|
|
82
|
+
export declare function formatActiveCompiledWorkflowStageStep(compiledPath: string, stage: string): string;
|