@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,250 @@
1
+ import { NextResponse } from "next/server";
2
+ import { z } from "zod";
3
+ import { createLogger } from "@open-mercato/shared/lib/logger";
4
+ import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
5
+ import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
6
+ import { resolveOrganizationScopeForRequest } from "@open-mercato/core/modules/directory/utils/organizationScope";
7
+ import { readJsonSafe } from "@open-mercato/shared/lib/http/readJsonSafe";
8
+ import { AiModelFactoryError } from "@open-mercato/ai-assistant/modules/ai_assistant/lib/model-factory";
9
+ import { validateCrudMutationGuard, runCrudMutationGuardAfterSuccess } from "@open-mercato/shared/lib/crud/mutation-guard";
10
+ import { agentRunRequestSchema, baseAgentResultSchema, guardrailKind, guardrailPhase } from "../../../../data/validators.js";
11
+ import { AgentProposal } from "../../../../data/entities.js";
12
+ import {
13
+ AgentGuardrailBlockedError,
14
+ AgentNotFoundError,
15
+ AgentOutputInvalidError,
16
+ AgentRunTimeoutError
17
+ } from "../../../../lib/runtime/agentRuntime.js";
18
+ import { isAgentCapacityError, resolveAdmissionMaxWaitMs } from "../../../../lib/runtime/admission.js";
19
+ const metadata = {
20
+ POST: { requireAuth: true, requireFeatures: ["agent_orchestrator.agents.run"] }
21
+ };
22
+ const logger = createLogger("agent_orchestrator").child({ component: "agent-run-api" });
23
+ const errorSchema = z.object({ error: z.string() });
24
+ const guardrailBlockedErrorSchema = errorSchema.extend({
25
+ code: z.literal("guardrail_blocked"),
26
+ kind: guardrailKind,
27
+ phase: guardrailPhase,
28
+ guardrailSetVersion: z.string().nullable()
29
+ });
30
+ const unclassifiedErrorSchema = errorSchema.extend({
31
+ code: z.literal("agent_run_failed"),
32
+ reason: z.string()
33
+ });
34
+ const modelUnavailableErrorSchema = errorSchema.extend({
35
+ code: z.enum(["no_provider_configured", "api_key_missing", "provider_rejected"])
36
+ });
37
+ const PROVIDER_REFUSAL_STATUSES = /* @__PURE__ */ new Set([401, 402, 403, 429]);
38
+ const BILLING_REFUSAL = /credit balance|billing|insufficient[_ ]quota|payment required/i;
39
+ const MODEL_FACTORY_ERROR_CODES = /* @__PURE__ */ new Set(["no_provider_configured", "api_key_missing"]);
40
+ function asModelFactoryError(err) {
41
+ if (err instanceof AiModelFactoryError) return { code: err.code };
42
+ if (!err || typeof err !== "object") return null;
43
+ const candidate = err;
44
+ if (candidate.name !== "AiModelFactoryError") return null;
45
+ const code = typeof candidate.code === "string" && MODEL_FACTORY_ERROR_CODES.has(candidate.code) ? candidate.code : "no_provider_configured";
46
+ return { code };
47
+ }
48
+ function isProviderRefusal(err) {
49
+ if (!err || typeof err !== "object") return false;
50
+ const candidate = err;
51
+ if (candidate.name !== "AI_APICallError") return false;
52
+ const status = typeof candidate.statusCode === "number" ? candidate.statusCode : null;
53
+ if (status !== null && PROVIDER_REFUSAL_STATUSES.has(status)) return true;
54
+ const body = typeof candidate.responseBody === "string" ? candidate.responseBody : "";
55
+ return status === 400 && BILLING_REFUSAL.test(body);
56
+ }
57
+ async function POST(req, ctx) {
58
+ const auth = await getAuthFromRequest(req);
59
+ if (!auth) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
60
+ if (!auth.tenantId || !auth.sub) {
61
+ return NextResponse.json({ error: "Tenant context required" }, { status: 400 });
62
+ }
63
+ const { id } = await ctx.params;
64
+ const body = await readJsonSafe(req, {});
65
+ const parsed = agentRunRequestSchema.safeParse(body);
66
+ if (!parsed.success) {
67
+ return NextResponse.json(
68
+ { error: "Validation failed", fieldErrors: parsed.error.flatten().fieldErrors },
69
+ { status: 422 }
70
+ );
71
+ }
72
+ const container = await createRequestContainer();
73
+ const scope = await resolveOrganizationScopeForRequest({ container, auth, request: req });
74
+ const organizationId = scope?.selectedId ?? null;
75
+ if (!organizationId) {
76
+ return NextResponse.json(
77
+ {
78
+ error: "Select a single organization before running an agent. Agent runs must be attributed to one organization so the resulting proposal is reviewable in the caseload."
79
+ },
80
+ { status: 400 }
81
+ );
82
+ }
83
+ const guardResult = await validateCrudMutationGuard(container, {
84
+ tenantId: auth.tenantId,
85
+ organizationId,
86
+ userId: auth.sub,
87
+ resourceKind: "agent_orchestrator.agent_run",
88
+ resourceId: id,
89
+ operation: "custom",
90
+ requestMethod: "POST",
91
+ requestHeaders: req.headers
92
+ });
93
+ if (guardResult && !guardResult.ok) {
94
+ return NextResponse.json(guardResult.body, { status: guardResult.status });
95
+ }
96
+ let observedRunId = null;
97
+ const runCtx = {
98
+ tenantId: auth.tenantId,
99
+ organizationId,
100
+ userId: auth.sub,
101
+ onRunPersisted: (persistedRunId) => {
102
+ if (!observedRunId) observedRunId = persistedRunId;
103
+ }
104
+ };
105
+ let result;
106
+ try {
107
+ const agentRuntime = container.resolve("agentRuntime");
108
+ result = await agentRuntime.run(id, parsed.data.input, runCtx);
109
+ } catch (err) {
110
+ if (err instanceof AgentNotFoundError) {
111
+ return NextResponse.json({ error: "Agent not found", code: "agent_not_found" }, { status: 404 });
112
+ }
113
+ if (err instanceof AgentGuardrailBlockedError) {
114
+ return NextResponse.json(
115
+ {
116
+ error: "Blocked by a runtime guardrail",
117
+ code: "guardrail_blocked",
118
+ kind: err.kind,
119
+ phase: err.phase,
120
+ guardrailSetVersion: err.guardrailSetVersion ?? null
121
+ },
122
+ { status: 422 }
123
+ );
124
+ }
125
+ if (err instanceof AgentOutputInvalidError) {
126
+ return NextResponse.json(
127
+ { error: "Agent produced invalid output", code: "agent_output_invalid" },
128
+ { status: 422 }
129
+ );
130
+ }
131
+ if (err instanceof AgentRunTimeoutError) {
132
+ return NextResponse.json(
133
+ { error: "The agent run timed out before producing a result", code: "agent_run_timeout" },
134
+ { status: 422 }
135
+ );
136
+ }
137
+ if (isAgentCapacityError(err)) {
138
+ const retryAfterSeconds = Math.max(1, Math.ceil(resolveAdmissionMaxWaitMs() / 1e3));
139
+ return NextResponse.json(
140
+ { error: "Agent run capacity is exhausted \u2014 retry shortly", code: "agent_capacity_exhausted" },
141
+ { status: 429, headers: { "Retry-After": String(retryAfterSeconds) } }
142
+ );
143
+ }
144
+ const modelFactoryError = asModelFactoryError(err);
145
+ if (modelFactoryError) {
146
+ return NextResponse.json(
147
+ { error: "No LLM provider is configured for this deployment", code: modelFactoryError.code },
148
+ { status: 503 }
149
+ );
150
+ }
151
+ if (isProviderRefusal(err)) {
152
+ logger.error("Agent run refused by the LLM provider", { agentId: id, runId: observedRunId, err });
153
+ return NextResponse.json(
154
+ { error: "The configured LLM provider refused the request for this deployment", code: "provider_rejected" },
155
+ { status: 503 }
156
+ );
157
+ }
158
+ logger.error("Agent run failed with an unclassified error", {
159
+ agentId: id,
160
+ runId: observedRunId,
161
+ err
162
+ });
163
+ const reason = err instanceof Error ? `${err.name}: ${err.message}` : String(err);
164
+ return NextResponse.json(
165
+ {
166
+ error: "The agent run failed unexpectedly",
167
+ code: "agent_run_failed",
168
+ reason: reason.slice(0, 300)
169
+ },
170
+ { status: 500 }
171
+ );
172
+ }
173
+ if (guardResult?.shouldRunAfterSuccess) {
174
+ await runCrudMutationGuardAfterSuccess(container, {
175
+ tenantId: auth.tenantId,
176
+ organizationId,
177
+ userId: auth.sub,
178
+ resourceKind: "agent_orchestrator.agent_run",
179
+ resourceId: id,
180
+ operation: "custom",
181
+ requestMethod: "POST",
182
+ requestHeaders: req.headers,
183
+ metadata: guardResult.metadata
184
+ });
185
+ }
186
+ let proposalId = null;
187
+ if (observedRunId) {
188
+ const em = container.resolve("em").fork();
189
+ const proposals = await em.find(
190
+ AgentProposal,
191
+ { runId: observedRunId, tenantId: auth.tenantId, organizationId, deletedAt: null },
192
+ { orderBy: { createdAt: "desc" }, limit: 1, fields: ["id"] }
193
+ );
194
+ proposalId = proposals[0]?.id ?? null;
195
+ }
196
+ const resultRecord = result && typeof result === "object" ? result : {};
197
+ return NextResponse.json({ ...resultRecord, runId: observedRunId, proposalId });
198
+ }
199
+ const openApi = {
200
+ tag: "Agent Orchestrator",
201
+ summary: "Run an agent (Playground \u2014 engineering primitive)",
202
+ methods: {
203
+ POST: {
204
+ summary: "Run one agent directly (Playground, evals, diagnostics)",
205
+ description: "An ENGINEERING primitive, not a business-orchestration one. It runs a single agent synchronously and returns what it produced; it has no retry, no wait states, no signals, no cancellation and no durable business lifecycle, because an AgentRun records an agent execution rather than a business process. Use it for the Playground, development, evals, diagnostics and sub-agent invocation. To start durable business work \u2014 from an integration, a schedule, an event or by hand \u2014 call POST /processes/{id}/executions and observe agent_orchestrator.process.execution.* instead; a caller coupled to an agent id cannot be refactored around. Runs the agent in object mode under the caller scope, persists an AgentRun (and an AgentProposal for proposal results), and returns the typed AgentResult plus additive sibling fields: `runId` (the persisted AgentRun id) and `proposalId` (the newest AgentProposal created by the run, null for researcher runs).",
206
+ requestBody: {
207
+ contentType: "application/json",
208
+ schema: agentRunRequestSchema,
209
+ description: "Agent input payload (shape is agent-specific)."
210
+ },
211
+ responses: [
212
+ {
213
+ status: 200,
214
+ description: "Typed AgentResult + { runId, proposalId }",
215
+ schema: baseAgentResultSchema.and(
216
+ z.object({ runId: z.string().uuid().nullable(), proposalId: z.string().uuid().nullable() })
217
+ )
218
+ }
219
+ ],
220
+ errors: [
221
+ { status: 400, description: 'Tenant context missing, or no single organization is selected (run under "All organizations" is rejected)', schema: errorSchema },
222
+ { status: 401, description: "Unauthorized", schema: errorSchema },
223
+ { status: 403, description: "Missing agent_orchestrator.agents.run", schema: errorSchema },
224
+ { status: 404, description: "Unknown agent id", schema: errorSchema },
225
+ {
226
+ status: 422,
227
+ description: 'Invalid input, invalid model output, run wall-clock timeout \u2014 or a runtime guardrail block, in which case the body carries `code: "guardrail_blocked"` plus the typed `kind`/`phase`/`guardrailSetVersion` reason',
228
+ schema: z.union([errorSchema, guardrailBlockedErrorSchema])
229
+ },
230
+ { status: 429, description: "Agent run capacity exhausted (admission control); includes Retry-After", schema: errorSchema },
231
+ {
232
+ status: 500,
233
+ description: "The run failed for a reason this route does not classify; the body carries `code` (`agent_run_failed`) and a truncated `reason`",
234
+ schema: unclassifiedErrorSchema
235
+ },
236
+ {
237
+ status: 503,
238
+ description: "The deployment has no usable LLM provider; the body carries `code` (`no_provider_configured`, `api_key_missing`, or `provider_rejected` when a configured provider refuses the call)",
239
+ schema: modelUnavailableErrorSchema
240
+ }
241
+ ]
242
+ }
243
+ }
244
+ };
245
+ export {
246
+ POST,
247
+ metadata,
248
+ openApi
249
+ };
250
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/agent_orchestrator/api/agents/%5Bid%5D/run/route.ts"],
4
+ "sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { resolveOrganizationScopeForRequest } from '@open-mercato/core/modules/directory/utils/organizationScope'\nimport { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'\nimport { AiModelFactoryError } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/model-factory'\nimport { validateCrudMutationGuard, runCrudMutationGuardAfterSuccess } from '@open-mercato/shared/lib/crud/mutation-guard'\nimport { agentRunRequestSchema, baseAgentResultSchema, guardrailKind, guardrailPhase } from '../../../../data/validators'\nimport { AgentProposal } from '../../../../data/entities'\nimport {\n AgentGuardrailBlockedError,\n AgentNotFoundError,\n AgentOutputInvalidError,\n AgentRunTimeoutError,\n type AgentRunCtx,\n type AgentRuntimeService,\n} from '../../../../lib/runtime/agentRuntime'\nimport { isAgentCapacityError, resolveAdmissionMaxWaitMs } from '../../../../lib/runtime/admission'\n\nexport const metadata = {\n POST: { requireAuth: true, requireFeatures: ['agent_orchestrator.agents.run'] },\n}\n\nconst logger = createLogger('agent_orchestrator').child({ component: 'agent-run-api' })\n\nconst errorSchema = z.object({ error: z.string() })\n\n/** 422 body for a guardrail `block` verdict \u2014 distinct from plain invalid output. */\nconst guardrailBlockedErrorSchema = errorSchema.extend({\n code: z.literal('guardrail_blocked'),\n kind: guardrailKind,\n phase: guardrailPhase,\n guardrailSetVersion: z.string().nullable(),\n})\n\n/** 500 body for a failure this route could not classify \u2014 it names itself. */\nconst unclassifiedErrorSchema = errorSchema.extend({\n code: z.literal('agent_run_failed'),\n reason: z.string(),\n})\n\n/** 503 body for a deployment whose LLM provider is missing or unusable. */\nconst modelUnavailableErrorSchema = errorSchema.extend({\n code: z.enum(['no_provider_configured', 'api_key_missing', 'provider_rejected']),\n})\n\n/**\n * Did the configured provider REFUSE the call for a reason that is about this\n * deployment rather than about the request?\n *\n * Detected structurally, the way the runtime already recognises a guardrail\n * block and a capacity error, so this module keeps importing no AI SDK. The\n * status set is deliberately narrow: 401/402/403 are authentication and billing,\n * 429 is exhausted quota. A plain 400 is NOT included \u2014 that is where a genuinely\n * malformed request from our own schema would land, and labelling that an\n * environment problem would hide our bug \u2014 except for the one unmistakable case\n * where the provider spends a 400 on a billing state (Anthropic answers \"credit\n * balance is too low\" that way).\n */\nconst PROVIDER_REFUSAL_STATUSES = new Set([401, 402, 403, 429])\nconst BILLING_REFUSAL = /credit balance|billing|insufficient[_ ]quota|payment required/i\n\nconst MODEL_FACTORY_ERROR_CODES = new Set(['no_provider_configured', 'api_key_missing'])\n\n/**\n * Is this the model factory saying the deployment cannot resolve a model?\n *\n * `instanceof` alone is not enough: the run executes behind the admission queue,\n * and by the time the error surfaces here it no longer carries the factory's\n * prototype \u2014 CI caught a pinned-provider failure (\"the model is pinned to\n * openai, but that provider is not configured\") falling past the 503 branch into\n * the unclassified 500. The name and the code survive that crossing, so they are\n * what we match on, the same way the provider-refusal check above works.\n */\nfunction asModelFactoryError(err: unknown): { code: string } | null {\n if (err instanceof AiModelFactoryError) return { code: err.code }\n if (!err || typeof err !== 'object') return null\n const candidate = err as { name?: unknown; code?: unknown }\n if (candidate.name !== 'AiModelFactoryError') return null\n const code = typeof candidate.code === 'string' && MODEL_FACTORY_ERROR_CODES.has(candidate.code)\n ? candidate.code\n : 'no_provider_configured'\n return { code }\n}\n\nfunction isProviderRefusal(err: unknown): boolean {\n if (!err || typeof err !== 'object') return false\n const candidate = err as { name?: unknown; statusCode?: unknown; responseBody?: unknown }\n if (candidate.name !== 'AI_APICallError') return false\n const status = typeof candidate.statusCode === 'number' ? candidate.statusCode : null\n if (status !== null && PROVIDER_REFUSAL_STATUSES.has(status)) return true\n const body = typeof candidate.responseBody === 'string' ? candidate.responseBody : ''\n return status === 400 && BILLING_REFUSAL.test(body)\n}\n\ntype RouteContext = { params: Promise<{ id: string }> }\n\nexport async function POST(req: Request, ctx: RouteContext) {\n const auth = await getAuthFromRequest(req)\n if (!auth) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n if (!auth.tenantId || !auth.sub) {\n return NextResponse.json({ error: 'Tenant context required' }, { status: 400 })\n }\n\n const { id } = await ctx.params\n const body = await readJsonSafe(req, {})\n const parsed = agentRunRequestSchema.safeParse(body)\n if (!parsed.success) {\n return NextResponse.json(\n { error: 'Validation failed', fieldErrors: parsed.error.flatten().fieldErrors },\n { status: 422 },\n )\n }\n\n const container = await createRequestContainer()\n\n // Attribute the run to the concretely selected organization, resolved through\n // the canonical scope resolver (the same one the caseload reads with). Raw\n // `auth.orgId` is not trustworthy here: under the \"All organizations\" scope it\n // is either null (superadmin) or a stale account/home org, which would stamp an\n // AgentRun/AgentProposal under an org the caseload never queries \u2014 silently\n // orphaning the proposal from human disposition (#3629). Fail closed instead.\n const scope = await resolveOrganizationScopeForRequest({ container, auth, request: req })\n const organizationId = scope?.selectedId ?? null\n if (!organizationId) {\n return NextResponse.json(\n {\n error:\n 'Select a single organization before running an agent. Agent runs must be attributed to one organization so the resulting proposal is reviewable in the caseload.',\n },\n { status: 400 },\n )\n }\n\n const guardResult = await validateCrudMutationGuard(container, {\n tenantId: auth.tenantId,\n organizationId,\n userId: auth.sub,\n resourceKind: 'agent_orchestrator.agent_run',\n resourceId: id,\n operation: 'custom',\n requestMethod: 'POST',\n requestHeaders: req.headers,\n })\n if (guardResult && !guardResult.ok) {\n return NextResponse.json(guardResult.body, { status: guardResult.status })\n }\n\n // Capture the persisted run id (navigation spec \u00A71): the runners fire\n // `onRunPersisted` for every run they create \u2014 nested sub-agent delegations\n // included \u2014 so keep only the FIRST invocation, which is the top-level run.\n let observedRunId: string | null = null\n const runCtx: AgentRunCtx = {\n tenantId: auth.tenantId,\n organizationId,\n userId: auth.sub,\n onRunPersisted: (persistedRunId) => {\n if (!observedRunId) observedRunId = persistedRunId\n },\n }\n\n let result: unknown\n try {\n const agentRuntime = container.resolve('agentRuntime') as AgentRuntimeService\n result = await agentRuntime.run(id, parsed.data.input, runCtx)\n } catch (err) {\n if (err instanceof AgentNotFoundError) {\n return NextResponse.json({ error: 'Agent not found', code: 'agent_not_found' }, { status: 404 })\n }\n // Subclass FIRST: a guardrail block is a policy verdict, not a model bug \u2014\n // the typed reason (kind/phase/set version) must reach the client instead\n // of the generic invalid-output message (data-honesty spec \u00A73.6).\n if (err instanceof AgentGuardrailBlockedError) {\n return NextResponse.json(\n {\n error: 'Blocked by a runtime guardrail',\n code: 'guardrail_blocked',\n kind: err.kind,\n phase: err.phase,\n guardrailSetVersion: err.guardrailSetVersion ?? null,\n },\n { status: 422 },\n )\n }\n if (err instanceof AgentOutputInvalidError) {\n return NextResponse.json(\n { error: 'Agent produced invalid output', code: 'agent_output_invalid' },\n { status: 422 },\n )\n }\n if (err instanceof AgentRunTimeoutError) {\n return NextResponse.json(\n { error: 'The agent run timed out before producing a result', code: 'agent_run_timeout' },\n { status: 422 },\n )\n }\n if (isAgentCapacityError(err)) {\n const retryAfterSeconds = Math.max(1, Math.ceil(resolveAdmissionMaxWaitMs() / 1000))\n return NextResponse.json(\n { error: 'Agent run capacity is exhausted \u2014 retry shortly', code: 'agent_capacity_exhausted' },\n { status: 429, headers: { 'Retry-After': String(retryAfterSeconds) } },\n )\n }\n // A deployment with no LLM provider (or a provider whose key never\n // resolved) is a MIS-PROVISIONED ENVIRONMENT, not a bad request and not a\n // bad model answer \u2014 so it is 503, not one of this route's 422s, which all\n // mean \"the run happened and its outcome is unusable\". Mirrors the mapping\n // the ai_assistant routing endpoint already uses for the same error.\n const modelFactoryError = asModelFactoryError(err)\n if (modelFactoryError) {\n return NextResponse.json(\n { error: 'No LLM provider is configured for this deployment', code: modelFactoryError.code },\n { status: 503 },\n )\n }\n // A provider that refuses the call \u2014 no credit, revoked key, exhausted quota \u2014\n // leaves this deployment unable to run a model, exactly like a provider that\n // was never configured. Same 503, own code, so a caller can tell \"nothing is\n // wired\" from \"what is wired will not serve us\".\n if (isProviderRefusal(err)) {\n logger.error('Agent run refused by the LLM provider', { agentId: id, runId: observedRunId, err })\n return NextResponse.json(\n { error: 'The configured LLM provider refused the request for this deployment', code: 'provider_rejected' },\n { status: 503 },\n )\n }\n // Anything past the typed mappings above used to rethrow into an\n // empty-bodied 500: unreadable from the client, and \u2014 because the app runs\n // as its own process whose output the harness captures rather than prints \u2014\n // invisible in CI too. A failing run then reported only \"expected 200,\n // received 500\", which names nothing.\n //\n // It answers with its own body now, carrying the error's name and a\n // truncated message. This surface is gated on `agents.run`, the message is\n // operational detail (\"provider refused\", \"column does not exist\"), and the\n // provider's response body \u2014 which echoes the request \u2014 is never included.\n logger.error('Agent run failed with an unclassified error', {\n agentId: id,\n runId: observedRunId,\n err,\n })\n const reason = err instanceof Error ? `${err.name}: ${err.message}` : String(err)\n return NextResponse.json(\n {\n error: 'The agent run failed unexpectedly',\n code: 'agent_run_failed',\n reason: reason.slice(0, 300),\n },\n { status: 500 },\n )\n }\n\n if (guardResult?.shouldRunAfterSuccess) {\n await runCrudMutationGuardAfterSuccess(container, {\n tenantId: auth.tenantId,\n organizationId,\n userId: auth.sub,\n resourceKind: 'agent_orchestrator.agent_run',\n resourceId: id,\n operation: 'custom',\n requestMethod: 'POST',\n requestHeaders: req.headers,\n metadata: guardResult.metadata,\n })\n }\n\n // Additive sibling fields next to the typed result (navigation spec \u00A71): the\n // `AgentResult` union never defines `runId`/`proposalId`, so spreading is\n // collision-free and existing consumers reading `kind`/`proposal`/`data` are\n // unaffected. Id-only projection \u2014 no encrypted proposal columns are fetched.\n let proposalId: string | null = null\n if (observedRunId) {\n const em = (container.resolve('em') as EntityManager).fork()\n const proposals = await em.find(\n AgentProposal,\n { runId: observedRunId, tenantId: auth.tenantId, organizationId, deletedAt: null },\n { orderBy: { createdAt: 'desc' }, limit: 1, fields: ['id'] },\n )\n proposalId = proposals[0]?.id ?? null\n }\n\n const resultRecord = (result && typeof result === 'object' ? result : {}) as Record<string, unknown>\n return NextResponse.json({ ...resultRecord, runId: observedRunId, proposalId })\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: 'Agent Orchestrator',\n summary: 'Run an agent (Playground \u2014 engineering primitive)',\n methods: {\n POST: {\n summary: 'Run one agent directly (Playground, evals, diagnostics)',\n description:\n 'An ENGINEERING primitive, not a business-orchestration one. It runs a single agent synchronously and returns what it produced; it has no retry, no wait states, no signals, no cancellation and no durable business lifecycle, because an AgentRun records an agent execution rather than a business process. Use it for the Playground, development, evals, diagnostics and sub-agent invocation. To start durable business work \u2014 from an integration, a schedule, an event or by hand \u2014 call POST /processes/{id}/executions and observe agent_orchestrator.process.execution.* instead; a caller coupled to an agent id cannot be refactored around. Runs the agent in object mode under the caller scope, persists an AgentRun (and an AgentProposal for proposal results), and returns the typed AgentResult plus additive sibling fields: `runId` (the persisted AgentRun id) and `proposalId` (the newest AgentProposal created by the run, null for researcher runs).',\n requestBody: {\n contentType: 'application/json',\n schema: agentRunRequestSchema,\n description: 'Agent input payload (shape is agent-specific).',\n },\n responses: [\n {\n status: 200,\n description: 'Typed AgentResult + { runId, proposalId }',\n schema: baseAgentResultSchema.and(\n z.object({ runId: z.string().uuid().nullable(), proposalId: z.string().uuid().nullable() }),\n ),\n },\n ],\n errors: [\n { status: 400, description: 'Tenant context missing, or no single organization is selected (run under \"All organizations\" is rejected)', schema: errorSchema },\n { status: 401, description: 'Unauthorized', schema: errorSchema },\n { status: 403, description: 'Missing agent_orchestrator.agents.run', schema: errorSchema },\n { status: 404, description: 'Unknown agent id', schema: errorSchema },\n {\n status: 422,\n description:\n 'Invalid input, invalid model output, run wall-clock timeout \u2014 or a runtime guardrail block, in which case the body carries `code: \"guardrail_blocked\"` plus the typed `kind`/`phase`/`guardrailSetVersion` reason',\n schema: z.union([errorSchema, guardrailBlockedErrorSchema]),\n },\n { status: 429, description: 'Agent run capacity exhausted (admission control); includes Retry-After', schema: errorSchema },\n {\n status: 500,\n description:\n 'The run failed for a reason this route does not classify; the body carries `code` (`agent_run_failed`) and a truncated `reason`',\n schema: unclassifiedErrorSchema,\n },\n {\n status: 503,\n description:\n 'The deployment has no usable LLM provider; the body carries `code` (`no_provider_configured`, `api_key_missing`, or `provider_rejected` when a configured provider refuses the call)',\n schema: modelUnavailableErrorSchema,\n },\n ],\n },\n },\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,105 @@
1
+ import { NextResponse } from "next/server";
2
+ import { z } from "zod";
3
+ import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
4
+ import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
5
+ import { readJsonSafe } from "@open-mercato/shared/lib/http/readJsonSafe";
6
+ import { enforceCommandOptimisticLock } from "@open-mercato/shared/lib/crud/optimistic-lock-command";
7
+ import { isCrudHttpError } from "@open-mercato/shared/lib/crud/errors";
8
+ import { getAgentEntry, ensureAgentsLoaded } from "../../../../lib/sdk/defineAgent.js";
9
+ import { AgentSetting } from "../../../../data/entities.js";
10
+ import { agentIconWriteSchema } from "../../../../data/validators.js";
11
+ import { AGENT_ICON_NAMES } from "../../../../data/agentIcons.js";
12
+ import { normalizeAgentTags } from "../../../../data/agentTags.js";
13
+ const metadata = {
14
+ PUT: { requireAuth: true, requireFeatures: ["agent_orchestrator.agents.manage"] }
15
+ };
16
+ const responseSchema = z.object({
17
+ agentId: z.string(),
18
+ icon: z.enum(AGENT_ICON_NAMES).nullable(),
19
+ tags: z.array(z.string()),
20
+ updatedAt: z.string()
21
+ });
22
+ const errorSchema = z.object({ error: z.string() });
23
+ async function PUT(req, ctx) {
24
+ const auth = await getAuthFromRequest(req);
25
+ if (!auth) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
26
+ if (!auth.tenantId || !auth.orgId) {
27
+ return NextResponse.json({ error: "Tenant scope required" }, { status: 400 });
28
+ }
29
+ const { id } = await ctx.params;
30
+ await ensureAgentsLoaded();
31
+ if (!getAgentEntry(id)) return NextResponse.json({ error: "Agent not found" }, { status: 404 });
32
+ const parsed = agentIconWriteSchema.safeParse(await readJsonSafe(req, {}));
33
+ if (!parsed.success) {
34
+ return NextResponse.json(
35
+ { error: "Validation failed", fieldErrors: parsed.error.flatten().fieldErrors },
36
+ { status: 400 }
37
+ );
38
+ }
39
+ const container = await createRequestContainer();
40
+ const em = container.resolve("em").fork();
41
+ const scope = { tenantId: auth.tenantId, organizationId: auth.orgId };
42
+ const existing = await em.findOne(AgentSetting, { ...scope, agentId: id });
43
+ const nextTags = parsed.data.tags === void 0 ? void 0 : normalizeAgentTags(parsed.data.tags);
44
+ if (existing) {
45
+ try {
46
+ enforceCommandOptimisticLock({
47
+ resourceKind: "agent_orchestrator.agent_setting",
48
+ resourceId: existing.id,
49
+ current: existing.updatedAt,
50
+ expected: parsed.data.updatedAt ?? void 0,
51
+ request: req
52
+ });
53
+ } catch (err) {
54
+ if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status });
55
+ throw err;
56
+ }
57
+ if (parsed.data.icon !== void 0) existing.icon = parsed.data.icon;
58
+ if (nextTags !== void 0) existing.tags = nextTags;
59
+ await em.flush();
60
+ return NextResponse.json({
61
+ agentId: id,
62
+ icon: existing.icon ?? null,
63
+ tags: normalizeAgentTags(existing.tags),
64
+ updatedAt: existing.updatedAt.toISOString()
65
+ });
66
+ }
67
+ const created = em.create(AgentSetting, {
68
+ ...scope,
69
+ agentId: id,
70
+ icon: parsed.data.icon ?? null,
71
+ tags: nextTags ?? []
72
+ });
73
+ em.persist(created);
74
+ await em.flush();
75
+ return NextResponse.json({
76
+ agentId: id,
77
+ icon: created.icon ?? null,
78
+ tags: normalizeAgentTags(created.tags),
79
+ updatedAt: created.updatedAt.toISOString()
80
+ });
81
+ }
82
+ const openApi = {
83
+ tag: "Agent Orchestrator",
84
+ summary: "Update agent presentation settings",
85
+ methods: {
86
+ PUT: {
87
+ summary: "Set an agent's presentation icon and tags",
88
+ description: "Upserts the per-(tenant, organization) presentation icon and operator tags for an agent definition. Both fields are optional and an omitted one is left unchanged. Optimistic-locked on the settings row updatedAt. Gated by agent_orchestrator.agents.manage.",
89
+ responses: [{ status: 200, description: "Updated settings", schema: responseSchema }],
90
+ errors: [
91
+ { status: 400, description: "Validation failed / missing scope", schema: errorSchema },
92
+ { status: 401, description: "Unauthorized", schema: errorSchema },
93
+ { status: 403, description: "Missing agent_orchestrator.agents.manage", schema: errorSchema },
94
+ { status: 404, description: "Unknown agent id", schema: errorSchema },
95
+ { status: 409, description: "Optimistic lock conflict", schema: errorSchema }
96
+ ]
97
+ }
98
+ }
99
+ };
100
+ export {
101
+ PUT,
102
+ metadata,
103
+ openApi
104
+ };
105
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/modules/agent_orchestrator/api/agents/%5Bid%5D/settings/route.ts"],
4
+ "sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { readJsonSafe } from '@open-mercato/shared/lib/http/readJsonSafe'\nimport { enforceCommandOptimisticLock } from '@open-mercato/shared/lib/crud/optimistic-lock-command'\nimport { isCrudHttpError } from '@open-mercato/shared/lib/crud/errors'\nimport { getAgentEntry, ensureAgentsLoaded } from '../../../../lib/sdk/defineAgent'\nimport { AgentSetting } from '../../../../data/entities'\nimport { agentIconWriteSchema } from '../../../../data/validators'\nimport { AGENT_ICON_NAMES } from '../../../../data/agentIcons'\nimport { normalizeAgentTags } from '../../../../data/agentTags'\n\nexport const metadata = {\n PUT: { requireAuth: true, requireFeatures: ['agent_orchestrator.agents.manage'] },\n}\n\nconst responseSchema = z.object({\n agentId: z.string(),\n icon: z.enum(AGENT_ICON_NAMES).nullable(),\n tags: z.array(z.string()),\n updatedAt: z.string(),\n})\n\nconst errorSchema = z.object({ error: z.string() })\n\ntype RouteContext = { params: Promise<{ id: string }> }\n\nexport async function PUT(req: Request, ctx: RouteContext) {\n const auth = await getAuthFromRequest(req)\n if (!auth) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n if (!auth.tenantId || !auth.orgId) {\n return NextResponse.json({ error: 'Tenant scope required' }, { status: 400 })\n }\n const { id } = await ctx.params\n\n await ensureAgentsLoaded()\n if (!getAgentEntry(id)) return NextResponse.json({ error: 'Agent not found' }, { status: 404 })\n\n const parsed = agentIconWriteSchema.safeParse(await readJsonSafe(req, {}))\n if (!parsed.success) {\n return NextResponse.json(\n { error: 'Validation failed', fieldErrors: parsed.error.flatten().fieldErrors },\n { status: 400 },\n )\n }\n\n const container = await createRequestContainer()\n const em = (container.resolve('em') as EntityManager).fork()\n const scope = { tenantId: auth.tenantId, organizationId: auth.orgId }\n const existing = await em.findOne(AgentSetting, { ...scope, agentId: id })\n\n // An omitted field means \"leave as is\", so tags-only and icon-only writes both\n // work against the one shared row.\n const nextTags = parsed.data.tags === undefined ? undefined : normalizeAgentTags(parsed.data.tags)\n\n if (existing) {\n // Optimistic lock only applies to an update of an existing row; a first-time\n // write (no row) has nothing to conflict with.\n try {\n enforceCommandOptimisticLock({\n resourceKind: 'agent_orchestrator.agent_setting',\n resourceId: existing.id,\n current: existing.updatedAt,\n expected: parsed.data.updatedAt ?? undefined,\n request: req,\n })\n } catch (err) {\n if (isCrudHttpError(err)) return NextResponse.json(err.body, { status: err.status })\n throw err\n }\n if (parsed.data.icon !== undefined) existing.icon = parsed.data.icon\n if (nextTags !== undefined) existing.tags = nextTags\n await em.flush()\n return NextResponse.json({\n agentId: id,\n icon: existing.icon ?? null,\n tags: normalizeAgentTags(existing.tags),\n updatedAt: existing.updatedAt.toISOString(),\n })\n }\n\n const created = em.create(AgentSetting, {\n ...scope,\n agentId: id,\n icon: parsed.data.icon ?? null,\n tags: nextTags ?? [],\n })\n em.persist(created)\n await em.flush()\n return NextResponse.json({\n agentId: id,\n icon: created.icon ?? null,\n tags: normalizeAgentTags(created.tags),\n updatedAt: created.updatedAt.toISOString(),\n })\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: 'Agent Orchestrator',\n summary: 'Update agent presentation settings',\n methods: {\n PUT: {\n summary: \"Set an agent's presentation icon and tags\",\n description:\n 'Upserts the per-(tenant, organization) presentation icon and operator tags for an agent definition. Both fields are optional and an omitted one is left unchanged. Optimistic-locked on the settings row updatedAt. Gated by agent_orchestrator.agents.manage.',\n responses: [{ status: 200, description: 'Updated settings', schema: responseSchema }],\n errors: [\n { status: 400, description: 'Validation failed / missing scope', schema: errorSchema },\n { status: 401, description: 'Unauthorized', schema: errorSchema },\n { status: 403, description: 'Missing agent_orchestrator.agents.manage', schema: errorSchema },\n { status: 404, description: 'Unknown agent id', schema: errorSchema },\n { status: 409, description: 'Optimistic lock conflict', schema: errorSchema },\n ],\n },\n },\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,114 @@
1
+ import { NextResponse } from "next/server";
2
+ import { z } from "zod";
3
+ import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
4
+ import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
5
+ import { listAgentEntries, ensureAgentsLoaded } from "../../lib/sdk/defineAgent.js";
6
+ import { resolveAgentOutcomeJsonSchema } from "../../lib/sdk/agentOutcomeContract.js";
7
+ import { getAgentPresentationMaps } from "../../lib/settings/agentSettings.js";
8
+ import { AGENT_ICON_NAMES } from "../../data/agentIcons.js";
9
+ import { agentTypeSchema } from "../../data/validators.js";
10
+ const metadata = {
11
+ GET: { requireAuth: true, requireFeatures: ["agent_orchestrator.agents.view"] }
12
+ };
13
+ const agentItemSchema = z.object({
14
+ id: z.string(),
15
+ resultKind: z.enum(["research", "proposal", "artifact"]),
16
+ // The DECLARED type (authoring fact). Null when the agent declares none —
17
+ // never defaulted to `researcher`, which would invent a declaration.
18
+ agentType: agentTypeSchema.nullable(),
19
+ // The effective action vocabulary after `catalogue ∩ allowedActions`. Null when
20
+ // the agent declared no narrowing (it may propose anything in the catalogue);
21
+ // an empty array means nothing survived the intersection.
22
+ allowedActions: z.array(z.string()).nullable(),
23
+ runtime: z.enum(["in-process", "native", "opencode", "external"]),
24
+ tools: z.array(z.string()),
25
+ skills: z.array(z.string()),
26
+ label: z.string(),
27
+ description: z.string(),
28
+ // Per-tenant presentation icon (lucide name) overriding the initials avatar
29
+ // in the agents list / overview. Null when the tenant has not set one.
30
+ icon: z.enum(AGENT_ICON_NAMES).nullable(),
31
+ // Per-tenant operator tags, normalized. Empty when the tenant has not tagged
32
+ // this agent; the registry list filters on them.
33
+ tags: z.array(z.string()),
34
+ // Optional per-agent example input for the Playground "Insert sample" button.
35
+ sampleInput: z.unknown().optional(),
36
+ // Optional OUTCOME JSON-Schema (the inner `data`/`proposal` shape, not the
37
+ // envelope) so consumers can type what an agent returns without a second
38
+ // fetch — the workflows INVOKE_AGENT editor builds its output-mapping source
39
+ // picker from it. Absent for agents whose result schema is not the declared
40
+ // envelope; consumers degrade to free text.
41
+ outcomeSchema: z.record(z.string(), z.unknown()).optional(),
42
+ // Optional declared Caseload facts (label + dot-path into run input/proposal payload/run output).
43
+ facts: z.array(
44
+ z.object({
45
+ label: z.string(),
46
+ source: z.enum(["input", "payload", "output"]),
47
+ path: z.string(),
48
+ format: z.enum(["text", "number", "boolean", "percent"]).optional()
49
+ })
50
+ ).optional()
51
+ });
52
+ const agentListResponseSchema = z.object({
53
+ items: z.array(agentItemSchema)
54
+ });
55
+ const errorSchema = z.object({ error: z.string() });
56
+ async function GET(req) {
57
+ const auth = await getAuthFromRequest(req);
58
+ if (!auth) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
59
+ await ensureAgentsLoaded();
60
+ let iconByAgent = /* @__PURE__ */ new Map();
61
+ let tagsByAgent = /* @__PURE__ */ new Map();
62
+ if (auth.tenantId && auth.orgId) {
63
+ try {
64
+ const container = await createRequestContainer();
65
+ const em = container.resolve("em").fork();
66
+ const maps = await getAgentPresentationMaps(em, { tenantId: auth.tenantId, organizationId: auth.orgId });
67
+ iconByAgent = maps.icons;
68
+ tagsByAgent = maps.tags;
69
+ } catch {
70
+ iconByAgent = /* @__PURE__ */ new Map();
71
+ tagsByAgent = /* @__PURE__ */ new Map();
72
+ }
73
+ }
74
+ const items = listAgentEntries().map((entry) => ({
75
+ id: entry.id,
76
+ resultKind: entry.resultKind,
77
+ agentType: entry.agentType ?? null,
78
+ allowedActions: entry.allowedActions ? [...entry.allowedActions] : null,
79
+ runtime: entry.runtime,
80
+ tools: entry.tools,
81
+ skills: entry.skills,
82
+ label: entry.label,
83
+ description: entry.description,
84
+ icon: iconByAgent.get(entry.id) ?? null,
85
+ tags: tagsByAgent.get(entry.id) ?? [],
86
+ sampleInput: entry.sampleInput,
87
+ outcomeSchema: resolveAgentOutcomeJsonSchema(entry),
88
+ facts: entry.facts
89
+ }));
90
+ return NextResponse.json({ items });
91
+ }
92
+ const openApi = {
93
+ tag: "Agent Orchestrator",
94
+ summary: "List agents",
95
+ methods: {
96
+ GET: {
97
+ summary: "List registered agents",
98
+ description: "Returns the in-module agent registry (id, result kind, declared agent type, narrowed action vocabulary, tools, skills, label, description, OUTCOME JSON-Schema) for agents declared via defineAgent or the file-agent conventions, merged with the tenant presentation overrides (icon, tags).",
99
+ responses: [
100
+ { status: 200, description: "Registered agents", schema: agentListResponseSchema }
101
+ ],
102
+ errors: [
103
+ { status: 401, description: "Unauthorized", schema: errorSchema },
104
+ { status: 403, description: "Missing agent_orchestrator.agents.view", schema: errorSchema }
105
+ ]
106
+ }
107
+ }
108
+ };
109
+ export {
110
+ GET,
111
+ metadata,
112
+ openApi
113
+ };
114
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/modules/agent_orchestrator/api/agents/route.ts"],
4
+ "sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { listAgentEntries, ensureAgentsLoaded } from '../../lib/sdk/defineAgent'\nimport { resolveAgentOutcomeJsonSchema } from '../../lib/sdk/agentOutcomeContract'\nimport { getAgentPresentationMaps } from '../../lib/settings/agentSettings'\nimport { AGENT_ICON_NAMES } from '../../data/agentIcons'\nimport { agentTypeSchema } from '../../data/validators'\n\nexport const metadata = {\n GET: { requireAuth: true, requireFeatures: ['agent_orchestrator.agents.view'] },\n}\n\nconst agentItemSchema = z.object({\n id: z.string(),\n resultKind: z.enum(['research', 'proposal', 'artifact']),\n // The DECLARED type (authoring fact). Null when the agent declares none \u2014\n // never defaulted to `researcher`, which would invent a declaration.\n agentType: agentTypeSchema.nullable(),\n // The effective action vocabulary after `catalogue \u2229 allowedActions`. Null when\n // the agent declared no narrowing (it may propose anything in the catalogue);\n // an empty array means nothing survived the intersection.\n allowedActions: z.array(z.string()).nullable(),\n runtime: z.enum(['in-process', 'native', 'opencode', 'external']),\n tools: z.array(z.string()),\n skills: z.array(z.string()),\n label: z.string(),\n description: z.string(),\n // Per-tenant presentation icon (lucide name) overriding the initials avatar\n // in the agents list / overview. Null when the tenant has not set one.\n icon: z.enum(AGENT_ICON_NAMES).nullable(),\n // Per-tenant operator tags, normalized. Empty when the tenant has not tagged\n // this agent; the registry list filters on them.\n tags: z.array(z.string()),\n // Optional per-agent example input for the Playground \"Insert sample\" button.\n sampleInput: z.unknown().optional(),\n // Optional OUTCOME JSON-Schema (the inner `data`/`proposal` shape, not the\n // envelope) so consumers can type what an agent returns without a second\n // fetch \u2014 the workflows INVOKE_AGENT editor builds its output-mapping source\n // picker from it. Absent for agents whose result schema is not the declared\n // envelope; consumers degrade to free text.\n outcomeSchema: z.record(z.string(), z.unknown()).optional(),\n // Optional declared Caseload facts (label + dot-path into run input/proposal payload/run output).\n facts: z\n .array(\n z.object({\n label: z.string(),\n source: z.enum(['input', 'payload', 'output']),\n path: z.string(),\n format: z.enum(['text', 'number', 'boolean', 'percent']).optional(),\n }),\n )\n .optional(),\n})\n\nconst agentListResponseSchema = z.object({\n items: z.array(agentItemSchema),\n})\n\nconst errorSchema = z.object({ error: z.string() })\n\nexport async function GET(req: Request) {\n const auth = await getAuthFromRequest(req)\n if (!auth) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })\n await ensureAgentsLoaded()\n\n // Per-tenant presentation overrides. Best-effort: a missing scope or a settings\n // read failure must not break the registry listing \u2014 agents still render with\n // their initials fallback and no tags.\n let iconByAgent = new Map<string, string>()\n let tagsByAgent = new Map<string, string[]>()\n if (auth.tenantId && auth.orgId) {\n try {\n const container = await createRequestContainer()\n const em = (container.resolve('em') as EntityManager).fork()\n const maps = await getAgentPresentationMaps(em, { tenantId: auth.tenantId, organizationId: auth.orgId })\n iconByAgent = maps.icons\n tagsByAgent = maps.tags\n } catch {\n iconByAgent = new Map()\n tagsByAgent = new Map()\n }\n }\n\n const items = listAgentEntries().map((entry) => ({\n id: entry.id,\n resultKind: entry.resultKind,\n agentType: entry.agentType ?? null,\n allowedActions: entry.allowedActions ? [...entry.allowedActions] : null,\n runtime: entry.runtime,\n tools: entry.tools,\n skills: entry.skills,\n label: entry.label,\n description: entry.description,\n icon: iconByAgent.get(entry.id) ?? null,\n tags: tagsByAgent.get(entry.id) ?? [],\n sampleInput: entry.sampleInput,\n outcomeSchema: resolveAgentOutcomeJsonSchema(entry),\n facts: entry.facts,\n }))\n return NextResponse.json({ items })\n}\n\nexport const openApi: OpenApiRouteDoc = {\n tag: 'Agent Orchestrator',\n summary: 'List agents',\n methods: {\n GET: {\n summary: 'List registered agents',\n description:\n 'Returns the in-module agent registry (id, result kind, declared agent type, narrowed action vocabulary, tools, skills, label, description, OUTCOME JSON-Schema) for agents declared via defineAgent or the file-agent conventions, merged with the tenant presentation overrides (icon, tags).',\n responses: [\n { status: 200, description: 'Registered agents', schema: agentListResponseSchema },\n ],\n errors: [\n { status: 401, description: 'Unauthorized', schema: errorSchema },\n { status: 403, description: 'Missing agent_orchestrator.agents.view', schema: errorSchema },\n ],\n },\n },\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,64 @@
1
+ import { NextResponse } from "next/server";
2
+ import { z } from "zod";
3
+ import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
4
+ import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
5
+ import { AgentRunArtifact } from "../../../../data/entities.js";
6
+ import { getArtifactBytes } from "../../../../lib/runtime/artifactFileStore.js";
7
+ const metadata = {
8
+ GET: { requireAuth: true, requireFeatures: ["agent_orchestrator.trace.view"] }
9
+ };
10
+ const idSchema = z.string().uuid();
11
+ const errorSchema = z.object({ error: z.string() });
12
+ async function GET(req, ctx) {
13
+ const auth = await getAuthFromRequest(req);
14
+ if (!auth?.tenantId) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
15
+ const { id } = await ctx.params;
16
+ const parsedId = idSchema.safeParse(id);
17
+ if (!parsedId.success) return NextResponse.json({ error: "Artifact not found" }, { status: 404 });
18
+ const scope = { tenantId: auth.tenantId, organizationId: auth.orgId ?? void 0 };
19
+ const container = await createRequestContainer();
20
+ const em = container.resolve("em").fork();
21
+ const artifact = await em.findOne(AgentRunArtifact, { id: parsedId.data, ...scope, deletedAt: null });
22
+ if (!artifact) return NextResponse.json({ error: "Artifact not found" }, { status: 404 });
23
+ const bytes = await getArtifactBytes(
24
+ container,
25
+ { tenantId: auth.tenantId, organizationId: auth.orgId ?? "" },
26
+ artifact.storageKey
27
+ );
28
+ if (!bytes) return NextResponse.json({ error: "Artifact bytes unavailable" }, { status: 404 });
29
+ const url = new URL(req.url);
30
+ const asDownload = url.searchParams.get("download") === "1";
31
+ const safeName = artifact.fileName.replace(/["\\]/g, "_");
32
+ const headers = new Headers({
33
+ "Content-Type": artifact.mimeType || "application/octet-stream",
34
+ "Content-Length": String(bytes.length),
35
+ "Content-Disposition": `${asDownload ? "attachment" : "inline"}; filename="${safeName}"`,
36
+ // Agent-authored bytes are untrusted: block any active content + sniffing.
37
+ "Content-Security-Policy": "default-src 'none'; sandbox",
38
+ "X-Content-Type-Options": "nosniff",
39
+ "Cache-Control": "private, no-store"
40
+ });
41
+ return new NextResponse(new Uint8Array(bytes), { status: 200, headers });
42
+ }
43
+ const openApi = {
44
+ tag: "Agent Orchestrator",
45
+ summary: "Download an agent run file artifact",
46
+ methods: {
47
+ GET: {
48
+ summary: "Stream a captured artifact\u2019s decrypted bytes",
49
+ description: "Streams the decrypted bytes of one AgentRunArtifact. Org-scoped; gated by agent_orchestrator.trace.view. Pass ?download=1 to force an attachment disposition.",
50
+ responses: [{ status: 200, description: "Artifact bytes" }],
51
+ errors: [
52
+ { status: 401, description: "Unauthorized", schema: errorSchema },
53
+ { status: 403, description: "Missing agent_orchestrator.trace.view", schema: errorSchema },
54
+ { status: 404, description: "Unknown artifact id or bytes unavailable", schema: errorSchema }
55
+ ]
56
+ }
57
+ }
58
+ };
59
+ export {
60
+ GET,
61
+ metadata,
62
+ openApi
63
+ };
64
+ //# sourceMappingURL=route.js.map