@mcoda/mswarm 0.1.57 → 0.1.60

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 (250) hide show
  1. package/README.md +19 -0
  2. package/dist/codali-executor.d.ts +266 -0
  3. package/dist/codali-executor.d.ts.map +1 -0
  4. package/dist/codali-executor.js +227 -0
  5. package/dist/codali-executor.js.map +1 -0
  6. package/dist/runtime.d.ts +36 -1
  7. package/dist/runtime.d.ts.map +1 -1
  8. package/dist/runtime.js +219 -30
  9. package/dist/runtime.js.map +1 -1
  10. package/dist/server.d.ts.map +1 -1
  11. package/dist/server.js +54 -0
  12. package/dist/server.js.map +1 -1
  13. package/dist/vendor/codali/agents/AgentProtocol.d.ts +287 -0
  14. package/dist/vendor/codali/agents/AgentProtocol.d.ts.map +1 -0
  15. package/dist/vendor/codali/agents/AgentProtocol.js +365 -0
  16. package/dist/vendor/codali/agents/AgentResolver.d.ts +23 -0
  17. package/dist/vendor/codali/agents/AgentResolver.d.ts.map +1 -0
  18. package/dist/vendor/codali/agents/AgentResolver.js +77 -0
  19. package/dist/vendor/codali/agents/PhaseAgentSelector.d.ts +23 -0
  20. package/dist/vendor/codali/agents/PhaseAgentSelector.d.ts.map +1 -0
  21. package/dist/vendor/codali/agents/PhaseAgentSelector.js +287 -0
  22. package/dist/vendor/codali/cli/EvalCommand.d.ts +37 -0
  23. package/dist/vendor/codali/cli/EvalCommand.d.ts.map +1 -0
  24. package/dist/vendor/codali/cli/EvalCommand.js +333 -0
  25. package/dist/vendor/codali/cli/FeedbackCommand.d.ts +22 -0
  26. package/dist/vendor/codali/cli/FeedbackCommand.d.ts.map +1 -0
  27. package/dist/vendor/codali/cli/FeedbackCommand.js +163 -0
  28. package/dist/vendor/codali/cli/RunCommand.d.ts +78 -0
  29. package/dist/vendor/codali/cli/RunCommand.d.ts.map +1 -0
  30. package/dist/vendor/codali/cli/RunCommand.js +2261 -0
  31. package/dist/vendor/codali/cli.d.ts +3 -0
  32. package/dist/vendor/codali/cli.d.ts.map +1 -0
  33. package/dist/vendor/codali/cli.js +109 -0
  34. package/dist/vendor/codali/cognitive/ArchitectPlanner.d.ts +107 -0
  35. package/dist/vendor/codali/cognitive/ArchitectPlanner.d.ts.map +1 -0
  36. package/dist/vendor/codali/cognitive/ArchitectPlanner.js +1726 -0
  37. package/dist/vendor/codali/cognitive/BuilderOutputParser.d.ts +25 -0
  38. package/dist/vendor/codali/cognitive/BuilderOutputParser.d.ts.map +1 -0
  39. package/dist/vendor/codali/cognitive/BuilderOutputParser.js +164 -0
  40. package/dist/vendor/codali/cognitive/BuilderRunner.d.ts +76 -0
  41. package/dist/vendor/codali/cognitive/BuilderRunner.d.ts.map +1 -0
  42. package/dist/vendor/codali/cognitive/BuilderRunner.js +1159 -0
  43. package/dist/vendor/codali/cognitive/ContextAssembler.d.ts +91 -0
  44. package/dist/vendor/codali/cognitive/ContextAssembler.d.ts.map +1 -0
  45. package/dist/vendor/codali/cognitive/ContextAssembler.js +4547 -0
  46. package/dist/vendor/codali/cognitive/ContextBudget.d.ts +19 -0
  47. package/dist/vendor/codali/cognitive/ContextBudget.d.ts.map +1 -0
  48. package/dist/vendor/codali/cognitive/ContextBudget.js +35 -0
  49. package/dist/vendor/codali/cognitive/ContextFileLoader.d.ts +30 -0
  50. package/dist/vendor/codali/cognitive/ContextFileLoader.d.ts.map +1 -0
  51. package/dist/vendor/codali/cognitive/ContextFileLoader.js +307 -0
  52. package/dist/vendor/codali/cognitive/ContextManager.d.ts +47 -0
  53. package/dist/vendor/codali/cognitive/ContextManager.d.ts.map +1 -0
  54. package/dist/vendor/codali/cognitive/ContextManager.js +272 -0
  55. package/dist/vendor/codali/cognitive/ContextRedactor.d.ts +18 -0
  56. package/dist/vendor/codali/cognitive/ContextRedactor.d.ts.map +1 -0
  57. package/dist/vendor/codali/cognitive/ContextRedactor.js +53 -0
  58. package/dist/vendor/codali/cognitive/ContextSelector.d.ts +22 -0
  59. package/dist/vendor/codali/cognitive/ContextSelector.d.ts.map +1 -0
  60. package/dist/vendor/codali/cognitive/ContextSelector.js +431 -0
  61. package/dist/vendor/codali/cognitive/ContextSerializer.d.ts +8 -0
  62. package/dist/vendor/codali/cognitive/ContextSerializer.d.ts.map +1 -0
  63. package/dist/vendor/codali/cognitive/ContextSerializer.js +882 -0
  64. package/dist/vendor/codali/cognitive/ContextStore.d.ts +27 -0
  65. package/dist/vendor/codali/cognitive/ContextStore.d.ts.map +1 -0
  66. package/dist/vendor/codali/cognitive/ContextStore.js +79 -0
  67. package/dist/vendor/codali/cognitive/ContextSummarizer.d.ts +16 -0
  68. package/dist/vendor/codali/cognitive/ContextSummarizer.d.ts.map +1 -0
  69. package/dist/vendor/codali/cognitive/ContextSummarizer.js +45 -0
  70. package/dist/vendor/codali/cognitive/CostEstimator.d.ts +31 -0
  71. package/dist/vendor/codali/cognitive/CostEstimator.d.ts.map +1 -0
  72. package/dist/vendor/codali/cognitive/CostEstimator.js +66 -0
  73. package/dist/vendor/codali/cognitive/CriticEvaluator.d.ts +32 -0
  74. package/dist/vendor/codali/cognitive/CriticEvaluator.d.ts.map +1 -0
  75. package/dist/vendor/codali/cognitive/CriticEvaluator.js +297 -0
  76. package/dist/vendor/codali/cognitive/EvidenceGate.d.ts +9 -0
  77. package/dist/vendor/codali/cognitive/EvidenceGate.d.ts.map +1 -0
  78. package/dist/vendor/codali/cognitive/EvidenceGate.js +75 -0
  79. package/dist/vendor/codali/cognitive/GoldenExampleIndexer.d.ts +12 -0
  80. package/dist/vendor/codali/cognitive/GoldenExampleIndexer.d.ts.map +1 -0
  81. package/dist/vendor/codali/cognitive/GoldenExampleIndexer.js +34 -0
  82. package/dist/vendor/codali/cognitive/GoldenSetStore.d.ts +33 -0
  83. package/dist/vendor/codali/cognitive/GoldenSetStore.d.ts.map +1 -0
  84. package/dist/vendor/codali/cognitive/GoldenSetStore.js +159 -0
  85. package/dist/vendor/codali/cognitive/IntentSignals.d.ts +7 -0
  86. package/dist/vendor/codali/cognitive/IntentSignals.d.ts.map +1 -0
  87. package/dist/vendor/codali/cognitive/IntentSignals.js +285 -0
  88. package/dist/vendor/codali/cognitive/LearningGovernance.d.ts +100 -0
  89. package/dist/vendor/codali/cognitive/LearningGovernance.d.ts.map +1 -0
  90. package/dist/vendor/codali/cognitive/LearningGovernance.js +276 -0
  91. package/dist/vendor/codali/cognitive/MemoryWriteback.d.ts +64 -0
  92. package/dist/vendor/codali/cognitive/MemoryWriteback.d.ts.map +1 -0
  93. package/dist/vendor/codali/cognitive/MemoryWriteback.js +287 -0
  94. package/dist/vendor/codali/cognitive/PatchApplier.d.ts +49 -0
  95. package/dist/vendor/codali/cognitive/PatchApplier.d.ts.map +1 -0
  96. package/dist/vendor/codali/cognitive/PatchApplier.js +199 -0
  97. package/dist/vendor/codali/cognitive/PatchInterpreter.d.ts +35 -0
  98. package/dist/vendor/codali/cognitive/PatchInterpreter.d.ts.map +1 -0
  99. package/dist/vendor/codali/cognitive/PatchInterpreter.js +100 -0
  100. package/dist/vendor/codali/cognitive/PatchOutputNormalizer.d.ts +7 -0
  101. package/dist/vendor/codali/cognitive/PatchOutputNormalizer.d.ts.map +1 -0
  102. package/dist/vendor/codali/cognitive/PatchOutputNormalizer.js +59 -0
  103. package/dist/vendor/codali/cognitive/PostMortemAnalyzer.d.ts +17 -0
  104. package/dist/vendor/codali/cognitive/PostMortemAnalyzer.d.ts.map +1 -0
  105. package/dist/vendor/codali/cognitive/PostMortemAnalyzer.js +131 -0
  106. package/dist/vendor/codali/cognitive/PreferenceExtraction.d.ts +3 -0
  107. package/dist/vendor/codali/cognitive/PreferenceExtraction.d.ts.map +1 -0
  108. package/dist/vendor/codali/cognitive/PreferenceExtraction.js +85 -0
  109. package/dist/vendor/codali/cognitive/Prompts.d.ts +15 -0
  110. package/dist/vendor/codali/cognitive/Prompts.d.ts.map +1 -0
  111. package/dist/vendor/codali/cognitive/Prompts.js +326 -0
  112. package/dist/vendor/codali/cognitive/ProviderRouting.d.ts +16 -0
  113. package/dist/vendor/codali/cognitive/ProviderRouting.d.ts.map +1 -0
  114. package/dist/vendor/codali/cognitive/ProviderRouting.js +24 -0
  115. package/dist/vendor/codali/cognitive/QueryExtraction.d.ts +12 -0
  116. package/dist/vendor/codali/cognitive/QueryExtraction.d.ts.map +1 -0
  117. package/dist/vendor/codali/cognitive/QueryExtraction.js +262 -0
  118. package/dist/vendor/codali/cognitive/RunHistoryIndexer.d.ts +13 -0
  119. package/dist/vendor/codali/cognitive/RunHistoryIndexer.d.ts.map +1 -0
  120. package/dist/vendor/codali/cognitive/RunHistoryIndexer.js +125 -0
  121. package/dist/vendor/codali/cognitive/SmartPipeline.d.ts +92 -0
  122. package/dist/vendor/codali/cognitive/SmartPipeline.d.ts.map +1 -0
  123. package/dist/vendor/codali/cognitive/SmartPipeline.js +4804 -0
  124. package/dist/vendor/codali/cognitive/Types.d.ts +474 -0
  125. package/dist/vendor/codali/cognitive/Types.d.ts.map +1 -0
  126. package/dist/vendor/codali/cognitive/Types.js +7 -0
  127. package/dist/vendor/codali/cognitive/ValidationRunner.d.ts +57 -0
  128. package/dist/vendor/codali/cognitive/ValidationRunner.d.ts.map +1 -0
  129. package/dist/vendor/codali/cognitive/ValidationRunner.js +515 -0
  130. package/dist/vendor/codali/config/Config.d.ts +249 -0
  131. package/dist/vendor/codali/config/Config.d.ts.map +1 -0
  132. package/dist/vendor/codali/config/Config.js +200 -0
  133. package/dist/vendor/codali/config/ConfigLoader.d.ts +56 -0
  134. package/dist/vendor/codali/config/ConfigLoader.d.ts.map +1 -0
  135. package/dist/vendor/codali/config/ConfigLoader.js +1246 -0
  136. package/dist/vendor/codali/docdex/DocdexClient.d.ts +113 -0
  137. package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -0
  138. package/dist/vendor/codali/docdex/DocdexClient.js +524 -0
  139. package/dist/vendor/codali/eval/EvalRunner.d.ts +35 -0
  140. package/dist/vendor/codali/eval/EvalRunner.d.ts.map +1 -0
  141. package/dist/vendor/codali/eval/EvalRunner.js +38 -0
  142. package/dist/vendor/codali/eval/EvalTaskExecutor.d.ts +81 -0
  143. package/dist/vendor/codali/eval/EvalTaskExecutor.d.ts.map +1 -0
  144. package/dist/vendor/codali/eval/EvalTaskExecutor.js +371 -0
  145. package/dist/vendor/codali/eval/GateEvaluator.d.ts +31 -0
  146. package/dist/vendor/codali/eval/GateEvaluator.d.ts.map +1 -0
  147. package/dist/vendor/codali/eval/GateEvaluator.js +134 -0
  148. package/dist/vendor/codali/eval/MetricTypes.d.ts +28 -0
  149. package/dist/vendor/codali/eval/MetricTypes.d.ts.map +1 -0
  150. package/dist/vendor/codali/eval/MetricTypes.js +1 -0
  151. package/dist/vendor/codali/eval/MetricsAggregator.d.ts +4 -0
  152. package/dist/vendor/codali/eval/MetricsAggregator.d.ts.map +1 -0
  153. package/dist/vendor/codali/eval/MetricsAggregator.js +97 -0
  154. package/dist/vendor/codali/eval/RegressionComparator.d.ts +29 -0
  155. package/dist/vendor/codali/eval/RegressionComparator.d.ts.map +1 -0
  156. package/dist/vendor/codali/eval/RegressionComparator.js +155 -0
  157. package/dist/vendor/codali/eval/ReportInputAdapter.d.ts +52 -0
  158. package/dist/vendor/codali/eval/ReportInputAdapter.d.ts.map +1 -0
  159. package/dist/vendor/codali/eval/ReportInputAdapter.js +229 -0
  160. package/dist/vendor/codali/eval/ReportSerializer.d.ts +32 -0
  161. package/dist/vendor/codali/eval/ReportSerializer.d.ts.map +1 -0
  162. package/dist/vendor/codali/eval/ReportSerializer.js +33 -0
  163. package/dist/vendor/codali/eval/ReportStore.d.ts +18 -0
  164. package/dist/vendor/codali/eval/ReportStore.d.ts.map +1 -0
  165. package/dist/vendor/codali/eval/ReportStore.js +96 -0
  166. package/dist/vendor/codali/eval/SuiteLoader.d.ts +12 -0
  167. package/dist/vendor/codali/eval/SuiteLoader.d.ts.map +1 -0
  168. package/dist/vendor/codali/eval/SuiteLoader.js +51 -0
  169. package/dist/vendor/codali/eval/SuiteSchema.d.ts +56 -0
  170. package/dist/vendor/codali/eval/SuiteSchema.d.ts.map +1 -0
  171. package/dist/vendor/codali/eval/SuiteSchema.js +357 -0
  172. package/dist/vendor/codali/index.d.ts +11 -0
  173. package/dist/vendor/codali/index.d.ts.map +1 -0
  174. package/dist/vendor/codali/index.js +5 -0
  175. package/dist/vendor/codali/providers/CodexCliProvider.d.ts +8 -0
  176. package/dist/vendor/codali/providers/CodexCliProvider.d.ts.map +1 -0
  177. package/dist/vendor/codali/providers/CodexCliProvider.js +282 -0
  178. package/dist/vendor/codali/providers/OllamaRemoteProvider.d.ts +8 -0
  179. package/dist/vendor/codali/providers/OllamaRemoteProvider.d.ts.map +1 -0
  180. package/dist/vendor/codali/providers/OllamaRemoteProvider.js +300 -0
  181. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts +8 -0
  182. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -0
  183. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +192 -0
  184. package/dist/vendor/codali/providers/ProviderRegistry.d.ts +12 -0
  185. package/dist/vendor/codali/providers/ProviderRegistry.d.ts.map +1 -0
  186. package/dist/vendor/codali/providers/ProviderRegistry.js +28 -0
  187. package/dist/vendor/codali/providers/ProviderTypes.d.ts +81 -0
  188. package/dist/vendor/codali/providers/ProviderTypes.d.ts.map +1 -0
  189. package/dist/vendor/codali/providers/ProviderTypes.js +1 -0
  190. package/dist/vendor/codali/runtime/CodaliRuntime.d.ts +183 -0
  191. package/dist/vendor/codali/runtime/CodaliRuntime.d.ts.map +1 -0
  192. package/dist/vendor/codali/runtime/CodaliRuntime.js +1363 -0
  193. package/dist/vendor/codali/runtime/DeepInvestigationErrors.d.ts +39 -0
  194. package/dist/vendor/codali/runtime/DeepInvestigationErrors.d.ts.map +1 -0
  195. package/dist/vendor/codali/runtime/DeepInvestigationErrors.js +57 -0
  196. package/dist/vendor/codali/runtime/RunContext.d.ts +27 -0
  197. package/dist/vendor/codali/runtime/RunContext.d.ts.map +1 -0
  198. package/dist/vendor/codali/runtime/RunContext.js +51 -0
  199. package/dist/vendor/codali/runtime/RunLogQuery.d.ts +48 -0
  200. package/dist/vendor/codali/runtime/RunLogQuery.d.ts.map +1 -0
  201. package/dist/vendor/codali/runtime/RunLogQuery.js +36 -0
  202. package/dist/vendor/codali/runtime/RunLogReader.d.ts +19 -0
  203. package/dist/vendor/codali/runtime/RunLogReader.d.ts.map +1 -0
  204. package/dist/vendor/codali/runtime/RunLogReader.js +361 -0
  205. package/dist/vendor/codali/runtime/RunLogger.d.ts +71 -0
  206. package/dist/vendor/codali/runtime/RunLogger.d.ts.map +1 -0
  207. package/dist/vendor/codali/runtime/RunLogger.js +100 -0
  208. package/dist/vendor/codali/runtime/RunTelemetryTypes.d.ts +117 -0
  209. package/dist/vendor/codali/runtime/RunTelemetryTypes.d.ts.map +1 -0
  210. package/dist/vendor/codali/runtime/RunTelemetryTypes.js +299 -0
  211. package/dist/vendor/codali/runtime/Runner.d.ts +66 -0
  212. package/dist/vendor/codali/runtime/Runner.d.ts.map +1 -0
  213. package/dist/vendor/codali/runtime/Runner.js +215 -0
  214. package/dist/vendor/codali/runtime/StoragePaths.d.ts +3 -0
  215. package/dist/vendor/codali/runtime/StoragePaths.d.ts.map +1 -0
  216. package/dist/vendor/codali/runtime/StoragePaths.js +19 -0
  217. package/dist/vendor/codali/runtime/WorkspaceLock.d.ts +30 -0
  218. package/dist/vendor/codali/runtime/WorkspaceLock.d.ts.map +1 -0
  219. package/dist/vendor/codali/runtime/WorkspaceLock.js +141 -0
  220. package/dist/vendor/codali/session/InstructionLoader.d.ts +14 -0
  221. package/dist/vendor/codali/session/InstructionLoader.d.ts.map +1 -0
  222. package/dist/vendor/codali/session/InstructionLoader.js +107 -0
  223. package/dist/vendor/codali/session/SessionStore.d.ts +81 -0
  224. package/dist/vendor/codali/session/SessionStore.d.ts.map +1 -0
  225. package/dist/vendor/codali/session/SessionStore.js +244 -0
  226. package/dist/vendor/codali/subagents/SubagentOrchestrator.d.ts +68 -0
  227. package/dist/vendor/codali/subagents/SubagentOrchestrator.d.ts.map +1 -0
  228. package/dist/vendor/codali/subagents/SubagentOrchestrator.js +150 -0
  229. package/dist/vendor/codali/tools/ToolRegistry.d.ts +9 -0
  230. package/dist/vendor/codali/tools/ToolRegistry.d.ts.map +1 -0
  231. package/dist/vendor/codali/tools/ToolRegistry.js +263 -0
  232. package/dist/vendor/codali/tools/ToolTypes.d.ts +66 -0
  233. package/dist/vendor/codali/tools/ToolTypes.d.ts.map +1 -0
  234. package/dist/vendor/codali/tools/ToolTypes.js +32 -0
  235. package/dist/vendor/codali/tools/diff/DiffTool.d.ts +3 -0
  236. package/dist/vendor/codali/tools/diff/DiffTool.d.ts.map +1 -0
  237. package/dist/vendor/codali/tools/diff/DiffTool.js +34 -0
  238. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts +4 -0
  239. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts.map +1 -0
  240. package/dist/vendor/codali/tools/docdex/DocdexTools.js +453 -0
  241. package/dist/vendor/codali/tools/filesystem/FileTools.d.ts +3 -0
  242. package/dist/vendor/codali/tools/filesystem/FileTools.d.ts.map +1 -0
  243. package/dist/vendor/codali/tools/filesystem/FileTools.js +141 -0
  244. package/dist/vendor/codali/tools/search/SearchTool.d.ts +3 -0
  245. package/dist/vendor/codali/tools/search/SearchTool.d.ts.map +1 -0
  246. package/dist/vendor/codali/tools/search/SearchTool.js +46 -0
  247. package/dist/vendor/codali/tools/shell/ShellTool.d.ts +3 -0
  248. package/dist/vendor/codali/tools/shell/ShellTool.d.ts.map +1 -0
  249. package/dist/vendor/codali/tools/shell/ShellTool.js +104 -0
  250. package/package.json +5 -3
