@llm-dev-ops/agentics-cli 1.4.53 → 1.4.54

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 (325) hide show
  1. package/dist/bundled-agents/connector-hub-agents/package-lock.json +11697 -0
  2. package/dist/bundled-agents/connector-hub-agents/package.json +75 -0
  3. package/dist/bundled-agents/connector-hub-agents/tsconfig.build.json +22 -0
  4. package/dist/bundled-agents/connector-hub-agents/tsconfig.json +57 -0
  5. package/dist/bundled-agents/copilot-agents/functions/.gcloudignore +17 -0
  6. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.d.ts +14 -0
  7. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js +35 -0
  8. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js.map +1 -0
  9. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.d.ts +55 -0
  10. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js +40 -0
  11. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js.map +1 -0
  12. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.d.ts +22 -0
  13. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js +38 -0
  14. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js.map +1 -0
  15. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.d.ts +34 -0
  16. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js +186 -0
  17. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js.map +1 -0
  18. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.d.ts +36 -0
  19. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js +121 -0
  20. package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js.map +1 -0
  21. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.d.ts +157 -0
  22. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js +948 -0
  23. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js.map +1 -0
  24. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.d.ts +9 -0
  25. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js +27 -0
  26. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js.map +1 -0
  27. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.d.ts +23 -0
  28. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js +50 -0
  29. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js.map +1 -0
  30. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.d.ts +214 -0
  31. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js +91 -0
  32. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js.map +1 -0
  33. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.d.ts +1166 -0
  34. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js +308 -0
  35. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js.map +1 -0
  36. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.d.ts +59 -0
  37. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js +62 -0
  38. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js.map +1 -0
  39. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.d.ts +400 -0
  40. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js +113 -0
  41. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js.map +1 -0
  42. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.d.ts +250 -0
  43. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js +169 -0
  44. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js.map +1 -0
  45. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.d.ts +17 -0
  46. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js +97 -0
  47. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js.map +1 -0
  48. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.d.ts +1674 -0
  49. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js +246 -0
  50. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js.map +1 -0
  51. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.d.ts +1085 -0
  52. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js +218 -0
  53. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js.map +1 -0
  54. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.d.ts +949 -0
  55. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js +253 -0
  56. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js.map +1 -0
  57. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.d.ts +657 -0
  58. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js +205 -0
  59. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js.map +1 -0
  60. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.d.ts +285 -0
  61. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js +106 -0
  62. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js.map +1 -0
  63. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.d.ts +581 -0
  64. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js +136 -0
  65. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js.map +1 -0
  66. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.d.ts +791 -0
  67. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js +225 -0
  68. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js.map +1 -0
  69. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.d.ts +120 -0
  70. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js +535 -0
  71. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js.map +1 -0
  72. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.d.ts +9 -0
  73. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js +18 -0
  74. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js.map +1 -0
  75. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.d.ts +4 -0
  76. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js +9 -0
  77. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js.map +1 -0
  78. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.d.ts +123 -0
  79. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js +609 -0
  80. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js.map +1 -0
  81. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.d.ts +10 -0
  82. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js +25 -0
  83. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js.map +1 -0
  84. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +111 -0
  85. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js +686 -0
  86. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js.map +1 -0
  87. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.d.ts +11 -0
  88. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js +25 -0
  89. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js.map +1 -0
  90. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.d.ts +6 -0
  91. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js +15 -0
  92. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js.map +1 -0
  93. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +126 -0
  94. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js +780 -0
  95. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js.map +1 -0
  96. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.d.ts +49 -0
  97. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js +125 -0
  98. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js.map +1 -0
  99. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.d.ts +73 -0
  100. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js +192 -0
  101. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js.map +1 -0
  102. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.d.ts +11 -0
  103. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js +25 -0
  104. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js.map +1 -0
  105. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.d.ts +127 -0
  106. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js +483 -0
  107. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js.map +1 -0
  108. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.d.ts +49 -0
  109. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js +125 -0
  110. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js.map +1 -0
  111. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.d.ts +73 -0
  112. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js +192 -0
  113. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js.map +1 -0
  114. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.d.ts +11 -0
  115. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js +27 -0
  116. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js.map +1 -0
  117. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.d.ts +122 -0
  118. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js +645 -0
  119. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js.map +1 -0
  120. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.d.ts +59 -0
  121. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js +156 -0
  122. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js.map +1 -0
  123. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.d.ts +88 -0
  124. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js +246 -0
  125. package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js.map +1 -0
  126. package/dist/bundled-agents/copilot-agents/functions/index.js +4 -0
  127. package/dist/bundled-agents/copilot-agents/functions/jest.config.js +29 -0
  128. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.d.ts +14 -0
  129. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js +35 -0
  130. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js.map +1 -0
  131. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.d.ts +27 -0
  132. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js +21 -0
  133. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js.map +1 -0
  134. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.d.ts +22 -0
  135. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js +38 -0
  136. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js.map +1 -0
  137. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.d.ts +34 -0
  138. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js +174 -0
  139. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js.map +1 -0
  140. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.d.ts +27 -0
  141. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js +107 -0
  142. package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js.map +1 -0
  143. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.d.ts +157 -0
  144. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js +941 -0
  145. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js.map +1 -0
  146. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.d.ts +9 -0
  147. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js +27 -0
  148. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js.map +1 -0
  149. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.d.ts +23 -0
  150. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js +50 -0
  151. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js.map +1 -0
  152. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.d.ts +185 -0
  153. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js +86 -0
  154. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js.map +1 -0
  155. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.d.ts +1081 -0
  156. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js +305 -0
  157. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js.map +1 -0
  158. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.d.ts +59 -0
  159. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js +62 -0
  160. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js.map +1 -0
  161. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.d.ts +315 -0
  162. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js +110 -0
  163. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js.map +1 -0
  164. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.d.ts +250 -0
  165. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js +169 -0
  166. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js.map +1 -0
  167. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.d.ts +16 -0
  168. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js +88 -0
  169. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js.map +1 -0
  170. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.d.ts +1674 -0
  171. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js +246 -0
  172. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js.map +1 -0
  173. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.d.ts +1000 -0
  174. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js +215 -0
  175. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js.map +1 -0
  176. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.d.ts +864 -0
  177. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js +250 -0
  178. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js.map +1 -0
  179. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.d.ts +572 -0
  180. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js +202 -0
  181. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js.map +1 -0
  182. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.d.ts +496 -0
  183. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js +133 -0
  184. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js.map +1 -0
  185. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.d.ts +706 -0
  186. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js +222 -0
  187. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js.map +1 -0
  188. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.d.ts +107 -0
  189. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js +360 -0
  190. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js.map +1 -0
  191. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.d.ts +9 -0
  192. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js +18 -0
  193. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js.map +1 -0
  194. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.d.ts +4 -0
  195. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js +9 -0
  196. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js.map +1 -0
  197. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.d.ts +123 -0
  198. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js +609 -0
  199. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js.map +1 -0
  200. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.d.ts +10 -0
  201. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js +25 -0
  202. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js.map +1 -0
  203. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +111 -0
  204. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js +686 -0
  205. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js.map +1 -0
  206. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.d.ts +11 -0
  207. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js +25 -0
  208. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js.map +1 -0
  209. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.d.ts +6 -0
  210. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js +15 -0
  211. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js.map +1 -0
  212. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +126 -0
  213. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js +780 -0
  214. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js.map +1 -0
  215. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.d.ts +49 -0
  216. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js +125 -0
  217. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js.map +1 -0
  218. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.d.ts +73 -0
  219. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js +192 -0
  220. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js.map +1 -0
  221. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.d.ts +11 -0
  222. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js +25 -0
  223. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js.map +1 -0
  224. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.d.ts +119 -0
  225. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js +421 -0
  226. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js.map +1 -0
  227. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.d.ts +49 -0
  228. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js +125 -0
  229. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js.map +1 -0
  230. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.d.ts +73 -0
  231. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js +192 -0
  232. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js.map +1 -0
  233. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.d.ts +11 -0
  234. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js +27 -0
  235. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js.map +1 -0
  236. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.d.ts +122 -0
  237. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js +645 -0
  238. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js.map +1 -0
  239. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.d.ts +59 -0
  240. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js +156 -0
  241. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js.map +1 -0
  242. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.d.ts +88 -0
  243. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js +246 -0
  244. package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js.map +1 -0
  245. package/dist/bundled-agents/copilot-agents/functions/package-lock.json +5473 -0
  246. package/dist/bundled-agents/copilot-agents/functions/package.json +40 -0
  247. package/dist/bundled-agents/copilot-agents/functions/src/claude.ts +71 -0
  248. package/dist/bundled-agents/copilot-agents/functions/src/cors.ts +36 -0
  249. package/dist/bundled-agents/copilot-agents/functions/src/envelope.ts +77 -0
  250. package/dist/bundled-agents/copilot-agents/functions/src/handler.test.ts +340 -0
  251. package/dist/bundled-agents/copilot-agents/functions/src/health.ts +53 -0
  252. package/dist/bundled-agents/copilot-agents/functions/src/index.ts +201 -0
  253. package/dist/bundled-agents/copilot-agents/functions/src/router.ts +148 -0
  254. package/dist/bundled-agents/copilot-agents/functions/tsconfig.json +31 -0
  255. package/dist/bundled-agents/copilot-agents/package-lock.json +11825 -0
  256. package/dist/bundled-agents/copilot-agents/package.json +5 -0
  257. package/dist/bundled-agents/governance-dashboard-agents/package-lock.json +8282 -0
  258. package/dist/bundled-agents/governance-dashboard-agents/package.json +13 -0
  259. package/dist/bundled-agents/orchestrator-agents/functions/contracts/index.js +590 -0
  260. package/dist/bundled-agents/orchestrator-agents/functions/index.js +442 -0
  261. package/dist/bundled-agents/orchestrator-agents/functions/test.js +325 -0
  262. package/dist/bundled-agents/orchestrator-agents/index.js +6 -0
  263. package/dist/bundled-agents/orchestrator-agents/package-lock.json +13254 -0
  264. package/dist/bundled-agents/orchestrator-agents/package.json +20 -0
  265. package/dist/bundled-agents/platform-agents/package-lock.json +1723 -0
  266. package/dist/bundled-agents/platform-agents/package.json +22 -0
  267. package/dist/bundled-agents/platform-agents/src/agents/decision-memo.ts +463 -0
  268. package/dist/bundled-agents/platform-agents/src/agents/decision.ts +234 -0
  269. package/dist/bundled-agents/platform-agents/src/agents/executive-summary.ts +229 -0
  270. package/dist/bundled-agents/platform-agents/src/agents/risk-score.ts +327 -0
  271. package/dist/bundled-agents/platform-agents/src/claude.ts +71 -0
  272. package/dist/bundled-agents/platform-agents/src/cors.ts +24 -0
  273. package/dist/bundled-agents/platform-agents/src/envelope.ts +37 -0
  274. package/dist/bundled-agents/platform-agents/src/health.ts +20 -0
  275. package/dist/bundled-agents/platform-agents/src/index.ts +171 -0
  276. package/dist/bundled-agents/platform-agents/src/router.ts +38 -0
  277. package/dist/bundled-agents/platform-agents/src/text-analysis.ts +238 -0
  278. package/dist/bundled-agents/platform-agents/tsconfig.json +19 -0
  279. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts +3 -0
  280. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts.map +1 -0
  281. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js +43 -0
  282. package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js.map +1 -0
  283. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts +3 -0
  284. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts.map +1 -0
  285. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js +30 -0
  286. package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js.map +1 -0
  287. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts +3 -0
  288. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts.map +1 -0
  289. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js +53 -0
  290. package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js.map +1 -0
  291. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts +3 -0
  292. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts.map +1 -0
  293. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js +51 -0
  294. package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js.map +1 -0
  295. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts +3 -0
  296. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts.map +1 -0
  297. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js +36 -0
  298. package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js.map +1 -0
  299. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts +2 -0
  300. package/dist/bundled-agents/sentinel-agents/lib/index.d.ts.map +1 -0
  301. package/dist/bundled-agents/sentinel-agents/lib/index.js +70 -0
  302. package/dist/bundled-agents/sentinel-agents/lib/index.js.map +1 -0
  303. package/dist/bundled-agents/sentinel-agents/package-lock.json +12591 -0
  304. package/dist/bundled-agents/sentinel-agents/package.json +62 -0
  305. package/dist/bundled-agents/sentinel-agents/src/agents/alert.ts +46 -0
  306. package/dist/bundled-agents/sentinel-agents/src/agents/anomaly.ts +33 -0
  307. package/dist/bundled-agents/sentinel-agents/src/agents/correlation.ts +56 -0
  308. package/dist/bundled-agents/sentinel-agents/src/agents/drift.ts +54 -0
  309. package/dist/bundled-agents/sentinel-agents/src/agents/rca.ts +38 -0
  310. package/dist/bundled-agents/sentinel-agents/src/claude.ts +71 -0
  311. package/dist/bundled-agents/sentinel-agents/src/index.ts +77 -0
  312. package/dist/bundled-agents/sentinel-agents/tsconfig.json +20 -0
  313. package/dist/pipeline/auto-chain.d.ts.map +1 -1
  314. package/dist/pipeline/auto-chain.js +52 -0
  315. package/dist/pipeline/auto-chain.js.map +1 -1
  316. package/dist/pipeline/phase2/phases/ddd-generator.d.ts.map +1 -1
  317. package/dist/pipeline/phase2/phases/ddd-generator.js +15 -1
  318. package/dist/pipeline/phase2/phases/ddd-generator.js.map +1 -1
  319. package/dist/pipeline/phase2/phases/sparc-specification.d.ts.map +1 -1
  320. package/dist/pipeline/phase2/phases/sparc-specification.js +9 -0
  321. package/dist/pipeline/phase2/phases/sparc-specification.js.map +1 -1
  322. package/dist/pipeline/phase3/phases/domain-codegen.d.ts.map +1 -1
  323. package/dist/pipeline/phase3/phases/domain-codegen.js +41 -0
  324. package/dist/pipeline/phase3/phases/domain-codegen.js.map +1 -1
  325. package/package.json +1 -1
