@resolveio/server-lib 22.3.126 → 22.3.128

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 (735) hide show
  1. package/ai/assistant-core-heuristics.d.ts +11 -0
  2. package/ai/assistant-core-heuristics.js +356 -0
  3. package/ai/assistant-core-heuristics.js.map +1 -0
  4. package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +3 -0
  5. package/ai/resolveio-platform-intelligence-memory-corpus.js +214 -0
  6. package/ai/resolveio-platform-intelligence-memory-corpus.js.map +1 -0
  7. package/ai/resolveio-platform-intelligence-memory.d.ts +20 -0
  8. package/ai/resolveio-platform-intelligence-memory.js +341 -0
  9. package/ai/resolveio-platform-intelligence-memory.js.map +1 -0
  10. package/{src/ai/resolveio-platform-intelligence-types.ts → ai/resolveio-platform-intelligence-types.d.ts} +15 -20
  11. package/ai/resolveio-platform-intelligence-types.js +4 -0
  12. package/ai/resolveio-platform-intelligence-types.js.map +1 -0
  13. package/ai/resolveio-platform-intelligence.d.ts +6 -0
  14. package/ai/resolveio-platform-intelligence.js +463 -0
  15. package/ai/resolveio-platform-intelligence.js.map +1 -0
  16. package/client-server-app.d.ts +1 -0
  17. package/client-server-app.js +68 -0
  18. package/client-server-app.js.map +1 -0
  19. package/collections/ai-run.collection.d.ts +3 -0
  20. package/collections/ai-run.collection.js +170 -0
  21. package/collections/ai-run.collection.js.map +1 -0
  22. package/collections/ai-terminal-conversation.collection.d.ts +2 -0
  23. package/collections/ai-terminal-conversation.collection.js +140 -0
  24. package/collections/ai-terminal-conversation.collection.js.map +1 -0
  25. package/collections/ai-terminal-issue-report.collection.d.ts +2 -0
  26. package/collections/ai-terminal-issue-report.collection.js +148 -0
  27. package/collections/ai-terminal-issue-report.collection.js.map +1 -0
  28. package/collections/ai-terminal-message.collection.d.ts +2 -0
  29. package/collections/ai-terminal-message.collection.js +121 -0
  30. package/collections/ai-terminal-message.collection.js.map +1 -0
  31. package/collections/app-setting.collection.d.ts +3 -0
  32. package/collections/app-setting.collection.js +103 -0
  33. package/collections/app-setting.collection.js.map +1 -0
  34. package/collections/app-status.collection.d.ts +3 -0
  35. package/collections/app-status.collection.js +57 -0
  36. package/collections/app-status.collection.js.map +1 -0
  37. package/collections/communication-metric.collection.d.ts +2 -0
  38. package/collections/communication-metric.collection.js +133 -0
  39. package/collections/communication-metric.collection.js.map +1 -0
  40. package/collections/counter.collection.d.ts +3 -0
  41. package/collections/counter.collection.js +56 -0
  42. package/collections/counter.collection.js.map +1 -0
  43. package/collections/cron-job-history.collection.d.ts +3 -0
  44. package/collections/cron-job-history.collection.js +137 -0
  45. package/collections/cron-job-history.collection.js.map +1 -0
  46. package/collections/cron-job.collection.d.ts +3 -0
  47. package/collections/cron-job.collection.js +92 -0
  48. package/collections/cron-job.collection.js.map +1 -0
  49. package/collections/customer-notification.collection.d.ts +3 -0
  50. package/collections/customer-notification.collection.js +130 -0
  51. package/collections/customer-notification.collection.js.map +1 -0
  52. package/collections/customer-portal-password.collection.d.ts +3 -0
  53. package/collections/customer-portal-password.collection.js +75 -0
  54. package/collections/customer-portal-password.collection.js.map +1 -0
  55. package/collections/email-history.collection.d.ts +3 -0
  56. package/collections/email-history.collection.js +134 -0
  57. package/collections/email-history.collection.js.map +1 -0
  58. package/collections/email-verified.collection.d.ts +3 -0
  59. package/collections/email-verified.collection.js +62 -0
  60. package/collections/email-verified.collection.js.map +1 -0
  61. package/collections/file.collection.d.ts +3 -0
  62. package/collections/file.collection.js +74 -0
  63. package/collections/file.collection.js.map +1 -0
  64. package/collections/flag-update.collection.d.ts +3 -0
  65. package/collections/flag-update.collection.js +57 -0
  66. package/collections/flag-update.collection.js.map +1 -0
  67. package/collections/flag.collection.d.ts +3 -0
  68. package/collections/flag.collection.js +57 -0
  69. package/collections/flag.collection.js.map +1 -0
  70. package/collections/log-method-latency.collection.d.ts +3 -0
  71. package/collections/log-method-latency.collection.js +77 -0
  72. package/collections/log-method-latency.collection.js.map +1 -0
  73. package/collections/log-subscription.collection.d.ts +3 -0
  74. package/collections/log-subscription.collection.js +80 -0
  75. package/collections/log-subscription.collection.js.map +1 -0
  76. package/collections/log.collection.d.ts +3 -0
  77. package/collections/log.collection.js +93 -0
  78. package/collections/log.collection.js.map +1 -0
  79. package/collections/logged-in-users.collection.d.ts +3 -0
  80. package/collections/logged-in-users.collection.js +67 -0
  81. package/collections/logged-in-users.collection.js.map +1 -0
  82. package/collections/monitor-cpu.collection.d.ts +3 -0
  83. package/collections/monitor-cpu.collection.js +65 -0
  84. package/collections/monitor-cpu.collection.js.map +1 -0
  85. package/collections/monitor-function.collection.d.ts +3 -0
  86. package/collections/monitor-function.collection.js +74 -0
  87. package/collections/monitor-function.collection.js.map +1 -0
  88. package/collections/monitor-memory.collection.d.ts +3 -0
  89. package/collections/monitor-memory.collection.js +77 -0
  90. package/collections/monitor-memory.collection.js.map +1 -0
  91. package/collections/monitor-mongo.collection.d.ts +3 -0
  92. package/collections/monitor-mongo.collection.js +71 -0
  93. package/collections/monitor-mongo.collection.js.map +1 -0
  94. package/collections/notification.collection.d.ts +3 -0
  95. package/collections/notification.collection.js +57 -0
  96. package/collections/notification.collection.js.map +1 -0
  97. package/collections/openai-usage-ledger.collection.d.ts +2 -0
  98. package/collections/openai-usage-ledger.collection.js +124 -0
  99. package/collections/openai-usage-ledger.collection.js.map +1 -0
  100. package/collections/report-builder-dashboard-builder.collection.d.ts +3 -0
  101. package/collections/report-builder-dashboard-builder.collection.js +109 -0
  102. package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
  103. package/collections/report-builder-library.collection.d.ts +3 -0
  104. package/collections/report-builder-library.collection.js +87 -0
  105. package/collections/report-builder-library.collection.js.map +1 -0
  106. package/collections/report-builder-report.collection.d.ts +4 -0
  107. package/collections/report-builder-report.collection.js +184 -0
  108. package/collections/report-builder-report.collection.js.map +1 -0
  109. package/collections/user-group.collection.d.ts +4 -0
  110. package/collections/user-group.collection.js +89 -0
  111. package/collections/user-group.collection.js.map +1 -0
  112. package/collections/user-guide.collection.d.ts +3 -0
  113. package/collections/user-guide.collection.js +57 -0
  114. package/collections/user-guide.collection.js.map +1 -0
  115. package/collections/user.collection.d.ts +4 -0
  116. package/collections/user.collection.js +180 -0
  117. package/collections/user.collection.js.map +1 -0
  118. package/cron/cron.d.ts +14 -0
  119. package/cron/cron.js +216 -0
  120. package/cron/cron.js.map +1 -0
  121. package/fixtures/cron-jobs.d.ts +1 -0
  122. package/fixtures/cron-jobs.js +150 -0
  123. package/fixtures/cron-jobs.js.map +1 -0
  124. package/fixtures/init.d.ts +1 -0
  125. package/fixtures/init.js +91 -0
  126. package/fixtures/init.js.map +1 -0
  127. package/http/auth.d.ts +2 -0
  128. package/http/auth.js +951 -0
  129. package/http/auth.js.map +1 -0
  130. package/http/health.d.ts +1 -0
  131. package/http/health.js +11 -0
  132. package/http/health.js.map +1 -0
  133. package/http/home.d.ts +1 -0
  134. package/http/home.js +134 -0
  135. package/http/home.js.map +1 -0
  136. package/http/slow-query-publication.d.ts +2 -0
  137. package/http/slow-query-publication.js +99 -0
  138. package/http/slow-query-publication.js.map +1 -0
  139. package/index.d.ts +1 -0
  140. package/index.js +19 -0
  141. package/index.js.map +1 -0
  142. package/managers/ai-assistant-codex-manager.manager.d.ts +67 -0
  143. package/managers/ai-assistant-codex-manager.manager.js +1113 -0
  144. package/managers/ai-assistant-codex-manager.manager.js.map +1 -0
  145. package/managers/ai-run-evidence.manager.d.ts +36 -0
  146. package/managers/ai-run-evidence.manager.js +377 -0
  147. package/managers/ai-run-evidence.manager.js.map +1 -0
  148. package/managers/communication-metric.manager.d.ts +16 -0
  149. package/managers/communication-metric.manager.js +134 -0
  150. package/managers/communication-metric.manager.js.map +1 -0
  151. package/managers/cron.manager.d.ts +20 -0
  152. package/managers/cron.manager.js +534 -0
  153. package/managers/cron.manager.js.map +1 -0
  154. package/managers/customer-notification-content.manager.d.ts +55 -0
  155. package/managers/customer-notification-content.manager.js +158 -0
  156. package/managers/customer-notification-content.manager.js.map +1 -0
  157. package/managers/diagnostic-manager-bootstrap.d.ts +9 -0
  158. package/managers/diagnostic-manager-bootstrap.js +260 -0
  159. package/managers/diagnostic-manager-bootstrap.js.map +1 -0
  160. package/managers/error-auto-fix.manager.d.ts +149 -0
  161. package/managers/error-auto-fix.manager.js +3064 -0
  162. package/managers/error-auto-fix.manager.js.map +1 -0
  163. package/managers/local-log.manager.d.ts +18 -0
  164. package/managers/local-log.manager.js +88 -0
  165. package/managers/local-log.manager.js.map +1 -0
  166. package/managers/method.manager.d.ts +84 -0
  167. package/managers/method.manager.js +1964 -0
  168. package/managers/method.manager.js.map +1 -0
  169. package/managers/mongo.manager.d.ts +224 -0
  170. package/managers/mongo.manager.js +5000 -0
  171. package/managers/mongo.manager.js.map +1 -0
  172. package/managers/monitor.manager.d.ts +70 -0
  173. package/managers/monitor.manager.js +550 -0
  174. package/managers/monitor.manager.js.map +1 -0
  175. package/managers/openai-usage-ledger.manager.d.ts +16 -0
  176. package/managers/openai-usage-ledger.manager.js +93 -0
  177. package/managers/openai-usage-ledger.manager.js.map +1 -0
  178. package/managers/slow-query-verifier.manager.d.ts +144 -0
  179. package/managers/slow-query-verifier.manager.js +3857 -0
  180. package/managers/slow-query-verifier.manager.js.map +1 -0
  181. package/managers/slow-query.manager.d.ts +28 -0
  182. package/managers/slow-query.manager.js +468 -0
  183. package/managers/slow-query.manager.js.map +1 -0
  184. package/managers/subscription.manager.d.ts +169 -0
  185. package/managers/subscription.manager.js +3434 -0
  186. package/managers/subscription.manager.js.map +1 -0
  187. package/managers/websocket.manager.d.ts +73 -0
  188. package/managers/websocket.manager.js +673 -0
  189. package/managers/websocket.manager.js.map +1 -0
  190. package/managers/worker-dispatcher.manager.d.ts +120 -0
  191. package/managers/worker-dispatcher.manager.js +1266 -0
  192. package/managers/worker-dispatcher.manager.js.map +1 -0
  193. package/managers/worker-server.manager.d.ts +35 -0
  194. package/managers/worker-server.manager.js +582 -0
  195. package/managers/worker-server.manager.js.map +1 -0
  196. package/methods/accounts.d.ts +2 -0
  197. package/methods/accounts.js +624 -0
  198. package/methods/accounts.js.map +1 -0
  199. package/methods/ai-terminal.d.ts +337 -0
  200. package/methods/ai-terminal.js +23166 -0
  201. package/methods/ai-terminal.js.map +1 -0
  202. package/methods/app-settings.d.ts +2 -0
  203. package/methods/app-settings.js +169 -0
  204. package/methods/app-settings.js.map +1 -0
  205. package/methods/aws.d.ts +2 -0
  206. package/methods/aws.js +877 -0
  207. package/methods/aws.js.map +1 -0
  208. package/methods/collections.d.ts +2 -0
  209. package/methods/collections.js +719 -0
  210. package/methods/collections.js.map +1 -0
  211. package/methods/counters.d.ts +2 -0
  212. package/methods/counters.js +113 -0
  213. package/methods/counters.js.map +1 -0
  214. package/methods/cron-jobs.d.ts +2 -0
  215. package/methods/cron-jobs.js +2475 -0
  216. package/methods/cron-jobs.js.map +1 -0
  217. package/methods/customer-notifications.d.ts +2 -0
  218. package/methods/customer-notifications.js +528 -0
  219. package/methods/customer-notifications.js.map +1 -0
  220. package/methods/diagnostics.d.ts +2 -0
  221. package/methods/diagnostics.js +703 -0
  222. package/methods/diagnostics.js.map +1 -0
  223. package/methods/flag-updates.d.ts +2 -0
  224. package/methods/flag-updates.js +8 -0
  225. package/methods/flag-updates.js.map +1 -0
  226. package/methods/flags.d.ts +2 -0
  227. package/methods/flags.js +8 -0
  228. package/methods/flags.js.map +1 -0
  229. package/methods/logs.d.ts +2 -0
  230. package/methods/logs.js +751 -0
  231. package/methods/logs.js.map +1 -0
  232. package/methods/mongo-explorer.d.ts +2 -0
  233. package/methods/mongo-explorer.js +1808 -0
  234. package/methods/mongo-explorer.js.map +1 -0
  235. package/methods/monitor.d.ts +2 -0
  236. package/methods/monitor.js +543 -0
  237. package/methods/monitor.js.map +1 -0
  238. package/methods/pdf.d.ts +2 -0
  239. package/methods/pdf.js +1216 -0
  240. package/methods/pdf.js.map +1 -0
  241. package/methods/publications.d.ts +1 -0
  242. package/methods/publications.js +183 -0
  243. package/methods/publications.js.map +1 -0
  244. package/methods/report-builder.d.ts +2 -0
  245. package/methods/report-builder.js +3094 -0
  246. package/methods/report-builder.js.map +1 -0
  247. package/methods/support.d.ts +2 -0
  248. package/methods/support.js +430 -0
  249. package/methods/support.js.map +1 -0
  250. package/models/ai-run.model.d.ts +19 -0
  251. package/models/ai-run.model.js +4 -0
  252. package/models/ai-run.model.js.map +1 -0
  253. package/models/ai-terminal-conversation.model.d.ts +17 -0
  254. package/models/ai-terminal-conversation.model.js +4 -0
  255. package/models/ai-terminal-conversation.model.js.map +1 -0
  256. package/models/ai-terminal-issue-report.model.d.ts +19 -0
  257. package/models/ai-terminal-issue-report.model.js +4 -0
  258. package/models/ai-terminal-issue-report.model.js.map +1 -0
  259. package/models/ai-terminal-message.model.d.ts +22 -0
  260. package/models/ai-terminal-message.model.js +4 -0
  261. package/models/ai-terminal-message.model.js.map +1 -0
  262. package/models/app-setting.model.d.ts +16 -0
  263. package/models/app-setting.model.js +4 -0
  264. package/models/app-setting.model.js.map +1 -0
  265. package/{src/models/app-status.model.ts → models/app-status.model.d.ts} +2 -3
  266. package/models/app-status.model.js +4 -0
  267. package/models/app-status.model.js.map +1 -0
  268. package/{src/models/billing-logged-in-users.model.ts → models/billing-logged-in-users.model.d.ts} +4 -5
  269. package/models/billing-logged-in-users.model.js +4 -0
  270. package/models/billing-logged-in-users.model.js.map +1 -0
  271. package/models/collection-document.model.d.ts +21 -0
  272. package/models/collection-document.model.js +4 -0
  273. package/models/collection-document.model.js.map +1 -0
  274. package/models/communication-metric.model.d.ts +20 -0
  275. package/models/communication-metric.model.js +4 -0
  276. package/models/communication-metric.model.js.map +1 -0
  277. package/{src/models/counter.model.ts → models/counter.model.d.ts} +3 -4
  278. package/models/counter.model.js +4 -0
  279. package/models/counter.model.js.map +1 -0
  280. package/models/cron-job-history.model.d.ts +15 -0
  281. package/models/cron-job-history.model.js +4 -0
  282. package/models/cron-job-history.model.js.map +1 -0
  283. package/models/cron-job.model.d.ts +14 -0
  284. package/models/cron-job.model.js +4 -0
  285. package/models/cron-job.model.js.map +1 -0
  286. package/models/customer-notification.model.d.ts +26 -0
  287. package/models/customer-notification.model.js +4 -0
  288. package/models/customer-notification.model.js.map +1 -0
  289. package/models/customer-portal-password.model.d.ts +11 -0
  290. package/models/customer-portal-password.model.js +4 -0
  291. package/models/customer-portal-password.model.js.map +1 -0
  292. package/models/dialog.model.d.ts +23 -0
  293. package/models/dialog.model.js +4 -0
  294. package/models/dialog.model.js.map +1 -0
  295. package/models/email-history.model.d.ts +32 -0
  296. package/{src/models/email-history.model.ts → models/email-history.model.js} +4 -36
  297. package/models/email-history.model.js.map +1 -0
  298. package/{src/models/email-verified.model.ts → models/email-verified.model.d.ts} +5 -6
  299. package/models/email-verified.model.js +4 -0
  300. package/models/email-verified.model.js.map +1 -0
  301. package/{src/models/file.model.ts → models/file.model.d.ts} +7 -8
  302. package/models/file.model.js +4 -0
  303. package/models/file.model.js.map +1 -0
  304. package/{src/models/flag-update.model.ts → models/flag-update.model.d.ts} +3 -4
  305. package/models/flag-update.model.js +4 -0
  306. package/models/flag-update.model.js.map +1 -0
  307. package/{src/models/flag.model.ts → models/flag.model.d.ts} +3 -4
  308. package/models/flag.model.js +4 -0
  309. package/models/flag.model.js.map +1 -0
  310. package/models/log-method-latency.model.d.ts +10 -0
  311. package/models/log-method-latency.model.js +4 -0
  312. package/models/log-method-latency.model.js.map +1 -0
  313. package/{src/models/log-subscription.model.ts → models/log-subscription.model.d.ts} +9 -11
  314. package/models/log-subscription.model.js +4 -0
  315. package/models/log-subscription.model.js.map +1 -0
  316. package/models/log.model.d.ts +17 -0
  317. package/models/log.model.js +4 -0
  318. package/models/log.model.js.map +1 -0
  319. package/{src/models/logged-in-users.model.ts → models/logged-in-users.model.d.ts} +5 -6
  320. package/models/logged-in-users.model.js +4 -0
  321. package/models/logged-in-users.model.js.map +1 -0
  322. package/{src/models/method-response.model.ts → models/method-response.model.d.ts} +6 -7
  323. package/models/method-response.model.js +4 -0
  324. package/models/method-response.model.js.map +1 -0
  325. package/models/method.model.d.ts +26 -0
  326. package/models/method.model.js +4 -0
  327. package/models/method.model.js.map +1 -0
  328. package/{src/models/monitor-cpu.model.ts → models/monitor-cpu.model.d.ts} +7 -9
  329. package/models/monitor-cpu.model.js +4 -0
  330. package/models/monitor-cpu.model.js.map +1 -0
  331. package/models/monitor-function.model.d.ts +14 -0
  332. package/models/monitor-function.model.js +4 -0
  333. package/models/monitor-function.model.js.map +1 -0
  334. package/models/monitor-memory.model.d.ts +15 -0
  335. package/models/monitor-memory.model.js +4 -0
  336. package/models/monitor-memory.model.js.map +1 -0
  337. package/models/monitor-mongo.model.d.ts +13 -0
  338. package/models/monitor-mongo.model.js +4 -0
  339. package/models/monitor-mongo.model.js.map +1 -0
  340. package/{src/models/notification.model.ts → models/notification.model.d.ts} +4 -6
  341. package/models/notification.model.js +4 -0
  342. package/models/notification.model.js.map +1 -0
  343. package/models/openai-usage-ledger.model.d.ts +15 -0
  344. package/models/openai-usage-ledger.model.js +4 -0
  345. package/models/openai-usage-ledger.model.js.map +1 -0
  346. package/models/pagination.model.d.ts +11 -0
  347. package/models/pagination.model.js +28 -0
  348. package/models/pagination.model.js.map +1 -0
  349. package/models/permission.model.d.ts +12 -0
  350. package/models/permission.model.js +4 -0
  351. package/models/permission.model.js.map +1 -0
  352. package/models/report-builder-dashboard-builder.model.d.ts +25 -0
  353. package/models/report-builder-dashboard-builder.model.js +4 -0
  354. package/models/report-builder-dashboard-builder.model.js.map +1 -0
  355. package/models/report-builder-library.model.d.ts +17 -0
  356. package/models/report-builder-library.model.js +4 -0
  357. package/models/report-builder-library.model.js.map +1 -0
  358. package/models/report-builder-report.model.d.ts +121 -0
  359. package/models/report-builder-report.model.js +4 -0
  360. package/models/report-builder-report.model.js.map +1 -0
  361. package/models/report-builder.model.d.ts +61 -0
  362. package/models/report-builder.model.js +4 -0
  363. package/models/report-builder.model.js.map +1 -0
  364. package/models/select-data-label.model.d.ts +9 -0
  365. package/models/select-data-label.model.js +4 -0
  366. package/models/select-data-label.model.js.map +1 -0
  367. package/models/server-message.model.d.ts +32 -0
  368. package/models/server-message.model.js +4 -0
  369. package/models/server-message.model.js.map +1 -0
  370. package/models/slow-query-report.model.d.ts +23 -0
  371. package/models/slow-query-report.model.js +4 -0
  372. package/models/slow-query-report.model.js.map +1 -0
  373. package/models/subscription.model.d.ts +31 -0
  374. package/models/subscription.model.js +4 -0
  375. package/models/subscription.model.js.map +1 -0
  376. package/models/support-ticket.model.d.ts +87 -0
  377. package/models/support-ticket.model.js +4 -0
  378. package/models/support-ticket.model.js.map +1 -0
  379. package/models/user-group.model.d.ts +20 -0
  380. package/models/user-group.model.js +4 -0
  381. package/models/user-group.model.js.map +1 -0
  382. package/{src/models/user-guide.model.ts → models/user-guide.model.d.ts} +4 -5
  383. package/models/user-guide.model.js +4 -0
  384. package/models/user-guide.model.js.map +1 -0
  385. package/models/user.model.d.ts +84 -0
  386. package/models/user.model.js +4 -0
  387. package/models/user.model.js.map +1 -0
  388. package/package.json +1 -1
  389. package/private/images/ResolveIO.png +0 -0
  390. package/public_api.js +125 -0
  391. package/public_api.js.map +1 -0
  392. package/publications/ai-terminal.d.ts +1 -0
  393. package/publications/ai-terminal.js +122 -0
  394. package/publications/ai-terminal.js.map +1 -0
  395. package/publications/app-settings.d.ts +2 -0
  396. package/publications/app-settings.js +28 -0
  397. package/publications/app-settings.js.map +1 -0
  398. package/publications/app-status.d.ts +2 -0
  399. package/publications/app-status.js +16 -0
  400. package/publications/app-status.js.map +1 -0
  401. package/publications/cron-jobs.d.ts +2 -0
  402. package/publications/cron-jobs.js +88 -0
  403. package/publications/cron-jobs.js.map +1 -0
  404. package/publications/customer-notifications.d.ts +2 -0
  405. package/publications/customer-notifications.js +161 -0
  406. package/publications/customer-notifications.js.map +1 -0
  407. package/publications/files.d.ts +2 -0
  408. package/publications/files.js +36 -0
  409. package/publications/files.js.map +1 -0
  410. package/publications/flags-update.d.ts +2 -0
  411. package/publications/flags-update.js +22 -0
  412. package/publications/flags-update.js.map +1 -0
  413. package/publications/flags.d.ts +2 -0
  414. package/publications/flags.js +22 -0
  415. package/publications/flags.js.map +1 -0
  416. package/publications/logs.d.ts +2 -0
  417. package/publications/logs.js +164 -0
  418. package/publications/logs.js.map +1 -0
  419. package/publications/notifications.d.ts +2 -0
  420. package/publications/notifications.js +16 -0
  421. package/publications/notifications.js.map +1 -0
  422. package/publications/report-builder-dashboard-builders.d.ts +2 -0
  423. package/publications/report-builder-dashboard-builders.js +42 -0
  424. package/publications/report-builder-dashboard-builders.js.map +1 -0
  425. package/publications/report-builder-libraries.d.ts +2 -0
  426. package/publications/report-builder-libraries.js +90 -0
  427. package/publications/report-builder-libraries.js.map +1 -0
  428. package/publications/report-builder-reports.d.ts +2 -0
  429. package/publications/report-builder-reports.js +50 -0
  430. package/publications/report-builder-reports.js.map +1 -0
  431. package/publications/super-admin.d.ts +2 -0
  432. package/publications/super-admin.js +16 -0
  433. package/publications/super-admin.js.map +1 -0
  434. package/publications/user-groups.d.ts +1 -0
  435. package/publications/user-groups.js +16 -0
  436. package/publications/user-groups.js.map +1 -0
  437. package/publications/user-guides.d.ts +1 -0
  438. package/publications/user-guides.js +16 -0
  439. package/publications/user-guides.js.map +1 -0
  440. package/resolveio-server-app.d.ts +70 -0
  441. package/resolveio-server-app.js +801 -0
  442. package/resolveio-server-app.js.map +1 -0
  443. package/server-app.d.ts +228 -0
  444. package/server-app.js +3566 -0
  445. package/server-app.js.map +1 -0
  446. package/services/codex-client.d.ts +128 -0
  447. package/services/codex-client.js +1629 -0
  448. package/services/codex-client.js.map +1 -0
  449. package/services/openai-client.d.ts +46 -0
  450. package/services/openai-client.js +318 -0
  451. package/services/openai-client.js.map +1 -0
  452. package/types/error-report.d.ts +25 -0
  453. package/types/error-report.js +4 -0
  454. package/types/error-report.js.map +1 -0
  455. package/types/slow-query-report.d.ts +27 -0
  456. package/types/slow-query-report.js +6 -0
  457. package/types/slow-query-report.js.map +1 -0
  458. package/util/ai-qa-policy.d.ts +124 -0
  459. package/util/ai-qa-policy.js +736 -0
  460. package/util/ai-qa-policy.js.map +1 -0
  461. package/util/ai-run-evidence-adapters.d.ts +33 -0
  462. package/util/ai-run-evidence-adapters.js +683 -0
  463. package/util/ai-run-evidence-adapters.js.map +1 -0
  464. package/util/ai-run-evidence-dashboard.d.ts +67 -0
  465. package/util/ai-run-evidence-dashboard.js +309 -0
  466. package/util/ai-run-evidence-dashboard.js.map +1 -0
  467. package/util/ai-run-evidence-eval.d.ts +86 -0
  468. package/util/ai-run-evidence-eval.js +854 -0
  469. package/util/ai-run-evidence-eval.js.map +1 -0
  470. package/util/ai-run-evidence.d.ts +212 -0
  471. package/util/ai-run-evidence.js +649 -0
  472. package/util/ai-run-evidence.js.map +1 -0
  473. package/util/ai-runner-artifacts.d.ts +82 -0
  474. package/util/ai-runner-artifacts.js +713 -0
  475. package/util/ai-runner-artifacts.js.map +1 -0
  476. package/util/ai-runner-qa-auth.d.ts +5 -0
  477. package/util/ai-runner-qa-auth.js +822 -0
  478. package/util/ai-runner-qa-auth.js.map +1 -0
  479. package/util/ai-runner-qa-tools.d.ts +26 -0
  480. package/util/ai-runner-qa-tools.js +3029 -0
  481. package/util/ai-runner-qa-tools.js.map +1 -0
  482. package/util/aicoder-runner-v6.d.ts +199 -0
  483. package/util/aicoder-runner-v6.js +421 -0
  484. package/util/aicoder-runner-v6.js.map +1 -0
  485. package/util/common.d.ts +31 -0
  486. package/util/common.js +683 -0
  487. package/util/common.js.map +1 -0
  488. package/util/customer-portal-password.d.ts +13 -0
  489. package/util/customer-portal-password.js +209 -0
  490. package/util/customer-portal-password.js.map +1 -0
  491. package/util/error-reporter.d.ts +52 -0
  492. package/util/error-reporter.js +326 -0
  493. package/util/error-reporter.js.map +1 -0
  494. package/util/error-tracking.d.ts +13 -0
  495. package/util/error-tracking.js +120 -0
  496. package/util/error-tracking.js.map +1 -0
  497. package/util/openai-usage-cost.d.ts +6 -0
  498. package/util/openai-usage-cost.js +103 -0
  499. package/util/openai-usage-cost.js.map +1 -0
  500. package/util/report-builder-unwinds.d.ts +15 -0
  501. package/util/report-builder-unwinds.js +156 -0
  502. package/util/report-builder-unwinds.js.map +1 -0
  503. package/util/runner-process-janitor.d.ts +27 -0
  504. package/util/runner-process-janitor.js +208 -0
  505. package/util/runner-process-janitor.js.map +1 -0
  506. package/util/schema-report-builder.d.ts +6 -0
  507. package/util/schema-report-builder.js +481 -0
  508. package/util/schema-report-builder.js.map +1 -0
  509. package/util/slow-query-reporter.d.ts +28 -0
  510. package/util/slow-query-reporter.js +226 -0
  511. package/util/slow-query-reporter.js.map +1 -0
  512. package/util/subscription-dependency-context.d.ts +34 -0
  513. package/util/subscription-dependency-context.js +1283 -0
  514. package/util/subscription-dependency-context.js.map +1 -0
  515. package/util/support-runner-v5.d.ts +374 -0
  516. package/util/support-runner-v5.js +1211 -0
  517. package/util/support-runner-v5.js.map +1 -0
  518. package/util/tokenizer.d.ts +5 -0
  519. package/util/tokenizer.js +41 -0
  520. package/util/tokenizer.js.map +1 -0
  521. package/workers/codex-runner.worker.d.ts +1 -0
  522. package/workers/codex-runner.worker.js +192 -0
  523. package/workers/codex-runner.worker.js.map +1 -0
  524. package/.nodemon.json +0 -5
  525. package/.vscode/settings.json +0 -21
  526. package/AGENTS.md +0 -195
  527. package/README.md +0 -22
  528. package/build_package.sh +0 -5
  529. package/compileDTS.pl +0 -64
  530. package/docs/ai-assistant-nightly-eval.md +0 -65
  531. package/docs/ai-assistant-preflight-checklist.md +0 -23
  532. package/docs/ai-assistant-report-builder-bridge-playbook.md +0 -115
  533. package/eslint-plugin-custom/index.js +0 -7
  534. package/eslint-plugin-custom/rules/no-filter-zero-index.js +0 -44
  535. package/eslint.config.js +0 -103
  536. package/gulpfile.js +0 -216
  537. package/methodAndPublicationListGenerator.py +0 -375
  538. package/mongodbensurers.js +0 -2
  539. package/mongostop.js +0 -3
  540. package/scripts/cleanup-bypassed-callmethod-logs.js +0 -616
  541. package/settings.development.json +0 -25
  542. package/settings.development.redacted.json +0 -25
  543. package/src/.env +0 -12
  544. package/src/ai/assistant-core-heuristics.ts +0 -379
  545. package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +0 -185
  546. package/src/ai/resolveio-platform-intelligence-memory.ts +0 -325
  547. package/src/ai/resolveio-platform-intelligence.ts +0 -462
  548. package/src/client-server-app.ts +0 -12
  549. package/src/collections/ai-run.collection.ts +0 -117
  550. package/src/collections/ai-terminal-conversation.collection.ts +0 -91
  551. package/src/collections/ai-terminal-issue-report.collection.ts +0 -99
  552. package/src/collections/ai-terminal-message.collection.ts +0 -77
  553. package/src/collections/app-setting.collection.ts +0 -104
  554. package/src/collections/app-status.collection.ts +0 -58
  555. package/src/collections/communication-metric.collection.ts +0 -84
  556. package/src/collections/counter.collection.ts +0 -56
  557. package/src/collections/cron-job-history.collection.ts +0 -94
  558. package/src/collections/cron-job.collection.ts +0 -92
  559. package/src/collections/customer-notification.collection.ts +0 -131
  560. package/src/collections/customer-portal-password.collection.ts +0 -76
  561. package/src/collections/email-history.collection.ts +0 -134
  562. package/src/collections/email-verified.collection.ts +0 -62
  563. package/src/collections/file.collection.ts +0 -74
  564. package/src/collections/flag-update.collection.ts +0 -57
  565. package/src/collections/flag.collection.ts +0 -57
  566. package/src/collections/log-method-latency.collection.ts +0 -77
  567. package/src/collections/log-subscription.collection.ts +0 -80
  568. package/src/collections/log.collection.ts +0 -93
  569. package/src/collections/logged-in-users.collection.ts +0 -67
  570. package/src/collections/monitor-cpu.collection.ts +0 -65
  571. package/src/collections/monitor-function.collection.ts +0 -74
  572. package/src/collections/monitor-memory.collection.ts +0 -77
  573. package/src/collections/monitor-mongo.collection.ts +0 -71
  574. package/src/collections/notification.collection.ts +0 -57
  575. package/src/collections/openai-usage-ledger.collection.ts +0 -77
  576. package/src/collections/report-builder-dashboard-builder.collection.ts +0 -109
  577. package/src/collections/report-builder-library.collection.ts +0 -89
  578. package/src/collections/report-builder-report.collection.ts +0 -184
  579. package/src/collections/user-group.collection.ts +0 -89
  580. package/src/collections/user-guide.collection.ts +0 -57
  581. package/src/collections/user.collection.ts +0 -181
  582. package/src/cron/cron.ts +0 -117
  583. package/src/fixtures/cron-jobs.ts +0 -95
  584. package/src/fixtures/init.ts +0 -35
  585. package/src/http/auth.ts +0 -818
  586. package/src/http/health.ts +0 -7
  587. package/src/http/home.ts +0 -90
  588. package/src/http/slow-query-publication.ts +0 -49
  589. package/src/index.ts +0 -1
  590. package/src/managers/ai-assistant-codex-manager.manager.ts +0 -1131
  591. package/src/managers/ai-run-evidence.manager.ts +0 -264
  592. package/src/managers/communication-metric.manager.ts +0 -82
  593. package/src/managers/cron.manager.ts +0 -333
  594. package/src/managers/customer-notification-content.manager.ts +0 -236
  595. package/src/managers/diagnostic-manager-bootstrap.ts +0 -165
  596. package/src/managers/error-auto-fix.manager.ts +0 -2767
  597. package/src/managers/local-log.manager.ts +0 -113
  598. package/src/managers/method.manager.ts +0 -1857
  599. package/src/managers/mongo.manager.ts +0 -4575
  600. package/src/managers/monitor.manager.ts +0 -507
  601. package/src/managers/openai-usage-ledger.manager.ts +0 -57
  602. package/src/managers/slow-query-verifier.manager.ts +0 -3590
  603. package/src/managers/slow-query.manager.ts +0 -519
  604. package/src/managers/subscription.manager.ts +0 -3128
  605. package/src/managers/websocket.manager.ts +0 -746
  606. package/src/managers/worker-dispatcher.manager.ts +0 -1360
  607. package/src/managers/worker-server.manager.ts +0 -536
  608. package/src/methods/accounts.ts +0 -532
  609. package/src/methods/ai-terminal.ts +0 -23497
  610. package/src/methods/app-settings.ts +0 -114
  611. package/src/methods/aws.ts +0 -649
  612. package/src/methods/collections.ts +0 -641
  613. package/src/methods/counters.ts +0 -69
  614. package/src/methods/cron-jobs.ts +0 -2614
  615. package/src/methods/customer-notifications.ts +0 -458
  616. package/src/methods/diagnostics.ts +0 -616
  617. package/src/methods/flag-updates.ts +0 -7
  618. package/src/methods/flags.ts +0 -7
  619. package/src/methods/logs.ts +0 -657
  620. package/src/methods/mongo-explorer.ts +0 -1880
  621. package/src/methods/monitor.ts +0 -540
  622. package/src/methods/pdf.ts +0 -1236
  623. package/src/methods/publications.ts +0 -129
  624. package/src/methods/report-builder.ts +0 -3300
  625. package/src/methods/support.ts +0 -335
  626. package/src/models/ai-run.model.ts +0 -27
  627. package/src/models/ai-terminal-conversation.model.ts +0 -19
  628. package/src/models/ai-terminal-issue-report.model.ts +0 -21
  629. package/src/models/ai-terminal-message.model.ts +0 -24
  630. package/src/models/app-setting.model.ts +0 -17
  631. package/src/models/collection-document.model.ts +0 -24
  632. package/src/models/communication-metric.model.ts +0 -23
  633. package/src/models/cron-job-history.model.ts +0 -16
  634. package/src/models/cron-job.model.ts +0 -15
  635. package/src/models/customer-notification.model.ts +0 -28
  636. package/src/models/customer-portal-password.model.ts +0 -12
  637. package/src/models/dialog.model.ts +0 -25
  638. package/src/models/log-method-latency.model.ts +0 -11
  639. package/src/models/log.model.ts +0 -19
  640. package/src/models/method.model.ts +0 -25
  641. package/src/models/monitor-function.model.ts +0 -16
  642. package/src/models/monitor-memory.model.ts +0 -17
  643. package/src/models/monitor-mongo.model.ts +0 -15
  644. package/src/models/openai-usage-ledger.model.ts +0 -16
  645. package/src/models/pagination.model.ts +0 -35
  646. package/src/models/permission.model.ts +0 -14
  647. package/src/models/report-builder-dashboard-builder.model.ts +0 -29
  648. package/src/models/report-builder-library.model.ts +0 -20
  649. package/src/models/report-builder-report.model.ts +0 -136
  650. package/src/models/report-builder.model.ts +0 -68
  651. package/src/models/select-data-label.model.ts +0 -9
  652. package/src/models/server-message.model.ts +0 -31
  653. package/src/models/slow-query-report.model.ts +0 -23
  654. package/src/models/subscription.model.ts +0 -73
  655. package/src/models/support-ticket.model.ts +0 -104
  656. package/src/models/user-group.model.ts +0 -24
  657. package/src/models/user.model.ts +0 -96
  658. package/src/private/images/ResolveIO.png +0 -0
  659. package/src/publications/ai-terminal.ts +0 -73
  660. package/src/publications/app-settings.ts +0 -25
  661. package/src/publications/app-status.ts +0 -13
  662. package/src/publications/cron-jobs.ts +0 -40
  663. package/src/publications/customer-notifications.ts +0 -101
  664. package/src/publications/files.ts +0 -33
  665. package/src/publications/flags-update.ts +0 -19
  666. package/src/publications/flags.ts +0 -19
  667. package/src/publications/logs.ts +0 -163
  668. package/src/publications/notifications.ts +0 -13
  669. package/src/publications/report-builder-dashboard-builders.ts +0 -39
  670. package/src/publications/report-builder-libraries.ts +0 -41
  671. package/src/publications/report-builder-reports.ts +0 -47
  672. package/src/publications/super-admin.ts +0 -13
  673. package/src/publications/user-groups.ts +0 -12
  674. package/src/publications/user-guides.ts +0 -12
  675. package/src/resolveio-server-app.ts +0 -617
  676. package/src/server-app.ts +0 -3354
  677. package/src/services/codex-client.ts +0 -1231
  678. package/src/services/openai-client.ts +0 -265
  679. package/src/types/error-report.ts +0 -26
  680. package/src/types/js-tiktoken.d.ts +0 -11
  681. package/src/types/slow-query-report.ts +0 -28
  682. package/src/util/ai-qa-policy.ts +0 -925
  683. package/src/util/ai-run-evidence-adapters.ts +0 -521
  684. package/src/util/ai-run-evidence-dashboard.ts +0 -271
  685. package/src/util/ai-run-evidence-eval.ts +0 -885
  686. package/src/util/ai-run-evidence.ts +0 -964
  687. package/src/util/ai-runner-artifacts.ts +0 -586
  688. package/src/util/ai-runner-qa-auth.ts +0 -821
  689. package/src/util/ai-runner-qa-tools.ts +0 -3045
  690. package/src/util/aicoder-runner-v6.ts +0 -526
  691. package/src/util/common.ts +0 -649
  692. package/src/util/customer-portal-password.ts +0 -183
  693. package/src/util/error-reporter.ts +0 -332
  694. package/src/util/error-tracking.ts +0 -79
  695. package/src/util/openai-usage-cost.ts +0 -114
  696. package/src/util/report-builder-unwinds.ts +0 -180
  697. package/src/util/runner-process-janitor.ts +0 -219
  698. package/src/util/schema-report-builder.ts +0 -448
  699. package/src/util/slow-query-reporter.ts +0 -216
  700. package/src/util/subscription-dependency-context.ts +0 -1096
  701. package/src/util/support-runner-v5.ts +0 -897
  702. package/src/util/tokenizer.ts +0 -38
  703. package/src/workers/codex-runner.worker.ts +0 -142
  704. package/start_server.sh +0 -5
  705. package/tests/ai-assistant-corpus-build.ts +0 -484
  706. package/tests/ai-assistant-corpus-replay-e2e.ts +0 -774
  707. package/tests/ai-assistant-data-parity-e2e.ts +0 -1989
  708. package/tests/ai-assistant-eval-triage.ts +0 -831
  709. package/tests/ai-assistant-openai-e2e.ts +0 -1061
  710. package/tests/ai-assistant-openai-git-e2e.ts +0 -155
  711. package/tests/ai-assistant-preflight-matrix.ts +0 -215
  712. package/tests/ai-assistant-routing-eval.test.ts +0 -560
  713. package/tests/ai-assistant-snf-live-eval.ts +0 -975
  714. package/tests/ai-assistant-utils.test.ts +0 -2968
  715. package/tests/ai-run-eval.test.ts +0 -88
  716. package/tests/ai-run-evidence.test.ts +0 -232
  717. package/tests/ai-runner-contract.test.ts +0 -488
  718. package/tests/aicoder-runner-v6.test.ts +0 -92
  719. package/tests/error-reporter.test.ts +0 -145
  720. package/tests/method-publication-generator.test.ts +0 -46
  721. package/tests/report-builder-linking.test.ts +0 -79
  722. package/tests/resolveio-platform-intelligence.test.ts +0 -352
  723. package/tests/server-app-cron-owner.test.ts +0 -127
  724. package/tests/subscription-connect-race.test.ts +0 -158
  725. package/tests/subscription-dependency-context.test.ts +0 -324
  726. package/tests/subscription-manager-collection-tracking.test.ts +0 -86
  727. package/tests/subscription-manager-invalidation.test.ts +0 -86
  728. package/tests/support-runner-v5.test.ts +0 -191
  729. package/tsconfig.json +0 -34
  730. /package/{src/private → private}/email-templates/enrollment.html +0 -0
  731. /package/{src/private → private}/email-templates/forgot-password.html +0 -0
  732. /package/{src/private → private}/email-templates/support-ticket-deleted.html +0 -0
  733. /package/{src/private → private}/email-templates/support-ticket-modified.html +0 -0
  734. /package/{src/private → private}/email-templates/support-ticket.html +0 -0
  735. /package/{src/public_api.ts → public_api.d.ts} +0 -0
