@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,417 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { parseBooleanWithDefault } from "@open-mercato/shared/lib/boolean";
4
+ import { parseAgentMarkdown } from "./agentMarkdown.js";
5
+ import { parseAgentLocalSkillMarkdown } from "./skillMarkdown.js";
6
+ import { compileOutcome } from "./outcomeSchema.js";
7
+ import { createLogger } from "@open-mercato/shared/lib/logger";
8
+ const logger = createLogger("agent_orchestrator").child({ component: "define-file-agent" });
9
+ import { registerFileAgent } from "./defineAgent.js";
10
+ const OUTCOME_FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---\s*\n?([\s\S]*)$/;
11
+ const JSON_FENCE_RE = /```json\s*\n([\s\S]*?)\n```/;
12
+ function parseOutcomeKind(frontmatterBlock) {
13
+ for (const line of frontmatterBlock.split("\n")) {
14
+ const match = /^kind:\s*(.*)$/.exec(line.trim());
15
+ if (!match) continue;
16
+ const value = match[1].trim().replace(/^['"]/, "").replace(/['"]$/, "").trim();
17
+ if (value === "research" || value === "proposal" || value === "artifact") return value;
18
+ return null;
19
+ }
20
+ return null;
21
+ }
22
+ function parseOutcomeMarkdown(raw) {
23
+ const frontmatterMatch = OUTCOME_FRONTMATTER_RE.exec(raw);
24
+ if (!frontmatterMatch) return null;
25
+ const [, frontmatterBlock, body] = frontmatterMatch;
26
+ const kind = parseOutcomeKind(frontmatterBlock);
27
+ if (!kind) return null;
28
+ const fenceMatch = JSON_FENCE_RE.exec(body);
29
+ if (!fenceMatch) {
30
+ return kind === "artifact" ? { kind, prose: body.trim() } : null;
31
+ }
32
+ let parsed;
33
+ try {
34
+ parsed = JSON.parse(fenceMatch[1]);
35
+ } catch {
36
+ return null;
37
+ }
38
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
39
+ const prose = body.slice(fenceMatch.index + fenceMatch[0].length).trim();
40
+ return { kind, schema: parsed, prose };
41
+ }
42
+ function renderOutcomeSection(kind, schema, prose) {
43
+ if (kind === "artifact") {
44
+ return [
45
+ "## Outcome contract",
46
+ "Write the files you produce into the run's `out/` directory, then pass this shape as the `outcome` argument of the submit_outcome tool:",
47
+ "",
48
+ "```json",
49
+ JSON.stringify(
50
+ {
51
+ artifacts: [{ fileName: "report.pdf", mimeType: "application/pdf", caption: "What this file is" }],
52
+ summary: "One sentence about what you produced."
53
+ },
54
+ null,
55
+ 2
56
+ ),
57
+ "```",
58
+ ...prose ? ["", prose] : []
59
+ ].join("\n");
60
+ }
61
+ const target = kind === "proposal" ? "the `proposal` object" : "the `data` object";
62
+ const schemaJson = JSON.stringify(schema, null, 2);
63
+ return [
64
+ "## Outcome contract",
65
+ `Your result MUST match this JSON Schema (${target}). Pass it as the \`outcome\` argument of the submit_outcome tool, as a JSON object (not a string):`,
66
+ "",
67
+ "```json",
68
+ schemaJson,
69
+ "```",
70
+ ...prose ? ["", prose] : []
71
+ ].join("\n");
72
+ }
73
+ function sanitizeAgentName(id) {
74
+ return id.replace(/[^a-z0-9_-]/gi, "_");
75
+ }
76
+ function loadSampleInput(dir) {
77
+ const samplePath = path.join(dir, "SAMPLE.json");
78
+ if (!fs.existsSync(samplePath)) return void 0;
79
+ try {
80
+ return JSON.parse(fs.readFileSync(samplePath, "utf8"));
81
+ } catch {
82
+ logger.warn("malformed SAMPLE.json; ignoring", { dir });
83
+ return void 0;
84
+ }
85
+ }
86
+ const FACT_SOURCES = ["input", "payload", "output"];
87
+ const FACT_FORMATS = ["text", "number", "boolean", "percent"];
88
+ function loadFacts(dir) {
89
+ const factsPath = path.join(dir, "FACTS.json");
90
+ if (!fs.existsSync(factsPath)) return void 0;
91
+ try {
92
+ const parsed = JSON.parse(fs.readFileSync(factsPath, "utf8"));
93
+ const entries = Array.isArray(parsed) ? parsed : parsed && typeof parsed === "object" && Array.isArray(parsed.facts) ? parsed.facts : null;
94
+ if (!entries) throw new Error('expected an array or { "facts": [...] }');
95
+ const facts = entries.filter((entry) => {
96
+ const fact = entry;
97
+ return Boolean(
98
+ fact && typeof fact.label === "string" && fact.label.trim() && typeof fact.path === "string" && fact.path.trim() && FACT_SOURCES.includes(fact.source) && (fact.format === void 0 || FACT_FORMATS.includes(fact.format))
99
+ );
100
+ });
101
+ return facts.length > 0 ? facts : void 0;
102
+ } catch (err) {
103
+ logger.warn("malformed FACTS.json; ignoring", {
104
+ dir,
105
+ error: err instanceof Error ? err.message : String(err)
106
+ });
107
+ return void 0;
108
+ }
109
+ }
110
+ function renderToolPermissionLine(toolName) {
111
+ return ` ${JSON.stringify(toolName)}: true`;
112
+ }
113
+ const DELEGATE_AGENT_TOOL_ID = "agent_orchestrator.delegate_agent";
114
+ const OPENCODE_MCP_SERVER_KEY = "open-mercato";
115
+ const CORE_FILE_AGENT_TOOL_IDS = [
116
+ "agent_orchestrator.submit_outcome",
117
+ "agent_orchestrator.load_skill",
118
+ "agent_orchestrator.run_skill_script"
119
+ ];
120
+ function toOpenCodeMcpToolId(omToolId) {
121
+ return `${OPENCODE_MCP_SERVER_KEY}_${omToolId.replace(/\./g, "_")}`;
122
+ }
123
+ function renderOpenCodeAgentFile(args) {
124
+ const mode = args.mode ?? "primary";
125
+ const subAgentIds = mode === "primary" ? args.subAgentIds ?? [] : [];
126
+ const hasSubAgents = subAgentIds.length > 0;
127
+ const omMcpToolIds = Array.from(
128
+ /* @__PURE__ */ new Set([...args.tools, ...CORE_FILE_AGENT_TOOL_IDS, ...hasSubAgents ? [DELEGATE_AGENT_TOOL_ID] : []])
129
+ );
130
+ const allowedTools = omMcpToolIds.map(toOpenCodeMcpToolId);
131
+ const modelLine = args.provider && args.model ? `model: ${args.provider}/${args.model}` : args.model ? `model: ${args.model}` : null;
132
+ const taskPermissionLines = [" task: deny"];
133
+ const filesActive = mode === "primary" && !!args.files?.enabled && parseBooleanWithDefault(process.env.OM_OPENCODE_FILES_ENABLED, false);
134
+ const containerWorkspaceRoot = (process.env.OM_OPENCODE_WORKSPACE_ROOT_CONTAINER || process.env.OM_OPENCODE_WORKSPACE_ROOT || "/home/opencode/work").trim();
135
+ const workspaceGlob = `${containerWorkspaceRoot}/**`;
136
+ const fileToolLines = [];
137
+ const filePermissionLines = [" write: deny", " edit: deny", " bash: deny"];
138
+ if (filesActive) {
139
+ fileToolLines.push(" read: true", " write: true", " edit: true");
140
+ if (args.files?.bash) fileToolLines.push(" bash: true");
141
+ filePermissionLines.length = 0;
142
+ for (const tool of ["write", "edit", "read"]) {
143
+ filePermissionLines.push(` ${tool}:`, ` ${JSON.stringify(workspaceGlob)}: allow`, ' "*": deny');
144
+ }
145
+ filePermissionLines.push(args.files?.bash ? " bash: allow" : " bash: deny");
146
+ }
147
+ const frontmatterLines = [
148
+ "---",
149
+ `description: ${JSON.stringify(args.description)}`,
150
+ ...modelLine ? [modelLine] : [],
151
+ `mode: ${mode}`,
152
+ "tools:",
153
+ ' "*": false',
154
+ ...allowedTools.map(renderToolPermissionLine),
155
+ ...fileToolLines,
156
+ "permission:",
157
+ ...filePermissionLines,
158
+ ...taskPermissionLines,
159
+ "---"
160
+ ];
161
+ const submitToolId = toOpenCodeMcpToolId("agent_orchestrator.submit_outcome");
162
+ const terminalInstruction = `Finish by calling the \`${submitToolId}\` tool with a value matching the outcome contract (pass it as the \`outcome\` argument). You MUST call the tool \u2014 do not answer in prose or emit the result as a code block.`;
163
+ const delegateToolName = toOpenCodeMcpToolId(DELEGATE_AGENT_TOOL_ID);
164
+ const subAgentSection = hasSubAgents ? `## Sub-agents
165
+ Delegate a sub-task by calling the \`${delegateToolName}\` tool with \`{ agentId: "<sub-agent id>", input: <sub-task input object> }\`. Issue multiple \`${delegateToolName}\` calls in the SAME step to fan out in parallel, then combine their results before submitting your outcome. Available sub-agents: ${subAgentIds.join(", ")}.` : null;
166
+ const outcomeSection = renderOutcomeSection(args.outcomeKind, args.outcomeSchema, args.outcomeProse);
167
+ const body = [
168
+ args.instructions.trim(),
169
+ ...subAgentSection ? [subAgentSection] : [],
170
+ outcomeSection,
171
+ terminalInstruction
172
+ ].filter(Boolean).join("\n\n");
173
+ return `${frontmatterLines.join("\n")}
174
+ ${body}
175
+ `;
176
+ }
177
+ function loadScriptsDir(scriptsDir) {
178
+ if (!fs.existsSync(scriptsDir) || !fs.statSync(scriptsDir).isDirectory()) return [];
179
+ const scripts = [];
180
+ const files = fs.readdirSync(scriptsDir).filter((name) => name.endsWith(".ts") || name.endsWith(".js")).sort((a, b) => a.localeCompare(b));
181
+ for (const file of files) {
182
+ const source = fs.readFileSync(path.join(scriptsDir, file), "utf8");
183
+ scripts.push({ name: file.replace(/\.(ts|js)$/, ""), source });
184
+ }
185
+ return scripts;
186
+ }
187
+ function loadSkillDir(skillDir) {
188
+ const skillPath = path.join(skillDir, "SKILL.md");
189
+ if (!fs.existsSync(skillPath)) return null;
190
+ const dirName = path.basename(skillDir);
191
+ const parsed = parseAgentLocalSkillMarkdown(fs.readFileSync(skillPath, "utf8"), dirName);
192
+ if (!parsed) return null;
193
+ const templatePath = path.join(skillDir, "TEMPLATE.md");
194
+ const template = fs.existsSync(templatePath) ? fs.readFileSync(templatePath, "utf8").trim() || void 0 : void 0;
195
+ const examplesDir = path.join(skillDir, "examples");
196
+ const examples = [];
197
+ if (fs.existsSync(examplesDir) && fs.statSync(examplesDir).isDirectory()) {
198
+ const files = fs.readdirSync(examplesDir).filter((name) => name.endsWith(".md")).sort((a, b) => a.localeCompare(b));
199
+ for (const file of files) {
200
+ const body = fs.readFileSync(path.join(examplesDir, file), "utf8").trim();
201
+ if (body) examples.push(body);
202
+ }
203
+ }
204
+ return {
205
+ id: parsed.id,
206
+ instructions: parsed.instructions,
207
+ template,
208
+ examples,
209
+ tools: parsed.tools,
210
+ scripts: loadScriptsDir(path.join(skillDir, "scripts"))
211
+ };
212
+ }
213
+ const TOOL_REF_RE = /^\s*\/\/\s*@ref:?\s+(\S+)/;
214
+ function loadToolFiles(agentDir) {
215
+ const toolsBase = path.join(agentDir, "tools");
216
+ if (!fs.existsSync(toolsBase) || !fs.statSync(toolsBase).isDirectory()) {
217
+ return { refs: [], scripts: [] };
218
+ }
219
+ const refs = [];
220
+ const scripts = [];
221
+ const files = fs.readdirSync(toolsBase).filter((name) => name.endsWith(".ts") || name.endsWith(".js")).sort((a, b) => a.localeCompare(b));
222
+ for (const file of files) {
223
+ const source = fs.readFileSync(path.join(toolsBase, file), "utf8");
224
+ const firstLine = source.split("\n", 1)[0] ?? "";
225
+ const refMatch = TOOL_REF_RE.exec(firstLine);
226
+ if (refMatch) {
227
+ refs.push(refMatch[1]);
228
+ continue;
229
+ }
230
+ scripts.push({ name: file.replace(/\.(ts|js)$/, ""), source });
231
+ }
232
+ return { refs, scripts };
233
+ }
234
+ const AGENT_TOOLS_SKILL_ID = "__agent_tools__";
235
+ function loadAgentSkills(agentDir, skillIds) {
236
+ if (skillIds.length === 0) return [];
237
+ const skillsBase = path.join(agentDir, "skills");
238
+ const hasSkillsDir = fs.existsSync(skillsBase) && fs.statSync(skillsBase).isDirectory();
239
+ const bySkillId = /* @__PURE__ */ new Map();
240
+ if (hasSkillsDir) {
241
+ for (const entry of fs.readdirSync(skillsBase, { withFileTypes: true })) {
242
+ if (!entry.isDirectory()) continue;
243
+ const loaded = loadSkillDir(path.join(skillsBase, entry.name));
244
+ if (loaded) bySkillId.set(loaded.id, loaded);
245
+ }
246
+ }
247
+ const resolved = [];
248
+ for (const skillId of skillIds) {
249
+ const skill = bySkillId.get(skillId);
250
+ if (!skill) {
251
+ logger.warn("file agent skill not found; skipping", { skillId, skillsBase });
252
+ continue;
253
+ }
254
+ resolved.push(skill);
255
+ }
256
+ return resolved;
257
+ }
258
+ function loadSubAgentDir(dir) {
259
+ const agentMdPath = path.join(dir, "AGENT.md");
260
+ const outcomePath = path.join(dir, "OUTCOME.md");
261
+ if (!fs.existsSync(agentMdPath) || !fs.existsSync(outcomePath)) {
262
+ throw new Error(`[internal] malformed sub-agent at ${dir}: both AGENT.md and OUTCOME.md are required`);
263
+ }
264
+ const agent = parseAgentMarkdown(fs.readFileSync(agentMdPath, "utf8"));
265
+ if (!agent) {
266
+ throw new Error(`[internal] malformed AGENT.md at ${dir}: missing id/label/description`);
267
+ }
268
+ const outcome = parseOutcomeMarkdown(fs.readFileSync(outcomePath, "utf8"));
269
+ if (!outcome) {
270
+ throw new Error(`[internal] malformed OUTCOME.md at ${dir}: missing kind or JSON-Schema block`);
271
+ }
272
+ if (outcome.kind !== "research") {
273
+ throw new Error(
274
+ `[internal] sub-agent at ${dir} must be research (kind: research); sub-agents inform, only the primary proposes`
275
+ );
276
+ }
277
+ if (agent.subAgents.length > 0) {
278
+ throw new Error(
279
+ `[internal] sub-agent at ${dir} may not declare subAgents (depth cap = 1); sub-agents may not delegate further`
280
+ );
281
+ }
282
+ let resultSchema;
283
+ try {
284
+ resultSchema = compileOutcome({ kind: outcome.kind, schema: outcome.schema }).resultSchema;
285
+ } catch (err) {
286
+ const detail = err instanceof Error ? err.message : String(err);
287
+ throw new Error(`[internal] malformed OUTCOME.md at ${dir}: ${detail}`);
288
+ }
289
+ const skillsContent = loadAgentSkills(dir, agent.skills);
290
+ const skillTools = skillsContent.flatMap((skill) => skill.tools);
291
+ const effectiveTools = Array.from(/* @__PURE__ */ new Set([...agent.tools, ...skillTools]));
292
+ const openCodeAgentName = sanitizeAgentName(agent.id);
293
+ const entry = {
294
+ id: agent.id,
295
+ moduleId: "",
296
+ resultKind: outcome.kind,
297
+ schema: resultSchema,
298
+ tools: effectiveTools,
299
+ skills: agent.skills,
300
+ subAgents: [],
301
+ label: agent.label,
302
+ description: agent.description,
303
+ instructions: agent.instructions,
304
+ defaultProvider: agent.provider,
305
+ defaultModel: agent.model,
306
+ loop: agent.maxSteps != null ? { maxSteps: agent.maxSteps } : void 0,
307
+ runtime: "opencode",
308
+ sampleInput: loadSampleInput(dir),
309
+ facts: loadFacts(dir)
310
+ };
311
+ const openCodeAgentFile = renderOpenCodeAgentFile({
312
+ description: agent.description,
313
+ provider: agent.provider,
314
+ model: agent.model,
315
+ instructions: agent.instructions,
316
+ tools: effectiveTools,
317
+ mode: "subagent",
318
+ outcomeKind: outcome.kind,
319
+ outcomeSchema: outcome.schema,
320
+ outcomeProse: outcome.prose
321
+ });
322
+ return {
323
+ entry,
324
+ outcomeSchema: outcome.schema,
325
+ resultKind: outcome.kind,
326
+ openCodeAgentFile,
327
+ openCodeAgentName,
328
+ skillsContent,
329
+ subAgents: []
330
+ };
331
+ }
332
+ function loadSubAgents(agentDir) {
333
+ const base = path.join(agentDir, "sub-agents");
334
+ if (!fs.existsSync(base) || !fs.statSync(base).isDirectory()) return [];
335
+ const loaded = [];
336
+ for (const entry of fs.readdirSync(base, { withFileTypes: true })) {
337
+ if (!entry.isDirectory() || entry.name === "__tests__") continue;
338
+ loaded.push(loadSubAgentDir(path.join(base, entry.name)));
339
+ }
340
+ return loaded;
341
+ }
342
+ function loadFileAgentDir(dir) {
343
+ const agentMdPath = path.join(dir, "AGENT.md");
344
+ const outcomePath = path.join(dir, "OUTCOME.md");
345
+ if (!fs.existsSync(agentMdPath) || !fs.existsSync(outcomePath)) return null;
346
+ const agentMdRaw = fs.readFileSync(agentMdPath, "utf8");
347
+ const outcomeRaw = fs.readFileSync(outcomePath, "utf8");
348
+ const agent = parseAgentMarkdown(agentMdRaw);
349
+ if (!agent) return null;
350
+ const outcome = parseOutcomeMarkdown(outcomeRaw);
351
+ if (!outcome) return null;
352
+ let resultSchema;
353
+ try {
354
+ resultSchema = compileOutcome({ kind: outcome.kind, schema: outcome.schema }).resultSchema;
355
+ } catch {
356
+ return null;
357
+ }
358
+ const skillsContent = loadAgentSkills(dir, agent.skills);
359
+ const skillTools = skillsContent.flatMap((skill) => skill.tools);
360
+ const toolFiles = loadToolFiles(dir);
361
+ const effectiveSkillsContent = toolFiles.scripts.length > 0 ? [
362
+ ...skillsContent,
363
+ { id: AGENT_TOOLS_SKILL_ID, instructions: "", examples: [], tools: [], scripts: toolFiles.scripts }
364
+ ] : skillsContent;
365
+ const effectiveTools = Array.from(/* @__PURE__ */ new Set([...agent.tools, ...skillTools, ...toolFiles.refs]));
366
+ const subAgents = loadSubAgents(dir);
367
+ const subAgentNames = subAgents.map((sub) => sub.openCodeAgentName);
368
+ const openCodeAgentName = sanitizeAgentName(agent.id);
369
+ const entry = {
370
+ id: agent.id,
371
+ moduleId: "",
372
+ resultKind: outcome.kind,
373
+ schema: resultSchema,
374
+ tools: effectiveTools,
375
+ skills: agent.skills,
376
+ subAgents: agent.subAgents,
377
+ label: agent.label,
378
+ description: agent.description,
379
+ instructions: agent.instructions,
380
+ defaultProvider: agent.provider,
381
+ defaultModel: agent.model,
382
+ loop: agent.maxSteps != null ? { maxSteps: agent.maxSteps } : void 0,
383
+ runtime: "opencode",
384
+ sampleInput: loadSampleInput(dir),
385
+ facts: loadFacts(dir),
386
+ files: agent.files
387
+ };
388
+ const openCodeAgentFile = renderOpenCodeAgentFile({
389
+ description: agent.description,
390
+ provider: agent.provider,
391
+ model: agent.model,
392
+ instructions: agent.instructions,
393
+ tools: effectiveTools,
394
+ mode: "primary",
395
+ subAgentNames,
396
+ subAgentIds: subAgents.map((sub) => sub.entry.id),
397
+ outcomeKind: outcome.kind,
398
+ outcomeSchema: outcome.schema,
399
+ outcomeProse: outcome.prose,
400
+ files: agent.files
401
+ });
402
+ return {
403
+ entry,
404
+ outcomeSchema: outcome.schema,
405
+ resultKind: outcome.kind,
406
+ openCodeAgentFile,
407
+ openCodeAgentName,
408
+ skillsContent: effectiveSkillsContent,
409
+ subAgents
410
+ };
411
+ }
412
+ export {
413
+ AGENT_TOOLS_SKILL_ID,
414
+ loadFileAgentDir,
415
+ registerFileAgent
416
+ };
417
+ //# sourceMappingURL=defineFileAgent.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/modules/agent_orchestrator/lib/sdk/defineFileAgent.ts"],
4
+ "sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport type { AgentFact, AgentRegistryEntry, FileAgentFilesConfig } from './defineAgent'\nimport { parseBooleanWithDefault } from '@open-mercato/shared/lib/boolean'\nimport { parseAgentMarkdown } from './agentMarkdown'\nimport { parseAgentLocalSkillMarkdown } from './skillMarkdown'\nimport { compileOutcome, type JsonSchemaNode, type OutcomeKind } from './outcomeSchema'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('agent_orchestrator').child({ component: 'define-file-agent' })\n\n/**\n * Re-export so callers that have a loaded entry can register it. File agents\n * register into the same in-memory registry as `defineAgent` agents.\n */\nexport { registerFileAgent } from './defineAgent'\n\n/**\n * Resolved content of one agent-local skill (Phase 3). Plain data so it can be\n * persisted to the committed manifest and returned by the `load_skill` MCP tool\n * at runtime without fs access.\n */\n/** One sandboxed skill/tool script carried as plain data (Phase 5). */\nexport type LoadedScript = {\n /** Script basename without extension (`scripts/score.ts` \u2192 `score`). */\n name: string\n /** Raw TS/JS source, run server-side in the Code Mode sandbox. */\n source: string\n}\n\nexport type LoadedSkillContent = {\n /** Skill id (frontmatter `id` or, when absent, the skill dir name). */\n id: string\n /** SKILL.md body \u2192 progressive-disclosure instructions. */\n instructions: string\n /** Optional TEMPLATE.md body (output template). */\n template?: string\n /** Optional examples/*.md bodies (few-shot blocks), ordered by filename. */\n examples: string[]\n /** Read-only tool ids the skill contributes to the agent allowlist. */\n tools: string[]\n /**\n * Optional sandboxed helper scripts (`scripts/*.ts`), Phase 5. Carried as\n * plain `{ name, source }` data (NOT copied to the OpenCode container); the\n * agent runs them via the `run_skill_script` MCP tool, server-side in the\n * Code Mode `isolated-vm` sandbox (no fs/net, 30s cap, per-call ACL).\n */\n scripts: LoadedScript[]\n}\n\nexport type LoadedFileAgent = {\n /** runtime: 'opencode'; schema = compiled OUTCOME resultSchema. */\n entry: AgentRegistryEntry\n /**\n * Raw JSON-Schema subset from OUTCOME.md (plain data for the committed\n * manifest). Absent for `kind: artifact`, whose envelope is fixed.\n */\n outcomeSchema?: JsonSchemaNode\n /** OUTCOME.md kind. */\n resultKind: OutcomeKind\n /** Rendered OpenCode agent .md (frontmatter + body). */\n openCodeAgentFile: string\n /** Sanitized filename-id passed in the message `agent` field. */\n openCodeAgentName: string\n /**\n * Resolved agent-local skill content (Phase 3). One entry per skill referenced\n * by AGENT.md `skills:` that resolved to an `agents/<id>/skills/<skill_id>/`\n * dir. Each skill's read-only tools are also unioned into `entry.tools`.\n */\n skillsContent: LoadedSkillContent[]\n /** Phase 4 sub-agent file loading; [] in Phase 1-3 (ids still carried on entry). */\n subAgents: LoadedFileAgent[]\n}\n\n/**\n * OUTCOME.md authoring format (Phase 1):\n *\n * ---\n * kind: proposal # research | proposal | artifact\n * ---\n * ```json\n * { \"type\": \"object\", \"required\": [...], \"properties\": { ... } }\n * ```\n *\n * Optional prose guidance after the JSON block \u2026\n *\n * The frontmatter carries ONLY `kind`. The result JSON-Schema is authored as the\n * FIRST fenced ```json code block in the body (robust for a line-based parser \u2014\n * no YAML dependency). Any text after the JSON block is human guidance.\n */\nconst OUTCOME_FRONTMATTER_RE = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n?([\\s\\S]*)$/\nconst JSON_FENCE_RE = /```json\\s*\\n([\\s\\S]*?)\\n```/\n\ntype OutcomeDescriptor = {\n kind: OutcomeKind\n /**\n * Absent for `kind: artifact`, which has a FIXED envelope: what came back is\n * the file list the run's own artifact plane captured, and it is the same shape\n * for a drafted email and a risk report. Declaring a schema that nothing reads\n * would be worse than declaring none.\n */\n schema?: JsonSchemaNode\n /** Human guidance after the JSON-Schema fence \u2014 injected into the agent prompt. */\n prose: string\n}\n\nfunction parseOutcomeKind(frontmatterBlock: string): OutcomeKind | null {\n for (const line of frontmatterBlock.split('\\n')) {\n const match = /^kind:\\s*(.*)$/.exec(line.trim())\n if (!match) continue\n const value = match[1].trim().replace(/^['\"]/, '').replace(/['\"]$/, '').trim()\n if (value === 'research' || value === 'proposal' || value === 'artifact') return value\n return null\n }\n return null\n}\n\n/** Parse OUTCOME.md into a `{ kind, schema }` descriptor. Returns null when malformed. */\nfunction parseOutcomeMarkdown(raw: string): OutcomeDescriptor | null {\n const frontmatterMatch = OUTCOME_FRONTMATTER_RE.exec(raw)\n if (!frontmatterMatch) return null\n const [, frontmatterBlock, body] = frontmatterMatch\n const kind = parseOutcomeKind(frontmatterBlock)\n if (!kind) return null\n const fenceMatch = JSON_FENCE_RE.exec(body)\n // An artifact agent declares no schema, so its whole OUTCOME.md is guidance.\n if (!fenceMatch) {\n return kind === 'artifact' ? { kind, prose: body.trim() } : null\n }\n let parsed: unknown\n try {\n parsed = JSON.parse(fenceMatch[1])\n } catch {\n return null\n }\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null\n const prose = body.slice(fenceMatch.index + fenceMatch[0].length).trim()\n return { kind, schema: parsed as JsonSchemaNode, prose }\n}\n\n/**\n * Render the \"## Outcome contract\" prompt section so the agent SEES the exact\n * shape it must submit (otherwise it guesses and only learns the shape from\n * submit_outcome's validation errors). Shows the JSON-Schema + the OUTCOME.md prose.\n */\nfunction renderOutcomeSection(kind: OutcomeKind, schema: JsonSchemaNode | undefined, prose: string): string {\n if (kind === 'artifact') {\n return [\n '## Outcome contract',\n 'Write the files you produce into the run\\'s `out/` directory, then pass this shape as the `outcome` argument of the submit_outcome tool:',\n '',\n '```json',\n JSON.stringify(\n {\n artifacts: [{ fileName: 'report.pdf', mimeType: 'application/pdf', caption: 'What this file is' }],\n summary: 'One sentence about what you produced.',\n },\n null,\n 2,\n ),\n '```',\n ...(prose ? ['', prose] : []),\n ].join('\\n')\n }\n const target = kind === 'proposal' ? 'the `proposal` object' : 'the `data` object'\n const schemaJson = JSON.stringify(schema, null, 2)\n return [\n '## Outcome contract',\n `Your result MUST match this JSON Schema (${target}). Pass it as the \\`outcome\\` argument of the submit_outcome tool, as a JSON object (not a string):`,\n '',\n '```json',\n schemaJson,\n '```',\n ...(prose ? ['', prose] : []),\n ].join('\\n')\n}\n\nfunction sanitizeAgentName(id: string): string {\n return id.replace(/[^a-z0-9_-]/gi, '_')\n}\n\n/**\n * Read the optional `agents/<id>/SAMPLE.json` example input, surfaced by the\n * Playground's \"Insert sample\" button. Pure JSON (no markdown/frontmatter) so it\n * needs no custom parser. Returns undefined when the file is absent or invalid\n * (a malformed sample must never block agent loading \u2014 the button just hides).\n * Must stay in sync with the generator's `discoverSampleInput`.\n */\nfunction loadSampleInput(dir: string): unknown {\n const samplePath = path.join(dir, 'SAMPLE.json')\n if (!fs.existsSync(samplePath)) return undefined\n try {\n return JSON.parse(fs.readFileSync(samplePath, 'utf8'))\n } catch {\n logger.warn('malformed SAMPLE.json; ignoring', { dir })\n return undefined\n }\n}\n\nconst FACT_SOURCES = ['input', 'payload', 'output'] as const\nconst FACT_FORMATS = ['text', 'number', 'boolean', 'percent'] as const\n\n/**\n * Read the optional `agents/<id>/FACTS.json` Caseload fact declarations\n * (`{ \"facts\": [...] }` or a bare array of `{ label, source, path, format? }`).\n * Returns undefined when the file is absent or invalid \u2014 a malformed file must\n * never block agent loading; the Caseload panel just falls back to its generic\n * derivation. Must stay in sync with the generator's `discoverFacts`.\n */\nfunction loadFacts(dir: string): AgentFact[] | undefined {\n const factsPath = path.join(dir, 'FACTS.json')\n if (!fs.existsSync(factsPath)) return undefined\n try {\n const parsed = JSON.parse(fs.readFileSync(factsPath, 'utf8')) as unknown\n const entries = Array.isArray(parsed)\n ? parsed\n : parsed && typeof parsed === 'object' && Array.isArray((parsed as { facts?: unknown }).facts)\n ? ((parsed as { facts: unknown[] }).facts)\n : null\n if (!entries) throw new Error('expected an array or { \"facts\": [...] }')\n const facts = entries.filter((entry): entry is AgentFact => {\n const fact = entry as Partial<AgentFact> | null\n return Boolean(\n fact &&\n typeof fact.label === 'string' &&\n fact.label.trim() &&\n typeof fact.path === 'string' &&\n fact.path.trim() &&\n FACT_SOURCES.includes(fact.source as (typeof FACT_SOURCES)[number]) &&\n (fact.format === undefined ||\n FACT_FORMATS.includes(fact.format as (typeof FACT_FORMATS)[number])),\n )\n })\n return facts.length > 0 ? facts : undefined\n } catch (err) {\n logger.warn('malformed FACTS.json; ignoring', {\n dir,\n error: err instanceof Error ? err.message : String(err),\n })\n return undefined\n }\n}\n\nfunction renderToolPermissionLine(toolName: string): string {\n return ` ${JSON.stringify(toolName)}: true`\n}\n\n/**\n * File-agent delegation goes through the server-side `agent_orchestrator.delegate_agent`\n * MCP tool (runs each sub-agent as its own authenticated run), NOT OpenCode's built-in\n * `task` tool \u2014 a `task` sub-session runs in a fresh session that never inherits the\n * run's session token, so its MCP calls fail with no_active_run. Kept in sync with the\n * CLI generator (`packages/cli/src/lib/generators/extensions/agent-files.ts`).\n */\nconst DELEGATE_AGENT_TOOL_ID = 'agent_orchestrator.delegate_agent'\n\n/**\n * The MCP server key OpenCode connects under (the `mcp.<key>` in opencode.jsonc;\n * `open-mercato` in OM's container). OpenCode exposes each MCP tool as\n * `<serverKey>_<toolName with dots\u2192underscores>`, so a file-agent's `tools`\n * allowlist + prompt MUST reference that id \u2014 verified against the running image.\n */\nconst OPENCODE_MCP_SERVER_KEY = 'open-mercato'\n\n/** Core MCP tools every file agent may call (terminal outcome + progressive disclosure + sandboxed scripts). */\nconst CORE_FILE_AGENT_TOOL_IDS = [\n 'agent_orchestrator.submit_outcome',\n 'agent_orchestrator.load_skill',\n 'agent_orchestrator.run_skill_script',\n]\n\n/** Map an OM tool id (`module.tool`) to OpenCode's MCP tool id (`<serverKey>_module_tool`). */\nfunction toOpenCodeMcpToolId(omToolId: string): string {\n return `${OPENCODE_MCP_SERVER_KEY}_${omToolId.replace(/\\./g, '_')}`\n}\n\n/**\n * Render the OpenCode agent .md file: YAML-ish frontmatter (description,\n * optional model/provider, mode, a read-only tools/permission block) plus the\n * body = instructions + the terminal `submit_outcome` instruction.\n *\n * The `tools` block denies everything by default and allows ONLY the agent's\n * declared read-only MCP tool ids plus `submit_outcome` (propose-only gate; see\n * findings \u00A7C8). Writes (`write`/`edit`/`bash`) are denied via `permission`.\n *\n * Sub-agent files (`mode: subagent`, Phase 4) are rendered with NO `task`\n * allowance and `permission.task: deny`, so they cannot delegate further (depth\n * cap = 1). The PRIMARY, when it declares sub-agents, additionally allows the\n * built-in `task` tool, whitelists ONLY its sub-agents' sanitized names under\n * `permission.task`, and gets a \"Sub-agents\" prompt section nudging parallel\n * fan-out (mirrors `defineAgent`'s `subAgentSection`).\n */\nfunction renderOpenCodeAgentFile(args: {\n description: string\n provider?: string\n model?: string\n instructions: string\n tools: string[]\n /** `'primary'` (default) or `'subagent'` for a generated sub-agent file. */\n mode?: 'primary' | 'subagent'\n /** Sanitized OpenCode names of this primary's reachable sub-agents (empty otherwise). */\n subAgentNames?: string[]\n /** Full registry ids of this primary's reachable sub-agents \u2014 the `agentId` values passed to delegate_agent. */\n subAgentIds?: string[]\n /** The OUTCOME contract \u2014 injected into the prompt so the agent sees its exact shape. */\n outcomeKind: OutcomeKind\n outcomeSchema?: JsonSchemaNode\n outcomeProse: string\n /** File-plane opt-in (#12). When set + `OM_OPENCODE_FILES_ENABLED`, grants sandbox-scoped write/edit/read. */\n files?: FileAgentFilesConfig\n}): string {\n const mode = args.mode ?? 'primary'\n const subAgentIds = mode === 'primary' ? (args.subAgentIds ?? []) : []\n const hasSubAgents = subAgentIds.length > 0\n // The agent's MCP tools = its declared read tools + the core file-agent tools\n // (submit_outcome / load_skill / run_skill_script). OpenCode names every MCP\n // tool `<serverKey>_<toolName with dots\u2192underscores>`, so the allowlist key and\n // the prompt MUST use that form \u2014 a dotted OM id never matches and `\"*\": false`\n // would silently drop it. `task` is an OpenCode built-in (not prefixed).\n const omMcpToolIds = Array.from(\n new Set([...args.tools, ...CORE_FILE_AGENT_TOOL_IDS, ...(hasSubAgents ? [DELEGATE_AGENT_TOOL_ID] : [])]),\n )\n const allowedTools = omMcpToolIds.map(toOpenCodeMcpToolId)\n const modelLine =\n args.provider && args.model\n ? `model: ${args.provider}/${args.model}`\n : args.model\n ? `model: ${args.model}`\n : null\n // OpenCode's built-in `task` tool is NEVER granted \u2014 delegation goes through the\n // server-side `agent_orchestrator.delegate_agent` tool instead (see DELEGATE_AGENT_TOOL_ID),\n // so no agent (primary or sub-agent) can spawn a `task` sub-session.\n const taskPermissionLines = [' task: deny']\n\n // File plane (#12): a primary that opted in gets sandbox-scoped write/edit/read\n // ONLY when the global kill-switch `OM_OPENCODE_FILES_ENABLED` is on \u2014 otherwise\n // it renders the historical deny frontmatter (BC: default off = unchanged). Sub-\n // agents never get file tools (read-only, researcher). Isolation is by per-run\n // sandbox subdir + container lease (Phase 0); this static glob only confines the\n // agent to the shared workspace root, away from OpenCode internals.\n const filesActive =\n mode === 'primary' &&\n !!args.files?.enabled &&\n parseBooleanWithDefault(process.env.OM_OPENCODE_FILES_ENABLED, false)\n // The frontmatter runs INSIDE the OpenCode container, so the permission glob\n // uses the CONTAINER-side workspace root (OM_OPENCODE_WORKSPACE_ROOT_CONTAINER,\n // defaulting to OM_OPENCODE_WORKSPACE_ROOT \u2014 equal in the full-docker case).\n const containerWorkspaceRoot = (\n process.env.OM_OPENCODE_WORKSPACE_ROOT_CONTAINER ||\n process.env.OM_OPENCODE_WORKSPACE_ROOT ||\n '/home/opencode/work'\n ).trim()\n const workspaceGlob = `${containerWorkspaceRoot}/**`\n const fileToolLines: string[] = []\n const filePermissionLines: string[] = [' write: deny', ' edit: deny', ' bash: deny']\n if (filesActive) {\n fileToolLines.push(' read: true', ' write: true', ' edit: true')\n if (args.files?.bash) fileToolLines.push(' bash: true')\n filePermissionLines.length = 0\n for (const tool of ['write', 'edit', 'read']) {\n filePermissionLines.push(` ${tool}:`, ` ${JSON.stringify(workspaceGlob)}: allow`, ' \"*\": deny')\n }\n filePermissionLines.push(args.files?.bash ? ' bash: allow' : ' bash: deny')\n }\n\n const frontmatterLines = [\n '---',\n `description: ${JSON.stringify(args.description)}`,\n ...(modelLine ? [modelLine] : []),\n `mode: ${mode}`,\n 'tools:',\n ' \"*\": false',\n ...allowedTools.map(renderToolPermissionLine),\n ...fileToolLines,\n 'permission:',\n ...filePermissionLines,\n ...taskPermissionLines,\n '---',\n ]\n const submitToolId = toOpenCodeMcpToolId('agent_orchestrator.submit_outcome')\n const terminalInstruction =\n `Finish by calling the \\`${submitToolId}\\` tool with a value matching the outcome contract (pass it as the \\`outcome\\` argument). You MUST call the tool \u2014 do not answer in prose or emit the result as a code block.`\n const delegateToolName = toOpenCodeMcpToolId(DELEGATE_AGENT_TOOL_ID)\n const subAgentSection = hasSubAgents\n ? `## Sub-agents\\nDelegate a sub-task by calling the \\`${delegateToolName}\\` tool with \\`{ agentId: \"<sub-agent id>\", input: <sub-task input object> }\\`. Issue multiple \\`${delegateToolName}\\` calls in the SAME step to fan out in parallel, then combine their results before submitting your outcome. Available sub-agents: ${subAgentIds.join(', ')}.`\n : null\n const outcomeSection = renderOutcomeSection(args.outcomeKind, args.outcomeSchema, args.outcomeProse)\n const body = [\n args.instructions.trim(),\n ...(subAgentSection ? [subAgentSection] : []),\n outcomeSection,\n terminalInstruction,\n ]\n .filter(Boolean)\n .join('\\n\\n')\n return `${frontmatterLines.join('\\n')}\\n${body}\\n`\n}\n\n/**\n * Read sandboxed scripts from a `scripts/` dir (`scripts/*.ts` / `*.js`), Phase 5.\n * Each file's basename (without extension) becomes the script `name`; the raw\n * source is carried as plain data (run server-side in the sandbox, never copied\n * to the container). Ordered by filename for determinism. Returns [] when the\n * dir is absent.\n */\nfunction loadScriptsDir(scriptsDir: string): LoadedScript[] {\n if (!fs.existsSync(scriptsDir) || !fs.statSync(scriptsDir).isDirectory()) return []\n const scripts: LoadedScript[] = []\n const files = fs\n .readdirSync(scriptsDir)\n .filter((name) => name.endsWith('.ts') || name.endsWith('.js'))\n .sort((a, b) => a.localeCompare(b))\n for (const file of files) {\n const source = fs.readFileSync(path.join(scriptsDir, file), 'utf8')\n scripts.push({ name: file.replace(/\\.(ts|js)$/, ''), source })\n }\n return scripts\n}\n\n/**\n * Read one agent-local skill dir `agents/<id>/skills/<skill_id>/`:\n * - `SKILL.md` (required; parsed with `parseAgentLocalSkillMarkdown`, moduleId\n * tolerated/absent, id defaulting to the dir name),\n * - optional `TEMPLATE.md`,\n * - optional `examples/*.md` (ordered by filename),\n * - optional `scripts/*.ts` (Phase 5; carried as plain source for sandboxed\n * execution via `run_skill_script`).\n *\n * Returns null when SKILL.md is missing or has no parseable frontmatter.\n */\nfunction loadSkillDir(skillDir: string): LoadedSkillContent | null {\n const skillPath = path.join(skillDir, 'SKILL.md')\n if (!fs.existsSync(skillPath)) return null\n const dirName = path.basename(skillDir)\n const parsed = parseAgentLocalSkillMarkdown(fs.readFileSync(skillPath, 'utf8'), dirName)\n if (!parsed) return null\n\n const templatePath = path.join(skillDir, 'TEMPLATE.md')\n const template = fs.existsSync(templatePath)\n ? fs.readFileSync(templatePath, 'utf8').trim() || undefined\n : undefined\n\n const examplesDir = path.join(skillDir, 'examples')\n const examples: string[] = []\n if (fs.existsSync(examplesDir) && fs.statSync(examplesDir).isDirectory()) {\n const files = fs\n .readdirSync(examplesDir)\n .filter((name) => name.endsWith('.md'))\n .sort((a, b) => a.localeCompare(b))\n for (const file of files) {\n const body = fs.readFileSync(path.join(examplesDir, file), 'utf8').trim()\n if (body) examples.push(body)\n }\n }\n\n return {\n id: parsed.id,\n instructions: parsed.instructions,\n template,\n examples,\n tools: parsed.tools,\n scripts: loadScriptsDir(path.join(skillDir, 'scripts')),\n }\n}\n\n/**\n * Load `agents/<id>/tools/*.ts` local tool files (Phase 5). Honors \u00A77.4's v1\n * guidance with TWO clearly-separated forms, both propose-only-safe:\n *\n * 1. REFERENCE form (preferred): a file whose first line is a directive\n * `// @ref <defineAiTool id>` (or `// @ref: <id>`). The id is unioned into\n * the agent's `tools` allowlist exactly like a AGENT.md `tools:` entry, so\n * it flows through the SAME central ACL + propose-only mutation gate (a\n * referenced `isMutation:true` tool is rejected at load by `defineAgent`'s\n * gate). Recommended \u2014 no new execution surface.\n * 2. LOCAL SANDBOXED form: any other `tools/*.ts` file is carried as a script\n * (`{ name, source }`) registered under the synthetic skill id\n * `__agent_tools__` and executed through the SAME `isolated-vm` sandbox as\n * skill scripts via `run_skill_script` (skillId `__agent_tools__`). It can\n * never touch fs/net/mutation or escape the sandbox, and is `isMutation:false`\n * at the MCP boundary \u2014 so propose-only holds without generating an\n * unsandboxed native `.opencode/tool/` file that would bypass the MCP ACL gate.\n *\n * Returns `{ refs, scripts }`: `refs` union into the allowlist; `scripts` carry\n * local sandboxed tool sources.\n */\nconst TOOL_REF_RE = /^\\s*\\/\\/\\s*@ref:?\\s+(\\S+)/\n\nfunction loadToolFiles(agentDir: string): { refs: string[]; scripts: LoadedScript[] } {\n const toolsBase = path.join(agentDir, 'tools')\n if (!fs.existsSync(toolsBase) || !fs.statSync(toolsBase).isDirectory()) {\n return { refs: [], scripts: [] }\n }\n const refs: string[] = []\n const scripts: LoadedScript[] = []\n const files = fs\n .readdirSync(toolsBase)\n .filter((name) => name.endsWith('.ts') || name.endsWith('.js'))\n .sort((a, b) => a.localeCompare(b))\n for (const file of files) {\n const source = fs.readFileSync(path.join(toolsBase, file), 'utf8')\n const firstLine = source.split('\\n', 1)[0] ?? ''\n const refMatch = TOOL_REF_RE.exec(firstLine)\n if (refMatch) {\n refs.push(refMatch[1])\n continue\n }\n scripts.push({ name: file.replace(/\\.(ts|js)$/, ''), source })\n }\n return { refs, scripts }\n}\n\n/** Synthetic skill id under which an agent's LOCAL sandboxed tool files register. */\nexport const AGENT_TOOLS_SKILL_ID = '__agent_tools__'\n\n/**\n * Resolve the agent-local skills referenced by AGENT.md `skills:`. For each id\n * we look for an `agents/<id>/skills/<skill_id>/` dir whose resolved skill id\n * (frontmatter id or dir name) matches. Unknown ids are skipped (warned) so a\n * stale reference never blocks the agent.\n */\nfunction loadAgentSkills(agentDir: string, skillIds: string[]): LoadedSkillContent[] {\n if (skillIds.length === 0) return []\n const skillsBase = path.join(agentDir, 'skills')\n const hasSkillsDir = fs.existsSync(skillsBase) && fs.statSync(skillsBase).isDirectory()\n\n const bySkillId = new Map<string, LoadedSkillContent>()\n if (hasSkillsDir) {\n for (const entry of fs.readdirSync(skillsBase, { withFileTypes: true })) {\n if (!entry.isDirectory()) continue\n const loaded = loadSkillDir(path.join(skillsBase, entry.name))\n if (loaded) bySkillId.set(loaded.id, loaded)\n }\n }\n\n const resolved: LoadedSkillContent[] = []\n for (const skillId of skillIds) {\n const skill = bySkillId.get(skillId)\n if (!skill) {\n logger.warn('file agent skill not found; skipping', { skillId, skillsBase })\n continue\n }\n resolved.push(skill)\n }\n return resolved\n}\n\n/**\n * Load one sub-agent dir `agents/<id>/sub-agents/<subid>/` (Phase 4). Sub-agents\n * are full file agents (AGENT.md + OUTCOME.md) but constrained: each is rendered\n * `mode: subagent`, read-only, and MUST satisfy two hard rules (matching the\n * in-process `delegate_agent` contract):\n *\n * 1. OUTCOME `kind` MUST be `research` (sub-agents inform; only the primary\n * proposes);\n * 2. it MUST NOT itself declare `subAgents` (depth cap = 1).\n *\n * A malformed sub-agent dir or a constraint violation THROWS with a clear\n * `[internal]` reason naming the dir (so the generator fails loudly), rather than\n * returning null \u2014 a present-but-invalid sub-agent must never be silently dropped.\n */\nfunction loadSubAgentDir(dir: string): LoadedFileAgent {\n const agentMdPath = path.join(dir, 'AGENT.md')\n const outcomePath = path.join(dir, 'OUTCOME.md')\n if (!fs.existsSync(agentMdPath) || !fs.existsSync(outcomePath)) {\n throw new Error(`[internal] malformed sub-agent at ${dir}: both AGENT.md and OUTCOME.md are required`)\n }\n\n const agent = parseAgentMarkdown(fs.readFileSync(agentMdPath, 'utf8'))\n if (!agent) {\n throw new Error(`[internal] malformed AGENT.md at ${dir}: missing id/label/description`)\n }\n const outcome = parseOutcomeMarkdown(fs.readFileSync(outcomePath, 'utf8'))\n if (!outcome) {\n throw new Error(`[internal] malformed OUTCOME.md at ${dir}: missing kind or JSON-Schema block`)\n }\n if (outcome.kind !== 'research') {\n throw new Error(\n `[internal] sub-agent at ${dir} must be research (kind: research); sub-agents inform, only the primary proposes`,\n )\n }\n if (agent.subAgents.length > 0) {\n throw new Error(\n `[internal] sub-agent at ${dir} may not declare subAgents (depth cap = 1); sub-agents may not delegate further`,\n )\n }\n\n let resultSchema\n try {\n resultSchema = compileOutcome({ kind: outcome.kind, schema: outcome.schema }).resultSchema\n } catch (err) {\n const detail = err instanceof Error ? err.message : String(err)\n throw new Error(`[internal] malformed OUTCOME.md at ${dir}: ${detail}`)\n }\n\n const skillsContent = loadAgentSkills(dir, agent.skills)\n const skillTools = skillsContent.flatMap((skill) => skill.tools)\n const effectiveTools = Array.from(new Set([...agent.tools, ...skillTools]))\n\n const openCodeAgentName = sanitizeAgentName(agent.id)\n const entry: AgentRegistryEntry = {\n id: agent.id,\n moduleId: '',\n resultKind: outcome.kind,\n schema: resultSchema,\n tools: effectiveTools,\n skills: agent.skills,\n subAgents: [],\n label: agent.label,\n description: agent.description,\n instructions: agent.instructions,\n defaultProvider: agent.provider,\n defaultModel: agent.model,\n loop: agent.maxSteps != null ? { maxSteps: agent.maxSteps } : undefined,\n runtime: 'opencode',\n sampleInput: loadSampleInput(dir),\n facts: loadFacts(dir),\n }\n\n const openCodeAgentFile = renderOpenCodeAgentFile({\n description: agent.description,\n provider: agent.provider,\n model: agent.model,\n instructions: agent.instructions,\n tools: effectiveTools,\n mode: 'subagent',\n outcomeKind: outcome.kind,\n outcomeSchema: outcome.schema,\n outcomeProse: outcome.prose,\n })\n\n return {\n entry,\n outcomeSchema: outcome.schema,\n resultKind: outcome.kind,\n openCodeAgentFile,\n openCodeAgentName,\n skillsContent,\n subAgents: [],\n }\n}\n\n/**\n * Load every sub-agent under `agents/<id>/sub-agents/<subid>/` (Phase 4). Each\n * resolved child carries its own loaded `LoadedFileAgent` (full file agent,\n * constrained to research + non-delegating). Returns [] when the agent has no\n * `sub-agents/` dir.\n */\nfunction loadSubAgents(agentDir: string): LoadedFileAgent[] {\n const base = path.join(agentDir, 'sub-agents')\n if (!fs.existsSync(base) || !fs.statSync(base).isDirectory()) return []\n const loaded: LoadedFileAgent[] = []\n for (const entry of fs.readdirSync(base, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === '__tests__') continue\n loaded.push(loadSubAgentDir(path.join(base, entry.name)))\n }\n return loaded\n}\n\n/**\n * Read `agents/<id>/{AGENT.md,OUTCOME.md}` (+ skills + sub-agents), validate,\n * compile the OUTCOME schema, and build an `AgentRegistryEntry` with\n * `runtime:'opencode'`. Pure and fs-based (unit-testable against fixtures).\n * Returns null when the dir is not a valid agent (missing/malformed AGENT.md or\n * OUTCOME.md); the generator turns a null into a hard generation error naming the\n * dir. A present-but-invalid SUB-agent throws (so a constraint violation fails\n * loudly rather than being silently dropped).\n *\n * `subAgents` (loaded children) is populated from `agents/<id>/sub-agents/`; the\n * declared sub-agent ids are still carried on `entry.subAgents`. When sub-agents\n * are present, the rendered primary agent file additionally allows the `task`\n * tool, whitelists ONLY its sub-agents' sanitized names under `permission.task`,\n * and gains a \"Sub-agents\" prompt section.\n */\nexport function loadFileAgentDir(dir: string): LoadedFileAgent | null {\n const agentMdPath = path.join(dir, 'AGENT.md')\n const outcomePath = path.join(dir, 'OUTCOME.md')\n if (!fs.existsSync(agentMdPath) || !fs.existsSync(outcomePath)) return null\n\n const agentMdRaw = fs.readFileSync(agentMdPath, 'utf8')\n const outcomeRaw = fs.readFileSync(outcomePath, 'utf8')\n\n const agent = parseAgentMarkdown(agentMdRaw)\n if (!agent) return null\n\n const outcome = parseOutcomeMarkdown(outcomeRaw)\n if (!outcome) return null\n\n let resultSchema\n try {\n resultSchema = compileOutcome({ kind: outcome.kind, schema: outcome.schema }).resultSchema\n } catch {\n return null\n }\n\n // Phase 3: resolve agent-local skills referenced by AGENT.md `skills:` and\n // UNION each resolved skill's read-only tools into the agent allowlist (deduped),\n // mirroring how the in-process `defineAgent` unions skill tools.\n const skillsContent = loadAgentSkills(dir, agent.skills)\n const skillTools = skillsContent.flatMap((skill) => skill.tools)\n\n // Phase 5: load `tools/*.ts` local tool files. Reference-form ids union into the\n // allowlist (flow through the central ACL + propose-only gate); local sandboxed\n // tool sources are carried under the synthetic `__agent_tools__` skill, run via\n // `run_skill_script` in the same sandbox as skill scripts.\n const toolFiles = loadToolFiles(dir)\n const effectiveSkillsContent =\n toolFiles.scripts.length > 0\n ? [\n ...skillsContent,\n { id: AGENT_TOOLS_SKILL_ID, instructions: '', examples: [], tools: [], scripts: toolFiles.scripts },\n ]\n : skillsContent\n const effectiveTools = Array.from(new Set([...agent.tools, ...skillTools, ...toolFiles.refs]))\n\n // Phase 4: load sub-agent dirs (constraints enforced \u2014 throws on violation).\n const subAgents = loadSubAgents(dir)\n const subAgentNames = subAgents.map((sub) => sub.openCodeAgentName)\n\n const openCodeAgentName = sanitizeAgentName(agent.id)\n const entry: AgentRegistryEntry = {\n id: agent.id,\n moduleId: '',\n resultKind: outcome.kind,\n schema: resultSchema,\n tools: effectiveTools,\n skills: agent.skills,\n subAgents: agent.subAgents,\n label: agent.label,\n description: agent.description,\n instructions: agent.instructions,\n defaultProvider: agent.provider,\n defaultModel: agent.model,\n loop: agent.maxSteps != null ? { maxSteps: agent.maxSteps } : undefined,\n runtime: 'opencode',\n sampleInput: loadSampleInput(dir),\n facts: loadFacts(dir),\n files: agent.files,\n }\n\n const openCodeAgentFile = renderOpenCodeAgentFile({\n description: agent.description,\n provider: agent.provider,\n model: agent.model,\n instructions: agent.instructions,\n tools: effectiveTools,\n mode: 'primary',\n subAgentNames,\n subAgentIds: subAgents.map((sub) => sub.entry.id),\n outcomeKind: outcome.kind,\n outcomeSchema: outcome.schema,\n outcomeProse: outcome.prose,\n files: agent.files,\n })\n\n return {\n entry,\n outcomeSchema: outcome.schema,\n resultKind: outcome.kind,\n openCodeAgentFile,\n openCodeAgentName,\n skillsContent: effectiveSkillsContent,\n subAgents,\n }\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAS,+BAA+B;AACxC,SAAS,0BAA0B;AACnC,SAAS,oCAAoC;AAC7C,SAAS,sBAA6D;AACtE,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,oBAAoB,EAAE,MAAM,EAAE,WAAW,oBAAoB,CAAC;AAM1F,SAAS,yBAAyB;AA2ElC,MAAM,yBAAyB;AAC/B,MAAM,gBAAgB;AAetB,SAAS,iBAAiB,kBAA8C;AACtE,aAAW,QAAQ,iBAAiB,MAAM,IAAI,GAAG;AAC/C,UAAM,QAAQ,iBAAiB,KAAK,KAAK,KAAK,CAAC;AAC/C,QAAI,CAAC,MAAO;AACZ,UAAM,QAAQ,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,SAAS,EA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AAAA,IACrB,eAAe,QAAQ;AAAA,IACvB,cAAc,QAAQ;AAAA,IACtB,OAAO,MAAM;AAAA,EACf,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,eAAe,QAAQ;AAAA,IACvB,YAAY,QAAQ;AAAA,IACpB;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,40 @@
1
+ const registry = /* @__PURE__ */ new Map();
2
+ function defineSkill(input) {
3
+ if (registry.has(input.id)) {
4
+ throw new Error(`[internal] duplicate skill id "${input.id}"`);
5
+ }
6
+ const entry = {
7
+ id: input.id,
8
+ moduleId: input.moduleId,
9
+ label: input.label,
10
+ description: input.description,
11
+ instructions: input.instructions,
12
+ tools: input.tools ?? []
13
+ };
14
+ registry.set(input.id, entry);
15
+ return entry;
16
+ }
17
+ function getSkillEntry(id) {
18
+ return registry.get(id);
19
+ }
20
+ function listSkillEntries() {
21
+ return [...registry.values()];
22
+ }
23
+ let skillsLoadPromise = null;
24
+ async function ensureSkillsLoaded() {
25
+ if (registry.size > 0) return;
26
+ if (!skillsLoadPromise) {
27
+ skillsLoadPromise = import("../../ai-skills.js").then(() => void 0).catch((err) => {
28
+ skillsLoadPromise = null;
29
+ throw err;
30
+ });
31
+ }
32
+ await skillsLoadPromise;
33
+ }
34
+ export {
35
+ defineSkill,
36
+ ensureSkillsLoaded,
37
+ getSkillEntry,
38
+ listSkillEntries
39
+ };
40
+ //# sourceMappingURL=defineSkill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/modules/agent_orchestrator/lib/sdk/defineSkill.ts"],
4
+ "sourcesContent": ["/**\n * Skill registry for propose-only agents. A skill is a reusable capability pack\n * (\u00E0 la Claude Agent SDK skills): a body of instructions injected into the\n * agent's system prompt plus an optional READ-ONLY tool allowlist the skill\n * contributes to the agent. Unlike the previous `[skill:<id>]` prompt-marker\n * stub, declaring a skill on an agent now actually changes what the agent knows\n * and can call (see `defineAgent` \u2192 skill resolution).\n *\n * Skills stay read-only by construction: agents are declared `readOnly`, so the\n * AI runtime strips any `isMutation: true` tool a skill contributes \u2014 a skill\n * can only ever add reads, never writes.\n */\nexport interface DefineSkillInput {\n /** 'module.skill' \u2014 STABLE contract id referenced by an agent's `skills`. */\n id: string\n moduleId: string\n label: string\n description: string\n /** SKILL.md-style body injected verbatim into the system prompt of any agent that declares it. */\n instructions: string\n /** defineAiTool ids the skill contributes to the agent's allowlist (read-only). */\n tools?: string[]\n}\n\nexport interface SkillRegistryEntry {\n id: string\n moduleId: string\n label: string\n description: string\n instructions: string\n tools: string[]\n}\n\nconst registry = new Map<string, SkillRegistryEntry>()\n\nexport function defineSkill(input: DefineSkillInput): SkillRegistryEntry {\n if (registry.has(input.id)) {\n throw new Error(`[internal] duplicate skill id \"${input.id}\"`)\n }\n const entry: SkillRegistryEntry = {\n id: input.id,\n moduleId: input.moduleId,\n label: input.label,\n description: input.description,\n instructions: input.instructions,\n tools: input.tools ?? [],\n }\n registry.set(input.id, entry)\n return entry\n}\n\nexport function getSkillEntry(id: string): SkillRegistryEntry | undefined {\n return registry.get(id)\n}\n\nexport function listSkillEntries(): SkillRegistryEntry[] {\n return [...registry.values()]\n}\n\nlet skillsLoadPromise: Promise<void> | null = null\n\n/**\n * Ensure the module's `ai-skills.ts` has executed so `defineSkill` has populated\n * the registry. Mirrors `ensureAgentsLoaded`: the registry is a module-level Map\n * filled by import side effect, so code paths that don't transitively import\n * `ai-skills.ts` (e.g. the agents detail API resolving skill metadata) would\n * otherwise read an empty registry. Idempotent.\n */\nexport async function ensureSkillsLoaded(): Promise<void> {\n if (registry.size > 0) return\n if (!skillsLoadPromise) {\n skillsLoadPromise = import('../../ai-skills')\n .then(() => undefined)\n .catch((err) => {\n skillsLoadPromise = null\n throw err\n })\n }\n await skillsLoadPromise\n}\n"],
5
+ "mappings": "AAiCA,MAAM,WAAW,oBAAI,IAAgC;AAE9C,SAAS,YAAY,OAA6C;AACvE,MAAI,SAAS,IAAI,MAAM,EAAE,GAAG;AAC1B,UAAM,IAAI,MAAM,kCAAkC,MAAM,EAAE,GAAG;AAAA,EAC/D;AACA,QAAM,QAA4B;AAAA,IAChC,IAAI,MAAM;AAAA,IACV,UAAU,MAAM;AAAA,IAChB,OAAO,MAAM;AAAA,IACb,aAAa,MAAM;AAAA,IACnB,cAAc,MAAM;AAAA,IACpB,OAAO,MAAM,SAAS,CAAC;AAAA,EACzB;AACA,WAAS,IAAI,MAAM,IAAI,KAAK;AAC5B,SAAO;AACT;AAEO,SAAS,cAAc,IAA4C;AACxE,SAAO,SAAS,IAAI,EAAE;AACxB;AAEO,SAAS,mBAAyC;AACvD,SAAO,CAAC,GAAG,SAAS,OAAO,CAAC;AAC9B;AAEA,IAAI,oBAA0C;AAS9C,eAAsB,qBAAoC;AACxD,MAAI,SAAS,OAAO,EAAG;AACvB,MAAI,CAAC,mBAAmB;AACtB,wBAAoB,OAAO,iBAAiB,EACzC,KAAK,MAAM,MAAS,EACpB,MAAM,CAAC,QAAQ;AACd,0BAAoB;AACpB,YAAM;AAAA,IACR,CAAC;AAAA,EACL;AACA,QAAM;AACR;",
6
+ "names": []
7
+ }