@mcoda/mswarm 0.1.56 → 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 +20 -1
  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 +47 -1
  7. package/dist/runtime.d.ts.map +1 -1
  8. package/dist/runtime.js +248 -30
  9. package/dist/runtime.js.map +1 -1
  10. package/dist/server.d.ts.map +1 -1
  11. package/dist/server.js +83 -3
  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,192 @@
1
+ const parseToolArgs = (raw) => {
2
+ try {
3
+ return JSON.parse(raw);
4
+ }
5
+ catch {
6
+ return raw;
7
+ }
8
+ };
9
+ const normalizeBaseUrl = (baseUrl) => {
10
+ const root = baseUrl ?? "https://api.openai.com/v1";
11
+ return root.endsWith("/") ? root : `${root}/`;
12
+ };
13
+ const toResponseFormat = (format) => {
14
+ if (!format)
15
+ return undefined;
16
+ if (format.type === "json") {
17
+ return { type: "json_object" };
18
+ }
19
+ if (format.type === "json_schema") {
20
+ return { type: "json_schema", json_schema: format.schema ?? {} };
21
+ }
22
+ if (format.type === "text") {
23
+ return { type: "text" };
24
+ }
25
+ return undefined;
26
+ };
27
+ export class OpenAiCompatibleProvider {
28
+ constructor(config) {
29
+ this.config = config;
30
+ this.name = "openai-compatible";
31
+ }
32
+ async generate(request) {
33
+ const baseUrl = normalizeBaseUrl(this.config.baseUrl);
34
+ const url = new URL("chat/completions", baseUrl).toString();
35
+ const emitToken = (token) => {
36
+ if (request.onEvent) {
37
+ request.onEvent({ type: "token", content: token });
38
+ return;
39
+ }
40
+ request.onToken?.(token);
41
+ };
42
+ const headers = {
43
+ "content-type": "application/json",
44
+ };
45
+ if (this.config.apiKey) {
46
+ headers.authorization = `Bearer ${this.config.apiKey}`;
47
+ }
48
+ const body = {
49
+ model: this.config.model,
50
+ messages: request.messages.map((message) => ({
51
+ role: message.role,
52
+ content: message.content,
53
+ name: message.name,
54
+ tool_call_id: message.toolCallId,
55
+ })),
56
+ tools: request.tools?.map((tool) => ({
57
+ type: "function",
58
+ function: {
59
+ name: tool.name,
60
+ description: tool.description,
61
+ parameters: tool.inputSchema ?? {},
62
+ },
63
+ })),
64
+ tool_choice: request.toolChoice,
65
+ max_tokens: request.maxTokens,
66
+ temperature: request.temperature,
67
+ response_format: toResponseFormat(request.responseFormat),
68
+ stream: request.stream ?? false,
69
+ stream_options: request.stream ? { include_usage: true } : undefined,
70
+ };
71
+ const controller = new AbortController();
72
+ const timeoutMs = this.config.timeoutMs ?? 60000;
73
+ const timeout = setTimeout(() => controller.abort(), timeoutMs);
74
+ try {
75
+ const response = await fetch(url, {
76
+ method: "POST",
77
+ headers,
78
+ body: JSON.stringify(body),
79
+ signal: controller.signal,
80
+ });
81
+ if (!response.ok) {
82
+ const errorBody = await response.text();
83
+ throw new Error(`OpenAI-compatible error ${response.status}: ${errorBody}`);
84
+ }
85
+ if (request.stream) {
86
+ if (!response.body) {
87
+ throw new Error("OpenAI-compatible streaming response missing body");
88
+ }
89
+ const reader = response.body.getReader();
90
+ const decoder = new TextDecoder();
91
+ let buffer = "";
92
+ let content = "";
93
+ const toolCallMap = new Map();
94
+ let usage;
95
+ while (true) {
96
+ const { value, done } = await reader.read();
97
+ if (done)
98
+ break;
99
+ buffer += decoder.decode(value, { stream: true });
100
+ const lines = buffer.split("\n");
101
+ buffer = lines.pop() ?? "";
102
+ for (const line of lines) {
103
+ const trimmed = line.trim();
104
+ if (!trimmed.startsWith("data:"))
105
+ continue;
106
+ const data = trimmed.slice(5).trim();
107
+ if (!data || data === "[DONE]")
108
+ continue;
109
+ try {
110
+ const chunk = JSON.parse(data);
111
+ const delta = chunk.choices?.[0]?.delta;
112
+ if (delta?.content) {
113
+ content += delta.content;
114
+ emitToken(delta.content);
115
+ }
116
+ if (Array.isArray(delta?.tool_calls)) {
117
+ for (const call of delta.tool_calls) {
118
+ const index = call.index ?? 0;
119
+ const existing = toolCallMap.get(index) ?? {
120
+ id: call.id ?? `call_${index + 1}`,
121
+ name: "",
122
+ args: "",
123
+ };
124
+ if (call.function?.name) {
125
+ existing.name = call.function.name;
126
+ }
127
+ if (typeof call.function?.arguments === "string") {
128
+ existing.args += call.function.arguments;
129
+ }
130
+ toolCallMap.set(index, existing);
131
+ }
132
+ }
133
+ if (chunk.usage) {
134
+ usage = chunk.usage;
135
+ }
136
+ }
137
+ catch {
138
+ // ignore malformed chunks
139
+ }
140
+ }
141
+ }
142
+ const toolCalls = toolCallMap.size > 0
143
+ ? Array.from(toolCallMap.entries()).map(([index, call]) => ({
144
+ id: call.id ?? `call_${index + 1}`,
145
+ name: call.name,
146
+ args: parseToolArgs(call.args),
147
+ }))
148
+ : undefined;
149
+ return {
150
+ message: { role: "assistant", content },
151
+ toolCalls,
152
+ usage: usage
153
+ ? {
154
+ inputTokens: usage.prompt_tokens,
155
+ outputTokens: usage.completion_tokens,
156
+ totalTokens: usage.total_tokens,
157
+ }
158
+ : undefined,
159
+ raw: { stream: true },
160
+ };
161
+ }
162
+ const raw = (await response.json());
163
+ const choice = raw.choices[0]?.message;
164
+ if (!choice) {
165
+ throw new Error("OpenAI-compatible response missing choices");
166
+ }
167
+ const toolCalls = choice.tool_calls?.map((call) => ({
168
+ id: call.id,
169
+ name: call.function.name,
170
+ args: parseToolArgs(call.function.arguments),
171
+ }));
172
+ return {
173
+ message: {
174
+ role: "assistant",
175
+ content: choice.content ?? "",
176
+ },
177
+ toolCalls,
178
+ usage: raw.usage
179
+ ? {
180
+ inputTokens: raw.usage.prompt_tokens,
181
+ outputTokens: raw.usage.completion_tokens,
182
+ totalTokens: raw.usage.total_tokens,
183
+ }
184
+ : undefined,
185
+ raw,
186
+ };
187
+ }
188
+ finally {
189
+ clearTimeout(timeout);
190
+ }
191
+ }
192
+ }
@@ -0,0 +1,12 @@
1
+ import type { Provider, ProviderConfig } from "./ProviderTypes.js";
2
+ export type ProviderFactory = (config: ProviderConfig) => Provider;
3
+ export declare class ProviderRegistry {
4
+ private factories;
5
+ register(name: string, factory: ProviderFactory): void;
6
+ create(name: string, config: ProviderConfig): Provider;
7
+ list(): string[];
8
+ }
9
+ export declare const defaultProviderRegistry: ProviderRegistry;
10
+ export declare const registerProvider: (name: string, factory: ProviderFactory) => void;
11
+ export declare const createProvider: (name: string, config: ProviderConfig) => Provider;
12
+ //# sourceMappingURL=ProviderRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderRegistry.d.ts","sourceRoot":"","sources":["../../src/providers/ProviderRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,QAAQ,CAAC;AAEnE,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAsC;IAEvD,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI;IAOtD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,QAAQ;IAQtD,IAAI,IAAI,MAAM,EAAE;CAGjB;AAED,eAAO,MAAM,uBAAuB,kBAAyB,CAAC;AAE9D,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,SAAS,eAAe,KAAG,IAEzE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,cAAc,KAAG,QAErE,CAAC"}
@@ -0,0 +1,28 @@
1
+ export class ProviderRegistry {
2
+ constructor() {
3
+ this.factories = new Map();
4
+ }
5
+ register(name, factory) {
6
+ if (this.factories.has(name)) {
7
+ throw new Error(`Provider already registered: ${name}`);
8
+ }
9
+ this.factories.set(name, factory);
10
+ }
11
+ create(name, config) {
12
+ const factory = this.factories.get(name);
13
+ if (!factory) {
14
+ throw new Error(`Unknown provider: ${name}`);
15
+ }
16
+ return factory(config);
17
+ }
18
+ list() {
19
+ return Array.from(this.factories.keys());
20
+ }
21
+ }
22
+ export const defaultProviderRegistry = new ProviderRegistry();
23
+ export const registerProvider = (name, factory) => {
24
+ defaultProviderRegistry.register(name, factory);
25
+ };
26
+ export const createProvider = (name, config) => {
27
+ return defaultProviderRegistry.create(name, config);
28
+ };
@@ -0,0 +1,81 @@
1
+ export type ProviderRole = "system" | "user" | "assistant" | "tool";
2
+ export interface ProviderToolDefinition {
3
+ name: string;
4
+ description?: string;
5
+ inputSchema?: Record<string, unknown>;
6
+ }
7
+ export interface ProviderToolCall {
8
+ id: string;
9
+ name: string;
10
+ args: unknown;
11
+ }
12
+ export type AgentStatusPhase = "thinking" | "executing" | "patching" | "done";
13
+ export type AgentEvent = {
14
+ type: "token";
15
+ content: string;
16
+ } | {
17
+ type: "tool_call";
18
+ name: string;
19
+ args: unknown;
20
+ } | {
21
+ type: "tool_result";
22
+ name: string;
23
+ output: string;
24
+ ok?: boolean;
25
+ errorCode?: string;
26
+ retryable?: boolean;
27
+ } | {
28
+ type: "status";
29
+ phase: AgentStatusPhase;
30
+ message?: string;
31
+ } | {
32
+ type: "error";
33
+ message: string;
34
+ };
35
+ export interface ProviderResponseFormat {
36
+ type: "json" | "json_schema" | "text" | "gbnf";
37
+ schema?: Record<string, unknown>;
38
+ grammar?: string;
39
+ }
40
+ export interface ProviderMessage {
41
+ role: ProviderRole;
42
+ content: string;
43
+ name?: string;
44
+ toolCallId?: string;
45
+ }
46
+ export interface ProviderUsage {
47
+ inputTokens?: number;
48
+ outputTokens?: number;
49
+ totalTokens?: number;
50
+ }
51
+ export interface ProviderRequest {
52
+ messages: ProviderMessage[];
53
+ tools?: ProviderToolDefinition[];
54
+ toolChoice?: "auto" | "none" | {
55
+ name: string;
56
+ };
57
+ maxTokens?: number;
58
+ temperature?: number;
59
+ responseFormat?: ProviderResponseFormat;
60
+ stream?: boolean;
61
+ onEvent?: (event: AgentEvent) => void;
62
+ onToken?: (token: string) => void;
63
+ streamFlushMs?: number;
64
+ }
65
+ export interface ProviderResponse {
66
+ message: ProviderMessage;
67
+ toolCalls?: ProviderToolCall[];
68
+ usage?: ProviderUsage;
69
+ raw?: unknown;
70
+ }
71
+ export interface ProviderConfig {
72
+ model: string;
73
+ apiKey?: string;
74
+ baseUrl?: string;
75
+ timeoutMs?: number;
76
+ }
77
+ export interface Provider {
78
+ name: string;
79
+ generate(request: ProviderRequest): Promise<ProviderResponse>;
80
+ }
81
+ //# sourceMappingURL=ProviderTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProviderTypes.d.ts","sourceRoot":"","sources":["../../src/providers/ProviderTypes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAEpE,MAAM,WAAW,sBAAsB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
@@ -0,0 +1,183 @@
1
+ import type { AgentStatusPhase, Provider, ProviderMessage, ProviderUsage } from "../providers/ProviderTypes.js";
2
+ import { ToolRegistry } from "../tools/ToolRegistry.js";
3
+ import type { ToolContext, ToolDefinition } from "../tools/ToolTypes.js";
4
+ import type { RunLogger } from "./RunLogger.js";
5
+ export interface CodaliRuntimeWorkspace {
6
+ root: string;
7
+ readOnly?: boolean;
8
+ }
9
+ export interface CodaliRuntimeProviderInput {
10
+ name: "openai-compatible" | "ollama-remote" | "codex-cli" | string;
11
+ model: string;
12
+ baseUrl?: string;
13
+ apiKey?: string;
14
+ timeoutMs?: number;
15
+ }
16
+ export interface CodaliRuntimeDocdexInput {
17
+ baseUrl?: string;
18
+ repoRoot?: string;
19
+ repoId?: string;
20
+ dagSessionId?: string;
21
+ initialize?: boolean;
22
+ allowWeb?: boolean;
23
+ allowMemoryWrite?: boolean;
24
+ allowProfileWrite?: boolean;
25
+ allowIndexRebuild?: boolean;
26
+ }
27
+ export interface CodaliRuntimeAgentInput {
28
+ slug: string;
29
+ adapter: string;
30
+ provider?: string;
31
+ model: string;
32
+ baseUrl?: string;
33
+ supportsTools?: boolean;
34
+ capabilities?: string[];
35
+ contextWindow?: number;
36
+ maxOutputTokens?: number;
37
+ }
38
+ export interface CodaliRuntimePolicy {
39
+ allowWrites: boolean;
40
+ allowShell: boolean;
41
+ allowDestructiveOperations: boolean;
42
+ allowOutsideWorkspace: boolean;
43
+ allowedTools?: string[];
44
+ deniedTools?: string[];
45
+ maxSteps: number;
46
+ maxToolCalls: number;
47
+ maxTokens?: number;
48
+ timeoutMs: number;
49
+ mode: "tool_loop" | "protocol_loop" | "smart_pipeline" | "patch_json" | "freeform";
50
+ }
51
+ export interface CodaliRuntimeSubagentsInput {
52
+ enabled?: boolean;
53
+ maxParallel?: number;
54
+ maxSubagents?: number;
55
+ defaultTimeoutMs?: number;
56
+ allowWrites?: boolean;
57
+ defaultTools?: string[];
58
+ }
59
+ export interface CodaliRuntimeSessionInput {
60
+ id?: string;
61
+ storageDir?: string;
62
+ resume?: boolean;
63
+ compactOnFinish?: boolean;
64
+ loadInstructions?: boolean;
65
+ includeLocalInstructions?: boolean;
66
+ focusPaths?: string[];
67
+ }
68
+ export type CodaliRuntimeEvent = {
69
+ type: "status";
70
+ phase: AgentStatusPhase;
71
+ message?: string;
72
+ at: string;
73
+ } | {
74
+ type: "token";
75
+ content: string;
76
+ at: string;
77
+ } | {
78
+ type: "tool_call";
79
+ id: string;
80
+ name: string;
81
+ args: unknown;
82
+ at: string;
83
+ } | {
84
+ type: "tool_result";
85
+ id: string;
86
+ name: string;
87
+ ok: boolean;
88
+ output: string;
89
+ errorCode?: string;
90
+ retryable?: boolean;
91
+ at: string;
92
+ } | {
93
+ type: "usage";
94
+ usage: ProviderUsage;
95
+ at: string;
96
+ } | {
97
+ type: "subagent_start";
98
+ id: string;
99
+ role: string;
100
+ goal: string;
101
+ at: string;
102
+ } | {
103
+ type: "subagent_result";
104
+ id: string;
105
+ role: string;
106
+ status: string;
107
+ summary: string;
108
+ at: string;
109
+ } | {
110
+ type: "final";
111
+ content: string;
112
+ at: string;
113
+ } | {
114
+ type: "error";
115
+ message: string;
116
+ code?: string;
117
+ retryable?: boolean;
118
+ at: string;
119
+ };
120
+ export interface CodaliRuntimeInput {
121
+ task: string;
122
+ messages?: ProviderMessage[];
123
+ workspace: CodaliRuntimeWorkspace;
124
+ provider: CodaliRuntimeProviderInput;
125
+ agent?: CodaliRuntimeAgentInput;
126
+ docdex?: CodaliRuntimeDocdexInput;
127
+ policy: CodaliRuntimePolicy;
128
+ response?: {
129
+ format?: "text" | "json" | "json_schema" | "gbnf";
130
+ schema?: Record<string, unknown>;
131
+ grammar?: string;
132
+ };
133
+ streaming?: {
134
+ enabled: boolean;
135
+ flushEveryMs?: number;
136
+ };
137
+ metadata?: {
138
+ jobId?: string;
139
+ requestId?: string;
140
+ tenantId?: string;
141
+ ownerUserId?: string;
142
+ apiKeyId?: string;
143
+ agentSlug?: string;
144
+ };
145
+ subagents?: CodaliRuntimeSubagentsInput;
146
+ session?: CodaliRuntimeSessionInput;
147
+ onEvent?: (event: CodaliRuntimeEvent) => void | Promise<void>;
148
+ providerInstance?: Provider;
149
+ toolRegistry?: ToolRegistry;
150
+ tools?: ToolDefinition[];
151
+ toolContext?: Partial<ToolContext>;
152
+ logger?: RunLogger;
153
+ }
154
+ export interface CodaliOpenAIChunkOptions {
155
+ id?: string;
156
+ requestId?: string;
157
+ model: string;
158
+ created?: number;
159
+ includeInternalEvents?: boolean;
160
+ }
161
+ export interface CodaliRuntimeResult {
162
+ finalMessage: string;
163
+ messages: ProviderMessage[];
164
+ toolCallsExecuted: number;
165
+ usage?: ProviderUsage;
166
+ touchedFiles: string[];
167
+ warnings: string[];
168
+ events: CodaliRuntimeEvent[];
169
+ runId: string;
170
+ session?: {
171
+ id: string;
172
+ summaryRefs: string[];
173
+ instructionSources: string[];
174
+ };
175
+ }
176
+ export declare const codaliEventToOpenAIChatCompletionChunk: (event: CodaliRuntimeEvent, options: CodaliOpenAIChunkOptions) => Record<string, unknown> | null;
177
+ export declare const codaliEventToOpenAISseData: (event: CodaliRuntimeEvent, options: CodaliOpenAIChunkOptions) => string | null;
178
+ export interface CodaliRuntime {
179
+ run(): Promise<CodaliRuntimeResult>;
180
+ }
181
+ export declare const createCodaliRuntime: (input: CodaliRuntimeInput) => CodaliRuntime;
182
+ export declare const runCodaliTask: (input: CodaliRuntimeInput) => Promise<CodaliRuntimeResult>;
183
+ //# sourceMappingURL=CodaliRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CodaliRuntime.d.ts","sourceRoot":"","sources":["../../src/runtime/CodaliRuntime.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,gBAAgB,EAChB,QAAQ,EAER,eAAe,EAEf,aAAa,EACd,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,KAAK,EAAE,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