@@ -0,0 +1,33 @@
1
+ import { stableJsonStringify } from "./SuiteSchema.js";
2
+ const asRecord = (value) => {
3
+ if (!value || typeof value !== "object" || Array.isArray(value))
4
+ return undefined;
5
+ return value;
6
+ };
7
+ export const serializeEvalReport = (report, pretty = true) => {
8
+ const stable = stableJsonStringify(report);
9
+ if (!pretty)
10
+ return stable;
11
+ const parsed = JSON.parse(stable);
12
+ return `${JSON.stringify(parsed, null, 2)}\n`;
13
+ };
14
+ export const parseEvalReport = (content) => {
15
+ let parsed;
16
+ try {
17
+ parsed = JSON.parse(content);
18
+ }
19
+ catch (error) {
20
+ throw new Error(`Report JSON parse failed: ${error instanceof Error ? error.message : String(error)}`);
21
+ }
22
+ const report = asRecord(parsed);
23
+ if (!report) {
24
+ throw new Error("Report payload must be an object.");
25
+ }
26
+ if (report.schema_version !== 1) {
27
+ throw new Error("Unsupported report schema_version.");
28
+ }
29
+ if (typeof report.report_id !== "string" || !report.report_id.trim()) {
30
+ throw new Error("Report report_id is required.");
31
+ }
32
+ return report;
33
+ };
@@ -0,0 +1,18 @@
1
+ import { type EvalReport } from "./ReportSerializer.js";
2
+ export declare class ReportStore {
3
+ readonly report_dir: string;
4
+ constructor(workspaceRoot: string, reportDir?: string);
5
+ private ensureDir;
6
+ save(report: EvalReport): Promise<string>;
7
+ read(reportPath: string): Promise<EvalReport>;
8
+ resolvePath(reportPath: string, cwd: string): Promise<string>;
9
+ listReports(): Promise<string[]>;
10
+ findLatestForSuite(params: {
11
+ suite_fingerprint: string;
12
+ exclude_report_id?: string;
13
+ }): Promise<{
14
+ path: string;
15
+ report: EvalReport;
16
+ } | undefined>;
17
+ }
18
+ //# sourceMappingURL=ReportStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReportStore.d.ts","sourceRoot":"","sources":["../../src/eval/ReportStore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwC,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAuC9F,qBAAa,WAAW;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEhB,aAAa,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;YAKvC,SAAS;IAIjB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAUzC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAK7C,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAK7D,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAmBhC,kBAAkB,CAAC,MAAM,EAAE;QAC/B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,CAAA;KAAE,GAAG,SAAS,CAAC;CAe9D"}
@@ -0,0 +1,96 @@
1
+ import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { getGlobalWorkspaceDir } from "../runtime/StoragePaths.js";
4
+ import { DEFAULT_LOG_DIR } from "../config/Config.js";
5
+ import { parseEvalReport, serializeEvalReport } from "./ReportSerializer.js";
6
+ const sanitize = (value) => value
7
+ .trim()
8
+ .replace(/[^a-z0-9._-]+/gi, "-")
9
+ .replace(/-+/g, "-")
10
+ .replace(/^-|-$/g, "")
11
+ .toLowerCase() || "suite";
12
+ const fileTimestamp = (filePath) => {
13
+ const match = /-(\d{13})-[a-z0-9._-]+\.json$/i.exec(path.basename(filePath));
14
+ if (!match)
15
+ return undefined;
16
+ const parsed = Number(match[1]);
17
+ return Number.isFinite(parsed) ? parsed : undefined;
18
+ };
19
+ const reportSortKey = async (filePath) => {
20
+ let mtimeMs = 0;
21
+ try {
22
+ const info = await stat(filePath);
23
+ mtimeMs = info.mtimeMs;
24
+ }
25
+ catch {
26
+ mtimeMs = 0;
27
+ }
28
+ return {
29
+ // Prefer timestamp encoded in the report filename to avoid OS-specific mtime granularity.
30
+ timestamp: fileTimestamp(filePath) ?? Math.floor(mtimeMs),
31
+ mtimeMs,
32
+ fileName: path.basename(filePath).toLowerCase(),
33
+ };
34
+ };
35
+ export class ReportStore {
36
+ constructor(workspaceRoot, reportDir) {
37
+ const storageRoot = getGlobalWorkspaceDir(workspaceRoot);
38
+ this.report_dir = path.resolve(storageRoot, reportDir ?? path.join(DEFAULT_LOG_DIR, "eval"));
39
+ }
40
+ async ensureDir() {
41
+ await mkdir(this.report_dir, { recursive: true });
42
+ }
43
+ async save(report) {
44
+ await this.ensureDir();
45
+ const suiteId = sanitize(report.suite.suite_id);
46
+ const timestamp = Date.now();
47
+ const fileName = `${suiteId}-${timestamp}-${sanitize(report.report_id)}.json`;
48
+ const filePath = path.join(this.report_dir, fileName);
49
+ await writeFile(filePath, serializeEvalReport(report, true), "utf8");
50
+ return filePath;
51
+ }
52
+ async read(reportPath) {
53
+ const content = await readFile(reportPath, "utf8");
54
+ return parseEvalReport(content);
55
+ }
56
+ async resolvePath(reportPath, cwd) {
57
+ const candidate = path.isAbsolute(reportPath) ? reportPath : path.resolve(cwd, reportPath);
58
+ return path.resolve(candidate);
59
+ }
60
+ async listReports() {
61
+ await this.ensureDir();
62
+ const entries = await readdir(this.report_dir);
63
+ const jsonEntries = entries
64
+ .filter((entry) => entry.endsWith(".json"))
65
+ .map((entry) => path.join(this.report_dir, entry));
66
+ const withKeys = await Promise.all(jsonEntries.map(async (entry) => ({ entry, key: await reportSortKey(entry) })));
67
+ withKeys.sort((left, right) => {
68
+ const byTimestamp = right.key.timestamp - left.key.timestamp;
69
+ if (byTimestamp !== 0)
70
+ return byTimestamp;
71
+ const byMtime = right.key.mtimeMs - left.key.mtimeMs;
72
+ if (byMtime !== 0)
73
+ return byMtime;
74
+ return right.key.fileName.localeCompare(left.key.fileName);
75
+ });
76
+ return withKeys.map((entry) => entry.entry);
77
+ }
78
+ async findLatestForSuite(params) {
79
+ const reportFiles = await this.listReports();
80
+ for (const reportFile of reportFiles) {
81
+ let parsed;
82
+ try {
83
+ parsed = await this.read(reportFile);
84
+ }
85
+ catch {
86
+ continue;
87
+ }
88
+ if (parsed.suite.suite_fingerprint !== params.suite_fingerprint)
89
+ continue;
90
+ if (params.exclude_report_id && parsed.report_id === params.exclude_report_id)
91
+ continue;
92
+ return { path: reportFile, report: parsed };
93
+ }
94
+ return undefined;
95
+ }
96
+ }
@@ -0,0 +1,12 @@
1
+ import { type EvalSuiteDefinition, type EvalTaskDefinition } from "./SuiteSchema.js";
2
+ export interface LoadedEvalSuite {
3
+ suite_path: string;
4
+ suite_dir: string;
5
+ suite_fingerprint: string;
6
+ suite: EvalSuiteDefinition;
7
+ }
8
+ export declare const hashSuiteDefinition: (suite: EvalSuiteDefinition) => string;
9
+ export declare const resolveSuitePath: (suitePath: string, cwd: string) => string;
10
+ export declare const resolveTaskFilePath: (task: EvalTaskDefinition, suiteDir: string, workspaceRoot: string) => string | undefined;
11
+ export declare const loadSuiteFromFile: (suitePath: string, cwd?: string) => Promise<LoadedEvalSuite>;
12
+ //# sourceMappingURL=SuiteLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuiteLoader.d.ts","sourceRoot":"","sources":["../../src/eval/SuiteLoader.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE,mBAAmB,CAAC;CAC5B;AAgBD,eAAO,MAAM,mBAAmB,GAAI,OAAO,mBAAmB,KAAG,MACc,CAAC;AAEhF,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,KAAG,MAMjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,MAAM,kBAAkB,EACxB,UAAU,MAAM,EAChB,eAAe,MAAM,KACpB,MAAM,GAAG,SAMX,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,WAAW,MAAM,EACjB,YAAmB,KAClB,OAAO,CAAC,eAAe,CAiCzB,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { createHash } from "node:crypto";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { normalizeSuiteDefinition, stableJsonStringify, SuiteValidationError, } from "./SuiteSchema.js";
5
+ const toSuiteValidationError = (label, message, code, pathLabel = label) => new SuiteValidationError(`${label} validation failed.`, [
6
+ {
7
+ path: pathLabel,
8
+ code,
9
+ message,
10
+ },
11
+ ]);
12
+ export const hashSuiteDefinition = (suite) => createHash("sha256").update(stableJsonStringify(suite), "utf8").digest("hex");
13
+ export const resolveSuitePath = (suitePath, cwd) => {
14
+ const trimmed = suitePath.trim();
15
+ if (!trimmed) {
16
+ throw toSuiteValidationError("suite", "Suite path must be non-empty.", "missing_suite_path");
17
+ }
18
+ return path.resolve(cwd, trimmed);
19
+ };
20
+ export const resolveTaskFilePath = (task, suiteDir, workspaceRoot) => {
21
+ if (!task.task_file)
22
+ return undefined;
23
+ const candidate = path.isAbsolute(task.task_file)
24
+ ? task.task_file
25
+ : path.resolve(suiteDir, task.task_file);
26
+ return path.resolve(workspaceRoot, path.relative(workspaceRoot, candidate));
27
+ };
28
+ export const loadSuiteFromFile = async (suitePath, cwd = process.cwd()) => {
29
+ const resolvedPath = resolveSuitePath(suitePath, cwd);
30
+ let content = "";
31
+ try {
32
+ content = await readFile(resolvedPath, "utf8");
33
+ }
34
+ catch (error) {
35
+ throw toSuiteValidationError("suite", `Unable to read suite file: ${error instanceof Error ? error.message : String(error)}`, "suite_read_failed", resolvedPath);
36
+ }
37
+ let raw;
38
+ try {
39
+ raw = JSON.parse(content);
40
+ }
41
+ catch (error) {
42
+ throw toSuiteValidationError("suite", `Suite file is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, "suite_invalid_json", resolvedPath);
43
+ }
44
+ const suite = normalizeSuiteDefinition(raw, resolvedPath);
45
+ return {
46
+ suite_path: resolvedPath,
47
+ suite_dir: path.dirname(resolvedPath),
48
+ suite_fingerprint: hashSuiteDefinition(suite),
49
+ suite,
50
+ };
51
+ };
@@ -0,0 +1,56 @@
1
+ export declare const EVAL_COMMANDS: readonly ["run", "fix", "review", "explain", "test"];
2
+ export type EvalCommandName = (typeof EVAL_COMMANDS)[number];
3
+ export declare const EVAL_VERIFICATION_EXPECTATIONS: readonly ["verified_passed", "verified_failed", "unverified_with_reason", "any"];
4
+ export type EvalVerificationExpectation = (typeof EVAL_VERIFICATION_EXPECTATIONS)[number];
5
+ export interface EvalGateThresholds {
6
+ patch_apply_drop_max: number;
7
+ verification_pass_rate_min: number;
8
+ hallucination_rate_max: number;
9
+ scope_violation_rate_max: number;
10
+ }
11
+ export interface EvalSuiteBaseline {
12
+ mode: "previous" | "none";
13
+ report_path?: string;
14
+ }
15
+ export interface EvalTaskAssertions {
16
+ expect_success: boolean;
17
+ expect_exit_code?: number;
18
+ expect_patch_apply?: boolean;
19
+ expect_verification?: EvalVerificationExpectation;
20
+ max_latency_ms?: number;
21
+ max_cost_usd?: number;
22
+ allow_hallucination: boolean;
23
+ allow_scope_violation: boolean;
24
+ }
25
+ export interface EvalTaskDefinition {
26
+ id: string;
27
+ title: string;
28
+ description?: string;
29
+ mode: "success" | "failure";
30
+ command: EvalCommandName;
31
+ task_file?: string;
32
+ inline_task?: string;
33
+ args: string[];
34
+ assertions: EvalTaskAssertions;
35
+ }
36
+ export interface EvalSuiteDefinition {
37
+ schema_version: 1;
38
+ suite_id: string;
39
+ name: string;
40
+ description?: string;
41
+ thresholds?: Partial<EvalGateThresholds>;
42
+ baseline?: EvalSuiteBaseline;
43
+ tasks: EvalTaskDefinition[];
44
+ }
45
+ export interface SuiteValidationIssue {
46
+ path: string;
47
+ code: string;
48
+ message: string;
49
+ }
50
+ export declare class SuiteValidationError extends Error {
51
+ readonly issues: SuiteValidationIssue[];
52
+ constructor(message: string, issues: SuiteValidationIssue[]);
53
+ }
54
+ export declare const normalizeSuiteDefinition: (raw: unknown, label?: string) => EvalSuiteDefinition;
55
+ export declare const stableJsonStringify: (value: unknown) => string;
56
+ //# sourceMappingURL=SuiteSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SuiteSchema.d.ts","sourceRoot":"","sources":["../../src/eval/SuiteSchema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,sDAAuD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,8BAA8B,kFAKjC,CAAC;AACX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1F,MAAM,WAAW,kBAAkB;IACjC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,0BAA0B,EAAE,MAAM,CAAC;IACnC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,wBAAwB,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,2BAA2B,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,UAAU,EAAE,kBAAkB,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,CAAC,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC;gBAE5B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,EAAE;CAK5D;AAsUD,eAAO,MAAM,wBAAwB,GAAI,KAAK,OAAO,EAAE,cAAe,KAAG,mBAyExE,CAAC;AAYF,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,MAClB,CAAC"}
@@ -0,0 +1,357 @@
1
+ export const EVAL_COMMANDS = ["run", "fix", "review", "explain", "test"];
2
+ export const EVAL_VERIFICATION_EXPECTATIONS = [
3
+ "verified_passed",
4
+ "verified_failed",
5
+ "unverified_with_reason",
6
+ "any",
7
+ ];
8
+ export class SuiteValidationError extends Error {
9
+ constructor(message, issues) {
10
+ super(message);
11
+ this.name = "SuiteValidationError";
12
+ this.issues = issues;
13
+ }
14
+ }
15
+ const asRecord = (value) => {
16
+ if (!value || typeof value !== "object" || Array.isArray(value))
17
+ return undefined;
18
+ return value;
19
+ };
20
+ const readAliased = (source, aliases) => {
21
+ for (const alias of aliases) {
22
+ if (Object.prototype.hasOwnProperty.call(source, alias))
23
+ return source[alias];
24
+ }
25
+ return undefined;
26
+ };
27
+ const readString = (source, aliases) => {
28
+ const value = readAliased(source, aliases);
29
+ if (typeof value !== "string")
30
+ return undefined;
31
+ const normalized = value.trim();
32
+ return normalized.length ? normalized : undefined;
33
+ };
34
+ const readBoolean = (source, aliases) => {
35
+ const value = readAliased(source, aliases);
36
+ return typeof value === "boolean" ? value : undefined;
37
+ };
38
+ const readNumber = (source, aliases) => {
39
+ const value = readAliased(source, aliases);
40
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
41
+ };
42
+ const readInteger = (source, aliases) => {
43
+ const value = readNumber(source, aliases);
44
+ return value !== undefined && Number.isInteger(value) ? value : undefined;
45
+ };
46
+ const normalizeRateField = (source, aliases, issues, pathLabel) => {
47
+ const value = readNumber(source, aliases);
48
+ if (value === undefined)
49
+ return undefined;
50
+ if (value < 0 || value > 1) {
51
+ issues.push({
52
+ path: pathLabel,
53
+ code: "invalid_rate_range",
54
+ message: "Expected a number between 0 and 1.",
55
+ });
56
+ return undefined;
57
+ }
58
+ return value;
59
+ };
60
+ const normalizeVerificationExpectation = (source, issues, pathLabel) => {
61
+ const value = readString(source, ["expect_verification", "expectVerification"]);
62
+ if (!value)
63
+ return undefined;
64
+ if (EVAL_VERIFICATION_EXPECTATIONS.includes(value)) {
65
+ return value;
66
+ }
67
+ if (["verified_passed", "verified_failed", "unverified_with_reason"].includes(value)) {
68
+ return value;
69
+ }
70
+ issues.push({
71
+ path: pathLabel,
72
+ code: "invalid_verification_expectation",
73
+ message: `Expected one of: ${EVAL_VERIFICATION_EXPECTATIONS.join(", ")}.`,
74
+ });
75
+ return undefined;
76
+ };
77
+ const normalizeTaskAssertions = (rawValue, taskPath, taskMode, issues) => {
78
+ const source = asRecord(rawValue) ?? {};
79
+ if (!asRecord(rawValue) && rawValue !== undefined) {
80
+ issues.push({
81
+ path: `${taskPath}.assertions`,
82
+ code: "invalid_object",
83
+ message: "Expected an object for assertions.",
84
+ });
85
+ }
86
+ const expectSuccess = readBoolean(source, ["expect_success", "expectSuccess"]) ?? (taskMode !== "failure");
87
+ const explicitExitCode = readInteger(source, ["expect_exit_code", "expectExitCode"]);
88
+ const expectExitCode = explicitExitCode ?? (expectSuccess ? 0 : undefined);
89
+ if (explicitExitCode !== undefined && explicitExitCode < 0) {
90
+ issues.push({
91
+ path: `${taskPath}.assertions.expect_exit_code`,
92
+ code: "invalid_exit_code",
93
+ message: "Expected a non-negative integer.",
94
+ });
95
+ }
96
+ const maxLatencyMs = readNumber(source, ["max_latency_ms", "maxLatencyMs"]);
97
+ if (maxLatencyMs !== undefined && maxLatencyMs <= 0) {
98
+ issues.push({
99
+ path: `${taskPath}.assertions.max_latency_ms`,
100
+ code: "invalid_latency",
101
+ message: "Expected max latency to be greater than 0.",
102
+ });
103
+ }
104
+ const maxCostUsd = readNumber(source, ["max_cost_usd", "maxCostUsd"]);
105
+ if (maxCostUsd !== undefined && maxCostUsd < 0) {
106
+ issues.push({
107
+ path: `${taskPath}.assertions.max_cost_usd`,
108
+ code: "invalid_cost",
109
+ message: "Expected max cost to be greater than or equal to 0.",
110
+ });
111
+ }
112
+ return {
113
+ expect_success: expectSuccess,
114
+ expect_exit_code: expectExitCode,
115
+ expect_patch_apply: readBoolean(source, ["expect_patch_apply", "expectPatchApply"]),
116
+ expect_verification: normalizeVerificationExpectation(source, issues, `${taskPath}.assertions.expect_verification`),
117
+ max_latency_ms: maxLatencyMs !== undefined && maxLatencyMs > 0 ? maxLatencyMs : undefined,
118
+ max_cost_usd: maxCostUsd !== undefined && maxCostUsd >= 0 ? maxCostUsd : undefined,
119
+ allow_hallucination: readBoolean(source, ["allow_hallucination", "allowHallucination"]) ?? false,
120
+ allow_scope_violation: readBoolean(source, ["allow_scope_violation", "allowScopeViolation"]) ?? false,
121
+ };
122
+ };
123
+ const normalizeTask = (value, index, issues) => {
124
+ const taskPath = `tasks[${index}]`;
125
+ const source = asRecord(value);
126
+ if (!source) {
127
+ issues.push({
128
+ path: taskPath,
129
+ code: "invalid_object",
130
+ message: "Expected task to be an object.",
131
+ });
132
+ }
133
+ const taskSource = source ?? {};
134
+ const id = readString(taskSource, ["id"]) ?? `task-${index + 1}`;
135
+ if (!readString(taskSource, ["id"])) {
136
+ issues.push({
137
+ path: `${taskPath}.id`,
138
+ code: "missing_required",
139
+ message: "Task id is required.",
140
+ });
141
+ }
142
+ const title = readString(taskSource, ["title"]) ?? id;
143
+ const modeValue = readString(taskSource, ["mode"]);
144
+ const mode = modeValue === "success" || modeValue === "failure"
145
+ ? modeValue
146
+ : (readBoolean(asRecord(readAliased(taskSource, ["assertions"])) ?? {}, ["expect_success", "expectSuccess"])
147
+ === false
148
+ ? "failure"
149
+ : "success");
150
+ if (modeValue && modeValue !== "success" && modeValue !== "failure") {
151
+ issues.push({
152
+ path: `${taskPath}.mode`,
153
+ code: "invalid_mode",
154
+ message: "Expected task mode to be success|failure.",
155
+ });
156
+ }
157
+ const commandValue = readString(taskSource, ["command"]);
158
+ const command = commandValue && EVAL_COMMANDS.includes(commandValue)
159
+ ? commandValue
160
+ : "run";
161
+ if (commandValue && !EVAL_COMMANDS.includes(commandValue)) {
162
+ issues.push({
163
+ path: `${taskPath}.command`,
164
+ code: "invalid_command",
165
+ message: `Expected command to be one of: ${EVAL_COMMANDS.join(", ")}.`,
166
+ });
167
+ }
168
+ const taskFile = readString(taskSource, ["task_file", "taskFile"]);
169
+ const inlineTask = readString(taskSource, ["inline_task", "inlineTask"]);
170
+ if (!taskFile && !inlineTask) {
171
+ issues.push({
172
+ path: taskPath,
173
+ code: "missing_task_input",
174
+ message: "Expected exactly one of task_file or inline_task.",
175
+ });
176
+ }
177
+ if (taskFile && inlineTask) {
178
+ issues.push({
179
+ path: taskPath,
180
+ code: "ambiguous_task_input",
181
+ message: "Provide only one of task_file or inline_task.",
182
+ });
183
+ }
184
+ const argsValue = readAliased(taskSource, ["args"]);
185
+ const args = [];
186
+ if (Array.isArray(argsValue)) {
187
+ for (let argIndex = 0; argIndex < argsValue.length; argIndex += 1) {
188
+ const entry = argsValue[argIndex];
189
+ if (typeof entry !== "string") {
190
+ issues.push({
191
+ path: `${taskPath}.args[${argIndex}]`,
192
+ code: "invalid_arg",
193
+ message: "Expected every task arg to be a string.",
194
+ });
195
+ continue;
196
+ }
197
+ const normalized = entry.trim();
198
+ if (normalized)
199
+ args.push(normalized);
200
+ }
201
+ }
202
+ else if (argsValue !== undefined) {
203
+ issues.push({
204
+ path: `${taskPath}.args`,
205
+ code: "invalid_args",
206
+ message: "Expected args to be an array of strings.",
207
+ });
208
+ }
209
+ return {
210
+ id,
211
+ title,
212
+ description: readString(taskSource, ["description"]),
213
+ mode,
214
+ command,
215
+ task_file: taskFile,
216
+ inline_task: inlineTask,
217
+ args,
218
+ assertions: normalizeTaskAssertions(readAliased(taskSource, ["assertions"]), taskPath, mode, issues),
219
+ };
220
+ };
221
+ const normalizeThresholds = (value, issues) => {
222
+ if (value === undefined)
223
+ return undefined;
224
+ const source = asRecord(value);
225
+ if (!source) {
226
+ issues.push({
227
+ path: "thresholds",
228
+ code: "invalid_object",
229
+ message: "Expected thresholds to be an object.",
230
+ });
231
+ return undefined;
232
+ }
233
+ const thresholds = {};
234
+ const patchApplyDropMax = normalizeRateField(source, ["patch_apply_drop_max", "patchApplyDropMax"], issues, "thresholds.patch_apply_drop_max");
235
+ if (patchApplyDropMax !== undefined)
236
+ thresholds.patch_apply_drop_max = patchApplyDropMax;
237
+ const verificationPassRateMin = normalizeRateField(source, ["verification_pass_rate_min", "verificationPassRateMin"], issues, "thresholds.verification_pass_rate_min");
238
+ if (verificationPassRateMin !== undefined) {
239
+ thresholds.verification_pass_rate_min = verificationPassRateMin;
240
+ }
241
+ const hallucinationRateMax = normalizeRateField(source, ["hallucination_rate_max", "hallucinationRateMax"], issues, "thresholds.hallucination_rate_max");
242
+ if (hallucinationRateMax !== undefined)
243
+ thresholds.hallucination_rate_max = hallucinationRateMax;
244
+ const scopeViolationRateMax = normalizeRateField(source, ["scope_violation_rate_max", "scopeViolationRateMax"], issues, "thresholds.scope_violation_rate_max");
245
+ if (scopeViolationRateMax !== undefined) {
246
+ thresholds.scope_violation_rate_max = scopeViolationRateMax;
247
+ }
248
+ return Object.keys(thresholds).length ? thresholds : undefined;
249
+ };
250
+ const normalizeBaseline = (value, issues) => {
251
+ if (value === undefined)
252
+ return undefined;
253
+ const source = asRecord(value);
254
+ if (!source) {
255
+ issues.push({
256
+ path: "baseline",
257
+ code: "invalid_object",
258
+ message: "Expected baseline to be an object.",
259
+ });
260
+ return undefined;
261
+ }
262
+ const modeValue = readString(source, ["mode"]);
263
+ let mode = "previous";
264
+ if (modeValue === "previous" || modeValue === "none") {
265
+ mode = modeValue;
266
+ }
267
+ else if (modeValue) {
268
+ issues.push({
269
+ path: "baseline.mode",
270
+ code: "invalid_baseline_mode",
271
+ message: "Expected baseline.mode to be previous|none.",
272
+ });
273
+ }
274
+ return {
275
+ mode,
276
+ report_path: readString(source, ["report_path", "reportPath"]),
277
+ };
278
+ };
279
+ export const normalizeSuiteDefinition = (raw, label = "suite") => {
280
+ const issues = [];
281
+ const source = asRecord(raw);
282
+ if (!source) {
283
+ throw new SuiteValidationError(`${label} is invalid.`, [
284
+ {
285
+ path: label,
286
+ code: "invalid_object",
287
+ message: "Expected suite root to be an object.",
288
+ },
289
+ ]);
290
+ }
291
+ const schemaVersion = readInteger(source, ["schema_version", "schemaVersion"]) ?? 1;
292
+ if (schemaVersion !== 1) {
293
+ issues.push({
294
+ path: "schema_version",
295
+ code: "unsupported_schema_version",
296
+ message: "Only schema_version=1 is supported.",
297
+ });
298
+ }
299
+ const suiteId = readString(source, ["suite_id", "suiteId"]);
300
+ if (!suiteId) {
301
+ issues.push({
302
+ path: "suite_id",
303
+ code: "missing_required",
304
+ message: "suite_id is required.",
305
+ });
306
+ }
307
+ const tasksValue = readAliased(source, ["tasks"]);
308
+ if (!Array.isArray(tasksValue) || tasksValue.length === 0) {
309
+ issues.push({
310
+ path: "tasks",
311
+ code: "missing_tasks",
312
+ message: "tasks must be a non-empty array.",
313
+ });
314
+ }
315
+ const tasksRaw = Array.isArray(tasksValue) ? tasksValue : [];
316
+ const tasks = tasksRaw.map((entry, index) => normalizeTask(entry, index, issues));
317
+ const seenTaskIds = new Set();
318
+ for (const task of tasks) {
319
+ if (seenTaskIds.has(task.id)) {
320
+ issues.push({
321
+ path: `tasks.${task.id}`,
322
+ code: "duplicate_task_id",
323
+ message: `Task id "${task.id}" is duplicated.`,
324
+ });
325
+ continue;
326
+ }
327
+ seenTaskIds.add(task.id);
328
+ }
329
+ if (issues.length > 0) {
330
+ throw new SuiteValidationError(`${label} validation failed.`, issues);
331
+ }
332
+ const normalized = {
333
+ schema_version: 1,
334
+ suite_id: suiteId ?? "unknown-suite",
335
+ name: readString(source, ["name"]) ?? (suiteId ?? "unnamed-suite"),
336
+ description: readString(source, ["description"]),
337
+ thresholds: normalizeThresholds(readAliased(source, ["thresholds"]), issues),
338
+ baseline: normalizeBaseline(readAliased(source, ["baseline"]), issues),
339
+ tasks,
340
+ };
341
+ if (issues.length > 0) {
342
+ throw new SuiteValidationError(`${label} validation failed.`, issues);
343
+ }
344
+ return normalized;
345
+ };
346
+ const stableSort = (value) => {
347
+ if (Array.isArray(value))
348
+ return value.map(stableSort);
349
+ if (!value || typeof value !== "object")
350
+ return value;
351
+ const source = value;
352
+ const sortedEntries = Object.keys(source)
353
+ .sort((left, right) => left.localeCompare(right))
354
+ .map((key) => [key, stableSort(source[key])]);
355
+ return Object.fromEntries(sortedEntries);
356
+ };
357
+ export const stableJsonStringify = (value) => JSON.stringify(stableSort(value));
@@ -0,0 +1,11 @@
1
+ export { runCli } from "./cli.js";
2
+ export { codaliEventToOpenAIChatCompletionChunk, codaliEventToOpenAISseData, createCodaliRuntime, runCodaliTask, } from "./runtime/CodaliRuntime.js";
3
+ export { loadInstructionBlocks, formatInstructionBlocks } from "./session/InstructionLoader.js";
4
+ export { SessionStore } from "./session/SessionStore.js";
5
+ export { SubagentOrchestrator } from "./subagents/SubagentOrchestrator.js";
6
+ export type { ProviderMessage, ProviderUsage, } from "./providers/ProviderTypes.js";
7
+ export type { CodaliRuntime, CodaliOpenAIChunkOptions, CodaliRuntimeAgentInput, CodaliRuntimeDocdexInput, CodaliRuntimeEvent, CodaliRuntimeInput, CodaliRuntimePolicy, CodaliRuntimeProviderInput, CodaliRuntimeSessionInput, CodaliRuntimeSubagentsInput, CodaliRuntimeResult, CodaliRuntimeWorkspace, } from "./runtime/CodaliRuntime.js";
8
+ export type { InstructionBlock, InstructionLoadOptions, } from "./session/InstructionLoader.js";
9
+ export type { CodaliResumeBundle, CodaliSessionMetadata, CodaliSessionStatus, CodaliSessionSummary, CodaliSessionTranscriptEvent, } from "./session/SessionStore.js";
10
+ export type { SubagentPermissions, SubagentResult, SubagentRole, SubagentSpec, SubagentStatus, } from "./subagents/SubagentOrchestrator.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EACL,sCAAsC,EACtC,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,GACd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,YAAY,EACV,eAAe,EACf,aAAa,GACd,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { runCli } from "./cli.js";
2
+ export { codaliEventToOpenAIChatCompletionChunk, codaliEventToOpenAISseData, createCodaliRuntime, runCodaliTask, } from "./runtime/CodaliRuntime.js";
3
+ export { loadInstructionBlocks, formatInstructionBlocks } from "./session/InstructionLoader.js";
4
+ export { SessionStore } from "./session/SessionStore.js";
5
+ export { SubagentOrchestrator } from "./subagents/SubagentOrchestrator.js";
@@ -0,0 +1,8 @@
1
+ import type { Provider, ProviderConfig, ProviderRequest, ProviderResponse } from "./ProviderTypes.js";
2
+ export declare class CodexCliProvider implements Provider {
3
+ private config;
4
+ name: string;
5
+ constructor(config: ProviderConfig);
6
+ generate(request: ProviderRequest): Promise<ProviderResponse>;
7
+ }
8
+ //# sourceMappingURL=CodexCliProvider.d.ts.map