@interf/compiler 0.16.0 → 0.21.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 (203) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +90 -73
  3. package/TRADEMARKS.md +4 -4
  4. package/dist/cli/commands/mcp.d.ts +0 -34
  5. package/dist/cli/commands/mcp.js +246 -45
  6. package/dist/cli/commands/method.js +261 -15
  7. package/dist/cli/commands/prep.js +116 -15
  8. package/dist/cli/commands/runs.js +103 -9
  9. package/dist/cli/commands/status.js +4 -2
  10. package/dist/cli/commands/test.d.ts +10 -0
  11. package/dist/cli/commands/{verify.js → test.js} +24 -17
  12. package/dist/cli/commands/web.js +82 -8
  13. package/dist/cli/commands/wizard.js +158 -51
  14. package/dist/cli/index.d.ts +2 -2
  15. package/dist/cli/index.js +3 -3
  16. package/dist/compiler-ui/404.html +1 -1
  17. package/dist/compiler-ui/__next.__PAGE__.txt +5 -5
  18. package/dist/compiler-ui/__next._full.txt +13 -12
  19. package/dist/compiler-ui/__next._head.txt +3 -3
  20. package/dist/compiler-ui/__next._index.txt +5 -4
  21. package/dist/compiler-ui/__next._tree.txt +4 -3
  22. package/dist/compiler-ui/_next/static/chunks/01646j7yi.w5a.css +1 -0
  23. package/dist/compiler-ui/_next/static/chunks/{0n51hrfoufc7g.js → 02f_.8.ebn556.js} +1 -1
  24. package/dist/compiler-ui/_next/static/chunks/02r7siaw-_p5w.js +1 -0
  25. package/dist/compiler-ui/_next/static/chunks/{08m7vf5asqlsm.js → 04d0ly-7xb~-j.js} +10 -10
  26. package/dist/compiler-ui/_next/static/chunks/0fhs9psnxqd8s.js +1 -0
  27. package/dist/compiler-ui/_next/static/chunks/0mssmhpbifj15.css +2 -0
  28. package/dist/compiler-ui/_next/static/chunks/0nypu~ddwxari.js +116 -0
  29. package/dist/compiler-ui/_next/static/chunks/0p3s8iyhgcww2.js +31 -0
  30. package/dist/compiler-ui/_next/static/chunks/0tjf-vu_rz8s0.css +1 -0
  31. package/dist/compiler-ui/_next/static/chunks/0u6p3fpbbfgtl.js +1 -0
  32. package/dist/compiler-ui/_next/static/chunks/0wpx5..8dnh0w.js +1 -0
  33. package/dist/compiler-ui/_next/static/chunks/0y0uj160p0ts~.js +1 -0
  34. package/dist/compiler-ui/_next/static/chunks/10t8l~_oenf.c.js +1 -0
  35. package/dist/compiler-ui/_next/static/chunks/13gz9e7z~imx1.js +5 -0
  36. package/dist/compiler-ui/_next/static/chunks/156xed-b6czaw.js +1 -0
  37. package/dist/compiler-ui/_next/static/chunks/{turbopack-0.uq1k8c0j4s..js → turbopack-02-3e_c-yz~5g.js} +1 -1
  38. package/dist/compiler-ui/_next/static/chunks/{turbopack-10e~t1yzi4svj.js → turbopack-0apv8vb-nczuy.js} +1 -1
  39. package/dist/compiler-ui/_not-found/__next._full.txt +10 -9
  40. package/dist/compiler-ui/_not-found/__next._head.txt +3 -3
  41. package/dist/compiler-ui/_not-found/__next._index.txt +5 -4
  42. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +2 -2
  43. package/dist/compiler-ui/_not-found/__next._not-found.txt +3 -3
  44. package/dist/compiler-ui/_not-found/__next._tree.txt +3 -2
  45. package/dist/compiler-ui/_not-found.html +1 -1
  46. package/dist/compiler-ui/_not-found.txt +10 -9
  47. package/dist/compiler-ui/index.html +1 -1
  48. package/dist/compiler-ui/index.txt +13 -12
  49. package/dist/packages/contracts/index.d.ts +2 -2
  50. package/dist/packages/contracts/index.js +1 -1
  51. package/dist/packages/contracts/lib/schema.d.ts +275 -72
  52. package/dist/packages/contracts/lib/schema.js +244 -83
  53. package/dist/packages/engine/action-definitions.d.ts +174 -13
  54. package/dist/packages/engine/action-definitions.js +125 -122
  55. package/dist/packages/engine/action-planner.js +4 -11
  56. package/dist/packages/engine/agents/lib/shells.d.ts +15 -5
  57. package/dist/packages/engine/agents/lib/shells.js +134 -123
  58. package/dist/packages/engine/agents/role-executors.js +1 -1
  59. package/dist/packages/engine/cloud-seams.d.ts +115 -0
  60. package/dist/packages/engine/cloud-seams.js +84 -0
  61. package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
  62. package/dist/packages/engine/compile/artifact-counts.js +3 -3
  63. package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
  64. package/dist/packages/engine/compile/artifact-status.js +166 -0
  65. package/dist/packages/engine/compile/billing-events.d.ts +89 -0
  66. package/dist/packages/engine/compile/billing-events.js +74 -0
  67. package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
  68. package/dist/packages/engine/compile/check-evaluator.js +298 -0
  69. package/dist/packages/engine/compile/compiled-paths.js +6 -6
  70. package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
  71. package/dist/packages/engine/compile/compiled-schema.js +55 -70
  72. package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
  73. package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
  74. package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
  75. package/dist/packages/engine/compile/index.d.ts +0 -1
  76. package/dist/packages/engine/compile/index.js +0 -1
  77. package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
  78. package/dist/packages/engine/compile/lib/schema.js +35 -39
  79. package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
  80. package/dist/packages/engine/compile/method-primitives.js +1 -1
  81. package/dist/packages/engine/compile/reset.js +4 -4
  82. package/dist/packages/engine/compile/runtime-contracts.js +2 -1
  83. package/dist/packages/engine/compile/runtime-prompt.js +3 -2
  84. package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
  85. package/dist/packages/engine/compile/runtime-runs.js +0 -1
  86. package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
  87. package/dist/packages/engine/compile/runtime.d.ts +1 -2
  88. package/dist/packages/engine/compile/runtime.js +0 -1
  89. package/dist/packages/engine/compile/state-health.js +6 -6
  90. package/dist/packages/engine/compile/state-view.js +7 -6
  91. package/dist/packages/engine/compile/validate-compiled.js +61 -30
  92. package/dist/packages/engine/compile/validate.js +26 -24
  93. package/dist/packages/engine/connection-config.js +1 -1
  94. package/dist/packages/engine/execution/lib/schema.d.ts +89 -33
  95. package/dist/packages/engine/execution/lib/schema.js +13 -5
  96. package/dist/packages/engine/index.d.ts +2 -2
  97. package/dist/packages/engine/index.js +1 -1
  98. package/dist/packages/engine/instance-paths.d.ts +15 -9
  99. package/dist/packages/engine/instance-paths.js +15 -9
  100. package/dist/packages/engine/lib/schema.d.ts +1316 -351
  101. package/dist/packages/engine/lib/schema.js +99 -36
  102. package/dist/packages/engine/native-run-handlers.js +25 -15
  103. package/dist/packages/engine/preparation-store.d.ts +9 -7
  104. package/dist/packages/engine/preparation-store.js +20 -0
  105. package/dist/packages/engine/requested-artifacts.d.ts +5 -0
  106. package/dist/packages/engine/requested-artifacts.js +36 -0
  107. package/dist/packages/engine/routes.d.ts +7 -1
  108. package/dist/packages/engine/routes.js +7 -1
  109. package/dist/packages/engine/run-observability.js +4 -4
  110. package/dist/packages/engine/runtime-event-applier.js +7 -0
  111. package/dist/packages/engine/runtime-proposal-helpers.d.ts +2 -2
  112. package/dist/packages/engine/runtime-proposal-helpers.js +6 -8
  113. package/dist/packages/engine/runtime-resource-builders.d.ts +11 -6
  114. package/dist/packages/engine/runtime-resource-builders.js +18 -6
  115. package/dist/packages/engine/runtime.d.ts +70 -8
  116. package/dist/packages/engine/runtime.js +304 -49
  117. package/dist/packages/engine/server.d.ts +25 -0
  118. package/dist/packages/engine/server.js +161 -50
  119. package/dist/packages/engine/verify/index.d.ts +10 -10
  120. package/dist/packages/engine/verify/index.js +8 -8
  121. package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
  122. package/dist/packages/engine/verify/readiness-check-run.js +92 -24
  123. package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
  124. package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +3 -3
  125. package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
  126. package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
  127. package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
  128. package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
  129. package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
  130. package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
  131. package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
  132. package/dist/packages/engine/wire-schemas.d.ts +549 -0
  133. package/dist/packages/engine/wire-schemas.js +59 -0
  134. package/dist/packages/methods/authoring/method-authoring.d.ts +5 -1
  135. package/dist/packages/methods/authoring/method-authoring.js +68 -18
  136. package/dist/packages/methods/authoring/method-edit-session.js +5 -5
  137. package/dist/packages/methods/authoring/method-improvement.js +1 -1
  138. package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
  139. package/dist/packages/methods/package/builtin-compiled-method.js +26 -23
  140. package/dist/packages/methods/package/context-interface.d.ts +39 -26
  141. package/dist/packages/methods/package/context-interface.js +48 -39
  142. package/dist/packages/methods/package/interf-method-package.js +28 -47
  143. package/dist/packages/methods/package/local-methods.d.ts +4 -4
  144. package/dist/packages/methods/package/local-methods.js +53 -66
  145. package/dist/packages/methods/package/method-definitions.d.ts +4 -6
  146. package/dist/packages/methods/package/method-definitions.js +1 -5
  147. package/dist/packages/methods/package/method-helpers.d.ts +0 -2
  148. package/dist/packages/methods/package/method-helpers.js +0 -4
  149. package/dist/packages/project/interf-detect.js +6 -6
  150. package/dist/packages/project/interf-scaffold.js +12 -12
  151. package/dist/packages/project/lib/schema.d.ts +193 -0
  152. package/dist/packages/project/lib/schema.js +46 -1
  153. package/dist/packages/project/source-config.js +6 -1
  154. package/dist/packages/project/source-folders.js +1 -1
  155. package/package.json +12 -23
  156. package/public-repo/CONTRIBUTING.md +47 -0
  157. package/public-repo/LICENSE.md +1 -0
  158. package/public-repo/README.md +325 -0
  159. package/public-repo/SECURITY.md +67 -0
  160. package/public-repo/TRADEMARKS.md +8 -0
  161. package/{builtin-methods → public-repo/methods}/interf-default/README.md +10 -7
  162. package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/shape/SKILL.md +4 -8
  163. package/{builtin-methods → public-repo/methods}/interf-default/method.json +8 -69
  164. package/public-repo/methods/interf-default/method.schema.json +75 -0
  165. package/public-repo/methods/interf-default/use/query/SKILL.md +23 -0
  166. package/public-repo/plugins/README.md +9 -0
  167. package/public-repo/plugins/interf/.claude-plugin/plugin.json +21 -0
  168. package/public-repo/plugins/interf/.mcp.json +12 -0
  169. package/public-repo/plugins/interf/README.md +29 -0
  170. package/public-repo/plugins/interf/skills/interf/SKILL.md +477 -0
  171. package/public-repo/skills/interf/SKILL.md +477 -0
  172. package/agent-skills/interf-actions/SKILL.md +0 -185
  173. package/agent-skills/interf-actions/references/cli.md +0 -243
  174. package/builtin-methods/interf-default/method.schema.json +0 -73
  175. package/builtin-methods/interf-default/use/query/SKILL.md +0 -28
  176. package/dist/cli/commands/verify.d.ts +0 -8
  177. package/dist/compiler-ui/_next/static/chunks/06yhdspx~ca5-.js +0 -5
  178. package/dist/compiler-ui/_next/static/chunks/06z~l3kwb891e.js +0 -1
  179. package/dist/compiler-ui/_next/static/chunks/08g7lvje.te.u.js +0 -1
  180. package/dist/compiler-ui/_next/static/chunks/0_i-3_5l9t2qe.js +0 -1
  181. package/dist/compiler-ui/_next/static/chunks/0b-ywny_j0g~0.js +0 -1
  182. package/dist/compiler-ui/_next/static/chunks/0b52v41o1gixx.js +0 -1
  183. package/dist/compiler-ui/_next/static/chunks/0gpzgsv0w.q~m.js +0 -31
  184. package/dist/compiler-ui/_next/static/chunks/0ilwfezfvu6~-.js +0 -1
  185. package/dist/compiler-ui/_next/static/chunks/0jipmpez3_ehh.js +0 -89
  186. package/dist/compiler-ui/_next/static/chunks/0xxmf45eskdt~.css +0 -1
  187. package/dist/compiler-ui/_next/static/chunks/13awzu4tooflw.css +0 -3
  188. package/dist/compiler-ui/_next/static/chunks/14wtz~vq25~qq.js +0 -1
  189. package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
  190. package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
  191. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_buildManifest.js +0 -0
  192. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_clientMiddlewareManifest.js +0 -0
  193. /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → tYHMLL9oKds1yDoNYgkPV}/_ssgManifest.js +0 -0
  194. /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
  195. /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
  196. /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
  197. /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
  198. /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
  199. /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
  200. /package/dist/packages/engine/verify/{test-types.js → verify-types.js} +0 -0
  201. /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/structure/SKILL.md +0 -0
  202. /package/{builtin-methods → public-repo/methods}/interf-default/compile/stages/summarize/SKILL.md +0 -0
  203. /package/{builtin-methods → public-repo/methods}/interf-default/improve/SKILL.md +0 -0
