openpond 0.2.67 → 0.2.68

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 (564) hide show
  1. package/dist/app-server.d.ts +668 -1
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/{account-context-TIJOM22A.js → account-context-MWB6HN6I.js} +1 -1
  4. package/dist/chunks/{acp-NASAJV5E.js → acp-2OIXATRY.js} +1 -1
  5. package/dist/chunks/{acp-agent-C3CRF6DT.js → acp-agent-PAGX2B47.js} +1 -1
  6. package/dist/chunks/actions-command-2VE6YI4W.js +2 -0
  7. package/dist/chunks/{app-layer-XIEZ6ALX.js → app-layer-YNEUEOEP.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-IB6M35NS.js → app-server-connected-apps-TZOAUOYR.js} +1 -1
  9. package/dist/chunks/app-server-evaluations-RRLYWLPK.js +2 -0
  10. package/dist/chunks/app-server-harness-services-XXM336NU.js +2 -0
  11. package/dist/chunks/app-server-runtime-GBX65JJ7.js +2 -0
  12. package/dist/chunks/apps-RSFEJOQN.js +2 -0
  13. package/dist/chunks/chunk-2PXKSAG6.js +2 -0
  14. package/dist/chunks/{chunk-XEU4J4GJ.js → chunk-2TGHZXJE.js} +2 -2
  15. package/dist/chunks/{chunk-AXO6OHJB.js → chunk-3A2Y7UK3.js} +1 -1
  16. package/dist/chunks/chunk-3Z4VM2LF.js +4 -0
  17. package/dist/chunks/{chunk-V3T2OJBZ.js → chunk-4BUM6JEC.js} +2 -2
  18. package/dist/chunks/chunk-4G3GTEVS.js +23 -0
  19. package/dist/chunks/{chunk-43QYVOYA.js → chunk-4KNPCJR4.js} +1 -1
  20. package/dist/chunks/chunk-4KTGYHCE.js +2 -0
  21. package/dist/chunks/chunk-4PUOWSDE.js +13 -0
  22. package/dist/chunks/chunk-55YD4UTW.js +2 -0
  23. package/dist/chunks/chunk-5G7BQAUA.js +2 -0
  24. package/dist/chunks/chunk-65FJWWXG.js +2 -0
  25. package/dist/chunks/{chunk-4EZI4KCT.js → chunk-65WRWLUD.js} +1 -1
  26. package/dist/chunks/chunk-6D3FI2XT.js +2 -0
  27. package/dist/chunks/chunk-73TW6BKK.js +6 -0
  28. package/dist/chunks/{chunk-5TPYBXWM.js → chunk-7NCM6GBN.js} +1 -1
  29. package/dist/chunks/chunk-7OFD6TFD.js +2 -0
  30. package/dist/chunks/chunk-7OKZCJHS.js +3 -0
  31. package/dist/chunks/{chunk-ADOCQA4D.js → chunk-7PKDJHT6.js} +1 -1
  32. package/dist/chunks/chunk-7RJOCGQ6.js +2 -0
  33. package/dist/chunks/{chunk-YR5URT73.js → chunk-7RSQOC5M.js} +3 -3
  34. package/dist/chunks/{chunk-FVK4W27G.js → chunk-AFH462DO.js} +1 -1
  35. package/dist/chunks/{chunk-GUG2SWRZ.js → chunk-AFKFN25T.js} +1 -1
  36. package/dist/chunks/chunk-AFYYIJ6K.js +2 -0
  37. package/dist/chunks/{chunk-U3MVH2YT.js → chunk-APKXXAUF.js} +1 -1
  38. package/dist/chunks/chunk-AQUZCWM3.js +2 -0
  39. package/dist/chunks/chunk-AUO5DCEU.js +2 -0
  40. package/dist/chunks/chunk-AYOMVI7J.js +2 -0
  41. package/dist/chunks/{chunk-RWRKUO5D.js → chunk-B66QCXH2.js} +1 -1
  42. package/dist/chunks/{chunk-SODAOLAP.js → chunk-BHKXPWFB.js} +1 -1
  43. package/dist/chunks/chunk-BU6MW65V.js +10 -0
  44. package/dist/chunks/{chunk-P6NQYXN6.js → chunk-CCZ276IA.js} +1 -1
  45. package/dist/chunks/{chunk-YONDU5TN.js → chunk-CIZI6Z7D.js} +1 -1
  46. package/dist/chunks/{chunk-ATFV2NA4.js → chunk-CO23RRN7.js} +1 -1
  47. package/dist/chunks/{chunk-QAFXQHHG.js → chunk-D6L6UNUQ.js} +2 -2
  48. package/dist/chunks/chunk-DDOIPTOM.js +2 -0
  49. package/dist/chunks/{chunk-CSU7RDA5.js → chunk-DKOVZ6R2.js} +3 -3
  50. package/dist/chunks/chunk-DRLP7GIU.js +2 -0
  51. package/dist/chunks/{chunk-DAEUVT2I.js → chunk-DRTHKWHK.js} +1 -1
  52. package/dist/chunks/{chunk-XDFXKRTI.js → chunk-DWF3FCY4.js} +1 -1
  53. package/dist/chunks/{chunk-W3ZILZUL.js → chunk-DWM5G7BU.js} +1 -1
  54. package/dist/chunks/chunk-DXJC3QW7.js +2 -0
  55. package/dist/chunks/{chunk-IDILAYCW.js → chunk-E2JB5OCO.js} +1 -1
  56. package/dist/chunks/{chunk-GI7LTJV3.js → chunk-EDYCSW22.js} +1 -1
  57. package/dist/chunks/{chunk-4JYTFEND.js → chunk-EFP75UEX.js} +1 -1
  58. package/dist/chunks/{chunk-CX7HKSQ4.js → chunk-EGP6DF34.js} +2 -2
  59. package/dist/chunks/{chunk-D5OFN47Z.js → chunk-ESYPMD7Q.js} +1 -1
  60. package/dist/chunks/{chunk-PWKJ5KLZ.js → chunk-EXYSD45J.js} +1 -1
  61. package/dist/chunks/{chunk-R6VI7MX5.js → chunk-EYTTZ5H4.js} +1 -1
  62. package/dist/chunks/chunk-FKUWCJ73.js +161 -0
  63. package/dist/chunks/{chunk-WD6ANOLL.js → chunk-FNGZ4UDZ.js} +1 -1
  64. package/dist/chunks/{chunk-JFZ6USNQ.js → chunk-G7X73SBG.js} +1 -1
  65. package/dist/chunks/{chunk-36FNNR5N.js → chunk-GEYZVOGD.js} +1 -1
  66. package/dist/chunks/{chunk-ULJZ7NUF.js → chunk-GY7YSD6J.js} +1 -1
  67. package/dist/chunks/{chunk-CWAQOFLP.js → chunk-GYYJ47GX.js} +1 -1
  68. package/dist/chunks/chunk-HG2YFMVU.js +4 -0
  69. package/dist/chunks/{chunk-YQBL5P6R.js → chunk-HKVFU3B3.js} +1 -1
  70. package/dist/chunks/{chunk-VEXJV5H5.js → chunk-IIT66347.js} +4 -4
  71. package/dist/chunks/{chunk-B2K5WQZE.js → chunk-IO5DZUKL.js} +1 -1
  72. package/dist/chunks/chunk-J256AEEE.js +2 -0
  73. package/dist/chunks/{chunk-CRDKBFRN.js → chunk-JEMECEQH.js} +1 -1
  74. package/dist/chunks/{chunk-7P5SH3CI.js → chunk-JPUSTFZC.js} +1 -1
  75. package/dist/chunks/{chunk-YMCF5GR2.js → chunk-JQOVC35K.js} +1 -1
  76. package/dist/chunks/{chunk-6LFTQBXP.js → chunk-JT5YQ52I.js} +1 -1
  77. package/dist/chunks/chunk-JVMSN7LH.js +2 -0
  78. package/dist/chunks/{chunk-HORMGT2Q.js → chunk-JXYJQT5Q.js} +1 -1
  79. package/dist/chunks/{chunk-WDKZMXIU.js → chunk-K7KBFM2T.js} +1 -1
  80. package/dist/chunks/{chunk-UBTP3QWI.js → chunk-KCLMA2IH.js} +1 -1
  81. package/dist/chunks/chunk-KDER7R45.js +2 -0
  82. package/dist/chunks/{chunk-IXZ5ZGIL.js → chunk-KOC3YJEU.js} +2 -2
  83. package/dist/chunks/{chunk-R6MMWEH4.js → chunk-KP2MYTP5.js} +1 -1
  84. package/dist/chunks/{chunk-TV2LE2BD.js → chunk-KU4TPDPH.js} +2 -2
  85. package/dist/chunks/{chunk-WJSJXK2N.js → chunk-KUE46HTH.js} +1 -1
  86. package/dist/chunks/chunk-LVXL7T5O.js +2 -0
  87. package/dist/chunks/{chunk-TSQ2I6XV.js → chunk-M4A7G4S5.js} +2 -2
  88. package/dist/chunks/{chunk-MX7KV5DA.js → chunk-M4ZHFDRJ.js} +1 -1
  89. package/dist/chunks/{chunk-26ID6A5C.js → chunk-MEJLWNRS.js} +1 -1
  90. package/dist/chunks/{chunk-XT5WUQGT.js → chunk-MIFVX5PK.js} +1 -1
  91. package/dist/chunks/{chunk-4VZJQRQI.js → chunk-MOXIGLN2.js} +1 -1
  92. package/dist/chunks/{chunk-UKSSFB4Q.js → chunk-N5EAVX4G.js} +1 -1
  93. package/dist/chunks/{chunk-4B7EGNYX.js → chunk-NMMHXYDJ.js} +1 -1
  94. package/dist/chunks/{chunk-EBOTNBUS.js → chunk-NRYC4NH6.js} +1 -1
  95. package/dist/chunks/chunk-NSSZ2ZIU.js +2 -0
  96. package/dist/chunks/{chunk-4TTXNVCE.js → chunk-OFJPOTES.js} +1 -1
  97. package/dist/chunks/chunk-OIH2LPIT.js +2 -0
  98. package/dist/chunks/chunk-OUJ63LMU.js +2 -0
  99. package/dist/chunks/{chunk-SD2XDZQW.js → chunk-P4QM63L3.js} +1 -1
  100. package/dist/chunks/chunk-PACLKDTN.js +2 -0
  101. package/dist/chunks/{chunk-VPAEFG7X.js → chunk-PAYFJHPO.js} +1 -1
  102. package/dist/chunks/{chunk-OPTJYDZN.js → chunk-PHZZBXDO.js} +1 -1
  103. package/dist/chunks/{chunk-HPTEJBP4.js → chunk-PKJHN666.js} +1 -1
  104. package/dist/chunks/{chunk-HNDAGZCF.js → chunk-PLROXHG2.js} +1 -1
  105. package/dist/chunks/{chunk-UNE52L3Y.js → chunk-PNPV2LDE.js} +1 -1
  106. package/dist/chunks/{chunk-2RSGVLZT.js → chunk-PSY6IRJE.js} +8 -8
  107. package/dist/chunks/{chunk-SVNEPXU3.js → chunk-Q73RKX7I.js} +1 -1
  108. package/dist/chunks/{chunk-IF5A3XWP.js → chunk-Q7FBVLLB.js} +1 -1
  109. package/dist/chunks/{chunk-V5AOM5MZ.js → chunk-Q7P34B2O.js} +1 -1
  110. package/dist/chunks/{chunk-375PADDM.js → chunk-QLGP2OAQ.js} +1 -1
  111. package/dist/chunks/{chunk-QQLS5FB7.js → chunk-QUNQM2E3.js} +1 -1
  112. package/dist/chunks/chunk-R2FYCJL6.js +2 -0
  113. package/dist/chunks/{chunk-6HQUIKC5.js → chunk-R4EEGWXB.js} +1 -1
  114. package/dist/chunks/chunk-RBTDSI4L.js +11 -0
  115. package/dist/chunks/chunk-RCQYEHHD.js +2 -0
  116. package/dist/chunks/{chunk-TGULVWPV.js → chunk-RFQD6B44.js} +1 -1
  117. package/dist/chunks/{chunk-3WJQ4IGK.js → chunk-RPM4FDRX.js} +1 -1
  118. package/dist/chunks/{chunk-MCBRB5D6.js → chunk-RY46UPBO.js} +4 -4
  119. package/dist/chunks/{chunk-K3LS5SK7.js → chunk-SDHG6CKU.js} +1 -1
  120. package/dist/chunks/{chunk-XKZ4PFMQ.js → chunk-SO4GMSNP.js} +1 -1
  121. package/dist/chunks/{chunk-O6ZYDHEJ.js → chunk-SSHE6B7Z.js} +1 -1
  122. package/dist/chunks/{chunk-SH7POUVX.js → chunk-SV7ZBEK2.js} +6 -6
  123. package/dist/chunks/{chunk-BJXPQIVD.js → chunk-U7D6Q744.js} +1 -1
  124. package/dist/chunks/chunk-U7X5ZLAL.js +2 -0
  125. package/dist/chunks/{chunk-N54CPLVD.js → chunk-UANH7U3Y.js} +1 -1
  126. package/dist/chunks/{chunk-BUZ7CBJC.js → chunk-UGFSAG4U.js} +1 -1
  127. package/dist/chunks/chunk-ULTV6INR.js +2 -0
  128. package/dist/chunks/{chunk-V3ILZQER.js → chunk-UMAVVMXL.js} +7 -7
  129. package/dist/chunks/chunk-V24VHT76.js +2 -0
  130. package/dist/chunks/chunk-VEBW7NKD.js +2 -0
  131. package/dist/chunks/chunk-VJR2GNRY.js +2 -0
  132. package/dist/chunks/{chunk-JD76ANPN.js → chunk-VJYOKU3C.js} +1 -1
  133. package/dist/chunks/{chunk-H2XG5N7D.js → chunk-VWWKWYSQ.js} +1 -1
  134. package/dist/chunks/chunk-WCNPGKST.js +2 -0
  135. package/dist/chunks/chunk-WD4KAKEX.js +2 -0
  136. package/dist/chunks/chunk-WGQ3FMRF.js +2 -0
  137. package/dist/chunks/{chunk-6C3CXME7.js → chunk-WNXUSELC.js} +1 -1
  138. package/dist/chunks/{chunk-RS526BG7.js → chunk-WZ35ICTE.js} +3 -3
  139. package/dist/chunks/chunk-XHACK2KR.js +2 -0
  140. package/dist/chunks/chunk-XOPHFUUY.js +2 -0
  141. package/dist/chunks/{chunk-YKTJPCYZ.js → chunk-XQAUHXL4.js} +4 -4
  142. package/dist/chunks/{chunk-ZVMQLIRA.js → chunk-XT4CSKHM.js} +1 -1
  143. package/dist/chunks/{chunk-KQD36SBJ.js → chunk-XY7HFXLH.js} +1 -1
  144. package/dist/chunks/{chunk-UXO33ST5.js → chunk-XYZV3FKD.js} +1 -1
  145. package/dist/chunks/{chunk-GC6RJBRZ.js → chunk-Y2WNZWT2.js} +1 -1
  146. package/dist/chunks/chunk-Y4I6CFZJ.js +2 -0
  147. package/dist/chunks/chunk-YDZBX4XQ.js +2 -0
  148. package/dist/chunks/chunk-YI6ME6PU.js +22 -0
  149. package/dist/chunks/{chunk-H42UW6IF.js → chunk-YXMYK5P7.js} +1 -1
  150. package/dist/chunks/{chunk-QFL2VQKX.js → chunk-Z33RVGP6.js} +1 -1
  151. package/dist/chunks/{chunk-OY4B7Y3T.js → chunk-ZDEIVUUI.js} +1 -1
  152. package/dist/chunks/{chunk-XGJG2ZKE.js → chunk-ZIQJDTQB.js} +1 -1
  153. package/dist/chunks/{chunk-IR2Y2VQY.js → chunk-ZYLLPRPU.js} +1 -1
  154. package/dist/chunks/cli-R7TAP6Z2.js +2 -0
  155. package/dist/chunks/{command-NWOZXU57.js → command-LNOVZQSK.js} +3 -3
  156. package/dist/chunks/{configuration-command-ZEIBQKB3.js → configuration-command-CNITTZRP.js} +1 -1
  157. package/dist/chunks/connected-app-executor-FGWCLOJO.js +2 -0
  158. package/dist/chunks/connected-evidence-5VZBYNWN.js +2 -0
  159. package/dist/chunks/{connected-starting-assets-66Y46ZPM.js → connected-starting-assets-KWOFEIE4.js} +1 -1
  160. package/dist/chunks/{connection-GDWPMHPC.js → connection-VMBXW5PD.js} +1 -1
  161. package/dist/chunks/{continual-TNPTWTKK.js → continual-FVOLGGOE.js} +1 -1
  162. package/dist/chunks/core-commands-BPYXVT7O.js +2 -0
  163. package/dist/chunks/dataset-preparation-authoring-UUYFWWCT.js +4 -0
  164. package/dist/chunks/datasets-E5TXSVIY.js +2 -0
  165. package/dist/chunks/desktop-test-FX7DTY4N.js +3 -0
  166. package/dist/chunks/dist-2MKJC6HN.js +2 -0
  167. package/dist/chunks/{dist-GR56E3QK.js → dist-DKE7RJZN.js} +1 -1
  168. package/dist/chunks/evaluation-coordination-KUTZEEPB.js +2 -0
  169. package/dist/chunks/experiment-improvements-PQNR5YHN.js +2 -0
  170. package/dist/chunks/experiments-Z4BJWT3Y.js +2 -0
  171. package/dist/chunks/experiments-signal-3GCLKUWZ.js +2 -0
  172. package/dist/chunks/{extension-UH34ZF7N.js → extension-3EKIT6BB.js} +1 -1
  173. package/dist/chunks/{help-O53DTZGN.js → help-K6YLZ3KL.js} +1 -1
  174. package/dist/chunks/host-profile-evaluation-tools-UF4ATIUF.js +2 -0
  175. package/dist/chunks/host-profile-external-dataset-KSEPXY2S.js +2 -0
  176. package/dist/chunks/hosted-app-server-composition-LA3BZ4SE.js +2 -0
  177. package/dist/chunks/hosted-experiment-improvement-VG2WE7XZ.js +3 -0
  178. package/dist/chunks/hosted-harness-runtime-MMTLCL23.js +2 -0
  179. package/dist/chunks/hosted-profile-candidate-PTGQLPZO.js +3 -0
  180. package/dist/chunks/hosted-profile-compiler-FS5R6CHJ.js +2 -0
  181. package/dist/chunks/hosted-profile-evaluation-control-UUEZEMXU.js +2 -0
  182. package/dist/chunks/hosted-profile-evaluation-inspection-4F7OEF4T.js +3 -0
  183. package/dist/chunks/hosted-profile-evaluation-preparation-LIJJZDHQ.js +3 -0
  184. package/dist/chunks/hosted-tasksets-NXVF4AQA.js +2 -0
  185. package/dist/chunks/human-review-2ZOB7CJZ.js +2 -0
  186. package/dist/chunks/{import-OBAKUJPM.js → import-YHYKZ6JN.js} +2 -2
  187. package/dist/chunks/{learning-CRR6NRPN.js → learning-LAXMGWSQ.js} +1 -1
  188. package/dist/chunks/learning-Y3UKNUGE.js +2 -0
  189. package/dist/chunks/local-harness-improvement-runtime-3YJQRYXC.js +2 -0
  190. package/dist/chunks/local-harness-taskset-review-XQHQ6JCR.js +2 -0
  191. package/dist/chunks/{model-projects-HP4DELCP.js → model-projects-6YWVD2TS.js} +1 -1
  192. package/dist/chunks/opchat-XXI2ZM53.js +3 -0
  193. package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +2 -0
  194. package/dist/chunks/organizations-W7HI2JA4.js +2 -0
  195. package/dist/chunks/{profile-3WZJ65CT.js → profile-P2SJPBOJ.js} +1 -1
  196. package/dist/chunks/project-action-payload-LTIQBX77.js +2 -0
  197. package/dist/chunks/project-agent-XRIXMXQK.js +2 -0
  198. package/dist/chunks/published-experiment-source-SDXUVPE7.js +2 -0
  199. package/dist/chunks/refiner-profile-service-56VYLZQJ.js +2 -0
  200. package/dist/chunks/{runtime-XP4DEGR3.js → runtime-Q7JUJO4D.js} +2 -2
  201. package/dist/chunks/sandbox-command-HVA5FJU4.js +2 -0
  202. package/dist/chunks/{sandbox-template-YFMHEMUQ.js → sandbox-template-U536EEWY.js} +1 -1
  203. package/dist/chunks/saved-work-KSIQPXC2.js +2 -0
  204. package/dist/chunks/{send-turn-D3GTSSHI.js → send-turn-YLY3YNEQ.js} +1 -1
  205. package/dist/chunks/setup-RMZ2BHLM.js +2 -0
  206. package/dist/chunks/{src-GQPWOPYA.js → src-C3ZUESMK.js} +1 -1
  207. package/dist/chunks/src-SGQYVBNQ.js +424 -0
  208. package/dist/chunks/standalone-experiment-turn-owner-TW5MTWIO.js +2 -0
  209. package/dist/chunks/store-chat-resources-IRHBW2EC.js +2 -0
  210. package/dist/chunks/{store-continual-support-reviews-VVRQO2JK.js → store-continual-support-reviews-3KK42L4I.js} +1 -1
  211. package/dist/chunks/store-conversation-serving-IVURK52V.js +2 -0
  212. package/dist/chunks/{store-create-improve-2XI36AET.js → store-create-improve-UTCLBXF2.js} +1 -1
  213. package/dist/chunks/{store-datasets-UFY422NG.js → store-datasets-4AQOVAQY.js} +1 -1
  214. package/dist/chunks/store-evaluation-results-PK2P3IMH.js +7 -0
  215. package/dist/chunks/{store-harness-workspaces-SGUEYDO2.js → store-harness-workspaces-YEXB4IRV.js} +1 -1
  216. package/dist/chunks/store-human-review-O4BVHP25.js +7 -0
  217. package/dist/chunks/store-learned-preference-migration-validation-44SVX6YB.js +2 -0
  218. package/dist/chunks/{store-learning-BFOT4QVT.js → store-learning-SIUQIY5C.js} +1 -1
  219. package/dist/chunks/{store-learning-credentials-DYTMWQTC.js → store-learning-credentials-BUHR7SN6.js} +1 -1
  220. package/dist/chunks/store-local-experiments-BHVTKPPE.js +97 -0
  221. package/dist/chunks/store-model-batch-review-RVAYUVK2.js +2 -0
  222. package/dist/chunks/{store-model-configuration-NJFWSYSA.js → store-model-configuration-6L3OYXF4.js} +1 -1
  223. package/dist/chunks/store-model-project-preparation-AAEKCF6V.js +2 -0
  224. package/dist/chunks/store-modification-recordings-LCPK6K2T.js +9 -0
  225. package/dist/chunks/{store-preference-comparison-MZAYONCK.js → store-preference-comparison-5YVIQNVB.js} +1 -1
  226. package/dist/chunks/{store-sidebar-file-bookmarks-J3JEVAYR.js → store-sidebar-file-bookmarks-WLMYDA4E.js} +1 -1
  227. package/dist/chunks/{store-sidebar-preferences-2JHTFXJK.js → store-sidebar-preferences-AFMYIDWT.js} +1 -1
  228. package/dist/chunks/{store-subagents-PUBQVWSU.js → store-subagents-KFPVSTRO.js} +1 -1
  229. package/dist/chunks/{store-task-inbox-3BREANOX.js → store-task-inbox-L6IQTY26.js} +1 -1
  230. package/dist/chunks/{store-task-inventory-5HRZCDUT.js → store-task-inventory-QWS2C656.js} +1 -1
  231. package/dist/chunks/store-taskset-drafts-FRFL6ITK.js +9 -0
  232. package/dist/chunks/{store-training-S3FXWLT6.js → store-training-FYXZU2FE.js} +1 -1
  233. package/dist/chunks/{store-training-jobs-2LCXPA7G.js → store-training-jobs-3N3VKPIY.js} +1 -1
  234. package/dist/chunks/{store-training-models-7AMKS7ZW.js → store-training-models-VOFVGPZR.js} +1 -1
  235. package/dist/chunks/{taskset-PLKWRT4X.js → taskset-UDDLFYKV.js} +1 -1
  236. package/dist/chunks/taskset-catalog-RZYEBCRQ.js +2 -0
  237. package/dist/chunks/taskset-packages-T6B6HYKZ.js +2 -0
  238. package/dist/chunks/taskset-packages-WMG5DUBN.js +2 -0
  239. package/dist/chunks/{teams-bot-VQXUA7U4.js → teams-bot-MPWL2PP4.js} +1 -1
  240. package/dist/chunks/tool-learning-ZQ6NSJ5K.js +2 -0
  241. package/dist/chunks/training-5NT2YB2L.js +2 -0
  242. package/dist/chunks/training-5UMT45UL.js +2 -0
  243. package/dist/chunks/training-UY6KRG4M.js +2 -0
  244. package/dist/chunks/{training-error-LQKCOQDJ.js → training-error-WF463UNZ.js} +1 -1
  245. package/dist/chunks/{training-hardware-ESXRWUIK.js → training-hardware-UWQCRDMV.js} +1 -1
  246. package/dist/chunks/training-hosted-CKSDRVL6.js +2 -0
  247. package/dist/chunks/training-hosted-alphaedit-HSMRDJTD.js +2 -0
  248. package/dist/chunks/training-hosted-decision-7JALOU6O.js +2 -0
  249. package/dist/chunks/training-hosted-engram-SXO75MFG.js +2 -0
  250. package/dist/chunks/{training-hosted-learning-WQ2IP5FP.js → training-hosted-learning-E2N32YU5.js} +1 -1
  251. package/dist/chunks/training-hosted-modification-comparison-TXFDJFTG.js +2 -0
  252. package/dist/chunks/training-hosted-neuron-training-J42WK4EH.js +2 -0
  253. package/dist/chunks/training-hosted-serving-report-BAEABGJH.js +2 -0
  254. package/dist/chunks/training-hosted-steering-T556BUBG.js +2 -0
  255. package/dist/chunks/training-model-start-P3PXDWNT.js +2 -0
  256. package/dist/chunks/web-search-ZEKJHZW4.js +2 -0
  257. package/dist/chunks/{workspaces-MCS2AQX6.js → workspaces-EK62ANTB.js} +1 -1
  258. package/dist/cli.js +1 -1
  259. package/dist/index.js +1 -1
  260. package/dist/sandbox/types/billing.d.ts +87 -6
  261. package/dist/sandbox/types/io.d.ts +3 -0
  262. package/dist/sandbox-template/manifest.js +1 -1
  263. package/dist/skills/manifest.json +3 -3
  264. package/dist/skills/openpond-cli/references/experiments-and-training.md +461 -1
  265. package/dist/web/assets/App-CCuh99JW.js +54 -0
  266. package/dist/web/assets/{AppDialog-BvskhHE9.js → AppDialog-CxjDHVk9.js} +1 -1
  267. package/dist/web/assets/AppTerminalPanel-CKJIVpKa.js +2 -0
  268. package/dist/web/assets/{AppToastContext-D2788RqX.js → AppToastContext-EpiT1dHs.js} +1 -1
  269. package/dist/web/assets/AppsView-BsMyPX_3.js +1 -0
  270. package/dist/web/assets/{AttachmentTypeIcon-DVluUHuc.js → AttachmentTypeIcon-BXvZy5gB.js} +1 -1
  271. package/dist/web/assets/BrowserSidebar-BIIV4aq4.js +1 -0
  272. package/dist/web/assets/{CartesianChart-DdBZ69lI.js → CartesianChart-brqLBqnF.js} +1 -1
  273. package/dist/web/assets/ChatTimelineEntry-CwZbn16X.js +8 -0
  274. package/dist/web/assets/{CollaborationTabs-ba6WupeJ.js → CollaborationTabs-BU4uc4tZ.js} +1 -1
  275. package/dist/web/assets/{CommandMenu-D7wTaEgl.js → CommandMenu-DkWpXR55.js} +1 -1
  276. package/dist/web/assets/CommunityView-CsSxJZGn.js +1 -0
  277. package/dist/web/assets/{ComposerAttachments-aO90qXYz.js → ComposerAttachments-BdJGCYzI.js} +1 -1
  278. package/dist/web/assets/{ComposerCreateImproveStrip-BPUJBSyS.js → ComposerCreateImproveStrip-CWy0j1vv.js} +1 -1
  279. package/dist/web/assets/{ConversationImportsSettings-Bo836wKJ.js → ConversationImportsSettings-DCmiakbZ.js} +1 -1
  280. package/dist/web/assets/DatasetReviewImport-DEnF_pGu.js +1 -0
  281. package/dist/web/assets/ExperimentTrainingDataWorkspace-WhwQ0QBi.js +2 -0
  282. package/dist/web/assets/{FilePagePreview-C6wIp6uX.js → FilePagePreview-BRhhz99q.js} +2 -2
  283. package/dist/web/assets/{GetStartedView-CxMv8q-h.js → GetStartedView-CLVD-qEi.js} +1 -1
  284. package/dist/web/assets/{GettingStartedDialog-CEb0cS-o.js → GettingStartedDialog-CMxaAMg-.js} +1 -1
  285. package/dist/web/assets/HostedModelLearningReview-Cn-j-rDo.js +1 -0
  286. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +1 -0
  287. package/dist/web/assets/{HtmlVisual-CCuUkYT8.js → HtmlVisual-D5y2WG9L.js} +10 -10
  288. package/dist/web/assets/LabModelVersionDetailPage-BxRmYD6h.js +1 -0
  289. package/dist/web/assets/{TrainingRunLineage-PXzWR65d.css → LabModelWorkspace-DOrgCk9Z.css} +1 -1
  290. package/dist/web/assets/LabModelWorkspace-u2Ulm_z4.js +1 -0
  291. package/dist/web/assets/{LabSkillSidebar-CFROlATQ.js → LabSkillSidebar-C7IceJTJ.js} +1 -1
  292. package/dist/web/assets/LabsRoute-C9Y0GU34.css +1 -0
  293. package/dist/web/assets/LabsRoute-CbztQaEf.js +74 -0
  294. package/dist/web/assets/LearningBatchesPage-B1NZTBSv.css +1 -0
  295. package/dist/web/assets/LearningBatchesPage-CJqgZNvM.js +26 -0
  296. package/dist/web/assets/MainChatThread-DNMfrrRq.js +2 -0
  297. package/dist/web/assets/{MainPane-BOWkynGB.css → MainPane-BZlNLfTM.css} +1 -1
  298. package/dist/web/assets/MainPane-CQQxSDPS.js +13 -0
  299. package/dist/web/assets/ModelProjectPageHeader-Dge19aE1.js +1 -0
  300. package/dist/web/assets/NativeSetupTerminal-D4JnbpyD.js +2 -0
  301. package/dist/web/assets/{NativeSkillSidebar-MAJWS4mL.js → NativeSkillSidebar-Jzx1BeKV.js} +1 -1
  302. package/dist/web/assets/{NewProjectDialog-MQiUBVx3.js → NewProjectDialog-DcnGzEd9.js} +1 -1
  303. package/dist/web/assets/{OutputsPage-DpF-aRTu.js → OutputsPage-Cmk15Vt_.js} +1 -1
  304. package/dist/web/assets/{PageChrome-8gH2hyDb.js → PageChrome-Cz_fCqtn.js} +1 -1
  305. package/dist/web/assets/{ProjectsPage-BQ98oGyu.js → ProjectsPage-BZ3Eo3Mz.js} +1 -1
  306. package/dist/web/assets/RightChatPanelStack-C6H2vU9N.js +1 -0
  307. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +1 -0
  308. package/dist/web/assets/{ScheduledWorkPage-CGCqZz_H.js → ScheduledWorkPage-CAkSwM0T.js} +1 -1
  309. package/dist/web/assets/{SettingsView-CqpMFLxy.js → SettingsView-DvQXGw3_.js} +3 -3
  310. package/dist/web/assets/{TasksetDraftEditorPrimitives-DJvIvzBb.js → TasksetDraftEditorPrimitives-JuU1k8vr.js} +1 -1
  311. package/dist/web/assets/TeamChatView-DmHjr8W9.js +1 -0
  312. package/dist/web/assets/{TerminalOverlay-D--M876l.js → TerminalOverlay-DlaM9d8F.js} +1 -1
  313. package/dist/web/assets/{TrainingCreationPanel-DDUoHQHU.js → TrainingCreationPanel-ClpylNsr.js} +1 -1
  314. package/dist/web/assets/{TrainingDraftPanel-CwLXn3Z7.js → TrainingDraftPanel-6tH2xSDj.js} +1 -1
  315. package/dist/web/assets/{UsageSettingsSection-CGwPregx.js → UsageSettingsSection-CzDqxOYM.js} +2 -2
  316. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +1 -0
  317. package/dist/web/assets/WorkspaceDiffPanel-B4e0lyF7.js +11 -0
  318. package/dist/web/assets/WorkspaceEnvironmentMenu-D01ZkZZF.js +35 -0
  319. package/dist/web/assets/{WorkspaceFileLocation-D-ctFM4d.js → WorkspaceFileLocation-C5s_njZb.js} +1 -1
  320. package/dist/web/assets/{WorkspaceGitDialogs-CQ28j3R7.js → WorkspaceGitDialogs-DjPZ6KIh.js} +1 -1
  321. package/dist/web/assets/{WorkspaceMonacoEditor-BrZs6-EW.js → WorkspaceMonacoEditor-CC4sfOiU.js} +3 -3
  322. package/dist/web/assets/{WorkspacePdfPreview-CU6PSjjN.js → WorkspacePdfPreview-vszQqFa4.js} +2 -2
  323. package/dist/web/assets/{WorkspacePresentationPreview-IjXVXpIy.js → WorkspacePresentationPreview-DQTvhaRD.js} +1 -1
  324. package/dist/web/assets/api-client-DJRVOFzS.js +1 -0
  325. package/dist/web/assets/{app-models-CKXrDTEU.js → app-models-BUdzQbXo.js} +1 -1
  326. package/dist/web/assets/bot-Doyx3T4j.js +1 -0
  327. package/dist/web/assets/{browser-sidebar-links-D9v2cyJa.js → browser-sidebar-links-PVPCrsDJ.js} +1 -1
  328. package/dist/web/assets/chat-resources-Beh5lB36.js +1 -0
  329. package/dist/web/assets/chevron-down-DX1hzujj.js +1 -0
  330. package/dist/web/assets/chevron-right-DHN0y3KC.js +1 -0
  331. package/dist/web/assets/chevron-up-_QrW88NF.js +1 -0
  332. package/dist/web/assets/{chunk-TLSP5JKG-BrrVo5rJ.js → chunk-3BYFS4RO-ztZjcMmt.js} +1 -1
  333. package/dist/web/assets/chunk-AG6UJ3DI-D9KZjTYP.js +1 -0
  334. package/dist/web/assets/chunk-C3TS766N-ppRhs95p.js +1 -0
  335. package/dist/web/assets/chunk-GCUWJUUM-Dy6oUNJ6.js +9 -0
  336. package/dist/web/assets/chunk-GS5HEE4M-C0RLeIsy.js +1 -0
  337. package/dist/web/assets/{chunk-H3JZ3P5T-CzpTARDY.js → chunk-H3JZ3P5T-DolwEJXo.js} +2 -2
  338. package/dist/web/assets/chunk-Q4RGCEOI-Cr-dg4Nk.js +1 -0
  339. package/dist/web/assets/client-DwZ92xtu.js +1 -0
  340. package/dist/web/assets/{client-choice-storage-DUWsS4X0.js → client-choice-storage-DitqKiIT.js} +1 -1
  341. package/dist/web/assets/cloud-upload-HdzNTgr2.js +1 -0
  342. package/dist/web/assets/common-BWVSBnpX.js +1 -0
  343. package/dist/web/assets/copy-DTQhoBNg.js +1 -0
  344. package/dist/web/assets/create-pipeline-DsZzNkt9.js +1 -0
  345. package/dist/web/assets/{cssMode-SclUkqPt.js → cssMode-BRTtfXxU.js} +1 -1
  346. package/dist/web/assets/dataset-workspaces-BTPi71mz.js +1 -0
  347. package/dist/web/assets/external-link-H1629UU6.js +1 -0
  348. package/dist/web/assets/folder-open-CAGdWOrr.js +1 -0
  349. package/dist/web/assets/folder-plus-C14cs2mE.js +1 -0
  350. package/dist/web/assets/git-commit-horizontal-DFUfuVvF.js +1 -0
  351. package/dist/web/assets/{htmlMode-X3mQtOeh.js → htmlMode-BVaCcL76.js} +1 -1
  352. package/dist/web/assets/icons-Bk2b68aC.js +1 -0
  353. package/dist/web/assets/image-0DPVY6Ev.js +1 -0
  354. package/dist/web/assets/{index-LXNhSUEL.js → index-B6XX_0h3.js} +2 -2
  355. package/dist/web/assets/info-C8b_tafZ.js +1 -0
  356. package/dist/web/assets/{intake-contracts-wCkD2ErR.js → intake-contracts-B8JZKYwb.js} +1 -1
  357. package/dist/web/assets/{jsonMode-BoKiIdHd.js → jsonMode-BCKKQmmV.js} +1 -1
  358. package/dist/web/assets/loader-circle-y-SSPwpk.js +1 -0
  359. package/dist/web/assets/{lspLanguageFeatures-CO2mzpy1.js → lspLanguageFeatures-DozmNUOx.js} +1 -1
  360. package/dist/web/assets/maximize-2-CByk9-zN.js +1 -0
  361. package/dist/web/assets/message-square-C889vRqm.js +1 -0
  362. package/dist/web/assets/{monaco.contribution-wacA5FjV.js → monaco.contribution-B9q6qbbo.js} +2 -2
  363. package/dist/web/assets/{monaco.contribution-CVe3mWSY.js → monaco.contribution-BITdsRbn.js} +2 -2
  364. package/dist/web/assets/{monaco.contribution-hrusiaZi.js → monaco.contribution-BqA-XZ44.js} +2 -2
  365. package/dist/web/assets/{monaco.contribution-C7CAQIKF.js → monaco.contribution-DxAV1oS5.js} +2 -2
  366. package/dist/web/assets/monitor-BtxlcLuI.js +1 -0
  367. package/dist/web/assets/paperclip-BeIdaspf.js +1 -0
  368. package/dist/web/assets/{pdf-Ct3M2mVw.js → pdf-perlzwEB.js} +1 -1
  369. package/dist/web/assets/play-CHXXdkuO.js +1 -0
  370. package/dist/web/assets/plus-DFFWjhPw.js +1 -0
  371. package/dist/web/assets/{ponder-desktop-D-zB6X4L.js → ponder-desktop-Ca-9KggQ.js} +1 -1
  372. package/dist/web/assets/presentation-0bzvu6_u.js +1 -0
  373. package/dist/web/assets/{profile-ref-CCxrOCio.js → profile-ref-D8lxL7dW.js} +1 -1
  374. package/dist/web/assets/{python-C0-pUUAU.js → python-B9hOnkOI.js} +1 -1
  375. package/dist/web/assets/refresh-cw-D61-Ozk3.js +1 -0
  376. package/dist/web/assets/{requests-DjSt-duM.js → requests-DmeUYik4.js} +1 -1
  377. package/dist/web/assets/reward-checks-DJJZYgf8.js +7 -0
  378. package/dist/web/assets/save-iEMNZoPe.js +1 -0
  379. package/dist/web/assets/schemas-Brv9Vmnk.js +64 -0
  380. package/dist/web/assets/settings-BC-bzgk6.js +21 -0
  381. package/dist/web/assets/settings-lists-C84qxFmP.js +5 -0
  382. package/dist/web/assets/square-BE_4JMR3.js +1 -0
  383. package/dist/web/assets/square-terminal-Djpzo2Qs.js +1 -0
  384. package/dist/web/assets/{submit-issue-command-Gk3RKrY-.js → submit-issue-command-HfKzyxg5.js} +1 -1
  385. package/dist/web/assets/{toggleHighContrast-BnYUBgZB.js → toggleHighContrast-ClsXu39R.js} +1 -1
  386. package/dist/web/assets/training-DWfghwfZ.js +1 -0
  387. package/dist/web/assets/{training-model-data-CxR3xpmK.js → training-model-data-CIysl8wH.js} +4 -4
  388. package/dist/web/assets/{tsMode-BVNyOY8h.js → tsMode-nbmaMc-D.js} +1 -1
  389. package/dist/web/assets/upload-C6ug8RD-.js +1 -0
  390. package/dist/web/assets/{useAccountSettings-4_XfwJQi.js → useAccountSettings-Dr9h4Qz_.js} +1 -1
  391. package/dist/web/assets/{useAgentInventory-CVuamyT3.js → useAgentInventory-ByCk2JAv.js} +1 -1
  392. package/dist/web/assets/useChatContextSelection-C0eMm2g6.js +1 -0
  393. package/dist/web/assets/{useLocalAgentSchedules-CmwN4ohy.js → useLocalAgentSchedules-Do0y_leJ.js} +1 -1
  394. package/dist/web/assets/useQuery-D2MQ7e5U.js +1 -0
  395. package/dist/web/assets/wifi-off-Dr-CapyW.js +1 -0
  396. package/dist/web/assets/work-outputs-D_8TovAK.js +1 -0
  397. package/dist/web/assets/{workers-CjtQ2aBD.js → workers-DKvM2NdM.js} +1 -1
  398. package/dist/web/assets/x-Jx2jlP9u.js +1 -0
  399. package/dist/web/assets/{yaml-N1KUjBZ8.js → yaml-C02vq4ar.js} +1 -1
  400. package/dist/web/index.html +1 -1
  401. package/docs/command-reference.md +93 -3
  402. package/package.json +1 -1
  403. package/dist/chunks/actions-command-BYPLSGZL.js +0 -2
  404. package/dist/chunks/app-server-evaluations-5YZUFXQ2.js +0 -2
  405. package/dist/chunks/app-server-harness-services-N5F5QVZI.js +0 -2
  406. package/dist/chunks/app-server-runtime-HJ2N57DL.js +0 -2
  407. package/dist/chunks/apps-WJTW64NW.js +0 -2
  408. package/dist/chunks/chunk-263WS3TB.js +0 -2
  409. package/dist/chunks/chunk-2UZHLO2V.js +0 -23
  410. package/dist/chunks/chunk-2W22IXHB.js +0 -2
  411. package/dist/chunks/chunk-46RMTR2Z.js +0 -2
  412. package/dist/chunks/chunk-4JJ4RYIB.js +0 -6
  413. package/dist/chunks/chunk-4NN5OLKW.js +0 -161
  414. package/dist/chunks/chunk-543QHE3D.js +0 -2
  415. package/dist/chunks/chunk-5QOFUGYQ.js +0 -2
  416. package/dist/chunks/chunk-5ZNE43XC.js +0 -10
  417. package/dist/chunks/chunk-6IS5OLI5.js +0 -2
  418. package/dist/chunks/chunk-7HAGSE7L.js +0 -2
  419. package/dist/chunks/chunk-AXYAEWWA.js +0 -2
  420. package/dist/chunks/chunk-B7XJBP4U.js +0 -2
  421. package/dist/chunks/chunk-BBIA24GD.js +0 -10
  422. package/dist/chunks/chunk-CJDGLPNX.js +0 -4
  423. package/dist/chunks/chunk-FCXDPVGJ.js +0 -3
  424. package/dist/chunks/chunk-FE2ENE3U.js +0 -2
  425. package/dist/chunks/chunk-H6EUFJJK.js +0 -2
  426. package/dist/chunks/chunk-IOSBGCRT.js +0 -2
  427. package/dist/chunks/chunk-K6DB5QWG.js +0 -2
  428. package/dist/chunks/chunk-LI56PPCN.js +0 -2
  429. package/dist/chunks/chunk-OE2OOWEQ.js +0 -2
  430. package/dist/chunks/chunk-OYIFH2OM.js +0 -2
  431. package/dist/chunks/chunk-QOUOU7FE.js +0 -22
  432. package/dist/chunks/chunk-R5GRESW3.js +0 -2
  433. package/dist/chunks/chunk-TERKCK4I.js +0 -2
  434. package/dist/chunks/chunk-TS5HNRZB.js +0 -2
  435. package/dist/chunks/chunk-V3KEG6MI.js +0 -2
  436. package/dist/chunks/chunk-WGISITX6.js +0 -4
  437. package/dist/chunks/chunk-XD4ZIQZ2.js +0 -2
  438. package/dist/chunks/chunk-XHU4BZQY.js +0 -13
  439. package/dist/chunks/chunk-ZWEY66RT.js +0 -2
  440. package/dist/chunks/cli-HV32F7HD.js +0 -2
  441. package/dist/chunks/connected-app-executor-DFHWNMRM.js +0 -2
  442. package/dist/chunks/connected-evidence-WOM6N5HO.js +0 -2
  443. package/dist/chunks/core-commands-GWRHH53F.js +0 -2
  444. package/dist/chunks/dataset-preparation-authoring-WJ2XEUO7.js +0 -4
  445. package/dist/chunks/datasets-XIMF54QN.js +0 -2
  446. package/dist/chunks/desktop-test-HF42V2EP.js +0 -3
  447. package/dist/chunks/dist-T6ES2TSM.js +0 -2
  448. package/dist/chunks/evaluation-coordination-WZT6FDMS.js +0 -2
  449. package/dist/chunks/experiment-improvements-H35VS6XZ.js +0 -2
  450. package/dist/chunks/experiments-F54C32EE.js +0 -2
  451. package/dist/chunks/experiments-signal-ONIGTGYR.js +0 -2
  452. package/dist/chunks/host-profile-evaluation-tools-LMCJ3MDJ.js +0 -2
  453. package/dist/chunks/host-profile-external-dataset-4HOXANWK.js +0 -2
  454. package/dist/chunks/hosted-app-server-composition-Y64A2A2B.js +0 -2
  455. package/dist/chunks/hosted-experiment-improvement-B2V2WIUI.js +0 -3
  456. package/dist/chunks/hosted-harness-runtime-C7I4KSDK.js +0 -2
  457. package/dist/chunks/hosted-profile-candidate-CXPVEEYQ.js +0 -3
  458. package/dist/chunks/hosted-profile-compiler-FGCI2VRW.js +0 -2
  459. package/dist/chunks/hosted-profile-evaluation-control-INNUYMBD.js +0 -2
  460. package/dist/chunks/hosted-profile-evaluation-inspection-UPTBRYMS.js +0 -3
  461. package/dist/chunks/hosted-profile-evaluation-preparation-TIQSVKLQ.js +0 -3
  462. package/dist/chunks/hosted-tasksets-7VMYOTIO.js +0 -2
  463. package/dist/chunks/human-review-7XC77NQP.js +0 -2
  464. package/dist/chunks/learning-3XDGIYUL.js +0 -2
  465. package/dist/chunks/local-harness-improvement-runtime-UIKQSAMM.js +0 -2
  466. package/dist/chunks/local-harness-taskset-review-6KJN3EQL.js +0 -2
  467. package/dist/chunks/opchat-NWYWWIA7.js +0 -3
  468. package/dist/chunks/opchat-bounded-chat-ICURZM6R.js +0 -2
  469. package/dist/chunks/organizations-7DBQGCCV.js +0 -2
  470. package/dist/chunks/project-action-payload-7DRABTHY.js +0 -2
  471. package/dist/chunks/project-agent-AXJOWXRU.js +0 -2
  472. package/dist/chunks/published-experiment-source-YBBPLNF2.js +0 -2
  473. package/dist/chunks/refiner-profile-service-ATEFPF5O.js +0 -2
  474. package/dist/chunks/sandbox-command-CF2PJCFX.js +0 -2
  475. package/dist/chunks/saved-work-3OAVRBH3.js +0 -2
  476. package/dist/chunks/setup-RHIMFI2Y.js +0 -2
  477. package/dist/chunks/src-V236S6MV.js +0 -424
  478. package/dist/chunks/standalone-experiment-turn-owner-CDRMGLWW.js +0 -2
  479. package/dist/chunks/store-chat-resources-P4EKCLSY.js +0 -2
  480. package/dist/chunks/store-conversation-serving-YFEZYQD3.js +0 -2
  481. package/dist/chunks/store-evaluation-results-VBH4R2U7.js +0 -7
  482. package/dist/chunks/store-human-review-RFCVZ3HP.js +0 -7
  483. package/dist/chunks/store-learned-preference-migration-validation-FNBGGZU6.js +0 -2
  484. package/dist/chunks/store-local-experiments-XPXGYXNM.js +0 -97
  485. package/dist/chunks/store-model-batch-review-J2L5JQV2.js +0 -2
  486. package/dist/chunks/store-model-project-preparation-OCLIFKI2.js +0 -2
  487. package/dist/chunks/store-taskset-drafts-BNKUVHPA.js +0 -9
  488. package/dist/chunks/taskset-packages-SXBLYHSP.js +0 -2
  489. package/dist/chunks/taskset-packages-V5T4V7YN.js +0 -2
  490. package/dist/chunks/tool-learning-47XQKELE.js +0 -2
  491. package/dist/chunks/training-7VQNCOGH.js +0 -2
  492. package/dist/chunks/training-VKLPNCMC.js +0 -2
  493. package/dist/chunks/training-hosted-NNE6BP6S.js +0 -2
  494. package/dist/chunks/training-hosted-serving-report-VZ4SMLMG.js +0 -2
  495. package/dist/chunks/training-model-start-G7YDZ7ZG.js +0 -2
  496. package/dist/chunks/web-search-56QRZGPR.js +0 -2
  497. package/dist/web/assets/App-DmEA-Lia.js +0 -53
  498. package/dist/web/assets/AppTerminalPanel-ScQKJV4z.js +0 -2
  499. package/dist/web/assets/AppsView-B1uNg9IQ.js +0 -1
  500. package/dist/web/assets/BrowserSidebar-DfVQoJHn.js +0 -1
  501. package/dist/web/assets/ChatTimelineEntry-Bbc6HRks.js +0 -8
  502. package/dist/web/assets/CommunityView-mO58f2B0.js +0 -1
  503. package/dist/web/assets/HostedModelLearningReview-BQIS7hkd.js +0 -1
  504. package/dist/web/assets/HostedModelLearningSettings-BQ-YeFMT.js +0 -1
  505. package/dist/web/assets/LabModelVersionDetailPage-BkHeVbAx.js +0 -1
  506. package/dist/web/assets/LabsRoute-CE45yAXJ.css +0 -1
  507. package/dist/web/assets/LabsRoute-YA9YckKj.js +0 -101
  508. package/dist/web/assets/MainChatThread-DpyPgGKW.js +0 -2
  509. package/dist/web/assets/MainPane-WOeodByM.js +0 -10
  510. package/dist/web/assets/NativeSetupTerminal-fmG2c65K.js +0 -2
  511. package/dist/web/assets/RightChatPanelStack-Bs7A4dLs.js +0 -1
  512. package/dist/web/assets/RightSidebarHomePanel-C-D4kba2.js +0 -1
  513. package/dist/web/assets/TeamChatView-DjmIaLO1.js +0 -1
  514. package/dist/web/assets/TrainingRunLineage-CtYe1KGX.js +0 -1
  515. package/dist/web/assets/WorkSidebarPanel-C6wWuo7U.js +0 -1
  516. package/dist/web/assets/WorkspaceDiffPanel-JDOUmrC-.js +0 -11
  517. package/dist/web/assets/WorkspaceEnvironmentMenu-sfL5LZeB.js +0 -35
  518. package/dist/web/assets/api-client-Dgz-fOMl.js +0 -1
  519. package/dist/web/assets/bot-Cd761lRF.js +0 -1
  520. package/dist/web/assets/chat-resources-BUDXdoG0.js +0 -1
  521. package/dist/web/assets/chevron-down-DEbd6Ek-.js +0 -1
  522. package/dist/web/assets/chevron-right-DLYNg_Oq.js +0 -1
  523. package/dist/web/assets/chevron-up-DFJJccDl.js +0 -1
  524. package/dist/web/assets/chunk-GHPCQXG5-DKDBSd8H.js +0 -9
  525. package/dist/web/assets/chunk-GJRXJL6G-luaxRTYI.js +0 -1
  526. package/dist/web/assets/chunk-JDQVAG3R-C0-rh1aR.js +0 -1
  527. package/dist/web/assets/chunk-XMVSQIK4-BBU7r_NH.js +0 -1
  528. package/dist/web/assets/client-BNjO4Xi8.js +0 -1
  529. package/dist/web/assets/cloud-upload-CoM1FGeB.js +0 -1
  530. package/dist/web/assets/common-CFsO2ppZ.js +0 -1
  531. package/dist/web/assets/copy-BGOhV6Pk.js +0 -1
  532. package/dist/web/assets/create-pipeline-DRR0Qeec.js +0 -1
  533. package/dist/web/assets/createLucideIcon-Bv-_eGcE.js +0 -1
  534. package/dist/web/assets/external-link-CVXsNeO3.js +0 -1
  535. package/dist/web/assets/folder-open-MnOmh19D.js +0 -1
  536. package/dist/web/assets/folder-plus-BRddLBtO.js +0 -1
  537. package/dist/web/assets/git-commit-horizontal-Bm4rkXug.js +0 -1
  538. package/dist/web/assets/icons-CZxmQtZs.js +0 -1
  539. package/dist/web/assets/image-BViGUAiq.js +0 -1
  540. package/dist/web/assets/info-DYPIbKKD.js +0 -1
  541. package/dist/web/assets/loader-circle-JFgFNsP5.js +0 -1
  542. package/dist/web/assets/maximize-2-DXZCQO0b.js +0 -1
  543. package/dist/web/assets/message-square-cOCAL8J1.js +0 -1
  544. package/dist/web/assets/models-route-CWcJuOd0.js +0 -1
  545. package/dist/web/assets/monitor-B35XSAvn.js +0 -1
  546. package/dist/web/assets/paperclip-CKgDxioG.js +0 -1
  547. package/dist/web/assets/play-DzqLr7fM.js +0 -1
  548. package/dist/web/assets/plus-Ddp1vXnw.js +0 -1
  549. package/dist/web/assets/presentation-B0S9v7ib.js +0 -1
  550. package/dist/web/assets/refresh-cw-D45mW-vs.js +0 -1
  551. package/dist/web/assets/reward-checks-D139zwha.js +0 -7
  552. package/dist/web/assets/save-Gu4R_82E.js +0 -1
  553. package/dist/web/assets/schemas-C9IwV7NS.js +0 -64
  554. package/dist/web/assets/settings-DdonLCIN.js +0 -21
  555. package/dist/web/assets/settings-lists-CFHFtO0D.js +0 -5
  556. package/dist/web/assets/square-Dqduqyyu.js +0 -1
  557. package/dist/web/assets/square-terminal-DS3zwi6X.js +0 -1
  558. package/dist/web/assets/training-QBuGBGJd.js +0 -2
  559. package/dist/web/assets/upload-ABSJxuUM.js +0 -1
  560. package/dist/web/assets/useQuery-CCjwL8VI.js +0 -1
  561. package/dist/web/assets/wifi-off-DGJH7Pke.js +0 -1
  562. package/dist/web/assets/work-outputs-CnbRtTLg.js +0 -1
  563. package/dist/web/assets/x-B-_zJVOZ.js +0 -1
  564. /package/dist/chunks/{chunk-SFR32TMJ.js → chunk-JXLDEYRW.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{a as H,g as O,h as M,i as q,j as V,k as F,l as W,m as G,n as K,p as B}from"./chunk-U7X5ZLAL.js";import{w as z}from"./chunk-WGQ3FMRF.js";import{s as D}from"./chunk-YI6ME6PU.js";import{a as x}from"./chunk-DRLP7GIU.js";import{E as C}from"./chunk-BU6MW65V.js";import{m as I}from"./chunk-HIQPGYVH.js";import{W as $,ea as A}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as k}from"./chunk-FTQLQJQV.js";var Q=e.enum(["create","save","publish","begin_version"]),ee=e.object({operationId:e.string().trim().min(1).max(240),kind:Q,requestHash:e.string().regex(/^[a-f0-9]{64}$/),receipt:q,base:q.nullable()}).strict().superRefine((t,a)=>{let{receipt:r,base:s,kind:i}=t;(s&&(s.teamId!==r.teamId||s.datasetId!==r.datasetId||s.revision+1!==r.revision)||!s&&r.revision!==1)&&a.addIssue({code:"custom",message:"Operation recovery history identity/revision mismatch."}),s&&((s.ownerScope??"workspace")!==(r.ownerScope??"workspace")||s.originProjectId!==r.originProjectId||s.workspace.draft.createdAt!==r.workspace.draft.createdAt)&&a.addIssue({code:"custom",message:"Operation recovery cannot change Dataset ownership or origin."});let n=s?r.workspace.draft.status==="published"?"publish":s.workspace.draft.status==="published"?"begin_version":"save":"create";i!==n&&a.addIssue({code:"custom",message:"Operation recovery kind differs from its retained lifecycle."})}),o=e.string().trim().min(1).max(240),u=e.string().regex(/^[a-f0-9]{64}$/),b=e.iso.datetime(),d=e.number().int().nonnegative(),l=e.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),te=e.object({id:o,projectId:o,maximumMicroUsd:l.positive(),maximumSandboxSeconds:d.max(10800)}).strict(),ae=e.object({schemaVersion:e.literal("openpond.datasetPreparationGrant.v1"),id:o,teamId:o,ownerUserId:o,projectId:o,maximumMicroUsd:l,maximumSandboxSeconds:d,settledMicroUsd:l,heldMicroUsd:l,sandboxSeconds:d,heldSandboxSeconds:d,unresolvedCalls:d,cleanupPending:d,createdAt:b,updatedAt:b}).strict(),T=e.enum(["coding_change","debugging","code_explanation","structured_text","artifact_work"]),J=e.enum(["inventory","preview","reconstruction","grader_authoring","qualification","release"]),se=e.enum(["draft","running","pausing","paused","needs_attention","preview_ready","ready","releasing","completed","insufficient_data","budget_exhausted","cancelling","cancelled","failed"]),re=e.object({projectId:o,from:b,to:b,importCutoff:b,connections:e.array(o).min(1).max(50),excludedSessions:e.array(e.object({connectionId:o,sourceKeyHash:u,nativeRevisionHash:u,reason:e.enum(["source_read_failed","native_session_not_ready"]),explanation:e.string().trim().min(1).max(2e3)}).strict()).max(1e4).default([])}).strict().superRefine((t,a)=>{Date.parse(t.from)>=Date.parse(t.to)&&a.addIssue({code:"custom",message:"Source event-time window must be nonempty."}),new Set(t.connections).size!==t.connections.length&&a.addIssue({code:"custom",message:"Source connections must be unique."}),t.excludedSessions.some(r=>!t.connections.includes(r.connectionId))&&a.addIssue({code:"custom",message:"Excluded sessions must belong to selected source connections."}),new Set(t.excludedSessions.map(r=>JSON.stringify([r.connectionId,r.sourceKeyHash]))).size!==t.excludedSessions.length&&a.addIssue({code:"custom",message:"Source session exclusions must be unique."})}),X=e.object({source:re,taskClasses:e.array(T).min(1).max(5),limits:e.object({maximumConversations:e.number().int().min(1).max(1e4),maximumCandidates:e.number().int().min(1).max(1e4),acceptedTarget:e.number().int().min(1).max(1e4),maximumRepairsPerCandidate:e.number().int().min(0).max(5),maximumEvidenceBytesPerConversation:e.number().int().min(1024).max(2e6)}).strict(),researcher:e.object({modelId:o,maximumOutputTokens:e.number().int().min(1).max(32768)}).strict(),adjudicator:e.object({modelId:o,maximumOutputTokens:e.number().int().min(1).max(32768)}).strict(),grading:e.discriminatedUnion("mode",[e.object({mode:e.literal("auto")}).strict(),e.object({mode:e.literal("existing_only")}).strict(),e.object({mode:e.literal("manual"),releases:e.array(x).min(1).max(100)}).strict()]),budget:e.object({grantId:o,maximumMicroUsd:l.positive(),previewMaximumMicroUsd:l,qualificationMaximumMicroUsdPerCandidate:l,maximumSandboxSeconds:d.max(10800)}).strict(),finish:e.enum(["stop_ready","create_private_version"]),execution:e.enum(["preview_only","prepare"]),allowPartialVersion:e.boolean(),population:e.literal("development")}).strict().superRefine((t,a)=>{t.limits.acceptedTarget>t.limits.maximumCandidates&&a.addIssue({code:"custom",message:"Accepted target exceeds candidate scan limit."}),t.budget.previewMaximumMicroUsd>t.budget.maximumMicroUsd&&a.addIssue({code:"custom",message:"Preview allowance exceeds the shared preparation ceiling."}),new Set(t.taskClasses).size!==t.taskClasses.length&&a.addIssue({code:"custom",message:"Task classes must be unique."})}),ie=e.object({operationId:o,expectedDatasetRevision:e.number().int().positive(),policy:X}).strict(),ne=e.discriminatedUnion("action",[e.object({action:e.enum(["start","pause","resume","cancel","release"]),operationId:o,expectedRevision:e.number().int().positive()}).strict(),e.object({action:e.literal("resolve"),operationId:o,expectedRevision:e.number().int().positive(),candidateId:o,decision:e.enum(["retry","exclude"]),reason:e.string().trim().min(1).max(5e3)}).strict()]),oe=e.object({conversations:d,importedTurns:d,selectedTurns:d,queuedSnapshots:d.nullable(),failedSessions:d.nullable(),skippedSessions:d.nullable(),lastAdmissionAt:b.nullable(),complete:e.boolean(),sourceComplete:e.boolean().default(!1),excludedSessions:d.default(0),reasons:e.array(e.object({code:o,message:e.string().trim().min(1).max(2e3)}).strict()).max(100),sourceInventoryHash:u}).strict(),de=e.object({maximumMicroUsd:l,settledMicroUsd:l,heldMicroUsd:l,unresolvedCalls:d,sandboxSeconds:d,cleanupPending:d,complete:e.boolean()}).strict(),ce=e.object({sampleConversations:d,sampleTurns:d,candidateCount:d,modelId:o,modelConfigurationHash:u,callReceiptIds:e.array(o).max(2e3),inputTokens:d.nullable(),outputTokens:d.nullable(),classes:e.array(e.object({taskClass:T,candidates:d,assessment:e.enum(["executable","calibrated_judge","unsupported"]),requirements:e.array(e.string().trim().min(1).max(5e3)).max(20)}).strict()).max(5),exclusions:e.array(e.object({code:o,count:d,reason:e.string().trim().min(1).max(5e3)}).strict()).max(100),estimates:e.array(e.object({stage:J,minimumMicroUsd:l,maximumMicroUsd:l,assumptions:e.array(e.string().trim().min(1).max(2e3)).min(1).max(20)}).strict().refine(t=>t.minimumMicroUsd<=t.maximumMicroUsd,"Estimate range is reversed.")).max(6),createdAt:b}).strict(),U=e.object({schemaVersion:e.literal("openpond.datasetPreparationRun.v1"),id:o,operationId:o,teamId:o,ownerUserId:o,datasetId:o,datasetRevision:e.number().int().positive(),revision:e.number().int().positive(),requestHash:u,policy:X,status:se,stage:J,coverage:oe.nullable(),preview:ce.nullable(),counts:e.object({scannedConversations:d,scannedTurns:d,candidates:d,reconstructed:d,qualifying:d,qualified:d,excluded:d,needsAttention:d}).strict(),accounting:de,publication:e.object({datasetId:o,workspaceRevision:e.number().int().positive(),release:x}).strict().nullable(),error:e.object({code:o,message:e.string().trim().min(1).max(5e3)}).strict().nullable(),createdAt:b,updatedAt:b}).strict().superRefine((t,a)=>{t.accounting.maximumMicroUsd!==t.policy.budget.maximumMicroUsd&&a.addIssue({code:"custom",message:"Accounting authority differs from the saved preparation policy."}),t.counts.qualified+t.counts.excluded+t.counts.needsAttention>t.counts.candidates&&a.addIssue({code:"custom",message:"Preparation outcomes exceed the candidate population."}),t.status==="preview_ready"&&(t.policy.execution!=="preview_only"||t.stage!=="preview"||!t.preview||!t.coverage?.complete||!t.accounting.complete)&&a.addIssue({code:"custom",message:"Preview readiness requires a preview-only policy, reconciled source coverage and settled preview calls."}),["ready","releasing","completed"].includes(t.status)&&(t.counts.qualified===0||!t.policy.allowPartialVersion&&t.counts.qualified<t.policy.limits.acceptedTarget)&&a.addIssue({code:"custom",message:"Preparation cannot report readiness below its accepted target."}),["ready","releasing","completed"].includes(t.status)&&(t.policy.execution!=="prepare"||!t.preview||!t.coverage?.complete||!t.accounting.complete)&&a.addIssue({code:"custom",message:"Dataset readiness requires full preparation authority, reconciled source coverage, preview and final accounting."}),t.status==="completed"&&(!t.publication||!t.accounting.complete)&&a.addIssue({code:"custom",message:"Completed preparation requires publication and reconciled accounting."}),t.status==="cancelled"&&(!t.accounting.complete||t.accounting.cleanupPending>0)&&a.addIssue({code:"custom",message:"Cancellation requires settled resource obligations."})}),me=e.object({teamId:o,datasetId:o,runs:e.array(U).max(50),nextCursor:o.nullable()}).strict(),P=e.object({source:H,startSequence:d,endSequence:d,role:e.enum(["requirement","initial_context","outcome","correction","verification"])}).strict().superRefine((t,a)=>{t.endSequence<t.startSequence&&a.addIssue({code:"custom",message:"Evidence span must be ordered."})}),pe=e.object({schemaVersion:e.literal("openpond.preparedTaskProvenance.v1"),candidateId:o,preparationId:o,familyKey:o,sourceSpans:e.array(P).min(1).max(200),firstAvailableAt:b,initialInputHash:u,initialEnvironmentHash:u,initialAssetsHash:u.nullable(),sourceScopeHash:u}).strict().superRefine((t,a)=>{t.sourceSpans.some(s=>s.role==="requirement")||a.addIssue({code:"custom",message:"A reconstructed task needs a source requirement."});let r=new Set;for(let s of t.sourceSpans){t.sourceSpans.some(n=>n!==s&&n.source.id===s.source.id&&n.source.snapshotHash===s.source.snapshotHash&&n.role!==s.role&&s.startSequence<=n.endSequence&&n.startSequence<=s.endSequence)&&a.addIssue({code:"custom",message:"Evidence offsets cannot have conflicting roles."});let i=JSON.stringify([s.source,s.startSequence,s.endSequence]);r.has(i)&&a.addIssue({code:"custom",message:"Evidence span is duplicated or crosses public/private roles."}),r.add(i)}}),ue=e.object({schemaVersion:e.literal("openpond.preparedTaskQualification.v1"),id:o,candidateId:o,preparationId:o,taskHash:u,environmentHash:u,packageHash:u,graderBindings:e.array(e.object({id:o,version:o,contentHash:u,origin:e.enum(["reused","adapted","authored"])}).strict()).min(1).max(100),checks:e.array(e.object({id:o,label:e.enum(["positive","incorrect","incomplete","adversarial","clean_reset"]),executionReceiptId:o,expectedPassed:e.boolean(),observedPassed:e.boolean().nullable(),infrastructureError:o.nullable()}).strict()).min(5).max(500),independentEvidenceRefs:e.array(o).min(1).max(100),judgeCalibration:e.enum(["not_applicable","passed","failed","pending"]),cleanup:e.enum(["completed","pending"]),passed:e.boolean(),createdAt:b}).strict().superRefine((t,a)=>{if(!t.passed)return;let r=new Set(t.checks.map(s=>s.label));["positive","incorrect","incomplete","adversarial","clean_reset"].some(s=>!r.has(s))&&a.addIssue({code:"custom",message:"Qualified tasks require positive, negative, adversarial and clean-reset evidence."}),(t.cleanup!=="completed"||["pending","failed"].includes(t.judgeCalibration)||t.checks.some(s=>s.infrastructureError!==null||s.observedPassed!==s.expectedPassed))&&a.addIssue({code:"custom",message:"Failed, uncalibrated or uncleared checks cannot qualify a task."}),t.checks.some(s=>s.expectedPassed!==["positive","clean_reset"].includes(s.label))&&a.addIssue({code:"custom",message:"Qualification witnesses must pass positives/resets and reject incorrect, incomplete and adversarial outputs."})}),le=e.object({id:o,runId:o,revision:e.number().int().positive(),taskClass:T,status:e.enum(["discovered","reconstructing","authoring","qualifying","qualified","excluded","needs_attention"]),objective:e.string().trim().min(1).max(2e4),provenance:pe.nullable(),qualification:ue.nullable(),reason:e.object({code:o,message:e.string().trim().min(1).max(5e3)}).strict().nullable(),attempts:d.max(6)}).strict().superRefine((t,a)=>{t.status==="qualified"&&(!t.provenance||!t.qualification?.passed)&&a.addIssue({code:"custom",message:"Candidate admission requires reconstruction and qualification receipts."}),t.provenance&&(t.provenance.candidateId!==t.id||t.provenance.preparationId!==t.runId)&&a.addIssue({code:"custom",message:"Candidate provenance identity mismatch."}),t.qualification&&(t.qualification.candidateId!==t.id||t.qualification.preparationId!==t.runId)&&a.addIssue({code:"custom",message:"Candidate qualification identity mismatch."})}),p=e.string().trim().min(1).max(240),he=e.object({teamId:p,datasetId:p,runId:p,candidates:e.array(le).max(50),nextCursor:p.nullable()}).strict(),L=class extends Error{static{k(this,"DatasetPreparationRequestError")}constructor(t,a,r){super(r),this.status=t,this.code=a,this.name="DatasetPreparationRequestError"}status;code},fe=class{static{k(this,"OpenPondDatasetPreparationClient")}constructor(t){this.options=t;let a=new URL(t.baseUrl);if(!["http:","https:"].includes(a.protocol)||a.username||a.password||a.search||a.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=a.toString().replace(/\/+$/,"")}options;baseUrl;async create(t,a,r){let s=ie.parse(a),i=this.readRun(await this.request(t,"","POST",s,r),t);if(i.operationId!==s.operationId||i.requestHash!==I(s)||i.datasetRevision!==s.expectedDatasetRevision)throw new Error("Preparation creation receipt differs from the saved intent.");return i}async createGrant(t,a,r){let s=te.parse(a),i=this.readGrant(await this.request(t,"/grants","POST",s,r));if(i.id!==s.id||i.projectId!==s.projectId||i.maximumMicroUsd!==s.maximumMicroUsd||i.maximumSandboxSeconds!==s.maximumSandboxSeconds)throw new Error("Preparation grant receipt differs from the saved limits.");return i}async getGrant(t,a,r){let s=this.readGrant(await this.request(t,`/grants/${encodeURIComponent(p.parse(a))}`,"GET",void 0,r));if(s.id!==a)throw new Error("Preparation grant identity mismatch.");return s}readGrant(t){let a=ae.parse(t);if(a.teamId!==this.options.teamId)throw new Error("Preparation grant workspace mismatch.");return a}async get(t,a,r){return this.readRun(await this.request(t,`/${encodeURIComponent(p.parse(a))}`,"GET",void 0,r),t,a)}async list(t,a={}){let r=new URLSearchParams(a.cursor?{cursor:p.parse(a.cursor)}:{}),s=me.parse(await this.request(t,`?${r}`,"GET",void 0,a.signal));if(s.teamId!==this.options.teamId||s.datasetId!==t||s.runs.some(i=>i.teamId!==s.teamId||i.datasetId!==t)||new Set(s.runs.map(i=>i.id)).size!==s.runs.length)throw new Error("Preparation list scope/identity mismatch.");return s}async command(t,a,r,s){let i=ne.parse(r),n=this.readRun(await this.request(t,`/${encodeURIComponent(p.parse(a))}/commands`,"POST",i,s),t,a);if(n.revision<i.expectedRevision+1)throw new Error("Preparation command did not advance the expected revision.");return n}async operationResult(t,a,r){let s=await this.request(t,`/operations/${encodeURIComponent(p.parse(a))}`,"GET",void 0,r);if(s===null)return null;let i=e.object({operationId:p,requestHash:e.string().regex(/^[a-f0-9]{64}$/),run:U}).strict().parse(s);if(i.operationId!==a)throw new Error("Preparation operation recovery identity mismatch.");return this.readRun(i.run,t),i}async candidates(t,a,r={}){let s=new URLSearchParams(r.cursor?{cursor:p.parse(r.cursor)}:{}),i=he.parse(await this.request(t,`/${encodeURIComponent(p.parse(a))}/candidates?${s}`,"GET",void 0,r.signal));if(i.teamId!==this.options.teamId||i.datasetId!==t||i.runId!==a||i.candidates.some(n=>n.runId!==a)||new Set(i.candidates.map(n=>n.id)).size!==i.candidates.length)throw new Error("Preparation candidate page scope/identity mismatch.");return i}readRun(t,a,r){let s=U.parse(t);if(s.teamId!==this.options.teamId||s.datasetId!==a||r&&s.id!==r)throw new Error("Preparation run scope/identity mismatch.");return s}async request(t,a,r,s,i){let n=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/dataset-workspaces/${encodeURIComponent(p.parse(t))}/preparations${a}`,{method:r,signal:i,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json"},...s===void 0?{}:{body:JSON.stringify(s)}});if(!n.body)throw n.ok?new Error("Preparation response is empty."):new L(n.status,"dataset_preparation_request_failed",`Dataset preparation request failed (${n.status}).`);let m=n.body.getReader(),h=[],v=0;try{for(;;){let g=await m.read();if(g.done)break;if(v+=g.value.byteLength,v>(n.ok?8*1024*1024:64*1024))throw new Error("Preparation response exceeds its bounded page.");h.push(g.value)}}finally{await m.cancel()}let y=new Uint8Array(v),c=0;for(let g of h)y.set(g,c),c+=g.length;let f=new TextDecoder("utf-8",{fatal:!0}).decode(y);if(!n.ok){let g=null;try{g=JSON.parse(f)}catch{}let w=e.object({code:e.string().max(240),message:e.string().max(5e3)}).safeParse(g);throw new L(n.status,w.success?w.data.code:"dataset_preparation_request_failed",w.success?w.data.message:`Dataset preparation request failed (${n.status}).`)}return JSON.parse(f)}},Me=class{static{k(this,"OpenPondDatasetWorkspaceClient")}constructor(t){this.options=t;let a=new URL(t.baseUrl);if(!["http:","https:"].includes(a.protocol)||a.username||a.password||a.search||a.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=a.toString().replace(/\/+$/,""),this.preparations=new fe(t)}options;baseUrl;preparations;async list(t={}){let{signal:a,...r}=t,s=O.parse(r),i=new URLSearchParams(Object.entries(s).filter(([,m])=>m!==void 0).map(([m,h])=>[m,String(h)])),n=G.parse(await this.request(`?${i}`,"GET",void 0,a));if(n.teamId!==this.options.teamId||n.datasets.length>s.limit||new Set(n.datasets.map(m=>m.id)).size!==n.datasets.length)throw new Error("Dataset list workspace/page mismatch.");return n}async get(t,a){return this.readback(await this.request(`/${encodeURIComponent(t)}`,"GET",void 0,a),t)}async operationResult(t,a){let r=Q.parse(a.kind),s=new URLSearchParams({kind:r,...a.datasetId?{datasetId:a.datasetId}:{}}),i=await this.request(`/operations/${encodeURIComponent(t)}?${s}`,"GET",void 0,a.signal,132*1024*1024);if(i===null)return null;let n=ee.parse(i);if(this.readback(n.receipt,n.receipt.datasetId),n.base&&this.readback(n.base,n.receipt.datasetId),n.operationId!==t||n.kind!==r||a.datasetId&&n.receipt.datasetId!==a.datasetId||a.requestHash&&n.requestHash!==a.requestHash)throw new Error("Dataset operation recovery identity/request mismatch.");return n}async beginVersion(t,a,r){let s=F.parse(a),i=this.readback(await this.request(`/${encodeURIComponent(t)}/begin-version`,"POST",s,r),t);if(i.revision!==s.expectedRevision+1||i.workspace.draft.status!=="draft"||!i.publication||!i.workspace.draft.publishedTasksetRef)throw new Error("Editable version receipt mismatch.");return i}async versions(t,a={}){let r=new URLSearchParams(a.beforeRevision===void 0?{}:{beforeRevision:String(a.beforeRevision)}),s=W.parse(await this.request(`/${encodeURIComponent(t)}/versions?${r}`,"GET",void 0,a.signal));if(s.teamId!==this.options.teamId||s.datasetId!==t||s.items.some((i,n)=>n>0&&i.workspaceRevision>=s.items[n-1].workspaceRevision||a.beforeRevision!==void 0&&i.workspaceRevision>=a.beforeRevision))throw new Error("Dataset version history scope/order mismatch.");return s}async version(t,a,r){let s=this.readback(await this.request(`/${encodeURIComponent(t)}/versions/${a}`,"GET",void 0,r),t);if(s.revision!==a||s.workspace.draft.status!=="published")throw new Error("Dataset immutable version mismatch.");return s}async save(t,a){let r=M.parse(t),s=D(r.workspace);if(s.draft.profileId!==this.options.teamId||s.draft.revision!==r.expectedRevision+1)throw new Error("Dataset write scope or revision mismatch.");let i=this.readback(await this.request(`/${encodeURIComponent(s.draft.id)}`,"PUT",r,a),s.draft.id);if(r.originProjectId&&i.originProjectId!==r.originProjectId)throw new Error("Dataset origin Project mismatch.");if(r.ownerScope&&i.ownerScope!==r.ownerScope)throw new Error("Dataset owner scope mismatch.");if(i.workspace.contentHash!==s.contentHash)throw new Error("Dataset write receipt differs from the saved bytes.");return i}async validate(t,a,r){let s=K.parse(await this.request(`/${encodeURIComponent(t)}/validate`,"POST",{expectedRevision:a},r));if(s.teamId!==this.options.teamId||s.datasetId!==t||s.revision!==a)throw new Error("Dataset validation receipt mismatch.");return s}async publish(t,a,r){let s=V.parse(a),i=this.readback(await this.request(`/${encodeURIComponent(t)}/publish`,"POST",s,r),t);if(i.revision!==s.expectedRevision+1||i.workspace.draft.status!=="published"||i.publication?.packageHash!==s.packageHash)throw new Error("Dataset publication receipt mismatch.");return i}readback(t,a){let r=q.parse(t);if(D(r.workspace),r.datasetId!==a||r.teamId!==this.options.teamId)throw new Error("Dataset identity mismatch.");return r}async request(t,a,r,s,i){let n=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/dataset-workspaces${t}`,{method:a,signal:s,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,"Content-Type":"application/json"},...r===void 0?{}:{body:JSON.stringify(r)}});if(!n.ok)throw new Error(`Dataset request failed (${n.status}).`);if(i!==void 0){if(!n.body)throw new Error("Dataset response is empty.");let m=n.body.getReader(),h=[],v=0;try{for(;;){let f=await m.read();if(f.done)break;if(v+=f.value.byteLength,v>i)throw new Error("Dataset recovery exceeds its bounded response.");h.push(f.value)}}finally{await m.cancel()}let y=new Uint8Array(v),c=0;for(let f of h)y.set(f,c),c+=f.length;return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(y))}return n.json()}},E=e.string().trim().min(1).max(500),ge=e.string().regex(/^[a-f0-9]{64}$/),Y=e.object({release:x,afterId:E.optional(),limit:e.number().int().min(1).max(1e4).default(100),view:e.enum(["ids","policy"]).default("ids")}).strict().superRefine((t,a)=>{t.view==="policy"&&t.limit>100&&a.addIssue({code:"custom",path:["limit"],message:"Policy previews are bounded to 100 tasks."})}),Z=e.object({id:A.shape.id,split:$}).strict(),we=Z.extend({input:e.record(e.string(),e.unknown()),policyVisibleContext:e.record(e.string(),e.unknown()),artifacts:e.array(e.object({id:E,path:e.string(),mediaType:e.string(),sizeBytes:e.number().int().nonnegative()}).strict()).max(1e3)}).strict(),be=e.object({schemaVersion:e.literal("openpond.datasetPopulationPage.v1"),teamId:E,release:x,view:Y.shape.view,taskCount:e.number().int().nonnegative(),items:e.array(e.union([Z,we])).max(1e4),graders:e.array(z).max(1e3),nextCursor:E.nullable(),contentHash:ge}).strict().superRefine((t,a)=>{t.view==="policy"&&t.items.length>100&&a.addIssue({code:"custom",message:"Policy preview exceeded its task bound."}),t.items.some(r=>"input"in r!=(t.view==="policy"))&&a.addIssue({code:"custom",message:"Dataset task view differs from the requested projection."})}),We=class{static{k(this,"OpenPondDatasetPopulationClient")}constructor(t){this.options=t;let a=new URL(t.baseUrl);if(!["http:","https:"].includes(a.protocol)||a.username||a.password||a.search||a.hash||!t.apiKey.trim()||!t.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=a.toString().replace(/\/+$/,"")}options;baseUrl;async read(t,a){let r=Y.parse(t),s=new URLSearchParams({releaseId:r.release.id,revision:String(r.release.revision),contentHash:r.release.contentHash,limit:String(r.limit),view:r.view});r.afterId&&s.set("afterId",r.afterId);let i=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/dataset-workspaces/population?${s}`,{signal:a,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,Accept:"application/json"}}),n=i.body?.getReader();if(!n)throw new Error("Dataset population response was empty.");let m=0,h="",v=new TextDecoder;try{for(;;){let w=await n.read();if(w.done)break;if(m+=w.value.byteLength,m>4194304)throw new Error("Dataset population response exceeded 4 MiB. Request fewer tasks.");h+=v.decode(w.value,{stream:!0})}h+=v.decode()}finally{await n.cancel(),n.releaseLock()}let y=JSON.parse(h);if(!i.ok)throw new Error(e.object({message:e.string()}).passthrough().parse(y).message);let c=be.parse(y),{contentHash:f,...g}=c;if(c.teamId!==this.options.teamId||I(c.release)!==I(r.release)||c.view!==r.view||c.items.length>r.limit||I(g)!==f||c.items.some((w,_)=>r.afterId!==void 0&&w.id<=r.afterId||_>0&&w.id<=c.items[_-1].id)||c.nextCursor!==null&&c.nextCursor!==c.items.at(-1)?.id)throw new Error("Dataset population identity, hash, order or bounds mismatch.");return c}},N=e.string().trim().min(1).max(240),S=e.string().trim().min(1).max(5e3),ve=e.object({taskClass:T,objective:e.string().trim().min(1).max(2e4),sourceSpans:e.array(P).min(1).max(200),firstAvailableAt:e.iso.datetime(),reconstruction:e.object({kind:e.enum(["text_only","pinned_repository","pinned_artifact","unsupported"]),requiredAssets:e.array(e.object({reference:S,evidence:P}).strict()).max(100),missingEvidence:e.array(S).max(20)}).strict(),assessment:e.object({kind:e.enum(["executable","calibrated_judge","unsupported"]),requirements:e.array(e.object({criterion:S,evidence:P}).strict()).min(1).max(20),limitations:e.array(S).max(20)}).strict()}).strict().superRefine((t,a)=>{t.sourceSpans.some(r=>r.role==="requirement")||a.addIssue({code:"custom",message:"A research candidate requires independently retained user requirements."}),t.assessment.requirements.some(r=>r.evidence.role!=="requirement")&&a.addIssue({code:"custom",message:"Assessment criteria must cite user requirements, not historical answers."})}),Ke=e.object({schemaVersion:e.literal("openpond.datasetPreparationResearchDecision.v1"),sourceId:N,snapshotHash:e.string().regex(/^[a-f0-9]{64}$/),candidates:e.array(ve).max(100),exclusions:e.array(e.object({code:N,reason:S,sourceSpans:e.array(P).max(200)}).strict()).max(100),contextSummary:e.string().max(2e4)}).strict(),ye=e.string().regex(/^[a-f0-9]{64}$/);var Le=e.object({schemaVersion:e.literal("openpond.preparedRepositoryStartingState.v1"),dependencyClosureQualified:e.literal(!1),assets:e.array(B.extend({receiptId:e.string().regex(/^starting-assets-[a-f0-9]{40}$/),receiptHash:ye,source:H}).strict()).min(1).max(100)}).strict().superRefine((t,a)=>{new Set(t.assets.map(r=>r.path)).size!==t.assets.length&&a.addIssue({code:"custom",message:"Starting paths must be distinct."}),t.assets.some(r=>r.commitHash!==t.assets[0].commitHash||I(r.source)!==I(t.assets[0].source))&&a.addIssue({code:"custom",message:"Starting assets must belong to one original task boundary and commit."})});var R=e.string().trim().min(1).max(240),j=e.string().trim().min(1).max(2e4),Ie=e.object({id:R,label:e.enum(["positive","incorrect","incomplete","adversarial"]),output:e.record(e.string(),e.unknown()),artifacts:e.array(e.object({path:C.shape.path,mediaType:C.shape.mediaType,base64:e.string().max(8*1024*1024)}).strict()).max(100)}).strict().superRefine((t,a)=>{new Set(t.artifacts.map(r=>r.path)).size!==t.artifacts.length&&a.addIssue({code:"custom",message:"Qualification artifacts must have distinct paths."})}),Qe=e.object({schemaVersion:e.literal("openpond.preparedQualificationPlan.v1"),requirementRefs:e.array(R).min(1).max(100),supported:e.boolean(),limitations:e.array(j).max(20),independentVerifier:e.object({runtime:e.enum(["isolated_javascript","sandbox_process"]),source:e.string().trim().min(1).max(2e5),exportName:e.literal("verify"),timeoutMs:e.number().int().min(1).max(6e4)}).strict().nullable(),witnesses:e.array(Ie).max(20)}).strict().superRefine((t,a)=>{(new Set(t.requirementRefs).size!==t.requirementRefs.length||new Set(t.witnesses.map(r=>r.id)).size!==t.witnesses.length)&&a.addIssue({code:"custom",message:"Qualification evidence identities must be distinct."}),t.supported&&(!t.independentVerifier||t.limitations.length||["positive","incorrect","incomplete","adversarial"].some(r=>!t.witnesses.some(s=>s.label===r)))&&a.addIssue({code:"custom",message:"Supported qualification needs a complete verifier and witness population without unresolved evidence gaps."})}),Je=e.object({schemaVersion:e.literal("openpond.preparedWitnessAdjudication.v1"),witnesses:e.array(e.object({id:R,failureMode:e.enum(["none","incorrect","incomplete","adversarial","unverifiable"]),requirements:e.array(e.object({reference:R,status:e.enum(["satisfied","violated","unverifiable"]),reason:j}).strict()).min(1).max(100)}).strict()).min(4).max(20)}).strict(),Xe=e.object({schemaVersion:e.literal("openpond.preparedCheckerAudit.v1"),requirements:e.array(e.object({reference:R,adequatelyChecked:e.boolean(),oracleAdequatelyChecked:e.boolean(),reason:j}).strict()).min(1).max(100),executionIsolationPassed:e.boolean(),futureEvidenceLeak:e.boolean(),unresolvedLimitations:e.array(j).max(20),passed:e.boolean()}).strict();export{Me as a,Y as b,be as c,We as d};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{Gg as l,Jg as h,Kg as E,Lg as w,Rg as f,aa as d,fe as u,ra as p}from"./chunk-6D3FI2XT.js";import{c as i,f as m,h as g}from"./chunk-3M53YXEI.js";import{a as c}from"./chunk-FTQLQJQV.js";var M=new Set(["hosted-engram-capability","hosted-compile-engram","hosted-prepare-engram","hosted-start-engram","hosted-cancel-engram","hosted-engram-execution","hosted-engram-executions","hosted-save-engram-model","hosted-control-engram-serving"]);async function k(x){let{action:r,target:s,teamId:n,options:o,client:t,readInput:y}=x;if(r==="hosted-engram-execution"){if(!s)throw new Error("Supply the original Engram execution ID.");return t.getEngramExecution(n,s)}if(r==="hosted-engram-executions"){if(s)throw new Error("List Engram executions using filters.");let e=f.parse(Object.fromEntries(Object.entries({id:i(o,"id")||void 0,projectId:i(o,"projectId")||void 0,phase:i(o,"phase")||void 0,cursor:i(o,"cursor")||void 0,limit:g(o.limit,"--limit")}).filter(([,I])=>I!==void 0)));return t.listEngramExecutions(n,e)}let a=await y();if(r==="hosted-control-engram-serving"){let e=p.parse(a);if(e.request.teamId!==n)throw new Error("Use the Model's original workspace.");if(e.request.action==="activate"&&!m(o.yes))throw new Error("Activating billed serving capacity requires --yes.");return t.controlEngramModelServing(e.modelProjectId,e.request)}if(r==="hosted-engram-capability"){let e=u.parse(a);if(e.teamId!==n)throw new Error("Use this input's original workspace.");return t.engramExecutionCapability(e)}if(r==="hosted-compile-engram"){let e=l.parse(a);if(e.teamId!==n)throw new Error("Use this input's original workspace.");return t.compileEngramExecution(e)}if(r==="hosted-prepare-engram"){let e=h.parse(a);if(e.teamId!==n)throw new Error("Use this input's original workspace.");return t.prepareEngramExecution(e)}if(r==="hosted-start-engram"){let e=E.parse(a);if(e.teamId!==n)throw new Error("Use this execution's original workspace.");if(!m(o.yes))throw new Error("Starting paid Engram training requires --yes.");return t.startEngramExecution(e)}if(r==="hosted-cancel-engram"){let e=w.parse(a);if(e.teamId!==n)throw new Error("Use this execution's original workspace.");return t.cancelEngramExecution(e)}if(r==="hosted-save-engram-model"){let e=d.parse(a);if(e.teamId!==n)throw new Error("Use this result's original workspace.");return t.saveEngramResultModel(e)}throw new Error("Unsupported Engram command.")}c(k,"runHostedEngramCommand");export{M as a,k as b};
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as pt}from"./chunk-2RSGVLZT.js";import{a as D,b as Fe,d as de}from"./chunk-HPTEJBP4.js";import{b as mt,c as ft}from"./chunk-QFL2VQKX.js";import{a as Je,b as Ye,c as Ze,d as ce}from"./chunk-ADOCQA4D.js";import{a as M,b as ue}from"./chunk-4EZI4KCT.js";import{_ as lt,a as le,d as $e,e as Ve,g as tt,j as rt,k as st,na as ut,oa as dt,pa as gt,v as at,w as Y,y as it}from"./chunk-4NN5OLKW.js";import{g as ct}from"./chunk-RWRKUO5D.js";import{a as ze}from"./chunk-PYNW5OFA.js";import{b as et}from"./chunk-4VZJQRQI.js";import{a as Xe}from"./chunk-VFH5C6D2.js";import{b as Ge,d as Qe}from"./chunk-R6VI7MX5.js";import{k as Ke}from"./chunk-CSU7RDA5.js";import{a as ot,b as nt}from"./chunk-GW766ZSO.js";import{i as Be,p as Ue}from"./chunk-MCBRB5D6.js";import{s as L,u as B,v as ie,z as Le}from"./chunk-4TTXNVCE.js";import{a as T,d as X}from"./chunk-BJXPQIVD.js";import{c as We}from"./chunk-L3KS6MOV.js";import{F as Ne,Ga as qe,g as Me}from"./chunk-CJDGLPNX.js";import{a as je}from"./chunk-BL3CZWWD.js";import{a as tr}from"./chunk-JFXINDOQ.js";import{b as De}from"./chunk-O6ZYDHEJ.js";import{g as be}from"./chunk-AJXWJLZA.js";import{_ as Ce,ca as He,fa as Oe}from"./chunk-SH7POUVX.js";import{F as Ie}from"./chunk-2MEOUS24.js";import{n as H}from"./chunk-RCT3O3HQ.js";import{p as _e}from"./chunk-UGOK7VTC.js";import{a as n,e as er}from"./chunk-FTQLQJQV.js";import{randomUUID as Pr}from"node:crypto";import{mkdir as Rr}from"node:fs/promises";import q from"node:path";function ht(e){return async(t,r)=>{let s=await e?.(t,r)??null;if((t.metadata?.standaloneExperiment!==void 0||t.metadata?.localProfileExperiment!==void 0)&&!s)throw new Error("This native Experiment session has no active durable model-dispatch owner.");return s}}n(ht,"experimentSessionStreamResolver");var St=er(tr(),1);import{randomUUID as pe}from"node:crypto";var rr=15e3,or=3e4;function Wr(e){let t=new Set,r=null,s=null;async function p(a){if(!a.profileRef||!a.profileWorkflowId)throw new Error(a.profileMigrationError??`Chat Workflow ${a.id} has no Profile package.`);let u=await e.getSession(a.sessionId),i=await e.resolveProfileOwner(u,a.profileRef),c=await e.readProfilePackage(i.sourcePath,a.profileWorkflowId);return{...a,name:c.name,prompt:c.prompt}}n(p,"authoredWorkflow");async function h(){for(let a of await e.store.listChatWorkflows())if(!(a.profileRef&&a.profileWorkflowId))try{let u=await e.getSession(a.sessionId);if(!u.currentProfile)throw new Error("Original session has no explicit Profile owner.");let i=await e.resolveProfileOwner(u,u.currentProfile),c={...a,profileRef:i.ref,profileWorkflowId:a.profileWorkflowId??`chat-${a.id.toLowerCase()}`,profileMigrationError:null};await e.saveProfilePackage(i.sourcePath,c),await e.store.patchChatWorkflow(a.id,()=>c)}catch(u){let i=`Profile package migration unresolved: ${u instanceof Error?u.message:String(u)}`;await e.store.patchChatWorkflow(a.id,c=>({...c,profileMigrationError:i})),e.logger?.warn("chat workflow Profile migration unresolved",{workflowId:a.id,error:i})}}n(h,"migrateExistingWorkflows");async function w(a){let u=await e.getSession(a.sessionId),i=await e.resolveProfileOwner(u),c=T(),g=Z(a.recurrence,new Date,0);if(!g.value)throw new Error(g.error??"This workflow has no future occurrence.");let k={id:pe(),sessionId:u.id,sessionTitle:u.title,sourceTurnId:a.sourceTurnId??null,name:a.name,prompt:a.prompt,profileRef:i.ref,profileWorkflowId:`chat-${pe()}`,recurrence:a.recurrence,enabled:!0,nextRunAt:g.value,lastRunAt:null,lastRunStatus:null,lastRunId:null,lastError:g.error,scheduledRunCount:0,createdAt:c,updatedAt:c};return await e.saveProfilePackage(i.sourcePath,k),e.store.upsertChatWorkflow(k)}n(w,"create");async function v(){if(e.isClosing())return;let a=await e.store.listDueChatWorkflows(T());for(let u of a)if(!t.has(u.id)){if(e.isSessionTurnActive(u.sessionId)){await e.store.patchChatWorkflow(u.id,i=>({...i,nextRunAt:new Date(Date.now()+or).toISOString(),lastError:"Waiting for the attached chat to finish its current turn.",updatedAt:T()}));continue}await d(u,u.nextRunAt??T(),"schedule")}}n(v,"runTick");function l(){if(s)return s;let a=v().finally(()=>{s===a&&(s=null)});return s=a,a}n(l,"trackedTick");async function d(a,u,i){a=await p(a);let c=T(),g=e.store.home?await Oe(e.store.home):void 0,k={definitionSnapshot:structuredClone(a),...g?{configurationSnapshot:{effectiveRevision:g.effectiveRevision,sources:g.sources}}:{},id:pe(),workflowId:a.id,sessionId:a.sessionId,scheduledFor:u,trigger:i,status:"queued",turnId:null,error:null,createdAt:c,startedAt:null,completedAt:null,updatedAt:c},y=await e.store.insertChatWorkflowRun(k);return t.add(a.id),e.queue.enqueue({label:"chat-workflow-run",metadata:{workflowId:a.id,sessionId:a.sessionId,trigger:i,scheduledFor:u}},async()=>{try{await f(a,y)}finally{t.delete(a.id)}}),y}n(d,"enqueue");async function f(a,u){let i=T();await e.store.patchChatWorkflowRun(u.id,S=>({...S,status:"running",startedAt:i,updatedAt:i}));let c=null,g=null;try{c=await e.sendTurn(a.sessionId,{prompt:a.prompt,metadata:{interactionKind:"scheduled_workflow",chatWorkflowId:a.id,chatWorkflowName:a.name,chatWorkflowRunId:u.id,scheduledFor:u.scheduledFor}})}catch(S){g=S instanceof Error?S.message:String(S)}let k=T(),y=c?.status==="completed"?"succeeded":"failed";await e.store.patchChatWorkflowRun(u.id,S=>({...S,status:y,turnId:c?.id??null,error:g??c?.error??null,completedAt:k,updatedAt:k})),await e.store.patchChatWorkflow(a.id,S=>{let b=S.scheduledRunCount+(u.trigger==="schedule"?1:0),P=u.trigger==="manual"?{value:S.nextRunAt,error:null}:Z(S.recurrence,new Date,b);return{...S,enabled:P.value?S.enabled:!1,nextRunAt:S.enabled?P.value:null,lastRunAt:k,lastRunStatus:y,lastRunId:u.id,lastError:P.error??g??c?.error??null,scheduledRunCount:b,updatedAt:k}})}return n(f,"execute"),{async start(){r||(await h(),l().catch(a=>e.logger?.warn("chat workflow tick failed",{error:String(a)})),r=setInterval(()=>{l().catch(a=>e.logger?.warn("chat workflow tick failed",{error:String(a)}))},e.tickMs??rr),r.unref?.())},async stop(){r&&clearInterval(r),r=null,await s?.catch(()=>{})},create:w,async list(a){let u=await e.store.listChatWorkflows({sessionId:a});return Promise.all(u.map(async i=>{try{return await p(i)}catch(c){return{...i,profileMigrationError:c instanceof Error?c.message:String(c)}}}))},listRuns:n(a=>e.store.listChatWorkflowRuns(a),"listRuns"),async patch(a,u){let i=await e.store.getChatWorkflow(a);if(!i)return null;let c=T();if("enabled"in u){let S=u.enabled?Z(i.recurrence,new Date,i.scheduledRunCount):{value:null,error:null};return e.store.patchChatWorkflow(a,b=>({...b,enabled:u.enabled&&!!S.value,nextRunAt:u.enabled?S.value:null,lastError:S.error,updatedAt:c}))}let g=Z(u.recurrence,new Date,0);if(!i.profileRef||!i.profileWorkflowId)throw new Error(`Chat Workflow ${a} has no resolved Profile owner; migrate it before editing.`);let k=await e.getSession(i.sessionId),y=await e.resolveProfileOwner(k,i.profileRef);return await e.saveProfilePackage(y.sourcePath,{...i,name:u.name,prompt:u.prompt}),e.store.patchChatWorkflow(a,S=>({...S,name:u.name,prompt:u.prompt,recurrence:u.recurrence,enabled:!!g.value,nextRunAt:g.value,lastError:g.error,scheduledRunCount:0,updatedAt:c}))},remove:n(a=>e.store.deleteChatWorkflow(a),"remove"),async runNow(a){let u=await e.store.getChatWorkflow(a);if(!u)throw new Error("Chat workflow not found.");if(e.isSessionTurnActive(u.sessionId))throw new Error("The attached chat is currently running a turn.");return d(u,T(),"manual")}}}n(Wr,"createChatWorkflowLoop");var nr={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6};function Z(e,t,r){try{return{value:me(e,t,r),error:null}}catch(s){return{value:null,error:s instanceof Error?s.message:String(s)}}}n(Z,"safeNextOccurrence");function me(e,t,r){if(e.end.kind==="after_occurrences"&&r>=e.end.occurrences)return null;let s=wt(e.startDate,e.localTime,e.timeZone);if(e.kind==="once")return s.getTime()>t.getTime()?s.toISOString():null;let[p,h]=e.localTime.split(":").map(Number),w=e.kind==="daily"?`${h} ${p} * * *`:e.kind==="weekdays"?`${h} ${p} * * 1-5`:e.kind==="weekly"?`${h} ${p} * * ${(e.weekdays??[]).map(d=>nr[d]).join(",")}`:`${h} ${p} ${e.dayOfMonth} * *`,v=new Date(Math.max(t.getTime(),s.getTime()-1e3)),l=St.CronExpressionParser.parse(w,{currentDate:v,tz:e.timeZone}).next().toDate();if(e.end.kind==="on_date"){let d=wt(e.end.date,"23:59",e.timeZone);if(l.getTime()>d.getTime()+59999)return null}return l.toISOString()}n(me,"nextOccurrence");function wt(e,t,r){let[s,p,h]=e.split("-").map(Number),[w,v]=t.split(":").map(Number),l=Date.UTC(s,p-1,h,w,v),d=new Date(l);for(let f=0;f<3;f+=1){let a=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(d),u=Object.fromEntries(a.map(g=>[g.type,g.value])),i=Date.UTC(Number(u.year),Number(u.month)-1,Number(u.day),Number(u.hour),Number(u.minute)),c=l-i;if(c===0)return d;d=new Date(d.getTime()+c)}return d}n(wt,"zonedLocalDateTime");function vt(e){return _e(e,t=>{let r=0,s=0;t.exec("BEGIN IMMEDIATE");try{for(let[p,h,w]of[["local_agent_schedule_runs","local_agent_schedules","scheduleId"],["chat_workflow_runs","chat_workflows","workflowId"]]){let v=t.prepare(`SELECT id, payload FROM ${p} WHERE status IN ('queued','running')`).all();for(let l of v){let d=JSON.parse(l.payload),f=new Date().toISOString(),a=typeof d.turnId=="string"?t.prepare("SELECT payload FROM turns WHERE id = ?").get(d.turnId):void 0,i=(a?JSON.parse(a.payload):null)?.status==="completed",c=i?"The previous scheduled turn completed before shutdown.":"OpenPond stopped before this scheduled run was settled. Its external outcome may be unknown. Review the run before retrying or enabling this schedule.",g=i?"succeeded":"failed";t.prepare(`UPDATE ${p} SET status=?, payload=?, updated_at=? WHERE id=?`).run(g,JSON.stringify({...d,status:g,error:i?null:c,completedAt:f,updatedAt:f}),f,l.id);let k=t.prepare(`SELECT payload FROM ${h} WHERE id = ?`).get(String(d[w]));if(k&&!i){let y=JSON.parse(k.payload);t.prepare(`UPDATE ${h} SET enabled=0, next_run_at=NULL, payload=?, updated_at=? WHERE id=?`).run(JSON.stringify({...y,enabled:!1,nextRunAt:null,lastRunStatus:g,lastRunId:l.id,lastError:c,updatedAt:f}),f,String(d[w]))}if(i&&k&&h==="chat_workflows"){let y=qe.parse(JSON.parse(k.payload)),S=y.scheduledRunCount+(d.trigger==="schedule"?1:0),b=d.trigger==="manual"?y.nextRunAt:me(y.recurrence,new Date(f),S),P=y.enabled&&b!==null;t.prepare("UPDATE chat_workflows SET enabled=?, next_run_at=?, payload=?, updated_at=? WHERE id=?").run(P?1:0,P?b:null,JSON.stringify({...y,enabled:P,nextRunAt:P?b:null,scheduledRunCount:S,lastRunStatus:g,lastRunId:l.id,lastRunAt:f,lastError:null,updatedAt:f}),f,y.id)}i?r+=1:s+=1}}return t.exec("COMMIT"),{recovered:r,needsReview:s}}catch(p){throw t.exec("ROLLBACK"),p}})}n(vt,"reconcileInterruptedScheduledWork");async function kt(e,t){let r=sr(e);if(!r)return null;let s=await t.loadProfileState();return r==="help"?ar(s):ir(s)}n(kt,"runProfileSkillCommand");function sr(e){let t=/^\/skill(?:\s+([\s\S]*))?$/i.exec(e.trim());if(!t)return null;let r=t[1]?.trim().toLowerCase()??"";return!r||r==="list"?"list":r==="help"?"help":null}n(sr,"readOnlyProfileSkillAction");function ar(e){return{handled:!0,action:"help",profile:e,message:["Profile skills support:","- /skill list","- /skill create <what the skill should help with>","- /skill create <skill-name>: <what the skill should help with>","- /skill create --name <skill-name> <what the skill should help with>","- /skill edit <skill-name> <change request>","","Create and edit run as normal model turns with the bundled OpenPond Skill Authoring skill. Skills may include SKILL.md plus focused scripts, references, and assets. Use an Agent when the workflow needs code, actions, durable runtime behavior, setup, or Evals."].join(`
2
+ import{a as pt}from"./chunk-PSY6IRJE.js";import{a as D,b as Fe,d as de}from"./chunk-PKJHN666.js";import{b as mt,c as ft}from"./chunk-Z33RVGP6.js";import{a as Je,b as Ye,c as Ze,d as ce}from"./chunk-7PKDJHT6.js";import{a as M,b as ue}from"./chunk-65WRWLUD.js";import{_ as lt,a as le,d as $e,e as Ve,g as tt,j as rt,k as st,na as ut,oa as dt,pa as gt,v as at,w as Y,y as it}from"./chunk-FKUWCJ73.js";import{g as ct}from"./chunk-B66QCXH2.js";import{a as ze}from"./chunk-PYNW5OFA.js";import{b as et}from"./chunk-MOXIGLN2.js";import{a as Xe}from"./chunk-VFH5C6D2.js";import{b as Ge,d as Qe}from"./chunk-EYTTZ5H4.js";import{k as Ke}from"./chunk-DKOVZ6R2.js";import{a as ot,b as nt}from"./chunk-GW766ZSO.js";import{i as Be,p as Ue}from"./chunk-RY46UPBO.js";import{s as L,u as B,v as ie,z as We}from"./chunk-OFJPOTES.js";import{a as T,d as X}from"./chunk-U7D6Q744.js";import{F as Ne,Ga as qe,g as Me}from"./chunk-HG2YFMVU.js";import{a as je}from"./chunk-BL3CZWWD.js";import{c as Oe}from"./chunk-L3KS6MOV.js";import{b as De}from"./chunk-SSHE6B7Z.js";import{a as tr}from"./chunk-JFXINDOQ.js";import{g as Le}from"./chunk-AJXWJLZA.js";import{_ as _e,ca as Ce,fa as He}from"./chunk-SV7ZBEK2.js";import{F as be}from"./chunk-2MEOUS24.js";import{n as H}from"./chunk-RCT3O3HQ.js";import{p as Ie}from"./chunk-UGOK7VTC.js";import{a as n,e as er}from"./chunk-FTQLQJQV.js";import{randomUUID as Pr}from"node:crypto";import{mkdir as Rr}from"node:fs/promises";import q from"node:path";function ht(e){return async(t,r)=>{let s=await e?.(t,r)??null;if((t.metadata?.standaloneExperiment!==void 0||t.metadata?.localProfileExperiment!==void 0)&&!s)throw new Error("This native Experiment session has no active durable model-dispatch owner.");return s}}n(ht,"experimentSessionStreamResolver");var St=er(tr(),1);import{randomUUID as pe}from"node:crypto";var rr=15e3,or=3e4;function Wr(e){let t=new Set,r=null,s=null;async function p(a){if(!a.profileRef||!a.profileWorkflowId)throw new Error(a.profileMigrationError??`Chat Workflow ${a.id} has no Profile package.`);let u=await e.getSession(a.sessionId),i=await e.resolveProfileOwner(u,a.profileRef),c=await e.readProfilePackage(i.sourcePath,a.profileWorkflowId);return{...a,name:c.name,prompt:c.prompt}}n(p,"authoredWorkflow");async function h(){for(let a of await e.store.listChatWorkflows())if(!(a.profileRef&&a.profileWorkflowId))try{let u=await e.getSession(a.sessionId);if(!u.currentProfile)throw new Error("Original session has no explicit Profile owner.");let i=await e.resolveProfileOwner(u,u.currentProfile),c={...a,profileRef:i.ref,profileWorkflowId:a.profileWorkflowId??`chat-${a.id.toLowerCase()}`,profileMigrationError:null};await e.saveProfilePackage(i.sourcePath,c),await e.store.patchChatWorkflow(a.id,()=>c)}catch(u){let i=`Profile package migration unresolved: ${u instanceof Error?u.message:String(u)}`;await e.store.patchChatWorkflow(a.id,c=>({...c,profileMigrationError:i})),e.logger?.warn("chat workflow Profile migration unresolved",{workflowId:a.id,error:i})}}n(h,"migrateExistingWorkflows");async function w(a){let u=await e.getSession(a.sessionId),i=await e.resolveProfileOwner(u),c=T(),g=Z(a.recurrence,new Date,0);if(!g.value)throw new Error(g.error??"This workflow has no future occurrence.");let k={id:pe(),sessionId:u.id,sessionTitle:u.title,sourceTurnId:a.sourceTurnId??null,name:a.name,prompt:a.prompt,profileRef:i.ref,profileWorkflowId:`chat-${pe()}`,recurrence:a.recurrence,enabled:!0,nextRunAt:g.value,lastRunAt:null,lastRunStatus:null,lastRunId:null,lastError:g.error,scheduledRunCount:0,createdAt:c,updatedAt:c};return await e.saveProfilePackage(i.sourcePath,k),e.store.upsertChatWorkflow(k)}n(w,"create");async function v(){if(e.isClosing())return;let a=await e.store.listDueChatWorkflows(T());for(let u of a)if(!t.has(u.id)){if(e.isSessionTurnActive(u.sessionId)){await e.store.patchChatWorkflow(u.id,i=>({...i,nextRunAt:new Date(Date.now()+or).toISOString(),lastError:"Waiting for the attached chat to finish its current turn.",updatedAt:T()}));continue}await d(u,u.nextRunAt??T(),"schedule")}}n(v,"runTick");function l(){if(s)return s;let a=v().finally(()=>{s===a&&(s=null)});return s=a,a}n(l,"trackedTick");async function d(a,u,i){a=await p(a);let c=T(),g=e.store.home?await He(e.store.home):void 0,k={definitionSnapshot:structuredClone(a),...g?{configurationSnapshot:{effectiveRevision:g.effectiveRevision,sources:g.sources}}:{},id:pe(),workflowId:a.id,sessionId:a.sessionId,scheduledFor:u,trigger:i,status:"queued",turnId:null,error:null,createdAt:c,startedAt:null,completedAt:null,updatedAt:c},y=await e.store.insertChatWorkflowRun(k);return t.add(a.id),e.queue.enqueue({label:"chat-workflow-run",metadata:{workflowId:a.id,sessionId:a.sessionId,trigger:i,scheduledFor:u}},async()=>{try{await f(a,y)}finally{t.delete(a.id)}}),y}n(d,"enqueue");async function f(a,u){let i=T();await e.store.patchChatWorkflowRun(u.id,S=>({...S,status:"running",startedAt:i,updatedAt:i}));let c=null,g=null;try{c=await e.sendTurn(a.sessionId,{prompt:a.prompt,metadata:{interactionKind:"scheduled_workflow",chatWorkflowId:a.id,chatWorkflowName:a.name,chatWorkflowRunId:u.id,scheduledFor:u.scheduledFor}})}catch(S){g=S instanceof Error?S.message:String(S)}let k=T(),y=c?.status==="completed"?"succeeded":"failed";await e.store.patchChatWorkflowRun(u.id,S=>({...S,status:y,turnId:c?.id??null,error:g??c?.error??null,completedAt:k,updatedAt:k})),await e.store.patchChatWorkflow(a.id,S=>{let b=S.scheduledRunCount+(u.trigger==="schedule"?1:0),P=u.trigger==="manual"?{value:S.nextRunAt,error:null}:Z(S.recurrence,new Date,b);return{...S,enabled:P.value?S.enabled:!1,nextRunAt:S.enabled?P.value:null,lastRunAt:k,lastRunStatus:y,lastRunId:u.id,lastError:P.error??g??c?.error??null,scheduledRunCount:b,updatedAt:k}})}return n(f,"execute"),{async start(){r||(await h(),l().catch(a=>e.logger?.warn("chat workflow tick failed",{error:String(a)})),r=setInterval(()=>{l().catch(a=>e.logger?.warn("chat workflow tick failed",{error:String(a)}))},e.tickMs??rr),r.unref?.())},async stop(){r&&clearInterval(r),r=null,await s?.catch(()=>{})},create:w,async list(a){let u=await e.store.listChatWorkflows({sessionId:a});return Promise.all(u.map(async i=>{try{return await p(i)}catch(c){return{...i,profileMigrationError:c instanceof Error?c.message:String(c)}}}))},listRuns:n(a=>e.store.listChatWorkflowRuns(a),"listRuns"),async patch(a,u){let i=await e.store.getChatWorkflow(a);if(!i)return null;let c=T();if("enabled"in u){let S=u.enabled?Z(i.recurrence,new Date,i.scheduledRunCount):{value:null,error:null};return e.store.patchChatWorkflow(a,b=>({...b,enabled:u.enabled&&!!S.value,nextRunAt:u.enabled?S.value:null,lastError:S.error,updatedAt:c}))}let g=Z(u.recurrence,new Date,0);if(!i.profileRef||!i.profileWorkflowId)throw new Error(`Chat Workflow ${a} has no resolved Profile owner; migrate it before editing.`);let k=await e.getSession(i.sessionId),y=await e.resolveProfileOwner(k,i.profileRef);return await e.saveProfilePackage(y.sourcePath,{...i,name:u.name,prompt:u.prompt}),e.store.patchChatWorkflow(a,S=>({...S,name:u.name,prompt:u.prompt,recurrence:u.recurrence,enabled:!!g.value,nextRunAt:g.value,lastError:g.error,scheduledRunCount:0,updatedAt:c}))},remove:n(a=>e.store.deleteChatWorkflow(a),"remove"),async runNow(a){let u=await e.store.getChatWorkflow(a);if(!u)throw new Error("Chat workflow not found.");if(e.isSessionTurnActive(u.sessionId))throw new Error("The attached chat is currently running a turn.");return d(u,T(),"manual")}}}n(Wr,"createChatWorkflowLoop");var nr={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6};function Z(e,t,r){try{return{value:me(e,t,r),error:null}}catch(s){return{value:null,error:s instanceof Error?s.message:String(s)}}}n(Z,"safeNextOccurrence");function me(e,t,r){if(e.end.kind==="after_occurrences"&&r>=e.end.occurrences)return null;let s=wt(e.startDate,e.localTime,e.timeZone);if(e.kind==="once")return s.getTime()>t.getTime()?s.toISOString():null;let[p,h]=e.localTime.split(":").map(Number),w=e.kind==="daily"?`${h} ${p} * * *`:e.kind==="weekdays"?`${h} ${p} * * 1-5`:e.kind==="weekly"?`${h} ${p} * * ${(e.weekdays??[]).map(d=>nr[d]).join(",")}`:`${h} ${p} ${e.dayOfMonth} * *`,v=new Date(Math.max(t.getTime(),s.getTime()-1e3)),l=St.CronExpressionParser.parse(w,{currentDate:v,tz:e.timeZone}).next().toDate();if(e.end.kind==="on_date"){let d=wt(e.end.date,"23:59",e.timeZone);if(l.getTime()>d.getTime()+59999)return null}return l.toISOString()}n(me,"nextOccurrence");function wt(e,t,r){let[s,p,h]=e.split("-").map(Number),[w,v]=t.split(":").map(Number),l=Date.UTC(s,p-1,h,w,v),d=new Date(l);for(let f=0;f<3;f+=1){let a=new Intl.DateTimeFormat("en-CA",{timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(d),u=Object.fromEntries(a.map(g=>[g.type,g.value])),i=Date.UTC(Number(u.year),Number(u.month)-1,Number(u.day),Number(u.hour),Number(u.minute)),c=l-i;if(c===0)return d;d=new Date(d.getTime()+c)}return d}n(wt,"zonedLocalDateTime");function vt(e){return Ie(e,t=>{let r=0,s=0;t.exec("BEGIN IMMEDIATE");try{for(let[p,h,w]of[["local_agent_schedule_runs","local_agent_schedules","scheduleId"],["chat_workflow_runs","chat_workflows","workflowId"]]){let v=t.prepare(`SELECT id, payload FROM ${p} WHERE status IN ('queued','running')`).all();for(let l of v){let d=JSON.parse(l.payload),f=new Date().toISOString(),a=typeof d.turnId=="string"?t.prepare("SELECT payload FROM turns WHERE id = ?").get(d.turnId):void 0,i=(a?JSON.parse(a.payload):null)?.status==="completed",c=i?"The previous scheduled turn completed before shutdown.":"OpenPond stopped before this scheduled run was settled. Its external outcome may be unknown. Review the run before retrying or enabling this schedule.",g=i?"succeeded":"failed";t.prepare(`UPDATE ${p} SET status=?, payload=?, updated_at=? WHERE id=?`).run(g,JSON.stringify({...d,status:g,error:i?null:c,completedAt:f,updatedAt:f}),f,l.id);let k=t.prepare(`SELECT payload FROM ${h} WHERE id = ?`).get(String(d[w]));if(k&&!i){let y=JSON.parse(k.payload);t.prepare(`UPDATE ${h} SET enabled=0, next_run_at=NULL, payload=?, updated_at=? WHERE id=?`).run(JSON.stringify({...y,enabled:!1,nextRunAt:null,lastRunStatus:g,lastRunId:l.id,lastError:c,updatedAt:f}),f,String(d[w]))}if(i&&k&&h==="chat_workflows"){let y=qe.parse(JSON.parse(k.payload)),S=y.scheduledRunCount+(d.trigger==="schedule"?1:0),b=d.trigger==="manual"?y.nextRunAt:me(y.recurrence,new Date(f),S),P=y.enabled&&b!==null;t.prepare("UPDATE chat_workflows SET enabled=?, next_run_at=?, payload=?, updated_at=? WHERE id=?").run(P?1:0,P?b:null,JSON.stringify({...y,enabled:P,nextRunAt:P?b:null,scheduledRunCount:S,lastRunStatus:g,lastRunId:l.id,lastRunAt:f,lastError:null,updatedAt:f}),f,y.id)}i?r+=1:s+=1}}return t.exec("COMMIT"),{recovered:r,needsReview:s}}catch(p){throw t.exec("ROLLBACK"),p}})}n(vt,"reconcileInterruptedScheduledWork");async function kt(e,t){let r=sr(e);if(!r)return null;let s=await t.loadProfileState();return r==="help"?ar(s):ir(s)}n(kt,"runProfileSkillCommand");function sr(e){let t=/^\/skill(?:\s+([\s\S]*))?$/i.exec(e.trim());if(!t)return null;let r=t[1]?.trim().toLowerCase()??"";return!r||r==="list"?"list":r==="help"?"help":null}n(sr,"readOnlyProfileSkillAction");function ar(e){return{handled:!0,action:"help",profile:e,message:["Profile skills support:","- /skill list","- /skill create <what the skill should help with>","- /skill create <skill-name>: <what the skill should help with>","- /skill create --name <skill-name> <what the skill should help with>","- /skill edit <skill-name> <change request>","","Create and edit run as normal model turns with the bundled OpenPond Skill Authoring skill. Skills may include SKILL.md plus focused scripts, references, and assets. Use an Agent when the workflow needs code, actions, durable runtime behavior, setup, or Evals."].join(`
3
3
  `)}}n(ar,"profileSkillHelp");function ir(e){let t=e.skills.slice().sort((s,p)=>s.name.localeCompare(p.name));return{handled:!0,action:"list",message:t.length===0?"No profile skills found in the active profile.":[`Profile skills (${t.length}):`,...t.map(s=>{let p=s.validationStatus==="valid"?"valid":`invalid: ${s.validationMessages.join("; ")}`;return`- ${s.name} (${p}) ${s.path}`})].join(`
4
- `),skills:t,profile:e}}n(ir,"listProfileSkills");import{randomUUID as lr}from"node:crypto";function yt(e){return async function*({messages:t,signal:r}){for await(let s of e({model:Ie,messages:t,requestId:`harness-continuous-review:${lr()}`,reasoningEffort:"medium",maxTokens:be,signal:r}))s.type==="text_delta"&&s.text?yield{text:s.text}:s.type==="usage"&&(yield{usage:{promptTokens:s.usage.prompt_tokens??0,completionTokens:s.usage.completion_tokens??0,totalTokens:s.usage.total_tokens??0}})}}n(yt,"createLocalHarnessEvaluationReviewModelStream");import{promises as Ct}from"node:fs";import N from"node:path";import{createHash as ur}from"node:crypto";import{access as cr,readFile as Pt}from"node:fs/promises";import x from"node:path";import{fileURLToPath as dr}from"node:url";var Tt=["openpond-cli","openpond-skill-authoring","openpond-agent-authoring","openpond-refiner-authoring"],Rt={"openpond-cli":["references/experiments-and-training.md","references/compact-resource-tables.md","references/diagnose-and-improve.md"],"openpond-skill-authoring":["references/skill-package-layout.md","references/copying-and-adaptation.md","references/validation-and-repair.md"],"openpond-agent-authoring":["references/profile-layout.md","references/action-and-chat-design.md","references/integrations-and-setup.md","references/validation-and-repair.md"],"openpond-refiner-authoring":["references/review-profile.md","references/core-boundary.md","references/validation-and-activation.md"]},Et=x.dirname(dr(import.meta.url));function At(e){return Tt.includes(e)}n(At,"isBundledAuthoringSkillName");async function xt(e=process.cwd()){return Promise.all(Tt.map(t=>ee(t,e)))}n(xt,"loadBundledAuthoringSkills");async function ee(e,t=process.cwd()){let r=await _t(e,t),s=await It(e,t),p=Ne.find(h=>h.name===e);if(!p)throw new Error(`Built-in OpenPond authoring skill metadata not found: ${e}`);return{...p,path:x.join(r,"SKILL.md"),sourcePath:r,charCount:s.length,sourceHash:ur("sha256").update(s).digest("hex"),validationMessages:[...p.validationMessages],resourceFiles:[...p.resourceFiles]}}n(ee,"loadBundledAuthoringProfileSkill");async function bt(e,t=process.cwd()){let r=await ee(e,t),s=await It(e,t);return{name:r.name,description:r.description,body:s,path:r.path,sourceHash:r.sourceHash,charCount:r.charCount,packagePath:r.sourcePath,resourceFiles:r.resourceFiles}}n(bt,"readBundledAuthoringProfileSkill");async function It(e,t=process.cwd()){let r=await _t(e,t),[s,...p]=await Promise.all([Pt(x.join(r,"SKILL.md"),"utf8"),...Rt[e].map(h=>Pt(x.join(r,h),"utf8"))]);return[s.trim(),...p.map((h,w)=>`
4
+ `),skills:t,profile:e}}n(ir,"listProfileSkills");import{randomUUID as lr}from"node:crypto";function yt(e){return async function*({messages:t,signal:r}){for await(let s of e({model:be,messages:t,requestId:`harness-continuous-review:${lr()}`,reasoningEffort:"medium",maxTokens:Le,signal:r}))s.type==="text_delta"&&s.text?yield{text:s.text}:s.type==="usage"&&(yield{usage:{promptTokens:s.usage.prompt_tokens??0,completionTokens:s.usage.completion_tokens??0,totalTokens:s.usage.total_tokens??0}})}}n(yt,"createLocalHarnessEvaluationReviewModelStream");import{promises as Ct}from"node:fs";import N from"node:path";import{createHash as ur}from"node:crypto";import{access as cr,readFile as Pt}from"node:fs/promises";import x from"node:path";import{fileURLToPath as dr}from"node:url";var Tt=["openpond-cli","openpond-skill-authoring","openpond-agent-authoring","openpond-refiner-authoring"],Rt={"openpond-cli":["references/experiments-and-training.md","references/compact-resource-tables.md","references/diagnose-and-improve.md"],"openpond-skill-authoring":["references/skill-package-layout.md","references/copying-and-adaptation.md","references/validation-and-repair.md"],"openpond-agent-authoring":["references/profile-layout.md","references/action-and-chat-design.md","references/integrations-and-setup.md","references/validation-and-repair.md"],"openpond-refiner-authoring":["references/review-profile.md","references/core-boundary.md","references/validation-and-activation.md"]},Et=x.dirname(dr(import.meta.url));function At(e){return Tt.includes(e)}n(At,"isBundledAuthoringSkillName");async function xt(e=process.cwd()){return Promise.all(Tt.map(t=>ee(t,e)))}n(xt,"loadBundledAuthoringSkills");async function ee(e,t=process.cwd()){let r=await _t(e,t),s=await It(e,t),p=Ne.find(h=>h.name===e);if(!p)throw new Error(`Built-in OpenPond authoring skill metadata not found: ${e}`);return{...p,path:x.join(r,"SKILL.md"),sourcePath:r,charCount:s.length,sourceHash:ur("sha256").update(s).digest("hex"),validationMessages:[...p.validationMessages],resourceFiles:[...p.resourceFiles]}}n(ee,"loadBundledAuthoringProfileSkill");async function bt(e,t=process.cwd()){let r=await ee(e,t),s=await It(e,t);return{name:r.name,description:r.description,body:s,path:r.path,sourceHash:r.sourceHash,charCount:r.charCount,packagePath:r.sourcePath,resourceFiles:r.resourceFiles}}n(bt,"readBundledAuthoringProfileSkill");async function It(e,t=process.cwd()){let r=await _t(e,t),[s,...p]=await Promise.all([Pt(x.join(r,"SKILL.md"),"utf8"),...Rt[e].map(h=>Pt(x.join(r,h),"utf8"))]);return[s.trim(),...p.map((h,w)=>`
5
5
  ## Bundled reference: ${Rt[e][w]}
6
6
 
7
7
  ${h.trim()}`)].join(`
8
- `)}n(It,"loadBundledAuthoringSkillBundle");async function _t(e,t=process.cwd(),r=process.execPath){let s=[x.resolve(t,"apps","cli","skills",e),x.resolve(t,"dist","skills",e),x.resolve(x.dirname(r),"skills",e),x.resolve(Et,"skills",e),x.resolve(Et,"..","skills",e)];for(let p of s)if(await cr(x.join(p,"SKILL.md")).then(()=>!0,()=>!1))return p;throw new Error(`Bundled OpenPond authoring skill ${e} was not found. Checked: ${s.join(", ")}`)}n(_t,"resolveBundledAuthoringSkillRoot");var Ht=24e3;function Wt(e){return[{name:"refiner_profile_inspect",description:"Inspect the separately versioned active Refiner Review Profile, its immutable release identity, and recent transitions. Use before editing Refiner behavior.",parameters:{type:"object",additionalProperties:!1,properties:{}},execute:n(async t=>I(t.callId,"refiner_profile_inspect",await(await import("./refiner-profile-service-ATEFPF5O.js")).inspectRefinerProfile(e.storeDir)),"execute")},{name:"refiner_profile_update",description:"Validate and write a complete JSON Refiner Review Profile as a new immutable Refiner release. Activation is explicit; normal Harness refinement never calls this tool.",parameters:{type:"object",additionalProperties:!1,properties:{profile:{type:"object",additionalProperties:!1,properties:{schemaVersion:{type:"string",const:"openpond.refinerReviewProfile.v1"},id:{type:"string",minLength:1,maxLength:120},version:{type:"string",minLength:1,maxLength:120},name:{type:"string",minLength:1,maxLength:200},objective:{type:"string",minLength:1,maxLength:1e4},instructions:{type:"array",maxItems:100,items:{type:"object",additionalProperties:!1,properties:{id:{type:"string",minLength:1,maxLength:120},text:{type:"string",minLength:1,maxLength:1e4}},required:["id","text"]}},allowedProposalRoutes:{type:"array",items:{type:"string",enum:["memory","prompt","skill","agent"]},maxItems:4},allowedExternalRoutes:{type:"array",items:{type:"string",enum:["runtime","product","taskset","training"]},maxItems:4}},required:["schemaVersion","id","version","name","objective","instructions","allowedProposalRoutes","allowedExternalRoutes"]},activate:{type:"boolean"},reason:{type:"string",minLength:1,maxLength:1e4}},required:["profile","activate","reason"]},execute:n(async t=>{let r=await ee("openpond-refiner-authoring");return I(t.callId,"refiner_profile_update",await(await import("./refiner-profile-service-ATEFPF5O.js")).updateRefinerProfile(e.storeDir,{profile:t.args.profile,activate:t.args.activate,reason:te(t.args.reason,1e4),actor:`work:${t.session.id}`,authoringSkillHash:r.sourceHash}))},"execute")},{name:"memory_search",description:"Search bounded active Personal Harness memory without loading the full memory corpus into context. Returns ranked stable memory keys and excerpts.",parameters:{type:"object",additionalProperties:!1,properties:{query:{type:"string",minLength:1,maxLength:500},limit:{type:"integer",minimum:1,maximum:20}},required:["query"]},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=te(t.args.query,500).toLowerCase(),p=[...new Set(s.split(/[^a-z0-9]+/).filter(l=>l.length>1))],h=typeof t.args.limit=="number"?Math.max(1,Math.min(20,Math.trunc(t.args.limit))):8,v=(await e.store.listHarnessMemories(r.workspace.id)).map(l=>{let d=`${l.key} ${l.tags.join(" ")} ${l.content}`.toLowerCase(),f=p.reduce((a,u)=>a+(d.includes(u)?1:0),0);return{entry:l,score:f}}).filter(({score:l})=>p.length===0||l>0).sort((l,d)=>d.score-l.score||d.entry.updatedAt.localeCompare(l.entry.updatedAt)).slice(0,h).map(({entry:l,score:d})=>({key:l.key,revision:l.revision,score:d,excerpt:l.content.slice(0,1e3),tags:l.tags,updatedAt:l.updatedAt}));return I(t.callId,"memory_search",{query:s,matches:v})},"execute")},{name:"memory_inspect",description:"Read one exact active Personal Harness memory entry returned by memory_search.",parameters:{type:"object",additionalProperties:!1,properties:{key:{type:"string",minLength:1,maxLength:120}},required:["key"]},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=te(t.args.key,120).toLowerCase(),p=await e.store.getHarnessMemory(r.workspace.id,s);if(!p||p.status!=="active")throw new Error(`Harness memory does not exist: ${s}.`);return I(t.callId,"memory_inspect",p)},"execute")},{name:"context_read",description:"Read a bounded slice of the current Agent run's canonical host-owned turns or runtime events. This never exposes other conversations or the whole history corpus.",parameters:{type:"object",additionalProperties:!1,properties:{scope:{type:"string",enum:["turns","events"]},limit:{type:"integer",minimum:1,maximum:50}},required:["scope"]},execute:n(async t=>{let r=typeof t.args.limit=="number"?Math.max(1,Math.min(50,Math.trunc(t.args.limit))):12;if(t.args.scope==="turns"){let s=await e.store.turnsForSession(t.session.id,r);return I(t.callId,"context_read",{scope:"turns",values:s.map(p=>Ot(p,6e3))})}if(t.args.scope==="events"){let s=await e.store.runtimeEventsForSession(t.session.id,{limit:r});return I(t.callId,"context_read",{scope:"events",values:s.map(p=>Ot(p,6e3))})}throw new Error("context_read scope must be turns or events.")},"execute")},{name:"harness_inspect",description:"Inspect the immutable Harness release pinned to this Agent run. With no path, returns its release, overlay, and component catalog. With a policy-visible text path, returns bounded exact source content.",parameters:{type:"object",additionalProperties:!1,properties:{path:{type:"string",minLength:1,description:"Optional exact Harness-relative source path from the returned catalog."}}},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness release is selected for this run.");let s=await e.store.getHarnessRunOverlay(t.session.id),p=N.join(r.release.bundlePath,"source"),h=je.parse(JSON.parse(await Ct.readFile(N.join(p,"harness.json"),"utf8"))),w=typeof t.args.path=="string"?t.args.path.trim().replaceAll("\\","/"):null,v=null;if(w){let l=h.files.find(f=>f.path===w);if(!l||l.visibility!=="policy")throw new Error(`Harness source is not policy-visible or declared: ${w}`);if(!l.mediaType.startsWith("text/")&&l.mediaType!=="application/json")throw new Error(`Harness source is not inspectable text: ${w}`);let d=await Ct.readFile(pr(p,w),"utf8");v={path:w,content:d.slice(0,Ht),truncated:d.length>Ht}}return I(t.callId,"harness_inspect",{workspace:{id:r.workspace.id,name:r.workspace.name,revision:r.workspace.revision,channel:r.workspace.currentChannel},pinnedRelease:{id:r.release.harnessRelease.id,contentHash:r.release.harnessRelease.contentHash,sourceRevision:r.release.sourceRevision},overlay:s?{id:s.id,revision:s.revision,status:s.status,contentHash:s.contentHash}:null,components:h.files.filter(l=>l.visibility==="policy").map(l=>({kind:l.kind,path:l.path,portability:l.portability})),source:v})},"execute")},{name:"skill_inspect",description:"Read one exact textual Skill from the immutable Harness release pinned to this run. Use this before asking the Refiner to update an existing Skill.",parameters:{type:"object",additionalProperties:!1,properties:{name:{type:"string",minLength:1,description:"Exact Skill name from harness_inspect."}},required:["name"]},execute:n(async t=>{let r=await M(e.store,t.session.id),s=typeof t.args.name=="string"?t.args.name.trim():"";if(!r?.skillRuntime.readSkill||!s)throw new Error("A valid Skill name and a selected Local Harness are required.");return I(t.callId,"skill_inspect",await r.skillRuntime.readSkill(s))},"execute")},{name:"refine_request",description:"Mark a concrete reusable lesson from the current turn for bounded Harness refinement at the next safe tool boundary. Immediate task recovery remains your responsibility. Do not call for one-off errors or transient facts.",parameters:{type:"object",additionalProperties:!1,properties:{summary:{type:"string",minLength:1,maxLength:2e3},suggestedRoute:{type:"string",enum:["runtime","memory","prompt","skill","agent","product","taskset","training"]}},required:["summary"]},execute:n(async t=>I(t.callId,"refine_request",{queuedAtBoundary:!0,summary:te(t.args.summary,2e3),suggestedRoute:typeof t.args.suggestedRoute=="string"?t.args.suggestedRoute:null}),"execute")},{name:"refine_status",description:"Inspect bounded Refiner trigger, proposal, route, validation, and outcome status for this Agent run.",parameters:{type:"object",additionalProperties:!1,properties:{}},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=n(async i=>e.store.listHarnessImprovementArtifacts(r.workspace.id,i,200),"all"),p=(await s("trigger_decision")).filter(i=>i.schemaVersion==="openpond.refinementTriggerDecision.v1").filter(i=>i.runRef===t.session.id),h=new Set(p.map(i=>U(i))),w=n(i=>h.has(U(fe(i.trigger))),"relatedToTrigger"),v=(await s("route_decision")).filter(i=>i.schemaVersion==="openpond.improvementRouteDecision.v1").filter(w),l=(await s("refiner_outcome")).filter(i=>i.schemaVersion==="openpond.harnessRefinerOutcome.v1").filter(w),d=new Set(l.flatMap(i=>{let c=fe(i.proposal);return c.id&&c.contentHash?[U(c)]:[]})),f=(await s("proposal")).filter(i=>i.schemaVersion==="openpond.harnessImprovementProposal.v1").filter(i=>d.has(U(i))),a=n(i=>d.has(U(fe(i.proposal))),"relatedToProposal"),u=[{kind:"trigger_decision",values:p},{kind:"route_decision",values:v},{kind:"proposal",values:f},{kind:"targeted_validation",values:(await s("targeted_validation")).filter(a)},{kind:"apply_receipt",values:(await s("apply_receipt")).filter(a)},{kind:"refiner_outcome",values:l}];return I(t.callId,"refine_status",{runId:t.session.id,artifacts:u})},"execute")}]}n(Wt,"createLocalHarnessModelToolDefinitions");function U(e){return`${String(e.id??"")}:${String(e.contentHash??"")}`}n(U,"artifactRefKey");function fe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}n(fe,"asRecord");function I(e,t,r){return{toolCallId:e,name:t,ok:!0,contentText:JSON.stringify(r),data:r}}n(I,"modelResult");function te(e,t){if(typeof e!="string"||!e.trim())throw new Error("A non-empty refinement summary is required.");return e.trim().slice(0,t)}n(te,"boundedText");function Ot(e,t){let r=JSON.stringify(e);return r.length<=t?e:{truncated:!0,json:r.slice(0,t)}}n(Ot,"boundedJson");function pr(e,t){let r=N.resolve(e),s=N.resolve(r,...t.split("/")),p=N.relative(r,s);if(!p||p.startsWith("..")||N.isAbsolute(p))throw new Error(`Harness source path escapes its release: ${t}`);return s}n(pr,"containedSourcePath");function Lt(){return{loadOpenPondProfileStateForRef:ie,executeProfileSkillCommand:n(({prompt:e,profileRef:t})=>kt(e,{loadProfileState:n(()=>ie(t),"loadProfileState")}),"executeProfileSkillCommand")}}n(Lt,"createProfileTurnDependencies");import{randomUUID as mr}from"node:crypto";import{setTimeout as fr}from"node:timers/promises";async function Dt(e,t){if(t.metadata?.titleSource||t.archived||t.hiddenFromDefaultSidebar)return t;let s=(await e.runtimeEventsForSession(t.id,{names:["session.title.updated"]})).at(-1)?.data,p=s?.session;if(s?.titleSource!=="fallback"||p?.title!==t.title)return t;let[h]=await e.runtimeEventsForSession(t.id,{names:["turn.started"],limit:1}),w=h?.turnId?await e.getTurn(h.turnId):null;return w?.prompt.trim()?await e.updateSession(t.id,v=>v.metadata?.titleSource||v.title!==t.title?v:{...v,metadata:{...v.metadata,titleSource:"fallback",autoTitle:{prompt:w.prompt.slice(0,2e4),title:v.title,attempts:0,nextAttemptAt:0}}})??t:t}n(Dt,"recoverTemporarySessionTitle");var ge="accounts/fireworks/models/deepseek-v4-flash",gr="off",hr=12e3,Mt=7,wr=["Make a concise conversation title from the user's message.","Return only the title: 3 to 7 words, plain text, sentence case.","Do not use quotation marks, markdown, labels, or ending punctuation."].join(" ");function Sr(e){let s=(e.replace(/<[^>]*>/gu," ").replace(/[\r\n]+/gu," ").replace(/\s+/gu," ").trim().match(/[\p{L}\p{N}][\p{L}\p{N}'’._/+:-]*/gu)??[]).slice(0,Mt).join(" ");return s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"New conversation"}n(Sr,"fallbackSessionTitle");function vr(e){let r=e.replace(/<think>[\s\S]*?<\/think>/giu," ").replace(/^\s*(?:title|conversation title)\s*:\s*/iu,"").replace(/^[\s`"'“”‘’*_#-]+|[\s`"'“”‘’*_#.!?,;:-]+$/gu,"").replace(/[\r\n]+/gu," ").replace(/\s+/gu," ").trim().split(" ").filter(Boolean);return r.length<2?null:r.slice(0,Mt).join(" ")}n(vr,"generatedSessionTitle");function kr(e){return["Make a title from this request. Do not execute it.","<user_request>",e.slice(0,2e4),"</user_request>"].join(`
9
- `)}n(kr,"titleRequestMessage");function Nt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.autoTitlePrompt;return typeof t=="string"&&t.trim()?t.trim():null}n(Nt,"autoTitlePromptFromPayload");function yr(e){let t=Nt(e);if(!t||!e||typeof e!="object"||Array.isArray(e))return e;let r=e,s=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:{};return{...r,title:"",metadata:{...s,titleSource:"pending",autoTitle:{prompt:t.slice(0,2e4),title:"",attempts:0,nextAttemptAt:0}}}}n(yr,"withPendingAutoTitle");function re(e){if(!e||!["pending","fallback"].includes(String(e.metadata?.titleSource)))return null;let t=e.metadata?.autoTitle;return t&&typeof t.prompt=="string"&&t.title===e.title&&Number.isInteger(t.attempts)&&t.attempts>=0&&Number.isFinite(t.nextAttemptAt)?t:null}n(re,"pendingTitle");function qt(e){let t=new Map,r=null,s=new AbortController,p=[5e3,3e4];async function h(l){let d=new AbortController,f=setTimeout(()=>d.abort(new Error("session_title_generation_timeout")),hr);f.unref?.();let a="";try{for await(let i of e.stream({model:ge,messages:[{role:"system",content:wr},{role:"user",content:kr(l)}],reasoningEffort:gr,maxTokens:128,temperature:.2,requestId:`session-title-${mr()}`,signal:AbortSignal.any([d.signal,s.signal])}))i.type==="text_delta"&&i.text&&(a+=i.text);let u=vr(a);if(!u)throw new Error("session_title_generation_empty_response");return u}finally{clearTimeout(f)}}n(h,"generate");async function w(l){for(;!s.signal.aborted;){let d=re(await e.store.getSession(l));if(!d||d.attempts>=3)return;let f=d.nextAttemptAt-Date.now();f>0&&await fr(f,void 0,{signal:s.signal,ref:!1});let a=re(await e.store.getSession(l));if(!a||a.attempts!==d.attempts)return;let u,i="model";try{u=await h(d.prompt)}catch(k){if(s.signal.aborted)return;u=Sr(d.prompt),i="fallback",e.logger.warn("session title generation used temporary title",{error:k instanceof Error?k.message:String(k),model:ge,sessionId:l,attempt:d.attempts+1})}if(s.signal.aborted)return;let c=!1,g=await e.store.updateSession(l,k=>{let y=re(k);return!y||y.attempts!==d.attempts||y.prompt!==d.prompt?k:(c=!0,{...k,title:u,metadata:{...k.metadata,titleSource:i,autoTitle:i==="model"?null:{...d,title:u,attempts:d.attempts+1,nextAttemptAt:Date.now()+(p[d.attempts]??0)}}})});if(!c||!g||(await e.appendRuntimeEvent(X({sessionId:l,name:"session.title.updated",source:"server",status:"completed",data:{session:g,model:ge,titleSource:i}})),i==="model"))return}}n(w,"run");function v(l){if(s.signal.aborted)return Promise.resolve();let d=t.get(l);if(d)return d;let f=w(l).catch(a=>{s.signal.aborted||e.logger.warn("session title generation failed",{error:a instanceof Error?a.message:String(a),sessionId:l})}).finally(()=>t.delete(l));return t.set(l,f),f}return n(v,"schedule"),{wrapCreateSession(l){return this.recover().catch(d=>e.logger.warn("Session title recovery failed",{error:String(d)})),async d=>{let f=await l(yr(d));return Nt(d)&&v(f.id),f}},schedule:v,recover(){return r||(r=(async()=>{for(let l of await e.store.sessionShells()){if(s.signal.aborted)return;let d=await Dt(e.store,l);re(d)&&v(l.id)}})().finally(()=>{r=null}),r)},async close(){s.abort(),await r?.catch(()=>{}),await Promise.allSettled(t.values())}}}n(qt,"createSessionTitleService");var Er=3,Tr=["sqlite_store","runtime_event_bus","session_store","hosted_provider","web_search","connected_apps","workspace_tools","command_approvals","harness","refiner","agent_runtime","jsonl_transport"];async function gn(e={}){if(e.runtimeStorage)return(await import("./hosted-app-server-composition-Y64A2A2B.js")).createHostedOwnedAppServer({...e,runtimeStorage:e.runtimeStorage});let t=q.resolve(e.storeDir??de());return Fe(t,()=>Ar({...e,storeDir:t}))}n(gn,"createOpenPondAppServer");async function Ar(e){let t=q.resolve(e.storeDir??de()),r=!!e.embedding;if(r&&!e.streamOpenPondHostedChatTurn)throw new Error("Embedded Work requires an explicit model-stream adapter.");let s=e.services??{},p=await $(s.webSearch,r,async()=>(await import("./web-search-56QRZGPR.js")).createWebSearchExecutorFromEnv()),h=await $(s.scheduling,r,async()=>(await import("./saved-work-3OAVRBH3.js")).createHostedSavedWork),w=await $(s.connectedApps,r,async()=>{let[o,m]=await Promise.all([import("./connected-app-executor-DFHWNMRM.js"),import("./app-server-connected-apps-IB6M35NS.js")]);return{execute:o.createCloudConnectedAppToolExecutor(),list:m.listAppServerIntegrationConnections}}),v=await $(s.tasksets,r,async()=>(await import("./hosted-tasksets-7VMYOTIO.js")).executeHostedTasksetAction),l=s.backgroundReview??!r,d=!r&&!!v;await Ce(t),l&&await(await import("./refiner-profile-service-ATEFPF5O.js")).initializeRefinerProfile(t);let f=q.resolve(e.workspaceDir??process.cwd());await Rr(f,{recursive:!0});let a=e.version??De,u=Ue(),i=Ve({channel:"app-server",logDir:q.join(t,"logs"),metadata:{version:a,runtimeVersion:u,placement:"hosted_work"}});D(()=>i.flush());let c=new pt(t,{logger:i});D(()=>c.close()),await c.recentTurns(1);let g=c,k=n(async()=>(await He(t)).preferences,"loadRuntimePreferences"),y=vt(t);(y.recovered||y.needsReview)&&i.warn("Scheduled work requires review after restart",y);let S=nt(e.streamOpenPondHostedChatTurn??Be,{enabled:ot()}),b=yt(S),{appendRuntimeEvent:P,closeEventSubscribers:jt,subscribeRuntimeEvents:Ft}=it({logger:i,store:g}),he=Y({queueId:"turn-follow-up",logger:i}),we=Y({queueId:"harness-refiner",logger:i}),Se=Y({queueId:"subagent",logger:i});if(e.harness&&e.profileSource)throw new Error("Configure either an explicit Harness source or Profile source for this app-server.");let A=null,z,oe;if(e.experimentHarnessSource){if(!e.experimentPolicyClient||e.profileSource||e.harness||e.runtimeStorage)throw new Error("A published standalone Experiment source requires its isolated policy owner and local case store.");let o=e.experimentHarnessSource.sourcePackage;z=await(await import("./published-experiment-source-YBBPLNF2.js")).installPublishedExperimentSource({store:c,storeDir:t,ownerId:e.experimentHarnessSource.ownerId,sourcePackage:o,reference:{harnessRelease:{id:o.harnessRelease.id,contentHash:o.harnessRelease.contentHash},agentSnapshot:{id:o.agentSnapshot.id,contentHash:o.agentSnapshot.contentHash},sourcePackageHash:o.contentHash},createdAt:T()})}if(e.profileSource){let o=e.profileSource;if(!o.repositoryId.trim()||!o.profileId.trim()||!o.sourceRevision.trim())throw new Error("Explicit Profile source requires an identity and accepted revision.");let m=await Le({repoPath:o.repoPath,profileId:o.profileId});if(m.mode!=="local"||!m.sourcePath||m.error||m.git?.isRepo&&(m.git.head!==o.sourceRevision||m.git.dirty))throw new Error("Explicit Profile source does not match its accepted revision.");A=await Je({store:c,storeDir:t,workspaceId:`${Xe}${H({profileId:o.profileId,sourceRevision:o.sourceRevision}).slice(0,24)}`,ownerId:"desktop-personal",name:o.profileId,profile:m,sourceRevision:o.sourceRevision,repositoryId:o.repositoryId})}e.harness&&(await Ke({store:c,storeDir:t,sourceDir:e.harness.sourceDirectory,id:e.harness.workspaceId,name:e.harness.name,ownerId:"desktop-personal"}),await c.selectHarnessWorkspace({ownerKind:"personal",ownerId:"desktop-personal",workspaceId:e.harness.workspaceId,updatedAt:T()})),await Ge({store:c,storeDir:t,loadProfileState:L,now:T}).catch(o=>{i.warn("app-server Harness initialization failed",{error:o})});let V=rt({appendRuntimeEvent:P,findLocalProject:n(o=>lt(c,o),"findLocalProject"),onRepositoryInstructionDiagnostic:n((o,m)=>{i.warn("repository instruction file skipped",{diagnostic:o,sessionId:m.id})},"onRepositoryInstructionDiagnostic")}),{createSession:j,getSession:C,updateSession:K,completeTurn:Bt,failTurn:Ut,interruptTurn:$t}=dt({store:g,defaultSessionCwd:n(()=>f,"defaultSessionCwd"),appendRuntimeEvent:P,loadAppPreferences:k,loadLastUsedProfile:n(async()=>(await B()).lastUsed,"loadLastUsedProfile")}),ve=qt({appendRuntimeEvent:P,store:g,logger:i,stream:S}),ke=r?j:ve.wrapCreateSession(j),J=at({workspaceDir:f,logger:i,getSession:C,updateSession:K,appendRuntimeEvent:P,sandboxRequest:e.sandboxRequest??(r?async()=>{throw new Error("Sandbox execution is not configured in this app-server deployment.")}:void 0)}),zt=d?await(await import("./local-harness-taskset-review-6KJN3EQL.js")).createLocalHarnessTasksetReviewControl({store:c,storeDir:t,evaluationRuntime:{streamOpenPondHostedChatTurn:S,workRuntime:{createSession:j,getSession:C,executeWorkspaceTool:J.executeWorkspaceTool,runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession")},resolveReleasedHarness:n(async()=>{let o=await Qe(c);return o?{agentSnapshot:o.release.agentSnapshot,harnessRelease:o.release.harnessRelease,instructionContext:o.instructionContext}:null},"resolveReleasedHarness")}}):void 0,ye=n(async o=>{await g.upsertApproval(o)},"upsertApproval"),Pe=et({upsertApproval:ye,appendRuntimeEvent:P}),Vt=await $(s.projectActions,r,async()=>(await import("./project-action-payload-7DRABTHY.js")).createProjectActionRunPayload({appendRuntimeEvent:P,resolveProjectRoot:n(async()=>null,"resolveProjectRoot")})),Kt=n(async o=>{try{await g.upsertModelUsageRecord(o)}catch(m){await P(br(o,m)).catch(()=>{})}},"safeUpsertModelUsageRecord"),Re=l?(await import("./local-harness-improvement-runtime-UIKQSAMM.js")).createLocalHarnessImprovementRuntime({store:c,storeDir:t,queue:we,streamOpenPondHostedChatTurn:S,appendRuntimeEvent:P,upsertModelUsageRecord:Kt}):void 0;await Re?.reconcilePending();let ne=e.profileExternalDataset?await(A&&e.profileExternalDatasetClient?(await import("./host-profile-external-dataset-4HOXANWK.js")).createHostProfileExternalDataset({value:e.profileExternalDataset,release:A,sourceRevision:e.profileSource.sourceRevision,client:e.profileExternalDatasetClient}):Promise.reject(new Error("External Dataset execution requires an explicit private Profile source owner."))):null,Jt=$e({deviceId:`evaluation-${H(t).slice(0,24)}`,storeDir:t,runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession")}),_=A?(await import("./host-profile-evaluation-tools-LMCJ3MDJ.js")).createHostProfileEvaluationTools({storeDir:t,release:A,getTurn:n(o=>g.getTurn(o),"getTurn"),getSession:C,saveOutput:Jt.saveOwnedOutputBytes,recordOutput:n(async(o,m,E)=>{await P({id:Pr(),timestamp:new Date().toISOString(),name:"workspace_action_result",source:"server",sessionId:o,turnId:m,action:"work_output_save",status:"completed",output:`Saved ${E.outputRef.title} as immutable case output.`,data:E})},"recordOutput"),authorize:n(async o=>{if(ne){await ne.authorize(o);return}let m=await Te();if(!m||m.ref.profileId!==e.profileSource?.profileId||m.sourceRevision!==e.profileSource?.sourceRevision)throw new Error("The released evaluation source authority changed.");let E=await c.getHarnessReleaseRecord(A.harnessRelease.contentHash);if(!E||E.harnessRelease.contentHash!==A.harnessRelease.contentHash)throw new Error("The isolated evaluation release is unavailable.")},"authorize")}):null,G=e.embedding?gt(e.embedding,async(o,m)=>{let E=await g.getTurn(o);if(!E)throw new Error("Embedded turn is unavailable.");let O=await C(E.sessionId),F=O.metadata?.embeddingToolBindings,W=[...m].sort((Q,Zt)=>Q.name.localeCompare(Zt.name));if(F!==void 0&&H(F)!==H(W))throw new Error("Embedded tool bindings changed; start a new thread.");await K(O.id,{metadata:{...O.metadata,embeddingToolBindings:W}}),await g.updateTurn(o,Q=>({...Q,metadata:{...Q.metadata,toolBindings:W}}))}):void 0,R=ut({executionHost:r?"embedded":"local",storageHome:t,workInputsForSession:e.workInputsForSession,finalizeWorkTurn:e.finalizeWorkTurn,isolatedProfileEvaluationForTurn:_?async o=>{if(o.metadata?.profileEvaluationRun===void 0)return!1;if(!_.ownsSession(o.id))throw new Error("A Profile evaluation target has no actual admitted case owner.");return!0}:void 0,executeProfileEvaluationAction:_?.executeAction,resolveModelTools:e.resolveModelTools||_||G?async o=>{let m=_?_.ownsSession(o.session.id)?await _.resolveTools(o):await G?.(o)??[]:G?await G(o):o.tools;return e.resolveModelTools?e.resolveModelTools({...o,tools:m}):m}:void 0,...r?{hostedToolFlags:{toolMode:"native",nativeToolTransport:!0,nativeToolProviderDenylist:[],textToolFallback:!1}}:{},attachmentRootDir:q.join(t,"attachments"),store:g,inboxStore:c,createSession:j,upsertApproval:ye,getSession:C,updateSession:K,completeTurn:Bt,failTurn:Ut,interruptTurn:$t,defaultSessionCwd:n(()=>f,"defaultSessionCwd"),findOpenPondApp:n(async o=>xr(o,f),"findOpenPondApp"),resolveSessionWorkspaceCwd:n(async o=>o.cwd?.trim()||f,"resolveSessionWorkspaceCwd"),ensureCodexRuntime:n(async()=>{throw new Error("The hosted app-server placement uses the OpenPond provider; Codex process hosting is not configured.")},"ensureCodexRuntime"),appendWorkspaceDiffEvent:J.appendWorkspaceDiffEvent,workspaceDiffBaseline:J.workspaceDiffBaseline,appendRuntimeEvent:P,processHarnessImprovementBoundary:Re,executeWorkspaceTool:J.executeWorkspaceTool,executeOpenPondCommand:Pe.executeCommand,executeProjectAction:Vt,executeDatasetBuilderAction:v,loadOpenPondProfileState:L,...Lt(),...r||s.profileActions===!1?{executeProfileSkillCommand:void 0}:{},loadOpenPondProfileLibrary:B,readOpenPondProfileSkill:We,loadSelectedHarnessRuntime:n(o=>ce(c,o),"loadSelectedHarnessRuntime"),ensureHarnessRunOverlay:n(o=>ue({store:c,...o}),"ensureHarnessRunOverlay"),harnessModelTools:Wt({store:c,storeDir:t}).filter(o=>l||!["refiner_profile_inspect","refiner_profile_update","refine_request","refine_status"].includes(o.name)),loadBuiltInOpenPondSkills:n(async()=>[await mt(),...await xt()],"loadBuiltInOpenPondSkills"),readBuiltInOpenPondSkill:n(async o=>{if(o==="openpond-taskset-authoring")return ft();if(At(o))return bt(o);throw new Error(`Built-in OpenPond skill not found: ${o}`)},"readBuiltInOpenPondSkill"),executeWebSearch:p,createScheduledWork:h,executeConnectedAppTool:w?.execute,listIntegrationConnections:w?.list,loadPersonalizationSoul:n(async()=>(await tt(c,t)).soul,"loadPersonalizationSoul"),loadAppPreferences:k,maybeCreateScaffoldForTurn:V.maybeCreateScaffoldForTurn,hostedSystemPrompt:V.hostedSystemPrompt,appendAssistantText:V.appendAssistantText,appendHostedContextUsage:V.appendHostedContextUsage,streamOpenPondHostedChatTurn:S,turnFollowUpQueue:he,resolveSessionModelStream:ht(async(o,m)=>await oe?.resolveSessionModelStream(o,m)??await e.resolveSessionModelStream?.(o,m)??null),subagentQueue:Se,maxHostedWorkspaceToolRounds:e.experimentHarnessSource?(await import("./experiments-VOCZ4DW3.js")).STANDALONE_EXPERIMENT_MAX_POLICY_CALLS:ct(e.maxHostedWorkspaceToolRounds),maxRepeatedInvalidToolRequests:Er});D(()=>R.close()),await R.recoverPendingSubagentCompletions(),await R.recoverTaskInbox();async function Gt(o,m){let E=await R.resolveNativeAgentApproval(o,m);if(E)return E;let O=await Pe.resolveApproval(o,m);if(O)return O;let F=await R.resolveCreateImproveApproval(o,m);if(F)return F;let W=await R.resolveSubagentPatchApplyApproval(o,m);if(W)return W;throw new Error(`Approval not found: ${o}`)}n(Gt,"resolveApproval");let Ee=!1,Te=n(async()=>{if(e.profileSource)return{ref:{source:"openpond_git",repositoryId:e.profileSource.repositoryId,profileId:e.profileSource.profileId},sourceRevision:e.profileSource.sourceRevision};let[o,m]=await Promise.all([B(),L()]);return o.lastUsed&&m.git?.head&&!m.git.dirty?{ref:o.lastUsed,sourceRevision:m.git.head}:null},"selectedEvaluationProfile"),Ae=n(async()=>{if(e.profileSource&&A)return Ze({store:c,release:A,ref:{source:"openpond_git",repositoryId:e.profileSource.repositoryId,profileId:e.profileSource.profileId},sourceRevision:e.profileSource.sourceRevision});let[o,m]=await Promise.all([B(),L()]);if(!o.lastUsed)throw new Error("Select a Profile before loading its workflows.");return Ye({store:c,storeDir:t,ref:o.lastUsed,profile:m,reloadProfile:L})},"listProfileWorkflows");if(z){let o=z;oe=(await import("./standalone-experiment-turn-owner-CDRMGLWW.js")).createStandaloneExperimentTurnOwner({store:c,createSession:j,sendTurn:R.sendTurn,interruptSessionTurn:R.interruptSessionTurn,authorizeWorkspace:n(async(m,E)=>{if(E.id!==o.workspace.id||H(E.ownerScope)!==H(o.workspace.ownerScope)||m.sourcePackageHash!==o.workspace.metadata.experimentSourcePackageHash||m.harnessRelease.id!==o.release.harnessRelease.id||m.harnessRelease.contentHash!==o.release.harnessRelease.contentHash)throw new Error("Standalone Experiment source differs from this execution owner's admitted closure.")},"authorizeWorkspace")})}let se=le(async()=>{let{createAppServerEvaluations:o}=await import("./app-server-evaluations-5YZUFXQ2.js");return o({options:e,store:c,storeDir:t,explicitProfileRelease:A,externalDataset:ne,isolatedProfileTools:_,selectedEvaluationProfile:Te,listProfileWorkflows:Ae,createSessionWithAutoTitle:ke,turnRunner:R,streamOpenPondHostedChatTurn:S,publishedExperimentSource:z,standaloneExperimentOwner:oe})}),Qt=se.methods(["listProfileEvaluations","executeProfileEvaluationCase","executeExperimentCase","cancelExperimentCase","executeProfileEvaluationRun","prepareProfileEvaluationRun","runPreparedProfileEvaluation","runProfileEvaluationSuite","compareProfileEvaluationRuns","buildProfileEvaluationReport"]);D(()=>se.close());let ae=le(async()=>{let{createAppServerHarnessServices:o}=await import("./app-server-harness-services-N5F5QVZI.js");return o({store:c,storeDir:t,backgroundReview:l,harnessEvaluationEnabled:d,harnessEvaluationReviewStream:b,harnessTasksetReview:zt})}),Xt=ae.methods(["inspectHarness","reviewHarnessProposal","reviewHarness","acceptHarnessEvaluationReview","materializeHarnessEvaluationTaskset","runHarnessEvaluationBaseline","validateHarness","updateHarnessBackgroundReview","diffHarness","rollbackHarness","inspectRefiner","updateRefiner","activateRefiner","rollbackRefiner"]);D(()=>ae.close());let Yt=ze({ports:st({placement:"hosted_work",connectedAppProviders:w?void 0:[],featureOverrides:{harnessBackgroundReview:l,harnessProposalReview:l,harnessReview:d,harnessEvaluationReview:d,harnessEvaluationReviewAcceptance:d,harnessEvaluationTasksetMaterialization:d,harnessEvaluationBaseline:d,refinerProfiles:l,immutableRefinerAdmission:l},createSession:ke,getSession:C,turnsForSession:n(o=>g.turnsForSession(o,1e3),"turnsForSession"),runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession"),sendTurn:R.sendTurn,steerSessionTurn:R.steerSessionTurn,readTaskInbox:R.readTaskInbox,queueTaskInput:R.queueTaskInput,updateTaskInput:R.updateTaskInput,isSessionTurnActive:R.isSessionTurnActive,waitForSessionTurnSettlement:R.waitForSessionTurnSettlement,interruptSessionTurn:R.interruptSessionTurn,resolveApproval:Gt,listProfileWorkflows:Ae,loadProfileTrainingSource:n(async()=>{if(!e.profileSource||!A)throw new Error("An explicit published Profile is required for hosted training source export.");return(await import("./profile-training-source-VIND2MM2.js")).profileTrainingSource({release:A,storeDir:t})},"loadProfileTrainingSource"),...Qt,...Xt,subscribeRuntimeEvents:Ft,observeRuntimeOperation:n(o=>{i.info("agent runtime operation",o)},"observeRuntimeOperation")}),close:n(async()=>{Ee||(Ee=!0,await ve.close(),await Promise.all([se.close(),ae.close(),R.close()]),_?.close(),await Promise.all([he.drain(),we.drain(),Se.drain()]),await jt(),await c.close(),await i.flush())},"close")}),xe=Tr.filter(o=>(o!=="web_search"||!!p)&&(o!=="connected_apps"||!!w)&&(o!=="refiner"||l));return i.info("app-server ready",{storePath:c.storePath,workspaceDir:f,composition:xe}),{...Yt,updateSession:K,pinSessionHarness:n(async o=>{let m=await ce(c,await C(o));if(!m)return null;let E={id:m.release.harnessRelease.id,contentHash:m.release.harnessRelease.contentHash};return await ue({store:c,runId:o,workspace:m.workspace,harnessRelease:E,admittedAt:T()}),E},"pinSessionHarness"),storePath:c.storePath,workspaceDir:f,composition:xe}}n(Ar,"createOwnedAppServer");function xr(e,t){return{id:e||Me(t),name:q.basename(t)||"Sandbox workspace",description:null,visibility:"private",gitOwner:null,gitRepo:null,gitHost:null,defaultBranch:null,sandbox:!1,updatedAt:T(),latestDeployment:null}}n(xr,"workspaceApp");function br(e,t){return X({sessionId:e.sessionId??void 0,turnId:e.turnId??void 0,name:"diagnostic",source:"server",status:"failed",output:t instanceof Error?t.message:"Failed to persist model usage record.",data:{kind:"model_usage_record_failed",requestId:e.requestId,provider:e.provider,model:e.model}})}n(br,"runtimeDiagnostic");async function $(e,t,r){if(e!==!1)return e!==void 0?e:t?void 0:r()}n($,"selectService");export{ht as a,Wr as b,vt as c,yt as d,At as e,xt as f,ee as g,bt as h,Wt as i,Lt as j,qt as k,Tr as l,gn as m};
8
+ `)}n(It,"loadBundledAuthoringSkillBundle");async function _t(e,t=process.cwd(),r=process.execPath){let s=[x.resolve(t,"apps","cli","skills",e),x.resolve(t,"dist","skills",e),x.resolve(x.dirname(r),"skills",e),x.resolve(Et,"skills",e),x.resolve(Et,"..","skills",e)];for(let p of s)if(await cr(x.join(p,"SKILL.md")).then(()=>!0,()=>!1))return p;throw new Error(`Bundled OpenPond authoring skill ${e} was not found. Checked: ${s.join(", ")}`)}n(_t,"resolveBundledAuthoringSkillRoot");var Ht=24e3;function Wt(e){return[{name:"refiner_profile_inspect",description:"Inspect the separately versioned active Refiner Review Profile, its immutable release identity, and recent transitions. Use before editing Refiner behavior.",parameters:{type:"object",additionalProperties:!1,properties:{}},execute:n(async t=>I(t.callId,"refiner_profile_inspect",await(await import("./refiner-profile-service-56VYLZQJ.js")).inspectRefinerProfile(e.storeDir)),"execute")},{name:"refiner_profile_update",description:"Validate and write a complete JSON Refiner Review Profile as a new immutable Refiner release. Activation is explicit; normal Harness refinement never calls this tool.",parameters:{type:"object",additionalProperties:!1,properties:{profile:{type:"object",additionalProperties:!1,properties:{schemaVersion:{type:"string",const:"openpond.refinerReviewProfile.v1"},id:{type:"string",minLength:1,maxLength:120},version:{type:"string",minLength:1,maxLength:120},name:{type:"string",minLength:1,maxLength:200},objective:{type:"string",minLength:1,maxLength:1e4},instructions:{type:"array",maxItems:100,items:{type:"object",additionalProperties:!1,properties:{id:{type:"string",minLength:1,maxLength:120},text:{type:"string",minLength:1,maxLength:1e4}},required:["id","text"]}},allowedProposalRoutes:{type:"array",items:{type:"string",enum:["memory","prompt","skill","agent"]},maxItems:4},allowedExternalRoutes:{type:"array",items:{type:"string",enum:["runtime","product","taskset","training"]},maxItems:4}},required:["schemaVersion","id","version","name","objective","instructions","allowedProposalRoutes","allowedExternalRoutes"]},activate:{type:"boolean"},reason:{type:"string",minLength:1,maxLength:1e4}},required:["profile","activate","reason"]},execute:n(async t=>{let r=await ee("openpond-refiner-authoring");return I(t.callId,"refiner_profile_update",await(await import("./refiner-profile-service-56VYLZQJ.js")).updateRefinerProfile(e.storeDir,{profile:t.args.profile,activate:t.args.activate,reason:te(t.args.reason,1e4),actor:`work:${t.session.id}`,authoringSkillHash:r.sourceHash}))},"execute")},{name:"memory_search",description:"Search bounded active Personal Harness memory without loading the full memory corpus into context. Returns ranked stable memory keys and excerpts.",parameters:{type:"object",additionalProperties:!1,properties:{query:{type:"string",minLength:1,maxLength:500},limit:{type:"integer",minimum:1,maximum:20}},required:["query"]},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=te(t.args.query,500).toLowerCase(),p=[...new Set(s.split(/[^a-z0-9]+/).filter(l=>l.length>1))],h=typeof t.args.limit=="number"?Math.max(1,Math.min(20,Math.trunc(t.args.limit))):8,v=(await e.store.listHarnessMemories(r.workspace.id)).map(l=>{let d=`${l.key} ${l.tags.join(" ")} ${l.content}`.toLowerCase(),f=p.reduce((a,u)=>a+(d.includes(u)?1:0),0);return{entry:l,score:f}}).filter(({score:l})=>p.length===0||l>0).sort((l,d)=>d.score-l.score||d.entry.updatedAt.localeCompare(l.entry.updatedAt)).slice(0,h).map(({entry:l,score:d})=>({key:l.key,revision:l.revision,score:d,excerpt:l.content.slice(0,1e3),tags:l.tags,updatedAt:l.updatedAt}));return I(t.callId,"memory_search",{query:s,matches:v})},"execute")},{name:"memory_inspect",description:"Read one exact active Personal Harness memory entry returned by memory_search.",parameters:{type:"object",additionalProperties:!1,properties:{key:{type:"string",minLength:1,maxLength:120}},required:["key"]},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=te(t.args.key,120).toLowerCase(),p=await e.store.getHarnessMemory(r.workspace.id,s);if(!p||p.status!=="active")throw new Error(`Harness memory does not exist: ${s}.`);return I(t.callId,"memory_inspect",p)},"execute")},{name:"context_read",description:"Read a bounded slice of the current Agent run's canonical host-owned turns or runtime events. This never exposes other conversations or the whole history corpus.",parameters:{type:"object",additionalProperties:!1,properties:{scope:{type:"string",enum:["turns","events"]},limit:{type:"integer",minimum:1,maximum:50}},required:["scope"]},execute:n(async t=>{let r=typeof t.args.limit=="number"?Math.max(1,Math.min(50,Math.trunc(t.args.limit))):12;if(t.args.scope==="turns"){let s=await e.store.turnsForSession(t.session.id,r);return I(t.callId,"context_read",{scope:"turns",values:s.map(p=>Ot(p,6e3))})}if(t.args.scope==="events"){let s=await e.store.runtimeEventsForSession(t.session.id,{limit:r});return I(t.callId,"context_read",{scope:"events",values:s.map(p=>Ot(p,6e3))})}throw new Error("context_read scope must be turns or events.")},"execute")},{name:"harness_inspect",description:"Inspect the immutable Harness release pinned to this Agent run. With no path, returns its release, overlay, and component catalog. With a policy-visible text path, returns bounded exact source content.",parameters:{type:"object",additionalProperties:!1,properties:{path:{type:"string",minLength:1,description:"Optional exact Harness-relative source path from the returned catalog."}}},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness release is selected for this run.");let s=await e.store.getHarnessRunOverlay(t.session.id),p=N.join(r.release.bundlePath,"source"),h=je.parse(JSON.parse(await Ct.readFile(N.join(p,"harness.json"),"utf8"))),w=typeof t.args.path=="string"?t.args.path.trim().replaceAll("\\","/"):null,v=null;if(w){let l=h.files.find(f=>f.path===w);if(!l||l.visibility!=="policy")throw new Error(`Harness source is not policy-visible or declared: ${w}`);if(!l.mediaType.startsWith("text/")&&l.mediaType!=="application/json")throw new Error(`Harness source is not inspectable text: ${w}`);let d=await Ct.readFile(pr(p,w),"utf8");v={path:w,content:d.slice(0,Ht),truncated:d.length>Ht}}return I(t.callId,"harness_inspect",{workspace:{id:r.workspace.id,name:r.workspace.name,revision:r.workspace.revision,channel:r.workspace.currentChannel},pinnedRelease:{id:r.release.harnessRelease.id,contentHash:r.release.harnessRelease.contentHash,sourceRevision:r.release.sourceRevision},overlay:s?{id:s.id,revision:s.revision,status:s.status,contentHash:s.contentHash}:null,components:h.files.filter(l=>l.visibility==="policy").map(l=>({kind:l.kind,path:l.path,portability:l.portability})),source:v})},"execute")},{name:"skill_inspect",description:"Read one exact textual Skill from the immutable Harness release pinned to this run. Use this before asking the Refiner to update an existing Skill.",parameters:{type:"object",additionalProperties:!1,properties:{name:{type:"string",minLength:1,description:"Exact Skill name from harness_inspect."}},required:["name"]},execute:n(async t=>{let r=await M(e.store,t.session.id),s=typeof t.args.name=="string"?t.args.name.trim():"";if(!r?.skillRuntime.readSkill||!s)throw new Error("A valid Skill name and a selected Local Harness are required.");return I(t.callId,"skill_inspect",await r.skillRuntime.readSkill(s))},"execute")},{name:"refine_request",description:"Mark a concrete reusable lesson from the current turn for bounded Harness refinement at the next safe tool boundary. Immediate task recovery remains your responsibility. Do not call for one-off errors or transient facts.",parameters:{type:"object",additionalProperties:!1,properties:{summary:{type:"string",minLength:1,maxLength:2e3},suggestedRoute:{type:"string",enum:["runtime","memory","prompt","skill","agent","product","taskset","training"]}},required:["summary"]},execute:n(async t=>I(t.callId,"refine_request",{queuedAtBoundary:!0,summary:te(t.args.summary,2e3),suggestedRoute:typeof t.args.suggestedRoute=="string"?t.args.suggestedRoute:null}),"execute")},{name:"refine_status",description:"Inspect bounded Refiner trigger, proposal, route, validation, and outcome status for this Agent run.",parameters:{type:"object",additionalProperties:!1,properties:{}},execute:n(async t=>{let r=await M(e.store,t.session.id);if(!r)throw new Error("No Local Harness is selected for this run.");let s=n(async i=>e.store.listHarnessImprovementArtifacts(r.workspace.id,i,200),"all"),p=(await s("trigger_decision")).filter(i=>i.schemaVersion==="openpond.refinementTriggerDecision.v1").filter(i=>i.runRef===t.session.id),h=new Set(p.map(i=>U(i))),w=n(i=>h.has(U(fe(i.trigger))),"relatedToTrigger"),v=(await s("route_decision")).filter(i=>i.schemaVersion==="openpond.improvementRouteDecision.v1").filter(w),l=(await s("refiner_outcome")).filter(i=>i.schemaVersion==="openpond.harnessRefinerOutcome.v1").filter(w),d=new Set(l.flatMap(i=>{let c=fe(i.proposal);return c.id&&c.contentHash?[U(c)]:[]})),f=(await s("proposal")).filter(i=>i.schemaVersion==="openpond.harnessImprovementProposal.v1").filter(i=>d.has(U(i))),a=n(i=>d.has(U(fe(i.proposal))),"relatedToProposal"),u=[{kind:"trigger_decision",values:p},{kind:"route_decision",values:v},{kind:"proposal",values:f},{kind:"targeted_validation",values:(await s("targeted_validation")).filter(a)},{kind:"apply_receipt",values:(await s("apply_receipt")).filter(a)},{kind:"refiner_outcome",values:l}];return I(t.callId,"refine_status",{runId:t.session.id,artifacts:u})},"execute")}]}n(Wt,"createLocalHarnessModelToolDefinitions");function U(e){return`${String(e.id??"")}:${String(e.contentHash??"")}`}n(U,"artifactRefKey");function fe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}n(fe,"asRecord");function I(e,t,r){return{toolCallId:e,name:t,ok:!0,contentText:JSON.stringify(r),data:r}}n(I,"modelResult");function te(e,t){if(typeof e!="string"||!e.trim())throw new Error("A non-empty refinement summary is required.");return e.trim().slice(0,t)}n(te,"boundedText");function Ot(e,t){let r=JSON.stringify(e);return r.length<=t?e:{truncated:!0,json:r.slice(0,t)}}n(Ot,"boundedJson");function pr(e,t){let r=N.resolve(e),s=N.resolve(r,...t.split("/")),p=N.relative(r,s);if(!p||p.startsWith("..")||N.isAbsolute(p))throw new Error(`Harness source path escapes its release: ${t}`);return s}n(pr,"containedSourcePath");function Lt(){return{loadOpenPondProfileStateForRef:ie,executeProfileSkillCommand:n(({prompt:e,profileRef:t})=>kt(e,{loadProfileState:n(()=>ie(t),"loadProfileState")}),"executeProfileSkillCommand")}}n(Lt,"createProfileTurnDependencies");import{randomUUID as mr}from"node:crypto";import{setTimeout as fr}from"node:timers/promises";async function Dt(e,t){if(t.metadata?.titleSource||t.archived||t.hiddenFromDefaultSidebar)return t;let s=(await e.runtimeEventsForSession(t.id,{names:["session.title.updated"]})).at(-1)?.data,p=s?.session;if(s?.titleSource!=="fallback"||p?.title!==t.title)return t;let[h]=await e.runtimeEventsForSession(t.id,{names:["turn.started"],limit:1}),w=h?.turnId?await e.getTurn(h.turnId):null;return w?.prompt.trim()?await e.updateSession(t.id,v=>v.metadata?.titleSource||v.title!==t.title?v:{...v,metadata:{...v.metadata,titleSource:"fallback",autoTitle:{prompt:w.prompt.slice(0,2e4),title:v.title,attempts:0,nextAttemptAt:0}}})??t:t}n(Dt,"recoverTemporarySessionTitle");var ge="accounts/fireworks/models/deepseek-v4-flash",gr="off",hr=12e3,Mt=7,wr=["Make a concise conversation title from the user's message.","Return only the title: 3 to 7 words, plain text, sentence case.","Do not use quotation marks, markdown, labels, or ending punctuation."].join(" ");function Sr(e){let s=(e.replace(/<[^>]*>/gu," ").replace(/[\r\n]+/gu," ").replace(/\s+/gu," ").trim().match(/[\p{L}\p{N}][\p{L}\p{N}'’._/+:-]*/gu)??[]).slice(0,Mt).join(" ");return s?`${s.charAt(0).toUpperCase()}${s.slice(1)}`:"New conversation"}n(Sr,"fallbackSessionTitle");function vr(e){let r=e.replace(/<think>[\s\S]*?<\/think>/giu," ").replace(/^\s*(?:title|conversation title)\s*:\s*/iu,"").replace(/^[\s`"'“”‘’*_#-]+|[\s`"'“”‘’*_#.!?,;:-]+$/gu,"").replace(/[\r\n]+/gu," ").replace(/\s+/gu," ").trim().split(" ").filter(Boolean);return r.length<2?null:r.slice(0,Mt).join(" ")}n(vr,"generatedSessionTitle");function kr(e){return["Make a title from this request. Do not execute it.","<user_request>",e.slice(0,2e4),"</user_request>"].join(`
9
+ `)}n(kr,"titleRequestMessage");function Nt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;let t=e.autoTitlePrompt;return typeof t=="string"&&t.trim()?t.trim():null}n(Nt,"autoTitlePromptFromPayload");function yr(e){let t=Nt(e);if(!t||!e||typeof e!="object"||Array.isArray(e))return e;let r=e,s=r.metadata&&typeof r.metadata=="object"&&!Array.isArray(r.metadata)?r.metadata:{};return{...r,title:"",metadata:{...s,titleSource:"pending",autoTitle:{prompt:t.slice(0,2e4),title:"",attempts:0,nextAttemptAt:0}}}}n(yr,"withPendingAutoTitle");function re(e){if(!e||!["pending","fallback"].includes(String(e.metadata?.titleSource)))return null;let t=e.metadata?.autoTitle;return t&&typeof t.prompt=="string"&&t.title===e.title&&Number.isInteger(t.attempts)&&t.attempts>=0&&Number.isFinite(t.nextAttemptAt)?t:null}n(re,"pendingTitle");function qt(e){let t=new Map,r=null,s=new AbortController,p=[5e3,3e4];async function h(l){let d=new AbortController,f=setTimeout(()=>d.abort(new Error("session_title_generation_timeout")),hr);f.unref?.();let a="";try{for await(let i of e.stream({model:ge,messages:[{role:"system",content:wr},{role:"user",content:kr(l)}],reasoningEffort:gr,maxTokens:128,temperature:.2,requestId:`session-title-${mr()}`,signal:AbortSignal.any([d.signal,s.signal])}))i.type==="text_delta"&&i.text&&(a+=i.text);let u=vr(a);if(!u)throw new Error("session_title_generation_empty_response");return u}finally{clearTimeout(f)}}n(h,"generate");async function w(l){for(;!s.signal.aborted;){let d=re(await e.store.getSession(l));if(!d||d.attempts>=3)return;let f=d.nextAttemptAt-Date.now();f>0&&await fr(f,void 0,{signal:s.signal,ref:!1});let a=re(await e.store.getSession(l));if(!a||a.attempts!==d.attempts)return;let u,i="model";try{u=await h(d.prompt)}catch(k){if(s.signal.aborted)return;u=Sr(d.prompt),i="fallback",e.logger.warn("session title generation used temporary title",{error:k instanceof Error?k.message:String(k),model:ge,sessionId:l,attempt:d.attempts+1})}if(s.signal.aborted)return;let c=!1,g=await e.store.updateSession(l,k=>{let y=re(k);return!y||y.attempts!==d.attempts||y.prompt!==d.prompt?k:(c=!0,{...k,title:u,metadata:{...k.metadata,titleSource:i,autoTitle:i==="model"?null:{...d,title:u,attempts:d.attempts+1,nextAttemptAt:Date.now()+(p[d.attempts]??0)}}})});if(!c||!g||(await e.appendRuntimeEvent(X({sessionId:l,name:"session.title.updated",source:"server",status:"completed",data:{session:g,model:ge,titleSource:i}})),i==="model"))return}}n(w,"run");function v(l){if(s.signal.aborted)return Promise.resolve();let d=t.get(l);if(d)return d;let f=w(l).catch(a=>{s.signal.aborted||e.logger.warn("session title generation failed",{error:a instanceof Error?a.message:String(a),sessionId:l})}).finally(()=>t.delete(l));return t.set(l,f),f}return n(v,"schedule"),{wrapCreateSession(l){return this.recover().catch(d=>e.logger.warn("Session title recovery failed",{error:String(d)})),async d=>{let f=await l(yr(d));return Nt(d)&&v(f.id),f}},schedule:v,recover(){return r||(r=(async()=>{for(let l of await e.store.sessionShells()){if(s.signal.aborted)return;let d=await Dt(e.store,l);re(d)&&v(l.id)}})().finally(()=>{r=null}),r)},async close(){s.abort(),await r?.catch(()=>{}),await Promise.allSettled(t.values())}}}n(qt,"createSessionTitleService");var Er=3,Tr=["sqlite_store","runtime_event_bus","session_store","hosted_provider","web_search","connected_apps","workspace_tools","command_approvals","harness","refiner","agent_runtime","jsonl_transport"];async function gn(e={}){if(e.runtimeStorage)return(await import("./hosted-app-server-composition-LA3BZ4SE.js")).createHostedOwnedAppServer({...e,runtimeStorage:e.runtimeStorage});let t=q.resolve(e.storeDir??de());return Fe(t,()=>Ar({...e,storeDir:t}))}n(gn,"createOpenPondAppServer");async function Ar(e){let t=q.resolve(e.storeDir??de()),r=!!e.embedding;if(r&&!e.streamOpenPondHostedChatTurn)throw new Error("Embedded Work requires an explicit model-stream adapter.");let s=e.services??{},p=await $(s.webSearch,r,async()=>(await import("./web-search-ZEKJHZW4.js")).createWebSearchExecutorFromEnv()),h=await $(s.scheduling,r,async()=>(await import("./saved-work-KSIQPXC2.js")).createHostedSavedWork),w=await $(s.connectedApps,r,async()=>{let[o,m]=await Promise.all([import("./connected-app-executor-FGWCLOJO.js"),import("./app-server-connected-apps-TZOAUOYR.js")]);return{execute:o.createCloudConnectedAppToolExecutor(),list:m.listAppServerIntegrationConnections}}),v=await $(s.tasksets,r,async()=>(await import("./hosted-tasksets-NXVF4AQA.js")).executeHostedTasksetAction),l=s.backgroundReview??!r,d=!r&&!!v;await _e(t),l&&await(await import("./refiner-profile-service-56VYLZQJ.js")).initializeRefinerProfile(t);let f=q.resolve(e.workspaceDir??process.cwd());await Rr(f,{recursive:!0});let a=e.version??De,u=Ue(),i=Ve({channel:"app-server",logDir:q.join(t,"logs"),metadata:{version:a,runtimeVersion:u,placement:"hosted_work"}});D(()=>i.flush());let c=new pt(t,{logger:i});D(()=>c.close()),await c.recentTurns(1);let g=c,k=n(async()=>(await Ce(t)).preferences,"loadRuntimePreferences"),y=vt(t);(y.recovered||y.needsReview)&&i.warn("Scheduled work requires review after restart",y);let S=nt(e.streamOpenPondHostedChatTurn??Be,{enabled:ot()}),b=yt(S),{appendRuntimeEvent:P,closeEventSubscribers:jt,subscribeRuntimeEvents:Ft}=it({logger:i,store:g}),he=Y({queueId:"turn-follow-up",logger:i}),we=Y({queueId:"harness-refiner",logger:i}),Se=Y({queueId:"subagent",logger:i});if(e.harness&&e.profileSource)throw new Error("Configure either an explicit Harness source or Profile source for this app-server.");let A=null,z,oe;if(e.experimentHarnessSource){if(!e.experimentPolicyClient||e.profileSource||e.harness||e.runtimeStorage)throw new Error("A published standalone Experiment source requires its isolated policy owner and local case store.");let o=e.experimentHarnessSource.sourcePackage;z=await(await import("./published-experiment-source-SDXUVPE7.js")).installPublishedExperimentSource({store:c,storeDir:t,ownerId:e.experimentHarnessSource.ownerId,sourcePackage:o,reference:{harnessRelease:{id:o.harnessRelease.id,contentHash:o.harnessRelease.contentHash},agentSnapshot:{id:o.agentSnapshot.id,contentHash:o.agentSnapshot.contentHash},sourcePackageHash:o.contentHash},createdAt:T()})}if(e.profileSource){let o=e.profileSource;if(!o.repositoryId.trim()||!o.profileId.trim()||!o.sourceRevision.trim())throw new Error("Explicit Profile source requires an identity and accepted revision.");let m=await We({repoPath:o.repoPath,profileId:o.profileId});if(m.mode!=="local"||!m.sourcePath||m.error||m.git?.isRepo&&(m.git.head!==o.sourceRevision||m.git.dirty))throw new Error("Explicit Profile source does not match its accepted revision.");A=await Je({store:c,storeDir:t,workspaceId:`${Xe}${H({profileId:o.profileId,sourceRevision:o.sourceRevision}).slice(0,24)}`,ownerId:"desktop-personal",name:o.profileId,profile:m,sourceRevision:o.sourceRevision,repositoryId:o.repositoryId})}e.harness&&(await Ke({store:c,storeDir:t,sourceDir:e.harness.sourceDirectory,id:e.harness.workspaceId,name:e.harness.name,ownerId:"desktop-personal"}),await c.selectHarnessWorkspace({ownerKind:"personal",ownerId:"desktop-personal",workspaceId:e.harness.workspaceId,updatedAt:T()})),await Ge({store:c,storeDir:t,loadProfileState:L,now:T}).catch(o=>{i.warn("app-server Harness initialization failed",{error:o})});let V=rt({appendRuntimeEvent:P,findLocalProject:n(o=>lt(c,o),"findLocalProject"),onRepositoryInstructionDiagnostic:n((o,m)=>{i.warn("repository instruction file skipped",{diagnostic:o,sessionId:m.id})},"onRepositoryInstructionDiagnostic")}),{createSession:j,getSession:C,updateSession:K,completeTurn:Bt,failTurn:Ut,interruptTurn:$t}=dt({store:g,defaultSessionCwd:n(()=>f,"defaultSessionCwd"),appendRuntimeEvent:P,loadAppPreferences:k,loadLastUsedProfile:n(async()=>(await B()).lastUsed,"loadLastUsedProfile")}),ve=qt({appendRuntimeEvent:P,store:g,logger:i,stream:S}),ke=r?j:ve.wrapCreateSession(j),J=at({workspaceDir:f,logger:i,getSession:C,updateSession:K,appendRuntimeEvent:P,sandboxRequest:e.sandboxRequest??(r?async()=>{throw new Error("Sandbox execution is not configured in this app-server deployment.")}:void 0)}),zt=d?await(await import("./local-harness-taskset-review-XQHQ6JCR.js")).createLocalHarnessTasksetReviewControl({store:c,storeDir:t,evaluationRuntime:{streamOpenPondHostedChatTurn:S,workRuntime:{createSession:j,getSession:C,executeWorkspaceTool:J.executeWorkspaceTool,runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession")},resolveReleasedHarness:n(async()=>{let o=await Qe(c);return o?{agentSnapshot:o.release.agentSnapshot,harnessRelease:o.release.harnessRelease,instructionContext:o.instructionContext}:null},"resolveReleasedHarness")}}):void 0,ye=n(async o=>{await g.upsertApproval(o)},"upsertApproval"),Pe=et({upsertApproval:ye,appendRuntimeEvent:P}),Vt=await $(s.projectActions,r,async()=>(await import("./project-action-payload-LTIQBX77.js")).createProjectActionRunPayload({appendRuntimeEvent:P,resolveProjectRoot:n(async()=>null,"resolveProjectRoot")})),Kt=n(async o=>{try{await g.upsertModelUsageRecord(o)}catch(m){await P(br(o,m)).catch(()=>{})}},"safeUpsertModelUsageRecord"),Re=l?(await import("./local-harness-improvement-runtime-3YJQRYXC.js")).createLocalHarnessImprovementRuntime({store:c,storeDir:t,queue:we,streamOpenPondHostedChatTurn:S,appendRuntimeEvent:P,upsertModelUsageRecord:Kt}):void 0;await Re?.reconcilePending();let ne=e.profileExternalDataset?await(A&&e.profileExternalDatasetClient?(await import("./host-profile-external-dataset-KSEPXY2S.js")).createHostProfileExternalDataset({value:e.profileExternalDataset,release:A,sourceRevision:e.profileSource.sourceRevision,client:e.profileExternalDatasetClient}):Promise.reject(new Error("External Dataset execution requires an explicit private Profile source owner."))):null,Jt=$e({deviceId:`evaluation-${H(t).slice(0,24)}`,storeDir:t,runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession")}),_=A?(await import("./host-profile-evaluation-tools-UF4ATIUF.js")).createHostProfileEvaluationTools({storeDir:t,release:A,getTurn:n(o=>g.getTurn(o),"getTurn"),getSession:C,saveOutput:Jt.saveOwnedOutputBytes,recordOutput:n(async(o,m,E)=>{await P({id:Pr(),timestamp:new Date().toISOString(),name:"workspace_action_result",source:"server",sessionId:o,turnId:m,action:"work_output_save",status:"completed",output:`Saved ${E.outputRef.title} as immutable case output.`,data:E})},"recordOutput"),authorize:n(async o=>{if(ne){await ne.authorize(o);return}let m=await Te();if(!m||m.ref.profileId!==e.profileSource?.profileId||m.sourceRevision!==e.profileSource?.sourceRevision)throw new Error("The released evaluation source authority changed.");let E=await c.getHarnessReleaseRecord(A.harnessRelease.contentHash);if(!E||E.harnessRelease.contentHash!==A.harnessRelease.contentHash)throw new Error("The isolated evaluation release is unavailable.")},"authorize")}):null,G=e.embedding?gt(e.embedding,async(o,m)=>{let E=await g.getTurn(o);if(!E)throw new Error("Embedded turn is unavailable.");let O=await C(E.sessionId),F=O.metadata?.embeddingToolBindings,W=[...m].sort((Q,Zt)=>Q.name.localeCompare(Zt.name));if(F!==void 0&&H(F)!==H(W))throw new Error("Embedded tool bindings changed; start a new thread.");await K(O.id,{metadata:{...O.metadata,embeddingToolBindings:W}}),await g.updateTurn(o,Q=>({...Q,metadata:{...Q.metadata,toolBindings:W}}))}):void 0,R=ut({executionHost:r?"embedded":"local",storageHome:t,workInputsForSession:e.workInputsForSession,finalizeWorkTurn:e.finalizeWorkTurn,isolatedProfileEvaluationForTurn:_?async o=>{if(o.metadata?.profileEvaluationRun===void 0)return!1;if(!_.ownsSession(o.id))throw new Error("A Profile evaluation target has no actual admitted case owner.");return!0}:void 0,executeProfileEvaluationAction:_?.executeAction,resolveModelTools:e.resolveModelTools||_||G?async o=>{let m=_?_.ownsSession(o.session.id)?await _.resolveTools(o):await G?.(o)??[]:G?await G(o):o.tools;return e.resolveModelTools?e.resolveModelTools({...o,tools:m}):m}:void 0,...r?{hostedToolFlags:{toolMode:"native",nativeToolTransport:!0,nativeToolProviderDenylist:[],textToolFallback:!1}}:{},attachmentRootDir:q.join(t,"attachments"),store:g,inboxStore:c,createSession:j,upsertApproval:ye,getSession:C,updateSession:K,completeTurn:Bt,failTurn:Ut,interruptTurn:$t,defaultSessionCwd:n(()=>f,"defaultSessionCwd"),findOpenPondApp:n(async o=>xr(o,f),"findOpenPondApp"),resolveSessionWorkspaceCwd:n(async o=>o.cwd?.trim()||f,"resolveSessionWorkspaceCwd"),ensureCodexRuntime:n(async()=>{throw new Error("The hosted app-server placement uses the OpenPond provider; Codex process hosting is not configured.")},"ensureCodexRuntime"),appendWorkspaceDiffEvent:J.appendWorkspaceDiffEvent,workspaceDiffBaseline:J.workspaceDiffBaseline,appendRuntimeEvent:P,processHarnessImprovementBoundary:Re,executeWorkspaceTool:J.executeWorkspaceTool,executeOpenPondCommand:Pe.executeCommand,executeProjectAction:Vt,executeDatasetBuilderAction:v,loadOpenPondProfileState:L,...Lt(),...r||s.profileActions===!1?{executeProfileSkillCommand:void 0}:{},loadOpenPondProfileLibrary:B,readOpenPondProfileSkill:Oe,loadSelectedHarnessRuntime:n(o=>ce(c,o),"loadSelectedHarnessRuntime"),ensureHarnessRunOverlay:n(o=>ue({store:c,...o}),"ensureHarnessRunOverlay"),harnessModelTools:Wt({store:c,storeDir:t}).filter(o=>l||!["refiner_profile_inspect","refiner_profile_update","refine_request","refine_status"].includes(o.name)),loadBuiltInOpenPondSkills:n(async()=>[await mt(),...await xt()],"loadBuiltInOpenPondSkills"),readBuiltInOpenPondSkill:n(async o=>{if(o==="openpond-taskset-authoring")return ft();if(At(o))return bt(o);throw new Error(`Built-in OpenPond skill not found: ${o}`)},"readBuiltInOpenPondSkill"),executeWebSearch:p,createScheduledWork:h,executeConnectedAppTool:w?.execute,listIntegrationConnections:w?.list,loadPersonalizationSoul:n(async()=>(await tt(c,t)).soul,"loadPersonalizationSoul"),loadAppPreferences:k,maybeCreateScaffoldForTurn:V.maybeCreateScaffoldForTurn,hostedSystemPrompt:V.hostedSystemPrompt,appendAssistantText:V.appendAssistantText,appendHostedContextUsage:V.appendHostedContextUsage,streamOpenPondHostedChatTurn:S,turnFollowUpQueue:he,resolveSessionModelStream:ht(async(o,m)=>await oe?.resolveSessionModelStream(o,m)??await e.resolveSessionModelStream?.(o,m)??null),subagentQueue:Se,maxHostedWorkspaceToolRounds:e.experimentHarnessSource?(await import("./experiments-VOCZ4DW3.js")).STANDALONE_EXPERIMENT_MAX_POLICY_CALLS:ct(e.maxHostedWorkspaceToolRounds),maxRepeatedInvalidToolRequests:Er});D(()=>R.close()),await R.recoverPendingSubagentCompletions(),await R.recoverTaskInbox();async function Gt(o,m){let E=await R.resolveNativeAgentApproval(o,m);if(E)return E;let O=await Pe.resolveApproval(o,m);if(O)return O;let F=await R.resolveCreateImproveApproval(o,m);if(F)return F;let W=await R.resolveSubagentPatchApplyApproval(o,m);if(W)return W;throw new Error(`Approval not found: ${o}`)}n(Gt,"resolveApproval");let Ee=!1,Te=n(async()=>{if(e.profileSource)return{ref:{source:"openpond_git",repositoryId:e.profileSource.repositoryId,profileId:e.profileSource.profileId},sourceRevision:e.profileSource.sourceRevision};let[o,m]=await Promise.all([B(),L()]);return o.lastUsed&&m.git?.head&&!m.git.dirty?{ref:o.lastUsed,sourceRevision:m.git.head}:null},"selectedEvaluationProfile"),Ae=n(async()=>{if(e.profileSource&&A)return Ze({store:c,release:A,ref:{source:"openpond_git",repositoryId:e.profileSource.repositoryId,profileId:e.profileSource.profileId},sourceRevision:e.profileSource.sourceRevision});let[o,m]=await Promise.all([B(),L()]);if(!o.lastUsed)throw new Error("Select a Profile before loading its workflows.");return Ye({store:c,storeDir:t,ref:o.lastUsed,profile:m,reloadProfile:L})},"listProfileWorkflows");if(z){let o=z;oe=(await import("./standalone-experiment-turn-owner-TW5MTWIO.js")).createStandaloneExperimentTurnOwner({store:c,createSession:j,sendTurn:R.sendTurn,interruptSessionTurn:R.interruptSessionTurn,authorizeWorkspace:n(async(m,E)=>{if(E.id!==o.workspace.id||H(E.ownerScope)!==H(o.workspace.ownerScope)||m.sourcePackageHash!==o.workspace.metadata.experimentSourcePackageHash||m.harnessRelease.id!==o.release.harnessRelease.id||m.harnessRelease.contentHash!==o.release.harnessRelease.contentHash)throw new Error("Standalone Experiment source differs from this execution owner's admitted closure.")},"authorizeWorkspace")})}let se=le(async()=>{let{createAppServerEvaluations:o}=await import("./app-server-evaluations-RRLYWLPK.js");return o({options:e,store:c,storeDir:t,explicitProfileRelease:A,externalDataset:ne,isolatedProfileTools:_,selectedEvaluationProfile:Te,listProfileWorkflows:Ae,createSessionWithAutoTitle:ke,turnRunner:R,streamOpenPondHostedChatTurn:S,publishedExperimentSource:z,standaloneExperimentOwner:oe})}),Qt=se.methods(["listProfileEvaluations","executeProfileEvaluationCase","executeExperimentCase","cancelExperimentCase","executeProfileEvaluationRun","prepareProfileEvaluationRun","runPreparedProfileEvaluation","runProfileEvaluationSuite","compareProfileEvaluationRuns","buildProfileEvaluationReport"]);D(()=>se.close());let ae=le(async()=>{let{createAppServerHarnessServices:o}=await import("./app-server-harness-services-XXM336NU.js");return o({store:c,storeDir:t,backgroundReview:l,harnessEvaluationEnabled:d,harnessEvaluationReviewStream:b,harnessTasksetReview:zt})}),Xt=ae.methods(["inspectHarness","reviewHarnessProposal","reviewHarness","acceptHarnessEvaluationReview","materializeHarnessEvaluationTaskset","runHarnessEvaluationBaseline","validateHarness","updateHarnessBackgroundReview","diffHarness","rollbackHarness","inspectRefiner","updateRefiner","activateRefiner","rollbackRefiner"]);D(()=>ae.close());let Yt=ze({ports:st({placement:"hosted_work",connectedAppProviders:w?void 0:[],featureOverrides:{harnessBackgroundReview:l,harnessProposalReview:l,harnessReview:d,harnessEvaluationReview:d,harnessEvaluationReviewAcceptance:d,harnessEvaluationTasksetMaterialization:d,harnessEvaluationBaseline:d,refinerProfiles:l,immutableRefinerAdmission:l},createSession:ke,getSession:C,turnsForSession:n(o=>g.turnsForSession(o,1e3),"turnsForSession"),runtimeEventsForSession:n(o=>g.runtimeEventsForSession(o),"runtimeEventsForSession"),sendTurn:R.sendTurn,steerSessionTurn:R.steerSessionTurn,readTaskInbox:R.readTaskInbox,queueTaskInput:R.queueTaskInput,updateTaskInput:R.updateTaskInput,isSessionTurnActive:R.isSessionTurnActive,waitForSessionTurnSettlement:R.waitForSessionTurnSettlement,interruptSessionTurn:R.interruptSessionTurn,resolveApproval:Gt,listProfileWorkflows:Ae,loadProfileTrainingSource:n(async()=>{if(!e.profileSource||!A)throw new Error("An explicit published Profile is required for hosted training source export.");return(await import("./profile-training-source-VIND2MM2.js")).profileTrainingSource({release:A,storeDir:t})},"loadProfileTrainingSource"),...Qt,...Xt,subscribeRuntimeEvents:Ft,observeRuntimeOperation:n(o=>{i.info("agent runtime operation",o)},"observeRuntimeOperation")}),close:n(async()=>{Ee||(Ee=!0,await ve.close(),await Promise.all([se.close(),ae.close(),R.close()]),_?.close(),await Promise.all([he.drain(),we.drain(),Se.drain()]),await jt(),await c.close(),await i.flush())},"close")}),xe=Tr.filter(o=>(o!=="web_search"||!!p)&&(o!=="connected_apps"||!!w)&&(o!=="refiner"||l));return i.info("app-server ready",{storePath:c.storePath,workspaceDir:f,composition:xe}),{...Yt,updateSession:K,pinSessionHarness:n(async o=>{let m=await ce(c,await C(o));if(!m)return null;let E={id:m.release.harnessRelease.id,contentHash:m.release.harnessRelease.contentHash};return await ue({store:c,runId:o,workspace:m.workspace,harnessRelease:E,admittedAt:T()}),E},"pinSessionHarness"),storePath:c.storePath,workspaceDir:f,composition:xe}}n(Ar,"createOwnedAppServer");function xr(e,t){return{id:e||Me(t),name:q.basename(t)||"Sandbox workspace",description:null,visibility:"private",gitOwner:null,gitRepo:null,gitHost:null,defaultBranch:null,sandbox:!1,updatedAt:T(),latestDeployment:null}}n(xr,"workspaceApp");function br(e,t){return X({sessionId:e.sessionId??void 0,turnId:e.turnId??void 0,name:"diagnostic",source:"server",status:"failed",output:t instanceof Error?t.message:"Failed to persist model usage record.",data:{kind:"model_usage_record_failed",requestId:e.requestId,provider:e.provider,model:e.model}})}n(br,"runtimeDiagnostic");async function $(e,t,r){if(e!==!1)return e!==void 0?e:t?void 0:r()}n($,"selectService");export{ht as a,Wr as b,vt as c,yt as d,At as e,xt as f,ee as g,bt as h,Wt as i,Lt as j,qt as k,Tr as l,gn as m};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as w,d as h}from"./chunk-6HQUIKC5.js";import{c as f}from"./chunk-TGULVWPV.js";import{c as l,f as c}from"./chunk-BSHAIAXY.js";import{c as a}from"./chunk-3M53YXEI.js";import{d as u}from"./chunk-3WJQ4IGK.js";import{b as s}from"./chunk-GLUWATL5.js";import{a as i}from"./chunk-FTQLQJQV.js";import{readFile as p,stat as m}from"node:fs/promises";async function v(r,t=1048576){let o=a(r,"inputFile");if(!o)throw new Error("Provide --input-file with the exact reviewed request.");let e=await m(o);if(!e.isFile()||e.size>t)throw new Error(`The request must be a regular JSON file of at most ${t} bytes.`);let n=await p(o);if(n.byteLength>t)throw new Error("The request file grew beyond its byte allowance.");return JSON.parse(n.toString("utf8"))}i(v,"readEvaluationCommandInput");async function E(r){let t=a(r,"team");if(!t)throw new Error("Select --team for the evaluation owner.");if(r.local===!0||r.local==="true"){let e=new URL(a(r,"serverUrl")||w);if(e.protocol!=="http:"||!["localhost","127.0.0.1","[::1]"].includes(e.hostname)||e.username||e.password||e.search||e.hash||e.pathname!=="/")throw new Error("Local evaluation commands require an HTTP loopback server origin.");return{teamId:t,baseUrl:e.origin,apiKey:"local-capability",fetch:await h(e.origin)}}let o=await u();return{teamId:t,apiKey:await f(o,c(o)),baseUrl:l(r)??o.apiBaseUrl??s}}i(E,"evaluationCommandAccess");export{v as a,E as b};
2
+ import{c as h}from"./chunk-RFQD6B44.js";import{a as u,d as f}from"./chunk-R4EEGWXB.js";import{d as w}from"./chunk-RPM4FDRX.js";import{c as l,f as c}from"./chunk-BSHAIAXY.js";import{c as a}from"./chunk-3M53YXEI.js";import{b as s}from"./chunk-GLUWATL5.js";import{a as i}from"./chunk-FTQLQJQV.js";import{readFile as p,stat as m}from"node:fs/promises";async function v(r,t=1048576){let o=a(r,"inputFile");if(!o)throw new Error("Provide --input-file with the exact reviewed request.");let e=await m(o);if(!e.isFile()||e.size>t)throw new Error(`The request must be a regular JSON file of at most ${t} bytes.`);let n=await p(o);if(n.byteLength>t)throw new Error("The request file grew beyond its byte allowance.");return JSON.parse(n.toString("utf8"))}i(v,"readEvaluationCommandInput");async function E(r){let t=a(r,"team");if(!t)throw new Error("Select --team for the evaluation owner.");if(r.local===!0||r.local==="true"){let e=new URL(a(r,"serverUrl")||u);if(e.protocol!=="http:"||!["localhost","127.0.0.1","[::1]"].includes(e.hostname)||e.username||e.password||e.search||e.hash||e.pathname!=="/")throw new Error("Local evaluation commands require an HTTP loopback server origin.");return{teamId:t,baseUrl:e.origin,apiKey:"local-capability",fetch:await f(e.origin)}}let o=await w();return{teamId:t,apiKey:await h(o,c(o)),baseUrl:l(r)??o.apiBaseUrl??s}}i(E,"evaluationCommandAccess");export{v as a,E as b};
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{g as E,m as g,n as j}from"./chunk-CSU7RDA5.js";import{b as W}from"./chunk-L3KS6MOV.js";import{k as P}from"./chunk-4V73I4OL.js";import{e as A,f as x,g as D,l as I}from"./chunk-LE75SVEL.js";import{n as $}from"./chunk-RCT3O3HQ.js";import{a as v}from"./chunk-FTQLQJQV.js";import{randomUUID as H}from"node:crypto";import{promises as p}from"node:fs";import{stripTypeScriptTypes as M}from"node:module";import m from"node:path";async function Q(e){let r=A.parse(e.overlay),t=x.parse(e.proposal),o=e.validations.map(h=>D.parse(h));if((t.route==="agent"?t.edits.filter(h=>h.target!=="harness.json"&&h.operation!=="delete"):[]).length>0){let h=t.validationPlan.find(n=>n.kind==="component_activation"&&n.required);if(!h)throw new Error("Desktop Work Agent proposals require component-activation validation before review.");if(o.find(n=>n.validationId===h.id)?.status==="passed")throw new Error("Desktop Work cannot accept a passed Agent activation receipt until an Agent source executor exists.")}if(t.overlay.id!==r.id||t.overlay.revision!==r.revision||t.overlay.contentHash!==r.contentHash)throw new Error("Refiner proposal is not bound to the supplied run overlay.");if(r.status!=="frozen")throw new Error("Only a frozen run overlay can advance a Harness workspace.");let i=await e.store.getHarnessWorkspace(t.expectedWorkspace.workspaceId);if(!i)throw new Error(`Harness workspace ${t.expectedWorkspace.workspaceId} does not exist.`);if(i.location!==e.store.harnessStoragePlacement)throw new Error("Refiner workspace does not match the admitted storage placement.");let s=E(e.storeDir,i.id),l=await g({workspaceId:i.id,sourceDir:s.source});if(l.sourceRevision!==i.sourceRevision)throw new Error(`Harness source is ${l.sourceRevision}; workspace expects ${i.sourceRevision}. Record or revert the source change before refinement.`);let w=m.join(s.root,`.source-candidate-${H()}`);await p.cp(s.source,w,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{await V(w,t);let h=await g({workspaceId:i.id,sourceDir:w}),f=(e.now??(()=>new Date().toISOString()))(),n=await j({storeDir:e.storeDir,workspaceId:i.id,compiled:h,createdAt:f});await e.store.saveHarnessReleaseRecord(n),await e.store.saveHarnessImprovementArtifact(i.id,"run_overlay",r),await e.store.saveHarnessImprovementArtifact(i.id,"proposal",t);for(let a of o)await e.store.saveHarnessImprovementArtifact(i.id,"targeted_validation",a);if(!P({workspace:i,proposal:t}).eligible&&!e.reviewAuthority)return e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,now:f});let u=m.join(s.root,`.source-backup-${H()}`),c=m.join(s.root,"source-swap.json");await _(c,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:i.id,expectedWorkspaceRevision:i.revision,previousSourceRevision:i.sourceRevision,nextSourceRevision:n.sourceRevision,backupSource:u,candidateSource:w,createdAt:f}),await p.rename(s.source,u),await p.rename(w,s.source);try{let a=e.reviewAuthority?await e.store.advanceReviewedHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,reviewer:e.reviewAuthority.reviewer,now:f}):await e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,now:f});return a.receipt.decision!=="advanced"?await b(s.source,u):await p.rm(u,{recursive:!0,force:!0}),await p.rm(c,{force:!0}),a}catch(a){throw await b(s.source,u).catch(()=>{}),await p.rm(c,{force:!0}).catch(()=>{}),a}}finally{await p.rm(w,{recursive:!0,force:!0}).catch(()=>{})}}v(Q,"applyLocalHarnessRefinerProposal");async function X(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r||r.location!==e.store.harnessStoragePlacement)throw new Error(`Local Harness workspace ${e.workspaceId} does not exist.`);if(r.currentChannel.release?.id!==e.rollbackOf.id||r.currentChannel.release.contentHash!==e.rollbackOf.contentHash)throw new Error("Harness rollback source is no longer the current release.");let t=await e.store.getHarnessReleaseRecord(e.targetRelease.contentHash);if(!t||t.workspaceId!==r.id||t.harnessRelease.id!==e.targetRelease.id)throw new Error("Harness rollback target is unavailable in this workspace.");let o=E(e.storeDir,r.id);if((await g({workspaceId:r.id,sourceDir:o.source})).sourceRevision!==r.sourceRevision)throw new Error("Harness source changed before rollback.");let i=m.join(o.root,`.source-rollback-${H()}`);await p.cp(m.join(t.bundlePath,"source"),i,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{if((await g({workspaceId:r.id,sourceDir:i})).sourceRevision!==t.sourceRevision)throw new Error("Harness rollback bundle does not reproduce its registered source revision.");let l=(e.now??(()=>new Date().toISOString()))(),w=m.join(o.root,`.source-backup-${H()}`),h=m.join(o.root,"source-swap.json");await _(h,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:r.id,expectedWorkspaceRevision:r.revision,previousSourceRevision:r.sourceRevision,nextSourceRevision:t.sourceRevision,backupSource:w,candidateSource:i,createdAt:l}),await p.rename(o.source,w),await p.rename(i,o.source);try{let f=await e.store.rollbackHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:r.id,expectedWorkspaceRevision:r.revision,expectedChannelRevision:r.currentChannel.revision,targetRelease:e.targetRelease,targetSourceRevision:t.sourceRevision,rollbackOf:e.rollbackOf,now:l});return f.receipt.decision!=="rolled_back"?await b(o.source,w):await p.rm(w,{recursive:!0,force:!0}),await p.rm(h,{force:!0}),f}catch(f){throw await b(o.source,w).catch(()=>{}),await p.rm(h,{force:!0}).catch(()=>{}),f}}finally{await p.rm(i,{recursive:!0,force:!0}).catch(()=>{})}}v(X,"rollbackLocalHarnessWorkspaceRelease");async function Y(e){let r=x.parse(e.proposal);if(r.expectedWorkspace.workspaceId!==e.workspace.id)throw new Error("Refiner proposal targets a different Harness workspace.");if(r.route==="memory")return q({proposal:r,now:e.now});let t=E(e.storeDir,e.workspace.id),o=await g({workspaceId:e.workspace.id,sourceDir:t.source});if(o.sourceRevision!==r.expectedWorkspace.sourceRevision)throw new Error("Refiner proposal source revision no longer matches the Local Harness workspace.");let d=m.join(t.root,`.validation-candidate-${H()}`);await p.cp(t.source,d,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});let i=(e.now??(()=>new Date().toISOString()))();try{await V(d,r);let s=await g({workspaceId:e.workspace.id,sourceDir:d}),l=new Map(s.manifest.files.map(n=>[n.path,n])),w=new Map(r.edits.map(n=>[n.target,n])),h=O(o),f=O(s);return Promise.all(r.validationPlan.map(async n=>{let y="passed",u="The candidate Harness source compiles and preserves its manifest contract.";try{if(n.kind==="observed_recovery"){let c=r.evidence.filter(a=>a.kind==="recovery");if(c.length===0)throw new Error("Observed-recovery validation requires recorded recovery evidence.");u=`Validated ${c.length} immutable recovery evidence reference(s) before candidate advancement.`}else if(n.kind==="prompt"){let c=r.edits.filter(a=>a.route==="prompt"&&a.target!=="harness.json");if(c.length===0)throw new Error("Prompt validation requires an instruction-file edit.");for(let a of c){let k=l.get(a.target);if(a.operation==="delete"){if(k)throw new Error(`Deleted instruction ${a.target} remains declared.`)}else if(k?.kind!=="instruction")throw new Error(`Instruction ${a.target} is not declared in the candidate Harness.`);if(a.content!==null&&/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(a.content))throw new Error(`Instruction ${a.target} appears to contain credential material.`)}u=`Validated ${c.length} textual instruction edit(s) and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="skill"){let c=r.edits.filter(a=>a.route==="skill"&&a.target!=="harness.json");if(c.length===0)throw new Error("Skill validation requires a declared Skill-file edit.");for(let a of c){let k=l.get(a.target);if(a.operation==="delete"){if(k)throw new Error(`Deleted Skill ${a.target} remains declared.`);continue}if(k?.kind!=="skill")throw new Error(`Skill ${a.target} is not declared in the candidate Harness.`);let S=w.get(a.target)?.content;if(!S)throw new Error(`Skill edit ${a.target} has no content.`);let R=W(S);if(!R.name||!R.description||R.messages.length>0)throw new Error(`Skill ${a.target} is invalid: ${R.messages.join(" ")}`)}u=`Validated ${c.length} Skill edit(s), Skill frontmatter, and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="dependency"){let c=s.manifest.files.find(a=>a.kind==="dependency_lock");if(!c)throw new Error("Candidate Harness has no dependency lock.");JSON.parse(await p.readFile(T(d,c.path),"utf8")),u=`Validated dependency lock ${c.path} and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="schema")x.parse(r),u=`Validated proposal, manifest, and candidate release schemas for ${s.harnessRelease.id}.`;else if(n.kind==="package"){let c=r.edits.filter(a=>a.route==="agent"&&a.operation!=="delete"&&a.target!=="harness.json");for(let a of c){if(!a.content)throw new Error(`Agent edit ${a.target} has no source.`);M(a.content,{mode:"transform",sourceUrl:a.target,sourceMap:!1})}u=c.length>0?`Syntax-checked ${c.length} Agent source edit(s) and compiled candidate ${s.harnessRelease.id}.`:`Compiled candidate package ${s.harnessRelease.id} and preserved the Harness source manifest contract.`}else if(n.kind==="component_activation"){let c=r.edits.filter(a=>a.target!=="harness.json");if(c.length===0)throw new Error("Component activation requires a concrete Harness component edit.");if(r.route==="agent"){if(c.filter(k=>k.operation!=="delete").length>0)throw new Error("Desktop Work does not compile or execute released Agent source; use an active instruction or standalone Skill, or add an Agent executor before release.");u=`Confirmed ${c.length} deleted Agent component(s) were inactive in Desktop Work.`}else{if(!["prompt","skill"].includes(r.route))throw new Error(`Desktop Work has no activation policy for ${r.route} proposals.`);let a=r.route==="prompt"?"instruction":"skill";for(let k of c){let S=f.components.find(R=>R.path===k.target&&R.kind===a);if(k.operation==="delete"?S:!S)throw new Error(`${a} ${k.target} is not reflected in the candidate Desktop Work runtime surface.`)}if(h.contentHash===f.contentHash)throw new Error("The candidate does not change the effective Desktop Work runtime surface.");u=`Activated ${c.length} ${a} edit(s) in the candidate Desktop Work runtime surface.`}}else n.kind==="business_formula"?(y="blocked",u="Business or financial logic is retained for review until an approved deterministic fixture supplies inputs and expected outputs."):n.kind==="targeted_evaluation"?(y="blocked",u="This sensitive change requires an explicit authority-preserving targeted Evaluation before release."):n.kind==="file_render"?(y="blocked",u="File-render validation requires an exact produced artifact reference; no artifact was attached to this Harness-source proposal."):(y="blocked",u=`Local targeted validation does not yet own ${n.kind}; it requires its dedicated validator.`)}catch(c){y="failed",u=c instanceof Error?c.message:String(c)}return I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${n.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:n.id,kind:n.kind,status:y,summary:u,evidenceRefs:r.evidence,createdAt:i,metadata:{candidateHarnessRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},sourceRevision:s.sourceRevision,...n.kind==="component_activation"?{targetRuntime:"desktop_work",beforeEffectiveRuntimeHash:h.contentHash,afterEffectiveRuntimeHash:f.contentHash,activatedComponentRefs:f.components,inactiveAgentRefs:f.inactiveAgents}:{}}})}))}catch(s){let l=s instanceof Error?s.message:String(s);return r.validationPlan.map(w=>I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${w.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:w.id,kind:w.kind,status:"failed",summary:l,evidenceRefs:r.evidence,createdAt:i,metadata:{}}))}finally{await p.rm(d,{recursive:!0,force:!0}).catch(()=>{})}}v(Y,"validateLocalHarnessRefinerProposal");function O(e){let r=[...e.agentSnapshot.instructions.map(o=>({kind:"instruction",path:o.path,contentHash:o.contentHash})),...e.agentSnapshot.skills.map(o=>({kind:"skill",path:o.path,contentHash:o.contentHash}))].sort((o,d)=>o.path.localeCompare(d.path)),t=e.agentSnapshot.agents.map(o=>({path:o.path,contentHash:o.contentHash})).sort((o,d)=>o.path.localeCompare(d.path));return{contentHash:$({schemaVersion:"openpond.desktopWorkHarnessSurface.v1",components:r}),components:r,inactiveAgents:t}}v(O,"desktopWorkRuntimeSurface");function q(e){let r=(e.now??(()=>new Date().toISOString()))(),t=e.proposal.edits.find(o=>o.route==="memory");return e.proposal.validationPlan.map(o=>{let d="passed",i="Memory candidate is bounded, scoped, and contains no obvious credential material.";try{if(o.kind==="observed_recovery"){if(!e.proposal.evidence.some(s=>s.kind==="recovery"))throw new Error("Observed-recovery validation requires recorded recovery evidence.");i="Memory proposal is grounded in immutable recovery evidence."}else if(o.kind==="memory"){if(!t||!/^memory\/[a-z0-9][a-z0-9-]{0,119}$/.test(t.target))throw new Error("Memory proposal requires one safe memory/<slug> target.");let s=e.proposal.metadata.expectedMemory;if(!s||typeof s!="object"||Array.isArray(s))throw new Error("Memory proposal requires an expected revision snapshot.");let l=s;if(l.key!==C(t.target))throw new Error("Memory proposal expected revision targets a different key.");if(l.revision!==null&&(!Number.isInteger(l.revision)||Number(l.revision)<1))throw new Error("Memory proposal expected revision is invalid.");if(l.contentHash!==null&&typeof l.contentHash!="string")throw new Error("Memory proposal expected content hash is invalid.");if(l.status!==null&&l.status!=="active"&&l.status!=="deleted")throw new Error("Memory proposal expected status is invalid.");if(l.revision===null&&(l.contentHash!==null||l.status!==null))throw new Error("New memory snapshot must not claim existing content or status.");if(l.revision!==null&&(typeof l.contentHash!="string"||l.status===null))throw new Error("Existing memory snapshot requires its content hash and status.");if(t.operation==="delete"&&l.status!=="active")throw new Error("Memory deletion requires an active expected revision.");if(t.operation!=="delete"){if(!t.content?.trim()||t.content.length>24e3)throw new Error("Memory content must contain 1-24,000 characters.");if(/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(t.content))throw new Error("Memory content appears to contain credential material.")}}else d="blocked",i=`Memory validation cannot satisfy ${o.kind}.`}catch(s){d="failed",i=s instanceof Error?s.message:String(s)}return I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${e.proposal.id}-${o.id}`,proposal:{id:e.proposal.id,contentHash:e.proposal.contentHash},validationId:o.id,kind:o.kind,status:d,summary:i,evidenceRefs:e.proposal.evidence,createdAt:r,metadata:{externalState:"harness_memory"}})})}v(q,"validateMemoryProposal");function C(e){let r=e.replaceAll("\\","/"),t=/^memory\/([a-z0-9][a-z0-9-]{0,119})$/.exec(r);if(!t)throw new Error(`Invalid Harness memory target: ${e}.`);return t[1]}v(C,"memoryKeyFromTarget");async function Z(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r)throw new Error(`Harness workspace ${e.workspaceId} does not exist.`);let t=E(e.storeDir,r.id),o=m.join(t.root,"source-swap.json"),d=await p.readFile(o,"utf8").then(JSON.parse).catch(l=>{if(l.code==="ENOENT")return null;throw l});if(!d)return"none";let i=await g({workspaceId:r.id,sourceDir:t.source});if(r.sourceRevision===d.nextSourceRevision&&i.sourceRevision===d.nextSourceRevision)return await p.rm(d.backupSource,{recursive:!0,force:!0}),await p.rm(o,{force:!0}),"completed";let s=await g({workspaceId:r.id,sourceDir:d.backupSource});if(r.sourceRevision===d.previousSourceRevision&&s.sourceRevision===d.previousSourceRevision)return await b(t.source,d.backupSource),await p.rm(o,{force:!0}),"restored";throw new Error("Harness source-swap recovery cannot reconcile filesystem and workspace revisions.")}v(Z,"recoverLocalHarnessSourceSwap");async function V(e,r){for(let t of r.edits){let o=T(e,t.target);if(t.operation==="delete"){await p.rm(o,{force:!1});continue}if(t.content===null)throw new Error(`Refiner edit ${t.id} has no content.`);if(t.operation==="create")await p.mkdir(m.dirname(o),{recursive:!0}),await p.writeFile(o,t.content,{flag:"wx"});else{let d=await p.lstat(o);if(!d.isFile()||d.isSymbolicLink())throw new Error(`Refiner update target must be a regular file: ${t.target}`);await p.writeFile(o,t.content,{flag:"w"})}}}v(V,"applyOverlayEdits");function T(e,r){let t=m.resolve(e),o=m.resolve(t,...r.replaceAll("\\","/").split("/")),d=m.relative(t,o);if(!d||d.startsWith("..")||m.isAbsolute(d))throw new Error(`Refiner edit target escapes the Harness source: ${r}`);return o}v(T,"containedPath");async function _(e,r){let t=`${e}.${H()}.tmp`;await p.writeFile(t,`${JSON.stringify(r,null,2)}
2
+ import{g as E,m as g,n as j}from"./chunk-DKOVZ6R2.js";import{k as P}from"./chunk-4V73I4OL.js";import{e as D,f as x,g as W,l as I}from"./chunk-LE75SVEL.js";import{b as A}from"./chunk-L3KS6MOV.js";import{n as $}from"./chunk-RCT3O3HQ.js";import{a as v}from"./chunk-FTQLQJQV.js";import{randomUUID as H}from"node:crypto";import{promises as p}from"node:fs";import{stripTypeScriptTypes as M}from"node:module";import m from"node:path";async function Q(e){let r=D.parse(e.overlay),t=x.parse(e.proposal),o=e.validations.map(h=>W.parse(h));if((t.route==="agent"?t.edits.filter(h=>h.target!=="harness.json"&&h.operation!=="delete"):[]).length>0){let h=t.validationPlan.find(n=>n.kind==="component_activation"&&n.required);if(!h)throw new Error("Desktop Work Agent proposals require component-activation validation before review.");if(o.find(n=>n.validationId===h.id)?.status==="passed")throw new Error("Desktop Work cannot accept a passed Agent activation receipt until an Agent source executor exists.")}if(t.overlay.id!==r.id||t.overlay.revision!==r.revision||t.overlay.contentHash!==r.contentHash)throw new Error("Refiner proposal is not bound to the supplied run overlay.");if(r.status!=="frozen")throw new Error("Only a frozen run overlay can advance a Harness workspace.");let i=await e.store.getHarnessWorkspace(t.expectedWorkspace.workspaceId);if(!i)throw new Error(`Harness workspace ${t.expectedWorkspace.workspaceId} does not exist.`);if(i.location!==e.store.harnessStoragePlacement)throw new Error("Refiner workspace does not match the admitted storage placement.");let s=E(e.storeDir,i.id),l=await g({workspaceId:i.id,sourceDir:s.source});if(l.sourceRevision!==i.sourceRevision)throw new Error(`Harness source is ${l.sourceRevision}; workspace expects ${i.sourceRevision}. Record or revert the source change before refinement.`);let w=m.join(s.root,`.source-candidate-${H()}`);await p.cp(s.source,w,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{await V(w,t);let h=await g({workspaceId:i.id,sourceDir:w}),f=(e.now??(()=>new Date().toISOString()))(),n=await j({storeDir:e.storeDir,workspaceId:i.id,compiled:h,createdAt:f});await e.store.saveHarnessReleaseRecord(n),await e.store.saveHarnessImprovementArtifact(i.id,"run_overlay",r),await e.store.saveHarnessImprovementArtifact(i.id,"proposal",t);for(let a of o)await e.store.saveHarnessImprovementArtifact(i.id,"targeted_validation",a);if(!P({workspace:i,proposal:t}).eligible&&!e.reviewAuthority)return e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,now:f});let u=m.join(s.root,`.source-backup-${H()}`),c=m.join(s.root,"source-swap.json");await _(c,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:i.id,expectedWorkspaceRevision:i.revision,previousSourceRevision:i.sourceRevision,nextSourceRevision:n.sourceRevision,backupSource:u,candidateSource:w,createdAt:f}),await p.rename(s.source,u),await p.rename(w,s.source);try{let a=e.reviewAuthority?await e.store.advanceReviewedHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,reviewer:e.reviewAuthority.reviewer,now:f}):await e.store.advanceHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:i.id,proposal:t,validations:o,nextRelease:{id:n.harnessRelease.id,contentHash:n.harnessRelease.contentHash},nextSourceRevision:n.sourceRevision,now:f});return a.receipt.decision!=="advanced"?await b(s.source,u):await p.rm(u,{recursive:!0,force:!0}),await p.rm(c,{force:!0}),a}catch(a){throw await b(s.source,u).catch(()=>{}),await p.rm(c,{force:!0}).catch(()=>{}),a}}finally{await p.rm(w,{recursive:!0,force:!0}).catch(()=>{})}}v(Q,"applyLocalHarnessRefinerProposal");async function X(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r||r.location!==e.store.harnessStoragePlacement)throw new Error(`Local Harness workspace ${e.workspaceId} does not exist.`);if(r.currentChannel.release?.id!==e.rollbackOf.id||r.currentChannel.release.contentHash!==e.rollbackOf.contentHash)throw new Error("Harness rollback source is no longer the current release.");let t=await e.store.getHarnessReleaseRecord(e.targetRelease.contentHash);if(!t||t.workspaceId!==r.id||t.harnessRelease.id!==e.targetRelease.id)throw new Error("Harness rollback target is unavailable in this workspace.");let o=E(e.storeDir,r.id);if((await g({workspaceId:r.id,sourceDir:o.source})).sourceRevision!==r.sourceRevision)throw new Error("Harness source changed before rollback.");let i=m.join(o.root,`.source-rollback-${H()}`);await p.cp(m.join(t.bundlePath,"source"),i,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});try{if((await g({workspaceId:r.id,sourceDir:i})).sourceRevision!==t.sourceRevision)throw new Error("Harness rollback bundle does not reproduce its registered source revision.");let l=(e.now??(()=>new Date().toISOString()))(),w=m.join(o.root,`.source-backup-${H()}`),h=m.join(o.root,"source-swap.json");await _(h,{schemaVersion:"openpond.localHarnessSourceSwap.v1",workspaceId:r.id,expectedWorkspaceRevision:r.revision,previousSourceRevision:r.sourceRevision,nextSourceRevision:t.sourceRevision,backupSource:w,candidateSource:i,createdAt:l}),await p.rename(o.source,w),await p.rename(i,o.source);try{let f=await e.store.rollbackHarnessWorkspaceAtomically({receiptId:e.receiptId,workspaceId:r.id,expectedWorkspaceRevision:r.revision,expectedChannelRevision:r.currentChannel.revision,targetRelease:e.targetRelease,targetSourceRevision:t.sourceRevision,rollbackOf:e.rollbackOf,now:l});return f.receipt.decision!=="rolled_back"?await b(o.source,w):await p.rm(w,{recursive:!0,force:!0}),await p.rm(h,{force:!0}),f}catch(f){throw await b(o.source,w).catch(()=>{}),await p.rm(h,{force:!0}).catch(()=>{}),f}}finally{await p.rm(i,{recursive:!0,force:!0}).catch(()=>{})}}v(X,"rollbackLocalHarnessWorkspaceRelease");async function Y(e){let r=x.parse(e.proposal);if(r.expectedWorkspace.workspaceId!==e.workspace.id)throw new Error("Refiner proposal targets a different Harness workspace.");if(r.route==="memory")return q({proposal:r,now:e.now});let t=E(e.storeDir,e.workspace.id),o=await g({workspaceId:e.workspace.id,sourceDir:t.source});if(o.sourceRevision!==r.expectedWorkspace.sourceRevision)throw new Error("Refiner proposal source revision no longer matches the Local Harness workspace.");let d=m.join(t.root,`.validation-candidate-${H()}`);await p.cp(t.source,d,{recursive:!0,force:!1,errorOnExist:!0,verbatimSymlinks:!1});let i=(e.now??(()=>new Date().toISOString()))();try{await V(d,r);let s=await g({workspaceId:e.workspace.id,sourceDir:d}),l=new Map(s.manifest.files.map(n=>[n.path,n])),w=new Map(r.edits.map(n=>[n.target,n])),h=O(o),f=O(s);return Promise.all(r.validationPlan.map(async n=>{let y="passed",u="The candidate Harness source compiles and preserves its manifest contract.";try{if(n.kind==="observed_recovery"){let c=r.evidence.filter(a=>a.kind==="recovery");if(c.length===0)throw new Error("Observed-recovery validation requires recorded recovery evidence.");u=`Validated ${c.length} immutable recovery evidence reference(s) before candidate advancement.`}else if(n.kind==="prompt"){let c=r.edits.filter(a=>a.route==="prompt"&&a.target!=="harness.json");if(c.length===0)throw new Error("Prompt validation requires an instruction-file edit.");for(let a of c){let k=l.get(a.target);if(a.operation==="delete"){if(k)throw new Error(`Deleted instruction ${a.target} remains declared.`)}else if(k?.kind!=="instruction")throw new Error(`Instruction ${a.target} is not declared in the candidate Harness.`);if(a.content!==null&&/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(a.content))throw new Error(`Instruction ${a.target} appears to contain credential material.`)}u=`Validated ${c.length} textual instruction edit(s) and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="skill"){let c=r.edits.filter(a=>a.route==="skill"&&a.target!=="harness.json");if(c.length===0)throw new Error("Skill validation requires a declared Skill-file edit.");for(let a of c){let k=l.get(a.target);if(a.operation==="delete"){if(k)throw new Error(`Deleted Skill ${a.target} remains declared.`);continue}if(k?.kind!=="skill")throw new Error(`Skill ${a.target} is not declared in the candidate Harness.`);let S=w.get(a.target)?.content;if(!S)throw new Error(`Skill edit ${a.target} has no content.`);let R=A(S);if(!R.name||!R.description||R.messages.length>0)throw new Error(`Skill ${a.target} is invalid: ${R.messages.join(" ")}`)}u=`Validated ${c.length} Skill edit(s), Skill frontmatter, and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="dependency"){let c=s.manifest.files.find(a=>a.kind==="dependency_lock");if(!c)throw new Error("Candidate Harness has no dependency lock.");JSON.parse(await p.readFile(T(d,c.path),"utf8")),u=`Validated dependency lock ${c.path} and compiled candidate ${s.harnessRelease.id}.`}else if(n.kind==="schema")x.parse(r),u=`Validated proposal, manifest, and candidate release schemas for ${s.harnessRelease.id}.`;else if(n.kind==="package"){let c=r.edits.filter(a=>a.route==="agent"&&a.operation!=="delete"&&a.target!=="harness.json");for(let a of c){if(!a.content)throw new Error(`Agent edit ${a.target} has no source.`);M(a.content,{mode:"transform",sourceUrl:a.target,sourceMap:!1})}u=c.length>0?`Syntax-checked ${c.length} Agent source edit(s) and compiled candidate ${s.harnessRelease.id}.`:`Compiled candidate package ${s.harnessRelease.id} and preserved the Harness source manifest contract.`}else if(n.kind==="component_activation"){let c=r.edits.filter(a=>a.target!=="harness.json");if(c.length===0)throw new Error("Component activation requires a concrete Harness component edit.");if(r.route==="agent"){if(c.filter(k=>k.operation!=="delete").length>0)throw new Error("Desktop Work does not compile or execute released Agent source; use an active instruction or standalone Skill, or add an Agent executor before release.");u=`Confirmed ${c.length} deleted Agent component(s) were inactive in Desktop Work.`}else{if(!["prompt","skill"].includes(r.route))throw new Error(`Desktop Work has no activation policy for ${r.route} proposals.`);let a=r.route==="prompt"?"instruction":"skill";for(let k of c){let S=f.components.find(R=>R.path===k.target&&R.kind===a);if(k.operation==="delete"?S:!S)throw new Error(`${a} ${k.target} is not reflected in the candidate Desktop Work runtime surface.`)}if(h.contentHash===f.contentHash)throw new Error("The candidate does not change the effective Desktop Work runtime surface.");u=`Activated ${c.length} ${a} edit(s) in the candidate Desktop Work runtime surface.`}}else n.kind==="business_formula"?(y="blocked",u="Business or financial logic is retained for review until an approved deterministic fixture supplies inputs and expected outputs."):n.kind==="targeted_evaluation"?(y="blocked",u="This sensitive change requires an explicit authority-preserving targeted Evaluation before release."):n.kind==="file_render"?(y="blocked",u="File-render validation requires an exact produced artifact reference; no artifact was attached to this Harness-source proposal."):(y="blocked",u=`Local targeted validation does not yet own ${n.kind}; it requires its dedicated validator.`)}catch(c){y="failed",u=c instanceof Error?c.message:String(c)}return I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${n.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:n.id,kind:n.kind,status:y,summary:u,evidenceRefs:r.evidence,createdAt:i,metadata:{candidateHarnessRelease:{id:s.harnessRelease.id,contentHash:s.harnessRelease.contentHash},sourceRevision:s.sourceRevision,...n.kind==="component_activation"?{targetRuntime:"desktop_work",beforeEffectiveRuntimeHash:h.contentHash,afterEffectiveRuntimeHash:f.contentHash,activatedComponentRefs:f.components,inactiveAgentRefs:f.inactiveAgents}:{}}})}))}catch(s){let l=s instanceof Error?s.message:String(s);return r.validationPlan.map(w=>I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${r.id}-${w.id}`,proposal:{id:r.id,contentHash:r.contentHash},validationId:w.id,kind:w.kind,status:"failed",summary:l,evidenceRefs:r.evidence,createdAt:i,metadata:{}}))}finally{await p.rm(d,{recursive:!0,force:!0}).catch(()=>{})}}v(Y,"validateLocalHarnessRefinerProposal");function O(e){let r=[...e.agentSnapshot.instructions.map(o=>({kind:"instruction",path:o.path,contentHash:o.contentHash})),...e.agentSnapshot.skills.map(o=>({kind:"skill",path:o.path,contentHash:o.contentHash}))].sort((o,d)=>o.path.localeCompare(d.path)),t=e.agentSnapshot.agents.map(o=>({path:o.path,contentHash:o.contentHash})).sort((o,d)=>o.path.localeCompare(d.path));return{contentHash:$({schemaVersion:"openpond.desktopWorkHarnessSurface.v1",components:r}),components:r,inactiveAgents:t}}v(O,"desktopWorkRuntimeSurface");function q(e){let r=(e.now??(()=>new Date().toISOString()))(),t=e.proposal.edits.find(o=>o.route==="memory");return e.proposal.validationPlan.map(o=>{let d="passed",i="Memory candidate is bounded, scoped, and contains no obvious credential material.";try{if(o.kind==="observed_recovery"){if(!e.proposal.evidence.some(s=>s.kind==="recovery"))throw new Error("Observed-recovery validation requires recorded recovery evidence.");i="Memory proposal is grounded in immutable recovery evidence."}else if(o.kind==="memory"){if(!t||!/^memory\/[a-z0-9][a-z0-9-]{0,119}$/.test(t.target))throw new Error("Memory proposal requires one safe memory/<slug> target.");let s=e.proposal.metadata.expectedMemory;if(!s||typeof s!="object"||Array.isArray(s))throw new Error("Memory proposal requires an expected revision snapshot.");let l=s;if(l.key!==C(t.target))throw new Error("Memory proposal expected revision targets a different key.");if(l.revision!==null&&(!Number.isInteger(l.revision)||Number(l.revision)<1))throw new Error("Memory proposal expected revision is invalid.");if(l.contentHash!==null&&typeof l.contentHash!="string")throw new Error("Memory proposal expected content hash is invalid.");if(l.status!==null&&l.status!=="active"&&l.status!=="deleted")throw new Error("Memory proposal expected status is invalid.");if(l.revision===null&&(l.contentHash!==null||l.status!==null))throw new Error("New memory snapshot must not claim existing content or status.");if(l.revision!==null&&(typeof l.contentHash!="string"||l.status===null))throw new Error("Existing memory snapshot requires its content hash and status.");if(t.operation==="delete"&&l.status!=="active")throw new Error("Memory deletion requires an active expected revision.");if(t.operation!=="delete"){if(!t.content?.trim()||t.content.length>24e3)throw new Error("Memory content must contain 1-24,000 characters.");if(/\b(?:api[_-]?key|access[_-]?token|password|secret)\s*[:=]/i.test(t.content))throw new Error("Memory content appears to contain credential material.")}}else d="blocked",i=`Memory validation cannot satisfy ${o.kind}.`}catch(s){d="failed",i=s instanceof Error?s.message:String(s)}return I({schemaVersion:"openpond.harnessTargetedValidationReceipt.v1",id:`validation-${e.proposal.id}-${o.id}`,proposal:{id:e.proposal.id,contentHash:e.proposal.contentHash},validationId:o.id,kind:o.kind,status:d,summary:i,evidenceRefs:e.proposal.evidence,createdAt:r,metadata:{externalState:"harness_memory"}})})}v(q,"validateMemoryProposal");function C(e){let r=e.replaceAll("\\","/"),t=/^memory\/([a-z0-9][a-z0-9-]{0,119})$/.exec(r);if(!t)throw new Error(`Invalid Harness memory target: ${e}.`);return t[1]}v(C,"memoryKeyFromTarget");async function Z(e){let r=await e.store.getHarnessWorkspace(e.workspaceId);if(!r)throw new Error(`Harness workspace ${e.workspaceId} does not exist.`);let t=E(e.storeDir,r.id),o=m.join(t.root,"source-swap.json"),d=await p.readFile(o,"utf8").then(JSON.parse).catch(l=>{if(l.code==="ENOENT")return null;throw l});if(!d)return"none";let i=await g({workspaceId:r.id,sourceDir:t.source});if(r.sourceRevision===d.nextSourceRevision&&i.sourceRevision===d.nextSourceRevision)return await p.rm(d.backupSource,{recursive:!0,force:!0}),await p.rm(o,{force:!0}),"completed";let s=await g({workspaceId:r.id,sourceDir:d.backupSource});if(r.sourceRevision===d.previousSourceRevision&&s.sourceRevision===d.previousSourceRevision)return await b(t.source,d.backupSource),await p.rm(o,{force:!0}),"restored";throw new Error("Harness source-swap recovery cannot reconcile filesystem and workspace revisions.")}v(Z,"recoverLocalHarnessSourceSwap");async function V(e,r){for(let t of r.edits){let o=T(e,t.target);if(t.operation==="delete"){await p.rm(o,{force:!1});continue}if(t.content===null)throw new Error(`Refiner edit ${t.id} has no content.`);if(t.operation==="create")await p.mkdir(m.dirname(o),{recursive:!0}),await p.writeFile(o,t.content,{flag:"wx"});else{let d=await p.lstat(o);if(!d.isFile()||d.isSymbolicLink())throw new Error(`Refiner update target must be a regular file: ${t.target}`);await p.writeFile(o,t.content,{flag:"w"})}}}v(V,"applyOverlayEdits");function T(e,r){let t=m.resolve(e),o=m.resolve(t,...r.replaceAll("\\","/").split("/")),d=m.relative(t,o);if(!d||d.startsWith("..")||m.isAbsolute(d))throw new Error(`Refiner edit target escapes the Harness source: ${r}`);return o}v(T,"containedPath");async function _(e,r){let t=`${e}.${H()}.tmp`;await p.writeFile(t,`${JSON.stringify(r,null,2)}
3
3
  `,{flag:"wx"}),await p.rename(t,e)}v(_,"writeSwapJournal");async function b(e,r){await p.rm(e,{recursive:!0,force:!0}),await p.rename(r,e)}v(b,"restoreSource");export{Q as a,X as b,Y as c,Z as d};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{sc as a,vc as u,wc as h}from"./chunk-XHU4BZQY.js";import{Ra as l}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";var o=e.string().trim().min(1).max(240),S=e.object({projectId:o.optional(),search:e.string().max(300).optional(),kind:e.string().max(100).optional(),sort:e.enum(["name","type","version","projects","datasets","runs"]).optional(),direction:e.enum(["asc","desc"]).optional(),after:e.string().max(3e3).optional(),limit:e.number().int().min(1).max(100).default(30)}).strict(),v=e.object({teamId:o,items:e.array(e.object({reward:l,projects:e.number().int().nonnegative(),datasets:e.number().int().nonnegative(),runs:e.number().int().nonnegative()}).strict()).max(100),nextCursor:e.string().nullable()}).strict(),b=e.object({teamId:o,id:o,items:e.array(l).max(100),nextRevision:e.number().int().positive().nullable()}).strict(),g=e.object({section:e.enum(["projects","datasets","runs"]),after:o.optional(),limit:e.number().int().min(1).max(100).default(25)}).strict(),I=e.object({teamId:o,id:o,section:g.shape.section,items:e.array(e.union([e.object({id:o,name:e.string(),graderRevisions:e.array(e.number().int().positive()),archived:e.boolean()}).strict(),e.object({id:o,name:e.string(),revision:e.number().int().positive(),graderRevisions:e.array(e.number().int().positive())}).strict(),e.object({id:o,name:e.string(),status:e.string()}).strict()])).max(100),nextCursor:o.nullable()}).strict(),V=class{static{p(this,"OpenPondGraderInspectionClient")}constructor(n){this.options=n;let i=new URL(n.baseUrl);if(!["http:","https:"].includes(i.protocol)||i.username||i.password||i.search||i.hash||!n.apiKey.trim()||!n.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=i.toString().replace(/\/+$/,"")}options;baseUrl;async catalog(n={},i){let c=S.parse(n),t=v.parse(await this.read("",c,i));if(t.teamId!==this.options.teamId||t.items.length>c.limit||new Set(t.items.map(r=>r.reward.id)).size!==t.items.length)throw new Error("Grader catalog differs from its requested workspace or bounds.");return t}async versions(n,i={},c){let t=e.object({beforeRevision:e.number().int().positive().optional(),limit:e.number().int().min(1).max(100).default(25)}).strict().parse(i),r=b.parse(await this.read(`/${encodeURIComponent(o.parse(n))}/versions`,t,c));if(r.teamId!==this.options.teamId||r.id!==n||r.items.length>t.limit||r.items.some((d,m)=>d.id!==n||t.beforeRevision&&d.revision>=t.beforeRevision||m>0&&d.revision>=r.items[m-1].revision))throw new Error("Grader versions differ from their requested identity or revision order.");return r}async usage(n,i,c){let t=g.parse(i),r=I.parse(await this.read(`/${encodeURIComponent(o.parse(n))}/usage`,t,c));if(r.teamId!==this.options.teamId||r.id!==n||r.section!==t.section||r.items.length>t.limit)throw new Error("Grader usage differs from its requested workspace, identity or bounds.");return r}async read(n,i,c){let t=new URLSearchParams(Object.entries(i).filter(([,m])=>m!==void 0).map(([m,f])=>[m,String(f)])),r=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/learning/read/graders${n}?${t}`,{signal:c,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,Accept:"application/json"}}),d=await r.json();if(!r.ok)throw new Error(e.object({error:e.string()}).parse(d).error);return d}};var s=e.string().trim().min(1).max(500),w=e.object({id:s,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),N=e.object({teamId:s,modelId:s,runId:s.optional(),from:e.string().datetime().optional(),to:e.string().datetime().optional()}).strict(),F=e.discriminatedUnion("action",[e.object({action:e.literal("declare_verification"),teamId:s,operationId:s,plan:e.object({modelId:a.shape.modelId,classification:a.shape.classification,feedback:a.shape.feedback,evidence:a.shape.evidence,trainingJobId:a.shape.trainingJobId,checkpoint:a.shape.checkpoint,artifact:a.shape.artifact,taskset:a.shape.taskset,checks:a.shape.checks,baselineOperationId:a.shape.baselineOperationId,candidateOperationId:a.shape.candidateOperationId,criterion:a.shape.criterion}).strict()}).strict(),e.object({action:e.literal("link_live_opportunity"),teamId:s,operationId:s,correction:w,inferenceRequestId:s,grade:e.object({id:s,revision:e.number().int().positive()}).strict(),checkIds:e.array(s).min(1).max(1e3)}).strict()]),Q=e.object({summary:h.nullable(),observations:e.array(u).max(1e3)}).strict();export{S as a,g as b,V as c};
2
+ import{tc as a,wc as u,xc as h}from"./chunk-4PUOWSDE.js";import{Ra as l}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as p}from"./chunk-FTQLQJQV.js";var o=e.string().trim().min(1).max(240),S=e.object({projectId:o.optional(),search:e.string().max(300).optional(),kind:e.string().max(100).optional(),sort:e.enum(["name","type","version","projects","datasets","runs"]).optional(),direction:e.enum(["asc","desc"]).optional(),after:e.string().max(3e3).optional(),limit:e.number().int().min(1).max(100).default(30)}).strict(),v=e.object({teamId:o,items:e.array(e.object({reward:l,projects:e.number().int().nonnegative(),datasets:e.number().int().nonnegative(),runs:e.number().int().nonnegative()}).strict()).max(100),nextCursor:e.string().nullable()}).strict(),b=e.object({teamId:o,id:o,items:e.array(l).max(100),nextRevision:e.number().int().positive().nullable()}).strict(),g=e.object({section:e.enum(["projects","datasets","runs"]),after:o.optional(),limit:e.number().int().min(1).max(100).default(25)}).strict(),I=e.object({teamId:o,id:o,section:g.shape.section,items:e.array(e.union([e.object({id:o,name:e.string(),graderRevisions:e.array(e.number().int().positive()),archived:e.boolean()}).strict(),e.object({id:o,name:e.string(),revision:e.number().int().positive(),graderRevisions:e.array(e.number().int().positive())}).strict(),e.object({id:o,name:e.string(),status:e.string()}).strict()])).max(100),nextCursor:o.nullable()}).strict(),V=class{static{p(this,"OpenPondGraderInspectionClient")}constructor(n){this.options=n;let i=new URL(n.baseUrl);if(!["http:","https:"].includes(i.protocol)||i.username||i.password||i.search||i.hash||!n.apiKey.trim()||!n.teamId.trim())throw new Error("A clean API origin and workspace credentials are required.");this.baseUrl=i.toString().replace(/\/+$/,"")}options;baseUrl;async catalog(n={},i){let c=S.parse(n),t=v.parse(await this.read("",c,i));if(t.teamId!==this.options.teamId||t.items.length>c.limit||new Set(t.items.map(r=>r.reward.id)).size!==t.items.length)throw new Error("Grader catalog differs from its requested workspace or bounds.");return t}async versions(n,i={},c){let t=e.object({beforeRevision:e.number().int().positive().optional(),limit:e.number().int().min(1).max(100).default(25)}).strict().parse(i),r=b.parse(await this.read(`/${encodeURIComponent(o.parse(n))}/versions`,t,c));if(r.teamId!==this.options.teamId||r.id!==n||r.items.length>t.limit||r.items.some((d,m)=>d.id!==n||t.beforeRevision&&d.revision>=t.beforeRevision||m>0&&d.revision>=r.items[m-1].revision))throw new Error("Grader versions differ from their requested identity or revision order.");return r}async usage(n,i,c){let t=g.parse(i),r=I.parse(await this.read(`/${encodeURIComponent(o.parse(n))}/usage`,t,c));if(r.teamId!==this.options.teamId||r.id!==n||r.section!==t.section||r.items.length>t.limit)throw new Error("Grader usage differs from its requested workspace, identity or bounds.");return r}async read(n,i,c){let t=new URLSearchParams(Object.entries(i).filter(([,m])=>m!==void 0).map(([m,f])=>[m,String(f)])),r=await(this.options.fetch??fetch)(`${this.baseUrl}/v1/learning/read/graders${n}?${t}`,{signal:c,redirect:"error",headers:{Authorization:`Bearer ${this.options.apiKey}`,"X-OpenPond-Team-Id":this.options.teamId,Accept:"application/json"}}),d=await r.json();if(!r.ok)throw new Error(e.object({error:e.string()}).parse(d).error);return d}};var s=e.string().trim().min(1).max(500),w=e.object({id:s,contentHash:e.string().regex(/^[a-f0-9]{64}$/)}).strict(),N=e.object({teamId:s,modelId:s,runId:s.optional(),from:e.string().datetime().optional(),to:e.string().datetime().optional()}).strict(),F=e.discriminatedUnion("action",[e.object({action:e.literal("declare_verification"),teamId:s,operationId:s,plan:e.object({modelId:a.shape.modelId,classification:a.shape.classification,feedback:a.shape.feedback,evidence:a.shape.evidence,trainingJobId:a.shape.trainingJobId,checkpoint:a.shape.checkpoint,artifact:a.shape.artifact,taskset:a.shape.taskset,checks:a.shape.checks,baselineOperationId:a.shape.baselineOperationId,candidateOperationId:a.shape.candidateOperationId,criterion:a.shape.criterion}).strict()}).strict(),e.object({action:e.literal("link_live_opportunity"),teamId:s,operationId:s,correction:w,inferenceRequestId:s,grade:e.object({id:s,revision:e.number().int().positive()}).strict(),checkIds:e.array(s).min(1).max(1e3)}).strict()]),Q=e.object({summary:h.nullable(),observations:e.array(u).max(1e3)}).strict();export{S as a,g as b,V as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{wa as n}from"./chunk-5ZNE43XC.js";import{a}from"./chunk-FTQLQJQV.js";function l(i,e,s){i.exec("BEGIN IMMEDIATE");try{let o=i.get("SELECT content_hash, profile_id FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[e.id,e.revision]);if(o&&o.content_hash!==e.contentHash)throw new Error(`Taskset ${e.id}@${e.revision} is immutable and already has another content hash.`);let t=i.get("SELECT payload FROM tasksets WHERE id = ?",[e.id]),d=t?n.parse(JSON.parse(t.payload)):null;if(o&&o.profile_id!==e.profileId||d&&d.profileId!==e.profileId)throw new Error(`Taskset ${e.id} belongs to another Profile.`);let r=JSON.stringify(e);i.run(`INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at)
2
+ import{wa as n}from"./chunk-BU6MW65V.js";import{a}from"./chunk-FTQLQJQV.js";function l(i,e,s){i.exec("BEGIN IMMEDIATE");try{let o=i.get("SELECT content_hash, profile_id FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[e.id,e.revision]);if(o&&o.content_hash!==e.contentHash)throw new Error(`Taskset ${e.id}@${e.revision} is immutable and already has another content hash.`);let t=i.get("SELECT payload FROM tasksets WHERE id = ?",[e.id]),d=t?n.parse(JSON.parse(t.payload)):null;if(o&&o.profile_id!==e.profileId||d&&d.profileId!==e.profileId)throw new Error(`Taskset ${e.id} belongs to another Profile.`);let r=JSON.stringify(e);i.run(`INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at)
3
3
  VALUES (?, ?, ?, ?, ?, ?, ?, ?)
4
4
  ON CONFLICT(taskset_id, revision) DO UPDATE SET status = excluded.status, payload = excluded.payload, updated_at = excluded.updated_at`,[e.id,e.revision,e.contentHash,e.profileId,e.status,r,e.createdAt,e.updatedAt]),(!d||d.revision<=e.revision)&&i.run(`INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at)
5
5
  VALUES (?, ?, ?, ?, ?, ?)
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{t as _,w as C}from"./chunk-WGQ3FMRF.js";import{f as R,m}from"./chunk-HIQPGYVH.js";import{Sa as A}from"./chunk-ZY32SZ2P.js";import{A as e}from"./chunk-X2J2P5ZT.js";import{a as l}from"./chunk-FTQLQJQV.js";var u=e.string().trim().min(1).max(200),P=e.object({operationId:u,execution:R,executionKind:e.literal("recorded_evidence").optional(),graders:e.array(A).min(1).max(100),maximumCostUsd:e.number().finite().min(1e-6).max(1e4),mappings:e.array(e.object({graderId:u,fields:_}).strict()).max(100).optional()}).strict().superRefine((a,n)=>{new Set(a.graders.map(o=>o.id)).size!==a.graders.length&&n.addIssue({code:"custom",path:["graders"],message:"Select each grader once."}),a.mappings&&(new Set(a.mappings.map(o=>o.graderId)).size!==a.mappings.length||a.mappings.some(o=>!a.graders.some(c=>c.id===o.graderId)))&&n.addIssue({code:"custom",path:["mappings"],message:"Map each selected grader at most once."})}),q=e.object({schemaVersion:e.literal("openpond.experimentScoringPass.v1"),id:u,teamId:u,revision:e.number().int().positive(),request:P,graders:e.array(C).min(1).max(100),status:e.enum(["queued","running","cancelling","completed","failed","cancelled"]),totalCount:e.number().int().min(1).max(1e4),counts:e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),scored:e.number().int().nonnegative(),unavailable:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),cancelled:e.number().int().nonnegative()}).strict(),resultAvailable:e.boolean(),createdAt:e.iso.datetime(),startedAt:e.iso.datetime().nullable(),completedAt:e.iso.datetime().nullable(),error:e.object({code:u,message:e.string().max(2e3)}).strict().nullable()}).strict(),L=q.extend({contentHash:e.string().regex(/^[a-f0-9]{64}$/)});function O(a){let n=L.parse(a),{contentHash:o,...c}=n;if(m(c)!==o||Object.values(n.counts).reduce((r,d)=>r+d,0)!==n.totalCount)throw new Error("Scoring pass integrity or population accounting failed.");let t=["completed","failed","cancelled"].includes(n.status);if(t&&(!n.completedAt||n.counts.pending||n.counts.running)||!t&&(n.completedAt!==null||n.resultAvailable)||n.status==="completed"&&!n.resultAvailable)throw new Error("Scoring pass lifecycle differs from its retained result.");if(n.graders.length!==n.request.graders.length||new Set(n.graders.map(r=>r.feedbackKey)).size!==n.graders.length||n.graders.some((r,d)=>m(r.release)!==m(n.request.graders[d])||m(r.mappings??[])!==m(n.request.mappings?.find(f=>f.graderId===r.release?.id)?.fields??[])))throw new Error("Scoring pass graders differ from their exact admission.");return n}l(O,"verifyExperimentScoringPass");var I=8388608;async function B(a,n,o,c){let t=new AbortController,r=o.signal,d=l(()=>t.abort(r?.reason),"forward");r?.aborted?d():r?.addEventListener("abort",d,{once:!0});let f=setTimeout(()=>t.abort(new Error("Connected evidence request timed out.")),6e4),s,h=l(()=>{s&&s.cancel(t.signal.reason).catch(()=>{})},"abortReader");t.signal.addEventListener("abort",h,{once:!0});let v=new Promise((w,g)=>{let p=l(()=>g(t.signal.reason??new DOMException("Request aborted","AbortError")),"abort");t.signal.aborted?p():t.signal.addEventListener("abort",p,{once:!0})});try{let w=a(n,{...o,signal:t.signal}).then(i=>{if(t.signal.aborted)throw i.body?.cancel(t.signal.reason).catch(()=>{}),t.signal.reason;return i}),g=await Promise.race([w,v]),p=g.headers.get("content-length");if(s=g.body?.getReader(),t.signal.aborted)throw await s?.cancel(t.signal.reason),t.signal.reason;if(p&&Number(p)>I)throw await s?.cancel(),c(502,"connected_response_too_large","Connected evidence response exceeds 8 MiB.");let x=[],b=0;if(s)for(;;){let i=await Promise.race([s.read(),v]);if(i.done)break;if(b+=i.value.byteLength,b>I)throw await s.cancel(),c(502,"connected_response_too_large","Connected evidence response exceeds 8 MiB.");x.push(i.value)}let S=new Uint8Array(b),E=0;for(let i of x)S.set(i,E),E+=i.byteLength;let y;try{y=JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(S))}catch{throw c(502,"connected_response_invalid","Connected evidence response is not valid JSON.")}return{response:g,value:y}}finally{clearTimeout(f),r?.removeEventListener("abort",d),t.signal.removeEventListener("abort",h),s?.releaseLock()}}l(B,"fetchConnectedJson");export{P as a,O as b,B as c};
@@ -0,0 +1,2 @@
1
+ import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
+ import{b as U}from"./chunk-2PXKSAG6.js";import{L as q,Q as Z,W as $,ja as ee}from"./chunk-BU6MW65V.js";import{m as D}from"./chunk-HIQPGYVH.js";import{A as Y,D as x,x as X,y as V,z as I}from"./chunk-DXJC3QW7.js";import{a as W}from"./chunk-P4QM63L3.js";import{L as A,M as C,N as g,Q,o as K}from"./chunk-4PUOWSDE.js";import{Ra as N,Wa as J,bb as _,ga as O,ia as F,v as P,x as B}from"./chunk-ZY32SZ2P.js";import{A as n}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";var j=h(t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},"fields");function te(t){let e=t?.method==="sft"?t:void 0;return{schemaVersion:"openpond.sftRecipe.v1",method:"sft",parameterization:"lora",...e?.baseModel?{baseModel:e.baseModel}:{},dataset:{completionOnly:!0,maxSequenceLength:8192,selectionStrategy:"stable_hash_top_n",selectionSeed:17,...j(e?.dataset)},lora:{rank:16,alpha:32,dropout:0,targetModules:["q_proj","k_proj","v_proj","o_proj","gate_proj","up_proj","down_proj"],...j(e?.lora)},optimizer:{learningRate:1e-4,epochs:3,maxSteps:30,batchSize:1,gradientAccumulationSteps:1,seed:17,...j(e?.optimizer)},resourceLimits:{cpuThreads:4,memoryBytes:48*1024**3,wallTimeMs:3600*1e3,...j(e?.resourceLimits)}}}h(te,"createSupervisedTrainingRecipeDefaults");function S(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}h(S,"fields2");function re(t,e=t?.method==="sft"?"sft":"grpo"){if(e==="sft")return te(t);let r=t?.method==="grpo"?t:void 0,a={schemaVersion:"openpond.rftRecipe.v1",method:"grpo",parameterization:"lora",lora:{rank:2},rollout:{groupSize:8,concurrency:4,maxOutputTokens:1024,temperature:.8,topP:.95,seed:17},optimizer:{learningRate:1e-4,maxSteps:8,clipRange:.2,iterations:2,microbatchSize:1,gradientAccumulationSteps:8,advantageEpsilon:1e-8,adamw:{name:"adamw",weightDecay:0,beta1:.9,beta2:.999,epsilon:1e-8}},loss:{method:"grpo",klBeta:.01},resourceLimits:{wallTimeMs:3960*1e3,maxRollouts:64,maxPayloadBytes:1e6},policyOptimization:null};return{...a,...r,lora:{...a.lora,...S(r?.lora)},rollout:{...a.rollout,...S(r?.rollout)},optimizer:{...a.optimizer,...S(r?.optimizer),adamw:{...a.optimizer.adamw,...S(S(r?.optimizer).adamw)}},loss:{...a.loss,...S(r?.loss)},resourceLimits:{...a.resourceLimits,...S(r?.resourceLimits)}}}h(re,"createModelTrainingRecipeDefaults");function pe(t){let e=x.parse(t.setup),r=typeof t.package=="object"&&t.package!==null&&"schemaVersion"in t.package&&t.package.schemaVersion==="openpond.tasksetPackage.v1"?ee(t.package):null,a=r?null:$(t.package),s=r??a,l=e.tasksetRef;if(!(l&&l.revision===s.taskset.revision&&(r?l.id===r.taskset.id&&l.contentHash===r.taskset.contentHash||l.id===r.taskset.metadata.sourceTasksetId&&l.contentHash===r.taskset.metadata.sourceTasksetHash:l.id===s.taskset.id)))return e;!e.evaluationTasksetRef&&s.taskset.tasks.some(p=>p.split==="frozen_eval"||p.split==="validation")&&(e.evaluationTasksetRef=e.tasksetRef);let o=e.baseModel;if(e.method==="sft"){if(e.recipe&&e.recipe.method!=="sft"||!o?.revision||!o.tokenizerRevision||!o.chatTemplateHash)return e;let p=s.taskset.tasks.filter(b=>b.split==="train");if(!p.length)return e;let E=te(e.recipe),k=S(E.dataset),H=e.evaluationTasksetRef?.id===e.tasksetRef?.id&&e.evaluationTasksetRef?.contentHash===e.tasksetRef?.contentHash;if(!k.validationSplit&&!H)throw new Error("Choose the optimizer validation split from the selected evaluation dataset.");return x.parse({...e,recipe:U.parse({...E,baseModel:{id:o.modelId,revision:o.revision,tokenizerRevision:o.tokenizerRevision,chatTemplateHash:o.chatTemplateHash},dataset:{...k,trainSplit:"train",validationSplit:k.validationSplit??(s.taskset.tasks.some(b=>b.split==="frozen_eval")?"frozen_eval":"validation"),maxExamples:typeof k.maxExamples=="number"?Math.min(k.maxExamples,p.length):Math.min(1e3,p.length)}})})}if(e.method!=="grpo"||e.recipe&&e.recipe.method!=="grpo"||!o?.revision||!o.tokenizerRevision||!o.chatTemplateHash||e.recipe?.baseModel&&e.recipe.reward&&e.recipe.dataset)return e;let m=s.taskset.tasks.filter(p=>p.split==="train"),R=r?r.taskset.graders:_(a.rewardBinding,a.rewards),f=R.find(p=>p.rewardEligible&&p.weight>0),y=r?.environment??a?.executionResources?.environment??a?.execution?.environment;if(!m.length||!f||!y)return e;let M=re(e.recipe);return x.parse({...e,recipe:{...M,baseModel:{id:o.modelId,revision:o.revision,tokenizerRevision:o.tokenizerRevision,chatTemplateHash:o.chatTemplateHash},dataset:{trainSplit:"train",validationSplit:s.taskset.tasks.some(p=>p.split==="frozen_eval")?"frozen_eval":"validation",maxPromptTokens:4096,maxExamples:Math.min(1e3,m.length),selectionStrategy:"stable_hash_top_n",...S(M.dataset)},rollout:{maxTurns:s.taskset.environment.kind==="text"?1:15,...S(M.rollout)},reward:{graderId:f.id,graderHash:D(R),environmentId:y.id,environmentVersion:String(y.revision),toolContractHash:D(s.taskset.tools),learnedPreference:S(M.reward).learnedPreference??null}}})}h(pe,"prepareModelTrainingDefaults");var T=n.string().trim().min(1).max(500),v=X,ae=n.object({schemaVersion:n.literal("openpond.modelStarter.v1"),id:T,revision:n.number().int().positive(),name:n.string().trim().min(1).max(200),description:n.string().trim().min(1).max(2e3),category:n.enum(["extraction","support","operations","knowledge","coding","writing","classification"]),taskset:v,taskDefinition:v,rewardBinding:v,rewards:n.array(v).min(1).max(100),assets:n.array(v).max(1e3),previewTaskIds:n.array(T).min(1).max(8),startingModel:V,supportedMethods:n.array(I).min(1).max(8),defaultMethod:I,provenance:n.object({author:n.string().min(1).max(200),license:n.string().min(1).max(200),sourceDescription:n.string().min(1).max(2e3)}).strict(),evidence:n.object({verifierFixtures:v.nullable(),baseline:v.nullable(),training:v.nullable(),evaluation:v.nullable()}).strict()}).strict().superRefine((t,e)=>{t.supportedMethods.includes(t.defaultMethod)||e.addIssue({code:"custom",path:["defaultMethod"],message:"The default method must be supported by the package."});for(let r of["rewards","assets"])new Set(t[r].map(a=>a.id)).size!==t[r].length&&e.addIssue({code:"custom",path:[r],message:"Dependency identities must be unique."});new Set(t.previewTaskIds).size!==t.previewTaskIds.length&&e.addIssue({code:"custom",path:["previewTaskIds"],message:"Preview tasks must be unique."})}),ie=ae.safeExtend({contentHash:n.string().regex(/^[a-f0-9]{64}$/)}),oe=n.object({starter:ie,taskset:O,taskDefinition:K,rewardBinding:J,rewards:n.array(N).min(1).max(100),assets:n.array(Q).max(1e3),execution:q.optional()}).strict(),ne=n.object({schemaVersion:n.literal("openpond.modelStarterPrivacyReview.v1"),disposition:n.literal("synthetic_only"),reviewedBy:n.string().trim().min(1).max(500),reviewedAt:n.iso.datetime(),reviewedContentHash:n.string().regex(/^[a-f0-9]{64}$/),note:n.string().trim().min(1).max(2e3)}).strict();function se(t){let{contentHash:e,...r}=t.starter,{contentHash:a,...s}=t.taskset,{contentHash:l,...c}=r.taskset,o={...s.metadata},m=o.starterAuthoring;if(m&&typeof m=="object"&&!Array.isArray(m)){let{privacyReview:R,...f}=m;o.starterAuthoring=f}return g({...t,starter:{...r,taskset:c},taskset:{...s,metadata:o}}).contentHash}h(se,"modelStarterPrivacyContentHash");var de=n.object({profileId:T,modelId:T,name:n.string().trim().min(1).max(200),starter:v,startingModel:V,method:I,rewardBindingRef:v.nullable().optional(),recipe:Y.nullable().optional(),managedGpuSelection:x.shape.managedGpuSelection,continuationAdapterMode:x.shape.continuationAdapterMode,learning:W.optional()}).strict(),ce=de.extend({schemaVersion:n.literal("openpond.modelStarterCreation.v1"),operationId:T}).strict();function le(t){return P(t,64*1024),ce.parse(t)}h(le,"parseModelStarterCreationRequest");function ue(t,e){let r=le(t),a=L(e);if(!C(r.starter,A(a.starter)))throw new Error("Starter creation references a different package revision.");if(!a.starter.supportedMethods.includes(r.method))throw new Error("The selected training method is not supported by this starter.");return{request:r,resolved:a}}h(ue,"validateModelStarterCreation");function he(t){let{starter:e,taskset:r,taskDefinition:a,rewardBinding:s,rewards:l}=L(t);return{starter:e,inputSchema:a.inputSchema,outputSchema:a.outputSchema,reward:{name:s.name,description:s.description,checks:s.sources.map(c=>{let o=l.find(m=>C(c.reward,A(m)));return{name:o.name,description:o.description,kind:o.implementation.kind,role:c.role,weight:c.weight,required:c.required,hardGate:c.hardGate}})},tasks:e.previewTaskIds.map(c=>{let o=r.tasks.find(m=>m.id===c);return{id:o.id,input:o.input,policyVisibleContext:o.policyVisibleContext}}),counts:{train:r.tasks.filter(c=>c.split==="train").length,validation:r.tasks.filter(c=>c.split==="validation").length,frozenEvaluation:r.tasks.filter(c=>c.split==="frozen_eval").length}}}h(he,"previewModelStarter");function L(t){P(t,16*1024*1024);let e=oe.parse(t),{starter:r,taskset:a,taskDefinition:s,rewardBinding:l,rewards:c,assets:o}=e,m=a.metadata.starterAuthoring;if(m&&typeof m=="object"&&!Array.isArray(m)&&"privacyReview"in m&&ne.parse(m.privacyReview).reviewedContentHash!==se(e))throw new Error("Starter privacy review differs from the published contents.");let R=[r,a,s,l,...c,...o];for(let i of R){let{contentHash:d,...u}=i;if(g(u).contentHash!==d)throw new Error(`Starter resource integrity failed: ${i.id}.`)}F(a),Z(e.execution,a,o);function f(i,d){if(!C(i,A(d)))throw new Error(`Starter dependency mismatch: ${i.id}.`)}if(h(f,"exact"),f(r.taskset,a),f(r.taskDefinition,s),f(r.rewardBinding,l),f(s.rewardBinding,l),l.recipeRef)throw new Error("Starter binding recipes must be resolved into a standalone binding before publication.");let{policy:y,environment:M,environmentRelease:p,tools:E,capabilities:k,verifierSetRelease:H}=a,b={policy:y,environment:M,...p?{environmentRelease:p}:{},tools:E,capabilities:k,...H?{verifierSetRelease:H}:{}};if(g(b).contentHash!==g(s.execution).contentHash)throw new Error("Starter execution context differs from its task format.");if(g({graders:a.graders}).contentHash!==g({graders:_(l,c)}).contentHash)throw new Error("Starter executable graders differ from its Reward binding.");for(let[i,d]of[[r.rewards,c],[r.assets,o]]){if(i.length!==d.length||new Set(d.map(u=>u.id)).size!==d.length)throw new Error("Starter dependency inventory mismatch.");for(let u of i){let w=d.find(z=>z.id===u.id);if(!w)throw new Error(`Starter dependency is missing: ${u.id}.`);f(u,w)}}for(let i of l.sources){let d=c.find(u=>u.id===i.reward.id);if(!d)throw new Error(`Starter Reward is missing: ${i.reward.id}.`);f(i.reward,d)}for(let i of c){let d=i.implementation,u=[...i.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]];for(let w of u){let z=o.find(me=>me.id===w.id);if(!z||g(z.asset).contentHash!==g(w).contentHash)throw new Error(`Starter Reward source is missing or changed: ${w.id}.`);if(w.visibility==="policy")throw new Error(`Starter Reward source must remain private to its evaluator: ${w.id}.`)}}if(new Set(a.tasks.map(i=>i.id)).size!==a.tasks.length)throw new Error("Starter task identities must be unique.");let G=new Map;for(let i of a.tasks){if(i.policyVisibleContext.instructions!==s.instructions)throw new Error(`Starter task does not carry its declared model instructions: ${i.id}.`);let d=g({input:i.input,context:i.policyVisibleContext}).contentHash,u=G.get(d);if(u&&u!==i.split)throw new Error("Starter policy input appears in multiple splits.");if(G.set(d,i.split),!B(s.inputSchema,i.input).valid)throw new Error(`Starter task input does not match its format: ${i.id}.`);if(i.expectedOutput!==null&&!B(s.outputSchema,i.expectedOutput).valid)throw new Error(`Starter expected output does not match its format: ${i.id}.`)}for(let i of r.previewTaskIds){let d=a.tasks.find(u=>u.id===i);if(!d||d.split==="frozen_eval")throw new Error(`Starter preview task is unavailable: ${i}.`)}return e}h(L,"validateResolvedModelStarter");export{pe as a,ie as b,ne as c,le as d,ue as e,he as f,L as g};