@@ -0,0 +1,1211 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __values = (this && this.__values) || function(o) {
14
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
15
+ if (m) return m.call(o);
16
+ if (o && typeof o.length === "number") return {
17
+ next: function () {
18
+ if (o && i >= o.length) o = void 0;
19
+ return { value: o && o[i++], done: !o };
20
+ }
21
+ };
22
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
23
+ };
24
+ var __read = (this && this.__read) || function (o, n) {
25
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
26
+ if (!m) return o;
27
+ var i = m.call(o), r, ar = [], e;
28
+ try {
29
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
+ }
31
+ catch (error) { e = { error: error }; }
32
+ finally {
33
+ try {
34
+ if (r && !r.done && (m = i["return"])) m.call(i);
35
+ }
36
+ finally { if (e) throw e.error; }
37
+ }
38
+ return ar;
39
+ };
40
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
41
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
42
+ if (ar || !(i in from)) {
43
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44
+ ar[i] = from[i];
45
+ }
46
+ }
47
+ return to.concat(ar || Array.prototype.slice.call(from));
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.normalizeResolveIOSupportDiagnosisGate = normalizeResolveIOSupportDiagnosisGate;
51
+ exports.extractResolveIOSupportDiagnosisGateFromText = extractResolveIOSupportDiagnosisGateFromText;
52
+ exports.validateResolveIOSupportDiagnosisGate = validateResolveIOSupportDiagnosisGate;
53
+ exports.buildResolveIOSupportIssueClassProbes = buildResolveIOSupportIssueClassProbes;
54
+ exports.hashResolveIOSupportV5Evidence = hashResolveIOSupportV5Evidence;
55
+ exports.decideResolveIOSupportV5RepeatedFailureStop = decideResolveIOSupportV5RepeatedFailureStop;
56
+ exports.changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles = changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles;
57
+ exports.applyResolveIOSupportDiagnosisGateToMicrotasks = applyResolveIOSupportDiagnosisGateToMicrotasks;
58
+ exports.fingerprintResolveIOSupportV5Blocker = fingerprintResolveIOSupportV5Blocker;
59
+ exports.buildResolveIOSupportV5Budget = buildResolveIOSupportV5Budget;
60
+ exports.buildResolveIOSupportV5PromptBudget = buildResolveIOSupportV5PromptBudget;
61
+ exports.buildResolveIOSupportV5ScopeDigest = buildResolveIOSupportV5ScopeDigest;
62
+ exports.buildResolveIOSupportV5MicrotaskLedger = buildResolveIOSupportV5MicrotaskLedger;
63
+ exports.selectResolveIOSupportV5ActiveMicrotask = selectResolveIOSupportV5ActiveMicrotask;
64
+ exports.initializeResolveIOSupportV5State = initializeResolveIOSupportV5State;
65
+ exports.recordResolveIOSupportV5Step = recordResolveIOSupportV5Step;
66
+ exports.recordResolveIOSupportV5MicrotaskUsage = recordResolveIOSupportV5MicrotaskUsage;
67
+ exports.decideResolveIOSupportV5Continuation = decideResolveIOSupportV5Continuation;
68
+ exports.buildResolveIOSupportV5DiagnoseFirstPrompt = buildResolveIOSupportV5DiagnoseFirstPrompt;
69
+ exports.buildResolveIOSupportV5MicrotaskPrompt = buildResolveIOSupportV5MicrotaskPrompt;
70
+ exports.summarizeResolveIOSupportV5MicrotaskUsage = summarizeResolveIOSupportV5MicrotaskUsage;
71
+ exports.buildResolveIOSupportV5Incident = buildResolveIOSupportV5Incident;
72
+ function isoNow(value) {
73
+ if (value instanceof Date) {
74
+ return value.toISOString();
75
+ }
76
+ var parsed = value ? new Date(value) : new Date();
77
+ if (Number.isFinite(parsed.getTime())) {
78
+ return parsed.toISOString();
79
+ }
80
+ return new Date().toISOString();
81
+ }
82
+ function cleanText(value, max) {
83
+ if (max === void 0) { max = 2000; }
84
+ return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
85
+ }
86
+ function cleanList(values, limit, max) {
87
+ var e_1, _a;
88
+ if (limit === void 0) { limit = 20; }
89
+ if (max === void 0) { max = 500; }
90
+ if (!Array.isArray(values)) {
91
+ return [];
92
+ }
93
+ var result = [];
94
+ try {
95
+ for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
96
+ var value = values_1_1.value;
97
+ var normalized = cleanText(value, max);
98
+ if (normalized && !result.includes(normalized)) {
99
+ result.push(normalized);
100
+ }
101
+ if (result.length >= limit) {
102
+ break;
103
+ }
104
+ }
105
+ }
106
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
107
+ finally {
108
+ try {
109
+ if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
110
+ }
111
+ finally { if (e_1) throw e_1.error; }
112
+ }
113
+ return result;
114
+ }
115
+ function cleanObject(value) {
116
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
117
+ }
118
+ function pickText(source, fields, max) {
119
+ var e_2, _a;
120
+ if (max === void 0) { max = 1000; }
121
+ try {
122
+ for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
123
+ var field = fields_1_1.value;
124
+ var normalized = cleanText(source === null || source === void 0 ? void 0 : source[field], max);
125
+ if (normalized) {
126
+ return normalized;
127
+ }
128
+ }
129
+ }
130
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
131
+ finally {
132
+ try {
133
+ if (fields_1_1 && !fields_1_1.done && (_a = fields_1.return)) _a.call(fields_1);
134
+ }
135
+ finally { if (e_2) throw e_2.error; }
136
+ }
137
+ return '';
138
+ }
139
+ function normalizeIssueClass(value) {
140
+ var normalized = cleanText(value, 80)
141
+ .toLowerCase()
142
+ .replace(/[\s-]+/g, '_');
143
+ var aliases = {
144
+ no_op: 'no_op_submit',
145
+ no_op_submit: 'no_op_submit',
146
+ submit_noop: 'no_op_submit',
147
+ missing_data: 'missing_wrong_data',
148
+ wrong_data: 'missing_wrong_data',
149
+ missing_wrong_data: 'missing_wrong_data',
150
+ filter_mismatch: 'filter_query_mismatch',
151
+ query_mismatch: 'filter_query_mismatch',
152
+ filter_query_mismatch: 'filter_query_mismatch',
153
+ invoice_pdf_export: 'invoice_pdf_export',
154
+ pdf_export: 'invoice_pdf_export',
155
+ export: 'invoice_pdf_export',
156
+ upload: 'upload_import',
157
+ import: 'upload_import',
158
+ upload_import: 'upload_import',
159
+ route_auth: 'route_auth_hydration',
160
+ auth_hydration: 'route_auth_hydration',
161
+ route_auth_hydration: 'route_auth_hydration',
162
+ slow_query: 'slow_query_performance',
163
+ performance: 'slow_query_performance',
164
+ slow_query_performance: 'slow_query_performance'
165
+ };
166
+ return aliases[normalized] || '';
167
+ }
168
+ function normalizeReproductionStatus(value) {
169
+ var normalized = cleanText(value, 80).toLowerCase();
170
+ if (/blocked|unable|cannot/.test(normalized)) {
171
+ return 'blocked';
172
+ }
173
+ if (/classif|triag|inferred/.test(normalized)) {
174
+ return 'classified';
175
+ }
176
+ return 'reproduced';
177
+ }
178
+ function normalizeSupportDiagnosisEvidence(values) {
179
+ var allowed = new Set(['ticket', 'browser', 'mongo', 'log', 'code', 'commit', 'qa', 'other']);
180
+ if (!Array.isArray(values)) {
181
+ var summary = cleanText(values, 1200);
182
+ return summary ? [{ type: 'other', summary: summary }] : [];
183
+ }
184
+ var stringEvidence = values
185
+ .filter(function (entry) { return typeof entry === 'string'; })
186
+ .map(function (entry) { return ({
187
+ type: 'other',
188
+ summary: cleanText(entry, 1200)
189
+ }); });
190
+ var objectEvidence = values
191
+ .filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); })
192
+ .map(function (entry) {
193
+ var type = cleanText(entry.type, 80).toLowerCase();
194
+ return {
195
+ type: (allowed.has(type) ? type : 'other'),
196
+ summary: cleanText(entry.summary || entry.message || entry.evidence || entry.reason, 1200),
197
+ artifactPath: cleanText(entry.artifactPath || entry.path || entry.file, 500)
198
+ };
199
+ });
200
+ return stringEvidence.concat(objectEvidence)
201
+ .filter(function (entry) { return entry.summary; })
202
+ .slice(0, 20);
203
+ }
204
+ function normalizeSupportDiagnosisHints(values) {
205
+ return (Array.isArray(values) ? values : [])
206
+ .map(function (entry) {
207
+ if (typeof entry === 'string') {
208
+ return { reason: cleanText(entry, 500) };
209
+ }
210
+ var value = cleanObject(entry);
211
+ return {
212
+ id: cleanText(value.id || value._id, 160),
213
+ ticketNumber: cleanText(value.ticketNumber || value.ticket_number || value.sourceTicketNumber, 80),
214
+ title: cleanText(value.title || value.summary, 300),
215
+ outcome: cleanText(value.outcome || value.status, 80),
216
+ issueClass: cleanText(value.issueClass || value.issue_class, 80),
217
+ ownerFiles: cleanList(value.ownerFiles || value.owner_files || value.files, 8, 240),
218
+ commitSha: cleanText(value.commitSha || value.commit_sha, 80),
219
+ commitMessage: cleanText(value.commitMessage || value.commit_message, 300),
220
+ reason: cleanText(value.reason || value.matchReason || value.match_reason, 500)
221
+ };
222
+ })
223
+ .filter(function (entry) { return entry.id || entry.ticketNumber || entry.title || entry.reason || entry.commitSha; })
224
+ .slice(0, 8);
225
+ }
226
+ function normalizeOwnerFilePath(value) {
227
+ return cleanText(value, 500)
228
+ .replace(/\\/g, '/')
229
+ .replace(/^\.\/+/, '')
230
+ .replace(/^\/+/, '')
231
+ .replace(/\s+$/g, '');
232
+ }
233
+ function ownerFileLooksBroad(value) {
234
+ var normalized = normalizeOwnerFilePath(value);
235
+ return !normalized
236
+ || normalized.includes('*')
237
+ || normalized.endsWith('/')
238
+ || !/\.[a-z0-9]+$/i.test(normalized)
239
+ || /^(\.|src|server|angular|client|app|lib|packages?)$/i.test(normalized)
240
+ || /(^|\/)(node_modules|dist|build|coverage|\.git)(\/|$)/i.test(normalized);
241
+ }
242
+ function normalizeResolveIOSupportDiagnosisGate(value, now) {
243
+ var source = cleanObject(value);
244
+ if (!Object.keys(source).length) {
245
+ return undefined;
246
+ }
247
+ var issueCaseSource = cleanObject(source.issue_case || source.issueCase);
248
+ var hypothesisSource = cleanObject(source.accepted_hypothesis || source.acceptedHypothesis);
249
+ var failingPathSource = cleanObject(source.failing_path || source.failingPath);
250
+ var proofPlanSource = cleanObject(source.proof_plan || source.proofPlan);
251
+ var issueClass = normalizeIssueClass(source.issue_class || source.issueClass);
252
+ var ownerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
253
+ .map(normalizeOwnerFilePath)
254
+ .filter(Boolean);
255
+ var gate = {
256
+ issue_case: {
257
+ customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200),
258
+ expected_result: pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000),
259
+ observed_result: pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000),
260
+ route_module: pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500),
261
+ account_customer_context: pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800),
262
+ reproduction_status: normalizeReproductionStatus(issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status),
263
+ reproduction_blocker: pickText(issueCaseSource, ['reproduction_blocker', 'reproductionBlocker', 'blocked_reason', 'blockedReason'], 1000)
264
+ },
265
+ issue_class: issueClass || 'missing_wrong_data',
266
+ accepted_hypothesis: {
267
+ statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'summary'], 1200)
268
+ || (typeof source.accepted_hypothesis === 'string' ? cleanText(source.accepted_hypothesis, 1200) : ''),
269
+ falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000),
270
+ evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
271
+ },
272
+ rejected_alternatives: cleanList(source.rejected_alternatives || source.rejectedAlternatives, 10, 700),
273
+ failing_path: {
274
+ frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath'], 700),
275
+ backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath'], 700),
276
+ shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'library', 'lib'], 700),
277
+ data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query'], 700),
278
+ description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || cleanText(source.failing_path, 1200)
279
+ },
280
+ owner_files: ownerFiles,
281
+ proof_plan: {
282
+ before: pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000),
283
+ before_state_unavailable_reason: pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000),
284
+ action: pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000),
285
+ after: pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000),
286
+ business_assertion: pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000),
287
+ route: pickText(proofPlanSource, ['route', 'url'], 500),
288
+ data_assertion: pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000),
289
+ artifact_expectation: pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000)
290
+ },
291
+ similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
292
+ similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
293
+ evidence: normalizeSupportDiagnosisEvidence(source.evidence),
294
+ status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
295
+ updatedAt: isoNow(now || source.updatedAt || source.updated_at)
296
+ };
297
+ if (!['missing', 'incomplete', 'blocked', 'passed'].includes(gate.status)) {
298
+ gate.status = 'incomplete';
299
+ }
300
+ return gate;
301
+ }
302
+ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
303
+ var e_3, _a;
304
+ var text = String(value || '').trim();
305
+ if (!text) {
306
+ return undefined;
307
+ }
308
+ var candidates = [];
309
+ var fenced = Array.from(text.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi)).map(function (match) { return match[1]; });
310
+ candidates.push.apply(candidates, __spreadArray([], __read(fenced), false));
311
+ var jsonBlock = text.match(/\{[\s\S]*\}/);
312
+ if (jsonBlock) {
313
+ candidates.push(jsonBlock[0]);
314
+ }
315
+ try {
316
+ for (var candidates_1 = __values(candidates), candidates_1_1 = candidates_1.next(); !candidates_1_1.done; candidates_1_1 = candidates_1.next()) {
317
+ var candidate = candidates_1_1.value;
318
+ try {
319
+ var parsed = JSON.parse(candidate);
320
+ var wrapped = (parsed === null || parsed === void 0 ? void 0 : parsed.support_diagnosis_gate) || (parsed === null || parsed === void 0 ? void 0 : parsed.supportDiagnosisGate) || (parsed === null || parsed === void 0 ? void 0 : parsed.diagnosis_gate) || (parsed === null || parsed === void 0 ? void 0 : parsed.diagnosisGate) || parsed;
321
+ var normalized = normalizeResolveIOSupportDiagnosisGate(wrapped, now);
322
+ if (normalized) {
323
+ return normalized;
324
+ }
325
+ }
326
+ catch (_b) {
327
+ // Continue trying less exact JSON candidates.
328
+ }
329
+ }
330
+ }
331
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
332
+ finally {
333
+ try {
334
+ if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
335
+ }
336
+ finally { if (e_3) throw e_3.error; }
337
+ }
338
+ return undefined;
339
+ }
340
+ function validateResolveIOSupportDiagnosisGate(value, options) {
341
+ if (options === void 0) { options = {}; }
342
+ var normalized = normalizeResolveIOSupportDiagnosisGate(value);
343
+ if (!normalized) {
344
+ return { valid: false, status: 'missing', blockers: ['SupportDiagnosisGate is missing.'] };
345
+ }
346
+ var blockers = [];
347
+ var maxOwnerFiles = Math.max(1, Number(options.maxOwnerFiles || 8) || 8);
348
+ if (!normalized.issue_case.customer_complaint) {
349
+ blockers.push('Diagnosis issue_case.customer_complaint is required.');
350
+ }
351
+ if (!normalized.issue_case.expected_result) {
352
+ blockers.push('Diagnosis issue_case.expected_result is required.');
353
+ }
354
+ if (!normalized.issue_case.observed_result) {
355
+ blockers.push('Diagnosis issue_case.observed_result is required.');
356
+ }
357
+ if (!normalized.issue_case.route_module) {
358
+ blockers.push('Diagnosis issue_case.route_module is required.');
359
+ }
360
+ if (!normalized.issue_case.account_customer_context) {
361
+ blockers.push('Diagnosis issue_case.account_customer_context is required.');
362
+ }
363
+ if (normalized.issue_case.reproduction_status === 'blocked' && !normalized.issue_case.reproduction_blocker) {
364
+ blockers.push('Diagnosis blocked reproduction requires issue_case.reproduction_blocker.');
365
+ }
366
+ if (!normalizeIssueClass(normalized.issue_class)) {
367
+ blockers.push('Diagnosis issue_class must be one of the supported issue-class probes.');
368
+ }
369
+ if (!normalized.accepted_hypothesis.statement) {
370
+ blockers.push('Diagnosis accepted_hypothesis.statement is required.');
371
+ }
372
+ if (!normalized.accepted_hypothesis.falsifiable_test) {
373
+ blockers.push('Diagnosis accepted_hypothesis.falsifiable_test is required.');
374
+ }
375
+ if (!normalized.accepted_hypothesis.evidence.length) {
376
+ blockers.push('Diagnosis accepted_hypothesis.evidence must cite proof.');
377
+ }
378
+ if (!normalized.rejected_alternatives.length) {
379
+ blockers.push('Diagnosis rejected_alternatives must include at least one rejected theory.');
380
+ }
381
+ if (!normalized.failing_path.description
382
+ && !normalized.failing_path.frontend
383
+ && !normalized.failing_path.backend
384
+ && !normalized.failing_path.shared_library
385
+ && !normalized.failing_path.data_query) {
386
+ blockers.push('Diagnosis failing_path must identify frontend, backend, query, shared library, or path description.');
387
+ }
388
+ if (!normalized.owner_files.length) {
389
+ blockers.push('Diagnosis owner_files must contain the small editable file set.');
390
+ }
391
+ if (normalized.owner_files.length > maxOwnerFiles) {
392
+ blockers.push("Diagnosis owner_files has ".concat(normalized.owner_files.length, " entries; maximum is ").concat(maxOwnerFiles, "."));
393
+ }
394
+ var broadFiles = normalized.owner_files.filter(ownerFileLooksBroad);
395
+ if (broadFiles.length) {
396
+ blockers.push("Diagnosis owner_files contains broad or unsafe path(s): ".concat(broadFiles.join(', '), "."));
397
+ }
398
+ if (!normalized.proof_plan.before && !normalized.proof_plan.before_state_unavailable_reason) {
399
+ blockers.push('Diagnosis proof_plan.before is required unless proof_plan.before_state_unavailable_reason explains why before-state proof is impossible.');
400
+ }
401
+ if (!normalized.proof_plan.action) {
402
+ blockers.push('Diagnosis proof_plan.action is required.');
403
+ }
404
+ if (!normalized.proof_plan.after) {
405
+ blockers.push('Diagnosis proof_plan.after is required.');
406
+ }
407
+ if (!normalized.proof_plan.business_assertion) {
408
+ blockers.push('Diagnosis proof_plan.business_assertion is required.');
409
+ }
410
+ if (!normalized.evidence.length) {
411
+ blockers.push('Diagnosis evidence must include ticket/code/browser/log/Mongo proof.');
412
+ }
413
+ normalized.status = blockers.length ? 'incomplete' : 'passed';
414
+ return {
415
+ valid: blockers.length === 0,
416
+ status: normalized.status,
417
+ blockers: blockers,
418
+ normalized: normalized
419
+ };
420
+ }
421
+ function buildResolveIOSupportIssueClassProbes(value) {
422
+ var validation = validateResolveIOSupportDiagnosisGate(value);
423
+ var gate = validation.normalized || normalizeResolveIOSupportDiagnosisGate(value);
424
+ if (!gate) {
425
+ return [];
426
+ }
427
+ var route = gate.proof_plan.route || gate.issue_case.route_module;
428
+ var proof = gate.proof_plan.business_assertion;
429
+ var common = {
430
+ issue_class: gate.issue_class,
431
+ probe_type: 'issue_class_probe',
432
+ route: route,
433
+ blocks_acceptance_without_business_assertion: true
434
+ };
435
+ var map = {
436
+ no_op_submit: {
437
+ action: "Submit the customer action on ".concat(route || 'the affected screen', " and assert a persisted state change or explicit validation message."),
438
+ expected: proof || 'Before/action/after proof shows the submit is no longer a no-op.'
439
+ },
440
+ missing_wrong_data: {
441
+ action: "Load the named record/list on ".concat(route || 'the affected route', " and compare visible data to the expected persisted source."),
442
+ expected: proof || 'Visible data and persisted data match the customer expectation.'
443
+ },
444
+ filter_query_mismatch: {
445
+ action: 'Apply the reported filter/query inputs and assert the returned rows/counts match the expected dataset.',
446
+ expected: proof || 'Filter/query output contains the correct included rows and excludes the wrong rows.'
447
+ },
448
+ invoice_pdf_export: {
449
+ action: 'Generate the invoice/PDF/export from the affected route and inspect the downloaded/generated artifact.',
450
+ expected: proof || 'Generated artifact contains the expected customer-visible rows, totals, or fields.'
451
+ },
452
+ upload_import: {
453
+ action: 'Run the upload/import workflow with a representative file and assert parsed plus persisted results.',
454
+ expected: proof || 'Import shows a success result and persisted rows/counts changed as expected.'
455
+ },
456
+ route_auth_hydration: {
457
+ action: 'Open the route as the affected user and assert authenticated hydration reaches the functional screen, not a shell.',
458
+ expected: proof || 'Route hydrates with the required controls/data for the affected account.'
459
+ },
460
+ slow_query_performance: {
461
+ action: 'Run the reported query/workflow with timing/log evidence before and after the fix.',
462
+ expected: proof || 'Performance evidence shows the slow path improved without changing results.'
463
+ }
464
+ };
465
+ var selected = map[gate.issue_class];
466
+ return [__assign(__assign({}, common), { objective: "Issue-class probe for ".concat(gate.issue_class, ": ").concat(gate.issue_case.customer_complaint), action: selected.action, expected_evidence: selected.expected })];
467
+ }
468
+ function hashResolveIOSupportV5Evidence(value) {
469
+ var raw = typeof value === 'string' ? value : JSON.stringify(value || {});
470
+ var normalized = cleanText(raw, 8000)
471
+ .toLowerCase()
472
+ .replace(/[a-f0-9]{16,}/g, '<id>')
473
+ .replace(/\b\d{2,}\b/g, '<n>');
474
+ var hash = 0;
475
+ for (var index = 0; index < normalized.length; index += 1) {
476
+ hash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;
477
+ }
478
+ return "ev-".concat(Math.abs(hash).toString(36) || '0');
479
+ }
480
+ function decideResolveIOSupportV5RepeatedFailureStop(input) {
481
+ var failureClass = cleanText(input.failureClass || 'unknown', 80).toLowerCase();
482
+ var blockerFingerprint = fingerprintResolveIOSupportV5Blocker(input.blocker || '');
483
+ var evidenceHash = cleanText(input.evidenceHash, 80) || hashResolveIOSupportV5Evidence(input.evidence || input.blocker || '');
484
+ var limit = Math.max(1, Number(input.limit || 2) || 2);
485
+ if (input.ignoreInfra !== false && /^(infra|compile)$/.test(failureClass)) {
486
+ return {
487
+ shouldStop: false,
488
+ repeatedCount: 0,
489
+ failureClass: failureClass,
490
+ blockerFingerprint: blockerFingerprint,
491
+ evidenceHash: evidenceHash,
492
+ reason: 'support_v5_infra_failures_do_not_count_as_product_repair_loops'
493
+ };
494
+ }
495
+ var repeatedCount = 0;
496
+ for (var index = (input.history || []).length - 1; index >= 0; index -= 1) {
497
+ var item = input.history[index];
498
+ if (item.outcome === 'pass' || item.outcome === 'ready_for_merge') {
499
+ break;
500
+ }
501
+ var itemFailureClass = cleanText(item.failureClass || 'unknown', 80).toLowerCase();
502
+ var itemBlockerFingerprint = cleanText(item.blockerFingerprint, 80)
503
+ || fingerprintResolveIOSupportV5Blocker(item.blocker || item.summary || '');
504
+ var itemEvidenceHash = cleanText(item.evidenceHash, 80)
505
+ || hashResolveIOSupportV5Evidence(item.artifactPaths || item.blocker || item.summary || '');
506
+ if (itemFailureClass !== failureClass || itemBlockerFingerprint !== blockerFingerprint || itemEvidenceHash !== evidenceHash) {
507
+ break;
508
+ }
509
+ repeatedCount += 1;
510
+ }
511
+ return {
512
+ shouldStop: repeatedCount >= limit,
513
+ repeatedCount: repeatedCount,
514
+ failureClass: failureClass,
515
+ blockerFingerprint: blockerFingerprint,
516
+ evidenceHash: evidenceHash,
517
+ reason: repeatedCount >= limit
518
+ ? 'support_v5_same_failure_class_without_new_evidence'
519
+ : 'support_v5_retry_allowed_new_or_below_repeat_limit'
520
+ };
521
+ }
522
+ function changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles(diagnosisGate, changedFiles, options) {
523
+ if (options === void 0) { options = {}; }
524
+ var validation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
525
+ if (!validation.valid || !validation.normalized) {
526
+ return cleanList(changedFiles, 80, 500);
527
+ }
528
+ var owners = new Set(validation.normalized.owner_files.map(normalizeOwnerFilePath));
529
+ return cleanList(changedFiles, 120, 500)
530
+ .map(normalizeOwnerFilePath)
531
+ .filter(function (filePath) {
532
+ if (!filePath) {
533
+ return false;
534
+ }
535
+ if (owners.has(filePath)) {
536
+ return false;
537
+ }
538
+ if (options.allowTests && /(^|\/)(tests?|spec|__tests__)(\/|$)|\.(?:spec|test)\.[jt]sx?$/i.test(filePath)) {
539
+ return false;
540
+ }
541
+ return true;
542
+ });
543
+ }
544
+ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
545
+ var validation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
546
+ var gate = validation.normalized;
547
+ if (!gate) {
548
+ return bundle;
549
+ }
550
+ var ownerFiles = gate.owner_files;
551
+ var probes = buildResolveIOSupportIssueClassProbes(gate);
552
+ var now = isoNow();
553
+ var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) {
554
+ var _a;
555
+ if (task.type === 'diagnosis_gate') {
556
+ return __assign(__assign({}, task), { status: validation.valid ? 'pass' : 'needs_repair', blocker: validation.valid ? '' : validation.blockers.join(' | '), updatedAt: now });
557
+ }
558
+ if (task.lane === 'build' && /repair|product_repair|build_repair/i.test(String(task.type || ''))) {
559
+ return __assign(__assign({}, task), { targetFiles: ownerFiles, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'owner_files'], false))), selfGate: "Repair only the diagnosed owner files unless you revise the diagnosis with new evidence. Owner files: ".concat(ownerFiles.join(', '), "."), acceptanceProof: gate.proof_plan.business_assertion, dependsOn: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.dependsOn || [])), false), [stableIdFromText('diagnosis', bundle.supportV5ScopeDigest || gate.issue_case.customer_complaint)], false))), updatedAt: now });
560
+ }
561
+ if (task.lane === 'qa' && task.type === 'qa_row') {
562
+ return __assign(__assign({}, task), { contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'proof_plan'], false))), selfGate: ((_a = probes[0]) === null || _a === void 0 ? void 0 : _a.action) || task.selfGate, acceptanceProof: gate.proof_plan.business_assertion || task.acceptanceProof, targetFiles: ownerFiles, updatedAt: now });
563
+ }
564
+ return task;
565
+ });
566
+ var nextActive = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
567
+ return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
568
+ bundle.supportV5LaneMemory.build.scopeSummary,
569
+ "Diagnosis issue class: ".concat(gate.issue_class),
570
+ "Accepted hypothesis: ".concat(gate.accepted_hypothesis.statement),
571
+ "Owner files: ".concat(ownerFiles.join(', '))
572
+ ].filter(Boolean).join(' | '), updatedAt: now }), qa: __assign(__assign({}, bundle.supportV5LaneMemory.qa), { activeQaRow: {
573
+ workflow: gate.proof_plan.business_assertion,
574
+ route: gate.proof_plan.route || gate.issue_case.route_module,
575
+ assertion: gate.proof_plan.after,
576
+ status: 'pending'
577
+ }, updatedAt: now }) }) });
578
+ }
579
+ function stableIdFromText(prefix, value) {
580
+ var text = cleanText(value, 2000).toLowerCase();
581
+ var hash = 0;
582
+ for (var index = 0; index < text.length; index += 1) {
583
+ hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
584
+ }
585
+ return "".concat(prefix, "-").concat(Math.abs(hash).toString(36) || '0');
586
+ }
587
+ function estimateTextTokens(value) {
588
+ var text = String(value || '');
589
+ if (!text) {
590
+ return 0;
591
+ }
592
+ return Math.max(1, Math.ceil(text.length / 4));
593
+ }
594
+ function fingerprintResolveIOSupportV5Blocker(value) {
595
+ var text = cleanText(value, 4000)
596
+ .toLowerCase()
597
+ .replace(/[a-f0-9]{16,}/g, '<id>')
598
+ .replace(/\b\d{2,}\b/g, '<n>')
599
+ .replace(/\bline\s+<n>\b/g, 'line <n>');
600
+ var hash = 0;
601
+ for (var index = 0; index < text.length; index += 1) {
602
+ hash = ((hash << 5) - hash + text.charCodeAt(index)) | 0;
603
+ }
604
+ return "v5-".concat(Math.abs(hash).toString(36));
605
+ }
606
+ function buildResolveIOSupportV5Budget(existing) {
607
+ return {
608
+ maxPromptTokensPerNonInitialStep: Number((existing === null || existing === void 0 ? void 0 : existing.maxPromptTokensPerNonInitialStep) || 1800),
609
+ maxLoopsPerTicket: Number((existing === null || existing === void 0 ? void 0 : existing.maxLoopsPerTicket) || 24),
610
+ maxRepeatedNoProgress: Number((existing === null || existing === void 0 ? void 0 : existing.maxRepeatedNoProgress) || 2),
611
+ maxRuntimeMinutesPerLoop: Number((existing === null || existing === void 0 ? void 0 : existing.maxRuntimeMinutesPerLoop) || 15),
612
+ totalPromptTokenEstimate: Number((existing === null || existing === void 0 ? void 0 : existing.totalPromptTokenEstimate) || 0),
613
+ totalRuntimeMs: Number((existing === null || existing === void 0 ? void 0 : existing.totalRuntimeMs) || 0),
614
+ loopCount: Number((existing === null || existing === void 0 ? void 0 : existing.loopCount) || 0)
615
+ };
616
+ }
617
+ function buildResolveIOSupportV5PromptBudget(existing) {
618
+ return {
619
+ initialPlannerCap: Number((existing === null || existing === void 0 ? void 0 : existing.initialPlannerCap) || 6000),
620
+ buildMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.buildMicrotaskCap) || 1800),
621
+ buildMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.buildMicrotaskHardCap) || 2500),
622
+ qaMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.qaMicrotaskCap) || 1500),
623
+ qaMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.qaMicrotaskHardCap) || 2200),
624
+ repairMicrotaskCap: Number((existing === null || existing === void 0 ? void 0 : existing.repairMicrotaskCap) || 1200),
625
+ repairMicrotaskHardCap: Number((existing === null || existing === void 0 ? void 0 : existing.repairMicrotaskHardCap) || 1800)
626
+ };
627
+ }
628
+ function buildResolveIOSupportV5ScopeDigest(input) {
629
+ var scope = Array.isArray(input.approvedScope)
630
+ ? cleanList(input.approvedScope, 30, 220).join(' | ')
631
+ : cleanText(input.approvedScope, 4000);
632
+ var raw = [
633
+ input.goal ? "Goal: ".concat(cleanText(input.goal, 300)) : '',
634
+ scope ? "Approved scope: ".concat(scope) : '',
635
+ input.prBranch ? "PR branch: ".concat(cleanText(input.prBranch, 160)) : ''
636
+ ].filter(Boolean).join('\n');
637
+ var maxChars = Math.max(400, Math.floor(Number(input.maxTokens || 1000) * 4));
638
+ return raw.slice(0, maxChars);
639
+ }
640
+ function buildResolveIOSupportV5MicrotaskLedger(input) {
641
+ var e_4, _a;
642
+ var existing = Array.isArray(input.existing) ? input.existing : [];
643
+ var completedByObjective = new Map();
644
+ try {
645
+ for (var existing_1 = __values(existing), existing_1_1 = existing_1.next(); !existing_1_1.done; existing_1_1 = existing_1.next()) {
646
+ var task = existing_1_1.value;
647
+ if (task && (task.status === 'pass' || task.status === 'parked')) {
648
+ completedByObjective.set(cleanText(task.objective, 500).toLowerCase(), task);
649
+ }
650
+ }
651
+ }
652
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
653
+ finally {
654
+ try {
655
+ if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
656
+ }
657
+ finally { if (e_4) throw e_4.error; }
658
+ }
659
+ var now = isoNow(input.now);
660
+ var requirements = cleanList(input.requirements, 30, 240);
661
+ var sourceRequirements = requirements.length
662
+ ? requirements
663
+ : cleanText(input.scopeDigest, 1000).split(/\s+\|\s+|\r?\n/g).map(function (line) { return line.trim(); }).filter(Boolean).slice(0, 12);
664
+ var ledger = [];
665
+ var diagnosisObjective = "Root-cause-first diagnosis gate for: ".concat(cleanText(input.scopeDigest, 360) || 'support ticket');
666
+ var diagnosisId = stableIdFromText('diagnosis', diagnosisObjective);
667
+ var existingDiagnosis = existing.find(function (task) { return (task === null || task === void 0 ? void 0 : task.type) === 'diagnosis_gate' || (task === null || task === void 0 ? void 0 : task.microtaskId) === diagnosisId; });
668
+ ledger.push(existingDiagnosis && (existingDiagnosis.status === 'pass' || existingDiagnosis.status === 'parked') ? existingDiagnosis : {
669
+ microtaskId: diagnosisId,
670
+ lane: 'build',
671
+ type: 'diagnosis_gate',
672
+ status: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.status) || 'pending',
673
+ objective: diagnosisObjective,
674
+ targetFiles: [],
675
+ contextRefs: ['scope_digest', 'support_context', 'similar_tickets', 'similar_commits'],
676
+ selfGate: 'Read-only diagnosis only: reproduce or explicitly classify the issue, accept one falsifiable root-cause hypothesis, reject alternatives, identify the failing path, cap owner_files, and define before/action/after business proof.',
677
+ acceptanceProof: 'Valid ResolveIOSupportDiagnosisGate JSON with issue_case, issue_class, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, proof_plan, evidence, and status=passed.',
678
+ threadKey: input.buildThreadKey,
679
+ promptTokenEstimate: existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.promptTokenEstimate,
680
+ attempts: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.attempts) || 0,
681
+ dependsOn: [],
682
+ parentScopeId: stableIdFromText('scope', diagnosisObjective),
683
+ blocker: existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.blocker,
684
+ createdAt: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.createdAt) || now,
685
+ updatedAt: (existingDiagnosis === null || existingDiagnosis === void 0 ? void 0 : existingDiagnosis.updatedAt) || now
686
+ });
687
+ sourceRequirements.forEach(function (requirement, index) {
688
+ var objective = cleanText(requirement, 240);
689
+ if (!objective) {
690
+ return;
691
+ }
692
+ var existingCompleted = completedByObjective.get(objective.toLowerCase());
693
+ var buildId = stableIdFromText("build-".concat(index + 1), objective);
694
+ var qaId = stableIdFromText("qa-".concat(index + 1), objective);
695
+ ledger.push(existingCompleted && existingCompleted.lane === 'build' ? existingCompleted : {
696
+ microtaskId: buildId,
697
+ lane: 'build',
698
+ type: 'build_repair',
699
+ status: 'pending',
700
+ objective: objective,
701
+ targetFiles: [],
702
+ contextRefs: ['scope_digest'],
703
+ selfGate: 'Run the smallest compile/type/unit check that proves this one behavior.',
704
+ acceptanceProof: 'Concrete code/data proof for this behavior, with changed files listed.',
705
+ threadKey: input.buildThreadKey,
706
+ attempts: 0,
707
+ dependsOn: [diagnosisId],
708
+ parentScopeId: stableIdFromText('scope', objective),
709
+ createdAt: now,
710
+ updatedAt: now
711
+ });
712
+ ledger.push({
713
+ microtaskId: qaId,
714
+ lane: 'qa',
715
+ type: 'qa_row',
716
+ status: 'pending',
717
+ objective: "QA proof for: ".concat(objective),
718
+ targetFiles: [],
719
+ contextRefs: ['scope_digest', buildId],
720
+ selfGate: 'Drive this one customer-facing workflow row in browser/localhost and capture one captioned proof artifact.',
721
+ acceptanceProof: 'QA matrix row pass with route/data assertion, screenshot/caption artifact, and persisted before/after row/count/value proof for data-changing workflows.',
722
+ threadKey: input.qaThreadKey,
723
+ attempts: 0,
724
+ dependsOn: [diagnosisId, buildId],
725
+ parentScopeId: stableIdFromText('scope', objective),
726
+ createdAt: now,
727
+ updatedAt: now
728
+ });
729
+ });
730
+ return ledger.length ? ledger : existing.slice(-80);
731
+ }
732
+ function selectResolveIOSupportV5ActiveMicrotask(ledger, preferredId) {
733
+ if (ledger === void 0) { ledger = []; }
734
+ var byPreferred = preferredId ? ledger.find(function (task) { return task.microtaskId === preferredId && !['pass', 'parked'].includes(task.status); }) : undefined;
735
+ if (byPreferred) {
736
+ return byPreferred;
737
+ }
738
+ return ledger.find(function (task) { return task.status === 'needs_repair'; })
739
+ || ledger.find(function (task) { return task.status === 'in_progress'; })
740
+ || ledger.find(function (task) { return task.lane === 'build' && /repair/i.test(String(task.type || '')) && task.status === 'pending'; })
741
+ || ledger.find(function (task) { return task.status === 'pending'; })
742
+ || ledger.find(function (task) { return task.status === 'blocked'; });
743
+ }
744
+ function initializeResolveIOSupportV5State(input) {
745
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
746
+ var now = isoNow(input.now);
747
+ var existing = input.existing || {};
748
+ var existingSupervisor = existing.supportV5SupervisorState;
749
+ var existingLaneMemory = existing.supportV5LaneMemory || {};
750
+ var scope = cleanList(input.approvedScopeRequirements, 24, 240).join(' | ')
751
+ || cleanText(input.description, 1000)
752
+ || cleanText(input.title, 300);
753
+ var ticketLabel = cleanText(input.ticketNumber || input.ticketId || input.jobId, 120);
754
+ var buildThreadKey = cleanText(input.buildThreadKey || ((_a = existingLaneMemory.build) === null || _a === void 0 ? void 0 : _a.threadKey) || "support:".concat(input.ticketId || input.jobId, ":job:").concat(input.jobId, ":build"), 240);
755
+ var qaThreadKey = cleanText(input.qaThreadKey || ((_b = existingLaneMemory.qa) === null || _b === void 0 ? void 0 : _b.threadKey) || "support:".concat(input.ticketId || input.jobId, ":job:").concat(input.jobId, ":qa"), 240);
756
+ var budget = buildResolveIOSupportV5Budget(existing.supportV5Budget);
757
+ var existingDiagnosisGate = normalizeResolveIOSupportDiagnosisGate(existing.supportV5DiagnosisGate);
758
+ var diagnosisValidation = validateResolveIOSupportDiagnosisGate(existingDiagnosisGate);
759
+ var scopeDigest = cleanText(existing.supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
760
+ goal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
761
+ approvedScope: scope,
762
+ prBranch: input.prBranch || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.prBranch) || ''
763
+ });
764
+ var ledger = buildResolveIOSupportV5MicrotaskLedger({
765
+ scopeDigest: scopeDigest,
766
+ requirements: cleanList(input.approvedScopeRequirements, 30, 240),
767
+ buildThreadKey: buildThreadKey,
768
+ qaThreadKey: qaThreadKey,
769
+ now: now,
770
+ existing: existing.supportV5MicrotaskLedger
771
+ });
772
+ var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, existing.supportV5ActiveMicrotaskId);
773
+ var initialized = {
774
+ supportWorkflowVersion: 'v5',
775
+ supportV5SupervisorState: {
776
+ version: 'v5',
777
+ status: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.status) || 'active',
778
+ currentGoal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
779
+ approvedScope: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.approvedScope) || scope,
780
+ prBranch: cleanText(input.prBranch || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.prBranch) || '', 240),
781
+ activeStep: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeStep) || (diagnosisValidation.valid ? 'compile_check' : 'diagnosis_gate'),
782
+ activeBlocker: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.activeBlocker) || (diagnosisValidation.valid ? '' : 'SupportDiagnosisGate required before product-code repair.'),
783
+ lastGoodCheckpoint: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.lastGoodCheckpoint) || 'v5_initialized',
784
+ currentQaRow: existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentQaRow,
785
+ processLease: input.processLease || (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.processLease),
786
+ artifactLinks: cleanList(existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.artifactLinks, 40, 500),
787
+ noEmailUnlessApproved: true,
788
+ updatedAt: now
789
+ },
790
+ supportV5DiagnosisGate: diagnosisValidation.valid ? diagnosisValidation.normalized : existingDiagnosisGate,
791
+ supportV5LaneMemory: {
792
+ build: {
793
+ lane: 'build',
794
+ model: ((_c = existingLaneMemory.build) === null || _c === void 0 ? void 0 : _c.model) || 'gpt-5.3-codex',
795
+ threadKey: buildThreadKey,
796
+ scopeSummary: ((_d = existingLaneMemory.build) === null || _d === void 0 ? void 0 : _d.scopeSummary) || scope,
797
+ activeBlocker: ((_e = existingLaneMemory.build) === null || _e === void 0 ? void 0 : _e.activeBlocker) || '',
798
+ activeQaRow: (_f = existingLaneMemory.build) === null || _f === void 0 ? void 0 : _f.activeQaRow,
799
+ changedFiles: cleanList((_g = existingLaneMemory.build) === null || _g === void 0 ? void 0 : _g.changedFiles, 80, 500),
800
+ artifactPaths: cleanList((_h = existingLaneMemory.build) === null || _h === void 0 ? void 0 : _h.artifactPaths, 80, 500),
801
+ latestPromptTokenEstimate: Number(((_j = existingLaneMemory.build) === null || _j === void 0 ? void 0 : _j.latestPromptTokenEstimate) || 0) || undefined,
802
+ updatedAt: ((_k = existingLaneMemory.build) === null || _k === void 0 ? void 0 : _k.updatedAt) || now
803
+ },
804
+ qa: {
805
+ lane: 'qa',
806
+ model: ((_l = existingLaneMemory.qa) === null || _l === void 0 ? void 0 : _l.model) || 'gpt-5.4-mini',
807
+ threadKey: qaThreadKey,
808
+ scopeSummary: ((_m = existingLaneMemory.qa) === null || _m === void 0 ? void 0 : _m.scopeSummary) || scope,
809
+ activeBlocker: ((_o = existingLaneMemory.qa) === null || _o === void 0 ? void 0 : _o.activeBlocker) || '',
810
+ activeQaRow: (_p = existingLaneMemory.qa) === null || _p === void 0 ? void 0 : _p.activeQaRow,
811
+ changedFiles: cleanList((_q = existingLaneMemory.qa) === null || _q === void 0 ? void 0 : _q.changedFiles, 80, 500),
812
+ artifactPaths: cleanList((_r = existingLaneMemory.qa) === null || _r === void 0 ? void 0 : _r.artifactPaths, 80, 500),
813
+ latestPromptTokenEstimate: Number(((_s = existingLaneMemory.qa) === null || _s === void 0 ? void 0 : _s.latestPromptTokenEstimate) || 0) || undefined,
814
+ updatedAt: ((_t = existingLaneMemory.qa) === null || _t === void 0 ? void 0 : _t.updatedAt) || now
815
+ }
816
+ },
817
+ supportV5StepHistory: Array.isArray(existing.supportV5StepHistory)
818
+ ? existing.supportV5StepHistory.slice(-80)
819
+ : [],
820
+ supportV5Budget: budget,
821
+ supportV5RunnerIncidents: Array.isArray(existing.supportV5RunnerIncidents)
822
+ ? existing.supportV5RunnerIncidents.slice(-80)
823
+ : [],
824
+ supportV5MicrotaskLedger: ledger,
825
+ supportV5ActiveMicrotaskId: diagnosisValidation.valid
826
+ ? activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId
827
+ : ((_u = ledger.find(function (task) { return task.type === 'diagnosis_gate' && !['pass', 'parked'].includes(task.status); })) === null || _u === void 0 ? void 0 : _u.microtaskId) || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.microtaskId),
828
+ supportV5ScopeDigest: scopeDigest,
829
+ supportV5MicrotaskUsageHistory: Array.isArray(existing.supportV5MicrotaskUsageHistory)
830
+ ? existing.supportV5MicrotaskUsageHistory.slice(-200)
831
+ : [],
832
+ supportV5FailureFingerprints: Array.isArray(existing.supportV5FailureFingerprints)
833
+ ? existing.supportV5FailureFingerprints.slice(-200)
834
+ : []
835
+ };
836
+ return diagnosisValidation.valid && diagnosisValidation.normalized
837
+ ? applyResolveIOSupportDiagnosisGateToMicrotasks(initialized, diagnosisValidation.normalized)
838
+ : initialized;
839
+ }
840
+ function recordResolveIOSupportV5Step(bundle, step) {
841
+ var _a, _b, _c, _d;
842
+ var now = isoNow(step.now);
843
+ var promptTokens = Math.max(0, Number(step.promptTokenEstimate || 0) || 0);
844
+ var runtimeMs = Math.max(0, Number(step.runtimeMs || 0) || 0);
845
+ var microtaskId = cleanText(step.microtaskId || bundle.supportV5ActiveMicrotaskId, 160);
846
+ var normalizedDiagnosisGate = step.diagnosisGate
847
+ ? normalizeResolveIOSupportDiagnosisGate(step.diagnosisGate, now)
848
+ : undefined;
849
+ var blockerFingerprint = step.blocker || step.summary
850
+ ? fingerprintResolveIOSupportV5Blocker(step.blocker || step.summary || '')
851
+ : undefined;
852
+ var evidenceHash = cleanText(step.evidenceHash, 80)
853
+ || (((_a = step.artifactPaths) === null || _a === void 0 ? void 0 : _a.length) || step.blocker || step.summary
854
+ ? hashResolveIOSupportV5Evidence(((_b = step.artifactPaths) === null || _b === void 0 ? void 0 : _b.length) ? step.artifactPaths : "".concat(step.blocker || '', "\n").concat(step.summary || ''))
855
+ : undefined);
856
+ var record = __assign(__assign({}, (microtaskId ? { microtaskId: microtaskId } : {})), { stepType: step.stepType, outcome: step.outcome, lane: step.lane, model: cleanText(step.model, 80), threadKey: cleanText(step.threadKey, 240), promptTokenEstimate: promptTokens || undefined, runtimeMs: runtimeMs || undefined, summary: cleanText(step.summary || step.blocker || step.outcome, 1200), blocker: cleanText(step.blocker, 1200), changedFiles: cleanList(step.changedFiles, 80, 500), artifactPaths: cleanList(step.artifactPaths, 80, 500), diagnosisGate: normalizedDiagnosisGate, failureClass: cleanText(step.failureClass, 80) || undefined, blockerFingerprint: blockerFingerprint, evidenceHash: evidenceHash, recordedAt: now });
857
+ var diagnosisGate = normalizedDiagnosisGate || bundle.supportV5DiagnosisGate;
858
+ var laneMemory = __assign({}, bundle.supportV5LaneMemory);
859
+ if (step.lane === 'build' || step.lane === 'qa') {
860
+ var previous = laneMemory[step.lane];
861
+ laneMemory[step.lane] = __assign(__assign({}, previous), { activeBlocker: record.blocker || previous.activeBlocker || '', activeQaRow: step.activeQaRow || previous.activeQaRow, changedFiles: ((_c = record.changedFiles) === null || _c === void 0 ? void 0 : _c.length) ? record.changedFiles : previous.changedFiles, artifactPaths: ((_d = record.artifactPaths) === null || _d === void 0 ? void 0 : _d.length) ? record.artifactPaths : previous.artifactPaths, latestPromptTokenEstimate: promptTokens || previous.latestPromptTokenEstimate, updatedAt: now });
862
+ }
863
+ var supervisor = __assign(__assign({}, bundle.supportV5SupervisorState), { status: step.outcome === 'ready_for_merge' ? 'complete' : (step.outcome === 'park_manual' || step.outcome === 'budget_stop' ? 'parked' : 'active'), activeStep: step.stepType, activeBlocker: record.blocker || '', currentQaRow: step.activeQaRow || bundle.supportV5SupervisorState.currentQaRow, lastGoodCheckpoint: step.outcome === 'pass' || step.outcome === 'ready_for_merge'
864
+ ? step.stepType
865
+ : bundle.supportV5SupervisorState.lastGoodCheckpoint, artifactLinks: Array.from(new Set(__spreadArray(__spreadArray([], __read(bundle.supportV5SupervisorState.artifactLinks), false), __read((record.artifactPaths || [])), false))).slice(-80), updatedAt: now });
866
+ var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) {
867
+ if (task.microtaskId !== bundle.supportV5ActiveMicrotaskId) {
868
+ return task;
869
+ }
870
+ var status = step.outcome === 'pass' || step.outcome === 'ready_for_merge'
871
+ ? 'pass'
872
+ : step.outcome === 'park_manual' || step.outcome === 'budget_stop'
873
+ ? 'parked'
874
+ : step.outcome === 'needs_repair' || step.outcome === 'retry_same_step'
875
+ ? 'needs_repair'
876
+ : 'in_progress';
877
+ return __assign(__assign({}, task), { status: status, blocker: record.blocker || task.blocker, promptTokenEstimate: promptTokens || task.promptTokenEstimate, attempts: task.attempts + (step.outcome === 'pass' || step.outcome === 'ready_for_merge' ? 0 : 1), updatedAt: now });
878
+ });
879
+ var failureFingerprint = record.failureClass && record.blockerFingerprint && record.evidenceHash
880
+ ? {
881
+ stepType: record.stepType,
882
+ failureClass: cleanText(record.failureClass, 80),
883
+ blockerFingerprint: record.blockerFingerprint,
884
+ evidenceHash: record.evidenceHash,
885
+ recordedAt: now
886
+ }
887
+ : undefined;
888
+ var nextMicrotask = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
889
+ var nextBundle = __assign(__assign({}, bundle), { supportV5SupervisorState: supervisor, supportV5DiagnosisGate: diagnosisGate, supportV5LaneMemory: laneMemory, supportV5StepHistory: __spreadArray(__spreadArray([], __read(bundle.supportV5StepHistory), false), [record], false).slice(-100), supportV5Budget: __assign(__assign({}, bundle.supportV5Budget), { totalPromptTokenEstimate: bundle.supportV5Budget.totalPromptTokenEstimate + promptTokens, totalRuntimeMs: bundle.supportV5Budget.totalRuntimeMs + runtimeMs, loopCount: bundle.supportV5Budget.loopCount + 1 }), supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextMicrotask === null || nextMicrotask === void 0 ? void 0 : nextMicrotask.microtaskId, supportV5MicrotaskUsageHistory: bundle.supportV5MicrotaskUsageHistory || [], supportV5FailureFingerprints: failureFingerprint
890
+ ? __spreadArray(__spreadArray([], __read((bundle.supportV5FailureFingerprints || [])), false), [failureFingerprint], false).slice(-200)
891
+ : (bundle.supportV5FailureFingerprints || []) });
892
+ if (normalizedDiagnosisGate && validateResolveIOSupportDiagnosisGate(normalizedDiagnosisGate).valid) {
893
+ return applyResolveIOSupportDiagnosisGateToMicrotasks(nextBundle, normalizedDiagnosisGate);
894
+ }
895
+ return nextBundle;
896
+ }
897
+ function recordResolveIOSupportV5MicrotaskUsage(bundle, usage) {
898
+ var record = __assign(__assign({}, usage), { microtaskId: cleanText(usage.microtaskId, 160), threadKey: cleanText(usage.threadKey, 240), model: cleanText(usage.model, 80), promptTokenEstimate: Math.max(0, Number(usage.promptTokenEstimate || 0) || 0), promptSections: Array.isArray(usage.promptSections)
899
+ ? usage.promptSections.map(function (section) { return ({
900
+ name: cleanText(section.name, 120),
901
+ tokenEstimate: Math.max(0, Number(section.tokenEstimate || 0) || 0)
902
+ }); }).filter(function (section) { return section.name; })
903
+ : [], recordedAt: isoNow() });
904
+ var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) { return task.microtaskId === record.microtaskId
905
+ ? __assign(__assign({}, task), { promptTokenEstimate: record.promptTokenEstimate, updatedAt: record.recordedAt }) : task; });
906
+ return __assign(__assign({}, bundle), { supportV5MicrotaskLedger: ledger, supportV5MicrotaskUsageHistory: __spreadArray(__spreadArray([], __read((bundle.supportV5MicrotaskUsageHistory || [])), false), [
907
+ record
908
+ ], false).slice(-200) });
909
+ }
910
+ function decideResolveIOSupportV5Continuation(bundle) {
911
+ var history = bundle.supportV5StepHistory || [];
912
+ var budget = buildResolveIOSupportV5Budget(bundle.supportV5Budget);
913
+ var last = history[history.length - 1];
914
+ var activeMicrotaskId = cleanText(bundle.supportV5ActiveMicrotaskId, 160);
915
+ var blockerFingerprint = fingerprintResolveIOSupportV5Blocker((last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary) || '');
916
+ var repeatedNoProgressCount = 0;
917
+ for (var index = history.length - 1; index >= 0; index -= 1) {
918
+ var item = history[index];
919
+ if (activeMicrotaskId && cleanText(item.microtaskId, 160) !== activeMicrotaskId) {
920
+ continue;
921
+ }
922
+ if (item.outcome === 'pass' || item.outcome === 'ready_for_merge') {
923
+ break;
924
+ }
925
+ if (item.stepType !== (last === null || last === void 0 ? void 0 : last.stepType)) {
926
+ break;
927
+ }
928
+ if (fingerprintResolveIOSupportV5Blocker(item.blocker || item.summary || '') === blockerFingerprint) {
929
+ repeatedNoProgressCount += 1;
930
+ }
931
+ }
932
+ var budgetExceeded = budget.loopCount >= budget.maxLoopsPerTicket
933
+ || ((last === null || last === void 0 ? void 0 : last.promptTokenEstimate) || 0) > budget.maxPromptTokensPerNonInitialStep;
934
+ var repeatedFailure = last ? decideResolveIOSupportV5RepeatedFailureStop({
935
+ history: history,
936
+ failureClass: last.failureClass,
937
+ blocker: last.blocker || last.summary,
938
+ evidenceHash: last.evidenceHash,
939
+ limit: budget.maxRepeatedNoProgress,
940
+ ignoreInfra: true
941
+ }) : null;
942
+ if (budgetExceeded) {
943
+ return {
944
+ action: 'park',
945
+ reason: 'support_v5_budget_guard',
946
+ nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
947
+ repeatedNoProgressCount: repeatedNoProgressCount,
948
+ budgetExceeded: budgetExceeded
949
+ };
950
+ }
951
+ if (repeatedNoProgressCount > budget.maxRepeatedNoProgress) {
952
+ return {
953
+ action: 'park',
954
+ reason: 'support_v5_repeated_no_progress',
955
+ nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
956
+ repeatedNoProgressCount: repeatedNoProgressCount,
957
+ budgetExceeded: budgetExceeded
958
+ };
959
+ }
960
+ if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
961
+ return {
962
+ action: 'park',
963
+ reason: repeatedFailure.reason,
964
+ nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
965
+ repeatedNoProgressCount: repeatedFailure.repeatedCount,
966
+ budgetExceeded: budgetExceeded
967
+ };
968
+ }
969
+ return {
970
+ action: 'continue',
971
+ reason: 'support_v5_continue',
972
+ nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep,
973
+ repeatedNoProgressCount: repeatedNoProgressCount,
974
+ budgetExceeded: false
975
+ };
976
+ }
977
+ function buildResolveIOSupportV5DiagnoseFirstPrompt(lines) {
978
+ var _a, _b;
979
+ return [
980
+ 'Support Runner V5 contract: act like a guarded autonomous engineer, not a gate checklist.',
981
+ 'Start with Diagnose First: observed evidence, likely cause, smallest next action, and expected proof.',
982
+ 'Use compact lane memory and current artifacts before asking for broad ticket context.',
983
+ 'Do not send customer email. Do not write production data. Do not spawn duplicate build, QA, server, client, Mongo, browser, or Codex processes.',
984
+ 'If repairing, inspect logs/artifacts/source/diff first; make the smallest code or localhost-data change, then run the smallest finite self-gate.',
985
+ 'For build repairs, prefer `npm run build-prod -- --watch=false`, a targeted `tsc --noEmit`, or a focused unit test. `npm run build-dev` is forbidden for support microtasks because it is slow/watch-oriented and can leave heavy esbuild work. If no finite gate exists, return a blocked self-gate with the exact reason instead of running build-dev.',
986
+ 'If QA fails, retest the failed row before advancing; if the same blocker repeats without new proof, park with the exact blocker.',
987
+ lines.goal ? "Goal: ".concat(cleanText(lines.goal, 500)) : '',
988
+ cleanList(lines.approvedScope, 12, 240).length ? "Approved scope: ".concat(cleanList(lines.approvedScope, 12, 240).join(' | ')) : '',
989
+ lines.activeStep ? "Active step: ".concat(lines.activeStep) : '',
990
+ lines.lane ? "Lane: ".concat(lines.lane) : '',
991
+ lines.laneSummary ? "Lane memory: ".concat(cleanText(lines.laneSummary, 700)) : '',
992
+ lines.activeBlocker ? "Active blocker: ".concat(cleanText(lines.activeBlocker, 800)) : '',
993
+ ((_a = lines.currentQaRow) === null || _a === void 0 ? void 0 : _a.workflow) ? "Current QA row: ".concat(cleanText(lines.currentQaRow.workflow, 300)) : '',
994
+ ((_b = lines.currentQaRow) === null || _b === void 0 ? void 0 : _b.route) ? "Current QA route: ".concat(cleanText(lines.currentQaRow.route, 300)) : '',
995
+ cleanList(lines.changedFiles, 12, 200).length ? "Changed files: ".concat(cleanList(lines.changedFiles, 12, 200).join(', ')) : '',
996
+ cleanList(lines.artifactPaths, 12, 240).length ? "Artifacts: ".concat(cleanList(lines.artifactPaths, 12, 240).join(', ')) : ''
997
+ ].filter(Boolean);
998
+ }
999
+ function buildResolveIOSupportV5MicrotaskPrompt(input) {
1000
+ var _a, _b, _c;
1001
+ var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(input.bundle.supportV5MicrotaskLedger || [], input.bundle.supportV5ActiveMicrotaskId);
1002
+ var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.bundle.supportV5DiagnosisGate);
1003
+ var diagnosisGate = diagnosisValidation.normalized || input.bundle.supportV5DiagnosisGate;
1004
+ var diagnosisActive = (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) === 'diagnosis_gate';
1005
+ var budget = buildResolveIOSupportV5PromptBudget();
1006
+ var repairLike = Boolean(input.failureText || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.status) === 'needs_repair' || /repair/i.test(String(input.stage || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.type) || '')));
1007
+ var cap = repairLike
1008
+ ? budget.repairMicrotaskCap
1009
+ : input.lane === 'qa'
1010
+ ? budget.qaMicrotaskCap
1011
+ : budget.buildMicrotaskCap;
1012
+ var hardCap = repairLike
1013
+ ? budget.repairMicrotaskHardCap
1014
+ : input.lane === 'qa'
1015
+ ? budget.qaMicrotaskHardCap
1016
+ : budget.buildMicrotaskHardCap;
1017
+ var laneMemory = input.bundle.supportV5LaneMemory[input.lane];
1018
+ var taskThreadKey = (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.threadKey) || laneMemory.threadKey;
1019
+ var changedFiles = cleanList(((_a = input.changedFiles) === null || _a === void 0 ? void 0 : _a.length) ? input.changedFiles : laneMemory.changedFiles, 8, 160);
1020
+ var artifactPaths = cleanList(((_b = input.artifactPaths) === null || _b === void 0 ? void 0 : _b.length) ? input.artifactPaths : laneMemory.artifactPaths, 8, 200);
1021
+ var targetFiles = cleanList(((_c = input.targetFiles) === null || _c === void 0 ? void 0 : _c.length) ? input.targetFiles : activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.targetFiles, 5, 160);
1022
+ var contextSnippets = cleanList(input.contextSnippets, 5, 360);
1023
+ var qaRow = input.activeQaRow || (activeMicrotask === null || activeMicrotask === void 0 ? void 0 : activeMicrotask.lane) === 'qa'
1024
+ ? input.activeQaRow || laneMemory.activeQaRow || input.bundle.supportV5SupervisorState.currentQaRow
1025
+ : undefined;
1026
+ var sections = [
1027
+ {
1028
+ name: 'microtask_contract',
1029
+ text: [
1030
+ 'Support Runner V5 Microtask Contract.',
1031
+ 'Use the existing persistent lane thread. Do not start a fresh thread.',
1032
+ 'Do exactly one microtask and one proof gate. Do not replay ticket triage, prior plans, attachments, broad QA checklist, or unrelated scope.',
1033
+ 'If context is insufficient, request the smallest missing file/log/artifact by path and park this microtask; do not broaden the prompt.',
1034
+ 'Do not send customer email. Do not deploy. Do not spawn duplicate server/client/Mongo/browser/Codex processes.',
1035
+ diagnosisActive
1036
+ ? 'Diagnosis gate hard boundary: read-only investigation only. Do not edit source, generated files, package files, tests, fixtures, QA artifacts, or local data. Return the diagnosis JSON contract only.'
1037
+ : input.lane === 'qa'
1038
+ ? 'QA lane hard boundary: the platform preflight owns compile, dependency install, Mongo/server/client startup, and Angular startup. This lane owns only browser/data proof and QA artifacts unless the prompt explicitly says preflight was skipped.'
1039
+ : 'Build lane hard boundary: do not run `npm run build-dev`, `ng build`, `npm run server`, `npm run client`, `ng serve`, `run-local-qa.sh`, browser automation, or any watch/long-lived command. If a broad compile gate is needed, run only `npm run build-prod -- --watch=false`; otherwise use a targeted finite check or return the precise blocker.'
1040
+ ].join('\n')
1041
+ },
1042
+ diagnosisActive ? {
1043
+ name: 'root_cause_first_diagnosis_contract',
1044
+ text: [
1045
+ 'Before any product-code repair, produce strict JSON only:',
1046
+ '{"support_diagnosis_gate":{"issue_case":{"customer_complaint":"","expected_result":"","observed_result":"","route_module":"","account_customer_context":"","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":""},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"","falsifiable_test":"","evidence":[""]},"rejected_alternatives":[""],"failing_path":{"frontend":"","backend":"","shared_library":"","data_query":"","description":""},"owner_files":["small/exact/file.ts"],"proof_plan":{"before":"","before_state_unavailable_reason":"","action":"","after":"","business_assertion":"","route":"","data_assertion":"","artifact_expectation":""},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"","artifactPath":""}],"status":"passed"}}',
1047
+ 'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
1048
+ 'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
1049
+ 'The proof plan must be before/action/after business proof. If before-state proof is impossible, explain exactly why in before_state_unavailable_reason.'
1050
+ ].join('\n')
1051
+ } : {
1052
+ name: 'diagnosis_gate_context',
1053
+ text: diagnosisValidation.valid && diagnosisGate ? [
1054
+ "Diagnosis issue class: ".concat(diagnosisGate.issue_class),
1055
+ "Accepted hypothesis: ".concat(diagnosisGate.accepted_hypothesis.statement),
1056
+ "Failing path: ".concat(diagnosisGate.failing_path.description || diagnosisGate.failing_path.frontend || diagnosisGate.failing_path.backend || ''),
1057
+ "Owner files: ".concat(diagnosisGate.owner_files.join(', ')),
1058
+ "Business proof required: ".concat(diagnosisGate.proof_plan.business_assertion),
1059
+ "Before/action/after: ".concat(diagnosisGate.proof_plan.before || diagnosisGate.proof_plan.before_state_unavailable_reason, " -> ").concat(diagnosisGate.proof_plan.action, " -> ").concat(diagnosisGate.proof_plan.after)
1060
+ ].filter(Boolean).join('\n') : 'SupportDiagnosisGate is not valid. Park instead of editing product code.'
1061
+ },
1062
+ {
1063
+ name: 'scope_digest',
1064
+ text: cleanText(input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.approvedScope, 900)
1065
+ },
1066
+ {
1067
+ name: 'active_microtask',
1068
+ text: activeMicrotask ? [
1069
+ "Microtask id: ".concat(activeMicrotask.microtaskId),
1070
+ "Lane: ".concat(input.lane),
1071
+ "Type: ".concat(activeMicrotask.type),
1072
+ "Status: ".concat(activeMicrotask.status),
1073
+ "Objective: ".concat(cleanText(activeMicrotask.objective, 360)),
1074
+ "Self-gate: ".concat(cleanText(activeMicrotask.selfGate, 260)),
1075
+ "Acceptance proof: ".concat(cleanText(activeMicrotask.acceptanceProof, 260)),
1076
+ "Attempts on this microtask: ".concat(activeMicrotask.attempts),
1077
+ "Thread key: ".concat(taskThreadKey)
1078
+ ].join('\n') : 'No active microtask found. Park and report support_v5_microtask_missing.'
1079
+ },
1080
+ {
1081
+ name: 'failure_delta',
1082
+ text: input.failureText ? "Latest blocker/failure delta: ".concat(cleanText(input.failureText, 700)) : ''
1083
+ },
1084
+ {
1085
+ name: 'target_context',
1086
+ text: [
1087
+ targetFiles.length ? "Target files: ".concat(targetFiles.join(', ')) : '',
1088
+ changedFiles.length ? "Changed files: ".concat(changedFiles.join(', ')) : '',
1089
+ artifactPaths.length ? "Artifacts: ".concat(artifactPaths.join(', ')) : '',
1090
+ (qaRow === null || qaRow === void 0 ? void 0 : qaRow.workflow) ? "QA row workflow: ".concat(cleanText(qaRow.workflow, 220)) : '',
1091
+ (qaRow === null || qaRow === void 0 ? void 0 : qaRow.route) ? "QA row route: ".concat(cleanText(qaRow.route, 220)) : '',
1092
+ (qaRow === null || qaRow === void 0 ? void 0 : qaRow.assertion) ? "QA row assertion: ".concat(cleanText(qaRow.assertion, 260)) : '',
1093
+ contextSnippets.length ? "Relevant snippets:\n".concat(contextSnippets.join('\n---\n')) : ''
1094
+ ].filter(Boolean).join('\n')
1095
+ },
1096
+ input.lane === 'qa' ? {
1097
+ name: 'qa_browser_evidence_contract',
1098
+ text: [
1099
+ 'QA lane first action after preflight: collect fresh browser evidence for the active row, not a proof review of existing route/auth artifacts.',
1100
+ 'Use the already-running localhost harness and staged env. Before any shell command, run `source .resolveio-support-tools/env.sh 2>/dev/null || source ../.resolveio-support-tools/env.sh 2>/dev/null || true`; then use `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, `$RESOLVEIO_SUPPORT_QA_SERVER_URL`, `$PUPPETEER_EXECUTABLE_PATH`, and `$CHROME_BIN`.',
1101
+ 'Required auth replay helper inside every Puppeteer row script: `const storage=JSON.parse(fs.readFileSync("qa-artifacts/auth-bootstrap-storage-state.json","utf8")); const entries=[...(Array.isArray(storage.localStorageEntries)?storage.localStorageEntries:[]), ...(Array.isArray(storage.localStorage)?storage.localStorage:Object.entries(storage.localStorage||{}).map(([key,value])=>({key,value}))), ...((storage.origins||[]).flatMap(o=>o.localStorage||[]))].map(e=>({key:e.key||e.name,value:e.value})).filter(e=>e.key); const clientUrl=process.env.RESOLVEIO_SUPPORT_QA_CLIENT_URL||process.env.RESOLVEIO_RUNNER_QA_CLIENT_URL; const rowRoute="<ACTIVE_QA_ROUTE>"; await page.goto(clientUrl,{waitUntil:"domcontentloaded"}); await page.evaluate(items=>{localStorage.clear(); for(const item of items)localStorage.setItem(item.key,item.value);}, entries); await page.goto(new URL(rowRoute, clientUrl).href,{waitUntil:"domcontentloaded"});` Replace `<ACTIVE_QA_ROUTE>` with the active row route before running. A screenshot of `/home`, the login screen, or a shell route after this helper means the QA script navigated to the wrong route or storage is stale; rerun the same row with the active route before returning an app blocker.',
1102
+ 'Allowed first command shape: one bounded `node`/Puppeteer row script that reads `qa-artifacts/auth-bootstrap-storage-state.json`, opens `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, seeds localStorage, navigates to the active QA route with `new URL(activeRoute, clientUrl).href`, drives the visible workflow, captures screenshot/caption, and updates the active matrix row. A `/home` proof is invalid for a locked non-home route.',
1103
+ 'Forbidden in QA lane after preflight: `npm run build`, `npm run build-dev`, `npm run build-prod`, `ng build`, `npm install`, `npm ci`, `npm run server`, `npm run client`, `ng serve`, `gulp`, `mongod`, `run-local-qa.sh`, and broad source discovery. If a build/startup/dependency problem is suspected, return `blocked` or `needs-fix` with the existing qa-artifacts log paths instead of launching those commands.',
1104
+ 'Launch Puppeteer from `PUPPETEER_EXECUTABLE_PATH || CHROME_BIN`, seed localStorage from `qa-artifacts/auth-bootstrap-storage-state.json`, then navigate to the active QA route.',
1105
+ 'Before passing, confirm `qa-artifacts/auth-bootstrap-result.json` used the ticket reporter or named affected user when available. If it used generic admin/dev while `qa-live-data-seed-result.json.selected.qa_user_context` names a reporter/affected user, rerun auth as that user or return needs-fix.',
1106
+ 'Drive the visible customer workflow for this one row. Capture a new customer-facing screenshot/caption and update `qa-artifacts/qa-coverage-matrix.json` with workflow, route, data id/name, assertion, screenshot path, caption, and pass/failed/blocked status.',
1107
+ 'After selecting any From/To, source/target, dropdown, combobox, rio-select, filter, item, customer, yard, chemical, or treatment-plan value, read the visible control text back from the DOM. If it still contains placeholder text such as Select Chemical, Select Yard, Select Customer, Select Treatment Plan Type, Loading..., empty, null, or undefined, do not click the action button and do not mark pass. Capture the selected-state blocker screenshot/DOM text and return needs-fix.',
1108
+ 'If the row needs persisted data proof, create that proof yourself in the same bounded QA command by querying localhost QA Mongo through process.env.MONGO_URL after the visible UI action. Write the result under qa-artifacts/ as JSON and reference that path in the matrix. Do not ask for a missing post-action DB artifact while the local QA stack is running; either write it or return needs-fix with the exact query/script error. For update-interchangeables rows, the JSON must include concrete non-placeholder fromText and toText, before/after counts or sample documents for treatment plans and tank/interchangeable records, and must fail if either selected value is only an arrow/placeholder or if the persisted collections are empty.',
1109
+ 'If the row names multiple concrete entities such as assets, units, BOLs, invoices, chemicals, customers, yards, or numbered records, prove every named entity. Do not pass by proving only one representative record.',
1110
+ 'For customer-reported data bugs, use production-seeded localhost records from `qa-live-data-seed-result.json`. If the exact named record is missing from the seed, fail the row as a seed/query blocker instead of testing a substitute record.',
1111
+ 'Route-ready, auth-bootstrap, shell, header-only, and empty-list screenshots do not satisfy this microtask. If the row cannot be proven, capture the blocker screenshot/DOM state and return needs-fix with that exact blocker.',
1112
+ 'Do not run compile/startup/npm install, do not spawn another server/client/Mongo, and do not inspect broad source trees before the first browser evidence command.'
1113
+ ].join('\n')
1114
+ } : {
1115
+ name: 'non_qa_noop',
1116
+ text: ''
1117
+ },
1118
+ {
1119
+ name: 'return_contract',
1120
+ text: diagnosisActive
1121
+ ? 'Return strict JSON only with support_diagnosis_gate. Do not include Markdown and do not edit files.'
1122
+ : input.lane === 'qa'
1123
+ ? 'Return strict JSON only: {"status":"pass"|"needs-fix"|"blocked","microtaskId":"","summary":"","evidence":[""],"artifacts":[""],"next_actions":[""]}.'
1124
+ : 'Return concise Markdown with: Microtask Result, Root Cause, Changes, Self-Gate, Acceptance Proof, Residual Risk.'
1125
+ }
1126
+ ].filter(function (section) { return cleanText(section.text, 20); });
1127
+ var promptSections = sections.map(function (section) { return ({
1128
+ name: section.name,
1129
+ tokenEstimate: estimateTextTokens(section.text)
1130
+ }); });
1131
+ var prompt = sections.map(function (section) { return section.text; }).join('\n\n');
1132
+ var promptTokenEstimate = estimateTextTokens(prompt);
1133
+ return {
1134
+ prompt: prompt,
1135
+ promptTokenEstimate: promptTokenEstimate,
1136
+ promptSections: promptSections,
1137
+ activeMicrotask: activeMicrotask,
1138
+ withinCap: promptTokenEstimate <= cap,
1139
+ withinHardCap: promptTokenEstimate <= hardCap,
1140
+ cap: cap,
1141
+ hardCap: hardCap,
1142
+ reason: promptTokenEstimate > hardCap
1143
+ ? 'support_v5_microtask_prompt_hard_cap'
1144
+ : promptTokenEstimate > cap
1145
+ ? 'support_v5_microtask_prompt_soft_cap'
1146
+ : undefined
1147
+ };
1148
+ }
1149
+ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
1150
+ var e_5, _a, e_6, _b;
1151
+ var byMicrotask = new Map();
1152
+ var bySection = new Map();
1153
+ var totalPromptTokenEstimate = 0;
1154
+ var broadPromptViolations = [];
1155
+ var promptBudget = buildResolveIOSupportV5PromptBudget();
1156
+ try {
1157
+ for (var _c = __values(bundle.supportV5MicrotaskUsageHistory || []), _d = _c.next(); !_d.done; _d = _c.next()) {
1158
+ var usage = _d.value;
1159
+ totalPromptTokenEstimate += usage.promptTokenEstimate || 0;
1160
+ var existing = byMicrotask.get(usage.microtaskId) || { microtaskId: usage.microtaskId, promptTokenEstimate: 0, calls: 0 };
1161
+ existing.promptTokenEstimate += usage.promptTokenEstimate || 0;
1162
+ existing.calls += 1;
1163
+ byMicrotask.set(usage.microtaskId, existing);
1164
+ try {
1165
+ for (var _e = (e_6 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
1166
+ var section = _f.value;
1167
+ bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
1168
+ }
1169
+ }
1170
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1171
+ finally {
1172
+ try {
1173
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
1174
+ }
1175
+ finally { if (e_6) throw e_6.error; }
1176
+ }
1177
+ var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
1178
+ if ((usage.promptTokenEstimate || 0) > hardCap) {
1179
+ broadPromptViolations.push(usage);
1180
+ }
1181
+ }
1182
+ }
1183
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1184
+ finally {
1185
+ try {
1186
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1187
+ }
1188
+ finally { if (e_5) throw e_5.error; }
1189
+ }
1190
+ return {
1191
+ totalPromptTokenEstimate: totalPromptTokenEstimate,
1192
+ byMicrotask: Array.from(byMicrotask.values()),
1193
+ bySection: Array.from(bySection.entries()).map(function (_a) {
1194
+ var _b = __read(_a, 2), name = _b[0], tokenEstimate = _b[1];
1195
+ return ({ name: name, tokenEstimate: tokenEstimate });
1196
+ }),
1197
+ broadPromptViolations: broadPromptViolations
1198
+ };
1199
+ }
1200
+ function buildResolveIOSupportV5Incident(input) {
1201
+ return {
1202
+ incidentClass: cleanText(input.incidentClass, 120) || 'support_v5_runner_incident',
1203
+ summary: cleanText(input.summary, 1200),
1204
+ stepType: input.stepType,
1205
+ blockerFingerprint: input.blocker ? fingerprintResolveIOSupportV5Blocker(input.blocker) : undefined,
1206
+ artifactPaths: cleanList(input.artifactPaths, 40, 500),
1207
+ recordedAt: isoNow(input.now)
1208
+ };
1209
+ }
1210
+
1211
+ //# sourceMappingURL=support-runner-v5.js.map