openpond 0.2.58 → 0.2.60

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 (389) hide show
  1. package/README.md +27 -0
  2. package/dist/app-server.d.ts +8 -1
  3. package/dist/app-server.js +1 -1
  4. package/dist/chunks/acp-ARBNMIPT.js +2 -0
  5. package/dist/chunks/acp-agent-53COYDHB.js +21 -0
  6. package/dist/chunks/{actions-command-QU4H53OG.js → actions-command-6YSZ7EJS.js} +1 -1
  7. package/dist/chunks/{app-layer-NSTE5HIT.js → app-layer-TVG7KTW6.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-JHGWLBXT.js → app-server-connected-apps-K62M6LCT.js} +1 -1
  9. package/dist/chunks/{app-server-evaluations-K52NAQLP.js → app-server-evaluations-RM6WXX3H.js} +1 -1
  10. package/dist/chunks/app-server-harness-services-RLKMWOQ4.js +2 -0
  11. package/dist/chunks/app-server-runtime-OKMEHNEU.js +2 -0
  12. package/dist/chunks/apps-YWZL2H34.js +2 -0
  13. package/dist/chunks/{chunk-DARVPBZ4.js → chunk-23P2O7PH.js} +1 -1
  14. package/dist/chunks/{chunk-PF5R6CMP.js → chunk-2GICDASL.js} +1 -1
  15. package/dist/chunks/{chunk-6MI4KKWF.js → chunk-2ITZW2CN.js} +1 -1
  16. package/dist/chunks/chunk-2MMCZHKL.js +2 -0
  17. package/dist/chunks/{chunk-ABD5M2D2.js → chunk-2PAJCXFC.js} +1 -1
  18. package/dist/chunks/chunk-2RNCXDJC.js +5 -0
  19. package/dist/chunks/{chunk-APB2STJK.js → chunk-2SUMZ73C.js} +1 -1
  20. package/dist/chunks/{chunk-YOQRYNLP.js → chunk-3CWRTKHY.js} +1 -1
  21. package/dist/chunks/{chunk-TRQQNFMO.js → chunk-44LWH5U6.js} +1 -1
  22. package/dist/chunks/{chunk-HPBQ4VTW.js → chunk-52KIORRX.js} +1 -1
  23. package/dist/chunks/{chunk-NHQ36THU.js → chunk-5RHYSQZ5.js} +1 -1
  24. package/dist/chunks/{chunk-3QIB5FXI.js → chunk-5ZBLCWEJ.js} +1 -1
  25. package/dist/chunks/{chunk-FTEOCCPB.js → chunk-637UACKH.js} +1 -1
  26. package/dist/chunks/chunk-655DQ6AX.js +145 -0
  27. package/dist/chunks/{chunk-N4FFQPLR.js → chunk-6GWOVHIG.js} +1 -1
  28. package/dist/chunks/chunk-6HQB3MQO.js +2 -0
  29. package/dist/chunks/{chunk-UKMA4R6X.js → chunk-7LZISGTA.js} +2 -2
  30. package/dist/chunks/{chunk-A6USMRWK.js → chunk-7RC5WPVT.js} +1 -1
  31. package/dist/chunks/{chunk-H6IW2R22.js → chunk-7YTHEMWI.js} +1 -1
  32. package/dist/chunks/{chunk-PCSIOUHF.js → chunk-A3L74U3W.js} +1 -1
  33. package/dist/chunks/{chunk-25MBPJVY.js → chunk-A66CSUBJ.js} +1 -1
  34. package/dist/chunks/{chunk-OUVIWDL2.js → chunk-AGVOGPAZ.js} +1 -1
  35. package/dist/chunks/{chunk-M4JWQSV7.js → chunk-AW5Q6NXT.js} +1 -1
  36. package/dist/chunks/{chunk-RWWE5OXU.js → chunk-B46HZ3MX.js} +1 -1
  37. package/dist/chunks/{chunk-KGNCKIFP.js → chunk-BIPQCJ5V.js} +1 -1
  38. package/dist/chunks/{chunk-HCYX6RHP.js → chunk-BIQ33JV5.js} +1 -1
  39. package/dist/chunks/{chunk-JFXWI3EN.js → chunk-BK63OQRW.js} +1 -1
  40. package/dist/chunks/{chunk-2D4Y3HNW.js → chunk-CFSIU6CW.js} +1 -1
  41. package/dist/chunks/{chunk-EIEZHFIW.js → chunk-D3RRUWNN.js} +1 -1
  42. package/dist/chunks/{chunk-X4OSOOSU.js → chunk-D4UX2O45.js} +1 -1
  43. package/dist/chunks/{chunk-GJ2ZJFDD.js → chunk-DG4TYVPF.js} +1 -1
  44. package/dist/chunks/{chunk-QIKWJ2AA.js → chunk-DGIEXZJV.js} +1 -1
  45. package/dist/chunks/{chunk-PRGBLQVH.js → chunk-DIGX56JY.js} +1 -1
  46. package/dist/chunks/{chunk-JYKRR7E5.js → chunk-DISNCX6R.js} +1 -1
  47. package/dist/chunks/{chunk-773TH7FN.js → chunk-DK7IKI7O.js} +1 -1
  48. package/dist/chunks/{chunk-74IIXVAE.js → chunk-DX7YEUNQ.js} +1 -1
  49. package/dist/chunks/{chunk-523TE4BI.js → chunk-E63VWAQA.js} +1 -1
  50. package/dist/chunks/{chunk-5MCNZCVQ.js → chunk-EL454L26.js} +1 -1
  51. package/dist/chunks/{chunk-OS3LO5J3.js → chunk-ENSB6ZTM.js} +1 -1
  52. package/dist/chunks/{chunk-EAPFMACH.js → chunk-ERJV5BMC.js} +1 -1
  53. package/dist/chunks/{chunk-RNIAFXMB.js → chunk-EXJGCNRS.js} +1 -1
  54. package/dist/chunks/chunk-F5KCCDQM.js +2 -0
  55. package/dist/chunks/chunk-FSQWAANK.js +3 -0
  56. package/dist/chunks/{chunk-Z54O534A.js → chunk-G5B3PB5X.js} +1 -1
  57. package/dist/chunks/{chunk-4D7HWVWD.js → chunk-GAWGIJQG.js} +1 -1
  58. package/dist/chunks/{chunk-IIZ4CWBX.js → chunk-GGGF5NHJ.js} +1 -1
  59. package/dist/chunks/{chunk-APB4O67E.js → chunk-GOYBYYPQ.js} +1 -1
  60. package/dist/chunks/{chunk-XDQMGUWL.js → chunk-H3BSIAQO.js} +1 -1
  61. package/dist/chunks/{chunk-EYPCBBMS.js → chunk-HCEJAOIF.js} +1 -1
  62. package/dist/chunks/{chunk-OPNRWESL.js → chunk-IFQCOSU6.js} +1 -1
  63. package/dist/chunks/chunk-IJHZBHEK.js +9 -0
  64. package/dist/chunks/{chunk-RAXOSUSW.js → chunk-ISFIDCIH.js} +1 -1
  65. package/dist/chunks/{chunk-OLLLZVHF.js → chunk-ITKTILKI.js} +1 -1
  66. package/dist/chunks/{chunk-D74JEERO.js → chunk-IUBARBGI.js} +1 -1
  67. package/dist/chunks/{chunk-O72BSKSO.js → chunk-J24I74EM.js} +1 -1
  68. package/dist/chunks/{chunk-H4QHIHMK.js → chunk-J7QGHA7G.js} +3 -3
  69. package/dist/chunks/chunk-JFXINDOQ.js +3 -0
  70. package/dist/chunks/{chunk-HIOKCIL7.js → chunk-JGWINTT5.js} +1 -1
  71. package/dist/chunks/{chunk-Q2QL6UWN.js → chunk-JHEFWB6O.js} +1 -1
  72. package/dist/chunks/{chunk-QNG27G3T.js → chunk-JHMS2WXM.js} +2 -2
  73. package/dist/chunks/{chunk-PSGGOZFM.js → chunk-JHR3LF2F.js} +1 -1
  74. package/dist/chunks/{chunk-JE7RJZOA.js → chunk-KGLJU66U.js} +3 -3
  75. package/dist/chunks/{chunk-XEOEKFG6.js → chunk-KJFRCVQC.js} +1 -1
  76. package/dist/chunks/chunk-KNO355LC.js +2 -0
  77. package/dist/chunks/{chunk-ZGTOK7ZK.js → chunk-LD7PGREF.js} +2 -2
  78. package/dist/chunks/{chunk-I7AQMAQI.js → chunk-LHA7RQBA.js} +6 -6
  79. package/dist/chunks/{chunk-6QSSIT62.js → chunk-LO3O45IX.js} +1 -1
  80. package/dist/chunks/{chunk-G3RXYI2L.js → chunk-M2SKXY5C.js} +2 -2
  81. package/dist/chunks/{chunk-2IHO4GDJ.js → chunk-M3ZQDPRS.js} +1 -1
  82. package/dist/chunks/{chunk-JDEEWOD7.js → chunk-M4ZF44H5.js} +1 -1
  83. package/dist/chunks/{chunk-Y4OWBBDD.js → chunk-M55H7KVR.js} +1 -1
  84. package/dist/chunks/{chunk-JAJ46T5X.js → chunk-MGKMIRYG.js} +1 -1
  85. package/dist/chunks/{chunk-4EQA2M7K.js → chunk-MJGU2JJ2.js} +2 -2
  86. package/dist/chunks/{chunk-65PL62KH.js → chunk-MS37ISA4.js} +2 -2
  87. package/dist/chunks/{chunk-NH6UUX5S.js → chunk-NCKXI2VB.js} +11 -11
  88. package/dist/chunks/chunk-NHUUCNAD.js +2 -0
  89. package/dist/chunks/{chunk-O6ULLQJ6.js → chunk-O3VP46SE.js} +1 -1
  90. package/dist/chunks/chunk-O4FBOUNX.js +2 -0
  91. package/dist/chunks/chunk-O6IFVTZT.js +9 -0
  92. package/dist/chunks/{chunk-5IPFI25K.js → chunk-O7B44IYN.js} +1 -1
  93. package/dist/chunks/{chunk-DMVD2RFZ.js → chunk-OGMDEA3Y.js} +1 -1
  94. package/dist/chunks/{chunk-BLXEAZCQ.js → chunk-OKBIWRHC.js} +1 -1
  95. package/dist/chunks/{chunk-FFRFSDBM.js → chunk-ON2RNOCG.js} +1 -1
  96. package/dist/chunks/{chunk-LQQNBVEB.js → chunk-ONDCV5QC.js} +1 -1
  97. package/dist/chunks/{chunk-UCPGRPWY.js → chunk-OQ4VGCRG.js} +1 -1
  98. package/dist/chunks/{chunk-YNH3NMPF.js → chunk-OWK7HU5I.js} +1 -1
  99. package/dist/chunks/{chunk-DBK66CJP.js → chunk-OY5HC2P6.js} +1 -1
  100. package/dist/chunks/{chunk-T5AACNJI.js → chunk-P7HRF4FM.js} +1 -1
  101. package/dist/chunks/{chunk-7ED24PP6.js → chunk-PCNLC5H3.js} +1 -1
  102. package/dist/chunks/{chunk-ES2ISFJC.js → chunk-PF56N7ZY.js} +1 -1
  103. package/dist/chunks/{chunk-VVCKLCF3.js → chunk-PKALOVHC.js} +2 -2
  104. package/dist/chunks/{chunk-ZCHXGRRU.js → chunk-PR5TYTY4.js} +1 -1
  105. package/dist/chunks/{chunk-Q4TBTRIG.js → chunk-PWK5Z5S3.js} +1 -1
  106. package/dist/chunks/chunk-PXS4SVQG.js +16 -0
  107. package/dist/chunks/{chunk-AY64VY4E.js → chunk-QGOPYQW3.js} +1 -1
  108. package/dist/chunks/{chunk-7E6T7GP5.js → chunk-R7YEURUQ.js} +1 -1
  109. package/dist/chunks/{chunk-ACYFMLWG.js → chunk-RCA6NGVA.js} +2 -2
  110. package/dist/chunks/{chunk-DUURYZOI.js → chunk-RG3NH6YQ.js} +1 -1
  111. package/dist/chunks/{chunk-7SC46OFC.js → chunk-RJIUOLWY.js} +1 -1
  112. package/dist/chunks/{chunk-F4KOGISR.js → chunk-RXE3FYMJ.js} +1 -1
  113. package/dist/chunks/chunk-RYGWCN2R.js +2 -0
  114. package/dist/chunks/{chunk-VYLGI3IH.js → chunk-SFNCAPCJ.js} +1 -1
  115. package/dist/chunks/{chunk-Z4Z5UOZM.js → chunk-SG6JZ7HD.js} +1 -1
  116. package/dist/chunks/{chunk-XX6SMFDY.js → chunk-SKRNWRKV.js} +5 -5
  117. package/dist/chunks/{chunk-ZRDGQDZL.js → chunk-SLZH4Z6C.js} +1 -1
  118. package/dist/chunks/{chunk-WN3V6KDN.js → chunk-SPDSSMFD.js} +1 -1
  119. package/dist/chunks/chunk-STWRTNRK.js +2 -0
  120. package/dist/chunks/{chunk-HZEIRHEB.js → chunk-T5J7HIHR.js} +1 -1
  121. package/dist/chunks/{chunk-ROGF26KV.js → chunk-TBUAQWFS.js} +1 -1
  122. package/dist/chunks/{chunk-ZUJ3XUCP.js → chunk-TEPRCBDV.js} +1 -1
  123. package/dist/chunks/{chunk-HDGTHRY7.js → chunk-TOFMA2L5.js} +2 -2
  124. package/dist/chunks/{chunk-QOGJAQDO.js → chunk-UFHLLSCE.js} +1 -1
  125. package/dist/chunks/{chunk-TTVS6JMC.js → chunk-UJKQLO6B.js} +2 -2
  126. package/dist/chunks/{chunk-OQKJGTTO.js → chunk-UZQNFTLR.js} +1 -1
  127. package/dist/chunks/{chunk-F74GBN6K.js → chunk-V2HMWCT6.js} +1 -1
  128. package/dist/chunks/{chunk-6ZFPQYHG.js → chunk-V4KT5FCJ.js} +1 -1
  129. package/dist/chunks/{chunk-TVQAPBLZ.js → chunk-VHSX3JPX.js} +1 -1
  130. package/dist/chunks/{chunk-SDXFLO7J.js → chunk-W2SXOGTQ.js} +1 -1
  131. package/dist/chunks/{chunk-FUOEIDMA.js → chunk-WDEO44UN.js} +1 -1
  132. package/dist/chunks/{chunk-4NESNOK5.js → chunk-WEHBK3MC.js} +1 -1
  133. package/dist/chunks/{chunk-4EPSHPZL.js → chunk-WGX7WY4N.js} +1 -1
  134. package/dist/chunks/{chunk-NC27T4AB.js → chunk-WHREO7A2.js} +1 -1
  135. package/dist/chunks/{chunk-RNQF63ZR.js → chunk-WS2ZZBAQ.js} +4 -4
  136. package/dist/chunks/{chunk-DIO5CB6U.js → chunk-WYZWDMMF.js} +1 -1
  137. package/dist/chunks/{chunk-MQULU465.js → chunk-XO3H32KX.js} +1 -1
  138. package/dist/chunks/{chunk-EIRYMSEG.js → chunk-XQBIHPPX.js} +1 -1
  139. package/dist/chunks/chunk-XRKFTPHD.js +2 -0
  140. package/dist/chunks/{chunk-B7RFL4N2.js → chunk-XSCIOQYE.js} +1 -1
  141. package/dist/chunks/{chunk-TJ6GVTYB.js → chunk-XTWEWYK7.js} +9 -9
  142. package/dist/chunks/{chunk-JUHZ5S3R.js → chunk-Y3GIM6WK.js} +1 -1
  143. package/dist/chunks/{chunk-74ZXXBGN.js → chunk-Y54RKLOI.js} +1 -1
  144. package/dist/chunks/{chunk-SWUEFLOH.js → chunk-Y777GISF.js} +1 -1
  145. package/dist/chunks/{chunk-EKM2D7JU.js → chunk-YDU3S6UT.js} +1 -1
  146. package/dist/chunks/{chunk-UGL7WF3W.js → chunk-YOZIZYSC.js} +1 -1
  147. package/dist/chunks/{chunk-OSIO7PLX.js → chunk-YQKOB56U.js} +1 -1
  148. package/dist/chunks/chunk-YVNDDNMK.js +3 -0
  149. package/dist/chunks/chunk-ZAZKJJOT.js +86 -0
  150. package/dist/chunks/{chunk-QL4OIPEZ.js → chunk-ZR7LIMJS.js} +2 -2
  151. package/dist/chunks/{chunk-L3KCP52O.js → chunk-ZTJOOY2F.js} +1 -1
  152. package/dist/chunks/{chunk-GPVCOEUH.js → chunk-ZTVXRZ6D.js} +1 -1
  153. package/dist/chunks/cli-CNYNXKGQ.js +2 -0
  154. package/dist/chunks/configuration-command-5K7EE2J5.js +2 -0
  155. package/dist/chunks/connected-app-executor-E25XCNAS.js +2 -0
  156. package/dist/chunks/connected-evidence-QNSO5BTF.js +2 -0
  157. package/dist/chunks/connection-Y2KCMBYD.js +2 -0
  158. package/dist/chunks/{continual-6CQAMTTR.js → continual-SOO3QBNQ.js} +1 -1
  159. package/dist/chunks/core-commands-ZTWPYAFQ.js +2 -0
  160. package/dist/chunks/datasets-XPUMWGOC.js +2 -0
  161. package/dist/chunks/desktop-test-HVSW4JHY.js +3 -0
  162. package/dist/chunks/dist-4N6AHWNN.js +2 -0
  163. package/dist/chunks/{dist-OMGUJYPD.js → dist-N6R6VNFD.js} +1 -1
  164. package/dist/chunks/{dist-VYC5VMQB.js → dist-QN7WKZ2D.js} +1 -1
  165. package/dist/chunks/{enclave-QS4BUNDU.js → enclave-VURYNILU.js} +1 -1
  166. package/dist/chunks/evaluation-coordination-AOTFPVMS.js +2 -0
  167. package/dist/chunks/experiment-improvements-75CN3VI7.js +2 -0
  168. package/dist/chunks/experiments-AGAHM2AK.js +2 -0
  169. package/dist/chunks/{experiments-VFQGE4HC.js → experiments-DYSHYBGB.js} +1 -1
  170. package/dist/chunks/{extension-XKXXOP5N.js → extension-UT4CSDJF.js} +1 -1
  171. package/dist/chunks/help-KU52CFMW.js +8 -0
  172. package/dist/chunks/host-profile-evaluation-tools-LZDMQCMT.js +2 -0
  173. package/dist/chunks/host-profile-external-dataset-VK3NJHMC.js +2 -0
  174. package/dist/chunks/hosted-app-server-composition-P7V7K7CG.js +2 -0
  175. package/dist/chunks/{hosted-experiment-improvement-HVMDGS75.js → hosted-experiment-improvement-P433KDX2.js} +1 -1
  176. package/dist/chunks/hosted-harness-runtime-Y4DONWPC.js +2 -0
  177. package/dist/chunks/{hosted-profile-candidate-EXNN6MVN.js → hosted-profile-candidate-72MMPN6U.js} +1 -1
  178. package/dist/chunks/hosted-profile-compiler-RXHLK224.js +2 -0
  179. package/dist/chunks/hosted-profile-evaluation-control-LS4DCSDO.js +2 -0
  180. package/dist/chunks/{hosted-profile-evaluation-inspection-ZUANDYZ6.js → hosted-profile-evaluation-inspection-3Q6EHO66.js} +1 -1
  181. package/dist/chunks/{hosted-profile-evaluation-preparation-ORVZ6MBD.js → hosted-profile-evaluation-preparation-ZD27HNLF.js} +1 -1
  182. package/dist/chunks/{hosted-tasksets-ANAE2PIW.js → hosted-tasksets-V2PQZJN4.js} +1 -1
  183. package/dist/chunks/human-review-4FJFINQX.js +2 -0
  184. package/dist/chunks/import-GBHSLA3G.js +3 -0
  185. package/dist/chunks/{learning-ACEVFL5M.js → learning-U3FZL5YB.js} +1 -1
  186. package/dist/chunks/local-harness-improvement-runtime-UP2P7UT4.js +2 -0
  187. package/dist/chunks/local-harness-taskset-review-ZNOKSPJJ.js +2 -0
  188. package/dist/chunks/{local-scope-HVF2GZ5W.js → local-scope-62GWHDXS.js} +1 -1
  189. package/dist/chunks/{model-projects-QPO22JPA.js → model-projects-LQ4C6R3X.js} +1 -1
  190. package/dist/chunks/opchat-Q4PIWPYW.js +3 -0
  191. package/dist/chunks/organizations-TEH6HBQ3.js +2 -0
  192. package/dist/chunks/{profile-TFZMUEDR.js → profile-SWPVCGTR.js} +1 -1
  193. package/dist/chunks/{profile-training-source-6GOT7AHM.js → profile-training-source-J73ZLNSC.js} +1 -1
  194. package/dist/chunks/project-action-payload-OU3ZPHW7.js +2 -0
  195. package/dist/chunks/project-agent-J7ILCRBS.js +2 -0
  196. package/dist/chunks/{published-experiment-source-HVP5IGRH.js → published-experiment-source-HVHKSYDL.js} +1 -1
  197. package/dist/chunks/refiner-profile-service-E7YU4E3N.js +2 -0
  198. package/dist/chunks/{runtime-A7OZXM43.js → runtime-LIPHPKKJ.js} +2 -2
  199. package/dist/chunks/sandbox-command-G6KID3OP.js +2 -0
  200. package/dist/chunks/{sandbox-template-C4V6T36U.js → sandbox-template-MZTMAUFS.js} +1 -1
  201. package/dist/chunks/saved-work-LOUWLF37.js +2 -0
  202. package/dist/chunks/{send-turn-XTAIS2JN.js → send-turn-UEUEGY5W.js} +1 -1
  203. package/dist/chunks/{src-R36AGJY7.js → src-7WMZOWZZ.js} +107 -100
  204. package/dist/chunks/{src-DZL5T2MT.js → src-MVAK6D6Y.js} +1 -1
  205. package/dist/chunks/standalone-experiment-turn-owner-YRKEOEJ2.js +2 -0
  206. package/dist/chunks/{store-continual-support-reviews-LJPNG4SP.js → store-continual-support-reviews-FJLLNKCY.js} +1 -1
  207. package/dist/chunks/{store-conversation-serving-KPC62UEY.js → store-conversation-serving-4KWR4IZY.js} +1 -1
  208. package/dist/chunks/{store-create-improve-SW5FTBTL.js → store-create-improve-JWBJZRAU.js} +1 -1
  209. package/dist/chunks/{store-datasets-WMA7AJKN.js → store-datasets-4N2M6Y3K.js} +2 -2
  210. package/dist/chunks/{store-evaluation-results-ZO6R653G.js → store-evaluation-results-OBM4623U.js} +1 -1
  211. package/dist/chunks/{store-harness-memory-VINCZ4GK.js → store-harness-memory-4HUEMRCD.js} +1 -1
  212. package/dist/chunks/{store-harness-refinement-candidates-EA5KFQPH.js → store-harness-refinement-candidates-NMRWMN23.js} +1 -1
  213. package/dist/chunks/store-harness-workspaces-BGONIQDY.js +2 -0
  214. package/dist/chunks/{store-human-review-7QQ7ZQ6P.js → store-human-review-J75SIZAL.js} +1 -1
  215. package/dist/chunks/store-learned-preference-migration-validation-VLASM4CT.js +2 -0
  216. package/dist/chunks/store-learning-TUCQFBLT.js +2 -0
  217. package/dist/chunks/{store-learning-credentials-WZQJ4HPJ.js → store-learning-credentials-S4RF57NV.js} +1 -1
  218. package/dist/chunks/{store-local-experiments-SAULQSBN.js → store-local-experiments-LULRLTII.js} +5 -5
  219. package/dist/chunks/{store-model-batch-review-VKLDYGH3.js → store-model-batch-review-SVL4MT6D.js} +1 -1
  220. package/dist/chunks/{store-model-configuration-BYRJUR3C.js → store-model-configuration-ZHDSM3XM.js} +2 -2
  221. package/dist/chunks/{store-preference-comparison-LV32MHVL.js → store-preference-comparison-YMMCKXS5.js} +1 -1
  222. package/dist/chunks/{store-schedules-VGTEQVKH.js → store-schedules-6Z4QS3NU.js} +1 -1
  223. package/dist/chunks/{store-sidebar-file-bookmarks-VB5GTLFY.js → store-sidebar-file-bookmarks-MX6EP6OB.js} +2 -2
  224. package/dist/chunks/{store-sidebar-preferences-GWIOG2NH.js → store-sidebar-preferences-VYREPW26.js} +1 -1
  225. package/dist/chunks/{store-subagents-T7R2Z6TB.js → store-subagents-WGBCRALX.js} +1 -1
  226. package/dist/chunks/{store-task-inbox-QPE44OSS.js → store-task-inbox-43BNZSB7.js} +6 -6
  227. package/dist/chunks/{store-task-inventory-I3RDRI52.js → store-task-inventory-AEW4POAJ.js} +2 -2
  228. package/dist/chunks/{store-taskset-drafts-2IULRV2W.js → store-taskset-drafts-DKFO2CYB.js} +1 -1
  229. package/dist/chunks/{store-training-B2TW2MLA.js → store-training-6PFFR6ST.js} +1 -1
  230. package/dist/chunks/{store-training-jobs-VBNG23RL.js → store-training-jobs-ANDEBQ67.js} +2 -2
  231. package/dist/chunks/{store-training-models-OMV5FIC4.js → store-training-models-OOI4ZJPX.js} +2 -2
  232. package/dist/chunks/{store-usage-IE2U2FD3.js → store-usage-U72RNW64.js} +1 -1
  233. package/dist/chunks/{store-work-evidence-QQDKM5AQ.js → store-work-evidence-NY5OBATB.js} +1 -1
  234. package/dist/chunks/{taskset-EQRFQBYM.js → taskset-SL3YOXW7.js} +1 -1
  235. package/dist/chunks/{taskset-packages-XC6HEE3K.js → taskset-packages-3PCEYYDA.js} +1 -1
  236. package/dist/chunks/{teams-bot-EAPGPTHZ.js → teams-bot-IDEF3BMI.js} +1 -1
  237. package/dist/chunks/{training-UF6RPI4T.js → training-57ISIC7U.js} +1 -1
  238. package/dist/chunks/web-search-222Y63QW.js +2 -0
  239. package/dist/chunks/{workspaces-EKKE5NAC.js → workspaces-5DF4H5EX.js} +1 -1
  240. package/dist/cli.js +1 -1
  241. package/dist/index.js +1 -1
  242. package/dist/sandbox-template/manifest.js +1 -1
  243. package/dist/web/assets/{App-CaRMZoxo.css → App-DbYvV_W6.css} +1 -1
  244. package/dist/web/assets/App-nzE7JU_O.js +154 -0
  245. package/dist/web/assets/{AppDialog-t2Fx5tK3.js → AppDialog-VtNvqbDm.js} +1 -1
  246. package/dist/web/assets/{AppTerminalPanel-Dj1Y32oI.js → AppTerminalPanel-BMfKdrrN.js} +2 -2
  247. package/dist/web/assets/AppsView-CdWyrDEb.js +1 -0
  248. package/dist/web/assets/{BrowserSidebar-jhWi4rVm.js → BrowserSidebar-CtOIciOa.js} +1 -1
  249. package/dist/web/assets/{CartesianChart-C1DIx0Ia.js → CartesianChart-u1lvLM30.js} +1 -1
  250. package/dist/web/assets/{CollaborationTabs-Bdr-HmOL.js → CollaborationTabs-CaBfDYRW.js} +1 -1
  251. package/dist/web/assets/{CommandMenu-Ux2yOHAc.js → CommandMenu-CFW3WJ11.js} +1 -1
  252. package/dist/web/assets/{CommunityView-DPEeVKFn.js → CommunityView-D2EjaeuH.js} +1 -1
  253. package/dist/web/assets/ComposerCreateImproveStrip-6wYSJdzv.js +1 -0
  254. package/dist/web/assets/ConversationImportsSettings-BJ4QhF7p.js +1 -0
  255. package/dist/web/assets/ConversationImportsSettings-PfUa8V7X.css +1 -0
  256. package/dist/web/assets/{GetStartedView-CFHP0AaI.js → GetStartedView-DBcOwIJn.js} +1 -1
  257. package/dist/web/assets/{HostedModelLearningReview-D8BGTPVN.js → HostedModelLearningReview-BNpK6_W9.js} +1 -1
  258. package/dist/web/assets/{HostedModelLearningSettings-JS1S7vNO.js → HostedModelLearningSettings-SrsdeeoA.js} +1 -1
  259. package/dist/web/assets/{LabModelVersionDetailPage-Dx5Q3xV2.js → LabModelVersionDetailPage-Cd6bRHt9.js} +1 -1
  260. package/dist/web/assets/LabSkillSidebar-CQfvel4w.js +1 -0
  261. package/dist/web/assets/{LabsRoute-CyYF8-dw.js → LabsRoute-sXLJt1KR.js} +4 -4
  262. package/dist/web/assets/MainChatThread-dlDDK2JM.js +2 -0
  263. package/dist/web/assets/MainPane-DCz38-qy.js +65 -0
  264. package/dist/web/assets/{MarkdownText-BR4V6lNO.js → MarkdownText-Drjq6-JM.js} +1 -1
  265. package/dist/web/assets/{NativeSkillSidebar-DU9IEgIO.js → NativeSkillSidebar-jncZijt-.js} +1 -1
  266. package/dist/web/assets/{NewExperienceSwitcher-mIy6FzCj.js → NewExperienceSwitcher-DXKzoMaM.js} +1 -1
  267. package/dist/web/assets/{NewProjectDialog-RfTZTHxl.js → NewProjectDialog-DIyjAxJG.js} +1 -1
  268. package/dist/web/assets/OutputsPage-Dy1cNr3n.js +1 -0
  269. package/dist/web/assets/{ProjectsPage-CE6QUB-b.js → ProjectsPage-D2EeybIv.js} +1 -1
  270. package/dist/web/assets/RightChatPanelStack-4wUL-W9_.js +1 -0
  271. package/dist/web/assets/{RightSidebarHomePanel-CK0rP3WT.js → RightSidebarHomePanel-Bd_AHUp8.js} +1 -1
  272. package/dist/web/assets/{ScheduledWorkPage-vOrYv8pp.js → ScheduledWorkPage-BJkSzwz2.js} +1 -1
  273. package/dist/web/assets/{SettingsView-DCKVrfjj.js → SettingsView-BhcP72KH.js} +4 -4
  274. package/dist/web/assets/SettingsView-DjjnCnlb.css +1 -0
  275. package/dist/web/assets/{TeamChatView-Bwrjr-vk.js → TeamChatView-CR0fdicZ.js} +2 -2
  276. package/dist/web/assets/{TerminalOverlay-DhPoKZAq.js → TerminalOverlay-DGrZRZ_3.js} +10 -10
  277. package/dist/web/assets/TrainingCreationPanel-BsTG7aFS.js +1 -0
  278. package/dist/web/assets/{TrainingDraftPanel-C9cRX5qf.js → TrainingDraftPanel-ByErrht7.js} +1 -1
  279. package/dist/web/assets/{UsageSettingsSection-CrdcSGeW.js → UsageSettingsSection-DeYTJbcM.js} +1 -1
  280. package/dist/web/assets/{WorkSidebarPanel-DSSikNFQ.js → WorkSidebarPanel-DcNvEEoy.js} +1 -1
  281. package/dist/web/assets/{WorkspaceDiffPanel-BAFo0CPN.js → WorkspaceDiffPanel-CdPRcYWN.js} +3 -3
  282. package/dist/web/assets/{WorkspaceEnvironmentMenu-BVHAhwnJ.js → WorkspaceEnvironmentMenu-xUYg-iGn.js} +18 -18
  283. package/dist/web/assets/{WorkspaceGitDialogs-CwVoiDQ2.js → WorkspaceGitDialogs-CBViLL3S.js} +1 -1
  284. package/dist/web/assets/{WorkspaceMonacoEditor-TxLyhzNp.js → WorkspaceMonacoEditor-frxie2_S.js} +3 -3
  285. package/dist/web/assets/agent-connections-D7ao-vbU.js +1 -0
  286. package/dist/web/assets/{arrow-up-right-C9aE8Mfz.js → arrow-up-right-DCWPxdbD.js} +1 -1
  287. package/dist/web/assets/{chunk-P3BRSSRD-DUGfuKA8.js → chunk-P3BRSSRD-B5JXa0Nh.js} +1 -1
  288. package/dist/web/assets/{clipboard-Dk158Qp4.js → clipboard-B-GnMVLp.js} +1 -1
  289. package/dist/web/assets/{cloud-upload-k9eqBsHr.js → cloud-upload-DpaGFZ9J.js} +1 -1
  290. package/dist/web/assets/{cssMode-CO35ARZp.js → cssMode-DJHE7R3W.js} +1 -1
  291. package/dist/web/assets/{folder-open-sYgceW_f.js → folder-open-B-DFLDFH.js} +1 -1
  292. package/dist/web/assets/{folder-plus-CS0R49m9.js → folder-plus-CPXxPvSH.js} +1 -1
  293. package/dist/web/assets/{git-commit-horizontal-DrGxH2h4.js → git-commit-horizontal-DCTzcivA.js} +1 -1
  294. package/dist/web/assets/{htmlMode-REMmzdfq.js → htmlMode-DxZVBAYd.js} +1 -1
  295. package/dist/web/assets/index-BojtIRzO.css +1 -0
  296. package/dist/web/assets/{index-C8aCGagb.js → index-Di1MU6Xr.js} +2 -2
  297. package/dist/web/assets/{info-DLdbiUrh.js → info-BMxsR_bn.js} +1 -1
  298. package/dist/web/assets/{jsonMode-KEdMfkIf.js → jsonMode-CzWoMkpp.js} +1 -1
  299. package/dist/web/assets/{lspLanguageFeatures-5KZwEoxW.js → lspLanguageFeatures-15K7ND6Q.js} +1 -1
  300. package/dist/web/assets/{minimize-2-CqcI4zcM.js → minimize-2-DwUgqXoR.js} +1 -1
  301. package/dist/web/assets/{monaco.contribution-Cly9Wt7L.js → monaco.contribution-BBLKjER5.js} +2 -2
  302. package/dist/web/assets/{monaco.contribution-omszXBEj.js → monaco.contribution-DBjvSu8p.js} +2 -2
  303. package/dist/web/assets/{monaco.contribution-DO10L0zW.js → monaco.contribution-DUWvjhIG.js} +2 -2
  304. package/dist/web/assets/{monaco.contribution-BJGj65F9.js → monaco.contribution-w0zfkYLX.js} +2 -2
  305. package/dist/web/assets/{monitor-BFVCcbxp.js → monitor-Ihu5LVYx.js} +1 -1
  306. package/dist/web/assets/{play-C469pVZq.js → play-D_YGCdxU.js} +1 -1
  307. package/dist/web/assets/{python-Dw0YcVy9.js → python-Q4OuoXYc.js} +1 -1
  308. package/dist/web/assets/{save-CtSjPydi.js → save-DJYUOhtD.js} +1 -1
  309. package/dist/web/assets/{square-BuImvLhT.js → square-DXtoCBNw.js} +1 -1
  310. package/dist/web/assets/{toggleHighContrast-DjCO9lIP.js → toggleHighContrast-CaNeuWVE.js} +1 -1
  311. package/dist/web/assets/{tsMode-BAOnxKd6.js → tsMode-CJnQ2wmM.js} +1 -1
  312. package/dist/web/assets/{upload-2JkFZo3h.js → upload-fCP3_OEO.js} +1 -1
  313. package/dist/web/assets/{useLocalAgentSchedules-BNqAisfS.js → useLocalAgentSchedules-BFoH_gwZ.js} +1 -1
  314. package/dist/web/assets/useProviderSettings-2eysgqiA.js +5 -0
  315. package/dist/web/assets/{useProviderSettings-CmL_BaxP.css → useProviderSettings-Cktvzinz.css} +1 -1
  316. package/dist/web/assets/{useSessionTurnCache-BHU2-Jmz.js → useSessionTurnCache-DLF5SPD-.js} +1 -1
  317. package/dist/web/assets/{wifi-off-CpOAH62M.js → wifi-off-DZoiFrRz.js} +1 -1
  318. package/dist/web/assets/{workers-0QvlA2T5.js → workers-D5nr74M-.js} +1 -1
  319. package/dist/web/assets/{yaml-BK3qxo7D.js → yaml-CwsoTJmk.js} +1 -1
  320. package/dist/web/index.html +2 -2
  321. package/docs/command-reference.md +22 -3
  322. package/docs/conversation-imports.md +57 -0
  323. package/package.json +1 -1
  324. package/dist/chunks/app-server-harness-services-QMUOEYOA.js +0 -2
  325. package/dist/chunks/app-server-runtime-ISGGLQHU.js +0 -2
  326. package/dist/chunks/apps-BKTOR4F7.js +0 -2
  327. package/dist/chunks/chunk-3VUATFZD.js +0 -2
  328. package/dist/chunks/chunk-3Z47M3YY.js +0 -2
  329. package/dist/chunks/chunk-6UDGARFC.js +0 -143
  330. package/dist/chunks/chunk-FV2R5RUN.js +0 -3
  331. package/dist/chunks/chunk-HY3GOBFJ.js +0 -58
  332. package/dist/chunks/chunk-I3HZKJB3.js +0 -2
  333. package/dist/chunks/chunk-I3VVWNUW.js +0 -5
  334. package/dist/chunks/chunk-KG325WTN.js +0 -2
  335. package/dist/chunks/chunk-Q5LEXXJG.js +0 -16
  336. package/dist/chunks/chunk-QDC4OW3S.js +0 -2
  337. package/dist/chunks/chunk-SDAUS5PY.js +0 -2
  338. package/dist/chunks/chunk-VRIEKBBH.js +0 -9
  339. package/dist/chunks/chunk-WJ43MJ3F.js +0 -2
  340. package/dist/chunks/chunk-X2HIHF2I.js +0 -2
  341. package/dist/chunks/chunk-YBT2NB32.js +0 -2
  342. package/dist/chunks/chunk-ZTNHW2K7.js +0 -10
  343. package/dist/chunks/cli-XZENDZ7Z.js +0 -2
  344. package/dist/chunks/configuration-command-6C5UO7GE.js +0 -2
  345. package/dist/chunks/connected-app-executor-LQNIU5NR.js +0 -2
  346. package/dist/chunks/connected-evidence-GH2ATNEX.js +0 -2
  347. package/dist/chunks/connection-HTF6CC7M.js +0 -2
  348. package/dist/chunks/core-commands-A2DGGIPS.js +0 -2
  349. package/dist/chunks/datasets-7BNMVJOY.js +0 -2
  350. package/dist/chunks/desktop-test-3CUHVLXV.js +0 -3
  351. package/dist/chunks/dist-ZVJPJLXR.js +0 -2
  352. package/dist/chunks/evaluation-coordination-XEF5L7KZ.js +0 -2
  353. package/dist/chunks/experiment-improvements-KRX2DP27.js +0 -2
  354. package/dist/chunks/experiments-DFGQYA4O.js +0 -2
  355. package/dist/chunks/help-S7THC6IE.js +0 -8
  356. package/dist/chunks/host-profile-evaluation-tools-JOFBL5OF.js +0 -2
  357. package/dist/chunks/host-profile-external-dataset-K3ICDHIP.js +0 -2
  358. package/dist/chunks/hosted-app-server-composition-T5IWGOTA.js +0 -2
  359. package/dist/chunks/hosted-harness-runtime-YCKB6NBI.js +0 -2
  360. package/dist/chunks/hosted-profile-compiler-IYLLHCRY.js +0 -2
  361. package/dist/chunks/hosted-profile-evaluation-control-TJVER3NW.js +0 -2
  362. package/dist/chunks/human-review-WR777ODH.js +0 -2
  363. package/dist/chunks/import-MLZUHITH.js +0 -4
  364. package/dist/chunks/local-harness-improvement-runtime-QRFGPFRM.js +0 -2
  365. package/dist/chunks/local-harness-taskset-review-HR7KLY4B.js +0 -2
  366. package/dist/chunks/opchat-T4QTNEIY.js +0 -3
  367. package/dist/chunks/organizations-75L5DZDV.js +0 -2
  368. package/dist/chunks/project-action-payload-JDS6OQAW.js +0 -2
  369. package/dist/chunks/project-agent-6RRO233B.js +0 -2
  370. package/dist/chunks/refiner-profile-service-FDTQKY33.js +0 -2
  371. package/dist/chunks/sandbox-command-IU5XFTJP.js +0 -2
  372. package/dist/chunks/saved-work-SHEEDZ6Z.js +0 -2
  373. package/dist/chunks/standalone-experiment-turn-owner-JCY5LL5R.js +0 -2
  374. package/dist/chunks/store-harness-workspaces-XUM4Z66X.js +0 -2
  375. package/dist/chunks/store-learned-preference-migration-validation-NADPXOTG.js +0 -2
  376. package/dist/chunks/store-learning-WLG6KFIO.js +0 -2
  377. package/dist/chunks/web-search-CZ3NCLPY.js +0 -2
  378. package/dist/web/assets/App-s-CJswyt.js +0 -154
  379. package/dist/web/assets/AppsView-BYE5EBDJ.js +0 -1
  380. package/dist/web/assets/ComposerCreateImproveStrip-CEgh4OtN.js +0 -1
  381. package/dist/web/assets/LabSkillSidebar-BxffN-pN.js +0 -1
  382. package/dist/web/assets/MainChatThread-DZpcFRFl.js +0 -2
  383. package/dist/web/assets/MainPane-5DTtwVCk.js +0 -65
  384. package/dist/web/assets/OutputsPage-Cr1Spf7S.js +0 -1
  385. package/dist/web/assets/RightChatPanelStack-T6VRWuHo.js +0 -1
  386. package/dist/web/assets/SettingsView-Dulr_xlq.css +0 -1
  387. package/dist/web/assets/TrainingCreationPanel-BXHfohNm.js +0 -1
  388. package/dist/web/assets/index-3iPNbbER.css +0 -1
  389. package/dist/web/assets/useProviderSettings-C4L4wDoh.js +0 -5
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{I as E,J as B,P as O,Q as z,S as R,T as M,h as v}from"./chunk-ACYFMLWG.js";import{m as x}from"./chunk-KGNCKIFP.js";import{b as p}from"./chunk-ES2ISFJC.js";import{a as w}from"./chunk-FTQLQJQV.js";var S=p.number().int().nonnegative().nullable(),L=p.object({requestId:p.string().min(1),startedAt:p.string().datetime(),provider:p.string(),model:p.string(),mode:p.string(),status:p.string(),source:p.string(),projectId:p.string().nullable(),inputTokens:S,cachedInputTokens:S,outputTokens:S,totalTokens:S}).strict();var y=p.number().int().nonnegative(),C=p.object({invocations:y,inputTokens:y,cachedInputTokens:y,outputTokens:y,totalTokens:y,missingInput:y,missingCachedInput:y,missingOutput:y,missingTotal:y,failures:y,unattributed:y}).strict(),U=p.object({total:C,days:p.array(C.extend({key:p.string().regex(/^\d{4}-\d{2}-\d{2}$/)})),modes:p.array(C.extend({key:p.string()})),models:p.array(C.extend({key:p.string()}))}).strict();var $=w(h=>["accepted","rejected","cancelled"].includes(h.status),"closed");function a(h,r=422){throw new v(h,r)}w(a,"fail");function V(h,r,b){try{M(h.form,r,b)}catch(l){a(l instanceof Error?l.message:"human_answer_invalid")}}w(V,"answers");function Q(h,r,b=()=>new Date().toISOString()){async function l(i,t){t.scope!==i.scope&&a("human_scope_denied",403),await r.member(i);let e=await r.owner(i,t.projectId),s=e||t.policy.managerIds.includes(i.actorId),n=e||t.assigneeId===i.actorId||t.policy.reviewerIds.includes(i.actorId);return e||s||n||t.policy.teamVisible||a("human_review_not_found",404),await r.evidence(i,t),{owner:e,manager:s,reviewer:n}}w(l,"access");async function A(i,t){let e=z.parse(t);return h.transaction(i.scope,async s=>{await r.member(i);let n=await s.get(e.id),c={owner:!1,manager:!1,reviewer:!1};if(e.action==="create"){let I={projectId:e.projectId,evidence:e.evidence,form:e.form};await r.owner(i,e.projectId)||a("human_assignment_owner_required",403),await r.evidence(i,I);for(let q of new Set([...e.assigneeId?[e.assigneeId]:[],...e.policy.managerIds,...e.policy.reviewerIds]))await r.assignee(i,q,I);e.kind==="grade"&&!e.evidence.attempts.length&&a("human_grade_requires_attempt"),e.kind!=="grade"&&!e.evidence.taskIds?.length&&a("human_task_assignment_requires_tasks"),e.form.mode==="pairwise"!=(e.evidence.attempts.length===2)&&a("human_form_evidence_mode_mismatch")}else n||a("human_review_not_found",404),c=await l(i,n),e.action==="bind_author_publication"&&!c.owner&&a("human_task_publication_owner_required",403),["reassign","cancel","decide"].includes(e.action)&&!c.manager&&a("human_manager_required",403),["save_draft","submit","reserve_execution","bind_execution"].includes(e.action)&&!c.reviewer&&!(e.action==="bind_execution"&&n.status==="cancelled"&&c.manager)&&a("human_assignee_required",403),e.action==="claim"&&(!n.policy.queueClaim||!n.policy.teamVisible||n.policy.reviewerIds.length&&!n.policy.reviewerIds.includes(i.actorId)&&!c.owner)&&a("human_claim_denied",403);let _=x([i.actorId,e.operationId]),d=x(e),k=await s.operation(_);if(k){k.requestHash!==d&&a("human_operation_conflict",409);let I=await s.get(k.reviewId,k.revision);return I||a("human_operation_result_unavailable",409),I}(n?.revision??0)!==e.expectedRevision&&a("human_revision_conflict",409);let o=b();if(e.action==="create")(n||e.expectedRevision!==0)&&a("human_review_exists",409),n=O.parse(R({schemaVersion:"openpond.humanReview.v1",id:e.id,revision:1,scope:i.scope,projectId:e.projectId,createdBy:i.actorId,kind:e.kind,title:e.title,...e.dueAt?{dueAt:e.dueAt}:{},authorPublication:null,evidence:e.evidence,form:e.form,policy:e.policy,status:e.assigneeId?"assigned":"queued",assigneeId:e.assigneeId,generation:1,drafts:[],submissions:[],decisions:[],audit:[],execution:null,createdAt:o,updatedAt:o}));else{n||a("human_review_not_found",404),$(n)&&e.action!=="bind_author_publication"&&!(n.status==="cancelled"&&e.action==="bind_execution")&&a("human_review_closed",409);let{contentHash:I,...q}=n,u={...q,revision:n.revision+1,updatedAt:o};if(e.action==="bind_author_publication")(n.kind!=="author"||n.status!=="accepted"||n.decisions.at(-1)?.taskProposalHash!==e.proposalHash||n.authorPublication)&&a("human_task_publication_stale",409),r.publication||a("human_task_publication_owner_unavailable",422),await r.publication(i,n,e.dataset,e.proposalHash),u.authorPublication={proposalHash:e.proposalHash,dataset:e.dataset,publishedBy:i.actorId,operationId:e.operationId,publishedAt:o};else if(e.action==="claim")(n.assigneeId||n.status!=="queued")&&a("human_already_claimed",409),await r.assignee(i,i.actorId,n),u={...u,assigneeId:i.actorId,status:"assigned",generation:n.generation+1,audit:[...n.audit,{actorId:i.actorId,action:"claim",priorAssigneeId:n.assigneeId,assigneeId:i.actorId,generation:n.generation+1,note:"",occurredAt:o}]};else if(e.action==="reserve_execution"||e.action==="bind_execution")if((n.kind!=="execute"||e.generation!==n.generation)&&a("human_execution_assignment_stale",409),e.action==="reserve_execution")n.execution&&a("human_execution_already_reserved",409),u.execution={executionId:null,operationId:e.runOperationId,boundBy:i.actorId,configurationHash:e.configurationHash,generation:e.generation,result:null},u.status="in_progress";else{let f=n.execution;(!f||f.executionId||f.operationId!==e.runOperationId||f.configurationHash!==e.configurationHash||f.boundBy!==i.actorId&&!(n.status==="cancelled"&&c.manager)||f.generation!==e.generation)&&a("human_execution_binding_conflict",409);let g={...f,executionId:e.executionId};r.execution||a("human_execution_owner_unavailable",422),await r.execution(i,n,g),u.execution=g}else if(e.action==="reassign")n.execution&&!n.execution.result&&a("human_execution_transfer_requires_completion",409),e.assigneeId&&await r.assignee(i,e.assigneeId,n),u={...u,execution:null,assigneeId:e.assigneeId,generation:n.generation+1,status:e.assigneeId?"assigned":"queued",audit:[...n.audit,{actorId:i.actorId,action:"reassign",priorAssigneeId:n.assigneeId,assigneeId:e.assigneeId,generation:n.generation+1,note:e.note,occurredAt:o}]};else if(e.action==="cancel")u.status="cancelled",u.audit=[...n.audit,{actorId:i.actorId,action:"cancel",priorAssigneeId:n.assigneeId,assigneeId:n.assigneeId,generation:n.generation,note:e.note,occurredAt:o}];else if(e.action==="save_draft"||e.action==="submit"){n.kind==="execute"&&!n.execution?.executionId&&a("human_execution_not_bound",409),e.generation!==n.generation&&a("human_assignment_generation_stale",409);let f=n.decisions.at(-1),g=n.submissions.filter(m=>m.actorId===i.actorId&&m.generation===n.generation).at(-1);if(g&&!(f?.outcome==="request_changes"&&f.submissions.some(m=>m.id===g.id))&&a("human_submission_already_sealed",409),e.taskProposal?.tasks.some(m=>m.expectedOutput!==void 0)&&!c.owner&&a("human_reference_edit_owner_required",403),e.taskProposal||e.action==="submit")try{B(n,e.taskProposal)}catch(m){a(m instanceof Error?m.message:"human_task_proposal_invalid")}if(V(n,e.answers,e.action==="submit"),e.action==="save_draft")u.drafts=[...n.drafts.filter(m=>m.actorId!==i.actorId),{actorId:i.actorId,generation:n.generation,...e.taskProposal?{taskProposal:e.taskProposal}:{},answers:e.answers,note:e.note,updatedAt:o}],u.status=n.status==="returned"?"returned":"in_progress";else{n.kind==="execute"&&((!e.executionResult||!r.completeExecution)&&a("human_execution_result_required",409),await r.completeExecution(i,n,e.executionResult),u.execution={...n.execution,result:e.executionResult}),(e.evidenceHash!==x(n.evidence)||e.formHash!==x(n.form))&&a("human_review_snapshot_stale",409);let m=R({...e.taskProposal?{taskProposal:e.taskProposal}:{},id:`submission-${_}`,revision:1,actorId:i.actorId,generation:n.generation,evidenceHash:e.evidenceHash,formHash:e.formHash,answers:e.answers,note:e.note,submittedAt:o,supersedes:g?.id??null});u.submissions=[...n.submissions,m],u.drafts=n.drafts.filter(H=>H.actorId!==i.actorId),u.status=n.policy.approval==="none"?"accepted":"submitted",n.policy.approval==="none"&&(u.decisions=[...n.decisions,R({id:`decision-${_}`,revision:1,actorId:i.actorId,outcome:"accept",...e.taskProposal?{taskProposalHash:e.taskProposal.contentHash}:{},submissions:[{id:m.id,contentHash:m.contentHash}],answers:e.answers,note:"",decidedAt:o})])}}else if(e.action==="decide"){(n.policy.approval!=="manager"||n.status!=="submitted")&&a("human_decision_not_required",409);let f=e.submissions.map(g=>n.submissions.find(m=>m.id===g.id&&m.contentHash===g.contentHash&&m.generation===n.generation&&!n.submissions.some(H=>H.supersedes===m.id))??a("human_submission_revision_stale",409));n.policy.distinctManager&&f.some(g=>g.actorId===i.actorId)&&a("human_distinct_manager_required",403),new Set(f.map(g=>g.id)).size!==f.length&&a("human_duplicate_submission"),e.outcome==="accept"&&new Set(f.map(g=>g.actorId)).size<n.policy.minimumRaters&&a("human_more_raters_required",409),e.outcome!=="accept"&&!e.note.trim()&&a("human_decision_reason_required"),n.kind==="author"&&e.outcome==="accept"&&!f.some(g=>g.taskProposal?.contentHash===e.taskProposalHash)&&a("human_task_proposal_decision_required",409),n.kind!=="author"&&e.taskProposalHash&&a("human_task_proposal_unexpected"),V(n,e.answers,e.outcome==="accept"),u.decisions=[...n.decisions,R({...e.taskProposalHash?{taskProposalHash:e.taskProposalHash}:{},id:`decision-${_}`,revision:1,actorId:i.actorId,outcome:e.outcome,submissions:e.submissions,answers:e.answers,note:e.note,decidedAt:o})],u.status=e.outcome==="accept"?"accepted":e.outcome==="reject"?"rejected":"returned"}n=O.parse(R(u))}return await s.put(n,e.expectedRevision),await s.saveOperation(_,{requestHash:d,reviewId:n.id,revision:n.revision}),n})}w(A,"command");async function T(i,t,e){return h.transaction(i.scope,async s=>{let n=await s.get(t);n||a("human_review_not_found",404),await l(i,n);let c=e===void 0?n:await s.get(t,e);return c||a("human_review_not_found",404),await r.evidence(i,c),c})}w(T,"get");async function P(i,t){return await r.member(i),h.transaction(i.scope,async e=>{let s,n=[],c=new Set,_=!1;do{let k=await e.list({projectId:t.projectId,afterId:s,limit:100});for(let o of k.items){let I;try{I=await l(i,o)}catch(H){if(H instanceof v&&[403,404].includes(H.status))continue;throw H}let q=!$(o),u=o.assigneeId===i.actorId||o.policy.reviewerIds.includes(i.actorId)||I.owner&&o.assigneeId===null&&o.createdBy===i.actorId,f=u&&I.reviewer&&q&&!o.submissions.some(H=>H.actorId===i.actorId&&H.generation===o.generation&&o.status!=="returned"),g=I.manager&&o.policy.approval==="manager"&&o.status==="submitted";I.manager&&o.policy.approval==="manager"&&(_=!0),(f||g)&&c.add(o.id),(t.view==="mine"?u:t.view==="approval"?I.manager&&o.policy.approval==="manager":o.policy.teamVisible||I.manager)&&(t.status==="active"?q:!q)&&(!t.afterId||o.id>t.afterId)&&n.push(o)}s=k.nextCursor??void 0}while(s);let d=n.slice(0,t.limit);return{items:d,nextCursor:n.length>t.limit?d.at(-1).id:null,actionCount:c.size,approvalAvailable:_}})}w(P,"inbox");async function j(i,t){let e=await T(i,t.id),s=await l(i,e),n=s.owner||s.manager,c=!n&&e.form.mode==="pairwise"&&e.policy.blindPair,_=!n&&e.policy.independentRaters;return{...t,evidence:c?null:t.evidence,evidenceHash:x(t.evidence),formHash:x(t.form),drafts:t.drafts.filter(d=>d.actorId===i.actorId).map(d=>({...d,taskProposal:s.owner?d.taskProposal:E(d.taskProposal)})),submissions:(_?t.submissions.filter(d=>d.actorId===i.actorId):t.submissions).map(d=>({...d,taskProposal:s.owner?d.taskProposal:E(d.taskProposal)})),decisions:_&&!$(e)?[]:t.decisions,audit:n?t.audit:[],createdBy:c?"owner":t.createdBy,permissions:{...s,claim:e.status==="queued"&&e.policy.queueClaim&&e.policy.teamVisible&&(!e.policy.reviewerIds.length||e.policy.reviewerIds.includes(i.actorId)||s.owner)}}}return w(j,"view"),{command:A,get:T,inbox:P,view:j}}w(Q,"createHumanReviewService");async function ne(h){let{service:r,context:b,request:l}=h,A=await r.get(b,l.id);if(A.kind!=="execute"||A.generation!==l.generation)throw new v("human_execution_assignment_stale",409);let T=A.execution;if(T&&T.boundBy!==b.actorId)throw new v("human_execution_executor_changed",403);let P=T?.operationId??`human-run-${x([b.actorId,l.id,l.operationId])}`,j=h.configuration,i={...j,operationId:P,request:{...j.request,operationId:P}},t=x(i),e=T?A:await r.command(b,{action:"reserve_execution",id:l.id,expectedRevision:l.expectedRevision,operationId:`reserve-${l.operationId}`,generation:l.generation,runOperationId:P,configurationHash:t});if(!e.execution||e.execution.operationId!==P||e.execution.configurationHash!==t)throw new v("human_execution_reservation_conflict",409);let s=await r.get(b,l.id);if(s.execution?.executionId)return s.status==="cancelled"&&await h.cancel(s),s;let n;if(T)n=await h.recover(s);else{if(s.generation!==e.generation||["accepted","rejected","cancelled"].includes(s.status))throw new v("human_execution_assignment_stale",409);try{n=await h.dispatch(i,s)}catch(c){if(n=await h.recover(await r.get(b,l.id)),!n)throw c}}if(!n)throw new v("human_execution_admission_recovery_pending",409,"The original execution admission is unavailable. Recover its retained owner outcome before retrying this assignment.");for(let c=0;c<3;c++){let _=await r.get(b,l.id);if(_.generation!==e.generation||!_.execution||_.execution.operationId!==P)throw new v("human_execution_assignment_stale",409);let d;try{d=_.execution.executionId?_:await r.command(b,{action:"bind_execution",id:l.id,expectedRevision:_.revision,operationId:`bind-${P}`,generation:l.generation,runOperationId:P,configurationHash:t,executionId:n.id})}catch(k){if(k instanceof v&&k.code==="human_revision_conflict")continue;throw k}if(d.execution?.executionId!==n.id)throw new v("human_execution_binding_conflict",409);return d.status==="cancelled"&&await h.cancel(d),d}throw new v("human_execution_binding_recovery_pending",409,"The assignment changed while retaining its execution. Retry the original operation to recover that exact run.")}w(ne,"dispatchAssignedHumanExecution");export{U as a,Q as b,ne as c};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as k}from"./chunk-I2NXNMRZ.js";import{f as m}from"./chunk-O72BSKSO.js";import{f as d}from"./chunk-XDQMGUWL.js";import{m as c}from"./chunk-KGNCKIFP.js";import{a as n}from"./chunk-FTQLQJQV.js";import h from"node:path";async function b(o){let{taskset:a}=o,{taskset:f,modelResources:p,learningResources:l}=o.content,u=new Set([...p?.assets??[],...l?.assets??[]].map(e=>e.id)),i=new Map,r=n((e,s=e.path)=>{if(u.has(e.id))return;let t=i.get(e.id);if(t&&(c(t.asset)!==c(e)||t.sourcePath!==s))throw new Error(`Conflicting local Taskset file reference: ${e.id}.`);i.set(e.id,{asset:e,sourcePath:s})},"add");for(let e of d.parse(a.metadata.portableFileInventory??[]))r(e.asset,e.sourcePath);for(let e of f.tasks){let s=a.tasks.find(t=>t.id===e.id);for(let t of e.artifactRefs)r(t,s?.assets?.find(g=>g.id===t.id)?.artifactRef??t.path);for(let t of e.requiredOutputs??[])t.schemaRef&&r(t.schemaRef)}for(let e of f.graders){let s=a.graders.find(t=>t.id===e.id);"verifierRef"in e&&r(e.verifierRef,s?.kind==="custom_verifier"?s.module:e.verifierRef.path),"rubricRef"in e&&r(e.rubricRef)}return m({root:h.join(o.storeDir,"training","tasksets",k(a)),content:o.content,sources:[...i.values()]})}n(b,"captureAuthoredModelTasksetPackage");export{b as a};
@@ -1,9 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{b as e}from"./chunk-ES2ISFJC.js";import{a as o}from"./chunk-FTQLQJQV.js";import{createHash as Ce}from"node:crypto";function F(i){if(i===null||typeof i=="boolean"||typeof i=="string")return i;if(typeof i=="number"){if(!Number.isFinite(i))throw new Error("Canonical JSON cannot encode a non-finite number.");return i}if(Array.isArray(i))return i.map(F);if(typeof i=="object"){let t={};for(let r of Object.keys(i).sort()){let n=i[r];n!==void 0&&(t[r]=F(n))}return t}throw new Error(`Canonical JSON cannot encode ${typeof i}.`)}o(F,"canonicalJson");function R(i){return Ce("sha256").update(JSON.stringify(F(i)),"utf8").digest("hex")}o(R,"canonicalHash");function st(i){if(!i.maxContextTokens||!i.usableContextTokens)return{shouldCompact:!1,projectedTokens:i.projectedTokens,thresholdTokens:Number.MAX_SAFE_INTEGER,usableContextTokens:0,maxContextTokens:0,tokenSource:"heuristic"};let t=Math.max(.01,Math.min(1,(i.triggerPercent??85)/100)),r=Math.max(1,Math.floor(i.usableContextTokens*t));return{shouldCompact:i.projectedTokens>=r,projectedTokens:i.projectedTokens,thresholdTokens:r,usableContextTokens:i.usableContextTokens,maxContextTokens:i.maxContextTokens,tokenSource:"heuristic"}}o(st,"agentCompactionDecision");async function ot(i){await i.started();try{return await i.compact()}catch(t){throw await i.failed(t),t}}o(ot,"runAgentCompaction");async function at(i){let t=i.host.projectEvents(i.events),r=i.host.selectEvents(t,i.maxContextTokens),{summaryEvents:n,preservedEvents:s,preservedEventIds:c}=r;if(n.length===0)throw new Error("There is not enough prior context to compact.");let l=i.host.normalizeRecords(n),u=i.host.normalizeRecords(s),m=i.host.buildFileLedger(i.host.normalizeRecords(t)),h=i.host.serializeRecords(l,i.host.inputCharBudget(i.maxContextTokens));if(!h.text.trim())throw new Error("There is not enough prior context to compact.");let y=i.host.buildSummaryMessages({serializedHistory:h.text,fileLedger:m}),b=Date.now(),v=(await i.host.streamSummary({model:i.model,messages:y,signal:i.signal})).trim(),I=Date.now()-b;if(!v)throw new Error("Compaction summary was empty.");let g=i.host.estimateProjection({events:t,preservedEvents:s,summary:v}),f=i.host.createMetrics({sourceEvents:t.length,summarizedEvents:n.length,preservedEvents:s.length,sourceRecords:h.sourceRecordCount,includedRecords:h.includedRecordCount,omittedRecords:h.omittedRecordCount,preservedRecords:u.length,truncatedRecords:h.truncatedRecordCount,summaryInputTruncated:h.inputTruncated,sourceSelectionStrategy:h.selectionStrategy,summaryInputChars:h.inputChars,retainedTailTokens:r.retainedTailTokens,retainedTailBudgetTokens:r.retainedTailBudgetTokens,finalProviderContextTokens:g.inputTokensAfter,durationMs:I,fileLedgerEntries:m.length,splitTurnId:r.splitTurnId});return{summary:v,model:i.model,compactedThroughEventId:t[t.length-1]?.id??null,compactedThroughTurnId:i.host.lastTurnId(t),preservedFromEventId:s[0]?.id??null,preservedEventIds:c,preservedResourceRefs:i.host.durableResourceRefs(i.events),sourceEventCount:n.length,preservedEventCount:s.length,fileLedger:m,inputTokensBefore:g.inputTokensBefore,inputTokensAfter:g.inputTokensAfter,maxContextTokens:i.maxContextTokens,tokenSource:"heuristic",metrics:f}}o(at,"runAgentCompactionProgram");var qe=e.enum(["thread.started","thread.resumed","turn.started","turn.steered","turn.interrupted","turn.completed","turn.failed","item.started","item.delta","item.completed","assistant.reasoning.delta","assistant.delta","tool.started","tool.completed","approval.requested","approval.resolved","user_input.requested","user_input.resolved","compaction.started","compaction.completed","harness.admitted","harness.refiner.queued","harness.refiner.started","harness.refiner.completed","harness.refiner.failed","diagnostic"]),Pe=e.object({sequence:e.number().int().nonnegative(),name:qe,source:e.enum(["runtime","provider","tool","host","refiner"]),status:e.string().trim().min(1).nullable().default(null),threadId:e.string().trim().min(1),turnId:e.string().trim().min(1).nullable().default(null),callId:e.string().trim().min(1).nullable().default(null),output:e.string().nullable().default(null),error:e.string().nullable().default(null),data:e.record(e.string(),e.unknown()).default({})}).strict();function pt(i){return R(Pe.parse(i))}o(pt,"canonicalEventHash");var A="2026-09-20",bt=["initialize","initialized","runtime/capabilities","thread/start","thread/resume","thread/read","turn/start","turn/steer","task/inbox","task/queue","task/inputUpdate","turn/interrupt","approval/resolve","userInput/resolve","profile/workflows","profile/evaluations","profile/trainingSource","profile/evaluations/prepare","profile/evaluations/run","profile/evaluations/runSuite","profile/evaluations/executeCase","profile/evaluations/executeRun","profile/evaluations/compare","profile/evaluations/report","experiments/executeCase","experiments/cancelCase","harness/inspect","harness/proposalReview","harness/review","harness/acceptEvaluationReview","harness/materializeEvaluationTaskset","harness/runEvaluationBaseline","harness/validate","harness/backgroundReview","harness/diff","harness/rollback","refiner/inspect","refiner/update","refiner/activate","refiner/rollback"],Z=e.object({jsonrpc:e.literal("2.0"),id:e.union([e.string(),e.number()]),method:e.string().trim().min(1),params:e.unknown().optional()}).strict(),ee=e.object({jsonrpc:e.literal("2.0"),method:e.string().trim().min(1),params:e.unknown().optional()}).strict(),W=e.object({jsonrpc:e.literal("2.0"),id:e.union([e.string(),e.number()]),result:e.unknown()}).strict(),J=e.object({jsonrpc:e.literal("2.0"),id:e.union([e.string(),e.number(),e.null()]),error:e.object({code:e.number().int(),message:e.string(),data:e.unknown().optional()}).strict()}).strict(),gt=e.union([Z,ee,W,J]),Ae=e.object({protocolVersion:e.string().trim().min(1),client:e.object({name:e.string().trim().min(1),version:e.string().trim().min(1)}).strict(),capabilities:e.record(e.string(),e.unknown()).default({})}).strict(),B=class{static{o(this,"AgentJsonRpcDispatcher")}#e;#t=null;#r=!1;constructor(t){this.#e=t}get initialized(){return this.#r}async handle(t){let r=ee.safeParse(t);if(r.success&&!("id"in t)){if(r.data.method==="initialized"){if(!this.#t)throw new T(-32002,"initialize must be called first");this.#r=!0}return null}let n=Z.safeParse(t);if(!n.success)return Y(null,-32600,"Invalid Request",n.error.flatten());let s=n.data;try{let c=await this.#n(s.method,s.params);return{jsonrpc:"2.0",id:s.id,result:c}}catch(c){let l=c instanceof T?c:new T(-32603,c instanceof Error?c.message:String(c));return Y(s.id,l.code,l.message,l.data)}}async#n(t,r){if(t==="initialize"){let n=Ae.parse(r);if(n.protocolVersion!==A)throw new T(-32001,"Incompatible agent protocol version",{requested:n.protocolVersion,supported:A});return this.#t=n,{protocolVersion:A,server:{name:"openpond-app-server",version:"1"},capabilities:await this.#e.capabilities()}}if(!this.#r)throw new T(-32002,"initialized notification is required");switch(t){case"runtime/capabilities":return this.#e.capabilities(r);case"thread/start":return this.#e.threadStart(r);case"thread/resume":return this.#e.threadResume(r);case"thread/read":return this.#e.threadRead(r);case"turn/start":return this.#e.turnStart(r);case"turn/steer":return this.#e.turnSteer(r);case"task/inbox":return this.#e.taskInbox(r);case"task/queue":return this.#e.taskQueue(r);case"task/inputUpdate":return this.#e.taskInputUpdate(r);case"turn/interrupt":return this.#e.turnInterrupt(r);case"approval/resolve":return this.#e.approvalResolve(r);case"userInput/resolve":return this.#e.userInputResolve(r);case"profile/workflows":return this.#e.profileWorkflows(r);case"profile/evaluations":return this.#e.profileEvaluations(r);case"profile/trainingSource":return this.#e.profileTrainingSource(r);case"profile/evaluations/prepare":return this.#e.profileEvaluationPrepare(r);case"profile/evaluations/run":return this.#e.profileEvaluationRun(r);case"experiments/executeCase":{if(!this.#e.experimentExecuteCase)throw new Error("Experiment execution is unavailable in this runtime.");return this.#e.experimentExecuteCase(r)}case"experiments/cancelCase":{if(!this.#e.experimentCancelCase)throw new Error("Experiment cancellation is unavailable in this runtime.");return this.#e.experimentCancelCase(r)}case"profile/evaluations/runSuite":return this.#e.profileEvaluationRunSuite(r);case"profile/evaluations/executeCase":return this.#e.profileEvaluationExecuteCase(r);case"profile/evaluations/executeRun":return this.#e.profileEvaluationExecuteRun(r);case"profile/evaluations/compare":return this.#e.profileEvaluationCompare(r);case"profile/evaluations/report":return this.#e.profileEvaluationReport(r);case"harness/inspect":return this.#e.harnessInspect(r);case"harness/proposalReview":return this.#e.harnessProposalReview(r);case"harness/review":return this.#e.harnessReview(r);case"harness/acceptEvaluationReview":return this.#e.harnessAcceptEvaluationReview(r);case"harness/materializeEvaluationTaskset":return this.#e.harnessMaterializeEvaluationTaskset(r);case"harness/runEvaluationBaseline":return this.#e.harnessRunEvaluationBaseline(r);case"harness/validate":return this.#e.harnessValidate(r);case"harness/backgroundReview":return this.#e.harnessBackgroundReview(r);case"harness/diff":return this.#e.harnessDiff(r);case"harness/rollback":return this.#e.harnessRollback(r);case"refiner/inspect":return this.#e.refinerInspect(r);case"refiner/update":return this.#e.refinerUpdate(r);case"refiner/activate":return this.#e.refinerActivate(r);case"refiner/rollback":return this.#e.refinerRollback(r);default:throw new T(-32601,`Method not found: ${t}`)}}},T=class extends Error{static{o(this,"JsonRpcDispatchError")}code;data;constructor(t,r,n){super(r),this.code=t,this.data=n}};function Y(i,t,r,n){return{jsonrpc:"2.0",id:i,error:{code:t,message:r,...n===void 0?{}:{data:n}}}}o(Y,"jsonRpcError");var te=class{static{o(this,"AgentRpcClient")}#e;#t;constructor(t){this.#e=t.request.bind(t),this.#t=t.notify.bind(t)}async initialize(t,r={}){let n=await this.#e("initialize",{protocolVersion:A,client:t,capabilities:r});return await this.#t("initialized"),n}capabilities=o((t={})=>this.#e("runtime/capabilities",t),"capabilities");threadStart=o(t=>this.#e("thread/start",t),"threadStart");threadResume=o(t=>this.#e("thread/resume",t),"threadResume");threadRead=o(t=>this.#e("thread/read",t),"threadRead");turnStart=o(t=>this.#e("turn/start",t),"turnStart");turnSteer=o(t=>this.#e("turn/steer",t),"turnSteer");taskInbox=o(t=>this.#e("task/inbox",t),"taskInbox");taskQueue=o(t=>this.#e("task/queue",t),"taskQueue");taskInputUpdate=o(t=>this.#e("task/inputUpdate",t),"taskInputUpdate");turnInterrupt=o(t=>this.#e("turn/interrupt",t),"turnInterrupt");approvalResolve=o(t=>this.#e("approval/resolve",t),"approvalResolve");userInputResolve=o(t=>this.#e("userInput/resolve",t),"userInputResolve");profileWorkflows=o(t=>this.#e("profile/workflows",t),"profileWorkflows");profileEvaluations=o(t=>this.#e("profile/evaluations",t),"profileEvaluations");profileEvaluationPrepare=o(t=>this.#e("profile/evaluations/prepare",t),"profileEvaluationPrepare");profileEvaluationRun=o(t=>this.#e("profile/evaluations/run",t),"profileEvaluationRun");profileEvaluationRunSuite=o(t=>this.#e("profile/evaluations/runSuite",t),"profileEvaluationRunSuite");profileEvaluationExecuteCase=o(t=>this.#e("profile/evaluations/executeCase",t),"profileEvaluationExecuteCase");profileEvaluationExecuteRun=o(t=>this.#e("profile/evaluations/executeRun",t),"profileEvaluationExecuteRun");profileEvaluationCompare=o(t=>this.#e("profile/evaluations/compare",t),"profileEvaluationCompare");experimentExecuteCase=o(t=>this.#e("experiments/executeCase",t),"experimentExecuteCase");experimentCancelCase=o(t=>this.#e("experiments/cancelCase",t),"experimentCancelCase");harnessInspect=o((t={})=>this.#e("harness/inspect",t),"harnessInspect");harnessProposalReview=o((t={})=>this.#e("harness/proposalReview",t),"harnessProposalReview");harnessReview=o((t={})=>this.#e("harness/review",t),"harnessReview");harnessAcceptEvaluationReview=o((t={})=>this.#e("harness/acceptEvaluationReview",t),"harnessAcceptEvaluationReview");harnessMaterializeEvaluationTaskset=o((t={})=>this.#e("harness/materializeEvaluationTaskset",t),"harnessMaterializeEvaluationTaskset");harnessRunEvaluationBaseline=o((t={})=>this.#e("harness/runEvaluationBaseline",t),"harnessRunEvaluationBaseline");harnessValidate=o((t={})=>this.#e("harness/validate",t),"harnessValidate");harnessBackgroundReview=o((t={})=>this.#e("harness/backgroundReview",t),"harnessBackgroundReview");harnessDiff=o((t={})=>this.#e("harness/diff",t),"harnessDiff");harnessRollback=o((t={})=>this.#e("harness/rollback",t),"harnessRollback");refinerInspect=o(t=>this.#e("refiner/inspect",t),"refinerInspect");refinerUpdate=o(t=>this.#e("refiner/update",t),"refinerUpdate");refinerActivate=o(t=>this.#e("refiner/activate",t),"refinerActivate");refinerRollback=o(t=>this.#e("refiner/rollback",t),"refinerRollback")};var G=e.object({caseId:e.string().trim().min(1).max(191),admissionHash:e.string().regex(/^[a-f0-9]{64}$/),definitionHash:e.string().regex(/^[a-f0-9]{64}$/),ordinal:e.number().int().nonnegative(),operation:e.enum(["create","reset","step","collect","destroy"]),value:e.record(e.string(),e.unknown()),timeoutMs:e.number().int().min(1).max(3e4)}).strict();var d=e.string().trim().min(1).max(200),$=e.string().trim().min(1).max(32e3),z=e.number().int().nonnegative(),re=e.object({id:d,sessionId:d,senderSessionId:d.nullable(),senderKind:e.enum(["user","task","runtime"]),kind:e.enum(["steer","message","followup","queued","result"]),body:$,payload:e.record(e.string(),e.unknown()),idempotencyKey:d,replyTo:d.nullable(),expectedTurnId:d.nullable()}).strict(),ze=e.discriminatedUnion("action",[e.object({action:e.literal("resume"),expectedRevision:e.number().int().positive()}).strict(),e.object({action:e.literal("cancel"),expectedRevision:e.number().int().positive()}).strict(),e.object({action:e.literal("edit"),expectedRevision:e.number().int().positive(),body:$}).strict(),e.object({action:e.literal("steer"),expectedRevision:e.number().int().positive(),expectedTurnId:d}).strict()]),ne=e.object({id:d,sessionId:d,turnId:d,targetSessionId:d.nullable(),targetTurnId:d.nullable(),targetInputId:d.nullable(),afterSequence:z,deadline:e.string(),state:e.enum(["waiting","message","completed","failed","interrupted","unavailable","timeout","cancelled"]),createdAt:e.string(),updatedAt:e.string()}).strict(),ie=e.record(e.string(),e.unknown()),He=e.enum(["queued","running","completed","failed","cancelled","needs_resume"]),Me=e.object({parentSessionId:d.nullable().optional(),childSessionId:d.nullable().optional(),status:e.array(He).nullable().optional(),afterId:e.string().max(200),limit:e.number().int().min(1).max(10)}).strict(),se=e.discriminatedUnion("action",[e.object({action:e.literal("recoverTaskInboxOwners"),ownerId:d}).strict(),e.object({action:e.literal("hasTaskCompletion"),turnId:d}).strict(),e.object({action:e.literal("taskInboxSnapshot"),sessionId:d}).strict(),e.object({action:e.literal("taskInboxSnapshotInputs"),sessionId:d,afterSequence:z}).strict(),e.object({action:e.literal("declareTaskWork"),sessionId:d,turnId:d,ownerId:d,areas:e.array($).max(100)}).strict(),e.object({action:e.literal("taskWorkAreas"),sessionId:d}).strict(),e.object({action:e.literal("admitTaskInput"),input:re}).strict(),e.object({action:e.literal("admitTaskInputs"),inputs:e.array(re).max(50)}).strict(),e.object({action:e.literal("rejectTaskInput"),id:d,error:$}).strict(),e.object({action:e.literal("getTaskInput"),id:d}).strict(),e.object({action:e.literal("taskInputsForSession"),sessionId:d,query:e.object({afterSequence:z.optional(),pendingOnly:e.boolean().optional(),limit:e.number().int().min(1).max(500).optional()}).strict()}).strict(),e.object({action:e.literal("mutateTaskInput"),sessionId:d,inputId:d,change:ze}).strict(),e.object({action:e.literal("openTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("renewTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("pendingTaskInputs"),sessionId:d,turnId:d,afterSequence:z}).strict(),e.object({action:e.literal("taskAssignmentInputs"),turnId:d,afterSequence:z}).strict(),e.object({action:e.literal("pauseTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("includeTaskInputs"),sessionId:d,turnId:d,ownerId:d,requestId:d}).strict(),e.object({action:e.literal("settleTaskInputRequest"),requestId:d,outcome:e.enum(["resolved","failed","replaced"])}).strict(),e.object({action:e.literal("sealTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("sealNativeTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("closeTaskInboxTurn"),sessionId:d,turnId:d,ownerId:d,outcome:e.enum(["completed","failed","interrupted"])}).strict(),e.object({action:e.literal("taskInboxPaused"),sessionId:d}).strict(),e.object({action:e.literal("reserveTaskFollowup"),sessionId:d,turnId:d,ownerId:d}).strict(),e.object({action:e.literal("taskInboxWakeTargets"),afterSessionId:e.string().max(200)}).strict(),e.object({action:e.literal("createTaskWait"),value:ne}).strict(),e.object({action:e.literal("settleTaskWait"),id:d,state:ne.shape.state}).strict(),e.object({action:e.literal("taskWaitsForSession"),sessionId:d,afterId:e.string().max(200)}).strict(),e.object({action:e.literal("commitSubagentCompletion"),value:ie,turnId:d}).strict(),e.object({action:e.literal("pendingTaskCompletions"),afterTurnId:e.string().max(200)}).strict(),e.object({action:e.literal("settleTaskCompletion"),turnId:d,inputId:d}).strict(),e.object({action:e.literal("upsertSubagentRun"),value:ie}).strict(),e.object({action:e.literal("getSubagentRun"),id:d}).strict(),e.object({action:e.literal("listSubagentRuns"),query:Me}).strict()]);var H=e.string().trim().min(1).max(191),oe=e.object({createdAt:e.string().min(1),id:H}).strict(),ae=e.enum(["trigger_decision","route_decision","refiner_outcome","proposal","targeted_validation","apply_receipt"]),ce=e.discriminatedUnion("action",[e.object({action:e.literal("active_release"),workspaceId:H}).strict(),e.object({action:e.literal("put_artifact"),workspaceId:H,kind:ae,artifact:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("artifact_page"),workspaceId:H,kind:ae,before:oe.nullable(),limit:e.number().int().min(1).max(200)}).strict(),e.object({action:e.literal("pending_trigger_page"),workspaceId:H,before:oe.nullable(),limit:e.number().int().min(1).max(200)}).strict()]);var w=e.string().trim().min(1).max(240),le=e.string().regex(/^[a-f0-9]{64}$/),ue=e.enum(["run_overlay","observation","trigger_decision","route_decision","proposal","targeted_validation","apply_receipt","refiner_outcome"]),de=e.object({createdAt:e.string().datetime(),id:w}).strict(),pe=e.discriminatedUnion("action",[e.object({action:e.literal("artifact_put"),workspaceId:w,kind:ue,artifact:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("artifact_page"),workspaceId:w,kind:ue,before:de.nullable(),limit:e.number().int().min(1).max(100)}).strict(),e.object({action:e.literal("pending_page"),workspaceId:w,before:de.nullable(),limit:e.number().int().min(1).max(100)}).strict(),e.object({action:e.literal("workspace_get"),workspaceId:w}).strict(),e.object({action:e.literal("background_get"),workspaceId:w}).strict(),e.object({action:e.literal("overlay_get"),runId:w}).strict(),e.object({action:e.literal("overlay_freeze"),runId:w,expectedRevision:e.number().int().nonnegative(),overlay:e.record(e.string(),e.unknown()),proposal:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("memory_get"),workspaceId:w,sessionId:w,key:w}).strict(),e.object({action:e.literal("memory_page"),workspaceId:w,sessionId:w,before:e.object({updatedAt:e.string().datetime(),key:w}).strict().nullable(),limit:e.number().int().min(1).max(20),includeDeleted:e.boolean()}).strict(),e.object({action:e.literal("memory_write"),sessionId:w,input:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("release_get"),contentHash:le}).strict(),e.object({action:e.literal("release_put"),record:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("session_get"),sessionId:w}).strict(),e.object({action:e.literal("turn_get"),turnId:w}).strict(),e.object({action:e.literal("turn_page"),sessionId:w,before:e.number().int().positive().nullable(),limit:e.number().int().min(1).max(100)}).strict(),e.object({action:e.literal("event_page"),turnId:w,afterSequence:e.number().int().nonnegative(),names:e.array(w).max(40),limit:e.number().int().min(1).max(100)}).strict(),e.object({action:e.literal("event_append"),event:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("usage_put"),record:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("snapshot_restore"),turnId:w,expectedHash:le,snapshot:e.record(e.string(),e.unknown())}).strict()]);var j=e.string().trim().min(1).max(200),me=e.string().regex(/^[a-f0-9]{64}$/),Ve=e.object({kind:e.enum(["structural","visual","test","user_review"]),status:e.enum(["passed","failed","not_run"]),label:e.string().trim().min(1).max(240),detail:e.string().trim().max(4e3).nullable().optional(),ref:e.string().trim().max(4096).nullable().optional()}),he=e.object({id:j,title:e.string().trim().min(1).max(240),sourceTaskId:j,sourceTurnId:j,revision:e.number().int().positive(),createdAt:e.string().datetime(),contentType:e.string().trim().min(1).max(200),sizeBytes:e.number().int().min(1).max(1e7),sha256:me,validation:e.array(Ve).max(32)}).strict(),fe=e.object({sessionId:j,turnId:j,output:he}).strict(),be=e.object({uploadId:j,index:e.number().int().min(0).max(1024),offset:e.number().int().min(0).max(1e7),sha256:me,contentsBase64:e.string().min(1).max(131072)}).strict(),ge=e.object({uploadId:j}).strict(),Ue=he.pick({id:!0,title:!0,sourceTaskId:!0,sourceTurnId:!0,revision:!0,createdAt:!0,validation:!0}),we=e.object({sessionId:j,turnId:j,output:Ue,sandboxPath:e.string().trim().min(1).max(4096)}).strict();var M=e.string().trim().min(1).max(200),Oe=e.object({type:e.enum(["create","get","start","stop","exec","open_port","list_files","download_file","upload_file","search_files","delete_file","stat_file","mkdir","move_file","process_start","process_get","git_status","git_diff","git_export_patch","git_branch","git_commit","git_pull","git_push"]),sandboxId:M.optional(),payload:e.unknown().optional(),processId:M.optional(),failOnUnpreservedChanges:e.boolean().optional()}).strict().superRefine((i,t)=>{i.type!=="create"&&!i.sandboxId&&t.addIssue({code:"custom",message:"Sandbox identity is required."}),i.type==="create"&&i.sandboxId&&t.addIssue({code:"custom",message:"Create cannot target a sandbox identity."}),i.type==="process_get"&&!i.processId&&t.addIssue({code:"custom",message:"Process identity is required."})}),ve=e.object({action:Oe}).strict(),xe=e.object({sessionId:M,turnId:M,name:M}).strict();var p=1,a=e.string().trim().min(1).max(191),C=e.number().int().min(1).max(200),Nt=e.object({teamId:a,ownerUserId:a,workspaceId:a,conversationId:a,turnId:a,attempt:e.number().int().min(1),leaseGeneration:e.number().int().min(1)}).strict(),Ie=e.discriminatedUnion("operation",[e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("profile-evaluations/grade"),params:e.object({action:e.enum(["upload","execute"]),callId:a,sessionId:a,turnId:a,sha256:e.string().regex(/^[a-f0-9]{64}$/),sizeBytes:e.number().int().positive().max(2e7),timeoutMs:e.number().int().positive().max(3e5),offset:e.number().int().nonnegative().max(2e7).optional(),contentsBase64:e.string().max(131072).optional()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("profile-evaluations/sandbox"),params:e.object({sessionId:a,turnId:a,action:e.enum(["upload","exec","read","stop"]),area:e.enum(["policy","runtime"]).optional(),path:e.string().min(1).max(4096).optional(),sha256:e.string().regex(/^[a-f0-9]{64}$/).optional(),sizeBytes:e.number().int().min(0).max(1e7).optional(),offset:e.number().int().min(0).max(1e7).optional(),contentsBase64:e.string().max(131072).optional(),command:e.string().min(1).max(2e4).optional(),stdin:e.string().max(12e4).optional(),cwd:e.string().max(4096).optional(),timeoutMs:e.number().int().min(1).max(18e4).optional()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/list"),params:e.object({}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/read"),params:e.object({fileId:a,revision:e.number().int().min(1),offset:e.number().int().min(0).max(1e7).optional(),maxChars:e.number().int().min(1).max(1e5).optional(),firstPage:e.number().int().min(1).max(1e3).optional(),pageCount:e.number().int().min(1).max(10).optional()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/readBytes"),params:e.object({sessionId:a,turnId:a,fileId:a,revision:e.number().int().positive(),sha256:e.string().regex(/^[a-f0-9]{64}$/),sizeBytes:e.number().int().min(1).max(1e7),offset:e.number().int().min(0).max(1e7)}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("profile.externalDataset.authorize"),params:e.object({bindingHash:e.string().regex(/^[a-f0-9]{64}$/),manifestHash:e.string().regex(/^[a-f0-9]{64}$/).optional(),taskId:a.optional(),seed:e.string().min(1).max(500).optional()}).strict().refine(i=>!!i.taskId==!!i.seed,"Case authority requires both task and seed.")}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("experiment/environment"),params:G}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("experiment/policy"),params:e.object({caseId:a,admissionHash:e.string().regex(/^[a-f0-9]{64}$/),ordinal:e.number().int().nonnegative(),messages:e.array(e.record(e.string(),e.unknown())).max(2e3),tools:e.array(e.record(e.string(),e.unknown())).max(200)}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("sandbox/request"),params:ve}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("embedding/authorize"),params:xe}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/begin"),params:fe}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/chunk"),params:be}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/complete"),params:ge}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("output/saveSandboxFile"),params:we}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("settings/get"),params:e.object({}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/get"),params:e.object({reference:e.object({id:a,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict().nullable()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/overlay/get"),params:e.object({runId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/overlay/put"),params:e.object({runId:a,expectedRevision:e.number().int().min(0).nullable(),overlay:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/overlay/freezeProposal"),params:e.object({runId:a,expectedRevision:e.number().int().min(0),overlay:e.record(e.string(),e.unknown()),proposal:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/memory/get"),params:e.object({workspaceId:a,key:e.string().min(1).max(120)}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/memory/list"),params:e.object({workspaceId:a,includeDeleted:e.boolean(),before:e.object({updatedAt:e.string(),key:e.string()}).strict().nullable(),limit:C}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/memory/search"),params:e.object({workspaceId:a,query:e.string().trim().min(1).max(500),limit:e.number().int().min(1).max(20)}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/memory/write"),params:e.object({input:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/state/read"),params:e.object({workspaceId:a,kind:e.enum(["selection","workspace_settings","evaluation_review_settings","candidates","cross_run_requests"]),afterId:a.nullable(),limit:e.number().int().min(1).max(100)}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("profile-evaluations/execute"),params:e.discriminatedUnion("action",[e.object({action:e.literal("get"),kind:e.enum(["grade","receipt","run","comparison","suite"]),id:a}).strict(),e.object({action:e.literal("page"),kind:e.enum(["grade","receipt","run","comparison","suite"]),profileKey:e.string().regex(/^[a-f0-9]{64}$/),before:e.object({createdAt:e.string(),id:a}).strict().nullable(),limit:e.number().int().min(1).max(100)}).strict(),e.object({action:e.literal("put"),kind:e.enum(["grade","receipt","run","comparison","suite"]),payload:e.record(e.string(),e.unknown()),profileKey:e.string().regex(/^[a-f0-9]{64}$/).nullable(),createdAt:e.string()}).strict()])}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/workspace/transition"),params:e.discriminatedUnion("action",[e.object({action:e.literal("advance"),receiptId:a,workspaceId:a,proposal:e.record(e.string(),e.unknown()),validations:e.array(e.record(e.string(),e.unknown())).max(100),nextRelease:e.object({id:a,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),nextSourceRevision:e.string().min(1),now:e.string()}).strict(),e.object({action:e.literal("reviewedAdvance"),receiptId:a,workspaceId:a,proposal:e.record(e.string(),e.unknown()),validations:e.array(e.record(e.string(),e.unknown())).max(100),nextRelease:e.object({id:a,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),nextSourceRevision:e.string().min(1),reviewer:a,now:e.string()}).strict(),e.object({action:e.literal("rollback"),receiptId:a,workspaceId:a,expectedWorkspaceRevision:e.number().int().nonnegative(),expectedChannelRevision:e.number().int().nonnegative(),targetRelease:e.object({id:a,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),targetSourceRevision:e.string().min(1),rollbackOf:e.object({id:a,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),now:e.string()}).strict()])}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("task-inbox/execute"),params:se}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("harness/review/execute"),params:pe}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("refiner/execute"),params:e.object({action:ce}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("create-improve/execute"),params:e.discriminatedUnion("action",[e.object({action:e.literal("get"),runId:a}).strict(),e.object({action:e.literal("page"),query:e.object({profileId:a.nullable(),targetKind:a.nullable(),targetId:a.nullable(),state:e.array(a).max(20)}).strict(),before:e.object({updatedAt:e.string(),id:a}).strict().nullable(),limit:C}).strict(),e.object({action:e.literal("put"),run:e.record(e.string(),e.unknown())}).strict(),e.object({action:e.literal("mutate"),mutation:e.record(e.string(),e.unknown()),next:e.record(e.string(),e.unknown())}).strict()])}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("approval/get"),params:e.object({approvalId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("approval/upsert"),params:e.object({approval:e.record(e.string(),e.unknown()),expectedRevision:e.number().int().min(1).nullable()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("usage/getByRequestId"),params:e.object({requestId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("usage/upsert"),params:e.object({record:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("usage/page"),params:e.object({query:e.object({sessionId:a.optional(),turnId:a.optional(),provider:a.optional(),model:a.optional(),startedAtFrom:e.string().optional(),startedAtTo:e.string().optional(),visibility:e.enum(["user_facing","background","system"]).optional(),status:e.enum(["started","completed","failed","interrupted","missing"]).optional()}).strict(),before:e.object({startedAt:e.string(),requestOrdinal:e.number().int().min(0),id:a}).strict().nullable(),limit:C}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("capabilities"),params:e.object({}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("session/count"),params:e.object({}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("session/get"),params:e.object({sessionId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("session/page"),params:e.object({afterId:a.nullable(),limit:C}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("session/put"),params:e.object({sessionId:a,expectedRevision:e.number().int().min(1).nullable(),session:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/count"),params:e.object({sessionId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/wakeCount"),params:e.object({sessionId:a,key:e.enum(["messageId","fromRunId"]),value:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/get"),params:e.object({turnId:a}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/put"),params:e.object({sessionId:a,turnId:a,expectedRevision:e.number().int().min(1).nullable(),turn:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/latest"),params:e.object({sessionId:a,status:e.enum(["in_progress","completed","failed","interrupted"]).nullable()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("turn/page"),params:e.object({sessionId:a,beforeSortIndex:e.number().int().min(0).nullable().optional(),limit:C}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("thread/turnPage"),params:e.object({sessionId:a,beforeSortIndex:e.number().int().min(0).nullable().optional(),limit:C}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("event/append"),params:e.object({event:e.record(e.string(),e.unknown())}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("events/page"),params:e.object({sessionId:a.nullable(),afterSequence:e.number().int().min(0),beforeSequence:e.number().int().min(1).nullable().optional(),limit:C,excludeReasoningDeltas:e.boolean().optional()}).strict()}).strict(),e.object({contractVersion:e.literal(p),requestId:a,operation:e.literal("events/latestAssistantText"),params:e.object({sessionId:a}).strict()}).strict()]),Lt=e.object({contractVersion:e.literal(p),operations:e.array(e.enum(["profile.externalDataset.authorize","experiment/policy","experiment/environment","sandbox/request","embedding/authorize","output/begin","output/chunk","output/complete","output/saveSandboxFile","output/list","output/read","output/readBytes","settings/get","harness/get","harness/overlay/get","harness/overlay/put","harness/overlay/freezeProposal","harness/memory/get","harness/memory/list","harness/memory/search","harness/memory/write","harness/state/read","profile-evaluations/execute","profile-evaluations/sandbox","profile-evaluations/grade","harness/review/execute","harness/workspace/transition","task-inbox/execute","refiner/execute","create-improve/execute","approval/get","approval/upsert","usage/getByRequestId","usage/upsert","usage/page","session/count","session/get","session/page","session/put","turn/count","turn/wakeCount","turn/get","turn/put","turn/latest","turn/page","thread/turnPage","event/append","events/page","events/latestAssistantText"])).max(50),allowedTools:e.array(a).max(128),maxPageSize:C,maxRequestBytes:e.number().int().min(1).max(8388608),maxInFlight:e.number().int().min(1).max(64)}).strict();var ye=class{static{o(this,"AgentHostStorageClient")}#e=new Map;#t=null;#r=1;bind(t){if(this.#t)throw new Error("Host storage client is already bound.");this.#t=t}async request(t,r=15e3){let n=Ie.parse(t);if(!this.#t)throw new Error("Host storage transport is unavailable.");if(this.#e.size>=32)throw new Error("Host storage request limit exceeded.");let s=`host-storage:${this.#r++}`,c={jsonrpc:"2.0",id:s,method:"host/storage",params:n},l=n.operation==="experiment/policy"||n.operation==="experiment/environment";if(Buffer.byteLength(JSON.stringify(c))>(l?8388608:256e3))throw new Error("Host storage request is too large.");let u=new Promise((m,h)=>{let y=n.operation==="profile-evaluations/grade"?42e4:n.operation==="sandbox/request"||n.operation==="profile-evaluations/sandbox"||l?3e5:6e4,b=setTimeout(()=>{this.#e.delete(s),h(new Error("Host storage request timed out."))},Math.max(1,Math.min(y,r)));this.#e.set(s,{resolve:m,reject:h,timer:b,maxResponseBytes:n.operation==="experiment/environment"?16e5:1e6})});try{await this.#t(c)}catch(m){let h=this.#e.get(s);h&&(clearTimeout(h.timer),this.#e.delete(s),h.reject(m instanceof Error?m:new Error(String(m))))}return u}accept(t){let r=W.safeParse(t),n=r.success?null:J.safeParse(t),s=r.success?r.data:n?.success?n.data:null;if(!s||typeof s.id!="string"||!s.id.startsWith("host-storage:"))return!1;let c=this.#e.get(s.id);return c?(clearTimeout(c.timer),this.#e.delete(s.id),Buffer.byteLength(JSON.stringify(s))>c.maxResponseBytes?(c.reject(new Error("Host storage response is too large.")),!0):("error"in s?c.reject(new Error(`Host storage request failed: ${s.error.message}`)):c.resolve(s.result),!0)):!0}close(){this.#t=null;for(let t of this.#e.values())clearTimeout(t.timer),t.reject(new Error("Host storage transport closed."));this.#e.clear()}};import{once as Be}from"node:events";import{createInterface as $e}from"node:readline";async function Zt(i){let t=null,r=Promise.resolve(),n=[],s=o(g=>(r=r.then(async()=>{i.writable.write(`${JSON.stringify(g)}
3
- `)||await Be(i.writable,"drain")}),r),"write");i.hostStorageClient?.bind(g=>s(g));let c=o(()=>{if(!(!t?.initialized||n.length===0))for(let g of n.splice(0))s(g)},"flushPendingNotifications"),l,u=new Set,m=$e({input:i.readable,crlfDelay:1/0}),h=[],y=!1,b=null,v=o(async g=>{let f=t;if(!f)throw new Error("Agent runtime dispatcher is unavailable.");let E=(async()=>{let X=await f.handle(g);X&&await s(X),c()})(),Q=g&&typeof g=="object"&&"method"in g?g.method:null;if(Q==="initialize"||Q==="initialized"){await E;return}u.add(E),E.finally(()=>u.delete(E))},"dispatch"),I=(async()=>{let g=typeof i.host=="function"?await i.host():i.host;for(t=new B(g),l=g.subscribe?.(f=>{if(!t?.initialized){n.push(f);return}s(f)});h.length>0;)await v(h.shift());y=!0})().catch(g=>{b=g,m.close()});try{for await(let g of m){if(!g.trim())continue;if(Buffer.byteLength(g,"utf8")>1e6){await s({jsonrpc:"2.0",id:null,error:{code:-32600,message:"Request exceeds the JSONL size limit"}});continue}let f;try{f=JSON.parse(g)}catch{await s({jsonrpc:"2.0",id:null,error:{code:-32700,message:"Parse error"}});continue}if(!i.hostStorageClient?.accept(f))if(y)await v(f);else if(h.length>=64){let E=f&&typeof f=="object"&&"id"in f?f.id:null;(typeof E=="string"||typeof E=="number")&&await s({jsonrpc:"2.0",id:E,error:{code:-32e3,message:"Runtime startup request limit exceeded"}})}else h.push(f)}if(await I,b)throw b;await Promise.all(u),await r}finally{i.hostStorageClient?.close(),l?.()}}o(Zt,"runAgentJsonlServer");async function*ke(i){if(!Number.isInteger(i.maxRounds)||i.maxRounds<1)throw new Error("Provider maxRounds must be a positive integer.");for(let t=0;t<i.maxRounds;t+=1){if(i.signal.aborted)throw i.signal.reason??new Error("Provider loop interrupted.");yield{index:t,requestId:`${i.turnId}:model:${t}`,signal:i.signal}}}o(ke,"providerRoundSequence");async function Ne(i){for await(let t of ke(i)){let r=await i.runRound(t);if(r.type==="complete")return r.result}return i.onExhausted()}o(Ne,"runProviderRoundLoop");async function Le(i){let t="",r="",n,s=null,c,l=[];try{for await(let m of i.stream){if(await i.onDelta?.(m),i.signal.aborted)throw i.signal.reason??new Error("Provider round interrupted.");m.text&&(t+=m.text),m.reasoningText&&(r+=m.reasoningText),m.usage!==void 0&&(n=m.usage),m.continuation!==void 0&&(s=m.continuation),m.toolCalls&&l.push([...m.toolCalls]),m.finishReason!==void 0&&(c=m.finishReason)}let u={text:t,reasoningText:r,usage:n,continuation:s,toolCallBatches:l,finishReason:c};return await i.onCompleted?.(u),u}catch(u){throw await i.onFailed?.(u),u}}o(Le,"runProviderRound");var N=e.object({threadId:e.string().trim().min(1)}).passthrough(),De=N.extend({includeHistory:e.boolean().optional()}),Fe=e.object({session:e.unknown()}).strict(),V=N.extend({input:e.unknown()}),We=V.extend({idempotencyKey:e.string().trim().min(1).max(200)}),Je=V.extend({inputId:e.string().trim().min(1)}),Ge=N.extend({reason:e.string().trim().min(1).optional()}),Ke=e.object({approvalId:e.string().trim().min(1),input:e.unknown()}).strict();function ar(i){let t=o(async(n,s,c)=>{let l=performance.now();i.telemetry?.({method:n,phase:"started",threadId:s,durationMs:null,errorClass:null});try{let u=await c();return i.telemetry?.({method:n,phase:"completed",threadId:s,durationMs:performance.now()-l,errorClass:null}),u}catch(u){throw i.telemetry?.({method:n,phase:"failed",threadId:s,durationMs:performance.now()-l,errorClass:u instanceof Error?u.name:"UnknownError"}),u}},"run"),r=o(async(n,s="thread/read")=>{let{threadId:c,includeHistory:l}=De.parse(n);return t(s,c,async()=>{if(l===!1)return{thread:await i.readThread(c),turns:[],events:[]};let[u,m,h]=await Promise.all([i.readThread(c),i.listTurns(c),i.listEvents(c)]);return{thread:u,turns:m,events:h}})},"threadRead");return{capabilities:o(n=>t("runtime/capabilities",null,()=>i.capabilities(n)),"capabilities"),threadStart:o(async n=>t("thread/start",null,async()=>({thread:await i.createThread(Fe.parse(n).session)})),"threadStart"),threadResume:o(n=>r(n,"thread/resume"),"threadResume"),threadRead:r,turnStart:o(async n=>{let s=V.parse(n);return t("turn/start",s.threadId,async()=>({turn:await i.startTurn(s.threadId,s.input)}))},"turnStart"),turnSteer:o(async n=>{let s=V.parse(n);return t("turn/steer",s.threadId,async()=>({receipt:await i.steerTurn(s.threadId,s.input)}))},"turnSteer"),taskInbox:o(async n=>{let{threadId:s}=N.parse(n);return t("task/inbox",s,()=>i.readTaskInbox(s))},"taskInbox"),taskQueue:o(async n=>{let s=We.parse(n);return t("task/queue",s.threadId,()=>i.queueTaskInput(s.threadId,s.input,s.idempotencyKey))},"taskQueue"),taskInputUpdate:o(async n=>{let s=Je.parse(n);return t("task/inputUpdate",s.threadId,()=>i.updateTaskInput(s.threadId,s.inputId,s.input))},"taskInputUpdate"),turnInterrupt:o(async n=>{let s=Ge.parse(n);return t("turn/interrupt",s.threadId,async()=>({turn:await i.interruptTurn(s.threadId,s.reason)}))},"turnInterrupt"),approvalResolve:o(async n=>{let s=Ke.parse(n);return t("approval/resolve",null,async()=>({approval:await i.resolveApproval(s.approvalId,s.input)}))},"approvalResolve"),userInputResolve:o(async n=>{let s=V.parse(n);return t("userInput/resolve",s.threadId,async()=>(i.isTurnActive(s.threadId)&&await i.waitForTurnSettlement(s.threadId),{turn:await i.startTurn(s.threadId,s.input)}))},"userInputResolve"),profileWorkflows:o(()=>t("profile/workflows",null,()=>i.listProfileWorkflows()),"profileWorkflows"),profileEvaluations:o(n=>t("profile/evaluations",null,()=>i.listProfileEvaluations(n)),"profileEvaluations"),profileTrainingSource:o(()=>t("profile/trainingSource",null,()=>i.loadProfileTrainingSource()),"profileTrainingSource"),profileEvaluationPrepare:o(n=>t("profile/evaluations/prepare",null,()=>i.prepareProfileEvaluationRun(n)),"profileEvaluationPrepare"),profileEvaluationRun:o(n=>t("profile/evaluations/run",null,()=>i.runPreparedProfileEvaluation(n)),"profileEvaluationRun"),...i.executeExperimentCase?{experimentExecuteCase:o(n=>t("experiments/executeCase",null,()=>i.executeExperimentCase(n)),"experimentExecuteCase")}:{},...i.cancelExperimentCase?{experimentCancelCase:o(n=>t("experiments/cancelCase",null,()=>i.cancelExperimentCase(n)),"experimentCancelCase")}:{},profileEvaluationRunSuite:o(n=>t("profile/evaluations/runSuite",null,()=>i.runProfileEvaluationSuite(n)),"profileEvaluationRunSuite"),profileEvaluationExecuteCase:o(n=>t("profile/evaluations/executeCase",null,()=>i.executeProfileEvaluationCase(n)),"profileEvaluationExecuteCase"),profileEvaluationExecuteRun:o(n=>t("profile/evaluations/executeRun",null,()=>i.executeProfileEvaluationRun(n)),"profileEvaluationExecuteRun"),profileEvaluationCompare:o(n=>t("profile/evaluations/compare",null,()=>i.compareProfileEvaluationRuns(n)),"profileEvaluationCompare"),profileEvaluationReport:o(n=>t("profile/evaluations/report",null,()=>i.buildProfileEvaluationReport(n)),"profileEvaluationReport"),harnessInspect:o(()=>t("harness/inspect",null,()=>i.inspectHarness()),"harnessInspect"),harnessProposalReview:o(n=>t("harness/proposalReview",null,()=>i.reviewHarnessProposal(n)),"harnessProposalReview"),harnessReview:o(n=>t("harness/review",null,()=>i.reviewHarness(n)),"harnessReview"),harnessAcceptEvaluationReview:o(n=>t("harness/acceptEvaluationReview",null,()=>i.acceptHarnessEvaluationReview(n)),"harnessAcceptEvaluationReview"),harnessMaterializeEvaluationTaskset:o(n=>t("harness/materializeEvaluationTaskset",null,()=>i.materializeHarnessEvaluationTaskset(n)),"harnessMaterializeEvaluationTaskset"),harnessRunEvaluationBaseline:o(n=>t("harness/runEvaluationBaseline",null,()=>i.runHarnessEvaluationBaseline(n)),"harnessRunEvaluationBaseline"),harnessValidate:o(()=>t("harness/validate",null,()=>i.validateHarness()),"harnessValidate"),harnessBackgroundReview:o(n=>t("harness/backgroundReview",null,()=>i.updateHarnessBackgroundReview(n)),"harnessBackgroundReview"),harnessDiff:o(n=>t("harness/diff",null,()=>i.diffHarness(n)),"harnessDiff"),harnessRollback:o(n=>t("harness/rollback",null,()=>i.rollbackHarness(n)),"harnessRollback"),refinerInspect:o(()=>t("refiner/inspect",null,()=>i.inspectRefiner()),"refinerInspect"),refinerUpdate:o(n=>t("refiner/update",null,()=>i.updateRefiner(n)),"refinerUpdate"),refinerActivate:o(n=>t("refiner/activate",null,()=>i.activateRefiner(n)),"refinerActivate"),refinerRollback:o(n=>t("refiner/rollback",null,()=>i.rollbackRefiner(n)),"refinerRollback"),subscribe:i.subscribeEvents&&i.eventNotification?n=>i.subscribeEvents(s=>n(i.eventNotification(s))):void 0}}o(ar,"createAgentRuntimeService");var q=e.string().regex(/^[a-f0-9]{64}$/),Qe=e.object({harnessReleaseHash:q,instructionsHash:q,skillHashes:e.record(e.string(),q),agentAssetHashes:e.record(e.string(),q),toolCatalogHash:q,memoryRevision:e.number().int().nonnegative().nullable()}).strict(),Xe=e.object({protocolVersion:e.string().trim().min(1),threadId:e.string().trim().min(1),turnId:e.string().trim().min(1),harnessReleaseHash:q,toolCatalogHash:q,context:e.record(e.string(),e.unknown()),pendingInteraction:e.record(e.string(),e.unknown()).nullable(),usage:e.record(e.string(),e.unknown())}).strict();function pr(i){return R(Qe.parse(i))}o(pr,"effectiveSurfaceHash");function mr(i){return R(Xe.parse(i))}o(mr,"checkpointHash");function hr(i){return[i.system,...i.harnessInstructions,...i.skillInstructions,...i.hostInstructions??[]].map(t=>t.trim()).filter(Boolean).join(`
4
-
5
- `)}o(hr,"materializeAgentPrompt");function vr(i){let t=new Map;for(let l of i){let u=l.name.trim();if(!u)throw new Error("Agent tool names cannot be empty.");if(t.has(u))throw new Error(`Duplicate agent tool: ${u}.`);if(!l.unavailableReason&&!l.execute)throw new Error(`Agent tool ${u} is declared as available without an executor.`);t.set(u,{...l,name:u})}let r=[...t.values()].sort((l,u)=>l.name.localeCompare(u.name)),n=r.filter(l=>!l.unavailableReason).map(l=>({name:l.name,description:l.description,inputSchema:e.toJSONSchema(l.inputSchema,{target:"draft-7",unrepresentable:"any"})})),s=r.map(l=>({name:l.name,displayLabel:l.displayLabel??l.name,placement:l.placement,available:!l.unavailableReason,unavailableReason:l.unavailableReason??null})),c=R({modelTools:n,capabilities:s});return{byName:t,tools:r,modelTools:n,capabilities:s,hash:c}}o(vr,"createAgentToolCatalog");async function xr(i,t){let r=i.byName.get(t.name);if(!r)throw new Error(`Unknown agent tool: ${t.name}.`);if(r.unavailableReason)throw new Error(`Agent tool ${t.name} is unavailable: ${r.unavailableReason}`);if(!r.execute)throw new Error(`Agent tool ${t.name} has no executor.`);return r.execute(r.inputSchema.parse(t.arguments),t.context)}o(xr,"executeAgentTool");function Ir(i){let t=new Set,r=[...i].map(c=>{let l=c.name.trim();if(!l)throw new Error("Agent tool names cannot be empty.");if(t.has(l))throw new Error(`Duplicate agent tool: ${l}.`);if(t.add(l),!c.unavailableReason&&!c.executorAvailable)throw new Error(`Agent tool ${l} is declared as available without an executor.`);return{...c,name:l}}).sort((c,l)=>c.name.localeCompare(l.name)),n=r.filter(c=>!c.unavailableReason).map(c=>({name:c.name,description:c.description,inputSchema:c.inputSchema})),s=r.map(c=>({name:c.name,displayLabel:c.displayLabel??c.name,placement:c.placement,available:!c.unavailableReason,unavailableReason:c.unavailableReason??null}));return{byName:new Map(r.map(c=>[c.name,c])),tools:r,modelTools:n,capabilities:s,hash:R({modelTools:n,capabilities:s})}}o(Ir,"createAgentToolCatalogProjection");async function yr(i,t){let r=i.byName.get(t.name);if(!r)throw new Error(`Unknown agent tool: ${t.name}.`);if(r.unavailableReason)throw new Error(`Agent tool ${t.name} is unavailable: ${r.unavailableReason}`);if(!r.execute)throw new Error(`Agent tool ${t.name} has no executor.`);let n=r.validateArguments?r.validateArguments(t.arguments):t.arguments;return r.execute(n,t.context)}o(yr,"executeProjectedAgentTool");var je=class{static{o(this,"TaskSignals")}#e=new Map;notify(t){for(let r of[...this.#e.get(t)??[]])r()}subscribe(t,r){let n=this.#e.get(t);return n||this.#e.set(t,n=new Set),n.add(r),()=>{n.delete(r),n.size===0&&this.#e.delete(t)}}async wait(t){let r=o(()=>{},"wake"),n=0,s=o(()=>{n+=1,r()},"changed"),c=[...new Set(t.taskIds)].map(u=>this.subscribe(u,s)),l=setTimeout(s,Math.max(0,t.deadline-Date.now()));t.signal.addEventListener("abort",s);try{for(;;){t.signal.throwIfAborted();let u=n,m=await t.read();if(m!==null)return m;if(Date.now()>=t.deadline)return null;n===u&&await new Promise(h=>{r=h,(n!==u||t.signal.aborted)&&h()})}}finally{clearTimeout(l),t.signal.removeEventListener("abort",s);for(let u of c)u()}}},_e=class{static{o(this,"TaskSerialExecutor")}#e=new Map;async run(t,r){let s=(this.#e.get(t)??Promise.resolve()).then(r),c=s.then(()=>{},()=>{});this.#e.set(t,c);try{return await s}finally{this.#e.get(t)===c&&this.#e.delete(t)}}};var L=class extends Error{static{o(this,"AcpRpcError")}code;data;constructor(t,r,n){super(r),this.code=t,this.data=n,this.name="AcpRpcError"}};import{execFile as Ye}from"node:child_process";function k(i,t){if(i.pid){if(process.platform==="win32"){Ye("taskkill",["/PID",String(i.pid),"/T",...t==="SIGKILL"?["/F"]:[]],{windowsHide:!0},()=>{});return}try{process.kill(-i.pid,t)}catch(r){if(r.code!=="ESRCH")throw r}}}o(k,"signalNativeProcess");import{spawn as Ze}from"node:child_process";import{StringDecoder as et}from"node:string_decoder";var K=8*1024*1024,D={outcome:{outcome:"cancelled"}};function P(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}o(P,"object");var Se=class{static{o(this,"AcpClient")}options;child=null;pending=new Map;sessions=new Set;activePrompts=new Set;permissions=new Map;nextId=1;buffer="";decoder=new et("utf8");initialized=null;updateQueue=Promise.resolve();stopped=!1;constructor(t){this.options=t}initialize(){return this.initialized?this.initialized:(this.initialized=this.connect(),this.initialized)}async connect(){if(this.stopped)throw new Error("ACP client is closed; reconnect with a new client.");let t=Ze(this.options.command,this.options.args,{cwd:this.options.cwd,env:this.options.env??process.env,stdio:["pipe","pipe","pipe"],shell:!1,detached:process.platform!=="win32"});this.child=t,t.stdout.on("data",r=>this.consume(this.decoder.write(r))),t.stderr.resume(),t.stdin.on("error",r=>this.fail(r)),t.on("error",r=>this.fail(r)),t.on("exit",(r,n)=>this.fail(new Error(`ACP agent exited (${n??r??"unknown"}).`)));try{let r=await this.request("initialize",{protocolVersion:1,clientInfo:{name:"openpond",title:"OpenPond",version:"1"},clientCapabilities:{fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}});if(r.protocolVersion!==1)throw new Error(`Unsupported ACP protocol version: ${r.protocolVersion}`);return r}catch(r){throw await this.stop(),r}}async authenticate(t){let n=(await this.initialize()).authMethods?.find(s=>s.id===t);if(!n)throw new Error("The agent did not advertise this authentication method.");if(n.type==="terminal")throw new Error("Run the agent's terminal login, then reconnect.");await this.request("authenticate",{methodId:t})}async createSession(t,r=[]){await this.initialize();let n=await this.request("session/new",{cwd:t,mcpServers:r});if(typeof n.sessionId!="string"||!n.sessionId)throw new Error("Agent returned no native session identity.");return this.sessions.add(n.sessionId),n}async loadSession(t,r,n=[]){if(!(await this.initialize()).agentCapabilities?.loadSession)throw new Error("This agent does not support native session loading.");this.sessions.add(t);try{let c=await this.request("session/load",{sessionId:t,cwd:r,mcpServers:n});return await this.updateQueue,{...c,sessionId:t}}catch(c){throw this.sessions.delete(t),c}}async setModel(t,r){this.assertSession(t),await this.request("session/set_model",{sessionId:t,modelId:r})}async setMode(t,r){this.assertSession(t),await this.request("session/set_mode",{sessionId:t,modeId:r})}async setConfigOption(t,r,n){return this.assertSession(t),await this.request("session/set_config_option",{sessionId:t,configId:r,value:n})}async prompt(t,r,n){if(this.assertSession(t),n?.aborted)throw new Error("ACP prompt cancelled.");if(this.activePrompts.has(t))throw new Error("A prompt is already active for this native session.");this.activePrompts.add(t);let s,c=o(()=>{this.cancel(t),s=setTimeout(()=>{this.stop()},5e3),s.unref()},"abort");n?.addEventListener("abort",c,{once:!0});try{let l=await this.request("session/prompt",{sessionId:t,prompt:r},0);return await this.updateQueue,n?.aborted?{...l,stopReason:"cancelled"}:l}catch(l){if(n?.aborted)return{stopReason:"cancelled"};throw l}finally{s&&clearTimeout(s),n?.removeEventListener("abort",c),this.activePrompts.delete(t),this.cancelPermissions(t)}}cancel(t){this.cancelPermissions(t),this.sessions.has(t)&&this.child&&this.write({jsonrpc:"2.0",method:"session/cancel",params:{sessionId:t}})}async stop(){if(this.stopped)return;this.stopped=!0;let t=this.child;this.fail(new Error("ACP connection closed.")),!(!t||t.exitCode!==null||t.signalCode!==null)&&await new Promise(r=>{let n=setTimeout(()=>k(t,"SIGKILL"),2e3);n.unref(),t.once("exit",()=>{clearTimeout(n),r()}),k(t,"SIGTERM")})}assertSession(t){if(!this.sessions.has(t))throw new Error("Session does not belong to this ACP connection.")}request(t,r,n=this.options.requestTimeoutMs??3e4){let s=this.nextId++;return new Promise((c,l)=>{let u=n>0?setTimeout(()=>{this.pending.delete(s),l(new Error(`ACP request timed out: ${t}`))},n):void 0;u?.unref(),this.pending.set(s,{resolve:c,reject:l,timer:u});try{this.write({jsonrpc:"2.0",id:s,method:t,params:r})}catch(m){u&&clearTimeout(u),this.pending.delete(s),l(m)}})}write(t){if(!this.child||this.child.stdin.destroyed)throw new Error("ACP connection is not running.");let r=JSON.stringify(t);if(Buffer.byteLength(r)>K)throw new Error("ACP frame exceeds the size limit.");this.child.stdin.write(`${r}
6
- `)}consume(t){this.buffer+=t;let r;for(;(r=this.buffer.indexOf(`
7
- `))!==-1;){let n=this.buffer.slice(0,r);if(this.buffer=this.buffer.slice(r+1),!!n.trim())try{if(Buffer.byteLength(n)>K)throw new Error("ACP frame exceeds the size limit.");this.receive(JSON.parse(n))}catch{this.fail(new Error("Invalid ACP protocol frame.")),this.stop();return}}Buffer.byteLength(this.buffer)>K&&(this.fail(new Error("ACP frame exceeds the size limit.")),this.stop())}receive(t){if(!P(t)||t.jsonrpc!=="2.0")throw new Error("Invalid JSON-RPC envelope.");if(typeof t.method=="string"){if("id"in t){this.handleRequest(t);return}if(t.method==="session/update"&&P(t.params)){let{sessionId:n,update:s}=t.params;if(typeof n!="string"||!this.sessions.has(n)||!P(s))return;this.updateQueue=this.updateQueue.then(async()=>{await this.options.onUpdate?.(n,s)}),this.updateQueue.catch(c=>{this.fail(c),this.stop()})}return}if(typeof t.id!="number")return;let r=this.pending.get(t.id);r&&(this.pending.delete(t.id),r.timer&&clearTimeout(r.timer),P(t.error)?r.reject(new L(Number(t.error.code),String(t.error.message),t.error.data)):r.resolve(t.result))}async handleRequest(t){let r=t.id;if(!(typeof r!="number"&&typeof r!="string"))try{if(t.method!=="session/request_permission"){this.write({jsonrpc:"2.0",id:r,error:{code:-32601,message:"Client method not supported."}});return}let n=t.params;if(!P(n)||typeof n.sessionId!="string"||!Array.isArray(n.options)||!P(n.toolCall))throw new Error("Invalid permission request.");if(this.assertSession(n.sessionId),!this.activePrompts.has(n.sessionId)){this.write({jsonrpc:"2.0",id:r,result:D});return}let s=new AbortController,c=this.permissions.get(n.sessionId)??new Set;c.add(s),this.permissions.set(n.sessionId,c);let l=D;try{if(this.options.onPermission&&(l=await Promise.race([this.options.onPermission(n,s.signal),new Promise(u=>s.signal.addEventListener("abort",()=>u(D),{once:!0}))])),s.signal.aborted&&(l=D),l.outcome.outcome==="selected"){let u=l.outcome.optionId;if(!n.options.some(m=>P(m)&&m.optionId===u))throw new Error("Permission option was not advertised by the agent.")}}finally{c.delete(s),c.size||this.permissions.delete(n.sessionId)}this.child&&this.write({jsonrpc:"2.0",id:r,result:l})}catch{this.child&&this.write({jsonrpc:"2.0",id:r,error:{code:-32602,message:"Invalid or expired client request."}})}}cancelPermissions(t){for(let r of this.permissions.get(t)??[])r.abort();this.permissions.delete(t)}fail(t){let r=this.child,n=!!r;this.child=null,r&&(k(r,"SIGTERM"),setTimeout(()=>k(r,"SIGKILL"),2e3).unref());for(let s of this.pending.values())s.timer&&clearTimeout(s.timer),s.reject(t);this.pending.clear();for(let s of this.sessions)this.cancelPermissions(s);this.sessions.clear(),n&&this.options.onExit?.(t)}};var _=o(i=>i&&typeof i=="object"&&!Array.isArray(i)?i:{},"record"),S=o(i=>typeof i=="number"&&Number.isFinite(i)&&i>=0?Math.floor(i):null,"count"),U=class{static{o(this,"ClaudeObservations")}emit;contextWindows;tools=new Map;models=new Set;latestUsage={};latestModel="unknown";compacting=!1;constructor(t,r=new Map){this.emit=t,this.contextWindows=r}tool(t){let r=String(t.toolCallId),s={...this.tools.get(r)??{},...t};this.tools.set(r,s),this.emit(s)}observe(t){if(!t.parent_tool_use_id){if(t.type==="stream_event"){let r=_(t.event),n=_(r.message);r.type==="message_start"&&this.assistant(n,!0),r.type==="message_delta"&&(this.latestUsage={...this.latestUsage,..._(r.usage)},this.context())}if(t.type==="assistant"){this.assistant(_(t.message),!1);let r=_(t.context_usage),n=S(r.total_tokens),s=S(r.raw_max_tokens);n!==null&&s&&typeof r.model=="string"&&(this.contextWindows.set(r.model,s),this.emit({sessionUpdate:"context_usage",model:r.model,usedTokens:n,maxContextTokens:s}))}if(t.type==="system"&&t.subtype==="status"&&t.status==="compacting"&&!this.compacting&&(this.compacting=!0,this.emit({sessionUpdate:"compaction_started"})),t.type==="system"&&t.subtype==="compact_boundary"){this.compacting=!1,this.latestUsage={};let r=_(t.compact_metadata);this.emit({sessionUpdate:"compaction_completed",reason:r.trigger,preTokens:r.pre_tokens})}}}assistant(t,r){typeof t.model=="string"&&!t.model.startsWith("<")&&(this.latestModel=t.model,this.models.add(t.model));let n=_(t.usage);r?this.latestUsage=n:this.latestUsage={...this.latestUsage,...n,output_tokens:Math.max(S(this.latestUsage.output_tokens)??0,S(n.output_tokens)??0)}}result(t,r){this.finishCompaction(),this.emit({sessionUpdate:"usage_update",usage:t.usage,model:this.models.size>1?"Claude Code (multiple models)":this.latestModel,status:r?"interrupted":t.is_error?"failed":"completed",scope:"main_loop_turn"});for(let[n,s]of Object.entries(_(t.modelUsage))){let c=S(_(s).contextWindow);c&&this.contextWindows.set(n,c)}this.context()}context(){let t=this.contextWindows.get(this.latestModel),r=S(this.latestUsage.input_tokens);if(t&&r!==null){let n=r+(S(this.latestUsage.cache_read_input_tokens)??0)+(S(this.latestUsage.cache_creation_input_tokens)??0)+(S(this.latestUsage.output_tokens)??0);this.emit({sessionUpdate:"context_usage",model:this.latestModel,usedTokens:n,maxContextTokens:t})}}finishCompaction(){this.compacting&&(this.compacting=!1,this.emit({sessionUpdate:"compaction_failed",error:"Claude ended before confirming compaction completed."}))}};import{spawn as tt}from"node:child_process";import{randomUUID as O}from"node:crypto";import{StringDecoder as Ee}from"node:string_decoder";var x=o(i=>i&&typeof i=="object"&&!Array.isArray(i)?i:{},"record"),Re=[{id:"manual",name:"Ask for permissions"},{id:"plan",name:"Plan"},{id:"bypassPermissions",name:"YOLO / Full access"}],Te=class{static{o(this,"ClaudeCliClient")}options;child=null;sessionId=null;pending=new Map;turn=null;messageId="";lastTextMessageId=null;permissions=new Set;updates=Promise.resolve();closed=!1;model="default";contextWindows=new Map;observations=new U(t=>this.emit(t),this.contextWindows);stderrTail="";constructor(t){this.options=t}async initialize(){return{protocolVersion:1,agentCapabilities:{loadSession:!0,mcpCapabilities:{http:!0},promptCapabilities:{image:!0,embeddedContext:!0}},authMethods:[],agentInfo:{name:"Claude Code CLI",version:"native"}}}async authenticate(t){throw new Error("Use Claude Code's native login, then reconnect.")}async createSession(t,r=[]){return this.start(O(),t,!1,r)}async loadSession(t,r,n=[]){return this.start(t,r,!0,n)}async start(t,r,n,s){if(this.child||this.closed)throw new Error("Claude connection already owns a session or is closed.");if(!/^[a-f0-9-]{36}$/i.test(t))throw new Error("Invalid native Claude session identity.");this.sessionId=t;let c=Object.fromEntries(s.map(b=>[String(b.name),{type:"http",url:b.url,headers:Object.fromEntries((Array.isArray(b.headers)?b.headers:[]).map(v=>{let I=x(v);return[String(I.name),String(I.value)]}))}])),l=["--print","--verbose","--input-format","stream-json","--output-format","stream-json","--include-partial-messages","--allow-dangerously-skip-permissions","--permission-prompt-tool","stdio","--append-system-prompt","When you create files for the user, link each deliverable using Markdown with its absolute local path so OpenPond can open it. For example: [Report](/absolute/path/report.pdf).",...(this.options.additionalDirectories??[]).flatMap(b=>["--add-dir",b]),...s.length?["--mcp-config",JSON.stringify({mcpServers:c})]:[],n?"--resume":"--session-id",t],u=tt(this.options.command,l,{cwd:r,env:this.options.env??process.env,stdio:["pipe","pipe","pipe"],shell:!1,detached:process.platform!=="win32"});this.child=u;let m=new Ee("utf8"),h="",y=new Ee("utf8");u.stderr.on("data",b=>{this.stderrTail=(this.stderrTail+y.write(b)).slice(-4096)}),u.stdout.on("data",b=>{h+=m.write(b);let v;for(;(v=h.indexOf(`
8
- `))>=0;){let I=h.slice(0,v);if(h=h.slice(v+1),!!I.trim())try{if(Buffer.byteLength(I)>8*1024*1024)throw new Error("Oversized frame");this.receive(x(JSON.parse(I)))}catch{this.fail(new Error("Invalid Claude CLI protocol frame.")),this.stop();return}}Buffer.byteLength(h)>8*1024*1024&&(this.fail(new Error("Claude CLI frame exceeds limit.")),this.stop())}),u.on("error",b=>this.fail(b)),u.stdin.on("error",b=>this.fail(b)),u.on("exit",b=>{this.fail(new Error(`Claude CLI exited (${b??"signal"}).${this.stderrTail.trim()?` ${this.stderrTail.trim()}`:""}`)),k(u,"SIGTERM"),setTimeout(()=>k(u,"SIGKILL"),2e3).unref(),this.child=null});try{let b=await this.control({subtype:"initialize",hooks:null}),v=Array.isArray(b.models)?b.models.map(x).filter(f=>typeof f.value=="string"):[],I=v.find(f=>f.value==="default")?.description,g=typeof I=="string"?v.find(f=>f.value!=="default"&&typeof f.displayName=="string"&&(I===f.displayName||I.startsWith(`${f.displayName} \xB7`))):void 0;return{sessionId:t,models:{currentModelId:this.model,availableModels:v.map(f=>({modelId:String(f.value),name:f.value==="default"&&g?`${g.displayName} (default)`:String(f.displayName??f.value),...typeof f.description=="string"?{description:f.description}:{}}))},modes:{currentModeId:String(b.current_permission_mode??"manual"),availableModes:Re.map(f=>({...f}))}}}catch(b){throw await this.stop(),b}}async setModel(t,r){this.assertSession(t),await this.control({subtype:"set_model",model:r}),this.model=r}async setMode(t,r){if(this.assertSession(t),!Re.some(n=>n.id===r))throw new Error("Unsupported Claude permission mode.");await this.control({subtype:"set_permission_mode",mode:r})}async prompt(t,r,n){if(this.assertSession(t),this.turn)throw new Error("A prompt is already active for this native session.");if(n?.aborted)throw new Error("Claude turn cancelled.");this.observations=new U(u=>this.emit(u),this.contextWindows),this.stderrTail="",this.messageId=O(),this.lastTextMessageId=null;let s=new Promise((u,m)=>{this.turn={resolve:u,reject:m,signal:n,resultReceived:!1}}),c,l=o(()=>{for(let u of this.permissions)u.abort();this.control({subtype:"interrupt"}).catch(()=>{}),c=setTimeout(()=>{this.stop()},5e3),c.unref()},"abort");n?.addEventListener("abort",l,{once:!0});try{this.write({type:"user",session_id:t,parent_tool_use_id:null,message:{role:"user",content:r.map(m=>m.type==="image"?{type:"image",source:{type:"base64",media_type:m.mimeType,data:m.data}}:m)}});let u=await s;return await this.updates,n?.aborted?{stopReason:"cancelled"}:u}catch(u){if(await this.updates.catch(()=>{}),n?.aborted)return{stopReason:"cancelled"};throw u}finally{n?.removeEventListener("abort",l),c&&clearTimeout(c),this.turn=null;for(let u of this.permissions)u.abort();this.permissions.clear()}}assertSession(t){if(!this.child||this.sessionId!==t||this.closed)throw new Error("Session does not belong to this Claude connection.")}write(t){if(!this.child||this.child.stdin.destroyed)throw new Error("Claude connection is closed.");let r=JSON.stringify(t);if(Buffer.byteLength(r)>8*1024*1024)throw new Error("Claude input exceeds limit.");this.child.stdin.write(`${r}
9
- `)}control(t){let r=O();return new Promise((n,s)=>{let c=setTimeout(()=>{this.pending.delete(r),s(new Error(`Claude control request timed out: ${t.subtype}`))},this.options.requestTimeoutMs??3e4);c.unref(),this.pending.set(r,{resolve:n,reject:s,timer:c});try{this.write({type:"control_request",request_id:r,request:t})}catch(l){clearTimeout(c),this.pending.delete(r),s(l)}})}emit(t){if(!this.turn||!this.sessionId)return;let r=this.sessionId;this.updates=this.updates.then(async()=>{await this.options.onUpdate?.(r,t)}),this.updates.catch(n=>{this.fail(n),this.stop()})}receive(t){if(typeof t.session_id=="string"&&t.session_id!==this.sessionId){this.fail(new Error("Claude changed native session identity.")),this.stop();return}if(this.turn&&!this.turn.resultReceived&&this.observations.observe(t),t.type==="control_response"){let r=x(t.response),n=String(r.request_id),s=this.pending.get(n);if(!s)return;clearTimeout(s.timer),this.pending.delete(n),r.subtype==="error"?s.reject(new Error(String(r.error??"Claude control failed."))):s.resolve(x(r.response))}else if(t.type==="control_request")this.permission(t);else if(t.type==="stream_event"){if(!this.turn||this.turn.resultReceived||t.parent_tool_use_id)return;let r=x(t.event),n=x(r.delta),s=x(r.content_block);if(r.type==="message_start"){let c=x(r.message).id;this.messageId=typeof c=="string"?c:O(),this.lastTextMessageId=null}if(r.type==="content_block_delta"&&(n.type==="text_delta"||n.type==="thinking_delta")){let c=n.type==="text_delta";c&&(this.lastTextMessageId=this.messageId),this.emit({sessionUpdate:c?"agent_message_chunk":"agent_thought_chunk",messageId:this.messageId,phase:c?"commentary":"reasoning",content:{type:"text",text:n.text??n.thinking??""}})}r.type==="content_block_start"&&s.type==="tool_use"&&(this.lastTextMessageId=null,this.observations.tool({sessionUpdate:"tool_call",toolCallId:s.id,title:s.name,kind:"other",status:"in_progress",rawInput:s.input}))}else if(t.type==="assistant"){if(!this.turn||this.turn.resultReceived)return;let r=x(t.message),n=r.content;!t.parent_tool_use_id&&typeof r.id=="string"&&Array.isArray(n)&&n.some(s=>x(s).type==="text")&&(this.lastTextMessageId=r.id),!t.parent_tool_use_id&&Array.isArray(n)&&n.some(s=>x(s).type==="tool_use")&&(this.lastTextMessageId=null);for(let s of Array.isArray(n)?n.map(x):[])s.type==="tool_use"&&this.observations.tool({sessionUpdate:"tool_call_update",toolCallId:s.id,title:s.name,status:"in_progress",rawInput:s.input})}else if(t.type==="user"){if(!this.turn||this.turn.resultReceived)return;let r=x(t.message).content;for(let n of Array.isArray(r)?r.map(x):[])n.type==="tool_result"&&this.observations.tool({sessionUpdate:"tool_call_update",toolCallId:n.tool_use_id,status:n.is_error?"failed":"completed",content:n.content})}else if(t.type==="result"){if(!this.turn||this.turn.resultReceived)return;if(this.turn.resultReceived=!0,t.session_id&&t.session_id!==this.sessionId){this.fail(new Error("Claude changed native session identity."));return}!t.is_error&&!this.turn.signal?.aborted&&typeof t.result=="string"&&t.result.trim()&&this.emit({sessionUpdate:"agent_message_final",messageId:this.lastTextMessageId??O(),content:{type:"text",text:t.result}}),this.observations.result(t,!!this.turn.signal?.aborted),t.is_error?this.turn?.reject(new Error(Array.isArray(t.errors)?t.errors.map(String).join("; "):"Claude turn failed.")):this.turn?.resolve({stopReason:"end_turn"})}}async permission(t){let r=x(t.request),n=String(t.request_id);if(r.subtype!=="can_use_tool"||!this.turn||!this.sessionId){this.write({type:"control_response",response:{subtype:"error",request_id:n,error:"Unsupported or inactive control request."}});return}let s=new AbortController;this.permissions.add(s);try{let c=x(r.input),l=r.tool_name==="AskUserQuestion"&&Array.isArray(c.questions)?c.questions:void 0,u=new Promise(y=>s.signal.addEventListener("abort",()=>y({outcome:{outcome:"cancelled"}}),{once:!0})),m=await Promise.race([u,this.options.onPermission?.({sessionId:this.sessionId,toolCall:{toolCallId:r.tool_use_id,title:r.title??r.tool_name,rawInput:r.input},questions:l,options:[{optionId:"allow",name:"Allow once",kind:"allow_once"},{optionId:"deny",name:"Deny",kind:"reject_once"}]},s.signal)]),h=!s.signal.aborted&&m?.outcome.outcome==="selected"&&m.outcome.optionId==="allow";this.child&&this.write({type:"control_response",response:{subtype:"success",request_id:n,response:h?{behavior:"allow",updatedInput:l?{...c,answers:m?.answers}:r.input}:{behavior:"deny",message:"Permission declined or turn cancelled."}}})}catch{this.child&&this.write({type:"control_response",response:{subtype:"success",request_id:n,response:{behavior:"deny",message:"Permission could not be resolved."}}})}finally{this.permissions.delete(s)}}fail(t){this.observations.finishCompaction();for(let r of this.pending.values())clearTimeout(r.timer),r.reject(t);this.pending.clear(),this.turn?.reject(t),this.turn=null;for(let r of this.permissions)r.abort();this.permissions.clear(),this.options.onExit?.(t)}async stop(){if(this.closed)return;this.closed=!0,this.fail(new Error("Claude connection closed."));let t=this.child;!t||t.exitCode!==null||t.signalCode!==null||(await new Promise(r=>{let n=setTimeout(()=>k(t,"SIGKILL"),2e3);n.unref(),t.once("exit",()=>{clearTimeout(n),r()}),k(t,"SIGTERM")}),this.child=null)}};export{ke as a,Ne as b,Le as c,F as d,R as e,st as f,ot as g,at as h,qe as i,Pe as j,pt as k,A as l,bt as m,Z as n,ee as o,W as p,J as q,gt as r,Ae as s,B as t,te as u,G as v,se as w,ce as x,pe as y,he as z,fe as A,be as B,ge as C,Ue as D,we as E,Oe as F,ve as G,xe as H,p as I,Nt as J,Ie as K,Lt as L,ye as M,Zt as N,ar as O,Qe as P,Xe as Q,pr as R,mr as S,hr as T,vr as U,xr as V,Ir as W,yr as X,je as Y,_e as Z,L as _,Se as $,Te as aa};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{h as c,i as _}from"./chunk-Q4TBTRIG.js";import{a as E}from"./chunk-DIO5CB6U.js";import{d as f}from"./chunk-GJ2ZJFDD.js";import{G as C,I as k,J as t,K as d,L as o,M as g,N as l,P as w,Q as j,T as y,U as q,Y as T,k as I,q as i,u as r,x as A}from"./chunk-Z4Z5UOZM.js";import{c as P,f as n}from"./chunk-FFRFSDBM.js";import{d as R,e as v}from"./chunk-ACYFMLWG.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as u}from"./chunk-FTQLQJQV.js";var b="local_path:";function Y(p){return`${b}${p.trim()}`}u(Y,"localPathWorkspaceId");function Z(p){return p.startsWith(b)&&p.slice(b.length).trim()||null}u(Z,"workspacePathFromLocalPathWorkspaceId");var ee=e.object({appId:e.string(),source:e.enum(["openpond","github","local_git","local_folder","unknown"]),workspacePath:e.string(),repoPath:e.string(),initialized:e.boolean(),remoteUrl:e.string().nullable(),expectedRemoteUrl:e.string().nullable(),currentBranch:e.string().nullable(),headCommit:e.string().nullable().optional().default(null),upstreamBranch:e.string().nullable().optional().default(null),ahead:e.number().int().nonnegative().optional().default(0),behind:e.number().int().nonnegative().optional().default(0),diverged:e.boolean().optional().default(!1),linkedSourceHeadCommit:e.string().nullable().optional().default(null),aheadOfLinkedSource:e.number().int().nonnegative().optional().default(0),behindLinkedSource:e.number().int().nonnegative().optional().default(0),divergedFromLinkedSource:e.boolean().optional().default(!1),linkedSourceComparisonError:e.string().nullable().optional().default(null),lastFetchAt:e.string().nullable().optional().default(null),defaultBranch:e.string().nullable(),branches:e.array(e.string()),dirty:e.boolean(),changedFilesCount:e.number(),untrackedFilesCount:e.number(),error:e.string().nullable(),updatedAt:e.string()}),F=e.object({path:e.string(),status:e.string(),additions:e.number(),deletions:e.number(),patch:e.string(),content:e.string().nullable().optional().default(null)}),ne=e.object({appId:e.string(),repoPath:e.string(),initialized:e.boolean(),dirty:e.boolean(),filesChanged:e.number(),additions:e.number(),deletions:e.number(),repoFiles:e.array(e.string()).optional().default([]),files:e.array(F),error:e.string().nullable(),updatedAt:e.string()}),te=e.object({branch:e.string().trim().min(1).max(160)}),oe=e.object({path:e.string().trim().min(1),content:e.string()}),M=e.object({line:e.number().int().nonnegative(),character:e.number().int().nonnegative()}),U=e.object({start:M,end:M}),N=e.object({path:e.string(),range:U,severity:e.enum(["error","warning","info","hint"]),message:e.string(),source:e.string().nullable().optional().default(null),code:e.string().nullable().optional().default(null)}),W=e.object({id:e.string(),root:e.string(),status:e.enum(["connected","unavailable","error"]),message:e.string().nullable().optional().default(null)}),ae=e.object({path:e.string().trim().min(1),content:e.string().optional(),waitForDiagnostics:e.boolean().optional().default(!0)}),ie=e.object({appId:e.string(),path:e.string(),diagnostics:e.array(N),servers:e.array(W),updatedAt:e.string()}),K=e.object({operation:e.enum(["hover","definition","references","documentSymbol"]),path:e.string().trim().min(1),content:e.string().optional(),line:e.number().int().nonnegative().optional(),character:e.number().int().nonnegative().optional()}),re=e.object({appId:e.string(),operation:K.shape.operation,path:e.string(),results:e.unknown(),servers:e.array(W),updatedAt:e.string()}),h=e.object({pinned:e.boolean().optional(),archived:e.boolean().optional(),order:e.number().optional()}),le=e.record(e.string(),h);var a=e.object({source:e.enum(["local","github","openpond_git"]),repositoryId:e.string().trim().min(1),profileId:e.string().trim().min(1)}),B=e.object({ref:a,revision:e.string().nullable(),sourceHash:e.string()});var s=e.enum(["chat","work","development"]),de=e.enum(["chat","models","console","development"]),D="work";var S=e.enum(["openpond.lab"]),x=e.object({id:e.string(),experience:s.default(D),provider:t,modelRef:n.nullable().optional(),openPondCommandAccessMode:o.default(k),systemKind:S.nullable().optional(),hiddenFromDefaultSidebar:e.boolean().optional(),parentSessionId:e.string().nullable().optional(),parentTurnId:e.string().nullable().optional(),subagentRunId:e.string().nullable().optional(),subagentRoleId:i.nullable().optional(),subagentDelegationMode:r.nullable().optional(),title:e.string(),appId:e.string().nullable(),appName:e.string().nullable(),workspaceKind:l.optional(),workspaceId:e.string().nullable().optional(),workspaceName:e.string().nullable().optional(),localProjectId:e.string().nullable().optional(),cloudProjectId:e.string().nullable().optional(),cloudTeamId:e.string().nullable().optional(),currentProfile:a.nullable().optional(),profileWorkflowBinding:R.nullable().optional(),profileComponentBinding:v.nullable().optional(),metadata:e.record(e.string(),e.unknown()).optional(),cwd:e.string().nullable(),codexThreadId:e.string().nullable(),nativeAgent:e.object({provider:e.union([e.enum(["claude-code","grok-build","opencode"]),P]),instanceId:e.string().min(1),sessionId:e.string().min(1),cwd:e.string().min(1)}).nullable().optional(),createdAt:e.string(),updatedAt:e.string(),status:e.enum(["idle","active","failed","closed"]),runtimeSeconds:e.number().int().nonnegative().optional(),runtimeRunningSince:e.string().nullable().optional(),pinned:e.boolean(),savedForLater:e.boolean().optional(),archived:e.boolean(),order:e.number()}),Ce=e.object({id:e.string(),sessionId:e.string(),providerTurnId:e.string().nullable(),modelRef:n.nullable().optional(),prompt:e.string(),startedAt:e.string(),completedAt:e.string().nullable(),status:e.enum(["in_progress","completed","failed","interrupted"]),error:e.string().nullable(),metadata:e.record(e.string(),e.unknown()).optional().default({}),createImproveRun:c.nullable().optional().default(null),profileSnapshot:B.nullable().optional(),harnessSnapshot:f.nullable().optional()});var L=e.object({id:e.string().trim().min(1).max(191),agentId:e.string().trim().min(1).max(191).optional().nullable(),sourcePath:e.string().trim().min(1).max(2e3).optional().nullable(),sourceActionId:e.string().trim().min(1).max(191).optional().nullable(),name:e.string().trim().min(1).max(191).optional().nullable(),label:e.string().trim().min(1).max(160).optional().nullable(),description:e.string().trim().max(1e3).optional().nullable(),visibility:e.string().trim().max(80).optional().nullable(),inputSchema:e.union([e.string().trim().max(191),e.record(e.string(),e.unknown())]).optional().nullable(),outputSchema:e.union([e.string().trim().max(191),e.record(e.string(),e.unknown())]).optional().nullable(),approvalPolicy:e.record(e.string(),e.unknown()).optional().nullable(),artifactPolicy:e.record(e.string(),e.unknown()).optional().nullable(),setupRequirements:e.array(e.record(e.string(),e.unknown())).optional(),mcp:e.record(e.string(),e.unknown()).optional().nullable(),schedulePolicy:e.record(e.string(),e.unknown()).optional().nullable(),trace:e.record(e.string(),e.unknown()).optional().nullable(),implementation:e.record(e.string(),e.unknown()).optional().nullable(),invokesModel:e.boolean().optional()});var z=e.enum(["slack","microsoft_teams","github","google","turnkey","x","mcp"]),H=e.enum(["slack","microsoft_teams","github","google","turnkey","x","mcp"]),V=e.enum(["native_bot","oauth_connector","wallet_connector","mcp_endpoint"]),X=e.object({kind:e.literal("integration"),provider:z,appIds:e.array(H).min(1).max(4),setupSurfaces:e.array(V).min(1).max(4),connectionIds:e.array(e.string().trim().min(1)).max(8).optional(),capabilities:e.array(e.string().trim().min(1)).max(64).optional()}).strict(),m={maxAttachments:10,maxAttachmentBytes:12*1024*1024,maxAttachmentBase64Chars:Math.ceil(12*1024*1024*4/3)+16,maxTextChars:2e5},$=e.enum(["image","text","file"]),G=e.object({sessionId:e.string().trim().min(1).max(200),turnId:e.string().trim().min(1).max(200),attachmentId:e.string().trim().min(1).max(200),storageName:e.string().trim().min(1).max(240),contentType:e.string().trim().min(1).max(160)}),J=e.object({sessionId:e.string().trim().min(1).max(200),turnId:e.string().trim().min(1).max(200),attachmentId:e.string().trim().min(1).max(200),storageName:e.string().trim().min(1).max(1024),contentType:e.string().trim().min(1).max(160)}),O=e.object({id:e.string().trim().min(1),name:e.string().trim().min(1).max(240),mediaType:e.string().trim().min(1).max(160),sizeBytes:e.number().int().nonnegative().max(m.maxAttachmentBytes),kind:$,lineCount:e.number().int().nonnegative().max(m.maxAttachmentBytes+1).optional(),relativePath:e.string().trim().min(1).max(1024).optional(),text:e.string().max(m.maxTextChars).optional(),contentsBase64:e.string().max(m.maxAttachmentBase64Chars).optional()}),He=O.omit({text:!0,contentsBase64:!0}).extend({imagePreview:G.optional(),filePreview:J.optional()}),Ve=e.object({experience:s.optional(),provider:t.default(C),modelRef:n.optional(),openPondCommandAccessMode:o.optional(),systemKind:S.nullable().optional(),hiddenFromDefaultSidebar:e.boolean().optional(),parentSessionId:e.string().trim().min(1).max(200).nullable().optional(),parentTurnId:e.string().trim().min(1).max(200).nullable().optional(),subagentRunId:e.string().trim().min(1).max(200).nullable().optional(),subagentRoleId:i.nullable().optional(),subagentDelegationMode:r.nullable().optional(),appId:e.string().nullable().optional(),appName:e.string().nullable().optional(),workspaceKind:l.optional(),workspaceId:e.string().nullable().optional(),workspaceName:e.string().nullable().optional(),localProjectId:e.string().nullable().optional(),cloudProjectId:e.string().nullable().optional(),cloudTeamId:e.string().nullable().optional(),currentProfile:a.nullable().optional(),profileWorkflowBinding:x.shape.profileWorkflowBinding,profileComponentBinding:x.shape.profileComponentBinding,metadata:e.record(e.string(),e.unknown()).optional(),cwd:e.string().nullable().optional(),title:e.string().optional(),autoTitlePrompt:e.string().trim().min(1).max(2e4).optional()}),Xe=e.object({teamId:e.string().trim().min(1),projectName:e.string().trim().min(1).max(120).optional(),branch:e.string().trim().min(1).max(120).optional(),chatSessionId:e.string().trim().min(1).max(200).optional(),displayPrompt:e.string().trim().min(1).max(2e3).optional()}),$e=e.object({branch:e.string().trim().min(1).max(120).optional()}),Ge=e.object({prompt:e.string().min(1),workflowInput:e.unknown().optional(),metadata:e.record(e.string(),e.unknown()).optional(),usageAttribution:E.optional().nullable(),cwd:e.string().nullable().optional(),model:e.string().nullable().optional(),modelRef:n.optional(),mentionedAppIds:e.array(e.string().trim().min(1)).max(8).optional(),mentionedConnectedApps:e.array(X).max(8).optional(),openPondActionCatalog:e.array(L).max(100).optional(),attachments:e.array(O).max(m.maxAttachments).optional(),createImproveRun:c.optional().nullable(),approvalPolicy:e.enum(["untrusted","on-failure","on-request","never"]).default("on-request"),sandbox:e.enum(["read-only","workspace-write","danger-full-access"]).default("workspace-write"),codexPermissionMode:d.default("default"),codexReasoningEffort:g.optional()}),Je=e.object({prompt:e.string().min(1),error:e.string().min(1),target:e.enum(["cloud_workspace","hybrid_sandbox"])}),Qe=_,Ye=e.object({reason:e.enum(["manual"]).default("manual"),model:e.string().nullable().optional(),modelRef:n.optional()}),Ze=e.object({experience:s.optional(),provider:t.optional(),modelRef:n.nullable().optional(),openPondCommandAccessMode:o.optional(),pinned:e.boolean().optional(),savedForLater:e.boolean().optional(),archived:e.boolean().optional(),order:e.number().optional(),title:e.string().optional(),parentSessionId:e.string().trim().min(1).max(200).nullable().optional(),parentTurnId:e.string().trim().min(1).max(200).nullable().optional(),subagentRunId:e.string().trim().min(1).max(200).nullable().optional(),subagentRoleId:i.nullable().optional(),subagentDelegationMode:r.nullable().optional(),appId:e.string().nullable().optional(),appName:e.string().nullable().optional(),workspaceKind:l.optional(),workspaceId:e.string().nullable().optional(),workspaceName:e.string().nullable().optional(),localProjectId:e.string().nullable().optional(),cloudProjectId:e.string().nullable().optional(),cloudTeamId:e.string().nullable().optional(),currentProfile:a.nullable().optional(),metadata:e.record(e.string(),e.unknown()).optional(),cwd:e.string().nullable().optional()}),en=e.object({command:e.string().trim().min(1),cwd:e.string().trim().min(1).max(4096).nullable().optional(),timeoutSeconds:e.number().int().min(1).max(3600).optional()}),nn=h,tn=e.object({appIds:e.array(e.string()).min(1)}),on=e.object({expectedRevision:e.string().optional(),defaultChatProvider:t.optional(),defaultChatModel:e.string().min(1).optional(),defaultChatModelRef:n.nullable().optional(),subagents:A.optional(),codexPermissionMode:d.optional(),codexReasoningEffort:g.optional(),openPondCommandAccessMode:o.optional(),defaultBranchPrefix:e.string().trim().max(48).optional(),defaultNewProjectDirectory:e.string().trim().max(4096).optional(),defaultTeamId:e.string().trim().max(191).nullable().optional(),advancedWorkspaceControls:e.boolean().optional(),steerActiveResponses:e.boolean().optional(),contextCompaction:y.optional(),training:q.optional(),sidebarWidth:e.number().int().min(244).max(560).optional(),diffPanelWidth:e.number().int().min(320).max(2400).optional(),sidebarSectionsCollapsed:w.optional(),editor:j.optional()}),an=I,rn=e.object({message:e.string().trim().min(1).max(4e3),surface:e.string().trim().min(1).max(120).default("app"),stack:e.string().max(12e3).nullable().optional(),context:e.record(e.string(),e.unknown()).optional()}).strict();var ln=e.object({activeTemplateId:T,templateName:e.string().trim().min(1).max(80),soul:e.string().trim().min(1).max(8e3),saveAsNew:e.boolean().optional().default(!1)}),sn=e.object({decision:e.enum(["accept","acceptForSession","decline","cancel"]),answers:e.record(e.string().min(1).max(2e3),e.string().trim().min(1).max(8e3)).optional()}),mn=e.object({branch:e.string().trim().min(1).max(240).nullable().optional(),surface:e.enum(["desktop","terminal"])}),pn=e.object({handle:e.string().min(1),baseUrl:e.string().nullable().optional()}),cn=e.object({handle:e.string().min(1),baseUrl:e.string().nullable().optional()}),un=e.object({handle:e.string().min(1).optional(),apiKey:e.string().min(1),baseUrl:e.string().nullable().optional(),apiBaseUrl:e.string().nullable().optional(),chatApiBaseUrl:e.string().nullable().optional(),environment:e.string().nullable().optional(),setActive:e.boolean().optional()}),dn=e.object({handle:e.string().min(1),currentBaseUrl:e.string().nullable().optional(),apiKey:e.string().min(1).optional(),baseUrl:e.string().nullable().optional(),apiBaseUrl:e.string().nullable().optional(),chatApiBaseUrl:e.string().nullable().optional(),environment:e.string().nullable().optional(),setActive:e.boolean().optional()});export{Y as a,Z as b,ee as c,F as d,ne as e,te as f,oe as g,ae as h,ie as i,K as j,re as k,le as l,s as m,D as n,a as o,x as p,Ce as q,L as r,m as s,J as t,O as u,Ve as v,Xe as w,$e as x,Ge as y,Je as z,Qe as A,Ye as B,Ze as C,en as D,nn as E,tn as F,on as G,an as H,rn as I,ln as J,sn as K,mn as L,pn as M,cn as N,un as O,dn as P};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as _}from"./chunk-X4OSOOSU.js";import{b}from"./chunk-65PL62KH.js";import{b as P}from"./chunk-A6USMRWK.js";import{g as h}from"./chunk-KG325WTN.js";import{q as x}from"./chunk-WJ43MJ3F.js";import{h as T}from"./chunk-N4FFQPLR.js";import{h as E,j as w,k as y}from"./chunk-74ZXXBGN.js";import{F as I}from"./chunk-Z4Z5UOZM.js";import{a as l}from"./chunk-FTQLQJQV.js";function L(e){let a=e.result.proposal,d=a?.edits.find(t=>t.target!=="harness.json")??a?.edits[0]??null,c=e.result.outcome.metadata.routed===!0,n=a?e.result.applyReceipt?.decision==="applied"?"applied":"retained":c?"routed":"no_action",r=a?.baseHarnessRelease??e.trigger.harnessRelease,o=n==="applied"?e.result.advanceReceipt?.nextRelease??r:null;return{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:C(e.session)?"always":"material_only",state:"completed",workspaceId:e.result.workspace.id,result:n,decision:a?"propose":c?"route":"no_action",route:a?.route??g(e.result.outcome.metadata.route),operation:d?.operation??null,target:d?.target??null,summary:d?.summary??g(e.result.outcome.metadata.summary)??U(n,a?.route??g(e.result.outcome.metadata.route)),expectedOutcome:a?.expectedOutcome??g(e.result.outcome.metadata.expectedOutcome),reason:e.result.outcome.reason,evidenceBasis:B(e.result),critiqueStatus:a?"passed":"not_applicable",validationStatus:W(e.result),validationReceipts:e.result.validations.map(t=>({id:t.id,contentHash:t.contentHash,status:t.status,summary:t.summary})),edits:a?.edits.map(t=>({id:t.id,operation:t.operation,target:t.target,summary:t.summary,content:t.content}))??[],trigger:{id:e.trigger.id,contentHash:e.trigger.contentHash},outcome:{id:e.result.outcome.id,contentHash:e.result.outcome.contentHash},proposal:a?{id:a.id,contentHash:a.contentHash}:null,applyReceipt:e.result.applyReceipt?{id:e.result.applyReceipt.id,contentHash:e.result.applyReceipt.contentHash}:null,advanceReceipt:e.result.advanceReceipt?{id:e.result.advanceReceipt.id,contentHash:e.result.advanceReceipt.contentHash}:null,inputHarness:r,outputHarness:o}}l(L,"localHarnessRefinerActivityDisplay");function B(e){let a=e.proposal?.metadata.evidenceBasis??e.outcome.metadata.evidenceBasis,d=E.safeParse(a);return d.success?d.data:null}l(B,"evidenceBasisFromResult");function W(e){if(!e.proposal)return"not_applicable";let a=new Map(e.validations.map(c=>[c.validationId,c])),d=e.proposal.validationPlan.filter(c=>c.required);return d.some(c=>!a.has(c.id))?"pending":d.every(c=>a.get(c.id)?.status==="passed")?"passed":"failed"}l(W,"proposalValidationStatus");function C(e){return e.metadata?.automatedTasksetWorkAttempt===!0||typeof e.metadata?.tasksetId=="string"||typeof e.metadata?.benchmarkRuntime=="string"}l(C,"isEvaluationSession");function g(e){return typeof e=="string"&&e.trim()?e.trim():null}l(g,"stringMetadata");function U(e,a){return e==="no_action"?"No reusable change":e==="routed"?a?`${k(a)} issue routed`:"Issue routed":e==="applied"?a?`${k(a)} change`:"Harness change":a?`${k(a)} change`:"Harness change"}l(U,"resultSummary");function k(e){return e.length>0?`${e[0].toUpperCase()}${e.slice(1)}`:e}l(k,"titleCase");function G(e){let a=new Set,d=l((async function(n){if(q(n.session))return;let r=await _({store:e.store,...n});if(!r)return;let o=r.trigger;if(o.decision==="route_deterministically"&&o.deterministicRoute){let t=T({schemaVersion:"openpond.improvementRouteDecision.v1",id:`route-${o.contentHash.slice(0,24)}`,trigger:{id:o.id,contentHash:o.contentHash},route:o.deterministicRoute,authority:"runtime_service",automatic:!0,reason:o.reason,createdAt:o.createdAt,metadata:{}});await e.store.saveHarnessImprovementArtifact(n.turn.harnessSnapshot.workspaceId,"route_decision",t);return}o.decision==="queue_refiner"&&await c(n,o,!1)}),"processLocalHarnessImprovementBoundary");async function c(n,r,o){if(r.decision!=="queue_refiner")throw new Error("Only queued Harness Refiner triggers can be enqueued.");if(a.has(r.contentHash))return;a.add(r.contentHash);let t=Date.now();try{await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.queued",source:"server",appId:n.session.appId,status:"pending",output:r.reason,data:{triggerId:r.id,timeoutMs:w,maxOutputTokens:y,execution:"public_package",recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"running",summary:"Reviewing this Work for a reusable improvement"}}}))}catch(f){throw a.delete(r.contentHash),f}e.queue.enqueue({label:"Refine the Local Harness from a recovered execution detour",metadata:{key:r.contentHash,sessionId:n.session.id,turnId:n.turn.id,triggerId:r.id,recoveredAfterRestart:o}},async()=>{let f=0,p=Date.now(),u=null,i=null;try{await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.started",source:"server",appId:n.session.appId,status:"started",data:{triggerId:r.id,queueWaitMs:Math.max(0,p-t),timeoutMs:w,maxOutputTokens:y,execution:"public_package",recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"running",summary:"Reviewing this Work for a reusable improvement"}}})),await e.prepareReview?.(r);let s=await b({store:e.store,storeDir:e.storeDir,loadActiveRefinerRelease:e.loadActiveRefinerRelease,trigger:r,signal:new AbortController().signal,stream:l(async function*({messages:O,signal:S}){u===null&&(u=Date.now());let M=f++,A=`harness-refiner:${r.id}:${M}`,v=await P({session:n.session,turn:n.turn,provider:"openpond",model:I,requestId:A,requestOrdinal:M,requestKind:"harness_refiner",upsert:e.upsertModelUsageRecord});try{for await(let m of e.streamOpenPondHostedChatTurn({model:I,messages:O,requestId:A,reasoningEffort:"low",maxTokens:y,signal:S}))m.type==="text_delta"&&m.text?(v.observeDelta({text:m.text}),yield{text:m.text}):m.type==="reasoning_delta"&&m.text?v.observeDelta({reasoningText:m.text}):m.type==="usage"&&v.observeDelta({usage:m.usage});await v.complete(),i=Date.now()}catch(m){throw i=Date.now(),await v.fail(m,S.aborted?"interrupted":"failed"),m}},"stream")}),R=Date.now(),H=L({session:n.session,trigger:r,result:s});await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.completed",source:"server",appId:n.session.appId,status:"completed",output:s.outcome.reason,data:{recoveredAfterRestart:o,trigger:{id:r.id,contentHash:r.contentHash},outcome:{id:s.outcome.id,contentHash:s.outcome.contentHash,decision:s.outcome.decision,routed:s.outcome.metadata.routed===!0,route:typeof s.outcome.metadata.route=="string"?s.outcome.metadata.route:null},proposal:s.proposal?{id:s.proposal.id,contentHash:s.proposal.contentHash}:null,workspaceAdvance:s.advanceReceipt?.decision??null,activity:H,timing:{queueWaitMs:Math.max(0,p-t),modelDurationMs:u===null||i===null?null:Math.max(0,i-u),materializationDurationMs:i===null?null:Math.max(0,R-i),totalJobDurationMs:Math.max(0,R-p)}}}))}catch(s){let R=Date.now();throw await e.appendRuntimeEvent(h({sessionId:n.session.id,turnId:n.turn.id,name:"harness.refiner.failed",source:"server",appId:n.session.appId,status:"failed",output:s instanceof Error?s.message:String(s),data:{triggerId:r.id,recoveredAfterRestart:o,activity:{schemaVersion:"openpond.localHarnessRefinerActivityDisplay.v1",visibility:D(n.session),state:"failed",summary:"Refiner review failed",reason:s instanceof Error?s.message:String(s)},timing:{queueWaitMs:Math.max(0,p-t),modelDurationMs:u===null||i===null?null:Math.max(0,i-u),totalJobDurationMs:Math.max(0,R-p)}}})).catch(()=>{}),s}finally{a.delete(r.contentHash)}})}return l(c,"enqueueTrigger"),d.reconcilePending=async()=>{let n=await e.store.listPendingHarnessRefinerTriggers(),r=0;for(let{workspaceId:o,trigger:t}of n){let[f,p]=await Promise.all([e.store.getSession(t.runRef),e.store.getTurn(t.turnId)]);if(!f||!p||p.sessionId!==f.id)throw new Error(`Pending Harness Refiner trigger ${t.id} references an unavailable session or turn.`);if(q(f))continue;let u=p;if(!u.harnessSnapshot){let[i,s]=await Promise.all([e.store.getHarnessWorkspace(o),e.store.getHarnessRunOverlay(t.runRef)]),R=!!(i&&s&&t.overlay&&s.id===t.overlay.id&&s.revision===t.overlay.revision&&s.contentHash===t.overlay.contentHash&&s.workspace.workspaceId===o&&s.workspace.revision===i.revision&&s.workspace.sourceRevision===i.sourceRevision&&s.workspace.channelRevision===i.currentChannel.revision&&s.baseHarnessRelease.id===t.harnessRelease.id&&s.baseHarnessRelease.contentHash===t.harnessRelease.contentHash);if(!i||!s||!t.overlay||!R)throw new Error(`Pending Harness Refiner trigger ${t.id} cannot reconstruct its missing Harness snapshot.`);u=await e.store.updateTurn(u.id,H=>x.parse({...H,harnessSnapshot:{schemaVersion:"openpond.harnessTurnSnapshot.v1",workspaceId:o,workspaceRevision:s.workspace.revision,sourceRevision:s.workspace.sourceRevision,channelName:i.currentChannel.name,channelRevision:s.workspace.channelRevision,harnessRelease:t.harnessRelease,overlay:t.overlay}}))??u}if(u.harnessSnapshot?.workspaceId!==o)throw new Error(`Pending Harness Refiner trigger ${t.id} no longer matches its Harness workspace.`);await c({session:f,turn:u},t,!0),r+=1}return r},d}l(G,"createLocalHarnessImprovementRuntime");function q(e){return e.metadata?.source==="experiment-improvement"&&typeof e.metadata.refinementCandidate=="object"?!0:e.metadata?.automatedTasksetWorkAttempt===!0&&typeof e.metadata.parentModelRunId=="string"&&e.metadata.parentModelRunId.trim().length>0}l(q,"parentModelRunOwnsRefinement");function D(e){return e.metadata?.automatedTasksetWorkAttempt===!0||typeof e.metadata?.tasksetId=="string"||typeof e.metadata?.benchmarkRuntime=="string"?"always":"material_only"}l(D,"refinerActivityVisibility");export{G as a};
@@ -1,2 +0,0 @@
1
- import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{Ab as Q,Bb as W,Cb as P,L as S,O as J,P as K,S as q,h as R,rb as z,sb as U,ub as F,zb as G}from"./chunk-ACYFMLWG.js";import{f as $,m as r}from"./chunk-KGNCKIFP.js";import{b as e}from"./chunk-ES2ISFJC.js";import{a as I}from"./chunk-FTQLQJQV.js";var X=e.object({schemaVersion:e.literal("openpond.humanResultView.v1"),executionId:e.string().min(1),executionHash:e.string().regex(/^[a-f0-9]{64}$/),selection:e.array(S).max(1e4),coverage:e.object({pending:e.number().int().nonnegative(),submitted:e.number().int().nonnegative(),accepted:e.number().int().nonnegative(),rejected:e.number().int().nonnegative(),cancelled:e.number().int().nonnegative()}).strict(),results:e.array(e.object({review:S,decision:S.nullable(),attemptIds:e.array(e.string().min(1)).min(1).max(2),mode:e.enum(["individual","pairwise"]),origin:e.enum(["hosted_retained","recorded_evidence","owner_attested_local","native_local"]),status:e.enum(["pending","submitted","accepted","rejected","cancelled"]),grader:S,answers:e.array(J).max(100)}).strict()).max(1e4)}).strict(),M=X.extend({contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict();function Y(o){let m=o.reviews.map(s=>{let i=K.parse(s),{contentHash:p,...f}=i;if(r(f)!==p||!i.evidence.attempts.some(v=>v.experimentId===o.executionId))throw new R("human_result_selection_mismatch",409);return i});if(new Set(m.map(s=>s.id)).size!==m.length)throw new R("human_result_duplicate_review",422);let n=m.map(s=>{let i=s.decisions.at(-1);return{review:{id:s.id,revision:s.revision,contentHash:s.contentHash},decision:i?{id:i.id,revision:i.revision,contentHash:i.contentHash}:null,attemptIds:s.evidence.attempts.map(p=>p.attemptId),mode:s.form.mode,origin:s.evidence.attempts.some(p=>p.localSource?.kind==="owner_attested_local")?"owner_attested_local":s.evidence.attempts.some(p=>p.localSource?.kind==="native_local")?"native_local":s.evidence.attempts.some(p=>p.recordedSource)?"recorded_evidence":"hosted_retained",status:s.status==="accepted"?"accepted":s.status==="rejected"?"rejected":s.status==="cancelled"?"cancelled":s.status==="submitted"?"submitted":"pending",grader:s.evidence.grader,answers:s.status==="accepted"&&i?.outcome==="accept"?i.answers:[]}}),y={pending:0,submitted:0,accepted:0,rejected:0,cancelled:0};for(let s of n)y[s.status]++;return M.parse(q(X.parse({schemaVersion:"openpond.humanResultView.v1",executionId:o.executionId,executionHash:o.executionHash,selection:n.map(s=>s.review),coverage:y,results:n})))}I(Y,"createHumanResultView");function Z(o,m){let n=K.parse(o),{contentHash:y,...s}=n,i=n.decisions.at(-1);if(y!==r(s)||y!==m.reviewHash||n.status!=="accepted"||!i||i.outcome!=="accept"||i.contentHash!==m.decisionHash)throw new R("human_accepted_revision_unavailable",409);let p=i.submissions.map(f=>{let v=n.submissions.find(w=>w.id===f.id&&w.contentHash===f.contentHash);if(!v||v.evidenceHash!==r(n.evidence)||v.formHash!==r(n.form))throw new R("human_accepted_lineage_invalid",409);return{id:v.id,revision:v.revision,contentHash:v.contentHash}});return{schemaVersion:"openpond.acceptedHumanEvidence.v1",scope:n.scope,projectId:n.projectId,review:{id:n.id,revision:n.revision,contentHash:y},sourceOrigins:n.evidence.attempts.map(f=>f.localSource?f.localSource.kind:f.recordedSource?"recorded_evidence":"hosted_retained"),decision:{id:i.id,revision:i.revision,contentHash:i.contentHash},submissions:p,evidence:n.evidence,answers:i.answers,...n.execution?.result?{execution:{id:n.execution.executionId,result:n.execution.result,configurationHash:n.execution.configurationHash}}:{},...i.taskProposalHash?{taskProposal:n.submissions.find(f=>f.taskProposal?.contentHash===i.taskProposalHash).taskProposal}:{}}}I(Z,"acceptedHumanEvidence");var T=e.string().regex(/^[a-f0-9]{64}$/),V=e.string().min(1).max(240),L={feedbackKey:V,criterionId:V},he=e.discriminatedUnion("kind",[e.object({...L,kind:e.literal("normalized_score"),minimum:e.number().finite(),maximum:e.number().finite(),passThreshold:e.number().min(0).max(1).optional()}).strict(),e.object({...L,kind:e.literal("boolean")}).strict(),e.object({...L,kind:e.literal("category")}).strict(),e.object({...L,kind:e.literal("preference_score"),tieScore:e.number().min(0).max(1).nullable()}).strict()]),ee=e.object({execution:$,resultHash:T,reviews:e.array(e.object({review:S,decision:S}).strict()).min(1).max(1e4)}).strict(),ie=e.object({rules:e.array(he).min(1).max(100),baseline:ee,candidate:ee}).strict().superRefine((o,m)=>{new Set(o.rules.map(n=>n.feedbackKey)).size!==o.rules.length&&m.addIssue({code:"custom",message:"Select each Human feedback key once."})}),ne=e.object({manifest:F,result:G}).strict(),te=e.object({id:V,manifestHash:T,resultHash:T}).strict(),ae=e.object({schemaVersion:e.literal("openpond.humanComparisonProjection.v1"),teamId:V,projectId:V,selections:ie,original:e.object({baseline:te,candidate:te}).strict(),humanResults:e.object({baseline:M,candidate:M}).strict(),baseline:ne,candidate:ne}).strict(),se=ae.extend({contentHash:T}).strict();function d(o){throw new R(o,409)}I(d,"fail");async function Ve(o){let m=ie.parse(o.selections);await o.authorize();let n={baseline:P(o.baseline),candidate:P(o.candidate)},y=new Set([m.baseline.execution.id,m.candidate.execution.id]);y.size!==2&&d("human_comparison_distinct_executions_required");let s=0;async function i(H){let l=n[H],j=m[H],_=l.manifest.lineage?.execution;l.manifest.lineage?.humanProjection&&d("human_comparison_recursive_projection"),(!_||r(_)!==r(j.execution)||l.manifest.teamId!==o.teamId)&&d("human_comparison_execution_changed");let E=[],A=new Map;for(let a of j.reviews){let t=await o.readReview(a.review);(t.scope!==o.teamId||t.projectId!==o.projectId||t.kind!=="grade"||t.revision!==a.review.revision||t.id!==a.review.id)&&d("human_comparison_review_scope_changed");let b=Z(t,{reviewHash:a.review.contentHash,decisionHash:a.decision.contentHash});s+=new TextEncoder().encode(JSON.stringify({answers:b.answers,form:t.form})).byteLength,s>4194304&&d("human_comparison_projection_too_large"),r(b.decision)!==r(a.decision)&&d("human_comparison_decision_changed"),t.evidence.attempts.some(k=>!y.has(k.experimentId))&&d("human_comparison_foreign_attempt");let u=t.evidence.attempts.filter(k=>k.experimentId===_.id);u.length!==1&&d("human_comparison_attempt_ambiguous");let c=u[0],g=await o.caseIdentity(c),h=l.result.cases.find(k=>z(k.identity)===z(g));(!h||g.caseId!==c.taskId||!h.traceRef||h.traceRef.contentHash!==c.trace?.contentHash||h.output===null)&&d("human_comparison_receipt_changed");let x=z(g)+":"+t.evidence.grader.id;A.has(x)&&d("human_comparison_duplicate_assessment"),A.set(x,{review:t,accepted:b,attempt:c}),E.push(t)}let D=Y({executionId:_.id,executionHash:_.contentHash,reviews:E});(D.contentHash!==j.resultHash||D.coverage.accepted!==E.length)&&d("human_comparison_result_changed");let N=new Map(m.rules.map(a=>[a.feedbackKey,a])),oe=l.manifest.evaluators.map(a=>{let t=N.get(a.feedbackKey);if(!t)return a;let b=E.filter(c=>c.evidence.grader.id===a.release.id&&String(c.evidence.grader.revision)===String(a.release.revision)&&c.evidence.grader.contentHash===a.release.contentHash).map(c=>c.form);(!b.length||new Set(b.map(r)).size!==1)&&d("human_comparison_form_changed");let u=b[0].criteria.find(c=>c.id===t.criterionId);return u||d("human_comparison_criterion_unavailable"),(t.kind==="normalized_score"&&(u.kind!=="score"||t.minimum!==u.minimum||t.maximum!==u.maximum||t.maximum<=t.minimum)||t.kind==="boolean"&&u.kind!=="boolean"||t.kind==="category"&&u.kind!=="category"||t.kind==="preference_score"&&(u.kind!=="preference"||b[0].mode!=="pairwise"))&&d("human_comparison_rule_changed"),{...a,output:t.kind==="boolean"?"boolean":t.kind==="category"?"category":"score",categories:u.kind==="category"?u.options:[],configurationHash:r({original:a.configurationHash,rule:t,formHash:r(b[0])})}});m.rules.some(a=>!l.manifest.evaluators.some(t=>t.feedbackKey===a.feedbackKey))&&d("human_comparison_grader_unavailable");let{contentHash:ce,...re}=l.manifest,C={originalManifest:{id:l.manifest.id,contentHash:l.manifest.contentHash},selectionHash:r(j),rulesHash:r(m.rules)},B=Q({...re,id:U(C.originalManifest,C.selectionHash,C.rulesHash),lineage:{...l.manifest.lineage,humanProjection:C},evaluators:oe}),de=l.result.cases.map(a=>{let t=a.feedback.map(u=>{let c=N.get(u.feedbackKey);if(!c)return u;let g=A.get(z(a.identity)+":"+u.evaluator.id);(!g||g.review.evidence.grader.contentHash!==u.evaluator.contentHash)&&d("human_comparison_assessment_missing");let h=g.accepted.answers.find(k=>k.criterionId===c.criterionId),x=null;if(h&&!h.abstain&&(c.kind==="normalized_score"&&typeof h.value=="number"&&(x=(h.value-c.minimum)/(c.maximum-c.minimum)),c.kind==="boolean"&&typeof h.value=="boolean"&&(x=h.value),c.kind==="category"&&typeof h.value=="string"&&(x=h.value),c.kind==="preference_score")){let k=g.review.evidence.attempts.findIndex(O=>O.experimentId===_.id&&O.attemptId===g.attempt.attemptId);x=h.value==="tie"?c.tieScore:h.value==="A"||h.value==="B"?h.value===(k===0?"A":"B")?1:0:null}return{...u,status:x===null?"unavailable":"scored",value:x,passed:x===null?null:c.kind==="boolean"?x:c.kind==="normalized_score"&&c.passThreshold!==void 0?Number(x)>=c.passThreshold:null,reasoning:h?.note??null,evidenceRefs:[{id:g.accepted.review.id,contentHash:g.accepted.review.contentHash,mediaType:"application/vnd.openpond.human-review+json",sizeBytes:null},{id:g.accepted.decision.id,contentHash:g.accepted.decision.contentHash,mediaType:"application/vnd.openpond.human-decision+json",sizeBytes:null}]}}),b=a.output!==null&&t.every(u=>u.status==="scored");return{...a,feedback:t,status:b?"completed":a.status,error:b?null:a.error}}),{contentHash:me,...ue}=l.result,le=W({...ue,manifest:{id:B.id,contentHash:B.contentHash},cases:de},B);for(let a of E){let t=await o.readReview({id:a.id,revision:a.revision,contentHash:a.contentHash});(t.contentHash!==a.contentHash||t.status!=="accepted")&&d("human_comparison_review_changed")}return await o.authorize(),{evidence:{manifest:B,result:le},humanResult:D}}I(i,"lane");let p=await i("baseline"),f=await i("candidate");for(let H of[...m.baseline.reviews,...m.candidate.reviews]){let l=await o.readReview(H.review);(l.contentHash!==H.review.contentHash||l.status!=="accepted"||l.decisions.at(-1)?.contentHash!==H.decision.contentHash)&&d("human_comparison_review_changed")}await o.authorize();let v={baseline:{id:n.baseline.manifest.id,manifestHash:n.baseline.manifest.contentHash,resultHash:n.baseline.result.contentHash},candidate:{id:n.candidate.manifest.id,manifestHash:n.candidate.manifest.contentHash,resultHash:n.candidate.result.contentHash}},w=ae.parse({schemaVersion:"openpond.humanComparisonProjection.v1",teamId:o.teamId,projectId:o.projectId,selections:m,original:v,humanResults:{baseline:p.humanResult,candidate:f.humanResult},baseline:p.evidence,candidate:f.evidence});return new TextEncoder().encode(JSON.stringify(w)).byteLength>8388608&&d("human_comparison_projection_too_large"),se.parse({...w,contentHash:r(w)})}I(Ve,"projectAcceptedHumanComparison");function Ce(o,m){let n=se.parse(o),{contentHash:y,...s}=n;y!==r(s)&&d("human_comparison_projection_invalid");for(let i of["baseline","candidate"]){let p=P(n[i]),f=p.manifest.lineage,v=f?.humanProjection,w=n.original[i],H=n.selections[i];(!f||!v||v.originalManifest.id!==w.id||v.originalManifest.contentHash!==w.manifestHash||v.selectionHash!==r(H)||v.rulesHash!==r(n.selections.rules)||r(f.execution)!==r(H.execution)||p.manifest.teamId!==n.teamId||n.humanResults[i].contentHash!==H.resultHash)&&d("human_comparison_projection_lineage_changed");let{contentHash:l,...j}=n.humanResults[i];if((r(j)!==l||j.executionId!==H.execution.id||j.executionHash!==H.execution.contentHash||r(j.selection)!==r(H.reviews.map(_=>_.review)))&&d("human_comparison_human_result_changed"),m){let _=P(m[i]);(_.manifest.lineage?.humanProjection||_.manifest.id!==w.id||_.manifest.contentHash!==w.manifestHash||_.result.contentHash!==w.resultHash||r(_.manifest.lineage?.execution)!==r(H.execution))&&d("human_comparison_original_changed")}}return n}I(Ce,"verifyHumanComparisonProjection");export{M as a,Y as b,ie as c,se as d,Ve as e,Ce as f};