semantic-atlas 0.4.0 → 2.0.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 (346) hide show
  1. package/.agents/skills/semantic-atlas/SKILL.md +134 -166
  2. package/.agents/skills/semantic-atlas/agents/openai.yaml +4 -0
  3. package/.agents/skills/semantic-atlas/references/observations.md +130 -0
  4. package/.agents/skills/semantic-atlas/scripts/query-context.mjs +110 -0
  5. package/.agents/skills/semantic-atlas-maintenance/SKILL.md +93 -0
  6. package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +4 -0
  7. package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +56 -0
  8. package/README.md +133 -265
  9. package/dist/application/map-application.d.ts +24 -0
  10. package/dist/application/map-application.d.ts.map +1 -0
  11. package/dist/application/map-application.js +134 -0
  12. package/dist/application/map-application.js.map +1 -0
  13. package/dist/cli/bin.js +6 -42
  14. package/dist/cli/bin.js.map +1 -0
  15. package/dist/cli/observation-commands.d.ts +16 -0
  16. package/dist/cli/observation-commands.d.ts.map +1 -0
  17. package/dist/cli/observation-commands.js +118 -0
  18. package/dist/cli/observation-commands.js.map +1 -0
  19. package/dist/cli/projection-writer.d.ts +2 -0
  20. package/dist/cli/projection-writer.d.ts.map +1 -0
  21. package/dist/cli/projection-writer.js +9 -0
  22. package/dist/cli/projection-writer.js.map +1 -0
  23. package/dist/cli/reconciliation-command.d.ts +7 -0
  24. package/dist/cli/reconciliation-command.d.ts.map +1 -0
  25. package/dist/cli/reconciliation-command.js +33 -0
  26. package/dist/cli/reconciliation-command.js.map +1 -0
  27. package/dist/cli/run-cli.d.ts +21 -0
  28. package/dist/cli/run-cli.d.ts.map +1 -0
  29. package/dist/cli/run-cli.js +299 -0
  30. package/dist/cli/run-cli.js.map +1 -0
  31. package/dist/contracts/cli.d.ts +166 -1211
  32. package/dist/contracts/cli.d.ts.map +1 -1
  33. package/dist/contracts/cli.js +2 -232
  34. package/dist/contracts/cli.js.map +1 -0
  35. package/dist/contracts/insights.d.ts +39 -1
  36. package/dist/contracts/insights.d.ts.map +1 -1
  37. package/dist/contracts/insights.js +2 -1
  38. package/dist/contracts/insights.js.map +1 -0
  39. package/dist/contracts/map.d.ts +154 -0
  40. package/dist/contracts/map.d.ts.map +1 -0
  41. package/dist/contracts/map.js +60 -0
  42. package/dist/contracts/map.js.map +1 -0
  43. package/dist/contracts/observation.d.ts +414 -0
  44. package/dist/contracts/observation.d.ts.map +1 -0
  45. package/dist/contracts/observation.js +125 -0
  46. package/dist/contracts/observation.js.map +1 -0
  47. package/dist/contracts/projection.d.ts +7 -0
  48. package/dist/contracts/projection.d.ts.map +1 -0
  49. package/dist/contracts/projection.js +2 -0
  50. package/dist/contracts/projection.js.map +1 -0
  51. package/dist/contracts/reconciliation.d.ts +40 -0
  52. package/dist/contracts/reconciliation.d.ts.map +1 -0
  53. package/dist/contracts/reconciliation.js +2 -0
  54. package/dist/contracts/reconciliation.js.map +1 -0
  55. package/dist/index.d.ts +7 -17
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +3 -9
  58. package/dist/index.js.map +1 -0
  59. package/dist/insights/insight-service.d.ts +14 -0
  60. package/dist/insights/insight-service.d.ts.map +1 -0
  61. package/dist/insights/insight-service.js +129 -0
  62. package/dist/insights/insight-service.js.map +1 -0
  63. package/dist/map/business-graph.d.ts +32 -0
  64. package/dist/map/business-graph.d.ts.map +1 -0
  65. package/dist/map/business-graph.js +122 -0
  66. package/dist/map/business-graph.js.map +1 -0
  67. package/dist/map/map-document-loader.d.ts +13 -0
  68. package/dist/map/map-document-loader.d.ts.map +1 -0
  69. package/dist/map/map-document-loader.js +86 -0
  70. package/dist/map/map-document-loader.js.map +1 -0
  71. package/dist/map/map-validator.d.ts +12 -0
  72. package/dist/map/map-validator.d.ts.map +1 -0
  73. package/dist/map/map-validator.js +322 -0
  74. package/dist/map/map-validator.js.map +1 -0
  75. package/dist/observations/observation-application.d.ts +23 -0
  76. package/dist/observations/observation-application.d.ts.map +1 -0
  77. package/dist/observations/observation-application.js +62 -0
  78. package/dist/observations/observation-application.js.map +1 -0
  79. package/dist/observations/observation-claim-manager.d.ts +17 -0
  80. package/dist/observations/observation-claim-manager.d.ts.map +1 -0
  81. package/dist/observations/observation-claim-manager.js +198 -0
  82. package/dist/observations/observation-claim-manager.js.map +1 -0
  83. package/dist/observations/observation-store.d.ts +43 -0
  84. package/dist/observations/observation-store.d.ts.map +1 -0
  85. package/dist/observations/observation-store.js +213 -0
  86. package/dist/observations/observation-store.js.map +1 -0
  87. package/dist/observations/repository-identity.d.ts +12 -0
  88. package/dist/observations/repository-identity.d.ts.map +1 -0
  89. package/dist/observations/repository-identity.js +108 -0
  90. package/dist/observations/repository-identity.js.map +1 -0
  91. package/dist/query/context-query-service.d.ts +15 -0
  92. package/dist/query/context-query-service.d.ts.map +1 -0
  93. package/dist/query/context-query-service.js +36 -0
  94. package/dist/query/context-query-service.js.map +1 -0
  95. package/dist/reconciliation/reconciliation-service.d.ts +10 -0
  96. package/dist/reconciliation/reconciliation-service.d.ts.map +1 -0
  97. package/dist/reconciliation/reconciliation-service.js +114 -0
  98. package/dist/reconciliation/reconciliation-service.js.map +1 -0
  99. package/dist/rendering/map-projector.d.ts +8 -0
  100. package/dist/rendering/map-projector.d.ts.map +1 -0
  101. package/dist/rendering/map-projector.js +386 -0
  102. package/dist/rendering/map-projector.js.map +1 -0
  103. package/dist/setup/managed-skill-installer.d.ts +60 -0
  104. package/dist/setup/managed-skill-installer.d.ts.map +1 -0
  105. package/dist/setup/managed-skill-installer.js +293 -0
  106. package/dist/setup/managed-skill-installer.js.map +1 -0
  107. package/dist/setup/package-identity.d.ts +6 -0
  108. package/dist/setup/package-identity.d.ts.map +1 -0
  109. package/dist/setup/package-identity.js +16 -0
  110. package/dist/setup/package-identity.js.map +1 -0
  111. package/dist/setup/package-upgrader.d.ts +10 -22
  112. package/dist/setup/package-upgrader.d.ts.map +1 -1
  113. package/dist/setup/package-upgrader.js +60 -76
  114. package/dist/setup/package-upgrader.js.map +1 -0
  115. package/docs/architecture.md +426 -0
  116. package/docs/evaluation.md +220 -174
  117. package/docs/index.md +27 -45
  118. package/docs/map-format.md +225 -0
  119. package/docs/observations.md +167 -0
  120. package/docs/product-contract.md +282 -165
  121. package/examples/commerce.yaml +204 -0
  122. package/package.json +31 -32
  123. package/.agents/skills/semantic-atlas/references/graph-patch.md +0 -190
  124. package/.agents/skills/semantic-atlas/references/product-feedback.md +0 -34
  125. package/.agents/skills/semantic-atlas/references/result-routing.md +0 -104
  126. package/.agents/skills/semantic-atlas/references/snapshot-bootstrap.md +0 -42
  127. package/.agents/skills/semantic-atlas-insights/SKILL.md +0 -55
  128. package/README.zh-CN.md +0 -296
  129. package/dist/business-flow/business-flow-derivation-service.d.ts +0 -11
  130. package/dist/business-flow/business-flow-derivation-service.d.ts.map +0 -1
  131. package/dist/business-flow/business-flow-derivation-service.js +0 -151
  132. package/dist/business-flow/business-flow-draft.d.ts +0 -16
  133. package/dist/business-flow/business-flow-draft.d.ts.map +0 -1
  134. package/dist/business-flow/business-flow-draft.js +0 -150
  135. package/dist/business-flow/framework-business-strategy.d.ts +0 -7
  136. package/dist/business-flow/framework-business-strategy.d.ts.map +0 -1
  137. package/dist/business-flow/framework-business-strategy.js +0 -1
  138. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts +0 -10
  139. package/dist/business-flow/strategies/bullmq-business-strategy.d.ts.map +0 -1
  140. package/dist/business-flow/strategies/bullmq-business-strategy.js +0 -79
  141. package/dist/business-flow/strategies/called-operation-derivation.d.ts +0 -13
  142. package/dist/business-flow/strategies/called-operation-derivation.d.ts.map +0 -1
  143. package/dist/business-flow/strategies/called-operation-derivation.js +0 -32
  144. package/dist/business-flow/strategies/graphql-business-strategy.d.ts +0 -8
  145. package/dist/business-flow/strategies/graphql-business-strategy.d.ts.map +0 -1
  146. package/dist/business-flow/strategies/graphql-business-strategy.js +0 -65
  147. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts +0 -8
  148. package/dist/business-flow/strategies/nestjs-business-strategy.d.ts.map +0 -1
  149. package/dist/business-flow/strategies/nestjs-business-strategy.js +0 -72
  150. package/dist/business-flow/strategies/strategy-helpers.d.ts +0 -32
  151. package/dist/business-flow/strategies/strategy-helpers.d.ts.map +0 -1
  152. package/dist/business-flow/strategies/strategy-helpers.js +0 -49
  153. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts +0 -10
  154. package/dist/business-flow/strategies/typeorm-business-strategy.d.ts.map +0 -1
  155. package/dist/business-flow/strategies/typeorm-business-strategy.js +0 -136
  156. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts +0 -5
  157. package/dist/business-flow/strategies/verified-invariant-strategy.d.ts.map +0 -1
  158. package/dist/business-flow/strategies/verified-invariant-strategy.js +0 -38
  159. package/dist/business-flow/strategies/verified-test-strategy.d.ts +0 -5
  160. package/dist/business-flow/strategies/verified-test-strategy.d.ts.map +0 -1
  161. package/dist/business-flow/strategies/verified-test-strategy.js +0 -26
  162. package/dist/business-flow/structural-flow-catalog.d.ts +0 -21
  163. package/dist/business-flow/structural-flow-catalog.d.ts.map +0 -1
  164. package/dist/business-flow/structural-flow-catalog.js +0 -125
  165. package/dist/business-flow/types.d.ts +0 -51
  166. package/dist/business-flow/types.d.ts.map +0 -1
  167. package/dist/business-flow/types.js +0 -1
  168. package/dist/cli/argument-parser.d.ts +0 -3
  169. package/dist/cli/argument-parser.d.ts.map +0 -1
  170. package/dist/cli/argument-parser.js +0 -200
  171. package/dist/cli/cli-application.d.ts +0 -39
  172. package/dist/cli/cli-application.d.ts.map +0 -1
  173. package/dist/cli/cli-application.js +0 -571
  174. package/dist/cli/cli-error.d.ts +0 -12
  175. package/dist/cli/cli-error.d.ts.map +0 -1
  176. package/dist/cli/cli-error.js +0 -44
  177. package/dist/cli/cli-presenter.d.ts +0 -14
  178. package/dist/cli/cli-presenter.d.ts.map +0 -1
  179. package/dist/cli/cli-presenter.js +0 -36
  180. package/dist/cli/insights-cli.d.ts +0 -6
  181. package/dist/cli/insights-cli.d.ts.map +0 -1
  182. package/dist/cli/insights-cli.js +0 -236
  183. package/dist/cli/main.d.ts +0 -3
  184. package/dist/cli/main.d.ts.map +0 -1
  185. package/dist/cli/main.js +0 -137
  186. package/dist/cli/standalone-cli.d.ts +0 -3
  187. package/dist/cli/standalone-cli.d.ts.map +0 -1
  188. package/dist/cli/standalone-cli.js +0 -104
  189. package/dist/cli/types.d.ts +0 -49
  190. package/dist/cli/types.d.ts.map +0 -1
  191. package/dist/cli/types.js +0 -1
  192. package/dist/cli/web-cli.d.ts +0 -9
  193. package/dist/cli/web-cli.d.ts.map +0 -1
  194. package/dist/cli/web-cli.js +0 -134
  195. package/dist/contracts/graph.d.ts +0 -266
  196. package/dist/contracts/graph.d.ts.map +0 -1
  197. package/dist/contracts/graph.js +0 -182
  198. package/dist/contracts/identifiers.d.ts +0 -4
  199. package/dist/contracts/identifiers.d.ts.map +0 -1
  200. package/dist/contracts/identifiers.js +0 -7
  201. package/dist/contracts/public-contracts.d.ts +0 -5
  202. package/dist/contracts/public-contracts.d.ts.map +0 -1
  203. package/dist/contracts/public-contracts.js +0 -4
  204. package/dist/evaluation/comparison.d.ts +0 -30
  205. package/dist/evaluation/comparison.d.ts.map +0 -1
  206. package/dist/evaluation/comparison.js +0 -108
  207. package/dist/evaluation/contracts.d.ts +0 -301
  208. package/dist/evaluation/contracts.d.ts.map +0 -1
  209. package/dist/evaluation/contracts.js +0 -413
  210. package/dist/graph/graph-store.d.ts +0 -55
  211. package/dist/graph/graph-store.d.ts.map +0 -1
  212. package/dist/graph/graph-store.js +0 -912
  213. package/dist/graph/types.d.ts +0 -189
  214. package/dist/graph/types.d.ts.map +0 -1
  215. package/dist/graph/types.js +0 -1
  216. package/dist/insights/contracts.d.ts +0 -266
  217. package/dist/insights/contracts.d.ts.map +0 -1
  218. package/dist/insights/contracts.js +0 -124
  219. package/dist/insights/insights-store.d.ts +0 -73
  220. package/dist/insights/insights-store.d.ts.map +0 -1
  221. package/dist/insights/insights-store.js +0 -246
  222. package/dist/knowledge/business-knowledge-service.d.ts +0 -24
  223. package/dist/knowledge/business-knowledge-service.d.ts.map +0 -1
  224. package/dist/knowledge/business-knowledge-service.js +0 -200
  225. package/dist/knowledge/graph-patch-conflict-error.d.ts +0 -8
  226. package/dist/knowledge/graph-patch-conflict-error.d.ts.map +0 -1
  227. package/dist/knowledge/graph-patch-conflict-error.js +0 -12
  228. package/dist/knowledge/structural-target-binding.d.ts +0 -14
  229. package/dist/knowledge/structural-target-binding.d.ts.map +0 -1
  230. package/dist/knowledge/structural-target-binding.js +0 -11
  231. package/dist/package-metadata.d.ts +0 -2
  232. package/dist/package-metadata.d.ts.map +0 -1
  233. package/dist/package-metadata.js +0 -9
  234. package/dist/repository/git-command.d.ts +0 -3
  235. package/dist/repository/git-command.d.ts.map +0 -1
  236. package/dist/repository/git-command.js +0 -25
  237. package/dist/repository/repository-inspector.d.ts +0 -8
  238. package/dist/repository/repository-inspector.d.ts.map +0 -1
  239. package/dist/repository/repository-inspector.js +0 -97
  240. package/dist/repository/repository-language-support.d.ts +0 -14
  241. package/dist/repository/repository-language-support.d.ts.map +0 -1
  242. package/dist/repository/repository-language-support.js +0 -64
  243. package/dist/repository/types.d.ts +0 -9
  244. package/dist/repository/types.d.ts.map +0 -1
  245. package/dist/repository/types.js +0 -1
  246. package/dist/runtime/sqlite-compatibility-process.d.ts +0 -8
  247. package/dist/runtime/sqlite-compatibility-process.d.ts.map +0 -1
  248. package/dist/runtime/sqlite-compatibility-process.js +0 -20
  249. package/dist/setup/skill-installer.d.ts +0 -20
  250. package/dist/setup/skill-installer.d.ts.map +0 -1
  251. package/dist/setup/skill-installer.js +0 -187
  252. package/dist/snapshots/repository-snapshot.d.ts +0 -4
  253. package/dist/snapshots/repository-snapshot.d.ts.map +0 -1
  254. package/dist/snapshots/repository-snapshot.js +0 -119
  255. package/dist/snapshots/types.d.ts +0 -30
  256. package/dist/snapshots/types.d.ts.map +0 -1
  257. package/dist/snapshots/types.js +0 -1
  258. package/dist/storage/atlas-database.d.ts +0 -25
  259. package/dist/storage/atlas-database.d.ts.map +0 -1
  260. package/dist/storage/atlas-database.js +0 -483
  261. package/dist/storage/snapshot-store.d.ts +0 -19
  262. package/dist/storage/snapshot-store.d.ts.map +0 -1
  263. package/dist/storage/snapshot-store.js +0 -74
  264. package/dist/structural-backend/codegraph-backend.d.ts +0 -57
  265. package/dist/structural-backend/codegraph-backend.d.ts.map +0 -1
  266. package/dist/structural-backend/codegraph-backend.js +0 -1230
  267. package/dist/structural-backend/codegraph-worker-client.d.ts +0 -5
  268. package/dist/structural-backend/codegraph-worker-client.d.ts.map +0 -1
  269. package/dist/structural-backend/codegraph-worker-client.js +0 -118
  270. package/dist/structural-backend/codegraph-worker-protocol.d.ts +0 -35
  271. package/dist/structural-backend/codegraph-worker-protocol.d.ts.map +0 -1
  272. package/dist/structural-backend/codegraph-worker-protocol.js +0 -1
  273. package/dist/structural-backend/codegraph-worker.d.ts +0 -2
  274. package/dist/structural-backend/codegraph-worker.d.ts.map +0 -1
  275. package/dist/structural-backend/codegraph-worker.js +0 -131
  276. package/dist/structural-backend/process-instance.d.ts +0 -18
  277. package/dist/structural-backend/process-instance.d.ts.map +0 -1
  278. package/dist/structural-backend/process-instance.js +0 -207
  279. package/dist/structural-backend/structural-fact-changes.d.ts +0 -7
  280. package/dist/structural-backend/structural-fact-changes.d.ts.map +0 -1
  281. package/dist/structural-backend/structural-fact-changes.js +0 -78
  282. package/dist/structural-backend/structural-projection-bootstrapper.d.ts +0 -10
  283. package/dist/structural-backend/structural-projection-bootstrapper.d.ts.map +0 -1
  284. package/dist/structural-backend/structural-projection-bootstrapper.js +0 -295
  285. package/dist/structural-backend/structural-publication.d.ts +0 -13
  286. package/dist/structural-backend/structural-publication.d.ts.map +0 -1
  287. package/dist/structural-backend/structural-publication.js +0 -255
  288. package/dist/structural-backend/structural-write-lock.d.ts +0 -8
  289. package/dist/structural-backend/structural-write-lock.d.ts.map +0 -1
  290. package/dist/structural-backend/structural-write-lock.js +0 -415
  291. package/dist/structural-backend/types.d.ts +0 -144
  292. package/dist/structural-backend/types.d.ts.map +0 -1
  293. package/dist/structural-backend/types.js +0 -11
  294. package/dist/web/application/atlas-read-service.d.ts +0 -27
  295. package/dist/web/application/atlas-read-service.d.ts.map +0 -1
  296. package/dist/web/application/atlas-read-service.js +0 -216
  297. package/dist/web/application/primary-repository-catalog.d.ts +0 -15
  298. package/dist/web/application/primary-repository-catalog.d.ts.map +0 -1
  299. package/dist/web/application/primary-repository-catalog.js +0 -202
  300. package/dist/web/application/types.d.ts +0 -41
  301. package/dist/web/application/types.d.ts.map +0 -1
  302. package/dist/web/application/types.js +0 -1
  303. package/dist/web/server/api-router.d.ts +0 -4
  304. package/dist/web/server/api-router.d.ts.map +0 -1
  305. package/dist/web/server/api-router.js +0 -151
  306. package/dist/web/server/local-web-server.d.ts +0 -12
  307. package/dist/web/server/local-web-server.d.ts.map +0 -1
  308. package/dist/web/server/local-web-server.js +0 -100
  309. package/dist/web-client/assets/index-DneaErDj.css +0 -1
  310. package/dist/web-client/assets/index-cze_4vtt.js +0 -2
  311. package/dist/web-client/assets/index-cze_4vtt.js.map +0 -1
  312. package/dist/web-client/index.html +0 -61
  313. package/dist/world/business-map-projector.d.ts +0 -14
  314. package/dist/world/business-map-projector.d.ts.map +0 -1
  315. package/dist/world/business-map-projector.js +0 -178
  316. package/dist/world/types.d.ts +0 -77
  317. package/dist/world/types.d.ts.map +0 -1
  318. package/dist/world/types.js +0 -1
  319. package/dist/world/world-graph-query.d.ts +0 -30
  320. package/dist/world/world-graph-query.d.ts.map +0 -1
  321. package/dist/world/world-graph-query.js +0 -252
  322. package/dist/world/world-model-service.d.ts +0 -21
  323. package/dist/world/world-model-service.d.ts.map +0 -1
  324. package/dist/world/world-model-service.js +0 -219
  325. package/dist/world/world-snapshot-store.d.ts +0 -41
  326. package/dist/world/world-snapshot-store.d.ts.map +0 -1
  327. package/dist/world/world-snapshot-store.js +0 -581
  328. package/docs/README.md +0 -30
  329. package/docs/architecture/codegraph-backend.md +0 -190
  330. package/docs/architecture/continuous-business-learning.md +0 -240
  331. package/docs/architecture/web-viewer.md +0 -225
  332. package/docs/contracts/cli-v1.md +0 -179
  333. package/docs/contracts/graph-model.md +0 -106
  334. package/docs/contracts/graph-patch-v1.md +0 -105
  335. package/docs/contracts/http-api-v1.md +0 -155
  336. package/docs/contracts/insights-v1.md +0 -84
  337. package/docs/log.md +0 -159
  338. package/docs/mindmaps/semantic-atlas-overview.drawio +0 -255
  339. package/docs/mindmaps/semantic-atlas-overview.png +0 -0
  340. package/docs/mindmaps/semantic-atlas-overview.zh-CN.drawio +0 -255
  341. package/docs/mindmaps/semantic-atlas-overview.zh-CN.png +0 -0
  342. package/schemas/cli-envelope-v1.schema.json +0 -1244
  343. package/schemas/evaluation-plan-v1.schema.json +0 -211
  344. package/schemas/evaluation-run-v1.schema.json +0 -659
  345. package/schemas/graph-patch-v1.schema.json +0 -392
  346. package/schemas/insights-envelope-v1.schema.json +0 -428
