@interf/compiler 0.4.0 → 0.5.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 +71 -69
- package/builtin-workflows/interf/README.md +6 -6
- package/builtin-workflows/interf/compile/stages/shape/SKILL.md +7 -7
- package/builtin-workflows/interf/compile/stages/structure/SKILL.md +2 -2
- package/builtin-workflows/interf/compile/stages/summarize/SKILL.md +1 -1
- package/builtin-workflows/interf/{workspace.schema.json → compiled.schema.json} +5 -5
- package/builtin-workflows/interf/improve/SKILL.md +3 -3
- package/builtin-workflows/interf/use/query/SKILL.md +2 -2
- package/builtin-workflows/interf/workflow.json +42 -31
- package/dist/commands/check-draft.d.ts +19 -0
- package/dist/commands/check-draft.js +110 -0
- package/dist/commands/compile-controller.d.ts +4 -4
- package/dist/commands/compile-controller.js +117 -81
- package/dist/commands/compile.d.ts +5 -5
- package/dist/commands/compile.js +61 -62
- package/dist/commands/compiled-flow.d.ts +23 -0
- package/dist/commands/compiled-flow.js +112 -0
- package/dist/commands/create-workflow-wizard.d.ts +3 -3
- package/dist/commands/create-workflow-wizard.js +11 -11
- package/dist/commands/create.d.ts +2 -2
- package/dist/commands/create.js +50 -57
- package/dist/commands/default.js +2 -2
- package/dist/commands/executor-flow.d.ts +20 -1
- package/dist/commands/executor-flow.js +67 -7
- package/dist/commands/init.js +242 -289
- package/dist/commands/list.js +14 -10
- package/dist/commands/reset.js +6 -6
- package/dist/commands/source-config-wizard.d.ts +12 -8
- package/dist/commands/source-config-wizard.js +356 -119
- package/dist/commands/status.js +49 -26
- package/dist/commands/test-flow.d.ts +23 -10
- package/dist/commands/test-flow.js +278 -58
- package/dist/commands/test.d.ts +7 -1
- package/dist/commands/test.js +264 -65
- package/dist/commands/verify.js +23 -14
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -4
- package/dist/lib/agent-args.js +2 -1
- package/dist/lib/agent-constants.js +1 -1
- package/dist/lib/agent-render.js +4 -4
- package/dist/lib/agent-shells.d.ts +8 -8
- package/dist/lib/agent-shells.js +231 -142
- package/dist/lib/compiled-compile.d.ts +52 -0
- package/dist/lib/compiled-compile.js +274 -0
- package/dist/lib/compiled-home.d.ts +5 -0
- package/dist/lib/compiled-home.js +32 -0
- package/dist/lib/compiled-layout.d.ts +2 -0
- package/dist/lib/compiled-layout.js +60 -0
- package/dist/lib/compiled-paths.d.ts +41 -0
- package/dist/lib/compiled-paths.js +111 -0
- package/dist/lib/{workspace-raw.d.ts → compiled-raw.d.ts} +8 -7
- package/dist/lib/{workspace-raw.js → compiled-raw.js} +16 -14
- package/dist/lib/compiled-reset.d.ts +1 -0
- package/dist/lib/compiled-reset.js +44 -0
- package/dist/lib/compiled-schema.d.ts +27 -0
- package/dist/lib/compiled-schema.js +110 -0
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +0 -1
- package/dist/lib/discovery.d.ts +1 -1
- package/dist/lib/discovery.js +3 -3
- package/dist/lib/interf-bootstrap.d.ts +1 -1
- package/dist/lib/interf-bootstrap.js +4 -4
- package/dist/lib/interf-detect.d.ts +10 -10
- package/dist/lib/interf-detect.js +78 -56
- package/dist/lib/interf-scaffold.d.ts +2 -2
- package/dist/lib/interf-scaffold.js +90 -57
- package/dist/lib/interf-workflow-package.d.ts +3 -3
- package/dist/lib/interf-workflow-package.js +30 -30
- package/dist/lib/interf.d.ts +5 -5
- package/dist/lib/interf.js +4 -4
- package/dist/lib/local-workflows.d.ts +4 -4
- package/dist/lib/local-workflows.js +35 -70
- package/dist/lib/obsidian.d.ts +1 -1
- package/dist/lib/parse.js +92 -1
- package/dist/lib/project-paths.d.ts +13 -0
- package/dist/lib/project-paths.js +29 -0
- package/dist/lib/runtime-acceptance.d.ts +7 -1
- package/dist/lib/runtime-acceptance.js +194 -59
- package/dist/lib/runtime-contracts.d.ts +2 -4
- package/dist/lib/runtime-contracts.js +17 -161
- package/dist/lib/runtime-inventory.d.ts +7 -0
- package/dist/lib/runtime-inventory.js +29 -0
- package/dist/lib/runtime-paths.js +5 -5
- package/dist/lib/runtime-prompt.js +9 -6
- package/dist/lib/runtime-reconcile.d.ts +2 -3
- package/dist/lib/runtime-reconcile.js +92 -171
- package/dist/lib/runtime-runs.js +30 -39
- package/dist/lib/runtime-types.d.ts +10 -19
- package/dist/lib/runtime.d.ts +2 -2
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/schema.d.ts +163 -140
- package/dist/lib/schema.js +163 -124
- package/dist/lib/source-config.d.ts +24 -20
- package/dist/lib/source-config.js +154 -116
- package/dist/lib/state-artifacts.d.ts +5 -5
- package/dist/lib/state-artifacts.js +8 -8
- package/dist/lib/state-health.d.ts +4 -4
- package/dist/lib/state-health.js +108 -126
- package/dist/lib/state-io.d.ts +8 -8
- package/dist/lib/state-io.js +77 -50
- package/dist/lib/state-paths.js +5 -5
- package/dist/lib/state-view.d.ts +4 -4
- package/dist/lib/state-view.js +52 -55
- package/dist/lib/state.d.ts +5 -5
- package/dist/lib/state.js +4 -4
- package/dist/lib/summarize-plan.d.ts +3 -2
- package/dist/lib/summarize-plan.js +18 -16
- package/dist/lib/test-execution.js +9 -9
- package/dist/lib/test-matrices.d.ts +3 -3
- package/dist/lib/test-matrices.js +6 -6
- package/dist/lib/test-paths.d.ts +4 -4
- package/dist/lib/test-paths.js +16 -10
- package/dist/lib/test-sandbox.d.ts +1 -1
- package/dist/lib/test-sandbox.js +38 -31
- package/dist/lib/test-targets.d.ts +2 -2
- package/dist/lib/test-targets.js +11 -11
- package/dist/lib/test-types.d.ts +1 -1
- package/dist/lib/test.d.ts +1 -1
- package/dist/lib/test.js +1 -1
- package/dist/lib/util.d.ts +2 -0
- package/dist/lib/util.js +14 -1
- package/dist/lib/validate-compiled.d.ts +27 -0
- package/dist/lib/validate-compiled.js +236 -0
- package/dist/lib/validate-helpers.d.ts +0 -8
- package/dist/lib/validate-helpers.js +0 -30
- package/dist/lib/validate.d.ts +4 -4
- package/dist/lib/validate.js +49 -15
- package/dist/lib/workflow-abi.d.ts +37 -46
- package/dist/lib/workflow-abi.js +51 -76
- package/dist/lib/workflow-definitions.d.ts +11 -11
- package/dist/lib/workflow-definitions.js +36 -53
- package/dist/lib/workflow-helpers.d.ts +2 -3
- package/dist/lib/workflow-helpers.js +9 -13
- package/dist/lib/workflow-improvement.d.ts +3 -3
- package/dist/lib/workflow-improvement.js +48 -48
- package/dist/lib/workflow-review-paths.d.ts +3 -3
- package/dist/lib/workflow-review-paths.js +11 -11
- package/dist/lib/workflow-stage-runner.d.ts +1 -1
- package/dist/lib/workflow-stage-runner.js +8 -8
- package/dist/lib/workflows.d.ts +9 -9
- package/dist/lib/workflows.js +15 -17
- package/package.json +10 -9
- package/dist/commands/workspace-flow.d.ts +0 -23
- package/dist/commands/workspace-flow.js +0 -109
- package/dist/lib/registry.d.ts +0 -16
- package/dist/lib/registry.js +0 -65
- package/dist/lib/validate-workspace.d.ts +0 -121
- package/dist/lib/validate-workspace.js +0 -407
- package/dist/lib/workspace-compile.d.ts +0 -54
- package/dist/lib/workspace-compile.js +0 -476
- package/dist/lib/workspace-home.d.ts +0 -5
- package/dist/lib/workspace-home.js +0 -32
- package/dist/lib/workspace-layout.d.ts +0 -2
- package/dist/lib/workspace-layout.js +0 -60
- package/dist/lib/workspace-paths.d.ts +0 -41
- package/dist/lib/workspace-paths.js +0 -107
- package/dist/lib/workspace-reset.d.ts +0 -1
- package/dist/lib/workspace-reset.js +0 -43
- package/dist/lib/workspace-schema.d.ts +0 -17
- package/dist/lib/workspace-schema.js +0 -74
package/dist/lib/workflow-abi.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export const
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
1
|
+
export const COMPILED_CONTRACT_TYPES = [
|
|
2
|
+
"compiled-file-evidence",
|
|
3
|
+
"compiled-knowledge-structure",
|
|
4
|
+
"compiled-query-shape",
|
|
5
5
|
];
|
|
6
|
-
export const
|
|
6
|
+
export const COMPILED_ZONE_KINDS = [
|
|
7
7
|
"directory",
|
|
8
8
|
"file",
|
|
9
9
|
"runtime",
|
|
10
10
|
];
|
|
11
|
-
export const
|
|
12
|
-
"
|
|
11
|
+
export const COMPILED_CONTRACT_FAMILY_METADATA = {
|
|
12
|
+
"compiled-file-evidence": {
|
|
13
13
|
order: 0,
|
|
14
14
|
bundledSkill: "compile/stages/summarize",
|
|
15
15
|
},
|
|
16
|
-
"
|
|
16
|
+
"compiled-knowledge-structure": {
|
|
17
17
|
order: 1,
|
|
18
18
|
bundledSkill: "compile/stages/structure",
|
|
19
19
|
},
|
|
20
|
-
"
|
|
20
|
+
"compiled-query-shape": {
|
|
21
21
|
order: 2,
|
|
22
22
|
bundledSkill: "compile/stages/shape",
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
|
-
export const
|
|
25
|
+
export const BUILTIN_COMPILED_STAGE_IDS = {
|
|
26
26
|
SUMMARIZE: "summarize",
|
|
27
27
|
STRUCTURE: "structure",
|
|
28
28
|
SHAPE: "shape",
|
|
29
29
|
};
|
|
30
|
-
export const
|
|
30
|
+
export const BUILTIN_COMPILED_ZONE_IDS = {
|
|
31
31
|
RAW: "raw",
|
|
32
32
|
SUMMARIES: "summaries",
|
|
33
33
|
KNOWLEDGE_ENTITIES: "knowledge-entities",
|
|
@@ -36,146 +36,121 @@ export const BUILTIN_WORKSPACE_ZONE_IDS = {
|
|
|
36
36
|
HOME: "home",
|
|
37
37
|
RUNTIME: "runtime",
|
|
38
38
|
};
|
|
39
|
-
export const
|
|
39
|
+
export const BUILTIN_COMPILED_ZONE_SPECS = [
|
|
40
40
|
{
|
|
41
|
-
id:
|
|
41
|
+
id: BUILTIN_COMPILED_ZONE_IDS.RAW,
|
|
42
42
|
path: "raw",
|
|
43
43
|
kind: "directory",
|
|
44
44
|
required: true,
|
|
45
|
-
description: "
|
|
45
|
+
description: "Compiled-local raw snapshot copied from the dataset for direct evidence and verification.",
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
id:
|
|
48
|
+
id: BUILTIN_COMPILED_ZONE_IDS.SUMMARIES,
|
|
49
49
|
path: "summaries",
|
|
50
50
|
kind: "directory",
|
|
51
51
|
required: true,
|
|
52
52
|
description: "Per-file evidence notes produced by file-evidence stages.",
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
id:
|
|
55
|
+
id: BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
56
56
|
path: "knowledge/entities",
|
|
57
57
|
kind: "directory",
|
|
58
58
|
required: true,
|
|
59
59
|
description: "Canonical entity notes produced by knowledge-structure stages.",
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
id:
|
|
62
|
+
id: BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
63
63
|
path: "knowledge/claims",
|
|
64
64
|
kind: "directory",
|
|
65
65
|
required: true,
|
|
66
66
|
description: "Claim notes produced by knowledge-structure stages.",
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
id:
|
|
69
|
+
id: BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
70
70
|
path: "knowledge/indexes",
|
|
71
71
|
kind: "directory",
|
|
72
72
|
required: true,
|
|
73
73
|
description: "Retrieval indexes and navigation notes produced by structure and shape stages.",
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
id:
|
|
76
|
+
id: BUILTIN_COMPILED_ZONE_IDS.HOME,
|
|
77
77
|
path: "home.md",
|
|
78
78
|
kind: "file",
|
|
79
79
|
required: true,
|
|
80
|
-
description: "Primary entrypoint note for agents using the compiled
|
|
80
|
+
description: "Primary entrypoint note for agents using the compiled dataset.",
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
id:
|
|
83
|
+
id: BUILTIN_COMPILED_ZONE_IDS.RUNTIME,
|
|
84
84
|
path: ".interf/runtime",
|
|
85
85
|
kind: "runtime",
|
|
86
86
|
required: true,
|
|
87
87
|
description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
|
|
88
88
|
},
|
|
89
89
|
];
|
|
90
|
-
export const
|
|
90
|
+
export const BUILTIN_COMPILED_STAGE_ACCESS_PATTERNS = [
|
|
91
91
|
{
|
|
92
|
-
id:
|
|
92
|
+
id: BUILTIN_COMPILED_STAGE_IDS.SUMMARIZE,
|
|
93
93
|
label: "Summarize",
|
|
94
94
|
description: "Turn source files into per-file summaries.",
|
|
95
|
-
contractType: "
|
|
95
|
+
contractType: "compiled-file-evidence",
|
|
96
96
|
skillDir: "summarize",
|
|
97
97
|
reads: [
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
BUILTIN_COMPILED_ZONE_IDS.RAW,
|
|
99
|
+
BUILTIN_COMPILED_ZONE_IDS.RUNTIME,
|
|
100
100
|
],
|
|
101
101
|
writes: [
|
|
102
|
-
|
|
102
|
+
BUILTIN_COMPILED_ZONE_IDS.SUMMARIES,
|
|
103
103
|
],
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
|
-
id:
|
|
106
|
+
id: BUILTIN_COMPILED_STAGE_IDS.STRUCTURE,
|
|
107
107
|
label: "Structure",
|
|
108
108
|
description: "Build the cross-file knowledge structure from the summaries.",
|
|
109
|
-
contractType: "
|
|
109
|
+
contractType: "compiled-knowledge-structure",
|
|
110
110
|
skillDir: "structure",
|
|
111
111
|
reads: [
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
BUILTIN_COMPILED_ZONE_IDS.SUMMARIES,
|
|
113
|
+
BUILTIN_COMPILED_ZONE_IDS.RUNTIME,
|
|
114
114
|
],
|
|
115
115
|
writes: [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
117
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
118
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
119
119
|
],
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
id:
|
|
122
|
+
id: BUILTIN_COMPILED_STAGE_IDS.SHAPE,
|
|
123
123
|
label: "Shape",
|
|
124
|
-
description: "Shape the final
|
|
125
|
-
contractType: "
|
|
124
|
+
description: "Shape the final compiled around the saved focus and truth checks.",
|
|
125
|
+
contractType: "compiled-query-shape",
|
|
126
126
|
skillDir: "shape",
|
|
127
127
|
reads: [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
BUILTIN_COMPILED_ZONE_IDS.RAW,
|
|
129
|
+
BUILTIN_COMPILED_ZONE_IDS.SUMMARIES,
|
|
130
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_ENTITIES,
|
|
131
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_CLAIMS,
|
|
132
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
133
|
+
BUILTIN_COMPILED_ZONE_IDS.RUNTIME,
|
|
134
134
|
],
|
|
135
135
|
writes: [
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
BUILTIN_COMPILED_ZONE_IDS.KNOWLEDGE_INDEXES,
|
|
137
|
+
BUILTIN_COMPILED_ZONE_IDS.HOME,
|
|
138
138
|
],
|
|
139
139
|
},
|
|
140
140
|
];
|
|
141
|
-
export function
|
|
142
|
-
return
|
|
141
|
+
export function listBuiltinCompiledZoneSpecs() {
|
|
142
|
+
return BUILTIN_COMPILED_ZONE_SPECS.map((zone) => ({ ...zone }));
|
|
143
143
|
}
|
|
144
|
-
export function
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
export function hasValidWorkspaceContractSequence(contractTypes) {
|
|
148
|
-
return contractTypes.every((contractType, index) => index === 0 ||
|
|
149
|
-
workspaceContractOrder(contractType) >= workspaceContractOrder(contractTypes[index - 1]));
|
|
150
|
-
}
|
|
151
|
-
export function listMissingWorkspaceContractTypes(contractTypes) {
|
|
152
|
-
return WORKSPACE_CONTRACT_TYPES.filter((contractType) => !contractTypes.includes(contractType));
|
|
153
|
-
}
|
|
154
|
-
export function validateWorkspaceContractSequence(contractTypes) {
|
|
155
|
-
const missing = listMissingWorkspaceContractTypes(contractTypes);
|
|
156
|
-
const orderValid = hasValidWorkspaceContractSequence(contractTypes);
|
|
157
|
-
return {
|
|
158
|
-
ok: missing.length === 0 && orderValid,
|
|
159
|
-
orderValid,
|
|
160
|
-
missing,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
export function listBuiltinWorkspaceZoneSpecs() {
|
|
164
|
-
return BUILTIN_WORKSPACE_ZONE_SPECS.map((zone) => ({ ...zone }));
|
|
165
|
-
}
|
|
166
|
-
export function listBuiltinWorkspaceFallbackStages() {
|
|
167
|
-
return BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS.map((stage) => ({
|
|
144
|
+
export function listBuiltinCompiledFallbackStages() {
|
|
145
|
+
return BUILTIN_COMPILED_STAGE_ACCESS_PATTERNS.map((stage) => ({
|
|
168
146
|
id: stage.id,
|
|
169
147
|
contract_type: stage.contractType,
|
|
170
148
|
reads: [...stage.reads],
|
|
171
149
|
writes: [...stage.writes],
|
|
172
150
|
}));
|
|
173
151
|
}
|
|
174
|
-
export function
|
|
175
|
-
const writerContractTypes = new Set(BUILTIN_WORKSPACE_STAGE_ACCESS_PATTERNS
|
|
176
|
-
.filter((stage) => stage.writes.includes(zoneId))
|
|
177
|
-
.map((stage) => stage.contractType));
|
|
152
|
+
export function requiredCompiledZoneOwners(stages, zoneId) {
|
|
178
153
|
return Array.from(new Set(stages
|
|
179
|
-
.filter((stage) =>
|
|
154
|
+
.filter((stage) => stage.writes.includes(zoneId))
|
|
180
155
|
.map((stage) => stage.id)));
|
|
181
156
|
}
|
|
@@ -24,7 +24,7 @@ export interface WorkflowDefinition<TId extends string> {
|
|
|
24
24
|
starterDocs?: WorkflowStarterDoc[];
|
|
25
25
|
scope?: "builtin" | "local";
|
|
26
26
|
}
|
|
27
|
-
export type
|
|
27
|
+
export type CompiledWorkflowId = string;
|
|
28
28
|
export declare function standaloneWorkflowDefinitionFromLocalPackage(local: {
|
|
29
29
|
id: string;
|
|
30
30
|
compiler_api?: WorkflowCompilerApi;
|
|
@@ -43,14 +43,14 @@ export declare function standaloneWorkflowDefinitionFromLocalPackage(local: {
|
|
|
43
43
|
stage_policy_notes?: Record<string, string[]>;
|
|
44
44
|
starter_docs: WorkflowStarterDoc[];
|
|
45
45
|
}): WorkflowDefinition<string>;
|
|
46
|
-
export declare function
|
|
47
|
-
export declare function
|
|
46
|
+
export declare function listCompiledWorkflowChoices(sourcePath?: string): WorkflowDefinition<string>[];
|
|
47
|
+
export declare function getCompiledWorkflow(workflowId: CompiledWorkflowId, options?: {
|
|
48
48
|
sourcePath?: string;
|
|
49
49
|
}): WorkflowDefinition<string>;
|
|
50
|
-
export declare function
|
|
51
|
-
export declare function
|
|
52
|
-
export declare function
|
|
53
|
-
export declare function
|
|
50
|
+
export declare function getActiveCompiledWorkflow(compiledPath: string, fallbackWorkflowId: CompiledWorkflowId): WorkflowDefinition<string>;
|
|
51
|
+
export declare function resolveCompiledWorkflowId(value: unknown): CompiledWorkflowId;
|
|
52
|
+
export declare function resolveCompiledWorkflowFromConfig(config: unknown): CompiledWorkflowId;
|
|
53
|
+
export declare function formatCompiledWorkflowStageStep(workflowId: CompiledWorkflowId, stage: string, options?: {
|
|
54
54
|
sourcePath?: string;
|
|
55
55
|
}): string;
|
|
56
56
|
export declare function getWorkflowStageDefinition(workflowId: WorkflowId, stage: string, sourcePath?: string): WorkflowStageDefinition | null;
|
|
@@ -60,8 +60,8 @@ export declare function getWorkflowStagePosition(workflowId: WorkflowId, stage:
|
|
|
60
60
|
stages: string[];
|
|
61
61
|
} | null;
|
|
62
62
|
export declare function getWorkflowStages(workflowId: WorkflowId, sourcePath?: string): string[];
|
|
63
|
-
export declare function
|
|
63
|
+
export declare function getActiveCompiledStages(compiledPath: string, fallbackWorkflowId: WorkflowId): string[];
|
|
64
64
|
export declare function getWorkflowStagePolicyNotes(workflowId: WorkflowId, stage: string, sourcePath?: string): string[];
|
|
65
|
-
export declare function
|
|
66
|
-
export declare function
|
|
67
|
-
export declare function
|
|
65
|
+
export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, fallbackWorkflowId: WorkflowId, stage: string): string[];
|
|
66
|
+
export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, fallbackWorkflowId: WorkflowId, stage: string): WorkflowStageDefinition["acceptance"] | undefined;
|
|
67
|
+
export declare function formatActiveCompiledWorkflowStageStep(compiledPath: string, fallbackWorkflowId: CompiledWorkflowId, stage: string): string;
|
|
@@ -3,16 +3,9 @@ import { join } from "node:path";
|
|
|
3
3
|
import { isWorkflowId, listLocalWorkflowDefinitions, loadLocalWorkflowDefinition, loadWorkflowDefinitionFromDir, } from "./local-workflows.js";
|
|
4
4
|
import { PACKAGE_ROOT } from "./config.js";
|
|
5
5
|
import { resolveSourceControlPath } from "./interf.js";
|
|
6
|
-
import { validateWorkspaceContractSequence, } from "./workflow-abi.js";
|
|
7
6
|
import { warnInterf } from "./logger.js";
|
|
8
|
-
import {
|
|
7
|
+
import { workflowPackagePathForCompiled } from "./compiled-paths.js";
|
|
9
8
|
let builtinInterfWorkflowCache = null;
|
|
10
|
-
function validateWorkspaceStages(stages) {
|
|
11
|
-
if (stages.length < 3)
|
|
12
|
-
return false;
|
|
13
|
-
const sequence = validateWorkspaceContractSequence(stages.map((stage) => stage.contractType));
|
|
14
|
-
return sequence.ok;
|
|
15
|
-
}
|
|
16
9
|
function toWorkflowStages(stages, fallbackStages) {
|
|
17
10
|
if (!stages || stages.length === 0)
|
|
18
11
|
return [...fallbackStages];
|
|
@@ -42,13 +35,13 @@ function mergeStagePolicyNotes(stages, baseNotes, overrideNotes) {
|
|
|
42
35
|
}
|
|
43
36
|
export function standaloneWorkflowDefinitionFromLocalPackage(local) {
|
|
44
37
|
if (!local.stages || local.stages.length === 0) {
|
|
45
|
-
throw new Error(`Workflow package "${local.id}" is missing explicit stages.
|
|
38
|
+
throw new Error(`Workflow package "${local.id}" is missing explicit stages. Compiled-local and portable workflow packages must be standalone.`);
|
|
46
39
|
}
|
|
47
40
|
const stages = toWorkflowStages(local.stages, []);
|
|
48
41
|
return {
|
|
49
42
|
id: local.id,
|
|
50
43
|
compilerApi: local.compiler_api ?? {
|
|
51
|
-
kind: "
|
|
44
|
+
kind: "compiled",
|
|
52
45
|
version: 1,
|
|
53
46
|
},
|
|
54
47
|
label: local.label,
|
|
@@ -71,9 +64,6 @@ function getBuiltinInterfWorkflow() {
|
|
|
71
64
|
throw new Error("Missing built-in Interf workflow package at builtin-workflows/interf.");
|
|
72
65
|
}
|
|
73
66
|
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
67
|
builtinInterfWorkflowCache = {
|
|
78
68
|
...resolved,
|
|
79
69
|
id: "interf",
|
|
@@ -82,31 +72,28 @@ function getBuiltinInterfWorkflow() {
|
|
|
82
72
|
};
|
|
83
73
|
return builtinInterfWorkflowCache;
|
|
84
74
|
}
|
|
85
|
-
function
|
|
75
|
+
function listBuiltinCompiledWorkflows() {
|
|
86
76
|
return [getBuiltinInterfWorkflow()];
|
|
87
77
|
}
|
|
88
|
-
function
|
|
78
|
+
function resolveCompiledWorkflowFromLocal(workflowId, sourcePath) {
|
|
89
79
|
const local = loadLocalWorkflowDefinition(sourcePath, workflowId);
|
|
90
80
|
if (!local)
|
|
91
81
|
return null;
|
|
92
82
|
if (local.extends) {
|
|
93
|
-
throw new Error(`Workflow "${workflowId}" uses legacy extends. Rewrite it as a standalone package before creating or compiling a
|
|
83
|
+
throw new Error(`Workflow "${workflowId}" uses legacy extends. Rewrite it as a standalone package before creating or compiling a compiled dataset.`);
|
|
94
84
|
}
|
|
95
85
|
const resolved = standaloneWorkflowDefinitionFromLocalPackage(local);
|
|
96
|
-
if (!validateWorkspaceStages(resolved.stages)) {
|
|
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.`);
|
|
98
|
-
}
|
|
99
86
|
return resolved;
|
|
100
87
|
}
|
|
101
|
-
export function
|
|
102
|
-
const builtins =
|
|
88
|
+
export function listCompiledWorkflowChoices(sourcePath) {
|
|
89
|
+
const builtins = listBuiltinCompiledWorkflows();
|
|
103
90
|
if (!sourcePath)
|
|
104
91
|
return builtins;
|
|
105
92
|
const locals = listLocalWorkflowDefinitions(sourcePath)
|
|
106
93
|
.filter((definition) => definition.id !== "interf")
|
|
107
94
|
.map((definition) => {
|
|
108
95
|
try {
|
|
109
|
-
return
|
|
96
|
+
return resolveCompiledWorkflowFromLocal(definition.id, sourcePath);
|
|
110
97
|
}
|
|
111
98
|
catch (error) {
|
|
112
99
|
warnInterf(`Warning: skipping local workflow "${definition.id}" because it could not be resolved cleanly: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -116,66 +103,62 @@ export function listWorkspaceWorkflowChoices(sourcePath) {
|
|
|
116
103
|
.filter((definition) => definition !== null);
|
|
117
104
|
return [...builtins, ...locals];
|
|
118
105
|
}
|
|
119
|
-
export function
|
|
120
|
-
const builtin =
|
|
106
|
+
export function getCompiledWorkflow(workflowId, options = {}) {
|
|
107
|
+
const builtin = listBuiltinCompiledWorkflows().find((candidate) => candidate.id === workflowId);
|
|
121
108
|
if (builtin)
|
|
122
109
|
return builtin;
|
|
123
110
|
if (options.sourcePath) {
|
|
124
|
-
const local =
|
|
111
|
+
const local = resolveCompiledWorkflowFromLocal(workflowId, options.sourcePath);
|
|
125
112
|
if (local)
|
|
126
113
|
return local;
|
|
127
114
|
throw new Error(`No local workflow package found for "${workflowId}" under ${join(options.sourcePath, "interf", "workflows", workflowId)}.`);
|
|
128
115
|
}
|
|
129
116
|
throw new Error(`Workflow "${workflowId}" is not built-in. Provide a source path so Interf Compiler can resolve a local workflow package.`);
|
|
130
117
|
}
|
|
131
|
-
export function
|
|
132
|
-
const workflowPath =
|
|
118
|
+
export function getActiveCompiledWorkflow(compiledPath, fallbackWorkflowId) {
|
|
119
|
+
const workflowPath = workflowPackagePathForCompiled(compiledPath);
|
|
133
120
|
if (existsSync(join(workflowPath, "workflow.json"))) {
|
|
134
121
|
const local = loadWorkflowDefinitionFromDir(workflowPath);
|
|
135
122
|
if (!local) {
|
|
136
|
-
throw new Error(`
|
|
123
|
+
throw new Error(`Dataset-local workflow package at ${workflowPath} is missing or invalid. Interf compile runs the local package directly; recreate or reseed this compiled dataset instead of relying on source-root fallback.`);
|
|
137
124
|
}
|
|
138
125
|
if (local.extends) {
|
|
139
|
-
throw new Error(`
|
|
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.`);
|
|
126
|
+
throw new Error(`Dataset-local workflow package at ${workflowPath} still uses legacy extends. Materialize it as a standalone package before compiling this compiled dataset.`);
|
|
144
127
|
}
|
|
145
|
-
return
|
|
128
|
+
return standaloneWorkflowDefinitionFromLocalPackage(local);
|
|
146
129
|
}
|
|
147
|
-
throw new Error(`Missing
|
|
130
|
+
throw new Error(`Missing local workflow package at ${workflowPath}. Interf compile runs the local package directly, so recreate or reseed this compiled dataset instead of relying on source-root workflow "${fallbackWorkflowId}" under ${resolveSourceControlPath(compiledPath)}.`);
|
|
148
131
|
}
|
|
149
|
-
export function
|
|
132
|
+
export function resolveCompiledWorkflowId(value) {
|
|
150
133
|
if (typeof value === "string" && isWorkflowId(value)) {
|
|
151
134
|
return value;
|
|
152
135
|
}
|
|
153
136
|
return "interf";
|
|
154
137
|
}
|
|
155
|
-
export function
|
|
138
|
+
export function resolveCompiledWorkflowFromConfig(config) {
|
|
156
139
|
if (!config || typeof config !== "object")
|
|
157
140
|
return "interf";
|
|
158
141
|
const raw = config;
|
|
159
|
-
return
|
|
142
|
+
return resolveCompiledWorkflowId(raw.workflow);
|
|
160
143
|
}
|
|
161
|
-
export function
|
|
162
|
-
return formatWorkflowStageStep(
|
|
144
|
+
export function formatCompiledWorkflowStageStep(workflowId, stage, options = {}) {
|
|
145
|
+
return formatWorkflowStageStep(getCompiledWorkflow(workflowId, options), stage);
|
|
163
146
|
}
|
|
164
147
|
function resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath) {
|
|
165
148
|
if (sourcePath &&
|
|
166
|
-
existsSync(join(
|
|
167
|
-
return
|
|
149
|
+
existsSync(join(workflowPackagePathForCompiled(sourcePath), "workflow.json"))) {
|
|
150
|
+
return getActiveCompiledWorkflow(sourcePath, workflowId);
|
|
168
151
|
}
|
|
169
|
-
return
|
|
152
|
+
return getCompiledWorkflow(workflowId, { sourcePath });
|
|
170
153
|
}
|
|
171
154
|
function formatWorkflowStageStep(workflow, stage) {
|
|
172
155
|
const stageIndex = workflow.stages.findIndex((candidate) => candidate.id === stage);
|
|
173
156
|
if (stageIndex === -1) {
|
|
174
|
-
throw new Error(`Stage "${stage}" is not part of the
|
|
157
|
+
throw new Error(`Stage "${stage}" is not part of the compiled runtime.`);
|
|
175
158
|
}
|
|
176
159
|
const stageDefinition = workflow.stages[stageIndex];
|
|
177
160
|
if (!stageDefinition) {
|
|
178
|
-
throw new Error(`Stage "${stage}" is not part of the
|
|
161
|
+
throw new Error(`Stage "${stage}" is not part of the compiled runtime.`);
|
|
179
162
|
}
|
|
180
163
|
return `Step ${stageIndex + 1}/${workflow.stages.length} - ${stageDefinition.label}`;
|
|
181
164
|
}
|
|
@@ -197,20 +180,20 @@ export function getWorkflowStagePosition(workflowId, stage, sourcePath) {
|
|
|
197
180
|
export function getWorkflowStages(workflowId, sourcePath) {
|
|
198
181
|
return resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath).stages.map((definition) => definition.id);
|
|
199
182
|
}
|
|
200
|
-
export function
|
|
201
|
-
return
|
|
183
|
+
export function getActiveCompiledStages(compiledPath, fallbackWorkflowId) {
|
|
184
|
+
return getActiveCompiledWorkflow(compiledPath, fallbackWorkflowId).stages.map((definition) => definition.id);
|
|
202
185
|
}
|
|
203
186
|
export function getWorkflowStagePolicyNotes(workflowId, stage, sourcePath) {
|
|
204
187
|
const workflow = resolveWorkflowDefinitionForStageMetadata(workflowId, sourcePath);
|
|
205
188
|
return [...(workflow.stagePolicyNotes?.[stage] ?? [])];
|
|
206
189
|
}
|
|
207
|
-
export function
|
|
208
|
-
const workflow =
|
|
190
|
+
export function getActiveCompiledStagePolicyNotes(compiledPath, fallbackWorkflowId, stage) {
|
|
191
|
+
const workflow = getActiveCompiledWorkflow(compiledPath, fallbackWorkflowId);
|
|
209
192
|
return [...(workflow.stagePolicyNotes?.[stage] ?? [])];
|
|
210
193
|
}
|
|
211
|
-
export function
|
|
212
|
-
return
|
|
194
|
+
export function resolveActiveCompiledStageAcceptance(compiledPath, fallbackWorkflowId, stage) {
|
|
195
|
+
return getActiveCompiledWorkflow(compiledPath, fallbackWorkflowId).stages.find((candidate) => candidate.id === stage)?.acceptance;
|
|
213
196
|
}
|
|
214
|
-
export function
|
|
215
|
-
return formatWorkflowStageStep(
|
|
197
|
+
export function formatActiveCompiledWorkflowStageStep(compiledPath, fallbackWorkflowId, stage) {
|
|
198
|
+
return formatWorkflowStageStep(getActiveCompiledWorkflow(compiledPath, fallbackWorkflowId), stage);
|
|
216
199
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type LocalInstructionMode, type
|
|
1
|
+
import { type LocalInstructionMode, type RuntimeInstructionMode, type RuntimeStageInstructions } from "./schema.js";
|
|
2
2
|
import { type WorkflowStageDefinition } from "./workflow-definitions.js";
|
|
3
3
|
export interface WorkflowReporter {
|
|
4
4
|
line?: (message: string) => void;
|
|
@@ -24,11 +24,10 @@ export declare function emptyLocalSkillContractExtension(): LocalSkillContractEx
|
|
|
24
24
|
export declare function buildLocalSkillContractExtension(rootPath: string, directories: string[], purpose: string): LocalSkillContractExtension;
|
|
25
25
|
export declare function buildLocalSkillContractExtensionRelativeTo(rootPath: string, relativeToPath: string, directories: string[], purpose: string): LocalSkillContractExtension;
|
|
26
26
|
export declare function mergeLocalSkillContractExtensions(extensions: LocalSkillContractExtension[]): LocalSkillContractExtension;
|
|
27
|
-
export declare function buildStageInstructions(
|
|
27
|
+
export declare function buildStageInstructions(stageSkillDir: string, localSkills: LocalSkillContractExtension): RuntimeStageInstructions;
|
|
28
28
|
export declare function reportLine(reporter: WorkflowReporter | undefined, message: string): void;
|
|
29
29
|
export declare function reportBlankLine(reporter: WorkflowReporter | undefined): void;
|
|
30
30
|
export declare function reportValidationFailure(reporter: WorkflowReporter | undefined, summary: string, errors?: string[]): void;
|
|
31
|
-
export declare function bundledSkillForContractType(contractType: RuntimeContractType): string;
|
|
32
31
|
export declare function resolveStageAcceptance(workflowId: string, stageId: string, sourcePath?: string): WorkflowStageDefinition["acceptance"] | undefined;
|
|
33
32
|
export declare function validateStageOutcome(_dirPath: string, validation: {
|
|
34
33
|
ok: boolean;
|
|
@@ -2,10 +2,9 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
2
2
|
import { join, relative, sep } from "node:path";
|
|
3
3
|
import { listFilesRecursive } from "./filesystem.js";
|
|
4
4
|
import { isMarkdownFile } from "./util.js";
|
|
5
|
-
import {
|
|
6
|
-
import { getWorkspaceWorkflow, } from "./workflow-definitions.js";
|
|
5
|
+
import { getCompiledWorkflow, } from "./workflow-definitions.js";
|
|
7
6
|
import { parseJsonFrontmatter } from "./parse.js";
|
|
8
|
-
import {
|
|
7
|
+
import { workflowPackagePathForCompiled } from "./compiled-paths.js";
|
|
9
8
|
const LOCAL_SKILL_READ_LIMIT = 50;
|
|
10
9
|
export function workflowQueryDirectory() {
|
|
11
10
|
return "workflow/use/query";
|
|
@@ -41,7 +40,7 @@ function collectLocalSkillDocs(rootPath, directories) {
|
|
|
41
40
|
}
|
|
42
41
|
function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories) {
|
|
43
42
|
const docs = new Map();
|
|
44
|
-
const workflowRoot =
|
|
43
|
+
const workflowRoot = workflowPackagePathForCompiled(rootPath);
|
|
45
44
|
const rootReadme = join(workflowRoot, "README.md");
|
|
46
45
|
if (existsSync(rootReadme)) {
|
|
47
46
|
const read = projectWorkflowReadPath(rootPath, relativeToPath, rootReadme);
|
|
@@ -68,16 +67,16 @@ function collectLocalSkillDocsRelativeTo(rootPath, relativeToPath, directories)
|
|
|
68
67
|
}
|
|
69
68
|
function resolveAuthoringDirectory(rootPath, directory) {
|
|
70
69
|
if (directory === "workflow") {
|
|
71
|
-
return
|
|
70
|
+
return workflowPackagePathForCompiled(rootPath);
|
|
72
71
|
}
|
|
73
72
|
if (directory.startsWith(`workflow${sep}`) || directory.startsWith("workflow/")) {
|
|
74
73
|
const relativeWorkflowPath = directory.replace(/^workflow[\\/]/, "");
|
|
75
|
-
return join(
|
|
74
|
+
return join(workflowPackagePathForCompiled(rootPath), relativeWorkflowPath);
|
|
76
75
|
}
|
|
77
76
|
return join(rootPath, directory);
|
|
78
77
|
}
|
|
79
78
|
function projectWorkflowReadPath(rootPath, relativeToPath, absolutePath) {
|
|
80
|
-
const workflowRoot =
|
|
79
|
+
const workflowRoot = workflowPackagePathForCompiled(rootPath);
|
|
81
80
|
const normalizedWorkflowRoot = `${workflowRoot}${sep}`;
|
|
82
81
|
if (absolutePath === workflowRoot || absolutePath.startsWith(normalizedWorkflowRoot)) {
|
|
83
82
|
const relativeWorkflowPath = relative(workflowRoot, absolutePath);
|
|
@@ -139,9 +138,9 @@ export function mergeLocalSkillContractExtensions(extensions) {
|
|
|
139
138
|
modeSources,
|
|
140
139
|
};
|
|
141
140
|
}
|
|
142
|
-
export function buildStageInstructions(
|
|
141
|
+
export function buildStageInstructions(stageSkillDir, localSkills) {
|
|
143
142
|
return {
|
|
144
|
-
|
|
143
|
+
stage_skill_dir: stageSkillDir,
|
|
145
144
|
effective_mode: localSkills.effectiveMode,
|
|
146
145
|
local_mode: localSkills.localMode,
|
|
147
146
|
local_docs: localSkills.reads,
|
|
@@ -160,11 +159,8 @@ export function reportValidationFailure(reporter, summary, errors = []) {
|
|
|
160
159
|
reportLine(reporter, `- ${error}`);
|
|
161
160
|
}
|
|
162
161
|
}
|
|
163
|
-
export function bundledSkillForContractType(contractType) {
|
|
164
|
-
return workspaceBundledSkillForContractType(contractType);
|
|
165
|
-
}
|
|
166
162
|
export function resolveStageAcceptance(workflowId, stageId, sourcePath) {
|
|
167
|
-
return
|
|
163
|
+
return getCompiledWorkflow(workflowId, { sourcePath }).stages.find((stage) => stage.id === stageId)?.acceptance;
|
|
168
164
|
}
|
|
169
165
|
export function validateStageOutcome(_dirPath, validation) {
|
|
170
166
|
return validation;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { WorkflowExecutor } from "./executors.js";
|
|
2
2
|
import { type WorkflowValidationResult } from "./local-workflows.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { SourceDatasetConfig, WorkflowImprovementLoopSummary } from "./schema.js";
|
|
4
4
|
export interface WorkflowImprovementRunResult {
|
|
5
5
|
status: "updated" | "no-change" | "invalid" | "executor-failed";
|
|
6
6
|
changed: boolean;
|
|
@@ -11,9 +11,9 @@ export interface WorkflowImprovementRunResult {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function runWorkflowImprovementLoop(options: {
|
|
13
13
|
executor: WorkflowExecutor;
|
|
14
|
-
|
|
14
|
+
compiledPath: string;
|
|
15
15
|
workflowId: string;
|
|
16
|
-
|
|
16
|
+
compiledConfig: Pick<SourceDatasetConfig, "checks">;
|
|
17
17
|
runId: string;
|
|
18
18
|
loopIndex: number;
|
|
19
19
|
maxLoops: number;
|