@interf/compiler 0.16.0 → 0.18.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/LICENSE.md +1 -0
- package/README.md +10 -7
- package/TRADEMARKS.md +4 -4
- package/builtin-methods/interf-default/README.md +6 -7
- package/builtin-methods/interf-default/method.json +7 -68
- package/builtin-methods/interf-default/method.schema.json +52 -50
- package/dist/cli/commands/prep.js +58 -2
- package/dist/cli/commands/verify.d.ts +2 -0
- package/dist/cli/commands/verify.js +17 -8
- package/dist/cli/commands/wizard.js +122 -14
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/{13awzu4tooflw.css → 0_c_tvh-cukjz.css} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{0jipmpez3_ehh.js → 0f_geuwdesg_c.js} +42 -17
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/packages/contracts/index.d.ts +2 -2
- package/dist/packages/contracts/index.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +271 -72
- package/dist/packages/contracts/lib/schema.js +243 -83
- package/dist/packages/engine/action-definitions.js +1 -1
- package/dist/packages/engine/agents/lib/shells.d.ts +12 -4
- package/dist/packages/engine/agents/lib/shells.js +127 -120
- package/dist/packages/engine/cloud-seams.d.ts +115 -0
- package/dist/packages/engine/cloud-seams.js +84 -0
- package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
- package/dist/packages/engine/compile/artifact-counts.js +3 -3
- package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
- package/dist/packages/engine/compile/artifact-status.js +166 -0
- package/dist/packages/engine/compile/billing-events.d.ts +89 -0
- package/dist/packages/engine/compile/billing-events.js +74 -0
- package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
- package/dist/packages/engine/compile/check-evaluator.js +298 -0
- package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
- package/dist/packages/engine/compile/compiled-schema.js +55 -70
- package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
- package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
- package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
- package/dist/packages/engine/compile/index.d.ts +0 -1
- package/dist/packages/engine/compile/index.js +0 -1
- package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
- package/dist/packages/engine/compile/lib/schema.js +35 -39
- package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
- package/dist/packages/engine/compile/method-primitives.js +1 -1
- package/dist/packages/engine/compile/reset.js +4 -4
- package/dist/packages/engine/compile/runtime-contracts.js +2 -1
- package/dist/packages/engine/compile/runtime-prompt.js +3 -2
- package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
- package/dist/packages/engine/compile/runtime-runs.js +0 -1
- package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
- package/dist/packages/engine/compile/runtime.d.ts +1 -2
- package/dist/packages/engine/compile/runtime.js +0 -1
- package/dist/packages/engine/compile/state-health.js +6 -6
- package/dist/packages/engine/compile/state-view.js +7 -6
- package/dist/packages/engine/compile/validate-compiled.js +61 -30
- package/dist/packages/engine/compile/validate.js +26 -24
- package/dist/packages/engine/execution/lib/schema.d.ts +79 -33
- package/dist/packages/engine/execution/lib/schema.js +13 -5
- package/dist/packages/engine/index.d.ts +2 -2
- package/dist/packages/engine/index.js +1 -1
- package/dist/packages/engine/lib/schema.d.ts +551 -242
- package/dist/packages/engine/lib/schema.js +53 -17
- package/dist/packages/engine/native-run-handlers.js +15 -7
- package/dist/packages/engine/preparation-store.d.ts +6 -0
- package/dist/packages/engine/preparation-store.js +8 -0
- package/dist/packages/engine/routes.d.ts +6 -0
- package/dist/packages/engine/routes.js +6 -0
- package/dist/packages/engine/run-observability.js +1 -2
- package/dist/packages/engine/runtime-event-applier.js +7 -0
- package/dist/packages/engine/runtime-proposal-helpers.js +1 -1
- package/dist/packages/engine/runtime-resource-builders.d.ts +6 -6
- package/dist/packages/engine/runtime-resource-builders.js +5 -4
- package/dist/packages/engine/runtime.d.ts +67 -7
- package/dist/packages/engine/runtime.js +159 -29
- package/dist/packages/engine/server.d.ts +25 -0
- package/dist/packages/engine/server.js +62 -3
- package/dist/packages/engine/verify/index.d.ts +10 -10
- package/dist/packages/engine/verify/index.js +8 -8
- package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
- package/dist/packages/engine/verify/readiness-check-run.js +92 -24
- package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
- package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +2 -2
- package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
- package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
- package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
- package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
- package/dist/packages/engine/wire-schemas.d.ts +545 -0
- package/dist/packages/engine/wire-schemas.js +59 -0
- package/dist/packages/methods/authoring/method-authoring.d.ts +2 -0
- package/dist/packages/methods/authoring/method-authoring.js +99 -18
- package/dist/packages/methods/authoring/method-edit-session.js +5 -5
- package/dist/packages/methods/authoring/method-improvement.js +1 -1
- package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
- package/dist/packages/methods/package/builtin-compiled-method.js +25 -22
- package/dist/packages/methods/package/context-interface.d.ts +39 -26
- package/dist/packages/methods/package/context-interface.js +48 -39
- package/dist/packages/methods/package/interf-method-package.js +28 -47
- package/dist/packages/methods/package/local-methods.d.ts +3 -4
- package/dist/packages/methods/package/local-methods.js +34 -62
- package/dist/packages/methods/package/method-definitions.d.ts +4 -6
- package/dist/packages/methods/package/method-definitions.js +0 -4
- package/dist/packages/methods/package/method-helpers.d.ts +0 -2
- package/dist/packages/methods/package/method-helpers.js +0 -4
- package/dist/packages/project/interf-scaffold.js +12 -12
- package/dist/packages/project/source-config.js +2 -1
- package/package.json +6 -16
- package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
- package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_ssgManifest.js +0 -0
- /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
- /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
- /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
- /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-types.js → verify-types.js} +0 -0
|
@@ -3,7 +3,7 @@ import { dirname, join } from "node:path";
|
|
|
3
3
|
import { renderCompiledQuerySkill } from "../../engine/agents/lib/shells.js";
|
|
4
4
|
import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, mergeStagePolicyNotesForStages, } from "./local-methods.js";
|
|
5
5
|
import { getCompiledMethod, } from "./method-definitions.js";
|
|
6
|
-
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
6
|
+
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, listContextInterfaceArtifacts, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
7
7
|
import { methodPackagePathForCompiled } from "../../engine/compile/compiled-paths.js";
|
|
8
8
|
function writeMethodStarterDocs(dirPath, docs, options) {
|
|
9
9
|
for (const doc of docs ?? []) {
|
|
@@ -47,7 +47,6 @@ function writeMethodPackageJson(rootPath, method, options) {
|
|
|
47
47
|
skill_dir: stage.skillDir,
|
|
48
48
|
reads: stage.reads,
|
|
49
49
|
writes: stage.writes,
|
|
50
|
-
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
51
50
|
})),
|
|
52
51
|
...(method.stagePolicyNotes ? { stage_policy_notes: method.stagePolicyNotes } : {}),
|
|
53
52
|
}, null, 2)}\n`);
|
|
@@ -60,9 +59,12 @@ function renderMethodReadme(method) {
|
|
|
60
59
|
const interfaceSummary = contextInterface
|
|
61
60
|
? summarizeContextInterface(contextInterface)
|
|
62
61
|
: null;
|
|
63
|
-
const
|
|
64
|
-
? contextInterface
|
|
65
|
-
|
|
62
|
+
const contextInterfaceArtifacts = contextInterface
|
|
63
|
+
? listContextInterfaceArtifacts(contextInterface)
|
|
64
|
+
: [];
|
|
65
|
+
const contextInterfaceLines = contextInterfaceArtifacts.length > 0
|
|
66
|
+
? contextInterfaceArtifacts
|
|
67
|
+
.map((artifact) => `- \`${artifact.id}\` — ${artifact.role} ${artifact.kind} Artifact at \`${artifact.path}\`: ${artifact.description}`)
|
|
66
68
|
.join("\n")
|
|
67
69
|
: null;
|
|
68
70
|
const inputs = method.inputs?.length
|
|
@@ -75,10 +77,10 @@ function renderMethodReadme(method) {
|
|
|
75
77
|
: null;
|
|
76
78
|
const contextInterfaceSummaryLines = interfaceSummary
|
|
77
79
|
? [
|
|
78
|
-
`- Input
|
|
79
|
-
`- Working
|
|
80
|
-
`- Output
|
|
81
|
-
`- Runtime
|
|
80
|
+
`- Input Artifacts: ${interfaceSummary.inputArtifacts.length > 0 ? interfaceSummary.inputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
81
|
+
`- Working Artifacts: ${interfaceSummary.workingArtifacts.length > 0 ? interfaceSummary.workingArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
82
|
+
`- Output Artifacts: ${interfaceSummary.outputArtifacts.length > 0 ? interfaceSummary.outputArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
83
|
+
`- Runtime Artifacts: ${interfaceSummary.runtimeArtifacts.length > 0 ? interfaceSummary.runtimeArtifacts.map((artifact) => `\`${artifact.id}\``).join(", ") : "none"}`,
|
|
82
84
|
].join("\n")
|
|
83
85
|
: null;
|
|
84
86
|
return [
|
|
@@ -113,7 +115,7 @@ function renderMethodReadme(method) {
|
|
|
113
115
|
"",
|
|
114
116
|
]
|
|
115
117
|
: []),
|
|
116
|
-
"
|
|
118
|
+
"Artifact map:",
|
|
117
119
|
"",
|
|
118
120
|
contextInterfaceLines,
|
|
119
121
|
]
|
|
@@ -142,7 +144,7 @@ function renderDerivedMethodReadme(options) {
|
|
|
142
144
|
options.hint,
|
|
143
145
|
"",
|
|
144
146
|
`This Method package was forked from \`${options.baseMethodId}\` and materialized as a standalone package for this kind of agent work.`,
|
|
145
|
-
"It starts with that Method's topology; edit the package when the agent work needs different stages,
|
|
147
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
|
|
146
148
|
"",
|
|
147
149
|
"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.",
|
|
148
150
|
"",
|
|
@@ -161,7 +163,7 @@ function renderSeedMethodReadme(options) {
|
|
|
161
163
|
options.hint,
|
|
162
164
|
"",
|
|
163
165
|
`This Method package was forked from \`${options.baseMethodId}\` as a standalone local package.`,
|
|
164
|
-
"It starts with that Method's topology; edit the package when the agent work needs different stages,
|
|
166
|
+
"It starts with that Method's topology; edit the package when the agent work needs different stages, Artifacts, or checks.",
|
|
165
167
|
"",
|
|
166
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.",
|
|
167
169
|
"",
|
|
@@ -206,7 +208,6 @@ function renderImproveSkill(method) {
|
|
|
206
208
|
}
|
|
207
209
|
function renderStageSkill(method, stage) {
|
|
208
210
|
const notes = method.stagePolicyNotes?.[stage.id] ?? [];
|
|
209
|
-
const acceptanceKeys = stage.acceptance ? Object.keys(stage.acceptance) : [];
|
|
210
211
|
const abstractRules = stage.contractType === "compiled-file-evidence"
|
|
211
212
|
? [
|
|
212
213
|
"- Valid abstract forms for deterministic validation are:",
|
|
@@ -223,27 +224,19 @@ function renderStageSkill(method, stage) {
|
|
|
223
224
|
"## Stage Contract",
|
|
224
225
|
"",
|
|
225
226
|
`- Contract type: \`${stage.contractType}\``,
|
|
226
|
-
`- Reads
|
|
227
|
-
`- Writes
|
|
227
|
+
`- Reads Artifacts: ${stage.reads.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
228
|
+
`- Writes Artifacts: ${stage.writes.map((artifactId) => `\`${artifactId}\``).join(", ")}`,
|
|
228
229
|
"",
|
|
229
230
|
"## Requirements",
|
|
230
231
|
"",
|
|
231
232
|
"- Treat `method.json` and `method.schema.json` as the authoritative package contract for this stage.",
|
|
232
|
-
"- Read only from the declared input
|
|
233
|
-
"- Write only inside the declared output
|
|
234
|
-
"- Keep stage instructions,
|
|
233
|
+
"- Read only from the declared input Artifacts unless this package explicitly documents a broader method.",
|
|
234
|
+
"- Write only inside the declared output Artifacts for this stage. Do not invent undeclared Artifacts or implicit outputs.",
|
|
235
|
+
"- Keep stage instructions, artifact ownership, and Method-level checks aligned when you change this stage.",
|
|
235
236
|
"- Treat runtime files as proof and execution state, not as the source of truth for Method behavior.",
|
|
236
237
|
"- Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
237
238
|
...abstractRules,
|
|
238
239
|
"",
|
|
239
|
-
...(acceptanceKeys.length > 0
|
|
240
|
-
? [
|
|
241
|
-
"## Declarative Acceptance",
|
|
242
|
-
"",
|
|
243
|
-
...acceptanceKeys.map((key) => `- \`${key}\``),
|
|
244
|
-
"",
|
|
245
|
-
]
|
|
246
|
-
: []),
|
|
247
240
|
...(notes.length > 0
|
|
248
241
|
? [
|
|
249
242
|
"## Notes",
|
|
@@ -428,24 +421,15 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
428
421
|
version: 1,
|
|
429
422
|
target_type: "compiled",
|
|
430
423
|
label: `${options.label} Method schema`,
|
|
431
|
-
|
|
424
|
+
artifacts: [
|
|
432
425
|
{
|
|
433
426
|
id: "draft-context",
|
|
434
|
-
|
|
435
|
-
path: "draft",
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
id: "runtime",
|
|
443
|
-
role: "runtime",
|
|
444
|
-
path: ".interf/runtime",
|
|
445
|
-
kind: "runtime",
|
|
446
|
-
required: true,
|
|
447
|
-
owned_by: [],
|
|
448
|
-
description: "CLI-owned runtime state, health, stage contracts, and proof artifacts.",
|
|
427
|
+
description: "Temporary placeholder Artifact for the neutral authoring scaffold. Replace it with task-specific Artifacts.",
|
|
428
|
+
shape: { kind: "path", path: "draft", artifact_kind: "directory" },
|
|
429
|
+
checks: [
|
|
430
|
+
{ id: "exists", kind: "min_file_count", required: true, params: { min: 1 } },
|
|
431
|
+
],
|
|
432
|
+
built_by_stages: ["prepare"],
|
|
449
433
|
},
|
|
450
434
|
],
|
|
451
435
|
},
|
|
@@ -457,17 +441,14 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
457
441
|
contractType: "method-draft-stage",
|
|
458
442
|
skillDir: "prepare",
|
|
459
443
|
role: "general",
|
|
460
|
-
reads: [
|
|
444
|
+
reads: [],
|
|
461
445
|
writes: ["draft-context"],
|
|
462
|
-
acceptance: {
|
|
463
|
-
stage_truthy: ["finished_at"],
|
|
464
|
-
},
|
|
465
446
|
},
|
|
466
447
|
],
|
|
467
448
|
stagePolicyNotes: {
|
|
468
449
|
prepare: [
|
|
469
450
|
"This is a neutral authoring scaffold, not a recommended method topology.",
|
|
470
|
-
"Replace this stage,
|
|
451
|
+
"Replace this stage, Artifact, and check when drafting the final method.",
|
|
471
452
|
],
|
|
472
453
|
},
|
|
473
454
|
starterDocs: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { MethodCompilerApiSchema,
|
|
2
|
+
import { MethodCompilerApiSchema, MethodPurposeSchema, type MethodStageArtifactReadAccess, type MethodStageArtifactWriteAccess } from "../../engine/compile/lib/schema.js";
|
|
3
3
|
import { RuntimeContractTypeSchema } from "../../contracts/lib/schema.js";
|
|
4
4
|
import { MethodInputSpecSchema, type ContextInterface, type MethodInputSpec } from "./context-interface.js";
|
|
5
5
|
export interface LocalMethodStarterDoc {
|
|
@@ -18,9 +18,8 @@ export interface LocalMethodStageDefinition {
|
|
|
18
18
|
* role-map (`~/.interf/agents.json`).
|
|
19
19
|
*/
|
|
20
20
|
role?: string;
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance?: z.infer<typeof RuntimeStageAcceptanceSchema>;
|
|
21
|
+
reads: MethodStageArtifactReadAccess;
|
|
22
|
+
writes: MethodStageArtifactWriteAccess;
|
|
24
23
|
}
|
|
25
24
|
export interface LocalMethodDefinition {
|
|
26
25
|
id: string;
|
|
@@ -5,11 +5,10 @@ import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
|
5
5
|
import { warnInterf } from "../../contracts/utils/logger.js";
|
|
6
6
|
import { readJsonFileUnchecked, readJsonFileWithSchema } from "../../contracts/utils/parse.js";
|
|
7
7
|
import { isMarkdownFile } from "../../contracts/utils/file-types.js";
|
|
8
|
-
import { MethodCompilerApiSchema,
|
|
8
|
+
import { MethodCompilerApiSchema, MethodPurposeSchema, MethodStageArtifactReadAccessSchema, MethodStageArtifactWriteAccessSchema, } from "../../engine/compile/lib/schema.js";
|
|
9
9
|
import { RuntimeContractTypeSchema, InterfIdPattern, } from "../../contracts/lib/schema.js";
|
|
10
10
|
import { asPreparationDataDir, preparationMethodsRoot, } from "../../contracts/lib/preparation-paths.js";
|
|
11
|
-
import {
|
|
12
|
-
import { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, contextInterfaceExists, contextInterfaceFilePath, readContextInterface, MethodInputSpecSchema, writeContextInterface, } from "./context-interface.js";
|
|
11
|
+
import { CONTEXT_INTERFACE_FILE, ContextInterfaceSchema, contextInterfaceExists, contextInterfaceFilePath, listContextInterfaceArtifacts, readContextInterface, MethodInputSpecSchema, writeContextInterface, } from "./context-interface.js";
|
|
13
12
|
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
14
13
|
const LocalMethodStageDefinitionSchema = z.object({
|
|
15
14
|
id: z.string().regex(InterfIdPattern),
|
|
@@ -18,9 +17,8 @@ const LocalMethodStageDefinitionSchema = z.object({
|
|
|
18
17
|
skill_dir: z.string().regex(InterfIdPattern).optional(),
|
|
19
18
|
description: z.string().min(1).optional(),
|
|
20
19
|
role: z.string().min(1).optional(),
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance: RuntimeStageAcceptanceSchema.optional(),
|
|
20
|
+
reads: MethodStageArtifactReadAccessSchema,
|
|
21
|
+
writes: MethodStageArtifactWriteAccessSchema,
|
|
24
22
|
});
|
|
25
23
|
const LocalMethodDefinitionSchema = z.object({
|
|
26
24
|
id: z.string().regex(InterfIdPattern),
|
|
@@ -365,8 +363,9 @@ export function validateMethodPackage(dirPath) {
|
|
|
365
363
|
const stages = def.stages ?? [];
|
|
366
364
|
const stageIds = new Set(stages.map((stage) => stage.id));
|
|
367
365
|
const seenPaths = new Map();
|
|
368
|
-
const
|
|
369
|
-
const
|
|
366
|
+
const seenArtifactIds = new Set();
|
|
367
|
+
const schemaArtifacts = listContextInterfaceArtifacts(methodSchema);
|
|
368
|
+
const artifactById = new Map(schemaArtifacts.map((artifact) => [artifact.id, artifact]));
|
|
370
369
|
const normalizedParts = (value) => value.replaceAll("\\", "/").split("/").filter(Boolean);
|
|
371
370
|
const hasOverlappingPath = (value, other) => {
|
|
372
371
|
const a = normalizedParts(value);
|
|
@@ -375,78 +374,51 @@ export function validateMethodPackage(dirPath) {
|
|
|
375
374
|
const longer = a.length <= b.length ? b : a;
|
|
376
375
|
return shorter.every((part, index) => longer[index] === part);
|
|
377
376
|
};
|
|
378
|
-
for (const
|
|
379
|
-
if (
|
|
380
|
-
errors.push(`method.schema.json repeats
|
|
377
|
+
for (const artifact of schemaArtifacts) {
|
|
378
|
+
if (seenArtifactIds.has(artifact.id)) {
|
|
379
|
+
errors.push(`method.schema.json repeats Artifact id "${artifact.id}".`);
|
|
381
380
|
}
|
|
382
|
-
|
|
383
|
-
const existingPathOwner = seenPaths.get(
|
|
381
|
+
seenArtifactIds.add(artifact.id);
|
|
382
|
+
const existingPathOwner = seenPaths.get(artifact.path);
|
|
384
383
|
if (existingPathOwner) {
|
|
385
|
-
errors.push(`method.schema.json repeats
|
|
384
|
+
errors.push(`method.schema.json repeats Artifact path "${artifact.path}".`);
|
|
386
385
|
}
|
|
387
386
|
for (const [existingPath, existingZoneId] of seenPaths.entries()) {
|
|
388
|
-
if (existingPath ===
|
|
387
|
+
if (existingPath === artifact.path)
|
|
389
388
|
continue;
|
|
390
|
-
if (hasOverlappingPath(
|
|
391
|
-
errors.push(`method.schema.json
|
|
389
|
+
if (hasOverlappingPath(artifact.path, existingPath)) {
|
|
390
|
+
errors.push(`method.schema.json Artifacts "${artifact.id}" and "${existingZoneId}" overlap on path "${artifact.path}" / "${existingPath}".`);
|
|
392
391
|
}
|
|
393
392
|
}
|
|
394
|
-
seenPaths.set(
|
|
395
|
-
if ((
|
|
396
|
-
errors.push(`method.schema.json
|
|
393
|
+
seenPaths.set(artifact.path, artifact.id);
|
|
394
|
+
if ((artifact.role === "input" || artifact.role === "runtime") && artifact.owned_by.length > 0) {
|
|
395
|
+
errors.push(`method.schema.json Artifact "${artifact.id}" cannot declare owners because its role is "${artifact.role}".`);
|
|
397
396
|
}
|
|
398
|
-
for (const owner of
|
|
397
|
+
for (const owner of artifact.owned_by) {
|
|
399
398
|
if (!stageIds.has(owner)) {
|
|
400
|
-
errors.push(`method.schema.json references unknown stage "${owner}" for
|
|
399
|
+
errors.push(`method.schema.json references unknown stage "${owner}" for Artifact path "${artifact.path}".`);
|
|
401
400
|
}
|
|
402
401
|
}
|
|
403
402
|
}
|
|
404
403
|
for (const stage of stages) {
|
|
405
|
-
for (const
|
|
406
|
-
if (!
|
|
407
|
-
errors.push(`Stage "${stage.id}" reads unknown
|
|
404
|
+
for (const artifactId of stage.reads) {
|
|
405
|
+
if (!artifactById.has(artifactId)) {
|
|
406
|
+
errors.push(`Stage "${stage.id}" reads unknown Artifact "${artifactId}".`);
|
|
408
407
|
}
|
|
409
408
|
}
|
|
410
|
-
for (const
|
|
411
|
-
const
|
|
412
|
-
if (!
|
|
413
|
-
errors.push(`Stage "${stage.id}" writes unknown
|
|
409
|
+
for (const artifactId of stage.writes) {
|
|
410
|
+
const artifact = artifactById.get(artifactId);
|
|
411
|
+
if (!artifact) {
|
|
412
|
+
errors.push(`Stage "${stage.id}" writes unknown Artifact "${artifactId}".`);
|
|
414
413
|
continue;
|
|
415
414
|
}
|
|
416
|
-
if (
|
|
417
|
-
errors.push(`Stage "${stage.id}" writes
|
|
415
|
+
if (artifact.role === "input" || artifact.role === "runtime") {
|
|
416
|
+
errors.push(`Stage "${stage.id}" writes Artifact "${artifactId}" but Artifacts with role "${artifact.role}" are engine-owned inputs, not writable stage outputs.`);
|
|
418
417
|
}
|
|
419
|
-
if (!
|
|
420
|
-
errors.push(`Stage "${stage.id}" writes
|
|
418
|
+
if (!artifact.owned_by.includes(stage.id)) {
|
|
419
|
+
errors.push(`Stage "${stage.id}" writes Artifact "${artifactId}" but that Artifact is not owned by the stage in method.schema.json.`);
|
|
421
420
|
}
|
|
422
421
|
}
|
|
423
|
-
for (const artifactPath of Object.keys(stage.acceptance?.artifacts_must_not_contain ?? {})) {
|
|
424
|
-
const normalizedArtifactPath = artifactPath.replaceAll("\\", "/");
|
|
425
|
-
const artifactParts = normalizedArtifactPath.split("/").filter(Boolean);
|
|
426
|
-
if (artifactPath.startsWith("/") ||
|
|
427
|
-
artifactPath.startsWith("\\") ||
|
|
428
|
-
artifactParts.some((part) => part === "..")) {
|
|
429
|
-
errors.push(`Stage "${stage.id}" artifacts_must_not_contain key "${artifactPath}" must be a portable-context relative artifact path.`);
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
const matchingZone = zoneById.get(artifactPath);
|
|
433
|
-
if (matchingZone) {
|
|
434
|
-
errors.push(`Stage "${stage.id}" artifacts_must_not_contain key "${artifactPath}" is a zone id. Use the zone path "${matchingZone.path}" instead.`);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
for (const requiredZone of listBuiltinCompiledZoneSpecs().filter((zone) => zone.id === "runtime")) {
|
|
439
|
-
const match = zoneById.get(requiredZone.id);
|
|
440
|
-
if (!match) {
|
|
441
|
-
errors.push(`method.schema.json is missing required zone "${requiredZone.id}".`);
|
|
442
|
-
continue;
|
|
443
|
-
}
|
|
444
|
-
if (match.kind !== requiredZone.kind) {
|
|
445
|
-
errors.push(`method.schema.json zone "${requiredZone.id}" should be kind "${requiredZone.kind}".`);
|
|
446
|
-
}
|
|
447
|
-
if (match.role !== requiredZone.role) {
|
|
448
|
-
errors.push(`method.schema.json zone "${requiredZone.id}" should have role "${requiredZone.role}".`);
|
|
449
|
-
}
|
|
450
422
|
}
|
|
451
423
|
}
|
|
452
424
|
const stageDirs = existsSync(join(dirPath, "compile", "stages"))
|
|
@@ -455,8 +427,8 @@ export function validateMethodPackage(dirPath) {
|
|
|
455
427
|
const counts = {
|
|
456
428
|
starter_docs: collectStarterDocs(dirPath).length,
|
|
457
429
|
compile_stage_docs: stageDirs.length,
|
|
458
|
-
|
|
459
|
-
|
|
430
|
+
compiled_artifacts: methodSchema ? listContextInterfaceArtifacts(methodSchema).length : 0,
|
|
431
|
+
method_artifacts: methodSchema ? listContextInterfaceArtifacts(methodSchema).length : 0,
|
|
460
432
|
};
|
|
461
433
|
return {
|
|
462
434
|
ok: errors.length === 0,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type LocalMethodDefinition } from "./local-methods.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { MethodCompilerApi } from "../../engine/compile/lib/schema.js";
|
|
3
3
|
import type { MethodId, RuntimeContractType } from "../../contracts/lib/schema.js";
|
|
4
|
-
import { type ContextInterface, type
|
|
4
|
+
import { type ContextInterface, type ContextInterfaceArtifactId, type MethodInputSpec } from "./context-interface.js";
|
|
5
5
|
export interface MethodStarterDoc {
|
|
6
6
|
relativePath: string;
|
|
7
7
|
content: string;
|
|
@@ -18,9 +18,8 @@ export interface MethodStageDefinition {
|
|
|
18
18
|
* time.
|
|
19
19
|
*/
|
|
20
20
|
role: string;
|
|
21
|
-
reads:
|
|
22
|
-
writes:
|
|
23
|
-
acceptance?: RuntimeStageAcceptance;
|
|
21
|
+
reads: ContextInterfaceArtifactId[];
|
|
22
|
+
writes: ContextInterfaceArtifactId[];
|
|
24
23
|
}
|
|
25
24
|
export interface MethodDefinition<TId extends string> {
|
|
26
25
|
id: TId;
|
|
@@ -59,5 +58,4 @@ export declare function getMethodStagePosition(methodId: MethodId, stage: string
|
|
|
59
58
|
export declare function getMethodStages(methodId: MethodId, prepDataDir?: string): string[];
|
|
60
59
|
export declare function getActiveCompiledStages(compiledPath: string): string[];
|
|
61
60
|
export declare function getActiveCompiledStagePolicyNotes(compiledPath: string, stage: string): string[];
|
|
62
|
-
export declare function resolveActiveCompiledStageAcceptance(compiledPath: string, stage: string): MethodStageDefinition["acceptance"] | undefined;
|
|
63
61
|
export declare function formatActiveCompiledMethodStageStep(compiledPath: string, stage: string): string;
|
|
@@ -19,7 +19,6 @@ function toMethodStages(stages) {
|
|
|
19
19
|
role: stage.role && stage.role.trim().length > 0 ? stage.role : "general",
|
|
20
20
|
reads: [...stage.reads],
|
|
21
21
|
writes: [...stage.writes],
|
|
22
|
-
...(stage.acceptance ? { acceptance: stage.acceptance } : {}),
|
|
23
22
|
}));
|
|
24
23
|
}
|
|
25
24
|
export function standaloneMethodDefinitionFromLocalPackage(local) {
|
|
@@ -210,9 +209,6 @@ export function getActiveCompiledStagePolicyNotes(compiledPath, stage) {
|
|
|
210
209
|
const method = getActiveCompiledMethod(compiledPath);
|
|
211
210
|
return [...(method.stagePolicyNotes?.[stage] ?? [])];
|
|
212
211
|
}
|
|
213
|
-
export function resolveActiveCompiledStageAcceptance(compiledPath, stage) {
|
|
214
|
-
return getActiveCompiledMethod(compiledPath).stages.find((candidate) => candidate.id === stage)?.acceptance;
|
|
215
|
-
}
|
|
216
212
|
export function formatActiveCompiledMethodStageStep(compiledPath, stage) {
|
|
217
213
|
return formatMethodStageStep(getActiveCompiledMethod(compiledPath), stage);
|
|
218
214
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type LocalInstructionMode, type RuntimeInstructionMode, type RuntimeStageInstructions } from "../../engine/compile/lib/schema.js";
|
|
2
|
-
import { type MethodStageDefinition } from "./method-definitions.js";
|
|
3
2
|
export interface MethodReporter {
|
|
4
3
|
line?: (message: string) => void;
|
|
5
4
|
blankLine?: () => void;
|
|
@@ -23,4 +22,3 @@ export declare function buildStageInstructions(stageSkillDir: string, localSkill
|
|
|
23
22
|
export declare function reportLine(reporter: MethodReporter | undefined, message: string): void;
|
|
24
23
|
export declare function reportBlankLine(reporter: MethodReporter | undefined): void;
|
|
25
24
|
export declare function reportValidationFailure(reporter: MethodReporter | undefined, summary: string, errors?: string[]): void;
|
|
26
|
-
export declare function resolveStageAcceptance(methodId: string, stageId: string, prepDataDir?: string): MethodStageDefinition["acceptance"] | undefined;
|
|
@@ -3,7 +3,6 @@ import { join, relative, sep } from "node:path";
|
|
|
3
3
|
import { listFilesRecursive } from "../../contracts/utils/filesystem.js";
|
|
4
4
|
import { parseJsonFrontmatter } from "../../contracts/utils/parse.js";
|
|
5
5
|
import { isMarkdownFile } from "../../contracts/utils/file-types.js";
|
|
6
|
-
import { getCompiledMethod, } from "./method-definitions.js";
|
|
7
6
|
import { COMPILED_METHOD_DIR, methodPackagePathForCompiled } from "../../engine/compile/compiled-paths.js";
|
|
8
7
|
const LOCAL_SKILL_READ_LIMIT = 50;
|
|
9
8
|
export function methodCompileStageDirectory(stageDir) {
|
|
@@ -128,6 +127,3 @@ export function reportValidationFailure(reporter, summary, errors = []) {
|
|
|
128
127
|
reportLine(reporter, `- ${error}`);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
|
-
export function resolveStageAcceptance(methodId, stageId, prepDataDir) {
|
|
132
|
-
return getCompiledMethod(methodId, { prepDataDir }).stages.find((stage) => stage.id === stageId)?.acceptance;
|
|
133
|
-
}
|
|
@@ -7,8 +7,8 @@ import { refreshCompiledBootstrapGuidance } from "../engine/agents/lib/compiled-
|
|
|
7
7
|
import { assertCompiledContainer, assertCompiledName, } from "./interf-detect.js";
|
|
8
8
|
import { seedCompiledMethodPackage } from "../methods/package/interf-method-package.js";
|
|
9
9
|
import { asPreparationDataDir, preparationPortableContextPath, } from "../contracts/lib/preparation-paths.js";
|
|
10
|
-
import {
|
|
11
|
-
import { findSourcePreparationConfig, loadSourceFolderConfig, methodIdForSourcePreparationConfig, resolveSourcePreparationPath, saveCompiledInterfConfig, } from "./source-config.js";
|
|
10
|
+
import { ensureCompiledArtifactTargets, listCompiledSchemaArtifacts, readCompiledSchemaFile } from "../engine/compile/compiled-schema.js";
|
|
11
|
+
import { findSourcePreparationConfig, loadSourceFolderConfig, methodIdForSourcePreparationConfig, resolveConfiguredSourceFolderPath, resolveSourcePreparationPath, saveCompiledInterfConfig, } from "./source-config.js";
|
|
12
12
|
import { defaultControlPathForCompiled, testRootForCompiled, methodPackagePathForCompiled } from "../engine/compile/compiled-paths.js";
|
|
13
13
|
import { DEFAULT_METHOD_ID } from "../methods/method-resolution.js";
|
|
14
14
|
const DEFAULT_INTERFIGNORE = [
|
|
@@ -33,11 +33,11 @@ function renderUncompiledCompiledFile(compiledName, relativePath, about) {
|
|
|
33
33
|
}
|
|
34
34
|
function compiledGitignoreEntries(compiledPath) {
|
|
35
35
|
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(compiledPath));
|
|
36
|
-
const
|
|
37
|
-
.filter((
|
|
38
|
-
.map((
|
|
36
|
+
const artifactEntries = (schema ? listCompiledSchemaArtifacts(schema) : [])
|
|
37
|
+
.filter((artifact) => artifact.kind !== "runtime")
|
|
38
|
+
.map((artifact) => artifact.kind === "file" ? artifact.path : `${artifact.path}/`);
|
|
39
39
|
return [
|
|
40
|
-
...
|
|
40
|
+
...artifactEntries,
|
|
41
41
|
".claude/",
|
|
42
42
|
".codex/",
|
|
43
43
|
".agents/",
|
|
@@ -52,14 +52,14 @@ function scaffoldCompiledOutputs(compiledPath, compiledName, about) {
|
|
|
52
52
|
if (!schema) {
|
|
53
53
|
throw new Error(`Missing Method schema at ${methodPackagePathForCompiled(compiledPath)}.`);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
for (const
|
|
57
|
-
if (!
|
|
55
|
+
ensureCompiledArtifactTargets(compiledPath, schema);
|
|
56
|
+
for (const artifact of listCompiledSchemaArtifacts(schema)) {
|
|
57
|
+
if (!artifact.required || artifact.kind !== "file" || artifact.role !== "output")
|
|
58
58
|
continue;
|
|
59
|
-
const targetPath = join(compiledPath,
|
|
59
|
+
const targetPath = join(compiledPath, artifact.path);
|
|
60
60
|
if (existsSync(targetPath))
|
|
61
61
|
continue;
|
|
62
|
-
writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName,
|
|
62
|
+
writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName, artifact.path, about));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
function localMethodMatches(compiledPath, methodId) {
|
|
@@ -99,7 +99,7 @@ export function createCompiled(name, prepDataDir, methodId = DEFAULT_METHOD_ID,
|
|
|
99
99
|
const compiledPath = ensurePortableContextScaffold(prepDataDir, name, selectedMethod.id);
|
|
100
100
|
const resolvedAbout = about ?? savedCompiled?.about;
|
|
101
101
|
const resolvedSourceFolderPath = savedCompiled
|
|
102
|
-
? resolveSourcePreparationPath(prepDataDir, savedCompiled)
|
|
102
|
+
? resolveConfiguredSourceFolderPath(prepDataDir) ?? resolveSourcePreparationPath(prepDataDir, savedCompiled)
|
|
103
103
|
: sourceFolderPath;
|
|
104
104
|
const sourceRelativePath = relative(compiledPath, resolvedSourceFolderPath).split(sep).join("/") || ".";
|
|
105
105
|
saveCompiledInterfConfig(compiledPath, {
|
|
@@ -241,7 +241,8 @@ export function saveCompiledInterfConfig(compiledPath, config) {
|
|
|
241
241
|
export function syncCompiledInterfConfigFromSourcePreparationConfig(compiledPath, preparationConfig) {
|
|
242
242
|
const current = readInterfConfig(compiledPath);
|
|
243
243
|
const prepDataDir = resolveSourceControlPathForCompiled(compiledPath);
|
|
244
|
-
const preparationAbsolutePath =
|
|
244
|
+
const preparationAbsolutePath = resolveConfiguredSourceFolderPath(prepDataDir) ??
|
|
245
|
+
resolveSourcePreparationPath(prepDataDir, preparationConfig);
|
|
245
246
|
const preparationRelativePath = relative(compiledPath, preparationAbsolutePath).split(sep).join("/") || ".";
|
|
246
247
|
const methodId = methodIdForSourcePreparationConfig(preparationConfig)
|
|
247
248
|
?? methodIdForSourcePreparationConfig(current)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interf/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Interf prepares data for agent work. It runs locally, processes your files, shows evidence that your data is ready, and writes portable context: a local folder with verifiable outputs agents can use.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,18 +14,6 @@
|
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"import": "./dist/index.js"
|
|
16
16
|
},
|
|
17
|
-
"./contracts": {
|
|
18
|
-
"types": "./dist/packages/contracts/index.d.ts",
|
|
19
|
-
"import": "./dist/packages/contracts/index.js"
|
|
20
|
-
},
|
|
21
|
-
"./execution": {
|
|
22
|
-
"types": "./dist/packages/engine/execution/index.d.ts",
|
|
23
|
-
"import": "./dist/packages/engine/execution/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./local-service": {
|
|
26
|
-
"types": "./dist/packages/engine/index.d.ts",
|
|
27
|
-
"import": "./dist/packages/engine/index.js"
|
|
28
|
-
},
|
|
29
17
|
"./package.json": "./package.json"
|
|
30
18
|
},
|
|
31
19
|
"scripts": {
|
|
@@ -54,6 +42,7 @@
|
|
|
54
42
|
"dist",
|
|
55
43
|
"builtin-methods",
|
|
56
44
|
"agent-skills",
|
|
45
|
+
"LICENSE.md",
|
|
57
46
|
"TRADEMARKS.md"
|
|
58
47
|
],
|
|
59
48
|
"publishConfig": {
|
|
@@ -67,13 +56,14 @@
|
|
|
67
56
|
"claude",
|
|
68
57
|
"codex"
|
|
69
58
|
],
|
|
70
|
-
"license": "
|
|
59
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
60
|
+
"author": "Interf Inc.",
|
|
71
61
|
"repository": {
|
|
72
62
|
"type": "git",
|
|
73
|
-
"url": "git+https://github.com/interf-labs/
|
|
63
|
+
"url": "git+https://github.com/interf-labs/compiler.git"
|
|
74
64
|
},
|
|
75
65
|
"bugs": {
|
|
76
|
-
"url": "https://github.com/interf-labs/
|
|
66
|
+
"url": "https://github.com/interf-labs/compiler/issues"
|
|
77
67
|
},
|
|
78
68
|
"homepage": "https://interf.com",
|
|
79
69
|
"engines": {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type CompiledState, type RuntimeStageAcceptance, type RuntimeStageContract } from "./lib/schema.js";
|
|
2
|
-
import { type RuntimeStageAcceptanceValidation } from "./runtime-types.js";
|
|
3
|
-
export declare function stageRecordFromState(state: CompiledState | null, stageId: string): Record<string, unknown> | null;
|
|
4
|
-
export declare function validateResolvedStageAcceptance(dirPath: string, options: {
|
|
5
|
-
stageId: string;
|
|
6
|
-
acceptance?: RuntimeStageAcceptance;
|
|
7
|
-
counts?: Record<string, number>;
|
|
8
|
-
}): RuntimeStageAcceptanceValidation;
|
|
9
|
-
export declare function validateStageContractAcceptance(dirPath: string, contract?: RuntimeStageContract | null): RuntimeStageAcceptanceValidation;
|