@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.
Files changed (133) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +10 -7
  3. package/TRADEMARKS.md +4 -4
  4. package/builtin-methods/interf-default/README.md +6 -7
  5. package/builtin-methods/interf-default/method.json +7 -68
  6. package/builtin-methods/interf-default/method.schema.json +52 -50
  7. package/dist/cli/commands/prep.js +58 -2
  8. package/dist/cli/commands/verify.d.ts +2 -0
  9. package/dist/cli/commands/verify.js +17 -8
  10. package/dist/cli/commands/wizard.js +122 -14
  11. package/dist/compiler-ui/404.html +1 -1
  12. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  13. package/dist/compiler-ui/__next._full.txt +3 -3
  14. package/dist/compiler-ui/__next._head.txt +1 -1
  15. package/dist/compiler-ui/__next._index.txt +2 -2
  16. package/dist/compiler-ui/__next._tree.txt +2 -2
  17. package/dist/compiler-ui/_next/static/chunks/{13awzu4tooflw.css → 0_c_tvh-cukjz.css} +1 -1
  18. package/dist/compiler-ui/_next/static/chunks/{0jipmpez3_ehh.js → 0f_geuwdesg_c.js} +42 -17
  19. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  20. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  21. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  22. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  23. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  24. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  25. package/dist/compiler-ui/_not-found.html +1 -1
  26. package/dist/compiler-ui/_not-found.txt +2 -2
  27. package/dist/compiler-ui/index.html +1 -1
  28. package/dist/compiler-ui/index.txt +3 -3
  29. package/dist/packages/contracts/index.d.ts +2 -2
  30. package/dist/packages/contracts/index.js +1 -1
  31. package/dist/packages/contracts/lib/schema.d.ts +271 -72
  32. package/dist/packages/contracts/lib/schema.js +243 -83
  33. package/dist/packages/engine/action-definitions.js +1 -1
  34. package/dist/packages/engine/agents/lib/shells.d.ts +12 -4
  35. package/dist/packages/engine/agents/lib/shells.js +127 -120
  36. package/dist/packages/engine/cloud-seams.d.ts +115 -0
  37. package/dist/packages/engine/cloud-seams.js +84 -0
  38. package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
  39. package/dist/packages/engine/compile/artifact-counts.js +3 -3
  40. package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
  41. package/dist/packages/engine/compile/artifact-status.js +166 -0
  42. package/dist/packages/engine/compile/billing-events.d.ts +89 -0
  43. package/dist/packages/engine/compile/billing-events.js +74 -0
  44. package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
  45. package/dist/packages/engine/compile/check-evaluator.js +298 -0
  46. package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
  47. package/dist/packages/engine/compile/compiled-schema.js +55 -70
  48. package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
  49. package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
  50. package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
  51. package/dist/packages/engine/compile/index.d.ts +0 -1
  52. package/dist/packages/engine/compile/index.js +0 -1
  53. package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
  54. package/dist/packages/engine/compile/lib/schema.js +35 -39
  55. package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
  56. package/dist/packages/engine/compile/method-primitives.js +1 -1
  57. package/dist/packages/engine/compile/reset.js +4 -4
  58. package/dist/packages/engine/compile/runtime-contracts.js +2 -1
  59. package/dist/packages/engine/compile/runtime-prompt.js +3 -2
  60. package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
  61. package/dist/packages/engine/compile/runtime-runs.js +0 -1
  62. package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
  63. package/dist/packages/engine/compile/runtime.d.ts +1 -2
  64. package/dist/packages/engine/compile/runtime.js +0 -1
  65. package/dist/packages/engine/compile/state-health.js +6 -6
  66. package/dist/packages/engine/compile/state-view.js +7 -6
  67. package/dist/packages/engine/compile/validate-compiled.js +61 -30
  68. package/dist/packages/engine/compile/validate.js +26 -24
  69. package/dist/packages/engine/execution/lib/schema.d.ts +79 -33
  70. package/dist/packages/engine/execution/lib/schema.js +13 -5
  71. package/dist/packages/engine/index.d.ts +2 -2
  72. package/dist/packages/engine/index.js +1 -1
  73. package/dist/packages/engine/lib/schema.d.ts +551 -242
  74. package/dist/packages/engine/lib/schema.js +53 -17
  75. package/dist/packages/engine/native-run-handlers.js +15 -7
  76. package/dist/packages/engine/preparation-store.d.ts +6 -0
  77. package/dist/packages/engine/preparation-store.js +8 -0
  78. package/dist/packages/engine/routes.d.ts +6 -0
  79. package/dist/packages/engine/routes.js +6 -0
  80. package/dist/packages/engine/run-observability.js +1 -2
  81. package/dist/packages/engine/runtime-event-applier.js +7 -0
  82. package/dist/packages/engine/runtime-proposal-helpers.js +1 -1
  83. package/dist/packages/engine/runtime-resource-builders.d.ts +6 -6
  84. package/dist/packages/engine/runtime-resource-builders.js +5 -4
  85. package/dist/packages/engine/runtime.d.ts +67 -7
  86. package/dist/packages/engine/runtime.js +159 -29
  87. package/dist/packages/engine/server.d.ts +25 -0
  88. package/dist/packages/engine/server.js +62 -3
  89. package/dist/packages/engine/verify/index.d.ts +10 -10
  90. package/dist/packages/engine/verify/index.js +8 -8
  91. package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
  92. package/dist/packages/engine/verify/readiness-check-run.js +92 -24
  93. package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
  94. package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +2 -2
  95. package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
  96. package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
  97. package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
  98. package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
  99. package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
  100. package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
  101. package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
  102. package/dist/packages/engine/wire-schemas.d.ts +545 -0
  103. package/dist/packages/engine/wire-schemas.js +59 -0
  104. package/dist/packages/methods/authoring/method-authoring.d.ts +2 -0
  105. package/dist/packages/methods/authoring/method-authoring.js +99 -18
  106. package/dist/packages/methods/authoring/method-edit-session.js +5 -5
  107. package/dist/packages/methods/authoring/method-improvement.js +1 -1
  108. package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
  109. package/dist/packages/methods/package/builtin-compiled-method.js +25 -22
  110. package/dist/packages/methods/package/context-interface.d.ts +39 -26
  111. package/dist/packages/methods/package/context-interface.js +48 -39
  112. package/dist/packages/methods/package/interf-method-package.js +28 -47
  113. package/dist/packages/methods/package/local-methods.d.ts +3 -4
  114. package/dist/packages/methods/package/local-methods.js +34 -62
  115. package/dist/packages/methods/package/method-definitions.d.ts +4 -6
  116. package/dist/packages/methods/package/method-definitions.js +0 -4
  117. package/dist/packages/methods/package/method-helpers.d.ts +0 -2
  118. package/dist/packages/methods/package/method-helpers.js +0 -4
  119. package/dist/packages/project/interf-scaffold.js +12 -12
  120. package/dist/packages/project/source-config.js +2 -1
  121. package/package.json +6 -16
  122. package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
  123. package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
  124. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_buildManifest.js +0 -0
  125. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_clientMiddlewareManifest.js +0 -0
  126. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_ssgManifest.js +0 -0
  127. /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
  128. /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
  129. /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
  130. /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
  131. /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
  132. /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
  133. /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 contextInterfaceLines = contextInterface?.zones