@@ -11,10 +11,10 @@ import { detectAgents, supportsAutomatedRuns, } from "./agents/lib/detection.js"
11
11
  import { loadUserConfig, } from "./agents/lib/user-config.js";
12
12
  import { asPreparationDataDir, preparationPortableContextPath, } from "../contracts/lib/preparation-paths.js";
13
13
  import { DEFAULT_METHOD_ID, methodIdForSourcePreparationConfig, } from "../project/source-config.js";
14
- import { createCompiledTestTarget, } from "./verify/test-targets.js";
14
+ import { createCompiledTestTarget, } from "./verify/verify-targets.js";
15
15
  import { methodAuthoringTaskPrompt, MethodAuthoringActionValuesSchema, } from "./action-values.js";
16
16
  import { ActionProposalPlanActionTypeSchema, } from "./lib/schema.js";
17
- export const ACTION_PLANNER_CLARIFICATION_MESSAGE = "I can help with this Interf Workspace. Ask a question about Interf, or ask me to create a Preparation, prepare, check readiness, improve, or draft a Method and I will prepare an approval proposal.";
17
+ export const ACTION_PLANNER_CLARIFICATION_MESSAGE = "I can help with this Interf instance. Ask a question about Interf, or ask me to create a Preparation, prepare, check readiness, improve, or draft a Build Plan and I will prepare an approval proposal.";
18
18
  export function createActionProposalId() {
19
19
  return `action_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
20
20
  }
@@ -112,15 +112,13 @@ export function testModeFromValues(values) {
112
112
  return "compiled";
113
113
  return value === "source-files" || value === "compiled" || value === "both" ? value : null;
114
114
  }
115
- export function testModeValue(values, defaultMode = "both") {
115
+ export function testModeValue(values, defaultMode = "compiled") {
116
116
  return testModeFromValues(values) ?? defaultMode;
117
117
  }
118
118
  export function testModeCliTarget(mode) {
119
119
  if (mode === "source-files")
120
120
  return "source-files";
121
- if (mode === "compiled")
122
- return "portable-context";
123
- return "both";
121
+ return "compiled";
124
122
  }
125
123
  export function methodIdForProposal(message, values) {
126
124
  const explicit = stringValue(values, "method_id") ??
@@ -210,13 +208,13 @@ export function actionCommandPreview(actionType, preparationName, methodId, valu
210
208
  if (actionType === "compile") {
211
209
  const methodSuffix = methodId ? ` # Method: ${methodId}` : "";
212
210
  return preparationName
213
- ? `interf compile --preparation ${preparationName}${methodSuffix}`
211
+ ? `interf compile ${preparationName}${methodSuffix}`
214
212
  : `interf compile${methodSuffix}`;
215
213
  }
