@mcoda/mswarm 0.1.135-codali.2 → 0.1.135-codali.32

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 (339) hide show
  1. package/README.md +5 -0
  2. package/dist/codali-executor.d.ts +19 -0
  3. package/dist/codali-executor.d.ts.map +1 -1
  4. package/dist/codali-executor.js +54 -2
  5. package/dist/codali-executor.js.map +1 -1
  6. package/dist/runtime.d.ts +3 -0
  7. package/dist/runtime.d.ts.map +1 -1
  8. package/dist/runtime.js +13 -5
  9. package/dist/runtime.js.map +1 -1
  10. package/dist/vendor/codali/cli/TerminalArtifacts.d.ts +5 -0
  11. package/dist/vendor/codali/cli/TerminalArtifacts.d.ts.map +1 -0
  12. package/dist/vendor/codali/cli/TerminalArtifacts.js +26 -0
  13. package/dist/vendor/codali/cli/TerminalCommand.d.ts +2 -1
  14. package/dist/vendor/codali/cli/TerminalCommand.d.ts.map +1 -1
  15. package/dist/vendor/codali/cli/TerminalCommand.js +436 -100
  16. package/dist/vendor/codali/cli/TerminalCredentials.js +2 -2
  17. package/dist/vendor/codali/cli/TerminalInput.d.ts +13 -0
  18. package/dist/vendor/codali/cli/TerminalInput.d.ts.map +1 -1
  19. package/dist/vendor/codali/cli/TerminalInput.js +55 -7
  20. package/dist/vendor/codali/cli/TerminalModels.d.ts +6 -0
  21. package/dist/vendor/codali/cli/TerminalModels.d.ts.map +1 -0
  22. package/dist/vendor/codali/cli/TerminalModels.js +45 -0
  23. package/dist/vendor/codali/cli/TerminalPlan.d.ts +40 -0
  24. package/dist/vendor/codali/cli/TerminalPlan.d.ts.map +1 -0
  25. package/dist/vendor/codali/cli/TerminalPlan.js +37 -0
  26. package/dist/vendor/codali/cli/ToolsCommand.d.ts.map +1 -1
  27. package/dist/vendor/codali/cli/ToolsCommand.js +8 -1
  28. package/dist/vendor/codali/cli/tui/TerminalCells.d.ts +6 -0
  29. package/dist/vendor/codali/cli/tui/TerminalCells.d.ts.map +1 -0
  30. package/dist/vendor/codali/cli/tui/TerminalCells.js +47 -0
  31. package/dist/vendor/codali/cli/tui/TerminalEditor.d.ts +22 -0
  32. package/dist/vendor/codali/cli/tui/TerminalEditor.d.ts.map +1 -0
  33. package/dist/vendor/codali/cli/tui/TerminalEditor.js +88 -0
  34. package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts +6 -0
  35. package/dist/vendor/codali/cli/tui/TerminalLogo.d.ts.map +1 -0
  36. package/dist/vendor/codali/cli/tui/TerminalLogo.js +26 -0
  37. package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts +5 -0
  38. package/dist/vendor/codali/cli/tui/TerminalMarkdown.d.ts.map +1 -0
  39. package/dist/vendor/codali/cli/tui/TerminalMarkdown.js +118 -0
  40. package/dist/vendor/codali/cli/tui/TerminalPresentation.d.ts +6 -0
  41. package/dist/vendor/codali/cli/tui/TerminalPresentation.d.ts.map +1 -0
  42. package/dist/vendor/codali/cli/tui/TerminalPresentation.js +152 -0
  43. package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts +50 -0
  44. package/dist/vendor/codali/cli/tui/TerminalScreen.d.ts.map +1 -0
  45. package/dist/vendor/codali/cli/tui/TerminalScreen.js +137 -0
  46. package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts +15 -0
  47. package/dist/vendor/codali/cli/tui/TerminalSelection.d.ts.map +1 -0
  48. package/dist/vendor/codali/cli/tui/TerminalSelection.js +38 -0
  49. package/dist/vendor/codali/cli/tui/TerminalTui.d.ts +82 -0
  50. package/dist/vendor/codali/cli/tui/TerminalTui.d.ts.map +1 -0
  51. package/dist/vendor/codali/cli/tui/TerminalTui.js +564 -0
  52. package/dist/vendor/codali/cli.d.ts.map +1 -1
  53. package/dist/vendor/codali/cli.js +5 -3
  54. package/dist/vendor/codali/config/OrchestrationConfig.d.ts +40 -0
  55. package/dist/vendor/codali/config/OrchestrationConfig.d.ts.map +1 -1
  56. package/dist/vendor/codali/config/OrchestrationConfig.js +74 -3
  57. package/dist/vendor/codali/connectors/media/MediaJobStore.d.ts +2 -1
  58. package/dist/vendor/codali/connectors/media/MediaJobStore.d.ts.map +1 -1
  59. package/dist/vendor/codali/connectors/media/MediaJobStore.js +11 -3
  60. package/dist/vendor/codali/docdex/DocdexCatalog.d.ts +12 -0
  61. package/dist/vendor/codali/docdex/DocdexCatalog.d.ts.map +1 -0
  62. package/dist/vendor/codali/docdex/DocdexCatalog.js +30 -0
  63. package/dist/vendor/codali/docdex/DocdexClient.d.ts +9 -2
  64. package/dist/vendor/codali/docdex/DocdexClient.d.ts.map +1 -1
  65. package/dist/vendor/codali/docdex/DocdexClient.js +86 -11
  66. package/dist/vendor/codali/docdex/ManagedDocdex.d.ts +4 -0
  67. package/dist/vendor/codali/docdex/ManagedDocdex.d.ts.map +1 -1
  68. package/dist/vendor/codali/docdex/ManagedDocdex.js +42 -5
  69. package/dist/vendor/codali/eval/TerminalWorkflowCorpus.d.ts +1 -1
  70. package/dist/vendor/codali/eval/TerminalWorkflowCorpus.d.ts.map +1 -1
  71. package/dist/vendor/codali/eval/TerminalWorkflowCorpus.js +9 -6
  72. package/dist/vendor/codali/eval/TrustBenchmark.d.ts +94 -0
  73. package/dist/vendor/codali/eval/TrustBenchmark.d.ts.map +1 -0
  74. package/dist/vendor/codali/eval/TrustBenchmark.js +199 -0
  75. package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts +4 -0
  76. package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.d.ts.map +1 -0
  77. package/dist/vendor/codali/eval/fixtures/ContractReviewProvider.js +10 -0
  78. package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.d.ts +6 -0
  79. package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.d.ts.map +1 -0
  80. package/dist/vendor/codali/eval/fixtures/MixedMediaRecoveryJourney.js +145 -0
  81. package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.d.ts.map +1 -1
  82. package/dist/vendor/codali/eval/fixtures/TerminalRecoveryJourney.js +14 -1
  83. package/dist/vendor/codali/gateway/GroundingMode.d.ts.map +1 -1
  84. package/dist/vendor/codali/gateway/GroundingMode.js +23 -3
  85. package/dist/vendor/codali/index.d.ts +1 -0
  86. package/dist/vendor/codali/index.d.ts.map +1 -1
  87. package/dist/vendor/codali/index.js +1 -0
  88. package/dist/vendor/codali/permissions/PermissionGate.d.ts +1 -1
  89. package/dist/vendor/codali/permissions/PermissionGate.d.ts.map +1 -1
  90. package/dist/vendor/codali/permissions/PermissionGate.js +45 -5
  91. package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts +11 -0
  92. package/dist/vendor/codali/permissions/WorkspacePermissions.d.ts.map +1 -0
  93. package/dist/vendor/codali/permissions/WorkspacePermissions.js +42 -0
  94. package/dist/vendor/codali/providers/ConfiguredModelScope.d.ts +1 -0
  95. package/dist/vendor/codali/providers/ConfiguredModelScope.d.ts.map +1 -1
  96. package/dist/vendor/codali/providers/ConfiguredModelScope.js +19 -2
  97. package/dist/vendor/codali/providers/ConfiguredProvider.d.ts +6 -0
  98. package/dist/vendor/codali/providers/ConfiguredProvider.d.ts.map +1 -1
  99. package/dist/vendor/codali/providers/ConfiguredProvider.js +88 -34
  100. package/dist/vendor/codali/providers/ModelCapacityWait.d.ts +21 -0
  101. package/dist/vendor/codali/providers/ModelCapacityWait.d.ts.map +1 -0
  102. package/dist/vendor/codali/providers/ModelCapacityWait.js +40 -0
  103. package/dist/vendor/codali/providers/ModelServiceError.d.ts +16 -2
  104. package/dist/vendor/codali/providers/ModelServiceError.d.ts.map +1 -1
  105. package/dist/vendor/codali/providers/ModelServiceError.js +37 -5
  106. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.d.ts.map +1 -1
  107. package/dist/vendor/codali/providers/OpenAiCompatibleProvider.js +26 -3
  108. package/dist/vendor/codali/providers/ProviderTypes.d.ts +6 -0
  109. package/dist/vendor/codali/providers/ProviderTypes.d.ts.map +1 -1
  110. package/dist/vendor/codali/providers/RequestSize.d.ts +5 -0
  111. package/dist/vendor/codali/providers/RequestSize.d.ts.map +1 -0
  112. package/dist/vendor/codali/providers/RequestSize.js +10 -0
  113. package/dist/vendor/codali/providers/RequestUsage.d.ts +11 -0
  114. package/dist/vendor/codali/providers/RequestUsage.d.ts.map +1 -0
  115. package/dist/vendor/codali/providers/RequestUsage.js +33 -0
  116. package/dist/vendor/codali/runtime/AnswerVerification.d.ts +17 -0
  117. package/dist/vendor/codali/runtime/AnswerVerification.d.ts.map +1 -0
  118. package/dist/vendor/codali/runtime/AnswerVerification.js +39 -0
  119. package/dist/vendor/codali/runtime/CodaliRuntime.d.ts +1 -0
  120. package/dist/vendor/codali/runtime/CodaliRuntime.d.ts.map +1 -1
  121. package/dist/vendor/codali/runtime/CodaliRuntime.js +1 -0
  122. package/dist/vendor/codali/runtime/CompletionReport.d.ts +2 -0
  123. package/dist/vendor/codali/runtime/CompletionReport.d.ts.map +1 -1
  124. package/dist/vendor/codali/runtime/CompletionReport.js +17 -0
  125. package/dist/vendor/codali/runtime/ComputedAnswer.d.ts +13 -0
  126. package/dist/vendor/codali/runtime/ComputedAnswer.d.ts.map +1 -0
  127. package/dist/vendor/codali/runtime/ComputedAnswer.js +75 -0
  128. package/dist/vendor/codali/runtime/ContextCompression.d.ts +38 -0
  129. package/dist/vendor/codali/runtime/ContextCompression.d.ts.map +1 -0
  130. package/dist/vendor/codali/runtime/ContextCompression.js +263 -0
  131. package/dist/vendor/codali/runtime/GatewayRequest.d.ts +5 -0
  132. package/dist/vendor/codali/runtime/GatewayRequest.d.ts.map +1 -0
  133. package/dist/vendor/codali/runtime/GatewayRequest.js +19 -0
  134. package/dist/vendor/codali/runtime/InspectionBudget.d.ts +11 -0
  135. package/dist/vendor/codali/runtime/InspectionBudget.d.ts.map +1 -0
  136. package/dist/vendor/codali/runtime/InspectionBudget.js +23 -0
  137. package/dist/vendor/codali/runtime/InspectionConvergence.d.ts +24 -0
  138. package/dist/vendor/codali/runtime/InspectionConvergence.d.ts.map +1 -0
  139. package/dist/vendor/codali/runtime/InspectionConvergence.js +67 -0
  140. package/dist/vendor/codali/runtime/InteractionContract.d.ts +44 -0
  141. package/dist/vendor/codali/runtime/InteractionContract.d.ts.map +1 -0
  142. package/dist/vendor/codali/runtime/InteractionContract.js +64 -0
  143. package/dist/vendor/codali/runtime/InteractionRouter.d.ts +73 -0
  144. package/dist/vendor/codali/runtime/InteractionRouter.d.ts.map +1 -0
  145. package/dist/vendor/codali/runtime/InteractionRouter.js +138 -0
  146. package/dist/vendor/codali/runtime/PlanCoverage.d.ts +9 -0
  147. package/dist/vendor/codali/runtime/PlanCoverage.d.ts.map +1 -0
  148. package/dist/vendor/codali/runtime/PlanCoverage.js +12 -0
  149. package/dist/vendor/codali/runtime/PreparedDocdex.d.ts +4 -0
  150. package/dist/vendor/codali/runtime/PreparedDocdex.d.ts.map +1 -0
  151. package/dist/vendor/codali/runtime/PreparedDocdex.js +55 -0
  152. package/dist/vendor/codali/runtime/PreparedMemory.d.ts +3 -0
  153. package/dist/vendor/codali/runtime/PreparedMemory.d.ts.map +1 -0
  154. package/dist/vendor/codali/runtime/PreparedMemory.js +30 -0
  155. package/dist/vendor/codali/runtime/ProgressTracker.d.ts +1 -0
  156. package/dist/vendor/codali/runtime/ProgressTracker.d.ts.map +1 -1
  157. package/dist/vendor/codali/runtime/ProgressTracker.js +25 -5
  158. package/dist/vendor/codali/runtime/ResearchEvidence.d.ts +19 -0
  159. package/dist/vendor/codali/runtime/ResearchEvidence.d.ts.map +1 -0
  160. package/dist/vendor/codali/runtime/ResearchEvidence.js +55 -0
  161. package/dist/vendor/codali/runtime/ReviewContract.d.ts +35 -0
  162. package/dist/vendor/codali/runtime/ReviewContract.d.ts.map +1 -0
  163. package/dist/vendor/codali/runtime/ReviewContract.js +132 -0
  164. package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts +43 -0
  165. package/dist/vendor/codali/runtime/ReviewCoordinator.d.ts.map +1 -0
  166. package/dist/vendor/codali/runtime/ReviewCoordinator.js +134 -0
  167. package/dist/vendor/codali/runtime/ReviewSource.d.ts +3 -0
  168. package/dist/vendor/codali/runtime/ReviewSource.d.ts.map +1 -1
  169. package/dist/vendor/codali/runtime/ReviewSource.js +17 -1
  170. package/dist/vendor/codali/runtime/Runner.d.ts.map +1 -1
  171. package/dist/vendor/codali/runtime/Runner.js +6 -1
  172. package/dist/vendor/codali/runtime/SessionController.d.ts +71 -5
  173. package/dist/vendor/codali/runtime/SessionController.d.ts.map +1 -1
  174. package/dist/vendor/codali/runtime/SessionController.js +1913 -223
  175. package/dist/vendor/codali/runtime/SpecialistTools.d.ts +6 -0
  176. package/dist/vendor/codali/runtime/SpecialistTools.d.ts.map +1 -0
  177. package/dist/vendor/codali/runtime/SpecialistTools.js +69 -0
  178. package/dist/vendor/codali/runtime/StructuralEvidence.d.ts +4 -2
  179. package/dist/vendor/codali/runtime/StructuralEvidence.d.ts.map +1 -1
  180. package/dist/vendor/codali/runtime/StructuralEvidence.js +22 -5
  181. package/dist/vendor/codali/runtime/TaskReview.d.ts +25 -0
  182. package/dist/vendor/codali/runtime/TaskReview.d.ts.map +1 -0
  183. package/dist/vendor/codali/runtime/TaskReview.js +109 -0
  184. package/dist/vendor/codali/runtime/TaskReviewContext.d.ts +37 -0
  185. package/dist/vendor/codali/runtime/TaskReviewContext.d.ts.map +1 -1
  186. package/dist/vendor/codali/runtime/TaskReviewContext.js +18 -2
  187. package/dist/vendor/codali/runtime/UsageReconciliation.d.ts +28 -0
  188. package/dist/vendor/codali/runtime/UsageReconciliation.d.ts.map +1 -0
  189. package/dist/vendor/codali/runtime/UsageReconciliation.js +68 -0
  190. package/dist/vendor/codali/runtime/VerificationCommand.d.ts +2 -0
  191. package/dist/vendor/codali/runtime/VerificationCommand.d.ts.map +1 -1
  192. package/dist/vendor/codali/runtime/VerificationCommand.js +28 -0
  193. package/dist/vendor/codali/runtime/VerificationReceiptSelection.d.ts +15 -0
  194. package/dist/vendor/codali/runtime/VerificationReceiptSelection.d.ts.map +1 -0
  195. package/dist/vendor/codali/runtime/VerificationReceiptSelection.js +30 -0
  196. package/dist/vendor/codali/runtime/WorkspaceLedger.d.ts +2 -0
  197. package/dist/vendor/codali/runtime/WorkspaceLedger.d.ts.map +1 -1
  198. package/dist/vendor/codali/runtime/WorkspaceLedger.js +44 -20
  199. package/dist/vendor/codali/runtime/WorkspaceLock.d.ts.map +1 -1
  200. package/dist/vendor/codali/runtime/WorkspaceLock.js +9 -1
  201. package/dist/vendor/codali/runtime/WorkspaceSnapshot.d.ts.map +1 -1
  202. package/dist/vendor/codali/runtime/WorkspaceSnapshot.js +3 -2
  203. package/dist/vendor/codali/runtime/WriteSyntaxCheck.d.ts +10 -0
  204. package/dist/vendor/codali/runtime/WriteSyntaxCheck.d.ts.map +1 -0
  205. package/dist/vendor/codali/runtime/WriteSyntaxCheck.js +34 -0
  206. package/dist/vendor/codali/session/AtomicState.d.ts.map +1 -1
  207. package/dist/vendor/codali/session/AtomicState.js +15 -1
  208. package/dist/vendor/codali/session/InstructionLoader.d.ts +5 -1
  209. package/dist/vendor/codali/session/InstructionLoader.d.ts.map +1 -1
  210. package/dist/vendor/codali/session/InstructionLoader.js +65 -19
  211. package/dist/vendor/codali/session/SessionStoragePath.d.ts.map +1 -1
  212. package/dist/vendor/codali/session/SessionStoragePath.js +34 -17
  213. package/dist/vendor/codali/session/SessionStore.d.ts +5 -1
  214. package/dist/vendor/codali/session/SessionStore.d.ts.map +1 -1
  215. package/dist/vendor/codali/session/SessionStore.js +11 -2
  216. package/dist/vendor/codali/session/SkillCatalog.d.ts +33 -0
  217. package/dist/vendor/codali/session/SkillCatalog.d.ts.map +1 -0
  218. package/dist/vendor/codali/session/SkillCatalog.js +197 -0
  219. package/dist/vendor/codali/session/WorkState.d.ts +11 -0
  220. package/dist/vendor/codali/session/WorkState.d.ts.map +1 -1
  221. package/dist/vendor/codali/session/WorkState.js +46 -2
  222. package/dist/vendor/codali/session/WorkTypes.d.ts +8 -0
  223. package/dist/vendor/codali/session/WorkTypes.d.ts.map +1 -1
  224. package/dist/vendor/codali/session/WorkspaceScope.d.ts +3 -0
  225. package/dist/vendor/codali/session/WorkspaceScope.d.ts.map +1 -0
  226. package/dist/vendor/codali/session/WorkspaceScope.js +19 -0
  227. package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts +19 -0
  228. package/dist/vendor/codali/tools/SemanticToolRetrieval.d.ts.map +1 -0
  229. package/dist/vendor/codali/tools/SemanticToolRetrieval.js +52 -0
  230. package/dist/vendor/codali/tools/ToolRetrieval.d.ts +7 -0
  231. package/dist/vendor/codali/tools/ToolRetrieval.d.ts.map +1 -0
  232. package/dist/vendor/codali/tools/ToolRetrieval.js +25 -0
  233. package/dist/vendor/codali/tools/ToolTypes.d.ts +2 -0
  234. package/dist/vendor/codali/tools/ToolTypes.d.ts.map +1 -1
  235. package/dist/vendor/codali/tools/browser/BrowserSessionTool.d.ts +16 -0
  236. package/dist/vendor/codali/tools/browser/BrowserSessionTool.d.ts.map +1 -0
  237. package/dist/vendor/codali/tools/browser/BrowserSessionTool.js +326 -0
  238. package/dist/vendor/codali/tools/browser/BrowserTool.d.ts +17 -0
  239. package/dist/vendor/codali/tools/browser/BrowserTool.d.ts.map +1 -0
  240. package/dist/vendor/codali/tools/browser/BrowserTool.js +291 -0
  241. package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts +2 -0
  242. package/dist/vendor/codali/tools/browser/BrowserWorker.d.ts.map +1 -0
  243. package/dist/vendor/codali/tools/browser/BrowserWorker.js +121 -0
  244. package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts +5 -0
  245. package/dist/vendor/codali/tools/calculation/CalculatorTool.d.ts.map +1 -0
  246. package/dist/vendor/codali/tools/calculation/CalculatorTool.js +163 -0
  247. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts +39 -0
  248. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.d.ts.map +1 -0
  249. package/dist/vendor/codali/tools/deterministic/DeterministicRuntime.js +98 -0
  250. package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts +8 -0
  251. package/dist/vendor/codali/tools/deterministic/DeterministicTools.d.ts.map +1 -0
  252. package/dist/vendor/codali/tools/deterministic/DeterministicTools.js +100 -0
  253. package/dist/vendor/codali/tools/deterministic/node-worker.cjs +38 -0
  254. package/dist/vendor/codali/tools/deterministic/python-worker.py +237 -0
  255. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts +4 -0
  256. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.d.ts.map +1 -0
  257. package/dist/vendor/codali/tools/docdex/DocdexCatalogTools.js +59 -0
  258. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts +2 -0
  259. package/dist/vendor/codali/tools/docdex/DocdexTools.d.ts.map +1 -1
  260. package/dist/vendor/codali/tools/docdex/DocdexTools.js +81 -106
  261. package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts +12 -0
  262. package/dist/vendor/codali/tools/documents/DocumentRuntime.d.ts.map +1 -0
  263. package/dist/vendor/codali/tools/documents/DocumentRuntime.js +59 -0
  264. package/dist/vendor/codali/tools/documents/DocumentTools.d.ts +19 -0
  265. package/dist/vendor/codali/tools/documents/DocumentTools.d.ts.map +1 -0
  266. package/dist/vendor/codali/tools/documents/DocumentTools.js +150 -0
  267. package/dist/vendor/codali/tools/documents/worker.py +267 -0
  268. package/dist/vendor/codali/tools/entities/AdesTool.d.ts +7 -0
  269. package/dist/vendor/codali/tools/entities/AdesTool.d.ts.map +1 -0
  270. package/dist/vendor/codali/tools/entities/AdesTool.js +59 -0
  271. package/dist/vendor/codali/tools/filesystem/FileTools.d.ts.map +1 -1
  272. package/dist/vendor/codali/tools/filesystem/FileTools.js +58 -11
  273. package/dist/vendor/codali/tools/research/TnlTool.d.ts +22 -0
  274. package/dist/vendor/codali/tools/research/TnlTool.d.ts.map +1 -0
  275. package/dist/vendor/codali/tools/research/TnlTool.js +246 -0
  276. package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts +7 -0
  277. package/dist/vendor/codali/tools/shell/AsyncProcess.d.ts.map +1 -1
  278. package/dist/vendor/codali/tools/shell/AsyncProcess.js +9 -3
  279. package/dist/vendor/codali/tools/shell/HostToolchain.d.ts.map +1 -1
  280. package/dist/vendor/codali/tools/shell/HostToolchain.js +37 -5
  281. package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts +4 -2
  282. package/dist/vendor/codali/tools/shell/IsolatedExecutor.d.ts.map +1 -1
  283. package/dist/vendor/codali/tools/shell/IsolatedExecutor.js +126 -27
  284. package/dist/vendor/codali/tools/shell/ShellTool.d.ts +2 -0
  285. package/dist/vendor/codali/tools/shell/ShellTool.d.ts.map +1 -1
  286. package/dist/vendor/codali/tools/shell/ShellTool.js +18 -4
  287. package/dist/vendor/codali/tools/system/CalendarTool.d.ts +15 -0
  288. package/dist/vendor/codali/tools/system/CalendarTool.d.ts.map +1 -0
  289. package/dist/vendor/codali/tools/system/CalendarTool.js +44 -0
  290. package/dist/vendor/codali/tools/system/TextTool.d.ts +4 -0
  291. package/dist/vendor/codali/tools/system/TextTool.d.ts.map +1 -0
  292. package/dist/vendor/codali/tools/system/TextTool.js +39 -0
  293. package/dist/vendor/codali/tools/system/TimeTool.d.ts +4 -0
  294. package/dist/vendor/codali/tools/system/TimeTool.d.ts.map +1 -0
  295. package/dist/vendor/codali/tools/system/TimeTool.js +22 -0
  296. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts +47 -0
  297. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.d.ts.map +1 -0
  298. package/dist/vendor/codali/tools/verification/JavaScriptVerificationTool.js +71 -0
  299. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts +2 -0
  300. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.d.ts.map +1 -0
  301. package/dist/vendor/codali/tools/verification/JavaScriptVerificationWorker.js +91 -0
  302. package/dist/vendor/codali/tools/verification/VitestTool.d.ts +6 -0
  303. package/dist/vendor/codali/tools/verification/VitestTool.d.ts.map +1 -0
  304. package/dist/vendor/codali/tools/verification/VitestTool.js +184 -0
  305. package/dist/vendor/config/AGENTS.md +17 -0
  306. package/dist/vendor/config/deterministic/install-python.mjs +16 -0
  307. package/dist/vendor/config/deterministic/node-worker.mjs +77 -0
  308. package/dist/vendor/config/deterministic/python-worker.py +237 -0
  309. package/dist/vendor/config/deterministic/requirements.txt +6 -0
  310. package/dist/vendor/config/docdex-runtime.json +21 -0
  311. package/dist/vendor/config/docdex-tools-0.2.99.json +3977 -0
  312. package/dist/vendor/config/documents/install-python.mjs +16 -0
  313. package/dist/vendor/config/documents/requirements.txt +10 -0
  314. package/dist/vendor/config/documents/worker.py +267 -0
  315. package/dist/vendor/config/skills/architecture-design/SKILL.md +14 -0
  316. package/dist/vendor/config/skills/browser-session/SKILL.md +16 -0
  317. package/dist/vendor/config/skills/browser-use/SKILL.md +14 -0
  318. package/dist/vendor/config/skills/code-implementation/SKILL.md +18 -0
  319. package/dist/vendor/config/skills/code-review/SKILL.md +14 -0
  320. package/dist/vendor/config/skills/docdex-research/SKILL.md +18 -0
  321. package/dist/vendor/config/skills/docdex-research/references/catalog.md +111 -0
  322. package/dist/vendor/config/skills/docdex-research/references/memory.md +22 -0
  323. package/dist/vendor/config/skills/docdex-research/references/operations.md +19 -0
  324. package/dist/vendor/config/skills/docdex-research/references/retrieval.md +13 -0
  325. package/dist/vendor/config/skills/planning/SKILL.md +14 -0
  326. package/dist/vendor/config/skills/system-diagnostics/SKILL.md +14 -0
  327. package/dist/vendor/config/skills/system-services/SKILL.md +17 -0
  328. package/dist/vendor/config/skills/system-services/references/docker.md +11 -0
  329. package/dist/vendor/config/skills/system-services/references/linux.md +9 -0
  330. package/dist/vendor/config/skills/system-services/references/macos.md +9 -0
  331. package/dist/vendor/config/skills/systematic-debugging/SKILL.md +14 -0
  332. package/dist/vendor/config/skills/testing-and-verification/SKILL.md +16 -0
  333. package/dist/vendor/config/skills/tool-selection/SKILL.md +16 -0
  334. package/dist/vendor/config/skills/ui-ux-design/SKILL.md +16 -0
  335. package/dist/vendor/config/skills/ui-ux-design/references/validation.md +13 -0
  336. package/dist/vendor/config/skills/webapp-testing/SKILL.md +12 -0
  337. package/package.json +15 -5
  338. package/scripts/media_gpu_lock.py +2 -2
  339. package/scripts/native_load_guard.py +257 -0
