@interf/compiler 0.1.12 → 0.2.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 (282) hide show
  1. package/README.md +254 -136
  2. package/dist/commands/benchmark.d.ts.map +1 -1
  3. package/dist/commands/benchmark.js +65 -84
  4. package/dist/commands/benchmark.js.map +1 -1
  5. package/dist/commands/compile.d.ts.map +1 -1
  6. package/dist/commands/compile.js +19 -3
  7. package/dist/commands/compile.js.map +1 -1
  8. package/dist/commands/create.d.ts +3 -0
  9. package/dist/commands/create.d.ts.map +1 -1
  10. package/dist/commands/create.js +34 -9
  11. package/dist/commands/create.js.map +1 -1
  12. package/dist/commands/default.d.ts.map +1 -1
  13. package/dist/commands/default.js +2 -0
  14. package/dist/commands/default.js.map +1 -1
  15. package/dist/commands/init.d.ts.map +1 -1
  16. package/dist/commands/init.js +3 -2
  17. package/dist/commands/init.js.map +1 -1
  18. package/dist/index.d.ts +11 -29
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +7 -16
  21. package/dist/index.js.map +1 -1
  22. package/dist/lib/agent-args.d.ts +4 -0
  23. package/dist/lib/agent-args.d.ts.map +1 -0
  24. package/dist/lib/agent-args.js +42 -0
  25. package/dist/lib/agent-args.js.map +1 -0
  26. package/dist/lib/agent-constants.d.ts +6 -0
  27. package/dist/lib/agent-constants.d.ts.map +1 -0
  28. package/dist/lib/agent-constants.js +29 -0
  29. package/dist/lib/agent-constants.js.map +1 -0
  30. package/dist/lib/agent-detection.d.ts +8 -0
  31. package/dist/lib/agent-detection.d.ts.map +1 -0
  32. package/dist/lib/agent-detection.js +66 -0
  33. package/dist/lib/agent-detection.js.map +1 -0
  34. package/dist/lib/agent-execution.d.ts +3 -0
  35. package/dist/lib/agent-execution.d.ts.map +1 -0
  36. package/dist/lib/agent-execution.js +207 -0
  37. package/dist/lib/agent-execution.js.map +1 -0
  38. package/dist/lib/agent-logs.d.ts +3 -0
  39. package/dist/lib/agent-logs.d.ts.map +1 -0
  40. package/dist/lib/agent-logs.js +18 -0
  41. package/dist/lib/agent-logs.js.map +1 -0
  42. package/dist/lib/agent-preflight.d.ts +8 -0
  43. package/dist/lib/agent-preflight.d.ts.map +1 -0
  44. package/dist/lib/agent-preflight.js +77 -0
  45. package/dist/lib/agent-preflight.js.map +1 -0
  46. package/dist/lib/agent-render.d.ts +9 -0
  47. package/dist/lib/agent-render.d.ts.map +1 -0
  48. package/dist/lib/agent-render.js +219 -0
  49. package/dist/lib/agent-render.js.map +1 -0
  50. package/dist/lib/agent-status.d.ts +4 -0
  51. package/dist/lib/agent-status.d.ts.map +1 -0
  52. package/dist/lib/agent-status.js +59 -0
  53. package/dist/lib/agent-status.js.map +1 -0
  54. package/dist/lib/agent-types.d.ts +31 -0
  55. package/dist/lib/agent-types.d.ts.map +1 -0
  56. package/dist/lib/agent-types.js +2 -0
  57. package/dist/lib/agent-types.js.map +1 -0
  58. package/dist/lib/agents.d.ts +7 -49
  59. package/dist/lib/agents.d.ts.map +1 -1
  60. package/dist/lib/agents.js +8 -554
  61. package/dist/lib/agents.js.map +1 -1
  62. package/dist/lib/benchmark-execution.d.ts +9 -0
  63. package/dist/lib/benchmark-execution.d.ts.map +1 -0
  64. package/dist/lib/benchmark-execution.js +488 -0
  65. package/dist/lib/benchmark-execution.js.map +1 -0
  66. package/dist/lib/benchmark-paths.d.ts +11 -0
  67. package/dist/lib/benchmark-paths.d.ts.map +1 -0
  68. package/dist/lib/benchmark-paths.js +38 -0
  69. package/dist/lib/benchmark-paths.js.map +1 -0
  70. package/dist/lib/benchmark-specs.d.ts +8 -0
  71. package/dist/lib/benchmark-specs.d.ts.map +1 -0
  72. package/dist/lib/benchmark-specs.js +115 -0
  73. package/dist/lib/benchmark-specs.js.map +1 -0
  74. package/dist/lib/benchmark-targets.d.ts +5 -0
  75. package/dist/lib/benchmark-targets.d.ts.map +1 -0
  76. package/dist/lib/benchmark-targets.js +72 -0
  77. package/dist/lib/benchmark-targets.js.map +1 -0
  78. package/dist/lib/benchmark-types.d.ts +19 -0
  79. package/dist/lib/benchmark-types.d.ts.map +1 -0
  80. package/dist/lib/benchmark-types.js +2 -0
  81. package/dist/lib/benchmark-types.js.map +1 -0
  82. package/dist/lib/benchmark.d.ts +4 -29
  83. package/dist/lib/benchmark.d.ts.map +1 -1
  84. package/dist/lib/benchmark.js +3 -324
  85. package/dist/lib/benchmark.js.map +1 -1
  86. package/dist/lib/bundled-templates.d.ts +5 -0
  87. package/dist/lib/bundled-templates.d.ts.map +1 -0
  88. package/dist/lib/bundled-templates.js +23 -0
  89. package/dist/lib/bundled-templates.js.map +1 -0
  90. package/dist/lib/config.d.ts +1 -0
  91. package/dist/lib/config.d.ts.map +1 -1
  92. package/dist/lib/config.js +2 -0
  93. package/dist/lib/config.js.map +1 -1
  94. package/dist/lib/eval-packs.d.ts +204 -0
  95. package/dist/lib/eval-packs.d.ts.map +1 -0
  96. package/dist/lib/eval-packs.js +177 -0
  97. package/dist/lib/eval-packs.js.map +1 -0
  98. package/dist/lib/execution-profile.d.ts +18 -0
  99. package/dist/lib/execution-profile.d.ts.map +1 -0
  100. package/dist/lib/execution-profile.js +85 -0
  101. package/dist/lib/execution-profile.js.map +1 -0
  102. package/dist/lib/interf-bootstrap.d.ts +4 -0
  103. package/dist/lib/interf-bootstrap.d.ts.map +1 -1
  104. package/dist/lib/interf-bootstrap.js +71 -68
  105. package/dist/lib/interf-bootstrap.js.map +1 -1
  106. package/dist/lib/interf-compile-plan.d.ts +12 -0
  107. package/dist/lib/interf-compile-plan.d.ts.map +1 -0
  108. package/dist/lib/interf-compile-plan.js +143 -0
  109. package/dist/lib/interf-compile-plan.js.map +1 -0
  110. package/dist/lib/interf-detect.d.ts.map +1 -1
  111. package/dist/lib/interf-detect.js +11 -10
  112. package/dist/lib/interf-detect.js.map +1 -1
  113. package/dist/lib/interf-scaffold.d.ts +1 -10
  114. package/dist/lib/interf-scaffold.d.ts.map +1 -1
  115. package/dist/lib/interf-scaffold.js +25 -362
  116. package/dist/lib/interf-scaffold.js.map +1 -1
  117. package/dist/lib/interf-workflow-package.d.ts +4 -0
  118. package/dist/lib/interf-workflow-package.d.ts.map +1 -0
  119. package/dist/lib/interf-workflow-package.js +131 -0
  120. package/dist/lib/interf-workflow-package.js.map +1 -0
  121. package/dist/lib/interf.d.ts +2 -1
  122. package/dist/lib/interf.d.ts.map +1 -1
  123. package/dist/lib/interf.js +2 -1
  124. package/dist/lib/interf.js.map +1 -1
  125. package/dist/lib/local-workflows.d.ts.map +1 -1
  126. package/dist/lib/local-workflows.js +8 -12
  127. package/dist/lib/local-workflows.js.map +1 -1
  128. package/dist/lib/logger.d.ts +4 -0
  129. package/dist/lib/logger.d.ts.map +1 -0
  130. package/dist/lib/logger.js +11 -0
  131. package/dist/lib/logger.js.map +1 -0
  132. package/dist/lib/obsidian.d.ts.map +1 -1
  133. package/dist/lib/obsidian.js +7 -3
  134. package/dist/lib/obsidian.js.map +1 -1
  135. package/dist/lib/parse.d.ts +2 -2
  136. package/dist/lib/parse.d.ts.map +1 -1
  137. package/dist/lib/parse.js +11 -7
  138. package/dist/lib/parse.js.map +1 -1
  139. package/dist/lib/registry.js +3 -3
  140. package/dist/lib/registry.js.map +1 -1
  141. package/dist/lib/runtime-acceptance.d.ts +4 -0
  142. package/dist/lib/runtime-acceptance.d.ts.map +1 -0
  143. package/dist/lib/runtime-acceptance.js +123 -0
  144. package/dist/lib/runtime-acceptance.js.map +1 -0
  145. package/dist/lib/runtime-contracts.d.ts +4 -0
  146. package/dist/lib/runtime-contracts.d.ts.map +1 -0
  147. package/dist/lib/runtime-contracts.js +63 -0
  148. package/dist/lib/runtime-contracts.js.map +1 -0
  149. package/dist/lib/runtime-paths.d.ts +8 -0
  150. package/dist/lib/runtime-paths.d.ts.map +1 -0
  151. package/dist/lib/runtime-paths.js +28 -0
  152. package/dist/lib/runtime-paths.js.map +1 -0
  153. package/dist/lib/runtime-prompt.d.ts +3 -0
  154. package/dist/lib/runtime-prompt.d.ts.map +1 -0
  155. package/dist/lib/runtime-prompt.js +59 -0
  156. package/dist/lib/runtime-prompt.js.map +1 -0
  157. package/dist/lib/runtime-reconcile.d.ts +6 -0
  158. package/dist/lib/runtime-reconcile.d.ts.map +1 -0
  159. package/dist/lib/runtime-reconcile.js +339 -0
  160. package/dist/lib/runtime-reconcile.js.map +1 -0
  161. package/dist/lib/runtime-runs.d.ts +12 -0
  162. package/dist/lib/runtime-runs.d.ts.map +1 -0
  163. package/dist/lib/runtime-runs.js +337 -0
  164. package/dist/lib/runtime-runs.js.map +1 -0
  165. package/dist/lib/runtime-types.d.ts +42 -0
  166. package/dist/lib/runtime-types.d.ts.map +1 -0
  167. package/dist/lib/runtime-types.js +2 -0
  168. package/dist/lib/runtime-types.js.map +1 -0
  169. package/dist/lib/runtime.d.ts +6 -58
  170. package/dist/lib/runtime.d.ts.map +1 -1
  171. package/dist/lib/runtime.js +5 -614
  172. package/dist/lib/runtime.js.map +1 -1
  173. package/dist/lib/schema.d.ts +156 -13
  174. package/dist/lib/schema.d.ts.map +1 -1
  175. package/dist/lib/schema.js +113 -4
  176. package/dist/lib/schema.js.map +1 -1
  177. package/dist/lib/source-config.d.ts +13 -0
  178. package/dist/lib/source-config.d.ts.map +1 -0
  179. package/dist/lib/source-config.js +75 -0
  180. package/dist/lib/source-config.js.map +1 -0
  181. package/dist/lib/state-artifacts.d.ts +15 -0
  182. package/dist/lib/state-artifacts.d.ts.map +1 -0
  183. package/dist/lib/state-artifacts.js +24 -0
  184. package/dist/lib/state-artifacts.js.map +1 -0
  185. package/dist/lib/state-health.d.ts +9 -0
  186. package/dist/lib/state-health.d.ts.map +1 -0
  187. package/dist/lib/state-health.js +330 -0
  188. package/dist/lib/state-health.js.map +1 -0
  189. package/dist/lib/state-io.d.ts +15 -0
  190. package/dist/lib/state-io.d.ts.map +1 -0
  191. package/dist/lib/state-io.js +219 -0
  192. package/dist/lib/state-io.js.map +1 -0
  193. package/dist/lib/state-paths.d.ts +5 -0
  194. package/dist/lib/state-paths.d.ts.map +1 -0
  195. package/dist/lib/state-paths.js +19 -0
  196. package/dist/lib/state-paths.js.map +1 -0
  197. package/dist/lib/state-view.d.ts +7 -0
  198. package/dist/lib/state-view.d.ts.map +1 -0
  199. package/dist/lib/state-view.js +147 -0
  200. package/dist/lib/state-view.js.map +1 -0
  201. package/dist/lib/state.d.ts +6 -46
  202. package/dist/lib/state.d.ts.map +1 -1
  203. package/dist/lib/state.js +5 -632
  204. package/dist/lib/state.js.map +1 -1
  205. package/dist/lib/summarize-plan.d.ts +1 -0
  206. package/dist/lib/summarize-plan.d.ts.map +1 -1
  207. package/dist/lib/summarize-plan.js +10 -0
  208. package/dist/lib/summarize-plan.js.map +1 -1
  209. package/dist/lib/user-config.js +2 -2
  210. package/dist/lib/user-config.js.map +1 -1
  211. package/dist/lib/validate-helpers.d.ts +21 -0
  212. package/dist/lib/validate-helpers.d.ts.map +1 -0
  213. package/dist/lib/validate-helpers.js +72 -0
  214. package/dist/lib/validate-helpers.js.map +1 -0
  215. package/dist/lib/validate-interface.d.ts +2 -0
  216. package/dist/lib/validate-interface.d.ts.map +1 -1
  217. package/dist/lib/validate-interface.js +103 -53
  218. package/dist/lib/validate-interface.js.map +1 -1
  219. package/dist/lib/validate-kb.d.ts +8 -0
  220. package/dist/lib/validate-kb.d.ts.map +1 -1
  221. package/dist/lib/validate-kb.js +53 -24
  222. package/dist/lib/validate-kb.js.map +1 -1
  223. package/dist/lib/validate.d.ts +1 -1
  224. package/dist/lib/validate.d.ts.map +1 -1
  225. package/dist/lib/validate.js +5 -2
  226. package/dist/lib/validate.js.map +1 -1
  227. package/dist/lib/workflow-definitions.d.ts +1 -1
  228. package/dist/lib/workflow-definitions.d.ts.map +1 -1
  229. package/dist/lib/workflow-definitions.js +90 -166
  230. package/dist/lib/workflow-definitions.js.map +1 -1
  231. package/dist/lib/workflow-helpers.d.ts.map +1 -1
  232. package/dist/lib/workflow-helpers.js +6 -3
  233. package/dist/lib/workflow-helpers.js.map +1 -1
  234. package/dist/lib/workflow-stage-runner.d.ts +41 -0
  235. package/dist/lib/workflow-stage-runner.d.ts.map +1 -0
  236. package/dist/lib/workflow-stage-runner.js +106 -0
  237. package/dist/lib/workflow-stage-runner.js.map +1 -0
  238. package/dist/lib/workflow-starter-docs.d.ts +9 -0
  239. package/dist/lib/workflow-starter-docs.d.ts.map +1 -0
  240. package/dist/lib/workflow-starter-docs.js +18 -0
  241. package/dist/lib/workflow-starter-docs.js.map +1 -0
  242. package/dist/lib/workflows-interface-contracts.d.ts +24 -0
  243. package/dist/lib/workflows-interface-contracts.d.ts.map +1 -0
  244. package/dist/lib/workflows-interface-contracts.js +304 -0
  245. package/dist/lib/workflows-interface-contracts.js.map +1 -0
  246. package/dist/lib/workflows-interface.d.ts +3 -10
  247. package/dist/lib/workflows-interface.d.ts.map +1 -1
  248. package/dist/lib/workflows-interface.js +117 -365
  249. package/dist/lib/workflows-interface.js.map +1 -1
  250. package/dist/lib/workflows-kb.d.ts.map +1 -1
  251. package/dist/lib/workflows-kb.js +79 -55
  252. package/dist/lib/workflows-kb.js.map +1 -1
  253. package/dist/lib/workflows.d.ts.map +1 -1
  254. package/dist/lib/workflows.js +1 -1
  255. package/dist/lib/workflows.js.map +1 -1
  256. package/package.json +15 -4
  257. package/skills/interface/analyze/SKILL.md +79 -28
  258. package/skills/interface/compile/SKILL.md +27 -28
  259. package/skills/interface/create/SKILL.md +53 -230
  260. package/skills/interface/create/references/compile-plan-format.md +31 -31
  261. package/skills/interface/create/references/workflows.md +17 -32
  262. package/skills/interface/query/SKILL.md +15 -1
  263. package/skills/interface/retrieve/SKILL.md +32 -65
  264. package/skills/knowledge-base/compile/SKILL.md +59 -83
  265. package/skills/knowledge-base/compile/references/stage-claims.md +1 -1
  266. package/skills/knowledge-base/compile/references/stage-entities.md +2 -2
  267. package/skills/knowledge-base/query/SKILL.md +13 -1
  268. package/skills/knowledge-base/summarize/SKILL.md +54 -24
  269. package/templates/interface/README.md +13 -12
  270. package/templates/interface/interfaces.md +14 -11
  271. package/templates/knowledge-base/README.md +0 -1
  272. package/templates/knowledge-base/registry.md +15 -15
  273. package/templates/workflow-package/README.md +16 -0
  274. package/templates/workflow-package/create/SKILL.md +8 -0
  275. package/templates/workflow-package/interface-query/SKILL.md +29 -0
  276. package/templates/workflow-package/interface-stage/SKILL.md +13 -0
  277. package/templates/workflow-package/knowledge-base-query/SKILL.md +36 -0
  278. package/templates/workflow-package/knowledge-base-stage/SKILL.md +13 -0
  279. package/templates/workflow-starters/interface/interf/README.md +13 -0
  280. package/templates/workflow-starters/interface/interf/create/SKILL.md +15 -0
  281. package/templates/workflow-starters/knowledge-base/interf/README.md +13 -0
  282. package/templates/workflow-starters/knowledge-base/karpathy/README.md +13 -0