@@ -0,0 +1,327 @@
1
+ import crypto from "crypto";
2
+ import { z } from "zod";
3
+ import { callClaude, extractJson } from "../claude";
4
+ import { analyzeText, type TextAnalysis } from "../text-analysis";
5
+
6
+ const InputSchema = z
7
+ .object({
8
+ objective: z.string(),
9
+ text: z.string().optional(),
10
+ context: z.record(z.unknown()).optional(),
11
+ })
12
+ .strict();
13
+
14
+ interface RiskFactor {
15
+ factor: string;
16
+ score: number;
17
+ weight: number;
18
+ description: string;
19
+ }
20
+
21
+ interface RiskResult {
22
+ overall_risk_score: number;
23
+ risk_level: "low" | "medium" | "high" | "critical";
24
+ risk_factors: RiskFactor[];
25
+ mitigations: string[];
26
+ confidence: number;
27
+ }
28
+
29
+ // ---------------------------------------------------------------------------
30
+ // Claude-powered analysis
31
+ // ---------------------------------------------------------------------------
32
+
33
+ const SYSTEM_PROMPT = `You are an expert risk analyst. Analyze the given objective and produce a thorough, domain-specific risk assessment.
34
+
35
+ Return ONLY valid JSON (no markdown fences, no explanation) with this exact structure:
36
+ {
37
+ "overall_risk_score": <number 0-100>,
38
+ "risk_level": "low" | "medium" | "high" | "critical",
39
+ "risk_factors": [
40
+ {
41
+ "factor": "<specific, domain-relevant risk factor name>",
42
+ "score": <number 0-100>,
43
+ "weight": <number 0.0-1.0>,
44
+ "description": "<2-3 sentence justification derived from the objective>"
45
+ }
46
+ ],
47
+ "mitigations": ["<specific, actionable mitigation>"],
48
+ "confidence": <number 0.0-1.0>
49
+ }
50
+
51
+ Rules:
52
+ - Extract DOMAIN-SPECIFIC risk factors from the objective, not generic ones.
53
+ - Include 4-7 risk factors covering: technology risks (migration complexity, vendor lock-in, integration challenges), business risks (timeline, budget, regulatory compliance), and operational risks (team readiness, data migration, rollback strategy) as applicable.
54
+ - All factor weights must sum to 1.0.
55
+ - overall_risk_score must equal the weighted sum of factor scores (rounded).
56
+ - risk_level: <=25 "low", <=50 "medium", <=75 "high", >75 "critical".
57
+ - Provide 3-7 specific, actionable mitigations tied to the identified risks.
58
+ - confidence reflects how much information was available for assessment (0.5-0.95).
59
+ - Every description and mitigation must reference specifics from the objective.`;
60
+
61
+ async function analyzeWithClaude(
62
+ objective: string,
63
+ text: string | undefined,
64
+ apiKey: string
65
+ ): Promise<RiskResult> {
66
+ const userMsg = text
67
+ ? `Objective: ${objective}\n\nAdditional context:\n${text}`
68
+ : `Objective: ${objective}`;
69
+ const raw = await callClaude(apiKey, SYSTEM_PROMPT, userMsg);
70
+ const parsed = extractJson<RiskResult>(raw);
71
+ // Validate and clamp values
72
+ parsed.overall_risk_score = clamp(Math.round(parsed.overall_risk_score), 0, 100);
73
+ parsed.confidence = clamp(parsed.confidence, 0, 1);
74
+ parsed.risk_level = riskLevelFromScore(parsed.overall_risk_score);
75
+ for (const f of parsed.risk_factors) {
76
+ f.score = clamp(Math.round(f.score), 0, 100);
77
+ f.weight = clamp(f.weight, 0, 1);
78
+ }
79
+ return parsed;
80
+ }
81
+
82
+ // ---------------------------------------------------------------------------
83
+ // Heuristic analysis (no API key)
84
+ // ---------------------------------------------------------------------------
85
+
86
+ function analyzeHeuristic(
87
+ objective: string,
88
+ text: string | undefined,
89
+ context: Record<string, unknown> | undefined
90
+ ): RiskResult {
91
+ const content = `${objective} ${text || ""}`;
92
+ const ta = analyzeText(content);
93
+ const factors: RiskFactor[] = [];
94
+
95
+ // Build domain-specific risk factors based on what was actually found
96
+ if (ta.actionType === "migration") {
97
+ factors.push(buildMigrationRisks(ta, objective));
98
+ }
99
+ if (ta.entities.length > 0) {
100
+ factors.push(buildTechnologyRisks(ta));
101
+ }
102
+ if (ta.riskSignals.includes("tight timeline pressure") || ta.constraints.includes("timeline constraint")) {
103
+ factors.push({
104
+ factor: `Timeline pressure for ${ta.actionType}`,
105
+ score: 65,
106
+ weight: 0,
107
+ description: `The objective indicates time-sensitive delivery. ${ta.actionType !== "general" ? `A ${ta.actionType} effort under time pressure increases risk of incomplete testing and rushed decision-making.` : "Rushed timelines increase risk of quality issues."}`,
108
+ });
109
+ }
110
+ if (ta.riskSignals.includes("resource constraints") || ta.constraints.includes("resource limitation")) {
111
+ factors.push({
112
+ factor: "Resource and capacity risk",
113
+ score: 60,
114
+ weight: 0,
115
+ description: `Resource constraints detected in the objective. Limited staffing or budget for "${truncate(objective, 60)}" may lead to bottlenecks and delivery risk.`,
116
+ });
117
+ }
118
+ if (ta.riskSignals.includes("vendor/third-party dependency")) {
119
+ factors.push({
120
+ factor: `Third-party dependency risk`,
121
+ score: 55,
122
+ weight: 0,
123
+ description: `The objective involves external vendor or partner dependencies. This introduces risks around vendor reliability, lock-in, and alignment with ${ta.entities.length > 0 ? ta.entities.join(", ") : "project"} requirements.`,
124
+ });
125
+ }
126
+ if (ta.riskSignals.includes("regulatory/compliance exposure") || ta.constraints.includes("regulatory requirement")) {
127
+ const complianceEntities = ta.entities.filter((e) =>
128
+ /PCI|HIPAA|GDPR|SOC|SOX|CCPA|ISO|NIST|FedRAMP/i.test(e)
129
+ );
130
+ factors.push({
131
+ factor: `Compliance risk${complianceEntities.length > 0 ? ` (${complianceEntities.join(", ")})` : ""}`,
132
+ score: 60,
133
+ weight: 0,
134
+ description: `Regulatory or compliance requirements add constraints to the ${ta.actionType}. Non-compliance could result in legal liability, fines, or project delays.`,
135
+ });
136
+ }
137
+ if (ta.riskSignals.includes("data integrity/migration risk")) {
138
+ factors.push({
139
+ factor: "Data integrity and migration risk",
140
+ score: 65,
141
+ weight: 0,
142
+ description: `Data migration or transformation is involved. Risks include data loss, corruption, schema incompatibilities, and validation gaps during the transition.`,
143
+ });
144
+ }
145
+ if (ta.riskSignals.includes("security exposure")) {
146
+ factors.push({
147
+ factor: "Security exposure risk",
148
+ score: 55,
149
+ weight: 0,
150
+ description: `Security considerations are present in the objective. Changes to systems or infrastructure may introduce new attack surfaces or temporarily weaken security posture.`,
151
+ });
152
+ }
153
+ if (ta.riskSignals.includes("technical complexity") && !factors.some((f) => f.factor.includes("complexity"))) {
154
+ factors.push({
155
+ factor: `Technical complexity of ${ta.actionType}`,
156
+ score: 60,
157
+ weight: 0,
158
+ description: `The scope described in "${truncate(objective, 50)}" indicates significant technical complexity involving ${ta.entities.length > 0 ? ta.entities.slice(0, 3).join(", ") : "multiple systems"}.`,
159
+ });
160
+ }
161
+
162
+ // Ensure we have at least 3 factors
163
+ if (factors.length < 3) {
164
+ if (!factors.some((f) => f.factor.toLowerCase().includes("scope"))) {
165
+ factors.push({
166
+ factor: `Scope management for ${ta.actionType || "initiative"}`,
167
+ score: 40,
168
+ weight: 0,
169
+ description: `Without clearly bounded scope, "${truncate(objective, 50)}" risks expanding beyond original intent, impacting timelines and resources.`,
170
+ });
171
+ }
172
+ if (factors.length < 3) {
173
+ factors.push({
174
+ factor: "Stakeholder alignment risk",
175
+ score: 35,
176
+ weight: 0,
177
+ description: `Ensuring all stakeholders agree on approach, priorities, and success criteria for "${truncate(objective, 50)}" is critical for avoiding mid-project pivots.`,
178
+ });
179
+ }
180
+ if (factors.length < 3) {
181
+ factors.push({
182
+ factor: "Execution and delivery risk",
183
+ score: 40,
184
+ weight: 0,
185
+ description: `General execution risk for the described initiative. Unforeseen technical or organizational challenges may arise during implementation.`,
186
+ });
187
+ }
188
+ }
189
+
190
+ // Assign weights evenly then adjust
191
+ const evenWeight = parseFloat((1.0 / factors.length).toFixed(3));
192
+ for (const f of factors) f.weight = evenWeight;
193
+ // Fix rounding: give remainder to first factor
194
+ const remainder = parseFloat((1.0 - evenWeight * factors.length).toFixed(3));
195
+ if (factors.length > 0) factors[0].weight = parseFloat((factors[0].weight + remainder).toFixed(3));
196
+
197
+ // Calculate weighted score
198
+ const overallRiskScore = clamp(
199
+ Math.round(factors.reduce((sum, f) => sum + f.score * f.weight, 0)),
200
+ 0,
201
+ 100
202
+ );
203
+
204
+ // Generate mitigations tied to the specific factors
205
+ const mitigations = factors
206
+ .filter((f) => f.score >= 40)
207
+ .map((f) => generateMitigation(f, ta));
208
+ if (mitigations.length < 2) {
209
+ mitigations.push(
210
+ `Establish regular risk review checkpoints throughout the ${ta.actionType} process`
211
+ );
212
+ }
213
+
214
+ // Confidence based on input richness
215
+ let confidence = 0.55;
216
+ if (text) confidence += 0.1;
217
+ if (context) confidence += 0.05;
218
+ if (ta.wordCount > 20) confidence += 0.05;
219
+ if (ta.wordCount > 50) confidence += 0.05;
220
+ if (ta.entities.length > 0) confidence += 0.05;
221
+ confidence = clamp(confidence, 0.4, 0.85);
222
+
223
+ return {
224
+ overall_risk_score: overallRiskScore,
225
+ risk_level: riskLevelFromScore(overallRiskScore),
226
+ risk_factors: factors,
227
+ mitigations,
228
+ confidence,
229
+ };
230
+ }
231
+
232
+ function buildMigrationRisks(ta: TextAnalysis, objective: string): RiskFactor {
233
+ const from = ta.entities.length > 0 ? ta.entities[0] : "source system";
234
+ const to = ta.entities.length > 1 ? ta.entities[1] : "target system";
235
+ return {
236
+ factor: `Migration complexity (${from} to ${to})`,
237
+ score: 65,
238
+ weight: 0,
239
+ description: `Migrating from ${from} to ${to} involves compatibility risks, data transfer challenges, and potential downtime. ${ta.constraints.length > 0 ? `Additional constraints: ${ta.constraints.join(", ")}.` : "Careful planning and rollback strategies are essential."}`,
240
+ };
241
+ }
242
+
243
+ function buildTechnologyRisks(ta: TextAnalysis): RiskFactor {
244
+ const techs = ta.entities.slice(0, 4).join(", ");
245
+ return {
246
+ factor: `Technology risk (${techs})`,
247
+ score: ta.entities.length > 3 ? 60 : 45,
248
+ weight: 0,
249
+ description: `The objective involves ${techs}. ${ta.entities.length > 3 ? "Multiple technology dependencies increase integration complexity and potential for compatibility issues." : "Technology-specific risks include learning curve, ecosystem maturity, and vendor support."}`,
250
+ };
251
+ }
252
+
253
+ function generateMitigation(factor: RiskFactor, ta: TextAnalysis): string {
254
+ const name = factor.factor.toLowerCase();
255
+ if (name.includes("migration"))
256
+ return `Develop a detailed migration plan with rollback procedures, dry-run testing, and phased cutover for the ${ta.entities.slice(0, 2).join(" to ") || "system"} migration`;
257
+ if (name.includes("timeline"))
258
+ return `Build schedule buffers and define a minimum viable scope that can be delivered within the constrained timeline`;
259
+ if (name.includes("resource"))
260
+ return `Identify critical skill gaps early and secure dedicated team capacity before the ${ta.actionType} begins`;
261
+ if (name.includes("compliance") || name.includes("regulatory"))
262
+ return `Engage compliance/legal review early and build compliance checkpoints into the project plan`;
263
+ if (name.includes("vendor") || name.includes("third-party"))
264
+ return `Negotiate SLAs with vendors and identify alternative providers to reduce single-vendor dependency`;
265
+ if (name.includes("data"))
266
+ return `Implement data validation and reconciliation procedures at every stage of the data migration pipeline`;
267
+ if (name.includes("security"))
268
+ return `Conduct security review and threat modeling before and after system changes`;
269
+ if (name.includes("technology"))
270
+ return `Run a proof-of-concept or spike to validate technology choices (${ta.entities.slice(0, 2).join(", ")}) before committing to full implementation`;
271
+ if (name.includes("scope"))
272
+ return `Define clear scope boundaries and a formal change-request process to prevent scope creep`;
273
+ return `Address ${factor.factor} through proactive monitoring, stakeholder communication, and contingency planning`;
274
+ }
275
+
276
+ // ---------------------------------------------------------------------------
277
+ // Utilities
278
+ // ---------------------------------------------------------------------------
279
+
280
+ function clamp(n: number, min: number, max: number): number {
281
+ return Math.max(min, Math.min(max, n));
282
+ }
283
+
284
+ function riskLevelFromScore(score: number): "low" | "medium" | "high" | "critical" {
285
+ if (score <= 25) return "low";
286
+ if (score <= 50) return "medium";
287
+ if (score <= 75) return "high";
288
+ return "critical";
289
+ }
290
+
291
+ function truncate(s: string, len: number): string {
292
+ return s.length > len ? s.slice(0, len) + "..." : s;
293
+ }
294
+
295
+ // ---------------------------------------------------------------------------
296
+ // Handler
297
+ // ---------------------------------------------------------------------------
298
+
299
+ export async function handleRiskScore(
300
+ body: Record<string, unknown>,
301
+ traceId?: string,
302
+ apiKey?: string
303
+ ): Promise<Record<string, unknown>> {
304
+ const parsed = InputSchema.parse(body);
305
+
306
+ let result: RiskResult;
307
+ if (apiKey) {
308
+ try {
309
+ result = await analyzeWithClaude(parsed.objective, parsed.text, apiKey);
310
+ } catch {
311
+ // Fall back to heuristic on any Claude failure
312
+ result = analyzeHeuristic(parsed.objective, parsed.text, parsed.context);
313
+ }
314
+ } else {
315
+ result = analyzeHeuristic(parsed.objective, parsed.text, parsed.context);
316
+ }
317
+
318
+ return {
319
+ risk_id: crypto.randomUUID(),
320
+ objective: parsed.objective,
321
+ overall_risk_score: result.overall_risk_score,
322
+ risk_level: result.risk_level,
323
+ risk_factors: result.risk_factors,
324
+ mitigations: result.mitigations,
325
+ confidence: result.confidence,
326
+ };
327
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.callClaude = callClaude;
4
+ exports.extractJson = extractJson;
5
+
6
+ const { execFileSync } = require("child_process");
7
+
8
+ function findClaudeBinary() {
9
+ for (const name of ["claude", "claude-code"]) {
10
+ try {
11
+ const result = execFileSync("which", [name], { encoding: "utf-8", timeout: 5000 }).trim();
12
+ if (result) return result;
13
+ } catch {}
14
+ }
15
+ throw new Error("Claude Code binary not found. Install: npm i -g @anthropic-ai/claude-code");
16
+ }
17
+
18
+ let _binary = null;
19
+ function getBinary() {
20
+ if (!_binary) _binary = findClaudeBinary();
21
+ return _binary;
22
+ }
23
+
24
+ async function callClaude(apiKey, systemPrompt, userMessage) {
25
+ const binary = getBinary();
26
+ const prompt = systemPrompt + "\n\n" + userMessage;
27
+ const env = Object.assign({}, process.env, { CI: "1" });
28
+ // Use short timeout when called from a child process (to avoid blocking the
29
+ // child's event loop for 120s). The parent will kill us anyway at timeoutMs.
30
+ const timeoutMs = process.env.AGENTICS_CHILD_PROCESS ? 8000 : 120000;
31
+ delete env.CLAUDECODE;
32
+ delete env.AGENTICS_DEV;
33
+
34
+ const raw = execFileSync(binary, [
35
+ "--print", "--output-format", "json", "--model", "claude-sonnet-4-20250514", prompt
36
+ ], {
37
+ encoding: "utf-8",
38
+ timeout: timeoutMs,
39
+ stdio: ["pipe", "pipe", "pipe"],
40
+ env: env,
41
+ maxBuffer: 10 * 1024 * 1024,
42
+ });
43
+
44
+ // Unwrap claude --output-format json envelope
45
+ try {
46
+ const parsed = JSON.parse(raw);
47
+ if (parsed.type === "result" && typeof parsed.result === "string") {
48
+ return parsed.result;
49
+ }
50
+ return raw;
51
+ } catch {
52
+ return raw;
53
+ }
54
+ }
55
+
56
+ function extractJson(text) {
57
+ const fenceMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/);
58
+ if (fenceMatch) return JSON.parse(fenceMatch[1].trim());
59
+ const startIdx = text.search(/[{[]/);
60
+ if (startIdx >= 0) {
61
+ const startChar = text[startIdx];
62
+ const endChar = startChar === "{" ? "}" : "]";
63
+ let depth = 0;
64
+ for (let i = startIdx; i < text.length; i++) {
65
+ if (text[i] === startChar) depth++;
66
+ else if (text[i] === endChar) depth--;
67
+ if (depth === 0) return JSON.parse(text.slice(startIdx, i + 1));
68
+ }
69
+ }
70
+ return JSON.parse(text.trim());
71
+ }
@@ -0,0 +1,24 @@
1
+ import type { IncomingMessage, ServerResponse } from "http";
2
+
3
+ export function setCorsHeaders(res: ServerResponse): void {
4
+ res.setHeader("Access-Control-Allow-Origin", "*");
5
+ res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
6
+ res.setHeader(
7
+ "Access-Control-Allow-Headers",
8
+ "Content-Type, Authorization, X-Correlation-ID"
9
+ );
10
+ res.setHeader("Access-Control-Max-Age", "86400");
11
+ }
12
+
13
+ export function handleCors(
14
+ req: IncomingMessage,
15
+ res: ServerResponse
16
+ ): boolean {
17
+ setCorsHeaders(res);
18
+ if (req.method === "OPTIONS") {
19
+ res.writeHead(204);
20
+ res.end();
21
+ return true;
22
+ }
23
+ return false;
24
+ }
@@ -0,0 +1,37 @@
1
+ import crypto from "crypto";
2
+
3
+ export interface LayerEntry {
4
+ layer: string;
5
+ status: "completed" | "failed" | "skipped";
6
+ duration_ms?: number;
7
+ }
8
+
9
+ export interface ExecutionMetadata {
10
+ trace_id: string;
11
+ timestamp: string;
12
+ service: string;
13
+ execution_id: string;
14
+ }
15
+
16
+ export interface EnvelopedResponse {
17
+ data: Record<string, unknown>;
18
+ execution_metadata: ExecutionMetadata;
19
+ layers_executed: LayerEntry[];
20
+ }
21
+
22
+ export function buildEnvelope(
23
+ data: Record<string, unknown>,
24
+ layers: LayerEntry[],
25
+ traceId?: string
26
+ ): EnvelopedResponse {
27
+ return {
28
+ data,
29
+ execution_metadata: {
30
+ trace_id: traceId || crypto.randomUUID(),
31
+ timestamp: new Date().toISOString(),
32
+ service: "platform-agents",
33
+ execution_id: crypto.randomUUID(),
34
+ },
35
+ layers_executed: layers,
36
+ };
37
+ }
@@ -0,0 +1,20 @@
1
+ import type { ServerResponse } from "http";
2
+ import { setCorsHeaders } from "./cors";
3
+
4
+ export function handleHealth(res: ServerResponse): void {
5
+ setCorsHeaders(res);
6
+ res.writeHead(200, { "Content-Type": "application/json" });
7
+ res.end(
8
+ JSON.stringify({
9
+ status: "healthy",
10
+ service: "platform-agents",
11
+ timestamp: new Date().toISOString(),
12
+ agents: [
13
+ "decision",
14
+ "executive-summary",
15
+ "decision-memo",
16
+ "risk-score",
17
+ ],
18
+ })
19
+ );
20
+ }
@@ -0,0 +1,171 @@
1
+ import type { IncomingMessage, ServerResponse } from "http";
2
+ import { handleCors, setCorsHeaders } from "./cors";
3
+ import { handleHealth } from "./health";
4
+ import { resolveAgent } from "./router";
5
+ import { buildEnvelope } from "./envelope";
6
+ import type { LayerEntry } from "./envelope";
7
+ import * as functions from "@google-cloud/functions-framework";
8
+
9
+ function parseBody(req: IncomingMessage): Promise<Record<string, unknown>> {
10
+ return new Promise((resolve, reject) => {
11
+ // Cloud Functions may have already parsed the body
12
+ if ((req as any).body) {
13
+ resolve((req as any).body as Record<string, unknown>);
14
+ return;
15
+ }
16
+ const chunks: Buffer[] = [];
17
+ req.on("data", (chunk: Buffer) => chunks.push(chunk));
18
+ req.on("end", () => {
19
+ try {
20
+ const raw = Buffer.concat(chunks).toString("utf-8");
21
+ resolve(raw ? JSON.parse(raw) : {});
22
+ } catch {
23
+ reject(new Error("Invalid JSON body"));
24
+ }
25
+ });
26
+ req.on("error", reject);
27
+ });
28
+ }
29
+
30
+ function sendJson(
31
+ res: ServerResponse,
32
+ status: number,
33
+ body: unknown
34
+ ): void {
35
+ setCorsHeaders(res);
36
+ res.writeHead(status, { "Content-Type": "application/json" });
37
+ res.end(JSON.stringify(body));
38
+ }
39
+
40
+ async function persistToRuvector(
41
+ data: Record<string, unknown>,
42
+ traceId: string
43
+ ): Promise<void> {
44
+ const url = process.env.RUVECTOR_SERVICE_URL;
45
+ if (!url) return;
46
+
47
+ try {
48
+ await fetch(`${url}/v1/vectors/store`, {
49
+ method: "POST",
50
+ headers: {
51
+ "Content-Type": "application/json",
52
+ "X-Correlation-ID": traceId,
53
+ },
54
+ body: JSON.stringify({
55
+ source: "platform-agents",
56
+ trace_id: traceId,
57
+ payload: data,
58
+ timestamp: new Date().toISOString(),
59
+ }),
60
+ signal: AbortSignal.timeout(5000),
61
+ });
62
+ } catch {
63
+ // Non-blocking, failure-tolerant — silently ignore
64
+ }
65
+ }
66
+
67
+ async function handleRequest(
68
+ req: IncomingMessage,
69
+ res: ServerResponse
70
+ ): Promise<void> {
71
+ // CORS preflight
72
+ if (handleCors(req, res)) return;
73
+
74
+ const url = (req as any).url || req.url || "/";
75
+ const path = url.split("?")[0].replace(/\/+$/, "") || "/";
76
+
77
+ // Health check
78
+ if (path === "/health" || path.endsWith("/health")) {
79
+ handleHealth(res);
80
+ return;
81
+ }
82
+
83
+ // Route: /v1/platform/<agent-slug>
84
+ const match = path.match(/\/v1\/platform\/([a-z-]+)$/);
85
+ if (!match || req.method !== "POST") {
86
+ sendJson(res, 404, {
87
+ error: "Not found",
88
+ message: `No route for ${req.method} ${path}`,
89
+ available_routes: [
90
+ "POST /v1/platform/decision",
91
+ "POST /v1/platform/executive-summary",
92
+ "POST /v1/platform/decision-memo",
93
+ "POST /v1/platform/risk-score",
94
+ "GET /health",
95
+ ],
96
+ });
97
+ return;
98
+ }
99
+
100
+ const slug = match[1];
101
+ const agent = resolveAgent(slug);
102
+ if (!agent) {
103
+ sendJson(res, 404, {
104
+ error: "Unknown agent",
105
+ message: `Agent "${slug}" not found`,
106
+ });
107
+ return;
108
+ }
109
+
110
+ const traceId =
111
+ (req.headers["x-correlation-id"] as string) ||
112
+ crypto.randomUUID();
113
+
114
+ let body: Record<string, unknown>;
115
+ try {
116
+ body = await parseBody(req);
117
+ } catch {
118
+ sendJson(res, 400, buildEnvelope(
119
+ { error: "Invalid JSON body" },
120
+ [{ layer: "AGENT_ROUTING", status: "failed" }],
121
+ traceId
122
+ ));
123
+ return;
124
+ }
125
+
126
+ const layers: LayerEntry[] = [
127
+ { layer: "AGENT_ROUTING", status: "completed" },
128
+ ];
129
+
130
+ const start = performance.now();
131
+ try {
132
+ const apiKey =
133
+ (req.headers["x-anthropic-api-key"] as string) || undefined;
134
+ const data = await agent.handler(body, traceId, apiKey);
135
+ const duration_ms = Math.round(performance.now() - start);
136
+
137
+ layers.push({
138
+ layer: agent.layerName,
139
+ status: "completed",
140
+ duration_ms,
141
+ });
142
+
143
+ const envelope = buildEnvelope(data, layers, traceId);
144
+ sendJson(res, 200, envelope);
145
+
146
+ // Fire-and-forget persistence
147
+ persistToRuvector(data, traceId);
148
+ } catch (err: any) {
149
+ const duration_ms = Math.round(performance.now() - start);
150
+ layers.push({
151
+ layer: agent.layerName,
152
+ status: "failed",
153
+ duration_ms,
154
+ });
155
+
156
+ const status = err.statusCode || 400;
157
+ sendJson(
158
+ res,
159
+ status,
160
+ buildEnvelope(
161
+ { error: err.message || "Agent execution failed" },
162
+ layers,
163
+ traceId
164
+ )
165
+ );
166
+ }
167
+ }
168
+
169
+ import crypto from "crypto";
170
+
171
+ functions.http("handler", handleRequest);
@@ -0,0 +1,38 @@
1
+ import { handleDecision } from "./agents/decision";
2
+ import { handleExecutiveSummary } from "./agents/executive-summary";
3
+ import { handleDecisionMemo } from "./agents/decision-memo";
4
+ import { handleRiskScore } from "./agents/risk-score";
5
+
6
+ export type AgentHandler = (
7
+ body: Record<string, unknown>,
8
+ traceId?: string,
9
+ apiKey?: string
10
+ ) => Promise<Record<string, unknown>>;
11
+
12
+ interface AgentRoute {
13
+ handler: AgentHandler;
14
+ layerName: string;
15
+ }
16
+
17
+ const routes: Record<string, AgentRoute> = {
18
+ decision: {
19
+ handler: handleDecision,
20
+ layerName: "PLATFORM_DECISION",
21
+ },
22
+ "executive-summary": {
23
+ handler: handleExecutiveSummary,
24
+ layerName: "PLATFORM_EXECUTIVE_SUMMARY",
25
+ },
26
+ "decision-memo": {
27
+ handler: handleDecisionMemo,
28
+ layerName: "PLATFORM_DECISION_MEMO",
29
+ },
30
+ "risk-score": {
31
+ handler: handleRiskScore,
32
+ layerName: "PLATFORM_RISK_SCORE",
33
+ },
34
+ };
35
+
36
+ export function resolveAgent(slug: string): AgentRoute | undefined {
37
+ return routes[slug];
38
+ }