64
- ? contextInterface.zones
65
- .map((zone) => `- \`${zone.id}\` — ${zone.role} ${zone.kind} at \`${zone.path}\`: ${zone.description}`)
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 zones: ${interfaceSummary.inputZones.length > 0 ? interfaceSummary.inputZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
79
- `- Working zones: ${interfaceSummary.workingZones.length > 0 ? interfaceSummary.workingZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
80
- `- Output zones: ${interfaceSummary.outputZones.length > 0 ? interfaceSummary.outputZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
81
- `- Runtime zones: ${interfaceSummary.runtimeZones.length > 0 ? interfaceSummary.runtimeZones.map((zone) => `\`${zone.id}\``).join(", ") : "none"}`,
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
- "Zone map:",
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, zones, or proof.",
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, zones, or proof.",
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 zones: ${stage.reads.map((zoneId) => `\`${zoneId}\``).join(", ")}`,
227
- `- Writes zones: ${stage.writes.map((zoneId) => `\`${zoneId}\``).join(", ")}`,
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 zones unless this package explicitly documents a broader method.",
233
- "- Write only inside the declared output zones for this stage. Do not invent undeclared zones or implicit outputs.",
234
- "- Keep stage instructions, zone ownership, and Method-level acceptance aligned when you change this stage.",
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
- zones: [
424
+ artifacts: [
432
425
  {
433
426
  id: "draft-context",
434
- role: "output",
435
- path: "draft",
436
- kind: "directory",
437
- required: true,
438
- owned_by: ["prepare"],
439
- description: "Temporary placeholder output zone for the neutral authoring scaffold. Replace it with task-specific output zones.",
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: ["runtime"],
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, output zone, and proof rule when drafting the final method.",
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, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema } from "../../engine/compile/lib/schema.js";
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: z.infer<typeof MethodStageZoneAccessSchema>;
22
- writes: z.infer<typeof MethodStageZoneAccessSchema>;
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, RuntimeStageAcceptanceSchema, MethodPurposeSchema, MethodStageZoneAccessSchema, } from "../../engine/compile/lib/schema.js";
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 { listBuiltinCompiledZoneSpecs, } from "./builtin-compiled-method.js";
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: MethodStageZoneAccessSchema,
22
- writes: MethodStageZoneAccessSchema,
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 seenZoneIds = new Set();
369
- const zoneById = new Map(methodSchema.zones.map((zone) => [zone.id, zone]));
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 zone of methodSchema.zones) {
379
- if (seenZoneIds.has(zone.id)) {
380
- errors.push(`method.schema.json repeats zone id "${zone.id}".`);
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
- seenZoneIds.add(zone.id);
383
- const existingPathOwner = seenPaths.get(zone.path);
381
+ seenArtifactIds.add(artifact.id);
382
+ const existingPathOwner = seenPaths.get(artifact.path);
384
383
  if (existingPathOwner) {
385
- errors.push(`method.schema.json repeats zone path "${zone.path}".`);
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 === zone.path)
387
+ if (existingPath === artifact.path)
389
388
  continue;
390
- if (hasOverlappingPath(zone.path, existingPath)) {
391
- errors.push(`method.schema.json zones "${zone.id}" and "${existingZoneId}" overlap on path "${zone.path}" / "${existingPath}".`);
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(zone.path, zone.id);
395
- if ((zone.role === "input" || zone.role === "runtime") && zone.owned_by.length > 0) {
396
- errors.push(`method.schema.json zone "${zone.id}" cannot declare owners because its role is "${zone.role}".`);
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 zone.owned_by) {
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 zone "${zone.path}".`);
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 zoneId of stage.reads) {
406
- if (!zoneById.has(zoneId)) {
407
- errors.push(`Stage "${stage.id}" reads unknown zone "${zoneId}".`);
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 zoneId of stage.writes) {
411
- const zone = zoneById.get(zoneId);
412
- if (!zone) {
413
- errors.push(`Stage "${stage.id}" writes unknown zone "${zoneId}".`);
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 (zone.role === "input" || zone.role === "runtime") {
417
- errors.push(`Stage "${stage.id}" writes zone "${zoneId}" but zones with role "${zone.role}" are engine-owned inputs, not writable stage outputs.`);
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 (!zone.owned_by.includes(stage.id)) {
420
- errors.push(`Stage "${stage.id}" writes zone "${zoneId}" but that zone is not owned by the stage in method.schema.json.`);
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
- compiled_zones: methodSchema?.zones.length ?? 0,
459
- method_zones: methodSchema?.zones.length ?? 0,
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 { RuntimeStageAcceptance, MethodCompilerApi } from "../../engine/compile/lib/schema.js";
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 ContextInterfaceZoneId, type MethodInputSpec } from "./context-interface.js";
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: ContextInterfaceZoneId[];
22
- writes: ContextInterfaceZoneId[];
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 { ensureCompiledZoneTargets, readCompiledSchemaFile } from "../engine/compile/compiled-schema.js";
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 zoneEntries = (schema?.zones ?? [])
37
- .filter((zone) => zone.kind !== "runtime")
38
- .map((zone) => zone.kind === "file" ? zone.path : `${zone.path}/`);
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
- ...zoneEntries,
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
- ensureCompiledZoneTargets(compiledPath, schema);
56
- for (const zone of schema.zones) {
57
- if (!zone.required || zone.kind !== "file" || zone.role !== "output")
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, zone.path);
59
+ const targetPath = join(compiledPath, artifact.path);
60
60
  if (existsSync(targetPath))
61
61
  continue;
62
- writeFileSync(targetPath, renderUncompiledCompiledFile(compiledName, zone.path, about));
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 = resolveSourcePreparationPath(prepDataDir, preparationConfig);
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.16.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": "UNLICENSED",
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/interf.git"
63
+ "url": "git+https://github.com/interf-labs/compiler.git"
74
64
  },
75
65
  "bugs": {
76
- "url": "https://github.com/interf-labs/interf/issues"
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;