@@ -0,0 +1,564 @@
1
+ import { emitKeypressEvents } from "node:readline";
2
+ import { promises as fs } from "node:fs";
3
+ import path from "node:path";
4
+ import { TerminalInput } from "../TerminalInput.js";
5
+ import { terminalText, TerminalTextStream } from "../TerminalText.js";
6
+ import { terminalHelp, terminalUsage, toolActivity, toolCompletionSummary } from "./TerminalPresentation.js";
7
+ import { TerminalEditor } from "./TerminalEditor.js";
8
+ import { TerminalSelection, clipboardSequence } from "./TerminalSelection.js";
9
+ import { renderTerminalScreen } from "./TerminalScreen.js";
10
+ /** One terminal owner; controller events are rendered as data, never executable escape codes. */
11
+ export class TerminalTui {
12
+ constructor(options) {
13
+ this.options = options;
14
+ this.live = false;
15
+ this.previousRaw = false;
16
+ this.previousFrame = [];
17
+ this.stream = new TerminalTextStream();
18
+ this.sequence = 0;
19
+ this.frameRows = 12;
20
+ this.transcriptRows = 0;
21
+ this.outputBlocked = false;
22
+ this.resize = () => { this.selection = undefined; this.previousFrame = []; this.schedule(); };
23
+ this.drain = () => { this.outputBlocked = false; this.schedule(); };
24
+ this.onKey = (text, key) => {
25
+ this.selection = undefined;
26
+ try {
27
+ this.key(text, key);
28
+ }
29
+ catch (error) {
30
+ this.error(error instanceof Error ? error.message : String(error));
31
+ }
32
+ this.schedule();
33
+ };
34
+ this.editor = new TerminalEditor(options.history.filter(value => Buffer.byteLength(value) <= 262144).map(value => terminalText(value).replace(/\t/g, " ")));
35
+ this.state = { ...options, workspace: terminalText(options.workspace), branch: options.branch ? terminalText(options.branch) : undefined, profile: terminalText(options.profile), version: terminalText(options.version), busy: false, activity: "Ready", route: "", tokens: 0, queued: 0, draft: "", cursor: 0, blocks: [], scroll: 0, expanded: false };
36
+ this.closedPromise = new Promise(resolve => { this.resolveClosed = resolve; });
37
+ this.input = new TerminalInput({ onPaste: text => {
38
+ if (this.approval || this.picker || this.state.overlay)
39
+ return;
40
+ if (!this.editor.insert(terminalText(text).replace(/\t/g, " ")))
41
+ this.notice("Input exceeds 256 KiB");
42
+ this.schedule();
43
+ }, onRejected: text => this.notice(text), onWheel: direction => { this.selection = undefined; this.scroll(direction * -3); }, onMouse: event => {
44
+ if ((event.button & 3) !== 0 || !this.previousFrame.length)
45
+ return;
46
+ const point = { x: Math.max(0, Math.min((process.stdout.columns || 80) - 1, event.x)), y: Math.max(0, Math.min(this.previousFrame.length - 1, event.y)) };
47
+ if (!event.release && !(event.button & 32))
48
+ this.selection = new TerminalSelection(this.previousFrame, point);
49
+ else if (this.selection) {
50
+ this.selection.end = point;
51
+ if (event.release) {
52
+ const text = this.selection.text();
53
+ if (text)
54
+ process.stdout.write(clipboardSequence(text));
55
+ this.selection = undefined;
56
+ this.previousFrame = [];
57
+ }
58
+ }
59
+ this.schedule();
60
+ }, onEscape: () => this.onKey("", { name: "escape" }) });
61
+ }
62
+ start() {
63
+ if (this.live)
64
+ return;
65
+ this.live = true;
66
+ this.previousRaw = !!process.stdin.isRaw;
67
+ process.stdout.write("\x1b[?1049h\x1b[?25l\x1b[?2004h\x1b[?1000h\x1b[?1002h\x1b[?1006h\x1b[2J");
68
+ process.stdin.setRawMode(true);
69
+ emitKeypressEvents(this.input);
70
+ this.input.on("keypress", this.onKey);
71
+ process.stdin.pipe(this.input);
72
+ process.stdin.resume();
73
+ process.stdout.on("resize", this.resize);
74
+ process.stdout.on("drain", this.drain);
75
+ this.draw();
76
+ }
77
+ wait() { return this.closedPromise; }
78
+ stop() {
79
+ if (!this.live) {
80
+ this.resolveClosed();
81
+ return;
82
+ }
83
+ this.live = false;
84
+ if (this.timer)
85
+ clearTimeout(this.timer);
86
+ this.timer = undefined;
87
+ this.approval?.resolve("deny");
88
+ this.approval = undefined;
89
+ this.permissionPicker?.resolve();
90
+ process.stdout.off("resize", this.resize);
91
+ process.stdout.off("drain", this.drain);
92
+ process.stdin.unpipe(this.input);
93
+ this.input.off("keypress", this.onKey);
94
+ this.input.destroy();
95
+ process.stdin.setRawMode(this.previousRaw);
96
+ process.stdin.pause();
97
+ process.stdout.write("\x1b[0m\x1b[?1006l\x1b[?1002l\x1b[?1000l\x1b[?2004l\x1b[?25h\x1b[?1049l");
98
+ this.resolveClosed();
99
+ }
100
+ schedule() {
101
+ if (!this.live || this.timer)
102
+ return;
103
+ this.timer = setTimeout(() => { this.timer = undefined; this.draw(); }, 24);
104
+ }
105
+ draw() {
106
+ if (!this.live || this.outputBlocked)
107
+ return;
108
+ this.state.draft = this.editor.text;
109
+ this.state.cursor = this.editor.cursor;
110
+ this.state.suggestions = undefined;
111
+ if (!this.state.overlay && !this.approval && this.editor.text.startsWith("/") && !/\s/.test(this.editor.text)) {
112
+ this.state.suggestions = this.options.commands.filter(command => command.name.startsWith(this.editor.text)).slice(0, 5).map(command => `${command.name} ${command.description}`);
113
+ this.state.selectedSuggestion = 0;
114
+ }
115
+ let frame = renderTerminalScreen(this.state, process.stdout.columns || 80, process.stdout.rows || 24, process.env.NO_COLOR === undefined);
116
+ if (this.state.scroll > 0 && frame.transcriptRows > this.transcriptRows) {
117
+ this.state.scroll += frame.transcriptRows - this.transcriptRows;
118
+ frame = renderTerminalScreen(this.state, process.stdout.columns || 80, process.stdout.rows || 24, process.env.NO_COLOR === undefined);
119
+ }
120
+ this.frameRows = frame.viewportRows;
121
+ this.transcriptRows = frame.transcriptRows;
122
+ if (this.selection) {
123
+ frame.lines = this.selection.frame();
124
+ frame.cursor = undefined;
125
+ }
126
+ let output = "\x1b[?25l";
127
+ frame.lines.forEach((line, i) => { if (this.previousFrame[i] !== line)
128
+ output += `\x1b[${i + 1};1H\x1b[2K${line}`; });
129
+ if (frame.cursor)
130
+ output += `\x1b[${frame.cursor.row + 1};${frame.cursor.column + 1}H\x1b[?25h`;
131
+ this.outputBlocked = !process.stdout.write(output);
132
+ this.previousFrame = frame.lines;
133
+ }
134
+ append(kind, title, text) {
135
+ const block = { id: `ui-${++this.sequence}`, kind, title: terminalText(title), text: terminalText(text).slice(-262144) };
136
+ this.state.blocks.push(block);
137
+ while (this.state.blocks.length > 200 || (this.state.blocks.length > 1 && this.state.blocks.reduce((sum, item) => sum + item.text.length, 0) > 262144))
138
+ this.state.blocks.shift();
139
+ this.schedule();
140
+ return block;
141
+ }
142
+ scroll(lines) {
143
+ if (this.picker)
144
+ return;
145
+ if (!this.state.overlay)
146
+ this.state.introDismissed = true;
147
+ if (this.state.overlay)
148
+ this.state.overlay.offset = Math.max(0, this.state.overlay.offset - lines);
149
+ else
150
+ this.state.scroll = Math.max(0, Math.min(Math.max(0, this.transcriptRows - this.frameRows), this.state.scroll + lines));
151
+ this.schedule();
152
+ }
153
+ notice(text) { this.append("notice", "NOTICE", text); }
154
+ error(text) {
155
+ const message = text === "fetch failed" ? "Could not reach the requested service. Check your connection or service status, then try again." : text;
156
+ this.append("error", "NEEDS ATTENTION", message);
157
+ }
158
+ user(text) { this.state.scroll = 0; this.append("user", "YOU", text); }
159
+ result(text) {
160
+ const clean = terminalText(text);
161
+ if (this.assistant && this.assistant.text.trim() === clean.trim())
162
+ return;
163
+ this.assistant = this.append("assistant", "CODALI", clean);
164
+ }
165
+ show(value, title = "Details") {
166
+ const text = title.toLowerCase() === "help" ? terminalHelp() : title.toLowerCase() === "usage" ? terminalUsage(value) : typeof value === "string" ? value : formatInspection(value);
167
+ const overlay = { title: terminalText(title.slice(0, 1).toUpperCase() + title.slice(1)), lines: terminalText(text).split("\n"), offset: 0 };
168
+ if (this.approval)
169
+ this.pendingInspection = overlay;
170
+ else {
171
+ this.permissionPicker?.resolve();
172
+ this.picker = undefined;
173
+ this.state.overlay = overlay;
174
+ }
175
+ this.schedule();
176
+ }
177
+ update(status) { Object.assign(this.state, status); this.schedule(); }
178
+ restore(events) {
179
+ this.state.blocks = [];
180
+ this.assistant = undefined;
181
+ this.lastTool = undefined;
182
+ this.stream.reset();
183
+ this.state.tokens = 0;
184
+ this.state.route = "";
185
+ this.state.session = undefined;
186
+ for (const event of events.slice(-3000)) {
187
+ if (!event?.data || typeof event.type !== "string")
188
+ continue;
189
+ if (event.sessionId)
190
+ this.state.session = event.sessionId;
191
+ if (event.type === "conversation_history" && Array.isArray(event.data.messages)) {
192
+ this.state.blocks = [];
193
+ for (const message of event.data.messages) {
194
+ if (message.role === "user")
195
+ this.user(message.content);
196
+ else if (message.role === "assistant")
197
+ this.result(message.content);
198
+ }
199
+ }
200
+ else if (event.type === "interaction_request" && typeof event.data.prompt === "string")
201
+ this.user(event.data.prompt);
202
+ else if (event.type === "session_started" && !event.data.interactionId && typeof event.data.objective === "string")
203
+ this.user(event.data.objective);
204
+ else if (event.type === "goal_amended" && !event.data.interactionId && typeof event.data.instruction === "string")
205
+ this.user(event.data.instruction);
206
+ else if (event.type === "turn_result" && typeof event.data.content === "string")
207
+ this.result(event.data.content);
208
+ else if (event.type === "turn_failed" && typeof event.data.message === "string") {
209
+ this.error(event.data.message);
210
+ if (typeof event.data.handoff === "string")
211
+ this.notice(event.data.handoff);
212
+ }
213
+ else if (["tool_intent", "tool_receipt", "usage", "model_route"].includes(event.type))
214
+ this.event(event);
215
+ }
216
+ this.state.busy = false;
217
+ this.state.activity = "Session resumed";
218
+ this.state.scroll = 0;
219
+ this.schedule();
220
+ }
221
+ event(event) {
222
+ const data = event.data;
223
+ if (event.sessionId)
224
+ this.state.session = event.sessionId;
225
+ if (event.type === "turn_started") {
226
+ this.stream.reset();
227
+ this.assistant = undefined;
228
+ this.state.busy = true;
229
+ this.state.activity = "Thinking";
230
+ }
231
+ else if (event.type === "token" && typeof data.content === "string") {
232
+ if (!this.assistant)
233
+ this.assistant = this.append("assistant", "CODALI", "");
234
+ this.assistant.text = (this.assistant.text + this.stream.write(data.content)).slice(-262144);
235
+ }
236
+ else if (event.type === "model_route") {
237
+ this.state.route = terminalText(`${data.modelId ?? "Model"}${data.host ? ` on ${data.host}` : ""}`);
238
+ this.state.activity = "Thinking";
239
+ }
240
+ else if (event.type === "docdex_degraded" && typeof data.message === "string")
241
+ this.notice(data.message);
242
+ else if (event.type === "interaction_progress" && typeof data.message === "string")
243
+ this.state.activity = terminalText(data.message);
244
+ else if (event.type === "model_recovery" && typeof data.message === "string") {
245
+ if (this.assistant) {
246
+ this.assistant.kind = "notice";
247
+ this.assistant.title = "Incomplete response · retrying";
248
+ }
249
+ this.assistant = undefined;
250
+ this.stream.reset();
251
+ this.notice(data.message);
252
+ this.state.activity = "Recovering incomplete model response";
253
+ }
254
+ else if (event.type === "usage") {
255
+ const usage = data.usage;
256
+ if (Number.isFinite(usage?.tokens))
257
+ this.state.tokens = usage.tokens;
258
+ }
259
+ else if (event.type === "tool_intent") {
260
+ const receipt = data.receipt;
261
+ this.lastTool = this.append("tool", `● ${toolActivity(receipt.tool, receipt.args)}`, receipt.args ? JSON.stringify(receipt.args, null, 2) : "Running…");
262
+ this.lastTool.id = receipt.id;
263
+ this.lastTool.summary = toolActivity(receipt.tool, receipt.args);
264
+ this.state.activity = terminalText(this.lastTool.summary);
265
+ }
266
+ else if (event.type === "process_output" && typeof data.content === "string") {
267
+ if (!this.lastTool)
268
+ this.lastTool = this.append("tool", "Process output", "");
269
+ this.lastTool.text = (this.lastTool.text + terminalText(data.content)).slice(-65536);
270
+ }
271
+ else if (event.type === "tool_receipt") {
272
+ const receipt = data.receipt;
273
+ const block = this.state.blocks.find(item => item.id === receipt.id);
274
+ if (block) {
275
+ block.title = terminalText(`${receipt.status === "success" ? "✓" : "!"} ${toolActivity(receipt.tool, receipt.args)} · ${receipt.status === "success" ? "done" : "needs attention"}`);
276
+ block.summary = receipt.status === "success" ? terminalText(toolCompletionSummary(receipt.tool, receipt.args, receipt.output)).slice(0, 600) : terminalText(receipt.error ?? receipt.output ?? "This step needs attention. Ctrl+O shows the details.").slice(0, 600);
277
+ if (receipt.syntaxCheck?.status === "failed") {
278
+ block.title = terminalText(`! ${toolActivity(receipt.tool, receipt.args)} · syntax needs fixing`);
279
+ block.summary = "The file was saved, but its Node syntax check failed. Codali needs to fix it before broader testing. Ctrl+O shows the error.";
280
+ }
281
+ if (typeof receipt.output === "string")
282
+ block.text = terminalText([receipt.args ? JSON.stringify(receipt.args, null, 2) : "", receipt.output].filter(Boolean).join("\n\n")).slice(-65536);
283
+ else if (receipt.error)
284
+ block.text += "\n" + terminalText(receipt.error);
285
+ }
286
+ }
287
+ else if (event.type === "status" && typeof data.message === "string")
288
+ this.state.activity = terminalText(data.message);
289
+ else if (event.type === "turn_result" || event.type === "turn_failed") {
290
+ if (this.assistant)
291
+ this.assistant.text += this.stream.finish();
292
+ if (event.type === "turn_failed" && typeof data.handoff === "string")
293
+ this.notice(data.handoff);
294
+ this.state.busy = false;
295
+ this.state.activity = event.type === "turn_failed" ? "Turn stopped" : data.mode && data.mode !== "execute" ? "Ready" : data.completed ? "Goal completed" : "Ready to continue";
296
+ }
297
+ this.schedule();
298
+ }
299
+ approve(title, details, signal) {
300
+ this.permissionPicker?.resolve();
301
+ this.approval?.resolve("deny");
302
+ this.picker = undefined;
303
+ return new Promise(resolve => {
304
+ const abort = () => finish("deny");
305
+ const finish = (choice) => {
306
+ signal?.removeEventListener("abort", abort);
307
+ this.approval = undefined;
308
+ this.state.overlay = this.pendingInspection;
309
+ this.pendingInspection = undefined;
310
+ this.schedule();
311
+ resolve(choice);
312
+ };
313
+ const overlay = { title: terminalText(title.slice(0, 1).toUpperCase() + title.slice(1)), lines: terminalText(details).split("\n"), offset: 0, choices: ["Allow once", "Allow for this session", "Deny"], selected: 2, hint: "↑↓ choose · Enter confirm · PgUp/PgDn inspect · Esc deny" };
314
+ this.approval = { resolve: finish, selected: 2, overlay };
315
+ this.state.overlay = overlay;
316
+ signal?.addEventListener("abort", abort, { once: true });
317
+ if (signal?.aborted)
318
+ abort();
319
+ this.schedule();
320
+ });
321
+ }
322
+ choosePermissions(current) {
323
+ if (this.approval)
324
+ return Promise.resolve(undefined);
325
+ this.permissionPicker?.resolve();
326
+ this.picker = undefined;
327
+ const profiles = ["plan", "ask", "workspace", "full"];
328
+ return new Promise(resolve => {
329
+ const overlay = { title: "Permissions for this directory", lines: [this.state.workspace, "Saved for future launches here. Full automatically approves available tools; workspace boundaries still apply."], offset: 0,
330
+ choices: ["Plan — read only", "Ask — approve operations individually", "Workspace — allow local writes and shell", "Full — allow all tools without prompts"], selected: profiles.indexOf(current), hint: "↑↓ choose · Enter save · Esc cancel" };
331
+ this.permissionPicker = { overlay, resolve: profile => {
332
+ this.permissionPicker = undefined;
333
+ if (this.state.overlay === overlay)
334
+ this.state.overlay = undefined;
335
+ this.schedule();
336
+ resolve(profile);
337
+ } };
338
+ this.state.overlay = overlay;
339
+ this.schedule();
340
+ });
341
+ }
342
+ pickerItems() {
343
+ if (!this.picker)
344
+ return [];
345
+ return this.picker.items.filter(item => item.label.toLowerCase().includes(this.picker.query.toLowerCase()));
346
+ }
347
+ showPicker() {
348
+ const picker = this.picker;
349
+ const items = this.pickerItems();
350
+ picker.selected = Math.max(0, Math.min(items.length - 1, picker.selected));
351
+ const count = Math.max(1, (process.stdout.rows || 24) - 10);
352
+ const offset = Math.max(0, picker.selected - count + 1);
353
+ this.state.overlay = { title: `${picker.kind === "command" ? "Commands" : picker.kind === "history" ? "History" : "Workspace files"} › ${picker.query}`, lines: items.length ? items.slice(offset, offset + count).map((item, i) => `${i + offset === picker.selected ? "›" : " "} ${item.label}`) : ["No matches"], offset: 0, hint: "Type to search · ↑↓ choose · Enter select · Esc close" };
354
+ this.schedule();
355
+ }
356
+ openPicker(kind) {
357
+ this.picker = { kind, query: "", selected: 0, items: kind === "command" ? this.options.commands.map(command => ({ label: `${command.name} ${command.description}`, value: command.name })) : this.editor.history.map(value => ({ label: value.replace(/\n/g, " ↵ "), value })) };
358
+ this.showPicker();
359
+ }
360
+ async completeFile() {
361
+ const draft = this.editor.text, cursor = this.editor.cursor;
362
+ const before = draft.slice(0, cursor);
363
+ const match = before.match(/(?:^|\s)@([^\n]*)$/u);
364
+ if (!match)
365
+ return;
366
+ const token = match[1], directory = token.endsWith("/") ? token : path.dirname(token), fragment = token.endsWith("/") ? "" : path.basename(token);
367
+ const relative = directory === "." ? "" : directory;
368
+ const root = await fs.realpath(this.options.workspace);
369
+ const target = await fs.realpath(path.resolve(root, relative));
370
+ if (target !== root && !target.startsWith(root + path.sep))
371
+ throw new Error("File completion is confined to this workspace");
372
+ const entries = await fs.readdir(target, { withFileTypes: true });
373
+ if (this.editor.text !== draft || this.editor.cursor !== cursor || this.approval || this.state.overlay)
374
+ return;
375
+ this.picker = { kind: "file", query: fragment, selected: 0, prefix: before.slice(0, before.length - token.length - 1), suffix: draft.slice(cursor), items: entries.filter(item => item.name !== ".git" && !item.isSymbolicLink() && !/[\x00-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/.test(item.name)).slice(0, 1000).map(item => { const value = path.join(relative, item.name) + (item.isDirectory() ? "/" : ""); return { label: value, value }; }).sort((a, b) => a.label.localeCompare(b.label)) };
376
+ this.showPicker();
377
+ }
378
+ key(text, key) {
379
+ if (key.ctrl && (key.name === "c" || key.name === "z")) {
380
+ this.options.cancel();
381
+ return;
382
+ }
383
+ if (this.permissionPicker) {
384
+ const picker = this.permissionPicker;
385
+ if (key.name === "escape")
386
+ picker.resolve();
387
+ else if ((process.stdout.columns || 80) < 24 || (process.stdout.rows || 24) < 10)
388
+ return;
389
+ else if (key.name === "up" || key.name === "down")
390
+ picker.overlay.selected = ((picker.overlay.selected ?? 0) + (key.name === "up" ? 3 : 1)) % 4;
391
+ else if (key.name === "return")
392
+ picker.resolve(["plan", "ask", "workspace", "full"][picker.overlay.selected ?? 1]);
393
+ else if (key.name === "pageup" || key.name === "pagedown")
394
+ picker.overlay.offset = Math.max(0, picker.overlay.offset + (key.name === "pageup" ? -6 : 6));
395
+ return;
396
+ }
397
+ if (this.approval) {
398
+ if (key.name === "escape")
399
+ this.approval.resolve("deny");
400
+ else if ((process.stdout.columns || 80) < 24 || (process.stdout.rows || 24) < 10)
401
+ return;
402
+ else if (key.name === "up" || key.name === "down") {
403
+ this.approval.selected = (this.approval.selected + (key.name === "down" ? 1 : 2)) % 3;
404
+ this.approval.overlay.selected = this.approval.selected;
405
+ }
406
+ else if (key.name === "return")
407
+ this.approval.resolve(["once", "session", "deny"][this.approval.selected]);
408
+ else if (key.name === "pageup" || key.name === "pagedown")
409
+ this.approval.overlay.offset = Math.max(0, this.approval.overlay.offset + (key.name === "pageup" ? -6 : 6));
410
+ return;
411
+ }
412
+ if (this.picker) {
413
+ if (key.name === "escape") {
414
+ this.picker = undefined;
415
+ this.state.overlay = undefined;
416
+ return;
417
+ }
418
+ if (key.name === "up" || key.name === "down")
419
+ this.picker.selected += key.name === "up" ? -1 : 1;
420
+ else if (key.name === "backspace")
421
+ this.picker.query = [...this.picker.query].slice(0, -1).join("");
422
+ else if (key.name === "return") {
423
+ const selected = this.pickerItems()[this.picker.selected];
424
+ if (!selected)
425
+ return;
426
+ const picker = this.picker;
427
+ this.picker = undefined;
428
+ this.state.overlay = undefined;
429
+ if (picker.kind === "command")
430
+ this.options.submit(selected.value, "queue");
431
+ else if (picker.kind === "history")
432
+ this.editor.set(selected.value);
433
+ else {
434
+ const prefix = (picker.prefix ?? "") + "@" + selected.value;
435
+ this.editor.set(prefix + (picker.suffix ?? ""));
436
+ this.editor.cursor = prefix.length;
437
+ if (selected.value.endsWith("/"))
438
+ void this.completeFile().catch(error => this.error(String(error)));
439
+ }
440
+ return;
441
+ }
442
+ else if (!key.ctrl && !key.meta && text && !/[\x00-\x1f\x7f]/.test(text)) {
443
+ this.picker.query += text;
444
+ this.picker.selected = 0;
445
+ }
446
+ this.showPicker();
447
+ return;
448
+ }
449
+ if (this.state.overlay) {
450
+ if (key.name === "escape" || key.name === "q")
451
+ this.state.overlay = undefined;
452
+ else if (["up", "down", "pageup", "pagedown"].includes(key.name ?? ""))
453
+ this.state.overlay.offset = Math.max(0, this.state.overlay.offset + (["up", "pageup"].includes(key.name) ? -1 : 1) * (key.name.startsWith("page") ? 8 : 1));
454
+ return;
455
+ }
456
+ if (key.ctrl && key.name === "end") {
457
+ this.state.scroll = 0;
458
+ return;
459
+ }
460
+ if (key.ctrl && key.name === "p") {
461
+ this.openPicker("command");
462
+ return;
463
+ }
464
+ if (key.ctrl && key.name === "r") {
465
+ this.openPicker("history");
466
+ return;
467
+ }
468
+ if (key.ctrl && key.name === "o") {
469
+ this.state.expanded = !this.state.expanded;
470
+ return;
471
+ }
472
+ if (key.ctrl && key.name === "l") {
473
+ this.previousFrame = [];
474
+ return;
475
+ }
476
+ if (key.name === "escape") {
477
+ if (this.state.busy)
478
+ this.options.cancel();
479
+ else
480
+ this.editor.clear();
481
+ return;
482
+ }
483
+ if (key.name === "pageup" || key.name === "pagedown") {
484
+ this.scroll((key.name === "pageup" ? 1 : -1) * Math.max(1, this.frameRows - 2));
485
+ return;
486
+ }
487
+ if (key.ctrl && key.name === "s") {
488
+ const value = this.editor.submit();
489
+ if (value.trim())
490
+ this.options.submit(value, "steer");
491
+ return;
492
+ }
493
+ if (key.name === "return") {
494
+ if (key.meta || key.shift)
495
+ this.editor.insert("\n");
496
+ else {
497
+ const value = this.editor.submit();
498
+ if (value.trim())
499
+ this.options.submit(value, "queue");
500
+ }
501
+ }
502
+ else if (key.ctrl && key.name === "j")
503
+ this.editor.insert("\n");
504
+ else if (key.name === "backspace")
505
+ this.editor.delete(true);
506
+ else if (key.name === "delete")
507
+ this.editor.delete(false);
508
+ else if (key.name === "left")
509
+ this.editor.move(-1);
510
+ else if (key.name === "right")
511
+ this.editor.move(1);
512
+ else if (key.name === "home" || (key.ctrl && key.name === "a"))
513
+ this.editor.home();
514
+ else if (key.name === "end" || (key.ctrl && key.name === "e"))
515
+ this.editor.end();
516
+ else if (key.ctrl && key.name === "u")
517
+ this.editor.clear();
518
+ else if (key.ctrl && key.name === "w")
519
+ this.editor.killWord();
520
+ else if (key.ctrl && key.name === "d" && !this.editor.text)
521
+ this.options.close();
522
+ else if (key.name === "up" || key.name === "down") {
523
+ const direction = key.name === "up" ? -1 : 1;
524
+ if (!this.editor.vertical(direction))
525
+ this.editor.previous(direction);
526
+ }
527
+ else if (key.name === "tab" && !key.shift) {
528
+ if (this.editor.text.startsWith("/") && !/\s/.test(this.editor.text)) {
529
+ const match = this.options.commands.find(command => command.name.startsWith(this.editor.text));
530
+ if (match)
531
+ this.editor.set(match.name + " ");
532
+ }
533
+ else {
534
+ const value = this.editor.submit();
535
+ if (value.trim())
536
+ this.options.submit(value, "queue");
537
+ }
538
+ }
539
+ else if (key.name === "tab" && key.shift) {
540
+ const matches = this.options.commands.filter(command => command.name.startsWith(this.editor.text));
541
+ if (this.editor.text.startsWith("/") && matches.length)
542
+ this.editor.set(matches[0].name + " ");
543
+ else
544
+ void this.completeFile().catch(error => this.error(error instanceof Error ? error.message : String(error)));
545
+ }
546
+ else if (!key.ctrl && !key.meta && text && !/[\x00-\x1f\x7f]/.test(text))
547
+ this.editor.insert(terminalText(text));
548
+ }
549
+ }
550
+ export const formatInspection = (value, depth = 0) => {
551
+ if (value === null || value === undefined)
552
+ return "—";
553
+ if (typeof value !== "object")
554
+ return String(value);
555
+ if (Array.isArray(value))
556
+ return value.length ? value.map((item, index) => `${index + 1}. ${formatInspection(item, depth + 1)}`).join("\n\n") : "None";
557
+ const entries = Object.entries(value);
558
+ if (depth > 4)
559
+ return JSON.stringify(value);
560
+ return entries.map(([key, item]) => {
561
+ const label = key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ");
562
+ return `${label[0]?.toUpperCase() ?? ""}${label.slice(1)}: ${item && typeof item === "object" ? "\n" : ""}${formatInspection(item, depth + 1)}`;
563
+ }).join("\n");
564
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA2FA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAA0B,KAAG,OAAO,CAAC,IAAI,CAyEjF,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6FA,eAAO,MAAM,MAAM,GAAU,OAAM,MAAM,EAA0B,KAAG,OAAO,CAAC,IAAI,CAyEjF,CAAC"}
@@ -12,8 +12,10 @@ import { EvalCommand } from "./cli/EvalCommand.js";
12
12
  import { DatasetCommand } from "./cli/DatasetCommand.js";
13
13
  import { ImprovementCommand } from "./cli/ImprovementCommand.js";
14
14
  import { TerminalCommand, terminalDoctor } from "./cli/TerminalCommand.js";
15
- const HELP_TEXT = "Usage: codali [chat] [prompt] [--effort low|medium|high|max] [--permissions plan|ask|workspace]\n" +
15
+ const HELP_TEXT = "Usage: codali [chat] [prompt] [--effort low|medium|high|max] [--permissions plan|ask|workspace|full]\n" +
16
16
  " or: codali exec <prompt> [--json] [--config <path>]\n" +
17
+ " or: codali exec <prompt> --output-format jsonl --permission-profile workspace\n" +
18
+ " or: codali config validate --file <path>\n" +
17
19
  " or: codali setup | login [--stdin] | logout | auth status\n" +
18
20
  " or: codali sessions | resume <id> | inspect <id>\n" +
19
21
  " or: codali ask \"<question>\" [--trace] [--json] [--workspace-root <path>]\n" +
@@ -108,11 +110,11 @@ export const runCli = async (argv = process.argv.slice(2)) => {
108
110
  console.log(JSON.stringify(await terminalDoctor(rest.includes("--config") ? rest[rest.indexOf("--config") + 1] : undefined), null, 2));
109
111
  return;
110
112
  }
111
- if (["chat", "exec", "setup", "login", "logout", "sessions", "resume", "status", "inspect", "checkpoint", "amend"].includes(command)) {
113
+ if (["chat", "exec", "config", "setup", "login", "logout", "sessions", "resume", "status", "inspect", "checkpoint", "amend"].includes(command)) {
112
114
  await TerminalCommand.run(argv);
113
115
  return;
114
116
  }
115
- if (["--effort", "--permissions", "--config", "--workspace-root", "--plain", "--json", "--stdin"].includes(command)) {
117
+ if (["--effort", "--permissions", "--permission-profile", "--output-format", "--config", "--workspace-root", "--plain", "--json", "--stdin"].includes(command)) {
116
118
  await TerminalCommand.run(["chat", ...argv]);
117
119
  return;
118
120
  }
@@ -46,6 +46,12 @@ export interface ModelBinding {
46
46
  embeddingSpace?: string;
47
47
  }
48
48
  export interface TaskControlConfig {
49
+ /** Require an explicit work_plan before claiming implementation tasks. */
50
+ requirePlan?: boolean;
51
+ /** Initial execution schemas; additional tools remain discoverable and policy-checked. */
52
+ initialTools?: string[];
53
+ /** Workspace-relative authoritative inputs that tools must not change. */
54
+ immutableInputs?: string[];
49
55
  maxWritingTasksPerWorktree: 1;
50
56
  maxConcurrentHelpers: number;
51
57
  helpers: "read-only-or-draft";
@@ -54,6 +60,34 @@ export interface TaskControlConfig {
54
60
  checkpointOn: string[];
55
61
  reviewPolicy: "risk-and-evidence";
56
62
  }
63
+ export interface InteractionConfig {
64
+ toolExposure?: "gateway" | "native";
65
+ toolSelection?: "fixed" | "progressive" | "lexical" | "semantic";
66
+ initialTools?: string[];
67
+ /** Opt-in single-call answering; routed preserves the established dispatcher. */
68
+ strategy?: "routed" | "direct" | "native" | "cascade" | "gateway" | "adaptive";
69
+ routerBinding?: string;
70
+ answerBinding?: string;
71
+ promptVersion?: string;
72
+ routerResponseFormat?: "json" | "json_schema";
73
+ routerPrompt?: string;
74
+ answerPrompt?: string;
75
+ maxInputChars?: number;
76
+ historyChars?: number;
77
+ maxOutputTokens?: number;
78
+ maxTotalTokens?: number;
79
+ maxModelCalls?: number;
80
+ maxInspectionSteps?: number;
81
+ timeoutMs?: number;
82
+ /** Optional single bounded revision pass for answers that already needed reasoning. */
83
+ answerReview?: {
84
+ enabled: boolean;
85
+ binding?: string;
86
+ maxOutputTokens?: number;
87
+ };
88
+ /** Experimental pure arithmetic tool for reasoning turns; disabled unless explicitly enabled. */
89
+ calculator?: boolean;
90
+ }
57
91
  export interface OrchestrationConfig {
58
92
  schemaVersion: 1;
59
93
  profile: string;
@@ -66,7 +100,13 @@ export interface OrchestrationConfig {
66
100
  };
67
101
  effort?: Partial<Record<EffortLevel, Partial<EffortBudget>>>;
68
102
  taskControl?: TaskControlConfig;
103
+ interaction?: InteractionConfig;
104
+ skills?: {
105
+ enabled?: boolean;
106
+ directories?: string[];
107
+ };
69
108
  docdex?: {
109
+ baseUrl?: string;
70
110
  binary?: string;
71
111
  binarySha256?: string;
72
112
  startupTimeoutMs?: number;