216
214
  if (actionType === "test") {
217
215
  const mode = testModeCliTarget(testModeValue(values));
218
216
  return preparationName
219
- ? `interf test --preparation ${preparationName} --target ${mode}`
217
+ ? `interf test ${preparationName} --target ${mode}`
220
218
  : `interf test --target ${mode}`;
221
219
  }
222
220
  if (actionType === "readiness-check-draft") {
@@ -9,7 +9,7 @@
9
9
  import { type ArtifactRef, type ProofRecord } from "./execution/lib/schema.js";
10
10
  import { type CompiledState } from "./compile/state.js";
11
11
  import { type RuntimeRun } from "./compile/lib/schema.js";
12
- import { type ReadinessState, type ReadinessTargetResult } from "../contracts/lib/schema.js";
12
+ import { type Artifact, type Readiness, type VerifyTargetResult } from "../contracts/lib/schema.js";
13
13
  import { type TestRunTargetSummary } from "./verify/lib/schema.js";
14
14
  import { type SourcePreparationConfig } from "../project/lib/schema.js";
15
15
  import { type MethodResource, type PreparationResource } from "./lib/schema.js";
@@ -35,18 +35,23 @@ export declare function logsForRuntimeRun(run: RuntimeRun | undefined): {
35
35
  prompt_path?: string | undefined;
36
36
  } | undefined;
37
37
  export declare function passRate(passed: number, total: number): number | null;
38
- export declare function readinessTargetResult(summary: TestRunTargetSummary | null | undefined, currentFingerprint: string | null, readinessRunFingerprint: string | null | undefined): ReadinessTargetResult | null;
39
- export declare function readinessSummaryForStatus(status: ReadinessState["status"]): string;
40
- export declare function readinessStateToPreparationReadiness(readiness: ReadinessState): ReadinessState;
41
- export declare function buildPreparationResource(rootPath: string, preparation: SourcePreparationConfig, readiness: ReadinessState, latestCompileRunId: string | null, latestTestRunId: string | null): PreparationResource;
38
+ export declare function readinessTargetResult(summary: TestRunTargetSummary | null | undefined, currentFingerprint: string | null, readinessRunFingerprint: string | null | undefined): VerifyTargetResult | null;
39
+ export declare function readinessSummaryForStatus(status: Readiness["status"]): string;
40
+ export declare function readinessStateToPreparationReadiness(readiness: Readiness): Readiness;
41
+ export declare function buildPreparationResource(rootPath: string, preparation: SourcePreparationConfig, readiness: Readiness, latestCompileRunId: string | null, latestTestRunId: string | null, artifacts?: PreparationResource["artifacts"]): PreparationResource;
42
42
  export declare function buildMethodResource(resource: {
43
43
  id: string;
44
44
  path: string;
45
45
  label?: string;
46
46
  hint?: string;
47
+ purpose?: {
48
+ label: string;
49
+ taskHint: string;
50
+ };
51
+ inputs?: MethodResource["inputs"];
47
52
  source_kind: "builtin" | "local";
48
53
  built_in: boolean;
49
54
  active_for_preparations: string[];
50
- output_paths: string[];
55
+ artifacts: Artifact[];
51
56
  stages: MethodResource["stages"];
52
57
  }): MethodResource;
@@ -1,4 +1,4 @@
1
- import { ReadinessStateSchema, } from "../contracts/lib/schema.js";
1
+ import { ReadinessSchema, } from "../contracts/lib/schema.js";
2
2
  import { methodIdForSourcePreparationConfig, resolveSourcePreparationPath, } from "../project/source-config.js";
3
3
  import { MethodResourceSchema, PreparationResourceSchema, } from "./lib/schema.js";
4
4
  export function createRunId(prefix) {
@@ -85,7 +85,7 @@ export function readinessSummaryForStatus(status) {
85
85
  if (status === "ready")
86
86
  return "Ready for agent work.";
87
87
  if (status === "not-ready")
88
- return "Readiness checks did not pass.";
88
+ return "Artifact or readiness checks did not pass.";
89
89
  if (status === "stale")
90
90
  return "Readiness checks are stale for the current saved checks.";
91
91
  if (status === "checking")
@@ -97,16 +97,16 @@ export function readinessSummaryForStatus(status) {
97
97
  if (status === "not-built")
98
98
  return "Portable context has not been built yet.";
99
99
  if (status === "not-configured")
100
- return "No readiness checks are configured.";
100
+ return "No checks are configured.";
101
101
  return "Latest preparation failed.";
102
102
  }
103
103
  export function readinessStateToPreparationReadiness(readiness) {
104
- return ReadinessStateSchema.parse({
104
+ return ReadinessSchema.parse({
105
105
  ...readiness,
106
106
  checks: readiness.checks.map((check) => ({ ...check })),
107
107
  });
108
108
  }
109
- export function buildPreparationResource(rootPath, preparation, readiness, latestCompileRunId, latestTestRunId) {
109
+ export function buildPreparationResource(rootPath, preparation, readiness, latestCompileRunId, latestTestRunId, artifacts = []) {
110
110
  const methodId = methodIdForSourcePreparationConfig(preparation);
111
111
  return PreparationResourceSchema.parse({
112
112
  id: preparation.name,
@@ -115,6 +115,8 @@ export function buildPreparationResource(rootPath, preparation, readiness, lates
115
115
  source_path: resolveSourcePreparationPath(rootPath, preparation),
116
116
  method_id: methodId,
117
117
  checks: preparation.checks,
118
+ requested_artifacts: preparation.requested_artifacts ?? [],
119
+ source_profile: preparation.source_profile ?? null,
118
120
  portable_context: {
119
121
  preparation: preparation.name,
120
122
  path: readiness.portable_context_path,
@@ -131,6 +133,7 @@ export function buildPreparationResource(rootPath, preparation, readiness, lates
131
133
  },
132
134
  latest_compile_run_id: latestCompileRunId,
133
135
  latest_test_run_id: latestTestRunId,
136
+ artifacts,
134
137
  });
135
138
  }
136
139
  export function buildMethodResource(resource) {
@@ -140,10 +143,19 @@ export function buildMethodResource(resource) {
140
143
  path: resource.path,
141
144
  ...(resource.label ? { label: resource.label } : {}),
142
145
  ...(resource.hint ? { hint: resource.hint } : {}),
146
+ ...(resource.purpose
147
+ ? {
148
+ purpose: {
149
+ label: resource.purpose.label,
150
+ task_hint: resource.purpose.taskHint,
151
+ },
152
+ }
153
+ : {}),
154
+ inputs: resource.inputs ?? [],
143
155
  source_kind: resource.source_kind,
144
156
  built_in: resource.built_in,
145
157
  active_for_preparations: resource.active_for_preparations,
146
- output_paths: resource.output_paths,
158
+ artifacts: resource.artifacts,
147
159
  stages: resource.stages,
148
160
  });
149
161
  }
@@ -1,7 +1,9 @@
1
1
  import { type ArtifactRef, type CompileRun, type InterfRunEvent, type ProofRecord } from "./execution/lib/schema.js";
2
2
  import { type RunEventSink } from "./execution/events.js";
3
- import { type ReadinessState } from "../contracts/lib/schema.js";
3
+ import { type Readiness } from "../contracts/lib/schema.js";
4
4
  import type { SourcePreparationConfig } from "../project/lib/schema.js";
5
+ import { type BillingEventSink } from "./compile/billing-events.js";
6
+ import type { IdempotencyStore, RunLeaseStore, TokenValidator } from "./cloud-seams.js";
5
7
  import { type ActionProposalCreateRequest, type ActionProposalPlan, type ActionProposalResource, type CompileRunCreateRequest, type CompileRunResource, type MethodResource, type LocalServiceHealth, type LocalJobEvent, type LocalJobEventAppendRequest, type LocalExecutorStatus, type LocalJobRunResource, type LocalRunHandlerResult, type PortableContextResource, type PreparationResource, type ReadinessCheckDraftCreateRequest, type ReadinessCheckDraftResult, type RunObservabilityResource, type ServiceRegistryWorkspace, type SourceFileResource, type WorkspaceFileResource, type VerifyRunCreateRequest, type VerifyRunResource, type MethodAuthoringCreateRequest, type MethodAuthoringResult, type MethodChangeResult, type PreparationChangeResult, type PreparationSetupResult, type ResetResult } from "./lib/schema.js";
6
8
  export interface LocalServiceCompileRunContext {
7
9
  runId: string;
@@ -58,6 +60,21 @@ export interface LocalServiceRuntimeOptions {
58
60
  * skip generating one; production startup always provides a token.
59
61
  */
60
62
  authToken?: string;
63
+ /**
64
+ * 0.17 — optional injection point for the per-Artifact billing event
65
+ * sink. Local default writes a JSONL file alongside the run record;
66
+ * cloud variants will inject a Metronome HTTP sender once the
67
+ * Stripe/Metronome integration ships in 0.18+.
68
+ */
69
+ billingEventSink?: BillingEventSink;
70
+ /**
71
+ * 0.17 — cloud-variant interface seams. Local default: in-process
72
+ * Maps on the runtime (current behavior). Cloud variants pass shared
73
+ * implementations so multi-replica engines coordinate. See
74
+ * `cloud-seams.ts` for the contract.
75
+ */
76
+ idempotencyStore?: IdempotencyStore;
77
+ runLeaseStore?: RunLeaseStore;
61
78
  }
62
79
  /**
63
80
  * Per-preparation context tracked by the runtime. Multiple preparations can
@@ -99,6 +116,11 @@ export declare class LocalServiceRuntime {
99
116
  * when a compile run is launched and cleared once the run reaches a
100
117
  * terminal state. Each entry remembers where the persisted record lives
101
118
  * so cancel can mark it without re-resolving the Preparation.
119
+ *
120
+ * TODO(cloud): when the cloud variant lands, wire `RunLeaseStore`
121
+ * (see `cloud-seams.ts` B4.2) through this map. Multi-replica engines
122
+ * need a shared lease store so a replica can take over a run whose
123
+ * owning replica died.
102
124
  */
103
125
  private activeCompileRuns;
104
126
  /**
@@ -108,6 +130,11 @@ export declare class LocalServiceRuntime {
108
130
  * tenants on the same engine (CSO finding: a malicious preparation could
109
131
  * otherwise hijack another preparation's run id by reusing its key).
110
132
  * Entries expire after `IDEMPOTENCY_TTL_MS`.
133
+ *
134
+ * TODO(cloud): when the cloud variant lands, wire `IdempotencyStore`
135
+ * (see `cloud-seams.ts` B4.1) through this map. Multi-replica engines
136
+ * need a shared store so retries that land on a different replica
137
+ * still hit the same dedupe entry.
111
138
  */
112
139
  private idempotencyKeyCache;
113
140
  /**
@@ -122,8 +149,32 @@ export declare class LocalServiceRuntime {
122
149
  private readonly readinessCache;
123
150
  private readonly sourceFilesCache;
124
151
  private readonly methodListingCache;
152
+ /**
153
+ * 0.17 — sink for per-Artifact billing events. Set once at construction.
154
+ * Lazy-defaults to a per-run JSONL writer when no override was injected.
155
+ */
156
+ private readonly billingEventSink;
157
+ /**
158
+ * 0.17 — cloud-variant injection points. The local engine accepts
159
+ * these on the options surface but does not consume them yet — the
160
+ * in-process Maps remain authoritative for idempotency and
161
+ * run-lease state. The cloud variant fork will swap to these stores;
162
+ * the option-fields are documented here so the cloud build has a
163
+ * stable target. See `cloud-seams.ts` for the contracts.
164
+ */
165
+ readonly cloudIdempotencyStore: IdempotencyStore | null;
166
+ readonly cloudRunLeaseStore: RunLeaseStore | null;
167
+ private cloudTokenValidator;
125
168
  constructor(options: LocalServiceRuntimeOptions);
126
169
  setBoundPort(port: number): void;
170
+ /**
171
+ * 0.17 — token validator setter for cloud variants. Stored on the
172
+ * runtime so `isAuthorizedMutation` in `server.ts` can opt into the
173
+ * async per-account check when present. Local default: never set —
174
+ * the static bearer-token check runs.
175
+ */
176
+ setTokenValidator(validator: TokenValidator | null): void;
177
+ getTokenValidator(): TokenValidator | null;
127
178
  /** Set a hook that fires whenever the registered preparations change. */
128
179
  setOnRegistryChanged(handler: (() => void) | null): void;
129
180
  /**
@@ -175,11 +226,11 @@ export declare class LocalServiceRuntime {
175
226
  health(prepDataDir?: string): LocalServiceHealth;
176
227
  listPreparations(prepDataDir: string): PreparationResource[];
177
228
  getPreparation(prepDataDir: string, preparationName: string): PreparationResource | null;
178
- listPreparationReadiness(prepDataDir: string): ReadinessState[];
179
- getPreparationReadiness(prepDataDir: string, preparationName: string): ReadinessState | null;
180
- listReadiness(prepDataDir: string): ReadinessState[];
181
- getReadiness(prepDataDir: string, preparationName: string): ReadinessState | null;
182
- computePreparationReadiness(prepDataDir: string, preparation: SourcePreparationConfig): ReadinessState;
229
+ listPreparationReadiness(prepDataDir: string): Readiness[];
230
+ getPreparationReadiness(prepDataDir: string, preparationName: string): Readiness | null;
231
+ listReadiness(prepDataDir: string): Readiness[];
232
+ getReadiness(prepDataDir: string, preparationName: string): Readiness | null;
233
+ computePreparationReadiness(prepDataDir: string, preparation: SourcePreparationConfig): Readiness;
183
234
  private computePreparationReadinessUncached;
184
235
  listSourceFiles(prepDataDir: string, preparationName?: string | null): SourceFileResource[];
185
236
  listWorkspaceFiles(prepDataDir: string): WorkspaceFileResource[];
@@ -224,7 +275,7 @@ export declare class LocalServiceRuntime {
224
275
  listRunObservability(prepDataDir: string): RunObservabilityResource[];
225
276
  getRunObservability(prepDataDir: string, runId: string): RunObservabilityResource | null;
226
277
  /**
227
- * Method-scoped runs: every method-authoring or method-improvement job
278
+ * Method Activity runs: every method-authoring or method-improvement job
228
279
  * whose `method` matches `methodId`. Surfaced through
229
280
  * `GET /v1/methods/<id>/runs` so Method Detail can show the full audit
230
281
  * trail of authoring + improvement work for a Method.
@@ -249,7 +300,7 @@ export declare class LocalServiceRuntime {
249
300
  createCompileRun(prepDataDir: string, requestValue: unknown): Promise<CompileRunResource>;
250
301
  /**
251
302
  * Cancel an in-flight compile run. Marks the persisted record as
252
- * `cancelled`, emits a `run.failed` event to capture the cancellation in
303
+ * `cancelled`, emits a `run.cancelled` event to capture the cancellation in
253
304
  * the run timeline, and clears the active handle so retries may start a
254
305
  * fresh run. If the run already finished, returns
255
306
  * `{ cancelled: false, reason: "already finished" }` and persists nothing.
@@ -303,6 +354,17 @@ export declare class LocalServiceRuntime {
303
354
  private resolvePreparationConfig;
304
355
  private ensureCompiledForRun;
305
356
  private readCompileRun;
357
+ private hydrateCompileRunFromRuntime;
358
+ private finalizeInterruptedCompileRuns;
359
+ private finalizeInterruptedJobRuns;
360
+ /**
361
+ * 0.17 — emit per-Artifact billing events when a compile run reaches
362
+ * a terminal state. STUB FORM: writes a JSONL file alongside the run
363
+ * record by default. Production sink (Metronome HTTP) wires in 0.18+.
364
+ * The JSONL output is observability/dev fixture, NOT production
365
+ * billing data.
366
+ */
367
+ private emitBillingEventsForRun;
306
368
  private writeCompileRun;
307
369
  private writeJobRun;
308
370
  private writeActionProposal;