@@ -1,108 +0,0 @@
1
- import { evaluationPlanSchema, evaluationRunSchema, summarizeEvaluationRun, } from "./contracts.js";
2
- const REDUCTION_GATE_PERCENT = 30;
3
- const UNCERTAINTY_FAILURES = new Set([
4
- "stale-knowledge",
5
- "hypothesis-mishandled",
6
- "unknown-boundary-mishandled",
7
- "unsupported-source",
8
- ]);
9
- export function summarizeEvaluationComparison(rawPlan, rawRuns) {
10
- const plan = evaluationPlanSchema.parse(rawPlan);
11
- const runs = rawRuns.map((run) => evaluationRunSchema.parse(run));
12
- requireUniqueRunIds(runs);
13
- const pairs = plan.cases.map((evaluationCase) => {
14
- const caseRuns = runs.filter((run) => run.caseId === evaluationCase.id);
15
- const noAtlas = requireModeRun(evaluationCase.id, caseRuns, "no-atlas");
16
- const atlas = requireModeRun(evaluationCase.id, caseRuns, "atlas");
17
- requireProtocolParity(noAtlas, atlas);
18
- const noAtlasSummary = summarizeEvaluationRun(evaluationCase, noAtlas);
19
- const atlasSummary = summarizeEvaluationRun(evaluationCase, atlas);
20
- return {
21
- caseId: evaluationCase.id,
22
- noAtlas: noAtlasSummary,
23
- atlas: atlasSummary,
24
- noRegression: preservesOutcome(noAtlasSummary, atlasSummary),
25
- };
26
- });
27
- const plannedCases = new Set(plan.cases.map((evaluationCase) => evaluationCase.id));
28
- const unexpectedRun = runs.find((run) => !plannedCases.has(run.caseId));
29
- if (unexpectedRun !== undefined) {
30
- throw new Error(`Run ${unexpectedRun.runId} references unknown case ${unexpectedRun.caseId}`);
31
- }
32
- const medians = {
33
- noAtlas: usageMedian(pairs.map((pair) => pair.noAtlas)),
34
- atlas: usageMedian(pairs.map((pair) => pair.atlas)),
35
- };
36
- const reductions = {
37
- openedFilePercent: reductionPercent(medians.noAtlas.openedFileCount, medians.atlas.openedFileCount),
38
- sourceTokenPercent: reductionPercent(medians.noAtlas.sourceTokens, medians.atlas.sourceTokens),
39
- };
40
- const noRegression = pairs.every((pair) => pair.noRegression);
41
- const uncertaintyHandled = pairs.every((pair) => (pair.atlas.failureClassifications.every((failure) => !UNCERTAINTY_FAILURES.has(failure))));
42
- const reductionThresholdMet = reductions.openedFilePercent >= REDUCTION_GATE_PERCENT
43
- || reductions.sourceTokenPercent >= REDUCTION_GATE_PERCENT;
44
- return {
45
- pairs,
46
- medians,
47
- reductions,
48
- gate: {
49
- noRegression,
50
- uncertaintyHandled,
51
- reductionThresholdMet,
52
- passed: noRegression && uncertaintyHandled && reductionThresholdMet,
53
- },
54
- };
55
- }
56
- function requireUniqueRunIds(runs) {
57
- const runIds = new Set();
58
- for (const run of runs) {
59
- if (runIds.has(run.runId)) {
60
- throw new Error(`Evaluation run ID ${run.runId} is duplicated`);
61
- }
62
- runIds.add(run.runId);
63
- }
64
- }
65
- function requireModeRun(caseId, runs, mode) {
66
- const matches = runs.filter((run) => run.mode === mode);
67
- if (matches.length !== 1 || runs.length !== 2) {
68
- throw new Error(`Evaluation case ${caseId} requires exactly one no-atlas and one atlas run`);
69
- }
70
- return matches[0];
71
- }
72
- function requireProtocolParity(noAtlas, atlas) {
73
- const comparable = [
74
- noAtlas.agent.product === atlas.agent.product,
75
- noAtlas.agent.model === atlas.agent.model,
76
- noAtlas.protocol.fixtureCommit === atlas.protocol.fixtureCommit,
77
- noAtlas.protocol.instructionsHash === atlas.protocol.instructionsHash,
78
- noAtlas.protocol.toolPolicyHash === atlas.protocol.toolPolicyHash,
79
- noAtlas.observations.sourceTokenMethod === atlas.observations.sourceTokenMethod,
80
- ];
81
- if (comparable.some((matches) => !matches)) {
82
- throw new Error("Paired runs require the same agent product, model, fixture commit, instructions, "
83
- + "tool policy, and source-token method");
84
- }
85
- }
86
- function preservesOutcome(noAtlas, atlas) {
87
- return Number(atlas.correct) >= Number(noAtlas.correct)
88
- && atlas.requiredFileRecall >= noAtlas.requiredFileRecall
89
- && atlas.requiredSymbolRecall >= noAtlas.requiredSymbolRecall;
90
- }
91
- function usageMedian(runs) {
92
- return {
93
- openedFileCount: median(runs.map((run) => run.openedFileCount)),
94
- sourceTokens: median(runs.map((run) => run.sourceTokens)),
95
- };
96
- }
97
- function median(values) {
98
- const sorted = [...values].sort((left, right) => left - right);
99
- const middle = Math.floor(sorted.length / 2);
100
- return sorted.length % 2 === 0
101
- ? (sorted[middle - 1] + sorted[middle]) / 2
102
- : sorted[middle];
103
- }
104
- function reductionPercent(baseline, candidate) {
105
- if (baseline === 0)
106
- return candidate === 0 ? 0 : -100;
107
- return Math.round(((baseline - candidate) / baseline) * 10_000) / 100;
108
- }
@@ -1,301 +0,0 @@
1
- import { z } from "zod";
2
- export declare const evaluationCaseSchema: z.ZodObject<{
3
- id: z.ZodString;
4
- title: z.ZodString;
5
- category: z.ZodEnum<{
6
- location: "location";
7
- "dependency-impact": "dependency-impact";
8
- }>;
9
- frameworks: z.ZodArray<z.ZodEnum<{
10
- nestjs: "nestjs";
11
- graphql: "graphql";
12
- typeorm: "typeorm";
13
- bullmq: "bullmq";
14
- }>>;
15
- fixture: z.ZodDiscriminatedUnion<[z.ZodObject<{
16
- kind: z.ZodLiteral<"synthetic">;
17
- repository: z.ZodString;
18
- revision: z.ZodString;
19
- }, z.core.$strict>, z.ZodObject<{
20
- kind: z.ZodLiteral<"private">;
21
- repositoryAlias: z.ZodString;
22
- revision: z.ZodString;
23
- }, z.core.$strict>], "kind">;
24
- prompt: z.ZodString;
25
- oracle: z.ZodObject<{
26
- acceptanceCriteria: z.ZodArray<z.ZodString>;
27
- requiredFiles: z.ZodArray<z.ZodString>;
28
- requiredSymbols: z.ZodArray<z.ZodObject<{
29
- file: z.ZodString;
30
- name: z.ZodString;
31
- }, z.core.$strict>>;
32
- }, z.core.$strict>;
33
- }, z.core.$strict>;
34
- export declare const evaluationPlanSchema: z.ZodObject<{
35
- schemaVersion: z.ZodLiteral<1>;
36
- cases: z.ZodArray<z.ZodObject<{
37
- id: z.ZodString;
38
- title: z.ZodString;
39
- category: z.ZodEnum<{
40
- location: "location";
41
- "dependency-impact": "dependency-impact";
42
- }>;
43
- frameworks: z.ZodArray<z.ZodEnum<{
44
- nestjs: "nestjs";
45
- graphql: "graphql";
46
- typeorm: "typeorm";
47
- bullmq: "bullmq";
48
- }>>;
49
- fixture: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
- kind: z.ZodLiteral<"synthetic">;
51
- repository: z.ZodString;
52
- revision: z.ZodString;
53
- }, z.core.$strict>, z.ZodObject<{
54
- kind: z.ZodLiteral<"private">;
55
- repositoryAlias: z.ZodString;
56
- revision: z.ZodString;
57
- }, z.core.$strict>], "kind">;
58
- prompt: z.ZodString;
59
- oracle: z.ZodObject<{
60
- acceptanceCriteria: z.ZodArray<z.ZodString>;
61
- requiredFiles: z.ZodArray<z.ZodString>;
62
- requiredSymbols: z.ZodArray<z.ZodObject<{
63
- file: z.ZodString;
64
- name: z.ZodString;
65
- }, z.core.$strict>>;
66
- }, z.core.$strict>;
67
- }, z.core.$strict>>;
68
- }, z.core.$strict>;
69
- export declare const baselineEvaluationPlanSchema: z.ZodObject<{
70
- schemaVersion: z.ZodLiteral<1>;
71
- cases: z.ZodArray<z.ZodObject<{
72
- id: z.ZodString;
73
- title: z.ZodString;
74
- category: z.ZodEnum<{
75
- location: "location";
76
- "dependency-impact": "dependency-impact";
77
- }>;
78
- frameworks: z.ZodArray<z.ZodEnum<{
79
- nestjs: "nestjs";
80
- graphql: "graphql";
81
- typeorm: "typeorm";
82
- bullmq: "bullmq";
83
- }>>;
84
- fixture: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
- kind: z.ZodLiteral<"synthetic">;
86
- repository: z.ZodString;
87
- revision: z.ZodString;
88
- }, z.core.$strict>, z.ZodObject<{
89
- kind: z.ZodLiteral<"private">;
90
- repositoryAlias: z.ZodString;
91
- revision: z.ZodString;
92
- }, z.core.$strict>], "kind">;
93
- prompt: z.ZodString;
94
- oracle: z.ZodObject<{
95
- acceptanceCriteria: z.ZodArray<z.ZodString>;
96
- requiredFiles: z.ZodArray<z.ZodString>;
97
- requiredSymbols: z.ZodArray<z.ZodObject<{
98
- file: z.ZodString;
99
- name: z.ZodString;
100
- }, z.core.$strict>>;
101
- }, z.core.$strict>;
102
- }, z.core.$strict>>;
103
- }, z.core.$strict>;
104
- export declare const knowledgeCaptureDecisionSchema: z.ZodObject<{
105
- outcome: z.ZodEnum<{
106
- persist: "persist";
107
- reuse: "reuse";
108
- transient: "transient";
109
- unverified: "unverified";
110
- }>;
111
- summary: z.ZodString;
112
- }, z.core.$strict>;
113
- export declare const knowledgeCaptureAdjudicationSchema: z.ZodObject<{
114
- outcome: z.ZodEnum<{
115
- persist: "persist";
116
- reuse: "reuse";
117
- transient: "transient";
118
- unverified: "unverified";
119
- }>;
120
- correct: z.ZodBoolean;
121
- notes: z.ZodString;
122
- }, z.core.$strict>;
123
- export declare const evaluationFailureClassificationSchema: z.ZodEnum<{
124
- "missed-dependency": "missed-dependency";
125
- "incorrect-answer": "incorrect-answer";
126
- "stale-knowledge": "stale-knowledge";
127
- "hypothesis-mishandled": "hypothesis-mishandled";
128
- "unknown-boundary-mishandled": "unknown-boundary-mishandled";
129
- "unsupported-source": "unsupported-source";
130
- "protocol-violation": "protocol-violation";
131
- }>;
132
- export declare const RETAINED_FRESH_AGENT_COMMAND_AUDIT_POLICY = "fresh-agent-shell-allowlist-v4";
133
- export declare const FRESH_AGENT_COMMAND_AUDIT_POLICY = "fresh-agent-shell-allowlist-v5";
134
- export declare const freshAgentCommandAuditPolicySchema: z.ZodEnum<{
135
- "fresh-agent-shell-allowlist-v4": "fresh-agent-shell-allowlist-v4";
136
- "fresh-agent-shell-allowlist-v5": "fresh-agent-shell-allowlist-v5";
137
- }>;
138
- export type FreshAgentCommandAuditPolicy = z.infer<typeof freshAgentCommandAuditPolicySchema>;
139
- export declare const evaluationRunSchema: z.ZodObject<{
140
- schemaVersion: z.ZodLiteral<1>;
141
- runId: z.ZodString;
142
- caseId: z.ZodString;
143
- mode: z.ZodEnum<{
144
- "no-atlas": "no-atlas";
145
- atlas: "atlas";
146
- }>;
147
- fixtureRevision: z.ZodString;
148
- agent: z.ZodObject<{
149
- product: z.ZodString;
150
- model: z.ZodString;
151
- freshContext: z.ZodLiteral<true>;
152
- }, z.core.$strict>;
153
- protocol: z.ZodObject<{
154
- runnerVersion: z.ZodString;
155
- fixtureCommit: z.ZodString;
156
- instructionsHash: z.ZodString;
157
- toolPolicyHash: z.ZodString;
158
- oracleHidden: z.ZodLiteral<true>;
159
- commandAuditPassed: z.ZodLiteral<true>;
160
- commandAudit: z.ZodObject<{
161
- policy: z.ZodEnum<{
162
- "fresh-agent-shell-allowlist-v4": "fresh-agent-shell-allowlist-v4";
163
- "fresh-agent-shell-allowlist-v5": "fresh-agent-shell-allowlist-v5";
164
- }>;
165
- commands: z.ZodArray<z.ZodString>;
166
- }, z.core.$strict>;
167
- skillDiscovery: z.ZodOptional<z.ZodObject<{
168
- delivery: z.ZodLiteral<"repository">;
169
- promptInjection: z.ZodLiteral<false>;
170
- mainSkillLoaded: z.ZodLiteral<true>;
171
- statusBeforeSource: z.ZodLiteral<true>;
172
- mapBeforeSource: z.ZodLiteral<true>;
173
- decisiveSourceRead: z.ZodLiteral<true>;
174
- decisiveSourceFiles: z.ZodArray<z.ZodString>;
175
- knowledgeCaptureDecision: z.ZodObject<{
176
- outcome: z.ZodEnum<{
177
- persist: "persist";
178
- reuse: "reuse";
179
- transient: "transient";
180
- unverified: "unverified";
181
- }>;
182
- summary: z.ZodString;
183
- }, z.core.$strict>;
184
- conditionalReferences: z.ZodObject<{
185
- snapshotBootstrap: z.ZodDiscriminatedUnion<[z.ZodObject<{
186
- outcome: z.ZodLiteral<"not-required">;
187
- }, z.core.$strict>, z.ZodObject<{
188
- outcome: z.ZodLiteral<"loaded-after-trigger">;
189
- triggerCommandSequence: z.ZodNumber;
190
- loadCommandSequence: z.ZodNumber;
191
- }, z.core.$strict>], "outcome">;
192
- resultRouting: z.ZodDiscriminatedUnion<[z.ZodObject<{
193
- outcome: z.ZodLiteral<"not-required">;
194
- }, z.core.$strict>, z.ZodObject<{
195
- outcome: z.ZodLiteral<"loaded-after-trigger">;
196
- triggerCommandSequence: z.ZodNumber;
197
- loadCommandSequence: z.ZodNumber;
198
- }, z.core.$strict>], "outcome">;
199
- graphPatch: z.ZodDiscriminatedUnion<[z.ZodObject<{
200
- outcome: z.ZodLiteral<"not-loaded">;
201
- }, z.core.$strict>, z.ZodObject<{
202
- outcome: z.ZodLiteral<"loaded-after-source">;
203
- sourceCommandSequence: z.ZodNumber;
204
- loadCommandSequence: z.ZodNumber;
205
- }, z.core.$strict>], "outcome">;
206
- }, z.core.$strict>;
207
- }, z.core.$strict>>;
208
- }, z.core.$strict>;
209
- startedAt: z.ZodISODateTime;
210
- finishedAt: z.ZodISODateTime;
211
- observations: z.ZodObject<{
212
- sourceTokenMethod: z.ZodString;
213
- sourceOpens: z.ZodArray<z.ZodObject<{
214
- sequence: z.ZodNumber;
215
- commandSequence: z.ZodOptional<z.ZodNumber>;
216
- exitCode: z.ZodOptional<z.ZodNumber>;
217
- file: z.ZodString;
218
- sourceTokens: z.ZodNumber;
219
- }, z.core.$strict>>;
220
- atlasCalls: z.ZodArray<z.ZodObject<{
221
- sequence: z.ZodNumber;
222
- command: z.ZodString;
223
- commandSequence: z.ZodOptional<z.ZodNumber>;
224
- exitCode: z.ZodOptional<z.ZodNumber>;
225
- output: z.ZodOptional<z.ZodString>;
226
- }, z.core.$strict>>;
227
- atlasHandling: z.ZodArray<z.ZodObject<{
228
- sequence: z.ZodNumber;
229
- classification: z.ZodEnum<{
230
- hypothesis: "hypothesis";
231
- stale: "stale";
232
- unsupported: "unsupported";
233
- unknown: "unknown";
234
- partial: "partial";
235
- insufficient: "insufficient";
236
- }>;
237
- action: z.ZodString;
238
- }, z.core.$strict>>;
239
- skillLoads: z.ZodOptional<z.ZodArray<z.ZodObject<{
240
- sequence: z.ZodNumber;
241
- file: z.ZodString;
242
- }, z.core.$strict>>>;
243
- }, z.core.$strict>;
244
- answer: z.ZodObject<{
245
- response: z.ZodString;
246
- reportedFiles: z.ZodArray<z.ZodString>;
247
- reportedSymbols: z.ZodArray<z.ZodObject<{
248
- file: z.ZodString;
249
- name: z.ZodString;
250
- }, z.core.$strict>>;
251
- knowledgeCaptureDecision: z.ZodOptional<z.ZodObject<{
252
- outcome: z.ZodEnum<{
253
- persist: "persist";
254
- reuse: "reuse";
255
- transient: "transient";
256
- unverified: "unverified";
257
- }>;
258
- summary: z.ZodString;
259
- }, z.core.$strict>>;
260
- }, z.core.$strict>;
261
- adjudication: z.ZodObject<{
262
- correct: z.ZodBoolean;
263
- notes: z.ZodString;
264
- failureClassifications: z.ZodArray<z.ZodEnum<{
265
- "missed-dependency": "missed-dependency";
266
- "incorrect-answer": "incorrect-answer";
267
- "stale-knowledge": "stale-knowledge";
268
- "hypothesis-mishandled": "hypothesis-mishandled";
269
- "unknown-boundary-mishandled": "unknown-boundary-mishandled";
270
- "unsupported-source": "unsupported-source";
271
- "protocol-violation": "protocol-violation";
272
- }>>;
273
- knowledgeCaptureDecision: z.ZodOptional<z.ZodObject<{
274
- outcome: z.ZodEnum<{
275
- persist: "persist";
276
- reuse: "reuse";
277
- transient: "transient";
278
- unverified: "unverified";
279
- }>;
280
- correct: z.ZodBoolean;
281
- notes: z.ZodString;
282
- }, z.core.$strict>>;
283
- }, z.core.$strict>;
284
- }, z.core.$strict>;
285
- export type EvaluationCase = z.infer<typeof evaluationCaseSchema>;
286
- export type EvaluationRun = z.infer<typeof evaluationRunSchema>;
287
- export interface EvaluationRunSummary {
288
- caseId: string;
289
- runId: string;
290
- mode: EvaluationRun["mode"];
291
- correct: boolean;
292
- requiredFileRecall: number;
293
- requiredSymbolRecall: number;
294
- openedFileCount: number;
295
- sourceTokens: number;
296
- atlasCallCount: number;
297
- atlasHandlingCount: number;
298
- failureClassifications: EvaluationRun["adjudication"]["failureClassifications"];
299
- }
300
- export declare function summarizeEvaluationRun(rawCase: unknown, rawRun: unknown): EvaluationRunSummary;
301
- //# sourceMappingURL=contracts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/evaluation/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA8BxB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0C7B,CAAC;AAEL,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAW7B,CAAC;AAEL,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2CxC,CAAC;AA6CF,eAAO,MAAM,8BAA8B;;;;;;;;kBAGzC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;kBAI7C,CAAC;AAuCH,eAAO,MAAM,qCAAqC;;;;;;;;EAQhD,CAAC;AAIH,eAAO,MAAM,yCAAyC,mCAAmC,CAAC;AAC1F,eAAO,MAAM,gCAAgC,mCAAmC,CAAC;AACjF,eAAO,MAAM,kCAAkC;;;EAG7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,kCAAkC,CAC1C,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkL5B,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC,wBAAwB,CAAC,CAAC;CACjF;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,OAAO,GACd,oBAAoB,CAgDtB"}