@@ -0,0 +1,123 @@
1
+ import { existsSync, readFileSync, } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { readJsonFileWithSchema } from "./parse.js";
4
+ import { RuntimeStageContractSchema, } from "./schema.js";
5
+ import { warnInterf } from "./logger.js";
6
+ import { stageContractPath } from "./runtime-paths.js";
7
+ function readWorkspaceJsonFile(dirPath, relativePath) {
8
+ const targetPath = join(dirPath, relativePath);
9
+ if (!existsSync(targetPath))
10
+ return null;
11
+ try {
12
+ const parsed = JSON.parse(readFileSync(targetPath, "utf8"));
13
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed)
14
+ ? parsed
15
+ : null;
16
+ }
17
+ catch (error) {
18
+ warnInterf(`Warning: failed to read workspace JSON at ${targetPath}: ${error instanceof Error ? error.message : String(error)}`);
19
+ return null;
20
+ }
21
+ }
22
+ function readPathValue(record, keyPath) {
23
+ if (!record)
24
+ return undefined;
25
+ return keyPath
26
+ .split(".")
27
+ .filter((segment) => segment.length > 0)
28
+ .reduce((current, segment) => {
29
+ if (!current || typeof current !== "object" || Array.isArray(current))
30
+ return undefined;
31
+ return current[segment];
32
+ }, record);
33
+ }
34
+ function toFiniteNumber(value) {
35
+ if (typeof value !== "number" || !Number.isFinite(value))
36
+ return null;
37
+ return value;
38
+ }
39
+ function hasAcceptanceRules(acceptance) {
40
+ if (!acceptance)
41
+ return false;
42
+ return (acceptance.artifacts_exist?.length ?? 0) > 0 ||
43
+ (acceptance.state_truthy?.length ?? 0) > 0 ||
44
+ Object.keys(acceptance.state_equals_counts ?? {}).length > 0 ||
45
+ Object.keys(acceptance.state_at_least ?? {}).length > 0 ||
46
+ Object.keys(acceptance.state_at_least_counts ?? {}).length > 0;
47
+ }
48
+ export function validateStageContractAcceptance(dirPath, contract = null) {
49
+ const resolvedContract = contract ?? (() => {
50
+ const path = stageContractPath(dirPath);
51
+ if (!existsSync(path))
52
+ return null;
53
+ return readJsonFileWithSchema(path, "stage contract", RuntimeStageContractSchema);
54
+ })();
55
+ if (!resolvedContract) {
56
+ return {
57
+ ok: true,
58
+ summary: "No active stage contract found for acceptance validation.",
59
+ failures: [],
60
+ };
61
+ }
62
+ const acceptance = resolvedContract.acceptance;
63
+ if (!hasAcceptanceRules(acceptance)) {
64
+ return {
65
+ ok: true,
66
+ summary: "No additional stage acceptance criteria were declared.",
67
+ failures: [],
68
+ };
69
+ }
70
+ const failures = [];
71
+ const state = readWorkspaceJsonFile(dirPath, ".interf/state.json");
72
+ for (const relativePath of acceptance?.artifacts_exist ?? []) {
73
+ if (!existsSync(join(dirPath, relativePath))) {
74
+ failures.push(`Missing required artifact: ${relativePath}.`);
75
+ }
76
+ }
77
+ for (const keyPath of acceptance?.state_truthy ?? []) {
78
+ if (!readPathValue(state, keyPath)) {
79
+ failures.push(`Expected truthy state value at "${keyPath}".`);
80
+ }
81
+ }
82
+ for (const [keyPath, countKey] of Object.entries(acceptance?.state_equals_counts ?? {})) {
83
+ const actual = readPathValue(state, keyPath);
84
+ const expected = resolvedContract.counts[countKey];
85
+ if (typeof expected !== "number") {
86
+ failures.push(`Acceptance references missing contract count "${countKey}" for "${keyPath}".`);
87
+ continue;
88
+ }
89
+ if (actual !== expected) {
90
+ failures.push(`Expected state "${keyPath}" to equal count "${countKey}" (${expected}), got ${JSON.stringify(actual)}.`);
91
+ }
92
+ }
93
+ for (const [keyPath, minimum] of Object.entries(acceptance?.state_at_least ?? {})) {
94
+ const actual = toFiniteNumber(readPathValue(state, keyPath));
95
+ if (actual === null || actual < minimum) {
96
+ failures.push(`Expected state "${keyPath}" to be at least ${minimum}, got ${actual === null ? "non-numeric" : actual}.`);
97
+ }
98
+ }
99
+ for (const [keyPath, countKey] of Object.entries(acceptance?.state_at_least_counts ?? {})) {
100
+ const actual = toFiniteNumber(readPathValue(state, keyPath));
101
+ const expected = resolvedContract.counts[countKey];
102
+ if (typeof expected !== "number") {
103
+ failures.push(`Acceptance references missing contract count "${countKey}" for "${keyPath}".`);
104
+ continue;
105
+ }
106
+ if (actual === null || actual < expected) {
107
+ failures.push(`Expected state "${keyPath}" to be at least count "${countKey}" (${expected}), got ${actual === null ? "non-numeric" : actual}.`);
108
+ }
109
+ }
110
+ if (failures.length === 0) {
111
+ return {
112
+ ok: true,
113
+ summary: `Stage acceptance satisfied for ${resolvedContract.stage}.`,
114
+ failures: [],
115
+ };
116
+ }
117
+ return {
118
+ ok: false,
119
+ summary: `Stage acceptance failed for ${resolvedContract.stage}: ${failures.join(" ")}`,
120
+ failures,
121
+ };
122
+ }
123
+ //# sourceMappingURL=runtime-acceptance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-acceptance.js","sourceRoot":"","sources":["../../src/lib/runtime-acceptance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAGL,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,SAAS,q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,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO;YACL,EAAE,EAAE,IAAI;YACR,OAAO,EAAE,kCAAkC,gBAAgB,CAAC,KAAK,GAAG;YACpE,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,+BAA+B,gBAAgB,CAAC,KAAK,KAAK,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACvF,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type RuntimeStageContractDraft } from "./runtime-types.js";
2
+ import { type KnowledgeBaseSummarizeContractOptions } from "./runtime-types.js";
3
+ export declare function buildKnowledgeBaseSummarizeContract(options: KnowledgeBaseSummarizeContractOptions): RuntimeStageContractDraft;
4
+ //# sourceMappingURL=runtime-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-contracts.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,KAAK,qCAAqC,EAAE,MAAM,oBAAoB,CAAC;AAEhF,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,qCAAqC,GAC7C,yBAAyB,CA6D3B"}
@@ -0,0 +1,63 @@
1
+ export function buildKnowledgeBaseSummarizeContract(options) {
2
+ const localSkillDocs = options.localSkillDocs ?? [];
3
+ const workflowNotes = options.workflowNotes ?? [];
4
+ return {
5
+ instructions: options.instructions,
6
+ counts: {
7
+ target_files: options.targetCount,
8
+ expected_summary_total: options.expectedSummaryTotal,
9
+ local_skill_docs: localSkillDocs.length,
10
+ },
11
+ ...(options.acceptance ? { acceptance: options.acceptance } : {}),
12
+ artifacts: {
13
+ reads: [
14
+ "interf.json",
15
+ options.planPath,
16
+ ".interf/source-access.json",
17
+ ...localSkillDocs,
18
+ ],
19
+ writes: [
20
+ "summaries/",
21
+ ".interf/inventory.json",
22
+ ],
23
+ verifies: [
24
+ "interf verify summarize --json",
25
+ ],
26
+ },
27
+ policies: {
28
+ execution_mode: "deterministic",
29
+ status_prefixes: ["STATUS:", "DONE:", "BLOCKED:", "ERROR:"],
30
+ notes: [
31
+ `Process only the files listed in ${options.planPath}.`,
32
+ `When ${options.planPath} includes \`targets[].output\`, write each summary to that exact relative path instead of inferring a filename.`,
33
+ `Source files live at ${options.sourcePath}.`,
34
+ "This is a knowledge-base file-evidence stage only. Do not do broad cross-file semantic weaving or ontology design here.",
35
+ "Write every summary as markdown under `summaries/` with a `.md` filename, even when the source file has another extension. If the source file already ends in `.md`, keep a single `.md` suffix instead of appending another one.",
36
+ "Use JSON frontmatter wrapped in `---` markers. Do not use YAML `key: value` frontmatter.",
37
+ "Use cautious, source-grounded titles. Summary filenames should describe what the file is or records without overstating uncertain conclusions.",
38
+ "If links are added, keep them minimal and source-grounded.",
39
+ "Do not precreate `.interf/inventory.json` with `touch` or placeholder writes. Write the final JSON document directly.",
40
+ "When updating `.interf/inventory.json`, rewrite the full JSON document in one whole-file write instead of appending or patching partial lines.",
41
+ "Do not use apply_patch or line-matched diffs on `.interf/inventory.json`. Replace the full document content in one write.",
42
+ "The CLI reconciles `.interf/state.json` and refreshes `.interf/health.json` after stage validation. Do not treat those files as stage-owned write targets for this stage.",
43
+ "Prefer the current inventory runtime shape: `.interf/inventory.json` should use `entries` plus `total`, with one object per source file containing at least `source`, `summary`, and a conservative status/state field. Do not invent new top-level inventory keys when the current shape already works.",
44
+ "Keep scratch extraction commands single-purpose and non-destructive. Do not use `rm`, wildcard cleanup, `;`, or `&&` chains during summarize.",
45
+ "If you need to verify raw access, inspect `.interf/source-access.json` and try one path from `suggested_checks` before assuming the source root is reachable. These checks are canonical absolute source-file paths.",
46
+ ...workflowNotes,
47
+ ...(localSkillDocs.length > 0
48
+ ? [
49
+ "Read any local instruction docs listed in the contract before processing source files.",
50
+ options.instructions.effective_mode === "override"
51
+ ? "Local docs replace the bundled file-evidence workflow for this run, but they still do not bypass per-file evidence capture, evidence weighting, required writes, or deterministic runtime reconciliation."
52
+ : "Local docs can refine summary structure and file-evidence heuristics, but they do not bypass per-file evidence capture, evidence weighting, required proof artifacts, or deterministic runtime reconciliation.",
53
+ ]
54
+ : []),
55
+ ],
56
+ evidence_weighting: {
57
+ required_fields: ["source_kind", "evidence_tier", "truth_mode", "state"],
58
+ preserve_tiers: true,
59
+ },
60
+ },
61
+ };
62
+ }
63
+ //# sourceMappingURL=runtime-contracts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-contracts.js","sourceRoot":"","sources":["../../src/lib/runtime-contracts.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,mCAAmC,CACjD,OAA8C;IAE9C,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;IAClD,OAAO;QACL,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,MAAM,EAAE;YACN,YAAY,EAAE,OAAO,CAAC,WAAW;YACjC,sBAAsB,EAAE,OAAO,CAAC,oBAAoB;YACpD,gBAAgB,EAAE,cAAc,CAAC,MAAM;SACxC;QACD,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,aAAa;gBACb,OAAO,CAAC,QAAQ;gBAChB,4BAA4B;gBAC5B,GAAG,cAAc;aAClB;YACD,MAAM,EAAE;gBACN,YAAY;gBACZ,wBAAwB;aACzB;YACD,QAAQ,EAAE;gBACR,gCAAgC;aACjC;SACF;QACD,QAAQ,EAAE;YACR,cAAc,EAAE,eAAe;YAC/B,eAAe,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC;YAC3D,KAAK,EAAE;gBACL,oCAAoC,OAAO,CAAC,QAAQ,GAAG;gBACvD,QAAQ,OAAO,CAAC,QAAQ,iHAAiH;gBACzI,wBAAwB,OAAO,CAAC,UAAU,GAAG;gBAC7C,yHAAyH;gBACzH,mOAAmO;gBACnO,0FAA0F;gBAC1F,gJAAgJ;gBAChJ,4DAA4D;gBAC5D,uHAAuH;gBACvH,gJAAgJ;gBAChJ,2HAA2H;gBAC3H,2KAA2K;gBAC3K,0SAA0S;gBAC1S,+IAA+I;gBAC/I,sNAAsN;gBACtN,GAAG,aAAa;gBAChB,GAAG,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;oBAC3B,CAAC,CAAC;wBACE,wFAAwF;wBACxF,OAAO,CAAC,YAAY,CAAC,cAAc,KAAK,UAAU;4BAChD,CAAC,CAAC,2MAA2M;4BAC7M,CAAC,CAAC,gNAAgN;qBACrN;oBACH,CAAC,CAAC,EAAE,CAAC;aACR;YACD,kBAAkB,EAAE;gBAClB,eAAe,EAAE,CAAC,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,CAAC;gBACxE,cAAc,EAAE,IAAI;aACrB;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function runPath(dirPath: string): string;
2
+ export declare function runHistoryPath(dirPath: string): string;
3
+ export declare function stageContractPath(dirPath: string): string;
4
+ export declare function logsDirPath(dirPath: string): string;
5
+ export declare function promptLogPath(dirPath: string, runId: string): string;
6
+ export declare function eventLogPath(dirPath: string, runId: string): string;
7
+ export declare function statusLogPath(dirPath: string, runId: string): string;
8
+ //# sourceMappingURL=runtime-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-paths.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-paths.ts"],"names":[],"mappings":"AAQA,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpE"}
@@ -0,0 +1,28 @@
1
+ import { join } from "node:path";
2
+ import { STATE_DIR } from "./util.js";
3
+ const RUN_FILE = "run.json";
4
+ const RUN_HISTORY_FILE = "run-history.jsonl";
5
+ const STAGE_CONTRACT_FILE = "stage-contract.json";
6
+ const LOGS_DIR = "logs";
7
+ export function runPath(dirPath) {
8
+ return join(dirPath, STATE_DIR, RUN_FILE);
9
+ }
10
+ export function runHistoryPath(dirPath) {
11
+ return join(dirPath, STATE_DIR, RUN_HISTORY_FILE);
12
+ }
13
+ export function stageContractPath(dirPath) {
14
+ return join(dirPath, STATE_DIR, STAGE_CONTRACT_FILE);
15
+ }
16
+ export function logsDirPath(dirPath) {
17
+ return join(dirPath, STATE_DIR, LOGS_DIR);
18
+ }
19
+ export function promptLogPath(dirPath, runId) {
20
+ return join(logsDirPath(dirPath), `${runId}.prompt.txt`);
21
+ }
22
+ export function eventLogPath(dirPath, runId) {
23
+ return join(logsDirPath(dirPath), `${runId}.events.ndjson`);
24
+ }
25
+ export function statusLogPath(dirPath, runId) {
26
+ return join(logsDirPath(dirPath), `${runId}.status.log`);
27
+ }
28
+ //# sourceMappingURL=runtime-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-paths.js","sourceRoot":"","sources":["../../src/lib/runtime-paths.ts"],"names":[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declare function buildStagePrompt(instructions: RuntimeStageInstructions, contractPath: string, statusLines: string[]): string;
3
+ //# sourceMappingURL=runtime-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-prompt.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-prompt.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,wBAAwB,EACtC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EAAE,GACpB,MAAM,CAwDR"}
@@ -0,0 +1,59 @@
1
+ import { existsSync, readFileSync, } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { SKILLS_DIR } from "./config.js";
4
+ export function buildStagePrompt(instructions, contractPath, statusLines) {
5
+ const bundledSkillPath = join(SKILLS_DIR, ...instructions.bundled_skill.split("/"), "SKILL.md");
6
+ const bundledSkillDoc = existsSync(bundledSkillPath)
7
+ ? readFileSync(bundledSkillPath, "utf8").trim()
8
+ : null;
9
+ const modeNotes = instructions.effective_mode === "override"
10
+ ? [
11
+ "Local stage instruction docs are authoritative for this run.",
12
+ "Do not fall back to bundled workflow heuristics unless the stage contract explicitly leaves room for them.",
13
+ "Interf still enforces the same required reads, writes, verifier outputs, and runtime reconciliation at stage close.",
14
+ ]
15
+ : instructions.effective_mode === "extend"
16
+ ? [
17
+ "Use the bundled stage instructions as the default workflow for this run.",
18
+ "Then apply any local stage instruction docs referenced by the contract as stage-specific extensions.",
19
+ ]
20
+ : [
21
+ "Use the bundled stage instructions as the default workflow for this run.",
22
+ ];
23
+ return [
24
+ `Interf built-in stage: ${instructions.bundled_skill}`,
25
+ "",
26
+ "This is an automated Interf stage run, not an open-ended chat session.",
27
+ "The user has already invoked this stage through the Interf CLI. Execute it now.",
28
+ "Do not ask what the user wants, offer help, list tools, or wait for another instruction.",
29
+ `Read \`${contractPath}\` first. It is the authoritative contract for this stage.`,
30
+ "Honor the contract's counts, artifact paths, and policies instead of inventing another workflow.",
31
+ "Read only the files named by the contract's `artifacts.reads` list plus any paths they explicitly direct you to open.",
32
+ "If the contract lists `instructions.local_docs`, open every one of those files before you write artifacts or declare the stage complete.",
33
+ "If `AGENTS.md` is listed in the contract, use it only for workspace routing that is directly relevant to this stage.",
34
+ "`.interf/run.json`, `.interf/state.json`, `.interf/health.json`, and `.interf/view-spec.json` are CLI-owned runtime artifacts. You may read them, but do not create, edit, or replace them unless the contract explicitly marks a different proof artifact as stage-owned.",
35
+ "If a contract-listed output file does not exist yet, create it in one whole-file write. Do not attempt patch-style edits against a missing runtime path.",
36
+ "Stay inside the current workspace. Do not try to open SDK repo docs, SDK source files, or other paths outside the workspace unless the stage contract explicitly requires them.",
37
+ instructions.effective_mode === "override"
38
+ ? "Do not depend on globally installed slash-command skills for this run. Local stage instruction docs are the primary workflow layer for this run."
39
+ : "Do not depend on globally installed slash-command skills for this run. Use the bundled stage instructions below as the default behavior.",
40
+ ...modeNotes,
41
+ "Do not narrate intentions, plans, or reasoning to the user.",
42
+ "Only emit user-visible updates that begin with STATUS:, DONE:, BLOCKED:, or ERROR:.",
43
+ "Those status lines are progress hints for the operator. The CLI decides stage completion from artifacts, validation, and reconcile checks rather than trusting status text alone.",
44
+ "Before any long-running raw inspection or shell-based helper step, emit a STATUS: line that names the current subtask.",
45
+ "If work stays in progress, do not remain silent for more than about one minute. Emit another STATUS: line when you switch files, page groups, targets, or extraction methods.",
46
+ "If you respond conversationally instead of executing the stage, the run will be treated as failed.",
47
+ "As soon as the required proof artifacts are complete, stop. Do not keep browsing or auditing after the contract is satisfied.",
48
+ ...statusLines,
49
+ ...(bundledSkillDoc && instructions.effective_mode !== "override"
50
+ ? [
51
+ "",
52
+ "Bundled Stage Instructions",
53
+ "==========================",
54
+ bundledSkillDoc,
55
+ ]
56
+ : []),
57
+ ].join("\n");
58
+ }
59
+ //# sourceMappingURL=runtime-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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mL;QACnL,wHAAwH;QACxH,+KAA+K;QAC/K,oGAAoG;QACpG,+HAA+H;QAC/H,GAAG,WAAW;QACd,GAAG,CAAC,eAAe,IAAI,YAAY,CAAC,cAAc,KAAK,UAAU;YAC/D,CAAC,CAAC;gBACE,EAAE;gBACF,4BAA4B;gBAC5B,4BAA4B;gBAC5B,eAAe;aAChB;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function reconcileKnowledgeBaseSummarizeRun(dirPath: string, expectedSummaryTotal: number): boolean;
2
+ export declare function reconcileKnowledgeBaseCompileRun(dirPath: string): boolean;
3
+ export declare function reconcileInterfaceRetrieveRun(dirPath: string): boolean;
4
+ export declare function reconcileInterfaceAnalyzeRun(dirPath: string): boolean;
5
+ export declare function reconcileInterfaceCompileRun(dirPath: string): boolean;
6
+ //# sourceMappingURL=runtime-reconcile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-reconcile.d.ts","sourceRoot":"","sources":["../../src/lib/runtime-reconcile.ts"],"names":[],"mappings":"AAiMA,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,EACf,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CA6CT;AAED,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAqDzE;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA6DtE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CA8BrE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAuDrE"}