@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,234 @@
1
+ import crypto from "crypto";
2
+ import { z } from "zod";
3
+ import { callClaude, extractJson } from "../claude";
4
+ import { analyzeText } from "../text-analysis";
5
+
6
+ const InputSchema = z
7
+ .object({
8
+ objective: z.string(),
9
+ context: z.record(z.unknown()).optional(),
10
+ })
11
+ .strict();
12
+
13
+ interface DecisionResult {
14
+ recommendation: "proceed" | "hold" | "reject";
15
+ confidence: number;
16
+ reasoning: string;
17
+ conditions: string[];
18
+ risks: string[];
19
+ }
20
+
21
+ // ---------------------------------------------------------------------------
22
+ // Claude-powered analysis
23
+ // ---------------------------------------------------------------------------
24
+
25
+ const SYSTEM_PROMPT = `You are an expert decision analyst. Analyze the given objective and produce a real go/no-go recommendation with thorough justification.
26
+
27
+ Return ONLY valid JSON (no markdown fences, no explanation) with this exact structure:
28
+ {
29
+ "recommendation": "proceed" | "hold" | "reject",
30
+ "confidence": <number 0.0-1.0>,
31
+ "reasoning": "<3-5 sentence explanation of the recommendation, referencing specifics from the objective>",
32
+ "conditions": ["<prerequisite or condition that must be met>"],
33
+ "risks": ["<specific risk or blocker identified>"]
34
+ }
35
+
36
+ Rules:
37
+ - "proceed" = the objective is feasible, well-scoped, and should move forward.
38
+ - "hold" = the objective has merit but needs clarification, prerequisites, or risk mitigation first.
39
+ - "reject" = the objective is infeasible, poorly scoped, or the risks clearly outweigh the benefits.
40
+ - Provide 3-6 conditions (prerequisites, success criteria, or governance requirements) specific to this objective.
41
+ - Provide 3-6 risks specific to this objective, not generic project management risks.
42
+ - The reasoning must reference specific elements from the objective, not boilerplate.
43
+ - confidence reflects certainty given the information provided (0.5-0.95).
44
+ - Extract key decision factors, pros/cons, prerequisites, and blockers from the objective text.`;
45
+
46
+ async function analyzeWithClaude(
47
+ objective: string,
48
+ apiKey: string
49
+ ): Promise<DecisionResult> {
50
+ const raw = await callClaude(apiKey, SYSTEM_PROMPT, `Objective: ${objective}`);
51
+ const parsed = extractJson<DecisionResult>(raw);
52
+ // Validate enum value
53
+ if (!["proceed", "hold", "reject"].includes(parsed.recommendation)) {
54
+ parsed.recommendation = "hold";
55
+ }
56
+ parsed.confidence = Math.max(0, Math.min(1, parsed.confidence));
57
+ return parsed;
58
+ }
59
+
60
+ // ---------------------------------------------------------------------------
61
+ // Heuristic analysis (no API key)
62
+ // ---------------------------------------------------------------------------
63
+
64
+ function analyzeHeuristic(
65
+ objective: string,
66
+ context: Record<string, unknown> | undefined
67
+ ): DecisionResult {
68
+ const ta = analyzeText(objective);
69
+ const conditions: string[] = [];
70
+ const risks: string[] = [];
71
+
72
+ // Determine recommendation based on risk/positive signal balance
73
+ let recommendation: "proceed" | "hold" | "reject" = "proceed";
74
+ let confidence = 0.70;
75
+
76
+ // Check for strong negative signals
77
+ const lower = objective.toLowerCase();
78
+ const rejectSignals = ["abandon", "cancel", "terminate", "infeasible", "impossible", "prohibitive"];
79
+ const hasReject = rejectSignals.some((k) => lower.includes(k));
80
+ if (hasReject) {
81
+ recommendation = "reject";
82
+ confidence = 0.75;
83
+ }
84
+
85
+ // Risk signals push toward hold
86
+ if (!hasReject && ta.riskSignals.length >= 3) {
87
+ recommendation = "hold";
88
+ confidence = 0.65;
89
+ } else if (!hasReject && ta.riskSignals.length >= 1 && ta.positiveSignals.length === 0) {
90
+ recommendation = "hold";
91
+ confidence = 0.60;
92
+ }
93
+
94
+ // Positive signals boost confidence
95
+ if (ta.positiveSignals.length > 0 && recommendation === "proceed") {
96
+ confidence = Math.min(confidence + ta.positiveSignals.length * 0.05, 0.90);
97
+ }
98
+
99
+ // Complexity can push toward hold
100
+ if (ta.complexity === "high" && recommendation === "proceed" && ta.positiveSignals.length === 0) {
101
+ recommendation = "hold";
102
+ confidence = 0.60;
103
+ }
104
+
105
+ // --- Build contextual conditions ---
106
+ if (ta.actionType === "migration") {
107
+ conditions.push(
108
+ `Migration plan for ${ta.entities.length > 0 ? ta.entities.join(" and ") : "the target systems"} must include rollback procedures`
109
+ );
110
+ conditions.push("Data validation and reconciliation process must be defined before migration begins");
111
+ }
112
+ if (ta.actionType === "implementation" || ta.actionType === "integration") {
113
+ conditions.push(
114
+ `Technical design and architecture review for ${ta.entities.length > 0 ? ta.entities.slice(0, 2).join("/") : "the solution"} completed and approved`
115
+ );
116
+ }
117
+ if (ta.constraints.includes("timeline constraint")) {
118
+ conditions.push("Timeline feasibility validated against resource availability and scope");
119
+ }
120
+ if (ta.constraints.includes("budget constraint")) {
121
+ conditions.push("Budget allocation confirmed and contingency reserve established");
122
+ }
123
+ if (ta.constraints.includes("regulatory requirement")) {
124
+ conditions.push(`Compliance review completed for applicable regulations${ta.entities.some((e) => /PCI|HIPAA|GDPR|SOC|SOX/i.test(e)) ? ` (${ta.entities.filter((e) => /PCI|HIPAA|GDPR|SOC|SOX/i.test(e)).join(", ")})` : ""}`);
125
+ }
126
+ if (ta.entities.length > 0) {
127
+ conditions.push(`Technical feasibility of ${ta.entities.slice(0, 3).join(", ")} integration validated`);
128
+ }
129
+
130
+ // Ensure minimum conditions
131
+ if (conditions.length < 2) {
132
+ conditions.push(`Stakeholder alignment on scope and success criteria for the ${ta.actionType}`);
133
+ conditions.push("Resource plan confirmed with identified team and budget");
134
+ }
135
+
136
+ // --- Build contextual risks ---
137
+ for (const signal of ta.riskSignals) {
138
+ if (signal === "tight timeline pressure") {
139
+ risks.push(`Timeline pressure may compromise quality of the ${ta.actionType} deliverables`);
140
+ } else if (signal === "resource constraints") {
141
+ risks.push("Resource limitations could cause delays or force scope reduction");
142
+ } else if (signal === "technical complexity") {
143
+ risks.push(
144
+ `Technical complexity of ${ta.entities.length > 0 ? ta.entities.slice(0, 2).join(" + ") : "the solution"} introduces integration and debugging risks`
145
+ );
146
+ } else if (signal === "vendor/third-party dependency") {
147
+ risks.push("External vendor dependencies create schedule and quality risks outside direct control");
148
+ } else if (signal === "regulatory/compliance exposure") {
149
+ risks.push("Non-compliance could result in legal liability, fines, or forced project changes");
150
+ } else if (signal === "data integrity/migration risk") {
151
+ risks.push("Data migration risks include potential data loss, corruption, or inconsistency");
152
+ } else if (signal === "uncertainty or unproven approach") {
153
+ risks.push("Unproven or experimental approach increases probability of unforeseen issues");
154
+ } else if (signal === "security exposure") {
155
+ risks.push("Security changes may introduce vulnerabilities if not properly reviewed and tested");
156
+ } else {
157
+ risks.push(`${signal.charAt(0).toUpperCase() + signal.slice(1)} may impact successful delivery`);
158
+ }
159
+ }
160
+
161
+ // Ensure minimum risks
162
+ if (risks.length < 2) {
163
+ risks.push(`Scope of "${truncate(objective, 60)}" may evolve, requiring re-evaluation of approach`);
164
+ if (risks.length < 2) {
165
+ risks.push(`Dependencies on team capacity and ${ta.entities.length > 0 ? ta.entities[0] : "technology"} readiness may affect delivery`);
166
+ }
167
+ }
168
+
169
+ // Context enrichment
170
+ if (context) {
171
+ if (context.budget) conditions.push(`Budget of ${context.budget} reviewed and validated`);
172
+ if (context.timeline) conditions.push(`Timeline target of ${context.timeline} assessed for feasibility`);
173
+ if (context.stakeholders) conditions.push("Key stakeholder sign-off obtained");
174
+ }
175
+
176
+ // Build reasoning referencing the objective
177
+ let reasoning: string;
178
+ if (recommendation === "proceed") {
179
+ reasoning =
180
+ `Analysis of "${truncate(objective, 80)}" indicates the initiative is feasible and should proceed. ` +
181
+ `The ${ta.actionType} involves ${ta.entities.length > 0 ? ta.entities.slice(0, 3).join(", ") : "well-understood components"} ` +
182
+ `and ${ta.positiveSignals.length > 0 ? `shows positive indicators (${ta.positiveSignals.join(", ")})` : "aligns with achievable goals"}. ` +
183
+ `${risks.length} risk(s) and ${conditions.length} condition(s) have been identified for monitoring.`;
184
+ } else if (recommendation === "hold") {
185
+ reasoning =
186
+ `Analysis of "${truncate(objective, 80)}" reveals factors requiring attention before proceeding. ` +
187
+ `${ta.riskSignals.length} risk signal(s) detected: ${ta.riskSignals.slice(0, 3).join(", ") || "complexity concerns"}. ` +
188
+ `The recommendation is to address the identified conditions and risk factors before committing resources to this ${ta.actionType}.`;
189
+ } else {
190
+ reasoning =
191
+ `Analysis of "${truncate(objective, 80)}" indicates significant concerns that warrant reconsideration. ` +
192
+ `The objective contains signals suggesting infeasibility or termination. ` +
193
+ `A fundamental reassessment of approach, scope, or viability is recommended before any further investment.`;
194
+ }
195
+
196
+ return { recommendation, confidence, reasoning, conditions, risks };
197
+ }
198
+
199
+ function truncate(s: string, len: number): string {
200
+ return s.length > len ? s.slice(0, len) + "..." : s;
201
+ }
202
+
203
+ // ---------------------------------------------------------------------------
204
+ // Handler
205
+ // ---------------------------------------------------------------------------
206
+
207
+ export async function handleDecision(
208
+ body: Record<string, unknown>,
209
+ traceId?: string,
210
+ apiKey?: string
211
+ ): Promise<Record<string, unknown>> {
212
+ const parsed = InputSchema.parse(body);
213
+
214
+ let result: DecisionResult;
215
+ if (apiKey) {
216
+ try {
217
+ result = await analyzeWithClaude(parsed.objective, apiKey);
218
+ } catch {
219
+ result = analyzeHeuristic(parsed.objective, parsed.context);
220
+ }
221
+ } else {
222
+ result = analyzeHeuristic(parsed.objective, parsed.context);
223
+ }
224
+
225
+ return {
226
+ decision_id: crypto.randomUUID(),
227
+ objective: parsed.objective,
228
+ recommendation: result.recommendation,
229
+ confidence: result.confidence,
230
+ reasoning: result.reasoning,
231
+ conditions: result.conditions,
232
+ risks: result.risks,
233
+ };
234
+ }
@@ -0,0 +1,229 @@
1
+ import crypto from "crypto";
2
+ import { z } from "zod";
3
+ import { callClaude, extractJson } from "../claude";
4
+ import { analyzeText } from "../text-analysis";
5
+
6
+ const InputSchema = z
7
+ .object({
8
+ objective: z.string(),
9
+ context: z.record(z.unknown()).optional(),
10
+ })
11
+ .strict();
12
+
13
+ interface SummaryResult {
14
+ executive_summary: string;
15
+ key_findings: string[];
16
+ metrics: Record<string, unknown>;
17
+ recommendation: string;
18
+ }
19
+
20
+ // ---------------------------------------------------------------------------
21
+ // Claude-powered analysis
22
+ // ---------------------------------------------------------------------------
23
+
24
+ const SYSTEM_PROMPT = `You are an executive advisor preparing a concise executive brief. Analyze the given objective and produce a real executive summary with actionable findings and recommendations.
25
+
26
+ Return ONLY valid JSON (no markdown fences, no explanation) with this exact structure:
27
+ {
28
+ "executive_summary": "<2-4 paragraph executive narrative covering: situation analysis, key findings, and recommended path forward. Must reference specifics from the objective.>",
29
+ "key_findings": [
30
+ "<specific finding derived from analyzing the objective>"
31
+ ],
32
+ "metrics": {
33
+ "complexity_score": "low" | "medium" | "high",
34
+ "estimated_impact": "<contextual impact assessment>",
35
+ "strategic_alignment": <number 0.0-1.0>
36
+ },
37
+ "recommendation": "<2-3 sentence actionable recommendation with rationale tied to the objective>"
38
+ }
39
+
40
+ Rules:
41
+ - The executive_summary must provide a genuine situation analysis, not template text. Reference the specific initiative, technologies, risks, and opportunities described.
42
+ - Provide 4-7 key_findings that a real executive would care about. Each should be specific and derived from the objective text.
43
+ - metrics.complexity_score should reflect the actual complexity of the described initiative.
44
+ - metrics.estimated_impact should describe the expected business/operational impact.
45
+ - metrics.strategic_alignment (0-1) should reflect how well the initiative aligns with typical organizational priorities.
46
+ - The recommendation must be specific, actionable, and reference elements from the objective.
47
+ - Write in professional executive language, concise and direct.`;
48
+
49
+ async function analyzeWithClaude(
50
+ objective: string,
51
+ apiKey: string
52
+ ): Promise<SummaryResult> {
53
+ const raw = await callClaude(apiKey, SYSTEM_PROMPT, `Objective: ${objective}`);
54
+ const parsed = extractJson<SummaryResult>(raw);
55
+ return parsed;
56
+ }
57
+
58
+ // ---------------------------------------------------------------------------
59
+ // Heuristic analysis (no API key)
60
+ // ---------------------------------------------------------------------------
61
+
62
+ function analyzeHeuristic(
63
+ objective: string,
64
+ context: Record<string, unknown> | undefined
65
+ ): SummaryResult {
66
+ const ta = analyzeText(objective);
67
+ const keyFindings: string[] = [];
68
+
69
+ // Build situation-aware executive summary
70
+ const entityRef = ta.entities.length > 0
71
+ ? ta.entities.slice(0, 4).join(", ")
72
+ : "the described systems";
73
+ const actionDesc = ta.actionType !== "general"
74
+ ? ta.actionType
75
+ : "initiative";
76
+
77
+ // --- Executive summary paragraphs ---
78
+ const situation =
79
+ `This executive summary addresses the proposed ${actionDesc}: "${truncate(objective, 120)}". ` +
80
+ `The initiative operates within the ${ta.domain} domain${ta.entities.length > 0 ? `, involving ${entityRef}` : ""}. ` +
81
+ `${ta.constraints.length > 0 ? `Key constraints include ${ta.constraints.join(", ")}. ` : ""}` +
82
+ `${ta.complexity === "high" ? "The scope and complexity of this effort are significant and warrant careful planning." : ta.complexity === "medium" ? "The initiative is moderately complex and requires structured execution." : "The scope appears manageable with appropriate planning."}`;
83
+
84
+ const riskParagraph = ta.riskSignals.length > 0
85
+ ? `Risk assessment identifies the following concerns: ${ta.riskSignals.join(", ")}. These factors should be addressed in the project plan to avoid delays or cost overruns.`
86
+ : `Initial risk assessment does not identify critical blockers, though standard project management risks apply.`;
87
+
88
+ const opportunityParagraph = ta.positiveSignals.length > 0
89
+ ? `Positive indicators include ${ta.positiveSignals.join(", ")}, suggesting favorable conditions for success.`
90
+ : `The initiative should be evaluated on its strategic merit and expected return on investment.`;
91
+
92
+ const executiveSummary = `${situation}\n\n${riskParagraph} ${opportunityParagraph}`;
93
+
94
+ // --- Key findings ---
95
+ if (ta.actionType === "migration") {
96
+ keyFindings.push(
97
+ `The ${ta.entities.length >= 2 ? `${ta.entities[0]} to ${ta.entities[1]}` : "proposed"} migration requires a detailed data transfer plan, compatibility validation, and rollback procedures`
98
+ );
99
+ keyFindings.push("Migration downtime window and rollback triggers must be defined before execution begins");
100
+ }
101
+ if (ta.actionType === "implementation" || ta.actionType === "integration") {
102
+ keyFindings.push(
103
+ `${entityRef} ${ta.actionType} requires architectural review and integration testing strategy`
104
+ );
105
+ }
106
+ if (ta.actionType === "optimization") {
107
+ keyFindings.push(
108
+ `Current performance baselines must be established before ${entityRef} optimization to measure improvement`
109
+ );
110
+ }
111
+
112
+ for (const signal of ta.riskSignals.slice(0, 3)) {
113
+ if (signal === "tight timeline pressure") {
114
+ keyFindings.push("Timeline pressure may require scope prioritization to deliver core value on schedule");
115
+ } else if (signal === "regulatory/compliance exposure") {
116
+ keyFindings.push(
117
+ `Compliance requirements${ta.entities.some((e) => /PCI|HIPAA|GDPR|SOC|SOX/i.test(e)) ? ` (${ta.entities.filter((e) => /PCI|HIPAA|GDPR|SOC|SOX/i.test(e)).join(", ")})` : ""} will impact timeline and require dedicated review cycles`
118
+ );
119
+ } else if (signal === "technical complexity") {
120
+ keyFindings.push(
121
+ `Technical complexity of the ${actionDesc} warrants a phased approach with validation at each stage`
122
+ );
123
+ } else if (signal === "resource constraints") {
124
+ keyFindings.push("Resource constraints identified; team capacity must be validated against delivery commitments");
125
+ } else if (signal === "security exposure") {
126
+ keyFindings.push("Security implications require threat modeling and security review before implementation");
127
+ }
128
+ }
129
+
130
+ for (const signal of ta.positiveSignals.slice(0, 2)) {
131
+ if (signal === "proven technology") {
132
+ keyFindings.push(`Use of proven, established technology (${entityRef}) reduces technical risk`);
133
+ } else if (signal === "efficiency gain") {
134
+ keyFindings.push("Expected efficiency gains from automation or process improvement support the business case");
135
+ } else if (signal === "strategic alignment") {
136
+ keyFindings.push("The initiative aligns with stated strategic priorities, supporting organizational buy-in");
137
+ }
138
+ }
139
+
140
+ // Ensure minimum findings
141
+ if (keyFindings.length < 3) {
142
+ keyFindings.push(`Resource allocation for the ${actionDesc} should be validated against project requirements`);
143
+ }
144
+ if (keyFindings.length < 3) {
145
+ keyFindings.push("Success metrics and acceptance criteria should be defined before execution begins");
146
+ }
147
+ if (keyFindings.length < 3) {
148
+ keyFindings.push("Stakeholder communication cadence should be established to maintain alignment throughout delivery");
149
+ }
150
+
151
+ // --- Metrics ---
152
+ const metrics: Record<string, unknown> = {
153
+ complexity_score: ta.complexity,
154
+ estimated_impact:
155
+ ta.complexity === "high"
156
+ ? "high — significant operational or strategic change"
157
+ : ta.complexity === "medium"
158
+ ? "moderate — meaningful improvement with manageable scope"
159
+ : "incremental — targeted improvement with contained scope",
160
+ strategic_alignment:
161
+ ta.positiveSignals.includes("strategic alignment")
162
+ ? 0.90
163
+ : ta.positiveSignals.length > 0
164
+ ? 0.78
165
+ : 0.65,
166
+ };
167
+
168
+ if (context) {
169
+ if (context.budget) metrics.budget_status = `reviewed (${context.budget})`;
170
+ if (context.team_size) metrics.team_coverage = `assessed (${context.team_size} members)`;
171
+ }
172
+
173
+ // --- Recommendation ---
174
+ let recommendation: string;
175
+ if (ta.riskSignals.length >= 3 || ta.complexity === "high") {
176
+ recommendation =
177
+ `Proceed with the ${actionDesc} using a phased approach to manage complexity and risk. ` +
178
+ `Prioritize addressing ${ta.riskSignals.slice(0, 2).join(" and ") || "identified risks"} before committing to full-scale execution. ` +
179
+ `Establish clear phase gates with go/no-go criteria at each milestone.`;
180
+ } else if (ta.riskSignals.length > 0) {
181
+ recommendation =
182
+ `Proceed with the ${actionDesc} with targeted risk mitigation for ${ta.riskSignals.join(", ")}. ` +
183
+ `${ta.entities.length > 0 ? `Validate ${ta.entities.slice(0, 2).join(" and ")} readiness before full commitment. ` : ""}` +
184
+ `Monitor identified risks through regular review cycles.`;
185
+ } else {
186
+ recommendation =
187
+ `Proceed with the ${actionDesc}${ta.entities.length > 0 ? ` involving ${entityRef}` : ""}. ` +
188
+ `The initiative shows favorable indicators and manageable risk. ` +
189
+ `Define success metrics and establish reporting cadence to track progress.`;
190
+ }
191
+
192
+ return { executive_summary: executiveSummary, key_findings: keyFindings, metrics, recommendation };
193
+ }
194
+
195
+ function truncate(s: string, len: number): string {
196
+ return s.length > len ? s.slice(0, len) + "..." : s;
197
+ }
198
+
199
+ // ---------------------------------------------------------------------------
200
+ // Handler
201
+ // ---------------------------------------------------------------------------
202
+
203
+ export async function handleExecutiveSummary(
204
+ body: Record<string, unknown>,
205
+ traceId?: string,
206
+ apiKey?: string
207
+ ): Promise<Record<string, unknown>> {
208
+ const parsed = InputSchema.parse(body);
209
+
210
+ let result: SummaryResult;
211
+ if (apiKey) {
212
+ try {
213
+ result = await analyzeWithClaude(parsed.objective, apiKey);
214
+ } catch {
215
+ result = analyzeHeuristic(parsed.objective, parsed.context);
216
+ }
217
+ } else {
218
+ result = analyzeHeuristic(parsed.objective, parsed.context);
219
+ }
220
+
221
+ return {
222
+ summary_id: crypto.randomUUID(),
223
+ objective: parsed.objective,
224
+ executive_summary: result.executive_summary,
225
+ key_findings: result.key_findings,
226
+ metrics: result.metrics,
227
+ recommendation: result.recommendation,
228
+ };
229
+ }