@open-mercato/enterprise 0.7.1-develop.7193.1.910a5b0a1e → 0.7.1-develop.7194.1.ab4fc81f82

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 (962) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/README.md +1 -0
  3. package/dist/index.js +1 -1
  4. package/dist/index.js.map +2 -2
  5. package/dist/modules/agent_orchestrator/acl.js +132 -0
  6. package/dist/modules/agent_orchestrator/acl.js.map +7 -0
  7. package/dist/modules/agent_orchestrator/ai-agents.js +57 -0
  8. package/dist/modules/agent_orchestrator/ai-agents.js.map +7 -0
  9. package/dist/modules/agent_orchestrator/ai-skills.js +48 -0
  10. package/dist/modules/agent_orchestrator/ai-skills.js.map +7 -0
  11. package/dist/modules/agent_orchestrator/ai-tools.js +254 -0
  12. package/dist/modules/agent_orchestrator/ai-tools.js.map +7 -0
  13. package/dist/modules/agent_orchestrator/api/agents/[id]/files/route.js +69 -0
  14. package/dist/modules/agent_orchestrator/api/agents/[id]/files/route.js.map +7 -0
  15. package/dist/modules/agent_orchestrator/api/agents/[id]/metrics/route.js +81 -0
  16. package/dist/modules/agent_orchestrator/api/agents/[id]/metrics/route.js.map +7 -0
  17. package/dist/modules/agent_orchestrator/api/agents/[id]/route.js +154 -0
  18. package/dist/modules/agent_orchestrator/api/agents/[id]/route.js.map +7 -0
  19. package/dist/modules/agent_orchestrator/api/agents/[id]/run/route.js +250 -0
  20. package/dist/modules/agent_orchestrator/api/agents/[id]/run/route.js.map +7 -0
  21. package/dist/modules/agent_orchestrator/api/agents/[id]/settings/route.js +105 -0
  22. package/dist/modules/agent_orchestrator/api/agents/[id]/settings/route.js.map +7 -0
  23. package/dist/modules/agent_orchestrator/api/agents/route.js +114 -0
  24. package/dist/modules/agent_orchestrator/api/agents/route.js.map +7 -0
  25. package/dist/modules/agent_orchestrator/api/artifacts/file/[id]/route.js +64 -0
  26. package/dist/modules/agent_orchestrator/api/artifacts/file/[id]/route.js.map +7 -0
  27. package/dist/modules/agent_orchestrator/api/audit/by-instigator/[humanUserId]/route.js +105 -0
  28. package/dist/modules/agent_orchestrator/api/audit/by-instigator/[humanUserId]/route.js.map +7 -0
  29. package/dist/modules/agent_orchestrator/api/auto-approval/settings/route.js +110 -0
  30. package/dist/modules/agent_orchestrator/api/auto-approval/settings/route.js.map +7 -0
  31. package/dist/modules/agent_orchestrator/api/context-bundles/route.js +88 -0
  32. package/dist/modules/agent_orchestrator/api/context-bundles/route.js.map +7 -0
  33. package/dist/modules/agent_orchestrator/api/corrections/route.js +101 -0
  34. package/dist/modules/agent_orchestrator/api/corrections/route.js.map +7 -0
  35. package/dist/modules/agent_orchestrator/api/eval-assertions/preview/route.js +98 -0
  36. package/dist/modules/agent_orchestrator/api/eval-assertions/preview/route.js.map +7 -0
  37. package/dist/modules/agent_orchestrator/api/eval-assertions/route.js +196 -0
  38. package/dist/modules/agent_orchestrator/api/eval-assertions/route.js.map +7 -0
  39. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/approve/route.js +86 -0
  40. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/approve/route.js.map +7 -0
  41. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/archive/route.js +85 -0
  42. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/archive/route.js.map +7 -0
  43. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/route.js +67 -0
  44. package/dist/modules/agent_orchestrator/api/eval-cases/[id]/route.js.map +7 -0
  45. package/dist/modules/agent_orchestrator/api/eval-cases/export/route.js +78 -0
  46. package/dist/modules/agent_orchestrator/api/eval-cases/export/route.js.map +7 -0
  47. package/dist/modules/agent_orchestrator/api/eval-cases/route.js +140 -0
  48. package/dist/modules/agent_orchestrator/api/eval-cases/route.js.map +7 -0
  49. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/cancel/route.js +67 -0
  50. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/cancel/route.js.map +7 -0
  51. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/case-runs/[caseRunId]/results/route.js +66 -0
  52. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/case-runs/[caseRunId]/results/route.js.map +7 -0
  53. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/route.js +111 -0
  54. package/dist/modules/agent_orchestrator/api/eval-runs/[id]/route.js.map +7 -0
  55. package/dist/modules/agent_orchestrator/api/eval-runs/route.js +157 -0
  56. package/dist/modules/agent_orchestrator/api/eval-runs/route.js.map +7 -0
  57. package/dist/modules/agent_orchestrator/api/eval-scorers/route.js +34 -0
  58. package/dist/modules/agent_orchestrator/api/eval-scorers/route.js.map +7 -0
  59. package/dist/modules/agent_orchestrator/api/executions/[id]/route.js +72 -0
  60. package/dist/modules/agent_orchestrator/api/executions/[id]/route.js.map +7 -0
  61. package/dist/modules/agent_orchestrator/api/executions/route.js +185 -0
  62. package/dist/modules/agent_orchestrator/api/executions/route.js.map +7 -0
  63. package/dist/modules/agent_orchestrator/api/features/route.js +61 -0
  64. package/dist/modules/agent_orchestrator/api/features/route.js.map +7 -0
  65. package/dist/modules/agent_orchestrator/api/guardrail-checks/route.js +85 -0
  66. package/dist/modules/agent_orchestrator/api/guardrail-checks/route.js.map +7 -0
  67. package/dist/modules/agent_orchestrator/api/identity/agent/auth/route.js +95 -0
  68. package/dist/modules/agent_orchestrator/api/identity/agent/auth/route.js.map +7 -0
  69. package/dist/modules/agent_orchestrator/api/identity/grants/[id]/revoke/route.js +109 -0
  70. package/dist/modules/agent_orchestrator/api/identity/grants/[id]/revoke/route.js.map +7 -0
  71. package/dist/modules/agent_orchestrator/api/identity/token/route.js +80 -0
  72. package/dist/modules/agent_orchestrator/api/identity/token/route.js.map +7 -0
  73. package/dist/modules/agent_orchestrator/api/identity/well-known/route.js +44 -0
  74. package/dist/modules/agent_orchestrator/api/identity/well-known/route.js.map +7 -0
  75. package/dist/modules/agent_orchestrator/api/metrics/agents/route.js +122 -0
  76. package/dist/modules/agent_orchestrator/api/metrics/agents/route.js.map +7 -0
  77. package/dist/modules/agent_orchestrator/api/metrics/overview/route.js +165 -0
  78. package/dist/modules/agent_orchestrator/api/metrics/overview/route.js.map +7 -0
  79. package/dist/modules/agent_orchestrator/api/openapi.js +29 -0
  80. package/dist/modules/agent_orchestrator/api/openapi.js.map +7 -0
  81. package/dist/modules/agent_orchestrator/api/processes/[id]/executions/route.js +160 -0
  82. package/dist/modules/agent_orchestrator/api/processes/[id]/executions/route.js.map +7 -0
  83. package/dist/modules/agent_orchestrator/api/processes/[id]/route.js +53 -0
  84. package/dist/modules/agent_orchestrator/api/processes/[id]/route.js.map +7 -0
  85. package/dist/modules/agent_orchestrator/api/processes/route.js +357 -0
  86. package/dist/modules/agent_orchestrator/api/processes/route.js.map +7 -0
  87. package/dist/modules/agent_orchestrator/api/proposals/[id]/dispose/route.js +111 -0
  88. package/dist/modules/agent_orchestrator/api/proposals/[id]/dispose/route.js.map +7 -0
  89. package/dist/modules/agent_orchestrator/api/proposals/route.js +98 -0
  90. package/dist/modules/agent_orchestrator/api/proposals/route.js.map +7 -0
  91. package/dist/modules/agent_orchestrator/api/runs/[id]/artifact/route.js +71 -0
  92. package/dist/modules/agent_orchestrator/api/runs/[id]/artifact/route.js.map +7 -0
  93. package/dist/modules/agent_orchestrator/api/runs/[id]/artifacts/route.js +66 -0
  94. package/dist/modules/agent_orchestrator/api/runs/[id]/artifacts/route.js.map +7 -0
  95. package/dist/modules/agent_orchestrator/api/runs/[id]/eval-case/route.js +73 -0
  96. package/dist/modules/agent_orchestrator/api/runs/[id]/eval-case/route.js.map +7 -0
  97. package/dist/modules/agent_orchestrator/api/runs/[id]/flag/route.js +74 -0
  98. package/dist/modules/agent_orchestrator/api/runs/[id]/flag/route.js.map +7 -0
  99. package/dist/modules/agent_orchestrator/api/runs/[id]/rerun/route.js +165 -0
  100. package/dist/modules/agent_orchestrator/api/runs/[id]/rerun/route.js.map +7 -0
  101. package/dist/modules/agent_orchestrator/api/runs/[id]/route.js +86 -0
  102. package/dist/modules/agent_orchestrator/api/runs/[id]/route.js.map +7 -0
  103. package/dist/modules/agent_orchestrator/api/runs/route.js +137 -0
  104. package/dist/modules/agent_orchestrator/api/runs/route.js.map +7 -0
  105. package/dist/modules/agent_orchestrator/api/tokens/estimate/route.js +56 -0
  106. package/dist/modules/agent_orchestrator/api/tokens/estimate/route.js.map +7 -0
  107. package/dist/modules/agent_orchestrator/api/trace/ingest/route.js +80 -0
  108. package/dist/modules/agent_orchestrator/api/trace/ingest/route.js.map +7 -0
  109. package/dist/modules/agent_orchestrator/api/web-search/health/route.js +184 -0
  110. package/dist/modules/agent_orchestrator/api/web-search/health/route.js.map +7 -0
  111. package/dist/modules/agent_orchestrator/api/web-search/preview/route.js +150 -0
  112. package/dist/modules/agent_orchestrator/api/web-search/preview/route.js.map +7 -0
  113. package/dist/modules/agent_orchestrator/api/web-search/settings/route.js +213 -0
  114. package/dist/modules/agent_orchestrator/api/web-search/settings/route.js.map +7 -0
  115. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/ActivityTab.js +112 -0
  116. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/ActivityTab.js.map +7 -0
  117. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AgentConfigDrawer.js +58 -0
  118. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AgentConfigDrawer.js.map +7 -0
  119. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AgentHeaderCard.js +117 -0
  120. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AgentHeaderCard.js.map +7 -0
  121. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AssertionFormDrawer.js +318 -0
  122. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/AssertionFormDrawer.js.map +7 -0
  123. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/ConfigurationTab.js +126 -0
  124. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/ConfigurationTab.js.map +7 -0
  125. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvalCaseDrawer.js +379 -0
  126. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvalCaseDrawer.js.map +7 -0
  127. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvalResultsDrawer.js +159 -0
  128. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvalResultsDrawer.js.map +7 -0
  129. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvaluationTab.js +581 -0
  130. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/EvaluationTab.js.map +7 -0
  131. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/FilesTab.js +249 -0
  132. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/FilesTab.js.map +7 -0
  133. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/OverviewTab.js +162 -0
  134. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/OverviewTab.js.map +7 -0
  135. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/RunEvaluationDrawer.js +199 -0
  136. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/RunEvaluationDrawer.js.map +7 -0
  137. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/TokenCalculatorTab.js +137 -0
  138. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/TokenCalculatorTab.js.map +7 -0
  139. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/filesShared.js +97 -0
  140. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/filesShared.js.map +7 -0
  141. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/workspacePrimitives.js +159 -0
  142. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/workspacePrimitives.js.map +7 -0
  143. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/workspaceShared.js +132 -0
  144. package/dist/modules/agent_orchestrator/backend/agents/[id]/components/workspaceShared.js.map +7 -0
  145. package/dist/modules/agent_orchestrator/backend/agents/[id]/page.js +266 -0
  146. package/dist/modules/agent_orchestrator/backend/agents/[id]/page.js.map +7 -0
  147. package/dist/modules/agent_orchestrator/backend/agents/[id]/page.meta.js +18 -0
  148. package/dist/modules/agent_orchestrator/backend/agents/[id]/page.meta.js.map +7 -0
  149. package/dist/modules/agent_orchestrator/backend/agents/agentListFilters.js +44 -0
  150. package/dist/modules/agent_orchestrator/backend/agents/agentListFilters.js.map +7 -0
  151. package/dist/modules/agent_orchestrator/backend/agents/page.js +439 -0
  152. package/dist/modules/agent_orchestrator/backend/agents/page.js.map +7 -0
  153. package/dist/modules/agent_orchestrator/backend/agents/page.meta.js +28 -0
  154. package/dist/modules/agent_orchestrator/backend/agents/page.meta.js.map +7 -0
  155. package/dist/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.js +80 -0
  156. package/dist/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.js.map +7 -0
  157. package/dist/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.meta.js +19 -0
  158. package/dist/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.meta.js.map +7 -0
  159. package/dist/modules/agent_orchestrator/backend/audit/page.js +324 -0
  160. package/dist/modules/agent_orchestrator/backend/audit/page.js.map +7 -0
  161. package/dist/modules/agent_orchestrator/backend/audit/page.meta.js +27 -0
  162. package/dist/modules/agent_orchestrator/backend/audit/page.meta.js.map +7 -0
  163. package/dist/modules/agent_orchestrator/backend/caseload/[proposalId]/page.js +239 -0
  164. package/dist/modules/agent_orchestrator/backend/caseload/[proposalId]/page.js.map +7 -0
  165. package/dist/modules/agent_orchestrator/backend/caseload/[proposalId]/page.meta.js +18 -0
  166. package/dist/modules/agent_orchestrator/backend/caseload/[proposalId]/page.meta.js.map +7 -0
  167. package/dist/modules/agent_orchestrator/backend/caseload/hooks.js +344 -0
  168. package/dist/modules/agent_orchestrator/backend/caseload/hooks.js.map +7 -0
  169. package/dist/modules/agent_orchestrator/backend/caseload/page.js +1360 -0
  170. package/dist/modules/agent_orchestrator/backend/caseload/page.js.map +7 -0
  171. package/dist/modules/agent_orchestrator/backend/caseload/page.meta.js +25 -0
  172. package/dist/modules/agent_orchestrator/backend/caseload/page.meta.js.map +7 -0
  173. package/dist/modules/agent_orchestrator/backend/eval-cases/[id]/page.js +357 -0
  174. package/dist/modules/agent_orchestrator/backend/eval-cases/[id]/page.js.map +7 -0
  175. package/dist/modules/agent_orchestrator/backend/eval-cases/[id]/page.meta.js +18 -0
  176. package/dist/modules/agent_orchestrator/backend/eval-cases/[id]/page.meta.js.map +7 -0
  177. package/dist/modules/agent_orchestrator/backend/eval-runs/[id]/page.js +595 -0
  178. package/dist/modules/agent_orchestrator/backend/eval-runs/[id]/page.js.map +7 -0
  179. package/dist/modules/agent_orchestrator/backend/eval-runs/[id]/page.meta.js +18 -0
  180. package/dist/modules/agent_orchestrator/backend/eval-runs/[id]/page.meta.js.map +7 -0
  181. package/dist/modules/agent_orchestrator/backend/overview/page.js +593 -0
  182. package/dist/modules/agent_orchestrator/backend/overview/page.js.map +7 -0
  183. package/dist/modules/agent_orchestrator/backend/overview/page.meta.js +27 -0
  184. package/dist/modules/agent_orchestrator/backend/overview/page.meta.js.map +7 -0
  185. package/dist/modules/agent_orchestrator/backend/playground/PlaygroundEvalPanel.js +219 -0
  186. package/dist/modules/agent_orchestrator/backend/playground/PlaygroundEvalPanel.js.map +7 -0
  187. package/dist/modules/agent_orchestrator/backend/playground/page.js +443 -0
  188. package/dist/modules/agent_orchestrator/backend/playground/page.js.map +7 -0
  189. package/dist/modules/agent_orchestrator/backend/playground/page.meta.js +24 -0
  190. package/dist/modules/agent_orchestrator/backend/playground/page.meta.js.map +7 -0
  191. package/dist/modules/agent_orchestrator/backend/processes/[id]/page.js +611 -0
  192. package/dist/modules/agent_orchestrator/backend/processes/[id]/page.js.map +7 -0
  193. package/dist/modules/agent_orchestrator/backend/processes/[id]/page.meta.js +18 -0
  194. package/dist/modules/agent_orchestrator/backend/processes/[id]/page.meta.js.map +7 -0
  195. package/dist/modules/agent_orchestrator/backend/processes/definitions/MilestoneEditor.js +219 -0
  196. package/dist/modules/agent_orchestrator/backend/processes/definitions/MilestoneEditor.js.map +7 -0
  197. package/dist/modules/agent_orchestrator/backend/processes/definitions/TriggerEditor.js +326 -0
  198. package/dist/modules/agent_orchestrator/backend/processes/definitions/TriggerEditor.js.map +7 -0
  199. package/dist/modules/agent_orchestrator/backend/processes/definitions/[id]/page.js +565 -0
  200. package/dist/modules/agent_orchestrator/backend/processes/definitions/[id]/page.js.map +7 -0
  201. package/dist/modules/agent_orchestrator/backend/processes/definitions/[id]/page.meta.js +17 -0
  202. package/dist/modules/agent_orchestrator/backend/processes/definitions/[id]/page.meta.js.map +7 -0
  203. package/dist/modules/agent_orchestrator/backend/processes/definitions/formHelpers.js +69 -0
  204. package/dist/modules/agent_orchestrator/backend/processes/definitions/formHelpers.js.map +7 -0
  205. package/dist/modules/agent_orchestrator/backend/processes/definitions/navigation.js +9 -0
  206. package/dist/modules/agent_orchestrator/backend/processes/definitions/navigation.js.map +7 -0
  207. package/dist/modules/agent_orchestrator/backend/processes/definitions/page.js +735 -0
  208. package/dist/modules/agent_orchestrator/backend/processes/definitions/page.js.map +7 -0
  209. package/dist/modules/agent_orchestrator/backend/processes/definitions/page.meta.js +25 -0
  210. package/dist/modules/agent_orchestrator/backend/processes/definitions/page.meta.js.map +7 -0
  211. package/dist/modules/agent_orchestrator/backend/processes/page.js +244 -0
  212. package/dist/modules/agent_orchestrator/backend/processes/page.js.map +7 -0
  213. package/dist/modules/agent_orchestrator/backend/processes/page.meta.js +29 -0
  214. package/dist/modules/agent_orchestrator/backend/processes/page.meta.js.map +7 -0
  215. package/dist/modules/agent_orchestrator/backend/settings/auto-approval/page.js +204 -0
  216. package/dist/modules/agent_orchestrator/backend/settings/auto-approval/page.js.map +7 -0
  217. package/dist/modules/agent_orchestrator/backend/settings/auto-approval/page.meta.js +30 -0
  218. package/dist/modules/agent_orchestrator/backend/settings/auto-approval/page.meta.js.map +7 -0
  219. package/dist/modules/agent_orchestrator/backend/settings/web-search/AdapterRow.js +241 -0
  220. package/dist/modules/agent_orchestrator/backend/settings/web-search/AdapterRow.js.map +7 -0
  221. package/dist/modules/agent_orchestrator/backend/settings/web-search/WebSearchPreview.js +129 -0
  222. package/dist/modules/agent_orchestrator/backend/settings/web-search/WebSearchPreview.js.map +7 -0
  223. package/dist/modules/agent_orchestrator/backend/settings/web-search/page.js +644 -0
  224. package/dist/modules/agent_orchestrator/backend/settings/web-search/page.js.map +7 -0
  225. package/dist/modules/agent_orchestrator/backend/settings/web-search/page.meta.js +32 -0
  226. package/dist/modules/agent_orchestrator/backend/settings/web-search/page.meta.js.map +7 -0
  227. package/dist/modules/agent_orchestrator/backend/traces/[id]/page.js +1015 -0
  228. package/dist/modules/agent_orchestrator/backend/traces/[id]/page.js.map +7 -0
  229. package/dist/modules/agent_orchestrator/backend/traces/[id]/page.meta.js +18 -0
  230. package/dist/modules/agent_orchestrator/backend/traces/[id]/page.meta.js.map +7 -0
  231. package/dist/modules/agent_orchestrator/backend/traces/page.js +477 -0
  232. package/dist/modules/agent_orchestrator/backend/traces/page.js.map +7 -0
  233. package/dist/modules/agent_orchestrator/backend/traces/page.meta.js +24 -0
  234. package/dist/modules/agent_orchestrator/backend/traces/page.meta.js.map +7 -0
  235. package/dist/modules/agent_orchestrator/cli.js +592 -0
  236. package/dist/modules/agent_orchestrator/cli.js.map +7 -0
  237. package/dist/modules/agent_orchestrator/commands/artifacts.js +127 -0
  238. package/dist/modules/agent_orchestrator/commands/artifacts.js.map +7 -0
  239. package/dist/modules/agent_orchestrator/commands/corrections.js +284 -0
  240. package/dist/modules/agent_orchestrator/commands/corrections.js.map +7 -0
  241. package/dist/modules/agent_orchestrator/commands/dispose.js +265 -0
  242. package/dist/modules/agent_orchestrator/commands/dispose.js.map +7 -0
  243. package/dist/modules/agent_orchestrator/commands/evalRuns.js +202 -0
  244. package/dist/modules/agent_orchestrator/commands/evalRuns.js.map +7 -0
  245. package/dist/modules/agent_orchestrator/commands/grants.js +119 -0
  246. package/dist/modules/agent_orchestrator/commands/grants.js.map +7 -0
  247. package/dist/modules/agent_orchestrator/commands/index.js +11 -0
  248. package/dist/modules/agent_orchestrator/commands/index.js.map +7 -0
  249. package/dist/modules/agent_orchestrator/commands/processes.js +130 -0
  250. package/dist/modules/agent_orchestrator/commands/processes.js.map +7 -0
  251. package/dist/modules/agent_orchestrator/commands/proposals.js +67 -0
  252. package/dist/modules/agent_orchestrator/commands/proposals.js.map +7 -0
  253. package/dist/modules/agent_orchestrator/commands/runActions.js +42 -0
  254. package/dist/modules/agent_orchestrator/commands/runActions.js.map +7 -0
  255. package/dist/modules/agent_orchestrator/commands/runs.js +183 -0
  256. package/dist/modules/agent_orchestrator/commands/runs.js.map +7 -0
  257. package/dist/modules/agent_orchestrator/commands/trace.js +89 -0
  258. package/dist/modules/agent_orchestrator/commands/trace.js.map +7 -0
  259. package/dist/modules/agent_orchestrator/components/AgentIoDrawer.js +45 -0
  260. package/dist/modules/agent_orchestrator/components/AgentIoDrawer.js.map +7 -0
  261. package/dist/modules/agent_orchestrator/components/AgentTimeline.js +129 -0
  262. package/dist/modules/agent_orchestrator/components/AgentTimeline.js.map +7 -0
  263. package/dist/modules/agent_orchestrator/components/DisposeDialog.js +87 -0
  264. package/dist/modules/agent_orchestrator/components/DisposeDialog.js.map +7 -0
  265. package/dist/modules/agent_orchestrator/components/EmptyArt.js +50 -0
  266. package/dist/modules/agent_orchestrator/components/EmptyArt.js.map +7 -0
  267. package/dist/modules/agent_orchestrator/components/InvokeAgentNodeConfig.js +111 -0
  268. package/dist/modules/agent_orchestrator/components/InvokeAgentNodeConfig.js.map +7 -0
  269. package/dist/modules/agent_orchestrator/components/ProcessOutcomeLink.js +42 -0
  270. package/dist/modules/agent_orchestrator/components/ProcessOutcomeLink.js.map +7 -0
  271. package/dist/modules/agent_orchestrator/components/ProposalCard.js +431 -0
  272. package/dist/modules/agent_orchestrator/components/ProposalCard.js.map +7 -0
  273. package/dist/modules/agent_orchestrator/components/ProposalFacts.js +85 -0
  274. package/dist/modules/agent_orchestrator/components/ProposalFacts.js.map +7 -0
  275. package/dist/modules/agent_orchestrator/components/ProposalOptionList.js +190 -0
  276. package/dist/modules/agent_orchestrator/components/ProposalOptionList.js.map +7 -0
  277. package/dist/modules/agent_orchestrator/components/ProposeOnlyNotice.js +25 -0
  278. package/dist/modules/agent_orchestrator/components/ProposeOnlyNotice.js.map +7 -0
  279. package/dist/modules/agent_orchestrator/components/SkillDrawer.js +48 -0
  280. package/dist/modules/agent_orchestrator/components/SkillDrawer.js.map +7 -0
  281. package/dist/modules/agent_orchestrator/components/StartHereGuide.js +183 -0
  282. package/dist/modules/agent_orchestrator/components/StartHereGuide.js.map +7 -0
  283. package/dist/modules/agent_orchestrator/components/SystemHealthTile.js +135 -0
  284. package/dist/modules/agent_orchestrator/components/SystemHealthTile.js.map +7 -0
  285. package/dist/modules/agent_orchestrator/components/WebSearchActivity.js +87 -0
  286. package/dist/modules/agent_orchestrator/components/WebSearchActivity.js.map +7 -0
  287. package/dist/modules/agent_orchestrator/components/agentChips.js +90 -0
  288. package/dist/modules/agent_orchestrator/components/agentChips.js.map +7 -0
  289. package/dist/modules/agent_orchestrator/components/cockpitStatus.js +94 -0
  290. package/dist/modules/agent_orchestrator/components/cockpitStatus.js.map +7 -0
  291. package/dist/modules/agent_orchestrator/components/evalRunTypes.js +209 -0
  292. package/dist/modules/agent_orchestrator/components/evalRunTypes.js.map +7 -0
  293. package/dist/modules/agent_orchestrator/components/health/HealthRow.js +15 -0
  294. package/dist/modules/agent_orchestrator/components/health/HealthRow.js.map +7 -0
  295. package/dist/modules/agent_orchestrator/components/health/HealthStateBadge.js +13 -0
  296. package/dist/modules/agent_orchestrator/components/health/HealthStateBadge.js.map +7 -0
  297. package/dist/modules/agent_orchestrator/components/health/SystemHealthPanel.js +126 -0
  298. package/dist/modules/agent_orchestrator/components/health/SystemHealthPanel.js.map +7 -0
  299. package/dist/modules/agent_orchestrator/components/health/vocabulary.js +40 -0
  300. package/dist/modules/agent_orchestrator/components/health/vocabulary.js.map +7 -0
  301. package/dist/modules/agent_orchestrator/components/optionalRequest.js +7 -0
  302. package/dist/modules/agent_orchestrator/components/optionalRequest.js.map +7 -0
  303. package/dist/modules/agent_orchestrator/components/playgroundRunError.js +37 -0
  304. package/dist/modules/agent_orchestrator/components/playgroundRunError.js.map +7 -0
  305. package/dist/modules/agent_orchestrator/components/playgroundToolCalls.js +12 -0
  306. package/dist/modules/agent_orchestrator/components/playgroundToolCalls.js.map +7 -0
  307. package/dist/modules/agent_orchestrator/components/processTypes.js +454 -0
  308. package/dist/modules/agent_orchestrator/components/processTypes.js.map +7 -0
  309. package/dist/modules/agent_orchestrator/components/proposalCaseStatus.js +64 -0
  310. package/dist/modules/agent_orchestrator/components/proposalCaseStatus.js.map +7 -0
  311. package/dist/modules/agent_orchestrator/components/proposalEdit.js +71 -0
  312. package/dist/modules/agent_orchestrator/components/proposalEdit.js.map +7 -0
  313. package/dist/modules/agent_orchestrator/components/proposalFactsData.js +138 -0
  314. package/dist/modules/agent_orchestrator/components/proposalFactsData.js.map +7 -0
  315. package/dist/modules/agent_orchestrator/components/serverSort.js +34 -0
  316. package/dist/modules/agent_orchestrator/components/serverSort.js.map +7 -0
  317. package/dist/modules/agent_orchestrator/components/subjectRef.js +34 -0
  318. package/dist/modules/agent_orchestrator/components/subjectRef.js.map +7 -0
  319. package/dist/modules/agent_orchestrator/components/types.js +462 -0
  320. package/dist/modules/agent_orchestrator/components/types.js.map +7 -0
  321. package/dist/modules/agent_orchestrator/components/useAgentIcons.js +31 -0
  322. package/dist/modules/agent_orchestrator/components/useAgentIcons.js.map +7 -0
  323. package/dist/modules/agent_orchestrator/components/useAgentLabels.js +35 -0
  324. package/dist/modules/agent_orchestrator/components/useAgentLabels.js.map +7 -0
  325. package/dist/modules/agent_orchestrator/components/useAgentTags.js +32 -0
  326. package/dist/modules/agent_orchestrator/components/useAgentTags.js.map +7 -0
  327. package/dist/modules/agent_orchestrator/components/useCoalescedReload.js +33 -0
  328. package/dist/modules/agent_orchestrator/components/useCoalescedReload.js.map +7 -0
  329. package/dist/modules/agent_orchestrator/data/agentIcons.js +35 -0
  330. package/dist/modules/agent_orchestrator/data/agentIcons.js.map +7 -0
  331. package/dist/modules/agent_orchestrator/data/agentTags.js +26 -0
  332. package/dist/modules/agent_orchestrator/data/agentTags.js.map +7 -0
  333. package/dist/modules/agent_orchestrator/data/entities.js +1382 -0
  334. package/dist/modules/agent_orchestrator/data/entities.js.map +7 -0
  335. package/dist/modules/agent_orchestrator/data/proposalEnvelope.js +168 -0
  336. package/dist/modules/agent_orchestrator/data/proposalEnvelope.js.map +7 -0
  337. package/dist/modules/agent_orchestrator/data/validators.js +949 -0
  338. package/dist/modules/agent_orchestrator/data/validators.js.map +7 -0
  339. package/dist/modules/agent_orchestrator/di.js +169 -0
  340. package/dist/modules/agent_orchestrator/di.js.map +7 -0
  341. package/dist/modules/agent_orchestrator/encryption.js +100 -0
  342. package/dist/modules/agent_orchestrator/encryption.js.map +7 -0
  343. package/dist/modules/agent_orchestrator/events.js +87 -0
  344. package/dist/modules/agent_orchestrator/events.js.map +7 -0
  345. package/dist/modules/agent_orchestrator/examples/deals-health-check-workflow.json +124 -0
  346. package/dist/modules/agent_orchestrator/examples/refund-triage-workflow.json +210 -0
  347. package/dist/modules/agent_orchestrator/generated/file-agents.generated.js +169 -0
  348. package/dist/modules/agent_orchestrator/generated/file-agents.generated.js.map +7 -0
  349. package/dist/modules/agent_orchestrator/i18n/de.json +1495 -0
  350. package/dist/modules/agent_orchestrator/i18n/en.json +1495 -0
  351. package/dist/modules/agent_orchestrator/i18n/es.json +1495 -0
  352. package/dist/modules/agent_orchestrator/i18n/ko.json +1495 -0
  353. package/dist/modules/agent_orchestrator/i18n/pl.json +1495 -0
  354. package/dist/modules/agent_orchestrator/index.js +151 -0
  355. package/dist/modules/agent_orchestrator/index.js.map +7 -0
  356. package/dist/modules/agent_orchestrator/lib/automationLinks.js +12 -0
  357. package/dist/modules/agent_orchestrator/lib/automationLinks.js.map +7 -0
  358. package/dist/modules/agent_orchestrator/lib/context/contextResolver.js +317 -0
  359. package/dist/modules/agent_orchestrator/lib/context/contextResolver.js.map +7 -0
  360. package/dist/modules/agent_orchestrator/lib/context/documentIngest.js +93 -0
  361. package/dist/modules/agent_orchestrator/lib/context/documentIngest.js.map +7 -0
  362. package/dist/modules/agent_orchestrator/lib/context/documentOcrProvider.js +90 -0
  363. package/dist/modules/agent_orchestrator/lib/context/documentOcrProvider.js.map +7 -0
  364. package/dist/modules/agent_orchestrator/lib/context/documentSource.js +44 -0
  365. package/dist/modules/agent_orchestrator/lib/context/documentSource.js.map +7 -0
  366. package/dist/modules/agent_orchestrator/lib/context/index.js +64 -0
  367. package/dist/modules/agent_orchestrator/lib/context/index.js.map +7 -0
  368. package/dist/modules/agent_orchestrator/lib/context/packer.js +47 -0
  369. package/dist/modules/agent_orchestrator/lib/context/packer.js.map +7 -0
  370. package/dist/modules/agent_orchestrator/lib/context/redactor.js +72 -0
  371. package/dist/modules/agent_orchestrator/lib/context/redactor.js.map +7 -0
  372. package/dist/modules/agent_orchestrator/lib/context/registry.js +60 -0
  373. package/dist/modules/agent_orchestrator/lib/context/registry.js.map +7 -0
  374. package/dist/modules/agent_orchestrator/lib/context/retrievalSource.js +69 -0
  375. package/dist/modules/agent_orchestrator/lib/context/retrievalSource.js.map +7 -0
  376. package/dist/modules/agent_orchestrator/lib/crudCache.js +24 -0
  377. package/dist/modules/agent_orchestrator/lib/crudCache.js.map +7 -0
  378. package/dist/modules/agent_orchestrator/lib/disposition/autoApprovalPolicy.js +51 -0
  379. package/dist/modules/agent_orchestrator/lib/disposition/autoApprovalPolicy.js.map +7 -0
  380. package/dist/modules/agent_orchestrator/lib/disposition/dispositionService.js +190 -0
  381. package/dist/modules/agent_orchestrator/lib/disposition/dispositionService.js.map +7 -0
  382. package/dist/modules/agent_orchestrator/lib/disposition/resume.js +42 -0
  383. package/dist/modules/agent_orchestrator/lib/disposition/resume.js.map +7 -0
  384. package/dist/modules/agent_orchestrator/lib/disposition/tenantAutoApprovalPolicy.js +59 -0
  385. package/dist/modules/agent_orchestrator/lib/disposition/tenantAutoApprovalPolicy.js.map +7 -0
  386. package/dist/modules/agent_orchestrator/lib/eval/assertionResolution.js +53 -0
  387. package/dist/modules/agent_orchestrator/lib/eval/assertionResolution.js.map +7 -0
  388. package/dist/modules/agent_orchestrator/lib/eval/canonicalInputKey.js +20 -0
  389. package/dist/modules/agent_orchestrator/lib/eval/canonicalInputKey.js.map +7 -0
  390. package/dist/modules/agent_orchestrator/lib/eval/defaultAssertions.js +78 -0
  391. package/dist/modules/agent_orchestrator/lib/eval/defaultAssertions.js.map +7 -0
  392. package/dist/modules/agent_orchestrator/lib/eval/evalGate.js +71 -0
  393. package/dist/modules/agent_orchestrator/lib/eval/evalGate.js.map +7 -0
  394. package/dist/modules/agent_orchestrator/lib/eval/evalReplayService.js +277 -0
  395. package/dist/modules/agent_orchestrator/lib/eval/evalReplayService.js.map +7 -0
  396. package/dist/modules/agent_orchestrator/lib/eval/evalRuntimeService.js +141 -0
  397. package/dist/modules/agent_orchestrator/lib/eval/evalRuntimeService.js.map +7 -0
  398. package/dist/modules/agent_orchestrator/lib/eval/judgeRubric.js +150 -0
  399. package/dist/modules/agent_orchestrator/lib/eval/judgeRubric.js.map +7 -0
  400. package/dist/modules/agent_orchestrator/lib/eval/llmJudge.js +122 -0
  401. package/dist/modules/agent_orchestrator/lib/eval/llmJudge.js.map +7 -0
  402. package/dist/modules/agent_orchestrator/lib/eval/projectRunView.js +32 -0
  403. package/dist/modules/agent_orchestrator/lib/eval/projectRunView.js.map +7 -0
  404. package/dist/modules/agent_orchestrator/lib/eval/registry/agent.js +240 -0
  405. package/dist/modules/agent_orchestrator/lib/eval/registry/agent.js.map +7 -0
  406. package/dist/modules/agent_orchestrator/lib/eval/registry/economics.js +77 -0
  407. package/dist/modules/agent_orchestrator/lib/eval/registry/economics.js.map +7 -0
  408. package/dist/modules/agent_orchestrator/lib/eval/registry/index.js +97 -0
  409. package/dist/modules/agent_orchestrator/lib/eval/registry/index.js.map +7 -0
  410. package/dist/modules/agent_orchestrator/lib/eval/registry/judge.js +66 -0
  411. package/dist/modules/agent_orchestrator/lib/eval/registry/judge.js.map +7 -0
  412. package/dist/modules/agent_orchestrator/lib/eval/registry/shared.js +146 -0
  413. package/dist/modules/agent_orchestrator/lib/eval/registry/shared.js.map +7 -0
  414. package/dist/modules/agent_orchestrator/lib/eval/registry/structured.js +264 -0
  415. package/dist/modules/agent_orchestrator/lib/eval/registry/structured.js.map +7 -0
  416. package/dist/modules/agent_orchestrator/lib/eval/registry/text.js +110 -0
  417. package/dist/modules/agent_orchestrator/lib/eval/registry/text.js.map +7 -0
  418. package/dist/modules/agent_orchestrator/lib/eval/registry/tools.js +232 -0
  419. package/dist/modules/agent_orchestrator/lib/eval/registry/tools.js.map +7 -0
  420. package/dist/modules/agent_orchestrator/lib/eval/sampling.js +26 -0
  421. package/dist/modules/agent_orchestrator/lib/eval/sampling.js.map +7 -0
  422. package/dist/modules/agent_orchestrator/lib/eval/scorers.js +46 -0
  423. package/dist/modules/agent_orchestrator/lib/eval/scorers.js.map +7 -0
  424. package/dist/modules/agent_orchestrator/lib/eval/types.js +16 -0
  425. package/dist/modules/agent_orchestrator/lib/eval/types.js.map +7 -0
  426. package/dist/modules/agent_orchestrator/lib/featureFlags.js +9 -0
  427. package/dist/modules/agent_orchestrator/lib/featureFlags.js.map +7 -0
  428. package/dist/modules/agent_orchestrator/lib/guardrails/grounding.js +90 -0
  429. package/dist/modules/agent_orchestrator/lib/guardrails/grounding.js.map +7 -0
  430. package/dist/modules/agent_orchestrator/lib/guardrails/groundingSets.js +35 -0
  431. package/dist/modules/agent_orchestrator/lib/guardrails/groundingSets.js.map +7 -0
  432. package/dist/modules/agent_orchestrator/lib/guardrails/guardrailService.js +160 -0
  433. package/dist/modules/agent_orchestrator/lib/guardrails/guardrailService.js.map +7 -0
  434. package/dist/modules/agent_orchestrator/lib/guardrails/promptInjection.js +94 -0
  435. package/dist/modules/agent_orchestrator/lib/guardrails/promptInjection.js.map +7 -0
  436. package/dist/modules/agent_orchestrator/lib/guardrails/publicEndpointRateLimit.js +36 -0
  437. package/dist/modules/agent_orchestrator/lib/guardrails/publicEndpointRateLimit.js.map +7 -0
  438. package/dist/modules/agent_orchestrator/lib/guardrails/syncGroundingSets.js +43 -0
  439. package/dist/modules/agent_orchestrator/lib/guardrails/syncGroundingSets.js.map +7 -0
  440. package/dist/modules/agent_orchestrator/lib/identity/agentAuthMdService.js +136 -0
  441. package/dist/modules/agent_orchestrator/lib/identity/agentAuthMdService.js.map +7 -0
  442. package/dist/modules/agent_orchestrator/lib/identity/agentDelegationGrantService.js +55 -0
  443. package/dist/modules/agent_orchestrator/lib/identity/agentDelegationGrantService.js.map +7 -0
  444. package/dist/modules/agent_orchestrator/lib/identity/agentNoBypassSubscriber.js +50 -0
  445. package/dist/modules/agent_orchestrator/lib/identity/agentNoBypassSubscriber.js.map +7 -0
  446. package/dist/modules/agent_orchestrator/lib/identity/agentPrincipalService.js +149 -0
  447. package/dist/modules/agent_orchestrator/lib/identity/agentPrincipalService.js.map +7 -0
  448. package/dist/modules/agent_orchestrator/lib/identity/agentTokenService.js +138 -0
  449. package/dist/modules/agent_orchestrator/lib/identity/agentTokenService.js.map +7 -0
  450. package/dist/modules/agent_orchestrator/lib/identity/agentWriteScope.js +22 -0
  451. package/dist/modules/agent_orchestrator/lib/identity/agentWriteScope.js.map +7 -0
  452. package/dist/modules/agent_orchestrator/lib/metrics/metricRollupService.js +112 -0
  453. package/dist/modules/agent_orchestrator/lib/metrics/metricRollupService.js.map +7 -0
  454. package/dist/modules/agent_orchestrator/lib/processes/executionSearch.js +16 -0
  455. package/dist/modules/agent_orchestrator/lib/processes/executionSearch.js.map +7 -0
  456. package/dist/modules/agent_orchestrator/lib/processes/materializeAgentWorkflow.js +178 -0
  457. package/dist/modules/agent_orchestrator/lib/processes/materializeAgentWorkflow.js.map +7 -0
  458. package/dist/modules/agent_orchestrator/lib/processes/processProjection.js +220 -0
  459. package/dist/modules/agent_orchestrator/lib/processes/processProjection.js.map +7 -0
  460. package/dist/modules/agent_orchestrator/lib/processes/subjectContext.js +14 -0
  461. package/dist/modules/agent_orchestrator/lib/processes/subjectContext.js.map +7 -0
  462. package/dist/modules/agent_orchestrator/lib/processes/workflowGrant.js +41 -0
  463. package/dist/modules/agent_orchestrator/lib/processes/workflowGrant.js.map +7 -0
  464. package/dist/modules/agent_orchestrator/lib/queue.js +25 -0
  465. package/dist/modules/agent_orchestrator/lib/queue.js.map +7 -0
  466. package/dist/modules/agent_orchestrator/lib/runtime/actionVocabulary.js +66 -0
  467. package/dist/modules/agent_orchestrator/lib/runtime/actionVocabulary.js.map +7 -0
  468. package/dist/modules/agent_orchestrator/lib/runtime/admission.js +113 -0
  469. package/dist/modules/agent_orchestrator/lib/runtime/admission.js.map +7 -0
  470. package/dist/modules/agent_orchestrator/lib/runtime/agentRunSessionStore.js +92 -0
  471. package/dist/modules/agent_orchestrator/lib/runtime/agentRunSessionStore.js.map +7 -0
  472. package/dist/modules/agent_orchestrator/lib/runtime/agentRuntime.js +67 -0
  473. package/dist/modules/agent_orchestrator/lib/runtime/agentRuntime.js.map +7 -0
  474. package/dist/modules/agent_orchestrator/lib/runtime/agentWorkspaceManager.js +111 -0
  475. package/dist/modules/agent_orchestrator/lib/runtime/agentWorkspaceManager.js.map +7 -0
  476. package/dist/modules/agent_orchestrator/lib/runtime/artifactCollector.js +146 -0
  477. package/dist/modules/agent_orchestrator/lib/runtime/artifactCollector.js.map +7 -0
  478. package/dist/modules/agent_orchestrator/lib/runtime/artifactFileStore.js +85 -0
  479. package/dist/modules/agent_orchestrator/lib/runtime/artifactFileStore.js.map +7 -0
  480. package/dist/modules/agent_orchestrator/lib/runtime/attachmentStager.js +62 -0
  481. package/dist/modules/agent_orchestrator/lib/runtime/attachmentStager.js.map +7 -0
  482. package/dist/modules/agent_orchestrator/lib/runtime/errors.js +38 -0
  483. package/dist/modules/agent_orchestrator/lib/runtime/errors.js.map +7 -0
  484. package/dist/modules/agent_orchestrator/lib/runtime/executeProposal.js +37 -0
  485. package/dist/modules/agent_orchestrator/lib/runtime/executeProposal.js.map +7 -0
  486. package/dist/modules/agent_orchestrator/lib/runtime/fileAgentSkills.js +32 -0
  487. package/dist/modules/agent_orchestrator/lib/runtime/fileAgentSkills.js.map +7 -0
  488. package/dist/modules/agent_orchestrator/lib/runtime/fileInput.js +27 -0
  489. package/dist/modules/agent_orchestrator/lib/runtime/fileInput.js.map +7 -0
  490. package/dist/modules/agent_orchestrator/lib/runtime/invokeAgentForWorkflow.js +115 -0
  491. package/dist/modules/agent_orchestrator/lib/runtime/invokeAgentForWorkflow.js.map +7 -0
  492. package/dist/modules/agent_orchestrator/lib/runtime/modelPricing.js +77 -0
  493. package/dist/modules/agent_orchestrator/lib/runtime/modelPricing.js.map +7 -0
  494. package/dist/modules/agent_orchestrator/lib/runtime/nativeAgentRunner.js +422 -0
  495. package/dist/modules/agent_orchestrator/lib/runtime/nativeAgentRunner.js.map +7 -0
  496. package/dist/modules/agent_orchestrator/lib/runtime/nativeTraceCapture.js +132 -0
  497. package/dist/modules/agent_orchestrator/lib/runtime/nativeTraceCapture.js.map +7 -0
  498. package/dist/modules/agent_orchestrator/lib/runtime/openCodeAgentRunner.js +581 -0
  499. package/dist/modules/agent_orchestrator/lib/runtime/openCodeAgentRunner.js.map +7 -0
  500. package/dist/modules/agent_orchestrator/lib/runtime/persistence.js +110 -0
  501. package/dist/modules/agent_orchestrator/lib/runtime/persistence.js.map +7 -0
  502. package/dist/modules/agent_orchestrator/lib/runtime/providerBudget.js +152 -0
  503. package/dist/modules/agent_orchestrator/lib/runtime/providerBudget.js.map +7 -0
  504. package/dist/modules/agent_orchestrator/lib/runtime/rerunContext.js +13 -0
  505. package/dist/modules/agent_orchestrator/lib/runtime/rerunContext.js.map +7 -0
  506. package/dist/modules/agent_orchestrator/lib/runtime/runContext.js +17 -0
  507. package/dist/modules/agent_orchestrator/lib/runtime/runContext.js.map +7 -0
  508. package/dist/modules/agent_orchestrator/lib/runtime/sandboxedScript.js +39 -0
  509. package/dist/modules/agent_orchestrator/lib/runtime/sandboxedScript.js.map +7 -0
  510. package/dist/modules/agent_orchestrator/lib/sdk/agentMarkdown.js +91 -0
  511. package/dist/modules/agent_orchestrator/lib/sdk/agentMarkdown.js.map +7 -0
  512. package/dist/modules/agent_orchestrator/lib/sdk/agentOutcomeContract.js +35 -0
  513. package/dist/modules/agent_orchestrator/lib/sdk/agentOutcomeContract.js.map +7 -0
  514. package/dist/modules/agent_orchestrator/lib/sdk/defineAgent.js +214 -0
  515. package/dist/modules/agent_orchestrator/lib/sdk/defineAgent.js.map +7 -0
  516. package/dist/modules/agent_orchestrator/lib/sdk/defineFileAgent.js +417 -0
  517. package/dist/modules/agent_orchestrator/lib/sdk/defineFileAgent.js.map +7 -0
  518. package/dist/modules/agent_orchestrator/lib/sdk/defineSkill.js +40 -0
  519. package/dist/modules/agent_orchestrator/lib/sdk/defineSkill.js.map +7 -0
  520. package/dist/modules/agent_orchestrator/lib/sdk/outcomeSchema.js +129 -0
  521. package/dist/modules/agent_orchestrator/lib/sdk/outcomeSchema.js.map +7 -0
  522. package/dist/modules/agent_orchestrator/lib/sdk/skillMarkdown.js +78 -0
  523. package/dist/modules/agent_orchestrator/lib/sdk/skillMarkdown.js.map +7 -0
  524. package/dist/modules/agent_orchestrator/lib/seeds.js +224 -0
  525. package/dist/modules/agent_orchestrator/lib/seeds.js.map +7 -0
  526. package/dist/modules/agent_orchestrator/lib/settings/agentSettings.js +55 -0
  527. package/dist/modules/agent_orchestrator/lib/settings/agentSettings.js.map +7 -0
  528. package/dist/modules/agent_orchestrator/lib/systemHealth.js +94 -0
  529. package/dist/modules/agent_orchestrator/lib/systemHealth.js.map +7 -0
  530. package/dist/modules/agent_orchestrator/lib/tasks/eventTriggerMatch.js +81 -0
  531. package/dist/modules/agent_orchestrator/lib/tasks/eventTriggerMatch.js.map +7 -0
  532. package/dist/modules/agent_orchestrator/lib/tasks/milestones.js +96 -0
  533. package/dist/modules/agent_orchestrator/lib/tasks/milestones.js.map +7 -0
  534. package/dist/modules/agent_orchestrator/lib/tasks/outcome.js +44 -0
  535. package/dist/modules/agent_orchestrator/lib/tasks/outcome.js.map +7 -0
  536. package/dist/modules/agent_orchestrator/lib/tasks/outcomeLink.js +45 -0
  537. package/dist/modules/agent_orchestrator/lib/tasks/outcomeLink.js.map +7 -0
  538. package/dist/modules/agent_orchestrator/lib/tasks/schedule.js +63 -0
  539. package/dist/modules/agent_orchestrator/lib/tasks/schedule.js.map +7 -0
  540. package/dist/modules/agent_orchestrator/lib/tasks/scheduleValidation.js +25 -0
  541. package/dist/modules/agent_orchestrator/lib/tasks/scheduleValidation.js.map +7 -0
  542. package/dist/modules/agent_orchestrator/lib/tasks/triggers.js +34 -0
  543. package/dist/modules/agent_orchestrator/lib/tasks/triggers.js.map +7 -0
  544. package/dist/modules/agent_orchestrator/lib/tokens/computeAgentTokenUsage.js +70 -0
  545. package/dist/modules/agent_orchestrator/lib/tokens/computeAgentTokenUsage.js.map +7 -0
  546. package/dist/modules/agent_orchestrator/lib/tokens/types.js +1 -0
  547. package/dist/modules/agent_orchestrator/lib/tokens/types.js.map +7 -0
  548. package/dist/modules/agent_orchestrator/lib/trace/artifactStore.js +89 -0
  549. package/dist/modules/agent_orchestrator/lib/trace/artifactStore.js.map +7 -0
  550. package/dist/modules/agent_orchestrator/lib/trace/correctionService.js +61 -0
  551. package/dist/modules/agent_orchestrator/lib/trace/correctionService.js.map +7 -0
  552. package/dist/modules/agent_orchestrator/lib/trace/ingestAuth.js +39 -0
  553. package/dist/modules/agent_orchestrator/lib/trace/ingestAuth.js.map +7 -0
  554. package/dist/modules/agent_orchestrator/lib/trace/redactToolSummary.js +44 -0
  555. package/dist/modules/agent_orchestrator/lib/trace/redactToolSummary.js.map +7 -0
  556. package/dist/modules/agent_orchestrator/lib/trace/spanTimeline.js +96 -0
  557. package/dist/modules/agent_orchestrator/lib/trace/spanTimeline.js.map +7 -0
  558. package/dist/modules/agent_orchestrator/lib/trace/traceIngestionService.js +168 -0
  559. package/dist/modules/agent_orchestrator/lib/trace/traceIngestionService.js.map +7 -0
  560. package/dist/modules/agent_orchestrator/lib/webSearch/guardrails.js +116 -0
  561. package/dist/modules/agent_orchestrator/lib/webSearch/guardrails.js.map +7 -0
  562. package/dist/modules/agent_orchestrator/lib/webSearch/healthCache.js +68 -0
  563. package/dist/modules/agent_orchestrator/lib/webSearch/healthCache.js.map +7 -0
  564. package/dist/modules/agent_orchestrator/lib/webSearch/healthProbePlan.js +16 -0
  565. package/dist/modules/agent_orchestrator/lib/webSearch/healthProbePlan.js.map +7 -0
  566. package/dist/modules/agent_orchestrator/lib/webSearch/policy.js +172 -0
  567. package/dist/modules/agent_orchestrator/lib/webSearch/policy.js.map +7 -0
  568. package/dist/modules/agent_orchestrator/lib/webSearch/registry.js +113 -0
  569. package/dist/modules/agent_orchestrator/lib/webSearch/registry.js.map +7 -0
  570. package/dist/modules/agent_orchestrator/lib/webSearch/secretStorage.js +87 -0
  571. package/dist/modules/agent_orchestrator/lib/webSearch/secretStorage.js.map +7 -0
  572. package/dist/modules/agent_orchestrator/lib/webSearch/steps.js +48 -0
  573. package/dist/modules/agent_orchestrator/lib/webSearch/steps.js.map +7 -0
  574. package/dist/modules/agent_orchestrator/lib/webSearch/tools.js +176 -0
  575. package/dist/modules/agent_orchestrator/lib/webSearch/tools.js.map +7 -0
  576. package/dist/modules/agent_orchestrator/lib/workInbox/agentDispositionSource.js +151 -0
  577. package/dist/modules/agent_orchestrator/lib/workInbox/agentDispositionSource.js.map +7 -0
  578. package/dist/modules/agent_orchestrator/migrations/Migration20260906141535_agent_orchestrator.js +200 -0
  579. package/dist/modules/agent_orchestrator/migrations/Migration20260906141535_agent_orchestrator.js.map +7 -0
  580. package/dist/modules/agent_orchestrator/notifications.js +32 -0
  581. package/dist/modules/agent_orchestrator/notifications.js.map +7 -0
  582. package/dist/modules/agent_orchestrator/setup.js +147 -0
  583. package/dist/modules/agent_orchestrator/setup.js.map +7 -0
  584. package/dist/modules/agent_orchestrator/subscribers/process-event-trigger.js +140 -0
  585. package/dist/modules/agent_orchestrator/subscribers/process-event-trigger.js.map +7 -0
  586. package/dist/modules/agent_orchestrator/subscribers/process-proposal-created.js +17 -0
  587. package/dist/modules/agent_orchestrator/subscribers/process-proposal-created.js.map +7 -0
  588. package/dist/modules/agent_orchestrator/subscribers/process-proposal-disposed.js +15 -0
  589. package/dist/modules/agent_orchestrator/subscribers/process-proposal-disposed.js.map +7 -0
  590. package/dist/modules/agent_orchestrator/subscribers/process-run-completed.js +17 -0
  591. package/dist/modules/agent_orchestrator/subscribers/process-run-completed.js.map +7 -0
  592. package/dist/modules/agent_orchestrator/subscribers/process-run-ingested.js +17 -0
  593. package/dist/modules/agent_orchestrator/subscribers/process-run-ingested.js.map +7 -0
  594. package/dist/modules/agent_orchestrator/subscribers/process-workflow-cancelled.js +20 -0
  595. package/dist/modules/agent_orchestrator/subscribers/process-workflow-cancelled.js.map +7 -0
  596. package/dist/modules/agent_orchestrator/subscribers/process-workflow-completed.js +20 -0
  597. package/dist/modules/agent_orchestrator/subscribers/process-workflow-completed.js.map +7 -0
  598. package/dist/modules/agent_orchestrator/subscribers/process-workflow-failed.js +21 -0
  599. package/dist/modules/agent_orchestrator/subscribers/process-workflow-failed.js.map +7 -0
  600. package/dist/modules/agent_orchestrator/subscribers/process-workflow-milestone.js +30 -0
  601. package/dist/modules/agent_orchestrator/subscribers/process-workflow-milestone.js.map +7 -0
  602. package/dist/modules/agent_orchestrator/subscribers/process-workflow-started.js +25 -0
  603. package/dist/modules/agent_orchestrator/subscribers/process-workflow-started.js.map +7 -0
  604. package/dist/modules/agent_orchestrator/subscribers/proposal-disposed-notification-clear.js +34 -0
  605. package/dist/modules/agent_orchestrator/subscribers/proposal-disposed-notification-clear.js.map +7 -0
  606. package/dist/modules/agent_orchestrator/subscribers/proposal-pending-notification.js +53 -0
  607. package/dist/modules/agent_orchestrator/subscribers/proposal-pending-notification.js.map +7 -0
  608. package/dist/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.client.js +44 -0
  609. package/dist/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.client.js.map +7 -0
  610. package/dist/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.js +17 -0
  611. package/dist/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.js.map +7 -0
  612. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.client.js +107 -0
  613. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.client.js.map +7 -0
  614. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.js +17 -0
  615. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.js.map +7 -0
  616. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-link/widget.js +28 -0
  617. package/dist/modules/agent_orchestrator/widgets/injection/task-proposal-link/widget.js.map +7 -0
  618. package/dist/modules/agent_orchestrator/widgets/injection-table.js +33 -0
  619. package/dist/modules/agent_orchestrator/widgets/injection-table.js.map +7 -0
  620. package/dist/modules/agent_orchestrator/workers/eval-suite-runner.js +56 -0
  621. package/dist/modules/agent_orchestrator/workers/eval-suite-runner.js.map +7 -0
  622. package/dist/modules/agent_orchestrator/workers/llm-judge.js +29 -0
  623. package/dist/modules/agent_orchestrator/workers/llm-judge.js.map +7 -0
  624. package/dist/modules/agent_orchestrator/workers/metric-rollup.js +29 -0
  625. package/dist/modules/agent_orchestrator/workers/metric-rollup.js.map +7 -0
  626. package/dist/modules/agent_orchestrator/workers/process-execution-starter.js +130 -0
  627. package/dist/modules/agent_orchestrator/workers/process-execution-starter.js.map +7 -0
  628. package/dist/modules/record_locks/lib/conflictValues.js +78 -0
  629. package/dist/modules/record_locks/lib/conflictValues.js.map +7 -0
  630. package/dist/modules/record_locks/lib/crudMutationGuardService.js +19 -4
  631. package/dist/modules/record_locks/lib/crudMutationGuardService.js.map +2 -2
  632. package/dist/modules/record_locks/lib/recordLockService.js +1 -44
  633. package/dist/modules/record_locks/lib/recordLockService.js.map +2 -2
  634. package/jest.config.cjs +2 -0
  635. package/package.json +18 -6
  636. package/src/index.ts +1 -1
  637. package/src/modules/agent_orchestrator/.ai/skills/om-create-opencode-agent/SKILL.md +251 -0
  638. package/src/modules/agent_orchestrator/AGENTS.md +374 -0
  639. package/src/modules/agent_orchestrator/DEMO.md +175 -0
  640. package/src/modules/agent_orchestrator/acl.ts +131 -0
  641. package/src/modules/agent_orchestrator/ai-agents.ts +70 -0
  642. package/src/modules/agent_orchestrator/ai-skills.ts +59 -0
  643. package/src/modules/agent_orchestrator/ai-tools.ts +391 -0
  644. package/src/modules/agent_orchestrator/api/agents/[id]/files/route.ts +77 -0
  645. package/src/modules/agent_orchestrator/api/agents/[id]/metrics/route.ts +106 -0
  646. package/src/modules/agent_orchestrator/api/agents/[id]/route.ts +166 -0
  647. package/src/modules/agent_orchestrator/api/agents/[id]/run/route.ts +339 -0
  648. package/src/modules/agent_orchestrator/api/agents/[id]/settings/route.ts +119 -0
  649. package/src/modules/agent_orchestrator/api/agents/route.ts +124 -0
  650. package/src/modules/agent_orchestrator/api/artifacts/file/[id]/route.ts +80 -0
  651. package/src/modules/agent_orchestrator/api/audit/by-instigator/[humanUserId]/route.ts +143 -0
  652. package/src/modules/agent_orchestrator/api/auto-approval/settings/route.ts +143 -0
  653. package/src/modules/agent_orchestrator/api/context-bundles/route.ts +89 -0
  654. package/src/modules/agent_orchestrator/api/corrections/route.ts +119 -0
  655. package/src/modules/agent_orchestrator/api/eval-assertions/preview/route.ts +123 -0
  656. package/src/modules/agent_orchestrator/api/eval-assertions/route.ts +228 -0
  657. package/src/modules/agent_orchestrator/api/eval-cases/[id]/approve/route.ts +101 -0
  658. package/src/modules/agent_orchestrator/api/eval-cases/[id]/archive/route.ts +100 -0
  659. package/src/modules/agent_orchestrator/api/eval-cases/[id]/route.ts +84 -0
  660. package/src/modules/agent_orchestrator/api/eval-cases/export/route.ts +92 -0
  661. package/src/modules/agent_orchestrator/api/eval-cases/route.ts +159 -0
  662. package/src/modules/agent_orchestrator/api/eval-runs/[id]/cancel/route.ts +78 -0
  663. package/src/modules/agent_orchestrator/api/eval-runs/[id]/case-runs/[caseRunId]/results/route.ts +82 -0
  664. package/src/modules/agent_orchestrator/api/eval-runs/[id]/route.ts +133 -0
  665. package/src/modules/agent_orchestrator/api/eval-runs/route.ts +197 -0
  666. package/src/modules/agent_orchestrator/api/eval-scorers/route.ts +51 -0
  667. package/src/modules/agent_orchestrator/api/executions/[id]/route.ts +106 -0
  668. package/src/modules/agent_orchestrator/api/executions/route.ts +206 -0
  669. package/src/modules/agent_orchestrator/api/features/route.ts +71 -0
  670. package/src/modules/agent_orchestrator/api/guardrail-checks/route.ts +86 -0
  671. package/src/modules/agent_orchestrator/api/identity/agent/auth/route.ts +121 -0
  672. package/src/modules/agent_orchestrator/api/identity/grants/[id]/revoke/route.ts +133 -0
  673. package/src/modules/agent_orchestrator/api/identity/token/route.ts +102 -0
  674. package/src/modules/agent_orchestrator/api/identity/well-known/route.ts +60 -0
  675. package/src/modules/agent_orchestrator/api/metrics/agents/route.ts +160 -0
  676. package/src/modules/agent_orchestrator/api/metrics/overview/route.ts +240 -0
  677. package/src/modules/agent_orchestrator/api/openapi.ts +31 -0
  678. package/src/modules/agent_orchestrator/api/processes/[id]/executions/route.ts +211 -0
  679. package/src/modules/agent_orchestrator/api/processes/[id]/route.ts +70 -0
  680. package/src/modules/agent_orchestrator/api/processes/route.ts +458 -0
  681. package/src/modules/agent_orchestrator/api/proposals/[id]/dispose/route.ts +131 -0
  682. package/src/modules/agent_orchestrator/api/proposals/route.ts +113 -0
  683. package/src/modules/agent_orchestrator/api/runs/[id]/artifact/route.ts +93 -0
  684. package/src/modules/agent_orchestrator/api/runs/[id]/artifacts/route.ts +83 -0
  685. package/src/modules/agent_orchestrator/api/runs/[id]/eval-case/route.ts +91 -0
  686. package/src/modules/agent_orchestrator/api/runs/[id]/flag/route.ts +89 -0
  687. package/src/modules/agent_orchestrator/api/runs/[id]/rerun/route.ts +195 -0
  688. package/src/modules/agent_orchestrator/api/runs/[id]/route.ts +102 -0
  689. package/src/modules/agent_orchestrator/api/runs/route.ts +146 -0
  690. package/src/modules/agent_orchestrator/api/tokens/estimate/route.ts +61 -0
  691. package/src/modules/agent_orchestrator/api/trace/ingest/route.ts +98 -0
  692. package/src/modules/agent_orchestrator/api/web-search/health/route.ts +268 -0
  693. package/src/modules/agent_orchestrator/api/web-search/preview/route.ts +184 -0
  694. package/src/modules/agent_orchestrator/api/web-search/settings/route.ts +309 -0
  695. package/src/modules/agent_orchestrator/auth.md +107 -0
  696. package/src/modules/agent_orchestrator/backend/agents/[id]/components/ActivityTab.tsx +118 -0
  697. package/src/modules/agent_orchestrator/backend/agents/[id]/components/AgentConfigDrawer.tsx +96 -0
  698. package/src/modules/agent_orchestrator/backend/agents/[id]/components/AgentHeaderCard.tsx +174 -0
  699. package/src/modules/agent_orchestrator/backend/agents/[id]/components/AssertionFormDrawer.tsx +418 -0
  700. package/src/modules/agent_orchestrator/backend/agents/[id]/components/ConfigurationTab.tsx +185 -0
  701. package/src/modules/agent_orchestrator/backend/agents/[id]/components/EvalCaseDrawer.tsx +488 -0
  702. package/src/modules/agent_orchestrator/backend/agents/[id]/components/EvalResultsDrawer.tsx +244 -0
  703. package/src/modules/agent_orchestrator/backend/agents/[id]/components/EvaluationTab.tsx +715 -0
  704. package/src/modules/agent_orchestrator/backend/agents/[id]/components/FilesTab.tsx +328 -0
  705. package/src/modules/agent_orchestrator/backend/agents/[id]/components/OverviewTab.tsx +211 -0
  706. package/src/modules/agent_orchestrator/backend/agents/[id]/components/RunEvaluationDrawer.tsx +247 -0
  707. package/src/modules/agent_orchestrator/backend/agents/[id]/components/TokenCalculatorTab.tsx +143 -0
  708. package/src/modules/agent_orchestrator/backend/agents/[id]/components/filesShared.ts +149 -0
  709. package/src/modules/agent_orchestrator/backend/agents/[id]/components/workspacePrimitives.tsx +236 -0
  710. package/src/modules/agent_orchestrator/backend/agents/[id]/components/workspaceShared.ts +193 -0
  711. package/src/modules/agent_orchestrator/backend/agents/[id]/page.meta.ts +14 -0
  712. package/src/modules/agent_orchestrator/backend/agents/[id]/page.tsx +335 -0
  713. package/src/modules/agent_orchestrator/backend/agents/agentListFilters.ts +95 -0
  714. package/src/modules/agent_orchestrator/backend/agents/page.meta.ts +26 -0
  715. package/src/modules/agent_orchestrator/backend/agents/page.tsx +549 -0
  716. package/src/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.meta.ts +15 -0
  717. package/src/modules/agent_orchestrator/backend/audit/by-instigator/[humanUserId]/page.tsx +126 -0
  718. package/src/modules/agent_orchestrator/backend/audit/page.meta.ts +25 -0
  719. package/src/modules/agent_orchestrator/backend/audit/page.tsx +392 -0
  720. package/src/modules/agent_orchestrator/backend/caseload/[proposalId]/page.meta.ts +14 -0
  721. package/src/modules/agent_orchestrator/backend/caseload/[proposalId]/page.tsx +298 -0
  722. package/src/modules/agent_orchestrator/backend/caseload/hooks.ts +583 -0
  723. package/src/modules/agent_orchestrator/backend/caseload/page.meta.ts +23 -0
  724. package/src/modules/agent_orchestrator/backend/caseload/page.tsx +1761 -0
  725. package/src/modules/agent_orchestrator/backend/eval-cases/[id]/page.meta.ts +14 -0
  726. package/src/modules/agent_orchestrator/backend/eval-cases/[id]/page.tsx +446 -0
  727. package/src/modules/agent_orchestrator/backend/eval-runs/[id]/page.meta.ts +14 -0
  728. package/src/modules/agent_orchestrator/backend/eval-runs/[id]/page.tsx +824 -0
  729. package/src/modules/agent_orchestrator/backend/overview/page.meta.ts +25 -0
  730. package/src/modules/agent_orchestrator/backend/overview/page.tsx +755 -0
  731. package/src/modules/agent_orchestrator/backend/playground/PlaygroundEvalPanel.tsx +292 -0
  732. package/src/modules/agent_orchestrator/backend/playground/page.meta.ts +22 -0
  733. package/src/modules/agent_orchestrator/backend/playground/page.tsx +647 -0
  734. package/src/modules/agent_orchestrator/backend/processes/[id]/page.meta.ts +14 -0
  735. package/src/modules/agent_orchestrator/backend/processes/[id]/page.tsx +856 -0
  736. package/src/modules/agent_orchestrator/backend/processes/definitions/MilestoneEditor.tsx +285 -0
  737. package/src/modules/agent_orchestrator/backend/processes/definitions/TriggerEditor.tsx +391 -0
  738. package/src/modules/agent_orchestrator/backend/processes/definitions/[id]/page.meta.ts +13 -0
  739. package/src/modules/agent_orchestrator/backend/processes/definitions/[id]/page.tsx +705 -0
  740. package/src/modules/agent_orchestrator/backend/processes/definitions/formHelpers.ts +100 -0
  741. package/src/modules/agent_orchestrator/backend/processes/definitions/navigation.ts +6 -0
  742. package/src/modules/agent_orchestrator/backend/processes/definitions/page.meta.ts +23 -0
  743. package/src/modules/agent_orchestrator/backend/processes/definitions/page.tsx +904 -0
  744. package/src/modules/agent_orchestrator/backend/processes/page.meta.ts +27 -0
  745. package/src/modules/agent_orchestrator/backend/processes/page.tsx +317 -0
  746. package/src/modules/agent_orchestrator/backend/settings/auto-approval/page.meta.ts +28 -0
  747. package/src/modules/agent_orchestrator/backend/settings/auto-approval/page.tsx +315 -0
  748. package/src/modules/agent_orchestrator/backend/settings/web-search/AdapterRow.tsx +351 -0
  749. package/src/modules/agent_orchestrator/backend/settings/web-search/WebSearchPreview.tsx +203 -0
  750. package/src/modules/agent_orchestrator/backend/settings/web-search/page.meta.ts +30 -0
  751. package/src/modules/agent_orchestrator/backend/settings/web-search/page.tsx +913 -0
  752. package/src/modules/agent_orchestrator/backend/traces/[id]/page.meta.ts +14 -0
  753. package/src/modules/agent_orchestrator/backend/traces/[id]/page.tsx +1383 -0
  754. package/src/modules/agent_orchestrator/backend/traces/page.meta.ts +22 -0
  755. package/src/modules/agent_orchestrator/backend/traces/page.tsx +601 -0
  756. package/src/modules/agent_orchestrator/cli.ts +719 -0
  757. package/src/modules/agent_orchestrator/commands/artifacts.ts +171 -0
  758. package/src/modules/agent_orchestrator/commands/corrections.ts +345 -0
  759. package/src/modules/agent_orchestrator/commands/dispose.ts +380 -0
  760. package/src/modules/agent_orchestrator/commands/evalRuns.ts +291 -0
  761. package/src/modules/agent_orchestrator/commands/grants.ts +149 -0
  762. package/src/modules/agent_orchestrator/commands/index.ts +10 -0
  763. package/src/modules/agent_orchestrator/commands/processes.ts +176 -0
  764. package/src/modules/agent_orchestrator/commands/proposals.ts +82 -0
  765. package/src/modules/agent_orchestrator/commands/runActions.ts +52 -0
  766. package/src/modules/agent_orchestrator/commands/runs.ts +212 -0
  767. package/src/modules/agent_orchestrator/commands/trace.ts +118 -0
  768. package/src/modules/agent_orchestrator/components/AgentIoDrawer.tsx +87 -0
  769. package/src/modules/agent_orchestrator/components/AgentTimeline.tsx +175 -0
  770. package/src/modules/agent_orchestrator/components/DisposeDialog.tsx +112 -0
  771. package/src/modules/agent_orchestrator/components/EmptyArt.tsx +51 -0
  772. package/src/modules/agent_orchestrator/components/InvokeAgentNodeConfig.tsx +150 -0
  773. package/src/modules/agent_orchestrator/components/ProcessOutcomeLink.tsx +50 -0
  774. package/src/modules/agent_orchestrator/components/ProposalCard.tsx +602 -0
  775. package/src/modules/agent_orchestrator/components/ProposalFacts.tsx +139 -0
  776. package/src/modules/agent_orchestrator/components/ProposalOptionList.tsx +273 -0
  777. package/src/modules/agent_orchestrator/components/ProposeOnlyNotice.tsx +40 -0
  778. package/src/modules/agent_orchestrator/components/SkillDrawer.tsx +75 -0
  779. package/src/modules/agent_orchestrator/components/StartHereGuide.tsx +241 -0
  780. package/src/modules/agent_orchestrator/components/SystemHealthTile.tsx +189 -0
  781. package/src/modules/agent_orchestrator/components/WebSearchActivity.tsx +180 -0
  782. package/src/modules/agent_orchestrator/components/agentChips.tsx +123 -0
  783. package/src/modules/agent_orchestrator/components/cockpitStatus.tsx +154 -0
  784. package/src/modules/agent_orchestrator/components/evalRunTypes.ts +339 -0
  785. package/src/modules/agent_orchestrator/components/health/HealthRow.tsx +36 -0
  786. package/src/modules/agent_orchestrator/components/health/HealthStateBadge.tsx +21 -0
  787. package/src/modules/agent_orchestrator/components/health/SystemHealthPanel.tsx +206 -0
  788. package/src/modules/agent_orchestrator/components/health/vocabulary.ts +53 -0
  789. package/src/modules/agent_orchestrator/components/optionalRequest.ts +18 -0
  790. package/src/modules/agent_orchestrator/components/playgroundRunError.ts +63 -0
  791. package/src/modules/agent_orchestrator/components/playgroundToolCalls.ts +32 -0
  792. package/src/modules/agent_orchestrator/components/processTypes.ts +613 -0
  793. package/src/modules/agent_orchestrator/components/proposalCaseStatus.ts +100 -0
  794. package/src/modules/agent_orchestrator/components/proposalEdit.ts +118 -0
  795. package/src/modules/agent_orchestrator/components/proposalFactsData.ts +222 -0
  796. package/src/modules/agent_orchestrator/components/serverSort.ts +56 -0
  797. package/src/modules/agent_orchestrator/components/subjectRef.ts +61 -0
  798. package/src/modules/agent_orchestrator/components/types.ts +834 -0
  799. package/src/modules/agent_orchestrator/components/useAgentIcons.ts +42 -0
  800. package/src/modules/agent_orchestrator/components/useAgentLabels.ts +44 -0
  801. package/src/modules/agent_orchestrator/components/useAgentTags.ts +38 -0
  802. package/src/modules/agent_orchestrator/components/useCoalescedReload.ts +43 -0
  803. package/src/modules/agent_orchestrator/data/agentIcons.ts +52 -0
  804. package/src/modules/agent_orchestrator/data/agentTags.ts +39 -0
  805. package/src/modules/agent_orchestrator/data/entities.ts +1904 -0
  806. package/src/modules/agent_orchestrator/data/proposalEnvelope.ts +263 -0
  807. package/src/modules/agent_orchestrator/data/validators.ts +1585 -0
  808. package/src/modules/agent_orchestrator/di.ts +182 -0
  809. package/src/modules/agent_orchestrator/encryption.ts +98 -0
  810. package/src/modules/agent_orchestrator/events.ts +97 -0
  811. package/src/modules/agent_orchestrator/examples/deals-health-check-workflow.json +124 -0
  812. package/src/modules/agent_orchestrator/examples/refund-triage-workflow.json +210 -0
  813. package/src/modules/agent_orchestrator/generated/file-agents.generated.ts +207 -0
  814. package/src/modules/agent_orchestrator/i18n/.hardcoded-allowlist.json +22 -0
  815. package/src/modules/agent_orchestrator/i18n/de.json +1495 -0
  816. package/src/modules/agent_orchestrator/i18n/en.json +1495 -0
  817. package/src/modules/agent_orchestrator/i18n/es.json +1495 -0
  818. package/src/modules/agent_orchestrator/i18n/ko.json +1495 -0
  819. package/src/modules/agent_orchestrator/i18n/pl.json +1495 -0
  820. package/src/modules/agent_orchestrator/index.ts +155 -0
  821. package/src/modules/agent_orchestrator/lib/automationLinks.ts +20 -0
  822. package/src/modules/agent_orchestrator/lib/context/contextResolver.ts +528 -0
  823. package/src/modules/agent_orchestrator/lib/context/documentIngest.ts +187 -0
  824. package/src/modules/agent_orchestrator/lib/context/documentOcrProvider.ts +189 -0
  825. package/src/modules/agent_orchestrator/lib/context/documentSource.ts +88 -0
  826. package/src/modules/agent_orchestrator/lib/context/index.ts +68 -0
  827. package/src/modules/agent_orchestrator/lib/context/packer.ts +114 -0
  828. package/src/modules/agent_orchestrator/lib/context/redactor.ts +138 -0
  829. package/src/modules/agent_orchestrator/lib/context/registry.ts +153 -0
  830. package/src/modules/agent_orchestrator/lib/context/retrievalSource.ts +146 -0
  831. package/src/modules/agent_orchestrator/lib/crudCache.ts +62 -0
  832. package/src/modules/agent_orchestrator/lib/disposition/autoApprovalPolicy.ts +163 -0
  833. package/src/modules/agent_orchestrator/lib/disposition/dispositionService.ts +310 -0
  834. package/src/modules/agent_orchestrator/lib/disposition/resume.ts +81 -0
  835. package/src/modules/agent_orchestrator/lib/disposition/tenantAutoApprovalPolicy.ts +100 -0
  836. package/src/modules/agent_orchestrator/lib/eval/assertionResolution.ts +105 -0
  837. package/src/modules/agent_orchestrator/lib/eval/canonicalInputKey.ts +32 -0
  838. package/src/modules/agent_orchestrator/lib/eval/defaultAssertions.ts +103 -0
  839. package/src/modules/agent_orchestrator/lib/eval/evalGate.ts +139 -0
  840. package/src/modules/agent_orchestrator/lib/eval/evalReplayService.ts +517 -0
  841. package/src/modules/agent_orchestrator/lib/eval/evalRuntimeService.ts +215 -0
  842. package/src/modules/agent_orchestrator/lib/eval/judgeRubric.ts +212 -0
  843. package/src/modules/agent_orchestrator/lib/eval/llmJudge.ts +174 -0
  844. package/src/modules/agent_orchestrator/lib/eval/projectRunView.ts +53 -0
  845. package/src/modules/agent_orchestrator/lib/eval/registry/agent.ts +334 -0
  846. package/src/modules/agent_orchestrator/lib/eval/registry/economics.ts +91 -0
  847. package/src/modules/agent_orchestrator/lib/eval/registry/index.ts +157 -0
  848. package/src/modules/agent_orchestrator/lib/eval/registry/judge.ts +102 -0
  849. package/src/modules/agent_orchestrator/lib/eval/registry/shared.ts +208 -0
  850. package/src/modules/agent_orchestrator/lib/eval/registry/structured.ts +297 -0
  851. package/src/modules/agent_orchestrator/lib/eval/registry/text.ts +125 -0
  852. package/src/modules/agent_orchestrator/lib/eval/registry/tools.ts +263 -0
  853. package/src/modules/agent_orchestrator/lib/eval/sampling.ts +33 -0
  854. package/src/modules/agent_orchestrator/lib/eval/scorers.ts +90 -0
  855. package/src/modules/agent_orchestrator/lib/eval/types.ts +189 -0
  856. package/src/modules/agent_orchestrator/lib/featureFlags.ts +22 -0
  857. package/src/modules/agent_orchestrator/lib/guardrails/grounding.ts +172 -0
  858. package/src/modules/agent_orchestrator/lib/guardrails/groundingSets.ts +61 -0
  859. package/src/modules/agent_orchestrator/lib/guardrails/guardrailService.ts +293 -0
  860. package/src/modules/agent_orchestrator/lib/guardrails/promptInjection.ts +163 -0
  861. package/src/modules/agent_orchestrator/lib/guardrails/publicEndpointRateLimit.ts +74 -0
  862. package/src/modules/agent_orchestrator/lib/guardrails/syncGroundingSets.ts +68 -0
  863. package/src/modules/agent_orchestrator/lib/identity/agentAuthMdService.ts +247 -0
  864. package/src/modules/agent_orchestrator/lib/identity/agentDelegationGrantService.ts +85 -0
  865. package/src/modules/agent_orchestrator/lib/identity/agentNoBypassSubscriber.ts +98 -0
  866. package/src/modules/agent_orchestrator/lib/identity/agentPrincipalService.ts +230 -0
  867. package/src/modules/agent_orchestrator/lib/identity/agentTokenService.ts +281 -0
  868. package/src/modules/agent_orchestrator/lib/identity/agentWriteScope.ts +68 -0
  869. package/src/modules/agent_orchestrator/lib/metrics/metricRollupService.ts +168 -0
  870. package/src/modules/agent_orchestrator/lib/processes/executionSearch.ts +35 -0
  871. package/src/modules/agent_orchestrator/lib/processes/materializeAgentWorkflow.ts +320 -0
  872. package/src/modules/agent_orchestrator/lib/processes/processProjection.ts +401 -0
  873. package/src/modules/agent_orchestrator/lib/processes/subjectContext.ts +30 -0
  874. package/src/modules/agent_orchestrator/lib/processes/workflowGrant.ts +84 -0
  875. package/src/modules/agent_orchestrator/lib/queue.ts +56 -0
  876. package/src/modules/agent_orchestrator/lib/runtime/actionVocabulary.ts +127 -0
  877. package/src/modules/agent_orchestrator/lib/runtime/admission.ts +177 -0
  878. package/src/modules/agent_orchestrator/lib/runtime/agentRunSessionStore.ts +166 -0
  879. package/src/modules/agent_orchestrator/lib/runtime/agentRuntime.ts +108 -0
  880. package/src/modules/agent_orchestrator/lib/runtime/agentWorkspaceManager.ts +187 -0
  881. package/src/modules/agent_orchestrator/lib/runtime/artifactCollector.ts +188 -0
  882. package/src/modules/agent_orchestrator/lib/runtime/artifactFileStore.ts +189 -0
  883. package/src/modules/agent_orchestrator/lib/runtime/attachmentStager.ts +100 -0
  884. package/src/modules/agent_orchestrator/lib/runtime/errors.ts +63 -0
  885. package/src/modules/agent_orchestrator/lib/runtime/executeProposal.ts +78 -0
  886. package/src/modules/agent_orchestrator/lib/runtime/fileAgentSkills.ts +81 -0
  887. package/src/modules/agent_orchestrator/lib/runtime/fileInput.ts +44 -0
  888. package/src/modules/agent_orchestrator/lib/runtime/invokeAgentForWorkflow.ts +255 -0
  889. package/src/modules/agent_orchestrator/lib/runtime/modelPricing.ts +146 -0
  890. package/src/modules/agent_orchestrator/lib/runtime/nativeAgentRunner.ts +617 -0
  891. package/src/modules/agent_orchestrator/lib/runtime/nativeTraceCapture.ts +217 -0
  892. package/src/modules/agent_orchestrator/lib/runtime/openCodeAgentRunner.ts +889 -0
  893. package/src/modules/agent_orchestrator/lib/runtime/persistence.ts +314 -0
  894. package/src/modules/agent_orchestrator/lib/runtime/providerBudget.ts +230 -0
  895. package/src/modules/agent_orchestrator/lib/runtime/rerunContext.ts +26 -0
  896. package/src/modules/agent_orchestrator/lib/runtime/runContext.ts +47 -0
  897. package/src/modules/agent_orchestrator/lib/runtime/sandboxedScript.ts +106 -0
  898. package/src/modules/agent_orchestrator/lib/sdk/agentMarkdown.ts +157 -0
  899. package/src/modules/agent_orchestrator/lib/sdk/agentOutcomeContract.ts +58 -0
  900. package/src/modules/agent_orchestrator/lib/sdk/defineAgent.ts +525 -0
  901. package/src/modules/agent_orchestrator/lib/sdk/defineFileAgent.ts +765 -0
  902. package/src/modules/agent_orchestrator/lib/sdk/defineSkill.ts +80 -0
  903. package/src/modules/agent_orchestrator/lib/sdk/outcomeSchema.ts +190 -0
  904. package/src/modules/agent_orchestrator/lib/sdk/skillMarkdown.ts +139 -0
  905. package/src/modules/agent_orchestrator/lib/seeds.ts +335 -0
  906. package/src/modules/agent_orchestrator/lib/settings/agentSettings.ts +92 -0
  907. package/src/modules/agent_orchestrator/lib/systemHealth.ts +212 -0
  908. package/src/modules/agent_orchestrator/lib/tasks/eventTriggerMatch.ts +116 -0
  909. package/src/modules/agent_orchestrator/lib/tasks/milestones.ts +201 -0
  910. package/src/modules/agent_orchestrator/lib/tasks/outcome.ts +93 -0
  911. package/src/modules/agent_orchestrator/lib/tasks/outcomeLink.ts +91 -0
  912. package/src/modules/agent_orchestrator/lib/tasks/schedule.ts +106 -0
  913. package/src/modules/agent_orchestrator/lib/tasks/scheduleValidation.ts +34 -0
  914. package/src/modules/agent_orchestrator/lib/tasks/triggers.ts +47 -0
  915. package/src/modules/agent_orchestrator/lib/tokens/computeAgentTokenUsage.ts +111 -0
  916. package/src/modules/agent_orchestrator/lib/tokens/types.ts +77 -0
  917. package/src/modules/agent_orchestrator/lib/trace/artifactStore.ts +198 -0
  918. package/src/modules/agent_orchestrator/lib/trace/correctionService.ts +117 -0
  919. package/src/modules/agent_orchestrator/lib/trace/ingestAuth.ts +65 -0
  920. package/src/modules/agent_orchestrator/lib/trace/redactToolSummary.ts +76 -0
  921. package/src/modules/agent_orchestrator/lib/trace/spanTimeline.ts +181 -0
  922. package/src/modules/agent_orchestrator/lib/trace/traceIngestionService.ts +250 -0
  923. package/src/modules/agent_orchestrator/lib/webSearch/guardrails.ts +199 -0
  924. package/src/modules/agent_orchestrator/lib/webSearch/healthCache.ts +109 -0
  925. package/src/modules/agent_orchestrator/lib/webSearch/healthProbePlan.ts +58 -0
  926. package/src/modules/agent_orchestrator/lib/webSearch/policy.ts +283 -0
  927. package/src/modules/agent_orchestrator/lib/webSearch/registry.ts +177 -0
  928. package/src/modules/agent_orchestrator/lib/webSearch/secretStorage.ts +181 -0
  929. package/src/modules/agent_orchestrator/lib/webSearch/steps.ts +77 -0
  930. package/src/modules/agent_orchestrator/lib/webSearch/tools.ts +246 -0
  931. package/src/modules/agent_orchestrator/lib/workInbox/agentDispositionSource.ts +324 -0
  932. package/src/modules/agent_orchestrator/migrations/.snapshot-open-mercato.json +7083 -0
  933. package/src/modules/agent_orchestrator/migrations/Migration20260906141535_agent_orchestrator.ts +278 -0
  934. package/src/modules/agent_orchestrator/migrations/adopt-squash.mjs +232 -0
  935. package/src/modules/agent_orchestrator/notifications.ts +43 -0
  936. package/src/modules/agent_orchestrator/setup.ts +190 -0
  937. package/src/modules/agent_orchestrator/skills/deals.stage_playbook.md +37 -0
  938. package/src/modules/agent_orchestrator/subscribers/process-event-trigger.ts +198 -0
  939. package/src/modules/agent_orchestrator/subscribers/process-proposal-created.ts +28 -0
  940. package/src/modules/agent_orchestrator/subscribers/process-proposal-disposed.ts +20 -0
  941. package/src/modules/agent_orchestrator/subscribers/process-run-completed.ts +23 -0
  942. package/src/modules/agent_orchestrator/subscribers/process-run-ingested.ts +22 -0
  943. package/src/modules/agent_orchestrator/subscribers/process-workflow-cancelled.ts +22 -0
  944. package/src/modules/agent_orchestrator/subscribers/process-workflow-completed.ts +32 -0
  945. package/src/modules/agent_orchestrator/subscribers/process-workflow-failed.ts +23 -0
  946. package/src/modules/agent_orchestrator/subscribers/process-workflow-milestone.ts +47 -0
  947. package/src/modules/agent_orchestrator/subscribers/process-workflow-started.ts +34 -0
  948. package/src/modules/agent_orchestrator/subscribers/proposal-disposed-notification-clear.ts +50 -0
  949. package/src/modules/agent_orchestrator/subscribers/proposal-pending-notification.ts +84 -0
  950. package/src/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.client.tsx +68 -0
  951. package/src/modules/agent_orchestrator/widgets/injection/caseload-nav-badge/widget.ts +16 -0
  952. package/src/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.client.tsx +148 -0
  953. package/src/modules/agent_orchestrator/widgets/injection/task-proposal-draft/widget.ts +24 -0
  954. package/src/modules/agent_orchestrator/widgets/injection/task-proposal-link/widget.ts +34 -0
  955. package/src/modules/agent_orchestrator/widgets/injection-table.ts +42 -0
  956. package/src/modules/agent_orchestrator/workers/eval-suite-runner.ts +85 -0
  957. package/src/modules/agent_orchestrator/workers/llm-judge.ts +39 -0
  958. package/src/modules/agent_orchestrator/workers/metric-rollup.ts +39 -0
  959. package/src/modules/agent_orchestrator/workers/process-execution-starter.ts +227 -0
  960. package/src/modules/record_locks/lib/conflictValues.ts +107 -0
  961. package/src/modules/record_locks/lib/crudMutationGuardService.ts +47 -3
  962. package/src/modules/record_locks/lib/recordLockService.ts +1 -51
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/modules/agent_orchestrator/lib/runtime/nativeAgentRunner.ts"],
4
+ "sourcesContent": ["import type { AwilixContainer } from 'awilix'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { runAiAgentObject } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/agent-runtime'\nimport { createModelFactory } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/model-factory'\nimport type { AiChatRequestContext } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/attachment-bridge-types'\nimport type { CommandBus } from '@open-mercato/shared/lib/commands'\nimport type { AgentRegistryEntry } from '../sdk/defineAgent'\nimport {\n type AgentResult,\n type CitableSource,\n type GuardResults,\n type GuardrailSetBody,\n type UntrustedSpan,\n} from '../../data/validators'\nimport { deriveEnvelopeConfidence } from '../../data/proposalEnvelope'\nimport { GuardrailService, persistVerdict, GUARDRAIL_SET_VERSION } from '../guardrails/guardrailService'\nimport { resolveCurrentGroundingSet } from '../guardrails/syncGroundingSets'\nimport { ContextResolverImpl, ContextModuleNotFoundError } from '../context/contextResolver'\nimport { resolveContextModule } from '../context/registry'\nimport { withRunContext } from './runContext'\nimport { runWithProviderBudget } from './providerBudget'\nimport { computeCostMinor } from './modelPricing'\nimport {\n captureNativeRunTrace,\n isNativeTraceCaptureEnabled,\n type NativeStepRecord,\n} from './nativeTraceCapture'\nimport {\n AgentGuardrailBlockedError,\n AgentOutputInvalidError,\n AgentRunTimeoutError,\n} from './errors'\nimport {\n type AgentRunCtx,\n buildCommandContext,\n resolveCallerAcl,\n createRun,\n completeRun,\n failRun,\n createProposal,\n shapeResult,\n} from './persistence'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('agent_orchestrator').child({ component: 'native-agent-runner' })\n\n/**\n * Default token budget for a TDCR context assembly when the caller does not pass\n * one (Phase 1 \u2014 the INVOKE_AGENT node config wires a per-capability budget in a\n * later phase). Conservative; the packer prunes optional fill that exceeds it.\n */\nexport const DEFAULT_CONTEXT_TOKEN_BUDGET = 4000\n\nexport type NativeAgentRunnerDeps = {\n container: AwilixContainer\n commandBus: CommandBus\n}\n\n/**\n * The `native` runtime (lightweight-agent-runtime spec Phase 1) \u2014 the extracted\n * in-process engine that runs an agent in object mode under the caller scope,\n * validates the structured output against the agent's result schema, persists a\n * thin AgentRun (and, for proposal results, an AgentProposal) through the\n * audited Command path, and returns the typed AgentResult union. Dispatch\n * target for BOTH `runtime: 'native'` and the legacy `'in-process'` alias.\n *\n * Native additions over the pre-extraction `runInProcess`:\n * - `createRun` stamps `runtime: 'native'` + `externalRunId = runId`, so the\n * post-run trace ingest upserts onto THIS row (never a shadow duplicate);\n * - every AI SDK step is recorded through the object-mode `loop.onStepFinish`\n * hook and written post-run, best-effort, as `AgentSpan`/`AgentToolCall`\n * rows (`OM_AGENT_TRACE_CAPTURE=off` escape hatch);\n * - the model call runs under the per-provider LLM budget (concurrency cap +\n * 429/overloaded retry with jittered backoff bounded by the run deadline).\n *\n * Propose-only is structural: the agent is declared read-only, so the AI runtime\n * strips every mutation tool \u2014 an agent may only READ (via its allowlisted tools,\n * when it declares any) and PROPOSE. The runner's only writes are AgentRun /\n * AgentProposal via Commands; domain writes happen later through the\n * proposal \u2192 disposition \u2192 effector path, never the agent itself.\n */\nexport class NativeAgentRunner {\n private readonly container: AwilixContainer\n private readonly commandBus: CommandBus\n\n constructor(deps: NativeAgentRunnerDeps) {\n this.container = deps.container\n this.commandBus = deps.commandBus\n }\n\n async run(\n agentId: string,\n entry: AgentRegistryEntry,\n input: unknown,\n ctx: AgentRunCtx,\n ): Promise<AgentResult> {\n const commandCtx = buildCommandContext(this.container, ctx)\n\n const runId = await createRun(this.commandBus, commandCtx, {\n source: ctx.source,\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n agentId,\n input,\n parentRunId: ctx.parentRunId ?? null,\n // `(runtime='native', externalRunId=runId)` is the trace-ingestion\n // idempotency key: the post-run span ingest upserts onto THIS row instead\n // of creating a forever-running shadow duplicate (spec decision H2).\n runtime: 'native',\n stampExternalRunIdFromId: true,\n model: entry.defaultModel ?? null,\n workflowInstanceId: ctx.workflowInstanceId ?? null,\n stepId: ctx.stepId ?? null,\n invocationId: ctx.invocationId ?? null,\n agentType: entry.agentType ?? null,\n })\n\n if (ctx.onRunPersisted) {\n try {\n ctx.onRunPersisted(runId)\n } catch (err) {\n logger.warn('onRunPersisted hook failed', {\n agentId,\n error: err instanceof Error ? err.message : String(err),\n })\n }\n }\n\n // Context overlay (Phase 1): assemble + persist one append-only\n // AgentContextBundle for this run BEFORE the model call (TDCR is on the\n // synchronous INVOKE_AGENT path). Called directly from the run path \u2014 there\n // is no pluggable workflow activity registry. Capability = the agent id. Only\n // capabilities that declare a ContextModule get a bundle; the rest are a safe\n // no-op so existing toolless agents are unaffected. Best-effort: an assembly\n // failure must not abort the run (the bundle is evidence, not a gate in P1).\n let untrustedSpans: UntrustedSpan[] = []\n let citableSources: CitableSource[] = []\n if (resolveContextModule(agentId)) {\n try {\n const contextEm = (this.container.resolve('em') as EntityManager).fork()\n const resolver = new ContextResolverImpl(this.container)\n const assembled = await resolver.assemble(contextEm, {\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n agentRunId: runId,\n workflowInstanceId: ctx.workflowInstanceId ?? null,\n stepId: ctx.stepId ?? null,\n capability: agentId,\n budget: DEFAULT_CONTEXT_TOKEN_BUDGET,\n })\n untrustedSpans = assembled.untrustedSpans\n citableSources = assembled.citableSources\n } catch (contextErr) {\n if (!(contextErr instanceof ContextModuleNotFoundError)) {\n logger.warn('context assembly failed', {\n error: contextErr instanceof Error ? contextErr.message : String(contextErr),\n })\n }\n }\n }\n\n // PRE-CALL input guardrail (Wave 3, Phase 3): screen the UNTRUSTED\n // document/retrieval spans assembled above for injected-instruction patterns\n // BEFORE the model call. A `block` persists the prompt_injection check + emits\n // `guardrail.tripped`, then fails the step with a typed reason (never reaches\n // disposition); a `warn`/`pass` records the audit rows and proceeds. The\n // always-on output tool-scope backstop holds even if this layer is evaded.\n const inputGuardrail = new GuardrailService(this.container)\n const inputVerdict = await inputGuardrail.checkInput({ capability: agentId, untrustedSpans })\n if (inputVerdict.checks.length > 0) {\n const inputGuardEm = (this.container.resolve('em') as EntityManager).fork()\n const inputScope = { tenantId: ctx.tenantId, organizationId: ctx.organizationId, agentRunId: runId }\n await persistVerdict({ em: inputGuardEm }, inputScope, {\n verdict: inputVerdict,\n capability: agentId,\n phase: 'input',\n proposalId: null,\n })\n if (inputVerdict.result === 'block' && inputVerdict.blockedReason) {\n const detail = '[internal] pre-call guardrail block (prompt_injection)'\n await failRun(this.commandBus, commandCtx, { runId, errorMessage: detail })\n throw new AgentGuardrailBlockedError(agentId, detail, {\n phase: inputVerdict.blockedReason.phase,\n kind: inputVerdict.blockedReason.kind,\n guardrailSetVersion: GUARDRAIL_SET_VERSION,\n })\n }\n }\n\n // Load the caller's effective ACL so the agent's read-only tools (e.g.\n // customers.get_deal, gated by customers.deals.view) pass their feature\n // check under the caller's own scope \u2014 never escalated. Defensive: if the\n // RBAC service is unavailable, fall back to no features (tool calls then\n // fail closed rather than running unauthorized).\n const acl = await resolveCallerAcl(this.container, ctx)\n const authContext: AiChatRequestContext = {\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n userId: ctx.userId,\n features: acl.features,\n isSuperAdmin: acl.isSuperAdmin,\n }\n\n // Wall-clock deadline for the WHOLE model execution (performance hardening\n // Phase 2) \u2014 a hung provider call can never pin a worker slot forever.\n // The timer is cancellable + unref'd (same hygiene as openCodeAgentRunner).\n const runTimeoutMs = resolveNativeRunTimeoutMs()\n const deadline = createRunDeadline(runTimeoutMs)\n const deadlineAtMs = Date.now() + runTimeoutMs\n\n // Per-step trace recording (Phase 1): the object-mode `loop.onStepFinish`\n // hook (forwarded by the additive ai-assistant change) records one entry per\n // AI SDK step as it happens, so partial traces survive even a failed run.\n const traceEnabled = isNativeTraceCaptureEnabled()\n const stepRecords: NativeStepRecord[] = []\n const recordStep = async (event: unknown): Promise<void> => {\n const raw = event as {\n toolCalls?: Array<{\n toolName?: string\n args?: unknown\n result?: unknown\n experimental_toToolResultError?: { code?: string; message?: string }\n startTime?: number\n endTime?: number\n }>\n finishReason?: string\n usage?: { inputTokens?: number; outputTokens?: number }\n response?: { modelId?: string }\n }\n stepRecords.push({\n modelId: raw.response?.modelId ?? 'unknown',\n finishReason: raw.finishReason ?? 'stop',\n usage: {\n inputTokens: raw.usage?.inputTokens ?? 0,\n outputTokens: raw.usage?.outputTokens ?? 0,\n },\n toolCalls: (raw.toolCalls ?? []).map((toolCall) => ({\n toolName: toolCall.toolName ?? 'unknown',\n args: toolCall.args ?? {},\n result: toolCall.result,\n ...(toolCall.experimental_toToolResultError\n ? {\n error: {\n code: String(toolCall.experimental_toToolResultError.code ?? 'unknown'),\n message: String(toolCall.experimental_toToolResultError.message ?? ''),\n },\n }\n : {}),\n durationMs:\n typeof toolCall.startTime === 'number' && typeof toolCall.endTime === 'number'\n ? toolCall.endTime - toolCall.startTime\n : 0,\n })),\n endedAtMs: Date.now(),\n })\n }\n\n // Live agent-action telemetry (workflows spec Phase 2). When this run is a\n // workflow INVOKE_AGENT step (`ctx.workflowInstanceId` present) and an event bus is\n // resolvable, emit a coarse `workflows.agent.action` per AI-SDK step so the\n // run view can show what the agent is doing WHILE it runs. Best-effort and\n // fully isolated: it never touches agent execution or the parked-step resume,\n // carries no token text or model output, and is skipped entirely for\n // non-workflow (e.g. chat) runs. Steps + tool calls only \u2014 token-level\n // streaming is deliberately out of scope (the tool loop uses generateText).\n const buildAgentActionEmitter = (): ((event: unknown) => Promise<void>) | null => {\n const instanceId = ctx.workflowInstanceId\n if (!instanceId || !ctx.tenantId) return null\n let eventBus:\n | { emitEvent: (event: string, payload: Record<string, unknown>) => Promise<void> }\n | undefined\n try {\n eventBus = this.container.resolve('eventBus')\n } catch {\n return null\n }\n if (!eventBus || typeof eventBus.emitEvent !== 'function') return null\n const bus = eventBus\n let stepIndex = 0\n return async (event: unknown): Promise<void> => {\n const raw = event as { toolCalls?: Array<{ toolName?: string }>; finishReason?: string }\n const toolCalls = raw.toolCalls ?? []\n const toolNames = toolCalls.map((call) => call.toolName).filter((name): name is string => !!name)\n const index = stepIndex\n stepIndex += 1\n try {\n await bus.emitEvent('workflows.agent.action', {\n id: instanceId,\n instanceId,\n stepId: ctx.stepId ?? null,\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId ?? null,\n agentId,\n kind: toolNames.length > 0 ? 'tool_call' : 'step_finish',\n ...(toolNames.length > 0 ? { name: toolNames.join(', ') } : {}),\n stepIndex: index,\n toolCallCount: toolCalls.length,\n finishReason: raw.finishReason ?? null,\n })\n } catch {\n // Telemetry is best-effort: a bus failure must never affect the run.\n }\n }\n }\n const emitAgentAction = buildAgentActionEmitter()\n const wireStepFinish = traceEnabled || emitAgentAction !== null\n const onAgentStepFinish = async (event: unknown): Promise<void> => {\n if (traceEnabled) await recordStep(event)\n if (emitAgentAction) await emitAgentAction(event)\n }\n\n // Provider budget key: the same resolution the model call performs. Fail\n // open to a shared 'unknown' bucket \u2014 a resolution failure here must\n // surface from the model call itself, not the budget gate.\n const providerId = this.resolveProviderId(entry)\n\n const modelStartMs = Date.now()\n let rawObject: unknown\n let fallbackUsage: { inputTokens?: number; outputTokens?: number } | null = null\n // Usage + estimated-cost stamp for the terminal transition (data-honesty\n // spec \u00A73.2): tokens summed from the recorded steps (or the object-mode\n // fallback usage), cost from the static pricing table for the model that\n // actually answered (last step's resolved id beats the declared default).\n // Null tokens or an unknown model keep cost null \u2014 the UI renders `\u2014`.\n const buildUsageStamp = (): {\n inputTokens?: number | null\n outputTokens?: number | null\n costMinor?: number | null\n currency?: string | null\n } => {\n const summed = stepRecords.reduce(\n (acc, step) => ({\n inputTokens: acc.inputTokens + step.usage.inputTokens,\n outputTokens: acc.outputTokens + step.usage.outputTokens,\n }),\n { inputTokens: 0, outputTokens: 0 },\n )\n const inputTokens =\n stepRecords.length > 0 ? summed.inputTokens : (fallbackUsage?.inputTokens ?? null)\n const outputTokens =\n stepRecords.length > 0 ? summed.outputTokens : (fallbackUsage?.outputTokens ?? null)\n if (inputTokens == null && outputTokens == null) return {}\n const resolvedModelId = [...stepRecords]\n .reverse()\n .find((step) => step.modelId && step.modelId !== 'unknown')?.modelId\n const cost = computeCostMinor(resolvedModelId ?? entry.defaultModel ?? null, inputTokens, outputTokens)\n return {\n inputTokens,\n outputTokens,\n ...(cost ? { costMinor: cost.costMinor, currency: cost.currency } : {}),\n }\n }\n const captureTrace = async (): Promise<void> => {\n if (!traceEnabled) return\n // AWAITED, not fire-and-forget. `dispositionService` decides whether a\n // proposal may act unattended by counting this run's spans the instant the\n // runner returns (`traceComplete`), so scheduling the capture in the\n // background raced that read: a run whose spans landed a few milliseconds\n // late was held as `trace_incomplete`, making auto-approval a function of\n // I/O timing rather than of policy. The cost is a handful of row inserts on\n // a path that has just paid for a model call.\n //\n // The capture catches internally; the defensive catch here guarantees a\n // rejected capture can never fail the run regardless of the capture\n // implementation.\n await captureNativeRunTrace(\n this.container,\n { tenantId: ctx.tenantId, organizationId: ctx.organizationId },\n {\n runId,\n agentId,\n steps: stepRecords,\n startedAtMs: modelStartMs,\n endedAtMs: Date.now(),\n fallbackUsage,\n fallbackModel: entry.defaultModel ?? null,\n },\n ).catch((err: unknown) => {\n logger.warn('native trace capture rejected for run', {\n runId,\n error: err instanceof Error ? err.message : String(err),\n })\n })\n }\n try {\n // Bind this run's id as the current in-process run so a `delegate_agent`\n // tool call (from a sub-agent-capable agent) can stamp `parent_run_id` on\n // its nested run for traceability (Phase 4).\n // `ctx.source` rides the async context so a nested `delegate_agent` call\n // inherits the eval tag instead of being recorded as production traffic.\n const modelExecution = withRunContext(runId, () =>\n runWithProviderBudget({ providerId, deadlineAtMs }, async () => {\n const objectResult = await runAiAgentObject({\n agentId,\n input: typeof input === 'string' ? input : JSON.stringify(input),\n authContext,\n container: this.container,\n output: { schemaName: agentId.replace(/\\W+/g, '_'), schema: entry.schema },\n // Propose-only agents stay read-only: run a read-only tool loop so the\n // agent can gather data (via its own tools or skill-contributed tools)\n // before proposing. The runtime auto-falls back to a plain structured\n // generate when no tools resolve, so toolless agents are unaffected.\n // Writes never execute directly (read-only policy + proposal \u2192 effector).\n enableTools: true,\n ...(wireStepFinish ? { loop: { onStepFinish: onAgentStepFinish } } : {}),\n })\n // Object mode defaults to `mode: 'generate'`, resolving `.object` directly.\n if (objectResult.mode === 'stream') {\n return await objectResult.object\n }\n fallbackUsage = objectResult.usage ?? null\n return objectResult.object\n }),\n ctx.source,\n )\n const raced = await Promise.race([\n modelExecution,\n deadline.promise.then(() => RUN_TIMED_OUT),\n ])\n if (raced === RUN_TIMED_OUT) {\n // The run is settled as timed out: swallow the late-arriving model\n // settle (result OR rejection) so it can neither complete the run nor\n // surface as an unhandled rejection.\n void modelExecution.then(\n () => undefined,\n () => undefined,\n )\n await failRun(this.commandBus, commandCtx, {\n runId,\n errorMessage: `[internal] agent run exceeded the ${runTimeoutMs}ms wall-clock deadline`,\n ...buildUsageStamp(),\n })\n throw new AgentRunTimeoutError(agentId, runTimeoutMs)\n }\n rawObject = raced\n } catch (err) {\n if (err instanceof AgentRunTimeoutError) {\n await captureTrace()\n throw err\n }\n const message = err instanceof Error ? err.message : String(err)\n await failRun(this.commandBus, commandCtx, { runId, errorMessage: message, ...buildUsageStamp() })\n await captureTrace()\n throw err\n } finally {\n deadline.cancel()\n }\n\n // POST-CALL output guardrail hook (Phase 1): the per-capability proposal\n // contract IS the agent's declared outcome schema; the capability IS the\n // agentId. Schema-validity and a tool-scope backstop are recorded as\n // append-only AgentGuardrailCheck rows for full audit BEFORE the run can fail.\n // Resolve the capability's CURRENT grounding set (Wave 3, Phase 4). Present\n // only for capabilities declared factual + synced (setup.ts) \u2014 non-factual\n // capabilities resolve null and the grounding gate is skipped entirely. Read\n // through a forked EM, scoped by org; a resolution failure must not abort the\n // run (the other output checks still run), so it is best-effort.\n let grounding:\n | { set: GuardrailSetBody; groundingSetVersion: string; citableSources: CitableSource[] }\n | undefined\n try {\n const groundingEm = (this.container.resolve('em') as EntityManager).fork()\n const groundingSet = await resolveCurrentGroundingSet(\n groundingEm,\n { tenantId: ctx.tenantId, organizationId: ctx.organizationId },\n agentId,\n )\n if (groundingSet) {\n grounding = {\n set: groundingSet.body as GuardrailSetBody,\n groundingSetVersion: groundingSet.version,\n citableSources,\n }\n }\n } catch (groundingErr) {\n logger.warn('grounding set resolution failed', {\n error: groundingErr instanceof Error ? groundingErr.message : String(groundingErr),\n })\n }\n\n const guardrailService = new GuardrailService(this.container)\n const verdict = await guardrailService.checkOutput({\n capability: agentId,\n schema: entry.schema,\n output: rawObject,\n allowedTools: entry.tools,\n grounding,\n })\n const guardEm = (this.container.resolve('em') as EntityManager).fork()\n const guardScope = { tenantId: ctx.tenantId, organizationId: ctx.organizationId, agentRunId: runId }\n\n const parsed = entry.schema.safeParse(rawObject)\n if (!parsed.success || verdict.result === 'block') {\n // Persist the block check(s) + emit `guardrail.tripped` BEFORE failing the\n // run, then preserve the existing AgentOutputInvalidError fail semantics.\n // Output checks at this point have no proposal yet \u2192 proposalId null.\n await persistVerdict({ em: guardEm }, guardScope, {\n verdict,\n capability: agentId,\n phase: 'output',\n proposalId: null,\n })\n const detail = parsed.success ? 'guardrail block' : parsed.error.message\n await failRun(this.commandBus, commandCtx, { runId, errorMessage: detail, ...buildUsageStamp() })\n await captureTrace()\n const blocked = verdict.blockedReason\n if (blocked) {\n throw new AgentGuardrailBlockedError(agentId, detail, {\n phase: blocked.phase,\n kind: blocked.kind,\n guardrailSetVersion: GUARDRAIL_SET_VERSION,\n })\n }\n throw new AgentOutputInvalidError(agentId, detail)\n }\n\n // Pass/warn: persist the audit rows (one per check). A pass verdict records\n // pass rows but otherwise does NOT change behavior; warn proceeds + flags.\n const guardResults: GuardResults = await persistVerdict({ em: guardEm }, guardScope, {\n verdict,\n capability: agentId,\n phase: 'output',\n proposalId: null,\n })\n\n const result = shapeResult(entry.resultKind, parsed.data, agentId)\n\n await completeRun(this.commandBus, commandCtx, {\n runId,\n output: result,\n resultKind: entry.resultKind,\n // Proposal runs surface the proposal's confidence on the run row;\n // researcher runs have no confidence semantics \u2192 null (renders `\u2014`).\n confidence: result.kind === 'proposal' ? deriveEnvelopeConfidence(result.proposal) : null,\n ...buildUsageStamp(),\n })\n\n if (result.kind === 'proposal') {\n await createProposal(this.commandBus, commandCtx, {\n source: ctx.source,\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n agentId,\n runId,\n payload: result.proposal,\n confidence: deriveEnvelopeConfidence(result.proposal),\n workflowInstanceId: ctx.workflowInstanceId ?? null,\n stepId: ctx.stepId ?? null,\n guardResults,\n })\n }\n\n // Span persistence, after the audited persistence tail so a capture failure\n // changes nothing about the run. Awaited: the caller disposes the proposal\n // this run just created, and that decision reads the trace.\n await captureTrace()\n\n return result\n }\n\n /**\n * Resolve the provider id the model call will use, purely for the budget key.\n * Mirrors the model factory resolution `runAiAgentObject` performs; fails\n * open to `'unknown'` so budget-key resolution can never fail a run the\n * model call itself would have served.\n */\n private resolveProviderId(entry: AgentRegistryEntry): string {\n try {\n const factory = createModelFactory(this.container)\n const resolution = factory.resolveModel({\n moduleId: entry.moduleId,\n agentDefaultModel: entry.defaultModel,\n agentDefaultProvider: entry.defaultProvider,\n })\n return resolution.providerId\n } catch {\n return 'unknown'\n }\n }\n}\n\nconst RUN_TIMED_OUT = Symbol('agent-run-timed-out')\n\n/**\n * Wall-clock deadline for one native agent run. Mirrors the OpenCode\n * runner's `OM_OPENCODE_RUN_TIMEOUT_MS` semantics (default 5 minutes); read\n * lazily per run so deployments and tests can vary the env without a restart.\n */\nconst DEFAULT_NATIVE_RUN_TIMEOUT_MS = 5 * 60_000\nfunction resolveNativeRunTimeoutMs(): number {\n const raw = Number.parseInt(process.env.OM_AGENT_RUN_TIMEOUT_MS ?? '', 10)\n return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_NATIVE_RUN_TIMEOUT_MS\n}\n\n/**\n * A cancellable wall-clock deadline (same hygiene as the OpenCode runner's):\n * `promise` resolves once `ms` elapses; `cancel()` clears the timer in the\n * caller's `finally` so a completed run leaks no timer. The timer is `unref`'d\n * so it never keeps the process alive on its own.\n */\nfunction createRunDeadline(ms: number): { promise: Promise<void>; cancel: () => void } {\n let timer: ReturnType<typeof setTimeout> | null = null\n const promise = new Promise<void>((resolve) => {\n timer = setTimeout(resolve, ms)\n const maybeUnref = timer as { unref?: () => void }\n if (typeof maybeUnref.unref === 'function') maybeUnref.unref()\n })\n return {\n promise,\n cancel() {\n if (timer) {\n clearTimeout(timer)\n timer = null\n }\n },\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAWnC,SAAS,gCAAgC;AACzC,SAAS,kBAAkB,gBAAgB,6BAA6B;AACxE,SAAS,kCAAkC;AAC3C,SAAS,qBAAqB,kCAAkC;AAChE,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,oBAAoB,EAAE,MAAM,EAAE,WAAW,sBAAsB,CAAC;AAOrF,MAAM,+BAA+B;AA8BrC,MAAM,kBAAkB;AAAA,EAI7B,YAAY,MAA6B;AACvC,SAAK,YAAY,KAAK;AACtB,SAAK,aAAa,KAAK;AAAA,EACzB;AAAA,EAEA,MAAM,IACJ,SACA,OACA,OACA,KACsB;AACtB,UAAM,aAAa,oBAAoB,KAAK,WAAW,GAAG;AAE1D,UAAM,QAAQ,MAAM,UAAU,KAAK,YAAY,YAAY;AAAA,MACzD,QAAQ,IAAI;AAAA,MACZ,UAAU,IAAI;AAAA,MACd,gBAAgB,IAAI;AAAA,MACpB;AAAA,MACA;AAAA,MACA,aAAa,IAAI,eAAe;AAAA;AAAA;AAAA;AAAA,MAIhC,SAAS;AAAA,MACT,0BAA0B;AAAA,MAC1B,OAAO,MAAM,gBAAgB;AAAA,MAC7B,oBAAoB,IAAI,sBAAsB;AAAA,MAC9C,QAAQ,IAAI,UAAU;AAAA,MACtB,c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AAAA,IACH;AAKA,UAAM,aAAa;AAEnB,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,kBAAkB,OAAmC;AAC3D,QAAI;AACF,YAAM,UAAU,mBAAmB,KAAK,SAAS;AACjD,YAAM,aAAa,QAAQ,aAAa;AAAA,QACtC,UAAU,MAAM;AAAA,QAChB,mBAAmB,MAAM;AAAA,QACzB,sBAAsB,MAAM;AAAA,MAC9B,CAAC;AACD,aAAO,WAAW;AAAA,IACpB,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACF;AAEA,MAAM,gBAAgB,uBAAO,qBAAqB;AAOlD,MAAM,gCAAgC,IAAI;AAC1C,SAAS,4BAAoC;AAC3C,QAAM,MAAM,OAAO,SAAS,QAAQ,IAAI,2BAA2B,IAAI,EAAE;AACzE,SAAO,OAAO,SAAS,GAAG,KAAK,MAAM,IAAI,MAAM;AACjD;AAQA,SAAS,kBAAkB,IAA4D;AACrF,MAAI,QAA8C;AAClD,QAAM,UAAU,IAAI,QAAc,CAAC,YAAY;AAC7C,YAAQ,WAAW,SAAS,EAAE;AAC9B,UAAM,aAAa;AACnB,QAAI,OAAO,WAAW,UAAU,WAAY,YAAW,MAAM;AAAA,EAC/D,CAAC;AACD,SAAO;AAAA,IACL;AAAA,IACA,SAAS;AACP,UAAI,OAAO;AACT,qBAAa,KAAK;AAClB,gBAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,132 @@
1
+ import { ingestTrace } from "../trace/traceIngestionService.js";
2
+ import { createArtifactOffloader } from "../trace/artifactStore.js";
3
+ import { evaluateRun } from "../eval/evalRuntimeService.js";
4
+ import { createLogger } from "@open-mercato/shared/lib/logger";
5
+ import { invalidateAgentRunCache } from "../crudCache.js";
6
+ const logger = createLogger("agent_orchestrator").child({ component: "native-trace-capture" });
7
+ function isNativeTraceCaptureEnabled() {
8
+ return (process.env.OM_AGENT_TRACE_CAPTURE ?? "on").toLowerCase() !== "off";
9
+ }
10
+ function isoAt(ms) {
11
+ return new Date(ms).toISOString();
12
+ }
13
+ function resolveModelId(input) {
14
+ const fromSteps = input.steps.find((step) => step.modelId && step.modelId !== "unknown")?.modelId;
15
+ return fromSteps ?? input.fallbackModel ?? null;
16
+ }
17
+ function buildNativeTracePayload(input) {
18
+ const spans = [];
19
+ let sequence = 0;
20
+ let cursorMs = input.startedAtMs;
21
+ for (let stepIndex = 0; stepIndex < input.steps.length; stepIndex += 1) {
22
+ const step = input.steps[stepIndex];
23
+ const stepSpanId = `${input.runId}:${stepIndex}`;
24
+ const stepStartMs = Math.min(cursorMs, step.endedAtMs);
25
+ spans.push({
26
+ externalSpanId: stepSpanId,
27
+ sequence: sequence++,
28
+ name: step.modelId && step.modelId !== "unknown" ? `llm:${step.modelId}` : "llm",
29
+ kind: "llm",
30
+ startedAt: isoAt(stepStartMs),
31
+ endedAt: isoAt(step.endedAtMs),
32
+ durationMs: Math.max(0, step.endedAtMs - stepStartMs),
33
+ status: "ok",
34
+ attributes: {
35
+ inputTokens: step.usage.inputTokens,
36
+ outputTokens: step.usage.outputTokens,
37
+ finishReason: step.finishReason
38
+ }
39
+ });
40
+ for (let toolIndex = 0; toolIndex < step.toolCalls.length; toolIndex += 1) {
41
+ const toolCall = step.toolCalls[toolIndex];
42
+ const toolDurationMs = Math.max(0, toolCall.durationMs);
43
+ const toolEndMs = Math.min(step.endedAtMs, stepStartMs + toolDurationMs);
44
+ spans.push({
45
+ externalSpanId: `${stepSpanId}:${toolIndex}`,
46
+ parentExternalSpanId: stepSpanId,
47
+ sequence: sequence++,
48
+ name: toolCall.toolName,
49
+ kind: "tool",
50
+ startedAt: isoAt(stepStartMs),
51
+ endedAt: isoAt(toolEndMs),
52
+ durationMs: toolDurationMs,
53
+ status: toolCall.error ? "error" : "ok",
54
+ toolCalls: [
55
+ {
56
+ toolName: toolCall.toolName,
57
+ requestSummary: toolCall.args,
58
+ responseSummary: toolCall.result,
59
+ status: toolCall.error ? "error" : "ok",
60
+ latencyMs: toolDurationMs,
61
+ ...toolCall.error ? { errorMessage: toolCall.error.message } : {}
62
+ }
63
+ ]
64
+ });
65
+ }
66
+ cursorMs = step.endedAtMs;
67
+ }
68
+ if (spans.length === 0) {
69
+ spans.push({
70
+ externalSpanId: `${input.runId}:0`,
71
+ sequence: 0,
72
+ name: resolveModelId(input) ? `llm:${resolveModelId(input)}` : "llm",
73
+ kind: "llm",
74
+ startedAt: isoAt(input.startedAtMs),
75
+ endedAt: isoAt(input.endedAtMs),
76
+ durationMs: Math.max(0, input.endedAtMs - input.startedAtMs),
77
+ status: "ok",
78
+ ...input.fallbackUsage ? {
79
+ attributes: {
80
+ inputTokens: input.fallbackUsage.inputTokens ?? 0,
81
+ outputTokens: input.fallbackUsage.outputTokens ?? 0
82
+ }
83
+ } : {}
84
+ });
85
+ }
86
+ const stepUsage = input.steps.reduce(
87
+ (acc, step) => ({
88
+ inputTokens: acc.inputTokens + step.usage.inputTokens,
89
+ outputTokens: acc.outputTokens + step.usage.outputTokens
90
+ }),
91
+ { inputTokens: 0, outputTokens: 0 }
92
+ );
93
+ const inputTokens = input.steps.length > 0 ? stepUsage.inputTokens : input.fallbackUsage?.inputTokens ?? null;
94
+ const outputTokens = input.steps.length > 0 ? stepUsage.outputTokens : input.fallbackUsage?.outputTokens ?? null;
95
+ const modelId = resolveModelId(input);
96
+ return {
97
+ runtime: "native",
98
+ externalRunId: input.runId,
99
+ agentId: input.agentId,
100
+ ...modelId ? { model: modelId } : {},
101
+ ...inputTokens != null ? { inputTokens } : {},
102
+ ...outputTokens != null ? { outputTokens } : {},
103
+ latencyMs: Math.max(0, input.endedAtMs - input.startedAtMs),
104
+ spans
105
+ };
106
+ }
107
+ async function captureNativeRunTrace(container, scope, input) {
108
+ if (!isNativeTraceCaptureEnabled()) return;
109
+ try {
110
+ const em = container.resolve("em").fork();
111
+ const result = await ingestTrace(em, scope, buildNativeTracePayload(input), {
112
+ offloadArtifact: createArtifactOffloader(container, scope)
113
+ });
114
+ await invalidateAgentRunCache(
115
+ container,
116
+ { id: result.runId, tenantId: scope.tenantId, organizationId: scope.organizationId },
117
+ "agent_orchestrator.trace.capture"
118
+ );
119
+ await evaluateRun(em, scope, result.runId);
120
+ } catch (err) {
121
+ logger.warn("native trace capture failed for run", {
122
+ runId: input.runId,
123
+ error: err instanceof Error ? err.message : String(err)
124
+ });
125
+ }
126
+ }
127
+ export {
128
+ buildNativeTracePayload,
129
+ captureNativeRunTrace,
130
+ isNativeTraceCaptureEnabled
131
+ };
132
+ //# sourceMappingURL=nativeTraceCapture.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/modules/agent_orchestrator/lib/runtime/nativeTraceCapture.ts"],
4
+ "sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport type { TraceIngest, TraceSpanIngest } from '../../data/validators'\nimport { ingestTrace } from '../trace/traceIngestionService'\nimport { createArtifactOffloader } from '../trace/artifactStore'\nimport { evaluateRun } from '../eval/evalRuntimeService'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport { invalidateAgentRunCache } from '../crudCache'\n\nconst logger = createLogger('agent_orchestrator').child({ component: 'native-trace-capture' })\n\n/**\n * Always-on per-step trace capture for the native runtime (lightweight-agent-\n * runtime spec Phase 1). The runner records one {@link NativeStepRecord} per\n * AI SDK step through the (newly forwarded) object-mode `loop.onStepFinish`\n * hook, then \u2014 post-run, best-effort \u2014 maps them to `AgentSpan`/`AgentToolCall`\n * rows via the existing idempotent `ingestTrace` service:\n *\n * - each step \u2192 one `llm` span (`externalSpanId = <runId>:<seq>`, token usage\n * + finish reason in `attributes`);\n * - each tool call within a step \u2192 one child `tool` span\n * (`externalSpanId = <runId>:<seq>:<toolIdx>`) carrying its `AgentToolCall`\n * row (capped/offloaded request/response summaries);\n * - a toolless run (plain `generateObject`, no step callbacks) \u2192 one synthetic\n * `llm` span covering the whole model call, so every native run has a trace.\n *\n * Deterministic span ids keyed off the run id make re-ingest attempts\n * idempotent, and the payload carries NO run-level `status`/`output` fields \u2014\n * the found-run update path can never regress the completed run's state.\n */\n\nexport type NativeStepToolCall = {\n toolName: string\n args: unknown\n result: unknown\n error?: { code: string; message: string }\n durationMs: number\n}\n\nexport type NativeStepRecord = {\n modelId: string\n finishReason: string\n usage: { inputTokens: number; outputTokens: number }\n toolCalls: NativeStepToolCall[]\n /** Wall-clock ms when the step's onStepFinish fired. */\n endedAtMs: number\n}\n\nexport type NativeTraceInput = {\n runId: string\n agentId: string\n steps: NativeStepRecord[]\n /** Wall-clock ms when the model execution started. */\n startedAtMs: number\n /** Wall-clock ms when the model execution settled. */\n endedAtMs: number\n /** Run-level usage fallback for toolless runs (no step callbacks). */\n fallbackUsage?: { inputTokens?: number; outputTokens?: number } | null\n /** Declared model id fallback when no step reported one. */\n fallbackModel?: string | null\n}\n\n/** Escape hatch: `OM_AGENT_TRACE_CAPTURE=off` disables native span capture. */\nexport function isNativeTraceCaptureEnabled(): boolean {\n return (process.env.OM_AGENT_TRACE_CAPTURE ?? 'on').toLowerCase() !== 'off'\n}\n\nfunction isoAt(ms: number): string {\n return new Date(ms).toISOString()\n}\n\nfunction resolveModelId(input: NativeTraceInput): string | null {\n const fromSteps = input.steps.find((step) => step.modelId && step.modelId !== 'unknown')?.modelId\n return fromSteps ?? input.fallbackModel ?? null\n}\n\n/**\n * Pure mapping from the runner's step records to the `ingestTrace` payload.\n * Spans-only at the run level (no status/output) per spec decision H2.\n */\nexport function buildNativeTracePayload(input: NativeTraceInput): TraceIngest {\n const spans: TraceSpanIngest[] = []\n let sequence = 0\n let cursorMs = input.startedAtMs\n\n for (let stepIndex = 0; stepIndex < input.steps.length; stepIndex += 1) {\n const step = input.steps[stepIndex]\n const stepSpanId = `${input.runId}:${stepIndex}`\n const stepStartMs = Math.min(cursorMs, step.endedAtMs)\n spans.push({\n externalSpanId: stepSpanId,\n sequence: sequence++,\n name: step.modelId && step.modelId !== 'unknown' ? `llm:${step.modelId}` : 'llm',\n kind: 'llm',\n startedAt: isoAt(stepStartMs),\n endedAt: isoAt(step.endedAtMs),\n durationMs: Math.max(0, step.endedAtMs - stepStartMs),\n status: 'ok',\n attributes: {\n inputTokens: step.usage.inputTokens,\n outputTokens: step.usage.outputTokens,\n finishReason: step.finishReason,\n },\n })\n for (let toolIndex = 0; toolIndex < step.toolCalls.length; toolIndex += 1) {\n const toolCall = step.toolCalls[toolIndex]\n const toolDurationMs = Math.max(0, toolCall.durationMs)\n const toolEndMs = Math.min(step.endedAtMs, stepStartMs + toolDurationMs)\n spans.push({\n externalSpanId: `${stepSpanId}:${toolIndex}`,\n parentExternalSpanId: stepSpanId,\n sequence: sequence++,\n name: toolCall.toolName,\n kind: 'tool',\n startedAt: isoAt(stepStartMs),\n endedAt: isoAt(toolEndMs),\n durationMs: toolDurationMs,\n status: toolCall.error ? 'error' : 'ok',\n toolCalls: [\n {\n toolName: toolCall.toolName,\n requestSummary: toolCall.args,\n responseSummary: toolCall.result,\n status: toolCall.error ? 'error' : 'ok',\n latencyMs: toolDurationMs,\n ...(toolCall.error ? { errorMessage: toolCall.error.message } : {}),\n },\n ],\n })\n }\n cursorMs = step.endedAtMs\n }\n\n if (spans.length === 0) {\n spans.push({\n externalSpanId: `${input.runId}:0`,\n sequence: 0,\n name: resolveModelId(input) ? `llm:${resolveModelId(input)}` : 'llm',\n kind: 'llm',\n startedAt: isoAt(input.startedAtMs),\n endedAt: isoAt(input.endedAtMs),\n durationMs: Math.max(0, input.endedAtMs - input.startedAtMs),\n status: 'ok',\n ...(input.fallbackUsage\n ? {\n attributes: {\n inputTokens: input.fallbackUsage.inputTokens ?? 0,\n outputTokens: input.fallbackUsage.outputTokens ?? 0,\n },\n }\n : {}),\n })\n }\n\n const stepUsage = input.steps.reduce(\n (acc, step) => ({\n inputTokens: acc.inputTokens + step.usage.inputTokens,\n outputTokens: acc.outputTokens + step.usage.outputTokens,\n }),\n { inputTokens: 0, outputTokens: 0 },\n )\n const inputTokens =\n input.steps.length > 0 ? stepUsage.inputTokens : (input.fallbackUsage?.inputTokens ?? null)\n const outputTokens =\n input.steps.length > 0 ? stepUsage.outputTokens : (input.fallbackUsage?.outputTokens ?? null)\n const modelId = resolveModelId(input)\n\n return {\n runtime: 'native',\n externalRunId: input.runId,\n agentId: input.agentId,\n ...(modelId ? { model: modelId } : {}),\n ...(inputTokens != null ? { inputTokens } : {}),\n ...(outputTokens != null ? { outputTokens } : {}),\n latencyMs: Math.max(0, input.endedAtMs - input.startedAtMs),\n spans,\n }\n}\n\ntype MinimalContainer = {\n resolve<T = unknown>(name: string): T\n hasRegistration?: (name: string) => boolean\n}\n\n/**\n * Post-run, best-effort persistence of a native run's trace. Never throws \u2014\n * a capture failure logs and the run outcome is unaffected (the run row was\n * already settled through the audited Command path).\n */\nexport async function captureNativeRunTrace(\n container: MinimalContainer,\n scope: { tenantId: string; organizationId: string },\n input: NativeTraceInput,\n): Promise<void> {\n if (!isNativeTraceCaptureEnabled()) return\n try {\n const em = (container.resolve('em') as EntityManager).fork()\n const result = await ingestTrace(em, scope, buildNativeTracePayload(input), {\n offloadArtifact: createArtifactOffloader(container, scope),\n })\n await invalidateAgentRunCache(\n container as Parameters<typeof invalidateAgentRunCache>[0],\n { id: result.runId, tenantId: scope.tenantId, organizationId: scope.organizationId },\n 'agent_orchestrator.trace.capture',\n )\n // Parity with the `trace.ingest` command (used by the OpenCode/HMAC path):\n // score the run online (deterministic assertions + the golden-match plane) on\n // the same EM. Without this, native runs never get an eval verdict or a golden\n // comparison \u2014 only OpenCode runs did. The async llm_judge tier stays on the\n // command path. Best-effort: wrapped by the outer try so it never fails the run.\n await evaluateRun(em, scope, result.runId)\n } catch (err) {\n logger.warn('native trace capture failed for run', {\n runId: input.runId,\n error: err instanceof Error ? err.message : String(err),\n })\n }\n}\n"],
5
+ "mappings": "AAEA,SAAS,mBAAmB;AAC5B,SAAS,+BAA+B;AACxC,SAAS,mBAAmB;AAC5B,SAA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